PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
gutenberg / build / routes / experiments-home / content.js

content.js in Gutenberg trunk, at build/routes/experiments-home/content.js

29,600 lines 1.1 MB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var __create = Object.create;
2 var __defProp = Object.defineProperty;
3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4 var __getOwnPropNames = Object.getOwnPropertyNames;
5 var __getProtoOf = Object.getPrototypeOf;
6 var __hasOwnProp = Object.prototype.hasOwnProperty;
7 var __commonJS = (cb, mod) => function __require() {
8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9 };
10 var __export = (target, all) => {
11 for (var name in all)
12 __defProp(target, name, { get: all[name], enumerable: true });
13 };
14 var __copyProps = (to, from, except, desc) => {
15 if (from && typeof from === "object" || typeof from === "function") {
16 for (let key of __getOwnPropNames(from))
17 if (!__hasOwnProp.call(to, key) && key !== except)
18 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19 }
20 return to;
21 };
22 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23 // If the importer is in node compatibility mode or this is not an ESM
24 // file that has been converted to a CommonJS file using a Babel-
25 // compatible transform (i.e. "__esModule" has not been set), then set
26 // "default" to the CommonJS "module.exports" for node compatibility.
27 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28 mod
29 ));
30
31 // package-external:@wordpress/i18n
32 var require_i18n = __commonJS({
33 "package-external:@wordpress/i18n"(exports, module) {
34 module.exports = window.wp.i18n;
35 }
36 });
37
38 // package-external:@wordpress/element
39 var require_element = __commonJS({
40 "package-external:@wordpress/element"(exports, module) {
41 module.exports = window.wp.element;
42 }
43 });
44
45 // vendor-external:react
46 var require_react = __commonJS({
47 "vendor-external:react"(exports, module) {
48 module.exports = window.React;
49 }
50 });
51
52 // vendor-external:react/jsx-runtime
53 var require_jsx_runtime = __commonJS({
54 "vendor-external:react/jsx-runtime"(exports, module) {
55 module.exports = window.ReactJSXRuntime;
56 }
57 });
58
59 // vendor-external:react-dom
60 var require_react_dom = __commonJS({
61 "vendor-external:react-dom"(exports, module) {
62 module.exports = window.ReactDOM;
63 }
64 });
65
66 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
67 var require_use_sync_external_store_shim_development = __commonJS({
68 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
69 "use strict";
70 (function() {
71 function is(x2, y2) {
72 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
73 }
74 function useSyncExternalStore$2(subscribe, getSnapshot) {
75 didWarnOld18Alpha || void 0 === React103.startTransition || (didWarnOld18Alpha = true, console.error(
76 "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
77 ));
78 var value = getSnapshot();
79 if (!didWarnUncachedGetSnapshot) {
80 var cachedValue = getSnapshot();
81 objectIs(value, cachedValue) || (console.error(
82 "The result of getSnapshot should be cached to avoid an infinite loop"
83 ), didWarnUncachedGetSnapshot = true);
84 }
85 cachedValue = useState34({
86 inst: { value, getSnapshot }
87 });
88 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
89 useLayoutEffect4(
90 function() {
91 inst.value = value;
92 inst.getSnapshot = getSnapshot;
93 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
94 },
95 [subscribe, value, getSnapshot]
96 );
97 useEffect30(
98 function() {
99 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
100 return subscribe(function() {
101 checkIfSnapshotChanged(inst) && forceUpdate({ inst });
102 });
103 },
104 [subscribe]
105 );
106 useDebugValue2(value);
107 return value;
108 }
109 function checkIfSnapshotChanged(inst) {
110 var latestGetSnapshot = inst.getSnapshot;
111 inst = inst.value;
112 try {
113 var nextValue = latestGetSnapshot();
114 return !objectIs(inst, nextValue);
115 } catch (error2) {
116 return true;
117 }
118 }
119 function useSyncExternalStore$1(subscribe, getSnapshot) {
120 return getSnapshot();
121 }
122 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
123 var React103 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState34 = React103.useState, useEffect30 = React103.useEffect, useLayoutEffect4 = React103.useLayoutEffect, useDebugValue2 = React103.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
124 exports.useSyncExternalStore = void 0 !== React103.useSyncExternalStore ? React103.useSyncExternalStore : shim;
125 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
126 })();
127 }
128 });
129
130 // node_modules/use-sync-external-store/shim/index.js
131 var require_shim = __commonJS({
132 "node_modules/use-sync-external-store/shim/index.js"(exports, module) {
133 "use strict";
134 if (false) {
135 module.exports = null;
136 } else {
137 module.exports = require_use_sync_external_store_shim_development();
138 }
139 }
140 });
141
142 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
143 var require_with_selector_development = __commonJS({
144 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
145 "use strict";
146 (function() {
147 function is(x2, y2) {
148 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
149 }
150 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
151 var React103 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef51 = React103.useRef, useEffect30 = React103.useEffect, useMemo41 = React103.useMemo, useDebugValue2 = React103.useDebugValue;
152 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
153 var instRef = useRef51(null);
154 if (null === instRef.current) {
155 var inst = { hasValue: false, value: null };
156 instRef.current = inst;
157 } else inst = instRef.current;
158 instRef = useMemo41(
159 function() {
160 function memoizedSelector(nextSnapshot) {
161 if (!hasMemo) {
162 hasMemo = true;
163 memoizedSnapshot = nextSnapshot;
164 nextSnapshot = selector(nextSnapshot);
165 if (void 0 !== isEqual && inst.hasValue) {
166 var currentSelection = inst.value;
167 if (isEqual(currentSelection, nextSnapshot))
168 return memoizedSelection = currentSelection;
169 }
170 return memoizedSelection = nextSnapshot;
171 }
172 currentSelection = memoizedSelection;
173 if (objectIs(memoizedSnapshot, nextSnapshot))
174 return currentSelection;
175 var nextSelection = selector(nextSnapshot);
176 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
177 return memoizedSnapshot = nextSnapshot, currentSelection;
178 memoizedSnapshot = nextSnapshot;
179 return memoizedSelection = nextSelection;
180 }
181 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
182 return [
183 function() {
184 return memoizedSelector(getSnapshot());
185 },
186 null === maybeGetServerSnapshot ? void 0 : function() {
187 return memoizedSelector(maybeGetServerSnapshot());
188 }
189 ];
190 },
191 [getSnapshot, getServerSnapshot, selector, isEqual]
192 );
193 var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
194 useEffect30(
195 function() {
196 inst.hasValue = true;
197 inst.value = value;
198 },
199 [value]
200 );
201 useDebugValue2(value);
202 return value;
203 };
204 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
205 })();
206 }
207 });
208
209 // node_modules/use-sync-external-store/shim/with-selector.js
210 var require_with_selector = __commonJS({
211 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
212 "use strict";
213 if (false) {
214 module.exports = null;
215 } else {
216 module.exports = require_with_selector_development();
217 }
218 }
219 });
220
221 // package-external:@wordpress/compose
222 var require_compose = __commonJS({
223 "package-external:@wordpress/compose"(exports, module) {
224 module.exports = window.wp.compose;
225 }
226 });
227
228 // package-external:@wordpress/theme
229 var require_theme = __commonJS({
230 "package-external:@wordpress/theme"(exports, module) {
231 module.exports = window.wp.theme;
232 }
233 });
234
235 // package-external:@wordpress/private-apis
236 var require_private_apis = __commonJS({
237 "package-external:@wordpress/private-apis"(exports, module) {
238 module.exports = window.wp.privateApis;
239 }
240 });
241
242 // package-external:@wordpress/primitives
243 var require_primitives = __commonJS({
244 "package-external:@wordpress/primitives"(exports, module) {
245 module.exports = window.wp.primitives;
246 }
247 });
248
249 // package-external:@wordpress/components
250 var require_components = __commonJS({
251 "package-external:@wordpress/components"(exports, module) {
252 module.exports = window.wp.components;
253 }
254 });
255
256 // package-external:@wordpress/core-data
257 var require_core_data = __commonJS({
258 "package-external:@wordpress/core-data"(exports, module) {
259 module.exports = window.wp.coreData;
260 }
261 });
262
263 // package-external:@wordpress/data
264 var require_data = __commonJS({
265 "package-external:@wordpress/data"(exports, module) {
266 module.exports = window.wp.data;
267 }
268 });
269
270 // node_modules/fast-deep-equal/es6/index.js
271 var require_es6 = __commonJS({
272 "node_modules/fast-deep-equal/es6/index.js"(exports, module) {
273 "use strict";
274 module.exports = function equal(a, b) {
275 if (a === b) return true;
276 if (a && b && typeof a == "object" && typeof b == "object") {
277 if (a.constructor !== b.constructor) return false;
278 var length, i, keys;
279 if (Array.isArray(a)) {
280 length = a.length;
281 if (length != b.length) return false;
282 for (i = length; i-- !== 0; )
283 if (!equal(a[i], b[i])) return false;
284 return true;
285 }
286 if (a instanceof Map && b instanceof Map) {
287 if (a.size !== b.size) return false;
288 for (i of a.entries())
289 if (!b.has(i[0])) return false;
290 for (i of a.entries())
291 if (!equal(i[1], b.get(i[0]))) return false;
292 return true;
293 }
294 if (a instanceof Set && b instanceof Set) {
295 if (a.size !== b.size) return false;
296 for (i of a.entries())
297 if (!b.has(i[0])) return false;
298 return true;
299 }
300 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
301 length = a.length;
302 if (length != b.length) return false;
303 for (i = length; i-- !== 0; )
304 if (a[i] !== b[i]) return false;
305 return true;
306 }
307 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
308 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
309 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
310 keys = Object.keys(a);
311 length = keys.length;
312 if (length !== Object.keys(b).length) return false;
313 for (i = length; i-- !== 0; )
314 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
315 for (i = length; i-- !== 0; ) {
316 var key = keys[i];
317 if (!equal(a[key], b[key])) return false;
318 }
319 return true;
320 }
321 return a !== a && b !== b;
322 };
323 }
324 });
325
326 // package-external:@wordpress/date
327 var require_date = __commonJS({
328 "package-external:@wordpress/date"(exports, module) {
329 module.exports = window.wp.date;
330 }
331 });
332
333 // node_modules/deepmerge/dist/cjs.js
334 var require_cjs = __commonJS({
335 "node_modules/deepmerge/dist/cjs.js"(exports, module) {
336 "use strict";
337 var isMergeableObject = function isMergeableObject2(value) {
338 return isNonNullObject(value) && !isSpecial(value);
339 };
340 function isNonNullObject(value) {
341 return !!value && typeof value === "object";
342 }
343 function isSpecial(value) {
344 var stringValue = Object.prototype.toString.call(value);
345 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
346 }
347 var canUseSymbol = typeof Symbol === "function" && Symbol.for;
348 var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103;
349 function isReactElement(value) {
350 return value.$$typeof === REACT_ELEMENT_TYPE;
351 }
352 function emptyTarget(val) {
353 return Array.isArray(val) ? [] : {};
354 }
355 function cloneUnlessOtherwiseSpecified(value, options) {
356 return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
357 }
358 function defaultArrayMerge(target, source, options) {
359 return target.concat(source).map(function(element) {
360 return cloneUnlessOtherwiseSpecified(element, options);
361 });
362 }
363 function getMergeFunction(key, options) {
364 if (!options.customMerge) {
365 return deepmerge;
366 }
367 var customMerge = options.customMerge(key);
368 return typeof customMerge === "function" ? customMerge : deepmerge;
369 }
370 function getEnumerableOwnPropertySymbols(target) {
371 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
372 return Object.propertyIsEnumerable.call(target, symbol);
373 }) : [];
374 }
375 function getKeys(target) {
376 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
377 }
378 function propertyIsOnObject(object, property) {
379 try {
380 return property in object;
381 } catch (_) {
382 return false;
383 }
384 }
385 function propertyIsUnsafe(target, key) {
386 return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
387 }
388 function mergeObject(target, source, options) {
389 var destination = {};
390 if (options.isMergeableObject(target)) {
391 getKeys(target).forEach(function(key) {
392 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
393 });
394 }
395 getKeys(source).forEach(function(key) {
396 if (propertyIsUnsafe(target, key)) {
397 return;
398 }
399 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
400 destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
401 } else {
402 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
403 }
404 });
405 return destination;
406 }
407 function deepmerge(target, source, options) {
408 options = options || {};
409 options.arrayMerge = options.arrayMerge || defaultArrayMerge;
410 options.isMergeableObject = options.isMergeableObject || isMergeableObject;
411 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
412 var sourceIsArray = Array.isArray(source);
413 var targetIsArray = Array.isArray(target);
414 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
415 if (!sourceAndTargetTypesMatch) {
416 return cloneUnlessOtherwiseSpecified(source, options);
417 } else if (sourceIsArray) {
418 return options.arrayMerge(target, source, options);
419 } else {
420 return mergeObject(target, source, options);
421 }
422 }
423 deepmerge.all = function deepmergeAll(array, options) {
424 if (!Array.isArray(array)) {
425 throw new Error("first argument should be an array");
426 }
427 return array.reduce(function(prev, next) {
428 return deepmerge(prev, next, options);
429 }, {});
430 };
431 var deepmerge_1 = deepmerge;
432 module.exports = deepmerge_1;
433 }
434 });
435
436 // package-external:@wordpress/notices
437 var require_notices = __commonJS({
438 "package-external:@wordpress/notices"(exports, module) {
439 module.exports = window.wp.notices;
440 }
441 });
442
443 // package-external:@wordpress/api-fetch
444 var require_api_fetch = __commonJS({
445 "package-external:@wordpress/api-fetch"(exports, module) {
446 module.exports = window.wp.apiFetch;
447 }
448 });
449
450 // node_modules/clsx/dist/clsx.mjs
451 function r(e) {
452 var t, f, n = "";
453 if ("string" == typeof e || "number" == typeof e) n += e;
454 else if ("object" == typeof e) if (Array.isArray(e)) {
455 var o = e.length;
456 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
457 } else for (f in e) e[f] && (n && (n += " "), n += f);
458 return n;
459 }
460 function clsx() {
461 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
462 return n;
463 }
464 var clsx_default = clsx;
465
466 // packages/ui/build-module/badge/badge.mjs
467 var import_element11 = __toESM(require_element(), 1);
468
469 // node_modules/@base-ui/utils/useControlled.mjs
470 var React = __toESM(require_react(), 1);
471
472 // node_modules/@base-ui/utils/createLogOnce.mjs
473 var loggedMessages;
474 if (true) {
475 loggedMessages = /* @__PURE__ */ new Set();
476 }
477 function createLogOnce(severity, prefix) {
478 return function logOnce(...messages) {
479 if (true) {
480 const message2 = messages.join(" ");
481 const output = prefix ? `${prefix}: ${message2}` : message2;
482 const key = `${severity}:${output}`;
483 if (!loggedMessages.has(key)) {
484 loggedMessages.add(key);
485 if (severity === "warn") {
486 console.warn(output);
487 } else {
488 console.error(output);
489 }
490 }
491 }
492 };
493 }
494
495 // node_modules/@base-ui/utils/error.mjs
496 var error = createLogOnce("error", "Base UI");
497
498 // node_modules/@base-ui/utils/useControlled.mjs
499 function useControlled({
500 controlled,
501 default: defaultProp,
502 name,
503 state = "value"
504 }) {
505 const {
506 current: isControlled
507 } = React.useRef(controlled !== void 0);
508 const [valueState, setValue] = React.useState(defaultProp);
509 const value = isControlled && controlled !== void 0 ? controlled : valueState;
510 if (true) {
511 React.useEffect(() => {
512 if (isControlled !== (controlled !== void 0)) {
513 error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n"));
514 }
515 }, [state, name, controlled]);
516 const {
517 current: defaultValue
518 } = React.useRef(defaultProp);
519 React.useEffect(() => {
520 if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {
521 error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n"));
522 }
523 }, [defaultProp]);
524 }
525 const setValueIfUncontrolled = React.useCallback((newValue) => {
526 if (!isControlled) {
527 setValue(newValue);
528 }
529 }, []);
530 return [value, setValueIfUncontrolled];
531 }
532 function serializeToDevModeString(input) {
533 let nextId = 0;
534 const seen = /* @__PURE__ */ new WeakMap();
535 try {
536 const result = JSON.stringify(input, function replacer(key, value) {
537 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) {
538 return void 0;
539 }
540 if (typeof value === "bigint") {
541 return `__bigint__:${value}`;
542 }
543 if (value !== null && typeof value === "object") {
544 const id = seen.get(value);
545 if (id !== void 0) {
546 return `__object__:${id}`;
547 }
548 seen.set(value, nextId);
549 nextId += 1;
550 }
551 return value;
552 });
553 return result ?? `__top__:${typeof input}`;
554 } catch {
555 return "__unserializable__";
556 }
557 }
558
559 // node_modules/@base-ui/utils/safeReact.mjs
560 var React2 = __toESM(require_react(), 1);
561 var SafeReact = {
562 ...React2
563 };
564
565 // node_modules/@base-ui/utils/useRefWithInit.mjs
566 var React3 = __toESM(require_react(), 1);
567 var UNINITIALIZED = {};
568 function useRefWithInit(init, initArg) {
569 const ref = React3.useRef(UNINITIALIZED);
570 if (ref.current === UNINITIALIZED) {
571 ref.current = init(initArg);
572 }
573 return ref;
574 }
575
576 // node_modules/@base-ui/utils/useStableCallback.mjs
577 var useInsertionEffect = SafeReact.useInsertionEffect;
578 var useSafeInsertionEffect = (
579 // React 17 doesn't have useInsertionEffect.
580 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
581 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
582 );
583 function useStableCallback(callback) {
584 const stable = useRefWithInit(createStableCallback).current;
585 stable.next = callback;
586 useSafeInsertionEffect(stable.effect);
587 return stable.trampoline;
588 }
589 function createStableCallback() {
590 const stable = {
591 next: void 0,
592 callback: assertNotCalled,
593 trampoline: (...args) => stable.callback?.(...args),
594 effect: () => {
595 stable.callback = stable.next;
596 }
597 };
598 return stable;
599 }
600 function assertNotCalled() {
601 if (true) {
602 throw (
603 /* minify-error-disabled */
604 new Error("Base UI: Cannot call an event handler while rendering.")
605 );
606 }
607 }
608
609 // node_modules/@base-ui/utils/warn.mjs
610 var warn = createLogOnce("warn", "Base UI");
611
612 // node_modules/@base-ui/utils/empty.mjs
613 function NOOP() {
614 }
615 var EMPTY_ARRAY = Object.freeze([]);
616 var EMPTY_OBJECT = Object.freeze({});
617
618 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
619 var React4 = __toESM(require_react(), 1);
620 var noop = () => {
621 };
622 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop;
623
624 // node_modules/@base-ui/react/internals/useRenderElement.mjs
625 var React7 = __toESM(require_react(), 1);
626
627 // node_modules/@base-ui/utils/useMergedRefs.mjs
628 function useMergedRefs(a, b, c2, d) {
629 const forkRef = useRefWithInit(createForkRef).current;
630 if (didChange(forkRef, a, b, c2, d)) {
631 update(forkRef, [a, b, c2, d]);
632 }
633 return forkRef.callback;
634 }
635 function useMergedRefsN(refs) {
636 const forkRef = useRefWithInit(createForkRef).current;
637 if (didChangeN(forkRef, refs)) {
638 update(forkRef, refs);
639 }
640 return forkRef.callback;
641 }
642 function createForkRef() {
643 return {
644 callback: null,
645 cleanup: null,
646 refs: []
647 };
648 }
649 function didChange(forkRef, a, b, c2, d) {
650 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d;
651 }
652 function didChangeN(forkRef, newRefs) {
653 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
654 }
655 function update(forkRef, refs) {
656 forkRef.refs = refs;
657 if (refs.every((ref) => ref == null)) {
658 forkRef.callback = null;
659 return;
660 }
661 forkRef.callback = (instance) => {
662 if (forkRef.cleanup) {
663 forkRef.cleanup();
664 forkRef.cleanup = null;
665 }
666 if (instance != null) {
667 const cleanupCallbacks = Array(refs.length).fill(null);
668 for (let i = 0; i < refs.length; i += 1) {
669 const ref = refs[i];
670 if (ref == null) {
671 continue;
672 }
673 switch (typeof ref) {
674 case "function": {
675 const refCleanup = ref(instance);
676 if (typeof refCleanup === "function") {
677 cleanupCallbacks[i] = refCleanup;
678 }
679 break;
680 }
681 case "object": {
682 ref.current = instance;
683 break;
684 }
685 default:
686 }
687 }
688 forkRef.cleanup = () => {
689 for (let i = 0; i < refs.length; i += 1) {
690 const ref = refs[i];
691 if (ref == null) {
692 continue;
693 }
694 switch (typeof ref) {
695 case "function": {
696 const cleanupCallback = cleanupCallbacks[i];
697 if (typeof cleanupCallback === "function") {
698 cleanupCallback();
699 } else {
700 void ref(null);
701 }
702 break;
703 }
704 case "object": {
705 ref.current = null;
706 break;
707 }
708 default:
709 }
710 }
711 };
712 }
713 };
714 }
715
716 // node_modules/@base-ui/utils/getReactElementRef.mjs
717 var React6 = __toESM(require_react(), 1);
718
719 // node_modules/@base-ui/utils/reactVersion.mjs
720 var React5 = __toESM(require_react(), 1);
721 var majorVersion = parseInt(React5.version, 10);
722 function isReactVersionAtLeast(reactVersionToCheck) {
723 return majorVersion >= reactVersionToCheck;
724 }
725
726 // node_modules/@base-ui/utils/getReactElementRef.mjs
727 function getReactElementRef(element) {
728 if (!/* @__PURE__ */ React6.isValidElement(element)) {
729 return null;
730 }
731 const reactElement = element;
732 const propsWithRef = reactElement.props;
733 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
734 }
735
736 // node_modules/@base-ui/utils/mergeObjects.mjs
737 function mergeObjects(a, b) {
738 if (a && !b) {
739 return a;
740 }
741 if (!a && b) {
742 return b;
743 }
744 if (a || b) {
745 return {
746 ...a,
747 ...b
748 };
749 }
750 return void 0;
751 }
752
753 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
754 function getStateAttributesProps(state, customMapping) {
755 const props = {};
756 for (const key in state) {
757 const value = state[key];
758 if (customMapping?.hasOwnProperty(key)) {
759 const customProps = customMapping[key](value);
760 if (customProps != null) {
761 Object.assign(props, customProps);
762 }
763 continue;
764 }
765 if (value === true) {
766 props[`data-${key.toLowerCase()}`] = "";
767 } else if (value) {
768 props[`data-${key.toLowerCase()}`] = value.toString();
769 }
770 }
771 return props;
772 }
773
774 // node_modules/@base-ui/react/utils/resolveClassName.mjs
775 function resolveClassName(className, state) {
776 return typeof className === "function" ? className(state) : className;
777 }
778
779 // node_modules/@base-ui/react/utils/resolveStyle.mjs
780 function resolveStyle(style, state) {
781 return typeof style === "function" ? style(state) : style;
782 }
783
784 // node_modules/@base-ui/react/merge-props/mergeProps.mjs
785 var EMPTY_PROPS = {};
786 function mergeProps(a, b, c2, d, e) {
787 if (!c2 && !d && !e && !a) {
788 return createInitialMergedProps(b);
789 }
790 let merged = createInitialMergedProps(a);
791 if (b) {
792 merged = mergeInto(merged, b);
793 }
794 if (c2) {
795 merged = mergeInto(merged, c2);
796 }
797 if (d) {
798 merged = mergeInto(merged, d);
799 }
800 if (e) {
801 merged = mergeInto(merged, e);
802 }
803 return merged;
804 }
805 function mergePropsN(props) {
806 if (props.length === 0) {
807 return EMPTY_PROPS;
808 }
809 if (props.length === 1) {
810 return createInitialMergedProps(props[0]);
811 }
812 let merged = createInitialMergedProps(props[0]);
813 for (let i = 1; i < props.length; i += 1) {
814 merged = mergeInto(merged, props[i]);
815 }
816 return merged;
817 }
818 function createInitialMergedProps(inputProps) {
819 if (isPropsGetter(inputProps)) {
820 return {
821 ...resolvePropsGetter(inputProps, EMPTY_PROPS)
822 };
823 }
824 return copyInitialProps(inputProps);
825 }
826 function mergeInto(merged, inputProps) {
827 if (isPropsGetter(inputProps)) {
828 return resolvePropsGetter(inputProps, merged);
829 }
830 return mutablyMergeInto(merged, inputProps);
831 }
832 function copyInitialProps(inputProps) {
833 const copiedProps = {
834 ...inputProps
835 };
836 for (const propName in copiedProps) {
837 const propValue = copiedProps[propName];
838 if (isEventHandler(propName, propValue)) {
839 copiedProps[propName] = wrapEventHandler(propValue);
840 }
841 }
842 return copiedProps;
843 }
844 function mutablyMergeInto(mergedProps, externalProps) {
845 if (!externalProps) {
846 return mergedProps;
847 }
848 for (const propName in externalProps) {
849 const externalPropValue = externalProps[propName];
850 switch (propName) {
851 case "style": {
852 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
853 break;
854 }
855 case "className": {
856 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
857 break;
858 }
859 default: {
860 if (isEventHandler(propName, externalPropValue)) {
861 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
862 } else {
863 mergedProps[propName] = externalPropValue;
864 }
865 }
866 }
867 }
868 return mergedProps;
869 }
870 function isEventHandler(key, value) {
871 const code0 = key.charCodeAt(0);
872 const code1 = key.charCodeAt(1);
873 const code2 = key.charCodeAt(2);
874 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
875 }
876 function isPropsGetter(inputProps) {
877 return typeof inputProps === "function";
878 }
879 function resolvePropsGetter(inputProps, previousProps) {
880 if (isPropsGetter(inputProps)) {
881 return inputProps(previousProps);
882 }
883 return inputProps ?? EMPTY_PROPS;
884 }
885 function mergeEventHandlers(ourHandler, theirHandler) {
886 if (!theirHandler) {
887 return ourHandler;
888 }
889 if (!ourHandler) {
890 return wrapEventHandler(theirHandler);
891 }
892 return (...args) => {
893 const event = args[0];
894 if (isSyntheticEvent(event)) {
895 const baseUIEvent = event;
896 makeEventPreventable(baseUIEvent);
897 const result2 = theirHandler(...args);
898 if (!baseUIEvent.baseUIHandlerPrevented) {
899 ourHandler?.(...args);
900 }
901 return result2;
902 }
903 const result = theirHandler(...args);
904 ourHandler?.(...args);
905 return result;
906 };
907 }
908 function wrapEventHandler(handler) {
909 if (!handler) {
910 return handler;
911 }
912 return (...args) => {
913 const event = args[0];
914 if (isSyntheticEvent(event)) {
915 makeEventPreventable(event);
916 }
917 return handler(...args);
918 };
919 }
920 function makeEventPreventable(event) {
921 event.preventBaseUIHandler = () => {
922 event.baseUIHandlerPrevented = true;
923 };
924 return event;
925 }
926 function mergeClassNames(ourClassName, theirClassName) {
927 if (theirClassName) {
928 if (ourClassName) {
929 return theirClassName + " " + ourClassName;
930 }
931 return theirClassName;
932 }
933 return ourClassName;
934 }
935 function isSyntheticEvent(event) {
936 return event != null && typeof event === "object" && "nativeEvent" in event;
937 }
938
939 // node_modules/@base-ui/react/internals/useRenderElement.mjs
940 var import_react = __toESM(require_react(), 1);
941 function useRenderElement(element, componentProps, params = {}) {
942 let renderProp = componentProps.render;
943 if (params.enabled !== false) {
944 renderProp = unwrapLazyRenderProp(renderProp);
945 }
946 const outProps = useRenderElementProps(componentProps, params, renderProp);
947 if (params.enabled === false) {
948 return null;
949 }
950 const state = params.state ?? EMPTY_OBJECT;
951 return evaluateRenderProp(element, renderProp, outProps, state);
952 }
953 function useRenderElementProps(componentProps, params, renderProp) {
954 const {
955 className: classNameProp,
956 style: styleProp
957 } = componentProps;
958 const {
959 state = EMPTY_OBJECT,
960 ref,
961 props,
962 stateAttributesMapping: stateAttributesMapping3,
963 enabled = true
964 } = params;
965 const className = enabled ? resolveClassName(classNameProp, state) : void 0;
966 const style = enabled ? resolveStyle(styleProp, state) : void 0;
967 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping3) : EMPTY_OBJECT;
968 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
969 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
970 if (typeof document !== "undefined") {
971 if (!enabled) {
972 void useMergedRefs(null, null);
973 } else if (Array.isArray(ref)) {
974 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
975 } else {
976 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
977 }
978 }
979 if (!enabled) {
980 return EMPTY_OBJECT;
981 }
982 if (className !== void 0) {
983 outProps.className = mergeClassNames(outProps.className, className);
984 }
985 if (style !== void 0) {
986 outProps.style = mergeObjects(outProps.style, style);
987 }
988 return outProps;
989 }
990 function resolveRenderFunctionProps(props) {
991 if (Array.isArray(props)) {
992 return mergePropsN(props);
993 }
994 return mergeProps(void 0, props);
995 }
996 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
997 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
998 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
999 function unwrapLazyRenderProp(render4) {
1000 if (render4?.$$typeof !== REACT_LAZY_TYPE) {
1001 return render4;
1002 }
1003 const unwrapped = React7.Children.toArray(render4)[0];
1004 return /* @__PURE__ */ React7.isValidElement(unwrapped) ? unwrapped : render4;
1005 }
1006 function evaluateRenderProp(element, render4, props, state) {
1007 if (render4) {
1008 if (typeof render4 === "function") {
1009 if (true) {
1010 warnIfRenderPropLooksLikeComponent(render4);
1011 }
1012 return render4(props, state);
1013 }
1014 const mergedProps = mergeProps(props, render4.props);
1015 mergedProps.ref = props.ref;
1016 if (true) {
1017 if (!/* @__PURE__ */ React7.isValidElement(render4)) {
1018 throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
1019 }
1020 }
1021 return /* @__PURE__ */ React7.cloneElement(render4, mergedProps);
1022 }
1023 if (element) {
1024 if (typeof element === "string") {
1025 return renderTag(element, props);
1026 }
1027 }
1028 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
1029 }
1030 function warnIfRenderPropLooksLikeComponent(renderFn) {
1031 const functionName = renderFn.name;
1032 if (functionName.length === 0) {
1033 return;
1034 }
1035 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
1036 return;
1037 }
1038 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
1039 return;
1040 }
1041 warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
1042 }
1043 function renderTag(Tag, props) {
1044 if (Tag === "button") {
1045 return /* @__PURE__ */ (0, import_react.createElement)("button", {
1046 type: "button",
1047 ...props,
1048 key: props.key
1049 });
1050 }
1051 if (Tag === "img") {
1052 return /* @__PURE__ */ (0, import_react.createElement)("img", {
1053 alt: "",
1054 ...props,
1055 key: props.key
1056 });
1057 }
1058 return /* @__PURE__ */ React7.createElement(Tag, props);
1059 }
1060
1061 // node_modules/@base-ui/utils/useId.mjs
1062 var React8 = __toESM(require_react(), 1);
1063 var globalId = 0;
1064 function useGlobalId(idOverride, prefix = "mui") {
1065 const [defaultId, setDefaultId] = React8.useState(idOverride);
1066 const id = idOverride || defaultId;
1067 React8.useEffect(() => {
1068 if (defaultId == null) {
1069 globalId += 1;
1070 setDefaultId(`${prefix}-${globalId}`);
1071 }
1072 }, [defaultId, prefix]);
1073 return id;
1074 }
1075 var maybeReactUseId = SafeReact.useId;
1076 function useId(idOverride, prefix) {
1077 if (maybeReactUseId !== void 0) {
1078 const reactId = maybeReactUseId();
1079 return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
1080 }
1081 return useGlobalId(idOverride, prefix);
1082 }
1083
1084 // node_modules/@base-ui/react/internals/useBaseUiId.mjs
1085 function useBaseUiId(idOverride) {
1086 return useId(idOverride, "base-ui");
1087 }
1088
1089 // node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs
1090 var React11 = __toESM(require_react(), 1);
1091
1092 // node_modules/@base-ui/react/internals/reason-parts.mjs
1093 var reason_parts_exports = {};
1094 __export(reason_parts_exports, {
1095 cancelOpen: () => cancelOpen,
1096 chipRemovePress: () => chipRemovePress,
1097 clearPress: () => clearPress,
1098 closePress: () => closePress,
1099 closeWatcher: () => closeWatcher,
1100 decrementPress: () => decrementPress,
1101 disabled: () => disabled,
1102 drag: () => drag,
1103 escapeKey: () => escapeKey,
1104 focusOut: () => focusOut,
1105 imperativeAction: () => imperativeAction,
1106 incrementPress: () => incrementPress,
1107 initial: () => initial,
1108 inputBlur: () => inputBlur,
1109 inputChange: () => inputChange,
1110 inputClear: () => inputClear,
1111 inputPaste: () => inputPaste,
1112 inputPress: () => inputPress,
1113 itemPress: () => itemPress,
1114 keyboard: () => keyboard,
1115 linkPress: () => linkPress,
1116 listNavigation: () => listNavigation,
1117 missing: () => missing,
1118 none: () => none,
1119 outsidePress: () => outsidePress,
1120 pointer: () => pointer,
1121 scrub: () => scrub,
1122 siblingOpen: () => siblingOpen,
1123 swipe: () => swipe,
1124 trackPress: () => trackPress,
1125 triggerFocus: () => triggerFocus,
1126 triggerHover: () => triggerHover,
1127 triggerPress: () => triggerPress,
1128 wheel: () => wheel,
1129 windowResize: () => windowResize
1130 });
1131 var none = "none";
1132 var triggerPress = "trigger-press";
1133 var triggerHover = "trigger-hover";
1134 var triggerFocus = "trigger-focus";
1135 var outsidePress = "outside-press";
1136 var itemPress = "item-press";
1137 var closePress = "close-press";
1138 var linkPress = "link-press";
1139 var clearPress = "clear-press";
1140 var chipRemovePress = "chip-remove-press";
1141 var trackPress = "track-press";
1142 var incrementPress = "increment-press";
1143 var decrementPress = "decrement-press";
1144 var inputChange = "input-change";
1145 var inputClear = "input-clear";
1146 var inputBlur = "input-blur";
1147 var inputPaste = "input-paste";
1148 var inputPress = "input-press";
1149 var focusOut = "focus-out";
1150 var escapeKey = "escape-key";
1151 var closeWatcher = "close-watcher";
1152 var listNavigation = "list-navigation";
1153 var keyboard = "keyboard";
1154 var pointer = "pointer";
1155 var drag = "drag";
1156 var wheel = "wheel";
1157 var scrub = "scrub";
1158 var cancelOpen = "cancel-open";
1159 var siblingOpen = "sibling-open";
1160 var disabled = "disabled";
1161 var missing = "missing";
1162 var initial = "initial";
1163 var imperativeAction = "imperative-action";
1164 var swipe = "swipe";
1165 var windowResize = "window-resize";
1166
1167 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs
1168 function createChangeEventDetails(reason, event, trigger, customProperties) {
1169 let canceled = false;
1170 let allowPropagation = false;
1171 const custom = customProperties ?? EMPTY_OBJECT;
1172 const details = {
1173 reason,
1174 event: event ?? new Event("base-ui"),
1175 cancel() {
1176 canceled = true;
1177 },
1178 allowPropagation() {
1179 allowPropagation = true;
1180 },
1181 get isCanceled() {
1182 return canceled;
1183 },
1184 get isPropagationAllowed() {
1185 return allowPropagation;
1186 },
1187 trigger,
1188 ...custom
1189 };
1190 return details;
1191 }
1192
1193 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1194 var React10 = __toESM(require_react(), 1);
1195
1196 // node_modules/@base-ui/utils/useOnMount.mjs
1197 var React9 = __toESM(require_react(), 1);
1198 function useOnMount(fn) {
1199 React9.useEffect(fn, EMPTY_ARRAY);
1200 }
1201
1202 // node_modules/@base-ui/utils/useAnimationFrame.mjs
1203 var EMPTY = null;
1204 var LAST_RAF = globalThis.requestAnimationFrame;
1205 var Scheduler = class {
1206 /* This implementation uses an array as a backing data-structure for frame callbacks.
1207 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
1208 * never calls the native `cancelAnimationFrame` if there are no frames left. This can
1209 * be much more efficient if there is a call pattern that alterns as
1210 * "request-cancel-request-cancel-…".
1211 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
1212 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
1213 callbacks = [];
1214 callbacksCount = 0;
1215 nextId = 1;
1216 startId = 1;
1217 isScheduled = false;
1218 tick = (timestamp) => {
1219 this.isScheduled = false;
1220 const currentCallbacks = this.callbacks;
1221 const currentCallbacksCount = this.callbacksCount;
1222 this.callbacks = [];
1223 this.callbacksCount = 0;
1224 this.startId = this.nextId;
1225 if (currentCallbacksCount > 0) {
1226 for (let i = 0; i < currentCallbacks.length; i += 1) {
1227 currentCallbacks[i]?.(timestamp);
1228 }
1229 }
1230 };
1231 request(fn) {
1232 const id = this.nextId;
1233 this.nextId += 1;
1234 this.callbacks.push(fn);
1235 this.callbacksCount += 1;
1236 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
1237 if (!this.isScheduled || didRAFChange) {
1238 requestAnimationFrame(this.tick);
1239 this.isScheduled = true;
1240 }
1241 return id;
1242 }
1243 cancel(id) {
1244 const index2 = id - this.startId;
1245 if (index2 < 0 || index2 >= this.callbacks.length) {
1246 return;
1247 }
1248 if (this.callbacks[index2] === null) {
1249 return;
1250 }
1251 this.callbacks[index2] = null;
1252 this.callbacksCount -= 1;
1253 }
1254 };
1255 var scheduler = new Scheduler();
1256 var AnimationFrame = class _AnimationFrame {
1257 static create() {
1258 return new _AnimationFrame();
1259 }
1260 static request(fn) {
1261 return scheduler.request(fn);
1262 }
1263 static cancel(id) {
1264 return scheduler.cancel(id);
1265 }
1266 currentId = EMPTY;
1267 /**
1268 * Executes `fn` after `delay`, clearing any previously scheduled call.
1269 */
1270 request(fn) {
1271 this.cancel();
1272 this.currentId = scheduler.request(() => {
1273 this.currentId = EMPTY;
1274 fn();
1275 });
1276 }
1277 cancel = () => {
1278 if (this.currentId !== EMPTY) {
1279 scheduler.cancel(this.currentId);
1280 this.currentId = EMPTY;
1281 }
1282 };
1283 disposeEffect = () => {
1284 return this.cancel;
1285 };
1286 };
1287 function useAnimationFrame() {
1288 const timeout = useRefWithInit(AnimationFrame.create).current;
1289 useOnMount(timeout.disposeEffect);
1290 return timeout;
1291 }
1292
1293 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs
1294 function useTransitionStatus(open3, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) {
1295 const [transitionStatus, setTransitionStatus] = React10.useState(open3 && enableIdleState ? "idle" : void 0);
1296 const [mounted, setMounted] = React10.useState(open3 && !animateInitialOpen);
1297 if (open3 && !mounted) {
1298 setMounted(true);
1299 setTransitionStatus("starting");
1300 }
1301 if (!open3 && mounted && transitionStatus !== "ending" && !deferEndingState) {
1302 setTransitionStatus("ending");
1303 }
1304 if (!open3 && !mounted && transitionStatus === "ending") {
1305 setTransitionStatus(void 0);
1306 }
1307 useIsoLayoutEffect(() => {
1308 if (!open3 && mounted && transitionStatus !== "ending" && deferEndingState) {
1309 const frame = AnimationFrame.request(() => {
1310 setTransitionStatus("ending");
1311 });
1312 return () => {
1313 AnimationFrame.cancel(frame);
1314 };
1315 }
1316 return void 0;
1317 }, [open3, mounted, transitionStatus, deferEndingState]);
1318 useIsoLayoutEffect(() => {
1319 if (!open3 || enableIdleState) {
1320 return void 0;
1321 }
1322 const frame = AnimationFrame.request(() => {
1323 setTransitionStatus(void 0);
1324 });
1325 return () => {
1326 AnimationFrame.cancel(frame);
1327 };
1328 }, [enableIdleState, open3]);
1329 useIsoLayoutEffect(() => {
1330 if (!open3 || !enableIdleState) {
1331 return void 0;
1332 }
1333 if (open3 && mounted && transitionStatus !== "idle") {
1334 setTransitionStatus("starting");
1335 }
1336 const frame = AnimationFrame.request(() => {
1337 setTransitionStatus("idle");
1338 });
1339 return () => {
1340 AnimationFrame.cancel(frame);
1341 };
1342 }, [enableIdleState, open3, mounted, transitionStatus]);
1343 return {
1344 mounted,
1345 setMounted,
1346 transitionStatus
1347 };
1348 }
1349
1350 // node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs
1351 function useCollapsibleRoot(parameters) {
1352 const {
1353 open: openParam,
1354 defaultOpen = false,
1355 onOpenChange,
1356 disabled: disabled2
1357 } = parameters;
1358 const [open3, setOpen] = useControlled({
1359 controlled: openParam,
1360 default: defaultOpen,
1361 name: "Collapsible",
1362 state: "open"
1363 });
1364 const {
1365 mounted,
1366 setMounted,
1367 transitionStatus
1368 } = useTransitionStatus(open3, true, true);
1369 const defaultPanelId = useBaseUiId();
1370 const [registeredPanelId, setPanelIdState] = React11.useState();
1371 const panelId = registeredPanelId === null ? void 0 : registeredPanelId ?? defaultPanelId;
1372 const handleTrigger = useStableCallback((event) => {
1373 const nextOpen = !open3;
1374 const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent);
1375 onOpenChange(nextOpen, eventDetails);
1376 if (eventDetails.isCanceled) {
1377 return;
1378 }
1379 setOpen(nextOpen);
1380 });
1381 return React11.useMemo(() => ({
1382 defaultPanelId,
1383 disabled: disabled2,
1384 handleTrigger,
1385 mounted,
1386 open: open3,
1387 panelId,
1388 setMounted,
1389 setOpen,
1390 setPanelIdState,
1391 transitionStatus
1392 }), [defaultPanelId, disabled2, handleTrigger, mounted, open3, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]);
1393 }
1394
1395 // node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs
1396 var React12 = __toESM(require_react(), 1);
1397 var CollapsibleRootContext = /* @__PURE__ */ React12.createContext(void 0);
1398 if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext";
1399 function useCollapsibleRootContext() {
1400 const context = React12.useContext(CollapsibleRootContext);
1401 if (context === void 0) {
1402 throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15));
1403 }
1404 return context;
1405 }
1406
1407 // node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs
1408 var TransitionStatusDataAttributes_exports = {};
1409 __export(TransitionStatusDataAttributes_exports, {
1410 endingStyle: () => endingStyle,
1411 startingStyle: () => startingStyle
1412 });
1413 var startingStyle = "data-starting-style";
1414 var endingStyle = "data-ending-style";
1415
1416 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs
1417 var STARTING_HOOK = {
1418 [startingStyle]: ""
1419 };
1420 var ENDING_HOOK = {
1421 [endingStyle]: ""
1422 };
1423 var transitionStatusMapping = {
1424 transitionStatus(value) {
1425 if (value === "starting") {
1426 return STARTING_HOOK;
1427 }
1428 if (value === "ending") {
1429 return ENDING_HOOK;
1430 }
1431 return null;
1432 }
1433 };
1434
1435 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs
1436 var open = "data-open";
1437 var closed = "data-closed";
1438 var startingStyle2 = TransitionStatusDataAttributes_exports.startingStyle;
1439 var endingStyle2 = TransitionStatusDataAttributes_exports.endingStyle;
1440
1441 // node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs
1442 var panelOpen = "data-panel-open";
1443
1444 // node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs
1445 var PANEL_OPEN_HOOK = {
1446 [open]: ""
1447 };
1448 var PANEL_CLOSED_HOOK = {
1449 [closed]: ""
1450 };
1451 var triggerOpenStateMapping = {
1452 open(value) {
1453 if (value) {
1454 return {
1455 [panelOpen]: ""
1456 };
1457 }
1458 return null;
1459 }
1460 };
1461 var collapsibleOpenStateMapping = {
1462 open(value) {
1463 if (value) {
1464 return PANEL_OPEN_HOOK;
1465 }
1466 return PANEL_CLOSED_HOOK;
1467 }
1468 };
1469
1470 // node_modules/@base-ui/react/internals/use-button/useButton.mjs
1471 var React15 = __toESM(require_react(), 1);
1472
1473 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1474 function hasWindow() {
1475 return typeof window !== "undefined";
1476 }
1477 function getNodeName(node) {
1478 if (isNode(node)) {
1479 return (node.nodeName || "").toLowerCase();
1480 }
1481 return "#document";
1482 }
1483 function getWindow(node) {
1484 var _node$ownerDocument;
1485 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1486 }
1487 function getDocumentElement(node) {
1488 var _ref;
1489 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1490 }
1491 function isNode(value) {
1492 if (!hasWindow()) {
1493 return false;
1494 }
1495 return value instanceof Node || value instanceof getWindow(value).Node;
1496 }
1497 function isElement(value) {
1498 if (!hasWindow()) {
1499 return false;
1500 }
1501 return value instanceof Element || value instanceof getWindow(value).Element;
1502 }
1503 function isHTMLElement(value) {
1504 if (!hasWindow()) {
1505 return false;
1506 }
1507 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1508 }
1509 function isShadowRoot(value) {
1510 if (!hasWindow() || typeof ShadowRoot === "undefined") {
1511 return false;
1512 }
1513 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1514 }
1515 function isOverflowElement(element) {
1516 const {
1517 overflow,
1518 overflowX,
1519 overflowY,
1520 display
1521 } = getComputedStyle2(element);
1522 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1523 }
1524 function isTableElement(element) {
1525 return /^(table|td|th)$/.test(getNodeName(element));
1526 }
1527 function isTopLayer(element) {
1528 try {
1529 if (element.matches(":popover-open")) {
1530 return true;
1531 }
1532 } catch (_e) {
1533 }
1534 try {
1535 return element.matches(":modal");
1536 } catch (_e) {
1537 return false;
1538 }
1539 }
1540 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1541 var containRe = /paint|layout|strict|content/;
1542 var isNotNone = (value) => !!value && value !== "none";
1543 var isWebKitValue;
1544 function isContainingBlock(elementOrCss) {
1545 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
1546 return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
1547 }
1548 function getContainingBlock(element) {
1549 let currentNode = getParentNode(element);
1550 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1551 if (isContainingBlock(currentNode)) {
1552 return currentNode;
1553 } else if (isTopLayer(currentNode)) {
1554 return null;
1555 }
1556 currentNode = getParentNode(currentNode);
1557 }
1558 return null;
1559 }
1560 function isWebKit() {
1561 if (isWebKitValue == null) {
1562 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1563 }
1564 return isWebKitValue;
1565 }
1566 function isLastTraversableNode(node) {
1567 return /^(html|body|#document)$/.test(getNodeName(node));
1568 }
1569 function getComputedStyle2(element) {
1570 return getWindow(element).getComputedStyle(element);
1571 }
1572 function getNodeScroll(element) {
1573 if (isElement(element)) {
1574 return {
1575 scrollLeft: element.scrollLeft,
1576 scrollTop: element.scrollTop
1577 };
1578 }
1579 return {
1580 scrollLeft: element.scrollX,
1581 scrollTop: element.scrollY
1582 };
1583 }
1584 function getParentNode(node) {
1585 if (getNodeName(node) === "html") {
1586 return node;
1587 }
1588 const result = (
1589 // Step into the shadow DOM of the parent of a slotted node.
1590 node.assignedSlot || // DOM Element detected.
1591 node.parentNode || // ShadowRoot detected.
1592 isShadowRoot(node) && node.host || // Fallback.
1593 getDocumentElement(node)
1594 );
1595 return isShadowRoot(result) ? result.host : result;
1596 }
1597 function getNearestOverflowAncestor(node) {
1598 const parentNode = getParentNode(node);
1599 if (isLastTraversableNode(parentNode)) {
1600 return (node.ownerDocument || node).body;
1601 }
1602 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1603 return parentNode;
1604 }
1605 return getNearestOverflowAncestor(parentNode);
1606 }
1607 function getOverflowAncestors(node, list, traverseIframes) {
1608 var _node$ownerDocument2;
1609 if (list === void 0) {
1610 list = [];
1611 }
1612 if (traverseIframes === void 0) {
1613 traverseIframes = true;
1614 }
1615 const scrollableAncestor = getNearestOverflowAncestor(node);
1616 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1617 const win = getWindow(scrollableAncestor);
1618 if (isBody) {
1619 const frameElement = getFrameElement(win);
1620 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1621 } else {
1622 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1623 }
1624 }
1625 function getFrameElement(win) {
1626 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1627 }
1628
1629 // node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs
1630 var React13 = __toESM(require_react(), 1);
1631 var CompositeRootContext = /* @__PURE__ */ React13.createContext(void 0);
1632 if (true) CompositeRootContext.displayName = "CompositeRootContext";
1633 function useCompositeRootContext(optional = false) {
1634 const context = React13.useContext(CompositeRootContext);
1635 if (context === void 0 && !optional) {
1636 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16));
1637 }
1638 return context;
1639 }
1640
1641 // node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs
1642 var React14 = __toESM(require_react(), 1);
1643 function useFocusableWhenDisabled(parameters) {
1644 const {
1645 focusableWhenDisabled,
1646 disabled: disabled2,
1647 composite = false,
1648 tabIndex: tabIndexProp = 0,
1649 isNativeButton
1650 } = parameters;
1651 const isFocusableComposite = composite && focusableWhenDisabled !== false;
1652 const isNonFocusableComposite = composite && focusableWhenDisabled === false;
1653 const props = React14.useMemo(() => {
1654 const additionalProps = {
1655 // allow Tabbing away from focusableWhenDisabled elements
1656 onKeyDown(event) {
1657 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") {
1658 event.preventDefault();
1659 }
1660 }
1661 };
1662 if (!composite) {
1663 additionalProps.tabIndex = tabIndexProp;
1664 if (!isNativeButton && disabled2) {
1665 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
1666 }
1667 }
1668 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) {
1669 additionalProps["aria-disabled"] = disabled2;
1670 }
1671 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
1672 additionalProps.disabled = disabled2;
1673 }
1674 return additionalProps;
1675 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
1676 return {
1677 props
1678 };
1679 }
1680
1681 // node_modules/@base-ui/utils/owner.mjs
1682 function ownerDocument(node) {
1683 return node?.ownerDocument || document;
1684 }
1685
1686 // node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs
1687 function dispatchClickWithModifiers(target, sourceEvent, {
1688 detail = 0
1689 } = {}) {
1690 target.dispatchEvent(new (getWindow(target)).PointerEvent("click", {
1691 bubbles: true,
1692 cancelable: true,
1693 composed: true,
1694 detail,
1695 shiftKey: sourceEvent.shiftKey,
1696 ctrlKey: sourceEvent.ctrlKey,
1697 altKey: sourceEvent.altKey,
1698 metaKey: sourceEvent.metaKey
1699 }));
1700 }
1701
1702 // node_modules/@base-ui/react/internals/use-button/useButton.mjs
1703 function useButton(parameters = {}) {
1704 const {
1705 disabled: disabled2 = false,
1706 focusableWhenDisabled,
1707 tabIndex = 0,
1708 native: isNativeButton = true,
1709 composite: compositeProp
1710 } = parameters;
1711 const elementRef = React15.useRef(null);
1712 const compositeRootContext = useCompositeRootContext(true);
1713 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
1714 const {
1715 props: focusableWhenDisabledProps
1716 } = useFocusableWhenDisabled({
1717 focusableWhenDisabled,
1718 disabled: disabled2,
1719 composite: isCompositeItem,
1720 tabIndex,
1721 isNativeButton
1722 });
1723 if (true) {
1724 React15.useEffect(() => {
1725 if (!elementRef.current) {
1726 return;
1727 }
1728 const isButtonTag = isButtonElement(elementRef.current);
1729 if (isNativeButton) {
1730 if (!isButtonTag) {
1731 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
1732 const message2 = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`.";
1733 error(`${message2}${ownerStackMessage}`);
1734 }
1735 } else if (isButtonTag) {
1736 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
1737 const message2 = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`.";
1738 error(`${message2}${ownerStackMessage}`);
1739 }
1740 }, [isNativeButton]);
1741 }
1742 const updateDisabled = React15.useCallback(() => {
1743 const element = elementRef.current;
1744 if (!isButtonElement(element)) {
1745 return;
1746 }
1747 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) {
1748 element.disabled = false;
1749 }
1750 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]);
1751 useIsoLayoutEffect(updateDisabled, [updateDisabled]);
1752 const getButtonProps = React15.useCallback((externalProps = {}) => {
1753 const {
1754 onClick: externalOnClick,
1755 onMouseDown: externalOnMouseDown,
1756 onKeyUp: externalOnKeyUp,
1757 onKeyDown: externalOnKeyDown,
1758 onPointerDown: externalOnPointerDown,
1759 ...otherExternalProps
1760 } = externalProps;
1761 return mergeProps({
1762 onClick(event) {
1763 if (disabled2) {
1764 event.preventDefault();
1765 return;
1766 }
1767 externalOnClick?.(event);
1768 },
1769 onMouseDown(event) {
1770 if (!disabled2) {
1771 externalOnMouseDown?.(event);
1772 }
1773 },
1774 onKeyDown(event) {
1775 if (disabled2) {
1776 return;
1777 }
1778 makeEventPreventable(event);
1779 externalOnKeyDown?.(event);
1780 if (event.baseUIHandlerPrevented) {
1781 return;
1782 }
1783 const isCurrentTarget = event.target === event.currentTarget;
1784 const currentTarget = event.currentTarget;
1785 const isButton = isButtonElement(currentTarget);
1786 const isLink = !isNativeButton && isValidLinkElement(currentTarget);
1787 const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
1788 const isEnterKey = event.key === "Enter";
1789 const isSpaceKey = event.key === " ";
1790 const role = currentTarget.getAttribute("role");
1791 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
1792 if (isCurrentTarget && isCompositeItem && isSpaceKey) {
1793 if (event.defaultPrevented && isTextNavigationRole) {
1794 return;
1795 }
1796 event.preventDefault();
1797 if (!isNativeButton || isButton) {
1798 event.preventBaseUIHandler();
1799 dispatchClickWithModifiers(currentTarget, event);
1800 }
1801 return;
1802 }
1803 if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {
1804 if (isCurrentTarget && isLink && isSpaceKey) {
1805 event.preventDefault();
1806 }
1807 return;
1808 }
1809 if (event.defaultPrevented) {
1810 return;
1811 }
1812 event.preventDefault();
1813 if (isEnterKey) {
1814 event.preventBaseUIHandler();
1815 dispatchClickWithModifiers(currentTarget, event);
1816 }
1817 },
1818 onKeyUp(event) {
1819 if (disabled2) {
1820 return;
1821 }
1822 makeEventPreventable(event);
1823 externalOnKeyUp?.(event);
1824 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
1825 event.preventDefault();
1826 return;
1827 }
1828 if (event.baseUIHandlerPrevented) {
1829 return;
1830 }
1831 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") {
1832 event.preventBaseUIHandler();
1833 dispatchClickWithModifiers(event.currentTarget, event);
1834 }
1835 },
1836 onPointerDown(event) {
1837 if (disabled2) {
1838 event.preventDefault();
1839 return;
1840 }
1841 externalOnPointerDown?.(event);
1842 }
1843 }, isNativeButton ? {
1844 type: "button"
1845 } : {
1846 role: "button"
1847 }, focusableWhenDisabledProps, otherExternalProps);
1848 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);
1849 const buttonRef = useStableCallback((element) => {
1850 elementRef.current = element;
1851 updateDisabled();
1852 });
1853 return {
1854 getButtonProps,
1855 buttonRef
1856 };
1857 }
1858 function isButtonElement(elem) {
1859 return isHTMLElement(elem) && elem.tagName === "BUTTON";
1860 }
1861 function isValidLinkElement(elem) {
1862 return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href);
1863 }
1864
1865 // node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs
1866 var React17 = __toESM(require_react(), 1);
1867
1868 // node_modules/@base-ui/utils/addEventListener.mjs
1869 function addEventListener(target, type, listener, options) {
1870 target.addEventListener(type, listener, options);
1871 return () => {
1872 target.removeEventListener(type, listener, options);
1873 };
1874 }
1875
1876 // node_modules/@base-ui/utils/useValueAsRef.mjs
1877 function useValueAsRef(value) {
1878 const latest = useRefWithInit(createLatestRef, value).current;
1879 latest.next = value;
1880 useIsoLayoutEffect(latest.effect);
1881 return latest;
1882 }
1883 function createLatestRef(value) {
1884 const latest = {
1885 current: value,
1886 next: value,
1887 effect: () => {
1888 latest.current = latest.next;
1889 }
1890 };
1891 return latest;
1892 }
1893
1894 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
1895 var React16 = __toESM(require_react(), 1);
1896
1897 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1898 var ReactDOM = __toESM(require_react_dom(), 1);
1899
1900 // node_modules/@base-ui/react/utils/resolveRef.mjs
1901 function resolveRef(maybeRef) {
1902 if (maybeRef == null) {
1903 return maybeRef;
1904 }
1905 return "current" in maybeRef ? maybeRef.current : maybeRef;
1906 }
1907
1908 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs
1909 var pendingCallbacks = null;
1910 function flushBeforePaint(fn) {
1911 if (!pendingCallbacks) {
1912 const callbacks = [];
1913 pendingCallbacks = callbacks;
1914 queueMicrotask(() => {
1915 pendingCallbacks = null;
1916 ReactDOM.flushSync(() => {
1917 for (const callback of callbacks) {
1918 callback();
1919 }
1920 });
1921 });
1922 }
1923 pendingCallbacks.push(fn);
1924 }
1925 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) {
1926 const frame = useAnimationFrame();
1927 return useStableCallback((fnToExecute, signal = null) => {
1928 frame.cancel();
1929 const element = resolveRef(elementOrRef);
1930 if (element == null) {
1931 return;
1932 }
1933 const resolvedElement = element;
1934 const done = () => {
1935 if (!batch) {
1936 ReactDOM.flushSync(fnToExecute);
1937 return;
1938 }
1939 flushBeforePaint(() => {
1940 if (!signal?.aborted) {
1941 fnToExecute();
1942 }
1943 });
1944 };
1945 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) {
1946 fnToExecute();
1947 return;
1948 }
1949 function exec() {
1950 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => {
1951 if (!signal?.aborted) {
1952 done();
1953 }
1954 }, () => {
1955 if (signal?.aborted) {
1956 return;
1957 }
1958 const currentAnimations = resolvedElement.getAnimations();
1959 if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) {
1960 exec();
1961 return;
1962 }
1963 done();
1964 });
1965 }
1966 if (waitForStartingStyleRemoved) {
1967 const startingStyleAttribute = startingStyle;
1968 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1969 frame.request(exec);
1970 return;
1971 }
1972 const attributeObserver = new MutationObserver(() => {
1973 if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
1974 attributeObserver.disconnect();
1975 exec();
1976 }
1977 });
1978 attributeObserver.observe(resolvedElement, {
1979 attributes: true,
1980 attributeFilter: [startingStyleAttribute]
1981 });
1982 signal?.addEventListener("abort", () => attributeObserver.disconnect(), {
1983 once: true
1984 });
1985 return;
1986 }
1987 frame.request(exec);
1988 });
1989 }
1990
1991 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs
1992 function useOpenChangeComplete(parameters) {
1993 const {
1994 enabled = true,
1995 open: open3,
1996 ref,
1997 batch = false,
1998 onComplete: onCompleteParam
1999 } = parameters;
2000 const onComplete = useStableCallback(onCompleteParam);
2001 const runOnceAnimationsFinish = useAnimationsFinished(ref, open3, batch);
2002 React16.useEffect(() => {
2003 if (!enabled) {
2004 return void 0;
2005 }
2006 const abortController = new AbortController();
2007 runOnceAnimationsFinish(onComplete, abortController.signal);
2008 return () => {
2009 abortController.abort();
2010 };
2011 }, [enabled, open3, onComplete, runOnceAnimationsFinish]);
2012 }
2013
2014 // node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs
2015 var EMPTY_DIMENSIONS = {
2016 height: void 0,
2017 width: void 0
2018 };
2019 function useCollapsiblePanel(parameters) {
2020 const {
2021 externalRef,
2022 hiddenUntilFound,
2023 id: idParam,
2024 keepMounted,
2025 mounted,
2026 onOpenChange,
2027 open: open3,
2028 setMounted,
2029 setOpen,
2030 transitionStatus
2031 } = parameters;
2032 const panelRef = React17.useRef(null);
2033 const animationTypeRef = React17.useRef(null);
2034 const [dimensions, setDimensionsUnwrapped] = React17.useState(EMPTY_DIMENSIONS);
2035 const lastMeasuredDimensionsRef = React17.useRef(EMPTY_DIMENSIONS);
2036 const shouldSkipNextOpenRef = React17.useRef(false);
2037 const shouldPreventMountAnimationRef = React17.useRef(open3);
2038 const shouldPreventActivityResumeAnimationRef = React17.useRef(false);
2039 const [forcePanelIdle, setForcePanelIdle] = React17.useState(false);
2040 const pendingTemporaryStyleRestoreRef = React17.useRef(null);
2041 const mergedPanelRef = useMergedRefs(externalRef, panelRef);
2042 const latestOpenRef = useValueAsRef(open3);
2043 const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef);
2044 const hidden = !open3 && !mounted;
2045 const panelTransitionStatus = forcePanelIdle ? "idle" : transitionStatus;
2046 const shouldPreventOpenAnimation = open3 && // These 2 refs are safe to read in render, they are only written from committed
2047 // layout/effect paths and gate one-shot motion suppression for the next open
2048 // lifecycle. They intentionally expose the last committed motion snapshot.
2049 (shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current);
2050 const renderedDimensions = !open3 && mounted && // These 2 refs are also safe to read in render, both hold the last committed
2051 // animation mode and measurement. This fallback only restores a previously
2052 // measured pixel size after the live dimensions state has been reset back to `auto`.
2053 animationTypeRef.current === "css-animation" && dimensions.height === void 0 && dimensions.width === void 0 ? lastMeasuredDimensionsRef.current : dimensions;
2054 const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== "css-animation";
2055 const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => {
2056 if (shouldCacheMeasurement) {
2057 lastMeasuredDimensionsRef.current = nextDimensions;
2058 }
2059 setDimensionsUnwrapped(nextDimensions);
2060 });
2061 const restorePendingTemporaryStyle = useStableCallback(() => {
2062 pendingTemporaryStyleRestoreRef.current?.();
2063 pendingTemporaryStyleRestoreRef.current = null;
2064 });
2065 const setPendingTemporaryStyleRestore = useStableCallback((restore) => {
2066 restorePendingTemporaryStyle();
2067 pendingTemporaryStyleRestoreRef.current = () => {
2068 pendingTemporaryStyleRestoreRef.current = null;
2069 restore();
2070 };
2071 });
2072 const markActivityResumeAnimationSuppressed = useStableCallback(() => {
2073 if (open3 && mounted && animationTypeRef.current === "css-animation") {
2074 shouldPreventActivityResumeAnimationRef.current = true;
2075 }
2076 });
2077 useIsoLayoutEffect(() => {
2078 if (!forcePanelIdle || transitionStatus === "starting") {
2079 return;
2080 }
2081 setForcePanelIdle(false);
2082 }, [forcePanelIdle, transitionStatus]);
2083 React17.useEffect(() => {
2084 return () => {
2085 markActivityResumeAnimationSuppressed();
2086 restorePendingTemporaryStyle();
2087 };
2088 }, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]);
2089 useIsoLayoutEffect(() => {
2090 const panel = panelRef.current;
2091 if (!panel) {
2092 return void 0;
2093 }
2094 if (!open3 && pendingTemporaryStyleRestoreRef.current) {
2095 restorePendingTemporaryStyle();
2096 }
2097 const animationType = getAnimationType(panel, shouldPreventOpenAnimation);
2098 animationTypeRef.current = animationType;
2099 if (open3 && transitionStatus === "idle" && shouldPreventMountAnimationRef.current && animationType === "css-animation") {
2100 lastMeasuredDimensionsRef.current = getDimensions(panel);
2101 return void 0;
2102 }
2103 if (open3 && transitionStatus === "starting") {
2104 const skipNextOpen = shouldSkipNextOpenRef.current;
2105 shouldSkipNextOpenRef.current = false;
2106 if (animationType === "none") {
2107 setDimensions(getDimensions(panel));
2108 setForcePanelIdle(true);
2109 return void 0;
2110 }
2111 if (animationType === "css-transition") {
2112 const restoreLayoutStyles = resetLayoutStyles(panel);
2113 setDimensions(getDimensions(panel));
2114 if (!skipNextOpen) {
2115 return restoreLayoutStyles;
2116 }
2117 const restoreTransitionDuration = setTemporaryStyle(panel, "transition-duration", "0s");
2118 setPendingTemporaryStyleRestore(restoreTransitionDuration);
2119 setForcePanelIdle(true);
2120 return restoreLayoutStyles;
2121 }
2122 setDimensions(getDimensions(panel));
2123 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none");
2124 if (!skipNextOpen) {
2125 restoreAnimationName();
2126 return void 0;
2127 }
2128 const restoreAnimationDuration = setTemporaryStyle(panel, "animation-duration", "0s");
2129 restoreAnimationName();
2130 setPendingTemporaryStyleRestore(restoreAnimationDuration);
2131 setForcePanelIdle(true);
2132 return void 0;
2133 }
2134 if (!open3 && mounted && (transitionStatus === "idle" || transitionStatus === "starting")) {
2135 shouldPreventMountAnimationRef.current = false;
2136 shouldPreventActivityResumeAnimationRef.current = false;
2137 if (animationType === "none") {
2138 setDimensions(EMPTY_DIMENSIONS, false);
2139 setMounted(false);
2140 return void 0;
2141 }
2142 setDimensions(getDimensions(panel));
2143 return void 0;
2144 }
2145 if (transitionStatus !== "ending") {
2146 return void 0;
2147 }
2148 if (animationType === "none") {
2149 setMounted(false);
2150 return void 0;
2151 }
2152 const nextDimensions = getDimensions(panel);
2153 const hasMeasuredSize = nextDimensions.height > 0 || nextDimensions.width > 0;
2154 if (!hasMeasuredSize) {
2155 setMounted(false);
2156 return void 0;
2157 }
2158 setDimensions(nextDimensions);
2159 if (animationType === "css-animation") {
2160 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none");
2161 restoreAnimationName();
2162 }
2163 return void 0;
2164 }, [mounted, open3, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]);
2165 useOpenChangeComplete({
2166 enabled: open3 && mounted && panelTransitionStatus === "idle",
2167 open: true,
2168 ref: panelRef,
2169 onComplete() {
2170 if (!open3) {
2171 return;
2172 }
2173 setDimensions(EMPTY_DIMENSIONS, false);
2174 }
2175 });
2176 React17.useEffect(() => {
2177 if (open3 || !mounted || panelTransitionStatus !== "ending") {
2178 return void 0;
2179 }
2180 const panel = panelRef.current;
2181 if (!panel) {
2182 return void 0;
2183 }
2184 const abortController = new AbortController();
2185 let endingStyleFrame = -1;
2186 function handleComplete() {
2187 if (latestOpenRef.current) {
2188 return;
2189 }
2190 setMounted(false);
2191 setDimensions(EMPTY_DIMENSIONS, false);
2192 }
2193 endingStyleFrame = AnimationFrame.request(() => {
2194 runOnceCloseAnimationsFinish(handleComplete, abortController.signal);
2195 });
2196 return () => {
2197 AnimationFrame.cancel(endingStyleFrame);
2198 abortController.abort();
2199 };
2200 }, [latestOpenRef, mounted, open3, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]);
2201 useIsoLayoutEffect(() => {
2202 const panel = panelRef.current;
2203 if (!panel || !hiddenUntilFound || !hidden) {
2204 return;
2205 }
2206 panel.setAttribute("hidden", "until-found");
2207 }, [hidden, hiddenUntilFound]);
2208 React17.useEffect(function registerBeforeMatchListener() {
2209 const panel = panelRef.current;
2210 if (!panel) {
2211 return void 0;
2212 }
2213 function handleBeforeMatch(event) {
2214 const eventDetails = createChangeEventDetails(reason_parts_exports.none, event);
2215 onOpenChange(true, eventDetails);
2216 if (eventDetails.isCanceled) {
2217 return;
2218 }
2219 shouldSkipNextOpenRef.current = true;
2220 setOpen(true);
2221 }
2222 return addEventListener(panel, "beforematch", handleBeforeMatch);
2223 }, [onOpenChange, setOpen]);
2224 const shouldRender = keepMounted || hiddenUntilFound || mounted || open3;
2225 return {
2226 height: renderedDimensions.height,
2227 props: {
2228 ...shouldPersistHiddenTransitionStyles ? {
2229 [startingStyle2]: ""
2230 } : void 0,
2231 hidden,
2232 id: idParam
2233 },
2234 ref: mergedPanelRef,
2235 shouldPreventOpenAnimation,
2236 shouldRender,
2237 transitionStatus: panelTransitionStatus,
2238 width: renderedDimensions.width
2239 };
2240 }
2241 function getDimensions(element) {
2242 return {
2243 height: element.scrollHeight,
2244 width: element.scrollWidth
2245 };
2246 }
2247 function getAnimationType(element, hasSuppressedMountAnimation) {
2248 const panelStyles = getWindow(element).getComputedStyle(element);
2249 const hasAnimation = (panelStyles.animationName.split(",").map((name) => name.trim()).some((name) => name !== "" && name !== "none") || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration);
2250 const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration);
2251 if (hasAnimation && hasTransition) {
2252 if (true) {
2253 warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used.");
2254 }
2255 return "css-transition";
2256 }
2257 if (hasTransition) {
2258 return "css-transition";
2259 }
2260 if (hasAnimation) {
2261 return "css-animation";
2262 }
2263 return "none";
2264 }
2265 function hasNonZeroDuration(value) {
2266 return value.split(",").map((part) => part.trim()).some((part) => part !== "" && Number.parseFloat(part) > 0);
2267 }
2268 function setTemporaryStyle(element, property, value) {
2269 const previousValue = element.style.getPropertyValue(property);
2270 const previousPriority = element.style.getPropertyPriority(property);
2271 element.style.setProperty(property, value);
2272 return () => {
2273 if (previousValue === "") {
2274 element.style.removeProperty(property);
2275 return;
2276 }
2277 element.style.setProperty(property, previousValue, previousPriority);
2278 };
2279 }
2280 function resetLayoutStyles(element) {
2281 const originalLayoutStyles = {
2282 "justify-content": element.style.justifyContent,
2283 "align-items": element.style.alignItems,
2284 "align-content": element.style.alignContent,
2285 "justify-items": element.style.justifyItems
2286 };
2287 Object.keys(originalLayoutStyles).forEach((key) => {
2288 element.style.setProperty(key, "initial", "important");
2289 });
2290 function restoreLayoutStyles() {
2291 Object.entries(originalLayoutStyles).forEach(([key, value]) => {
2292 if (value === "") {
2293 element.style.removeProperty(key);
2294 return;
2295 }
2296 element.style.setProperty(key, value);
2297 });
2298 }
2299 const frame = AnimationFrame.request(restoreLayoutStyles);
2300 return () => {
2301 AnimationFrame.cancel(frame);
2302 restoreLayoutStyles();
2303 };
2304 }
2305
2306 // node_modules/@base-ui/utils/platform/parts.mjs
2307 var parts_exports = {};
2308 __export(parts_exports, {
2309 engine: () => engine_exports,
2310 env: () => env_exports,
2311 mediaQuery: () => media_query_exports,
2312 os: () => os_exports,
2313 screenReader: () => screen_reader_exports
2314 });
2315
2316 // node_modules/@base-ui/utils/platform/os.mjs
2317 var os_exports = {};
2318 __export(os_exports, {
2319 android: () => android,
2320 apple: () => apple,
2321 ios: () => ios,
2322 linux: () => linux,
2323 mac: () => mac,
2324 windows: () => windows
2325 });
2326
2327 // node_modules/@base-ui/utils/platform/shared.mjs
2328 function readRawData() {
2329 if (typeof navigator === "undefined") {
2330 return {
2331 userAgent: "",
2332 platform: "",
2333 maxTouchPoints: 0
2334 };
2335 }
2336 if (true) {
2337 const uaData = navigator.userAgentData;
2338 if (uaData && Array.isArray(uaData.brands)) {
2339 return {
2340 userAgent: uaData.brands.map(({
2341 brand,
2342 version: version2
2343 }) => `${brand}/${version2}`).join(" "),
2344 platform: uaData.platform ?? navigator.platform ?? "",
2345 maxTouchPoints: navigator.maxTouchPoints ?? 0
2346 };
2347 }
2348 }
2349 return {
2350 userAgent: navigator.userAgent,
2351 platform: navigator.platform ?? "",
2352 maxTouchPoints: navigator.maxTouchPoints ?? 0
2353 };
2354 }
2355 var {
2356 userAgent,
2357 platform,
2358 maxTouchPoints
2359 } = readRawData();
2360 var lowerUserAgent = userAgent.toLowerCase();
2361 var lowerPlatform = platform.toLowerCase();
2362
2363 // node_modules/@base-ui/utils/platform/os.mjs
2364 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1;
2365 var ANDROID_STRING = "android";
2366 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);
2367 var mac = !ios && lowerPlatform.startsWith("mac");
2368 var windows = lowerPlatform.startsWith("win");
2369 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform);
2370 var apple = mac || ios;
2371
2372 // node_modules/@base-ui/utils/platform/engine.mjs
2373 var engine_exports = {};
2374 __export(engine_exports, {
2375 blink: () => blink,
2376 gecko: () => gecko,
2377 webkit: () => webkit
2378 });
2379 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none");
2380 var gecko = !webkit && lowerUserAgent.includes("firefox");
2381 var blink = !webkit && lowerUserAgent.includes("chrom");
2382
2383 // node_modules/@base-ui/utils/platform/screen-reader.mjs
2384 var screen_reader_exports = {};
2385 __export(screen_reader_exports, {
2386 voiceOver: () => voiceOver
2387 });
2388 var voiceOver = apple;
2389
2390 // node_modules/@base-ui/utils/platform/env.mjs
2391 var env_exports = {};
2392 __export(env_exports, {
2393 jsdom: () => jsdom
2394 });
2395 var jsdom = /jsdom|happydom/.test(lowerUserAgent);
2396
2397 // node_modules/@base-ui/utils/platform/media-query.mjs
2398 var media_query_exports = {};
2399 __export(media_query_exports, {
2400 iOS: () => iOS
2401 });
2402 var iOS = "@supports (-webkit-touch-callout: none)";
2403
2404 // node_modules/@base-ui/utils/useTimeout.mjs
2405 var EMPTY2 = 0;
2406 var Timeout = class _Timeout {
2407 static create() {
2408 return new _Timeout();
2409 }
2410 currentId = EMPTY2;
2411 /**
2412 * Executes `fn` after `delay`, clearing any previously scheduled call.
2413 */
2414 start(delay, fn) {
2415 this.clear();
2416 this.currentId = setTimeout(() => {
2417 this.currentId = EMPTY2;
2418 fn();
2419 }, delay);
2420 }
2421 isStarted() {
2422 return this.currentId !== EMPTY2;
2423 }
2424 clear = () => {
2425 if (this.currentId !== EMPTY2) {
2426 clearTimeout(this.currentId);
2427 this.currentId = EMPTY2;
2428 }
2429 };
2430 disposeEffect = () => {
2431 return this.clear;
2432 };
2433 };
2434 function useTimeout() {
2435 const timeout = useRefWithInit(Timeout.create).current;
2436 useOnMount(timeout.disposeEffect);
2437 return timeout;
2438 }
2439
2440 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
2441 var React18 = __toESM(require_react(), 1);
2442
2443 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs
2444 function isReactEvent(event) {
2445 return "nativeEvent" in event;
2446 }
2447 function isVirtualClick(event) {
2448 if (event.pointerType === "" && event.isTrusted) {
2449 return true;
2450 }
2451 if (parts_exports.os.android && event.pointerType) {
2452 return event.type === "click" && event.buttons === 1;
2453 }
2454 return event.detail === 0 && !event.pointerType;
2455 }
2456 function isMouseLikePointerType(pointerType, strict) {
2457 const values = ["mouse", "pen"];
2458 if (!strict) {
2459 values.push("", void 0);
2460 }
2461 return values.includes(pointerType);
2462 }
2463 function isClickLikeEvent(event) {
2464 const type = event.type;
2465 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
2466 }
2467
2468 // node_modules/@base-ui/utils/shadowDom.mjs
2469 function activeElement(doc) {
2470 let element = doc.activeElement;
2471 while (element?.shadowRoot?.activeElement != null) {
2472 element = element.shadowRoot.activeElement;
2473 }
2474 return element;
2475 }
2476 function contains(parent, child) {
2477 if (!parent || !child) {
2478 return false;
2479 }
2480 const rootNode = child.getRootNode?.();
2481 if (parent.contains(child)) {
2482 return true;
2483 }
2484 if (rootNode && isShadowRoot(rootNode)) {
2485 let next = child;
2486 while (next) {
2487 if (parent === next) {
2488 return true;
2489 }
2490 next = next.parentNode || next.host;
2491 }
2492 }
2493 return false;
2494 }
2495 function getTarget(event) {
2496 if ("composedPath" in event) {
2497 return event.composedPath()[0] ?? event.target;
2498 }
2499 return event.target;
2500 }
2501
2502 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs
2503 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
2504 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
2505
2506 // node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs
2507 var open2 = "data-open";
2508 var closed2 = "data-closed";
2509 var anchorHidden = "data-anchor-hidden";
2510
2511 // node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs
2512 var CommonTriggerDataAttributes_exports = {};
2513 __export(CommonTriggerDataAttributes_exports, {
2514 popupOpen: () => popupOpen,
2515 pressed: () => pressed
2516 });
2517 var popupOpen = "data-popup-open";
2518 var pressed = "data-pressed";
2519
2520 // node_modules/@base-ui/react/utils/popupStateMapping.mjs
2521 var TRIGGER_HOOK = {
2522 [popupOpen]: ""
2523 };
2524 var PRESSABLE_TRIGGER_HOOK = {
2525 [popupOpen]: "",
2526 [pressed]: ""
2527 };
2528 var POPUP_OPEN_HOOK = {
2529 [open2]: ""
2530 };
2531 var POPUP_CLOSED_HOOK = {
2532 [closed2]: ""
2533 };
2534 var ANCHOR_HIDDEN_HOOK = {
2535 [anchorHidden]: ""
2536 };
2537 var triggerOpenStateMapping2 = {
2538 open(value) {
2539 if (value) {
2540 return TRIGGER_HOOK;
2541 }
2542 return null;
2543 }
2544 };
2545 var popupStateMapping = {
2546 open(value) {
2547 if (value) {
2548 return POPUP_OPEN_HOOK;
2549 }
2550 return POPUP_CLOSED_HOOK;
2551 },
2552 anchorHidden(value) {
2553 if (value) {
2554 return ANCHOR_HIDDEN_HOOK;
2555 }
2556 return null;
2557 }
2558 };
2559 var popupTransitionStateMapping = {
2560 ...popupStateMapping,
2561 ...transitionStatusMapping
2562 };
2563
2564 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs
2565 var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen;
2566 var triggerDisabled = "data-trigger-disabled";
2567
2568 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs
2569 function isTargetInsideEnabledTrigger(target, triggerElements) {
2570 if (!isElement(target)) {
2571 return false;
2572 }
2573 const targetElement = target;
2574 if (triggerElements.hasElement(targetElement)) {
2575 return !targetElement.hasAttribute(triggerDisabled);
2576 }
2577 for (const [, trigger] of triggerElements.entries()) {
2578 if (contains(trigger, targetElement)) {
2579 return !trigger.hasAttribute(triggerDisabled);
2580 }
2581 }
2582 return false;
2583 }
2584 function isEventTargetWithin(event, node) {
2585 if (node == null) {
2586 return false;
2587 }
2588 if ("composedPath" in event) {
2589 return event.composedPath().includes(node);
2590 }
2591 const eventAgain = event;
2592 return eventAgain.target != null && node.contains(eventAgain.target);
2593 }
2594 function isRootElement(element) {
2595 return element.matches("html,body");
2596 }
2597 function isTypeableElement(element) {
2598 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
2599 }
2600 function isInteractiveElement(element) {
2601 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null;
2602 }
2603 function matchesFocusVisible(element) {
2604 if (!element || parts_exports.env.jsdom) {
2605 return true;
2606 }
2607 try {
2608 return element.matches(":focus-visible");
2609 } catch (_e) {
2610 return true;
2611 }
2612 }
2613
2614 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs
2615 function resolveValue(value, pointerType) {
2616 if (pointerType != null && !isMouseLikePointerType(pointerType)) {
2617 return 0;
2618 }
2619 if (typeof value === "function") {
2620 return value();
2621 }
2622 return value;
2623 }
2624 function getDelay(value, prop, pointerType) {
2625 const result = resolveValue(value, pointerType);
2626 if (typeof result === "number") {
2627 return result;
2628 }
2629 return result?.[prop];
2630 }
2631 function getRestMs(value) {
2632 if (typeof value === "function") {
2633 return value();
2634 }
2635 return value;
2636 }
2637 function isClickLikeOpenEvent(openEventType, interactedInside) {
2638 return interactedInside || openEventType === "click" || openEventType === "mousedown";
2639 }
2640 function isHoverOpenEvent(openEventType) {
2641 return openEventType?.includes("mouse") && openEventType !== "mousedown";
2642 }
2643
2644 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs
2645 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
2646 var FloatingDelayGroupContext = /* @__PURE__ */ React18.createContext({
2647 hasProvider: false,
2648 timeoutMs: 0,
2649 delayRef: {
2650 current: 0
2651 },
2652 initialDelayRef: {
2653 current: 0
2654 },
2655 timeout: new Timeout(),
2656 currentIdRef: {
2657 current: null
2658 },
2659 currentContextRef: {
2660 current: null
2661 }
2662 });
2663 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
2664 function resetDelayRef(delayRef, initialDelayRef) {
2665 delayRef.current = initialDelayRef.current;
2666 }
2667 function FloatingDelayGroup(props) {
2668 const {
2669 children,
2670 delay,
2671 timeoutMs = 0
2672 } = props;
2673 const delayRef = React18.useRef(delay);
2674 const initialDelayRef = React18.useRef(delay);
2675 const currentIdRef = React18.useRef(null);
2676 const currentContextRef = React18.useRef(null);
2677 const timeout = useTimeout();
2678 useIsoLayoutEffect(() => {
2679 initialDelayRef.current = delay;
2680 if (!currentIdRef.current) {
2681 delayRef.current = delay;
2682 return;
2683 }
2684 delayRef.current = {
2685 open: getDelay(delayRef.current, "open"),
2686 close: getDelay(delay, "close")
2687 };
2688 }, [delay, currentIdRef, delayRef, initialDelayRef]);
2689 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, {
2690 value: React18.useMemo(() => ({
2691 hasProvider: true,
2692 delayRef,
2693 initialDelayRef,
2694 currentIdRef,
2695 timeoutMs,
2696 currentContextRef,
2697 timeout
2698 }), [timeoutMs, timeout]),
2699 children
2700 });
2701 }
2702 function useDelayGroup(context, options = {
2703 open: false
2704 }) {
2705 const {
2706 open: open3
2707 } = options;
2708 const store = "rootStore" in context ? context.rootStore : context;
2709 const floatingId = store.useState("floatingId");
2710 const groupContext = React18.useContext(FloatingDelayGroupContext);
2711 const {
2712 currentIdRef,
2713 delayRef,
2714 timeoutMs,
2715 initialDelayRef,
2716 currentContextRef,
2717 hasProvider,
2718 timeout
2719 } = groupContext;
2720 const [isInstantPhase, setIsInstantPhase] = React18.useState(false);
2721 const openRef = React18.useRef(open3);
2722 useIsoLayoutEffect(() => {
2723 openRef.current = open3;
2724 }, [open3]);
2725 useIsoLayoutEffect(() => {
2726 function unset() {
2727 currentContextRef.current?.setIsInstantPhase(false);
2728 currentIdRef.current = null;
2729 currentContextRef.current = null;
2730 delayRef.current = initialDelayRef.current;
2731 timeout.clear();
2732 }
2733 if (!currentIdRef.current) {
2734 return void 0;
2735 }
2736 if (!open3 && currentIdRef.current === floatingId) {
2737 setIsInstantPhase(false);
2738 if (timeoutMs) {
2739 const closingId = floatingId;
2740 timeout.start(timeoutMs, () => {
2741 if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
2742 return;
2743 }
2744 unset();
2745 });
2746 return () => {
2747 if (openRef.current || currentIdRef.current !== closingId) {
2748 timeout.clear();
2749 }
2750 };
2751 }
2752 unset();
2753 }
2754 return void 0;
2755 }, [open3, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]);
2756 useIsoLayoutEffect(() => {
2757 if (!open3) {
2758 return;
2759 }
2760 const prevContext = currentContextRef.current;
2761 const prevId = currentIdRef.current;
2762 timeout.clear();
2763 currentContextRef.current = {
2764 onOpenChange: store.setOpen,
2765 setIsInstantPhase
2766 };
2767 currentIdRef.current = floatingId;
2768 delayRef.current = {
2769 open: 0,
2770 close: getDelay(initialDelayRef.current, "close")
2771 };
2772 if (prevId !== null && prevId !== floatingId) {
2773 setIsInstantPhase(true);
2774 prevContext?.setIsInstantPhase(true);
2775 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none));
2776 } else {
2777 setIsInstantPhase(false);
2778 prevContext?.setIsInstantPhase(false);
2779 }
2780 }, [open3, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]);
2781 useIsoLayoutEffect(() => {
2782 return () => {
2783 if (currentIdRef.current === floatingId) {
2784 currentContextRef.current = null;
2785 if (!openRef.current) {
2786 return;
2787 }
2788 currentIdRef.current = null;
2789 resetDelayRef(delayRef, initialDelayRef);
2790 timeout.clear();
2791 }
2792 };
2793 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]);
2794 return React18.useMemo(() => ({
2795 activeIdRef: currentIdRef,
2796 hasProvider,
2797 delayRef,
2798 isInstantPhase
2799 }), [currentIdRef, hasProvider, delayRef, isInstantPhase]);
2800 }
2801
2802 // node_modules/@base-ui/utils/mergeCleanups.mjs
2803 function mergeCleanups(...cleanups) {
2804 return () => {
2805 for (let i = 0; i < cleanups.length; i += 1) {
2806 const cleanup = cleanups[i];
2807 if (cleanup) {
2808 cleanup();
2809 }
2810 }
2811 };
2812 }
2813
2814 // node_modules/@base-ui/react/utils/FocusGuard.mjs
2815 var React19 = __toESM(require_react(), 1);
2816
2817 // node_modules/@base-ui/utils/visuallyHidden.mjs
2818 var visuallyHiddenBase = {
2819 clipPath: "inset(50%)",
2820 overflow: "hidden",
2821 whiteSpace: "nowrap",
2822 border: 0,
2823 padding: 0,
2824 width: 1,
2825 height: 1,
2826 margin: -1
2827 };
2828 var visuallyHidden = {
2829 ...visuallyHiddenBase,
2830 position: "fixed",
2831 top: 0,
2832 left: 0
2833 };
2834 var visuallyHiddenInput = {
2835 ...visuallyHiddenBase,
2836 position: "absolute"
2837 };
2838
2839 // node_modules/@base-ui/react/utils/FocusGuard.mjs
2840 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
2841 var FocusGuard = /* @__PURE__ */ React19.forwardRef(function FocusGuard2(props, ref) {
2842 const [role, setRole] = React19.useState();
2843 useIsoLayoutEffect(() => {
2844 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) {
2845 setRole("button");
2846 }
2847 }, []);
2848 const restProps = {
2849 tabIndex: 0,
2850 // Role is only for VoiceOver
2851 role
2852 };
2853 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
2854 ...props,
2855 ref,
2856 style: visuallyHidden,
2857 "aria-hidden": role ? void 0 : true,
2858 ...restProps,
2859 "data-base-ui-focus-guard": ""
2860 });
2861 });
2862 if (true) FocusGuard.displayName = "FocusGuard";
2863
2864 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
2865 var min = Math.min;
2866 var max = Math.max;
2867 var round = Math.round;
2868 var floor = Math.floor;
2869 var createCoords = (v2) => ({
2870 x: v2,
2871 y: v2
2872 });
2873 var oppositeSideMap = {
2874 left: "right",
2875 right: "left",
2876 bottom: "top",
2877 top: "bottom"
2878 };
2879 function clamp(start, value, end) {
2880 return max(start, min(value, end));
2881 }
2882 function evaluate(value, param) {
2883 return typeof value === "function" ? value(param) : value;
2884 }
2885 function getSide(placement) {
2886 return placement.split("-")[0];
2887 }
2888 function getAlignment(placement) {
2889 return placement.split("-")[1];
2890 }
2891 function getOppositeAxis(axis) {
2892 return axis === "x" ? "y" : "x";
2893 }
2894 function getAxisLength(axis) {
2895 return axis === "y" ? "height" : "width";
2896 }
2897 function getSideAxis(placement) {
2898 const firstChar = placement[0];
2899 return firstChar === "t" || firstChar === "b" ? "y" : "x";
2900 }
2901 function getAlignmentAxis(placement) {
2902 return getOppositeAxis(getSideAxis(placement));
2903 }
2904 function getAlignmentSides(placement, rects, rtl) {
2905 if (rtl === void 0) {
2906 rtl = false;
2907 }
2908 const alignment = getAlignment(placement);
2909 const alignmentAxis = getAlignmentAxis(placement);
2910 const length = getAxisLength(alignmentAxis);
2911 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
2912 if (rects.reference[length] > rects.floating[length]) {
2913 mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
2914 }
2915 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
2916 }
2917 function getExpandedPlacements(placement) {
2918 const oppositePlacement = getOppositePlacement(placement);
2919 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
2920 }
2921 function getOppositeAlignmentPlacement(placement) {
2922 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
2923 }
2924 var lrPlacement = ["left", "right"];
2925 var rlPlacement = ["right", "left"];
2926 var tbPlacement = ["top", "bottom"];
2927 var btPlacement = ["bottom", "top"];
2928 function getSideList(side, isStart, rtl) {
2929 switch (side) {
2930 case "top":
2931 case "bottom":
2932 if (rtl) return isStart ? rlPlacement : lrPlacement;
2933 return isStart ? lrPlacement : rlPlacement;
2934 case "left":
2935 case "right":
2936 return isStart ? tbPlacement : btPlacement;
2937 default:
2938 return [];
2939 }
2940 }
2941 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
2942 const alignment = getAlignment(placement);
2943 let list = getSideList(getSide(placement), direction === "start", rtl);
2944 if (alignment) {
2945 list = list.map((side) => side + "-" + alignment);
2946 if (flipAlignment) {
2947 list = list.concat(list.map(getOppositeAlignmentPlacement));
2948 }
2949 }
2950 return list;
2951 }
2952 function getOppositePlacement(placement) {
2953 const side = getSide(placement);
2954 return oppositeSideMap[side] + placement.slice(side.length);
2955 }
2956 function expandPaddingObject(padding) {
2957 var _padding$top, _padding$right, _padding$bottom, _padding$left;
2958 return {
2959 top: (_padding$top = padding.top) != null ? _padding$top : 0,
2960 right: (_padding$right = padding.right) != null ? _padding$right : 0,
2961 bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
2962 left: (_padding$left = padding.left) != null ? _padding$left : 0
2963 };
2964 }
2965 function getPaddingObject(padding) {
2966 return typeof padding !== "number" ? expandPaddingObject(padding) : {
2967 top: padding,
2968 right: padding,
2969 bottom: padding,
2970 left: padding
2971 };
2972 }
2973 function rectToClientRect(rect) {
2974 const {
2975 x: x2,
2976 y: y2,
2977 width,
2978 height
2979 } = rect;
2980 return {
2981 width,
2982 height,
2983 top: y2,
2984 left: x2,
2985 right: x2 + width,
2986 bottom: y2 + height,
2987 x: x2,
2988 y: y2
2989 };
2990 }
2991
2992 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs
2993 function isHiddenByStyles(styles) {
2994 return styles.visibility === "hidden" || styles.visibility === "collapse";
2995 }
2996 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) {
2997 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
2998 return false;
2999 }
3000 if (typeof element.checkVisibility === "function") {
3001 return element.checkVisibility();
3002 }
3003 return styles.display !== "none" && styles.display !== "contents";
3004 }
3005
3006 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs
3007 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';
3008 function getParentElement(element) {
3009 const assignedSlot = element.assignedSlot;
3010 if (assignedSlot) {
3011 return assignedSlot;
3012 }
3013 if (element.parentElement) {
3014 return element.parentElement;
3015 }
3016 const rootNode = element.getRootNode();
3017 return isShadowRoot(rootNode) ? rootNode.host : null;
3018 }
3019 function getDetailsSummary(details) {
3020 for (const child of Array.from(details.children)) {
3021 if (getNodeName(child) === "summary") {
3022 return child;
3023 }
3024 }
3025 return null;
3026 }
3027 function isWithinOpenDetailsSummary(element, details) {
3028 const summary = getDetailsSummary(details);
3029 return !!summary && (element === summary || contains(summary, element));
3030 }
3031 function isFocusableCandidate(element) {
3032 const nodeName = element ? getNodeName(element) : "";
3033 return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== "summary" || element.parentElement != null && getNodeName(element.parentElement) === "details" && getDetailsSummary(element.parentElement) === element) && (nodeName !== "details" || getDetailsSummary(element) == null) && (nodeName !== "input" || element.type !== "hidden");
3034 }
3035 function isFocusableElement(element) {
3036 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) {
3037 return false;
3038 }
3039 for (let current = element; current; current = getParentElement(current)) {
3040 const isAncestor = current !== element;
3041 const isSlot = getNodeName(current) === "slot";
3042 if (current.hasAttribute("inert")) {
3043 return false;
3044 }
3045 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {
3046 return false;
3047 }
3048 }
3049 return true;
3050 }
3051 function isVisibleInTabbableTree(element, isAncestor) {
3052 const styles = getComputedStyle2(element);
3053 if (!isAncestor) {
3054 return isElementVisible(element, styles);
3055 }
3056 return styles.display !== "none";
3057 }
3058 function getTabIndex(element) {
3059 const tabIndex = element.tabIndex;
3060 if (tabIndex < 0) {
3061 const nodeName = getNodeName(element);
3062 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) {
3063 return 0;
3064 }
3065 }
3066 return tabIndex;
3067 }
3068 function getNamedRadioInput(element) {
3069 if (getNodeName(element) !== "input") {
3070 return null;
3071 }
3072 const input = element;
3073 return input.type === "radio" && input.name !== "" ? input : null;
3074 }
3075 function isTabbableRadio(element, candidates) {
3076 const input = getNamedRadioInput(element);
3077 if (!input) {
3078 return true;
3079 }
3080 const checkedRadio = candidates.find((candidate) => {
3081 const radio = getNamedRadioInput(candidate);
3082 return radio?.name === input.name && radio.form === input.form && radio.checked;
3083 });
3084 if (checkedRadio) {
3085 return checkedRadio === input;
3086 }
3087 return candidates.find((candidate) => {
3088 const radio = getNamedRadioInput(candidate);
3089 return radio?.name === input.name && radio.form === input.form;
3090 }) === input;
3091 }
3092 function getComposedChildren(container) {
3093 if (isHTMLElement(container) && getNodeName(container) === "slot") {
3094 const assignedElements = container.assignedElements({
3095 flatten: true
3096 });
3097 if (assignedElements.length > 0) {
3098 return assignedElements;
3099 }
3100 }
3101 if (isHTMLElement(container) && container.shadowRoot) {
3102 return Array.from(container.shadowRoot.children);
3103 }
3104 return Array.from(container.children);
3105 }
3106 function appendCandidates(container, list) {
3107 getComposedChildren(container).forEach((child) => {
3108 if (isFocusableCandidate(child)) {
3109 list.push(child);
3110 }
3111 appendCandidates(child, list);
3112 });
3113 }
3114 function appendMatchingElements(container, selector, list) {
3115 getComposedChildren(container).forEach((child) => {
3116 if (isHTMLElement(child) && child.matches(selector)) {
3117 list.push(child);
3118 }
3119 appendMatchingElements(child, selector, list);
3120 });
3121 }
3122 function focusable(container) {
3123 const candidates = [];
3124 appendCandidates(container, candidates);
3125 return candidates.filter(isFocusableElement);
3126 }
3127 function tabbable(container) {
3128 const candidates = focusable(container);
3129 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));
3130 }
3131 function getTabbableIn(container, dir) {
3132 const list = tabbable(container);
3133 const len = list.length;
3134 if (len === 0) {
3135 return void 0;
3136 }
3137 const active = activeElement(ownerDocument(container));
3138 const index2 = list.indexOf(active);
3139 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
3140 return list[nextIndex];
3141 }
3142 function getNextTabbable(referenceElement) {
3143 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;
3144 }
3145 function getPreviousTabbable(referenceElement) {
3146 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
3147 }
3148 function isOutsideEvent(event, container) {
3149 const containerElement = container || event.currentTarget;
3150 const relatedTarget = event.relatedTarget;
3151 return !relatedTarget || !contains(containerElement, relatedTarget);
3152 }
3153 function disableFocusInside(container) {
3154 const tabbableElements = tabbable(container);
3155 tabbableElements.forEach((element) => {
3156 element.dataset.tabindex = element.getAttribute("tabindex") || "";
3157 element.setAttribute("tabindex", "-1");
3158 });
3159 }
3160 function enableFocusInside(container) {
3161 const elements = [];
3162 appendMatchingElements(container, "[data-tabindex]", elements);
3163 elements.forEach((element) => {
3164 const tabindex = element.dataset.tabindex;
3165 delete element.dataset.tabindex;
3166 if (tabindex) {
3167 element.setAttribute("tabindex", tabindex);
3168 } else {
3169 element.removeAttribute("tabindex");
3170 }
3171 });
3172 }
3173
3174 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs
3175 function getNodeChildren(nodes, id, onlyOpenChildren = true) {
3176 const directChildren = nodes.filter((node) => node.parentId === id);
3177 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
3178 }
3179
3180 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs
3181 function createAttribute(name) {
3182 return `data-base-ui-${name}`;
3183 }
3184
3185 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
3186 var React20 = __toESM(require_react(), 1);
3187 var ReactDOM2 = __toESM(require_react_dom(), 1);
3188
3189 // node_modules/@base-ui/react/internals/constants.mjs
3190 var DISABLED_TRANSITIONS_STYLE = {
3191 style: {
3192 transition: "none"
3193 }
3194 };
3195 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore";
3196 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore";
3197 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;
3198 var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;
3199 var POPUP_COLLISION_AVOIDANCE = {
3200 fallbackAxisSide: "end"
3201 };
3202 var ownerVisuallyHidden = {
3203 clipPath: "inset(50%)",
3204 position: "fixed",
3205 top: 0,
3206 left: 0
3207 };
3208
3209 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs
3210 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
3211 var PortalContext = /* @__PURE__ */ React20.createContext(null);
3212 if (true) PortalContext.displayName = "PortalContext";
3213 var usePortalContext = () => React20.useContext(PortalContext);
3214 var attr = createAttribute("portal");
3215 function useFloatingPortalNode(props = {}) {
3216 const {
3217 ref,
3218 container: containerProp,
3219 componentProps = EMPTY_OBJECT,
3220 elementProps
3221 } = props;
3222 const uniqueId = useId();
3223 const portalContext = usePortalContext();
3224 const parentPortalNode = portalContext?.portalNode;
3225 const [containerElement, setContainerElement] = React20.useState(null);
3226 const [portalNode, setPortalNode] = React20.useState(null);
3227 const setPortalNodeRef = useStableCallback((node) => {
3228 if (node !== null) {
3229 setPortalNode(node);
3230 }
3231 });
3232 const containerRef = React20.useRef(null);
3233 useIsoLayoutEffect(() => {
3234 if (containerProp === null) {
3235 if (containerRef.current) {
3236 containerRef.current = null;
3237 setPortalNode(null);
3238 setContainerElement(null);
3239 }
3240 return;
3241 }
3242 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
3243 if (resolvedContainer == null) {
3244 if (containerRef.current) {
3245 containerRef.current = null;
3246 setPortalNode(null);
3247 setContainerElement(null);
3248 }
3249 return;
3250 }
3251 if (containerRef.current !== resolvedContainer) {
3252 containerRef.current = resolvedContainer;
3253 setPortalNode(null);
3254 setContainerElement(resolvedContainer);
3255 }
3256 }, [containerProp, parentPortalNode]);
3257 const portalElement = useRenderElement("div", componentProps, {
3258 ref: [ref, setPortalNodeRef],
3259 props: [{
3260 id: uniqueId,
3261 [attr]: ""
3262 }, elementProps]
3263 });
3264 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null;
3265 return {
3266 node: portalNode,
3267 // `id` and `render` props can override or remove the generated ID. Use the exact
3268 // rendered value so `aria-owns` never points at an ID absent from the DOM.
3269 nodeId: /* @__PURE__ */ React20.isValidElement(portalElement) ? portalElement.props.id : void 0,
3270 subtree: portalSubtree
3271 };
3272 }
3273 var FloatingPortal = /* @__PURE__ */ React20.forwardRef(function FloatingPortal2(componentProps, forwardedRef) {
3274 const {
3275 render: render4,
3276 className,
3277 style,
3278 children,
3279 container,
3280 portalOwnerRole,
3281 ...elementProps
3282 } = componentProps;
3283 const {
3284 node: portalNode,
3285 nodeId: portalNodeId,
3286 subtree: portalSubtree
3287 } = useFloatingPortalNode({
3288 container,
3289 ref: forwardedRef,
3290 componentProps,
3291 elementProps
3292 });
3293 const beforeOutsideRef = React20.useRef(null);
3294 const afterOutsideRef = React20.useRef(null);
3295 const beforeInsideRef = React20.useRef(null);
3296 const afterInsideRef = React20.useRef(null);
3297 const [focusManagerState, setFocusManagerState] = React20.useState(null);
3298 const focusInsideDisabledRef = React20.useRef(false);
3299 const modal = focusManagerState?.modal;
3300 const open3 = focusManagerState?.open;
3301 const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
3302 React20.useEffect(() => {
3303 if (!portalNode || modal) {
3304 return void 0;
3305 }
3306 function onFocus(event) {
3307 if (portalNode && event.relatedTarget && isOutsideEvent(event)) {
3308 if (event.type === "focusin") {
3309 if (focusInsideDisabledRef.current) {
3310 enableFocusInside(portalNode);
3311 focusInsideDisabledRef.current = false;
3312 }
3313 } else {
3314 disableFocusInside(portalNode);
3315 focusInsideDisabledRef.current = true;
3316 }
3317 }
3318 }
3319 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true));
3320 }, [portalNode, modal]);
3321 useIsoLayoutEffect(() => {
3322 if (!portalNode || open3 !== true || !focusInsideDisabledRef.current) {
3323 return;
3324 }
3325 enableFocusInside(portalNode);
3326 focusInsideDisabledRef.current = false;
3327 }, [open3, portalNode]);
3328 const portalContextValue = React20.useMemo(() => ({
3329 beforeOutsideRef,
3330 afterOutsideRef,
3331 beforeInsideRef,
3332 afterInsideRef,
3333 portalNode,
3334 setFocusManagerState
3335 }), [portalNode]);
3336 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React20.Fragment, {
3337 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, {
3338 value: portalContextValue,
3339 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
3340 "data-type": "outside",
3341 ref: beforeOutsideRef,
3342 onFocus: (event) => {
3343 if (isOutsideEvent(event, portalNode)) {
3344 beforeInsideRef.current?.focus();
3345 } else {
3346 const domReference = focusManagerState ? focusManagerState.domReference : null;
3347 const prevTabbable = getPreviousTabbable(domReference);
3348 prevTabbable?.focus();
3349 }
3350 }
3351 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", {
3352 role: portalOwnerRole,
3353 "aria-owns": portalNodeId,
3354 style: ownerVisuallyHidden
3355 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, {
3356 "data-type": "outside",
3357 ref: afterOutsideRef,
3358 onFocus: (event) => {
3359 if (isOutsideEvent(event, portalNode)) {
3360 afterInsideRef.current?.focus();
3361 } else {
3362 const domReference = focusManagerState ? focusManagerState.domReference : null;
3363 const nextTabbable = getNextTabbable(domReference);
3364 nextTabbable?.focus();
3365 if (focusManagerState?.closeOnFocusOut) {
3366 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent));
3367 }
3368 }
3369 }
3370 })]
3371 })]
3372 });
3373 });
3374 if (true) FloatingPortal.displayName = "FloatingPortal";
3375
3376 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3377 var React21 = __toESM(require_react(), 1);
3378
3379 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs
3380 function createEventEmitter() {
3381 const map = /* @__PURE__ */ new Map();
3382 return {
3383 emit(event, data) {
3384 map.get(event)?.forEach((listener) => listener(data));
3385 },
3386 on(event, listener) {
3387 if (!map.has(event)) {
3388 map.set(event, /* @__PURE__ */ new Set());
3389 }
3390 map.get(event).add(listener);
3391 },
3392 off(event, listener) {
3393 map.get(event)?.delete(listener);
3394 }
3395 };
3396 }
3397
3398 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs
3399 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
3400 var FloatingNodeContext = /* @__PURE__ */ React21.createContext(null);
3401 if (true) FloatingNodeContext.displayName = "FloatingNodeContext";
3402 var FloatingTreeContext = /* @__PURE__ */ React21.createContext(null);
3403 if (true) FloatingTreeContext.displayName = "FloatingTreeContext";
3404 var useFloatingParentNodeId = () => React21.useContext(FloatingNodeContext)?.id || null;
3405 var useFloatingTree = (externalTree) => {
3406 const contextTree = React21.useContext(FloatingTreeContext);
3407 return externalTree ?? contextTree;
3408 };
3409
3410 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs
3411 var React22 = __toESM(require_react(), 1);
3412 function createVirtualElement(domElement, data) {
3413 let offsetX = null;
3414 let offsetY = null;
3415 let isAutoUpdateEvent = false;
3416 return {
3417 contextElement: domElement || void 0,
3418 getBoundingClientRect() {
3419 const domRect = domElement?.getBoundingClientRect() || {
3420 width: 0,
3421 height: 0,
3422 x: 0,
3423 y: 0
3424 };
3425 const isXAxis = data.axis === "x" || data.axis === "both";
3426 const isYAxis = data.axis === "y" || data.axis === "both";
3427 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch";
3428 let width = domRect.width;
3429 let height = domRect.height;
3430 let x2 = domRect.x;
3431 let y2 = domRect.y;
3432 if (offsetX == null && data.x && isXAxis) {
3433 offsetX = domRect.x - data.x;
3434 }
3435 if (offsetY == null && data.y && isYAxis) {
3436 offsetY = domRect.y - data.y;
3437 }
3438 x2 -= offsetX || 0;
3439 y2 -= offsetY || 0;
3440 width = 0;
3441 height = 0;
3442 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
3443 width = data.axis === "y" ? domRect.width : 0;
3444 height = data.axis === "x" ? domRect.height : 0;
3445 x2 = isXAxis && data.x != null ? data.x : x2;
3446 y2 = isYAxis && data.y != null ? data.y : y2;
3447 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
3448 height = data.axis === "x" ? domRect.height : height;
3449 width = data.axis === "y" ? domRect.width : width;
3450 }
3451 isAutoUpdateEvent = true;
3452 return {
3453 width,
3454 height,
3455 x: x2,
3456 y: y2,
3457 top: y2,
3458 right: x2 + width,
3459 bottom: y2 + height,
3460 left: x2
3461 };
3462 }
3463 };
3464 }
3465 function isMouseBasedEvent(event) {
3466 return event != null && event.clientX != null;
3467 }
3468 function useClientPoint(context, props = {}) {
3469 const {
3470 enabled = true,
3471 axis = "both"
3472 } = props;
3473 const store = "rootStore" in context ? context.rootStore : context;
3474 const open3 = store.useState("open");
3475 const floating = store.useState("floatingElement");
3476 const domReference = store.useState("domReferenceElement");
3477 const dataRef = store.context.dataRef;
3478 const initialRef = React22.useRef(false);
3479 const cleanupListenerRef = React22.useRef(null);
3480 const [pointerType, setPointerType] = React22.useState();
3481 const [reactive, setReactive] = React22.useState([]);
3482 const resetReference = useStableCallback((reference2) => {
3483 store.set("positionReference", reference2);
3484 });
3485 const setReference = useStableCallback((newX, newY, referenceElement) => {
3486 if (initialRef.current) {
3487 return;
3488 }
3489 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {
3490 return;
3491 }
3492 store.set("positionReference", createVirtualElement(referenceElement ?? domReference, {
3493 x: newX,
3494 y: newY,
3495 axis,
3496 dataRef,
3497 pointerType
3498 }));
3499 });
3500 const handleReferenceEnterOrMove = useStableCallback((event) => {
3501 if (!open3) {
3502 setReference(event.clientX, event.clientY, event.currentTarget);
3503 } else if (!cleanupListenerRef.current) {
3504 setReference(event.clientX, event.clientY, event.currentTarget);
3505 setReactive([]);
3506 }
3507 });
3508 const openCheck = isMouseLikePointerType(pointerType) ? floating : open3;
3509 React22.useEffect(() => {
3510 if (!enabled) {
3511 resetReference(domReference);
3512 return void 0;
3513 }
3514 if (!openCheck) {
3515 return void 0;
3516 }
3517 function cleanupListener() {
3518 cleanupListenerRef.current?.();
3519 cleanupListenerRef.current = null;
3520 }
3521 const win = getWindow(floating);
3522 function handleMouseMove(event) {
3523 const target = getTarget(event);
3524 if (!contains(floating, target)) {
3525 setReference(event.clientX, event.clientY);
3526 } else {
3527 cleanupListener();
3528 }
3529 }
3530 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
3531 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove);
3532 } else {
3533 resetReference(domReference);
3534 }
3535 return cleanupListener;
3536 }, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]);
3537 React22.useEffect(() => () => {
3538 store.set("positionReference", null);
3539 }, [store]);
3540 React22.useEffect(() => {
3541 if (enabled && !floating) {
3542 initialRef.current = false;
3543 }
3544 }, [enabled, floating]);
3545 React22.useEffect(() => {
3546 if (!enabled && open3) {
3547 initialRef.current = true;
3548 }
3549 }, [enabled, open3]);
3550 const reference = React22.useMemo(() => {
3551 function setPointerTypeRef(event) {
3552 setPointerType(event.pointerType);
3553 }
3554 return {
3555 onPointerDown: setPointerTypeRef,
3556 onPointerEnter: setPointerTypeRef,
3557 onMouseMove: handleReferenceEnterOrMove,
3558 onMouseEnter: handleReferenceEnterOrMove
3559 };
3560 }, [handleReferenceEnterOrMove]);
3561 return React22.useMemo(() => enabled ? {
3562 reference,
3563 trigger: reference
3564 } : {}, [enabled, reference]);
3565 }
3566
3567 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs
3568 var React23 = __toESM(require_react(), 1);
3569 function alwaysFalse() {
3570 return false;
3571 }
3572 function normalizeProp(normalizable) {
3573 return {
3574 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false,
3575 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true
3576 };
3577 }
3578 function useDismiss(context, props = {}) {
3579 const {
3580 enabled = true,
3581 escapeKey: escapeKey2 = true,
3582 outsidePress: outsidePressProp = true,
3583 outsidePressEvent = "sloppy",
3584 referencePress = alwaysFalse,
3585 bubbles,
3586 externalTree
3587 } = props;
3588 const store = "rootStore" in context ? context.rootStore : context;
3589 const open3 = store.useState("open");
3590 const floatingElement = store.useState("floatingElement");
3591 const {
3592 dataRef,
3593 events
3594 } = store.context;
3595 const tree = useFloatingTree(externalTree);
3596 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false);
3597 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp;
3598 const outsidePressEnabled = outsidePress2 !== false;
3599 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);
3600 const {
3601 escapeKey: escapeKeyBubbles,
3602 outsidePress: outsidePressBubbles
3603 } = normalizeProp(bubbles);
3604 const pressStartedInsideRef = React23.useRef(false);
3605 const pressStartPreventedRef = React23.useRef(false);
3606 const suppressNextOutsideClickRef = React23.useRef(false);
3607 const sawPressWhileOpenRef = React23.useRef(false);
3608 const isComposingRef = React23.useRef(false);
3609 const currentPointerTypeRef = React23.useRef("");
3610 const touchStateRef = React23.useRef(null);
3611 const cancelDismissOnEndTimeout = useTimeout();
3612 const clearInsideReactTreeTimeout = useTimeout();
3613 const clearInsideReactTree = useStableCallback(() => {
3614 clearInsideReactTreeTimeout.clear();
3615 dataRef.current.insideReactTree = false;
3616 });
3617 const hasBlockingChild = useStableCallback((bubbleKey) => {
3618 const nodeId = dataRef.current.floatingContext?.nodeId;
3619 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
3620 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]);
3621 });
3622 const isEventWithinOwnElements = useStableCallback((event) => {
3623 return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"));
3624 });
3625 const closeOnReferencePress = useStableCallback((event) => {
3626 if (!referencePress()) {
3627 return;
3628 }
3629 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent));
3630 });
3631 const closeOnEscapeKeyDown = useStableCallback((event) => {
3632 if (!open3 || !enabled || !escapeKey2 || event.key !== "Escape") {
3633 return;
3634 }
3635 if (isComposingRef.current) {
3636 return;
3637 }
3638 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) {
3639 return;
3640 }
3641 const native = isReactEvent(event) ? event.nativeEvent : event;
3642 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native);
3643 store.setOpen(false, eventDetails);
3644 if (!eventDetails.isCanceled) {
3645 event.preventDefault();
3646 }
3647 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {
3648 event.stopPropagation();
3649 }
3650 });
3651 const markInsideReactTree = useStableCallback(() => {
3652 dataRef.current.insideReactTree = true;
3653 clearInsideReactTreeTimeout.start(0, clearInsideReactTree);
3654 });
3655 const markPressStartedInsideReactTree = useStableCallback((event) => {
3656 if (!open3 || !enabled || event.button !== 0) {
3657 return;
3658 }
3659 const target = getTarget(event.nativeEvent);
3660 if (!contains(store.select("floatingElement"), target)) {
3661 return;
3662 }
3663 if (!pressStartedInsideRef.current) {
3664 pressStartedInsideRef.current = true;
3665 pressStartPreventedRef.current = false;
3666 }
3667 });
3668 const markInsidePressStartPrevented = useStableCallback((event) => {
3669 if (!open3 || !enabled) {
3670 return;
3671 }
3672 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {
3673 return;
3674 }
3675 if (pressStartedInsideRef.current) {
3676 pressStartPreventedRef.current = true;
3677 }
3678 });
3679 React23.useEffect(() => {
3680 function handleOpenChange(details) {
3681 if (!details.open) {
3682 sawPressWhileOpenRef.current = false;
3683 }
3684 }
3685 events.on("openchange", handleOpenChange);
3686 return () => {
3687 events.off("openchange", handleOpenChange);
3688 };
3689 }, [events]);
3690 React23.useEffect(() => {
3691 if (!open3 || !enabled) {
3692 if (!open3) {
3693 sawPressWhileOpenRef.current = false;
3694 }
3695 return clearInsideReactTree;
3696 }
3697 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
3698 dataRef.current.__outsidePressBubbles = outsidePressBubbles;
3699 const compositionTimeout = new Timeout();
3700 const preventedPressSuppressionTimeout = new Timeout();
3701 const doc = ownerDocument(floatingElement);
3702 function handleCompositionStart() {
3703 compositionTimeout.clear();
3704 isComposingRef.current = true;
3705 }
3706 function handleCompositionEnd() {
3707 compositionTimeout.start(
3708 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
3709 // Only apply to WebKit for the test to remain 0ms.
3710 parts_exports.engine.webkit ? 5 : 0,
3711 () => {
3712 isComposingRef.current = false;
3713 }
3714 );
3715 }
3716 function suppressImmediateOutsideClickAfterPreventedStart() {
3717 suppressNextOutsideClickRef.current = true;
3718 preventedPressSuppressionTimeout.start(0, () => {
3719 suppressNextOutsideClickRef.current = false;
3720 });
3721 }
3722 function resetPressStartState() {
3723 pressStartedInsideRef.current = false;
3724 pressStartPreventedRef.current = false;
3725 }
3726 function getOutsidePressEvent() {
3727 const type = currentPointerTypeRef.current;
3728 const computedType = type === "pen" || !type ? "mouse" : type;
3729 const outsidePressEventValue = getOutsidePressEventProp();
3730 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue;
3731 if (typeof resolved === "string") {
3732 return resolved;
3733 }
3734 return resolved[computedType];
3735 }
3736 function shouldIgnoreEvent(event) {
3737 const computedOutsidePressEvent = getOutsidePressEvent();
3738 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click";
3739 }
3740 function isEventWithinFloatingTree(event) {
3741 const nodeId = dataRef.current.floatingContext?.nodeId;
3742 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating));
3743 return isEventWithinOwnElements(event) || targetIsInsideChildren;
3744 }
3745 function closeOnPressOutside(event) {
3746 if (shouldIgnoreEvent(event)) {
3747 if (event.type !== "click" && !isEventWithinOwnElements(event)) {
3748 preventedPressSuppressionTimeout.clear();
3749 suppressNextOutsideClickRef.current = false;
3750 }
3751 clearInsideReactTree();
3752 return;
3753 }
3754 if (dataRef.current.insideReactTree) {
3755 clearInsideReactTree();
3756 return;
3757 }
3758 const target = getTarget(event);
3759 const inertSelector = `[${createAttribute("inert")}]`;
3760 const targetRoot = isElement(target) ? target.getRootNode() : null;
3761 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector));
3762 const triggers = store.context.triggerElements;
3763 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) {
3764 return;
3765 }
3766 let targetRootAncestor = isElement(target) ? target : null;
3767 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
3768 const nextParent = getParentNode(targetRootAncestor);
3769 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {
3770 break;
3771 }
3772 targetRootAncestor = nextParent;
3773 }
3774 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
3775 !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the
3776 // element was injected after the floating element rendered.
3777 markers.every((marker) => !contains(targetRootAncestor, marker))) {
3778 return;
3779 }
3780 if (isHTMLElement(target) && !("touches" in event)) {
3781 const lastTraversableNode = isLastTraversableNode(target);
3782 const style = getComputedStyle2(target);
3783 const scrollRe = /auto|scroll/;
3784 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
3785 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
3786 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
3787 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
3788 const isRTL6 = style.direction === "rtl";
3789 const pressedVerticalScrollbar = canScrollY && (isRTL6 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
3790 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
3791 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
3792 return;
3793 }
3794 }
3795 if (isEventWithinFloatingTree(event)) {
3796 return;
3797 }
3798 if (getOutsidePressEvent() === "intentional") {
3799 if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) {
3800 return;
3801 }
3802 if (suppressNextOutsideClickRef.current) {
3803 preventedPressSuppressionTimeout.clear();
3804 suppressNextOutsideClickRef.current = false;
3805 return;
3806 }
3807 }
3808 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
3809 return;
3810 }
3811 if (hasBlockingChild("__outsidePressBubbles")) {
3812 return;
3813 }
3814 store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event));
3815 clearInsideReactTree();
3816 }
3817 function handlePointerDown(event) {
3818 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) {
3819 return;
3820 }
3821 closeOnPressOutside(event);
3822 }
3823 function handleTouchStart(event) {
3824 if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) {
3825 return;
3826 }
3827 const touch = event.touches[0];
3828 if (touch) {
3829 touchStateRef.current = {
3830 startTime: Date.now(),
3831 startX: touch.clientX,
3832 startY: touch.clientY,
3833 dismissOnTouchEnd: false,
3834 dismissOnMouseDown: true
3835 };
3836 cancelDismissOnEndTimeout.start(1e3, () => {
3837 if (touchStateRef.current) {
3838 touchStateRef.current.dismissOnTouchEnd = false;
3839 touchStateRef.current.dismissOnMouseDown = false;
3840 }
3841 });
3842 }
3843 }
3844 function addTargetEventListenerOnce(event, listener) {
3845 const target = getTarget(event);
3846 if (!target) {
3847 return;
3848 }
3849 const unsubscribe2 = addEventListener(target, event.type, () => {
3850 listener(event);
3851 unsubscribe2();
3852 });
3853 }
3854 function handleTouchStartCapture(event) {
3855 currentPointerTypeRef.current = "touch";
3856 addTargetEventListenerOnce(event, handleTouchStart);
3857 }
3858 function closeOnPressOutsideCapture(event) {
3859 cancelDismissOnEndTimeout.clear();
3860 if (event.type === "pointerdown") {
3861 if (event.button === 0) {
3862 sawPressWhileOpenRef.current = true;
3863 }
3864 currentPointerTypeRef.current = event.pointerType;
3865 }
3866 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {
3867 return;
3868 }
3869 addTargetEventListenerOnce(event, (targetEvent) => {
3870 if (targetEvent.type === "pointerdown") {
3871 handlePointerDown(targetEvent);
3872 } else {
3873 closeOnPressOutside(targetEvent);
3874 }
3875 });
3876 }
3877 function handlePressEndCapture(event) {
3878 if (event.type === "pointercancel") {
3879 sawPressWhileOpenRef.current = false;
3880 }
3881 if (!pressStartedInsideRef.current) {
3882 return;
3883 }
3884 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;
3885 resetPressStartState();
3886 if (getOutsidePressEvent() !== "intentional") {
3887 return;
3888 }
3889 if (event.type === "pointercancel") {
3890 if (pressStartedInsideDefaultPrevented) {
3891 suppressImmediateOutsideClickAfterPreventedStart();
3892 }
3893 return;
3894 }
3895 if (isEventWithinFloatingTree(event)) {
3896 return;
3897 }
3898 if (pressStartedInsideDefaultPrevented) {
3899 suppressImmediateOutsideClickAfterPreventedStart();
3900 return;
3901 }
3902 if (typeof outsidePress2 === "function" && !outsidePress2(event)) {
3903 return;
3904 }
3905 preventedPressSuppressionTimeout.clear();
3906 suppressNextOutsideClickRef.current = true;
3907 clearInsideReactTree();
3908 }
3909 function handleTouchMove(event) {
3910 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
3911 return;
3912 }
3913 const touch = event.touches[0];
3914 if (!touch) {
3915 return;
3916 }
3917 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);
3918 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);
3919 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
3920 if (distance > 5) {
3921 touchStateRef.current.dismissOnTouchEnd = true;
3922 }
3923 if (distance > 10) {
3924 closeOnPressOutside(event);
3925 cancelDismissOnEndTimeout.clear();
3926 touchStateRef.current = null;
3927 }
3928 }
3929 function handleTouchMoveCapture(event) {
3930 addTargetEventListenerOnce(event, handleTouchMove);
3931 }
3932 function handleTouchEnd(event) {
3933 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) {
3934 return;
3935 }
3936 if (touchStateRef.current.dismissOnTouchEnd) {
3937 closeOnPressOutside(event);
3938 }
3939 cancelDismissOnEndTimeout.clear();
3940 touchStateRef.current = null;
3941 }
3942 function handleTouchEndCapture(event) {
3943 addTargetEventListenerOnce(event, handleTouchEnd);
3944 }
3945 const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, {
3946 capture: true,
3947 passive: true
3948 }), addEventListener(doc, "touchmove", handleTouchMoveCapture, {
3949 capture: true,
3950 passive: true
3951 }), addEventListener(doc, "touchend", handleTouchEndCapture, {
3952 capture: true,
3953 passive: true
3954 })));
3955 return () => {
3956 unsubscribe();
3957 compositionTimeout.clear();
3958 preventedPressSuppressionTimeout.clear();
3959 resetPressStartState();
3960 suppressNextOutsideClickRef.current = false;
3961 clearInsideReactTree();
3962 };
3963 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open3, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);
3964 const reference = React23.useMemo(() => ({
3965 onKeyDown: closeOnEscapeKeyDown,
3966 onPointerDown: closeOnReferencePress,
3967 onClick: closeOnReferencePress
3968 }), [closeOnEscapeKeyDown, closeOnReferencePress]);
3969 const floating = React23.useMemo(() => ({
3970 onKeyDown: closeOnEscapeKeyDown,
3971 // `onMouseDown` may be blocked if `event.preventDefault()` is called in
3972 // `onPointerDown`, such as with <NumberField.ScrubArea>.
3973 // See https://github.com/mui/base-ui/pull/3379
3974 onPointerDown: markInsidePressStartPrevented,
3975 onMouseDown: markInsidePressStartPrevented,
3976 onClickCapture: markInsideReactTree,
3977 onMouseDownCapture(event) {
3978 markInsideReactTree();
3979 markPressStartedInsideReactTree(event);
3980 },
3981 onPointerDownCapture(event) {
3982 markInsideReactTree();
3983 markPressStartedInsideReactTree(event);
3984 },
3985 onMouseUpCapture: markInsideReactTree,
3986 onTouchEndCapture: markInsideReactTree,
3987 onTouchMoveCapture: markInsideReactTree
3988 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);
3989 return React23.useMemo(() => enabled ? {
3990 reference,
3991 floating,
3992 trigger: reference
3993 } : {}, [enabled, reference, floating]);
3994 }
3995
3996 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
3997 var React31 = __toESM(require_react(), 1);
3998
3999 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs
4000 function computeCoordsFromPlacement(_ref, placement, rtl) {
4001 let {
4002 reference,
4003 floating
4004 } = _ref;
4005 const sideAxis = getSideAxis(placement);
4006 const alignmentAxis = getAlignmentAxis(placement);
4007 const alignLength = getAxisLength(alignmentAxis);
4008 const side = getSide(placement);
4009 const isVertical = sideAxis === "y";
4010 const commonX = reference.x + reference.width / 2 - floating.width / 2;
4011 const commonY = reference.y + reference.height / 2 - floating.height / 2;
4012 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
4013 let coords;
4014 switch (side) {
4015 case "top":
4016 coords = {
4017 x: commonX,
4018 y: reference.y - floating.height
4019 };
4020 break;
4021 case "bottom":
4022 coords = {
4023 x: commonX,
4024 y: reference.y + reference.height
4025 };
4026 break;
4027 case "right":
4028 coords = {
4029 x: reference.x + reference.width,
4030 y: commonY
4031 };
4032 break;
4033 case "left":
4034 coords = {
4035 x: reference.x - floating.width,
4036 y: commonY
4037 };
4038 break;
4039 default:
4040 coords = {
4041 x: reference.x,
4042 y: reference.y
4043 };
4044 }
4045 const alignment = getAlignment(placement);
4046 if (alignment) {
4047 coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
4048 }
4049 return coords;
4050 }
4051 async function detectOverflow(state, options) {
4052 var _await$platform$isEle;
4053 if (options === void 0) {
4054 options = {};
4055 }
4056 const {
4057 x: x2,
4058 y: y2,
4059 platform: platform3,
4060 rects,
4061 elements,
4062 strategy
4063 } = state;
4064 const {
4065 boundary = "clippingAncestors",
4066 rootBoundary = "viewport",
4067 elementContext = "floating",
4068 altBoundary = false,
4069 padding = 0
4070 } = evaluate(options, state);
4071 const paddingObject = getPaddingObject(padding);
4072 const altContext = elementContext === "floating" ? "reference" : "floating";
4073 const element = elements[altBoundary ? altContext : elementContext];
4074 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({
4075 element: ((_await$platform$isEle = await (platform3.isElement == null ? void 0 : platform3.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform3.getDocumentElement == null ? void 0 : platform3.getDocumentElement(elements.floating)),
4076 boundary,
4077 rootBoundary,
4078 strategy
4079 }));
4080 const rect = elementContext === "floating" ? {
4081 x: x2,
4082 y: y2,
4083 width: rects.floating.width,
4084 height: rects.floating.height
4085 } : rects.reference;
4086 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating));
4087 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || {
4088 x: 1,
4089 y: 1
4090 };
4091 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({
4092 elements,
4093 rect,
4094 offsetParent,
4095 strategy
4096 }) : rect);
4097 return {
4098 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
4099 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
4100 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
4101 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
4102 };
4103 }
4104 var MAX_RESET_COUNT = 50;
4105 var computePosition = async (reference, floating, config) => {
4106 const {
4107 placement = "bottom",
4108 strategy = "absolute",
4109 middleware = [],
4110 platform: platform3
4111 } = config;
4112 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : {
4113 ...platform3,
4114 detectOverflow
4115 };
4116 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating));
4117 let rects = await platform3.getElementRects({
4118 reference,
4119 floating,
4120 strategy
4121 });
4122 let {
4123 x: x2,
4124 y: y2
4125 } = computeCoordsFromPlacement(rects, placement, rtl);
4126 let statefulPlacement = placement;
4127 let resetCount = 0;
4128 const middlewareData = {};
4129 for (let i = 0; i < middleware.length; i++) {
4130 const currentMiddleware = middleware[i];
4131 if (!currentMiddleware) {
4132 continue;
4133 }
4134 const {
4135 name,
4136 fn
4137 } = currentMiddleware;
4138 const {
4139 x: nextX,
4140 y: nextY,
4141 data,
4142 reset
4143 } = await fn({
4144 x: x2,
4145 y: y2,
4146 initialPlacement: placement,
4147 placement: statefulPlacement,
4148 strategy,
4149 middlewareData,
4150 rects,
4151 platform: platformWithDetectOverflow,
4152 elements: {
4153 reference,
4154 floating
4155 }
4156 });
4157 x2 = nextX != null ? nextX : x2;
4158 y2 = nextY != null ? nextY : y2;
4159 middlewareData[name] = {
4160 ...middlewareData[name],
4161 ...data
4162 };
4163 if (reset && resetCount < MAX_RESET_COUNT) {
4164 resetCount++;
4165 if (typeof reset === "object") {
4166 if (reset.placement) {
4167 statefulPlacement = reset.placement;
4168 }
4169 if (reset.rects) {
4170 rects = reset.rects === true ? await platform3.getElementRects({
4171 reference,
4172 floating,
4173 strategy
4174 }) : reset.rects;
4175 }
4176 ({
4177 x: x2,
4178 y: y2
4179 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
4180 }
4181 i = -1;
4182 }
4183 }
4184 return {
4185 x: x2,
4186 y: y2,
4187 placement: statefulPlacement,
4188 strategy,
4189 middlewareData
4190 };
4191 };
4192 var flip = function(options) {
4193 if (options === void 0) {
4194 options = {};
4195 }
4196 return {
4197 name: "flip",
4198 options,
4199 async fn(state) {
4200 var _middlewareData$arrow, _middlewareData$flip;
4201 const {
4202 placement,
4203 middlewareData,
4204 rects,
4205 initialPlacement,
4206 platform: platform3,
4207 elements
4208 } = state;
4209 const {
4210 mainAxis: checkMainAxis = true,
4211 crossAxis: checkCrossAxis = true,
4212 fallbackPlacements: specifiedFallbackPlacements,
4213 fallbackStrategy = "bestFit",
4214 fallbackAxisSideDirection = "none",
4215 flipAlignment = true,
4216 ...detectOverflowOptions
4217 } = evaluate(options, state);
4218 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
4219 return {};
4220 }
4221 const side = getSide(placement);
4222 const initialSideAxis = getSideAxis(initialPlacement);
4223 const isBasePlacement = getSide(initialPlacement) === initialPlacement;
4224 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
4225 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
4226 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
4227 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
4228 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
4229 }
4230 const placements2 = [initialPlacement, ...fallbackPlacements];
4231 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4232 const overflows = [];
4233 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
4234 if (checkMainAxis) {
4235 overflows.push(overflow[side]);
4236 }
4237 if (checkCrossAxis) {
4238 const sides2 = getAlignmentSides(placement, rects, rtl);
4239 overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
4240 }
4241 overflowsData = [...overflowsData, {
4242 placement,
4243 overflows
4244 }];
4245 if (!overflows.every((side2) => side2 <= 0)) {
4246 var _middlewareData$flip2, _overflowsData$filter;
4247 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
4248 const nextPlacement = placements2[nextIndex];
4249 if (nextPlacement) {
4250 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
4251 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
4252 // overflows the main axis.
4253 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
4254 return {
4255 data: {
4256 index: nextIndex,
4257 overflows: overflowsData
4258 },
4259 reset: {
4260 placement: nextPlacement
4261 }
4262 };
4263 }
4264 }
4265 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
4266 if (!resetPlacement) {
4267 switch (fallbackStrategy) {
4268 case "bestFit": {
4269 var _overflowsData$filter2;
4270 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
4271 if (hasFallbackAxisSideDirection) {
4272 const currentSideAxis = getSideAxis(d.placement);
4273 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
4274 // reading directions favoring greater width.
4275 currentSideAxis === "y";
4276 }
4277 return true;
4278 }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
4279 if (placement2) {
4280 resetPlacement = placement2;
4281 }
4282 break;
4283 }
4284 case "initialPlacement":
4285 resetPlacement = initialPlacement;
4286 break;
4287 }
4288 }
4289 if (placement !== resetPlacement) {
4290 return {
4291 reset: {
4292 placement: resetPlacement
4293 }
4294 };
4295 }
4296 }
4297 return {};
4298 }
4299 };
4300 };
4301 var originSides = /* @__PURE__ */ new Set(["left", "top"]);
4302 async function convertValueToCoords(state, options) {
4303 const {
4304 placement,
4305 platform: platform3,
4306 elements
4307 } = state;
4308 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating));
4309 const side = getSide(placement);
4310 const alignment = getAlignment(placement);
4311 const isVertical = getSideAxis(placement) === "y";
4312 const mainAxisMulti = originSides.has(side) ? -1 : 1;
4313 const crossAxisMulti = rtl && isVertical ? -1 : 1;
4314 const rawValue = evaluate(options, state);
4315 let {
4316 mainAxis,
4317 crossAxis,
4318 alignmentAxis
4319 } = typeof rawValue === "number" ? {
4320 mainAxis: rawValue,
4321 crossAxis: 0,
4322 alignmentAxis: null
4323 } : {
4324 mainAxis: rawValue.mainAxis || 0,
4325 crossAxis: rawValue.crossAxis || 0,
4326 alignmentAxis: rawValue.alignmentAxis
4327 };
4328 if (alignment && typeof alignmentAxis === "number") {
4329 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
4330 }
4331 return isVertical ? {
4332 x: crossAxis * crossAxisMulti,
4333 y: mainAxis * mainAxisMulti
4334 } : {
4335 x: mainAxis * mainAxisMulti,
4336 y: crossAxis * crossAxisMulti
4337 };
4338 }
4339 var offset = function(options) {
4340 if (options === void 0) {
4341 options = 0;
4342 }
4343 return {
4344 name: "offset",
4345 options,
4346 async fn(state) {
4347 var _middlewareData$offse, _middlewareData$arrow;
4348 const {
4349 x: x2,
4350 y: y2,
4351 placement,
4352 middlewareData
4353 } = state;
4354 const diffCoords = await convertValueToCoords(state, options);
4355 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
4356 return {};
4357 }
4358 return {
4359 x: x2 + diffCoords.x,
4360 y: y2 + diffCoords.y,
4361 data: {
4362 ...diffCoords,
4363 placement
4364 }
4365 };
4366 }
4367 };
4368 };
4369 var shift = function(options) {
4370 if (options === void 0) {
4371 options = {};
4372 }
4373 return {
4374 name: "shift",
4375 options,
4376 async fn(state) {
4377 const {
4378 x: x2,
4379 y: y2,
4380 placement,
4381 platform: platform3
4382 } = state;
4383 const {
4384 mainAxis: checkMainAxis = true,
4385 crossAxis: checkCrossAxis = false,
4386 limiter = {
4387 fn: (_ref) => {
4388 let {
4389 x: x3,
4390 y: y3
4391 } = _ref;
4392 return {
4393 x: x3,
4394 y: y3
4395 };
4396 }
4397 },
4398 ...detectOverflowOptions
4399 } = evaluate(options, state);
4400 const coords = {
4401 x: x2,
4402 y: y2
4403 };
4404 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4405 const crossAxis = getSideAxis(placement);
4406 const mainAxis = getOppositeAxis(crossAxis);
4407 let mainAxisCoord = coords[mainAxis];
4408 let crossAxisCoord = coords[crossAxis];
4409 const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
4410 if (checkMainAxis) {
4411 mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
4412 }
4413 if (checkCrossAxis) {
4414 crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
4415 }
4416 const limitedCoords = limiter.fn({
4417 ...state,
4418 [mainAxis]: mainAxisCoord,
4419 [crossAxis]: crossAxisCoord
4420 });
4421 return {
4422 ...limitedCoords,
4423 data: {
4424 x: limitedCoords.x - x2,
4425 y: limitedCoords.y - y2,
4426 enabled: {
4427 [mainAxis]: checkMainAxis,
4428 [crossAxis]: checkCrossAxis
4429 }
4430 }
4431 };
4432 }
4433 };
4434 };
4435 var limitShift = function(options) {
4436 if (options === void 0) {
4437 options = {};
4438 }
4439 return {
4440 options,
4441 fn(state) {
4442 var _rawOffset$mainAxis, _rawOffset$crossAxis;
4443 const {
4444 x: x2,
4445 y: y2,
4446 placement,
4447 rects,
4448 middlewareData
4449 } = state;
4450 const {
4451 offset: offset4 = 0,
4452 mainAxis: checkMainAxis = true,
4453 crossAxis: checkCrossAxis = true
4454 } = evaluate(options, state);
4455 const coords = {
4456 x: x2,
4457 y: y2
4458 };
4459 const crossAxis = getSideAxis(placement);
4460 const mainAxis = getOppositeAxis(crossAxis);
4461 let mainAxisCoord = coords[mainAxis];
4462 let crossAxisCoord = coords[crossAxis];
4463 const rawOffset = evaluate(offset4, state);
4464 const computedOffset = typeof rawOffset === "number" ? {
4465 mainAxis: rawOffset,
4466 crossAxis: 0
4467 } : {
4468 mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
4469 crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
4470 };
4471 if (checkMainAxis) {
4472 const len = mainAxis === "y" ? "height" : "width";
4473 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
4474 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
4475 if (mainAxisCoord < limitMin) {
4476 mainAxisCoord = limitMin;
4477 } else if (mainAxisCoord > limitMax) {
4478 mainAxisCoord = limitMax;
4479 }
4480 }
4481 if (checkCrossAxis) {
4482 var _middlewareData$offse, _middlewareData$offse2;
4483 const len = mainAxis === "y" ? "width" : "height";
4484 const isOriginSide = originSides.has(getSide(placement));
4485 const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
4486 const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
4487 if (crossAxisCoord < limitMin) {
4488 crossAxisCoord = limitMin;
4489 } else if (crossAxisCoord > limitMax) {
4490 crossAxisCoord = limitMax;
4491 }
4492 }
4493 return {
4494 [mainAxis]: mainAxisCoord,
4495 [crossAxis]: crossAxisCoord
4496 };
4497 }
4498 };
4499 };
4500 var size = function(options) {
4501 if (options === void 0) {
4502 options = {};
4503 }
4504 return {
4505 name: "size",
4506 options,
4507 async fn(state) {
4508 const {
4509 placement,
4510 rects,
4511 platform: platform3,
4512 elements
4513 } = state;
4514 const {
4515 apply = () => {
4516 },
4517 ...detectOverflowOptions
4518 } = evaluate(options, state);
4519 const overflow = await platform3.detectOverflow(state, detectOverflowOptions);
4520 const side = getSide(placement);
4521 const alignment = getAlignment(placement);
4522 const isYAxis = getSideAxis(placement) === "y";
4523 const {
4524 width,
4525 height
4526 } = rects.floating;
4527 let heightSide;
4528 let widthSide;
4529 if (side === "top" || side === "bottom") {
4530 heightSide = side;
4531 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
4532 } else {
4533 widthSide = side;
4534 heightSide = alignment === "end" ? "top" : "bottom";
4535 }
4536 const maximumClippingHeight = height - overflow.top - overflow.bottom;
4537 const maximumClippingWidth = width - overflow.left - overflow.right;
4538 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
4539 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
4540 const shiftData = state.middlewareData.shift;
4541 const noShift = !shiftData;
4542 let availableHeight2 = overflowAvailableHeight;
4543 let availableWidth2 = overflowAvailableWidth;
4544 if (shiftData != null && shiftData.enabled.x) {
4545 availableWidth2 = maximumClippingWidth;
4546 }
4547 if (shiftData != null && shiftData.enabled.y) {
4548 availableHeight2 = maximumClippingHeight;
4549 }
4550 if (noShift && !alignment) {
4551 if (isYAxis) {
4552 availableWidth2 = width - 2 * max(overflow.left, overflow.right);
4553 } else {
4554 availableHeight2 = height - 2 * max(overflow.top, overflow.bottom);
4555 }
4556 }
4557 await apply({
4558 ...state,
4559 availableWidth: availableWidth2,
4560 availableHeight: availableHeight2
4561 });
4562 const nextDimensions = await platform3.getDimensions(elements.floating);
4563 if (width !== nextDimensions.width || height !== nextDimensions.height) {
4564 return {
4565 reset: {
4566 rects: true
4567 }
4568 };
4569 }
4570 return {};
4571 }
4572 };
4573 };
4574
4575 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
4576 function getCssDimensions(element) {
4577 const css = getComputedStyle2(element);
4578 let width = parseFloat(css.width) || 0;
4579 let height = parseFloat(css.height) || 0;
4580 const hasOffset = isHTMLElement(element);
4581 const offsetWidth = hasOffset ? element.offsetWidth : width;
4582 const offsetHeight = hasOffset ? element.offsetHeight : height;
4583 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
4584 if (shouldFallback) {
4585 width = offsetWidth;
4586 height = offsetHeight;
4587 }
4588 return {
4589 width,
4590 height,
4591 $: shouldFallback
4592 };
4593 }
4594 function unwrapElement(element) {
4595 return !isElement(element) ? element.contextElement : element;
4596 }
4597 function getScale(element) {
4598 const domElement = unwrapElement(element);
4599 if (!isHTMLElement(domElement)) {
4600 return createCoords(1);
4601 }
4602 const rect = domElement.getBoundingClientRect();
4603 const {
4604 width,
4605 height,
4606 $: $2
4607 } = getCssDimensions(domElement);
4608 let x2 = ($2 ? round(rect.width) : rect.width) / width;
4609 let y2 = ($2 ? round(rect.height) : rect.height) / height;
4610 if (!x2 || !Number.isFinite(x2)) {
4611 x2 = 1;
4612 }
4613 if (!y2 || !Number.isFinite(y2)) {
4614 y2 = 1;
4615 }
4616 return {
4617 x: x2,
4618 y: y2
4619 };
4620 }
4621 var noOffsets = /* @__PURE__ */ createCoords(0);
4622 function getVisualOffsets(element) {
4623 const win = getWindow(element);
4624 if (!isWebKit() || !win.visualViewport) {
4625 return noOffsets;
4626 }
4627 return {
4628 x: win.visualViewport.offsetLeft,
4629 y: win.visualViewport.offsetTop
4630 };
4631 }
4632 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
4633 if (isFixed === void 0) {
4634 isFixed = false;
4635 }
4636 return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
4637 }
4638 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
4639 if (includeScale === void 0) {
4640 includeScale = false;
4641 }
4642 if (isFixedStrategy === void 0) {
4643 isFixedStrategy = false;
4644 }
4645 const clientRect = element.getBoundingClientRect();
4646 const domElement = unwrapElement(element);
4647 let scale = createCoords(1);
4648 if (includeScale) {
4649 if (offsetParent) {
4650 if (isElement(offsetParent)) {
4651 scale = getScale(offsetParent);
4652 }
4653 } else {
4654 scale = getScale(element);
4655 }
4656 }
4657 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
4658 let x2 = (clientRect.left + visualOffsets.x) / scale.x;
4659 let y2 = (clientRect.top + visualOffsets.y) / scale.y;
4660 let width = clientRect.width / scale.x;
4661 let height = clientRect.height / scale.y;
4662 if (domElement && offsetParent) {
4663 const win = getWindow(domElement);
4664 const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
4665 let currentWin = win;
4666 let currentIFrame = getFrameElement(currentWin);
4667 while (currentIFrame && offsetWin !== currentWin) {
4668 const iframeScale = getScale(currentIFrame);
4669 const iframeRect = currentIFrame.getBoundingClientRect();
4670 const css = getComputedStyle2(currentIFrame);
4671 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
4672 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
4673 x2 *= iframeScale.x;
4674 y2 *= iframeScale.y;
4675 width *= iframeScale.x;
4676 height *= iframeScale.y;
4677 x2 += left;
4678 y2 += top;
4679 currentWin = getWindow(currentIFrame);
4680 currentIFrame = getFrameElement(currentWin);
4681 }
4682 }
4683 return rectToClientRect({
4684 width,
4685 height,
4686 x: x2,
4687 y: y2
4688 });
4689 }
4690 function getWindowScrollBarX(element, rect) {
4691 const leftScroll = getNodeScroll(element).scrollLeft;
4692 if (!rect) {
4693 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
4694 }
4695 return rect.left + leftScroll;
4696 }
4697 function getHTMLOffset(documentElement, scroll) {
4698 const htmlRect = documentElement.getBoundingClientRect();
4699 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
4700 const y2 = htmlRect.top + scroll.scrollTop;
4701 return {
4702 x: x2,
4703 y: y2
4704 };
4705 }
4706 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
4707 let {
4708 elements,
4709 rect,
4710 offsetParent,
4711 strategy
4712 } = _ref;
4713 const isFixed = strategy === "fixed";
4714 const documentElement = getDocumentElement(offsetParent);
4715 const topLayer = elements ? isTopLayer(elements.floating) : false;
4716 if (offsetParent === documentElement || topLayer && isFixed) {
4717 return rect;
4718 }
4719 let scroll = {
4720 scrollLeft: 0,
4721 scrollTop: 0
4722 };
4723 let scale = createCoords(1);
4724 const offsets = createCoords(0);
4725 const isOffsetParentAnElement = isHTMLElement(offsetParent);
4726 if (isOffsetParentAnElement || !isFixed) {
4727 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
4728 scroll = getNodeScroll(offsetParent);
4729 }
4730 if (isOffsetParentAnElement) {
4731 const offsetRect = getBoundingClientRect(offsetParent);
4732 scale = getScale(offsetParent);
4733 offsets.x = offsetRect.x + offsetParent.clientLeft;
4734 offsets.y = offsetRect.y + offsetParent.clientTop;
4735 }
4736 }
4737 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
4738 return {
4739 width: rect.width * scale.x,
4740 height: rect.height * scale.y,
4741 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
4742 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
4743 };
4744 }
4745 function getClientRects(element) {
4746 return element.getClientRects ? Array.from(element.getClientRects()) : [];
4747 }
4748 function getDocumentRect(html) {
4749 const scroll = getNodeScroll(html);
4750 const body = html.ownerDocument.body;
4751 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
4752 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
4753 let x2 = -scroll.scrollLeft + getWindowScrollBarX(html);
4754 const y2 = -scroll.scrollTop;
4755 if (getComputedStyle2(body).direction === "rtl") {
4756 x2 += max(html.clientWidth, body.clientWidth) - width;
4757 }
4758 return {
4759 width,
4760 height,
4761 x: x2,
4762 y: y2
4763 };
4764 }
4765 var SCROLLBAR_MAX = 25;
4766 function getViewportRect(element, strategy, rootBoundary) {
4767 if (rootBoundary === void 0) {
4768 rootBoundary = "viewport";
4769 }
4770 const isLayoutViewport = rootBoundary === "layoutViewport";
4771 const win = getWindow(element);
4772 const html = getDocumentElement(element);
4773 const visualViewport = win.visualViewport;
4774 let width = html.clientWidth;
4775 let height = html.clientHeight;
4776 let x2 = 0;
4777 let y2 = 0;
4778 if (visualViewport) {
4779 const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
4780 if (isLayoutViewport) {
4781 if (!layoutRelativeClientCoords) {
4782 x2 = -visualViewport.offsetLeft;
4783 y2 = -visualViewport.offsetTop;
4784 }
4785 } else {
4786 width = visualViewport.width;
4787 height = visualViewport.height;
4788 if (layoutRelativeClientCoords) {
4789 x2 = visualViewport.offsetLeft;
4790 y2 = visualViewport.offsetTop;
4791 }
4792 }
4793 }
4794 const windowScrollbarX = getWindowScrollBarX(html);
4795 if (windowScrollbarX <= 0) {
4796 const doc = html.ownerDocument;
4797 const body = doc.body;
4798 const bodyStyles = getComputedStyle(body);
4799 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
4800 const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
4801 const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
4802 if (gutter <= SCROLLBAR_MAX) {
4803 width -= gutter;
4804 }
4805 }
4806 return {
4807 width,
4808 height,
4809 x: x2,
4810 y: y2
4811 };
4812 }
4813 function getInnerBoundingClientRect(element, strategy) {
4814 const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
4815 const top = clientRect.top + element.clientTop;
4816 const left = clientRect.left + element.clientLeft;
4817 const scale = getScale(element);
4818 const width = element.clientWidth * scale.x;
4819 const height = element.clientHeight * scale.y;
4820 const x2 = left * scale.x;
4821 const y2 = top * scale.y;
4822 return {
4823 width,
4824 height,
4825 x: x2,
4826 y: y2
4827 };
4828 }
4829 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
4830 let rect;
4831 if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") {
4832 rect = getViewportRect(element, strategy, clippingAncestor);
4833 } else if (clippingAncestor === "document") {
4834 rect = getDocumentRect(getDocumentElement(element));
4835 } else if (isElement(clippingAncestor)) {
4836 rect = getInnerBoundingClientRect(clippingAncestor, strategy);
4837 } else {
4838 const visualOffsets = getVisualOffsets(element);
4839 rect = {
4840 x: clippingAncestor.x - visualOffsets.x,
4841 y: clippingAncestor.y - visualOffsets.y,
4842 width: clippingAncestor.width,
4843 height: clippingAncestor.height
4844 };
4845 }
4846 return rectToClientRect(rect);
4847 }
4848 function getClippingElementAncestors(element, cache) {
4849 const cachedResult = cache.get(element);
4850 if (cachedResult) {
4851 return cachedResult;
4852 }
4853 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
4854 let lastKeptComputedStyle = null;
4855 const elementIsFixed = getComputedStyle2(element).position === "fixed";
4856 let currentNode = elementIsFixed ? getParentNode(element) : element;
4857 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
4858 const computedStyle = getComputedStyle2(currentNode);
4859 const currentNodeIsContaining = isContainingBlock(currentNode);
4860 const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
4861 const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static");
4862 if (shouldDropCurrentNode) {
4863 result = result.filter((ancestor) => ancestor !== currentNode);
4864 } else {
4865 lastKeptComputedStyle = computedStyle;
4866 }
4867 currentNode = getParentNode(currentNode);
4868 }
4869 cache.set(element, result);
4870 return result;
4871 }
4872 function getClippingRect(_ref) {
4873 let {
4874 element,
4875 boundary,
4876 rootBoundary,
4877 strategy
4878 } = _ref;
4879 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
4880 const clippingAncestors = [...elementClippingAncestors, rootBoundary];
4881 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
4882 let top = firstRect.top;
4883 let right = firstRect.right;
4884 let bottom = firstRect.bottom;
4885 let left = firstRect.left;
4886 for (let i = 1; i < clippingAncestors.length; i++) {
4887 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
4888 top = max(rect.top, top);
4889 right = min(rect.right, right);
4890 bottom = min(rect.bottom, bottom);
4891 left = max(rect.left, left);
4892 }
4893 return {
4894 width: right - left,
4895 height: bottom - top,
4896 x: left,
4897 y: top
4898 };
4899 }
4900 function getDimensions2(element) {
4901 const {
4902 width,
4903 height
4904 } = getCssDimensions(element);
4905 return {
4906 width,
4907 height
4908 };
4909 }
4910 function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
4911 const isOffsetParentAnElement = isHTMLElement(offsetParent);
4912 const documentElement = getDocumentElement(offsetParent);
4913 const isFixed = strategy === "fixed";
4914 const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
4915 let scroll = {
4916 scrollLeft: 0,
4917 scrollTop: 0
4918 };
4919 const offsets = createCoords(0);
4920 if (isOffsetParentAnElement || !isFixed) {
4921 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
4922 scroll = getNodeScroll(offsetParent);
4923 }
4924 if (isOffsetParentAnElement) {
4925 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
4926 offsets.x = offsetRect.x + offsetParent.clientLeft;
4927 offsets.y = offsetRect.y + offsetParent.clientTop;
4928 }
4929 }
4930 if (!isOffsetParentAnElement && documentElement) {
4931 offsets.x = getWindowScrollBarX(documentElement);
4932 }
4933 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
4934 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
4935 const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
4936 return {
4937 x: x2,
4938 y: y2,
4939 width: rect.width,
4940 height: rect.height
4941 };
4942 }
4943 function isStaticPositioned(element) {
4944 return getComputedStyle2(element).position === "static";
4945 }
4946 function getTrueOffsetParent(element, polyfill) {
4947 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
4948 return null;
4949 }
4950 if (polyfill) {
4951 return polyfill(element);
4952 }
4953 let rawOffsetParent = element.offsetParent;
4954 if (getDocumentElement(element) === rawOffsetParent) {
4955 rawOffsetParent = rawOffsetParent.ownerDocument.body;
4956 }
4957 return rawOffsetParent;
4958 }
4959 function getOffsetParent(element, polyfill) {
4960 const win = getWindow(element);
4961 if (isTopLayer(element)) {
4962 return win;
4963 }
4964 if (!isHTMLElement(element)) {
4965 let svgOffsetParent = getParentNode(element);
4966 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
4967 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
4968 return svgOffsetParent;
4969 }
4970 svgOffsetParent = getParentNode(svgOffsetParent);
4971 }
4972 return win;
4973 }
4974 let offsetParent = getTrueOffsetParent(element, polyfill);
4975 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
4976 offsetParent = getTrueOffsetParent(offsetParent, polyfill);
4977 }
4978 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
4979 return win;
4980 }
4981 return offsetParent || getContainingBlock(element) || win;
4982 }
4983 var getElementRects = async function(data) {
4984 const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
4985 const getDimensionsFn = this.getDimensions;
4986 const floatingDimensions = await getDimensionsFn(data.floating);
4987 return {
4988 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
4989 floating: {
4990 x: 0,
4991 y: 0,
4992 width: floatingDimensions.width,
4993 height: floatingDimensions.height
4994 }
4995 };
4996 };
4997 function isRTL(element) {
4998 return getComputedStyle2(element).direction === "rtl";
4999 }
5000 var platform2 = {
5001 convertOffsetParentRelativeRectToViewportRelativeRect,
5002 getDocumentElement,
5003 getClippingRect,
5004 getOffsetParent,
5005 getElementRects,
5006 getClientRects,
5007 getDimensions: getDimensions2,
5008 getScale,
5009 isElement,
5010 isRTL
5011 };
5012 function rectsAreEqual(a, b) {
5013 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
5014 }
5015 function observeMove(element, onMove, ancestorResize) {
5016 let io = null;
5017 let timeoutId;
5018 const root = getDocumentElement(element);
5019 function cleanup() {
5020 var _io;
5021 clearTimeout(timeoutId);
5022 (_io = io) == null || _io.disconnect();
5023 io = null;
5024 }
5025 function refresh(skip, threshold) {
5026 if (skip === void 0) {
5027 skip = false;
5028 }
5029 if (threshold === void 0) {
5030 threshold = 1;
5031 }
5032 cleanup();
5033 const elementRectForRootMargin = element.getBoundingClientRect();
5034 const {
5035 left,
5036 top,
5037 width,
5038 height
5039 } = elementRectForRootMargin;
5040 if (!skip) {
5041 onMove();
5042 }
5043 if (!width || !height) {
5044 return;
5045 }
5046 const insetTop = floor(top);
5047 const insetRight = floor(root.clientWidth - (left + width));
5048 const insetBottom = floor(root.clientHeight - (top + height));
5049 const insetLeft = floor(left);
5050 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
5051 const options = {
5052 rootMargin,
5053 threshold: max(0, min(1, threshold)) || 1
5054 };
5055 let isFirstUpdate = true;
5056 function handleObserve(entries) {
5057 const ratio = entries[0].intersectionRatio;
5058 if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
5059 return refresh();
5060 }
5061 if (ratio !== threshold) {
5062 if (!isFirstUpdate) {
5063 return refresh();
5064 }
5065 if (!ratio) {
5066 timeoutId = setTimeout(() => {
5067 refresh(false, 1e-7);
5068 }, 1e3);
5069 } else {
5070 refresh(false, ratio);
5071 }
5072 }
5073 isFirstUpdate = false;
5074 }
5075 try {
5076 io = new IntersectionObserver(handleObserve, {
5077 ...options,
5078 // Handle <iframe>s
5079 root: root.ownerDocument
5080 });
5081 } catch (_e) {
5082 io = new IntersectionObserver(handleObserve, options);
5083 }
5084 io.observe(element);
5085 }
5086 const win = getWindow(element);
5087 const handleResize = () => refresh(ancestorResize);
5088 win.addEventListener("resize", handleResize);
5089 refresh(true);
5090 return () => {
5091 win.removeEventListener("resize", handleResize);
5092 cleanup();
5093 };
5094 }
5095 function autoUpdate(reference, floating, update2, options) {
5096 if (options === void 0) {
5097 options = {};
5098 }
5099 const {
5100 ancestorScroll = true,
5101 ancestorResize = true,
5102 elementResize = typeof ResizeObserver === "function",
5103 layoutShift = typeof IntersectionObserver === "function",
5104 animationFrame = false
5105 } = options;
5106 const referenceEl = unwrapElement(reference);
5107 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
5108 ancestors.forEach((ancestor) => {
5109 ancestorScroll && ancestor.addEventListener("scroll", update2);
5110 ancestorResize && ancestor.addEventListener("resize", update2);
5111 });
5112 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null;
5113 let reobserveFrame = -1;
5114 let resizeObserver = null;
5115 if (elementResize) {
5116 resizeObserver = new ResizeObserver((_ref) => {
5117 let [firstEntry] = _ref;
5118 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
5119 resizeObserver.unobserve(floating);
5120 cancelAnimationFrame(reobserveFrame);
5121 reobserveFrame = requestAnimationFrame(() => {
5122 var _resizeObserver;
5123 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
5124 });
5125 }
5126 update2();
5127 });
5128 if (referenceEl && !animationFrame) {
5129 resizeObserver.observe(referenceEl);
5130 }
5131 if (floating) {
5132 resizeObserver.observe(floating);
5133 }
5134 }
5135 let frameId;
5136 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
5137 if (animationFrame) {
5138 frameLoop();
5139 }
5140 function frameLoop() {
5141 const nextRefRect = getBoundingClientRect(reference);
5142 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
5143 update2();
5144 }
5145 prevRefRect = nextRefRect;
5146 frameId = requestAnimationFrame(frameLoop);
5147 }
5148 update2();
5149 return () => {
5150 var _resizeObserver2;
5151 ancestors.forEach((ancestor) => {
5152 ancestorScroll && ancestor.removeEventListener("scroll", update2);
5153 ancestorResize && ancestor.removeEventListener("resize", update2);
5154 });
5155 cleanupIo == null || cleanupIo();
5156 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
5157 resizeObserver = null;
5158 if (animationFrame) {
5159 cancelAnimationFrame(frameId);
5160 }
5161 };
5162 }
5163 var offset2 = offset;
5164 var shift2 = shift;
5165 var flip2 = flip;
5166 var size2 = size;
5167 var limitShift2 = limitShift;
5168 var computePosition2 = (reference, floating, options) => {
5169 const cache = /* @__PURE__ */ new Map();
5170 const mergedOptions = options != null ? options : {};
5171 const platformWithCache = {
5172 ...platform2,
5173 ...mergedOptions.platform,
5174 _c: cache
5175 };
5176 return computePosition(reference, floating, {
5177 ...mergedOptions,
5178 platform: platformWithCache
5179 });
5180 };
5181
5182 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
5183 var React24 = __toESM(require_react(), 1);
5184 var import_react2 = __toESM(require_react(), 1);
5185 var ReactDOM3 = __toESM(require_react_dom(), 1);
5186 var isClient = typeof document !== "undefined";
5187 var noop2 = function noop3() {
5188 };
5189 var index = isClient ? import_react2.useLayoutEffect : noop2;
5190 function deepEqual(a, b) {
5191 if (a === b) {
5192 return true;
5193 }
5194 if (typeof a !== typeof b) {
5195 return false;
5196 }
5197 if (typeof a === "function" && a.toString() === b.toString()) {
5198 return true;
5199 }
5200 let length;
5201 let i;
5202 let keys;
5203 if (a && b && typeof a === "object") {
5204 if (Array.isArray(a)) {
5205 length = a.length;
5206 if (length !== b.length) return false;
5207 for (i = length; i-- !== 0; ) {
5208 if (!deepEqual(a[i], b[i])) {
5209 return false;
5210 }
5211 }
5212 return true;
5213 }
5214 keys = Object.keys(a);
5215 length = keys.length;
5216 if (length !== Object.keys(b).length) {
5217 return false;
5218 }
5219 for (i = length; i-- !== 0; ) {
5220 if (!{}.hasOwnProperty.call(b, keys[i])) {
5221 return false;
5222 }
5223 }
5224 for (i = length; i-- !== 0; ) {
5225 const key = keys[i];
5226 if (key === "_owner" && a.$$typeof) {
5227 continue;
5228 }
5229 if (!deepEqual(a[key], b[key])) {
5230 return false;
5231 }
5232 }
5233 return true;
5234 }
5235 return a !== a && b !== b;
5236 }
5237 function getDPR(element) {
5238 if (typeof window === "undefined") {
5239 return 1;
5240 }
5241 const win = element.ownerDocument.defaultView || window;
5242 return win.devicePixelRatio || 1;
5243 }
5244 function roundByDPR(element, value) {
5245 const dpr = getDPR(element);
5246 return Math.round(value * dpr) / dpr;
5247 }
5248 function useLatestRef(value) {
5249 const ref = React24.useRef(value);
5250 index(() => {
5251 ref.current = value;
5252 });
5253 return ref;
5254 }
5255 function useFloating(options) {
5256 if (options === void 0) {
5257 options = {};
5258 }
5259 const {
5260 placement = "bottom",
5261 strategy = "absolute",
5262 middleware = [],
5263 platform: platform3,
5264 elements: {
5265 reference: externalReference,
5266 floating: externalFloating
5267 } = {},
5268 transform = true,
5269 whileElementsMounted,
5270 open: open3
5271 } = options;
5272 const [data, setData] = React24.useState({
5273 x: 0,
5274 y: 0,
5275 strategy,
5276 placement,
5277 middlewareData: {},
5278 isPositioned: false
5279 });
5280 const [latestMiddleware, setLatestMiddleware] = React24.useState(middleware);
5281 if (!deepEqual(latestMiddleware, middleware)) {
5282 setLatestMiddleware(middleware);
5283 }
5284 const [_reference, _setReference] = React24.useState(null);
5285 const [_floating, _setFloating] = React24.useState(null);
5286 const setReference = React24.useCallback((node) => {
5287 if (node !== referenceRef.current) {
5288 referenceRef.current = node;
5289 _setReference(node);
5290 }
5291 }, []);
5292 const setFloating = React24.useCallback((node) => {
5293 if (node !== floatingRef.current) {
5294 floatingRef.current = node;
5295 _setFloating(node);
5296 }
5297 }, []);
5298 const referenceEl = externalReference || _reference;
5299 const floatingEl = externalFloating || _floating;
5300 const referenceRef = React24.useRef(null);
5301 const floatingRef = React24.useRef(null);
5302 const dataRef = React24.useRef(data);
5303 const hasWhileElementsMounted = whileElementsMounted != null;
5304 const whileElementsMountedRef = useLatestRef(whileElementsMounted);
5305 const platformRef = useLatestRef(platform3);
5306 const openRef = useLatestRef(open3);
5307 const update2 = React24.useCallback(() => {
5308 if (!referenceRef.current || !floatingRef.current) {
5309 return;
5310 }
5311 const config = {
5312 placement,
5313 strategy,
5314 middleware: latestMiddleware
5315 };
5316 if (platformRef.current) {
5317 config.platform = platformRef.current;
5318 }
5319 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
5320 const fullData = {
5321 ...data2,
5322 // The floating element's position may be recomputed while it's closed
5323 // but still mounted (such as when transitioning out). To ensure
5324 // `isPositioned` will be `false` initially on the next open, avoid
5325 // setting it to `true` when `open === false` (must be specified).
5326 isPositioned: openRef.current !== false
5327 };
5328 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
5329 dataRef.current = fullData;
5330 ReactDOM3.flushSync(() => {
5331 setData(fullData);
5332 });
5333 }
5334 });
5335 }, [latestMiddleware, placement, strategy, platformRef, openRef]);
5336 index(() => {
5337 if (open3 === false && dataRef.current.isPositioned) {
5338 dataRef.current.isPositioned = false;
5339 setData((data2) => ({
5340 ...data2,
5341 isPositioned: false
5342 }));
5343 }
5344 }, [open3]);
5345 const isMountedRef = React24.useRef(false);
5346 index(() => {
5347 isMountedRef.current = true;
5348 return () => {
5349 isMountedRef.current = false;
5350 };
5351 }, []);
5352 index(() => {
5353 if (referenceEl) referenceRef.current = referenceEl;
5354 if (floatingEl) floatingRef.current = floatingEl;
5355 if (referenceEl && floatingEl) {
5356 if (whileElementsMountedRef.current) {
5357 return whileElementsMountedRef.current(referenceEl, floatingEl, update2);
5358 }
5359 update2();
5360 }
5361 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]);
5362 const refs = React24.useMemo(() => ({
5363 reference: referenceRef,
5364 floating: floatingRef,
5365 setReference,
5366 setFloating
5367 }), [setReference, setFloating]);
5368 const elements = React24.useMemo(() => ({
5369 reference: referenceEl,
5370 floating: floatingEl
5371 }), [referenceEl, floatingEl]);
5372 const floatingStyles = React24.useMemo(() => {
5373 const initialStyles = {
5374 position: strategy,
5375 left: 0,
5376 top: 0
5377 };
5378 if (!elements.floating) {
5379 return initialStyles;
5380 }
5381 const x2 = roundByDPR(elements.floating, data.x);
5382 const y2 = roundByDPR(elements.floating, data.y);
5383 if (transform) {
5384 return {
5385 ...initialStyles,
5386 transform: "translate(" + x2 + "px, " + y2 + "px)",
5387 ...getDPR(elements.floating) >= 1.5 && {
5388 willChange: "transform"
5389 }
5390 };
5391 }
5392 return {
5393 position: strategy,
5394 left: x2,
5395 top: y2
5396 };
5397 }, [strategy, transform, elements.floating, data.x, data.y]);
5398 return React24.useMemo(() => ({
5399 ...data,
5400 update: update2,
5401 refs,
5402 elements,
5403 floatingStyles
5404 }), [data, update2, refs, elements, floatingStyles]);
5405 }
5406 var offset3 = (options, deps) => {
5407 const result = offset2(options);
5408 return {
5409 name: result.name,
5410 fn: result.fn,
5411 options: [options, deps]
5412 };
5413 };
5414 var shift3 = (options, deps) => {
5415 const result = shift2(options);
5416 return {
5417 name: result.name,
5418 fn: result.fn,
5419 options: [options, deps]
5420 };
5421 };
5422 var limitShift3 = (options, deps) => {
5423 const result = limitShift2(options);
5424 return {
5425 fn: result.fn,
5426 options: [options, deps]
5427 };
5428 };
5429 var flip3 = (options, deps) => {
5430 const result = flip2(options);
5431 return {
5432 name: result.name,
5433 fn: result.fn,
5434 options: [options, deps]
5435 };
5436 };
5437 var size3 = (options, deps) => {
5438 const result = size2(options);
5439 return {
5440 name: result.name,
5441 fn: result.fn,
5442 options: [options, deps]
5443 };
5444 };
5445
5446 // node_modules/@base-ui/react/utils/popups/popupHandle.mjs
5447 var BasePopupHandle = class {
5448 /**
5449 * Stores of every root currently using this handle, in attach order. A handle is meant to be used
5450 * by a single mounted root, but roots can transiently overlap (e.g. during an animated route
5451 * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of
5452 * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first.
5453 */
5454 attachedStores = [];
5455 /**
5456 * Store of the root that currently controls the handle: the most recently attached one still
5457 * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`.
5458 */
5459 attachedStoreValue = null;
5460 /**
5461 * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer.
5462 */
5463 storeListeners = /* @__PURE__ */ new Set();
5464 /**
5465 * Creates a handle backed by the store used while no root is attached.
5466 *
5467 * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached,
5468 * so they can render and register without a mounted root. Triggers register into whichever store
5469 * `store` currently resolves to, so while detached they live in this store's trigger map and
5470 * migrate themselves to the root's store (and back) as it attaches/detaches.
5471 * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces
5472 * `MenuHandle.open()` in warning text.
5473 * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is
5474 * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to,
5475 * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning.
5476 */
5477 constructor(fallbackStore, componentName, throwOnMissingTrigger = true) {
5478 this.fallbackStore = fallbackStore;
5479 this.componentName = componentName;
5480 this.throwOnMissingTrigger = throwOnMissingTrigger;
5481 }
5482 get attachedStore() {
5483 return this.attachedStoreValue;
5484 }
5485 /**
5486 * Store that detached triggers read from: the attached root's store, or an inert fallback store
5487 * used while no root is attached.
5488 * @internal
5489 */
5490 get store() {
5491 return this.attachedStoreValue ?? this.fallbackStore;
5492 }
5493 /**
5494 * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on
5495 * the handle during render because a handle can be shared by concurrent server-rendered requests.
5496 * @internal
5497 */
5498 get serverStore() {
5499 return this.fallbackStore;
5500 }
5501 /**
5502 * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind
5503 * when a root attaches or detaches. Returns a function that removes the listener.
5504 * @internal
5505 */
5506 subscribeStore(listener) {
5507 this.storeListeners.add(listener);
5508 return () => {
5509 this.storeListeners.delete(listener);
5510 };
5511 }
5512 /**
5513 * Points the handle at a root's store and notifies subscribers so detached triggers re-render and
5514 * re-register into it (their registration effect migrates them when the store pointer changes).
5515 * Returns a cleanup function that detaches the store again.
5516 * @internal
5517 */
5518 attachStore(newStore) {
5519 this.attachedStores.push(newStore);
5520 this.setActiveStore(newStore);
5521 if (true) {
5522 if (this.attachedStores.length > 1) {
5523 const dev = this;
5524 (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => {
5525 if (this.attachedStores.length > 1) {
5526 console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle.");
5527 }
5528 });
5529 }
5530 }
5531 return () => {
5532 const index2 = this.attachedStores.lastIndexOf(newStore);
5533 if (index2 !== -1) {
5534 this.attachedStores.splice(index2, 1);
5535 }
5536 this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null);
5537 };
5538 }
5539 /**
5540 * Sets the store that currently controls the handle and notifies subscribers when it changes, so
5541 * detached triggers re-render and migrate their registration to the new store.
5542 */
5543 setActiveStore(store) {
5544 if (this.attachedStoreValue !== store) {
5545 this.attachedStoreValue = store;
5546 this.storeListeners.forEach((listener) => {
5547 listener();
5548 });
5549 }
5550 }
5551 /**
5552 * Opens the attached root's store and associates it with the trigger with the given id, or a
5553 * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public
5554 * `open()` method, which only narrows the parameter type.
5555 *
5556 * When a trigger id is given but no matching trigger is registered, anchored popups throw (see
5557 * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead.
5558 *
5559 * This method should only be called in an event handler or an effect (not during rendering).
5560 *
5561 * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open
5562 * without associating any trigger.
5563 */
5564 openByTrigger(triggerId) {
5565 const attachedStore = this.attachedStore;
5566 if (attachedStore === null) {
5567 if (true) {
5568 console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`);
5569 }
5570 return;
5571 }
5572 let triggerElement;
5573 if (triggerId) {
5574 for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) {
5575 triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId);
5576 }
5577 triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId);
5578 }
5579 if (triggerId && !triggerElement) {
5580 if (this.throwOnMissingTrigger) {
5581 throw new Error(true ? `Base UI: ${this.componentName}Handle.open() was called with the trigger id "${triggerId}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its "handle" prop.` : formatErrorMessage_default(99, this.componentName, triggerId, this.componentName));
5582 }
5583 if (true) {
5584 console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id "${triggerId}". The popup will open, but the trigger will not be associated with it.`);
5585 }
5586 }
5587 attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement));
5588 }
5589 /**
5590 * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning)
5591 * while no root is attached. Shared by every concrete handle's public `close()` method.
5592 *
5593 * This method should only be called in an event handler or an effect (not during rendering).
5594 */
5595 closePopup() {
5596 const attachedStore = this.attachedStore;
5597 if (attachedStore === null) {
5598 if (true) {
5599 console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`);
5600 }
5601 return;
5602 }
5603 attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction));
5604 }
5605 };
5606
5607 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
5608 var React29 = __toESM(require_react(), 1);
5609 var ReactDOM4 = __toESM(require_react_dom(), 1);
5610
5611 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
5612 var React28 = __toESM(require_react(), 1);
5613
5614 // node_modules/@base-ui/utils/store/useStore.mjs
5615 var React26 = __toESM(require_react(), 1);
5616 var import_shim = __toESM(require_shim(), 1);
5617 var import_with_selector = __toESM(require_with_selector(), 1);
5618
5619 // node_modules/@base-ui/utils/fastHooks.mjs
5620 var React25 = __toESM(require_react(), 1);
5621 var hooks = [];
5622 var currentInstance = void 0;
5623 function getInstance() {
5624 return currentInstance;
5625 }
5626 function register(hook) {
5627 hooks.push(hook);
5628 }
5629 function fastComponent(fn) {
5630 const FastComponent = (props, forwardedRef) => {
5631 const instance = useRefWithInit(createInstance).current;
5632 let result;
5633 try {
5634 currentInstance = instance;
5635 for (const hook of hooks) {
5636 hook.before(instance);
5637 }
5638 result = fn(props, forwardedRef);
5639 for (const hook of hooks) {
5640 hook.after(instance);
5641 }
5642 instance.didInitialize = true;
5643 } finally {
5644 currentInstance = void 0;
5645 }
5646 return result;
5647 };
5648 FastComponent.displayName = fn.displayName || fn.name;
5649 return FastComponent;
5650 }
5651 function fastComponentRef(fn) {
5652 return /* @__PURE__ */ React25.forwardRef(fastComponent(fn));
5653 }
5654 function createInstance() {
5655 return {
5656 didInitialize: false
5657 };
5658 }
5659
5660 // node_modules/@base-ui/utils/store/useStore.mjs
5661 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);
5662 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;
5663 function useStore(store, selector, a1, a2, a3) {
5664 return useStoreImplementation(store, selector, a1, a2, a3);
5665 }
5666 function useStoreR19(store, selector, a1, a2, a3) {
5667 const getSelection = React26.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);
5668 return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection);
5669 }
5670 register({
5671 before(instance) {
5672 instance.syncIndex = 0;
5673 if (!instance.didInitialize) {
5674 instance.syncTick = 1;
5675 instance.syncHooks = [];
5676 instance.didChangeStore = true;
5677 instance.getSnapshot = () => {
5678 let didChange2 = false;
5679 for (let i = 0; i < instance.syncHooks.length; i += 1) {
5680 const hook = instance.syncHooks[i];
5681 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);
5682 if (!Object.is(hook.value, value)) {
5683 didChange2 = true;
5684 hook.value = value;
5685 }
5686 }
5687 if (didChange2) {
5688 instance.syncTick += 1;
5689 }
5690 return instance.syncTick;
5691 };
5692 }
5693 },
5694 after(instance) {
5695 if (instance.syncHooks.length > 0) {
5696 if (instance.didChangeStore) {
5697 instance.didChangeStore = false;
5698 instance.subscribe = (onStoreChange) => {
5699 const stores = /* @__PURE__ */ new Set();
5700 for (const hook of instance.syncHooks) {
5701 stores.add(hook.store);
5702 }
5703 const unsubscribes = [];
5704 for (const store of stores) {
5705 unsubscribes.push(store.subscribe(onStoreChange));
5706 }
5707 return () => {
5708 for (const unsubscribe of unsubscribes) {
5709 unsubscribe();
5710 }
5711 };
5712 };
5713 }
5714 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot);
5715 }
5716 }
5717 });
5718 function useStoreFast(store, selector, a1, a2, a3) {
5719 const instance = getInstance();
5720 if (!instance) {
5721 return useStoreR19(store, selector, a1, a2, a3);
5722 }
5723 const index2 = instance.syncIndex;
5724 instance.syncIndex += 1;
5725 let hook;
5726 if (!instance.didInitialize) {
5727 hook = {
5728 store,
5729 selector,
5730 a1,
5731 a2,
5732 a3,
5733 value: selector(store.getSnapshot(), a1, a2, a3)
5734 };
5735 instance.syncHooks.push(hook);
5736 } else {
5737 hook = instance.syncHooks[index2];
5738 if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {
5739 if (hook.store !== store) {
5740 instance.didChangeStore = true;
5741 }
5742 hook.store = store;
5743 hook.selector = selector;
5744 hook.a1 = a1;
5745 hook.a2 = a2;
5746 hook.a3 = a3;
5747 hook.value = selector(store.getSnapshot(), a1, a2, a3);
5748 }
5749 }
5750 return hook.value;
5751 }
5752 function useStoreLegacy(store, selector, a1, a2, a3) {
5753 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3));
5754 }
5755
5756 // node_modules/@base-ui/utils/store/Store.mjs
5757 var Store = class {
5758 /**
5759 * Creates a store with the given initial state, constructing the class it is called on.
5760 * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that
5761 * class but degrades the inferred instance type to `Store`; use `new` there instead.
5762 */
5763 static create(state) {
5764 return new this(state);
5765 }
5766 /**
5767 * The current state of the store.
5768 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
5769 * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
5770 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
5771 *
5772 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
5773 */
5774 // Internal state to handle recursive `setState()` calls
5775 constructor(state) {
5776 this.state = state;
5777 this.listeners = /* @__PURE__ */ new Set();
5778 this.updateTick = 0;
5779 }
5780 /**
5781 * Registers a listener that will be called whenever the store's state changes.
5782 *
5783 * @param fn The listener function to be called on state changes.
5784 * @returns A function to unsubscribe the listener.
5785 */
5786 subscribe = (fn) => {
5787 this.listeners.add(fn);
5788 return () => {
5789 this.listeners.delete(fn);
5790 };
5791 };
5792 /**
5793 * Returns the current state of the store.
5794 */
5795 getSnapshot = () => {
5796 return this.state;
5797 };
5798 /**
5799 * Updates the entire store's state and notifies all registered listeners.
5800 *
5801 * @param newState The new state to set for the store.
5802 */
5803 setState(newState) {
5804 if (this.state === newState) {
5805 return;
5806 }
5807 this.state = newState;
5808 this.updateTick += 1;
5809 const currentTick = this.updateTick;
5810 for (const listener of this.listeners) {
5811 if (currentTick !== this.updateTick) {
5812 return;
5813 }
5814 listener(newState);
5815 }
5816 }
5817 /**
5818 * Merges the provided changes into the current state and notifies listeners if there are changes.
5819 * Each value must match its state key. Pass an exact known subset rather than a broad
5820 * `Partial<State>`, which may contain `undefined` for required state fields.
5821 *
5822 * @param changes An object containing the changes to apply to the current state.
5823 */
5824 update(changes) {
5825 for (const key in changes) {
5826 if (!Object.is(this.state[key], changes[key])) {
5827 this.setState({
5828 ...this.state,
5829 ...changes
5830 });
5831 return;
5832 }
5833 }
5834 }
5835 /**
5836 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
5837 *
5838 * @param key The key in the store's state to update.
5839 * @param value The new value to set for the specified key.
5840 */
5841 set(key, value) {
5842 if (!Object.is(this.state[key], value)) {
5843 this.setState({
5844 ...this.state,
5845 [key]: value
5846 });
5847 }
5848 }
5849 /**
5850 * Gives the state a new reference and updates all registered listeners.
5851 */
5852 notifyAll() {
5853 const newState = {
5854 ...this.state
5855 };
5856 this.setState(newState);
5857 }
5858 use(selector, a1, a2, a3) {
5859 return useStore(this, selector, a1, a2, a3);
5860 }
5861 };
5862
5863 // node_modules/@base-ui/utils/store/ReactStore.mjs
5864 var React27 = __toESM(require_react(), 1);
5865 var ReactStore = class extends Store {
5866 /**
5867 * Creates a new ReactStore instance.
5868 *
5869 * @param state Initial state of the store.
5870 * @param context Non-reactive context values.
5871 * @param selectors Optional selectors for use with `useState`.
5872 */
5873 constructor(state, context = {}, selectors3) {
5874 super(state);
5875 this.context = context;
5876 this.selectors = selectors3;
5877 }
5878 /**
5879 * Non-reactive values such as refs, callbacks, etc.
5880 */
5881 /**
5882 * Synchronizes a single external value into the store.
5883 *
5884 * Note that the while the value in `state` is updated immediately, the value returned
5885 * by `useState` is updated before the next render (similarly to React's `useState`).
5886 */
5887 useSyncedValue(key, value) {
5888 React27.useDebugValue(key);
5889 const store = this;
5890 useIsoLayoutEffect(() => {
5891 if (store.state[key] !== value) {
5892 store.set(key, value);
5893 }
5894 }, [store, key, value]);
5895 }
5896 /**
5897 * Synchronizes a single external value into the store and
5898 * cleans it up (sets to `undefined`) on unmount.
5899 *
5900 * Note that the while the value in `state` is updated immediately, the value returned
5901 * by `useState` is updated before the next render (similarly to React's `useState`).
5902 */
5903 useSyncedValueWithCleanup(key, value) {
5904 const store = this;
5905 useIsoLayoutEffect(() => {
5906 if (store.state[key] !== value) {
5907 store.set(key, value);
5908 }
5909 return () => {
5910 store.set(key, void 0);
5911 };
5912 }, [store, key, value]);
5913 }
5914 /**
5915 * Synchronizes multiple external values into the store.
5916 * Each value must match its state key. Pass an exact known subset rather than a broad
5917 * `Partial<State>`, which may contain `undefined` for required state fields.
5918 *
5919 * Note that the while the values in `state` are updated immediately, the values returned
5920 * by `useState` are updated before the next render (similarly to React's `useState`).
5921 *
5922 * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted.
5923 */
5924 useSyncedValues(statePart) {
5925 const store = this;
5926 if (true) {
5927 React27.useDebugValue(statePart, (p2) => Object.keys(p2));
5928 const keys = React27.useRef(Object.keys(statePart)).current;
5929 const nextKeys = Object.keys(statePart);
5930 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) {
5931 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
5932 }
5933 }
5934 const dependencies = Object.values(statePart);
5935 useIsoLayoutEffect(() => {
5936 store.update(statePart);
5937 }, [store, ...dependencies]);
5938 }
5939 /**
5940 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
5941 * is non-undefined, the store's state at `key` is updated to match `controlled`.
5942 */
5943 useControlledProp(key, controlled) {
5944 React27.useDebugValue(key);
5945 const store = this;
5946 const isControlled = controlled !== void 0;
5947 useIsoLayoutEffect(() => {
5948 if (isControlled && !Object.is(store.state[key], controlled)) {
5949 store.setState({
5950 ...store.state,
5951 [key]: controlled
5952 });
5953 }
5954 }, [store, key, controlled, isControlled]);
5955 if (true) {
5956 const cache = this.controlledValues ??= /* @__PURE__ */ new Map();
5957 if (!cache.has(key)) {
5958 cache.set(key, isControlled);
5959 }
5960 const previouslyControlled = cache.get(key);
5961 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) {
5962 console.error(`A component is changing the ${isControlled ? "" : "un"}controlled state of ${key.toString()} to be ${isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
5963 }
5964 }
5965 }
5966 /** Gets the current value from the store using a selector with the provided key.
5967 *
5968 * @param key Key of the selector to use.
5969 */
5970 select(key, a1, a2, a3) {
5971 const selector = this.selectors[key];
5972 return selector(this.state, a1, a2, a3);
5973 }
5974 /**
5975 * Returns a value from the store's state using a selector function.
5976 * Used to subscribe to specific parts of the state.
5977 * This methods causes a rerender whenever the selected state changes.
5978 *
5979 * @param key Key of the selector to use.
5980 */
5981 useState(key, a1, a2, a3) {
5982 React27.useDebugValue(key);
5983 return useStore(this, this.selectors[key], a1, a2, a3);
5984 }
5985 /**
5986 * Wraps a function with `useStableCallback` to ensure it has a stable reference
5987 * and assigns it to the context.
5988 *
5989 * @param key Key of the event callback. Must be a function in the context.
5990 * @param fn Function to assign.
5991 */
5992 useContextCallback(key, fn) {
5993 React27.useDebugValue(key);
5994 const stableFunction = useStableCallback(fn ?? NOOP);
5995 this.context[key] = stableFunction;
5996 }
5997 /**
5998 * Returns a stable setter function for a specific key in the store's state.
5999 * It's commonly used to pass as a ref callback to React elements.
6000 *
6001 * @param key Key of the state to set.
6002 */
6003 useStateSetter(key) {
6004 const ref = React27.useRef(void 0);
6005 if (ref.current === void 0) {
6006 ref.current = (value) => {
6007 this.set(key, value);
6008 };
6009 }
6010 return ref.current;
6011 }
6012 /**
6013 * Observes changes derived from the store's selectors and calls the listener when the selected value changes.
6014 *
6015 * @param key Key of the selector to observe.
6016 * @param listener Listener function called when the selector result changes.
6017 */
6018 observe(selector, listener) {
6019 let selectFn;
6020 if (typeof selector === "function") {
6021 selectFn = selector;
6022 } else {
6023 selectFn = this.selectors[selector];
6024 }
6025 let prevValue = selectFn(this.state);
6026 listener(prevValue, prevValue, this);
6027 return this.subscribe((nextState) => {
6028 const nextValue = selectFn(nextState);
6029 if (!Object.is(prevValue, nextValue)) {
6030 const oldValue = prevValue;
6031 prevValue = nextValue;
6032 listener(nextValue, oldValue, this);
6033 }
6034 });
6035 }
6036 };
6037
6038 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs
6039 var selectors = {
6040 open: (state) => state.open,
6041 transitionStatus: (state) => state.transitionStatus,
6042 domReferenceElement: (state) => state.domReferenceElement,
6043 referenceElement: (state) => state.positionReference ?? state.referenceElement,
6044 floatingElement: (state) => state.floatingElement,
6045 floatingId: (state) => state.floatingId
6046 };
6047 var FloatingRootStore = class extends ReactStore {
6048 constructor(options) {
6049 const {
6050 syncOnly,
6051 nested,
6052 onOpenChange,
6053 triggerElements,
6054 ...initialState
6055 } = options;
6056 super({
6057 ...initialState,
6058 positionReference: initialState.referenceElement,
6059 domReferenceElement: initialState.referenceElement
6060 }, {
6061 onOpenChange,
6062 dataRef: {
6063 current: {}
6064 },
6065 events: createEventEmitter(),
6066 nested,
6067 triggerElements
6068 }, selectors);
6069 this.syncOnly = syncOnly;
6070 }
6071 /**
6072 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.
6073 */
6074 syncOpenEvent = (newOpen, event) => {
6075 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
6076 // click events to upgrade a hover-open.
6077 event != null && isClickLikeEvent(event)) {
6078 this.context.dataRef.current.openEvent = newOpen ? event : void 0;
6079 }
6080 };
6081 /**
6082 * Runs the root-owned side effects for an open state change.
6083 */
6084 dispatchOpenChange = (newOpen, eventDetails) => {
6085 this.syncOpenEvent(newOpen, eventDetails.event);
6086 const details = {
6087 open: newOpen,
6088 reason: eventDetails.reason,
6089 nativeEvent: eventDetails.event,
6090 nested: this.context.nested,
6091 triggerElement: eventDetails.trigger
6092 };
6093 this.context.events.emit("openchange", details);
6094 };
6095 /**
6096 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
6097 *
6098 * @param newOpen The new open state.
6099 * @param eventDetails Details about the event that triggered the open state change.
6100 */
6101 setOpen = (newOpen, eventDetails) => {
6102 if (this.syncOnly) {
6103 this.context.onOpenChange?.(newOpen, eventDetails);
6104 return;
6105 }
6106 this.dispatchOpenChange(newOpen, eventDetails);
6107 this.context.onOpenChange?.(newOpen, eventDetails);
6108 };
6109 };
6110
6111 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs
6112 function useSyncedFloatingRootContext(options) {
6113 const {
6114 popupStore,
6115 treatPopupAsFloatingElement = false,
6116 floatingRootContext: floatingRootContextProp,
6117 floatingId,
6118 nested,
6119 onOpenChange
6120 } = options;
6121 const open3 = popupStore.useState("open");
6122 const referenceElement = popupStore.useState("activeTriggerElement");
6123 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement");
6124 const triggerElements = popupStore.context.triggerElements;
6125 const handleOpenChange = onOpenChange;
6126 const internalStoreRef = React28.useRef(null);
6127 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) {
6128 internalStoreRef.current = new FloatingRootStore({
6129 open: open3,
6130 transitionStatus: void 0,
6131 referenceElement,
6132 floatingElement,
6133 triggerElements,
6134 onOpenChange: handleOpenChange,
6135 floatingId,
6136 syncOnly: true,
6137 nested
6138 });
6139 }
6140 const store = floatingRootContextProp ?? internalStoreRef.current;
6141 popupStore.useSyncedValue("floatingId", floatingId);
6142 useIsoLayoutEffect(() => {
6143 const valuesToSync = {
6144 open: open3,
6145 floatingId,
6146 referenceElement,
6147 floatingElement
6148 };
6149 if (isElement(referenceElement)) {
6150 valuesToSync.domReferenceElement = referenceElement;
6151 }
6152 if (store.state.positionReference === store.state.referenceElement) {
6153 valuesToSync.positionReference = referenceElement;
6154 }
6155 store.update(valuesToSync);
6156 }, [open3, floatingId, referenceElement, floatingElement, store]);
6157 store.context.onOpenChange = handleOpenChange;
6158 store.context.nested = nested;
6159 return store;
6160 }
6161
6162 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs
6163 var FOCUSABLE_POPUP_PROPS = {
6164 tabIndex: -1,
6165 [FOCUSABLE_ATTRIBUTE]: ""
6166 };
6167 function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {
6168 const floatingId = useId();
6169 const nested = useFloatingParentNodeId() != null;
6170 const store = useRefWithInit(() => createStore(floatingId, nested)).current;
6171 useSyncedFloatingRootContext({
6172 popupStore: store,
6173 treatPopupAsFloatingElement,
6174 floatingRootContext: store.state.floatingRootContext,
6175 floatingId,
6176 nested,
6177 onOpenChange: store.setOpen
6178 });
6179 return store;
6180 }
6181 function PopupHandleAttachment({
6182 handle,
6183 store
6184 }) {
6185 useIsoLayoutEffect(() => {
6186 return handle.attachStore(store);
6187 }, [handle, store]);
6188 return null;
6189 }
6190 function syncTriggerCount(store) {
6191 const triggerCount = store.context.triggerElements.size;
6192 if (store.select("open") && store.state.triggerCount !== triggerCount) {
6193 store.set("triggerCount", triggerCount);
6194 }
6195 }
6196 function useTriggerRegistration(id, store) {
6197 const registrationRef = React29.useRef(null);
6198 return useStableCallback((element) => {
6199 const registration = registrationRef.current;
6200 if (registration !== null) {
6201 if (registration.element === element && registration.store === store && registration.id === id) {
6202 return;
6203 }
6204 registrationRef.current = null;
6205 const registeredStore = registration.store;
6206 if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) {
6207 registeredStore.context.triggerElements.delete(registration.id);
6208 syncTriggerCount(registeredStore);
6209 }
6210 }
6211 if (element !== null && id !== void 0) {
6212 registrationRef.current = {
6213 store,
6214 id,
6215 element
6216 };
6217 store.context.triggerElements.add(id, element);
6218 syncTriggerCount(store);
6219 }
6220 });
6221 }
6222 function createPopupOpenState(state, open3, trigger, preventUnmountOnClose = false) {
6223 let preventUnmountingOnClose = state.preventUnmountingOnClose;
6224 if (open3) {
6225 preventUnmountingOnClose = false;
6226 } else if (preventUnmountOnClose) {
6227 preventUnmountingOnClose = true;
6228 }
6229 const triggerId = trigger?.id ?? null;
6230 let activeTriggerId = state.activeTriggerId;
6231 let activeTriggerElement = state.activeTriggerElement;
6232 if (triggerId || open3) {
6233 activeTriggerId = triggerId;
6234 activeTriggerElement = trigger ?? null;
6235 }
6236 return {
6237 open: open3,
6238 preventUnmountingOnClose,
6239 activeTriggerId,
6240 activeTriggerElement
6241 };
6242 }
6243 function attachPreventUnmountOnClose(eventDetails) {
6244 let preventUnmountOnClose = false;
6245 eventDetails.preventUnmountOnClose = () => {
6246 preventUnmountOnClose = true;
6247 };
6248 return () => preventUnmountOnClose;
6249 }
6250 function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {
6251 const reason = eventDetails.reason;
6252 const isHover = reason === reason_parts_exports.triggerHover;
6253 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus;
6254 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey);
6255 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
6256 store.context.onOpenChange?.(nextOpen, eventDetails);
6257 if (eventDetails.isCanceled) {
6258 return;
6259 }
6260 options.onBeforeDispatch?.();
6261 store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
6262 const changeState = () => {
6263 const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
6264 const updatedState = {
6265 ...options.extraState,
6266 ...popupOpenState
6267 };
6268 if (isFocusOpen) {
6269 updatedState.instantType = "focus";
6270 } else if (isDismissClose) {
6271 updatedState.instantType = "dismiss";
6272 } else if (isHover) {
6273 updatedState.instantType = void 0;
6274 }
6275 store.update(updatedState);
6276 };
6277 if (isHover) {
6278 ReactDOM4.flushSync(changeState);
6279 } else {
6280 changeState();
6281 }
6282 }
6283 function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {
6284 const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId);
6285 const baseRegisterTrigger = useTriggerRegistration(triggerId, store);
6286 const applyTriggerData = useStableCallback((element) => {
6287 const open3 = store.select("open");
6288 const activeTriggerId = store.select("activeTriggerId");
6289 if (activeTriggerId === triggerId) {
6290 const changes = {
6291 activeTriggerElement: element,
6292 ...open3 ? stateUpdates : null
6293 };
6294 store.update(changes);
6295 return;
6296 }
6297 if (activeTriggerId == null && open3) {
6298 const changes = {
6299 activeTriggerId: triggerId ?? null,
6300 activeTriggerElement: element,
6301 ...stateUpdates
6302 };
6303 store.update(changes);
6304 }
6305 });
6306 const registerTrigger = useStableCallback((element) => {
6307 baseRegisterTrigger(element);
6308 if (element) {
6309 applyTriggerData(element);
6310 }
6311 });
6312 useIsoLayoutEffect(() => {
6313 registerTrigger(triggerElementRef.current);
6314 return () => registerTrigger(null);
6315 }, [registerTrigger, triggerElementRef, store, triggerId]);
6316 useIsoLayoutEffect(() => {
6317 if (isMountedByThisTrigger) {
6318 const changes = {
6319 activeTriggerElement: triggerElementRef.current,
6320 ...stateUpdates
6321 };
6322 store.update(changes);
6323 }
6324 }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);
6325 return {
6326 registerTrigger,
6327 isMountedByThisTrigger
6328 };
6329 }
6330 function useImplicitActiveTrigger(store, options = {}) {
6331 const {
6332 closeOnActiveTriggerUnmount = false
6333 } = options;
6334 const resolvedActiveTriggerIdRef = React29.useRef(null);
6335 const open3 = store.useState("open");
6336 const reactiveTriggerCount = store.useState("triggerCount");
6337 const activeTriggerId = store.useState("activeTriggerId");
6338 const reactiveActiveTriggerElement = store.useState("activeTriggerElement");
6339 useIsoLayoutEffect(() => {
6340 if (!open3) {
6341 resolvedActiveTriggerIdRef.current = null;
6342 if (store.state.triggerCount !== 0) {
6343 store.set("triggerCount", 0);
6344 }
6345 return;
6346 }
6347 const triggerCount = store.context.triggerElements.size;
6348 const stateUpdates = {};
6349 if (store.state.triggerCount !== triggerCount) {
6350 stateUpdates.triggerCount = triggerCount;
6351 }
6352 const currentActiveTriggerId = store.select("activeTriggerId");
6353 let lostActiveTriggerId = null;
6354 if (currentActiveTriggerId) {
6355 const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId);
6356 if (!activeTriggerElement) {
6357 for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) {
6358 if (triggerElement === store.state.activeTriggerElement) {
6359 stateUpdates.activeTriggerId = triggerId;
6360 stateUpdates.activeTriggerElement = triggerElement;
6361 resolvedActiveTriggerIdRef.current = triggerId;
6362 break;
6363 }
6364 }
6365 if (stateUpdates.activeTriggerId === void 0) {
6366 if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {
6367 lostActiveTriggerId = currentActiveTriggerId;
6368 } else {
6369 resolvedActiveTriggerIdRef.current = null;
6370 }
6371 }
6372 } else {
6373 resolvedActiveTriggerIdRef.current = currentActiveTriggerId;
6374 if (activeTriggerElement !== store.state.activeTriggerElement) {
6375 stateUpdates.activeTriggerElement = activeTriggerElement;
6376 }
6377 }
6378 } else {
6379 resolvedActiveTriggerIdRef.current = null;
6380 }
6381 if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {
6382 const iteratorResult = store.context.triggerElements.entries().next();
6383 if (!iteratorResult.done) {
6384 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;
6385 stateUpdates.activeTriggerId = implicitTriggerId;
6386 stateUpdates.activeTriggerElement = implicitTriggerElement;
6387 resolvedActiveTriggerIdRef.current = implicitTriggerId;
6388 }
6389 }
6390 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) {
6391 store.update(stateUpdates);
6392 }
6393 if (lostActiveTriggerId) {
6394 if (closeOnActiveTriggerUnmount) {
6395 queueMicrotask(() => {
6396 if (store.select("open") && store.select("activeTriggerId") === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {
6397 const eventDetails = createChangeEventDetails(reason_parts_exports.none);
6398 store.setOpen(false, eventDetails);
6399 if (!eventDetails.isCanceled) {
6400 store.update({
6401 activeTriggerId: null,
6402 activeTriggerElement: null
6403 });
6404 }
6405 }
6406 });
6407 }
6408 }
6409 }, [open3, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);
6410 }
6411 function useOpenStateTransitions(open3, store, onUnmount, animateInitialOpen) {
6412 const {
6413 mounted,
6414 setMounted,
6415 transitionStatus
6416 } = useTransitionStatus(open3, false, false, animateInitialOpen);
6417 const preventUnmountingOnClose = store.useState("preventUnmountingOnClose");
6418 const syncedPreventUnmountingOnClose = open3 ? false : preventUnmountingOnClose;
6419 store.useSyncedValues({
6420 mounted,
6421 transitionStatus,
6422 preventUnmountingOnClose: syncedPreventUnmountingOnClose
6423 });
6424 const forceUnmount = useStableCallback(() => {
6425 setMounted(false);
6426 store.update({
6427 activeTriggerId: null,
6428 activeTriggerElement: null,
6429 mounted: false,
6430 preventUnmountingOnClose: false
6431 });
6432 onUnmount?.();
6433 store.context.onOpenChangeComplete?.(false);
6434 });
6435 useOpenChangeComplete({
6436 enabled: mounted && !open3 && !syncedPreventUnmountingOnClose,
6437 open: open3,
6438 ref: store.context.popupRef,
6439 onComplete() {
6440 if (!open3) {
6441 forceUnmount();
6442 }
6443 }
6444 });
6445 return {
6446 forceUnmount,
6447 transitionStatus
6448 };
6449 }
6450 function usePopupInteractionProps(store, statePart) {
6451 store.useSyncedValues(statePart);
6452 useIsoLayoutEffect(() => () => {
6453 store.update({
6454 activeTriggerProps: EMPTY_OBJECT,
6455 inactiveTriggerProps: EMPTY_OBJECT,
6456 popupProps: EMPTY_OBJECT
6457 });
6458 }, [store]);
6459 }
6460
6461 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs
6462 var devElementIdsByMap;
6463 function getDevElementIds(map) {
6464 devElementIdsByMap ??= /* @__PURE__ */ new WeakMap();
6465 let elementIds = devElementIdsByMap.get(map);
6466 if (!elementIds) {
6467 elementIds = /* @__PURE__ */ new WeakMap();
6468 devElementIdsByMap.set(map, elementIds);
6469 }
6470 return elementIds;
6471 }
6472 var PopupTriggerMap = class {
6473 constructor() {
6474 this.idMap = /* @__PURE__ */ new Map();
6475 }
6476 /**
6477 * Adds a trigger element with the given ID.
6478 *
6479 * Note: The provided element is assumed to not be registered under multiple IDs.
6480 */
6481 add(id, element) {
6482 if (true) {
6483 const elementIds = getDevElementIds(this);
6484 const existingId = elementIds.get(element);
6485 if (existingId !== void 0 && existingId !== id) {
6486 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.");
6487 }
6488 const previousElement = this.idMap.get(id);
6489 if (previousElement !== void 0 && previousElement !== element) {
6490 elementIds.delete(previousElement);
6491 }
6492 elementIds.set(element, id);
6493 }
6494 this.idMap.set(id, element);
6495 }
6496 /**
6497 * Removes the trigger element with the given ID.
6498 */
6499 delete(id) {
6500 if (true) {
6501 const element = this.idMap.get(id);
6502 if (element !== void 0) {
6503 devElementIdsByMap?.get(this)?.delete(element);
6504 }
6505 }
6506 this.idMap.delete(id);
6507 }
6508 /**
6509 * Whether the given element is registered as a trigger.
6510 */
6511 hasElement(element) {
6512 for (const registered of this.idMap.values()) {
6513 if (registered === element) {
6514 return true;
6515 }
6516 }
6517 return false;
6518 }
6519 /**
6520 * Whether there is a registered trigger element matching the given predicate.
6521 */
6522 hasMatchingElement(predicate) {
6523 for (const element of this.idMap.values()) {
6524 if (predicate(element)) {
6525 return true;
6526 }
6527 }
6528 return false;
6529 }
6530 /**
6531 * Returns the trigger element associated with the given ID, or undefined if no such element exists.
6532 */
6533 getById(id) {
6534 return this.idMap.get(id);
6535 }
6536 /**
6537 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].
6538 */
6539 entries() {
6540 return this.idMap.entries();
6541 }
6542 /**
6543 * Returns an iterable of all registered trigger elements.
6544 */
6545 elements() {
6546 return this.idMap.values();
6547 }
6548 /**
6549 * Returns the number of registered trigger elements.
6550 */
6551 get size() {
6552 return this.idMap.size;
6553 }
6554 };
6555
6556 // node_modules/@base-ui/react/utils/popups/store.mjs
6557 function createInitialPopupStoreState(triggerElements, floatingId, nested = false) {
6558 return {
6559 open: false,
6560 openProp: void 0,
6561 mounted: false,
6562 transitionStatus: void 0,
6563 floatingRootContext: new FloatingRootStore({
6564 open: false,
6565 transitionStatus: void 0,
6566 floatingElement: null,
6567 referenceElement: null,
6568 triggerElements,
6569 floatingId,
6570 syncOnly: true,
6571 nested,
6572 onOpenChange: void 0
6573 }),
6574 floatingId,
6575 triggerCount: 0,
6576 preventUnmountingOnClose: false,
6577 payload: void 0,
6578 activeTriggerId: null,
6579 activeTriggerElement: null,
6580 triggerIdProp: void 0,
6581 popupElement: null,
6582 positionerElement: null,
6583 activeTriggerProps: EMPTY_OBJECT,
6584 inactiveTriggerProps: EMPTY_OBJECT,
6585 popupProps: EMPTY_OBJECT
6586 };
6587 }
6588 var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId;
6589 var openSelector = (state) => state.openProp ?? state.open;
6590 var popupIdSelector = (state) => {
6591 const popupId = state.popupElement?.id ?? state.floatingId;
6592 return popupId || void 0;
6593 };
6594 function triggerOwnsOpenPopup(state, triggerId) {
6595 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
6596 }
6597 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
6598 if (triggerOwnsOpenPopup(state, triggerId)) {
6599 return true;
6600 }
6601 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;
6602 }
6603 var popupStoreSelectors = {
6604 open: openSelector,
6605 mounted: (state) => state.mounted,
6606 transitionStatus: (state) => state.transitionStatus,
6607 floatingRootContext: (state) => state.floatingRootContext,
6608 triggerCount: (state) => state.triggerCount,
6609 preventUnmountingOnClose: (state) => state.preventUnmountingOnClose,
6610 payload: (state) => state.payload,
6611 activeTriggerId: activeTriggerIdSelector,
6612 activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null,
6613 popupId: popupIdSelector,
6614 /**
6615 * Whether the trigger with the given ID was used to open the popup.
6616 */
6617 isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId,
6618 /**
6619 * Whether the popup is open and was activated by a trigger with the given ID.
6620 */
6621 isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),
6622 /**
6623 * Whether the popup is mounted and was activated by a trigger with the given ID.
6624 */
6625 isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted,
6626 triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,
6627 /**
6628 * Popup id for the trigger that currently owns the open popup.
6629 */
6630 triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0,
6631 popupProps: (state) => state.popupProps,
6632 popupElement: (state) => state.popupElement,
6633 positionerElement: (state) => state.positionerElement
6634 };
6635
6636 // node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs
6637 var React30 = __toESM(require_react(), 1);
6638 var import_shim2 = __toESM(require_shim(), 1);
6639 function usePopupHandleStore(handle) {
6640 const subscribe = React30.useCallback((listener) => {
6641 if (handle === void 0) {
6642 return NOOP;
6643 }
6644 return handle.subscribeStore(listener);
6645 }, [handle]);
6646 const getSnapshot = React30.useCallback(() => {
6647 return handle === void 0 ? void 0 : handle.store;
6648 }, [handle]);
6649 return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore);
6650 }
6651
6652 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs
6653 function useBaseUIFloating(options) {
6654 return useFloatingWithStore(options, options.rootContext);
6655 }
6656 function useFloatingWithStore(options, store) {
6657 const {
6658 nodeId,
6659 externalTree
6660 } = options;
6661 const referenceElement = store.useState("referenceElement");
6662 const floatingElement = store.useState("floatingElement");
6663 const domReferenceElement = store.useState("domReferenceElement");
6664 const open3 = store.useState("open");
6665 const floatingId = store.useState("floatingId");
6666 const [positionReference, setPositionReferenceRaw] = React31.useState(null);
6667 const [localDomReference, setLocalDomReference] = React31.useState(void 0);
6668 const [localFloatingElement, setLocalFloatingElement] = React31.useState(void 0);
6669 const domReferenceRef = React31.useRef(null);
6670 const tree = useFloatingTree(externalTree);
6671 const storeElements = React31.useMemo(() => ({
6672 reference: referenceElement,
6673 floating: floatingElement,
6674 domReference: domReferenceElement
6675 }), [referenceElement, floatingElement, domReferenceElement]);
6676 const position = useFloating({
6677 ...options,
6678 elements: {
6679 ...storeElements,
6680 ...positionReference && {
6681 reference: positionReference
6682 }
6683 }
6684 });
6685 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;
6686 const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement;
6687 store.useSyncedValue("referenceElement", localDomReference ?? null);
6688 store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement);
6689 store.useSyncedValue("floatingElement", syncedFloatingElement);
6690 const setPositionReference = React31.useCallback((node) => {
6691 const computedPositionReference = isElement(node) ? {
6692 getBoundingClientRect: () => node.getBoundingClientRect(),
6693 getClientRects: () => node.getClientRects(),
6694 contextElement: node
6695 } : node;
6696 setPositionReferenceRaw(computedPositionReference);
6697 position.refs.setReference(computedPositionReference);
6698 }, [position.refs]);
6699 const setReference = React31.useCallback((node) => {
6700 if (isElement(node) || node === null) {
6701 domReferenceRef.current = node;
6702 setLocalDomReference(node);
6703 }
6704 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
6705 // `null` to support `positionReference` + an unstable `reference`
6706 // callback ref.
6707 node !== null && !isElement(node)) {
6708 position.refs.setReference(node);
6709 }
6710 }, [position.refs, setLocalDomReference]);
6711 const setFloating = React31.useCallback((node) => {
6712 setLocalFloatingElement(node);
6713 position.refs.setFloating(node);
6714 }, [position.refs]);
6715 const refs = React31.useMemo(() => ({
6716 ...position.refs,
6717 setReference,
6718 setFloating,
6719 setPositionReference,
6720 domReference: domReferenceRef
6721 }), [position.refs, setReference, setFloating, setPositionReference]);
6722 const elements = React31.useMemo(() => ({
6723 ...position.elements,
6724 domReference: domReferenceElement
6725 }), [position.elements, domReferenceElement]);
6726 const context = React31.useMemo(() => ({
6727 ...position,
6728 dataRef: store.context.dataRef,
6729 open: open3,
6730 onOpenChange: store.setOpen,
6731 events: store.context.events,
6732 floatingId,
6733 refs,
6734 elements,
6735 nodeId,
6736 rootStore: store
6737 }), [position, refs, elements, nodeId, store, open3, floatingId]);
6738 useIsoLayoutEffect(() => {
6739 if (domReferenceElement) {
6740 domReferenceRef.current = domReferenceElement;
6741 }
6742 }, [domReferenceElement]);
6743 useIsoLayoutEffect(() => {
6744 store.context.dataRef.current.floatingContext = context;
6745 const node = tree?.nodesRef.current.find((n) => n.id === nodeId);
6746 if (node) {
6747 node.context = context;
6748 }
6749 });
6750 return React31.useMemo(() => ({
6751 ...position,
6752 context,
6753 refs,
6754 elements,
6755 rootStore: store
6756 }), [position, refs, elements, context, store]);
6757 }
6758
6759 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs
6760 var React32 = __toESM(require_react(), 1);
6761 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit;
6762 function useFocus(context, props = {}) {
6763 const {
6764 enabled = true,
6765 delay
6766 } = props;
6767 const store = "rootStore" in context ? context.rootStore : context;
6768 const {
6769 events,
6770 dataRef
6771 } = store.context;
6772 const blockFocusRef = React32.useRef(false);
6773 const blockedReferenceRef = React32.useRef(null);
6774 const keyboardModalityRef = React32.useRef(true);
6775 const timeout = useTimeout();
6776 React32.useEffect(() => {
6777 const domReference = store.select("domReferenceElement");
6778 if (!enabled) {
6779 return void 0;
6780 }
6781 const win = getWindow(domReference);
6782 function onBlur() {
6783 const currentDomReference = store.select("domReferenceElement");
6784 if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) {
6785 blockFocusRef.current = true;
6786 blockedReferenceRef.current = currentDomReference;
6787 }
6788 }
6789 function onKeyDown() {
6790 keyboardModalityRef.current = true;
6791 }
6792 function onPointerDown() {
6793 keyboardModalityRef.current = false;
6794 }
6795 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true));
6796 }, [store, enabled]);
6797 React32.useEffect(() => {
6798 if (!enabled) {
6799 return void 0;
6800 }
6801 function onOpenChangeLocal(details) {
6802 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) {
6803 const referenceElement = store.select("domReferenceElement");
6804 if (isElement(referenceElement)) {
6805 blockedReferenceRef.current = referenceElement;
6806 blockFocusRef.current = true;
6807 }
6808 }
6809 }
6810 events.on("openchange", onOpenChangeLocal);
6811 return () => {
6812 events.off("openchange", onOpenChangeLocal);
6813 };
6814 }, [events, enabled, store]);
6815 const reference = React32.useMemo(() => {
6816 function resetBlockedFocus() {
6817 blockFocusRef.current = false;
6818 blockedReferenceRef.current = null;
6819 }
6820 return {
6821 onMouseLeave() {
6822 resetBlockedFocus();
6823 },
6824 onFocus(event) {
6825 const focusTarget = event.currentTarget;
6826 if (blockFocusRef.current) {
6827 if (blockedReferenceRef.current === focusTarget) {
6828 return;
6829 }
6830 resetBlockedFocus();
6831 }
6832 const target = getTarget(event.nativeEvent);
6833 if (isElement(target)) {
6834 if (isMacSafari && !event.relatedTarget) {
6835 if (!keyboardModalityRef.current && !isTypeableElement(target)) {
6836 return;
6837 }
6838 } else if (!matchesFocusVisible(target)) {
6839 return;
6840 }
6841 }
6842 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements);
6843 const {
6844 nativeEvent,
6845 currentTarget
6846 } = event;
6847 const delayValue = typeof delay === "function" ? delay() : delay;
6848 if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) {
6849 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
6850 return;
6851 }
6852 timeout.start(delayValue, () => {
6853 if (blockFocusRef.current) {
6854 return;
6855 }
6856 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget));
6857 });
6858 },
6859 onBlur(event) {
6860 resetBlockedFocus();
6861 const relatedTarget = event.relatedTarget;
6862 const nativeEvent = event.nativeEvent;
6863 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
6864 timeout.start(0, () => {
6865 const domReference = store.select("domReferenceElement");
6866 const activeEl = activeElement(ownerDocument(domReference));
6867 if (!relatedTarget && activeEl === domReference) {
6868 return;
6869 }
6870 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) {
6871 return;
6872 }
6873 const nextFocusedElement = relatedTarget ?? activeEl;
6874 if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) {
6875 return;
6876 }
6877 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent));
6878 });
6879 }
6880 };
6881 }, [dataRef, delay, store, timeout]);
6882 return React32.useMemo(() => enabled ? {
6883 reference,
6884 trigger: reference
6885 } : {}, [enabled, reference]);
6886 }
6887
6888 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
6889 var React33 = __toESM(require_react(), 1);
6890
6891 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs
6892 var HoverInteraction = class _HoverInteraction {
6893 constructor() {
6894 this.pointerType = void 0;
6895 this.interactedInside = false;
6896 this.handler = void 0;
6897 this.blockMouseMove = true;
6898 this.performedPointerEventsMutation = false;
6899 this.pointerEventsScopeElement = null;
6900 this.pointerEventsReferenceElement = null;
6901 this.pointerEventsFloatingElement = null;
6902 this.restTimeoutPending = false;
6903 this.openChangeTimeout = new Timeout();
6904 this.restTimeout = new Timeout();
6905 this.handleCloseOptions = void 0;
6906 }
6907 static create() {
6908 return new _HoverInteraction();
6909 }
6910 dispose = () => {
6911 this.openChangeTimeout.clear();
6912 this.restTimeout.clear();
6913 };
6914 disposeEffect = () => {
6915 return this.dispose;
6916 };
6917 };
6918 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap();
6919 function clearSafePolygonPointerEventsMutation(instance) {
6920 if (!instance.performedPointerEventsMutation) {
6921 return;
6922 }
6923 const scopeElement = instance.pointerEventsScopeElement;
6924 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {
6925 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events");
6926 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events");
6927 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events");
6928 pointerEventsMutationOwnerByScopeElement.delete(scopeElement);
6929 }
6930 instance.performedPointerEventsMutation = false;
6931 instance.pointerEventsScopeElement = null;
6932 instance.pointerEventsReferenceElement = null;
6933 instance.pointerEventsFloatingElement = null;
6934 }
6935 function applySafePolygonPointerEventsMutation(instance, options) {
6936 const {
6937 scopeElement,
6938 referenceElement,
6939 floatingElement
6940 } = options;
6941 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);
6942 if (existingOwner && existingOwner !== instance) {
6943 clearSafePolygonPointerEventsMutation(existingOwner);
6944 }
6945 clearSafePolygonPointerEventsMutation(instance);
6946 instance.performedPointerEventsMutation = true;
6947 instance.pointerEventsScopeElement = scopeElement;
6948 instance.pointerEventsReferenceElement = referenceElement;
6949 instance.pointerEventsFloatingElement = floatingElement;
6950 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);
6951 scopeElement.style.pointerEvents = "none";
6952 referenceElement.style.pointerEvents = "auto";
6953 floatingElement.style.pointerEvents = "auto";
6954 }
6955 function useHoverInteractionSharedState(store) {
6956 const data = store.context.dataRef.current;
6957 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;
6958 if (!data.hoverInteractionState) {
6959 data.hoverInteractionState = instance;
6960 }
6961 useOnMount(data.hoverInteractionState.disposeEffect);
6962 return data.hoverInteractionState;
6963 }
6964
6965 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs
6966 function useHoverFloatingInteraction(context, parameters = {}) {
6967 const {
6968 enabled = true,
6969 closeDelay: closeDelayProp = 0,
6970 nodeId: nodeIdProp
6971 } = parameters;
6972 const store = "rootStore" in context ? context.rootStore : context;
6973 const open3 = store.useState("open");
6974 const floatingElement = store.useState("floatingElement");
6975 const domReferenceElement = store.useState("domReferenceElement");
6976 const {
6977 dataRef
6978 } = store.context;
6979 const tree = useFloatingTree();
6980 const parentId = useFloatingParentNodeId();
6981 const instance = useHoverInteractionSharedState(store);
6982 const childClosedTimeout = useTimeout();
6983 const isClickLikeOpenEvent2 = useStableCallback(() => {
6984 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
6985 });
6986 const isHoverOpen = useStableCallback(() => {
6987 return isHoverOpenEvent(dataRef.current.openEvent?.type);
6988 });
6989 const clearPointerEvents = useStableCallback(() => {
6990 clearSafePolygonPointerEventsMutation(instance);
6991 });
6992 useIsoLayoutEffect(() => {
6993 if (!open3) {
6994 instance.pointerType = void 0;
6995 instance.restTimeoutPending = false;
6996 instance.interactedInside = false;
6997 clearPointerEvents();
6998 }
6999 }, [open3, instance, clearPointerEvents]);
7000 React33.useEffect(() => {
7001 return clearPointerEvents;
7002 }, [clearPointerEvents]);
7003 useIsoLayoutEffect(() => {
7004 if (!enabled) {
7005 return void 0;
7006 }
7007 if (open3 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {
7008 const ref = domReferenceElement;
7009 const floatingEl = floatingElement;
7010 const doc = ownerDocument(floatingElement);
7011 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating;
7012 if (parentFloating) {
7013 parentFloating.style.pointerEvents = "";
7014 }
7015 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;
7016 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;
7017 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body;
7018 applySafePolygonPointerEventsMutation(instance, {
7019 scopeElement,
7020 referenceElement: ref,
7021 floatingElement: floatingEl
7022 });
7023 return () => {
7024 clearPointerEvents();
7025 };
7026 }
7027 return void 0;
7028 }, [enabled, open3, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);
7029 React33.useEffect(() => {
7030 if (!enabled) {
7031 return void 0;
7032 }
7033 function hasParentChildren() {
7034 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);
7035 }
7036 function closeWithDelay(event) {
7037 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType);
7038 const close = () => {
7039 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7040 tree?.events.emit("floating.closed", event);
7041 };
7042 if (closeDelay) {
7043 instance.openChangeTimeout.start(closeDelay, close);
7044 } else {
7045 instance.openChangeTimeout.clear();
7046 close();
7047 }
7048 }
7049 function handleInteractInside(event) {
7050 const target = getTarget(event);
7051 if (!isInteractiveElement(target)) {
7052 instance.interactedInside = false;
7053 return;
7054 }
7055 instance.interactedInside = target?.closest("[aria-haspopup]") != null;
7056 }
7057 function onFloatingMouseEnter() {
7058 instance.openChangeTimeout.clear();
7059 childClosedTimeout.clear();
7060 tree?.events.off("floating.closed", onNodeClosed);
7061 clearPointerEvents();
7062 }
7063 function onFloatingMouseLeave(event) {
7064 if (hasParentChildren() && tree) {
7065 tree.events.on("floating.closed", onNodeClosed);
7066 return;
7067 }
7068 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {
7069 return;
7070 }
7071 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;
7072 const relatedTarget = event.relatedTarget;
7073 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget));
7074 if (isMovingIntoDescendantFloating) {
7075 return;
7076 }
7077 if (instance.handler) {
7078 instance.handler(event);
7079 return;
7080 }
7081 clearPointerEvents();
7082 if (isHoverOpen() && !isClickLikeOpenEvent2()) {
7083 closeWithDelay(event);
7084 }
7085 }
7086 function onNodeClosed(event) {
7087 if (!tree || !parentId || hasParentChildren()) {
7088 return;
7089 }
7090 childClosedTimeout.start(0, () => {
7091 tree.events.off("floating.closed", onNodeClosed);
7092 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7093 tree.events.emit("floating.closed", event);
7094 });
7095 }
7096 const floating = floatingElement;
7097 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => {
7098 tree?.events.off("floating.closed", onNodeClosed);
7099 });
7100 }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);
7101 }
7102
7103 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs
7104 var React34 = __toESM(require_react(), 1);
7105 var ReactDOM5 = __toESM(require_react_dom(), 1);
7106 var EMPTY_REF = {
7107 current: null
7108 };
7109 function useHoverReferenceInteraction(context, props = {}) {
7110 const {
7111 enabled = true,
7112 delay = 0,
7113 handleClose = null,
7114 mouseOnly = false,
7115 restMs = 0,
7116 move = true,
7117 triggerElementRef = EMPTY_REF,
7118 externalTree,
7119 isActiveTrigger = true,
7120 getHandleCloseContext,
7121 isClosing,
7122 shouldOpen: shouldOpenProp,
7123 guardStaleOpen = false
7124 } = props;
7125 const store = "rootStore" in context ? context.rootStore : context;
7126 const {
7127 dataRef,
7128 events
7129 } = store.context;
7130 const tree = useFloatingTree(externalTree);
7131 const instance = useHoverInteractionSharedState(store);
7132 const isHoverCloseActiveRef = React34.useRef(false);
7133 const handleCloseRef = useValueAsRef(handleClose);
7134 const delayRef = useValueAsRef(delay);
7135 const restMsRef = useValueAsRef(restMs);
7136 const enabledRef = useValueAsRef(enabled);
7137 const shouldOpenRef = useValueAsRef(shouldOpenProp);
7138 const isClosingRef = useValueAsRef(isClosing);
7139 const isClickLikeOpenEvent2 = useStableCallback(() => {
7140 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside);
7141 });
7142 const checkShouldOpen = useStableCallback(() => {
7143 return shouldOpenRef.current?.() !== false;
7144 });
7145 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {
7146 const allTriggers = store.context.triggerElements;
7147 if (allTriggers.hasElement(currentTarget)) {
7148 return !currentDomReference || !contains(currentDomReference, currentTarget);
7149 }
7150 if (!isElement(target)) {
7151 return false;
7152 }
7153 const targetElement = target;
7154 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));
7155 });
7156 const cleanupMouseMoveHandler = useStableCallback(() => {
7157 if (!instance.handler) {
7158 return;
7159 }
7160 const doc = ownerDocument(store.select("domReferenceElement"));
7161 doc.removeEventListener("mousemove", instance.handler);
7162 instance.handler = void 0;
7163 });
7164 const clearPointerEvents = useStableCallback(() => {
7165 clearSafePolygonPointerEventsMutation(instance);
7166 });
7167 if (isActiveTrigger) {
7168 instance.handleCloseOptions = handleClose?.__options;
7169 }
7170 React34.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);
7171 React34.useEffect(() => {
7172 if (!enabled) {
7173 return void 0;
7174 }
7175 function onOpenChangeLocal(details) {
7176 if (!details.open) {
7177 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover;
7178 cleanupMouseMoveHandler();
7179 instance.openChangeTimeout.clear();
7180 instance.restTimeout.clear();
7181 instance.blockMouseMove = true;
7182 instance.restTimeoutPending = false;
7183 } else {
7184 isHoverCloseActiveRef.current = false;
7185 }
7186 }
7187 events.on("openchange", onOpenChangeLocal);
7188 return () => {
7189 events.off("openchange", onOpenChangeLocal);
7190 };
7191 }, [enabled, events, instance, cleanupMouseMoveHandler]);
7192 React34.useEffect(() => {
7193 if (!enabled) {
7194 return void 0;
7195 }
7196 function closeWithDelay(event, runElseBranch = true) {
7197 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType);
7198 if (closeDelay) {
7199 instance.openChangeTimeout.start(closeDelay, () => {
7200 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7201 tree?.events.emit("floating.closed", event);
7202 });
7203 } else if (runElseBranch) {
7204 instance.openChangeTimeout.clear();
7205 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
7206 tree?.events.emit("floating.closed", event);
7207 }
7208 }
7209 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null);
7210 if (!isElement(trigger)) {
7211 return void 0;
7212 }
7213 function onMouseEnter(event) {
7214 instance.openChangeTimeout.clear();
7215 instance.blockMouseMove = false;
7216 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
7217 return;
7218 }
7219 const restMsValue = getRestMs(restMsRef.current);
7220 const openDelay = getDelay(delayRef.current, "open", instance.pointerType);
7221 const eventTarget = getTarget(event);
7222 const currentTarget = event.currentTarget ?? null;
7223 const currentDomReference = store.select("domReferenceElement");
7224 let triggerNode = currentTarget;
7225 if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) {
7226 for (const triggerElement of store.context.triggerElements.elements()) {
7227 if (contains(triggerElement, eventTarget)) {
7228 triggerNode = triggerElement;
7229 break;
7230 }
7231 }
7232 }
7233 if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {
7234 triggerNode = currentDomReference;
7235 }
7236 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);
7237 const isOpen = store.select("open");
7238 const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending";
7239 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;
7240 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;
7241 const isRestOnlyDelay = restMsValue > 0 && !openDelay;
7242 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;
7243 const shouldOpen = !isOpen || isOverInactive;
7244 if (shouldOpenImmediately) {
7245 if (checkShouldOpen()) {
7246 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7247 }
7248 return;
7249 }
7250 if (isRestOnlyDelay) {
7251 return;
7252 }
7253 if (openDelay) {
7254 instance.openChangeTimeout.start(openDelay, () => {
7255 if (shouldOpen && checkShouldOpen()) {
7256 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7257 }
7258 });
7259 } else if (shouldOpen) {
7260 if (checkShouldOpen()) {
7261 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode));
7262 }
7263 }
7264 }
7265 function onMouseLeave(event) {
7266 if (isClickLikeOpenEvent2()) {
7267 clearPointerEvents();
7268 return;
7269 }
7270 cleanupMouseMoveHandler();
7271 const domReferenceElement = store.select("domReferenceElement");
7272 const doc = ownerDocument(domReferenceElement);
7273 instance.restTimeout.clear();
7274 instance.restTimeoutPending = false;
7275 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();
7276 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {
7277 return;
7278 }
7279 if (handleCloseRef.current && handleCloseContextBase) {
7280 if (!store.select("open")) {
7281 instance.openChangeTimeout.clear();
7282 }
7283 const currentTrigger = triggerElementRef.current;
7284 instance.handler = handleCloseRef.current({
7285 ...handleCloseContextBase,
7286 tree,
7287 x: event.clientX,
7288 y: event.clientY,
7289 onClose() {
7290 clearPointerEvents();
7291 cleanupMouseMoveHandler();
7292 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) {
7293 closeWithDelay(event, true);
7294 }
7295 }
7296 });
7297 doc.addEventListener("mousemove", instance.handler);
7298 instance.handler(event);
7299 return;
7300 }
7301 const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true;
7302 if (shouldClose) {
7303 closeWithDelay(event);
7304 }
7305 }
7306 function onMouseOut(event) {
7307 if (contains(trigger, event.relatedTarget)) {
7308 return;
7309 }
7310 instance.openChangeTimeout.clear();
7311 instance.restTimeout.clear();
7312 instance.restTimeoutPending = false;
7313 }
7314 const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0;
7315 if (move) {
7316 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, {
7317 once: true
7318 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
7319 }
7320 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard);
7321 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]);
7322 return React34.useMemo(() => {
7323 if (!enabled) {
7324 return void 0;
7325 }
7326 function setPointerRef(event) {
7327 instance.pointerType = event.pointerType;
7328 }
7329 return {
7330 onPointerDown: setPointerRef,
7331 onPointerEnter: setPointerRef,
7332 onMouseMove(event) {
7333 const {
7334 nativeEvent
7335 } = event;
7336 const trigger = event.currentTarget;
7337 const currentDomReference = store.select("domReferenceElement");
7338 const currentOpen = store.select("open");
7339 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);
7340 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {
7341 return;
7342 }
7343 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {
7344 const floatingElement = store.select("floatingElement");
7345 if (floatingElement) {
7346 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;
7347 applySafePolygonPointerEventsMutation(instance, {
7348 scopeElement,
7349 referenceElement: trigger,
7350 floatingElement
7351 });
7352 }
7353 }
7354 const restMsValue = getRestMs(restMsRef.current);
7355 if (currentOpen && !isOverInactive || restMsValue === 0) {
7356 return;
7357 }
7358 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {
7359 return;
7360 }
7361 instance.restTimeout.clear();
7362 function handleMouseMove() {
7363 instance.restTimeoutPending = false;
7364 if (isClickLikeOpenEvent2()) {
7365 return;
7366 }
7367 const latestOpen = store.select("open");
7368 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {
7369 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger));
7370 }
7371 }
7372 if (instance.pointerType === "touch") {
7373 ReactDOM5.flushSync(() => {
7374 handleMouseMove();
7375 });
7376 } else if (isOverInactive && currentOpen) {
7377 handleMouseMove();
7378 } else {
7379 instance.restTimeoutPending = true;
7380 instance.restTimeout.start(restMsValue, handleMouseMove);
7381 }
7382 }
7383 };
7384 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]);
7385 }
7386
7387 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs
7388 var CURSOR_SPEED_THRESHOLD = 0.1;
7389 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;
7390 var POLYGON_BUFFER = 0.5;
7391 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {
7392 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;
7393 }
7394 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {
7395 let isInsideValue = false;
7396 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {
7397 isInsideValue = !isInsideValue;
7398 }
7399 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {
7400 isInsideValue = !isInsideValue;
7401 }
7402 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {
7403 isInsideValue = !isInsideValue;
7404 }
7405 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {
7406 isInsideValue = !isInsideValue;
7407 }
7408 return isInsideValue;
7409 }
7410 function isInsideRect(pointX, pointY, rect) {
7411 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;
7412 }
7413 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {
7414 const minX = Math.min(x1, x2);
7415 const maxX = Math.max(x1, x2);
7416 const minY = Math.min(y1, y2);
7417 const maxY = Math.max(y1, y2);
7418 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
7419 }
7420 function safePolygon(options = {}) {
7421 const {
7422 blockPointerEvents = false
7423 } = options;
7424 const timeout = new Timeout();
7425 const fn = ({
7426 x: x2,
7427 y: y2,
7428 placement,
7429 elements,
7430 onClose,
7431 nodeId,
7432 tree
7433 }) => {
7434 const side = placement?.split("-")[0];
7435 let hasLanded = false;
7436 let lastX = null;
7437 let lastY = null;
7438 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
7439 function isCursorMovingSlowly(nextX, nextY) {
7440 const currentTime = performance.now();
7441 const elapsedTime = currentTime - lastCursorTime;
7442 if (lastX === null || lastY === null || elapsedTime === 0) {
7443 lastX = nextX;
7444 lastY = nextY;
7445 lastCursorTime = currentTime;
7446 return false;
7447 }
7448 const deltaX = nextX - lastX;
7449 const deltaY = nextY - lastY;
7450 const distanceSquared = deltaX * deltaX + deltaY * deltaY;
7451 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;
7452 lastX = nextX;
7453 lastY = nextY;
7454 lastCursorTime = currentTime;
7455 return distanceSquared < thresholdSquared;
7456 }
7457 function close() {
7458 timeout.clear();
7459 onClose();
7460 }
7461 return function onMouseMove(event) {
7462 timeout.clear();
7463 const domReference = elements.domReference;
7464 const floating = elements.floating;
7465 if (!domReference || !floating || side == null || x2 == null || y2 == null) {
7466 return void 0;
7467 }
7468 const {
7469 clientX,
7470 clientY
7471 } = event;
7472 const target = getTarget(event);
7473 const isLeave = event.type === "mouseleave";
7474 const isOverFloatingEl = contains(floating, target);
7475 const isOverReferenceEl = contains(domReference, target);
7476 if (isOverFloatingEl) {
7477 hasLanded = true;
7478 if (!isLeave) {
7479 return void 0;
7480 }
7481 }
7482 if (isOverReferenceEl) {
7483 hasLanded = false;
7484 if (!isLeave) {
7485 hasLanded = true;
7486 return void 0;
7487 }
7488 }
7489 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {
7490 return void 0;
7491 }
7492 function hasOpenChildNode() {
7493 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);
7494 }
7495 function closeIfNoOpenChild() {
7496 if (!hasOpenChildNode()) {
7497 close();
7498 }
7499 }
7500 if (hasOpenChildNode()) {
7501 return void 0;
7502 }
7503 const refRect = domReference.getBoundingClientRect();
7504 const rect = floating.getBoundingClientRect();
7505 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2;
7506 const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2;
7507 const isFloatingWider = rect.width > refRect.width;
7508 const isFloatingTaller = rect.height > refRect.height;
7509 const left = (isFloatingWider ? refRect : rect).left;
7510 const right = (isFloatingWider ? refRect : rect).right;
7511 const top = (isFloatingTaller ? refRect : rect).top;
7512 const bottom = (isFloatingTaller ? refRect : rect).bottom;
7513 if (side === "top" && y2 >= refRect.bottom - 1 || side === "bottom" && y2 <= refRect.top + 1 || side === "left" && x2 >= refRect.right - 1 || side === "right" && x2 <= refRect.left + 1) {
7514 closeIfNoOpenChild();
7515 return void 0;
7516 }
7517 let isInsideTroughRect = false;
7518 switch (side) {
7519 case "top":
7520 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);
7521 break;
7522 case "bottom":
7523 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);
7524 break;
7525 case "left":
7526 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);
7527 break;
7528 case "right":
7529 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);
7530 break;
7531 default:
7532 }
7533 if (isInsideTroughRect) {
7534 return void 0;
7535 }
7536 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {
7537 closeIfNoOpenChild();
7538 return void 0;
7539 }
7540 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {
7541 closeIfNoOpenChild();
7542 return void 0;
7543 }
7544 let isInsidePolygon = false;
7545 switch (side) {
7546 case "top": {
7547 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7548 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7549 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7550 const cursorPointY = y2 + POLYGON_BUFFER + 1;
7551 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;
7552 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;
7553 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
7554 break;
7555 }
7556 case "bottom": {
7557 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7558 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7559 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset;
7560 const cursorPointY = y2 - POLYGON_BUFFER;
7561 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;
7562 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;
7563 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);
7564 break;
7565 }
7566 case "left": {
7567 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7568 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7569 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7570 const cursorPointX = x2 + POLYGON_BUFFER + 1;
7571 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;
7572 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;
7573 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);
7574 break;
7575 }
7576 case "right": {
7577 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;
7578 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7579 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset;
7580 const cursorPointX = x2 - POLYGON_BUFFER;
7581 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;
7582 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;
7583 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);
7584 break;
7585 }
7586 default:
7587 }
7588 if (!isInsidePolygon) {
7589 closeIfNoOpenChild();
7590 } else if (!hasLanded) {
7591 timeout.start(40, closeIfNoOpenChild);
7592 }
7593 return void 0;
7594 };
7595 };
7596 fn.__options = {
7597 ...options,
7598 blockPointerEvents
7599 };
7600 return fn;
7601 }
7602
7603 // node_modules/@base-ui/react/utils/NullStore.mjs
7604 var NullStore = class extends ReactStore {
7605 // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding
7606 // `setState` alone would neutralize them today. They are overridden explicitly so the store stays
7607 // inert even if a future base-class change stops routing a mutator through `setState`.
7608 setState(_newState) {
7609 }
7610 update(_changes) {
7611 }
7612 set(_key, _value) {
7613 }
7614 notifyAll() {
7615 }
7616 };
7617
7618 // node_modules/@base-ui/utils/inertValue.mjs
7619 function inertValue(value) {
7620 if (isReactVersionAtLeast(19)) {
7621 return value;
7622 }
7623 return value ? "true" : void 0;
7624 }
7625
7626 // node_modules/@base-ui/react/internals/useValueChanged.mjs
7627 var React35 = __toESM(require_react(), 1);
7628 function useValueChanged(value, onChange) {
7629 const valueRef = React35.useRef(value);
7630 const onChangeCallback = useStableCallback(onChange);
7631 useIsoLayoutEffect(() => {
7632 if (valueRef.current !== value) {
7633 onChangeCallback(valueRef.current);
7634 }
7635 valueRef.current = value;
7636 }, [value, onChangeCallback]);
7637 }
7638
7639 // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
7640 var React36 = __toESM(require_react(), 1);
7641
7642 // node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs
7643 var valid = "data-valid";
7644 var invalid = "data-invalid";
7645
7646 // node_modules/@base-ui/react/internals/field-constants/constants.mjs
7647 var DEFAULT_VALIDITY_STATE = {
7648 badInput: false,
7649 customError: false,
7650 patternMismatch: false,
7651 rangeOverflow: false,
7652 rangeUnderflow: false,
7653 stepMismatch: false,
7654 tooLong: false,
7655 tooShort: false,
7656 typeMismatch: false,
7657 valid: null,
7658 valueMissing: false
7659 };
7660 var DEFAULT_FIELD_STATE_ATTRIBUTES = {
7661 valid: null,
7662 touched: false,
7663 dirty: false,
7664 filled: false,
7665 focused: false
7666 };
7667 var DEFAULT_FIELD_ROOT_STATE = {
7668 disabled: false,
7669 ...DEFAULT_FIELD_STATE_ATTRIBUTES
7670 };
7671 var fieldValidityMapping = {
7672 valid(value) {
7673 if (value === null) {
7674 return null;
7675 }
7676 if (value) {
7677 return {
7678 [valid]: ""
7679 };
7680 }
7681 return {
7682 [invalid]: ""
7683 };
7684 }
7685 };
7686
7687 // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs
7688 var DEFAULT_FIELD_ROOT_CONTEXT = {
7689 invalid: void 0,
7690 name: void 0,
7691 validityData: {
7692 state: DEFAULT_VALIDITY_STATE,
7693 errors: [],
7694 error: "",
7695 value: "",
7696 initialValue: null
7697 },
7698 setValidityData: NOOP,
7699 disabled: void 0,
7700 setTouched: NOOP,
7701 setDirty: NOOP,
7702 setFilled: NOOP,
7703 setFocused: NOOP,
7704 validationMode: "onSubmit",
7705 shouldValidateOnChange: () => false,
7706 state: DEFAULT_FIELD_ROOT_STATE,
7707 registerFieldControl: NOOP,
7708 validation: {
7709 getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,
7710 inputRef: {
7711 current: null
7712 },
7713 registeredInputs: /* @__PURE__ */ new Map(),
7714 registerInput: NOOP,
7715 getInputControl: () => null,
7716 commit: async () => {
7717 },
7718 change: NOOP
7719 }
7720 };
7721 var FieldRootContext = /* @__PURE__ */ React36.createContext(DEFAULT_FIELD_ROOT_CONTEXT);
7722 if (true) FieldRootContext.displayName = "FieldRootContext";
7723 function useFieldRootContext(optional = true) {
7724 const context = React36.useContext(FieldRootContext);
7725 if (context.setValidityData === NOOP && !optional) {
7726 throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28));
7727 }
7728 return context;
7729 }
7730
7731 // node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs
7732 function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {
7733 const {
7734 registerFieldControl
7735 } = useFieldRootContext();
7736 const sourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol());
7737 useIsoLayoutEffect(() => {
7738 const source = sourceRef.current;
7739 if (!enabled) {
7740 registerFieldControl(source, void 0);
7741 return;
7742 }
7743 const registration = {
7744 controlRef,
7745 getValue: getFormValueOverride,
7746 id,
7747 name,
7748 value
7749 };
7750 registerFieldControl(source, registration);
7751 }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]);
7752 useIsoLayoutEffect(() => {
7753 const source = sourceRef.current;
7754 return () => {
7755 registerFieldControl(source, void 0);
7756 };
7757 }, [registerFieldControl, sourceRef]);
7758 }
7759
7760 // node_modules/@base-ui/react/internals/form-context/FormContext.mjs
7761 var React37 = __toESM(require_react(), 1);
7762 var FormContext = /* @__PURE__ */ React37.createContext({
7763 elementRef: {
7764 current: null
7765 },
7766 formRef: {
7767 current: {
7768 fields: /* @__PURE__ */ new Map()
7769 }
7770 },
7771 errors: {},
7772 clearErrors: NOOP,
7773 validationMode: "onSubmit",
7774 submitCountRef: {
7775 current: 0
7776 }
7777 });
7778 if (true) FormContext.displayName = "FormContext";
7779 function useFormContext() {
7780 return React37.useContext(FormContext);
7781 }
7782
7783 // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
7784 var React39 = __toESM(require_react(), 1);
7785
7786 // node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs
7787 var React38 = __toESM(require_react(), 1);
7788 var LabelableContext = /* @__PURE__ */ React38.createContext({
7789 controlId: void 0,
7790 registerControlId: NOOP,
7791 resetControlId: NOOP,
7792 labelId: void 0,
7793 setLabelId: NOOP,
7794 messageIds: [],
7795 setMessageIds: NOOP,
7796 getDescriptionProps: (externalProps) => externalProps
7797 });
7798 if (true) LabelableContext.displayName = "LabelableContext";
7799 function useLabelableContext() {
7800 return React38.useContext(LabelableContext);
7801 }
7802
7803 // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs
7804 function useLabelableId(params = {}) {
7805 const {
7806 id,
7807 enabled = true
7808 } = params;
7809 const {
7810 controlId,
7811 registerControlId,
7812 resetControlId
7813 } = useLabelableContext();
7814 const defaultId = useBaseUiId();
7815 const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol());
7816 const hasRegisteredRef = React39.useRef(false);
7817 const hadExplicitIdRef = React39.useRef(false);
7818 const unregisterControlId = useStableCallback(() => {
7819 if (!hasRegisteredRef.current || registerControlId === NOOP) {
7820 return;
7821 }
7822 hasRegisteredRef.current = false;
7823 registerControlId(controlSourceRef.current, void 0);
7824 });
7825 useIsoLayoutEffect(() => {
7826 if (!enabled || registerControlId === NOOP) {
7827 unregisterControlId();
7828 return void 0;
7829 }
7830 let nextId;
7831 if (id !== void 0) {
7832 hadExplicitIdRef.current = true;
7833 nextId = id;
7834 } else if (hadExplicitIdRef.current) {
7835 nextId = defaultId;
7836 } else {
7837 resetControlId();
7838 return void 0;
7839 }
7840 if (nextId === void 0) {
7841 unregisterControlId();
7842 return void 0;
7843 }
7844 hasRegisteredRef.current = true;
7845 registerControlId(controlSourceRef.current, nextId);
7846 return void 0;
7847 }, [id, enabled, registerControlId, resetControlId, defaultId, controlSourceRef, unregisterControlId]);
7848 useIsoLayoutEffect(() => {
7849 return unregisterControlId;
7850 }, [unregisterControlId]);
7851 return (enabled ? controlId : void 0) ?? id ?? defaultId;
7852 }
7853
7854 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs
7855 var React40 = __toESM(require_react(), 1);
7856 var DirectionContext = /* @__PURE__ */ React40.createContext(void 0);
7857 if (true) DirectionContext.displayName = "DirectionContext";
7858 function useDirection() {
7859 const context = React40.useContext(DirectionContext);
7860 return context?.direction ?? "ltr";
7861 }
7862
7863 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
7864 var React41 = __toESM(require_react(), 1);
7865
7866 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs
7867 var baseArrow = (options) => ({
7868 name: "arrow",
7869 options,
7870 async fn(state) {
7871 const {
7872 x: x2,
7873 y: y2,
7874 placement,
7875 rects,
7876 platform: platform3,
7877 elements,
7878 middlewareData
7879 } = state;
7880 const {
7881 element,
7882 padding = 0,
7883 offsetParent = "real"
7884 } = evaluate(options, state) || {};
7885 if (element == null) {
7886 return {};
7887 }
7888 const paddingObject = getPaddingObject(padding);
7889 const coords = {
7890 x: x2,
7891 y: y2
7892 };
7893 const axis = getAlignmentAxis(placement);
7894 const length = getAxisLength(axis);
7895 const arrowDimensions = await platform3.getDimensions(element);
7896 const isYAxis = axis === "y";
7897 const minProp = isYAxis ? "top" : "left";
7898 const maxProp = isYAxis ? "bottom" : "right";
7899 const clientProp = isYAxis ? "clientHeight" : "clientWidth";
7900 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
7901 const startDiff = coords[axis] - rects.reference[axis];
7902 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating;
7903 let clientSize = elements.floating[clientProp] || rects.floating[length];
7904 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) {
7905 clientSize = elements.floating[clientProp] || rects.floating[length];
7906 }
7907 const centerToReference = endDiff / 2 - startDiff / 2;
7908 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
7909 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);
7910 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);
7911 const min3 = minPadding;
7912 const max3 = clientSize - arrowDimensions[length] - maxPadding;
7913 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
7914 const offset4 = clamp(min3, center, max3);
7915 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min3 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
7916 const alignmentOffset = shouldAddOffset ? center < min3 ? center - min3 : center - max3 : 0;
7917 return {
7918 [axis]: coords[axis] + alignmentOffset,
7919 data: {
7920 [axis]: offset4,
7921 centerOffset: center - offset4 - alignmentOffset,
7922 ...shouldAddOffset && {
7923 alignmentOffset
7924 }
7925 },
7926 reset: shouldAddOffset
7927 };
7928 }
7929 });
7930 var arrow4 = (options, deps) => {
7931 const {
7932 name,
7933 fn
7934 } = baseArrow(options);
7935 return {
7936 name,
7937 fn,
7938 options: [options, deps]
7939 };
7940 };
7941
7942 // node_modules/@base-ui/react/utils/hideMiddleware.mjs
7943 var hide4 = {
7944 name: "hide",
7945 async fn(state) {
7946 const {
7947 width,
7948 height,
7949 x: x2,
7950 y: y2
7951 } = state.rects.reference;
7952 const anchorHidden2 = width === 0 && height === 0 && x2 === 0 && y2 === 0;
7953 const overflow = await state.platform.detectOverflow(state, {
7954 elementContext: "reference"
7955 });
7956 const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;
7957 return {
7958 data: {
7959 referenceHidden: referenceHidden || anchorHidden2
7960 }
7961 };
7962 }
7963 };
7964
7965 // node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs
7966 var DEFAULT_SIDES = {
7967 sideX: "left",
7968 sideY: "top"
7969 };
7970
7971 // node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs
7972 var availableWidth = "--available-width";
7973 var availableHeight = "--available-height";
7974 var anchorWidth = "--anchor-width";
7975 var anchorHeight = "--anchor-height";
7976 var transformOrigin = "--transform-origin";
7977 var positionerWidth = "--positioner-width";
7978 var positionerHeight = "--positioner-height";
7979
7980 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs
7981 var AVAILABLE_WIDTH_VAR = availableWidth;
7982 var AVAILABLE_HEIGHT_VAR = availableHeight;
7983 function getLogicalSide(sideParam, renderedSide, isRtl) {
7984 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end";
7985 const logicalRight = isRtl ? "inline-start" : "inline-end";
7986 const logicalLeft = isRtl ? "inline-end" : "inline-start";
7987 return {
7988 top: "top",
7989 right: isLogicalSideParam ? logicalRight : "right",
7990 bottom: "bottom",
7991 left: isLogicalSideParam ? logicalLeft : "left"
7992 }[renderedSide];
7993 }
7994 function getOffsetData(state, sideParam, isRtl) {
7995 const {
7996 rects,
7997 placement
7998 } = state;
7999 const data = {
8000 side: getLogicalSide(sideParam, getSide(placement), isRtl),
8001 align: getAlignment(placement) || "center",
8002 anchor: {
8003 width: rects.reference.width,
8004 height: rects.reference.height
8005 },
8006 positioner: {
8007 width: rects.floating.width,
8008 height: rects.floating.height
8009 }
8010 };
8011 return data;
8012 }
8013 function useAnchorPositioning(params) {
8014 return useAnchorPositioningWithHook(params, useBaseUIFloating);
8015 }
8016 function useAnchorPositioningWithHook(params, useFloatingHook) {
8017 const {
8018 // Public parameters
8019 anchor,
8020 positionMethod = "absolute",
8021 side: sideParam = "bottom",
8022 sideOffset = 0,
8023 align = "center",
8024 alignOffset = 0,
8025 collisionBoundary,
8026 collisionPadding: collisionPaddingParam = 5,
8027 sticky = false,
8028 arrowPadding = 5,
8029 disableAnchorTracking = false,
8030 inline: inlineMiddleware,
8031 // Private parameters
8032 keepMounted = false,
8033 floatingRootContext,
8034 mounted,
8035 collisionAvoidance,
8036 shift: shift4,
8037 nodeId,
8038 adaptiveOrigin: adaptiveOrigin2,
8039 lazyFlip = false,
8040 externalTree
8041 } = params;
8042 const [mountSide, setMountSide] = React41.useState(null);
8043 if (!mounted && mountSide !== null) {
8044 setMountSide(null);
8045 }
8046 const collisionAvoidanceSide = collisionAvoidance.side || "flip";
8047 const collisionAvoidanceAlign = collisionAvoidance.align || "flip";
8048 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end";
8049 const shiftCrossAxis = shift4?.crossAxis ?? false;
8050 const shiftRootBoundary = shift4?.rootBoundary;
8051 const anchorFn = typeof anchor === "function" ? anchor : void 0;
8052 const anchorFnCallback = useStableCallback(anchorFn);
8053 const anchorDep = anchorFn ? anchorFnCallback : anchor;
8054 const anchorValueRef = useValueAsRef(anchor);
8055 const mountedRef = useValueAsRef(mounted);
8056 const direction = useDirection();
8057 const isRtl = direction === "rtl";
8058 const side = mountSide || {
8059 top: "top",
8060 right: "right",
8061 bottom: "bottom",
8062 left: "left",
8063 "inline-end": isRtl ? "left" : "right",
8064 "inline-start": isRtl ? "right" : "left"
8065 }[sideParam];
8066 const placement = align === "center" ? side : `${side}-${align}`;
8067 let collisionPadding = collisionPaddingParam;
8068 if (typeof collisionPadding === "number") {
8069 collisionPadding = {
8070 top: collisionPadding,
8071 right: collisionPadding,
8072 bottom: collisionPadding,
8073 left: collisionPadding
8074 };
8075 } else if (collisionPadding) {
8076 collisionPadding = {
8077 top: collisionPadding.top || 0,
8078 right: collisionPadding.right || 0,
8079 bottom: collisionPadding.bottom || 0,
8080 left: collisionPadding.left || 0
8081 };
8082 }
8083 const bias = 1;
8084 const biasTop = sideParam === "bottom" ? bias : 0;
8085 const biasBottom = sideParam === "top" ? bias : 0;
8086 const biasLeft = sideParam === "right" ? bias : 0;
8087 const biasRight = sideParam === "left" ? bias : 0;
8088 const commonCollisionProps = {
8089 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary,
8090 padding: collisionPadding
8091 };
8092 const arrowRef = React41.useRef(null);
8093 const sideOffsetRef = useValueAsRef(sideOffset);
8094 const alignOffsetRef = useValueAsRef(alignOffset);
8095 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0;
8096 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0;
8097 const middleware = [];
8098 if (inlineMiddleware) {
8099 middleware.push(inlineMiddleware);
8100 }
8101 middleware.push(offset3((state) => {
8102 const data = getOffsetData(state, sideParam, isRtl);
8103 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current;
8104 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current;
8105 return {
8106 mainAxis: sideAxis,
8107 crossAxis: alignAxis,
8108 alignmentAxis: alignAxis
8109 };
8110 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));
8111 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift";
8112 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift");
8113 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({
8114 ...commonCollisionProps,
8115 // Ensure the popup flips if it's been limited by its --available-height and it resizes.
8116 // Since the size() padding is smaller than the flip() padding, flip() will take precedence.
8117 padding: {
8118 top: collisionPadding.top + bias + biasTop,
8119 right: collisionPadding.right + bias + biasRight,
8120 bottom: collisionPadding.bottom + bias + biasBottom,
8121 left: collisionPadding.left + bias + biasLeft
8122 },
8123 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip",
8124 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false,
8125 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide
8126 });
8127 const shiftMiddleware = shiftDisabled ? null : shift3({
8128 ...commonCollisionProps,
8129 // Use the Layout Viewport to avoid shifting around when pinch-zooming.
8130 rootBoundary: shiftRootBoundary,
8131 mainAxis: collisionAvoidanceAlign !== "none",
8132 crossAxis: crossAxisShiftEnabled,
8133 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => {
8134 if (!arrowRef.current) {
8135 return {};
8136 }
8137 const {
8138 width,
8139 height
8140 } = arrowRef.current.getBoundingClientRect();
8141 const sideAxis = getSideAxis(getSide(limitData.placement));
8142 const arrowSize = sideAxis === "y" ? width : height;
8143 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;
8144 return {
8145 offset: arrowSize / 2 + offsetAmount / 2
8146 };
8147 })
8148 }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);
8149 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") {
8150 middleware.push(shiftMiddleware, flipMiddleware);
8151 } else {
8152 middleware.push(flipMiddleware, shiftMiddleware);
8153 }
8154 middleware.push(size3({
8155 ...commonCollisionProps,
8156 apply({
8157 elements: {
8158 floating
8159 },
8160 availableWidth: availableWidth2,
8161 availableHeight: availableHeight2,
8162 rects
8163 }) {
8164 if (!mountedRef.current) {
8165 return;
8166 }
8167 const floatingStyle = floating.style;
8168 floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth2}px`);
8169 floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight2}px`);
8170 const dpr = getWindow(floating).devicePixelRatio || 1;
8171 const {
8172 x: x3,
8173 y: y3,
8174 width,
8175 height
8176 } = rects.reference;
8177 const anchorWidth2 = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr;
8178 const anchorHeight2 = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr;
8179 floatingStyle.setProperty(anchorWidth, `${anchorWidth2}px`);
8180 floatingStyle.setProperty(anchorHeight, `${anchorHeight2}px`);
8181 }
8182 }), arrow4((state) => ({
8183 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,
8184 // we'll create a fake element.
8185 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"),
8186 // No padding for the fake arrow: it would displace aligned popups on narrow anchors.
8187 padding: arrowRef.current ? arrowPadding : 0,
8188 offsetParent: "floating"
8189 }), [arrowPadding]), {
8190 name: "transformOrigin",
8191 fn(state) {
8192 const {
8193 elements: {
8194 floating
8195 },
8196 middlewareData: middlewareData2,
8197 placement: renderedPlacement2,
8198 platform: platform3,
8199 rects,
8200 y: y3
8201 } = state;
8202 const renderedSide2 = getSide(renderedPlacement2);
8203 const renderedAlign2 = getAlignment(renderedPlacement2);
8204 const isVertical = getSideAxis(renderedSide2) === "y";
8205 const arrowEl = arrowRef.current;
8206 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;
8207 let crossOrigin;
8208 if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) {
8209 crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%";
8210 } else {
8211 const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0;
8212 const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0;
8213 crossOrigin = `${arrowOffset + arrowSize / 2}px`;
8214 }
8215 let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`;
8216 if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) {
8217 sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y3}px`;
8218 }
8219 floating.style.setProperty(transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`);
8220 return {};
8221 }
8222 }, hide4, adaptiveOrigin2);
8223 useIsoLayoutEffect(() => {
8224 if (!mounted && floatingRootContext) {
8225 floatingRootContext.update({
8226 referenceElement: null,
8227 floatingElement: null,
8228 domReferenceElement: null,
8229 positionReference: null
8230 });
8231 }
8232 }, [mounted, floatingRootContext]);
8233 const autoUpdateOptions = React41.useMemo(() => ({
8234 ancestorScroll: !disableAnchorTracking,
8235 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined",
8236 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined"
8237 }), [disableAnchorTracking]);
8238 const {
8239 refs,
8240 elements,
8241 x: x2,
8242 y: y2,
8243 middlewareData,
8244 update: update2,
8245 placement: renderedPlacement,
8246 context,
8247 isPositioned,
8248 floatingStyles: originalFloatingStyles
8249 } = useFloatingHook({
8250 rootContext: floatingRootContext,
8251 open: keepMounted ? mounted : void 0,
8252 placement,
8253 middleware,
8254 strategy: positionMethod,
8255 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions),
8256 nodeId,
8257 externalTree
8258 });
8259 const {
8260 sideX,
8261 sideY
8262 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;
8263 const resolvedPosition = isPositioned ? positionMethod : "fixed";
8264 const floatingStyles = React41.useMemo(() => {
8265 let base;
8266 if (!isPositioned) {
8267 base = {
8268 position: resolvedPosition,
8269 top: 0,
8270 left: 0
8271 };
8272 } else if (adaptiveOrigin2) {
8273 base = {
8274 position: resolvedPosition,
8275 [sideX]: x2,
8276 [sideY]: y2
8277 };
8278 } else {
8279 base = {
8280 ...originalFloatingStyles,
8281 position: resolvedPosition
8282 };
8283 }
8284 base[AVAILABLE_WIDTH_VAR] = "100vw";
8285 base[AVAILABLE_HEIGHT_VAR] = "100vh";
8286 if (!isPositioned) {
8287 base.opacity = 0;
8288 }
8289 return base;
8290 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]);
8291 const registeredPositionReferenceRef = React41.useRef(null);
8292 useIsoLayoutEffect(() => {
8293 if (!mounted) {
8294 return;
8295 }
8296 const anchorValue = anchorValueRef.current;
8297 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue;
8298 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;
8299 const finalAnchor = unwrappedElement || null;
8300 if (finalAnchor !== registeredPositionReferenceRef.current) {
8301 refs.setPositionReference(finalAnchor);
8302 registeredPositionReferenceRef.current = finalAnchor;
8303 }
8304 }, [mounted, refs, anchorDep, anchorValueRef]);
8305 React41.useEffect(() => {
8306 if (!mounted) {
8307 return;
8308 }
8309 const anchorValue = anchorValueRef.current;
8310 if (typeof anchorValue === "function") {
8311 return;
8312 }
8313 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {
8314 refs.setPositionReference(anchorValue.current);
8315 registeredPositionReferenceRef.current = anchorValue.current;
8316 }
8317 }, [mounted, refs, anchorDep, anchorValueRef]);
8318 React41.useEffect(() => {
8319 if (keepMounted && mounted && elements.reference && elements.floating) {
8320 return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions);
8321 }
8322 return void 0;
8323 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]);
8324 const renderedSide = getSide(renderedPlacement);
8325 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);
8326 const renderedAlign = getAlignment(renderedPlacement) || "center";
8327 const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden);
8328 useIsoLayoutEffect(() => {
8329 if (lazyFlip && mounted && isPositioned && renderedSide !== side) {
8330 setMountSide(renderedSide);
8331 }
8332 }, [lazyFlip, mounted, isPositioned, renderedSide, side]);
8333 const arrowStyles = React41.useMemo(() => ({
8334 position: "absolute",
8335 top: middlewareData.arrow?.y,
8336 left: middlewareData.arrow?.x
8337 }), [middlewareData.arrow]);
8338 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;
8339 return React41.useMemo(() => ({
8340 positionerStyles: floatingStyles,
8341 arrowStyles,
8342 arrowRef,
8343 arrowUncentered,
8344 side: logicalRenderedSide,
8345 align: renderedAlign,
8346 physicalSide: renderedSide,
8347 anchorHidden: anchorHidden2,
8348 refs,
8349 context,
8350 isPositioned,
8351 update: update2
8352 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]);
8353 }
8354 function isRef(param) {
8355 return param != null && "current" in param;
8356 }
8357
8358 // node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs
8359 function getDisabledMountTransitionStyles(transitionStatus) {
8360 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;
8361 }
8362
8363 // node_modules/@base-ui/react/utils/usePositioner.mjs
8364 function usePositioner(componentProps, state, {
8365 styles,
8366 transitionStatus,
8367 props,
8368 refs,
8369 hidden,
8370 inert = false
8371 }) {
8372 const style = {
8373 ...styles
8374 };
8375 if (inert) {
8376 style.pointerEvents = "none";
8377 }
8378 return useRenderElement("div", componentProps, {
8379 state,
8380 ref: refs,
8381 props: [{
8382 role: "presentation",
8383 hidden,
8384 style
8385 }, getDisabledMountTransitionStyles(transitionStatus), props],
8386 stateAttributesMapping: popupStateMapping
8387 });
8388 }
8389
8390 // node_modules/@base-ui/react/button/Button.mjs
8391 var React42 = __toESM(require_react(), 1);
8392 var Button = /* @__PURE__ */ React42.forwardRef(function Button2(componentProps, forwardedRef) {
8393 const {
8394 render: render4,
8395 className,
8396 disabled: disabled2 = false,
8397 focusableWhenDisabled = false,
8398 nativeButton = true,
8399 style,
8400 ...elementProps
8401 } = componentProps;
8402 const {
8403 getButtonProps,
8404 buttonRef
8405 } = useButton({
8406 disabled: disabled2,
8407 focusableWhenDisabled,
8408 native: nativeButton
8409 });
8410 const state = {
8411 disabled: disabled2
8412 };
8413 return useRenderElement("button", componentProps, {
8414 state,
8415 ref: [forwardedRef, buttonRef],
8416 props: [elementProps, getButtonProps]
8417 });
8418 });
8419 if (true) Button.displayName = "Button";
8420
8421 // node_modules/@base-ui/react/field/item/FieldItemContext.mjs
8422 var React43 = __toESM(require_react(), 1);
8423 var FieldItemContext = /* @__PURE__ */ React43.createContext({
8424 disabled: false
8425 });
8426 if (true) FieldItemContext.displayName = "FieldItemContext";
8427 function useFieldItemContext() {
8428 const context = React43.useContext(FieldItemContext);
8429 return context;
8430 }
8431
8432 // node_modules/@base-ui/react/field/root/useFieldValidation.mjs
8433 var React44 = __toESM(require_react(), 1);
8434
8435 // node_modules/@base-ui/react/field/utils/getCombinedFieldValidityData.mjs
8436 function getCombinedFieldValidityData(validityData, invalid2) {
8437 return {
8438 ...validityData,
8439 state: {
8440 ...validityData.state,
8441 valid: !invalid2 && validityData.state.valid
8442 }
8443 };
8444 }
8445
8446 // node_modules/@base-ui/react/field/root/useFieldValidation.mjs
8447 var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE);
8448 function isEligibleInput(input, formElement) {
8449 if (input.matches(":disabled")) {
8450 return false;
8451 }
8452 if (!formElement || input.form === formElement) {
8453 return true;
8454 }
8455 return input.form === null && !input.hasAttribute("form");
8456 }
8457 function findRepresentativeInput(inputs, formElement) {
8458 let fallback = null;
8459 for (const input of inputs.keys()) {
8460 if (!isEligibleInput(input, formElement)) {
8461 continue;
8462 }
8463 if (!input.validity.valid) {
8464 return input;
8465 }
8466 fallback ??= input;
8467 }
8468 return fallback;
8469 }
8470 function makeState(customError) {
8471 return {
8472 ...DEFAULT_VALIDITY_STATE,
8473 valid: !customError,
8474 customError
8475 };
8476 }
8477 function getNativeErrors(element) {
8478 return element && element.validationMessage ? [element.validationMessage] : [];
8479 }
8480 function useFieldValidation(params) {
8481 const {
8482 elementRef,
8483 formRef
8484 } = useFormContext();
8485 const {
8486 setValidityData,
8487 validate,
8488 validityData,
8489 validationDebounceTime,
8490 invalid: invalid2,
8491 markedDirtyRef,
8492 state,
8493 shouldValidateOnChange,
8494 validationMode,
8495 registeredFieldIdRef
8496 } = params;
8497 const {
8498 controlId,
8499 getDescriptionProps
8500 } = useLabelableContext();
8501 const timeout = useTimeout();
8502 const inputRef = React44.useRef(null);
8503 const registeredInputs = useRefWithInit(() => /* @__PURE__ */ new Map()).current;
8504 const validationCommitIdRef = React44.useRef(0);
8505 const customValidityRef = React44.useRef(null);
8506 const registerInput = React44.useCallback((element, registration) => {
8507 registeredInputs.set(element, registration);
8508 return () => {
8509 registeredInputs.delete(element);
8510 };
8511 }, [registeredInputs]);
8512 const getInputControl = useStableCallback(() => {
8513 const element = findRepresentativeInput(registeredInputs, elementRef.current);
8514 return element && registeredInputs.get(element)?.controlRef.current || null;
8515 });
8516 const commit = useStableCallback(async (value, revalidate = false) => {
8517 validationCommitIdRef.current += 1;
8518 const validationCommitId = validationCommitIdRef.current;
8519 function updateRegisteredFieldValidity(nextValidityData, externalInvalid = invalid2) {
8520 const fieldId = registeredFieldIdRef.current ?? controlId;
8521 if (fieldId == null) {
8522 return;
8523 }
8524 const currentFieldData = formRef.current.fields.get(fieldId);
8525 if (!currentFieldData) {
8526 return;
8527 }
8528 const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData, externalInvalid);
8529 formRef.current.fields.set(fieldId, {
8530 ...currentFieldData,
8531 validityData: validityDataWithFormErrors
8532 });
8533 }
8534 function makeValidityData(validityState, errorMessages) {
8535 const errors = validityState.valid === false ? errorMessages : [];
8536 return {
8537 value,
8538 state: validityState,
8539 error: errors[0] ?? "",
8540 errors,
8541 initialValue: validityData.initialValue
8542 };
8543 }
8544 function setCustomValidity(element2, message2) {
8545 const displaced = element2.validity.customError ? element2.validationMessage : "";
8546 const ownedMessage = message2.replace(/\r\n?/g, "\n");
8547 element2.setCustomValidity(ownedMessage);
8548 customValidityRef.current = [element2, ownedMessage, displaced];
8549 }
8550 function clearCustomValidity() {
8551 const record = customValidityRef.current;
8552 customValidityRef.current = null;
8553 if (record && (!record[0].willValidate || record[0].validationMessage === record[1])) {
8554 record[0].setCustomValidity(record[2]);
8555 }
8556 }
8557 function publish(validityState, errorMessages, externalInvalid) {
8558 const nextValidityData = makeValidityData(validityState, errorMessages);
8559 updateRegisteredFieldValidity(nextValidityData, externalInvalid);
8560 setValidityData(nextValidityData);
8561 }
8562 function getState(el) {
8563 const computedState = validityKeys.reduce((acc, key) => {
8564 acc[key] = el.validity[key];
8565 return acc;
8566 }, {});
8567 let hasOnlyValueMissingError = false;
8568 for (const key of validityKeys) {
8569 if (key === "valid") {
8570 continue;
8571 }
8572 if (key === "valueMissing" && computedState[key]) {
8573 hasOnlyValueMissingError = true;
8574 } else if (computedState[key]) {
8575 return computedState;
8576 }
8577 }
8578 if (hasOnlyValueMissingError && !markedDirtyRef.current) {
8579 computedState.valid = true;
8580 computedState.valueMissing = false;
8581 }
8582 return computedState;
8583 }
8584 function resolveRepresentativeInput() {
8585 return registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current;
8586 }
8587 let element = resolveRepresentativeInput();
8588 function refreshState() {
8589 element = resolveRepresentativeInput();
8590 return element?.willValidate ? getState(element) : makeState(false);
8591 }
8592 if (revalidate) {
8593 if (state.valid !== false || !element) {
8594 return;
8595 }
8596 if (!element.validity.valueMissing) {
8597 clearCustomValidity();
8598 const currentElement = resolveRepresentativeInput();
8599 const foreign = currentElement?.validity.customError ? getNativeErrors(currentElement) : [];
8600 publish(makeState(foreign.length > 0), foreign, false);
8601 return;
8602 }
8603 for (const key of validityKeys) {
8604 if (key !== "valid" && key !== "valueMissing" && key !== "customError" && element.validity[key]) {
8605 return;
8606 }
8607 }
8608 }
8609 timeout.clear();
8610 clearCustomValidity();
8611 let nextState = refreshState();
8612 let validationErrors = getNativeErrors(element);
8613 const isValidatingOnChange = shouldValidateOnChange();
8614 if (validationErrors.length === 0 || isValidatingOnChange) {
8615 const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => {
8616 if (field.name) {
8617 acc[field.name] = field.getValue();
8618 }
8619 return acc;
8620 }, {});
8621 const resultOrPromise = validate(value, formValues);
8622 let result;
8623 if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) {
8624 if (nextState.valid === false) {
8625 publish(nextState, validationErrors);
8626 } else if (validationMode === "onSubmit" || !validityData.state.customError) {
8627 nextState.valid = null;
8628 publish(nextState, validationErrors);
8629 }
8630 result = await resultOrPromise;
8631 if (validationCommitId !== validationCommitIdRef.current) {
8632 return;
8633 }
8634 nextState = refreshState();
8635 } else {
8636 result = resultOrPromise;
8637 }
8638 validationErrors = result ? [].concat(result).filter(Boolean) : [];
8639 if (validationErrors.length > 0) {
8640 nextState.valid = false;
8641 nextState.customError = true;
8642 if (element?.willValidate) {
8643 setCustomValidity(element, validationErrors.join("\n"));
8644 }
8645 } else {
8646 validationErrors = getNativeErrors(element);
8647 }
8648 }
8649 publish(nextState, validationErrors);
8650 });
8651 const change = useStableCallback((value, cancelPending = false) => {
8652 timeout.clear();
8653 validationCommitIdRef.current += 1;
8654 if (cancelPending) {
8655 return;
8656 }
8657 const validateOnChange = shouldValidateOnChange();
8658 if (validateOnChange && value !== "" && validationDebounceTime) {
8659 timeout.start(validationDebounceTime, () => {
8660 commit(value);
8661 });
8662 } else {
8663 commit(value, !validateOnChange);
8664 }
8665 });
8666 const getValidationProps = React44.useCallback((disabled2, externalProps = {}) => mergeProps(getDescriptionProps(externalProps), state.valid === false && !state.disabled && !disabled2 ? {
8667 "aria-invalid": true
8668 } : EMPTY_OBJECT), [getDescriptionProps, state.disabled, state.valid]);
8669 return React44.useMemo(() => ({
8670 getValidationProps,
8671 inputRef,
8672 registeredInputs,
8673 registerInput,
8674 getInputControl,
8675 commit,
8676 change
8677 }), [getValidationProps, registeredInputs, registerInput, getInputControl, commit, change]);
8678 }
8679
8680 // node_modules/@base-ui/react/collapsible/index.parts.mjs
8681 var index_parts_exports = {};
8682 __export(index_parts_exports, {
8683 Panel: () => CollapsiblePanel,
8684 Root: () => CollapsibleRoot,
8685 Trigger: () => CollapsibleTrigger
8686 });
8687
8688 // node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs
8689 var React45 = __toESM(require_react(), 1);
8690
8691 // node_modules/@base-ui/react/collapsible/root/stateAttributesMapping.mjs
8692 var collapsibleStateAttributesMapping = {
8693 ...collapsibleOpenStateMapping,
8694 ...transitionStatusMapping
8695 };
8696
8697 // node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs
8698 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
8699 var CollapsibleRoot = /* @__PURE__ */ React45.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) {
8700 const {
8701 render: render4,
8702 className,
8703 defaultOpen = false,
8704 disabled: disabled2 = false,
8705 onOpenChange: onOpenChangeProp,
8706 open: open3,
8707 style,
8708 ...elementProps
8709 } = componentProps;
8710 const onOpenChange = useStableCallback(onOpenChangeProp);
8711 const collapsible = useCollapsibleRoot({
8712 open: open3,
8713 defaultOpen,
8714 onOpenChange,
8715 disabled: disabled2
8716 });
8717 const state = React45.useMemo(() => ({
8718 open: collapsible.open,
8719 disabled: collapsible.disabled,
8720 transitionStatus: collapsible.transitionStatus
8721 }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]);
8722 const contextValue = React45.useMemo(() => ({
8723 ...collapsible,
8724 onOpenChange,
8725 state
8726 }), [collapsible, onOpenChange, state]);
8727 const element = useRenderElement("div", componentProps, {
8728 state,
8729 ref: forwardedRef,
8730 props: elementProps,
8731 stateAttributesMapping: collapsibleStateAttributesMapping
8732 });
8733 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapsibleRootContext.Provider, {
8734 value: contextValue,
8735 children: element
8736 });
8737 });
8738 if (true) CollapsibleRoot.displayName = "CollapsibleRoot";
8739
8740 // node_modules/@base-ui/react/collapsible/trigger/CollapsibleTrigger.mjs
8741 var React46 = __toESM(require_react(), 1);
8742 var stateAttributesMapping = {
8743 ...triggerOpenStateMapping,
8744 ...transitionStatusMapping
8745 };
8746 var CollapsibleTrigger = /* @__PURE__ */ React46.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) {
8747 const {
8748 panelId,
8749 open: open3,
8750 handleTrigger,
8751 state,
8752 disabled: contextDisabled
8753 } = useCollapsibleRootContext();
8754 const {
8755 className,
8756 disabled: disabled2 = contextDisabled,
8757 render: render4,
8758 nativeButton = true,
8759 style,
8760 ...elementProps
8761 } = componentProps;
8762 const {
8763 getButtonProps,
8764 buttonRef
8765 } = useButton({
8766 disabled: disabled2,
8767 focusableWhenDisabled: true,
8768 native: nativeButton
8769 });
8770 const element = useRenderElement("button", componentProps, {
8771 state,
8772 ref: [forwardedRef, buttonRef],
8773 props: [{
8774 "aria-controls": open3 ? panelId : void 0,
8775 "aria-expanded": open3,
8776 onClick: handleTrigger
8777 }, elementProps, getButtonProps],
8778 stateAttributesMapping
8779 });
8780 return element;
8781 });
8782 if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger";
8783
8784 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs
8785 var React47 = __toESM(require_react(), 1);
8786
8787 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelCssVars.mjs
8788 var collapsiblePanelHeight = "--collapsible-panel-height";
8789 var collapsiblePanelWidth = "--collapsible-panel-width";
8790
8791 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs
8792 var CollapsiblePanel = /* @__PURE__ */ React47.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) {
8793 const {
8794 className,
8795 hiddenUntilFound: hiddenUntilFoundProp,
8796 keepMounted: keepMountedProp,
8797 render: render4,
8798 id: idProp,
8799 style,
8800 ...elementProps
8801 } = componentProps;
8802 if (true) {
8803 React47.useEffect(() => {
8804 if (hiddenUntilFoundProp && keepMountedProp === false) {
8805 warn("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed.");
8806 }
8807 }, [hiddenUntilFoundProp, keepMountedProp]);
8808 }
8809 const {
8810 defaultPanelId,
8811 mounted,
8812 onOpenChange,
8813 open: open3,
8814 setMounted,
8815 setPanelIdState,
8816 setOpen,
8817 state,
8818 transitionStatus
8819 } = useCollapsibleRootContext();
8820 const hiddenUntilFound = hiddenUntilFoundProp ?? false;
8821 const keepMounted = keepMountedProp ?? false;
8822 const registeredId = idProp || void 0;
8823 const id = registeredId ?? defaultPanelId;
8824 useIsoLayoutEffect(() => {
8825 setPanelIdState((currentId) => registeredId ?? (currentId === null ? void 0 : currentId));
8826 return () => {
8827 setPanelIdState((currentId) => currentId === registeredId ? null : currentId);
8828 };
8829 }, [registeredId, setPanelIdState]);
8830 const {
8831 height,
8832 props,
8833 ref,
8834 shouldPreventOpenAnimation,
8835 shouldRender,
8836 transitionStatus: panelTransitionStatus,
8837 width
8838 } = useCollapsiblePanel({
8839 externalRef: forwardedRef,
8840 hiddenUntilFound,
8841 id,
8842 keepMounted,
8843 mounted,
8844 onOpenChange,
8845 open: open3,
8846 setMounted,
8847 setOpen,
8848 transitionStatus
8849 });
8850 const panelState = {
8851 ...state,
8852 transitionStatus: panelTransitionStatus
8853 };
8854 const resolvedStyle = resolveStyle(style, panelState);
8855 const element = useRenderElement("div", {
8856 ...componentProps,
8857 style: void 0
8858 }, {
8859 state: panelState,
8860 ref,
8861 props: [
8862 props,
8863 {
8864 style: {
8865 [collapsiblePanelHeight]: height === void 0 ? "auto" : `${height}px`,
8866 [collapsiblePanelWidth]: width === void 0 ? "auto" : `${width}px`
8867 }
8868 },
8869 elementProps,
8870 resolvedStyle ? {
8871 style: resolvedStyle
8872 } : void 0,
8873 // Resolve the public `style` prop so temporary `animationName: 'none'`
8874 // can still win after user's inline styles have been merged.
8875 shouldPreventOpenAnimation ? {
8876 style: {
8877 animationName: "none"
8878 }
8879 } : void 0
8880 ],
8881 stateAttributesMapping: collapsibleStateAttributesMapping
8882 });
8883 if (!shouldRender) {
8884 return null;
8885 }
8886 return element;
8887 });
8888 if (true) CollapsiblePanel.displayName = "CollapsiblePanel";
8889
8890 // node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs
8891 function useRegisteredLabelId(idProp, setLabelId) {
8892 const id = useBaseUiId(idProp);
8893 useIsoLayoutEffect(() => {
8894 setLabelId(id);
8895 return () => {
8896 setLabelId((currentId) => currentId === id ? void 0 : currentId);
8897 };
8898 }, [id, setLabelId]);
8899 return id;
8900 }
8901
8902 // node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs
8903 function useLabel(params = {}) {
8904 const {
8905 id: idProp,
8906 fallbackControlId,
8907 native = false,
8908 setLabelId: setLabelIdProp,
8909 focusControl: focusControlProp
8910 } = params;
8911 const {
8912 controlId: contextControlId,
8913 setLabelId: setContextLabelId
8914 } = useLabelableContext();
8915 const syncLabelId = useStableCallback((nextLabelId) => {
8916 setContextLabelId(nextLabelId);
8917 setLabelIdProp?.(nextLabelId);
8918 });
8919 const id = useRegisteredLabelId(idProp, syncLabelId);
8920 const resolvedControlId = contextControlId ?? fallbackControlId;
8921 function focusControl(event) {
8922 if (focusControlProp) {
8923 focusControlProp(event, resolvedControlId);
8924 return;
8925 }
8926 if (!resolvedControlId) {
8927 return;
8928 }
8929 const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId);
8930 if (isHTMLElement(controlElement)) {
8931 focusElementWithVisible(controlElement);
8932 }
8933 }
8934 function handleInteraction(event) {
8935 const target = getTarget(event.nativeEvent);
8936 if (target?.closest("button,input,select,textarea")) {
8937 return;
8938 }
8939 if (!event.defaultPrevented && event.detail > 1) {
8940 event.preventDefault();
8941 }
8942 if (native) {
8943 return;
8944 }
8945 focusControl(event);
8946 }
8947 return native ? {
8948 id,
8949 htmlFor: resolvedControlId,
8950 onMouseDown: handleInteraction
8951 } : {
8952 id,
8953 onClick: handleInteraction,
8954 onPointerDown(event) {
8955 event.preventDefault();
8956 }
8957 };
8958 }
8959 function focusElementWithVisible(element) {
8960 element.focus({
8961 // Available from Chrome 144+ (January 2026).
8962 // Safari and Firefox already support it.
8963 focusVisible: true
8964 });
8965 }
8966
8967 // node_modules/@base-ui/react/utils/usePopupViewport.mjs
8968 var React51 = __toESM(require_react(), 1);
8969 var ReactDOM6 = __toESM(require_react_dom(), 1);
8970
8971 // node_modules/@base-ui/utils/usePreviousValue.mjs
8972 var React48 = __toESM(require_react(), 1);
8973 function usePreviousValue(value) {
8974 const [state, setState] = React48.useState({
8975 current: value,
8976 previous: null
8977 });
8978 if (!Object.is(value, state.current)) {
8979 setState({
8980 current: value,
8981 previous: state.current
8982 });
8983 }
8984 return state.previous;
8985 }
8986
8987 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
8988 var React49 = __toESM(require_react(), 1);
8989
8990 // node_modules/@base-ui/react/utils/getCssDimensions.mjs
8991 function getCssDimensions2(element) {
8992 const css = getComputedStyle2(element);
8993 let width = parseFloat(css.width) || 0;
8994 let height = parseFloat(css.height) || 0;
8995 const hasOffset = isHTMLElement(element);
8996 const offsetWidth = hasOffset ? element.offsetWidth : width;
8997 const offsetHeight = hasOffset ? element.offsetHeight : height;
8998 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
8999 if (shouldFallback) {
9000 width = offsetWidth;
9001 height = offsetHeight;
9002 }
9003 return {
9004 width,
9005 height
9006 };
9007 }
9008
9009 // node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs
9010 var popupWidth = "--popup-width";
9011 var popupHeight = "--popup-height";
9012
9013 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs
9014 function usePopupAutoResize(parameters) {
9015 const {
9016 popupElement,
9017 positionerElement,
9018 content,
9019 mounted,
9020 onMeasureLayout: onMeasureLayoutParam,
9021 onMeasureLayoutComplete: onMeasureLayoutCompleteParam,
9022 side,
9023 direction
9024 } = parameters;
9025 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true);
9026 const animationFrame = useAnimationFrame();
9027 const committedDimensionsRef = React49.useRef(null);
9028 const isInitialRenderRef = React49.useRef(true);
9029 const restoreAnchoringStylesRef = React49.useRef(NOOP);
9030 const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
9031 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
9032 const anchoringStyles = React49.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]);
9033 useIsoLayoutEffect(() => {
9034 if (!mounted) {
9035 restoreAnchoringStylesRef.current = NOOP;
9036 isInitialRenderRef.current = true;
9037 committedDimensionsRef.current = null;
9038 return void 0;
9039 }
9040 if (!popupElement || !positionerElement) {
9041 return void 0;
9042 }
9043 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles);
9044 setPopupCssSize(popupElement, "auto");
9045 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static");
9046 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none");
9047 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1");
9048 const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
9049 [availableWidth]: "max-content",
9050 [availableHeight]: "max-content"
9051 });
9052 function restoreMeasurementOverrides() {
9053 restorePopupPosition();
9054 restorePopupTransform();
9055 restorePositionerAvailableSize();
9056 }
9057 function restoreMeasurementOverridesIncludingScale() {
9058 restoreMeasurementOverrides();
9059 restorePopupScale();
9060 }
9061 onMeasureLayout?.();
9062 if (isInitialRenderRef.current || committedDimensionsRef.current === null) {
9063 setPositionerCssSize(positionerElement, "max-content");
9064 const dimensions = getCssDimensions2(popupElement);
9065 committedDimensionsRef.current = dimensions;
9066 setPositionerCssSize(positionerElement, dimensions);
9067 restoreMeasurementOverridesIncludingScale();
9068 onMeasureLayoutComplete?.(null, dimensions);
9069 isInitialRenderRef.current = false;
9070 return () => {
9071 restoreAnchoringStylesRef.current();
9072 restoreAnchoringStylesRef.current = NOOP;
9073 };
9074 }
9075 setPositionerCssSize(positionerElement, "max-content");
9076 const previousDimensions = committedDimensionsRef.current;
9077 const newDimensions = getCssDimensions2(popupElement);
9078 committedDimensionsRef.current = newDimensions;
9079 setPopupCssSize(popupElement, previousDimensions);
9080 restoreMeasurementOverridesIncludingScale();
9081 onMeasureLayoutComplete?.(previousDimensions, newDimensions);
9082 setPositionerCssSize(positionerElement, newDimensions);
9083 const abortController = new AbortController();
9084 animationFrame.request(() => {
9085 setPopupCssSize(popupElement, newDimensions);
9086 runOnceAnimationsFinish(() => {
9087 popupElement.style.setProperty(popupWidth, "auto");
9088 popupElement.style.setProperty(popupHeight, "auto");
9089 }, abortController.signal);
9090 });
9091 return () => {
9092 abortController.abort();
9093 animationFrame.cancel();
9094 restoreAnchoringStylesRef.current();
9095 restoreAnchoringStylesRef.current = NOOP;
9096 };
9097 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]);
9098 }
9099 function getPopupAnchoringStyles(side, direction) {
9100 const isPhysicalTop = side === "top";
9101 const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start");
9102 if (!isPhysicalTop && !isPhysicalLeft) {
9103 return EMPTY_OBJECT;
9104 }
9105 return {
9106 position: "absolute",
9107 [isPhysicalTop ? "bottom" : "top"]: "0",
9108 [isPhysicalLeft ? "right" : "left"]: "0"
9109 };
9110 }
9111 function overrideElementStyle(element, property, value) {
9112 const originalValue = element.style.getPropertyValue(property);
9113 element.style.setProperty(property, value);
9114 return () => {
9115 element.style.setProperty(property, originalValue);
9116 };
9117 }
9118 function applyElementStyles(element, styles) {
9119 const restorers = [];
9120 for (const [key, value] of Object.entries(styles)) {
9121 restorers.push(overrideElementStyle(element, key, value));
9122 }
9123 return restorers.length ? () => {
9124 restorers.forEach((restore) => restore());
9125 } : NOOP;
9126 }
9127 function setPopupCssSize(popupElement, size4) {
9128 const width = size4 === "auto" ? "auto" : `${size4.width}px`;
9129 const height = size4 === "auto" ? "auto" : `${size4.height}px`;
9130 popupElement.style.setProperty(popupWidth, width);
9131 popupElement.style.setProperty(popupHeight, height);
9132 }
9133 function setPositionerCssSize(positionerElement, size4) {
9134 const width = size4 === "max-content" ? "max-content" : `${size4.width}px`;
9135 const height = size4 === "max-content" ? "max-content" : `${size4.height}px`;
9136 positionerElement.style.setProperty(positionerWidth, width);
9137 positionerElement.style.setProperty(positionerHeight, height);
9138 }
9139
9140 // node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs
9141 var React50 = __toESM(require_react(), 1);
9142 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
9143 var DirectionProvider = function DirectionProvider2(props) {
9144 const {
9145 direction = "ltr"
9146 } = props;
9147 const contextValue = React50.useMemo(() => ({
9148 direction
9149 }), [direction]);
9150 return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DirectionContext.Provider, {
9151 value: contextValue,
9152 children: props.children
9153 });
9154 };
9155 if (true) DirectionProvider.displayName = "DirectionProvider";
9156
9157 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs
9158 var adaptiveOrigin = {
9159 name: "adaptiveOrigin",
9160 async fn(state) {
9161 const {
9162 x: rawX,
9163 y: rawY,
9164 rects: {
9165 floating: floatRect
9166 },
9167 elements: {
9168 floating
9169 },
9170 platform: platform3,
9171 strategy,
9172 placement
9173 } = state;
9174 const win = getWindow(floating);
9175 const styles = win.getComputedStyle(floating);
9176 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== "";
9177 if (!hasTransition) {
9178 return {
9179 x: rawX,
9180 y: rawY,
9181 data: DEFAULT_SIDES
9182 };
9183 }
9184 const offsetParent = await platform3.getOffsetParent?.(floating);
9185 let offsetDimensions = {
9186 width: 0,
9187 height: 0
9188 };
9189 if (strategy === "fixed" && win?.visualViewport) {
9190 offsetDimensions = {
9191 width: win.visualViewport.width,
9192 height: win.visualViewport.height
9193 };
9194 } else if (offsetParent === win) {
9195 const doc = ownerDocument(floating);
9196 offsetDimensions = {
9197 width: doc.documentElement.clientWidth,
9198 height: doc.documentElement.clientHeight
9199 };
9200 } else if (await platform3.isElement?.(offsetParent)) {
9201 offsetDimensions = await platform3.getDimensions(offsetParent);
9202 }
9203 const currentSide = getSide(placement);
9204 let x2 = rawX;
9205 let y2 = rawY;
9206 if (currentSide === "left") {
9207 x2 = offsetDimensions.width - (rawX + floatRect.width);
9208 }
9209 if (currentSide === "top") {
9210 y2 = offsetDimensions.height - (rawY + floatRect.height);
9211 }
9212 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX;
9213 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY;
9214 return {
9215 x: x2,
9216 y: y2,
9217 data: {
9218 sideX,
9219 sideY
9220 }
9221 };
9222 }
9223 };
9224
9225 // node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs
9226 var activationDirection = "data-activation-direction";
9227
9228 // node_modules/@base-ui/react/utils/usePopupViewport.mjs
9229 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
9230 var popupViewportStateMapping = {
9231 activationDirection: (value) => value ? {
9232 [activationDirection]: value
9233 } : null
9234 };
9235 function usePopupViewport(parameters) {
9236 const {
9237 store,
9238 side,
9239 children
9240 } = parameters;
9241 const direction = useDirection();
9242 const activeTrigger = store.useState("activeTriggerElement");
9243 const activeTriggerId = store.useState("activeTriggerId");
9244 const open3 = store.useState("open");
9245 const payload = store.useState("payload");
9246 const mounted = store.useState("mounted");
9247 const popupElement = store.useState("popupElement");
9248 const positionerElement = store.useState("positionerElement");
9249 const previousActiveTrigger = usePreviousValue(open3 ? activeTrigger : null);
9250 const currentContentKey = usePopupContentKey(activeTriggerId, payload);
9251 const capturedNodeRef = React51.useRef(null);
9252 const [previousContentNode, setPreviousContentNode] = React51.useState(null);
9253 const [newTriggerOffset, setNewTriggerOffset] = React51.useState(null);
9254 const currentContainerRef = React51.useRef(null);
9255 const previousContainerRef = React51.useRef(null);
9256 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true);
9257 const cleanupFrame = useAnimationFrame();
9258 const cleanupControllerRef = React51.useRef(null);
9259 const [previousContentDimensions, setPreviousContentDimensions] = React51.useState(null);
9260 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React51.useState(false);
9261 useIsoLayoutEffect(() => {
9262 store.set("adaptiveOrigin", adaptiveOrigin);
9263 return () => {
9264 store.set("adaptiveOrigin", void 0);
9265 };
9266 }, [store]);
9267 const handleMeasureLayout = useStableCallback(() => {
9268 currentContainerRef.current?.style.setProperty("animation", "none");
9269 currentContainerRef.current?.style.setProperty("transition", "none");
9270 previousContainerRef.current?.style.setProperty("display", "none");
9271 });
9272 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => {
9273 currentContainerRef.current?.style.removeProperty("animation");
9274 currentContainerRef.current?.style.removeProperty("transition");
9275 previousContainerRef.current?.style.removeProperty("display");
9276 if (previousDimensions) {
9277 setPreviousContentDimensions(previousDimensions);
9278 }
9279 });
9280 const armViewportCleanup = useStableCallback(() => {
9281 cleanupControllerRef.current?.abort();
9282 const controller = new AbortController();
9283 cleanupControllerRef.current = controller;
9284 onAnimationsFinished(() => {
9285 setPreviousContentNode(null);
9286 setPreviousContentDimensions(null);
9287 capturedNodeRef.current = null;
9288 }, controller.signal);
9289 });
9290 const lastHandledTriggerRef = React51.useRef(null);
9291 useIsoLayoutEffect(() => {
9292 if (!open3 || !mounted) {
9293 lastHandledTriggerRef.current = null;
9294 }
9295 }, [open3, mounted]);
9296 useIsoLayoutEffect(() => {
9297 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
9298 setPreviousContentNode(capturedNodeRef.current);
9299 setShowStartingStyleAttribute(true);
9300 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger);
9301 setNewTriggerOffset(offset4);
9302 lastHandledTriggerRef.current = activeTrigger;
9303 }
9304 }, [activeTrigger, previousActiveTrigger]);
9305 useIsoLayoutEffect(() => {
9306 if (previousContentNode == null) {
9307 return;
9308 }
9309 cleanupControllerRef.current?.abort();
9310 setShowStartingStyleAttribute(true);
9311 cleanupFrame.request(() => {
9312 ReactDOM6.flushSync(() => {
9313 setShowStartingStyleAttribute(false);
9314 });
9315 armViewportCleanup();
9316 });
9317 }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]);
9318 useIsoLayoutEffect(() => {
9319 const source = currentContainerRef.current;
9320 if (!source) {
9321 return;
9322 }
9323 const wrapper = ownerDocument(source).createElement("div");
9324 for (const child of Array.from(source.childNodes)) {
9325 wrapper.appendChild(child.cloneNode(true));
9326 }
9327 capturedNodeRef.current = wrapper;
9328 });
9329 const isTransitioning = previousContentNode != null;
9330 let childrenToRender;
9331 if (!isTransitioning) {
9332 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
9333 "data-current": true,
9334 ref: currentContainerRef,
9335 children
9336 }, currentContentKey);
9337 } else {
9338 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React51.Fragment, {
9339 children: [/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
9340 "data-previous": true,
9341 inert: inertValue(true),
9342 ref: previousContainerRef,
9343 style: {
9344 ...previousContentDimensions ? {
9345 [popupWidth]: `${previousContentDimensions.width}px`,
9346 [popupHeight]: `${previousContentDimensions.height}px`
9347 } : null,
9348 position: "absolute"
9349 },
9350 "data-ending-style": showStartingStyleAttribute ? void 0 : ""
9351 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
9352 "data-current": true,
9353 ref: currentContainerRef,
9354 "data-starting-style": showStartingStyleAttribute ? "" : void 0,
9355 children
9356 }, currentContentKey)]
9357 });
9358 }
9359 useIsoLayoutEffect(() => {
9360 const container = previousContainerRef.current;
9361 if (!container || !previousContentNode) {
9362 return;
9363 }
9364 container.replaceChildren(...Array.from(previousContentNode.childNodes));
9365 }, [previousContentNode]);
9366 usePopupAutoResize({
9367 popupElement,
9368 positionerElement,
9369 mounted,
9370 content: payload,
9371 onMeasureLayout: handleMeasureLayout,
9372 onMeasureLayoutComplete: handleMeasureLayoutComplete,
9373 side,
9374 direction
9375 });
9376 const state = {
9377 activationDirection: getActivationDirection(newTriggerOffset),
9378 transitioning: isTransitioning
9379 };
9380 return {
9381 children: childrenToRender,
9382 state
9383 };
9384 }
9385 function getActivationDirection(offset4) {
9386 if (!offset4) {
9387 return void 0;
9388 }
9389 return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`;
9390 }
9391 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) {
9392 if (value > tolerance) {
9393 return positiveLabel;
9394 }
9395 if (value < -tolerance) {
9396 return negativeLabel;
9397 }
9398 return "";
9399 }
9400 function calculateRelativePosition(from, to) {
9401 const fromRect = from.getBoundingClientRect();
9402 const toRect = to.getBoundingClientRect();
9403 const fromCenter = {
9404 x: fromRect.left + fromRect.width / 2,
9405 y: fromRect.top + fromRect.height / 2
9406 };
9407 const toCenter = {
9408 x: toRect.left + toRect.width / 2,
9409 y: toRect.top + toRect.height / 2
9410 };
9411 return {
9412 horizontal: toCenter.x - fromCenter.x,
9413 vertical: toCenter.y - fromCenter.y
9414 };
9415 }
9416 function usePopupContentKey(activeTriggerId, payload) {
9417 const [contentKey, setContentKey] = React51.useState(0);
9418 const previousActiveTriggerIdRef = React51.useRef(activeTriggerId);
9419 const previousPayloadRef = React51.useRef(payload);
9420 const pendingPayloadUpdateRef = React51.useRef(false);
9421 useIsoLayoutEffect(() => {
9422 const previousActiveTriggerId = previousActiveTriggerIdRef.current;
9423 const previousPayload = previousPayloadRef.current;
9424 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId;
9425 const payloadChanged = payload !== previousPayload;
9426 if (triggerIdChanged) {
9427 setContentKey((value) => value + 1);
9428 pendingPayloadUpdateRef.current = !payloadChanged;
9429 } else if (pendingPayloadUpdateRef.current && payloadChanged) {
9430 setContentKey((value) => value + 1);
9431 pendingPayloadUpdateRef.current = false;
9432 }
9433 previousActiveTriggerIdRef.current = activeTriggerId;
9434 previousPayloadRef.current = payload;
9435 }, [activeTriggerId, payload]);
9436 return `${activeTriggerId ?? "current"}-${contentKey}`;
9437 }
9438
9439 // node_modules/@base-ui/react/field/index.parts.mjs
9440 var index_parts_exports2 = {};
9441 __export(index_parts_exports2, {
9442 Control: () => FieldControl,
9443 Description: () => FieldDescription,
9444 Error: () => FieldError,
9445 Item: () => FieldItem,
9446 Label: () => FieldLabel,
9447 Root: () => FieldRoot,
9448 Validity: () => FieldValidity
9449 });
9450
9451 // node_modules/@base-ui/react/field/root/FieldRoot.mjs
9452 var React55 = __toESM(require_react(), 1);
9453
9454 // node_modules/@base-ui/react/fieldset/root/FieldsetRootContext.mjs
9455 var React52 = __toESM(require_react(), 1);
9456 var FieldsetRootContext = /* @__PURE__ */ React52.createContext(void 0);
9457 if (true) FieldsetRootContext.displayName = "FieldsetRootContext";
9458 function useFieldsetRootContext(optional = false) {
9459 const context = React52.useContext(FieldsetRootContext);
9460 if (!context && !optional) {
9461 throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86));
9462 }
9463 return context;
9464 }
9465
9466 // node_modules/@base-ui/react/internals/labelable-provider/LabelableProvider.mjs
9467 var React53 = __toESM(require_react(), 1);
9468 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
9469 var LabelableProvider = function LabelableProvider2(props) {
9470 const defaultId = useBaseUiId();
9471 const [controlIdState, setControlIdState] = React53.useState(defaultId);
9472 const [labelId, setLabelId] = React53.useState();
9473 const [messageIds, setMessageIds] = React53.useState([]);
9474 const controlId = controlIdState === void 0 ? defaultId : controlIdState;
9475 const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map());
9476 const {
9477 messageIds: parentMessageIds
9478 } = useLabelableContext();
9479 const registerControlId = useStableCallback((source, nextId) => {
9480 const registrations = registrationsRef.current;
9481 if (nextId === void 0) {
9482 registrations.delete(source);
9483 } else {
9484 registrations.set(source, nextId);
9485 }
9486 setControlIdState((prev) => {
9487 if (registrations.size === 0) {
9488 return prev;
9489 }
9490 let nextControlId;
9491 for (const id of registrations.values()) {
9492 if (id === prev) {
9493 return prev;
9494 }
9495 if (nextControlId === void 0) {
9496 nextControlId = id;
9497 }
9498 }
9499 return nextControlId;
9500 });
9501 });
9502 const resetControlId = useStableCallback(() => {
9503 if (registrationsRef.current.size === 0) {
9504 setControlIdState(defaultId);
9505 }
9506 });
9507 const getDescriptionProps = React53.useCallback((externalProps) => {
9508 const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : [];
9509 ids.push(...parentMessageIds, ...messageIds);
9510 return {
9511 ...externalProps,
9512 "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0
9513 };
9514 }, [parentMessageIds, messageIds]);
9515 const contextValue = React53.useMemo(() => ({
9516 controlId,
9517 registerControlId,
9518 resetControlId,
9519 labelId,
9520 setLabelId,
9521 messageIds,
9522 setMessageIds,
9523 getDescriptionProps
9524 }), [controlId, registerControlId, resetControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]);
9525 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LabelableContext.Provider, {
9526 value: contextValue,
9527 children: props.children
9528 });
9529 };
9530 if (true) LabelableProvider.displayName = "LabelableProvider";
9531
9532 // node_modules/@base-ui/react/internals/field-register-control/useFieldControlRegistration.mjs
9533 var React54 = __toESM(require_react(), 1);
9534 function useFieldControlRegistration(params) {
9535 const {
9536 change,
9537 commit,
9538 invalid: invalid2,
9539 markedDirtyRef,
9540 name,
9541 setRegisteredFieldName,
9542 registeredFieldIdRef,
9543 setValidityData,
9544 validityData
9545 } = params;
9546 const {
9547 formRef
9548 } = useFormContext();
9549 const activeFieldControlSourceRef = React54.useRef(null);
9550 const registrationRef = React54.useRef(null);
9551 const initialValueCapturedRef = React54.useRef(false);
9552 const getValueForForm = useStableCallback(() => {
9553 const registration = registrationRef.current;
9554 if (!registration) {
9555 return void 0;
9556 }
9557 if (registration.getValue) {
9558 return registration.getValue();
9559 }
9560 return registration.value;
9561 });
9562 function getRegistrationValue(registration) {
9563 return registration.value === void 0 ? getValueForForm() : registration.value;
9564 }
9565 const validate = useStableCallback(() => {
9566 const registration = registrationRef.current;
9567 markedDirtyRef.current = true;
9568 if (!registration) {
9569 commit(validityData.value);
9570 return;
9571 }
9572 commit(getRegistrationValue(registration));
9573 });
9574 function refreshRegistration() {
9575 const registration = registrationRef.current;
9576 if (!registration || !registration.id) {
9577 return;
9578 }
9579 formRef.current.fields.set(registration.id, {
9580 getValue: getValueForForm,
9581 name: name ?? registration.name,
9582 controlRef: registration.controlRef,
9583 validityData: getCombinedFieldValidityData(validityData, invalid2),
9584 validate
9585 });
9586 }
9587 function deleteRegistration(id = registrationRef.current?.id) {
9588 if (id) {
9589 formRef.current.fields.delete(id);
9590 }
9591 }
9592 function captureInitialValue(registration) {
9593 if (initialValueCapturedRef.current) {
9594 return;
9595 }
9596 initialValueCapturedRef.current = true;
9597 const initialValue = getRegistrationValue(registration);
9598 setValidityData((prev) => prev.initialValue === initialValue ? prev : {
9599 ...prev,
9600 initialValue
9601 });
9602 }
9603 useIsoLayoutEffect(() => {
9604 const registration = registrationRef.current;
9605 if (!registration || !registration.id) {
9606 return;
9607 }
9608 setRegisteredFieldName(name ? void 0 : registration.name);
9609 formRef.current.fields.set(registration.id, {
9610 getValue: getValueForForm,
9611 name: name ?? registration.name,
9612 controlRef: registration.controlRef,
9613 validityData: getCombinedFieldValidityData(validityData, invalid2),
9614 validate
9615 });
9616 }, [formRef, getValueForForm, invalid2, name, setRegisteredFieldName, validate, validityData]);
9617 useIsoLayoutEffect(() => {
9618 const fields = formRef.current.fields;
9619 return () => {
9620 const id = registrationRef.current?.id;
9621 if (id) {
9622 fields.delete(id);
9623 }
9624 };
9625 }, [formRef]);
9626 const register2 = useStableCallback((source, registration) => {
9627 if (!registration) {
9628 if (activeFieldControlSourceRef.current === source) {
9629 activeFieldControlSourceRef.current = null;
9630 change(void 0, true);
9631 deleteRegistration();
9632 registrationRef.current = null;
9633 setRegisteredFieldName(void 0);
9634 registeredFieldIdRef.current = void 0;
9635 }
9636 return;
9637 }
9638 const previousId = registrationRef.current?.id;
9639 const previousSource = activeFieldControlSourceRef.current;
9640 if (previousSource && previousSource !== source) {
9641 change(void 0, true);
9642 }
9643 activeFieldControlSourceRef.current = source;
9644 registrationRef.current = registration;
9645 if (!name) {
9646 setRegisteredFieldName(registration.name);
9647 }
9648 registeredFieldIdRef.current = registration.id;
9649 if (previousId && previousId !== registration.id) {
9650 deleteRegistration(previousId);
9651 }
9652 captureInitialValue(registration);
9653 refreshRegistration();
9654 });
9655 return [validate, register2];
9656 }
9657
9658 // node_modules/@base-ui/react/field/root/FieldRoot.mjs
9659 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
9660 var FieldRootInner = /* @__PURE__ */ React55.forwardRef(function FieldRootInner2(componentProps, forwardedRef) {
9661 const {
9662 errors,
9663 validationMode: formValidationMode,
9664 submitCountRef
9665 } = useFormContext();
9666 const {
9667 render: render4,
9668 className,
9669 validate: validateProp,
9670 validationDebounceTime = 0,
9671 validationMode = formValidationMode,
9672 name,
9673 disabled: disabledProp = false,
9674 invalid: invalidProp,
9675 dirty: dirtyProp,
9676 touched: touchedProp,
9677 actionsRef,
9678 style,
9679 ...elementProps
9680 } = componentProps;
9681 const disabledFieldset = useFieldsetRootContext(true)?.disabled;
9682 const validate = useStableCallback(validateProp || (() => null));
9683 const disabled2 = disabledFieldset || disabledProp;
9684 const [touchedState, setTouchedUnwrapped] = React55.useState(false);
9685 const [dirtyState, setDirtyUnwrapped] = React55.useState(false);
9686 const [filled, setFilled] = React55.useState(false);
9687 const [focused, setFocused] = React55.useState(false);
9688 const dirty = dirtyProp ?? dirtyState;
9689 const touched = touchedProp ?? touchedState;
9690 const markedDirtyRef = React55.useRef(dirty);
9691 const registeredFieldIdRef = React55.useRef(void 0);
9692 const [registeredFieldName, setRegisteredFieldName] = React55.useState();
9693 const effectiveName = name ?? registeredFieldName;
9694 useIsoLayoutEffect(() => {
9695 if (dirtyProp !== void 0) {
9696 markedDirtyRef.current = dirtyProp;
9697 }
9698 }, [dirtyProp]);
9699 const setDirty = useStableCallback((value) => {
9700 if (dirtyProp !== void 0) {
9701 return;
9702 }
9703 if (value) {
9704 markedDirtyRef.current = true;
9705 }
9706 setDirtyUnwrapped(value);
9707 });
9708 const setTouched = useStableCallback((value) => {
9709 if (touchedProp !== void 0) {
9710 return;
9711 }
9712 setTouchedUnwrapped(value);
9713 });
9714 const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitCountRef.current > 0);
9715 const formError = effectiveName && Object.hasOwn(errors, effectiveName) ? errors[effectiveName] : null;
9716 const hasFormError = !!(Array.isArray(formError) ? formError.length : formError);
9717 const invalid2 = invalidProp === true || hasFormError;
9718 const [validityData, setValidityData] = React55.useState({
9719 state: DEFAULT_VALIDITY_STATE,
9720 error: "",
9721 errors: [],
9722 value: null,
9723 initialValue: null
9724 });
9725 const valid2 = !invalid2 && (disabled2 ? null : validityData.state.valid);
9726 const state = React55.useMemo(() => ({
9727 disabled: disabled2,
9728 touched,
9729 dirty,
9730 valid: valid2,
9731 filled,
9732 focused
9733 }), [disabled2, touched, dirty, valid2, filled, focused]);
9734 const validation = useFieldValidation({
9735 setValidityData,
9736 validate,
9737 validityData,
9738 validationDebounceTime,
9739 invalid: invalid2,
9740 markedDirtyRef,
9741 state,
9742 shouldValidateOnChange,
9743 validationMode,
9744 registeredFieldIdRef
9745 });
9746 const [validateFieldControl, registerFieldControl] = useFieldControlRegistration({
9747 change: validation.change,
9748 commit: validation.commit,
9749 invalid: invalid2,
9750 markedDirtyRef,
9751 name,
9752 setRegisteredFieldName,
9753 registeredFieldIdRef,
9754 setValidityData,
9755 validityData
9756 });
9757 React55.useImperativeHandle(actionsRef, () => ({
9758 validate: validateFieldControl
9759 }), [validateFieldControl]);
9760 const contextValue = React55.useMemo(() => ({
9761 invalid: invalid2,
9762 name: effectiveName,
9763 validityData,
9764 setValidityData,
9765 disabled: disabled2,
9766 setTouched,
9767 setDirty,
9768 setFilled,
9769 setFocused,
9770 validationMode,
9771 shouldValidateOnChange,
9772 state,
9773 registerFieldControl,
9774 validation
9775 }), [invalid2, effectiveName, validityData, disabled2, setTouched, setDirty, setFilled, setFocused, validationMode, shouldValidateOnChange, state, registerFieldControl, validation]);
9776 const element = useRenderElement("div", componentProps, {
9777 ref: forwardedRef,
9778 state,
9779 props: elementProps,
9780 stateAttributesMapping: fieldValidityMapping
9781 });
9782 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FieldRootContext.Provider, {
9783 value: contextValue,
9784 children: element
9785 });
9786 });
9787 if (true) FieldRootInner.displayName = "FieldRootInner";
9788 var FieldRoot = /* @__PURE__ */ React55.forwardRef(function FieldRoot2(componentProps, forwardedRef) {
9789 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LabelableProvider, {
9790 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FieldRootInner, {
9791 ...componentProps,
9792 ref: forwardedRef
9793 })
9794 });
9795 });
9796 if (true) FieldRoot.displayName = "FieldRoot";
9797
9798 // node_modules/@base-ui/react/field/label/FieldLabel.mjs
9799 var React56 = __toESM(require_react(), 1);
9800 var FieldLabel = /* @__PURE__ */ React56.forwardRef(function FieldLabel2(componentProps, forwardedRef) {
9801 const {
9802 render: render4,
9803 className,
9804 style,
9805 id: idProp,
9806 nativeLabel = true,
9807 ...elementProps
9808 } = componentProps;
9809 const fieldRootContext = useFieldRootContext(false);
9810 const fieldItemContext = useFieldItemContext();
9811 const {
9812 labelId
9813 } = useLabelableContext();
9814 const state = {
9815 ...fieldRootContext.state,
9816 disabled: fieldRootContext.disabled || fieldItemContext.disabled
9817 };
9818 const labelRef = React56.useRef(null);
9819 const labelProps = useLabel({
9820 id: labelId ?? idProp,
9821 native: nativeLabel
9822 });
9823 if (true) {
9824 React56.useEffect(() => {
9825 if (!labelRef.current) {
9826 return;
9827 }
9828 const isLabelTag = labelRef.current.tagName === "LABEL";
9829 if (nativeLabel) {
9830 if (!isLabelTag) {
9831 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
9832 const message2 = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. Rendering a non-<label> disables native label association, so `htmlFor` will not work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`.";
9833 error(`${message2}${ownerStackMessage}`);
9834 }
9835 } else if (isLabelTag) {
9836 const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
9837 const message2 = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the `render` prop, or set `nativeLabel` to `true`.";
9838 error(`${message2}${ownerStackMessage}`);
9839 }
9840 }, [nativeLabel]);
9841 }
9842 const element = useRenderElement("label", componentProps, {
9843 ref: [forwardedRef, labelRef],
9844 state,
9845 props: [labelProps, elementProps],
9846 stateAttributesMapping: fieldValidityMapping
9847 });
9848 return element;
9849 });
9850 if (true) FieldLabel.displayName = "FieldLabel";
9851
9852 // node_modules/@base-ui/react/field/error/FieldError.mjs
9853 var React57 = __toESM(require_react(), 1);
9854 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
9855 var stateAttributesMapping2 = {
9856 ...fieldValidityMapping,
9857 ...transitionStatusMapping
9858 };
9859 var FieldError = /* @__PURE__ */ React57.forwardRef(function FieldError2(componentProps, forwardedRef) {
9860 const {
9861 render: render4,
9862 id: idProp,
9863 className,
9864 match: match2,
9865 style,
9866 ...elementProps
9867 } = componentProps;
9868 const id = useBaseUiId(idProp);
9869 const {
9870 validityData,
9871 state: fieldState,
9872 name
9873 } = useFieldRootContext(false);
9874 const {
9875 setMessageIds
9876 } = useLabelableContext();
9877 const {
9878 errors
9879 } = useFormContext();
9880 const formError = name && Object.hasOwn(errors, name) ? errors[name] : null;
9881 const hasFormError = !!(Array.isArray(formError) ? formError.length : formError);
9882 const hasSpecificMatch = typeof match2 === "string";
9883 let rendered = false;
9884 if (match2 === true) {
9885 rendered = true;
9886 } else if (fieldState.disabled) {
9887 rendered = false;
9888 } else if (hasSpecificMatch) {
9889 rendered = Boolean(validityData.state[match2]);
9890 } else {
9891 rendered = hasFormError || validityData.state.valid === false;
9892 }
9893 const {
9894 mounted,
9895 transitionStatus,
9896 setMounted
9897 } = useTransitionStatus(rendered);
9898 useIsoLayoutEffect(() => {
9899 if (!rendered || !id) {
9900 return void 0;
9901 }
9902 setMessageIds((v2) => v2.concat(id));
9903 return () => {
9904 setMessageIds((v2) => v2.filter((item) => item !== id));
9905 };
9906 }, [rendered, id, setMessageIds]);
9907 const errorRef = React57.useRef(null);
9908 const [lastRenderedMessage, setLastRenderedMessage] = React57.useState(null);
9909 const [lastRenderedMessageKey, setLastRenderedMessageKey] = React57.useState(null);
9910 let error2 = validityData.error;
9911 if (!hasSpecificMatch && hasFormError) {
9912 error2 = formError;
9913 } else if (validityData.errors.length > 1) {
9914 error2 = validityData.errors;
9915 }
9916 let errorMessage = error2;
9917 if (Array.isArray(error2)) {
9918 errorMessage = error2.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", {
9919 children: error2.map((message2) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", {
9920 children: message2
9921 }, message2))
9922 }) : error2[0];
9923 }
9924 const errorKey = Array.isArray(error2) ? JSON.stringify(error2) : error2;
9925 if (rendered && errorKey !== lastRenderedMessageKey) {
9926 setLastRenderedMessageKey(errorKey);
9927 setLastRenderedMessage(errorMessage);
9928 }
9929 useOpenChangeComplete({
9930 open: rendered,
9931 ref: errorRef,
9932 onComplete() {
9933 if (!rendered) {
9934 setMounted(false);
9935 }
9936 }
9937 });
9938 const state = {
9939 ...fieldState,
9940 transitionStatus
9941 };
9942 const element = useRenderElement("div", componentProps, {
9943 ref: [forwardedRef, errorRef],
9944 state,
9945 props: [{
9946 id,
9947 children: rendered ? errorMessage : lastRenderedMessage
9948 }, elementProps],
9949 stateAttributesMapping: stateAttributesMapping2,
9950 enabled: mounted
9951 });
9952 if (!mounted) {
9953 return null;
9954 }
9955 return element;
9956 });
9957 if (true) FieldError.displayName = "FieldError";
9958
9959 // node_modules/@base-ui/react/field/description/FieldDescription.mjs
9960 var React58 = __toESM(require_react(), 1);
9961 var FieldDescription = /* @__PURE__ */ React58.forwardRef(function FieldDescription2(componentProps, forwardedRef) {
9962 const {
9963 render: render4,
9964 id: idProp,
9965 className,
9966 style,
9967 ...elementProps
9968 } = componentProps;
9969 const id = useBaseUiId(idProp);
9970 const fieldRootContext = useFieldRootContext(false);
9971 const fieldItemContext = useFieldItemContext();
9972 const {
9973 setMessageIds
9974 } = useLabelableContext();
9975 const state = {
9976 ...fieldRootContext.state,
9977 disabled: fieldRootContext.disabled || fieldItemContext.disabled
9978 };
9979 useIsoLayoutEffect(() => {
9980 if (!id) {
9981 return void 0;
9982 }
9983 setMessageIds((v2) => v2.concat(id));
9984 return () => {
9985 setMessageIds((v2) => v2.filter((item) => item !== id));
9986 };
9987 }, [id, setMessageIds]);
9988 const element = useRenderElement("p", componentProps, {
9989 ref: forwardedRef,
9990 state,
9991 props: [{
9992 id
9993 }, elementProps],
9994 stateAttributesMapping: fieldValidityMapping
9995 });
9996 return element;
9997 });
9998 if (true) FieldDescription.displayName = "FieldDescription";
9999
10000 // node_modules/@base-ui/react/field/control/FieldControl.mjs
10001 var React59 = __toESM(require_react(), 1);
10002 var FieldControl = /* @__PURE__ */ React59.forwardRef(function FieldControl2(componentProps, forwardedRef) {
10003 const {
10004 render: render4,
10005 className,
10006 id: idProp,
10007 name: nameProp,
10008 value: valueProp,
10009 disabled: disabledProp = false,
10010 onValueChange,
10011 defaultValue,
10012 autoFocus = false,
10013 style,
10014 ...elementProps
10015 } = componentProps;
10016 const {
10017 state: fieldState,
10018 name: fieldName,
10019 disabled: fieldDisabled,
10020 setTouched,
10021 setDirty,
10022 validityData,
10023 setFocused,
10024 setFilled,
10025 validationMode,
10026 validation
10027 } = useFieldRootContext();
10028 const {
10029 clearErrors,
10030 elementRef: formElementRef,
10031 submitCountRef
10032 } = useFormContext();
10033 const disabled2 = fieldDisabled || disabledProp;
10034 const name = fieldName ?? nameProp;
10035 const state = {
10036 ...fieldState,
10037 disabled: disabled2
10038 };
10039 const {
10040 labelId
10041 } = useLabelableContext();
10042 const id = useLabelableId({
10043 id: idProp
10044 });
10045 const [valueUnwrapped] = useControlled({
10046 controlled: valueProp,
10047 default: defaultValue,
10048 name: "FieldControl",
10049 state: "value"
10050 });
10051 const isControlled = valueProp !== void 0;
10052 const value = isControlled ? valueUnwrapped : void 0;
10053 const serializedValue = value == null ? void 0 : String(value);
10054 const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value);
10055 useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled2, nameProp);
10056 useIsoLayoutEffect(() => {
10057 const currentValue = serializedValue ?? validation.inputRef.current?.value;
10058 if (currentValue !== void 0) {
10059 setFilled(currentValue !== "");
10060 }
10061 }, [serializedValue, validation.inputRef, setFilled]);
10062 useValueChanged(serializedValue, () => {
10063 if (serializedValue === void 0) {
10064 return;
10065 }
10066 clearErrors(name);
10067 setDirty(serializedValue !== (validityData.initialValue ?? ""));
10068 validation.change(serializedValue);
10069 });
10070 const inputRef = React59.useRef(null);
10071 const enterValidationTimeout = useTimeout();
10072 useIsoLayoutEffect(() => {
10073 if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) {
10074 setFocused(true);
10075 }
10076 }, [autoFocus, setFocused]);
10077 const element = useRenderElement("input", componentProps, {
10078 ref: [forwardedRef, inputRef],
10079 state,
10080 props: [{
10081 id,
10082 disabled: disabled2,
10083 name,
10084 ref: validation.inputRef,
10085 "aria-labelledby": labelId,
10086 autoFocus,
10087 ...isControlled ? {
10088 value
10089 } : {
10090 defaultValue
10091 },
10092 onChange(event) {
10093 const inputValue = event.currentTarget.value;
10094 const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent);
10095 onValueChange?.(inputValue, details);
10096 if (isControlled) {
10097 return;
10098 }
10099 setDirty(inputValue !== (validityData.initialValue ?? ""));
10100 setFilled(inputValue !== "");
10101 if (!event.nativeEvent.defaultPrevented && !details.isCanceled) {
10102 clearErrors(name);
10103 validation.change(inputValue);
10104 }
10105 },
10106 onFocus() {
10107 setFocused(true);
10108 },
10109 onBlur(event) {
10110 setTouched(true);
10111 setFocused(false);
10112 if (validationMode === "onBlur") {
10113 const inputValue = event.currentTarget.value;
10114 validation.commit(inputValue);
10115 if (isControlled) {
10116 queueMicrotask(() => {
10117 const nextValue = validation.inputRef.current?.value;
10118 if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) {
10119 validation.commit(nextValue);
10120 }
10121 });
10122 }
10123 }
10124 },
10125 onKeyDown(event) {
10126 if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") {
10127 setTouched(true);
10128 const value2 = event.currentTarget.value;
10129 const form = event.currentTarget.form;
10130 if (form && form === formElementRef.current && !event.defaultPrevented) {
10131 const input = event.currentTarget;
10132 const submitCount = submitCountRef.current;
10133 enterValidationTimeout.start(0, () => {
10134 if (submitCountRef.current === submitCount) {
10135 validation.commit(input.value);
10136 }
10137 });
10138 } else {
10139 validation.commit(value2);
10140 }
10141 }
10142 }
10143 }, elementProps, (props) => validation.getValidationProps(disabled2, props)],
10144 stateAttributesMapping: fieldValidityMapping
10145 });
10146 return element;
10147 });
10148 if (true) FieldControl.displayName = "FieldControl";
10149
10150 // node_modules/@base-ui/react/field/validity/FieldValidity.mjs
10151 var React60 = __toESM(require_react(), 1);
10152 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
10153 var FieldValidity = function FieldValidity2(props) {
10154 const {
10155 children
10156 } = props;
10157 const {
10158 validityData,
10159 invalid: invalid2
10160 } = useFieldRootContext(false);
10161 const combinedFieldValidityData = React60.useMemo(() => getCombinedFieldValidityData(validityData, invalid2), [validityData, invalid2]);
10162 const isInvalid = combinedFieldValidityData.state.valid === false;
10163 const {
10164 transitionStatus
10165 } = useTransitionStatus(isInvalid);
10166 const fieldValidityState = React60.useMemo(() => {
10167 return {
10168 ...combinedFieldValidityData,
10169 validity: combinedFieldValidityData.state,
10170 transitionStatus
10171 };
10172 }, [combinedFieldValidityData, transitionStatus]);
10173 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(React60.Fragment, {
10174 children: children(fieldValidityState)
10175 });
10176 };
10177 if (true) FieldValidity.displayName = "FieldValidity";
10178
10179 // node_modules/@base-ui/react/field/item/FieldItem.mjs
10180 var React61 = __toESM(require_react(), 1);
10181 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
10182 var FieldItem = /* @__PURE__ */ React61.forwardRef(function FieldItem2(componentProps, forwardedRef) {
10183 const {
10184 render: render4,
10185 className,
10186 style,
10187 disabled: disabledProp = false,
10188 ...elementProps
10189 } = componentProps;
10190 const {
10191 state: fieldState,
10192 disabled: rootDisabled
10193 } = useFieldRootContext(false);
10194 const disabled2 = rootDisabled || disabledProp;
10195 const state = {
10196 ...fieldState,
10197 disabled: disabled2
10198 };
10199 const fieldItemContext = React61.useMemo(() => ({
10200 disabled: disabled2
10201 }), [disabled2]);
10202 const element = useRenderElement("div", componentProps, {
10203 ref: forwardedRef,
10204 state,
10205 props: elementProps,
10206 stateAttributesMapping: fieldValidityMapping
10207 });
10208 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LabelableProvider, {
10209 children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FieldItemContext.Provider, {
10210 value: fieldItemContext,
10211 children: element
10212 })
10213 });
10214 });
10215 if (true) FieldItem.displayName = "FieldItem";
10216
10217 // node_modules/@base-ui/react/input/Input.mjs
10218 var React62 = __toESM(require_react(), 1);
10219 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
10220 var Input = /* @__PURE__ */ React62.forwardRef(function Input2(props, forwardedRef) {
10221 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(index_parts_exports2.Control, {
10222 ref: forwardedRef,
10223 ...props
10224 });
10225 });
10226 if (true) Input.displayName = "Input";
10227
10228 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs
10229 var React63 = __toESM(require_react(), 1);
10230 var ReactDOM7 = __toESM(require_react_dom(), 1);
10231 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
10232 var FloatingPortalLite = /* @__PURE__ */ React63.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) {
10233 const {
10234 children,
10235 container,
10236 className,
10237 render: render4,
10238 style,
10239 ...elementProps
10240 } = componentProps;
10241 const {
10242 node: portalNode,
10243 subtree: portalSubtree
10244 } = useFloatingPortalNode({
10245 container,
10246 ref: forwardedRef,
10247 componentProps,
10248 elementProps
10249 });
10250 if (!portalSubtree && !portalNode) {
10251 return null;
10252 }
10253 return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(React63.Fragment, {
10254 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)]
10255 });
10256 });
10257 if (true) FloatingPortalLite.displayName = "FloatingPortalLite";
10258
10259 // node_modules/@base-ui/react/tooltip/index.parts.mjs
10260 var index_parts_exports3 = {};
10261 __export(index_parts_exports3, {
10262 Arrow: () => TooltipArrow,
10263 Handle: () => TooltipHandle,
10264 Popup: () => TooltipPopup,
10265 Portal: () => TooltipPortal,
10266 Positioner: () => TooltipPositioner,
10267 Provider: () => TooltipProvider,
10268 Root: () => TooltipRoot,
10269 Trigger: () => TooltipTrigger,
10270 Viewport: () => TooltipViewport,
10271 createHandle: () => createTooltipHandle
10272 });
10273
10274 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
10275 var React66 = __toESM(require_react(), 1);
10276
10277 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs
10278 var React64 = __toESM(require_react(), 1);
10279 var TooltipRootContext = /* @__PURE__ */ React64.createContext(void 0);
10280 if (true) TooltipRootContext.displayName = "TooltipRootContext";
10281 function useTooltipRootContext(optional) {
10282 const context = React64.useContext(TooltipRootContext);
10283 if (context === void 0 && !optional) {
10284 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72));
10285 }
10286 return context;
10287 }
10288
10289 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs
10290 var React65 = __toESM(require_react(), 1);
10291 var selectors2 = {
10292 ...popupStoreSelectors,
10293 disabled: (state) => state.disabled,
10294 instantType: (state) => state.instantType,
10295 isInstantPhase: (state) => state.isInstantPhase,
10296 trackCursorAxis: (state) => state.trackCursorAxis,
10297 disableHoverablePopup: (state) => state.disableHoverablePopup,
10298 lastOpenChangeReason: (state) => state.openChangeReason,
10299 closeOnClick: (state) => state.closeOnClick,
10300 closeDelay: (state) => state.closeDelay,
10301 adaptiveOrigin: (state) => state.adaptiveOrigin
10302 };
10303 var TooltipStore = class extends ReactStore {
10304 constructor(initialState, floatingId, nested) {
10305 const triggerElements = new PopupTriggerMap();
10306 super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2);
10307 }
10308 setOpen = (nextOpen, eventDetails) => {
10309 applyPopupOpenChange(this, nextOpen, eventDetails, {
10310 extraState: {
10311 openChangeReason: eventDetails.reason
10312 }
10313 });
10314 };
10315 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change.
10316 cancelPendingOpen(event) {
10317 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event));
10318 }
10319 };
10320 function createNullTooltipStore() {
10321 const triggerElements = new PopupTriggerMap();
10322 const store = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2);
10323 return Object.assign(store, {
10324 setOpen: NOOP,
10325 cancelPendingOpen: NOOP
10326 });
10327 }
10328 function createInitialState(initialState, triggerElements, floatingId, nested = false) {
10329 const state = {
10330 ...createInitialPopupStoreState(triggerElements, floatingId, nested),
10331 disabled: false,
10332 instantType: void 0,
10333 isInstantPhase: false,
10334 trackCursorAxis: "none",
10335 disableHoverablePopup: false,
10336 openChangeReason: null,
10337 closeOnClick: true,
10338 closeDelay: 0,
10339 adaptiveOrigin: void 0,
10340 ...initialState
10341 };
10342 return state;
10343 }
10344 function createInitialContext(triggerElements) {
10345 return {
10346 popupRef: /* @__PURE__ */ React65.createRef(),
10347 onOpenChange: void 0,
10348 onOpenChangeComplete: void 0,
10349 triggerElements
10350 };
10351 }
10352
10353 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs
10354 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
10355 var TooltipRoot = fastComponent(function TooltipRoot2(props) {
10356 const {
10357 disabled: disabled2 = false,
10358 defaultOpen = false,
10359 open: openProp,
10360 disableHoverablePopup = false,
10361 trackCursorAxis = "none",
10362 actionsRef,
10363 onOpenChange,
10364 onOpenChangeComplete,
10365 handle,
10366 triggerId: triggerIdProp,
10367 defaultTriggerId: defaultTriggerIdProp = null,
10368 children
10369 } = props;
10370 const store = usePopupRootStore((floatingId, nested) => new TooltipStore({
10371 open: defaultOpen,
10372 openProp,
10373 activeTriggerId: defaultTriggerIdProp,
10374 triggerIdProp
10375 }, floatingId, nested));
10376 store.useControlledProp("openProp", openProp);
10377 store.useControlledProp("triggerIdProp", triggerIdProp);
10378 store.useContextCallback("onOpenChange", onOpenChange);
10379 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
10380 const openState = store.useState("open");
10381 const open3 = !disabled2 && openState;
10382 const activeTriggerId = store.useState("activeTriggerId");
10383 const mounted = store.useState("mounted");
10384 const payload = store.useState("payload");
10385 store.useSyncedValues({
10386 trackCursorAxis,
10387 disableHoverablePopup,
10388 disabled: disabled2
10389 });
10390 useImplicitActiveTrigger(store, {
10391 closeOnActiveTriggerUnmount: true
10392 });
10393 const {
10394 forceUnmount,
10395 transitionStatus
10396 } = useOpenStateTransitions(open3, store);
10397 const isInstantPhase = store.useState("isInstantPhase");
10398 const instantType = store.useState("instantType");
10399 const lastOpenChangeReason = store.useState("lastOpenChangeReason");
10400 const previousInstantTypeRef = React66.useRef(null);
10401 useIsoLayoutEffect(() => {
10402 if (openState && disabled2) {
10403 store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled));
10404 }
10405 }, [openState, disabled2, store]);
10406 useIsoLayoutEffect(() => {
10407 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) {
10408 if (instantType !== "delay") {
10409 previousInstantTypeRef.current = instantType;
10410 }
10411 store.set("instantType", "delay");
10412 } else if (previousInstantTypeRef.current !== null) {
10413 store.set("instantType", previousInstantTypeRef.current);
10414 previousInstantTypeRef.current = null;
10415 }
10416 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]);
10417 useIsoLayoutEffect(() => {
10418 if (open3) {
10419 if (activeTriggerId == null) {
10420 store.set("payload", void 0);
10421 }
10422 }
10423 }, [store, activeTriggerId, open3]);
10424 React66.useImperativeHandle(actionsRef, () => ({
10425 unmount: forceUnmount,
10426 close: () => store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction))
10427 }), [forceUnmount, store]);
10428 const shouldRenderInteractions = open3 || mounted || !disabled2 && trackCursorAxis !== "none";
10429 return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(TooltipRootContext.Provider, {
10430 value: store,
10431 children: [handle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PopupHandleAttachment, {
10432 handle,
10433 store
10434 }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipInteractions, {
10435 store,
10436 disabled: disabled2,
10437 trackCursorAxis
10438 }), typeof children === "function" ? children({
10439 payload
10440 }) : children]
10441 });
10442 });
10443 if (true) TooltipRoot.displayName = "TooltipRoot";
10444 function TooltipInteractions({
10445 store,
10446 disabled: disabled2,
10447 trackCursorAxis
10448 }) {
10449 const floatingRootContext = store.useState("floatingRootContext");
10450 const dismiss = useDismiss(floatingRootContext, {
10451 enabled: !disabled2,
10452 referencePress: () => store.select("closeOnClick")
10453 });
10454 const clientPoint = useClientPoint(floatingRootContext, {
10455 enabled: !disabled2 && trackCursorAxis !== "none",
10456 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis
10457 });
10458 const triggerProps = React66.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]);
10459 usePopupInteractionProps(store, {
10460 activeTriggerProps: triggerProps,
10461 inactiveTriggerProps: triggerProps,
10462 popupProps: dismiss.floating ?? EMPTY_OBJECT
10463 });
10464 return null;
10465 }
10466
10467 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
10468 var React68 = __toESM(require_react(), 1);
10469
10470 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs
10471 var React67 = __toESM(require_react(), 1);
10472 var TooltipProviderContext = /* @__PURE__ */ React67.createContext(void 0);
10473 if (true) TooltipProviderContext.displayName = "TooltipProviderContext";
10474 function useTooltipProviderContext() {
10475 return React67.useContext(TooltipProviderContext);
10476 }
10477
10478 // node_modules/@base-ui/react/tooltip/utils/constants.mjs
10479 var OPEN_DELAY = 600;
10480
10481 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs
10482 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger";
10483 function getTargetElement(event) {
10484 if ("composedPath" in event) {
10485 const path = event.composedPath();
10486 for (let i = 0; i < path.length; i += 1) {
10487 const element = path[i];
10488 if (isElement(element)) {
10489 return element;
10490 }
10491 }
10492 }
10493 const target = event.target;
10494 if (isElement(target)) {
10495 return target;
10496 }
10497 return null;
10498 }
10499 function closestEnabledTooltipTrigger(element) {
10500 let current = element;
10501 while (current) {
10502 const trigger = current.closest(`[${TOOLTIP_TRIGGER_IDENTIFIER}]`);
10503 if (trigger) {
10504 return trigger;
10505 }
10506 const root = current.getRootNode();
10507 current = "host" in root && isElement(root.host) ? root.host : null;
10508 }
10509 return null;
10510 }
10511 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) {
10512 const {
10513 render: render4,
10514 className,
10515 style,
10516 handle,
10517 payload,
10518 disabled: disabledProp,
10519 delay,
10520 closeOnClick = true,
10521 closeDelay,
10522 id: idProp,
10523 ...elementProps
10524 } = componentProps;
10525 const rootContext = useTooltipRootContext(true);
10526 const handleStore = usePopupHandleStore(handle);
10527 const store = handleStore ?? rootContext;
10528 if (!store) {
10529 throw new Error(true ? "Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle." : formatErrorMessage_default(82));
10530 }
10531 const thisTriggerId = useBaseUiId(idProp);
10532 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
10533 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
10534 const floatingRootContext = store.useState("floatingRootContext");
10535 const triggerElementRef = React68.useRef(null);
10536 const closeDelayWithDefault = closeDelay ?? 0;
10537 const {
10538 registerTrigger,
10539 isMountedByThisTrigger
10540 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
10541 payload,
10542 closeOnClick,
10543 closeDelay: closeDelayWithDefault
10544 });
10545 const providerDelay = useTooltipProviderContext();
10546 const {
10547 activeIdRef,
10548 delayRef,
10549 isInstantPhase,
10550 hasProvider
10551 } = useDelayGroup(floatingRootContext, {
10552 open: isOpenedByThisTrigger
10553 });
10554 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext);
10555 store.useSyncedValue("isInstantPhase", isInstantPhase);
10556 const rootDisabled = store.useState("disabled");
10557 const disabled2 = disabledProp ?? rootDisabled;
10558 const disabledRef = useValueAsRef(disabled2);
10559 const trackCursorAxis = store.useState("trackCursorAxis");
10560 const disableHoverablePopup = store.useState("disableHoverablePopup");
10561 const isNestedTriggerHoveredRef = React68.useRef(false);
10562 const nestedTriggerOpenTimeout = useTimeout();
10563 const pointerTypeRef = React68.useRef(void 0);
10564 function getOpenDelay() {
10565 if (hasProvider && activeIdRef.current != null) {
10566 return 0;
10567 }
10568 return delay ?? providerDelay ?? OPEN_DELAY;
10569 }
10570 function isEnabledNestedTriggerTarget(target) {
10571 const triggerEl = triggerElementRef.current;
10572 if (!triggerEl || !target) {
10573 return false;
10574 }
10575 const nearestTrigger = closestEnabledTooltipTrigger(target);
10576 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger);
10577 }
10578 function detectNestedTriggerHover(target) {
10579 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target);
10580 isNestedTriggerHoveredRef.current = nestedTriggerHovered;
10581 if (nestedTriggerHovered) {
10582 hoverInteraction.openChangeTimeout.clear();
10583 hoverInteraction.restTimeout.clear();
10584 hoverInteraction.restTimeoutPending = false;
10585 nestedTriggerOpenTimeout.clear();
10586 }
10587 return nestedTriggerHovered;
10588 }
10589 const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
10590 enabled: !disabled2,
10591 mouseOnly: true,
10592 move: false,
10593 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null,
10594 restMs: getOpenDelay,
10595 delay() {
10596 if (closeDelay == null && hasProvider) {
10597 return {
10598 close: getDelay(delayRef.current, "close")
10599 };
10600 }
10601 return {
10602 close: closeDelayWithDefault
10603 };
10604 },
10605 triggerElementRef,
10606 isActiveTrigger: isTriggerActive,
10607 isClosing: () => store.select("transitionStatus") === "ending",
10608 shouldOpen() {
10609 return !isNestedTriggerHoveredRef.current;
10610 }
10611 });
10612 const focusProps = useFocus(floatingRootContext, {
10613 enabled: !disabled2
10614 }).reference;
10615 const handleNestedTriggerHover = (event) => {
10616 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current;
10617 const target = getTargetElement(event);
10618 const nestedTriggerHovered = detectNestedTriggerHover(target);
10619 const triggerEl = triggerElementRef.current;
10620 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target);
10621 if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) {
10622 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event));
10623 return;
10624 }
10625 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences.
10626 isMouseLikePointerType(pointerTypeRef.current)) {
10627 const open3 = () => {
10628 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) {
10629 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl));
10630 }
10631 };
10632 const openDelay = getOpenDelay();
10633 if (openDelay === 0) {
10634 nestedTriggerOpenTimeout.clear();
10635 open3();
10636 } else {
10637 nestedTriggerOpenTimeout.start(openDelay, open3);
10638 }
10639 }
10640 };
10641 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
10642 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none";
10643 const state = {
10644 open: isOpenedByThisTrigger
10645 };
10646 const element = useRenderElement("button", componentProps, {
10647 state,
10648 ref: [forwardedRef, registerTrigger, triggerElementRef],
10649 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, {
10650 onMouseOver(event) {
10651 handleNestedTriggerHover(event.nativeEvent);
10652 },
10653 onFocus(event) {
10654 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) {
10655 event.preventBaseUIHandler();
10656 }
10657 },
10658 onMouseLeave() {
10659 isNestedTriggerHoveredRef.current = false;
10660 nestedTriggerOpenTimeout.clear();
10661 pointerTypeRef.current = void 0;
10662 },
10663 onPointerEnter(event) {
10664 pointerTypeRef.current = event.pointerType;
10665 },
10666 onPointerDown(event) {
10667 pointerTypeRef.current = event.pointerType;
10668 store.set("closeOnClick", closeOnClick);
10669 if (closeOnClick && !store.select("open")) {
10670 store.cancelPendingOpen(event.nativeEvent);
10671 }
10672 },
10673 onClick(event) {
10674 if (closeOnClick && !store.select("open")) {
10675 store.cancelPendingOpen(event.nativeEvent);
10676 }
10677 },
10678 id: thisTriggerId,
10679 [triggerDisabled]: disabled2 ? "" : void 0,
10680 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : ""
10681 }, elementProps],
10682 stateAttributesMapping: triggerOpenStateMapping2
10683 });
10684 return element;
10685 });
10686 if (true) TooltipTrigger.displayName = "TooltipTrigger";
10687
10688 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
10689 var React70 = __toESM(require_react(), 1);
10690
10691 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs
10692 var React69 = __toESM(require_react(), 1);
10693 var TooltipPortalContext = /* @__PURE__ */ React69.createContext(void 0);
10694 if (true) TooltipPortalContext.displayName = "TooltipPortalContext";
10695 function useTooltipPortalContext() {
10696 const value = React69.useContext(TooltipPortalContext);
10697 if (value === void 0) {
10698 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70));
10699 }
10700 return value;
10701 }
10702
10703 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs
10704 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
10705 var TooltipPortal = /* @__PURE__ */ React70.forwardRef(function TooltipPortal2(props, forwardedRef) {
10706 const {
10707 keepMounted = false,
10708 ...portalProps
10709 } = props;
10710 const store = useTooltipRootContext();
10711 const mounted = store.useState("mounted");
10712 const shouldRender = mounted || keepMounted;
10713 if (!shouldRender) {
10714 return null;
10715 }
10716 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipPortalContext.Provider, {
10717 value: keepMounted,
10718 children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FloatingPortalLite, {
10719 ref: forwardedRef,
10720 ...portalProps
10721 })
10722 });
10723 });
10724 if (true) TooltipPortal.displayName = "TooltipPortal";
10725
10726 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
10727 var React72 = __toESM(require_react(), 1);
10728
10729 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs
10730 var React71 = __toESM(require_react(), 1);
10731 var TooltipPositionerContext = /* @__PURE__ */ React71.createContext(void 0);
10732 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext";
10733 function useTooltipPositionerContext() {
10734 const context = React71.useContext(TooltipPositionerContext);
10735 if (context === void 0) {
10736 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71));
10737 }
10738 return context;
10739 }
10740
10741 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs
10742 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
10743 var TooltipPositioner = /* @__PURE__ */ React72.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) {
10744 const {
10745 render: render4,
10746 className,
10747 anchor,
10748 positionMethod = "absolute",
10749 side = "top",
10750 align = "center",
10751 sideOffset = 0,
10752 alignOffset = 0,
10753 collisionBoundary = "clipping-ancestors",
10754 collisionPadding = 5,
10755 arrowPadding = 5,
10756 sticky = false,
10757 disableAnchorTracking = false,
10758 collisionAvoidance = POPUP_COLLISION_AVOIDANCE,
10759 style,
10760 ...elementProps
10761 } = componentProps;
10762 const store = useTooltipRootContext();
10763 const keepMounted = useTooltipPortalContext();
10764 const open3 = store.useState("open");
10765 const mounted = store.useState("mounted");
10766 const trackCursorAxis = store.useState("trackCursorAxis");
10767 const disableHoverablePopup = store.useState("disableHoverablePopup");
10768 const floatingRootContext = store.useState("floatingRootContext");
10769 const instantType = store.useState("instantType");
10770 const transitionStatus = store.useState("transitionStatus");
10771 const adaptiveOrigin2 = store.useState("adaptiveOrigin");
10772 const positioning = useAnchorPositioning({
10773 anchor,
10774 positionMethod,
10775 floatingRootContext,
10776 mounted,
10777 side,
10778 sideOffset,
10779 align,
10780 alignOffset,
10781 collisionBoundary,
10782 collisionPadding,
10783 sticky,
10784 arrowPadding,
10785 disableAnchorTracking,
10786 keepMounted,
10787 collisionAvoidance,
10788 adaptiveOrigin: adaptiveOrigin2
10789 });
10790 const state = React72.useMemo(() => ({
10791 open: open3,
10792 side: positioning.side,
10793 align: positioning.align,
10794 anchorHidden: positioning.anchorHidden,
10795 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType
10796 }), [open3, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]);
10797 const element = usePositioner(componentProps, state, {
10798 styles: positioning.positionerStyles,
10799 transitionStatus,
10800 props: elementProps,
10801 refs: [forwardedRef, store.useStateSetter("positionerElement")],
10802 hidden: !mounted,
10803 inert: !open3 || trackCursorAxis === "both" || disableHoverablePopup
10804 });
10805 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TooltipPositionerContext.Provider, {
10806 value: positioning,
10807 children: element
10808 });
10809 });
10810 if (true) TooltipPositioner.displayName = "TooltipPositioner";
10811
10812 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs
10813 var React73 = __toESM(require_react(), 1);
10814 var TooltipPopup = /* @__PURE__ */ React73.forwardRef(function TooltipPopup2(componentProps, forwardedRef) {
10815 const {
10816 render: render4,
10817 className,
10818 style,
10819 ...elementProps
10820 } = componentProps;
10821 const store = useTooltipRootContext();
10822 const {
10823 side,
10824 align
10825 } = useTooltipPositionerContext();
10826 const open3 = store.useState("open");
10827 const instantType = store.useState("instantType");
10828 const transitionStatus = store.useState("transitionStatus");
10829 const popupProps = store.useState("popupProps");
10830 const floatingContext = store.useState("floatingRootContext");
10831 const disabled2 = store.useState("disabled");
10832 const closeDelay = store.useState("closeDelay");
10833 useOpenChangeComplete({
10834 open: open3,
10835 ref: store.context.popupRef,
10836 onComplete() {
10837 if (open3) {
10838 store.context.onOpenChangeComplete?.(true);
10839 }
10840 }
10841 });
10842 useHoverFloatingInteraction(floatingContext, {
10843 enabled: !disabled2,
10844 closeDelay
10845 });
10846 const setPopupElement = store.useStateSetter("popupElement");
10847 const state = {
10848 open: open3,
10849 side,
10850 align,
10851 instant: instantType,
10852 transitionStatus
10853 };
10854 const element = useRenderElement("div", componentProps, {
10855 state,
10856 ref: [forwardedRef, store.context.popupRef, setPopupElement],
10857 props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps],
10858 stateAttributesMapping: popupTransitionStateMapping
10859 });
10860 return element;
10861 });
10862 if (true) TooltipPopup.displayName = "TooltipPopup";
10863
10864 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs
10865 var React74 = __toESM(require_react(), 1);
10866 var TooltipArrow = /* @__PURE__ */ React74.forwardRef(function TooltipArrow2(componentProps, forwardedRef) {
10867 const {
10868 render: render4,
10869 className,
10870 style,
10871 ...elementProps
10872 } = componentProps;
10873 const store = useTooltipRootContext();
10874 const {
10875 arrowRef,
10876 side,
10877 align,
10878 arrowUncentered,
10879 arrowStyles
10880 } = useTooltipPositionerContext();
10881 const open3 = store.useState("open");
10882 const instantType = store.useState("instantType");
10883 const state = {
10884 open: open3,
10885 side,
10886 align,
10887 uncentered: arrowUncentered,
10888 instant: instantType
10889 };
10890 const element = useRenderElement("div", componentProps, {
10891 state,
10892 ref: [forwardedRef, arrowRef],
10893 props: [{
10894 style: arrowStyles,
10895 "aria-hidden": true
10896 }, elementProps],
10897 stateAttributesMapping: popupStateMapping
10898 });
10899 return element;
10900 });
10901 if (true) TooltipArrow.displayName = "TooltipArrow";
10902
10903 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs
10904 var React75 = __toESM(require_react(), 1);
10905 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
10906 var TooltipProvider = function TooltipProvider2(props) {
10907 const {
10908 delay,
10909 closeDelay,
10910 timeout = 400
10911 } = props;
10912 const delayValue = React75.useMemo(() => ({
10913 open: delay,
10914 close: closeDelay
10915 }), [delay, closeDelay]);
10916 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipProviderContext.Provider, {
10917 value: delay,
10918 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FloatingDelayGroup, {
10919 delay: delayValue,
10920 timeoutMs: timeout,
10921 children: props.children
10922 })
10923 });
10924 };
10925 if (true) TooltipProvider.displayName = "TooltipProvider";
10926
10927 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs
10928 var React76 = __toESM(require_react(), 1);
10929 var TooltipViewport = /* @__PURE__ */ React76.forwardRef(function TooltipViewport2(componentProps, forwardedRef) {
10930 const {
10931 render: render4,
10932 className,
10933 style,
10934 children,
10935 ...elementProps
10936 } = componentProps;
10937 const store = useTooltipRootContext();
10938 const positioner = useTooltipPositionerContext();
10939 const instantType = store.useState("instantType");
10940 const {
10941 children: childrenToRender,
10942 state: viewportState
10943 } = usePopupViewport({
10944 store,
10945 side: positioner.side,
10946 children
10947 });
10948 const state = {
10949 activationDirection: viewportState.activationDirection,
10950 transitioning: viewportState.transitioning,
10951 instant: instantType
10952 };
10953 return useRenderElement("div", componentProps, {
10954 state,
10955 ref: forwardedRef,
10956 props: [elementProps, {
10957 children: childrenToRender
10958 }],
10959 stateAttributesMapping: popupViewportStateMapping
10960 });
10961 });
10962 if (true) TooltipViewport.displayName = "TooltipViewport";
10963
10964 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs
10965 var TooltipHandle = class extends BasePopupHandle {
10966 constructor() {
10967 super(createNullTooltipStore(), "Tooltip");
10968 }
10969 /**
10970 * Opens the tooltip and associates it with the trigger with the given id.
10971 *
10972 * This method should only be called in an event handler or an effect (not during rendering).
10973 *
10974 * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching
10975 * `Tooltip.Trigger` with this handle passed as a prop.
10976 */
10977 open(triggerId) {
10978 this.openByTrigger(triggerId);
10979 }
10980 /**
10981 * Closes the tooltip.
10982 *
10983 * This method should only be called in an event handler or an effect (not during rendering).
10984 */
10985 close() {
10986 this.closePopup();
10987 }
10988 /**
10989 * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle.
10990 */
10991 get isOpen() {
10992 return this.attachedStore?.select("open") ?? false;
10993 }
10994 };
10995 function createTooltipHandle() {
10996 return new TooltipHandle();
10997 }
10998
10999 // node_modules/@base-ui/react/use-render/useRender.mjs
11000 function useRender(params) {
11001 return useRenderElement(params.defaultTagName ?? "div", params, params);
11002 }
11003
11004 // packages/ui/build-module/text/text.mjs
11005 var import_element10 = __toESM(require_element(), 1);
11006 var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
11007 function getRuntime() {
11008 const globalScope = globalThis;
11009 if (globalScope.__wpStyleRuntime) {
11010 return globalScope.__wpStyleRuntime;
11011 }
11012 globalScope.__wpStyleRuntime = {
11013 documents: /* @__PURE__ */ new Map(),
11014 styles: /* @__PURE__ */ new Map(),
11015 injectedStyles: /* @__PURE__ */ new WeakMap()
11016 };
11017 if (typeof document !== "undefined") {
11018 registerDocument(document);
11019 }
11020 return globalScope.__wpStyleRuntime;
11021 }
11022 function documentContainsStyleHash(targetDocument, hash) {
11023 if (!targetDocument.head) {
11024 return false;
11025 }
11026 for (const style of targetDocument.head.querySelectorAll(
11027 `style[${STYLE_HASH_ATTRIBUTE}]`
11028 )) {
11029 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
11030 return true;
11031 }
11032 }
11033 return false;
11034 }
11035 function injectStyle(targetDocument, hash, css) {
11036 if (!targetDocument.head) {
11037 return;
11038 }
11039 const runtime = getRuntime();
11040 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11041 if (!injectedStyles) {
11042 injectedStyles = /* @__PURE__ */ new Set();
11043 runtime.injectedStyles.set(targetDocument, injectedStyles);
11044 }
11045 if (injectedStyles.has(hash)) {
11046 return;
11047 }
11048 if (documentContainsStyleHash(targetDocument, hash)) {
11049 injectedStyles.add(hash);
11050 return;
11051 }
11052 const style = targetDocument.createElement("style");
11053 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
11054 style.appendChild(targetDocument.createTextNode(css));
11055 targetDocument.head.appendChild(style);
11056 injectedStyles.add(hash);
11057 }
11058 function registerDocument(targetDocument) {
11059 const runtime = getRuntime();
11060 runtime.documents.set(
11061 targetDocument,
11062 (runtime.documents.get(targetDocument) ?? 0) + 1
11063 );
11064 for (const [hash, css] of runtime.styles) {
11065 injectStyle(targetDocument, hash, css);
11066 }
11067 return () => {
11068 const count = runtime.documents.get(targetDocument);
11069 if (count === void 0) {
11070 return;
11071 }
11072 if (count <= 1) {
11073 runtime.documents.delete(targetDocument);
11074 return;
11075 }
11076 runtime.documents.set(targetDocument, count - 1);
11077 };
11078 }
11079 function registerStyle(hash, css) {
11080 const runtime = getRuntime();
11081 runtime.styles.set(hash, css);
11082 for (const targetDocument of runtime.documents.keys()) {
11083 injectStyle(targetDocument, hash, css);
11084 }
11085 }
11086 if (typeof process === "undefined" || true) {
11087 registerStyle("3167e7d116", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{text-wrap:pretty;margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
11088 }
11089 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" };
11090 if (typeof process === "undefined" || true) {
11091 registerStyle("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
11092 }
11093 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
11094 var Text = (0, import_element10.forwardRef)(function Text2({ variant = "body-md", render: render4, className, ...props }, ref) {
11095 const element = useRender({
11096 render: render4,
11097 defaultTagName: "span",
11098 ref,
11099 props: mergeProps(props, {
11100 className: clsx_default(
11101 style_default.text,
11102 global_css_defense_default.heading,
11103 global_css_defense_default.p,
11104 style_default[variant],
11105 className
11106 )
11107 })
11108 });
11109 return element;
11110 });
11111
11112 // packages/ui/build-module/badge/badge.mjs
11113 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
11114 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash";
11115 function getRuntime2() {
11116 const globalScope = globalThis;
11117 if (globalScope.__wpStyleRuntime) {
11118 return globalScope.__wpStyleRuntime;
11119 }
11120 globalScope.__wpStyleRuntime = {
11121 documents: /* @__PURE__ */ new Map(),
11122 styles: /* @__PURE__ */ new Map(),
11123 injectedStyles: /* @__PURE__ */ new WeakMap()
11124 };
11125 if (typeof document !== "undefined") {
11126 registerDocument2(document);
11127 }
11128 return globalScope.__wpStyleRuntime;
11129 }
11130 function documentContainsStyleHash2(targetDocument, hash) {
11131 if (!targetDocument.head) {
11132 return false;
11133 }
11134 for (const style of targetDocument.head.querySelectorAll(
11135 `style[${STYLE_HASH_ATTRIBUTE2}]`
11136 )) {
11137 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) {
11138 return true;
11139 }
11140 }
11141 return false;
11142 }
11143 function injectStyle2(targetDocument, hash, css) {
11144 if (!targetDocument.head) {
11145 return;
11146 }
11147 const runtime = getRuntime2();
11148 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11149 if (!injectedStyles) {
11150 injectedStyles = /* @__PURE__ */ new Set();
11151 runtime.injectedStyles.set(targetDocument, injectedStyles);
11152 }
11153 if (injectedStyles.has(hash)) {
11154 return;
11155 }
11156 if (documentContainsStyleHash2(targetDocument, hash)) {
11157 injectedStyles.add(hash);
11158 return;
11159 }
11160 const style = targetDocument.createElement("style");
11161 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash);
11162 style.appendChild(targetDocument.createTextNode(css));
11163 targetDocument.head.appendChild(style);
11164 injectedStyles.add(hash);
11165 }
11166 function registerDocument2(targetDocument) {
11167 const runtime = getRuntime2();
11168 runtime.documents.set(
11169 targetDocument,
11170 (runtime.documents.get(targetDocument) ?? 0) + 1
11171 );
11172 for (const [hash, css] of runtime.styles) {
11173 injectStyle2(targetDocument, hash, css);
11174 }
11175 return () => {
11176 const count = runtime.documents.get(targetDocument);
11177 if (count === void 0) {
11178 return;
11179 }
11180 if (count <= 1) {
11181 runtime.documents.delete(targetDocument);
11182 return;
11183 }
11184 runtime.documents.set(targetDocument, count - 1);
11185 };
11186 }
11187 function registerStyle2(hash, css) {
11188 const runtime = getRuntime2();
11189 runtime.styles.set(hash, css);
11190 for (const targetDocument of runtime.documents.keys()) {
11191 injectStyle2(targetDocument, hash, css);
11192 }
11193 }
11194 if (typeof process === "undefined" || true) {
11195 registerStyle2("40ea4a6382", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-background-surface-error,#fae5e1);color:var(--wpds-color-foreground-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-background-surface-warning,#fde6be);color:var(--wpds-color-foreground-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-background-surface-caution,#fee995);color:var(--wpds-color-foreground-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-background-surface-success,#c2f8ca);color:var(--wpds-color-foreground-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-background-surface-info,#deebfa);color:var(--wpds-color-foreground-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);padding-block:calc(var(--wpds-dimension-padding-xs, 4px) - var(--wpds-border-width-xs, 1px));padding-inline:calc(var(--wpds-dimension-padding-sm, 8px) - var(--wpds-border-width-xs, 1px))}}}");
11196 }
11197 var style_default2 = { "badge": "_96e6251aad1a6136__badge", "is-high-intent": "_99f7158cb520f750__is-high-intent", "is-medium-intent": "c20ebef2365bc8b7__is-medium-intent", "is-low-intent": "_365e1626c6202e52__is-low-intent", "is-stable-intent": "_33f8198127ddf4ef__is-stable-intent", "is-informational-intent": "_04c1aca8fc449412__is-informational-intent", "is-draft-intent": "_90726e69d495ec19__is-draft-intent", "is-none-intent": "_898f4a544993bd39__is-none-intent" };
11198 var Badge = (0, import_element11.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) {
11199 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11200 Text,
11201 {
11202 ref,
11203 className: clsx_default(
11204 style_default2.badge,
11205 style_default2[`is-${intent}-intent`],
11206 className
11207 ),
11208 ...props,
11209 variant: "body-sm"
11210 }
11211 );
11212 });
11213
11214 // packages/ui/build-module/tooltip/popup.mjs
11215 var import_element15 = __toESM(require_element(), 1);
11216
11217 // packages/ui/build-module/tooltip/portal.mjs
11218 var import_element12 = __toESM(require_element(), 1);
11219
11220 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs
11221 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash";
11222 function getRuntime3() {
11223 const globalScope = globalThis;
11224 if (globalScope.__wpStyleRuntime) {
11225 return globalScope.__wpStyleRuntime;
11226 }
11227 globalScope.__wpStyleRuntime = {
11228 documents: /* @__PURE__ */ new Map(),
11229 styles: /* @__PURE__ */ new Map(),
11230 injectedStyles: /* @__PURE__ */ new WeakMap()
11231 };
11232 if (typeof document !== "undefined") {
11233 registerDocument3(document);
11234 }
11235 return globalScope.__wpStyleRuntime;
11236 }
11237 function documentContainsStyleHash3(targetDocument, hash) {
11238 if (!targetDocument.head) {
11239 return false;
11240 }
11241 for (const style of targetDocument.head.querySelectorAll(
11242 `style[${STYLE_HASH_ATTRIBUTE3}]`
11243 )) {
11244 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) {
11245 return true;
11246 }
11247 }
11248 return false;
11249 }
11250 function injectStyle3(targetDocument, hash, css) {
11251 if (!targetDocument.head) {
11252 return;
11253 }
11254 const runtime = getRuntime3();
11255 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11256 if (!injectedStyles) {
11257 injectedStyles = /* @__PURE__ */ new Set();
11258 runtime.injectedStyles.set(targetDocument, injectedStyles);
11259 }
11260 if (injectedStyles.has(hash)) {
11261 return;
11262 }
11263 if (documentContainsStyleHash3(targetDocument, hash)) {
11264 injectedStyles.add(hash);
11265 return;
11266 }
11267 const style = targetDocument.createElement("style");
11268 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash);
11269 style.appendChild(targetDocument.createTextNode(css));
11270 targetDocument.head.appendChild(style);
11271 injectedStyles.add(hash);
11272 }
11273 function registerDocument3(targetDocument) {
11274 const runtime = getRuntime3();
11275 runtime.documents.set(
11276 targetDocument,
11277 (runtime.documents.get(targetDocument) ?? 0) + 1
11278 );
11279 for (const [hash, css] of runtime.styles) {
11280 injectStyle3(targetDocument, hash, css);
11281 }
11282 return () => {
11283 const count = runtime.documents.get(targetDocument);
11284 if (count === void 0) {
11285 return;
11286 }
11287 if (count <= 1) {
11288 runtime.documents.delete(targetDocument);
11289 return;
11290 }
11291 runtime.documents.set(targetDocument, count - 1);
11292 };
11293 }
11294 function registerStyle3(hash, css) {
11295 const runtime = getRuntime3();
11296 runtime.styles.set(hash, css);
11297 for (const targetDocument of runtime.documents.keys()) {
11298 injectStyle3(targetDocument, hash, css);
11299 }
11300 }
11301 if (typeof process === "undefined" || true) {
11302 registerStyle3("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}");
11303 }
11304 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" };
11305 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot";
11306 function resolveOwnerDocument() {
11307 return typeof document === "undefined" ? null : document;
11308 }
11309 function isInWordPressEnvironment() {
11310 let topWp;
11311 try {
11312 topWp = window.top?.wp;
11313 } catch {
11314 }
11315 const wp = topWp ?? window.wp;
11316 return typeof wp?.components === "object" && wp.components !== null;
11317 }
11318 var cachedSlot = null;
11319 function ensureSlotIsAccessible(element) {
11320 element.setAttribute("aria-hidden", "false");
11321 return element;
11322 }
11323 function createSlot(ownerDocument2) {
11324 const element = ownerDocument2.createElement("div");
11325 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, "");
11326 if (wp_compat_overlay_slot_default.slot) {
11327 element.classList.add(wp_compat_overlay_slot_default.slot);
11328 }
11329 ownerDocument2.body.appendChild(element);
11330 return element;
11331 }
11332 function getWpCompatOverlaySlot() {
11333 if (typeof window === "undefined") {
11334 return void 0;
11335 }
11336 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) {
11337 return void 0;
11338 }
11339 const ownerDocument2 = resolveOwnerDocument();
11340 if (!ownerDocument2 || !ownerDocument2.body) {
11341 return void 0;
11342 }
11343 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) {
11344 return ensureSlotIsAccessible(cachedSlot);
11345 }
11346 const existing = ownerDocument2.querySelector(
11347 `[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]`
11348 );
11349 if (existing instanceof HTMLDivElement) {
11350 cachedSlot = ensureSlotIsAccessible(existing);
11351 return cachedSlot;
11352 }
11353 if (cachedSlot?.isConnected) {
11354 cachedSlot.remove();
11355 }
11356 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2));
11357 return cachedSlot;
11358 }
11359
11360 // packages/ui/build-module/tooltip/portal.mjs
11361 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
11362 var Portal = (0, import_element12.forwardRef)(
11363 function TooltipPortal3({ container, ...restProps }, ref) {
11364 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
11365 index_parts_exports3.Portal,
11366 {
11367 container: container ?? getWpCompatOverlaySlot(),
11368 ...restProps,
11369 ref
11370 }
11371 );
11372 }
11373 );
11374
11375 // packages/ui/build-module/tooltip/positioner.mjs
11376 var import_element13 = __toESM(require_element(), 1);
11377 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
11378 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash";
11379 function getRuntime4() {
11380 const globalScope = globalThis;
11381 if (globalScope.__wpStyleRuntime) {
11382 return globalScope.__wpStyleRuntime;
11383 }
11384 globalScope.__wpStyleRuntime = {
11385 documents: /* @__PURE__ */ new Map(),
11386 styles: /* @__PURE__ */ new Map(),
11387 injectedStyles: /* @__PURE__ */ new WeakMap()
11388 };
11389 if (typeof document !== "undefined") {
11390 registerDocument4(document);
11391 }
11392 return globalScope.__wpStyleRuntime;
11393 }
11394 function documentContainsStyleHash4(targetDocument, hash) {
11395 if (!targetDocument.head) {
11396 return false;
11397 }
11398 for (const style of targetDocument.head.querySelectorAll(
11399 `style[${STYLE_HASH_ATTRIBUTE4}]`
11400 )) {
11401 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) {
11402 return true;
11403 }
11404 }
11405 return false;
11406 }
11407 function injectStyle4(targetDocument, hash, css) {
11408 if (!targetDocument.head) {
11409 return;
11410 }
11411 const runtime = getRuntime4();
11412 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11413 if (!injectedStyles) {
11414 injectedStyles = /* @__PURE__ */ new Set();
11415 runtime.injectedStyles.set(targetDocument, injectedStyles);
11416 }
11417 if (injectedStyles.has(hash)) {
11418 return;
11419 }
11420 if (documentContainsStyleHash4(targetDocument, hash)) {
11421 injectedStyles.add(hash);
11422 return;
11423 }
11424 const style = targetDocument.createElement("style");
11425 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash);
11426 style.appendChild(targetDocument.createTextNode(css));
11427 targetDocument.head.appendChild(style);
11428 injectedStyles.add(hash);
11429 }
11430 function registerDocument4(targetDocument) {
11431 const runtime = getRuntime4();
11432 runtime.documents.set(
11433 targetDocument,
11434 (runtime.documents.get(targetDocument) ?? 0) + 1
11435 );
11436 for (const [hash, css] of runtime.styles) {
11437 injectStyle4(targetDocument, hash, css);
11438 }
11439 return () => {
11440 const count = runtime.documents.get(targetDocument);
11441 if (count === void 0) {
11442 return;
11443 }
11444 if (count <= 1) {
11445 runtime.documents.delete(targetDocument);
11446 return;
11447 }
11448 runtime.documents.set(targetDocument, count - 1);
11449 };
11450 }
11451 function registerStyle4(hash, css) {
11452 const runtime = getRuntime4();
11453 runtime.styles.set(hash, css);
11454 for (const targetDocument of runtime.documents.keys()) {
11455 injectStyle4(targetDocument, hash, css);
11456 }
11457 }
11458 if (typeof process === "undefined" || true) {
11459 registerStyle4("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
11460 }
11461 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
11462 if (typeof process === "undefined" || true) {
11463 registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}');
11464 }
11465 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
11466 var Positioner = (0, import_element13.forwardRef)(
11467 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) {
11468 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11469 index_parts_exports3.Positioner,
11470 {
11471 ref,
11472 align,
11473 side,
11474 sideOffset,
11475 ...props,
11476 className: clsx_default(
11477 resets_default["box-sizing"],
11478 style_default3.positioner,
11479 className
11480 )
11481 }
11482 );
11483 }
11484 );
11485
11486 // packages/ui/build-module/utils/render-slot-with-children.mjs
11487 var import_element14 = __toESM(require_element(), 1);
11488 function renderSlotWithChildren(slot, defaultSlot, children) {
11489 return (0, import_element14.cloneElement)(slot ?? defaultSlot, { children });
11490 }
11491
11492 // packages/ui/build-module/utils/theme-provider.mjs
11493 var theme = __toESM(require_theme(), 1);
11494
11495 // packages/ui/build-module/lock-unlock.mjs
11496 var import_private_apis = __toESM(require_private_apis(), 1);
11497 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
11498 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
11499 "@wordpress/ui"
11500 );
11501
11502 // packages/ui/build-module/utils/theme-provider.mjs
11503 function getThemeProvider() {
11504 const themePackage = theme;
11505 if (themePackage.ThemeProvider) {
11506 return themePackage.ThemeProvider;
11507 }
11508 if (!themePackage.privateApis) {
11509 throw new Error(
11510 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`."
11511 );
11512 }
11513 return unlock(
11514 themePackage.privateApis
11515 ).ThemeProvider;
11516 }
11517 var ThemeProvider = getThemeProvider();
11518
11519 // packages/ui/build-module/tooltip/popup.mjs
11520 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
11521 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash";
11522 function getRuntime5() {
11523 const globalScope = globalThis;
11524 if (globalScope.__wpStyleRuntime) {
11525 return globalScope.__wpStyleRuntime;
11526 }
11527 globalScope.__wpStyleRuntime = {
11528 documents: /* @__PURE__ */ new Map(),
11529 styles: /* @__PURE__ */ new Map(),
11530 injectedStyles: /* @__PURE__ */ new WeakMap()
11531 };
11532 if (typeof document !== "undefined") {
11533 registerDocument5(document);
11534 }
11535 return globalScope.__wpStyleRuntime;
11536 }
11537 function documentContainsStyleHash5(targetDocument, hash) {
11538 if (!targetDocument.head) {
11539 return false;
11540 }
11541 for (const style of targetDocument.head.querySelectorAll(
11542 `style[${STYLE_HASH_ATTRIBUTE5}]`
11543 )) {
11544 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) {
11545 return true;
11546 }
11547 }
11548 return false;
11549 }
11550 function injectStyle5(targetDocument, hash, css) {
11551 if (!targetDocument.head) {
11552 return;
11553 }
11554 const runtime = getRuntime5();
11555 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11556 if (!injectedStyles) {
11557 injectedStyles = /* @__PURE__ */ new Set();
11558 runtime.injectedStyles.set(targetDocument, injectedStyles);
11559 }
11560 if (injectedStyles.has(hash)) {
11561 return;
11562 }
11563 if (documentContainsStyleHash5(targetDocument, hash)) {
11564 injectedStyles.add(hash);
11565 return;
11566 }
11567 const style = targetDocument.createElement("style");
11568 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash);
11569 style.appendChild(targetDocument.createTextNode(css));
11570 targetDocument.head.appendChild(style);
11571 injectedStyles.add(hash);
11572 }
11573 function registerDocument5(targetDocument) {
11574 const runtime = getRuntime5();
11575 runtime.documents.set(
11576 targetDocument,
11577 (runtime.documents.get(targetDocument) ?? 0) + 1
11578 );
11579 for (const [hash, css] of runtime.styles) {
11580 injectStyle5(targetDocument, hash, css);
11581 }
11582 return () => {
11583 const count = runtime.documents.get(targetDocument);
11584 if (count === void 0) {
11585 return;
11586 }
11587 if (count <= 1) {
11588 runtime.documents.delete(targetDocument);
11589 return;
11590 }
11591 runtime.documents.set(targetDocument, count - 1);
11592 };
11593 }
11594 function registerStyle5(hash, css) {
11595 const runtime = getRuntime5();
11596 runtime.styles.set(hash, css);
11597 for (const targetDocument of runtime.documents.keys()) {
11598 injectStyle5(targetDocument, hash, css);
11599 }
11600 }
11601 if (typeof process === "undefined" || true) {
11602 registerStyle5("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}');
11603 }
11604 var style_default4 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" };
11605 var POPUP_COLOR = { background: "#1e1e1e" };
11606 var Popup = (0, import_element15.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) {
11607 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
11608 index_parts_exports3.Popup,
11609 {
11610 ref,
11611 className: clsx_default(style_default4.popup, className),
11612 ...props,
11613 children
11614 }
11615 ) });
11616 const positionedPopup = renderSlotWithChildren(
11617 positioner,
11618 /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Positioner, {}),
11619 popupContent
11620 );
11621 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Portal, {}), positionedPopup);
11622 });
11623
11624 // packages/ui/build-module/tooltip/trigger.mjs
11625 var import_element16 = __toESM(require_element(), 1);
11626 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
11627 var Trigger = (0, import_element16.forwardRef)(
11628 function TooltipTrigger3(props, ref) {
11629 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(index_parts_exports3.Trigger, { ref, ...props });
11630 }
11631 );
11632
11633 // packages/ui/build-module/utils/direction-provider.mjs
11634 var import_i18n = __toESM(require_i18n(), 1);
11635 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
11636 function DirectionProvider3({ children }) {
11637 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DirectionProvider, { direction: (0, import_i18n.isRTL)() ? "rtl" : "ltr", children });
11638 }
11639
11640 // packages/ui/build-module/tooltip/root.mjs
11641 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
11642 function Root(props) {
11643 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(index_parts_exports3.Root, { ...props }) });
11644 }
11645
11646 // packages/ui/build-module/link/link.mjs
11647 var import_element17 = __toESM(require_element(), 1);
11648 var import_i18n2 = __toESM(require_i18n(), 1);
11649 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
11650 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash";
11651 function getRuntime6() {
11652 const globalScope = globalThis;
11653 if (globalScope.__wpStyleRuntime) {
11654 return globalScope.__wpStyleRuntime;
11655 }
11656 globalScope.__wpStyleRuntime = {
11657 documents: /* @__PURE__ */ new Map(),
11658 styles: /* @__PURE__ */ new Map(),
11659 injectedStyles: /* @__PURE__ */ new WeakMap()
11660 };
11661 if (typeof document !== "undefined") {
11662 registerDocument6(document);
11663 }
11664 return globalScope.__wpStyleRuntime;
11665 }
11666 function documentContainsStyleHash6(targetDocument, hash) {
11667 if (!targetDocument.head) {
11668 return false;
11669 }
11670 for (const style of targetDocument.head.querySelectorAll(
11671 `style[${STYLE_HASH_ATTRIBUTE6}]`
11672 )) {
11673 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) {
11674 return true;
11675 }
11676 }
11677 return false;
11678 }
11679 function injectStyle6(targetDocument, hash, css) {
11680 if (!targetDocument.head) {
11681 return;
11682 }
11683 const runtime = getRuntime6();
11684 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11685 if (!injectedStyles) {
11686 injectedStyles = /* @__PURE__ */ new Set();
11687 runtime.injectedStyles.set(targetDocument, injectedStyles);
11688 }
11689 if (injectedStyles.has(hash)) {
11690 return;
11691 }
11692 if (documentContainsStyleHash6(targetDocument, hash)) {
11693 injectedStyles.add(hash);
11694 return;
11695 }
11696 const style = targetDocument.createElement("style");
11697 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash);
11698 style.appendChild(targetDocument.createTextNode(css));
11699 targetDocument.head.appendChild(style);
11700 injectedStyles.add(hash);
11701 }
11702 function registerDocument6(targetDocument) {
11703 const runtime = getRuntime6();
11704 runtime.documents.set(
11705 targetDocument,
11706 (runtime.documents.get(targetDocument) ?? 0) + 1
11707 );
11708 for (const [hash, css] of runtime.styles) {
11709 injectStyle6(targetDocument, hash, css);
11710 }
11711 return () => {
11712 const count = runtime.documents.get(targetDocument);
11713 if (count === void 0) {
11714 return;
11715 }
11716 if (count <= 1) {
11717 runtime.documents.delete(targetDocument);
11718 return;
11719 }
11720 runtime.documents.set(targetDocument, count - 1);
11721 };
11722 }
11723 function registerStyle6(hash, css) {
11724 const runtime = getRuntime6();
11725 runtime.styles.set(hash, css);
11726 for (const targetDocument of runtime.documents.keys()) {
11727 injectStyle6(targetDocument, hash, css);
11728 }
11729 }
11730 if (typeof process === "undefined" || true) {
11731 registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
11732 }
11733 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
11734 if (typeof process === "undefined" || true) {
11735 registerStyle6("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
11736 }
11737 var focus_module_default = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
11738 if (typeof process === "undefined" || true) {
11739 registerStyle6("e8e6a9be37", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}}');
11740 }
11741 var style_default5 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" };
11742 if (typeof process === "undefined" || true) {
11743 registerStyle6("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
11744 }
11745 var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
11746 var Link = (0, import_element17.forwardRef)(function Link2({
11747 children,
11748 variant = "default",
11749 tone = "brand",
11750 openInNewTab = false,
11751 target,
11752 render: render4,
11753 className,
11754 ...props
11755 }, ref) {
11756 const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? "");
11757 const element = useRender({
11758 render: render4,
11759 defaultTagName: "a",
11760 ref,
11761 props: mergeProps(props, {
11762 className: clsx_default(
11763 global_css_defense_default2.a,
11764 resets_default2["box-sizing"],
11765 focus_module_default["outset-ring--focus-except-active"],
11766 variant !== "unstyled" && style_default5.link,
11767 variant !== "unstyled" && style_default5[`is-${tone}`],
11768 variant === "unstyled" && style_default5["is-unstyled"],
11769 className
11770 ),
11771 target: target ?? (openInNewTab ? "_blank" : void 0),
11772 children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
11773 children,
11774 shouldShowNewTabIndicator && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
11775 "span",
11776 {
11777 className: style_default5["link-icon"],
11778 role: "img",
11779 "aria-label": (
11780 /* translators: accessibility text appended to link text */
11781 (0, import_i18n2.__)("(opens in a new tab)")
11782 )
11783 }
11784 )
11785 ] })
11786 })
11787 });
11788 return element;
11789 });
11790
11791 // packages/icons/build-module/library/chevron-down.mjs
11792 var import_primitives = __toESM(require_primitives(), 1);
11793 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
11794 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives.Path, { d: "M7 11L12 15L17 11", vectorEffect: "non-scaling-stroke" }) });
11795
11796 // packages/icons/build-module/library/chevron-left.mjs
11797 var import_primitives2 = __toESM(require_primitives(), 1);
11798 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
11799 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives2.Path, { d: "M14 6.5L9 12L14 17.5", vectorEffect: "non-scaling-stroke" }) });
11800
11801 // packages/icons/build-module/library/chevron-right.mjs
11802 var import_primitives3 = __toESM(require_primitives(), 1);
11803 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
11804 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives3.Path, { d: "M10 6.5L15 12L10 17.5", vectorEffect: "non-scaling-stroke" }) });
11805
11806 // packages/icons/build-module/library/close-small.mjs
11807 var import_primitives4 = __toESM(require_primitives(), 1);
11808 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
11809 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives4.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) });
11810
11811 // packages/icons/build-module/library/envelope.mjs
11812 var import_primitives5 = __toESM(require_primitives(), 1);
11813 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
11814 var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives5.Path, { d: "M20.25 8.5V7C20.25 6.30964 19.6904 5.75 19 5.75H5C4.30964 5.75 3.75 6.30964 3.75 7V8.5M20.25 8.5V17C20.25 17.6904 19.6904 18.25 19 18.25H5C4.30964 18.25 3.75 17.6904 3.75 17V8.5M20.25 8.5L12 14.5L3.75 8.5", vectorEffect: "non-scaling-stroke" }) });
11815
11816 // packages/icons/build-module/library/error.mjs
11817 var import_primitives6 = __toESM(require_primitives(), 1);
11818 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
11819 var error_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives6.Path, { d: "M12 9L12 14M12 15.5V17M11.1284 5.04947L3.83827 18.0097C3.46331 18.6763 3.94502 19.5 4.70985 19.5H19.2902C20.055 19.5 20.5367 18.6763 20.1617 18.0097L12.8716 5.04947C12.4893 4.36982 11.5107 4.36982 11.1284 5.04947Z", vectorEffect: "non-scaling-stroke" }) });
11820
11821 // packages/icons/build-module/library/link.mjs
11822 var import_primitives7 = __toESM(require_primitives(), 1);
11823 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
11824 var link_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives7.Path, { d: "M9.5 12L14.5 12M10 7.75H8.25C5.90279 7.75 4 9.65279 4 12C4 14.3472 5.90279 16.25 8.25 16.25H10M14 16.25H15.75C18.0972 16.25 20 14.3472 20 12C20 9.65279 18.0972 7.75 15.75 7.75L14 7.75", vectorEffect: "non-scaling-stroke" }) });
11825
11826 // packages/icons/build-module/library/mobile.mjs
11827 var import_primitives8 = __toESM(require_primitives(), 1);
11828 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
11829 var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives8.Path, { d: "M11 16.5H13M16.25 18V6C16.25 5.30964 15.6904 4.75 15 4.75H9C8.30964 4.75 7.75 5.30964 7.75 6L7.75 18C7.75 18.6904 8.30964 19.25 9 19.25H15C15.6904 19.25 16.25 18.6904 16.25 18Z", vectorEffect: "non-scaling-stroke" }) });
11830
11831 // packages/icons/build-module/library/pencil.mjs
11832 var import_primitives9 = __toESM(require_primitives(), 1);
11833 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
11834 var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11835 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives9.Path, { d: "M5 19.25H12", vectorEffect: "non-scaling-stroke" }),
11836 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives9.Path, { d: "M10 15L7.5 15.5L8 13L16 5L18 7L10 15Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
11837 ] });
11838
11839 // packages/icons/build-module/library/published.mjs
11840 var import_primitives10 = __toESM(require_primitives(), 1);
11841 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
11842 var published_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11843 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives10.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }),
11844 /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives10.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" })
11845 ] });
11846
11847 // packages/icons/build-module/library/seen.mjs
11848 var import_primitives11 = __toESM(require_primitives(), 1);
11849 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
11850 var seen_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11851 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives11.Path, { d: "M20.0645 13C18.5918 10.0366 15.5337 8 12 8C8.46631 8 5.40825 10.0366 3.93555 13", vectorEffect: "non-scaling-stroke" }),
11852 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives11.Circle, { cx: "12", cy: "12.5", r: "3", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
11853 ] });
11854
11855 // packages/icons/build-module/library/unseen.mjs
11856 var import_primitives12 = __toESM(require_primitives(), 1);
11857 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
11858 var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
11859 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives12.Path, { d: "M8 21L10.6587 15.1842M13.1523 9.72929L13.8553 8.19144L16 3.5M20.0645 13C19.2118 11.2841 17.8276 9.87898 16.1272 9M3.93555 13C5.40825 10.0366 8.46631 8 12 8C12.636 8 13.2566 8.06597 13.8553 8.19144M13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842M13.1523 9.72929L10.6587 15.1842M13.1755 15.261C14.2481 14.8037 15 13.7397 15 12.5C15 12.1819 14.9505 11.8753 14.8587 11.5876", vectorEffect: "non-scaling-stroke" }),
11860 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives12.Path, { d: "M12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842L13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" })
11861 ] });
11862
11863 // packages/ui/build-module/icon/icon.mjs
11864 var import_element18 = __toESM(require_element(), 1);
11865 var import_primitives13 = __toESM(require_primitives(), 1);
11866 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
11867 var Icon = (0, import_element18.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) {
11868 const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0;
11869 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
11870 import_primitives13.SVG,
11871 {
11872 ref,
11873 ...icon.props,
11874 ...restProps,
11875 ...mergedStyle ? { style: mergedStyle } : {},
11876 width: size4,
11877 height: size4
11878 }
11879 );
11880 });
11881
11882 // packages/ui/build-module/utils/keyboard-shortcut.mjs
11883 var import_element20 = __toESM(require_element(), 1);
11884 var import_i18n3 = __toESM(require_i18n(), 1);
11885
11886 // packages/ui/build-module/visually-hidden/visually-hidden.mjs
11887 var import_element19 = __toESM(require_element(), 1);
11888 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash";
11889 function getRuntime7() {
11890 const globalScope = globalThis;
11891 if (globalScope.__wpStyleRuntime) {
11892 return globalScope.__wpStyleRuntime;
11893 }
11894 globalScope.__wpStyleRuntime = {
11895 documents: /* @__PURE__ */ new Map(),
11896 styles: /* @__PURE__ */ new Map(),
11897 injectedStyles: /* @__PURE__ */ new WeakMap()
11898 };
11899 if (typeof document !== "undefined") {
11900 registerDocument7(document);
11901 }
11902 return globalScope.__wpStyleRuntime;
11903 }
11904 function documentContainsStyleHash7(targetDocument, hash) {
11905 if (!targetDocument.head) {
11906 return false;
11907 }
11908 for (const style of targetDocument.head.querySelectorAll(
11909 `style[${STYLE_HASH_ATTRIBUTE7}]`
11910 )) {
11911 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) {
11912 return true;
11913 }
11914 }
11915 return false;
11916 }
11917 function injectStyle7(targetDocument, hash, css) {
11918 if (!targetDocument.head) {
11919 return;
11920 }
11921 const runtime = getRuntime7();
11922 let injectedStyles = runtime.injectedStyles.get(targetDocument);
11923 if (!injectedStyles) {
11924 injectedStyles = /* @__PURE__ */ new Set();
11925 runtime.injectedStyles.set(targetDocument, injectedStyles);
11926 }
11927 if (injectedStyles.has(hash)) {
11928 return;
11929 }
11930 if (documentContainsStyleHash7(targetDocument, hash)) {
11931 injectedStyles.add(hash);
11932 return;
11933 }
11934 const style = targetDocument.createElement("style");
11935 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash);
11936 style.appendChild(targetDocument.createTextNode(css));
11937 targetDocument.head.appendChild(style);
11938 injectedStyles.add(hash);
11939 }
11940 function registerDocument7(targetDocument) {
11941 const runtime = getRuntime7();
11942 runtime.documents.set(
11943 targetDocument,
11944 (runtime.documents.get(targetDocument) ?? 0) + 1
11945 );
11946 for (const [hash, css] of runtime.styles) {
11947 injectStyle7(targetDocument, hash, css);
11948 }
11949 return () => {
11950 const count = runtime.documents.get(targetDocument);
11951 if (count === void 0) {
11952 return;
11953 }
11954 if (count <= 1) {
11955 runtime.documents.delete(targetDocument);
11956 return;
11957 }
11958 runtime.documents.set(targetDocument, count - 1);
11959 };
11960 }
11961 function registerStyle7(hash, css) {
11962 const runtime = getRuntime7();
11963 runtime.styles.set(hash, css);
11964 for (const targetDocument of runtime.documents.keys()) {
11965 injectStyle7(targetDocument, hash, css);
11966 }
11967 }
11968 if (typeof process === "undefined" || true) {
11969 registerStyle7("f4df7461e9", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal;padding:0;position:absolute;width:1px;word-break:normal}}}");
11970 }
11971 var style_default6 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" };
11972 var VisuallyHidden = (0, import_element19.forwardRef)(
11973 function VisuallyHidden2({ render: render4, ...restProps }, ref) {
11974 const element = useRender({
11975 render: render4,
11976 ref,
11977 props: mergeProps(
11978 { className: style_default6["visually-hidden"] },
11979 restProps,
11980 {
11981 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it.
11982 "data-visually-hidden": ""
11983 }
11984 )
11985 });
11986 return element;
11987 }
11988 );
11989
11990 // packages/ui/build-module/utils/keyboard-shortcut.mjs
11991 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
11992 function useKeyboardShortcutProps({
11993 "aria-describedby": ariaDescribedBy,
11994 "aria-keyshortcuts": ariaKeyShortcuts,
11995 shortcut
11996 }) {
11997 const generatedDescriptionId = (0, import_element20.useId)();
11998 const descriptionId = shortcut ? generatedDescriptionId : void 0;
11999 const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" ");
12000 return {
12001 descriptionId,
12002 targetProps: {
12003 "aria-describedby": describedBy || void 0,
12004 "aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts
12005 }
12006 };
12007 }
12008 var KeyboardShortcutDescription = (0, import_element20.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) {
12009 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
12010 VisuallyHidden,
12011 {
12012 id: descriptionId,
12013 "aria-hidden": "true",
12014 render: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { ref }),
12015 children: (0, import_i18n3.sprintf)(
12016 /* translators: %s: keyboard shortcut. */
12017 (0, import_i18n3.__)("Keyboard shortcut: %s"),
12018 shortcut.label ?? shortcut.ariaKeyShortcut
12019 )
12020 }
12021 );
12022 });
12023 var KeyboardShortcutDisplay = (0, import_element20.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) {
12024 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut });
12025 });
12026
12027 // packages/ui/build-module/button/button.mjs
12028 var import_element21 = __toESM(require_element(), 1);
12029 var import_i18n4 = __toESM(require_i18n(), 1);
12030 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
12031 import { speak } from "@wordpress/a11y";
12032 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash";
12033 function getRuntime8() {
12034 const globalScope = globalThis;
12035 if (globalScope.__wpStyleRuntime) {
12036 return globalScope.__wpStyleRuntime;
12037 }
12038 globalScope.__wpStyleRuntime = {
12039 documents: /* @__PURE__ */ new Map(),
12040 styles: /* @__PURE__ */ new Map(),
12041 injectedStyles: /* @__PURE__ */ new WeakMap()
12042 };
12043 if (typeof document !== "undefined") {
12044 registerDocument8(document);
12045 }
12046 return globalScope.__wpStyleRuntime;
12047 }
12048 function documentContainsStyleHash8(targetDocument, hash) {
12049 if (!targetDocument.head) {
12050 return false;
12051 }
12052 for (const style of targetDocument.head.querySelectorAll(
12053 `style[${STYLE_HASH_ATTRIBUTE8}]`
12054 )) {
12055 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) {
12056 return true;
12057 }
12058 }
12059 return false;
12060 }
12061 function injectStyle8(targetDocument, hash, css) {
12062 if (!targetDocument.head) {
12063 return;
12064 }
12065 const runtime = getRuntime8();
12066 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12067 if (!injectedStyles) {
12068 injectedStyles = /* @__PURE__ */ new Set();
12069 runtime.injectedStyles.set(targetDocument, injectedStyles);
12070 }
12071 if (injectedStyles.has(hash)) {
12072 return;
12073 }
12074 if (documentContainsStyleHash8(targetDocument, hash)) {
12075 injectedStyles.add(hash);
12076 return;
12077 }
12078 const style = targetDocument.createElement("style");
12079 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash);
12080 style.appendChild(targetDocument.createTextNode(css));
12081 targetDocument.head.appendChild(style);
12082 injectedStyles.add(hash);
12083 }
12084 function registerDocument8(targetDocument) {
12085 const runtime = getRuntime8();
12086 runtime.documents.set(
12087 targetDocument,
12088 (runtime.documents.get(targetDocument) ?? 0) + 1
12089 );
12090 for (const [hash, css] of runtime.styles) {
12091 injectStyle8(targetDocument, hash, css);
12092 }
12093 return () => {
12094 const count = runtime.documents.get(targetDocument);
12095 if (count === void 0) {
12096 return;
12097 }
12098 if (count <= 1) {
12099 runtime.documents.delete(targetDocument);
12100 return;
12101 }
12102 runtime.documents.set(targetDocument, count - 1);
12103 };
12104 }
12105 function registerStyle8(hash, css) {
12106 const runtime = getRuntime8();
12107 runtime.styles.set(hash, css);
12108 for (const targetDocument of runtime.documents.keys()) {
12109 injectStyle8(targetDocument, hash, css);
12110 }
12111 }
12112 if (typeof process === "undefined" || true) {
12113 registerStyle8("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}');
12114 }
12115 var style_default7 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" };
12116 if (typeof process === "undefined" || true) {
12117 registerStyle8("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
12118 }
12119 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
12120 if (typeof process === "undefined" || true) {
12121 registerStyle8("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
12122 }
12123 var focus_module_default2 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
12124 if (typeof process === "undefined" || true) {
12125 registerStyle8("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
12126 }
12127 var global_css_defense_default3 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
12128 var Button3 = (0, import_element21.forwardRef)(
12129 function Button22({
12130 tone = "brand",
12131 variant = "solid",
12132 size: size4 = "default",
12133 className,
12134 focusableWhenDisabled = true,
12135 disabled: disabled2,
12136 loading,
12137 loadingAnnouncement = (0, import_i18n4.__)("Loading"),
12138 children,
12139 ...props
12140 }, ref) {
12141 const mergedClassName = clsx_default(
12142 global_css_defense_default3.button,
12143 resets_default3["box-sizing"],
12144 focus_module_default2["outset-ring--focus-except-active"],
12145 variant !== "unstyled" && style_default7.button,
12146 style_default7[`is-${tone}`],
12147 style_default7[`is-${variant}`],
12148 style_default7[`is-${size4}`],
12149 loading && style_default7["is-loading"],
12150 className
12151 );
12152 (0, import_element21.useEffect)(() => {
12153 if (loading && loadingAnnouncement) {
12154 speak(loadingAnnouncement);
12155 }
12156 }, [loading, loadingAnnouncement]);
12157 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
12158 Button,
12159 {
12160 ref,
12161 className: mergedClassName,
12162 focusableWhenDisabled,
12163 disabled: disabled2 ?? loading,
12164 ...props,
12165 children
12166 }
12167 );
12168 }
12169 );
12170
12171 // packages/ui/build-module/button/icon.mjs
12172 var import_element22 = __toESM(require_element(), 1);
12173 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
12174 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash";
12175 function getRuntime9() {
12176 const globalScope = globalThis;
12177 if (globalScope.__wpStyleRuntime) {
12178 return globalScope.__wpStyleRuntime;
12179 }
12180 globalScope.__wpStyleRuntime = {
12181 documents: /* @__PURE__ */ new Map(),
12182 styles: /* @__PURE__ */ new Map(),
12183 injectedStyles: /* @__PURE__ */ new WeakMap()
12184 };
12185 if (typeof document !== "undefined") {
12186 registerDocument9(document);
12187 }
12188 return globalScope.__wpStyleRuntime;
12189 }
12190 function documentContainsStyleHash9(targetDocument, hash) {
12191 if (!targetDocument.head) {
12192 return false;
12193 }
12194 for (const style of targetDocument.head.querySelectorAll(
12195 `style[${STYLE_HASH_ATTRIBUTE9}]`
12196 )) {
12197 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) {
12198 return true;
12199 }
12200 }
12201 return false;
12202 }
12203 function injectStyle9(targetDocument, hash, css) {
12204 if (!targetDocument.head) {
12205 return;
12206 }
12207 const runtime = getRuntime9();
12208 let injectedStyles = runtime.injectedStyles.get(targetDocument);
12209 if (!injectedStyles) {
12210 injectedStyles = /* @__PURE__ */ new Set();
12211 runtime.injectedStyles.set(targetDocument, injectedStyles);
12212 }
12213 if (injectedStyles.has(hash)) {
12214 return;
12215 }
12216 if (documentContainsStyleHash9(targetDocument, hash)) {
12217 injectedStyles.add(hash);
12218 return;
12219 }
12220 const style = targetDocument.createElement("style");
12221 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash);
12222 style.appendChild(targetDocument.createTextNode(css));
12223 targetDocument.head.appendChild(style);
12224 injectedStyles.add(hash);
12225 }
12226 function registerDocument9(targetDocument) {
12227 const runtime = getRuntime9();
12228 runtime.documents.set(
12229 targetDocument,
12230 (runtime.documents.get(targetDocument) ?? 0) + 1
12231 );
12232 for (const [hash, css] of runtime.styles) {
12233 injectStyle9(targetDocument, hash, css);
12234 }
12235 return () => {
12236 const count = runtime.documents.get(targetDocument);
12237 if (count === void 0) {
12238 return;
12239 }
12240 if (count <= 1) {
12241 runtime.documents.delete(targetDocument);
12242 return;
12243 }
12244 runtime.documents.set(targetDocument, count - 1);
12245 };
12246 }
12247 function registerStyle9(hash, css) {
12248 const runtime = getRuntime9();
12249 runtime.styles.set(hash, css);
12250 for (const targetDocument of runtime.documents.keys()) {
12251 injectStyle9(targetDocument, hash, css);
12252 }
12253 }
12254 if (typeof process === "undefined" || true) {
12255 registerStyle9("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}');
12256 }
12257 var style_default8 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" };
12258 var ButtonIcon = (0, import_element22.forwardRef)(
12259 function ButtonIcon2({ className, icon, ...props }, ref) {
12260 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
12261 Icon,
12262 {
12263 ref,
12264 icon,
12265 className: clsx_default(style_default8.icon, className),
12266 size: 24,
12267 ...props
12268 }
12269 );
12270 }
12271 );
12272
12273 // packages/ui/build-module/button/index.mjs
12274 ButtonIcon.displayName = "Button.Icon";
12275 var Button4 = Object.assign(Button3, {
12276 /**
12277 * An icon component specifically designed to work well when rendered inside
12278 * a `Button` component.
12279 */
12280 Icon: ButtonIcon
12281 });
12282
12283 // node_modules/@date-fns/tz/tzName/index.js
12284 function tzName(timeZone, date, format7 = "long") {
12285 return new Intl.DateTimeFormat("en-US", {
12286 // Enforces engine to render the time. Without the option JavaScriptCore omits it.
12287 hour: "numeric",
12288 timeZone,
12289 timeZoneName: format7
12290 }).format(date).split(/\s/g).slice(2).join(" ");
12291 }
12292
12293 // node_modules/@date-fns/tz/tzOffset/index.js
12294 var offsetFormatCache = {};
12295 var offsetCache = {};
12296 function tzOffset(timeZone, date) {
12297 try {
12298 const format7 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
12299 timeZone,
12300 timeZoneName: "longOffset"
12301 }).format;
12302 const offsetStr = format7(date).split("GMT")[1];
12303 if (offsetStr in offsetCache) return offsetCache[offsetStr];
12304 return calcOffset(offsetStr, offsetStr.split(":"));
12305 } catch {
12306 if (timeZone in offsetCache) return offsetCache[timeZone];
12307 const captures = timeZone?.match(offsetRe);
12308 if (captures) return calcOffset(timeZone, captures.slice(1));
12309 return NaN;
12310 }
12311 }
12312 var offsetRe = /([+-]\d\d):?(\d\d)?/;
12313 function calcOffset(cacheStr, values) {
12314 const hours = +(values[0] || 0);
12315 const minutes = +(values[1] || 0);
12316 const seconds = +(values[2] || 0) / 60;
12317 return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
12318 }
12319
12320 // node_modules/@date-fns/tz/date/mini.js
12321 var TZDateMini = class _TZDateMini extends Date {
12322 //#region static
12323 constructor(...args) {
12324 super();
12325 if (args.length > 1 && typeof args[args.length - 1] === "string") {
12326 this.timeZone = args.pop();
12327 }
12328 this.internal = /* @__PURE__ */ new Date();
12329 if (isNaN(tzOffset(this.timeZone, this))) {
12330 this.setTime(NaN);
12331 } else {
12332 if (!args.length) {
12333 this.setTime(Date.now());
12334 } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
12335 this.setTime(args[0]);
12336 } else if (typeof args[0] === "string") {
12337 this.setTime(+new Date(args[0]));
12338 } else if (args[0] instanceof Date) {
12339 this.setTime(+args[0]);
12340 } else {
12341 this.setTime(+new Date(...args));
12342 adjustToSystemTZ(this, args);
12343 }
12344 }
12345 }
12346 static tz(tz, ...args) {
12347 return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz);
12348 }
12349 //#endregion
12350 //#region time zone
12351 withTimeZone(timeZone) {
12352 return new _TZDateMini(+this, timeZone);
12353 }
12354 getTimezoneOffset() {
12355 const offset4 = -tzOffset(this.timeZone, this);
12356 return offset4 > 0 ? Math.floor(offset4) : Math.ceil(offset4);
12357 }
12358 //#endregion
12359 //#region time
12360 setTime(_time) {
12361 Date.prototype.setTime.apply(this, arguments);
12362 syncToInternal(this);
12363 return +this;
12364 }
12365 //#endregion
12366 //#region date-fns integration
12367 [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
12368 return new _TZDateMini(+new Date(date), this.timeZone);
12369 }
12370 //#endregion
12371 };
12372 var re = /^(get|set)(?!UTC)/;
12373 Object.getOwnPropertyNames(Date.prototype).forEach((method) => {
12374 if (!re.test(method)) return;
12375 const utcMethod = method.replace(re, "$1UTC");
12376 if (!TZDateMini.prototype[utcMethod]) return;
12377 if (method.startsWith("get")) {
12378 TZDateMini.prototype[method] = function() {
12379 return this.internal[utcMethod]();
12380 };
12381 } else {
12382 TZDateMini.prototype[method] = function() {
12383 Date.prototype[utcMethod].apply(this.internal, arguments);
12384 syncFromInternal(this);
12385 return +this;
12386 };
12387 TZDateMini.prototype[utcMethod] = function() {
12388 Date.prototype[utcMethod].apply(this, arguments);
12389 syncToInternal(this);
12390 return +this;
12391 };
12392 }
12393 });
12394 function syncToInternal(date) {
12395 date.internal.setTime(+date);
12396 date.internal.setUTCSeconds(date.internal.getUTCSeconds() - // Round after converting minutes to seconds to avoid fractional offset
12397 // precision errors from historical offsets.
12398 Math.round(-tzOffset(date.timeZone, date) * 60));
12399 }
12400 function syncFromInternal(date) {
12401 Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
12402 Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
12403 adjustToSystemTZ(date);
12404 }
12405 function adjustToSystemTZ(date, constructorArgs) {
12406 const expectedInternalTime = Array.isArray(constructorArgs) ? constructorArgsToInternalTime(constructorArgs) : +date.internal;
12407 const offsetWithSeconds = tzOffset(date.timeZone, date);
12408 const offset4 = offsetWithSeconds > 0 ? Math.floor(offsetWithSeconds) : Math.ceil(offsetWithSeconds);
12409 const prevHour = /* @__PURE__ */ new Date(+date);
12410 prevHour.setUTCHours(prevHour.getUTCHours() - 1);
12411 const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
12412 const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset();
12413 const systemDSTChange = systemOffset - prevHourSystemOffset;
12414 let systemOffsetForDiff = systemOffset;
12415 if (systemDSTChange && systemOffset !== offset4) {
12416 const systemHour = Date.prototype.getHours.apply(date);
12417 const expectedHour = Array.isArray(constructorArgs) ? constructorArgs[3] || 0 : date.internal.getUTCHours();
12418 if (systemHour !== expectedHour) {
12419 const testDate = /* @__PURE__ */ new Date(+date);
12420 const testOffsetDiff = systemOffset - offset4;
12421 if (testOffsetDiff) testDate.setUTCMinutes(testDate.getUTCMinutes() + testOffsetDiff);
12422 const testOffsetWithSeconds = tzOffset(date.timeZone, testDate);
12423 const testOffset = testOffsetWithSeconds > 0 ? Math.floor(testOffsetWithSeconds) : Math.ceil(testOffsetWithSeconds);
12424 if (testOffset === offset4) systemOffsetForDiff = prevHourSystemOffset;
12425 }
12426 }
12427 const offsetDiff = systemOffsetForDiff - offset4;
12428 if (offsetDiff)
12429 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
12430 const systemDate = /* @__PURE__ */ new Date(+date);
12431 systemDate.setUTCSeconds(0);
12432 const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
12433 const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
12434 if (secondsOffset || systemSecondsOffset)
12435 Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
12436 const postOffsetWithSeconds = tzOffset(date.timeZone, date);
12437 const postOffset = postOffsetWithSeconds > 0 ? Math.floor(postOffsetWithSeconds) : Math.ceil(postOffsetWithSeconds);
12438 const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset();
12439 const postOffsetDiff = postSystemOffset - postOffset;
12440 const offsetChanged = postOffset !== offset4;
12441 const postDiff = postOffsetDiff - offsetDiff;
12442 const targetDSTShift = postOffset - offset4;
12443 const postOffsetCandidate = expectedInternalTime - postOffset * 60 * 1e3;
12444 const normalizedTargetDSTGap = targetDSTShift > 0 && targetInternalTime(date) - expectedInternalTime === targetDSTShift * 60 * 1e3 && targetInternalTime(date, postOffsetCandidate) !== expectedInternalTime;
12445 if (offsetChanged && postDiff && !normalizedTargetDSTGap) {
12446 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
12447 const newOffsetWithSeconds = tzOffset(date.timeZone, date);
12448 const newOffset = newOffsetWithSeconds > 0 ? Math.floor(newOffsetWithSeconds) : Math.ceil(newOffsetWithSeconds);
12449 const offsetChange = postOffset - newOffset;
12450 if (offsetChange && postDiff < 0) {
12451 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
12452 }
12453 }
12454 syncToInternal(date);
12455 const expectedTime = constructorArgs ? expectedInternalTime : expectedInternalTime + secondsOffset * 1e3;
12456 const drift = expectedTime - +date.internal;
12457 if (drift && Math.abs(drift) < 30 * 60 * 1e3) {
12458 Date.prototype.setTime.call(date, +date + drift);
12459 syncToInternal(date);
12460 }
12461 }
12462 function constructorArgsToInternalTime(args) {
12463 return Date.UTC(args[0], args.length > 1 ? args[1] : 0, args.length > 2 ? args[2] : 1, ...args.slice(3));
12464 }
12465 function targetInternalTime(date, time) {
12466 const internal = new Date(time ?? +date);
12467 internal.setUTCSeconds(internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, internal) * 60));
12468 return +internal;
12469 }
12470
12471 // node_modules/@date-fns/tz/date/index.js
12472 var TZDate = class _TZDate extends TZDateMini {
12473 //#region static
12474 static tz(tz, ...args) {
12475 return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz);
12476 }
12477 //#endregion
12478 //#region representation
12479 toISOString() {
12480 const [sign, hours, minutes] = this.tzComponents();
12481 const tz = `${sign}${hours}:${minutes}`;
12482 return this.internal.toISOString().slice(0, -1) + tz;
12483 }
12484 toString() {
12485 return `${this.toDateString()} ${this.toTimeString()}`;
12486 }
12487 toDateString() {
12488 const [day, date, month, year] = this.internal.toUTCString().split(" ");
12489 return `${day?.slice(0, -1)} ${month} ${date} ${year}`;
12490 }
12491 toTimeString() {
12492 const time = this.internal.toUTCString().split(" ")[4];
12493 const [sign, hours, minutes] = this.tzComponents();
12494 return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
12495 }
12496 toLocaleString(locales, options) {
12497 return Date.prototype.toLocaleString.call(this, locales, {
12498 ...options,
12499 timeZone: options?.timeZone || this.timeZone
12500 });
12501 }
12502 toLocaleDateString(locales, options) {
12503 return Date.prototype.toLocaleDateString.call(this, locales, {
12504 ...options,
12505 timeZone: options?.timeZone || this.timeZone
12506 });
12507 }
12508 toLocaleTimeString(locales, options) {
12509 return Date.prototype.toLocaleTimeString.call(this, locales, {
12510 ...options,
12511 timeZone: options?.timeZone || this.timeZone
12512 });
12513 }
12514 //#endregion
12515 //#region private
12516 tzComponents() {
12517 const offset4 = this.getTimezoneOffset();
12518 const sign = offset4 > 0 ? "-" : "+";
12519 const hours = String(Math.floor(Math.abs(offset4) / 60)).padStart(2, "0");
12520 const minutes = String(Math.abs(offset4) % 60).padStart(2, "0");
12521 return [sign, hours, minutes];
12522 }
12523 //#endregion
12524 withTimeZone(timeZone) {
12525 return new _TZDate(+this, timeZone);
12526 }
12527 //#region date-fns integration
12528 [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) {
12529 return new _TZDate(+new Date(date), this.timeZone);
12530 }
12531 //#endregion
12532 };
12533
12534 // node_modules/date-fns/constants.js
12535 var daysInYear = 365.2425;
12536 var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
12537 var minTime = -maxTime;
12538 var millisecondsInWeek = 6048e5;
12539 var millisecondsInDay = 864e5;
12540 var millisecondsInMinute = 6e4;
12541 var millisecondsInHour = 36e5;
12542 var millisecondsInSecond = 1e3;
12543 var secondsInHour = 3600;
12544 var secondsInDay = secondsInHour * 24;
12545 var secondsInWeek = secondsInDay * 7;
12546 var secondsInYear = secondsInDay * daysInYear;
12547 var secondsInMonth = secondsInYear / 12;
12548 var secondsInQuarter = secondsInMonth * 3;
12549 var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
12550
12551 // node_modules/date-fns/constructFrom.js
12552 function constructFrom(date, value) {
12553 if (typeof date === "function") return date(value);
12554 if (date && typeof date === "object" && constructFromSymbol in date)
12555 return date[constructFromSymbol](value);
12556 if (date instanceof Date) return new date.constructor(value);
12557 return new Date(value);
12558 }
12559
12560 // node_modules/date-fns/toDate.js
12561 function toDate(argument, context) {
12562 return constructFrom(context || argument, argument);
12563 }
12564
12565 // node_modules/date-fns/addDays.js
12566 function addDays(date, amount, options) {
12567 const _date = toDate(date, options?.in);
12568 if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
12569 if (!amount) return _date;
12570 _date.setDate(_date.getDate() + amount);
12571 return _date;
12572 }
12573
12574 // node_modules/date-fns/addMonths.js
12575 function addMonths(date, amount, options) {
12576 const _date = toDate(date, options?.in);
12577 if (isNaN(amount)) return constructFrom(options?.in || date, NaN);
12578 if (!amount) {
12579 return _date;
12580 }
12581 const dayOfMonth = _date.getDate();
12582 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime());
12583 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
12584 const daysInMonth = endOfDesiredMonth.getDate();
12585 if (dayOfMonth >= daysInMonth) {
12586 return endOfDesiredMonth;
12587 } else {
12588 _date.setFullYear(
12589 endOfDesiredMonth.getFullYear(),
12590 endOfDesiredMonth.getMonth(),
12591 dayOfMonth
12592 );
12593 return _date;
12594 }
12595 }
12596
12597 // node_modules/date-fns/_lib/defaultOptions.js
12598 var defaultOptions = {};
12599 function getDefaultOptions() {
12600 return defaultOptions;
12601 }
12602
12603 // node_modules/date-fns/startOfWeek.js
12604 function startOfWeek(date, options) {
12605 const defaultOptions2 = getDefaultOptions();
12606 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
12607 const _date = toDate(date, options?.in);
12608 const day = _date.getDay();
12609 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
12610 _date.setDate(_date.getDate() - diff);
12611 _date.setHours(0, 0, 0, 0);
12612 return _date;
12613 }
12614
12615 // node_modules/date-fns/startOfISOWeek.js
12616 function startOfISOWeek(date, options) {
12617 return startOfWeek(date, { ...options, weekStartsOn: 1 });
12618 }
12619
12620 // node_modules/date-fns/getISOWeekYear.js
12621 function getISOWeekYear(date, options) {
12622 const _date = toDate(date, options?.in);
12623 const year = _date.getFullYear();
12624 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
12625 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
12626 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
12627 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
12628 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
12629 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
12630 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
12631 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
12632 if (_date.getTime() >= startOfNextYear.getTime()) {
12633 return year + 1;
12634 } else if (_date.getTime() >= startOfThisYear.getTime()) {
12635 return year;
12636 } else {
12637 return year - 1;
12638 }
12639 }
12640
12641 // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
12642 function getTimezoneOffsetInMilliseconds(date) {
12643 const _date = toDate(date);
12644 const utcDate = new Date(
12645 Date.UTC(
12646 _date.getFullYear(),
12647 _date.getMonth(),
12648 _date.getDate(),
12649 _date.getHours(),
12650 _date.getMinutes(),
12651 _date.getSeconds(),
12652 _date.getMilliseconds()
12653 )
12654 );
12655 utcDate.setUTCFullYear(_date.getFullYear());
12656 return +date - +utcDate;
12657 }
12658
12659 // node_modules/date-fns/_lib/normalizeDates.js
12660 function normalizeDates(context, ...dates) {
12661 const normalize = constructFrom.bind(
12662 null,
12663 context || dates.find((date) => typeof date === "object")
12664 );
12665 return dates.map(normalize);
12666 }
12667
12668 // node_modules/date-fns/startOfDay.js
12669 function startOfDay(date, options) {
12670 const _date = toDate(date, options?.in);
12671 _date.setHours(0, 0, 0, 0);
12672 return _date;
12673 }
12674
12675 // node_modules/date-fns/differenceInCalendarDays.js
12676 function differenceInCalendarDays(laterDate, earlierDate, options) {
12677 const [laterDate_, earlierDate_] = normalizeDates(
12678 options?.in,
12679 laterDate,
12680 earlierDate
12681 );
12682 const laterStartOfDay = startOfDay(laterDate_);
12683 const earlierStartOfDay = startOfDay(earlierDate_);
12684 const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
12685 const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
12686 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
12687 }
12688
12689 // node_modules/date-fns/startOfISOWeekYear.js
12690 function startOfISOWeekYear(date, options) {
12691 const year = getISOWeekYear(date, options);
12692 const fourthOfJanuary = constructFrom(options?.in || date, 0);
12693 fourthOfJanuary.setFullYear(year, 0, 4);
12694 fourthOfJanuary.setHours(0, 0, 0, 0);
12695 return startOfISOWeek(fourthOfJanuary);
12696 }
12697
12698 // node_modules/date-fns/addWeeks.js
12699 function addWeeks(date, amount, options) {
12700 return addDays(date, amount * 7, options);
12701 }
12702
12703 // node_modules/date-fns/addYears.js
12704 function addYears(date, amount, options) {
12705 return addMonths(date, amount * 12, options);
12706 }
12707
12708 // node_modules/date-fns/areIntervalsOverlapping.js
12709 function areIntervalsOverlapping(intervalLeft, intervalRight, options) {
12710 const [leftStartTime, leftEndTime] = [
12711 +toDate(intervalLeft.start, options?.in),
12712 +toDate(intervalLeft.end, options?.in)
12713 ].sort((a, b) => a - b);
12714 const [rightStartTime, rightEndTime] = [
12715 +toDate(intervalRight.start, options?.in),
12716 +toDate(intervalRight.end, options?.in)
12717 ].sort((a, b) => a - b);
12718 if (options?.inclusive)
12719 return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
12720 return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
12721 }
12722
12723 // node_modules/date-fns/max.js
12724 function max2(dates, options) {
12725 let result;
12726 let context = options?.in;
12727 dates.forEach((date) => {
12728 if (!context && typeof date === "object")
12729 context = constructFrom.bind(null, date);
12730 const date_ = toDate(date, context);
12731 if (!result || result < date_ || isNaN(+date_)) result = date_;
12732 });
12733 return constructFrom(context, result || NaN);
12734 }
12735
12736 // node_modules/date-fns/min.js
12737 function min2(dates, options) {
12738 let result;
12739 let context = options?.in;
12740 dates.forEach((date) => {
12741 if (!context && typeof date === "object")
12742 context = constructFrom.bind(null, date);
12743 const date_ = toDate(date, context);
12744 if (!result || result > date_ || isNaN(+date_)) result = date_;
12745 });
12746 return constructFrom(context, result || NaN);
12747 }
12748
12749 // node_modules/date-fns/isSameDay.js
12750 function isSameDay(laterDate, earlierDate, options) {
12751 const [dateLeft_, dateRight_] = normalizeDates(
12752 options?.in,
12753 laterDate,
12754 earlierDate
12755 );
12756 return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
12757 }
12758
12759 // node_modules/date-fns/isDate.js
12760 function isDate(value) {
12761 return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
12762 }
12763
12764 // node_modules/date-fns/isValid.js
12765 function isValid(date) {
12766 return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
12767 }
12768
12769 // node_modules/date-fns/differenceInCalendarMonths.js
12770 function differenceInCalendarMonths(laterDate, earlierDate, options) {
12771 const [laterDate_, earlierDate_] = normalizeDates(
12772 options?.in,
12773 laterDate,
12774 earlierDate
12775 );
12776 const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
12777 const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
12778 return yearsDiff * 12 + monthsDiff;
12779 }
12780
12781 // node_modules/date-fns/endOfMonth.js
12782 function endOfMonth(date, options) {
12783 const _date = toDate(date, options?.in);
12784 const month = _date.getMonth();
12785 _date.setFullYear(_date.getFullYear(), month + 1, 0);
12786 _date.setHours(23, 59, 59, 999);
12787 return _date;
12788 }
12789
12790 // node_modules/date-fns/_lib/normalizeInterval.js
12791 function normalizeInterval(context, interval) {
12792 const [start, end] = normalizeDates(context, interval.start, interval.end);
12793 return { start, end };
12794 }
12795
12796 // node_modules/date-fns/eachMonthOfInterval.js
12797 function eachMonthOfInterval(interval, options) {
12798 const { start, end } = normalizeInterval(options?.in, interval);
12799 let reversed = +start > +end;
12800 const endTime = reversed ? +start : +end;
12801 const date = reversed ? end : start;
12802 date.setHours(0, 0, 0, 0);
12803 date.setDate(1);
12804 let step = options?.step ?? 1;
12805 if (!step) return [];
12806 if (step < 0) {
12807 step = -step;
12808 reversed = !reversed;
12809 }
12810 const dates = [];
12811 while (+date <= endTime) {
12812 dates.push(constructFrom(start, date));
12813 date.setMonth(date.getMonth() + step);
12814 }
12815 return reversed ? dates.reverse() : dates;
12816 }
12817
12818 // node_modules/date-fns/startOfMonth.js
12819 function startOfMonth(date, options) {
12820 const _date = toDate(date, options?.in);
12821 _date.setDate(1);
12822 _date.setHours(0, 0, 0, 0);
12823 return _date;
12824 }
12825
12826 // node_modules/date-fns/endOfYear.js
12827 function endOfYear(date, options) {
12828 const _date = toDate(date, options?.in);
12829 const year = _date.getFullYear();
12830 _date.setFullYear(year + 1, 0, 0);
12831 _date.setHours(23, 59, 59, 999);
12832 return _date;
12833 }
12834
12835 // node_modules/date-fns/startOfYear.js
12836 function startOfYear(date, options) {
12837 const date_ = toDate(date, options?.in);
12838 date_.setFullYear(date_.getFullYear(), 0, 1);
12839 date_.setHours(0, 0, 0, 0);
12840 return date_;
12841 }
12842
12843 // node_modules/date-fns/eachYearOfInterval.js
12844 function eachYearOfInterval(interval, options) {
12845 const { start, end } = normalizeInterval(options?.in, interval);
12846 let reversed = +start > +end;
12847 const endTime = reversed ? +start : +end;
12848 const date = reversed ? end : start;
12849 date.setHours(0, 0, 0, 0);
12850 date.setMonth(0, 1);
12851 let step = options?.step ?? 1;
12852 if (!step) return [];
12853 if (step < 0) {
12854 step = -step;
12855 reversed = !reversed;
12856 }
12857 const dates = [];
12858 while (+date <= endTime) {
12859 dates.push(constructFrom(start, date));
12860 date.setFullYear(date.getFullYear() + step);
12861 }
12862 return reversed ? dates.reverse() : dates;
12863 }
12864
12865 // node_modules/date-fns/endOfWeek.js
12866 function endOfWeek(date, options) {
12867 const defaultOptions2 = getDefaultOptions();
12868 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
12869 const _date = toDate(date, options?.in);
12870 const day = _date.getDay();
12871 const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
12872 _date.setDate(_date.getDate() + diff);
12873 _date.setHours(23, 59, 59, 999);
12874 return _date;
12875 }
12876
12877 // node_modules/date-fns/endOfISOWeek.js
12878 function endOfISOWeek(date, options) {
12879 return endOfWeek(date, { ...options, weekStartsOn: 1 });
12880 }
12881
12882 // node_modules/date-fns/locale/en-US/_lib/formatDistance.js
12883 var formatDistanceLocale = {
12884 lessThanXSeconds: {
12885 one: "less than a second",
12886 other: "less than {{count}} seconds"
12887 },
12888 xSeconds: {
12889 one: "1 second",
12890 other: "{{count}} seconds"
12891 },
12892 halfAMinute: "half a minute",
12893 lessThanXMinutes: {
12894 one: "less than a minute",
12895 other: "less than {{count}} minutes"
12896 },
12897 xMinutes: {
12898 one: "1 minute",
12899 other: "{{count}} minutes"
12900 },
12901 aboutXHours: {
12902 one: "about 1 hour",
12903 other: "about {{count}} hours"
12904 },
12905 xHours: {
12906 one: "1 hour",
12907 other: "{{count}} hours"
12908 },
12909 xDays: {
12910 one: "1 day",
12911 other: "{{count}} days"
12912 },
12913 aboutXWeeks: {
12914 one: "about 1 week",
12915 other: "about {{count}} weeks"
12916 },
12917 xWeeks: {
12918 one: "1 week",
12919 other: "{{count}} weeks"
12920 },
12921 aboutXMonths: {
12922 one: "about 1 month",
12923 other: "about {{count}} months"
12924 },
12925 xMonths: {
12926 one: "1 month",
12927 other: "{{count}} months"
12928 },
12929 aboutXYears: {
12930 one: "about 1 year",
12931 other: "about {{count}} years"
12932 },
12933 xYears: {
12934 one: "1 year",
12935 other: "{{count}} years"
12936 },
12937 overXYears: {
12938 one: "over 1 year",
12939 other: "over {{count}} years"
12940 },
12941 almostXYears: {
12942 one: "almost 1 year",
12943 other: "almost {{count}} years"
12944 }
12945 };
12946 var formatDistance = (token, count, options) => {
12947 let result;
12948 const tokenValue = formatDistanceLocale[token];
12949 if (typeof tokenValue === "string") {
12950 result = tokenValue;
12951 } else if (count === 1) {
12952 result = tokenValue.one;
12953 } else {
12954 result = tokenValue.other.replace("{{count}}", count.toString());
12955 }
12956 if (options?.addSuffix) {
12957 if (options.comparison && options.comparison > 0) {
12958 return "in " + result;
12959 } else {
12960 return result + " ago";
12961 }
12962 }
12963 return result;
12964 };
12965
12966 // node_modules/date-fns/locale/_lib/buildFormatLongFn.js
12967 function buildFormatLongFn(args) {
12968 return (options = {}) => {
12969 const width = options.width ? String(options.width) : args.defaultWidth;
12970 const format7 = args.formats[width] || args.formats[args.defaultWidth];
12971 return format7;
12972 };
12973 }
12974
12975 // node_modules/date-fns/locale/en-US/_lib/formatLong.js
12976 var dateFormats = {
12977 full: "EEEE, MMMM do, y",
12978 long: "MMMM do, y",
12979 medium: "MMM d, y",
12980 short: "MM/dd/yyyy"
12981 };
12982 var timeFormats = {
12983 full: "h:mm:ss a zzzz",
12984 long: "h:mm:ss a z",
12985 medium: "h:mm:ss a",
12986 short: "h:mm a"
12987 };
12988 var dateTimeFormats = {
12989 full: "{{date}} 'at' {{time}}",
12990 long: "{{date}} 'at' {{time}}",
12991 medium: "{{date}}, {{time}}",
12992 short: "{{date}}, {{time}}"
12993 };
12994 var formatLong = {
12995 date: buildFormatLongFn({
12996 formats: dateFormats,
12997 defaultWidth: "full"
12998 }),
12999 time: buildFormatLongFn({
13000 formats: timeFormats,
13001 defaultWidth: "full"
13002 }),
13003 dateTime: buildFormatLongFn({
13004 formats: dateTimeFormats,
13005 defaultWidth: "full"
13006 })
13007 };
13008
13009 // node_modules/date-fns/locale/en-US/_lib/formatRelative.js
13010 var formatRelativeLocale = {
13011 lastWeek: "'last' eeee 'at' p",
13012 yesterday: "'yesterday at' p",
13013 today: "'today at' p",
13014 tomorrow: "'tomorrow at' p",
13015 nextWeek: "eeee 'at' p",
13016 other: "P"
13017 };
13018 var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
13019
13020 // node_modules/date-fns/locale/_lib/buildLocalizeFn.js
13021 function buildLocalizeFn(args) {
13022 return (value, options) => {
13023 const context = options?.context ? String(options.context) : "standalone";
13024 let valuesArray;
13025 if (context === "formatting" && args.formattingValues) {
13026 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
13027 const width = options?.width ? String(options.width) : defaultWidth;
13028 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
13029 } else {
13030 const defaultWidth = args.defaultWidth;
13031 const width = options?.width ? String(options.width) : args.defaultWidth;
13032 valuesArray = args.values[width] || args.values[defaultWidth];
13033 }
13034 const index2 = args.argumentCallback ? args.argumentCallback(value) : value;
13035 return valuesArray[index2];
13036 };
13037 }
13038
13039 // node_modules/date-fns/locale/en-US/_lib/localize.js
13040 var eraValues = {
13041 narrow: ["B", "A"],
13042 abbreviated: ["BC", "AD"],
13043 wide: ["Before Christ", "Anno Domini"]
13044 };
13045 var quarterValues = {
13046 narrow: ["1", "2", "3", "4"],
13047 abbreviated: ["Q1", "Q2", "Q3", "Q4"],
13048 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
13049 };
13050 var monthValues = {
13051 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
13052 abbreviated: [
13053 "Jan",
13054 "Feb",
13055 "Mar",
13056 "Apr",
13057 "May",
13058 "Jun",
13059 "Jul",
13060 "Aug",
13061 "Sep",
13062 "Oct",
13063 "Nov",
13064 "Dec"
13065 ],
13066 wide: [
13067 "January",
13068 "February",
13069 "March",
13070 "April",
13071 "May",
13072 "June",
13073 "July",
13074 "August",
13075 "September",
13076 "October",
13077 "November",
13078 "December"
13079 ]
13080 };
13081 var dayValues = {
13082 narrow: ["S", "M", "T", "W", "T", "F", "S"],
13083 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
13084 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
13085 wide: [
13086 "Sunday",
13087 "Monday",
13088 "Tuesday",
13089 "Wednesday",
13090 "Thursday",
13091 "Friday",
13092 "Saturday"
13093 ]
13094 };
13095 var dayPeriodValues = {
13096 narrow: {
13097 am: "a",
13098 pm: "p",
13099 midnight: "mi",
13100 noon: "n",
13101 morning: "morning",
13102 afternoon: "afternoon",
13103 evening: "evening",
13104 night: "night"
13105 },
13106 abbreviated: {
13107 am: "AM",
13108 pm: "PM",
13109 midnight: "midnight",
13110 noon: "noon",
13111 morning: "morning",
13112 afternoon: "afternoon",
13113 evening: "evening",
13114 night: "night"
13115 },
13116 wide: {
13117 am: "a.m.",
13118 pm: "p.m.",
13119 midnight: "midnight",
13120 noon: "noon",
13121 morning: "morning",
13122 afternoon: "afternoon",
13123 evening: "evening",
13124 night: "night"
13125 }
13126 };
13127 var formattingDayPeriodValues = {
13128 narrow: {
13129 am: "a",
13130 pm: "p",
13131 midnight: "mi",
13132 noon: "n",
13133 morning: "in the morning",
13134 afternoon: "in the afternoon",
13135 evening: "in the evening",
13136 night: "at night"
13137 },
13138 abbreviated: {
13139 am: "AM",
13140 pm: "PM",
13141 midnight: "midnight",
13142 noon: "noon",
13143 morning: "in the morning",
13144 afternoon: "in the afternoon",
13145 evening: "in the evening",
13146 night: "at night"
13147 },
13148 wide: {
13149 am: "a.m.",
13150 pm: "p.m.",
13151 midnight: "midnight",
13152 noon: "noon",
13153 morning: "in the morning",
13154 afternoon: "in the afternoon",
13155 evening: "in the evening",
13156 night: "at night"
13157 }
13158 };
13159 var ordinalNumber = (dirtyNumber, _options) => {
13160 const number = Number(dirtyNumber);
13161 const rem100 = number % 100;
13162 if (rem100 > 20 || rem100 < 10) {
13163 switch (rem100 % 10) {
13164 case 1:
13165 return number + "st";
13166 case 2:
13167 return number + "nd";
13168 case 3:
13169 return number + "rd";
13170 }
13171 }
13172 return number + "th";
13173 };
13174 var localize = {
13175 ordinalNumber,
13176 era: buildLocalizeFn({
13177 values: eraValues,
13178 defaultWidth: "wide"
13179 }),
13180 quarter: buildLocalizeFn({
13181 values: quarterValues,
13182 defaultWidth: "wide",
13183 argumentCallback: (quarter) => quarter - 1
13184 }),
13185 month: buildLocalizeFn({
13186 values: monthValues,
13187 defaultWidth: "wide"
13188 }),
13189 day: buildLocalizeFn({
13190 values: dayValues,
13191 defaultWidth: "wide"
13192 }),
13193 dayPeriod: buildLocalizeFn({
13194 values: dayPeriodValues,
13195 defaultWidth: "wide",
13196 formattingValues: formattingDayPeriodValues,
13197 defaultFormattingWidth: "wide"
13198 })
13199 };
13200
13201 // node_modules/date-fns/locale/_lib/buildMatchFn.js
13202 function buildMatchFn(args) {
13203 return (string, options = {}) => {
13204 const width = options.width;
13205 const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
13206 const matchResult = string.match(matchPattern);
13207 if (!matchResult) {
13208 return null;
13209 }
13210 const matchedString = matchResult[0];
13211 const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
13212 const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
13213 // [TODO] -- I challenge you to fix the type
13214 findKey(parsePatterns, (pattern) => pattern.test(matchedString))
13215 );
13216 let value;
13217 value = args.valueCallback ? args.valueCallback(key) : key;
13218 value = options.valueCallback ? (
13219 // [TODO] -- I challenge you to fix the type
13220 options.valueCallback(value)
13221 ) : value;
13222 const rest = string.slice(matchedString.length);
13223 return { value, rest };
13224 };
13225 }
13226 function findKey(object, predicate) {
13227 for (const key in object) {
13228 if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
13229 return key;
13230 }
13231 }
13232 return void 0;
13233 }
13234 function findIndex(array, predicate) {
13235 for (let key = 0; key < array.length; key++) {
13236 if (predicate(array[key])) {
13237 return key;
13238 }
13239 }
13240 return void 0;
13241 }
13242
13243 // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
13244 function buildMatchPatternFn(args) {
13245 return (string, options = {}) => {
13246 const matchResult = string.match(args.matchPattern);
13247 if (!matchResult) return null;
13248 const matchedString = matchResult[0];
13249 const parseResult = string.match(args.parsePattern);
13250 if (!parseResult) return null;
13251 let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
13252 value = options.valueCallback ? options.valueCallback(value) : value;
13253 const rest = string.slice(matchedString.length);
13254 return { value, rest };
13255 };
13256 }
13257
13258 // node_modules/date-fns/locale/en-US/_lib/match.js
13259 var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
13260 var parseOrdinalNumberPattern = /\d+/i;
13261 var matchEraPatterns = {
13262 narrow: /^(b|a)/i,
13263 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
13264 wide: /^(before christ|before common era|anno domini|common era)/i
13265 };
13266 var parseEraPatterns = {
13267 any: [/^b/i, /^(a|c)/i]
13268 };
13269 var matchQuarterPatterns = {
13270 narrow: /^[1234]/i,
13271 abbreviated: /^q[1234]/i,
13272 wide: /^[1234](th|st|nd|rd)? quarter/i
13273 };
13274 var parseQuarterPatterns = {
13275 any: [/1/i, /2/i, /3/i, /4/i]
13276 };
13277 var matchMonthPatterns = {
13278 narrow: /^[jfmasond]/i,
13279 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
13280 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
13281 };
13282 var parseMonthPatterns = {
13283 narrow: [
13284 /^j/i,
13285 /^f/i,
13286 /^m/i,
13287 /^a/i,
13288 /^m/i,
13289 /^j/i,
13290 /^j/i,
13291 /^a/i,
13292 /^s/i,
13293 /^o/i,
13294 /^n/i,
13295 /^d/i
13296 ],
13297 any: [
13298 /^ja/i,
13299 /^f/i,
13300 /^mar/i,
13301 /^ap/i,
13302 /^may/i,
13303 /^jun/i,
13304 /^jul/i,
13305 /^au/i,
13306 /^s/i,
13307 /^o/i,
13308 /^n/i,
13309 /^d/i
13310 ]
13311 };
13312 var matchDayPatterns = {
13313 narrow: /^[smtwf]/i,
13314 short: /^(su|mo|tu|we|th|fr|sa)/i,
13315 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
13316 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
13317 };
13318 var parseDayPatterns = {
13319 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
13320 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
13321 };
13322 var matchDayPeriodPatterns = {
13323 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
13324 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
13325 };
13326 var parseDayPeriodPatterns = {
13327 any: {
13328 am: /^a/i,
13329 pm: /^p/i,
13330 midnight: /^mi/i,
13331 noon: /^no/i,
13332 morning: /morning/i,
13333 afternoon: /afternoon/i,
13334 evening: /evening/i,
13335 night: /night/i
13336 }
13337 };
13338 var match = {
13339 ordinalNumber: buildMatchPatternFn({
13340 matchPattern: matchOrdinalNumberPattern,
13341 parsePattern: parseOrdinalNumberPattern,
13342 valueCallback: (value) => parseInt(value, 10)
13343 }),
13344 era: buildMatchFn({
13345 matchPatterns: matchEraPatterns,
13346 defaultMatchWidth: "wide",
13347 parsePatterns: parseEraPatterns,
13348 defaultParseWidth: "any"
13349 }),
13350 quarter: buildMatchFn({
13351 matchPatterns: matchQuarterPatterns,
13352 defaultMatchWidth: "wide",
13353 parsePatterns: parseQuarterPatterns,
13354 defaultParseWidth: "any",
13355 valueCallback: (index2) => index2 + 1
13356 }),
13357 month: buildMatchFn({
13358 matchPatterns: matchMonthPatterns,
13359 defaultMatchWidth: "wide",
13360 parsePatterns: parseMonthPatterns,
13361 defaultParseWidth: "any"
13362 }),
13363 day: buildMatchFn({
13364 matchPatterns: matchDayPatterns,
13365 defaultMatchWidth: "wide",
13366 parsePatterns: parseDayPatterns,
13367 defaultParseWidth: "any"
13368 }),
13369 dayPeriod: buildMatchFn({
13370 matchPatterns: matchDayPeriodPatterns,
13371 defaultMatchWidth: "any",
13372 parsePatterns: parseDayPeriodPatterns,
13373 defaultParseWidth: "any"
13374 })
13375 };
13376
13377 // node_modules/date-fns/locale/en-US.js
13378 var enUS = {
13379 code: "en-US",
13380 formatDistance,
13381 formatLong,
13382 formatRelative,
13383 localize,
13384 match,
13385 options: {
13386 weekStartsOn: 0,
13387 firstWeekContainsDate: 1
13388 }
13389 };
13390
13391 // node_modules/date-fns/getDayOfYear.js
13392 function getDayOfYear(date, options) {
13393 const _date = toDate(date, options?.in);
13394 const diff = differenceInCalendarDays(_date, startOfYear(_date));
13395 const dayOfYear = diff + 1;
13396 return dayOfYear;
13397 }
13398
13399 // node_modules/date-fns/getISOWeek.js
13400 function getISOWeek(date, options) {
13401 const _date = toDate(date, options?.in);
13402 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
13403 return Math.round(diff / millisecondsInWeek) + 1;
13404 }
13405
13406 // node_modules/date-fns/getWeekYear.js
13407 function getWeekYear(date, options) {
13408 const _date = toDate(date, options?.in);
13409 const year = _date.getFullYear();
13410 const defaultOptions2 = getDefaultOptions();
13411 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
13412 const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
13413 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
13414 firstWeekOfNextYear.setHours(0, 0, 0, 0);
13415 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
13416 const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
13417 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
13418 firstWeekOfThisYear.setHours(0, 0, 0, 0);
13419 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
13420 if (+_date >= +startOfNextYear) {
13421 return year + 1;
13422 } else if (+_date >= +startOfThisYear) {
13423 return year;
13424 } else {
13425 return year - 1;
13426 }
13427 }
13428
13429 // node_modules/date-fns/startOfWeekYear.js
13430 function startOfWeekYear(date, options) {
13431 const defaultOptions2 = getDefaultOptions();
13432 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
13433 const year = getWeekYear(date, options);
13434 const firstWeek = constructFrom(options?.in || date, 0);
13435 firstWeek.setFullYear(year, 0, firstWeekContainsDate);
13436 firstWeek.setHours(0, 0, 0, 0);
13437 const _date = startOfWeek(firstWeek, options);
13438 return _date;
13439 }
13440
13441 // node_modules/date-fns/getWeek.js
13442 function getWeek(date, options) {
13443 const _date = toDate(date, options?.in);
13444 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
13445 return Math.round(diff / millisecondsInWeek) + 1;
13446 }
13447
13448 // node_modules/date-fns/_lib/addLeadingZeros.js
13449 function addLeadingZeros(number, targetLength) {
13450 const sign = number < 0 ? "-" : "";
13451 const output = Math.abs(number).toString().padStart(targetLength, "0");
13452 return sign + output;
13453 }
13454
13455 // node_modules/date-fns/_lib/format/lightFormatters.js
13456 var lightFormatters = {
13457 // Year
13458 y(date, token) {
13459 const signedYear = date.getFullYear();
13460 const year = signedYear > 0 ? signedYear : 1 - signedYear;
13461 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
13462 },
13463 // Month
13464 M(date, token) {
13465 const month = date.getMonth();
13466 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
13467 },
13468 // Day of the month
13469 d(date, token) {
13470 return addLeadingZeros(date.getDate(), token.length);
13471 },
13472 // AM or PM
13473 a(date, token) {
13474 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
13475 switch (token) {
13476 case "a":
13477 case "aa":
13478 return dayPeriodEnumValue.toUpperCase();
13479 case "aaa":
13480 return dayPeriodEnumValue;
13481 case "aaaaa":
13482 return dayPeriodEnumValue[0];
13483 case "aaaa":
13484 default:
13485 return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
13486 }
13487 },
13488 // Hour [1-12]
13489 h(date, token) {
13490 return addLeadingZeros(date.getHours() % 12 || 12, token.length);
13491 },
13492 // Hour [0-23]
13493 H(date, token) {
13494 return addLeadingZeros(date.getHours(), token.length);
13495 },
13496 // Minute
13497 m(date, token) {
13498 return addLeadingZeros(date.getMinutes(), token.length);
13499 },
13500 // Second
13501 s(date, token) {
13502 return addLeadingZeros(date.getSeconds(), token.length);
13503 },
13504 // Fraction of second
13505 S(date, token) {
13506 const numberOfDigits = token.length;
13507 const milliseconds = date.getMilliseconds();
13508 const fractionalSeconds = Math.trunc(
13509 milliseconds * Math.pow(10, numberOfDigits - 3)
13510 );
13511 return addLeadingZeros(fractionalSeconds, token.length);
13512 }
13513 };
13514
13515 // node_modules/date-fns/_lib/format/formatters.js
13516 var dayPeriodEnum = {
13517 am: "am",
13518 pm: "pm",
13519 midnight: "midnight",
13520 noon: "noon",
13521 morning: "morning",
13522 afternoon: "afternoon",
13523 evening: "evening",
13524 night: "night"
13525 };
13526 var formatters = {
13527 // Era
13528 G: function(date, token, localize2) {
13529 const era = date.getFullYear() > 0 ? 1 : 0;
13530 switch (token) {
13531 // AD, BC
13532 case "G":
13533 case "GG":
13534 case "GGG":
13535 return localize2.era(era, { width: "abbreviated" });
13536 // A, B
13537 case "GGGGG":
13538 return localize2.era(era, { width: "narrow" });
13539 // Anno Domini, Before Christ
13540 case "GGGG":
13541 default:
13542 return localize2.era(era, { width: "wide" });
13543 }
13544 },
13545 // Year
13546 y: function(date, token, localize2) {
13547 if (token === "yo") {
13548 const signedYear = date.getFullYear();
13549 const year = signedYear > 0 ? signedYear : 1 - signedYear;
13550 return localize2.ordinalNumber(year, { unit: "year" });
13551 }
13552 return lightFormatters.y(date, token);
13553 },
13554 // Local week-numbering year
13555 Y: function(date, token, localize2, options) {
13556 const signedWeekYear = getWeekYear(date, options);
13557 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
13558 if (token === "YY") {
13559 const twoDigitYear = weekYear % 100;
13560 return addLeadingZeros(twoDigitYear, 2);
13561 }
13562 if (token === "Yo") {
13563 return localize2.ordinalNumber(weekYear, { unit: "year" });
13564 }
13565 return addLeadingZeros(weekYear, token.length);
13566 },
13567 // ISO week-numbering year
13568 R: function(date, token) {
13569 const isoWeekYear = getISOWeekYear(date);
13570 return addLeadingZeros(isoWeekYear, token.length);
13571 },
13572 // Extended year. This is a single number designating the year of this calendar system.
13573 // The main difference between `y` and `u` localizers are B.C. years:
13574 // | Year | `y` | `u` |
13575 // |------|-----|-----|
13576 // | AC 1 | 1 | 1 |
13577 // | BC 1 | 1 | 0 |
13578 // | BC 2 | 2 | -1 |
13579 // Also `yy` always returns the last two digits of a year,
13580 // while `uu` pads single digit years to 2 characters and returns other years unchanged.
13581 u: function(date, token) {
13582 const year = date.getFullYear();
13583 return addLeadingZeros(year, token.length);
13584 },
13585 // Quarter
13586 Q: function(date, token, localize2) {
13587 const quarter = Math.ceil((date.getMonth() + 1) / 3);
13588 switch (token) {
13589 // 1, 2, 3, 4
13590 case "Q":
13591 return String(quarter);
13592 // 01, 02, 03, 04
13593 case "QQ":
13594 return addLeadingZeros(quarter, 2);
13595 // 1st, 2nd, 3rd, 4th
13596 case "Qo":
13597 return localize2.ordinalNumber(quarter, { unit: "quarter" });
13598 // Q1, Q2, Q3, Q4
13599 case "QQQ":
13600 return localize2.quarter(quarter, {
13601 width: "abbreviated",
13602 context: "formatting"
13603 });
13604 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
13605 case "QQQQQ":
13606 return localize2.quarter(quarter, {
13607 width: "narrow",
13608 context: "formatting"
13609 });
13610 // 1st quarter, 2nd quarter, ...
13611 case "QQQQ":
13612 default:
13613 return localize2.quarter(quarter, {
13614 width: "wide",
13615 context: "formatting"
13616 });
13617 }
13618 },
13619 // Stand-alone quarter
13620 q: function(date, token, localize2) {
13621 const quarter = Math.ceil((date.getMonth() + 1) / 3);
13622 switch (token) {
13623 // 1, 2, 3, 4
13624 case "q":
13625 return String(quarter);
13626 // 01, 02, 03, 04
13627 case "qq":
13628 return addLeadingZeros(quarter, 2);
13629 // 1st, 2nd, 3rd, 4th
13630 case "qo":
13631 return localize2.ordinalNumber(quarter, { unit: "quarter" });
13632 // Q1, Q2, Q3, Q4
13633 case "qqq":
13634 return localize2.quarter(quarter, {
13635 width: "abbreviated",
13636 context: "standalone"
13637 });
13638 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
13639 case "qqqqq":
13640 return localize2.quarter(quarter, {
13641 width: "narrow",
13642 context: "standalone"
13643 });
13644 // 1st quarter, 2nd quarter, ...
13645 case "qqqq":
13646 default:
13647 return localize2.quarter(quarter, {
13648 width: "wide",
13649 context: "standalone"
13650 });
13651 }
13652 },
13653 // Month
13654 M: function(date, token, localize2) {
13655 const month = date.getMonth();
13656 switch (token) {
13657 case "M":
13658 case "MM":
13659 return lightFormatters.M(date, token);
13660 // 1st, 2nd, ..., 12th
13661 case "Mo":
13662 return localize2.ordinalNumber(month + 1, { unit: "month" });
13663 // Jan, Feb, ..., Dec
13664 case "MMM":
13665 return localize2.month(month, {
13666 width: "abbreviated",
13667 context: "formatting"
13668 });
13669 // J, F, ..., D
13670 case "MMMMM":
13671 return localize2.month(month, {
13672 width: "narrow",
13673 context: "formatting"
13674 });
13675 // January, February, ..., December
13676 case "MMMM":
13677 default:
13678 return localize2.month(month, { width: "wide", context: "formatting" });
13679 }
13680 },
13681 // Stand-alone month
13682 L: function(date, token, localize2) {
13683 const month = date.getMonth();
13684 switch (token) {
13685 // 1, 2, ..., 12
13686 case "L":
13687 return String(month + 1);
13688 // 01, 02, ..., 12
13689 case "LL":
13690 return addLeadingZeros(month + 1, 2);
13691 // 1st, 2nd, ..., 12th
13692 case "Lo":
13693 return localize2.ordinalNumber(month + 1, { unit: "month" });
13694 // Jan, Feb, ..., Dec
13695 case "LLL":
13696 return localize2.month(month, {
13697 width: "abbreviated",
13698 context: "standalone"
13699 });
13700 // J, F, ..., D
13701 case "LLLLL":
13702 return localize2.month(month, {
13703 width: "narrow",
13704 context: "standalone"
13705 });
13706 // January, February, ..., December
13707 case "LLLL":
13708 default:
13709 return localize2.month(month, { width: "wide", context: "standalone" });
13710 }
13711 },
13712 // Local week of year
13713 w: function(date, token, localize2, options) {
13714 const week = getWeek(date, options);
13715 if (token === "wo") {
13716 return localize2.ordinalNumber(week, { unit: "week" });
13717 }
13718 return addLeadingZeros(week, token.length);
13719 },
13720 // ISO week of year
13721 I: function(date, token, localize2) {
13722 const isoWeek = getISOWeek(date);
13723 if (token === "Io") {
13724 return localize2.ordinalNumber(isoWeek, { unit: "week" });
13725 }
13726 return addLeadingZeros(isoWeek, token.length);
13727 },
13728 // Day of the month
13729 d: function(date, token, localize2) {
13730 if (token === "do") {
13731 return localize2.ordinalNumber(date.getDate(), { unit: "date" });
13732 }
13733 return lightFormatters.d(date, token);
13734 },
13735 // Day of year
13736 D: function(date, token, localize2) {
13737 const dayOfYear = getDayOfYear(date);
13738 if (token === "Do") {
13739 return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
13740 }
13741 return addLeadingZeros(dayOfYear, token.length);
13742 },
13743 // Day of week
13744 E: function(date, token, localize2) {
13745 const dayOfWeek = date.getDay();
13746 switch (token) {
13747 // Tue
13748 case "E":
13749 case "EE":
13750 case "EEE":
13751 return localize2.day(dayOfWeek, {
13752 width: "abbreviated",
13753 context: "formatting"
13754 });
13755 // T
13756 case "EEEEE":
13757 return localize2.day(dayOfWeek, {
13758 width: "narrow",
13759 context: "formatting"
13760 });
13761 // Tu
13762 case "EEEEEE":
13763 return localize2.day(dayOfWeek, {
13764 width: "short",
13765 context: "formatting"
13766 });
13767 // Tuesday
13768 case "EEEE":
13769 default:
13770 return localize2.day(dayOfWeek, {
13771 width: "wide",
13772 context: "formatting"
13773 });
13774 }
13775 },
13776 // Local day of week
13777 e: function(date, token, localize2, options) {
13778 const dayOfWeek = date.getDay();
13779 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
13780 switch (token) {
13781 // Numerical value (Nth day of week with current locale or weekStartsOn)
13782 case "e":
13783 return String(localDayOfWeek);
13784 // Padded numerical value
13785 case "ee":
13786 return addLeadingZeros(localDayOfWeek, 2);
13787 // 1st, 2nd, ..., 7th
13788 case "eo":
13789 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
13790 case "eee":
13791 return localize2.day(dayOfWeek, {
13792 width: "abbreviated",
13793 context: "formatting"
13794 });
13795 // T
13796 case "eeeee":
13797 return localize2.day(dayOfWeek, {
13798 width: "narrow",
13799 context: "formatting"
13800 });
13801 // Tu
13802 case "eeeeee":
13803 return localize2.day(dayOfWeek, {
13804 width: "short",
13805 context: "formatting"
13806 });
13807 // Tuesday
13808 case "eeee":
13809 default:
13810 return localize2.day(dayOfWeek, {
13811 width: "wide",
13812 context: "formatting"
13813 });
13814 }
13815 },
13816 // Stand-alone local day of week
13817 c: function(date, token, localize2, options) {
13818 const dayOfWeek = date.getDay();
13819 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
13820 switch (token) {
13821 // Numerical value (same as in `e`)
13822 case "c":
13823 return String(localDayOfWeek);
13824 // Padded numerical value
13825 case "cc":
13826 return addLeadingZeros(localDayOfWeek, token.length);
13827 // 1st, 2nd, ..., 7th
13828 case "co":
13829 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
13830 case "ccc":
13831 return localize2.day(dayOfWeek, {
13832 width: "abbreviated",
13833 context: "standalone"
13834 });
13835 // T
13836 case "ccccc":
13837 return localize2.day(dayOfWeek, {
13838 width: "narrow",
13839 context: "standalone"
13840 });
13841 // Tu
13842 case "cccccc":
13843 return localize2.day(dayOfWeek, {
13844 width: "short",
13845 context: "standalone"
13846 });
13847 // Tuesday
13848 case "cccc":
13849 default:
13850 return localize2.day(dayOfWeek, {
13851 width: "wide",
13852 context: "standalone"
13853 });
13854 }
13855 },
13856 // ISO day of week
13857 i: function(date, token, localize2) {
13858 const dayOfWeek = date.getDay();
13859 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
13860 switch (token) {
13861 // 2
13862 case "i":
13863 return String(isoDayOfWeek);
13864 // 02
13865 case "ii":
13866 return addLeadingZeros(isoDayOfWeek, token.length);
13867 // 2nd
13868 case "io":
13869 return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
13870 // Tue
13871 case "iii":
13872 return localize2.day(dayOfWeek, {
13873 width: "abbreviated",
13874 context: "formatting"
13875 });
13876 // T
13877 case "iiiii":
13878 return localize2.day(dayOfWeek, {
13879 width: "narrow",
13880 context: "formatting"
13881 });
13882 // Tu
13883 case "iiiiii":
13884 return localize2.day(dayOfWeek, {
13885 width: "short",
13886 context: "formatting"
13887 });
13888 // Tuesday
13889 case "iiii":
13890 default:
13891 return localize2.day(dayOfWeek, {
13892 width: "wide",
13893 context: "formatting"
13894 });
13895 }
13896 },
13897 // AM or PM
13898 a: function(date, token, localize2) {
13899 const hours = date.getHours();
13900 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
13901 switch (token) {
13902 case "a":
13903 case "aa":
13904 return localize2.dayPeriod(dayPeriodEnumValue, {
13905 width: "abbreviated",
13906 context: "formatting"
13907 });
13908 case "aaa":
13909 return localize2.dayPeriod(dayPeriodEnumValue, {
13910 width: "abbreviated",
13911 context: "formatting"
13912 }).toLowerCase();
13913 case "aaaaa":
13914 return localize2.dayPeriod(dayPeriodEnumValue, {
13915 width: "narrow",
13916 context: "formatting"
13917 });
13918 case "aaaa":
13919 default:
13920 return localize2.dayPeriod(dayPeriodEnumValue, {
13921 width: "wide",
13922 context: "formatting"
13923 });
13924 }
13925 },
13926 // AM, PM, midnight, noon
13927 b: function(date, token, localize2) {
13928 const hours = date.getHours();
13929 let dayPeriodEnumValue;
13930 if (hours === 12) {
13931 dayPeriodEnumValue = dayPeriodEnum.noon;
13932 } else if (hours === 0) {
13933 dayPeriodEnumValue = dayPeriodEnum.midnight;
13934 } else {
13935 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
13936 }
13937 switch (token) {
13938 case "b":
13939 case "bb":
13940 return localize2.dayPeriod(dayPeriodEnumValue, {
13941 width: "abbreviated",
13942 context: "formatting"
13943 });
13944 case "bbb":
13945 return localize2.dayPeriod(dayPeriodEnumValue, {
13946 width: "abbreviated",
13947 context: "formatting"
13948 }).toLowerCase();
13949 case "bbbbb":
13950 return localize2.dayPeriod(dayPeriodEnumValue, {
13951 width: "narrow",
13952 context: "formatting"
13953 });
13954 case "bbbb":
13955 default:
13956 return localize2.dayPeriod(dayPeriodEnumValue, {
13957 width: "wide",
13958 context: "formatting"
13959 });
13960 }
13961 },
13962 // in the morning, in the afternoon, in the evening, at night
13963 B: function(date, token, localize2) {
13964 const hours = date.getHours();
13965 let dayPeriodEnumValue;
13966 if (hours >= 17) {
13967 dayPeriodEnumValue = dayPeriodEnum.evening;
13968 } else if (hours >= 12) {
13969 dayPeriodEnumValue = dayPeriodEnum.afternoon;
13970 } else if (hours >= 4) {
13971 dayPeriodEnumValue = dayPeriodEnum.morning;
13972 } else {
13973 dayPeriodEnumValue = dayPeriodEnum.night;
13974 }
13975 switch (token) {
13976 case "B":
13977 case "BB":
13978 case "BBB":
13979 return localize2.dayPeriod(dayPeriodEnumValue, {
13980 width: "abbreviated",
13981 context: "formatting"
13982 });
13983 case "BBBBB":
13984 return localize2.dayPeriod(dayPeriodEnumValue, {
13985 width: "narrow",
13986 context: "formatting"
13987 });
13988 case "BBBB":
13989 default:
13990 return localize2.dayPeriod(dayPeriodEnumValue, {
13991 width: "wide",
13992 context: "formatting"
13993 });
13994 }
13995 },
13996 // Hour [1-12]
13997 h: function(date, token, localize2) {
13998 if (token === "ho") {
13999 let hours = date.getHours() % 12;
14000 if (hours === 0) hours = 12;
14001 return localize2.ordinalNumber(hours, { unit: "hour" });
14002 }
14003 return lightFormatters.h(date, token);
14004 },
14005 // Hour [0-23]
14006 H: function(date, token, localize2) {
14007 if (token === "Ho") {
14008 return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
14009 }
14010 return lightFormatters.H(date, token);
14011 },
14012 // Hour [0-11]
14013 K: function(date, token, localize2) {
14014 const hours = date.getHours() % 12;
14015 if (token === "Ko") {
14016 return localize2.ordinalNumber(hours, { unit: "hour" });
14017 }
14018 return addLeadingZeros(hours, token.length);
14019 },
14020 // Hour [1-24]
14021 k: function(date, token, localize2) {
14022 let hours = date.getHours();
14023 if (hours === 0) hours = 24;
14024 if (token === "ko") {
14025 return localize2.ordinalNumber(hours, { unit: "hour" });
14026 }
14027 return addLeadingZeros(hours, token.length);
14028 },
14029 // Minute
14030 m: function(date, token, localize2) {
14031 if (token === "mo") {
14032 return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
14033 }
14034 return lightFormatters.m(date, token);
14035 },
14036 // Second
14037 s: function(date, token, localize2) {
14038 if (token === "so") {
14039 return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
14040 }
14041 return lightFormatters.s(date, token);
14042 },
14043 // Fraction of second
14044 S: function(date, token) {
14045 return lightFormatters.S(date, token);
14046 },
14047 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
14048 X: function(date, token, _localize) {
14049 const timezoneOffset = date.getTimezoneOffset();
14050 if (timezoneOffset === 0) {
14051 return "Z";
14052 }
14053 switch (token) {
14054 // Hours and optional minutes
14055 case "X":
14056 return formatTimezoneWithOptionalMinutes(timezoneOffset);
14057 // Hours, minutes and optional seconds without `:` delimiter
14058 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
14059 // so this token always has the same output as `XX`
14060 case "XXXX":
14061 case "XX":
14062 return formatTimezone(timezoneOffset);
14063 // Hours, minutes and optional seconds with `:` delimiter
14064 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
14065 // so this token always has the same output as `XXX`
14066 case "XXXXX":
14067 case "XXX":
14068 // Hours and minutes with `:` delimiter
14069 default:
14070 return formatTimezone(timezoneOffset, ":");
14071 }
14072 },
14073 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
14074 x: function(date, token, _localize) {
14075 const timezoneOffset = date.getTimezoneOffset();
14076 switch (token) {
14077 // Hours and optional minutes
14078 case "x":
14079 return formatTimezoneWithOptionalMinutes(timezoneOffset);
14080 // Hours, minutes and optional seconds without `:` delimiter
14081 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
14082 // so this token always has the same output as `xx`
14083 case "xxxx":
14084 case "xx":
14085 return formatTimezone(timezoneOffset);
14086 // Hours, minutes and optional seconds with `:` delimiter
14087 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
14088 // so this token always has the same output as `xxx`
14089 case "xxxxx":
14090 case "xxx":
14091 // Hours and minutes with `:` delimiter
14092 default:
14093 return formatTimezone(timezoneOffset, ":");
14094 }
14095 },
14096 // Timezone (GMT)
14097 O: function(date, token, _localize) {
14098 const timezoneOffset = date.getTimezoneOffset();
14099 switch (token) {
14100 // Short
14101 case "O":
14102 case "OO":
14103 case "OOO":
14104 return "GMT" + formatTimezoneShort(timezoneOffset, ":");
14105 // Long
14106 case "OOOO":
14107 default:
14108 return "GMT" + formatTimezone(timezoneOffset, ":");
14109 }
14110 },
14111 // Timezone (specific non-location)
14112 z: function(date, token, _localize) {
14113 const timezoneOffset = date.getTimezoneOffset();
14114 switch (token) {
14115 // Short
14116 case "z":
14117 case "zz":
14118 case "zzz":
14119 return "GMT" + formatTimezoneShort(timezoneOffset, ":");
14120 // Long
14121 case "zzzz":
14122 default:
14123 return "GMT" + formatTimezone(timezoneOffset, ":");
14124 }
14125 },
14126 // Seconds timestamp
14127 t: function(date, token, _localize) {
14128 const timestamp = Math.trunc(+date / 1e3);
14129 return addLeadingZeros(timestamp, token.length);
14130 },
14131 // Milliseconds timestamp
14132 T: function(date, token, _localize) {
14133 return addLeadingZeros(+date, token.length);
14134 }
14135 };
14136 function formatTimezoneShort(offset4, delimiter = "") {
14137 const sign = offset4 > 0 ? "-" : "+";
14138 const absOffset = Math.abs(offset4);
14139 const hours = Math.trunc(absOffset / 60);
14140 const minutes = absOffset % 60;
14141 if (minutes === 0) {
14142 return sign + String(hours);
14143 }
14144 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
14145 }
14146 function formatTimezoneWithOptionalMinutes(offset4, delimiter) {
14147 if (offset4 % 60 === 0) {
14148 const sign = offset4 > 0 ? "-" : "+";
14149 return sign + addLeadingZeros(Math.abs(offset4) / 60, 2);
14150 }
14151 return formatTimezone(offset4, delimiter);
14152 }
14153 function formatTimezone(offset4, delimiter = "") {
14154 const sign = offset4 > 0 ? "-" : "+";
14155 const absOffset = Math.abs(offset4);
14156 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
14157 const minutes = addLeadingZeros(absOffset % 60, 2);
14158 return sign + hours + delimiter + minutes;
14159 }
14160
14161 // node_modules/date-fns/_lib/format/longFormatters.js
14162 var dateLongFormatter = (pattern, formatLong2) => {
14163 switch (pattern) {
14164 case "P":
14165 return formatLong2.date({ width: "short" });
14166 case "PP":
14167 return formatLong2.date({ width: "medium" });
14168 case "PPP":
14169 return formatLong2.date({ width: "long" });
14170 case "PPPP":
14171 default:
14172 return formatLong2.date({ width: "full" });
14173 }
14174 };
14175 var timeLongFormatter = (pattern, formatLong2) => {
14176 switch (pattern) {
14177 case "p":
14178 return formatLong2.time({ width: "short" });
14179 case "pp":
14180 return formatLong2.time({ width: "medium" });
14181 case "ppp":
14182 return formatLong2.time({ width: "long" });
14183 case "pppp":
14184 default:
14185 return formatLong2.time({ width: "full" });
14186 }
14187 };
14188 var dateTimeLongFormatter = (pattern, formatLong2) => {
14189 const matchResult = pattern.match(/(P+)(p+)?/) || [];
14190 const datePattern = matchResult[1];
14191 const timePattern = matchResult[2];
14192 if (!timePattern) {
14193 return dateLongFormatter(pattern, formatLong2);
14194 }
14195 let dateTimeFormat;
14196 switch (datePattern) {
14197 case "P":
14198 dateTimeFormat = formatLong2.dateTime({ width: "short" });
14199 break;
14200 case "PP":
14201 dateTimeFormat = formatLong2.dateTime({ width: "medium" });
14202 break;
14203 case "PPP":
14204 dateTimeFormat = formatLong2.dateTime({ width: "long" });
14205 break;
14206 case "PPPP":
14207 default:
14208 dateTimeFormat = formatLong2.dateTime({ width: "full" });
14209 break;
14210 }
14211 return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
14212 };
14213 var longFormatters = {
14214 p: timeLongFormatter,
14215 P: dateTimeLongFormatter
14216 };
14217
14218 // node_modules/date-fns/_lib/protectedTokens.js
14219 var dayOfYearTokenRE = /^D+$/;
14220 var weekYearTokenRE = /^Y+$/;
14221 var throwTokens = ["D", "DD", "YY", "YYYY"];
14222 function isProtectedDayOfYearToken(token) {
14223 return dayOfYearTokenRE.test(token);
14224 }
14225 function isProtectedWeekYearToken(token) {
14226 return weekYearTokenRE.test(token);
14227 }
14228 function warnOrThrowProtectedError(token, format7, input) {
14229 const _message = message(token, format7, input);
14230 console.warn(_message);
14231 if (throwTokens.includes(token)) throw new RangeError(_message);
14232 }
14233 function message(token, format7, input) {
14234 const subject = token[0] === "Y" ? "years" : "days of the month";
14235 return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format7}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
14236 }
14237
14238 // node_modules/date-fns/format.js
14239 var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
14240 var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
14241 var escapedStringRegExp = /^'([^]*?)'?$/;
14242 var doubleQuoteRegExp = /''/g;
14243 var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
14244 function format(date, formatStr, options) {
14245 const defaultOptions2 = getDefaultOptions();
14246 const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
14247 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
14248 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
14249 const originalDate = toDate(date, options?.in);
14250 if (!isValid(originalDate)) {
14251 throw new RangeError("Invalid time value");
14252 }
14253 let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
14254 const firstCharacter = substring[0];
14255 if (firstCharacter === "p" || firstCharacter === "P") {
14256 const longFormatter = longFormatters[firstCharacter];
14257 return longFormatter(substring, locale.formatLong);
14258 }
14259 return substring;
14260 }).join("").match(formattingTokensRegExp).map((substring) => {
14261 if (substring === "''") {
14262 return { isToken: false, value: "'" };
14263 }
14264 const firstCharacter = substring[0];
14265 if (firstCharacter === "'") {
14266 return { isToken: false, value: cleanEscapedString(substring) };
14267 }
14268 if (formatters[firstCharacter]) {
14269 return { isToken: true, value: substring };
14270 }
14271 if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
14272 throw new RangeError(
14273 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
14274 );
14275 }
14276 return { isToken: false, value: substring };
14277 });
14278 if (locale.localize.preprocessor) {
14279 parts = locale.localize.preprocessor(originalDate, parts);
14280 }
14281 const formatterOptions = {
14282 firstWeekContainsDate,
14283 weekStartsOn,
14284 locale
14285 };
14286 return parts.map((part) => {
14287 if (!part.isToken) return part.value;
14288 const token = part.value;
14289 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
14290 warnOrThrowProtectedError(token, formatStr, String(date));
14291 }
14292 const formatter = formatters[token[0]];
14293 return formatter(originalDate, token, locale.localize, formatterOptions);
14294 }).join("");
14295 }
14296 function cleanEscapedString(input) {
14297 const matched = input.match(escapedStringRegExp);
14298 if (!matched) {
14299 return input;
14300 }
14301 return matched[1].replace(doubleQuoteRegExp, "'");
14302 }
14303
14304 // node_modules/date-fns/getDaysInMonth.js
14305 function getDaysInMonth(date, options) {
14306 const _date = toDate(date, options?.in);
14307 const year = _date.getFullYear();
14308 const monthIndex = _date.getMonth();
14309 const lastDayOfMonth = constructFrom(_date, 0);
14310 lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
14311 lastDayOfMonth.setHours(0, 0, 0, 0);
14312 return lastDayOfMonth.getDate();
14313 }
14314
14315 // node_modules/date-fns/getDefaultOptions.js
14316 function getDefaultOptions2() {
14317 return Object.assign({}, getDefaultOptions());
14318 }
14319
14320 // node_modules/date-fns/getISODay.js
14321 function getISODay(date, options) {
14322 const day = toDate(date, options?.in).getDay();
14323 return day === 0 ? 7 : day;
14324 }
14325
14326 // node_modules/date-fns/getMonth.js
14327 function getMonth(date, options) {
14328 return toDate(date, options?.in).getMonth();
14329 }
14330
14331 // node_modules/date-fns/getYear.js
14332 function getYear(date, options) {
14333 return toDate(date, options?.in).getFullYear();
14334 }
14335
14336 // node_modules/date-fns/isAfter.js
14337 function isAfter(date, dateToCompare) {
14338 return +toDate(date) > +toDate(dateToCompare);
14339 }
14340
14341 // node_modules/date-fns/isBefore.js
14342 function isBefore(date, dateToCompare) {
14343 return +toDate(date) < +toDate(dateToCompare);
14344 }
14345
14346 // node_modules/date-fns/transpose.js
14347 function transpose(date, constructor) {
14348 const date_ = isConstructor(constructor) ? new constructor(0) : constructFrom(constructor, 0);
14349 date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
14350 date_.setHours(
14351 date.getHours(),
14352 date.getMinutes(),
14353 date.getSeconds(),
14354 date.getMilliseconds()
14355 );
14356 return date_;
14357 }
14358 function isConstructor(constructor) {
14359 return typeof constructor === "function" && constructor.prototype?.constructor === constructor;
14360 }
14361
14362 // node_modules/date-fns/parse/_lib/Setter.js
14363 var TIMEZONE_UNIT_PRIORITY = 10;
14364 var Setter = class {
14365 subPriority = 0;
14366 validate(_utcDate, _options) {
14367 return true;
14368 }
14369 };
14370 var ValueSetter = class extends Setter {
14371 constructor(value, validateValue, setValue, priority, subPriority) {
14372 super();
14373 this.value = value;
14374 this.validateValue = validateValue;
14375 this.setValue = setValue;
14376 this.priority = priority;
14377 if (subPriority) {
14378 this.subPriority = subPriority;
14379 }
14380 }
14381 validate(date, options) {
14382 return this.validateValue(date, this.value, options);
14383 }
14384 set(date, flags, options) {
14385 return this.setValue(date, flags, this.value, options);
14386 }
14387 };
14388 var DateTimezoneSetter = class extends Setter {
14389 priority = TIMEZONE_UNIT_PRIORITY;
14390 subPriority = -1;
14391 constructor(context, reference) {
14392 super();
14393 this.context = context || ((date) => constructFrom(reference, date));
14394 }
14395 set(date, flags) {
14396 if (flags.timestampIsSet) return date;
14397 return constructFrom(date, transpose(date, this.context));
14398 }
14399 };
14400
14401 // node_modules/date-fns/parse/_lib/Parser.js
14402 var Parser = class {
14403 run(dateString, token, match2, options) {
14404 const result = this.parse(dateString, token, match2, options);
14405 if (!result) {
14406 return null;
14407 }
14408 return {
14409 setter: new ValueSetter(
14410 result.value,
14411 this.validate,
14412 this.set,
14413 this.priority,
14414 this.subPriority
14415 ),
14416 rest: result.rest
14417 };
14418 }
14419 validate(_utcDate, _value, _options) {
14420 return true;
14421 }
14422 };
14423
14424 // node_modules/date-fns/parse/_lib/parsers/EraParser.js
14425 var EraParser = class extends Parser {
14426 priority = 140;
14427 parse(dateString, token, match2) {
14428 switch (token) {
14429 // AD, BC
14430 case "G":
14431 case "GG":
14432 case "GGG":
14433 return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
14434 // A, B
14435 case "GGGGG":
14436 return match2.era(dateString, { width: "narrow" });
14437 // Anno Domini, Before Christ
14438 case "GGGG":
14439 default:
14440 return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
14441 }
14442 }
14443 set(date, flags, value) {
14444 flags.era = value;
14445 date.setFullYear(value, 0, 1);
14446 date.setHours(0, 0, 0, 0);
14447 return date;
14448 }
14449 incompatibleTokens = ["R", "u", "t", "T"];
14450 };
14451
14452 // node_modules/date-fns/parse/_lib/constants.js
14453 var numericPatterns = {
14454 month: /^(1[0-2]|0?\d)/,
14455 // 0 to 12
14456 date: /^(3[0-1]|[0-2]?\d)/,
14457 // 0 to 31
14458 dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
14459 // 0 to 366
14460 week: /^(5[0-3]|[0-4]?\d)/,
14461 // 0 to 53
14462 hour23h: /^(2[0-3]|[0-1]?\d)/,
14463 // 0 to 23
14464 hour24h: /^(2[0-4]|[0-1]?\d)/,
14465 // 0 to 24
14466 hour11h: /^(1[0-1]|0?\d)/,
14467 // 0 to 11
14468 hour12h: /^(1[0-2]|0?\d)/,
14469 // 0 to 12
14470 minute: /^[0-5]?\d/,
14471 // 0 to 59
14472 second: /^[0-5]?\d/,
14473 // 0 to 59
14474 singleDigit: /^\d/,
14475 // 0 to 9
14476 twoDigits: /^\d{1,2}/,
14477 // 0 to 99
14478 threeDigits: /^\d{1,3}/,
14479 // 0 to 999
14480 fourDigits: /^\d{1,4}/,
14481 // 0 to 9999
14482 anyDigitsSigned: /^-?\d+/,
14483 singleDigitSigned: /^-?\d/,
14484 // 0 to 9, -0 to -9
14485 twoDigitsSigned: /^-?\d{1,2}/,
14486 // 0 to 99, -0 to -99
14487 threeDigitsSigned: /^-?\d{1,3}/,
14488 // 0 to 999, -0 to -999
14489 fourDigitsSigned: /^-?\d{1,4}/
14490 // 0 to 9999, -0 to -9999
14491 };
14492 var timezonePatterns = {
14493 basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
14494 basic: /^([+-])(\d{2})(\d{2})|Z/,
14495 basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
14496 extended: /^([+-])(\d{2}):(\d{2})|Z/,
14497 extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
14498 };
14499
14500 // node_modules/date-fns/parse/_lib/utils.js
14501 function mapValue(parseFnResult, mapFn) {
14502 if (!parseFnResult) {
14503 return parseFnResult;
14504 }
14505 return {
14506 value: mapFn(parseFnResult.value),
14507 rest: parseFnResult.rest
14508 };
14509 }
14510 function parseNumericPattern(pattern, dateString) {
14511 const matchResult = dateString.match(pattern);
14512 if (!matchResult) {
14513 return null;
14514 }
14515 return {
14516 value: parseInt(matchResult[0], 10),
14517 rest: dateString.slice(matchResult[0].length)
14518 };
14519 }
14520 function parseTimezonePattern(pattern, dateString) {
14521 const matchResult = dateString.match(pattern);
14522 if (!matchResult) {
14523 return null;
14524 }
14525 if (matchResult[0] === "Z") {
14526 return {
14527 value: 0,
14528 rest: dateString.slice(1)
14529 };
14530 }
14531 const sign = matchResult[1] === "+" ? 1 : -1;
14532 const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
14533 const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
14534 const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
14535 return {
14536 value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
14537 rest: dateString.slice(matchResult[0].length)
14538 };
14539 }
14540 function parseAnyDigitsSigned(dateString) {
14541 return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
14542 }
14543 function parseNDigits(n, dateString) {
14544 switch (n) {
14545 case 1:
14546 return parseNumericPattern(numericPatterns.singleDigit, dateString);
14547 case 2:
14548 return parseNumericPattern(numericPatterns.twoDigits, dateString);
14549 case 3:
14550 return parseNumericPattern(numericPatterns.threeDigits, dateString);
14551 case 4:
14552 return parseNumericPattern(numericPatterns.fourDigits, dateString);
14553 default:
14554 return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString);
14555 }
14556 }
14557 function parseNDigitsSigned(n, dateString) {
14558 switch (n) {
14559 case 1:
14560 return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
14561 case 2:
14562 return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
14563 case 3:
14564 return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
14565 case 4:
14566 return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
14567 default:
14568 return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString);
14569 }
14570 }
14571 function dayPeriodEnumToHours(dayPeriod) {
14572 switch (dayPeriod) {
14573 case "morning":
14574 return 4;
14575 case "evening":
14576 return 17;
14577 case "pm":
14578 case "noon":
14579 case "afternoon":
14580 return 12;
14581 case "am":
14582 case "midnight":
14583 case "night":
14584 default:
14585 return 0;
14586 }
14587 }
14588 function normalizeTwoDigitYear(twoDigitYear, currentYear) {
14589 const isCommonEra = currentYear > 0;
14590 const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
14591 let result;
14592 if (absCurrentYear <= 50) {
14593 result = twoDigitYear || 100;
14594 } else {
14595 const rangeEnd = absCurrentYear + 50;
14596 const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
14597 const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
14598 result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
14599 }
14600 return isCommonEra ? result : 1 - result;
14601 }
14602 function isLeapYearIndex(year) {
14603 return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
14604 }
14605
14606 // node_modules/date-fns/parse/_lib/parsers/YearParser.js
14607 var YearParser = class extends Parser {
14608 priority = 130;
14609 incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"];
14610 parse(dateString, token, match2) {
14611 const valueCallback = (year) => ({
14612 year,
14613 isTwoDigitYear: token === "yy"
14614 });
14615 switch (token) {
14616 case "y":
14617 return mapValue(parseNDigits(4, dateString), valueCallback);
14618 case "yo":
14619 return mapValue(
14620 match2.ordinalNumber(dateString, {
14621 unit: "year"
14622 }),
14623 valueCallback
14624 );
14625 default:
14626 return mapValue(parseNDigits(token.length, dateString), valueCallback);
14627 }
14628 }
14629 validate(_date, value) {
14630 return value.isTwoDigitYear || value.year > 0;
14631 }
14632 set(date, flags, value) {
14633 const currentYear = date.getFullYear();
14634 if (value.isTwoDigitYear) {
14635 const normalizedTwoDigitYear = normalizeTwoDigitYear(
14636 value.year,
14637 currentYear
14638 );
14639 date.setFullYear(normalizedTwoDigitYear, 0, 1);
14640 date.setHours(0, 0, 0, 0);
14641 return date;
14642 }
14643 const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
14644 date.setFullYear(year, 0, 1);
14645 date.setHours(0, 0, 0, 0);
14646 return date;
14647 }
14648 };
14649
14650 // node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js
14651 var LocalWeekYearParser = class extends Parser {
14652 priority = 130;
14653 parse(dateString, token, match2) {
14654 const valueCallback = (year) => ({
14655 year,
14656 isTwoDigitYear: token === "YY"
14657 });
14658 switch (token) {
14659 case "Y":
14660 return mapValue(parseNDigits(4, dateString), valueCallback);
14661 case "Yo":
14662 return mapValue(
14663 match2.ordinalNumber(dateString, {
14664 unit: "year"
14665 }),
14666 valueCallback
14667 );
14668 default:
14669 return mapValue(parseNDigits(token.length, dateString), valueCallback);
14670 }
14671 }
14672 validate(_date, value) {
14673 return value.isTwoDigitYear || value.year > 0;
14674 }
14675 set(date, flags, value, options) {
14676 const currentYear = getWeekYear(date, options);
14677 if (value.isTwoDigitYear) {
14678 const normalizedTwoDigitYear = normalizeTwoDigitYear(
14679 value.year,
14680 currentYear
14681 );
14682 date.setFullYear(
14683 normalizedTwoDigitYear,
14684 0,
14685 options.firstWeekContainsDate
14686 );
14687 date.setHours(0, 0, 0, 0);
14688 return startOfWeek(date, options);
14689 }
14690 const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
14691 date.setFullYear(year, 0, options.firstWeekContainsDate);
14692 date.setHours(0, 0, 0, 0);
14693 return startOfWeek(date, options);
14694 }
14695 incompatibleTokens = [
14696 "y",
14697 "R",
14698 "u",
14699 "Q",
14700 "q",
14701 "M",
14702 "L",
14703 "I",
14704 "d",
14705 "D",
14706 "i",
14707 "t",
14708 "T"
14709 ];
14710 };
14711
14712 // node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js
14713 var ISOWeekYearParser = class extends Parser {
14714 priority = 130;
14715 parse(dateString, token) {
14716 if (token === "R") {
14717 return parseNDigitsSigned(4, dateString);
14718 }
14719 return parseNDigitsSigned(token.length, dateString);
14720 }
14721 set(date, _flags, value) {
14722 const firstWeekOfYear = constructFrom(date, 0);
14723 firstWeekOfYear.setFullYear(value, 0, 4);
14724 firstWeekOfYear.setHours(0, 0, 0, 0);
14725 return startOfISOWeek(firstWeekOfYear);
14726 }
14727 incompatibleTokens = [
14728 "G",
14729 "y",
14730 "Y",
14731 "u",
14732 "Q",
14733 "q",
14734 "M",
14735 "L",
14736 "w",
14737 "d",
14738 "D",
14739 "e",
14740 "c",
14741 "t",
14742 "T"
14743 ];
14744 };
14745
14746 // node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js
14747 var ExtendedYearParser = class extends Parser {
14748 priority = 130;
14749 parse(dateString, token) {
14750 if (token === "u") {
14751 return parseNDigitsSigned(4, dateString);
14752 }
14753 return parseNDigitsSigned(token.length, dateString);
14754 }
14755 set(date, _flags, value) {
14756 date.setFullYear(value, 0, 1);
14757 date.setHours(0, 0, 0, 0);
14758 return date;
14759 }
14760 incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
14761 };
14762
14763 // node_modules/date-fns/parse/_lib/parsers/QuarterParser.js
14764 var QuarterParser = class extends Parser {
14765 priority = 120;
14766 parse(dateString, token, match2) {
14767 switch (token) {
14768 // 1, 2, 3, 4
14769 case "Q":
14770 case "QQ":
14771 return parseNDigits(token.length, dateString);
14772 // 1st, 2nd, 3rd, 4th
14773 case "Qo":
14774 return match2.ordinalNumber(dateString, { unit: "quarter" });
14775 // Q1, Q2, Q3, Q4
14776 case "QQQ":
14777 return match2.quarter(dateString, {
14778 width: "abbreviated",
14779 context: "formatting"
14780 }) || match2.quarter(dateString, {
14781 width: "narrow",
14782 context: "formatting"
14783 });
14784 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
14785 case "QQQQQ":
14786 return match2.quarter(dateString, {
14787 width: "narrow",
14788 context: "formatting"
14789 });
14790 // 1st quarter, 2nd quarter, ...
14791 case "QQQQ":
14792 default:
14793 return match2.quarter(dateString, {
14794 width: "wide",
14795 context: "formatting"
14796 }) || match2.quarter(dateString, {
14797 width: "abbreviated",
14798 context: "formatting"
14799 }) || match2.quarter(dateString, {
14800 width: "narrow",
14801 context: "formatting"
14802 });
14803 }
14804 }
14805 validate(_date, value) {
14806 return value >= 1 && value <= 4;
14807 }
14808 set(date, _flags, value) {
14809 date.setMonth((value - 1) * 3, 1);
14810 date.setHours(0, 0, 0, 0);
14811 return date;
14812 }
14813 incompatibleTokens = [
14814 "Y",
14815 "R",
14816 "q",
14817 "M",
14818 "L",
14819 "w",
14820 "I",
14821 "d",
14822 "D",
14823 "i",
14824 "e",
14825 "c",
14826 "t",
14827 "T"
14828 ];
14829 };
14830
14831 // node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js
14832 var StandAloneQuarterParser = class extends Parser {
14833 priority = 120;
14834 parse(dateString, token, match2) {
14835 switch (token) {
14836 // 1, 2, 3, 4
14837 case "q":
14838 case "qq":
14839 return parseNDigits(token.length, dateString);
14840 // 1st, 2nd, 3rd, 4th
14841 case "qo":
14842 return match2.ordinalNumber(dateString, { unit: "quarter" });
14843 // Q1, Q2, Q3, Q4
14844 case "qqq":
14845 return match2.quarter(dateString, {
14846 width: "abbreviated",
14847 context: "standalone"
14848 }) || match2.quarter(dateString, {
14849 width: "narrow",
14850 context: "standalone"
14851 });
14852 // 1, 2, 3, 4 (narrow quarter; could be not numerical)
14853 case "qqqqq":
14854 return match2.quarter(dateString, {
14855 width: "narrow",
14856 context: "standalone"
14857 });
14858 // 1st quarter, 2nd quarter, ...
14859 case "qqqq":
14860 default:
14861 return match2.quarter(dateString, {
14862 width: "wide",
14863 context: "standalone"
14864 }) || match2.quarter(dateString, {
14865 width: "abbreviated",
14866 context: "standalone"
14867 }) || match2.quarter(dateString, {
14868 width: "narrow",
14869 context: "standalone"
14870 });
14871 }
14872 }
14873 validate(_date, value) {
14874 return value >= 1 && value <= 4;
14875 }
14876 set(date, _flags, value) {
14877 date.setMonth((value - 1) * 3, 1);
14878 date.setHours(0, 0, 0, 0);
14879 return date;
14880 }
14881 incompatibleTokens = [
14882 "Y",
14883 "R",
14884 "Q",
14885 "M",
14886 "L",
14887 "w",
14888 "I",
14889 "d",
14890 "D",
14891 "i",
14892 "e",
14893 "c",
14894 "t",
14895 "T"
14896 ];
14897 };
14898
14899 // node_modules/date-fns/parse/_lib/parsers/MonthParser.js
14900 var MonthParser = class extends Parser {
14901 incompatibleTokens = [
14902 "Y",
14903 "R",
14904 "q",
14905 "Q",
14906 "L",
14907 "w",
14908 "I",
14909 "D",
14910 "i",
14911 "e",
14912 "c",
14913 "t",
14914 "T"
14915 ];
14916 priority = 110;
14917 parse(dateString, token, match2) {
14918 const valueCallback = (value) => value - 1;
14919 switch (token) {
14920 // 1, 2, ..., 12
14921 case "M":
14922 return mapValue(
14923 parseNumericPattern(numericPatterns.month, dateString),
14924 valueCallback
14925 );
14926 // 01, 02, ..., 12
14927 case "MM":
14928 return mapValue(parseNDigits(2, dateString), valueCallback);
14929 // 1st, 2nd, ..., 12th
14930 case "Mo":
14931 return mapValue(
14932 match2.ordinalNumber(dateString, {
14933 unit: "month"
14934 }),
14935 valueCallback
14936 );
14937 // Jan, Feb, ..., Dec
14938 case "MMM":
14939 return match2.month(dateString, {
14940 width: "abbreviated",
14941 context: "formatting"
14942 }) || match2.month(dateString, { width: "narrow", context: "formatting" });
14943 // J, F, ..., D
14944 case "MMMMM":
14945 return match2.month(dateString, {
14946 width: "narrow",
14947 context: "formatting"
14948 });
14949 // January, February, ..., December
14950 case "MMMM":
14951 default:
14952 return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, {
14953 width: "abbreviated",
14954 context: "formatting"
14955 }) || match2.month(dateString, { width: "narrow", context: "formatting" });
14956 }
14957 }
14958 validate(_date, value) {
14959 return value >= 0 && value <= 11;
14960 }
14961 set(date, _flags, value) {
14962 date.setMonth(value, 1);
14963 date.setHours(0, 0, 0, 0);
14964 return date;
14965 }
14966 };
14967
14968 // node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js
14969 var StandAloneMonthParser = class extends Parser {
14970 priority = 110;
14971 parse(dateString, token, match2) {
14972 const valueCallback = (value) => value - 1;
14973 switch (token) {
14974 // 1, 2, ..., 12
14975 case "L":
14976 return mapValue(
14977 parseNumericPattern(numericPatterns.month, dateString),
14978 valueCallback
14979 );
14980 // 01, 02, ..., 12
14981 case "LL":
14982 return mapValue(parseNDigits(2, dateString), valueCallback);
14983 // 1st, 2nd, ..., 12th
14984 case "Lo":
14985 return mapValue(
14986 match2.ordinalNumber(dateString, {
14987 unit: "month"
14988 }),
14989 valueCallback
14990 );
14991 // Jan, Feb, ..., Dec
14992 case "LLL":
14993 return match2.month(dateString, {
14994 width: "abbreviated",
14995 context: "standalone"
14996 }) || match2.month(dateString, { width: "narrow", context: "standalone" });
14997 // J, F, ..., D
14998 case "LLLLL":
14999 return match2.month(dateString, {
15000 width: "narrow",
15001 context: "standalone"
15002 });
15003 // January, February, ..., December
15004 case "LLLL":
15005 default:
15006 return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, {
15007 width: "abbreviated",
15008 context: "standalone"
15009 }) || match2.month(dateString, { width: "narrow", context: "standalone" });
15010 }
15011 }
15012 validate(_date, value) {
15013 return value >= 0 && value <= 11;
15014 }
15015 set(date, _flags, value) {
15016 date.setMonth(value, 1);
15017 date.setHours(0, 0, 0, 0);
15018 return date;
15019 }
15020 incompatibleTokens = [
15021 "Y",
15022 "R",
15023 "q",
15024 "Q",
15025 "M",
15026 "w",
15027 "I",
15028 "D",
15029 "i",
15030 "e",
15031 "c",
15032 "t",
15033 "T"
15034 ];
15035 };
15036
15037 // node_modules/date-fns/setWeek.js
15038 function setWeek(date, week, options) {
15039 const date_ = toDate(date, options?.in);
15040 const diff = getWeek(date_, options) - week;
15041 date_.setDate(date_.getDate() - diff * 7);
15042 return toDate(date_, options?.in);
15043 }
15044
15045 // node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js
15046 var LocalWeekParser = class extends Parser {
15047 priority = 100;
15048 parse(dateString, token, match2) {
15049 switch (token) {
15050 case "w":
15051 return parseNumericPattern(numericPatterns.week, dateString);
15052 case "wo":
15053 return match2.ordinalNumber(dateString, { unit: "week" });
15054 default:
15055 return parseNDigits(token.length, dateString);
15056 }
15057 }
15058 validate(_date, value) {
15059 return value >= 1 && value <= 53;
15060 }
15061 set(date, _flags, value, options) {
15062 return startOfWeek(setWeek(date, value, options), options);
15063 }
15064 incompatibleTokens = [
15065 "y",
15066 "R",
15067 "u",
15068 "q",
15069 "Q",
15070 "M",
15071 "L",
15072 "I",
15073 "d",
15074 "D",
15075 "i",
15076 "t",
15077 "T"
15078 ];
15079 };
15080
15081 // node_modules/date-fns/setISOWeek.js
15082 function setISOWeek(date, week, options) {
15083 const _date = toDate(date, options?.in);
15084 const diff = getISOWeek(_date, options) - week;
15085 _date.setDate(_date.getDate() - diff * 7);
15086 return _date;
15087 }
15088
15089 // node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js
15090 var ISOWeekParser = class extends Parser {
15091 priority = 100;
15092 parse(dateString, token, match2) {
15093 switch (token) {
15094 case "I":
15095 return parseNumericPattern(numericPatterns.week, dateString);
15096 case "Io":
15097 return match2.ordinalNumber(dateString, { unit: "week" });
15098 default:
15099 return parseNDigits(token.length, dateString);
15100 }
15101 }
15102 validate(_date, value) {
15103 return value >= 1 && value <= 53;
15104 }
15105 set(date, _flags, value) {
15106 return startOfISOWeek(setISOWeek(date, value));
15107 }
15108 incompatibleTokens = [
15109 "y",
15110 "Y",
15111 "u",
15112 "q",
15113 "Q",
15114 "M",
15115 "L",
15116 "w",
15117 "d",
15118 "D",
15119 "e",
15120 "c",
15121 "t",
15122 "T"
15123 ];
15124 };
15125
15126 // node_modules/date-fns/parse/_lib/parsers/DateParser.js
15127 var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
15128 var DAYS_IN_MONTH_LEAP_YEAR = [
15129 31,
15130 29,
15131 31,
15132 30,
15133 31,
15134 30,
15135 31,
15136 31,
15137 30,
15138 31,
15139 30,
15140 31
15141 ];
15142 var DateParser = class extends Parser {
15143 priority = 90;
15144 subPriority = 1;
15145 parse(dateString, token, match2) {
15146 switch (token) {
15147 case "d":
15148 return parseNumericPattern(numericPatterns.date, dateString);
15149 case "do":
15150 return match2.ordinalNumber(dateString, { unit: "date" });
15151 default:
15152 return parseNDigits(token.length, dateString);
15153 }
15154 }
15155 validate(date, value) {
15156 const year = date.getFullYear();
15157 const isLeapYear = isLeapYearIndex(year);
15158 const month = date.getMonth();
15159 if (isLeapYear) {
15160 return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
15161 } else {
15162 return value >= 1 && value <= DAYS_IN_MONTH[month];
15163 }
15164 }
15165 set(date, _flags, value) {
15166 date.setDate(value);
15167 date.setHours(0, 0, 0, 0);
15168 return date;
15169 }
15170 incompatibleTokens = [
15171 "Y",
15172 "R",
15173 "q",
15174 "Q",
15175 "w",
15176 "I",
15177 "D",
15178 "i",
15179 "e",
15180 "c",
15181 "t",
15182 "T"
15183 ];
15184 };
15185
15186 // node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js
15187 var DayOfYearParser = class extends Parser {
15188 priority = 90;
15189 subpriority = 1;
15190 parse(dateString, token, match2) {
15191 switch (token) {
15192 case "D":
15193 case "DD":
15194 return parseNumericPattern(numericPatterns.dayOfYear, dateString);
15195 case "Do":
15196 return match2.ordinalNumber(dateString, { unit: "date" });
15197 default:
15198 return parseNDigits(token.length, dateString);
15199 }
15200 }
15201 validate(date, value) {
15202 const year = date.getFullYear();
15203 const isLeapYear = isLeapYearIndex(year);
15204 if (isLeapYear) {
15205 return value >= 1 && value <= 366;
15206 } else {
15207 return value >= 1 && value <= 365;
15208 }
15209 }
15210 set(date, _flags, value) {
15211 date.setMonth(0, value);
15212 date.setHours(0, 0, 0, 0);
15213 return date;
15214 }
15215 incompatibleTokens = [
15216 "Y",
15217 "R",
15218 "q",
15219 "Q",
15220 "M",
15221 "L",
15222 "w",
15223 "I",
15224 "d",
15225 "E",
15226 "i",
15227 "e",
15228 "c",
15229 "t",
15230 "T"
15231 ];
15232 };
15233
15234 // node_modules/date-fns/setDay.js
15235 function setDay(date, day, options) {
15236 const defaultOptions2 = getDefaultOptions();
15237 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
15238 const date_ = toDate(date, options?.in);
15239 const currentDay = date_.getDay();
15240 const remainder = day % 7;
15241 const dayIndex = (remainder + 7) % 7;
15242 const delta = 7 - weekStartsOn;
15243 const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
15244 return addDays(date_, diff, options);
15245 }
15246
15247 // node_modules/date-fns/parse/_lib/parsers/DayParser.js
15248 var DayParser = class extends Parser {
15249 priority = 90;
15250 parse(dateString, token, match2) {
15251 switch (token) {
15252 // Tue
15253 case "E":
15254 case "EE":
15255 case "EEE":
15256 return match2.day(dateString, {
15257 width: "abbreviated",
15258 context: "formatting"
15259 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15260 // T
15261 case "EEEEE":
15262 return match2.day(dateString, {
15263 width: "narrow",
15264 context: "formatting"
15265 });
15266 // Tu
15267 case "EEEEEE":
15268 return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15269 // Tuesday
15270 case "EEEE":
15271 default:
15272 return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
15273 width: "abbreviated",
15274 context: "formatting"
15275 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15276 }
15277 }
15278 validate(_date, value) {
15279 return value >= 0 && value <= 6;
15280 }
15281 set(date, _flags, value, options) {
15282 date = setDay(date, value, options);
15283 date.setHours(0, 0, 0, 0);
15284 return date;
15285 }
15286 incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
15287 };
15288
15289 // node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js
15290 var LocalDayParser = class extends Parser {
15291 priority = 90;
15292 parse(dateString, token, match2, options) {
15293 const valueCallback = (value) => {
15294 const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
15295 return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
15296 };
15297 switch (token) {
15298 // 3
15299 case "e":
15300 case "ee":
15301 return mapValue(parseNDigits(token.length, dateString), valueCallback);
15302 // 3rd
15303 case "eo":
15304 return mapValue(
15305 match2.ordinalNumber(dateString, {
15306 unit: "day"
15307 }),
15308 valueCallback
15309 );
15310 // Tue
15311 case "eee":
15312 return match2.day(dateString, {
15313 width: "abbreviated",
15314 context: "formatting"
15315 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15316 // T
15317 case "eeeee":
15318 return match2.day(dateString, {
15319 width: "narrow",
15320 context: "formatting"
15321 });
15322 // Tu
15323 case "eeeeee":
15324 return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15325 // Tuesday
15326 case "eeee":
15327 default:
15328 return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
15329 width: "abbreviated",
15330 context: "formatting"
15331 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
15332 }
15333 }
15334 validate(_date, value) {
15335 return value >= 0 && value <= 6;
15336 }
15337 set(date, _flags, value, options) {
15338 date = setDay(date, value, options);
15339 date.setHours(0, 0, 0, 0);
15340 return date;
15341 }
15342 incompatibleTokens = [
15343 "y",
15344 "R",
15345 "u",
15346 "q",
15347 "Q",
15348 "M",
15349 "L",
15350 "I",
15351 "d",
15352 "D",
15353 "E",
15354 "i",
15355 "c",
15356 "t",
15357 "T"
15358 ];
15359 };
15360
15361 // node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js
15362 var StandAloneLocalDayParser = class extends Parser {
15363 priority = 90;
15364 parse(dateString, token, match2, options) {
15365 const valueCallback = (value) => {
15366 const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
15367 return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
15368 };
15369 switch (token) {
15370 // 3
15371 case "c":
15372 case "cc":
15373 return mapValue(parseNDigits(token.length, dateString), valueCallback);
15374 // 3rd
15375 case "co":
15376 return mapValue(
15377 match2.ordinalNumber(dateString, {
15378 unit: "day"
15379 }),
15380 valueCallback
15381 );
15382 // Tue
15383 case "ccc":
15384 return match2.day(dateString, {
15385 width: "abbreviated",
15386 context: "standalone"
15387 }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
15388 // T
15389 case "ccccc":
15390 return match2.day(dateString, {
15391 width: "narrow",
15392 context: "standalone"
15393 });
15394 // Tu
15395 case "cccccc":
15396 return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
15397 // Tuesday
15398 case "cccc":
15399 default:
15400 return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, {
15401 width: "abbreviated",
15402 context: "standalone"
15403 }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
15404 }
15405 }
15406 validate(_date, value) {
15407 return value >= 0 && value <= 6;
15408 }
15409 set(date, _flags, value, options) {
15410 date = setDay(date, value, options);
15411 date.setHours(0, 0, 0, 0);
15412 return date;
15413 }
15414 incompatibleTokens = [
15415 "y",
15416 "R",
15417 "u",
15418 "q",
15419 "Q",
15420 "M",
15421 "L",
15422 "I",
15423 "d",
15424 "D",
15425 "E",
15426 "i",
15427 "e",
15428 "t",
15429 "T"
15430 ];
15431 };
15432
15433 // node_modules/date-fns/setISODay.js
15434 function setISODay(date, day, options) {
15435 const date_ = toDate(date, options?.in);
15436 const currentDay = getISODay(date_, options);
15437 const diff = day - currentDay;
15438 return addDays(date_, diff, options);
15439 }
15440
15441 // node_modules/date-fns/parse/_lib/parsers/ISODayParser.js
15442 var ISODayParser = class extends Parser {
15443 priority = 90;
15444 parse(dateString, token, match2) {
15445 const valueCallback = (value) => {
15446 if (value === 0) {
15447 return 7;
15448 }
15449 return value;
15450 };
15451 switch (token) {
15452 // 2
15453 case "i":
15454 case "ii":
15455 return parseNDigits(token.length, dateString);
15456 // 2nd
15457 case "io":
15458 return match2.ordinalNumber(dateString, { unit: "day" });
15459 // Tue
15460 case "iii":
15461 return mapValue(
15462 match2.day(dateString, {
15463 width: "abbreviated",
15464 context: "formatting"
15465 }) || match2.day(dateString, {
15466 width: "short",
15467 context: "formatting"
15468 }) || match2.day(dateString, {
15469 width: "narrow",
15470 context: "formatting"
15471 }),
15472 valueCallback
15473 );
15474 // T
15475 case "iiiii":
15476 return mapValue(
15477 match2.day(dateString, {
15478 width: "narrow",
15479 context: "formatting"
15480 }),
15481 valueCallback
15482 );
15483 // Tu
15484 case "iiiiii":
15485 return mapValue(
15486 match2.day(dateString, {
15487 width: "short",
15488 context: "formatting"
15489 }) || match2.day(dateString, {
15490 width: "narrow",
15491 context: "formatting"
15492 }),
15493 valueCallback
15494 );
15495 // Tuesday
15496 case "iiii":
15497 default:
15498 return mapValue(
15499 match2.day(dateString, {
15500 width: "wide",
15501 context: "formatting"
15502 }) || match2.day(dateString, {
15503 width: "abbreviated",
15504 context: "formatting"
15505 }) || match2.day(dateString, {
15506 width: "short",
15507 context: "formatting"
15508 }) || match2.day(dateString, {
15509 width: "narrow",
15510 context: "formatting"
15511 }),
15512 valueCallback
15513 );
15514 }
15515 }
15516 validate(_date, value) {
15517 return value >= 1 && value <= 7;
15518 }
15519 set(date, _flags, value) {
15520 date = setISODay(date, value);
15521 date.setHours(0, 0, 0, 0);
15522 return date;
15523 }
15524 incompatibleTokens = [
15525 "y",
15526 "Y",
15527 "u",
15528 "q",
15529 "Q",
15530 "M",
15531 "L",
15532 "w",
15533 "d",
15534 "D",
15535 "E",
15536 "e",
15537 "c",
15538 "t",
15539 "T"
15540 ];
15541 };
15542
15543 // node_modules/date-fns/parse/_lib/parsers/AMPMParser.js
15544 var AMPMParser = class extends Parser {
15545 priority = 80;
15546 parse(dateString, token, match2) {
15547 switch (token) {
15548 case "a":
15549 case "aa":
15550 case "aaa":
15551 return match2.dayPeriod(dateString, {
15552 width: "abbreviated",
15553 context: "formatting"
15554 }) || match2.dayPeriod(dateString, {
15555 width: "narrow",
15556 context: "formatting"
15557 });
15558 case "aaaaa":
15559 return match2.dayPeriod(dateString, {
15560 width: "narrow",
15561 context: "formatting"
15562 });
15563 case "aaaa":
15564 default:
15565 return match2.dayPeriod(dateString, {
15566 width: "wide",
15567 context: "formatting"
15568 }) || match2.dayPeriod(dateString, {
15569 width: "abbreviated",
15570 context: "formatting"
15571 }) || match2.dayPeriod(dateString, {
15572 width: "narrow",
15573 context: "formatting"
15574 });
15575 }
15576 }
15577 set(date, _flags, value) {
15578 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
15579 return date;
15580 }
15581 incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
15582 };
15583
15584 // node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js
15585 var AMPMMidnightParser = class extends Parser {
15586 priority = 80;
15587 parse(dateString, token, match2) {
15588 switch (token) {
15589 case "b":
15590 case "bb":
15591 case "bbb":
15592 return match2.dayPeriod(dateString, {
15593 width: "abbreviated",
15594 context: "formatting"
15595 }) || match2.dayPeriod(dateString, {
15596 width: "narrow",
15597 context: "formatting"
15598 });
15599 case "bbbbb":
15600 return match2.dayPeriod(dateString, {
15601 width: "narrow",
15602 context: "formatting"
15603 });
15604 case "bbbb":
15605 default:
15606 return match2.dayPeriod(dateString, {
15607 width: "wide",
15608 context: "formatting"
15609 }) || match2.dayPeriod(dateString, {
15610 width: "abbreviated",
15611 context: "formatting"
15612 }) || match2.dayPeriod(dateString, {
15613 width: "narrow",
15614 context: "formatting"
15615 });
15616 }
15617 }
15618 set(date, _flags, value) {
15619 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
15620 return date;
15621 }
15622 incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
15623 };
15624
15625 // node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js
15626 var DayPeriodParser = class extends Parser {
15627 priority = 80;
15628 parse(dateString, token, match2) {
15629 switch (token) {
15630 case "B":
15631 case "BB":
15632 case "BBB":
15633 return match2.dayPeriod(dateString, {
15634 width: "abbreviated",
15635 context: "formatting"
15636 }) || match2.dayPeriod(dateString, {
15637 width: "narrow",
15638 context: "formatting"
15639 });
15640 case "BBBBB":
15641 return match2.dayPeriod(dateString, {
15642 width: "narrow",
15643 context: "formatting"
15644 });
15645 case "BBBB":
15646 default:
15647 return match2.dayPeriod(dateString, {
15648 width: "wide",
15649 context: "formatting"
15650 }) || match2.dayPeriod(dateString, {
15651 width: "abbreviated",
15652 context: "formatting"
15653 }) || match2.dayPeriod(dateString, {
15654 width: "narrow",
15655 context: "formatting"
15656 });
15657 }
15658 }
15659 set(date, _flags, value) {
15660 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
15661 return date;
15662 }
15663 incompatibleTokens = ["a", "b", "t", "T"];
15664 };
15665
15666 // node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js
15667 var Hour1to12Parser = class extends Parser {
15668 priority = 70;
15669 parse(dateString, token, match2) {
15670 switch (token) {
15671 case "h":
15672 return parseNumericPattern(numericPatterns.hour12h, dateString);
15673 case "ho":
15674 return match2.ordinalNumber(dateString, { unit: "hour" });
15675 default:
15676 return parseNDigits(token.length, dateString);
15677 }
15678 }
15679 validate(_date, value) {
15680 return value >= 1 && value <= 12;
15681 }
15682 set(date, _flags, value) {
15683 const isPM = date.getHours() >= 12;
15684 if (isPM && value < 12) {
15685 date.setHours(value + 12, 0, 0, 0);
15686 } else if (!isPM && value === 12) {
15687 date.setHours(0, 0, 0, 0);
15688 } else {
15689 date.setHours(value, 0, 0, 0);
15690 }
15691 return date;
15692 }
15693 incompatibleTokens = ["H", "K", "k", "t", "T"];
15694 };
15695
15696 // node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js
15697 var Hour0to23Parser = class extends Parser {
15698 priority = 70;
15699 parse(dateString, token, match2) {
15700 switch (token) {
15701 case "H":
15702 return parseNumericPattern(numericPatterns.hour23h, dateString);
15703 case "Ho":
15704 return match2.ordinalNumber(dateString, { unit: "hour" });
15705 default:
15706 return parseNDigits(token.length, dateString);
15707 }
15708 }
15709 validate(_date, value) {
15710 return value >= 0 && value <= 23;
15711 }
15712 set(date, _flags, value) {
15713 date.setHours(value, 0, 0, 0);
15714 return date;
15715 }
15716 incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
15717 };
15718
15719 // node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js
15720 var Hour0To11Parser = class extends Parser {
15721 priority = 70;
15722 parse(dateString, token, match2) {
15723 switch (token) {
15724 case "K":
15725 return parseNumericPattern(numericPatterns.hour11h, dateString);
15726 case "Ko":
15727 return match2.ordinalNumber(dateString, { unit: "hour" });
15728 default:
15729 return parseNDigits(token.length, dateString);
15730 }
15731 }
15732 validate(_date, value) {
15733 return value >= 0 && value <= 11;
15734 }
15735 set(date, _flags, value) {
15736 const isPM = date.getHours() >= 12;
15737 if (isPM && value < 12) {
15738 date.setHours(value + 12, 0, 0, 0);
15739 } else {
15740 date.setHours(value, 0, 0, 0);
15741 }
15742 return date;
15743 }
15744 incompatibleTokens = ["h", "H", "k", "t", "T"];
15745 };
15746
15747 // node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js
15748 var Hour1To24Parser = class extends Parser {
15749 priority = 70;
15750 parse(dateString, token, match2) {
15751 switch (token) {
15752 case "k":
15753 return parseNumericPattern(numericPatterns.hour24h, dateString);
15754 case "ko":
15755 return match2.ordinalNumber(dateString, { unit: "hour" });
15756 default:
15757 return parseNDigits(token.length, dateString);
15758 }
15759 }
15760 validate(_date, value) {
15761 return value >= 1 && value <= 24;
15762 }
15763 set(date, _flags, value) {
15764 const hours = value <= 24 ? value % 24 : value;
15765 date.setHours(hours, 0, 0, 0);
15766 return date;
15767 }
15768 incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
15769 };
15770
15771 // node_modules/date-fns/parse/_lib/parsers/MinuteParser.js
15772 var MinuteParser = class extends Parser {
15773 priority = 60;
15774 parse(dateString, token, match2) {
15775 switch (token) {
15776 case "m":
15777 return parseNumericPattern(numericPatterns.minute, dateString);
15778 case "mo":
15779 return match2.ordinalNumber(dateString, { unit: "minute" });
15780 default:
15781 return parseNDigits(token.length, dateString);
15782 }
15783 }
15784 validate(_date, value) {
15785 return value >= 0 && value <= 59;
15786 }
15787 set(date, _flags, value) {
15788 date.setMinutes(value, 0, 0);
15789 return date;
15790 }
15791 incompatibleTokens = ["t", "T"];
15792 };
15793
15794 // node_modules/date-fns/parse/_lib/parsers/SecondParser.js
15795 var SecondParser = class extends Parser {
15796 priority = 50;
15797 parse(dateString, token, match2) {
15798 switch (token) {
15799 case "s":
15800 return parseNumericPattern(numericPatterns.second, dateString);
15801 case "so":
15802 return match2.ordinalNumber(dateString, { unit: "second" });
15803 default:
15804 return parseNDigits(token.length, dateString);
15805 }
15806 }
15807 validate(_date, value) {
15808 return value >= 0 && value <= 59;
15809 }
15810 set(date, _flags, value) {
15811 date.setSeconds(value, 0);
15812 return date;
15813 }
15814 incompatibleTokens = ["t", "T"];
15815 };
15816
15817 // node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js
15818 var FractionOfSecondParser = class extends Parser {
15819 priority = 30;
15820 parse(dateString, token) {
15821 const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
15822 return mapValue(parseNDigits(token.length, dateString), valueCallback);
15823 }
15824 set(date, _flags, value) {
15825 date.setMilliseconds(value);
15826 return date;
15827 }
15828 incompatibleTokens = ["t", "T"];
15829 };
15830
15831 // node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js
15832 var ISOTimezoneWithZParser = class extends Parser {
15833 priority = 10;
15834 parse(dateString, token) {
15835 switch (token) {
15836 case "X":
15837 return parseTimezonePattern(
15838 timezonePatterns.basicOptionalMinutes,
15839 dateString
15840 );
15841 case "XX":
15842 return parseTimezonePattern(timezonePatterns.basic, dateString);
15843 case "XXXX":
15844 return parseTimezonePattern(
15845 timezonePatterns.basicOptionalSeconds,
15846 dateString
15847 );
15848 case "XXXXX":
15849 return parseTimezonePattern(
15850 timezonePatterns.extendedOptionalSeconds,
15851 dateString
15852 );
15853 case "XXX":
15854 default:
15855 return parseTimezonePattern(timezonePatterns.extended, dateString);
15856 }
15857 }
15858 set(date, flags, value) {
15859 if (flags.timestampIsSet) return date;
15860 return constructFrom(
15861 date,
15862 date.getTime() - getTimezoneOffsetInMilliseconds(date) - value
15863 );
15864 }
15865 incompatibleTokens = ["t", "T", "x"];
15866 };
15867
15868 // node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js
15869 var ISOTimezoneParser = class extends Parser {
15870 priority = 10;
15871 parse(dateString, token) {
15872 switch (token) {
15873 case "x":
15874 return parseTimezonePattern(
15875 timezonePatterns.basicOptionalMinutes,
15876 dateString
15877 );
15878 case "xx":
15879 return parseTimezonePattern(timezonePatterns.basic, dateString);
15880 case "xxxx":
15881 return parseTimezonePattern(
15882 timezonePatterns.basicOptionalSeconds,
15883 dateString
15884 );
15885 case "xxxxx":
15886 return parseTimezonePattern(
15887 timezonePatterns.extendedOptionalSeconds,
15888 dateString
15889 );
15890 case "xxx":
15891 default:
15892 return parseTimezonePattern(timezonePatterns.extended, dateString);
15893 }
15894 }
15895 set(date, flags, value) {
15896 if (flags.timestampIsSet) return date;
15897 return constructFrom(
15898 date,
15899 date.getTime() - getTimezoneOffsetInMilliseconds(date) - value
15900 );
15901 }
15902 incompatibleTokens = ["t", "T", "X"];
15903 };
15904
15905 // node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js
15906 var TimestampSecondsParser = class extends Parser {
15907 priority = 40;
15908 parse(dateString) {
15909 return parseAnyDigitsSigned(dateString);
15910 }
15911 set(date, _flags, value) {
15912 return [constructFrom(date, value * 1e3), { timestampIsSet: true }];
15913 }
15914 incompatibleTokens = "*";
15915 };
15916
15917 // node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js
15918 var TimestampMillisecondsParser = class extends Parser {
15919 priority = 20;
15920 parse(dateString) {
15921 return parseAnyDigitsSigned(dateString);
15922 }
15923 set(date, _flags, value) {
15924 return [constructFrom(date, value), { timestampIsSet: true }];
15925 }
15926 incompatibleTokens = "*";
15927 };
15928
15929 // node_modules/date-fns/parse/_lib/parsers.js
15930 var parsers = {
15931 G: new EraParser(),
15932 y: new YearParser(),
15933 Y: new LocalWeekYearParser(),
15934 R: new ISOWeekYearParser(),
15935 u: new ExtendedYearParser(),
15936 Q: new QuarterParser(),
15937 q: new StandAloneQuarterParser(),
15938 M: new MonthParser(),
15939 L: new StandAloneMonthParser(),
15940 w: new LocalWeekParser(),
15941 I: new ISOWeekParser(),
15942 d: new DateParser(),
15943 D: new DayOfYearParser(),
15944 E: new DayParser(),
15945 e: new LocalDayParser(),
15946 c: new StandAloneLocalDayParser(),
15947 i: new ISODayParser(),
15948 a: new AMPMParser(),
15949 b: new AMPMMidnightParser(),
15950 B: new DayPeriodParser(),
15951 h: new Hour1to12Parser(),
15952 H: new Hour0to23Parser(),
15953 K: new Hour0To11Parser(),
15954 k: new Hour1To24Parser(),
15955 m: new MinuteParser(),
15956 s: new SecondParser(),
15957 S: new FractionOfSecondParser(),
15958 X: new ISOTimezoneWithZParser(),
15959 x: new ISOTimezoneParser(),
15960 t: new TimestampSecondsParser(),
15961 T: new TimestampMillisecondsParser()
15962 };
15963
15964 // node_modules/date-fns/parse.js
15965 var formattingTokensRegExp2 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
15966 var longFormattingTokensRegExp2 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
15967 var escapedStringRegExp2 = /^'([^]*?)'?$/;
15968 var doubleQuoteRegExp2 = /''/g;
15969 var notWhitespaceRegExp = /\S/;
15970 var unescapedLatinCharacterRegExp2 = /[a-zA-Z]/;
15971 function parse(dateStr, formatStr, referenceDate, options) {
15972 const invalidDate = () => constructFrom(options?.in || referenceDate, NaN);
15973 const defaultOptions2 = getDefaultOptions2();
15974 const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
15975 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
15976 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
15977 if (!formatStr)
15978 return dateStr ? invalidDate() : toDate(referenceDate, options?.in);
15979 const subFnOptions = {
15980 firstWeekContainsDate,
15981 weekStartsOn,
15982 locale
15983 };
15984 const setters = [new DateTimezoneSetter(options?.in, referenceDate)];
15985 const tokens = formatStr.match(longFormattingTokensRegExp2).map((substring) => {
15986 const firstCharacter = substring[0];
15987 if (firstCharacter in longFormatters) {
15988 const longFormatter = longFormatters[firstCharacter];
15989 return longFormatter(substring, locale.formatLong);
15990 }
15991 return substring;
15992 }).join("").match(formattingTokensRegExp2);
15993 const usedTokens = [];
15994 for (let token of tokens) {
15995 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) {
15996 warnOrThrowProtectedError(token, formatStr, dateStr);
15997 }
15998 if (!options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
15999 warnOrThrowProtectedError(token, formatStr, dateStr);
16000 }
16001 const firstCharacter = token[0];
16002 const parser = parsers[firstCharacter];
16003 if (parser) {
16004 const { incompatibleTokens } = parser;
16005 if (Array.isArray(incompatibleTokens)) {
16006 const incompatibleToken = usedTokens.find(
16007 (usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter
16008 );
16009 if (incompatibleToken) {
16010 throw new RangeError(
16011 `The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`
16012 );
16013 }
16014 } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
16015 throw new RangeError(
16016 `The format string mustn't contain \`${token}\` and any other token at the same time`
16017 );
16018 }
16019 usedTokens.push({ token: firstCharacter, fullToken: token });
16020 const parseResult = parser.run(
16021 dateStr,
16022 token,
16023 locale.match,
16024 subFnOptions
16025 );
16026 if (!parseResult) {
16027 return invalidDate();
16028 }
16029 setters.push(parseResult.setter);
16030 dateStr = parseResult.rest;
16031 } else {
16032 if (firstCharacter.match(unescapedLatinCharacterRegExp2)) {
16033 throw new RangeError(
16034 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
16035 );
16036 }
16037 if (token === "''") {
16038 token = "'";
16039 } else if (firstCharacter === "'") {
16040 token = cleanEscapedString2(token);
16041 }
16042 if (dateStr.indexOf(token) === 0) {
16043 dateStr = dateStr.slice(token.length);
16044 } else {
16045 return invalidDate();
16046 }
16047 }
16048 }
16049 if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
16050 return invalidDate();
16051 }
16052 const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority, index2, array) => array.indexOf(priority) === index2).map(
16053 (priority) => setters.filter((setter) => setter.priority === priority).sort((a, b) => b.subPriority - a.subPriority)
16054 ).map((setterArray) => setterArray[0]);
16055 let date = toDate(referenceDate, options?.in);
16056 if (isNaN(+date)) return invalidDate();
16057 const flags = {};
16058 for (const setter of uniquePrioritySetters) {
16059 if (!setter.validate(date, subFnOptions)) {
16060 return invalidDate();
16061 }
16062 const result = setter.set(date, flags, subFnOptions);
16063 if (Array.isArray(result)) {
16064 date = result[0];
16065 Object.assign(flags, result[1]);
16066 } else {
16067 date = result;
16068 }
16069 }
16070 return date;
16071 }
16072 function cleanEscapedString2(input) {
16073 return input.match(escapedStringRegExp2)[1].replace(doubleQuoteRegExp2, "'");
16074 }
16075
16076 // node_modules/date-fns/isSameMonth.js
16077 function isSameMonth(laterDate, earlierDate, options) {
16078 const [laterDate_, earlierDate_] = normalizeDates(
16079 options?.in,
16080 laterDate,
16081 earlierDate
16082 );
16083 return laterDate_.getFullYear() === earlierDate_.getFullYear() && laterDate_.getMonth() === earlierDate_.getMonth();
16084 }
16085
16086 // node_modules/date-fns/isSameYear.js
16087 function isSameYear(laterDate, earlierDate, options) {
16088 const [laterDate_, earlierDate_] = normalizeDates(
16089 options?.in,
16090 laterDate,
16091 earlierDate
16092 );
16093 return laterDate_.getFullYear() === earlierDate_.getFullYear();
16094 }
16095
16096 // node_modules/date-fns/subDays.js
16097 function subDays(date, amount, options) {
16098 return addDays(date, -amount, options);
16099 }
16100
16101 // node_modules/date-fns/parseISO.js
16102 function parseISO(argument, options) {
16103 const invalidDate = () => constructFrom(options?.in, NaN);
16104 const additionalDigits = options?.additionalDigits ?? 2;
16105 const dateStrings = splitDateString(argument);
16106 let date;
16107 if (dateStrings.date) {
16108 const parseYearResult = parseYear(dateStrings.date, additionalDigits);
16109 date = parseDate(parseYearResult.restDateString, parseYearResult.year);
16110 }
16111 if (!date || isNaN(+date)) return invalidDate();
16112 const timestamp = +date;
16113 let time = 0;
16114 let offset4;
16115 if (dateStrings.time) {
16116 time = parseTime(dateStrings.time);
16117 if (isNaN(time)) return invalidDate();
16118 }
16119 if (dateStrings.timezone) {
16120 offset4 = parseTimezone(dateStrings.timezone);
16121 if (isNaN(offset4)) return invalidDate();
16122 } else {
16123 const tmpDate = new Date(timestamp + time);
16124 const result = toDate(0, options?.in);
16125 result.setFullYear(
16126 tmpDate.getUTCFullYear(),
16127 tmpDate.getUTCMonth(),
16128 tmpDate.getUTCDate()
16129 );
16130 result.setHours(
16131 tmpDate.getUTCHours(),
16132 tmpDate.getUTCMinutes(),
16133 tmpDate.getUTCSeconds(),
16134 tmpDate.getUTCMilliseconds()
16135 );
16136 return result;
16137 }
16138 return toDate(timestamp + time + offset4, options?.in);
16139 }
16140 var patterns = {
16141 dateTimeDelimiter: /[T ]/,
16142 timeZoneDelimiter: /[Z ]/i,
16143 timezone: /([Z+-].*)$/
16144 };
16145 var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
16146 var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
16147 var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
16148 function splitDateString(dateString) {
16149 const dateStrings = {};
16150 const array = dateString.split(patterns.dateTimeDelimiter);
16151 let timeString;
16152 if (array.length > 2) {
16153 return dateStrings;
16154 }
16155 if (/:/.test(array[0])) {
16156 timeString = array[0];
16157 } else {
16158 dateStrings.date = array[0];
16159 timeString = array[1];
16160 if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
16161 dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
16162 timeString = dateString.substr(
16163 dateStrings.date.length,
16164 dateString.length
16165 );
16166 }
16167 }
16168 if (timeString) {
16169 const token = patterns.timezone.exec(timeString);
16170 if (token) {
16171 dateStrings.time = timeString.replace(token[1], "");
16172 dateStrings.timezone = token[1];
16173 } else {
16174 dateStrings.time = timeString;
16175 }
16176 }
16177 return dateStrings;
16178 }
16179 function parseYear(dateString, additionalDigits) {
16180 const regex = new RegExp(
16181 "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
16182 );
16183 const captures = dateString.match(regex);
16184 if (!captures) return { year: NaN, restDateString: "" };
16185 const year = captures[1] ? parseInt(captures[1]) : null;
16186 const century = captures[2] ? parseInt(captures[2]) : null;
16187 return {
16188 year: century === null ? year : century * 100,
16189 restDateString: dateString.slice((captures[1] || captures[2]).length)
16190 };
16191 }
16192 function parseDate(dateString, year) {
16193 if (year === null) return /* @__PURE__ */ new Date(NaN);
16194 const captures = dateString.match(dateRegex);
16195 if (!captures) return /* @__PURE__ */ new Date(NaN);
16196 const isWeekDate = !!captures[4];
16197 const dayOfYear = parseDateUnit(captures[1]);
16198 const month = parseDateUnit(captures[2]) - 1;
16199 const day = parseDateUnit(captures[3]);
16200 const week = parseDateUnit(captures[4]);
16201 const dayOfWeek = parseDateUnit(captures[5]) - 1;
16202 if (isWeekDate) {
16203 if (!validateWeekDate(year, week, dayOfWeek)) {
16204 return /* @__PURE__ */ new Date(NaN);
16205 }
16206 return dayOfISOWeekYear(year, week, dayOfWeek);
16207 } else {
16208 const date = /* @__PURE__ */ new Date(0);
16209 if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
16210 return /* @__PURE__ */ new Date(NaN);
16211 }
16212 date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
16213 return date;
16214 }
16215 }
16216 function parseDateUnit(value) {
16217 return value ? parseInt(value) : 1;
16218 }
16219 function parseTime(timeString) {
16220 const captures = timeString.match(timeRegex);
16221 if (!captures) return NaN;
16222 const hours = parseTimeUnit(captures[1]);
16223 const minutes = parseTimeUnit(captures[2]);
16224 const seconds = parseTimeUnit(captures[3]);
16225 if (!validateTime(hours, minutes, seconds)) {
16226 return NaN;
16227 }
16228 return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
16229 }
16230 function parseTimeUnit(value) {
16231 return value && parseFloat(value.replace(",", ".")) || 0;
16232 }
16233 function parseTimezone(timezoneString) {
16234 if (timezoneString === "Z") return 0;
16235 const captures = timezoneString.match(timezoneRegex);
16236 if (!captures) return 0;
16237 const sign = captures[1] === "+" ? -1 : 1;
16238 const hours = parseInt(captures[2]);
16239 const minutes = captures[3] && parseInt(captures[3]) || 0;
16240 if (!validateTimezone(hours, minutes)) {
16241 return NaN;
16242 }
16243 return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
16244 }
16245 function dayOfISOWeekYear(isoWeekYear, week, day) {
16246 const date = /* @__PURE__ */ new Date(0);
16247 date.setUTCFullYear(isoWeekYear, 0, 4);
16248 const fourthOfJanuaryDay = date.getUTCDay() || 7;
16249 const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
16250 date.setUTCDate(date.getUTCDate() + diff);
16251 return date;
16252 }
16253 var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
16254 function isLeapYearIndex2(year) {
16255 return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
16256 }
16257 function validateDate(year, month, date) {
16258 return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex2(year) ? 29 : 28));
16259 }
16260 function validateDayOfYearDate(year, dayOfYear) {
16261 return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex2(year) ? 366 : 365);
16262 }
16263 function validateWeekDate(_year, week, day) {
16264 return week >= 1 && week <= 53 && day >= 0 && day <= 6;
16265 }
16266 function validateTime(hours, minutes, seconds) {
16267 if (hours === 24) {
16268 return minutes === 0 && seconds === 0;
16269 }
16270 return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
16271 }
16272 function validateTimezone(_hours, minutes) {
16273 return minutes >= 0 && minutes <= 59;
16274 }
16275
16276 // node_modules/date-fns/setMonth.js
16277 function setMonth(date, month, options) {
16278 const _date = toDate(date, options?.in);
16279 const year = _date.getFullYear();
16280 const day = _date.getDate();
16281 const midMonth = constructFrom(options?.in || date, 0);
16282 midMonth.setFullYear(year, month, 15);
16283 midMonth.setHours(0, 0, 0, 0);
16284 const daysInMonth = getDaysInMonth(midMonth);
16285 _date.setMonth(month, Math.min(day, daysInMonth));
16286 return _date;
16287 }
16288
16289 // node_modules/date-fns/setYear.js
16290 function setYear(date, year, options) {
16291 const date_ = toDate(date, options?.in);
16292 if (isNaN(+date_)) return constructFrom(options?.in || date, NaN);
16293 date_.setFullYear(year);
16294 return date_;
16295 }
16296
16297 // node_modules/date-fns/subMonths.js
16298 function subMonths(date, amount, options) {
16299 return addMonths(date, -amount, options);
16300 }
16301
16302 // node_modules/date-fns/subWeeks.js
16303 function subWeeks(date, amount, options) {
16304 return addWeeks(date, -amount, options);
16305 }
16306
16307 // node_modules/date-fns/subYears.js
16308 function subYears(date, amount, options) {
16309 return addYears(date, -amount, options);
16310 }
16311
16312 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js
16313 var FIVE_WEEKS = 5;
16314 var FOUR_WEEKS = 4;
16315 function getBroadcastWeeksInMonth(month, dateLib) {
16316 const firstDayOfMonth = dateLib.startOfMonth(month);
16317 const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
16318 const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
16319 const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
16320 const numberOfWeeks = dateLib.getMonth(month) === dateLib.getMonth(lastDateOfLastWeek) ? FIVE_WEEKS : FOUR_WEEKS;
16321 return numberOfWeeks;
16322 }
16323
16324 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js
16325 function startOfBroadcastWeek(date, dateLib) {
16326 const firstOfMonth = dateLib.startOfMonth(date);
16327 const dayOfWeek = firstOfMonth.getDay();
16328 if (dayOfWeek === 1) {
16329 return firstOfMonth;
16330 } else if (dayOfWeek === 0) {
16331 return dateLib.addDays(firstOfMonth, -1 * 6);
16332 } else {
16333 return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1));
16334 }
16335 }
16336
16337 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js
16338 function endOfBroadcastWeek(date, dateLib) {
16339 const startDate = startOfBroadcastWeek(date, dateLib);
16340 const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
16341 const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
16342 return endDate;
16343 }
16344
16345 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/locale/en-US.js
16346 var enUS2 = {
16347 ...enUS,
16348 labels: {
16349 labelDayButton: (date, modifiers, options, dateLib) => {
16350 let formatDate2;
16351 if (dateLib && typeof dateLib.format === "function") {
16352 formatDate2 = dateLib.format.bind(dateLib);
16353 } else {
16354 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
16355 }
16356 let label = formatDate2(date, "PPPP");
16357 if (modifiers.today)
16358 label = `Today, ${label}`;
16359 if (modifiers.selected)
16360 label = `${label}, selected`;
16361 return label;
16362 },
16363 labelMonthDropdown: "Choose the Month",
16364 labelNext: "Go to the Next Month",
16365 labelPrevious: "Go to the Previous Month",
16366 labelWeekNumber: (weekNumber) => `Week ${weekNumber}`,
16367 labelYearDropdown: "Choose the Year",
16368 labelGrid: (date, options, dateLib) => {
16369 let formatDate2;
16370 if (dateLib && typeof dateLib.format === "function") {
16371 formatDate2 = dateLib.format.bind(dateLib);
16372 } else {
16373 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
16374 }
16375 return formatDate2(date, "LLLL yyyy");
16376 },
16377 labelGridcell: (date, modifiers, options, dateLib) => {
16378 let formatDate2;
16379 if (dateLib && typeof dateLib.format === "function") {
16380 formatDate2 = dateLib.format.bind(dateLib);
16381 } else {
16382 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
16383 }
16384 let label = formatDate2(date, "PPPP");
16385 if (modifiers?.today) {
16386 label = `Today, ${label}`;
16387 }
16388 return label;
16389 },
16390 labelNav: "Navigation bar",
16391 labelWeekNumberHeader: "Week Number",
16392 labelWeekday: (date, options, dateLib) => {
16393 let formatDate2;
16394 if (dateLib && typeof dateLib.format === "function") {
16395 formatDate2 = dateLib.format.bind(dateLib);
16396 } else {
16397 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options });
16398 }
16399 return formatDate2(date, "cccc");
16400 }
16401 }
16402 };
16403
16404 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/DateLib.js
16405 var DateLib = class _DateLib {
16406 /**
16407 * Creates an instance of `DateLib`.
16408 *
16409 * @param options Configuration options for the date library.
16410 * @param overrides Custom overrides for the date library functions.
16411 */
16412 constructor(options, overrides) {
16413 this.today = () => {
16414 if (this.overrides?.today) {
16415 return this.overrides.today();
16416 }
16417 if (this.options.timeZone) {
16418 return TZDate.tz(this.options.timeZone);
16419 }
16420 const DateCtor = this.options.Date ?? Date;
16421 return new DateCtor();
16422 };
16423 this.newDate = (year, monthIndex, date) => {
16424 if (this.overrides?.newDate) {
16425 return this.overrides.newDate(year, monthIndex, date);
16426 }
16427 if (this.options.timeZone) {
16428 return new TZDate(year, monthIndex, date, this.options.timeZone);
16429 }
16430 return new Date(year, monthIndex, date);
16431 };
16432 this.addDays = (date, amount) => {
16433 return this.overrides?.addDays ? this.overrides.addDays(date, amount) : addDays(date, amount);
16434 };
16435 this.addMonths = (date, amount) => {
16436 return this.overrides?.addMonths ? this.overrides.addMonths(date, amount) : addMonths(date, amount);
16437 };
16438 this.addWeeks = (date, amount) => {
16439 return this.overrides?.addWeeks ? this.overrides.addWeeks(date, amount) : addWeeks(date, amount);
16440 };
16441 this.addYears = (date, amount) => {
16442 return this.overrides?.addYears ? this.overrides.addYears(date, amount) : addYears(date, amount);
16443 };
16444 this.differenceInCalendarDays = (dateLeft, dateRight) => {
16445 return this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(dateLeft, dateRight) : differenceInCalendarDays(dateLeft, dateRight);
16446 };
16447 this.differenceInCalendarMonths = (dateLeft, dateRight) => {
16448 return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight);
16449 };
16450 this.eachMonthOfInterval = (interval) => {
16451 return this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(interval) : eachMonthOfInterval(interval);
16452 };
16453 this.eachYearOfInterval = (interval) => {
16454 const years = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(interval) : eachYearOfInterval(interval);
16455 const uniqueYears = new Set(years.map((d) => this.getYear(d)));
16456 if (uniqueYears.size === years.length) {
16457 return years;
16458 }
16459 const yearsArray = [];
16460 uniqueYears.forEach((y2) => {
16461 yearsArray.push(new Date(y2, 0, 1));
16462 });
16463 return yearsArray;
16464 };
16465 this.endOfBroadcastWeek = (date) => {
16466 return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date) : endOfBroadcastWeek(date, this);
16467 };
16468 this.endOfISOWeek = (date) => {
16469 return this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(date) : endOfISOWeek(date);
16470 };
16471 this.endOfMonth = (date) => {
16472 return this.overrides?.endOfMonth ? this.overrides.endOfMonth(date) : endOfMonth(date);
16473 };
16474 this.endOfWeek = (date, options2) => {
16475 return this.overrides?.endOfWeek ? this.overrides.endOfWeek(date, options2) : endOfWeek(date, this.options);
16476 };
16477 this.endOfYear = (date) => {
16478 return this.overrides?.endOfYear ? this.overrides.endOfYear(date) : endOfYear(date);
16479 };
16480 this.format = (date, formatStr, _options) => {
16481 const formatted = this.overrides?.format ? this.overrides.format(date, formatStr, this.options) : format(date, formatStr, this.options);
16482 if (this.options.numerals && this.options.numerals !== "latn") {
16483 return this.replaceDigits(formatted);
16484 }
16485 return formatted;
16486 };
16487 this.getISOWeek = (date) => {
16488 return this.overrides?.getISOWeek ? this.overrides.getISOWeek(date) : getISOWeek(date);
16489 };
16490 this.getMonth = (date, _options) => {
16491 return this.overrides?.getMonth ? this.overrides.getMonth(date, this.options) : getMonth(date, this.options);
16492 };
16493 this.getYear = (date, _options) => {
16494 return this.overrides?.getYear ? this.overrides.getYear(date, this.options) : getYear(date, this.options);
16495 };
16496 this.getWeek = (date, _options) => {
16497 return this.overrides?.getWeek ? this.overrides.getWeek(date, this.options) : getWeek(date, this.options);
16498 };
16499 this.isAfter = (date, dateToCompare) => {
16500 return this.overrides?.isAfter ? this.overrides.isAfter(date, dateToCompare) : isAfter(date, dateToCompare);
16501 };
16502 this.isBefore = (date, dateToCompare) => {
16503 return this.overrides?.isBefore ? this.overrides.isBefore(date, dateToCompare) : isBefore(date, dateToCompare);
16504 };
16505 this.isDate = (value) => {
16506 return this.overrides?.isDate ? this.overrides.isDate(value) : isDate(value);
16507 };
16508 this.isSameDay = (dateLeft, dateRight) => {
16509 return this.overrides?.isSameDay ? this.overrides.isSameDay(dateLeft, dateRight) : isSameDay(dateLeft, dateRight);
16510 };
16511 this.isSameMonth = (dateLeft, dateRight) => {
16512 return this.overrides?.isSameMonth ? this.overrides.isSameMonth(dateLeft, dateRight) : isSameMonth(dateLeft, dateRight);
16513 };
16514 this.isSameYear = (dateLeft, dateRight) => {
16515 return this.overrides?.isSameYear ? this.overrides.isSameYear(dateLeft, dateRight) : isSameYear(dateLeft, dateRight);
16516 };
16517 this.max = (dates) => {
16518 return this.overrides?.max ? this.overrides.max(dates) : max2(dates);
16519 };
16520 this.min = (dates) => {
16521 return this.overrides?.min ? this.overrides.min(dates) : min2(dates);
16522 };
16523 this.setMonth = (date, month) => {
16524 return this.overrides?.setMonth ? this.overrides.setMonth(date, month) : setMonth(date, month);
16525 };
16526 this.setYear = (date, year) => {
16527 return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year);
16528 };
16529 this.startOfBroadcastWeek = (date, _dateLib) => {
16530 return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this);
16531 };
16532 this.startOfDay = (date) => {
16533 return this.overrides?.startOfDay ? this.overrides.startOfDay(date) : startOfDay(date);
16534 };
16535 this.startOfISOWeek = (date) => {
16536 return this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(date) : startOfISOWeek(date);
16537 };
16538 this.startOfMonth = (date) => {
16539 return this.overrides?.startOfMonth ? this.overrides.startOfMonth(date) : startOfMonth(date);
16540 };
16541 this.startOfWeek = (date, _options) => {
16542 return this.overrides?.startOfWeek ? this.overrides.startOfWeek(date, this.options) : startOfWeek(date, this.options);
16543 };
16544 this.startOfYear = (date) => {
16545 return this.overrides?.startOfYear ? this.overrides.startOfYear(date) : startOfYear(date);
16546 };
16547 this.options = { locale: enUS2, ...options };
16548 this.overrides = overrides;
16549 }
16550 /**
16551 * Generates a mapping of Arabic digits (0-9) to the target numbering system
16552 * digits.
16553 *
16554 * @since 9.5.0
16555 * @returns A record mapping Arabic digits to the target numerals.
16556 */
16557 getDigitMap() {
16558 const { numerals = "latn" } = this.options;
16559 const formatter = new Intl.NumberFormat("en-US", {
16560 numberingSystem: numerals
16561 });
16562 const digitMap = {};
16563 for (let i = 0; i < 10; i++) {
16564 digitMap[i.toString()] = formatter.format(i);
16565 }
16566 return digitMap;
16567 }
16568 /**
16569 * Replaces Arabic digits in a string with the target numbering system digits.
16570 *
16571 * @since 9.5.0
16572 * @param input The string containing Arabic digits.
16573 * @returns The string with digits replaced.
16574 */
16575 replaceDigits(input) {
16576 const digitMap = this.getDigitMap();
16577 return input.replace(/\d/g, (digit) => digitMap[digit] || digit);
16578 }
16579 /**
16580 * Formats a number using the configured numbering system.
16581 *
16582 * @since 9.5.0
16583 * @param value The number to format.
16584 * @returns The formatted number as a string.
16585 */
16586 formatNumber(value) {
16587 return this.replaceDigits(value.toString());
16588 }
16589 /**
16590 * Returns the preferred ordering for month and year labels for the current
16591 * locale.
16592 */
16593 getMonthYearOrder() {
16594 const code = this.options.locale?.code;
16595 if (!code) {
16596 return "month-first";
16597 }
16598 return _DateLib.yearFirstLocales.has(code) ? "year-first" : "month-first";
16599 }
16600 /**
16601 * Formats the month/year pair respecting locale conventions.
16602 *
16603 * @since 9.11.0
16604 */
16605 formatMonthYear(date) {
16606 const { locale, timeZone, numerals } = this.options;
16607 const localeCode = locale?.code;
16608 if (localeCode && _DateLib.yearFirstLocales.has(localeCode)) {
16609 try {
16610 const intl = new Intl.DateTimeFormat(localeCode, {
16611 month: "long",
16612 year: "numeric",
16613 timeZone,
16614 numberingSystem: numerals
16615 });
16616 const formatted = intl.format(date);
16617 return formatted;
16618 } catch {
16619 }
16620 }
16621 const pattern = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
16622 return this.format(date, pattern);
16623 }
16624 };
16625 DateLib.yearFirstLocales = /* @__PURE__ */ new Set([
16626 "eu",
16627 "hu",
16628 "ja",
16629 "ja-Hira",
16630 "ja-JP",
16631 "ko",
16632 "ko-KR",
16633 "lt",
16634 "lt-LT",
16635 "lv",
16636 "lv-LV",
16637 "mn",
16638 "mn-MN",
16639 "zh",
16640 "zh-CN",
16641 "zh-HK",
16642 "zh-TW"
16643 ]);
16644 var defaultDateLib = new DateLib();
16645
16646 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js
16647 var CalendarDay = class {
16648 constructor(date, displayMonth, dateLib = defaultDateLib) {
16649 this.date = date;
16650 this.displayMonth = displayMonth;
16651 this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth));
16652 this.dateLib = dateLib;
16653 this.isoDate = dateLib.format(date, "yyyy-MM-dd");
16654 this.displayMonthId = dateLib.format(displayMonth, "yyyy-MM");
16655 this.dateMonthId = dateLib.format(date, "yyyy-MM");
16656 }
16657 /**
16658 * Checks if this day is equal to another `CalendarDay`, considering both the
16659 * date and the displayed month.
16660 *
16661 * @param day The `CalendarDay` to compare with.
16662 * @returns `true` if the days are equal, otherwise `false`.
16663 */
16664 isEqualTo(day) {
16665 return this.dateLib.isSameDay(day.date, this.date) && this.dateLib.isSameMonth(day.displayMonth, this.displayMonth);
16666 }
16667 };
16668
16669 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js
16670 var CalendarMonth = class {
16671 constructor(month, weeks) {
16672 this.date = month;
16673 this.weeks = weeks;
16674 }
16675 };
16676
16677 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js
16678 var CalendarWeek = class {
16679 constructor(weekNumber, days) {
16680 this.days = days;
16681 this.weekNumber = weekNumber;
16682 }
16683 };
16684
16685 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/custom-components.js
16686 var custom_components_exports = {};
16687 __export(custom_components_exports, {
16688 CaptionLabel: () => CaptionLabel,
16689 Chevron: () => Chevron,
16690 Day: () => Day,
16691 DayButton: () => DayButton,
16692 Dropdown: () => Dropdown,
16693 DropdownNav: () => DropdownNav,
16694 Footer: () => Footer,
16695 Month: () => Month,
16696 MonthCaption: () => MonthCaption,
16697 MonthGrid: () => MonthGrid,
16698 Months: () => Months,
16699 MonthsDropdown: () => MonthsDropdown,
16700 Nav: () => Nav,
16701 NextMonthButton: () => NextMonthButton,
16702 Option: () => Option,
16703 PreviousMonthButton: () => PreviousMonthButton,
16704 Root: () => Root2,
16705 Select: () => Select,
16706 Week: () => Week,
16707 WeekNumber: () => WeekNumber,
16708 WeekNumberHeader: () => WeekNumberHeader,
16709 Weekday: () => Weekday,
16710 Weekdays: () => Weekdays,
16711 Weeks: () => Weeks,
16712 YearsDropdown: () => YearsDropdown
16713 });
16714
16715 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js
16716 var import_react6 = __toESM(require_react(), 1);
16717 function CaptionLabel(props) {
16718 return import_react6.default.createElement("span", { ...props });
16719 }
16720
16721 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Chevron.js
16722 var import_react7 = __toESM(require_react(), 1);
16723 function Chevron(props) {
16724 const { size: size4 = 24, orientation = "left", className, style } = props;
16725 return import_react7.default.createElement(
16726 "svg",
16727 { className, style, width: size4, height: size4, viewBox: "0 0 24 24" },
16728 orientation === "up" && import_react7.default.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
16729 orientation === "down" && import_react7.default.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
16730 orientation === "left" && import_react7.default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
16731 orientation === "right" && import_react7.default.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" })
16732 );
16733 }
16734
16735 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Day.js
16736 var import_react8 = __toESM(require_react(), 1);
16737 function Day(props) {
16738 const { day, modifiers, ...tdProps } = props;
16739 return import_react8.default.createElement("td", { ...tdProps });
16740 }
16741
16742 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DayButton.js
16743 var import_react9 = __toESM(require_react(), 1);
16744 function DayButton(props) {
16745 const { day, modifiers, ...buttonProps } = props;
16746 const ref = import_react9.default.useRef(null);
16747 import_react9.default.useEffect(() => {
16748 if (modifiers.focused)
16749 ref.current?.focus();
16750 }, [modifiers.focused]);
16751 return import_react9.default.createElement("button", { ref, ...buttonProps });
16752 }
16753
16754 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js
16755 var import_react11 = __toESM(require_react(), 1);
16756
16757 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/UI.js
16758 var UI;
16759 (function(UI2) {
16760 UI2["Root"] = "root";
16761 UI2["Chevron"] = "chevron";
16762 UI2["Day"] = "day";
16763 UI2["DayButton"] = "day_button";
16764 UI2["CaptionLabel"] = "caption_label";
16765 UI2["Dropdowns"] = "dropdowns";
16766 UI2["Dropdown"] = "dropdown";
16767 UI2["DropdownRoot"] = "dropdown_root";
16768 UI2["Footer"] = "footer";
16769 UI2["MonthGrid"] = "month_grid";
16770 UI2["MonthCaption"] = "month_caption";
16771 UI2["MonthsDropdown"] = "months_dropdown";
16772 UI2["Month"] = "month";
16773 UI2["Months"] = "months";
16774 UI2["Nav"] = "nav";
16775 UI2["NextMonthButton"] = "button_next";
16776 UI2["PreviousMonthButton"] = "button_previous";
16777 UI2["Week"] = "week";
16778 UI2["Weeks"] = "weeks";
16779 UI2["Weekday"] = "weekday";
16780 UI2["Weekdays"] = "weekdays";
16781 UI2["WeekNumber"] = "week_number";
16782 UI2["WeekNumberHeader"] = "week_number_header";
16783 UI2["YearsDropdown"] = "years_dropdown";
16784 })(UI || (UI = {}));
16785 var DayFlag;
16786 (function(DayFlag2) {
16787 DayFlag2["disabled"] = "disabled";
16788 DayFlag2["hidden"] = "hidden";
16789 DayFlag2["outside"] = "outside";
16790 DayFlag2["focused"] = "focused";
16791 DayFlag2["today"] = "today";
16792 })(DayFlag || (DayFlag = {}));
16793 var SelectionState;
16794 (function(SelectionState2) {
16795 SelectionState2["range_end"] = "range_end";
16796 SelectionState2["range_middle"] = "range_middle";
16797 SelectionState2["range_start"] = "range_start";
16798 SelectionState2["selected"] = "selected";
16799 })(SelectionState || (SelectionState = {}));
16800 var Animation;
16801 (function(Animation2) {
16802 Animation2["weeks_before_enter"] = "weeks_before_enter";
16803 Animation2["weeks_before_exit"] = "weeks_before_exit";
16804 Animation2["weeks_after_enter"] = "weeks_after_enter";
16805 Animation2["weeks_after_exit"] = "weeks_after_exit";
16806 Animation2["caption_after_enter"] = "caption_after_enter";
16807 Animation2["caption_after_exit"] = "caption_after_exit";
16808 Animation2["caption_before_enter"] = "caption_before_enter";
16809 Animation2["caption_before_exit"] = "caption_before_exit";
16810 })(Animation || (Animation = {}));
16811
16812 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useDayPicker.js
16813 var import_react10 = __toESM(require_react(), 1);
16814 var dayPickerContext = (0, import_react10.createContext)(void 0);
16815 function useDayPicker() {
16816 const context = (0, import_react10.useContext)(dayPickerContext);
16817 if (context === void 0) {
16818 throw new Error("useDayPicker() must be used within a custom component.");
16819 }
16820 return context;
16821 }
16822
16823 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js
16824 function Dropdown(props) {
16825 const { options, className, ...selectProps } = props;
16826 const { classNames, components, styles } = useDayPicker();
16827 const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");
16828 const selectedOption = options?.find(({ value }) => value === selectProps.value);
16829 return import_react11.default.createElement(
16830 "span",
16831 { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles?.[UI.DropdownRoot] },
16832 import_react11.default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled: disabled2 }) => import_react11.default.createElement(components.Option, { key: value, value, disabled: disabled2 }, label))),
16833 import_react11.default.createElement(
16834 "span",
16835 { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], "aria-hidden": true },
16836 selectedOption?.label,
16837 import_react11.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron], style: styles?.[UI.Chevron] })
16838 )
16839 );
16840 }
16841
16842 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DropdownNav.js
16843 var import_react12 = __toESM(require_react(), 1);
16844 function DropdownNav(props) {
16845 return import_react12.default.createElement("div", { ...props });
16846 }
16847
16848 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Footer.js
16849 var import_react13 = __toESM(require_react(), 1);
16850 function Footer(props) {
16851 return import_react13.default.createElement("div", { ...props });
16852 }
16853
16854 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Month.js
16855 var import_react14 = __toESM(require_react(), 1);
16856 function Month(props) {
16857 const { calendarMonth, displayIndex, ...divProps } = props;
16858 return import_react14.default.createElement("div", { ...divProps }, props.children);
16859 }
16860
16861 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthCaption.js
16862 var import_react15 = __toESM(require_react(), 1);
16863 function MonthCaption(props) {
16864 const { calendarMonth, displayIndex, ...divProps } = props;
16865 return import_react15.default.createElement("div", { ...divProps });
16866 }
16867
16868 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthGrid.js
16869 var import_react16 = __toESM(require_react(), 1);
16870 function MonthGrid(props) {
16871 return import_react16.default.createElement("table", { ...props });
16872 }
16873
16874 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Months.js
16875 var import_react17 = __toESM(require_react(), 1);
16876 function Months(props) {
16877 return import_react17.default.createElement("div", { ...props });
16878 }
16879
16880 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js
16881 var import_react18 = __toESM(require_react(), 1);
16882 function MonthsDropdown(props) {
16883 const { components } = useDayPicker();
16884 return import_react18.default.createElement(components.Dropdown, { ...props });
16885 }
16886
16887 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Nav.js
16888 var import_react19 = __toESM(require_react(), 1);
16889 function Nav(props) {
16890 const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props;
16891 const { components, classNames, styles, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker();
16892 const handleNextClick = (0, import_react19.useCallback)((e) => {
16893 if (nextMonth) {
16894 onNextClick?.(e);
16895 }
16896 }, [nextMonth, onNextClick]);
16897 const handlePreviousClick = (0, import_react19.useCallback)((e) => {
16898 if (previousMonth) {
16899 onPreviousClick?.(e);
16900 }
16901 }, [previousMonth, onPreviousClick]);
16902 return import_react19.default.createElement(
16903 "nav",
16904 { ...navProps },
16905 import_react19.default.createElement(
16906 components.PreviousMonthButton,
16907 { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick },
16908 import_react19.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: "left" })
16909 ),
16910 import_react19.default.createElement(
16911 components.NextMonthButton,
16912 { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick },
16913 import_react19.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron], style: styles?.[UI.Chevron] })
16914 )
16915 );
16916 }
16917
16918 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js
16919 var import_react20 = __toESM(require_react(), 1);
16920 function NextMonthButton(props) {
16921 return import_react20.default.createElement("button", { ...props });
16922 }
16923
16924 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Option.js
16925 var import_react21 = __toESM(require_react(), 1);
16926 function Option(props) {
16927 return import_react21.default.createElement("option", { ...props });
16928 }
16929
16930 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js
16931 var import_react22 = __toESM(require_react(), 1);
16932 function PreviousMonthButton(props) {
16933 return import_react22.default.createElement("button", { ...props });
16934 }
16935
16936 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Root.js
16937 var import_react23 = __toESM(require_react(), 1);
16938 function Root2(props) {
16939 const { rootRef, ...rest } = props;
16940 return import_react23.default.createElement("div", { ...rest, ref: rootRef });
16941 }
16942
16943 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Select.js
16944 var import_react24 = __toESM(require_react(), 1);
16945 function Select(props) {
16946 return import_react24.default.createElement("select", { ...props });
16947 }
16948
16949 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Week.js
16950 var import_react25 = __toESM(require_react(), 1);
16951 function Week(props) {
16952 const { week, ...trProps } = props;
16953 return import_react25.default.createElement("tr", { ...trProps });
16954 }
16955
16956 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekday.js
16957 var import_react26 = __toESM(require_react(), 1);
16958 function Weekday(props) {
16959 return import_react26.default.createElement("th", { ...props });
16960 }
16961
16962 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekdays.js
16963 var import_react27 = __toESM(require_react(), 1);
16964 function Weekdays(props) {
16965 return import_react27.default.createElement(
16966 "thead",
16967 { "aria-hidden": true },
16968 import_react27.default.createElement("tr", { ...props })
16969 );
16970 }
16971
16972 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumber.js
16973 var import_react28 = __toESM(require_react(), 1);
16974 function WeekNumber(props) {
16975 const { week, ...thProps } = props;
16976 return import_react28.default.createElement("th", { ...thProps });
16977 }
16978
16979 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js
16980 var import_react29 = __toESM(require_react(), 1);
16981 function WeekNumberHeader(props) {
16982 return import_react29.default.createElement("th", { ...props });
16983 }
16984
16985 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weeks.js
16986 var import_react30 = __toESM(require_react(), 1);
16987 function Weeks(props) {
16988 return import_react30.default.createElement("tbody", { ...props });
16989 }
16990
16991 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js
16992 var import_react31 = __toESM(require_react(), 1);
16993 function YearsDropdown(props) {
16994 const { components } = useDayPicker();
16995 return import_react31.default.createElement(components.Dropdown, { ...props });
16996 }
16997
16998 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js
16999 var import_react36 = __toESM(require_react(), 1);
17000
17001 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js
17002 function rangeIncludesDate(range, date, excludeEnds = false, dateLib = defaultDateLib) {
17003 let { from, to } = range;
17004 const { differenceInCalendarDays: differenceInCalendarDays2, isSameDay: isSameDay2 } = dateLib;
17005 if (from && to) {
17006 const isRangeInverted = differenceInCalendarDays2(to, from) < 0;
17007 if (isRangeInverted) {
17008 [from, to] = [to, from];
17009 }
17010 const isInRange = differenceInCalendarDays2(date, from) >= (excludeEnds ? 1 : 0) && differenceInCalendarDays2(to, date) >= (excludeEnds ? 1 : 0);
17011 return isInRange;
17012 }
17013 if (!excludeEnds && to) {
17014 return isSameDay2(to, date);
17015 }
17016 if (!excludeEnds && from) {
17017 return isSameDay2(from, date);
17018 }
17019 return false;
17020 }
17021
17022 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/typeguards.js
17023 function isDateInterval(matcher) {
17024 return Boolean(matcher && typeof matcher === "object" && "before" in matcher && "after" in matcher);
17025 }
17026 function isDateRange(value) {
17027 return Boolean(value && typeof value === "object" && "from" in value);
17028 }
17029 function isDateAfterType(value) {
17030 return Boolean(value && typeof value === "object" && "after" in value);
17031 }
17032 function isDateBeforeType(value) {
17033 return Boolean(value && typeof value === "object" && "before" in value);
17034 }
17035 function isDayOfWeekType(value) {
17036 return Boolean(value && typeof value === "object" && "dayOfWeek" in value);
17037 }
17038 function isDatesArray(value, dateLib) {
17039 return Array.isArray(value) && value.every(dateLib.isDate);
17040 }
17041
17042 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js
17043 function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
17044 const matchersArr = !Array.isArray(matchers) ? [matchers] : matchers;
17045 const { isSameDay: isSameDay2, differenceInCalendarDays: differenceInCalendarDays2, isAfter: isAfter2 } = dateLib;
17046 return matchersArr.some((matcher) => {
17047 if (typeof matcher === "boolean") {
17048 return matcher;
17049 }
17050 if (dateLib.isDate(matcher)) {
17051 return isSameDay2(date, matcher);
17052 }
17053 if (isDatesArray(matcher, dateLib)) {
17054 return matcher.some((matcherDate) => isSameDay2(date, matcherDate));
17055 }
17056 if (isDateRange(matcher)) {
17057 return rangeIncludesDate(matcher, date, false, dateLib);
17058 }
17059 if (isDayOfWeekType(matcher)) {
17060 if (!Array.isArray(matcher.dayOfWeek)) {
17061 return matcher.dayOfWeek === date.getDay();
17062 }
17063 return matcher.dayOfWeek.includes(date.getDay());
17064 }
17065 if (isDateInterval(matcher)) {
17066 const diffBefore = differenceInCalendarDays2(matcher.before, date);
17067 const diffAfter = differenceInCalendarDays2(matcher.after, date);
17068 const isDayBefore = diffBefore > 0;
17069 const isDayAfter = diffAfter < 0;
17070 const isClosedInterval = isAfter2(matcher.before, matcher.after);
17071 if (isClosedInterval) {
17072 return isDayAfter && isDayBefore;
17073 } else {
17074 return isDayBefore || isDayAfter;
17075 }
17076 }
17077 if (isDateAfterType(matcher)) {
17078 return differenceInCalendarDays2(date, matcher.after) > 0;
17079 }
17080 if (isDateBeforeType(matcher)) {
17081 return differenceInCalendarDays2(matcher.before, date) > 0;
17082 }
17083 if (typeof matcher === "function") {
17084 return matcher(date);
17085 }
17086 return false;
17087 });
17088 }
17089
17090 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js
17091 function createGetModifiers(days, props, navStart, navEnd, dateLib) {
17092 const { disabled: disabled2, hidden, modifiers, showOutsideDays, broadcastCalendar, today = dateLib.today() } = props;
17093 const { isSameDay: isSameDay2, isSameMonth: isSameMonth2, startOfMonth: startOfMonth2, isBefore: isBefore2, endOfMonth: endOfMonth2, isAfter: isAfter2 } = dateLib;
17094 const computedNavStart = navStart && startOfMonth2(navStart);
17095 const computedNavEnd = navEnd && endOfMonth2(navEnd);
17096 const internalModifiersMap = {
17097 [DayFlag.focused]: [],
17098 [DayFlag.outside]: [],
17099 [DayFlag.disabled]: [],
17100 [DayFlag.hidden]: [],
17101 [DayFlag.today]: []
17102 };
17103 const customModifiersMap = {};
17104 for (const day of days) {
17105 const { date, displayMonth } = day;
17106 const isOutside = Boolean(displayMonth && !isSameMonth2(date, displayMonth));
17107 const isBeforeNavStart = Boolean(computedNavStart && isBefore2(date, computedNavStart));
17108 const isAfterNavEnd = Boolean(computedNavEnd && isAfter2(date, computedNavEnd));
17109 const isDisabled = Boolean(disabled2 && dateMatchModifiers(date, disabled2, dateLib));
17110 const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || isBeforeNavStart || isAfterNavEnd || // Broadcast calendar will show outside days as default
17111 !broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside;
17112 const isToday = isSameDay2(date, today);
17113 if (isOutside)
17114 internalModifiersMap.outside.push(day);
17115 if (isDisabled)
17116 internalModifiersMap.disabled.push(day);
17117 if (isHidden)
17118 internalModifiersMap.hidden.push(day);
17119 if (isToday)
17120 internalModifiersMap.today.push(day);
17121 if (modifiers) {
17122 Object.keys(modifiers).forEach((name) => {
17123 const modifierValue = modifiers?.[name];
17124 const isMatch = modifierValue ? dateMatchModifiers(date, modifierValue, dateLib) : false;
17125 if (!isMatch)
17126 return;
17127 if (customModifiersMap[name]) {
17128 customModifiersMap[name].push(day);
17129 } else {
17130 customModifiersMap[name] = [day];
17131 }
17132 });
17133 }
17134 }
17135 return (day) => {
17136 const dayFlags = {
17137 [DayFlag.focused]: false,
17138 [DayFlag.disabled]: false,
17139 [DayFlag.hidden]: false,
17140 [DayFlag.outside]: false,
17141 [DayFlag.today]: false
17142 };
17143 const customModifiers = {};
17144 for (const name in internalModifiersMap) {
17145 const days2 = internalModifiersMap[name];
17146 dayFlags[name] = days2.some((d) => d === day);
17147 }
17148 for (const name in customModifiersMap) {
17149 customModifiers[name] = customModifiersMap[name].some((d) => d === day);
17150 }
17151 return {
17152 ...dayFlags,
17153 // custom modifiers should override all the previous ones
17154 ...customModifiers
17155 };
17156 };
17157 }
17158
17159 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js
17160 function getClassNamesForModifiers(modifiers, classNames, modifiersClassNames = {}) {
17161 const modifierClassNames = Object.entries(modifiers).filter(([, active]) => active === true).reduce((previousValue, [key]) => {
17162 if (modifiersClassNames[key]) {
17163 previousValue.push(modifiersClassNames[key]);
17164 } else if (classNames[DayFlag[key]]) {
17165 previousValue.push(classNames[DayFlag[key]]);
17166 } else if (classNames[SelectionState[key]]) {
17167 previousValue.push(classNames[SelectionState[key]]);
17168 }
17169 return previousValue;
17170 }, [classNames[UI.Day]]);
17171 return modifierClassNames;
17172 }
17173
17174 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getComponents.js
17175 function getComponents(customComponents) {
17176 return {
17177 ...custom_components_exports,
17178 ...customComponents
17179 };
17180 }
17181
17182 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js
17183 function getDataAttributes(props) {
17184 const dataAttributes = {
17185 "data-mode": props.mode ?? void 0,
17186 "data-required": "required" in props ? props.required : void 0,
17187 "data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || void 0,
17188 "data-week-numbers": props.showWeekNumber || void 0,
17189 "data-broadcast-calendar": props.broadcastCalendar || void 0,
17190 "data-nav-layout": props.navLayout || void 0
17191 };
17192 Object.entries(props).forEach(([key, val]) => {
17193 if (key.startsWith("data-")) {
17194 dataAttributes[key] = val;
17195 }
17196 });
17197 return dataAttributes;
17198 }
17199
17200 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js
17201 function getDefaultClassNames() {
17202 const classNames = {};
17203 for (const key in UI) {
17204 classNames[UI[key]] = `rdp-${UI[key]}`;
17205 }
17206 for (const key in DayFlag) {
17207 classNames[DayFlag[key]] = `rdp-${DayFlag[key]}`;
17208 }
17209 for (const key in SelectionState) {
17210 classNames[SelectionState[key]] = `rdp-${SelectionState[key]}`;
17211 }
17212 for (const key in Animation) {
17213 classNames[Animation[key]] = `rdp-${Animation[key]}`;
17214 }
17215 return classNames;
17216 }
17217
17218 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/index.js
17219 var formatters_exports = {};
17220 __export(formatters_exports, {
17221 formatCaption: () => formatCaption,
17222 formatDay: () => formatDay,
17223 formatMonthDropdown: () => formatMonthDropdown,
17224 formatWeekNumber: () => formatWeekNumber,
17225 formatWeekNumberHeader: () => formatWeekNumberHeader,
17226 formatWeekdayName: () => formatWeekdayName,
17227 formatYearDropdown: () => formatYearDropdown
17228 });
17229
17230 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js
17231 function formatCaption(month, options, dateLib) {
17232 const lib = dateLib ?? new DateLib(options);
17233 return lib.formatMonthYear(month);
17234 }
17235
17236 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatDay.js
17237 function formatDay(date, options, dateLib) {
17238 return (dateLib ?? new DateLib(options)).format(date, "d");
17239 }
17240
17241 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js
17242 function formatMonthDropdown(month, dateLib = defaultDateLib) {
17243 return dateLib.format(month, "LLLL");
17244 }
17245
17246 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js
17247 function formatWeekdayName(weekday, options, dateLib) {
17248 return (dateLib ?? new DateLib(options)).format(weekday, "cccccc");
17249 }
17250
17251 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js
17252 function formatWeekNumber(weekNumber, dateLib = defaultDateLib) {
17253 if (weekNumber < 10) {
17254 return dateLib.formatNumber(`0${weekNumber.toLocaleString()}`);
17255 }
17256 return dateLib.formatNumber(`${weekNumber.toLocaleString()}`);
17257 }
17258
17259 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js
17260 function formatWeekNumberHeader() {
17261 return ``;
17262 }
17263
17264 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js
17265 function formatYearDropdown(year, dateLib = defaultDateLib) {
17266 return dateLib.format(year, "yyyy");
17267 }
17268
17269 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js
17270 function getFormatters(customFormatters) {
17271 return {
17272 ...formatters_exports,
17273 ...customFormatters
17274 };
17275 }
17276
17277 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/index.js
17278 var labels_exports = {};
17279 __export(labels_exports, {
17280 labelDayButton: () => labelDayButton,
17281 labelGrid: () => labelGrid,
17282 labelGridcell: () => labelGridcell,
17283 labelMonthDropdown: () => labelMonthDropdown,
17284 labelNav: () => labelNav,
17285 labelNext: () => labelNext,
17286 labelPrevious: () => labelPrevious,
17287 labelWeekNumber: () => labelWeekNumber,
17288 labelWeekNumberHeader: () => labelWeekNumberHeader,
17289 labelWeekday: () => labelWeekday,
17290 labelYearDropdown: () => labelYearDropdown
17291 });
17292
17293 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js
17294 function labelDayButton(date, modifiers, options, dateLib) {
17295 let label = (dateLib ?? new DateLib(options)).format(date, "PPPP");
17296 if (modifiers.today)
17297 label = `Today, ${label}`;
17298 if (modifiers.selected)
17299 label = `${label}, selected`;
17300 return label;
17301 }
17302
17303 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGrid.js
17304 function labelGrid(date, options, dateLib) {
17305 const lib = dateLib ?? new DateLib(options);
17306 return lib.formatMonthYear(date);
17307 }
17308
17309 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js
17310 function labelGridcell(date, modifiers, options, dateLib) {
17311 let label = (dateLib ?? new DateLib(options)).format(date, "PPPP");
17312 if (modifiers?.today) {
17313 label = `Today, ${label}`;
17314 }
17315 return label;
17316 }
17317
17318 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js
17319 function labelMonthDropdown(_options) {
17320 return "Choose the Month";
17321 }
17322
17323 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNav.js
17324 function labelNav() {
17325 return "";
17326 }
17327
17328 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNext.js
17329 var defaultLabel = "Go to the Next Month";
17330 function labelNext(_month, _options) {
17331 return defaultLabel;
17332 }
17333
17334 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js
17335 function labelPrevious(_month) {
17336 return "Go to the Previous Month";
17337 }
17338
17339 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js
17340 function labelWeekday(date, options, dateLib) {
17341 return (dateLib ?? new DateLib(options)).format(date, "cccc");
17342 }
17343
17344 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js
17345 function labelWeekNumber(weekNumber, _options) {
17346 return `Week ${weekNumber}`;
17347 }
17348
17349 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js
17350 function labelWeekNumberHeader(_options) {
17351 return "Week Number";
17352 }
17353
17354 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js
17355 function labelYearDropdown(_options) {
17356 return "Choose the Year";
17357 }
17358
17359 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getLabels.js
17360 var resolveLabel = (defaultLabel2, customLabel, localeLabel) => {
17361 if (customLabel)
17362 return customLabel;
17363 if (localeLabel) {
17364 return typeof localeLabel === "function" ? localeLabel : (..._args) => localeLabel;
17365 }
17366 return defaultLabel2;
17367 };
17368 function getLabels(customLabels, options) {
17369 const localeLabels = options.locale?.labels ?? {};
17370 return {
17371 ...labels_exports,
17372 ...customLabels ?? {},
17373 labelDayButton: resolveLabel(labelDayButton, customLabels?.labelDayButton, localeLabels.labelDayButton),
17374 labelMonthDropdown: resolveLabel(labelMonthDropdown, customLabels?.labelMonthDropdown, localeLabels.labelMonthDropdown),
17375 labelNext: resolveLabel(labelNext, customLabels?.labelNext, localeLabels.labelNext),
17376 labelPrevious: resolveLabel(labelPrevious, customLabels?.labelPrevious, localeLabels.labelPrevious),
17377 labelWeekNumber: resolveLabel(labelWeekNumber, customLabels?.labelWeekNumber, localeLabels.labelWeekNumber),
17378 labelYearDropdown: resolveLabel(labelYearDropdown, customLabels?.labelYearDropdown, localeLabels.labelYearDropdown),
17379 labelGrid: resolveLabel(labelGrid, customLabels?.labelGrid, localeLabels.labelGrid),
17380 labelGridcell: resolveLabel(labelGridcell, customLabels?.labelGridcell, localeLabels.labelGridcell),
17381 labelNav: resolveLabel(labelNav, customLabels?.labelNav, localeLabels.labelNav),
17382 labelWeekNumberHeader: resolveLabel(labelWeekNumberHeader, customLabels?.labelWeekNumberHeader, localeLabels.labelWeekNumberHeader),
17383 labelWeekday: resolveLabel(labelWeekday, customLabels?.labelWeekday, localeLabels.labelWeekday)
17384 };
17385 }
17386
17387 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js
17388 function getMonthOptions(displayMonth, navStart, navEnd, formatters2, dateLib) {
17389 const { startOfMonth: startOfMonth2, startOfYear: startOfYear2, endOfYear: endOfYear2, eachMonthOfInterval: eachMonthOfInterval2, getMonth: getMonth2 } = dateLib;
17390 const months = eachMonthOfInterval2({
17391 start: startOfYear2(displayMonth),
17392 end: endOfYear2(displayMonth)
17393 });
17394 const options = months.map((month) => {
17395 const label = formatters2.formatMonthDropdown(month, dateLib);
17396 const value = getMonth2(month);
17397 const disabled2 = navStart && month < startOfMonth2(navStart) || navEnd && month > startOfMonth2(navEnd) || false;
17398 return { value, label, disabled: disabled2 };
17399 });
17400 return options;
17401 }
17402
17403 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js
17404 function getStyleForModifiers(dayModifiers, styles = {}, modifiersStyles = {}) {
17405 let style = { ...styles?.[UI.Day] };
17406 Object.entries(dayModifiers).filter(([, active]) => active === true).forEach(([modifier]) => {
17407 style = {
17408 ...style,
17409 ...modifiersStyles?.[modifier]
17410 };
17411 });
17412 return style;
17413 }
17414
17415 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js
17416 function getWeekdays(dateLib, ISOWeek, broadcastCalendar, today) {
17417 const referenceToday = today ?? dateLib.today();
17418 const start = broadcastCalendar ? dateLib.startOfBroadcastWeek(referenceToday, dateLib) : ISOWeek ? dateLib.startOfISOWeek(referenceToday) : dateLib.startOfWeek(referenceToday);
17419 const days = [];
17420 for (let i = 0; i < 7; i++) {
17421 const day = dateLib.addDays(start, i);
17422 days.push(day);
17423 }
17424 return days;
17425 }
17426
17427 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js
17428 function getYearOptions(navStart, navEnd, formatters2, dateLib, reverse = false) {
17429 if (!navStart)
17430 return void 0;
17431 if (!navEnd)
17432 return void 0;
17433 const { startOfYear: startOfYear2, endOfYear: endOfYear2, eachYearOfInterval: eachYearOfInterval2, getYear: getYear2 } = dateLib;
17434 const firstNavYear = startOfYear2(navStart);
17435 const lastNavYear = endOfYear2(navEnd);
17436 const years = eachYearOfInterval2({ start: firstNavYear, end: lastNavYear });
17437 if (reverse)
17438 years.reverse();
17439 return years.map((year) => {
17440 const label = formatters2.formatYearDropdown(year, dateLib);
17441 return {
17442 value: getYear2(year),
17443 label,
17444 disabled: false
17445 };
17446 });
17447 }
17448
17449 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/noonDateLib.js
17450 function createNoonOverrides(timeZone, options = {}) {
17451 const { weekStartsOn, locale } = options;
17452 const fallbackWeekStartsOn = weekStartsOn ?? locale?.options?.weekStartsOn ?? 0;
17453 const toNoonTZDate = (date) => {
17454 const normalizedDate = typeof date === "number" || typeof date === "string" ? new Date(date) : date;
17455 return new TZDate(normalizedDate.getFullYear(), normalizedDate.getMonth(), normalizedDate.getDate(), 12, 0, 0, timeZone);
17456 };
17457 const toCalendarDate2 = (date) => {
17458 const zoned = toNoonTZDate(date);
17459 return new Date(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 0, 0, 0, 0);
17460 };
17461 return {
17462 today: () => {
17463 return toNoonTZDate(TZDate.tz(timeZone));
17464 },
17465 newDate: (year, monthIndex, date) => {
17466 return new TZDate(year, monthIndex, date, 12, 0, 0, timeZone);
17467 },
17468 startOfDay: (date) => {
17469 return toNoonTZDate(date);
17470 },
17471 startOfWeek: (date, options2) => {
17472 const base = toNoonTZDate(date);
17473 const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn;
17474 const diff = (base.getDay() - weekStartsOnValue + 7) % 7;
17475 base.setDate(base.getDate() - diff);
17476 return base;
17477 },
17478 startOfISOWeek: (date) => {
17479 const base = toNoonTZDate(date);
17480 const diff = (base.getDay() - 1 + 7) % 7;
17481 base.setDate(base.getDate() - diff);
17482 return base;
17483 },
17484 startOfMonth: (date) => {
17485 const base = toNoonTZDate(date);
17486 base.setDate(1);
17487 return base;
17488 },
17489 startOfYear: (date) => {
17490 const base = toNoonTZDate(date);
17491 base.setMonth(0, 1);
17492 return base;
17493 },
17494 endOfWeek: (date, options2) => {
17495 const base = toNoonTZDate(date);
17496 const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn;
17497 const endDow = (weekStartsOnValue + 6) % 7;
17498 const diff = (endDow - base.getDay() + 7) % 7;
17499 base.setDate(base.getDate() + diff);
17500 return base;
17501 },
17502 endOfISOWeek: (date) => {
17503 const base = toNoonTZDate(date);
17504 const diff = (7 - base.getDay()) % 7;
17505 base.setDate(base.getDate() + diff);
17506 return base;
17507 },
17508 endOfMonth: (date) => {
17509 const base = toNoonTZDate(date);
17510 base.setMonth(base.getMonth() + 1, 0);
17511 return base;
17512 },
17513 endOfYear: (date) => {
17514 const base = toNoonTZDate(date);
17515 base.setMonth(11, 31);
17516 return base;
17517 },
17518 eachMonthOfInterval: (interval) => {
17519 const start = toNoonTZDate(interval.start);
17520 const end = toNoonTZDate(interval.end);
17521 const result = [];
17522 const cursor = new TZDate(start.getFullYear(), start.getMonth(), 1, 12, 0, 0, timeZone);
17523 const endKey = end.getFullYear() * 12 + end.getMonth();
17524 while (cursor.getFullYear() * 12 + cursor.getMonth() <= endKey) {
17525 result.push(new TZDate(cursor, timeZone));
17526 cursor.setMonth(cursor.getMonth() + 1, 1);
17527 }
17528 return result;
17529 },
17530 // Normalize to noon once before arithmetic (avoid DST/midnight edge cases),
17531 // mutate the same TZDate, and return it.
17532 addDays: (date, amount) => {
17533 const base = toNoonTZDate(date);
17534 base.setDate(base.getDate() + amount);
17535 return base;
17536 },
17537 addWeeks: (date, amount) => {
17538 const base = toNoonTZDate(date);
17539 base.setDate(base.getDate() + amount * 7);
17540 return base;
17541 },
17542 addMonths: (date, amount) => {
17543 const base = toNoonTZDate(date);
17544 base.setMonth(base.getMonth() + amount);
17545 return base;
17546 },
17547 addYears: (date, amount) => {
17548 const base = toNoonTZDate(date);
17549 base.setFullYear(base.getFullYear() + amount);
17550 return base;
17551 },
17552 eachYearOfInterval: (interval) => {
17553 const start = toNoonTZDate(interval.start);
17554 const end = toNoonTZDate(interval.end);
17555 const years = [];
17556 const cursor = new TZDate(start.getFullYear(), 0, 1, 12, 0, 0, timeZone);
17557 while (cursor.getFullYear() <= end.getFullYear()) {
17558 years.push(new TZDate(cursor, timeZone));
17559 cursor.setFullYear(cursor.getFullYear() + 1, 0, 1);
17560 }
17561 return years;
17562 },
17563 getWeek: (date, options2) => {
17564 const base = toCalendarDate2(date);
17565 return getWeek(base, {
17566 weekStartsOn: options2?.weekStartsOn ?? fallbackWeekStartsOn,
17567 firstWeekContainsDate: options2?.firstWeekContainsDate ?? locale?.options?.firstWeekContainsDate ?? 1
17568 });
17569 },
17570 getISOWeek: (date) => {
17571 const base = toCalendarDate2(date);
17572 return getISOWeek(base);
17573 },
17574 differenceInCalendarDays: (dateLeft, dateRight) => {
17575 const left = toCalendarDate2(dateLeft);
17576 const right = toCalendarDate2(dateRight);
17577 return differenceInCalendarDays(left, right);
17578 },
17579 differenceInCalendarMonths: (dateLeft, dateRight) => {
17580 const left = toCalendarDate2(dateLeft);
17581 const right = toCalendarDate2(dateRight);
17582 return differenceInCalendarMonths(left, right);
17583 }
17584 };
17585 }
17586
17587 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useAnimation.js
17588 var import_react32 = __toESM(require_react(), 1);
17589 var asHtmlElement = (element) => {
17590 if (element instanceof HTMLElement)
17591 return element;
17592 return null;
17593 };
17594 var queryMonthEls = (element) => [
17595 ...element.querySelectorAll("[data-animated-month]") ?? []
17596 ];
17597 var queryMonthEl = (element) => asHtmlElement(element.querySelector("[data-animated-month]"));
17598 var queryCaptionEl = (element) => asHtmlElement(element.querySelector("[data-animated-caption]"));
17599 var queryWeeksEl = (element) => asHtmlElement(element.querySelector("[data-animated-weeks]"));
17600 var queryNavEl = (element) => asHtmlElement(element.querySelector("[data-animated-nav]"));
17601 var queryWeekdaysEl = (element) => asHtmlElement(element.querySelector("[data-animated-weekdays]"));
17602 function useAnimation(rootElRef, enabled, { classNames, months, focused, dateLib }) {
17603 const previousRootElSnapshotRef = (0, import_react32.useRef)(null);
17604 const previousMonthsRef = (0, import_react32.useRef)(months);
17605 const animatingRef = (0, import_react32.useRef)(false);
17606 (0, import_react32.useLayoutEffect)(() => {
17607 const previousMonths = previousMonthsRef.current;
17608 previousMonthsRef.current = months;
17609 if (!enabled || !rootElRef.current || // safety check because the ref can be set to anything by consumers
17610 !(rootElRef.current instanceof HTMLElement) || // validation required for the animation to work as expected
17611 months.length === 0 || previousMonths.length === 0 || months.length !== previousMonths.length) {
17612 return;
17613 }
17614 const isSameMonth2 = dateLib.isSameMonth(months[0].date, previousMonths[0].date);
17615 const isAfterPreviousMonth = dateLib.isAfter(months[0].date, previousMonths[0].date);
17616 const captionAnimationClass = isAfterPreviousMonth ? classNames[Animation.caption_after_enter] : classNames[Animation.caption_before_enter];
17617 const weeksAnimationClass = isAfterPreviousMonth ? classNames[Animation.weeks_after_enter] : classNames[Animation.weeks_before_enter];
17618 const previousRootElSnapshot = previousRootElSnapshotRef.current;
17619 const rootElSnapshot = rootElRef.current.cloneNode(true);
17620 if (rootElSnapshot instanceof HTMLElement) {
17621 const currentMonthElsSnapshot = queryMonthEls(rootElSnapshot);
17622 currentMonthElsSnapshot.forEach((currentMonthElSnapshot) => {
17623 if (!(currentMonthElSnapshot instanceof HTMLElement))
17624 return;
17625 const previousMonthElSnapshot = queryMonthEl(currentMonthElSnapshot);
17626 if (previousMonthElSnapshot && currentMonthElSnapshot.contains(previousMonthElSnapshot)) {
17627 currentMonthElSnapshot.removeChild(previousMonthElSnapshot);
17628 }
17629 const captionEl = queryCaptionEl(currentMonthElSnapshot);
17630 if (captionEl) {
17631 captionEl.classList.remove(captionAnimationClass);
17632 }
17633 const weeksEl = queryWeeksEl(currentMonthElSnapshot);
17634 if (weeksEl) {
17635 weeksEl.classList.remove(weeksAnimationClass);
17636 }
17637 });
17638 previousRootElSnapshotRef.current = rootElSnapshot;
17639 } else {
17640 previousRootElSnapshotRef.current = null;
17641 }
17642 if (animatingRef.current || isSameMonth2 || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y
17643 focused) {
17644 return;
17645 }
17646 const previousMonthEls = previousRootElSnapshot instanceof HTMLElement ? queryMonthEls(previousRootElSnapshot) : [];
17647 const currentMonthEls = queryMonthEls(rootElRef.current);
17648 if (currentMonthEls?.every((el) => el instanceof HTMLElement) && previousMonthEls?.every((el) => el instanceof HTMLElement)) {
17649 animatingRef.current = true;
17650 const cleanUpFunctions = [];
17651 rootElRef.current.style.isolation = "isolate";
17652 const navEl = queryNavEl(rootElRef.current);
17653 if (navEl) {
17654 navEl.style.zIndex = "1";
17655 }
17656 currentMonthEls.forEach((currentMonthEl, index2) => {
17657 const previousMonthEl = previousMonthEls[index2];
17658 if (!previousMonthEl) {
17659 return;
17660 }
17661 currentMonthEl.style.position = "relative";
17662 currentMonthEl.style.overflow = "hidden";
17663 const captionEl = queryCaptionEl(currentMonthEl);
17664 if (captionEl) {
17665 captionEl.classList.add(captionAnimationClass);
17666 }
17667 const weeksEl = queryWeeksEl(currentMonthEl);
17668 if (weeksEl) {
17669 weeksEl.classList.add(weeksAnimationClass);
17670 }
17671 const cleanUp = () => {
17672 animatingRef.current = false;
17673 if (rootElRef.current) {
17674 rootElRef.current.style.isolation = "";
17675 }
17676 if (navEl) {
17677 navEl.style.zIndex = "";
17678 }
17679 if (captionEl) {
17680 captionEl.classList.remove(captionAnimationClass);
17681 }
17682 if (weeksEl) {
17683 weeksEl.classList.remove(weeksAnimationClass);
17684 }
17685 currentMonthEl.style.position = "";
17686 currentMonthEl.style.overflow = "";
17687 if (currentMonthEl.contains(previousMonthEl)) {
17688 currentMonthEl.removeChild(previousMonthEl);
17689 }
17690 };
17691 cleanUpFunctions.push(cleanUp);
17692 previousMonthEl.style.pointerEvents = "none";
17693 previousMonthEl.style.position = "absolute";
17694 previousMonthEl.style.overflow = "hidden";
17695 previousMonthEl.setAttribute("aria-hidden", "true");
17696 const previousWeekdaysEl = queryWeekdaysEl(previousMonthEl);
17697 if (previousWeekdaysEl) {
17698 previousWeekdaysEl.style.opacity = "0";
17699 }
17700 const previousCaptionEl = queryCaptionEl(previousMonthEl);
17701 if (previousCaptionEl) {
17702 previousCaptionEl.classList.add(isAfterPreviousMonth ? classNames[Animation.caption_before_exit] : classNames[Animation.caption_after_exit]);
17703 previousCaptionEl.addEventListener("animationend", cleanUp);
17704 }
17705 const previousWeeksEl = queryWeeksEl(previousMonthEl);
17706 if (previousWeeksEl) {
17707 previousWeeksEl.classList.add(isAfterPreviousMonth ? classNames[Animation.weeks_before_exit] : classNames[Animation.weeks_after_exit]);
17708 }
17709 currentMonthEl.insertBefore(previousMonthEl, currentMonthEl.firstChild);
17710 });
17711 }
17712 });
17713 }
17714
17715 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js
17716 var import_react34 = __toESM(require_react(), 1);
17717
17718 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDates.js
17719 function getDates(displayMonths, maxDate, props, dateLib) {
17720 const firstMonth = displayMonths[0];
17721 const lastMonth = displayMonths[displayMonths.length - 1];
17722 const { ISOWeek, fixedWeeks, broadcastCalendar } = props ?? {};
17723 const { addDays: addDays2, differenceInCalendarDays: differenceInCalendarDays2, differenceInCalendarMonths: differenceInCalendarMonths2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, isAfter: isAfter2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
17724 const startWeekFirstDate = broadcastCalendar ? startOfBroadcastWeek2(firstMonth, dateLib) : ISOWeek ? startOfISOWeek2(firstMonth) : startOfWeek2(firstMonth);
17725 const displayMonthsWeekEnd = broadcastCalendar ? endOfBroadcastWeek2(lastMonth) : ISOWeek ? endOfISOWeek2(endOfMonth2(lastMonth)) : endOfWeek2(endOfMonth2(lastMonth));
17726 const constraintWeekEnd = maxDate && (broadcastCalendar ? endOfBroadcastWeek2(maxDate) : ISOWeek ? endOfISOWeek2(maxDate) : endOfWeek2(maxDate));
17727 const gridEndDate = constraintWeekEnd && isAfter2(displayMonthsWeekEnd, constraintWeekEnd) ? constraintWeekEnd : displayMonthsWeekEnd;
17728 const nOfDays = differenceInCalendarDays2(gridEndDate, startWeekFirstDate);
17729 const nOfMonths = differenceInCalendarMonths2(lastMonth, firstMonth) + 1;
17730 const dates = [];
17731 for (let i = 0; i <= nOfDays; i++) {
17732 const date = addDays2(startWeekFirstDate, i);
17733 dates.push(date);
17734 }
17735 const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42;
17736 const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
17737 if (fixedWeeks && dates.length < extraDates) {
17738 const daysToAdd = extraDates - dates.length;
17739 for (let i = 0; i < daysToAdd; i++) {
17740 const date = addDays2(dates[dates.length - 1], 1);
17741 dates.push(date);
17742 }
17743 }
17744 return dates;
17745 }
17746
17747 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDays.js
17748 function getDays(calendarMonths) {
17749 const initialDays = [];
17750 return calendarMonths.reduce((days, month) => {
17751 const weekDays = month.weeks.reduce((weekDays2, week) => {
17752 return weekDays2.concat(week.days.slice());
17753 }, initialDays.slice());
17754 return days.concat(weekDays.slice());
17755 }, initialDays.slice());
17756 }
17757
17758 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js
17759 function getDisplayMonths(firstDisplayedMonth, calendarEndMonth, props, dateLib) {
17760 const { numberOfMonths = 1 } = props;
17761 const months = [];
17762 for (let i = 0; i < numberOfMonths; i++) {
17763 const month = dateLib.addMonths(firstDisplayedMonth, i);
17764 if (calendarEndMonth && month > calendarEndMonth) {
17765 break;
17766 }
17767 months.push(month);
17768 }
17769 return months;
17770 }
17771
17772 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js
17773 function getInitialMonth(props, navStart, navEnd, dateLib) {
17774 const { month, defaultMonth, today = dateLib.today(), numberOfMonths = 1 } = props;
17775 let initialMonth = month || defaultMonth || today;
17776 const { differenceInCalendarMonths: differenceInCalendarMonths2, addMonths: addMonths2, startOfMonth: startOfMonth2 } = dateLib;
17777 if (navEnd && differenceInCalendarMonths2(navEnd, initialMonth) < numberOfMonths - 1) {
17778 const offset4 = -1 * (numberOfMonths - 1);
17779 initialMonth = addMonths2(navEnd, offset4);
17780 }
17781 if (navStart && differenceInCalendarMonths2(initialMonth, navStart) < 0) {
17782 initialMonth = navStart;
17783 }
17784 return startOfMonth2(initialMonth);
17785 }
17786
17787 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonths.js
17788 function getMonths(displayMonths, dates, props, dateLib) {
17789 const { addDays: addDays2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, getISOWeek: getISOWeek2, getWeek: getWeek2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
17790 const dayPickerMonths = displayMonths.reduce((months, month) => {
17791 const firstDateOfFirstWeek = props.broadcastCalendar ? startOfBroadcastWeek2(month, dateLib) : props.ISOWeek ? startOfISOWeek2(month) : startOfWeek2(month);
17792 const lastDateOfLastWeek = props.broadcastCalendar ? endOfBroadcastWeek2(month) : props.ISOWeek ? endOfISOWeek2(endOfMonth2(month)) : endOfWeek2(endOfMonth2(month));
17793 const monthDates = dates.filter((date) => {
17794 return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
17795 });
17796 const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42;
17797 if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
17798 const extraDates = dates.filter((date) => {
17799 const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length;
17800 return date > lastDateOfLastWeek && date <= addDays2(lastDateOfLastWeek, daysToAdd);
17801 });
17802 monthDates.push(...extraDates);
17803 }
17804 const weeks = monthDates.reduce((weeks2, date) => {
17805 const weekNumber = props.ISOWeek ? getISOWeek2(date) : getWeek2(date);
17806 const week = weeks2.find((week2) => week2.weekNumber === weekNumber);
17807 const day = new CalendarDay(date, month, dateLib);
17808 if (!week) {
17809 weeks2.push(new CalendarWeek(weekNumber, [day]));
17810 } else {
17811 week.days.push(day);
17812 }
17813 return weeks2;
17814 }, []);
17815 const dayPickerMonth = new CalendarMonth(month, weeks);
17816 months.push(dayPickerMonth);
17817 return months;
17818 }, []);
17819 if (!props.reverseMonths) {
17820 return dayPickerMonths;
17821 } else {
17822 return dayPickerMonths.reverse();
17823 }
17824 }
17825
17826 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js
17827 function getNavMonths(props, dateLib) {
17828 let { startMonth, endMonth } = props;
17829 const { startOfYear: startOfYear2, startOfDay: startOfDay2, startOfMonth: startOfMonth2, endOfMonth: endOfMonth2, addYears: addYears2, endOfYear: endOfYear2, today } = dateLib;
17830 const hasYearDropdown = props.captionLayout === "dropdown" || props.captionLayout === "dropdown-years";
17831 if (startMonth) {
17832 startMonth = startOfMonth2(startMonth);
17833 } else if (!startMonth && hasYearDropdown) {
17834 startMonth = startOfYear2(addYears2(props.today ?? today(), -100));
17835 }
17836 if (endMonth) {
17837 endMonth = endOfMonth2(endMonth);
17838 } else if (!endMonth && hasYearDropdown) {
17839 endMonth = endOfYear2(props.today ?? today());
17840 }
17841 return [
17842 startMonth ? startOfDay2(startMonth) : startMonth,
17843 endMonth ? startOfDay2(endMonth) : endMonth
17844 ];
17845 }
17846
17847 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js
17848 function getNextMonth(firstDisplayedMonth, calendarEndMonth, options, dateLib) {
17849 if (options.disableNavigation) {
17850 return void 0;
17851 }
17852 const { pagedNavigation, numberOfMonths = 1 } = options;
17853 const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib;
17854 const offset4 = pagedNavigation ? numberOfMonths : 1;
17855 const month = startOfMonth2(firstDisplayedMonth);
17856 if (!calendarEndMonth) {
17857 return addMonths2(month, offset4);
17858 }
17859 const monthsDiff = differenceInCalendarMonths2(calendarEndMonth, firstDisplayedMonth);
17860 if (monthsDiff < numberOfMonths) {
17861 return void 0;
17862 }
17863 return addMonths2(month, offset4);
17864 }
17865
17866 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js
17867 function getPreviousMonth(firstDisplayedMonth, calendarStartMonth, options, dateLib) {
17868 if (options.disableNavigation) {
17869 return void 0;
17870 }
17871 const { pagedNavigation, numberOfMonths } = options;
17872 const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib;
17873 const offset4 = pagedNavigation ? numberOfMonths ?? 1 : 1;
17874 const month = startOfMonth2(firstDisplayedMonth);
17875 if (!calendarStartMonth) {
17876 return addMonths2(month, -offset4);
17877 }
17878 const monthsDiff = differenceInCalendarMonths2(month, calendarStartMonth);
17879 if (monthsDiff <= 0) {
17880 return void 0;
17881 }
17882 return addMonths2(month, -offset4);
17883 }
17884
17885 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js
17886 function getWeeks(months) {
17887 const initialWeeks = [];
17888 return months.reduce((weeks, month) => {
17889 return weeks.concat(month.weeks.slice());
17890 }, initialWeeks.slice());
17891 }
17892
17893 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js
17894 var import_react33 = __toESM(require_react(), 1);
17895 function useControlledValue(defaultValue, controlledValue) {
17896 const [uncontrolledValue, setValue] = (0, import_react33.useState)(defaultValue);
17897 const value = controlledValue === void 0 ? uncontrolledValue : controlledValue;
17898 return [value, setValue];
17899 }
17900
17901 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js
17902 function useCalendar(props, dateLib) {
17903 const [navStart, navEnd] = getNavMonths(props, dateLib);
17904 const { startOfMonth: startOfMonth2, endOfMonth: endOfMonth2 } = dateLib;
17905 const initialMonth = getInitialMonth(props, navStart, navEnd, dateLib);
17906 const [firstMonth, setFirstMonth] = useControlledValue(
17907 initialMonth,
17908 // initialMonth is always computed from props.month if provided
17909 props.month ? initialMonth : void 0
17910 );
17911 (0, import_react34.useEffect)(() => {
17912 const newInitialMonth = getInitialMonth(props, navStart, navEnd, dateLib);
17913 setFirstMonth(newInitialMonth);
17914 }, [props.timeZone]);
17915 const { months, weeks, days, previousMonth, nextMonth } = (0, import_react34.useMemo)(() => {
17916 const displayMonths = getDisplayMonths(firstMonth, navEnd, { numberOfMonths: props.numberOfMonths }, dateLib);
17917 const dates = getDates(displayMonths, props.endMonth ? endOfMonth2(props.endMonth) : void 0, {
17918 ISOWeek: props.ISOWeek,
17919 fixedWeeks: props.fixedWeeks,
17920 broadcastCalendar: props.broadcastCalendar
17921 }, dateLib);
17922 const months2 = getMonths(displayMonths, dates, {
17923 broadcastCalendar: props.broadcastCalendar,
17924 fixedWeeks: props.fixedWeeks,
17925 ISOWeek: props.ISOWeek,
17926 reverseMonths: props.reverseMonths
17927 }, dateLib);
17928 const weeks2 = getWeeks(months2);
17929 const days2 = getDays(months2);
17930 const previousMonth2 = getPreviousMonth(firstMonth, navStart, props, dateLib);
17931 const nextMonth2 = getNextMonth(firstMonth, navEnd, props, dateLib);
17932 return {
17933 months: months2,
17934 weeks: weeks2,
17935 days: days2,
17936 previousMonth: previousMonth2,
17937 nextMonth: nextMonth2
17938 };
17939 }, [
17940 dateLib,
17941 firstMonth.getTime(),
17942 navEnd?.getTime(),
17943 navStart?.getTime(),
17944 props.disableNavigation,
17945 props.broadcastCalendar,
17946 props.endMonth?.getTime(),
17947 props.fixedWeeks,
17948 props.ISOWeek,
17949 props.numberOfMonths,
17950 props.pagedNavigation,
17951 props.reverseMonths
17952 ]);
17953 const { disableNavigation, onMonthChange } = props;
17954 const isDayInCalendar = (day) => weeks.some((week) => week.days.some((d) => d.isEqualTo(day)));
17955 const goToMonth = (date) => {
17956 if (disableNavigation) {
17957 return;
17958 }
17959 let newMonth = startOfMonth2(date);
17960 if (navStart && newMonth < startOfMonth2(navStart)) {
17961 newMonth = startOfMonth2(navStart);
17962 }
17963 if (navEnd && newMonth > startOfMonth2(navEnd)) {
17964 newMonth = startOfMonth2(navEnd);
17965 }
17966 setFirstMonth(newMonth);
17967 onMonthChange?.(newMonth);
17968 };
17969 const goToDay = (day) => {
17970 if (isDayInCalendar(day)) {
17971 return;
17972 }
17973 goToMonth(day.date);
17974 };
17975 const calendar = {
17976 months,
17977 weeks,
17978 days,
17979 navStart,
17980 navEnd,
17981 previousMonth,
17982 nextMonth,
17983 goToMonth,
17984 goToDay
17985 };
17986 return calendar;
17987 }
17988
17989 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js
17990 var import_react35 = __toESM(require_react(), 1);
17991
17992 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js
17993 var FocusTargetPriority;
17994 (function(FocusTargetPriority2) {
17995 FocusTargetPriority2[FocusTargetPriority2["Today"] = 0] = "Today";
17996 FocusTargetPriority2[FocusTargetPriority2["Selected"] = 1] = "Selected";
17997 FocusTargetPriority2[FocusTargetPriority2["LastFocused"] = 2] = "LastFocused";
17998 FocusTargetPriority2[FocusTargetPriority2["FocusedModifier"] = 3] = "FocusedModifier";
17999 })(FocusTargetPriority || (FocusTargetPriority = {}));
18000 function isFocusableDay(modifiers) {
18001 return !modifiers[DayFlag.disabled] && !modifiers[DayFlag.hidden] && !modifiers[DayFlag.outside];
18002 }
18003 function calculateFocusTarget(days, getModifiers, isSelected, lastFocused) {
18004 let focusTarget;
18005 let foundFocusTargetPriority = -1;
18006 for (const day of days) {
18007 const modifiers = getModifiers(day);
18008 if (isFocusableDay(modifiers)) {
18009 if (modifiers[DayFlag.focused] && foundFocusTargetPriority < FocusTargetPriority.FocusedModifier) {
18010 focusTarget = day;
18011 foundFocusTargetPriority = FocusTargetPriority.FocusedModifier;
18012 } else if (lastFocused?.isEqualTo(day) && foundFocusTargetPriority < FocusTargetPriority.LastFocused) {
18013 focusTarget = day;
18014 foundFocusTargetPriority = FocusTargetPriority.LastFocused;
18015 } else if (isSelected(day.date) && foundFocusTargetPriority < FocusTargetPriority.Selected) {
18016 focusTarget = day;
18017 foundFocusTargetPriority = FocusTargetPriority.Selected;
18018 } else if (modifiers[DayFlag.today] && foundFocusTargetPriority < FocusTargetPriority.Today) {
18019 focusTarget = day;
18020 foundFocusTargetPriority = FocusTargetPriority.Today;
18021 }
18022 }
18023 }
18024 if (!focusTarget) {
18025 focusTarget = days.find((day) => isFocusableDay(getModifiers(day)));
18026 }
18027 return focusTarget;
18028 }
18029
18030 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js
18031 function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
18032 const { ISOWeek, broadcastCalendar } = props;
18033 const { addDays: addDays2, addMonths: addMonths2, addWeeks: addWeeks2, addYears: addYears2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfWeek: endOfWeek2, max: max3, min: min3, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib;
18034 const moveFns = {
18035 day: addDays2,
18036 week: addWeeks2,
18037 month: addMonths2,
18038 year: addYears2,
18039 startOfWeek: (date) => broadcastCalendar ? startOfBroadcastWeek2(date, dateLib) : ISOWeek ? startOfISOWeek2(date) : startOfWeek2(date),
18040 endOfWeek: (date) => broadcastCalendar ? endOfBroadcastWeek2(date) : ISOWeek ? endOfISOWeek2(date) : endOfWeek2(date)
18041 };
18042 let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
18043 if (moveDir === "before" && navStart) {
18044 focusableDate = max3([navStart, focusableDate]);
18045 } else if (moveDir === "after" && navEnd) {
18046 focusableDate = min3([navEnd, focusableDate]);
18047 }
18048 return focusableDate;
18049 }
18050
18051 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js
18052 function getNextFocus(moveBy, moveDir, refDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt = 0) {
18053 if (attempt > 365) {
18054 return void 0;
18055 }
18056 const focusableDate = getFocusableDate(moveBy, moveDir, refDay.date, calendarStartMonth, calendarEndMonth, props, dateLib);
18057 const isDisabled = Boolean(props.disabled && dateMatchModifiers(focusableDate, props.disabled, dateLib));
18058 const isHidden = Boolean(props.hidden && dateMatchModifiers(focusableDate, props.hidden, dateLib));
18059 const targetMonth = focusableDate;
18060 const focusDay = new CalendarDay(focusableDate, targetMonth, dateLib);
18061 if (!isDisabled && !isHidden) {
18062 return focusDay;
18063 }
18064 return getNextFocus(moveBy, moveDir, focusDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt + 1);
18065 }
18066
18067 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js
18068 function useFocus2(props, calendar, getModifiers, isSelected, dateLib) {
18069 const { autoFocus } = props;
18070 const [lastFocused, setLastFocused] = (0, import_react35.useState)();
18071 const focusTarget = calculateFocusTarget(calendar.days, getModifiers, isSelected || (() => false), lastFocused);
18072 const [focusedDay, setFocused] = (0, import_react35.useState)(autoFocus ? focusTarget : void 0);
18073 const blur = () => {
18074 setLastFocused(focusedDay);
18075 setFocused(void 0);
18076 };
18077 const moveFocus = (moveBy, moveDir) => {
18078 if (!focusedDay)
18079 return;
18080 const nextFocus = getNextFocus(moveBy, moveDir, focusedDay, calendar.navStart, calendar.navEnd, props, dateLib);
18081 if (!nextFocus)
18082 return;
18083 if (props.disableNavigation) {
18084 const isNextInCalendar = calendar.days.some((day) => day.isEqualTo(nextFocus));
18085 if (!isNextInCalendar) {
18086 return;
18087 }
18088 }
18089 calendar.goToDay(nextFocus);
18090 setFocused(nextFocus);
18091 };
18092 const isFocusTarget = (day) => {
18093 return Boolean(focusTarget?.isEqualTo(day));
18094 };
18095 const useFocus3 = {
18096 isFocusTarget,
18097 setFocused,
18098 focused: focusedDay,
18099 blur,
18100 moveFocus
18101 };
18102 return useFocus3;
18103 }
18104
18105 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useMulti.js
18106 function useMulti(props, dateLib) {
18107 const { selected: initiallySelected, required, onSelect } = props;
18108 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
18109 const selected = !onSelect ? internallySelected : initiallySelected;
18110 const { isSameDay: isSameDay2 } = dateLib;
18111 const isSelected = (date) => {
18112 return selected?.some((d) => isSameDay2(d, date)) ?? false;
18113 };
18114 const { min: min3, max: max3 } = props;
18115 const select = (triggerDate, modifiers, e) => {
18116 let newDates = [...selected ?? []];
18117 if (isSelected(triggerDate)) {
18118 if (selected?.length === min3) {
18119 return;
18120 }
18121 if (required && selected?.length === 1) {
18122 return;
18123 }
18124 newDates = selected?.filter((d) => !isSameDay2(d, triggerDate));
18125 } else {
18126 if (selected?.length === max3) {
18127 newDates = [triggerDate];
18128 } else {
18129 newDates = [...newDates, triggerDate];
18130 }
18131 }
18132 if (!onSelect) {
18133 setSelected(newDates);
18134 }
18135 onSelect?.(newDates, triggerDate, modifiers, e);
18136 return newDates;
18137 };
18138 return {
18139 selected,
18140 select,
18141 isSelected
18142 };
18143 }
18144
18145 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/addToRange.js
18146 function addToRange(date, initialRange, min3 = 0, max3 = 0, required = false, dateLib = defaultDateLib) {
18147 const { from, to } = initialRange || {};
18148 const { isSameDay: isSameDay2, isAfter: isAfter2, isBefore: isBefore2 } = dateLib;
18149 let range;
18150 if (!from && !to) {
18151 range = { from: date, to: min3 > 0 ? void 0 : date };
18152 } else if (from && !to) {
18153 if (isSameDay2(from, date)) {
18154 if (min3 === 0) {
18155 range = { from, to: date };
18156 } else if (required) {
18157 range = { from, to: void 0 };
18158 } else {
18159 range = void 0;
18160 }
18161 } else if (isBefore2(date, from)) {
18162 range = { from: date, to: from };
18163 } else {
18164 range = { from, to: date };
18165 }
18166 } else if (from && to) {
18167 if (isSameDay2(from, date) && isSameDay2(to, date)) {
18168 if (required) {
18169 range = { from, to };
18170 } else {
18171 range = void 0;
18172 }
18173 } else if (isSameDay2(from, date)) {
18174 range = { from, to: min3 > 0 ? void 0 : date };
18175 } else if (isSameDay2(to, date)) {
18176 range = { from: date, to: min3 > 0 ? void 0 : date };
18177 } else if (isBefore2(date, from)) {
18178 range = { from: date, to };
18179 } else if (isAfter2(date, from)) {
18180 range = { from, to: date };
18181 } else if (isAfter2(date, to)) {
18182 range = { from, to: date };
18183 } else {
18184 throw new Error("Invalid range");
18185 }
18186 }
18187 if (range?.from && range?.to) {
18188 const diff = dateLib.differenceInCalendarDays(range.to, range.from);
18189 if (max3 > 0 && diff > max3) {
18190 range = { from: date, to: void 0 };
18191 } else if (min3 > 1 && diff < min3) {
18192 range = { from: date, to: void 0 };
18193 }
18194 }
18195 return range;
18196 }
18197
18198 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js
18199 function rangeContainsDayOfWeek(range, dayOfWeek, dateLib = defaultDateLib) {
18200 const dayOfWeekArr = !Array.isArray(dayOfWeek) ? [dayOfWeek] : dayOfWeek;
18201 let date = range.from;
18202 const totalDays = dateLib.differenceInCalendarDays(range.to, range.from);
18203 const totalDaysLimit = Math.min(totalDays, 6);
18204 for (let i = 0; i <= totalDaysLimit; i++) {
18205 if (dayOfWeekArr.includes(date.getDay())) {
18206 return true;
18207 }
18208 date = dateLib.addDays(date, 1);
18209 }
18210 return false;
18211 }
18212
18213 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js
18214 function rangeOverlaps(rangeLeft, rangeRight, dateLib = defaultDateLib) {
18215 return rangeIncludesDate(rangeLeft, rangeRight.from, false, dateLib) || rangeIncludesDate(rangeLeft, rangeRight.to, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.from, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.to, false, dateLib);
18216 }
18217
18218 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js
18219 function rangeContainsModifiers(range, modifiers, dateLib = defaultDateLib) {
18220 const matchers = Array.isArray(modifiers) ? modifiers : [modifiers];
18221 const nonFunctionMatchers = matchers.filter((matcher) => typeof matcher !== "function");
18222 const nonFunctionMatchersResult = nonFunctionMatchers.some((matcher) => {
18223 if (typeof matcher === "boolean")
18224 return matcher;
18225 if (dateLib.isDate(matcher)) {
18226 return rangeIncludesDate(range, matcher, false, dateLib);
18227 }
18228 if (isDatesArray(matcher, dateLib)) {
18229 return matcher.some((date) => rangeIncludesDate(range, date, false, dateLib));
18230 }
18231 if (isDateRange(matcher)) {
18232 if (matcher.from && matcher.to) {
18233 return rangeOverlaps(range, { from: matcher.from, to: matcher.to }, dateLib);
18234 }
18235 return false;
18236 }
18237 if (isDayOfWeekType(matcher)) {
18238 return rangeContainsDayOfWeek(range, matcher.dayOfWeek, dateLib);
18239 }
18240 if (isDateInterval(matcher)) {
18241 const isClosedInterval = dateLib.isAfter(matcher.before, matcher.after);
18242 if (isClosedInterval) {
18243 return rangeOverlaps(range, {
18244 from: dateLib.addDays(matcher.after, 1),
18245 to: dateLib.addDays(matcher.before, -1)
18246 }, dateLib);
18247 }
18248 return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib);
18249 }
18250 if (isDateAfterType(matcher) || isDateBeforeType(matcher)) {
18251 return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib);
18252 }
18253 return false;
18254 });
18255 if (nonFunctionMatchersResult) {
18256 return true;
18257 }
18258 const functionMatchers = matchers.filter((matcher) => typeof matcher === "function");
18259 if (functionMatchers.length) {
18260 let date = range.from;
18261 const totalDays = dateLib.differenceInCalendarDays(range.to, range.from);
18262 for (let i = 0; i <= totalDays; i++) {
18263 if (functionMatchers.some((matcher) => matcher(date))) {
18264 return true;
18265 }
18266 date = dateLib.addDays(date, 1);
18267 }
18268 }
18269 return false;
18270 }
18271
18272 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useRange.js
18273 function useRange(props, dateLib) {
18274 const { disabled: disabled2, excludeDisabled, resetOnSelect, selected: initiallySelected, required, onSelect } = props;
18275 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
18276 const selected = !onSelect ? internallySelected : initiallySelected;
18277 const isSelected = (date) => selected && rangeIncludesDate(selected, date, false, dateLib);
18278 const select = (triggerDate, modifiers, e) => {
18279 const { min: min3, max: max3 } = props;
18280 let newRange;
18281 if (triggerDate) {
18282 const selectedFrom = selected?.from;
18283 const selectedTo = selected?.to;
18284 const hasFullRange = !!selectedFrom && !!selectedTo;
18285 const isClickingSingleDayRange = !!selectedFrom && !!selectedTo && dateLib.isSameDay(selectedFrom, selectedTo) && dateLib.isSameDay(triggerDate, selectedFrom);
18286 if (resetOnSelect && (hasFullRange || !selected?.from)) {
18287 if (!required && isClickingSingleDayRange) {
18288 newRange = void 0;
18289 } else {
18290 newRange = { from: triggerDate, to: void 0 };
18291 }
18292 } else {
18293 newRange = addToRange(triggerDate, selected, min3, max3, required, dateLib);
18294 }
18295 }
18296 if (excludeDisabled && disabled2 && newRange?.from && newRange.to) {
18297 if (rangeContainsModifiers({ from: newRange.from, to: newRange.to }, disabled2, dateLib)) {
18298 newRange.from = triggerDate;
18299 newRange.to = void 0;
18300 }
18301 }
18302 if (!onSelect) {
18303 setSelected(newRange);
18304 }
18305 onSelect?.(newRange, triggerDate, modifiers, e);
18306 return newRange;
18307 };
18308 return {
18309 selected,
18310 select,
18311 isSelected
18312 };
18313 }
18314
18315 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useSingle.js
18316 function useSingle(props, dateLib) {
18317 const { selected: initiallySelected, required, onSelect } = props;
18318 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0);
18319 const selected = !onSelect ? internallySelected : initiallySelected;
18320 const { isSameDay: isSameDay2 } = dateLib;
18321 const isSelected = (compareDate) => {
18322 return selected ? isSameDay2(selected, compareDate) : false;
18323 };
18324 const select = (triggerDate, modifiers, e) => {
18325 let newDate = triggerDate;
18326 if (!required && selected && selected && isSameDay2(triggerDate, selected)) {
18327 newDate = void 0;
18328 }
18329 if (!onSelect) {
18330 setSelected(newDate);
18331 }
18332 if (required) {
18333 onSelect?.(newDate, triggerDate, modifiers, e);
18334 } else {
18335 onSelect?.(newDate, triggerDate, modifiers, e);
18336 }
18337 return newDate;
18338 };
18339 return {
18340 selected,
18341 select,
18342 isSelected
18343 };
18344 }
18345
18346 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useSelection.js
18347 function useSelection(props, dateLib) {
18348 const single = useSingle(props, dateLib);
18349 const multi = useMulti(props, dateLib);
18350 const range = useRange(props, dateLib);
18351 switch (props.mode) {
18352 case "single":
18353 return single;
18354 case "multiple":
18355 return multi;
18356 case "range":
18357 return range;
18358 default:
18359 return void 0;
18360 }
18361 }
18362
18363 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js
18364 function toTimeZone(date, timeZone) {
18365 if (date instanceof TZDate && date.timeZone === timeZone) {
18366 return date;
18367 }
18368 return new TZDate(date, timeZone);
18369 }
18370
18371 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js
18372 function toZoneNoon(date, timeZone, noonSafe) {
18373 if (!noonSafe)
18374 return toTimeZone(date, timeZone);
18375 const zoned = toTimeZone(date, timeZone);
18376 const noonZoned = new TZDate(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 12, 0, 0, timeZone);
18377 return new Date(noonZoned.getTime());
18378 }
18379 function convertMatcher(matcher, timeZone, noonSafe) {
18380 if (typeof matcher === "boolean" || typeof matcher === "function") {
18381 return matcher;
18382 }
18383 if (matcher instanceof Date) {
18384 return toZoneNoon(matcher, timeZone, noonSafe);
18385 }
18386 if (Array.isArray(matcher)) {
18387 return matcher.map((value) => value instanceof Date ? toZoneNoon(value, timeZone, noonSafe) : value);
18388 }
18389 if (isDateRange(matcher)) {
18390 return {
18391 ...matcher,
18392 from: matcher.from ? toTimeZone(matcher.from, timeZone) : matcher.from,
18393 to: matcher.to ? toTimeZone(matcher.to, timeZone) : matcher.to
18394 };
18395 }
18396 if (isDateInterval(matcher)) {
18397 return {
18398 before: toZoneNoon(matcher.before, timeZone, noonSafe),
18399 after: toZoneNoon(matcher.after, timeZone, noonSafe)
18400 };
18401 }
18402 if (isDateAfterType(matcher)) {
18403 return {
18404 after: toZoneNoon(matcher.after, timeZone, noonSafe)
18405 };
18406 }
18407 if (isDateBeforeType(matcher)) {
18408 return {
18409 before: toZoneNoon(matcher.before, timeZone, noonSafe)
18410 };
18411 }
18412 return matcher;
18413 }
18414 function convertMatchersToTimeZone(matchers, timeZone, noonSafe) {
18415 if (!matchers) {
18416 return matchers;
18417 }
18418 if (Array.isArray(matchers)) {
18419 return matchers.map((matcher) => convertMatcher(matcher, timeZone, noonSafe));
18420 }
18421 return convertMatcher(matchers, timeZone, noonSafe);
18422 }
18423
18424 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js
18425 function DayPicker(initialProps) {
18426 let props = initialProps;
18427 const timeZone = props.timeZone;
18428 if (timeZone) {
18429 props = {
18430 ...initialProps,
18431 timeZone
18432 };
18433 if (props.today) {
18434 props.today = toTimeZone(props.today, timeZone);
18435 }
18436 if (props.month) {
18437 props.month = toTimeZone(props.month, timeZone);
18438 }
18439 if (props.defaultMonth) {
18440 props.defaultMonth = toTimeZone(props.defaultMonth, timeZone);
18441 }
18442 if (props.startMonth) {
18443 props.startMonth = toTimeZone(props.startMonth, timeZone);
18444 }
18445 if (props.endMonth) {
18446 props.endMonth = toTimeZone(props.endMonth, timeZone);
18447 }
18448 if (props.mode === "single" && props.selected) {
18449 props.selected = toTimeZone(props.selected, timeZone);
18450 } else if (props.mode === "multiple" && props.selected) {
18451 props.selected = props.selected?.map((date) => toTimeZone(date, timeZone));
18452 } else if (props.mode === "range" && props.selected) {
18453 props.selected = {
18454 from: props.selected.from ? toTimeZone(props.selected.from, timeZone) : props.selected.from,
18455 to: props.selected.to ? toTimeZone(props.selected.to, timeZone) : props.selected.to
18456 };
18457 }
18458 if (props.disabled !== void 0) {
18459 props.disabled = convertMatchersToTimeZone(props.disabled, timeZone);
18460 }
18461 if (props.hidden !== void 0) {
18462 props.hidden = convertMatchersToTimeZone(props.hidden, timeZone);
18463 }
18464 if (props.modifiers) {
18465 const nextModifiers = {};
18466 Object.keys(props.modifiers).forEach((key) => {
18467 nextModifiers[key] = convertMatchersToTimeZone(props.modifiers?.[key], timeZone);
18468 });
18469 props.modifiers = nextModifiers;
18470 }
18471 }
18472 const { components, formatters: formatters2, labels, dateLib, locale, classNames } = (0, import_react36.useMemo)(() => {
18473 const locale2 = { ...enUS2, ...props.locale };
18474 const weekStartsOn = props.broadcastCalendar ? 1 : props.weekStartsOn;
18475 const noonOverrides = props.noonSafe && props.timeZone ? createNoonOverrides(props.timeZone, {
18476 weekStartsOn,
18477 locale: locale2
18478 }) : void 0;
18479 const overrides = props.dateLib && noonOverrides ? { ...noonOverrides, ...props.dateLib } : props.dateLib ?? noonOverrides;
18480 const dateLib2 = new DateLib({
18481 locale: locale2,
18482 weekStartsOn,
18483 firstWeekContainsDate: props.firstWeekContainsDate,
18484 useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens,
18485 useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens,
18486 timeZone: props.timeZone,
18487 numerals: props.numerals
18488 }, overrides);
18489 return {
18490 dateLib: dateLib2,
18491 components: getComponents(props.components),
18492 formatters: getFormatters(props.formatters),
18493 labels: getLabels(props.labels, dateLib2.options),
18494 locale: locale2,
18495 classNames: { ...getDefaultClassNames(), ...props.classNames }
18496 };
18497 }, [
18498 props.locale,
18499 props.broadcastCalendar,
18500 props.weekStartsOn,
18501 props.firstWeekContainsDate,
18502 props.useAdditionalWeekYearTokens,
18503 props.useAdditionalDayOfYearTokens,
18504 props.timeZone,
18505 props.numerals,
18506 props.dateLib,
18507 props.noonSafe,
18508 props.components,
18509 props.formatters,
18510 props.labels,
18511 props.classNames
18512 ]);
18513 if (!props.today) {
18514 props = { ...props, today: dateLib.today() };
18515 }
18516 const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles } = props;
18517 const { formatCaption: formatCaption2, formatDay: formatDay2, formatMonthDropdown: formatMonthDropdown2, formatWeekNumber: formatWeekNumber2, formatWeekNumberHeader: formatWeekNumberHeader2, formatWeekdayName: formatWeekdayName2, formatYearDropdown: formatYearDropdown2 } = formatters2;
18518 const calendar = useCalendar(props, dateLib);
18519 const { days, months, navStart, navEnd, previousMonth, nextMonth, goToMonth } = calendar;
18520 const getModifiers = createGetModifiers(days, props, navStart, navEnd, dateLib);
18521 const { isSelected, select, selected: selectedValue } = useSelection(props, dateLib) ?? {};
18522 const { blur, focused, isFocusTarget, moveFocus, setFocused } = useFocus2(props, calendar, getModifiers, isSelected ?? (() => false), dateLib);
18523 const { labelDayButton: labelDayButton2, labelGridcell: labelGridcell2, labelGrid: labelGrid2, labelMonthDropdown: labelMonthDropdown2, labelNav: labelNav2, labelPrevious: labelPrevious2, labelNext: labelNext2, labelWeekday: labelWeekday2, labelWeekNumber: labelWeekNumber2, labelWeekNumberHeader: labelWeekNumberHeader2, labelYearDropdown: labelYearDropdown2 } = labels;
18524 const weekdays = (0, import_react36.useMemo)(() => getWeekdays(dateLib, props.ISOWeek, props.broadcastCalendar, props.today), [dateLib, props.ISOWeek, props.broadcastCalendar, props.today]);
18525 const isInteractive = mode !== void 0 || onDayClick !== void 0;
18526 const handlePreviousClick = (0, import_react36.useCallback)(() => {
18527 if (!previousMonth)
18528 return;
18529 goToMonth(previousMonth);
18530 onPrevClick?.(previousMonth);
18531 }, [previousMonth, goToMonth, onPrevClick]);
18532 const handleNextClick = (0, import_react36.useCallback)(() => {
18533 if (!nextMonth)
18534 return;
18535 goToMonth(nextMonth);
18536 onNextClick?.(nextMonth);
18537 }, [goToMonth, nextMonth, onNextClick]);
18538 const handleDayClick = (0, import_react36.useCallback)((day, m2) => (e) => {
18539 e.preventDefault();
18540 e.stopPropagation();
18541 setFocused(day);
18542 if (m2.disabled) {
18543 return;
18544 }
18545 select?.(day.date, m2, e);
18546 onDayClick?.(day.date, m2, e);
18547 }, [select, onDayClick, setFocused]);
18548 const handleDayFocus = (0, import_react36.useCallback)((day, m2) => (e) => {
18549 setFocused(day);
18550 onDayFocus?.(day.date, m2, e);
18551 }, [onDayFocus, setFocused]);
18552 const handleDayBlur = (0, import_react36.useCallback)((day, m2) => (e) => {
18553 blur();
18554 onDayBlur?.(day.date, m2, e);
18555 }, [blur, onDayBlur]);
18556 const handleDayKeyDown = (0, import_react36.useCallback)((day, modifiers) => (e) => {
18557 const keyMap = {
18558 ArrowLeft: [
18559 e.shiftKey ? "month" : "day",
18560 props.dir === "rtl" ? "after" : "before"
18561 ],
18562 ArrowRight: [
18563 e.shiftKey ? "month" : "day",
18564 props.dir === "rtl" ? "before" : "after"
18565 ],
18566 ArrowDown: [e.shiftKey ? "year" : "week", "after"],
18567 ArrowUp: [e.shiftKey ? "year" : "week", "before"],
18568 PageUp: [e.shiftKey ? "year" : "month", "before"],
18569 PageDown: [e.shiftKey ? "year" : "month", "after"],
18570 Home: ["startOfWeek", "before"],
18571 End: ["endOfWeek", "after"]
18572 };
18573 if (keyMap[e.key]) {
18574 e.preventDefault();
18575 e.stopPropagation();
18576 const [moveBy, moveDir] = keyMap[e.key];
18577 moveFocus(moveBy, moveDir);
18578 }
18579 onDayKeyDown?.(day.date, modifiers, e);
18580 }, [moveFocus, onDayKeyDown, props.dir]);
18581 const handleDayMouseEnter = (0, import_react36.useCallback)((day, modifiers) => (e) => {
18582 onDayMouseEnter?.(day.date, modifiers, e);
18583 }, [onDayMouseEnter]);
18584 const handleDayMouseLeave = (0, import_react36.useCallback)((day, modifiers) => (e) => {
18585 onDayMouseLeave?.(day.date, modifiers, e);
18586 }, [onDayMouseLeave]);
18587 const handleMonthChange = (0, import_react36.useCallback)((date, monthOffset) => (e) => {
18588 const selectedMonth = Number(e.target.value);
18589 const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);
18590 goToMonth(dateLib.addMonths(month, -monthOffset));
18591 }, [dateLib, goToMonth]);
18592 const handleYearChange = (0, import_react36.useCallback)((date, monthOffset) => (e) => {
18593 const selectedYear = Number(e.target.value);
18594 const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);
18595 goToMonth(dateLib.addMonths(month, -monthOffset));
18596 }, [dateLib, goToMonth]);
18597 const { className, style } = (0, import_react36.useMemo)(() => ({
18598 className: [classNames[UI.Root], props.className].filter(Boolean).join(" "),
18599 style: { ...styles?.[UI.Root], ...props.style }
18600 }), [classNames, props.className, props.style, styles]);
18601 const dataAttributes = getDataAttributes(props);
18602 const getDropdownStyle = (dropdown) => {
18603 const dropdownStyle = styles?.[UI.Dropdown];
18604 const specificDropdownStyle = styles?.[dropdown];
18605 if (!dropdownStyle && !specificDropdownStyle) {
18606 return void 0;
18607 }
18608 return {
18609 ...dropdownStyle,
18610 ...specificDropdownStyle
18611 };
18612 };
18613 const rootElRef = (0, import_react36.useRef)(null);
18614 useAnimation(rootElRef, Boolean(props.animate), {
18615 classNames,
18616 months,
18617 focused,
18618 dateLib
18619 });
18620 const contextValue = {
18621 dayPickerProps: props,
18622 selected: selectedValue,
18623 select,
18624 isSelected,
18625 months,
18626 nextMonth,
18627 previousMonth,
18628 goToMonth,
18629 getModifiers,
18630 components,
18631 classNames,
18632 styles,
18633 labels,
18634 formatters: formatters2
18635 };
18636 return import_react36.default.createElement(
18637 dayPickerContext.Provider,
18638 { value: contextValue },
18639 import_react36.default.createElement(
18640 components.Root,
18641 { rootRef: props.animate ? rootElRef : void 0, className, style, dir: props.dir, id: props.id, lang: props.lang ?? locale.code, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], ...dataAttributes },
18642 import_react36.default.createElement(
18643 components.Months,
18644 { className: classNames[UI.Months], style: styles?.[UI.Months] },
18645 !props.hideNavigation && !navLayout && import_react36.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
18646 months.map((calendarMonth, displayIndex) => {
18647 const monthOffset = props.reverseMonths ? months.length - 1 - displayIndex : displayIndex;
18648 return import_react36.default.createElement(
18649 components.Month,
18650 {
18651 "data-animated-month": props.animate ? "true" : void 0,
18652 className: classNames[UI.Month],
18653 style: styles?.[UI.Month],
18654 // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
18655 key: displayIndex,
18656 displayIndex,
18657 calendarMonth
18658 },
18659 navLayout === "around" && !props.hideNavigation && displayIndex === 0 && import_react36.default.createElement(
18660 components.PreviousMonthButton,
18661 { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 },
18662 import_react36.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" })
18663 ),
18664 import_react36.default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : void 0, className: classNames[UI.MonthCaption], style: styles?.[UI.MonthCaption], calendarMonth, displayIndex }, captionLayout?.startsWith("dropdown") ? import_react36.default.createElement(
18665 components.DropdownNav,
18666 { className: classNames[UI.Dropdowns], style: styles?.[UI.Dropdowns] },
18667 (() => {
18668 const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? import_react36.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) }) : import_react36.default.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib));
18669 const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? import_react36.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) }) : import_react36.default.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib));
18670 const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl];
18671 return controls;
18672 })(),
18673 import_react36.default.createElement("span", { role: "status", "aria-live": "polite", style: {
18674 border: 0,
18675 clip: "rect(0 0 0 0)",
18676 height: "1px",
18677 margin: "-1px",
18678 overflow: "hidden",
18679 padding: 0,
18680 position: "absolute",
18681 width: "1px",
18682 whiteSpace: "nowrap",
18683 wordWrap: "normal"
18684 } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))
18685 ) : import_react36.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))),
18686 navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && import_react36.default.createElement(
18687 components.NextMonthButton,
18688 { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 },
18689 import_react36.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" })
18690 ),
18691 displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && import_react36.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }),
18692 import_react36.default.createElement(
18693 components.MonthGrid,
18694 { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid2(calendarMonth.date, dateLib.options, dateLib) || void 0, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] },
18695 !props.hideWeekdays && import_react36.default.createElement(
18696 components.Weekdays,
18697 { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
18698 showWeekNumber && import_react36.default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()),
18699 weekdays.map((weekday) => import_react36.default.createElement(components.Weekday, { "aria-label": labelWeekday2(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName2(weekday, dateLib.options, dateLib)))
18700 ),
18701 import_react36.default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
18702 return import_react36.default.createElement(
18703 components.Week,
18704 { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week },
18705 showWeekNumber && import_react36.default.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, {
18706 locale
18707 }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)),
18708 week.days.map((day) => {
18709 const { date } = day;
18710 const modifiers = getModifiers(day);
18711 modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day));
18712 modifiers[SelectionState.selected] = isSelected?.(date) || modifiers.selected;
18713 if (isDateRange(selectedValue)) {
18714 const { from, to } = selectedValue;
18715 modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
18716 modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
18717 modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib);
18718 }
18719 const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
18720 const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
18721 const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0;
18722 return import_react36.default.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day, modifiers, className: className2.join(" "), style: style2, role: "gridcell", "aria-selected": modifiers.selected || void 0, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : void 0, "data-selected": modifiers.selected || void 0, "data-disabled": modifiers.disabled || void 0, "data-hidden": modifiers.hidden || void 0, "data-outside": day.outside || void 0, "data-focused": modifiers.focused || void 0, "data-today": modifiers.today || void 0 }, !modifiers.hidden && isInteractive ? import_react36.default.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day, modifiers, disabled: !modifiers.focused && modifiers.disabled || void 0, "aria-disabled": modifiers.focused && modifiers.disabled || void 0, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton2(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay2(date, dateLib.options, dateLib)) : !modifiers.hidden && formatDay2(day.date, dateLib.options, dateLib));
18723 })
18724 );
18725 }))
18726 )
18727 );
18728 })
18729 ),
18730 props.footer && import_react36.default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)
18731 )
18732 );
18733 }
18734
18735 // packages/ui/build-module/calendar/calendar.mjs
18736 var import_element29 = __toESM(require_element(), 1);
18737
18738 // packages/ui/build-module/calendar/utils/components.mjs
18739 var import_element25 = __toESM(require_element(), 1);
18740 var import_compose = __toESM(require_compose(), 1);
18741 var import_i18n5 = __toESM(require_i18n(), 1);
18742
18743 // packages/ui/build-module/icon-button/icon-button.mjs
18744 var import_element23 = __toESM(require_element(), 1);
18745 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
18746 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash";
18747 function getRuntime10() {
18748 const globalScope = globalThis;
18749 if (globalScope.__wpStyleRuntime) {
18750 return globalScope.__wpStyleRuntime;
18751 }
18752 globalScope.__wpStyleRuntime = {
18753 documents: /* @__PURE__ */ new Map(),
18754 styles: /* @__PURE__ */ new Map(),
18755 injectedStyles: /* @__PURE__ */ new WeakMap()
18756 };
18757 if (typeof document !== "undefined") {
18758 registerDocument10(document);
18759 }
18760 return globalScope.__wpStyleRuntime;
18761 }
18762 function documentContainsStyleHash10(targetDocument, hash) {
18763 if (!targetDocument.head) {
18764 return false;
18765 }
18766 for (const style of targetDocument.head.querySelectorAll(
18767 `style[${STYLE_HASH_ATTRIBUTE10}]`
18768 )) {
18769 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) {
18770 return true;
18771 }
18772 }
18773 return false;
18774 }
18775 function injectStyle10(targetDocument, hash, css) {
18776 if (!targetDocument.head) {
18777 return;
18778 }
18779 const runtime = getRuntime10();
18780 let injectedStyles = runtime.injectedStyles.get(targetDocument);
18781 if (!injectedStyles) {
18782 injectedStyles = /* @__PURE__ */ new Set();
18783 runtime.injectedStyles.set(targetDocument, injectedStyles);
18784 }
18785 if (injectedStyles.has(hash)) {
18786 return;
18787 }
18788 if (documentContainsStyleHash10(targetDocument, hash)) {
18789 injectedStyles.add(hash);
18790 return;
18791 }
18792 const style = targetDocument.createElement("style");
18793 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash);
18794 style.appendChild(targetDocument.createTextNode(css));
18795 targetDocument.head.appendChild(style);
18796 injectedStyles.add(hash);
18797 }
18798 function registerDocument10(targetDocument) {
18799 const runtime = getRuntime10();
18800 runtime.documents.set(
18801 targetDocument,
18802 (runtime.documents.get(targetDocument) ?? 0) + 1
18803 );
18804 for (const [hash, css] of runtime.styles) {
18805 injectStyle10(targetDocument, hash, css);
18806 }
18807 return () => {
18808 const count = runtime.documents.get(targetDocument);
18809 if (count === void 0) {
18810 return;
18811 }
18812 if (count <= 1) {
18813 runtime.documents.delete(targetDocument);
18814 return;
18815 }
18816 runtime.documents.set(targetDocument, count - 1);
18817 };
18818 }
18819 function registerStyle10(hash, css) {
18820 const runtime = getRuntime10();
18821 runtime.styles.set(hash, css);
18822 for (const targetDocument of runtime.documents.keys()) {
18823 injectStyle10(targetDocument, hash, css);
18824 }
18825 }
18826 if (typeof process === "undefined" || true) {
18827 registerStyle10("c5cdafb1bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0px;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}");
18828 }
18829 var style_default9 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" };
18830 var IconButton = (0, import_element23.forwardRef)(
18831 function IconButton2({
18832 label,
18833 className,
18834 // Prevent accidental forwarding of `children`
18835 children: _children,
18836 disabled: disabled2,
18837 focusableWhenDisabled = true,
18838 icon,
18839 size: size4,
18840 shortcut,
18841 positioner,
18842 "aria-describedby": ariaDescribedBy,
18843 "aria-keyshortcuts": ariaKeyShortcuts,
18844 ...restProps
18845 }, ref) {
18846 const classes = clsx_default(style_default9["icon-button"], className);
18847 const { descriptionId, targetProps } = useKeyboardShortcutProps({
18848 "aria-describedby": ariaDescribedBy,
18849 "aria-keyshortcuts": ariaKeyShortcuts,
18850 shortcut
18851 });
18852 return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Root, { children: [
18853 /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
18854 Trigger,
18855 {
18856 ref,
18857 ...targetProps,
18858 disabled: disabled2 && !focusableWhenDisabled,
18859 render: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
18860 Button4,
18861 {
18862 ...restProps,
18863 size: size4,
18864 "aria-label": label,
18865 disabled: disabled2,
18866 focusableWhenDisabled
18867 }
18868 ),
18869 className: classes,
18870 children: [
18871 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { icon, size: 24, className: style_default9.icon }),
18872 shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
18873 KeyboardShortcutDescription,
18874 {
18875 descriptionId,
18876 shortcut
18877 }
18878 )
18879 ]
18880 }
18881 ),
18882 /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Popup, { positioner, children: [
18883 label,
18884 shortcut && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
18885 " ",
18886 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KeyboardShortcutDisplay, { shortcut })
18887 ] })
18888 ] })
18889 ] });
18890 }
18891 );
18892
18893 // packages/ui/build-module/calendar/utils/root-context.mjs
18894 var import_element24 = __toESM(require_element(), 1);
18895 var RootContext = (0, import_element24.createContext)({});
18896
18897 // packages/ui/build-module/calendar/utils/components.mjs
18898 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
18899 var PreviewDashStartAndEnd = () => {
18900 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18901 "svg",
18902 {
18903 viewBox: "0 0 32 32",
18904 xmlns: "http://www.w3.org/2000/svg",
18905 fill: "none",
18906 stroke: "currentColor",
18907 strokeDasharray: "3.7677",
18908 strokeDashoffset: "3.2",
18909 strokeWidth: "1",
18910 children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { d: "M29.5,0.5 h-27 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h27 a2,2 0 0 0 2,-2 v-27 a2,2 0 0 0 -2,-2" })
18911 }
18912 );
18913 };
18914 var PreviewDashStart = () => {
18915 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18916 "svg",
18917 {
18918 viewBox: "0 0 32 32",
18919 xmlns: "http://www.w3.org/2000/svg",
18920 fill: "none",
18921 stroke: "currentColor",
18922 strokeDasharray: "3.84516",
18923 strokeDashoffset: "1.9226",
18924 strokeWidth: "1",
18925 children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { d: "M32,0.5 h-29.5 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h30" })
18926 }
18927 );
18928 };
18929 var PreviewDashMiddle = () => {
18930 return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18931 "svg",
18932 {
18933 viewBox: "0 0 32 32",
18934 xmlns: "http://www.w3.org/2000/svg",
18935 fill: "none",
18936 stroke: "currentColor",
18937 strokeDasharray: "3.9 4",
18938 strokeDashoffset: "2",
18939 strokeWidth: "1",
18940 children: [
18941 /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("line", { x1: "0", y1: "0.5", x2: "100", y2: "0.5" }),
18942 /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("line", { x1: "0", y1: "31.5", x2: "100", y2: "31.5" })
18943 ]
18944 }
18945 );
18946 };
18947 var PreviewDashEnd = () => {
18948 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18949 "svg",
18950 {
18951 viewBox: "0 0 32 32",
18952 xmlns: "http://www.w3.org/2000/svg",
18953 fill: "none",
18954 stroke: "currentColor",
18955 strokeDasharray: "3.84516",
18956 strokeDashoffset: "1.9226",
18957 strokeWidth: "1",
18958 children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { d: "M0,0.5 h29.5 a2,2 0 0 1 2,2 v27 a2,2 0 0 1 -2,2 h-29.5" })
18959 }
18960 );
18961 };
18962 function Day2(props) {
18963 const { day, modifiers, children, ...tdProps } = props;
18964 let PreviewDash;
18965 if (modifiers.preview_start && modifiers.preview_end) {
18966 PreviewDash = PreviewDashStartAndEnd;
18967 } else if (modifiers.preview_start) {
18968 PreviewDash = PreviewDashStart;
18969 } else if (modifiers.preview_end) {
18970 PreviewDash = PreviewDashEnd;
18971 } else if (modifiers.preview) {
18972 PreviewDash = PreviewDashMiddle;
18973 }
18974 return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("td", { ...tdProps, children: [
18975 PreviewDash && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PreviewDash, {}),
18976 children
18977 ] });
18978 }
18979 function Root3({ rootRef, ...props }) {
18980 const { render: render4, ref, role, defaultAriaLabel } = (0, import_element25.useContext)(RootContext);
18981 const { months, labels } = useDayPicker();
18982 const hasExplicitLabel = props["aria-label"] !== void 0 || props["aria-labelledby"] !== void 0;
18983 let ariaLabel = props["aria-label"];
18984 if (!hasExplicitLabel && defaultAriaLabel && role === "application") {
18985 const currentMonth = months[0];
18986 ariaLabel = currentMonth ? (0, import_i18n5.sprintf)(
18987 // translators: 1: Calendar type. 2: Current month and year.
18988 (0, import_i18n5.__)("%1$s, %2$s"),
18989 defaultAriaLabel,
18990 labels.labelGrid(currentMonth.date)
18991 ) : defaultAriaLabel;
18992 }
18993 const mergedRef = (0, import_compose.useMergeRefs)([rootRef ?? null, ref ?? null]);
18994 return useRender({
18995 render: render4,
18996 defaultTagName: "div",
18997 ref: mergedRef,
18998 props: { ...props, role, "aria-label": ariaLabel }
18999 });
19000 }
19001 function NavButton({
19002 icon,
19003 className,
19004 children: _children,
19005 "aria-label": label,
19006 "aria-disabled": ariaDisabled,
19007 ...props
19008 }) {
19009 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
19010 IconButton,
19011 {
19012 ...props,
19013 className,
19014 label,
19015 icon,
19016 variant: "minimal",
19017 tone: "neutral",
19018 size: "compact",
19019 disabled: ariaDisabled === true || ariaDisabled === "true",
19020 focusableWhenDisabled: true
19021 }
19022 );
19023 }
19024 function PreviousMonthButton2(props) {
19025 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(NavButton, { ...props, icon: chevron_left_default });
19026 }
19027 function NextMonthButton2(props) {
19028 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(NavButton, { ...props, icon: chevron_right_default });
19029 }
19030
19031 // packages/ui/build-module/calendar/utils/constants.mjs
19032 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash";
19033 function getRuntime11() {
19034 const globalScope = globalThis;
19035 if (globalScope.__wpStyleRuntime) {
19036 return globalScope.__wpStyleRuntime;
19037 }
19038 globalScope.__wpStyleRuntime = {
19039 documents: /* @__PURE__ */ new Map(),
19040 styles: /* @__PURE__ */ new Map(),
19041 injectedStyles: /* @__PURE__ */ new WeakMap()
19042 };
19043 if (typeof document !== "undefined") {
19044 registerDocument11(document);
19045 }
19046 return globalScope.__wpStyleRuntime;
19047 }
19048 function documentContainsStyleHash11(targetDocument, hash) {
19049 if (!targetDocument.head) {
19050 return false;
19051 }
19052 for (const style of targetDocument.head.querySelectorAll(
19053 `style[${STYLE_HASH_ATTRIBUTE11}]`
19054 )) {
19055 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) {
19056 return true;
19057 }
19058 }
19059 return false;
19060 }
19061 function injectStyle11(targetDocument, hash, css) {
19062 if (!targetDocument.head) {
19063 return;
19064 }
19065 const runtime = getRuntime11();
19066 let injectedStyles = runtime.injectedStyles.get(targetDocument);
19067 if (!injectedStyles) {
19068 injectedStyles = /* @__PURE__ */ new Set();
19069 runtime.injectedStyles.set(targetDocument, injectedStyles);
19070 }
19071 if (injectedStyles.has(hash)) {
19072 return;
19073 }
19074 if (documentContainsStyleHash11(targetDocument, hash)) {
19075 injectedStyles.add(hash);
19076 return;
19077 }
19078 const style = targetDocument.createElement("style");
19079 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash);
19080 style.appendChild(targetDocument.createTextNode(css));
19081 targetDocument.head.appendChild(style);
19082 injectedStyles.add(hash);
19083 }
19084 function registerDocument11(targetDocument) {
19085 const runtime = getRuntime11();
19086 runtime.documents.set(
19087 targetDocument,
19088 (runtime.documents.get(targetDocument) ?? 0) + 1
19089 );
19090 for (const [hash, css] of runtime.styles) {
19091 injectStyle11(targetDocument, hash, css);
19092 }
19093 return () => {
19094 const count = runtime.documents.get(targetDocument);
19095 if (count === void 0) {
19096 return;
19097 }
19098 if (count <= 1) {
19099 runtime.documents.delete(targetDocument);
19100 return;
19101 }
19102 runtime.documents.set(targetDocument, count - 1);
19103 };
19104 }
19105 function registerStyle11(hash, css) {
19106 const runtime = getRuntime11();
19107 runtime.styles.set(hash, css);
19108 for (const targetDocument of runtime.documents.keys()) {
19109 injectStyle11(targetDocument, hash, css);
19110 }
19111 }
19112 if (typeof process === "undefined" || true) {
19113 registerStyle11("9d2212290a", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2c7ac60ba97b3411__root{--wp-ui-calendar-cell-size:var(--wpds-dimension-size-md,32px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-block;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);position:relative;z-index:0}._172c492625235710__day{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);padding:0;position:relative;&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&:has(._1b64226e315835f8__day-button:focus-visible),&:has(._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}}._1b64226e315835f8__day-button{align-items:center;background:none;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:inherit;cursor:var(--wpds-cursor-control,pointer);display:flex;font:inherit;font-variant-numeric:tabular-nums;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin:0;padding:0;position:relative;width:var(--wp-ui-calendar-cell-size);&:before{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border:none;border-radius:var(--wpds-border-radius-sm,2px);z-index:-1}&:after,&:before{content:"";inset:0;position:absolute}&:after{pointer-events:none;z-index:1}&:disabled{cursor:revert;&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}@media (forced-colors:active){text-decoration:line-through}}&:focus-visible:before,&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed)}}._66b9a8120581fd4b__caption-label{align-items:center;border:0;display:inline-flex;position:relative;text-transform:capitalize;white-space:nowrap;z-index:1}._2c7ac60ba97b3411__root[dir=rtl] ._395a75bb1930f57e__nav-button{transform:rotate(180deg);transform-origin:50%}._337e5337d49b7f3d__month-caption{align-content:center;display:flex;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin-bottom:var(--wpds-dimension-gap-md,12px)}._110e46230c68e498__months{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-lg,16px);justify-content:center;max-width:fit-content;position:relative}._92915239fedb1fea__month-grid{border-collapse:separate;border-spacing:0 var(--wpds-dimension-gap-xs,4px)}._66b1d4a7b488b496__nav{align-items:center;display:flex;height:var(--wp-ui-calendar-cell-size);inset-block-start:0;inset-inline-end:0;inset-inline-start:0;justify-content:space-between;position:absolute}._7207199709ca5776__weekday{color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-weight:var(--wpds-typography-font-weight-default,400);height:var(--wp-ui-calendar-cell-size);padding:0;text-align:center;text-transform:uppercase;width:var(--wp-ui-calendar-cell-size)}._058175f0f9c495e0__today:after{border:2px solid;border-radius:50%;content:"";height:0;inset-block-start:2px;inset-inline-end:2px;position:absolute;width:0;z-index:1}.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle){&:has(._1b64226e315835f8__day-button,._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0)}&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);border:1px solid transparent}&:disabled:before{background-color:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6)}&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e)}}}.c259c5c255fda10f__outside{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}._4d8957a0ca4ec8f0__hidden{visibility:hidden}.f2523033db055ffe__range-start:not(.c04a453de7b11520__range-end) ._1b64226e315835f8__day-button{&,&:before{border-end-end-radius:0;border-start-end-radius:0}}._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-color:transparent;border-radius:0;border-style:solid;border-width:1px 0}}.c04a453de7b11520__range-end:not(.f2523033db055ffe__range-start) ._1b64226e315835f8__day-button{&,&:before{border-end-start-radius:0;border-start-start-radius:0}}._81b244e7c541d95e__preview svg{color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);inset:0;pointer-events:none;position:absolute;@media (forced-colors:active){color:inherit}}._81b244e7c541d95e__preview.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle) svg{display:none}._2c7ac60ba97b3411__root[dir=rtl] ._81b244e7c541d95e__preview svg{transform:scaleX(-1)}._81b244e7c541d95e__preview._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button:before{border:none}@keyframes _255a1a462a5377db__slide-in-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes c21e45f616d6db39__slide-in-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes aed80001de9ae226__slide-out-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes _7d4779a7f29408f2__slide-out-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes _83ba6321b055d687__fade-in{0%{opacity:0}to{opacity:1}}@keyframes _96fbead71248d210__fade-out{0%{opacity:1}to{opacity:0}}._1563bccb09e39c30__caption-after-enter,._60ac2a7fc3208801__weeks-before-exit,._735dacf9052adecd__caption-before-exit,._7f73a6ab85101202__weeks-after-exit,._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter,.c7a3082839155d29__caption-after-exit,.cb8a5ec82ad0885e__caption-before-enter{animation-duration:0s;animation-fill-mode:forwards;animation-timing-function:var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1));@media not (prefers-reduced-motion){animation-duration:var(--wpds-motion-duration-lg,.3s)}}._2c7ac60ba97b3411__root[dir=rtl] ._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter{animation-name:_255a1a462a5377db__slide-in-left}._2c7ac60ba97b3411__root[dir=rtl] ._7f73a6ab85101202__weeks-after-exit,._60ac2a7fc3208801__weeks-before-exit{animation-name:aed80001de9ae226__slide-out-left}._2c7ac60ba97b3411__root[dir=rtl] ._9721326fbc23a5fb__weeks-before-enter,._805d698b56ba4a29__weeks-after-enter{animation-name:c21e45f616d6db39__slide-in-right}._2c7ac60ba97b3411__root[dir=rtl] ._60ac2a7fc3208801__weeks-before-exit,._7f73a6ab85101202__weeks-after-exit{animation-name:_7d4779a7f29408f2__slide-out-right}._1563bccb09e39c30__caption-after-enter,.cb8a5ec82ad0885e__caption-before-enter{animation-name:_83ba6321b055d687__fade-in}._735dacf9052adecd__caption-before-exit,.c7a3082839155d29__caption-after-exit{animation-name:_96fbead71248d210__fade-out}}}');
19114 }
19115 var style_default10 = { "root": "_2c7ac60ba97b3411__root", "day": "_172c492625235710__day", "day-button": "_1b64226e315835f8__day-button", "caption-label": "_66b9a8120581fd4b__caption-label", "nav-button": "_395a75bb1930f57e__nav-button", "month-caption": "_337e5337d49b7f3d__month-caption", "months": "_110e46230c68e498__months", "month-grid": "_92915239fedb1fea__month-grid", "nav": "_66b1d4a7b488b496__nav", "weekday": "_7207199709ca5776__weekday", "today": "_058175f0f9c495e0__today", "selected": "acb642920fb0bef5__selected", "range-middle": "_165d91a726feca9c__range-middle", "outside": "c259c5c255fda10f__outside", "hidden": "_4d8957a0ca4ec8f0__hidden", "range-start": "f2523033db055ffe__range-start", "range-end": "c04a453de7b11520__range-end", "preview": "_81b244e7c541d95e__preview", "weeks-before-enter": "_9721326fbc23a5fb__weeks-before-enter", "weeks-before-exit": "_60ac2a7fc3208801__weeks-before-exit", "weeks-after-enter": "_805d698b56ba4a29__weeks-after-enter", "weeks-after-exit": "_7f73a6ab85101202__weeks-after-exit", "caption-after-enter": "_1563bccb09e39c30__caption-after-enter", "caption-after-exit": "c7a3082839155d29__caption-after-exit", "caption-before-enter": "cb8a5ec82ad0885e__caption-before-enter", "caption-before-exit": "_735dacf9052adecd__caption-before-exit", "slide-in-left": "_255a1a462a5377db__slide-in-left", "slide-out-left": "aed80001de9ae226__slide-out-left", "slide-in-right": "c21e45f616d6db39__slide-in-right", "slide-out-right": "_7d4779a7f29408f2__slide-out-right", "fade-in": "_83ba6321b055d687__fade-in", "fade-out": "_96fbead71248d210__fade-out" };
19116 if (typeof process === "undefined" || true) {
19117 registerStyle11("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
19118 }
19119 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
19120 if (typeof process === "undefined" || true) {
19121 registerStyle11("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
19122 }
19123 var focus_module_default3 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
19124 if (typeof process === "undefined" || true) {
19125 registerStyle11("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
19126 }
19127 var global_css_defense_default4 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
19128 var CLASSNAMES = {
19129 root: clsx_default(style_default10.root, resets_default4["box-sizing"]),
19130 day: style_default10.day,
19131 day_button: clsx_default(
19132 style_default10["day-button"],
19133 global_css_defense_default4.button,
19134 focus_module_default3["outset-ring--focus-visible"]
19135 ),
19136 outside: style_default10.outside,
19137 caption_label: style_default10["caption-label"],
19138 button_next: style_default10["nav-button"],
19139 button_previous: style_default10["nav-button"],
19140 nav: style_default10.nav,
19141 month_caption: style_default10["month-caption"],
19142 months: style_default10.months,
19143 month_grid: style_default10["month-grid"],
19144 weekday: style_default10.weekday,
19145 today: style_default10.today,
19146 selected: style_default10.selected,
19147 /*
19148 * Disabled days are styled through `:has(.day-button:disabled)` rather than
19149 * a modifier class on the cell, because the two are not equivalent: the
19150 * focused day keeps its button enabled so it stays reachable. Mapped to
19151 * `undefined` on purpose, so `@daypicker/react` doesn't fall back to its
19152 * own `rdp-disabled` class for a modifier we don't style.
19153 */
19154 disabled: void 0,
19155 hidden: style_default10.hidden,
19156 range_start: style_default10["range-start"],
19157 range_end: style_default10["range-end"],
19158 range_middle: style_default10["range-middle"],
19159 weeks_before_enter: style_default10["weeks-before-enter"],
19160 weeks_before_exit: style_default10["weeks-before-exit"],
19161 weeks_after_enter: style_default10["weeks-after-enter"],
19162 weeks_after_exit: style_default10["weeks-after-exit"],
19163 caption_after_enter: style_default10["caption-after-enter"],
19164 caption_after_exit: style_default10["caption-after-exit"],
19165 caption_before_enter: style_default10["caption-before-enter"],
19166 caption_before_exit: style_default10["caption-before-exit"]
19167 };
19168 var MODIFIER_CLASSNAMES = {
19169 preview: style_default10.preview
19170 };
19171 var COMMON_PROPS = {
19172 animate: true,
19173 // Only show days in the current month
19174 showOutsideDays: false,
19175 // Hide week number column
19176 showWeekNumber: false,
19177 // Show weekdays row
19178 hideWeekdays: false,
19179 // Month and year caption are not interactive
19180 captionLayout: "label",
19181 // Show a variable number of weeks depending on the month
19182 fixedWeeks: false,
19183 // Show navigation buttons
19184 hideNavigation: false,
19185 // Class names
19186 classNames: CLASSNAMES,
19187 components: {
19188 Day: Day2,
19189 Root: Root3,
19190 PreviousMonthButton: PreviousMonthButton2,
19191 NextMonthButton: NextMonthButton2
19192 }
19193 };
19194
19195 // packages/ui/build-module/calendar/utils/misc.mjs
19196 function clampNumberOfMonths(numberOfMonths) {
19197 return Math.min(3, Math.max(1, numberOfMonths));
19198 }
19199
19200 // packages/ui/build-module/calendar/utils/use-controlled-value.mjs
19201 var import_element26 = __toESM(require_element(), 1);
19202 function useControlledValue2({
19203 defaultValue,
19204 onChange,
19205 value: valueProp
19206 }) {
19207 const hasValue = typeof valueProp !== "undefined";
19208 const initialValue = hasValue ? valueProp : defaultValue;
19209 const [state, setState] = (0, import_element26.useState)(initialValue);
19210 const value = hasValue ? valueProp : state;
19211 const uncontrolledSetValue = (0, import_element26.useCallback)(
19212 (nextValue, ...args) => {
19213 setState(nextValue);
19214 onChange?.(nextValue, ...args);
19215 },
19216 [onChange]
19217 );
19218 let setValue;
19219 if (hasValue && typeof onChange === "function") {
19220 setValue = onChange;
19221 } else if (!hasValue && typeof onChange === "function") {
19222 setValue = uncontrolledSetValue;
19223 } else {
19224 setValue = setState;
19225 }
19226 return [value, setValue];
19227 }
19228
19229 // packages/ui/build-module/calendar/utils/use-localization-props.mjs
19230 var import_i18n6 = __toESM(require_i18n(), 1);
19231 var import_element27 = __toESM(require_element(), 1);
19232 function isLocaleRTL(locale) {
19233 const direction = (locale.getTextInfo?.() ?? locale.textInfo)?.direction;
19234 if (direction) {
19235 return direction === "rtl";
19236 }
19237 return [
19238 "ar",
19239 // Arabic
19240 "he",
19241 // Hebrew
19242 "fa",
19243 // Persian (Farsi)
19244 "ur",
19245 // Urdu
19246 "ps",
19247 // Pashto
19248 "syr",
19249 // Syriac
19250 "dv",
19251 // Divehi
19252 "ku",
19253 // Kurdish (Sorani)
19254 "ckb",
19255 // Central Kurdish (Sorani)
19256 "ug",
19257 // Uyghur
19258 "yi"
19259 // Yiddish
19260 ].includes(locale.language);
19261 }
19262 function getSupportedLocaleCode(localeCode) {
19263 if (!localeCode) {
19264 return;
19265 }
19266 let supportedLocaleCode;
19267 try {
19268 supportedLocaleCode = Intl.DateTimeFormat.supportedLocalesOf([
19269 localeCode
19270 ])[0];
19271 } catch {
19272 }
19273 return supportedLocaleCode;
19274 }
19275 function getWeekStartsOn(locale) {
19276 const firstDay = (locale.getWeekInfo?.() ?? locale.weekInfo)?.firstDay;
19277 if (firstDay === void 0 || firstDay < 1 || firstDay > 7) {
19278 return;
19279 }
19280 return firstDay % 7;
19281 }
19282 var useLocalizationProps = ({
19283 locale,
19284 timeZone,
19285 mode
19286 }) => {
19287 return (0, import_element27.useMemo)(() => {
19288 const isLocaleString = typeof locale === "string";
19289 const dateFnsLocale = isLocaleString || locale === void 0 ? enUS : locale;
19290 const supportedLocaleCode = getSupportedLocaleCode(
19291 isLocaleString ? locale : locale?.code
19292 );
19293 const localeCode = supportedLocaleCode ?? "en-US";
19294 const intlLocale = new Intl.Locale(localeCode);
19295 const isRightToLeft = supportedLocaleCode !== void 0 ? isLocaleRTL(intlLocale) : (0, import_i18n6.isRTL)();
19296 const weekStartsOn = isLocaleString || supportedLocaleCode !== void 0 ? getWeekStartsOn(intlLocale) : void 0;
19297 const monthNameFormatter = new Intl.DateTimeFormat(localeCode, {
19298 calendar: "gregory",
19299 year: "numeric",
19300 month: "long",
19301 timeZone
19302 });
19303 const weekdayNarrowFormatter = new Intl.DateTimeFormat(localeCode, {
19304 calendar: "gregory",
19305 weekday: "narrow",
19306 timeZone
19307 });
19308 const weekdayLongFormatter = new Intl.DateTimeFormat(localeCode, {
19309 calendar: "gregory",
19310 weekday: "long",
19311 timeZone
19312 });
19313 const fullDateFormatter = new Intl.DateTimeFormat(localeCode, {
19314 calendar: "gregory",
19315 weekday: "long",
19316 year: "numeric",
19317 month: "long",
19318 day: "numeric",
19319 timeZone
19320 });
19321 const dayNumberFormatter = new Intl.DateTimeFormat(localeCode, {
19322 calendar: "gregory",
19323 day: "numeric",
19324 timeZone
19325 });
19326 return {
19327 "aria-label": mode === "single" ? (0, import_i18n6.__)("Date calendar") : (0, import_i18n6.__)("Date range calendar"),
19328 labels: {
19329 /** The label for the navigation toolbar. */
19330 labelNav: () => (0, import_i18n6.__)("Navigation bar"),
19331 /**
19332 * The label for the month grid.
19333 * @param date
19334 */
19335 labelGrid: monthNameFormatter.format,
19336 /**
19337 * The label for the gridcell, when the calendar is not interactive.
19338 * @param date
19339 * @param modifiers
19340 */
19341 labelGridcell: (date, modifiers) => {
19342 const formattedDate = fullDateFormatter.format(date);
19343 let label = formattedDate;
19344 if (modifiers?.today) {
19345 label = (0, import_i18n6.sprintf)(
19346 // translators: %s is the full date (e.g. "Monday, April 29, 2025")
19347 (0, import_i18n6.__)("Today, %s"),
19348 formattedDate
19349 );
19350 }
19351 return label;
19352 },
19353 /** The label for the "next month" button. */
19354 labelNext: () => (0, import_i18n6.__)("Next month"),
19355 /** The label for the "previous month" button. */
19356 labelPrevious: () => (0, import_i18n6.__)("Previous month"),
19357 /**
19358 * The label for the day button.
19359 * @param date
19360 * @param modifiers
19361 */
19362 labelDayButton: (date, modifiers) => {
19363 const formattedDate = fullDateFormatter.format(date);
19364 let label = formattedDate;
19365 if (modifiers?.today && modifiers?.selected) {
19366 return (0, import_i18n6.sprintf)(
19367 // translators: %s is the full date (e.g. "Monday, April 29, 2025")
19368 (0, import_i18n6.__)("Today, %s, selected"),
19369 formattedDate
19370 );
19371 }
19372 if (modifiers?.today) {
19373 label = (0, import_i18n6.sprintf)(
19374 // translators: %s is the full date (e.g. "Monday, April 29, 2025")
19375 (0, import_i18n6.__)("Today, %s"),
19376 formattedDate
19377 );
19378 }
19379 if (modifiers?.selected) {
19380 label = (0, import_i18n6.sprintf)(
19381 // translators: %s is the full date (e.g. "Monday, April 29, 2025")
19382 (0, import_i18n6.__)("%s, selected"),
19383 formattedDate
19384 );
19385 }
19386 return label;
19387 },
19388 /**
19389 * The label for the weekday.
19390 * @param date
19391 */
19392 labelWeekday: weekdayLongFormatter.format
19393 },
19394 locale: dateFnsLocale,
19395 lang: localeCode,
19396 dir: isRightToLeft ? "rtl" : "ltr",
19397 ...weekStartsOn === void 0 ? {} : { weekStartsOn },
19398 formatters: {
19399 formatDay: dayNumberFormatter.format,
19400 formatWeekdayName: weekdayNarrowFormatter.format,
19401 formatCaption: monthNameFormatter.format
19402 },
19403 timeZone
19404 };
19405 }, [locale, timeZone, mode]);
19406 };
19407
19408 // packages/ui/build-module/calendar/utils/use-preserve-day-focus.mjs
19409 var import_compose2 = __toESM(require_compose(), 1);
19410 var import_element28 = __toESM(require_element(), 1);
19411 function usePreserveDayFocus(forwardedRef, month) {
19412 const rootRef = (0, import_element28.useRef)(null);
19413 const hadDayFocusRef = (0, import_element28.useRef)(false);
19414 const mergedRef = (0, import_compose2.useMergeRefs)([rootRef, forwardedRef]);
19415 const monthIndex = month ? month.getFullYear() * 12 + month.getMonth() : void 0;
19416 const onDayFocus = (0, import_element28.useCallback)(() => {
19417 hadDayFocusRef.current = true;
19418 }, []);
19419 const onDayBlur = (0, import_element28.useCallback)(() => {
19420 hadDayFocusRef.current = false;
19421 }, []);
19422 (0, import_element28.useEffect)(() => {
19423 if (!hadDayFocusRef.current) {
19424 return;
19425 }
19426 const root = rootRef.current;
19427 if (!root) {
19428 return;
19429 }
19430 const { activeElement: activeElement2, body } = root.ownerDocument;
19431 if (activeElement2 !== body) {
19432 const grid = activeElement2?.closest('[role="grid"]');
19433 hadDayFocusRef.current = !!grid && root.contains(grid);
19434 return;
19435 }
19436 hadDayFocusRef.current = false;
19437 const focusTarget = root.querySelector(
19438 '[role="grid"] button[tabindex="0"]:not(:disabled)'
19439 );
19440 const enabledControl = root.querySelector(
19441 'button:not(:disabled):not([aria-disabled="true"])'
19442 );
19443 const focusableControl = root.querySelector(
19444 "button:not(:disabled)"
19445 );
19446 (focusTarget ?? enabledControl ?? focusableControl)?.focus();
19447 }, [monthIndex]);
19448 return { ref: mergedRef, onDayFocus, onDayBlur };
19449 }
19450
19451 // packages/ui/build-module/calendar/calendar.mjs
19452 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
19453 var Calendar = (0, import_element29.forwardRef)(
19454 function Calendar2({
19455 defaultValue,
19456 value: valueProp,
19457 onValueChange,
19458 numberOfMonths = 1,
19459 locale,
19460 timeZone,
19461 month,
19462 render: render4,
19463 role = "application",
19464 "aria-label": ariaLabel,
19465 labels: customLabels,
19466 ...props
19467 }, ref) {
19468 const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({
19469 locale,
19470 timeZone,
19471 mode: "single"
19472 });
19473 const labels = (0, import_element29.useMemo)(
19474 () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels,
19475 [localizationProps.labels, customLabels]
19476 );
19477 const onChange = (0, import_element29.useCallback)(
19478 (selected2, triggerDate, modifiers, e) => {
19479 onValueChange?.(
19480 selected2 ?? null,
19481 triggerDate,
19482 modifiers,
19483 e
19484 );
19485 },
19486 [onValueChange]
19487 );
19488 const [selected, setSelected] = useControlledValue2({
19489 defaultValue,
19490 value: valueProp,
19491 onChange
19492 });
19493 const dayFocusProps = usePreserveDayFocus(ref, month);
19494 const rootContextValue = (0, import_element29.useMemo)(
19495 () => ({
19496 render: render4,
19497 ref: dayFocusProps.ref,
19498 role,
19499 defaultAriaLabel
19500 }),
19501 [render4, dayFocusProps.ref, role, defaultAriaLabel]
19502 );
19503 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
19504 DayPicker,
19505 {
19506 ...COMMON_PROPS,
19507 ...localizationProps,
19508 ...props,
19509 "aria-label": ariaLabel,
19510 mode: "single",
19511 month,
19512 numberOfMonths: clampNumberOfMonths(numberOfMonths),
19513 labels,
19514 selected: selected ?? void 0,
19515 onSelect: setSelected,
19516 onDayFocus: dayFocusProps.onDayFocus,
19517 onDayBlur: dayFocusProps.onDayBlur
19518 }
19519 ) });
19520 }
19521 );
19522
19523 // packages/ui/build-module/calendar/range-calendar.mjs
19524 var import_element30 = __toESM(require_element(), 1);
19525 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
19526 function usePreviewRange({
19527 value,
19528 hoveredDate,
19529 excludeDisabled,
19530 resetOnSelect,
19531 min: min3,
19532 max: max3,
19533 disabled: disabled2
19534 }) {
19535 return (0, import_element30.useMemo)(() => {
19536 if (!hoveredDate || !value?.from) {
19537 return;
19538 }
19539 if (resetOnSelect && value.to) {
19540 return {
19541 from: hoveredDate,
19542 to: hoveredDate
19543 };
19544 }
19545 let previewHighlight;
19546 let potentialNewRange;
19547 if (hoveredDate < value.from) {
19548 previewHighlight = {
19549 from: hoveredDate,
19550 to: value.from
19551 };
19552 potentialNewRange = {
19553 from: hoveredDate,
19554 to: value.to ?? value.from
19555 };
19556 } else if (value.to && hoveredDate > value.from && hoveredDate < value.to) {
19557 previewHighlight = {
19558 from: value.from,
19559 to: hoveredDate
19560 };
19561 potentialNewRange = {
19562 from: value.from,
19563 to: hoveredDate
19564 };
19565 } else if (hoveredDate > value.from) {
19566 previewHighlight = {
19567 from: value.to ?? value.from,
19568 to: hoveredDate
19569 };
19570 potentialNewRange = {
19571 from: value.from,
19572 to: hoveredDate
19573 };
19574 }
19575 if (min3 !== void 0 && min3 > 0 && potentialNewRange && differenceInCalendarDays(
19576 potentialNewRange.to,
19577 potentialNewRange.from
19578 ) < min3) {
19579 previewHighlight = {
19580 from: hoveredDate,
19581 to: hoveredDate
19582 };
19583 }
19584 if (max3 !== void 0 && max3 > 0 && potentialNewRange && differenceInCalendarDays(
19585 potentialNewRange.to,
19586 potentialNewRange.from
19587 ) > max3) {
19588 previewHighlight = {
19589 from: hoveredDate,
19590 to: hoveredDate
19591 };
19592 }
19593 if (excludeDisabled && disabled2 && potentialNewRange && rangeContainsModifiers(potentialNewRange, disabled2)) {
19594 previewHighlight = {
19595 from: hoveredDate,
19596 to: hoveredDate
19597 };
19598 }
19599 return previewHighlight;
19600 }, [
19601 value,
19602 hoveredDate,
19603 excludeDisabled,
19604 resetOnSelect,
19605 min3,
19606 max3,
19607 disabled2
19608 ]);
19609 }
19610 var RangeCalendar = (0, import_element30.forwardRef)(
19611 function RangeCalendar2({
19612 defaultValue,
19613 value: valueProp,
19614 onValueChange,
19615 numberOfMonths = 1,
19616 excludeDisabled,
19617 resetOnSelect = true,
19618 min: min3,
19619 max: max3,
19620 disabled: disabled2,
19621 locale,
19622 timeZone,
19623 month,
19624 render: render4,
19625 role = "application",
19626 "aria-label": ariaLabel,
19627 labels: customLabels,
19628 ...props
19629 }, ref) {
19630 const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({
19631 locale,
19632 timeZone,
19633 mode: "range"
19634 });
19635 const labels = (0, import_element30.useMemo)(
19636 () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels,
19637 [localizationProps.labels, customLabels]
19638 );
19639 const onChange = (0, import_element30.useCallback)(
19640 (selected2, triggerDate, modifiers2, e) => {
19641 onValueChange?.(
19642 selected2 ?? null,
19643 triggerDate,
19644 modifiers2,
19645 e
19646 );
19647 },
19648 [onValueChange]
19649 );
19650 const [selected, setSelected] = useControlledValue2({
19651 defaultValue,
19652 value: valueProp,
19653 onChange
19654 });
19655 const dayFocusProps = usePreserveDayFocus(ref, month);
19656 const [hoveredDate, setHoveredDate] = (0, import_element30.useState)(
19657 void 0
19658 );
19659 const previewRange = usePreviewRange({
19660 value: selected,
19661 hoveredDate,
19662 excludeDisabled,
19663 resetOnSelect,
19664 min: min3,
19665 max: max3,
19666 disabled: disabled2
19667 });
19668 const modifiers = (0, import_element30.useMemo)(() => {
19669 return {
19670 preview: previewRange,
19671 preview_start: previewRange?.from,
19672 preview_end: previewRange?.to
19673 };
19674 }, [previewRange]);
19675 const rootContextValue = (0, import_element30.useMemo)(
19676 () => ({
19677 render: render4,
19678 ref: dayFocusProps.ref,
19679 role,
19680 defaultAriaLabel
19681 }),
19682 [render4, dayFocusProps.ref, role, defaultAriaLabel]
19683 );
19684 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
19685 DayPicker,
19686 {
19687 ...COMMON_PROPS,
19688 ...localizationProps,
19689 ...props,
19690 "aria-label": ariaLabel,
19691 mode: "range",
19692 month,
19693 numberOfMonths: clampNumberOfMonths(numberOfMonths),
19694 disabled: disabled2,
19695 excludeDisabled,
19696 resetOnSelect,
19697 min: min3,
19698 max: max3,
19699 labels,
19700 selected: selected ?? void 0,
19701 onSelect: setSelected,
19702 onDayFocus: dayFocusProps.onDayFocus,
19703 onDayBlur: dayFocusProps.onDayBlur,
19704 onDayMouseEnter: (date) => setHoveredDate(date),
19705 onDayMouseLeave: () => setHoveredDate(void 0),
19706 modifiers,
19707 modifiersClassNames: MODIFIER_CLASSNAMES
19708 }
19709 ) });
19710 }
19711 );
19712
19713 // packages/ui/build-module/card/index.mjs
19714 var card_exports = {};
19715 __export(card_exports, {
19716 Content: () => Content,
19717 FullBleed: () => FullBleed,
19718 Header: () => Header,
19719 Root: () => Root4,
19720 Title: () => Title
19721 });
19722
19723 // packages/ui/build-module/card/root.mjs
19724 var import_element31 = __toESM(require_element(), 1);
19725 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash";
19726 function getRuntime12() {
19727 const globalScope = globalThis;
19728 if (globalScope.__wpStyleRuntime) {
19729 return globalScope.__wpStyleRuntime;
19730 }
19731 globalScope.__wpStyleRuntime = {
19732 documents: /* @__PURE__ */ new Map(),
19733 styles: /* @__PURE__ */ new Map(),
19734 injectedStyles: /* @__PURE__ */ new WeakMap()
19735 };
19736 if (typeof document !== "undefined") {
19737 registerDocument12(document);
19738 }
19739 return globalScope.__wpStyleRuntime;
19740 }
19741 function documentContainsStyleHash12(targetDocument, hash) {
19742 if (!targetDocument.head) {
19743 return false;
19744 }
19745 for (const style of targetDocument.head.querySelectorAll(
19746 `style[${STYLE_HASH_ATTRIBUTE12}]`
19747 )) {
19748 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) {
19749 return true;
19750 }
19751 }
19752 return false;
19753 }
19754 function injectStyle12(targetDocument, hash, css) {
19755 if (!targetDocument.head) {
19756 return;
19757 }
19758 const runtime = getRuntime12();
19759 let injectedStyles = runtime.injectedStyles.get(targetDocument);
19760 if (!injectedStyles) {
19761 injectedStyles = /* @__PURE__ */ new Set();
19762 runtime.injectedStyles.set(targetDocument, injectedStyles);
19763 }
19764 if (injectedStyles.has(hash)) {
19765 return;
19766 }
19767 if (documentContainsStyleHash12(targetDocument, hash)) {
19768 injectedStyles.add(hash);
19769 return;
19770 }
19771 const style = targetDocument.createElement("style");
19772 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash);
19773 style.appendChild(targetDocument.createTextNode(css));
19774 targetDocument.head.appendChild(style);
19775 injectedStyles.add(hash);
19776 }
19777 function registerDocument12(targetDocument) {
19778 const runtime = getRuntime12();
19779 runtime.documents.set(
19780 targetDocument,
19781 (runtime.documents.get(targetDocument) ?? 0) + 1
19782 );
19783 for (const [hash, css] of runtime.styles) {
19784 injectStyle12(targetDocument, hash, css);
19785 }
19786 return () => {
19787 const count = runtime.documents.get(targetDocument);
19788 if (count === void 0) {
19789 return;
19790 }
19791 if (count <= 1) {
19792 runtime.documents.delete(targetDocument);
19793 return;
19794 }
19795 runtime.documents.set(targetDocument, count - 1);
19796 };
19797 }
19798 function registerStyle12(hash, css) {
19799 const runtime = getRuntime12();
19800 runtime.styles.set(hash, css);
19801 for (const targetDocument of runtime.documents.keys()) {
19802 injectStyle12(targetDocument, hash, css);
19803 }
19804 }
19805 if (typeof process === "undefined" || true) {
19806 registerStyle12("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
19807 }
19808 var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
19809 if (typeof process === "undefined" || true) {
19810 registerStyle12("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}");
19811 }
19812 var style_default11 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
19813 var Root4 = (0, import_element31.forwardRef)(function Card({ render: render4, ...restProps }, ref) {
19814 const mergedClassName = clsx_default(style_default11.root, resets_default5["box-sizing"]);
19815 const element = useRender({
19816 defaultTagName: "div",
19817 render: render4,
19818 ref,
19819 props: mergeProps({ className: mergedClassName }, restProps)
19820 });
19821 return element;
19822 });
19823
19824 // packages/ui/build-module/card/header.mjs
19825 var import_element32 = __toESM(require_element(), 1);
19826 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash";
19827 function getRuntime13() {
19828 const globalScope = globalThis;
19829 if (globalScope.__wpStyleRuntime) {
19830 return globalScope.__wpStyleRuntime;
19831 }
19832 globalScope.__wpStyleRuntime = {
19833 documents: /* @__PURE__ */ new Map(),
19834 styles: /* @__PURE__ */ new Map(),
19835 injectedStyles: /* @__PURE__ */ new WeakMap()
19836 };
19837 if (typeof document !== "undefined") {
19838 registerDocument13(document);
19839 }
19840 return globalScope.__wpStyleRuntime;
19841 }
19842 function documentContainsStyleHash13(targetDocument, hash) {
19843 if (!targetDocument.head) {
19844 return false;
19845 }
19846 for (const style of targetDocument.head.querySelectorAll(
19847 `style[${STYLE_HASH_ATTRIBUTE13}]`
19848 )) {
19849 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) {
19850 return true;
19851 }
19852 }
19853 return false;
19854 }
19855 function injectStyle13(targetDocument, hash, css) {
19856 if (!targetDocument.head) {
19857 return;
19858 }
19859 const runtime = getRuntime13();
19860 let injectedStyles = runtime.injectedStyles.get(targetDocument);
19861 if (!injectedStyles) {
19862 injectedStyles = /* @__PURE__ */ new Set();
19863 runtime.injectedStyles.set(targetDocument, injectedStyles);
19864 }
19865 if (injectedStyles.has(hash)) {
19866 return;
19867 }
19868 if (documentContainsStyleHash13(targetDocument, hash)) {
19869 injectedStyles.add(hash);
19870 return;
19871 }
19872 const style = targetDocument.createElement("style");
19873 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash);
19874 style.appendChild(targetDocument.createTextNode(css));
19875 targetDocument.head.appendChild(style);
19876 injectedStyles.add(hash);
19877 }
19878 function registerDocument13(targetDocument) {
19879 const runtime = getRuntime13();
19880 runtime.documents.set(
19881 targetDocument,
19882 (runtime.documents.get(targetDocument) ?? 0) + 1
19883 );
19884 for (const [hash, css] of runtime.styles) {
19885 injectStyle13(targetDocument, hash, css);
19886 }
19887 return () => {
19888 const count = runtime.documents.get(targetDocument);
19889 if (count === void 0) {
19890 return;
19891 }
19892 if (count <= 1) {
19893 runtime.documents.delete(targetDocument);
19894 return;
19895 }
19896 runtime.documents.set(targetDocument, count - 1);
19897 };
19898 }
19899 function registerStyle13(hash, css) {
19900 const runtime = getRuntime13();
19901 runtime.styles.set(hash, css);
19902 for (const targetDocument of runtime.documents.keys()) {
19903 injectStyle13(targetDocument, hash, css);
19904 }
19905 }
19906 if (typeof process === "undefined" || true) {
19907 registerStyle13("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}");
19908 }
19909 var style_default12 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
19910 var Header = (0, import_element32.forwardRef)(
19911 function CardHeader({ render: render4, ...props }, ref) {
19912 const element = useRender({
19913 defaultTagName: "div",
19914 render: render4,
19915 ref,
19916 props: mergeProps({ className: style_default12.header }, props)
19917 });
19918 return element;
19919 }
19920 );
19921
19922 // packages/ui/build-module/card/content.mjs
19923 var import_element33 = __toESM(require_element(), 1);
19924 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash";
19925 function getRuntime14() {
19926 const globalScope = globalThis;
19927 if (globalScope.__wpStyleRuntime) {
19928 return globalScope.__wpStyleRuntime;
19929 }
19930 globalScope.__wpStyleRuntime = {
19931 documents: /* @__PURE__ */ new Map(),
19932 styles: /* @__PURE__ */ new Map(),
19933 injectedStyles: /* @__PURE__ */ new WeakMap()
19934 };
19935 if (typeof document !== "undefined") {
19936 registerDocument14(document);
19937 }
19938 return globalScope.__wpStyleRuntime;
19939 }
19940 function documentContainsStyleHash14(targetDocument, hash) {
19941 if (!targetDocument.head) {
19942 return false;
19943 }
19944 for (const style of targetDocument.head.querySelectorAll(
19945 `style[${STYLE_HASH_ATTRIBUTE14}]`
19946 )) {
19947 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) {
19948 return true;
19949 }
19950 }
19951 return false;
19952 }
19953 function injectStyle14(targetDocument, hash, css) {
19954 if (!targetDocument.head) {
19955 return;
19956 }
19957 const runtime = getRuntime14();
19958 let injectedStyles = runtime.injectedStyles.get(targetDocument);
19959 if (!injectedStyles) {
19960 injectedStyles = /* @__PURE__ */ new Set();
19961 runtime.injectedStyles.set(targetDocument, injectedStyles);
19962 }
19963 if (injectedStyles.has(hash)) {
19964 return;
19965 }
19966 if (documentContainsStyleHash14(targetDocument, hash)) {
19967 injectedStyles.add(hash);
19968 return;
19969 }
19970 const style = targetDocument.createElement("style");
19971 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash);
19972 style.appendChild(targetDocument.createTextNode(css));
19973 targetDocument.head.appendChild(style);
19974 injectedStyles.add(hash);
19975 }
19976 function registerDocument14(targetDocument) {
19977 const runtime = getRuntime14();
19978 runtime.documents.set(
19979 targetDocument,
19980 (runtime.documents.get(targetDocument) ?? 0) + 1
19981 );
19982 for (const [hash, css] of runtime.styles) {
19983 injectStyle14(targetDocument, hash, css);
19984 }
19985 return () => {
19986 const count = runtime.documents.get(targetDocument);
19987 if (count === void 0) {
19988 return;
19989 }
19990 if (count <= 1) {
19991 runtime.documents.delete(targetDocument);
19992 return;
19993 }
19994 runtime.documents.set(targetDocument, count - 1);
19995 };
19996 }
19997 function registerStyle14(hash, css) {
19998 const runtime = getRuntime14();
19999 runtime.styles.set(hash, css);
20000 for (const targetDocument of runtime.documents.keys()) {
20001 injectStyle14(targetDocument, hash, css);
20002 }
20003 }
20004 if (typeof process === "undefined" || true) {
20005 registerStyle14("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}");
20006 }
20007 var style_default13 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
20008 var Content = (0, import_element33.forwardRef)(
20009 function CardContent({ render: render4, ...props }, ref) {
20010 const element = useRender({
20011 defaultTagName: "div",
20012 render: render4,
20013 ref,
20014 props: mergeProps({ className: style_default13.content }, props)
20015 });
20016 return element;
20017 }
20018 );
20019
20020 // packages/ui/build-module/card/full-bleed.mjs
20021 var import_element34 = __toESM(require_element(), 1);
20022 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash";
20023 function getRuntime15() {
20024 const globalScope = globalThis;
20025 if (globalScope.__wpStyleRuntime) {
20026 return globalScope.__wpStyleRuntime;
20027 }
20028 globalScope.__wpStyleRuntime = {
20029 documents: /* @__PURE__ */ new Map(),
20030 styles: /* @__PURE__ */ new Map(),
20031 injectedStyles: /* @__PURE__ */ new WeakMap()
20032 };
20033 if (typeof document !== "undefined") {
20034 registerDocument15(document);
20035 }
20036 return globalScope.__wpStyleRuntime;
20037 }
20038 function documentContainsStyleHash15(targetDocument, hash) {
20039 if (!targetDocument.head) {
20040 return false;
20041 }
20042 for (const style of targetDocument.head.querySelectorAll(
20043 `style[${STYLE_HASH_ATTRIBUTE15}]`
20044 )) {
20045 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) {
20046 return true;
20047 }
20048 }
20049 return false;
20050 }
20051 function injectStyle15(targetDocument, hash, css) {
20052 if (!targetDocument.head) {
20053 return;
20054 }
20055 const runtime = getRuntime15();
20056 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20057 if (!injectedStyles) {
20058 injectedStyles = /* @__PURE__ */ new Set();
20059 runtime.injectedStyles.set(targetDocument, injectedStyles);
20060 }
20061 if (injectedStyles.has(hash)) {
20062 return;
20063 }
20064 if (documentContainsStyleHash15(targetDocument, hash)) {
20065 injectedStyles.add(hash);
20066 return;
20067 }
20068 const style = targetDocument.createElement("style");
20069 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash);
20070 style.appendChild(targetDocument.createTextNode(css));
20071 targetDocument.head.appendChild(style);
20072 injectedStyles.add(hash);
20073 }
20074 function registerDocument15(targetDocument) {
20075 const runtime = getRuntime15();
20076 runtime.documents.set(
20077 targetDocument,
20078 (runtime.documents.get(targetDocument) ?? 0) + 1
20079 );
20080 for (const [hash, css] of runtime.styles) {
20081 injectStyle15(targetDocument, hash, css);
20082 }
20083 return () => {
20084 const count = runtime.documents.get(targetDocument);
20085 if (count === void 0) {
20086 return;
20087 }
20088 if (count <= 1) {
20089 runtime.documents.delete(targetDocument);
20090 return;
20091 }
20092 runtime.documents.set(targetDocument, count - 1);
20093 };
20094 }
20095 function registerStyle15(hash, css) {
20096 const runtime = getRuntime15();
20097 runtime.styles.set(hash, css);
20098 for (const targetDocument of runtime.documents.keys()) {
20099 injectStyle15(targetDocument, hash, css);
20100 }
20101 }
20102 if (typeof process === "undefined" || true) {
20103 registerStyle15("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}}");
20104 }
20105 var style_default14 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" };
20106 var FullBleed = (0, import_element34.forwardRef)(
20107 function CardFullBleed({ render: render4, ...props }, ref) {
20108 const element = useRender({
20109 defaultTagName: "div",
20110 render: render4,
20111 ref,
20112 props: mergeProps(
20113 { className: style_default14.fullbleed },
20114 props
20115 )
20116 });
20117 return element;
20118 }
20119 );
20120
20121 // packages/ui/build-module/card/title.mjs
20122 var import_element35 = __toESM(require_element(), 1);
20123 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
20124 var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", {});
20125 var Title = (0, import_element35.forwardRef)(
20126 function CardTitle({ render: render4 = DEFAULT_TAG, children, ...props }, ref) {
20127 return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
20128 Text,
20129 {
20130 ref,
20131 variant: "heading-lg",
20132 render: render4,
20133 ...props,
20134 children
20135 }
20136 );
20137 }
20138 );
20139
20140 // packages/ui/build-module/collapsible/panel.mjs
20141 var import_element36 = __toESM(require_element(), 1);
20142 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
20143 var Panel = (0, import_element36.forwardRef)(
20144 function CollapsiblePanel3(props, forwardedRef) {
20145 return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props });
20146 }
20147 );
20148
20149 // packages/ui/build-module/collapsible/root.mjs
20150 var import_element37 = __toESM(require_element(), 1);
20151 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
20152 var Root5 = (0, import_element37.forwardRef)(
20153 function CollapsibleRoot3(props, forwardedRef) {
20154 return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props });
20155 }
20156 );
20157
20158 // packages/ui/build-module/collapsible/trigger.mjs
20159 var import_element38 = __toESM(require_element(), 1);
20160 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
20161 var Trigger2 = (0, import_element38.forwardRef)(
20162 function CollapsibleTrigger3(props, forwardedRef) {
20163 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props });
20164 }
20165 );
20166
20167 // packages/ui/build-module/collapsible-card/index.mjs
20168 var collapsible_card_exports = {};
20169 __export(collapsible_card_exports, {
20170 Content: () => Content2,
20171 Header: () => Header2,
20172 HeaderDescription: () => HeaderDescription,
20173 Root: () => Root32
20174 });
20175
20176 // packages/ui/build-module/collapsible-card/root.mjs
20177 var import_element39 = __toESM(require_element(), 1);
20178 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
20179 var Root32 = (0, import_element39.forwardRef)(
20180 function CollapsibleCardRoot({ render: render4, ...restProps }, ref) {
20181 return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
20182 Root5,
20183 {
20184 ref,
20185 render: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Root4, { render: render4 }),
20186 ...restProps
20187 }
20188 );
20189 }
20190 );
20191
20192 // packages/ui/build-module/collapsible-card/header.mjs
20193 var import_compose3 = __toESM(require_compose(), 1);
20194 var import_element41 = __toESM(require_element(), 1);
20195
20196 // packages/ui/build-module/collapsible-card/context.mjs
20197 var import_element40 = __toESM(require_element(), 1);
20198 var HeaderDescriptionIdContext = (0, import_element40.createContext)(null);
20199
20200 // packages/ui/build-module/collapsible-card/header.mjs
20201 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
20202 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash";
20203 function getRuntime16() {
20204 const globalScope = globalThis;
20205 if (globalScope.__wpStyleRuntime) {
20206 return globalScope.__wpStyleRuntime;
20207 }
20208 globalScope.__wpStyleRuntime = {
20209 documents: /* @__PURE__ */ new Map(),
20210 styles: /* @__PURE__ */ new Map(),
20211 injectedStyles: /* @__PURE__ */ new WeakMap()
20212 };
20213 if (typeof document !== "undefined") {
20214 registerDocument16(document);
20215 }
20216 return globalScope.__wpStyleRuntime;
20217 }
20218 function documentContainsStyleHash16(targetDocument, hash) {
20219 if (!targetDocument.head) {
20220 return false;
20221 }
20222 for (const style of targetDocument.head.querySelectorAll(
20223 `style[${STYLE_HASH_ATTRIBUTE16}]`
20224 )) {
20225 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) {
20226 return true;
20227 }
20228 }
20229 return false;
20230 }
20231 function injectStyle16(targetDocument, hash, css) {
20232 if (!targetDocument.head) {
20233 return;
20234 }
20235 const runtime = getRuntime16();
20236 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20237 if (!injectedStyles) {
20238 injectedStyles = /* @__PURE__ */ new Set();
20239 runtime.injectedStyles.set(targetDocument, injectedStyles);
20240 }
20241 if (injectedStyles.has(hash)) {
20242 return;
20243 }
20244 if (documentContainsStyleHash16(targetDocument, hash)) {
20245 injectedStyles.add(hash);
20246 return;
20247 }
20248 const style = targetDocument.createElement("style");
20249 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash);
20250 style.appendChild(targetDocument.createTextNode(css));
20251 targetDocument.head.appendChild(style);
20252 injectedStyles.add(hash);
20253 }
20254 function registerDocument16(targetDocument) {
20255 const runtime = getRuntime16();
20256 runtime.documents.set(
20257 targetDocument,
20258 (runtime.documents.get(targetDocument) ?? 0) + 1
20259 );
20260 for (const [hash, css] of runtime.styles) {
20261 injectStyle16(targetDocument, hash, css);
20262 }
20263 return () => {
20264 const count = runtime.documents.get(targetDocument);
20265 if (count === void 0) {
20266 return;
20267 }
20268 if (count <= 1) {
20269 runtime.documents.delete(targetDocument);
20270 return;
20271 }
20272 runtime.documents.set(targetDocument, count - 1);
20273 };
20274 }
20275 function registerStyle16(hash, css) {
20276 const runtime = getRuntime16();
20277 runtime.styles.set(hash, css);
20278 for (const targetDocument of runtime.documents.keys()) {
20279 injectStyle16(targetDocument, hash, css);
20280 }
20281 }
20282 if (typeof process === "undefined" || true) {
20283 registerStyle16("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}}");
20284 }
20285 var style_default15 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
20286 if (typeof process === "undefined" || true) {
20287 registerStyle16("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
20288 }
20289 var global_css_defense_default5 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
20290 if (typeof process === "undefined" || true) {
20291 registerStyle16("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
20292 }
20293 var focus_module_default4 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
20294 var Header2 = (0, import_element41.forwardRef)(
20295 function CollapsibleCardHeader({
20296 children,
20297 className,
20298 render: render4,
20299 "aria-describedby": ariaDescribedByProp,
20300 ...restProps
20301 }, ref) {
20302 const [descriptionIds, setDescriptionIds] = (0, import_element41.useState)(
20303 []
20304 );
20305 const [orderedDescriptionIds, setOrderedDescriptionIds] = (0, import_element41.useState)([]);
20306 const headerContentRef = (0, import_element41.useRef)(null);
20307 const registerDescriptionId = (0, import_element41.useCallback)((id) => {
20308 setDescriptionIds((currentDescriptionIds) => {
20309 if (currentDescriptionIds.includes(id)) {
20310 return currentDescriptionIds;
20311 }
20312 return [...currentDescriptionIds, id];
20313 });
20314 return () => {
20315 setDescriptionIds(
20316 (currentDescriptionIds) => currentDescriptionIds.filter(
20317 (descriptionId) => descriptionId !== id
20318 )
20319 );
20320 };
20321 }, []);
20322 const contextValue = (0, import_element41.useMemo)(
20323 () => ({ registerDescriptionId }),
20324 [registerDescriptionId]
20325 );
20326 (0, import_compose3.useIsomorphicLayoutEffect)(() => {
20327 const registeredDescriptionIds = new Set(descriptionIds);
20328 const nextDescriptionIds = Array.from(
20329 headerContentRef.current?.querySelectorAll("[id]") ?? []
20330 ).map((element) => element.id).filter((id) => registeredDescriptionIds.has(id));
20331 setOrderedDescriptionIds((currentDescriptionIds) => {
20332 if (currentDescriptionIds.length === nextDescriptionIds.length && currentDescriptionIds.every(
20333 (id, index2) => id === nextDescriptionIds[index2]
20334 )) {
20335 return currentDescriptionIds;
20336 }
20337 return nextDescriptionIds;
20338 });
20339 });
20340 const ariaDescribedBy = Array.from(
20341 /* @__PURE__ */ new Set([
20342 ...ariaDescribedByProp?.split(/\s+/).filter(Boolean) ?? [],
20343 ...orderedDescriptionIds
20344 ])
20345 ).join(" ") || void 0;
20346 return useRender({
20347 defaultTagName: "div",
20348 render: render4,
20349 ref,
20350 props: mergeProps(restProps, {
20351 className: clsx_default(
20352 global_css_defense_default5.heading,
20353 style_default15["heading-wrapper"],
20354 className
20355 ),
20356 children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
20357 Trigger2,
20358 {
20359 className: style_default15.header,
20360 render: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Header, {}),
20361 nativeButton: false,
20362 "aria-describedby": ariaDescribedBy,
20363 children: [
20364 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
20365 "div",
20366 {
20367 ref: headerContentRef,
20368 className: style_default15["header-content"],
20369 children
20370 }
20371 ),
20372 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
20373 "div",
20374 {
20375 className: clsx_default(
20376 style_default15["header-trigger-positioner"]
20377 ),
20378 children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
20379 "div",
20380 {
20381 className: clsx_default(
20382 style_default15["header-trigger-wrapper"],
20383 global_css_defense_default5.div,
20384 // While the interactive trigger element is the whole header,
20385 // the focus ring will be displayed only on the icon to visually
20386 // emulate it being the button.
20387 focus_module_default4["outset-ring--focus-parent-visible"]
20388 ),
20389 children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
20390 Icon,
20391 {
20392 icon: chevron_down_default,
20393 className: style_default15["header-trigger"]
20394 }
20395 )
20396 }
20397 )
20398 }
20399 )
20400 ]
20401 }
20402 ) })
20403 })
20404 });
20405 }
20406 );
20407
20408 // packages/ui/build-module/collapsible-card/header-description.mjs
20409 var import_element42 = __toESM(require_element(), 1);
20410 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
20411 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash";
20412 function getRuntime17() {
20413 const globalScope = globalThis;
20414 if (globalScope.__wpStyleRuntime) {
20415 return globalScope.__wpStyleRuntime;
20416 }
20417 globalScope.__wpStyleRuntime = {
20418 documents: /* @__PURE__ */ new Map(),
20419 styles: /* @__PURE__ */ new Map(),
20420 injectedStyles: /* @__PURE__ */ new WeakMap()
20421 };
20422 if (typeof document !== "undefined") {
20423 registerDocument17(document);
20424 }
20425 return globalScope.__wpStyleRuntime;
20426 }
20427 function documentContainsStyleHash17(targetDocument, hash) {
20428 if (!targetDocument.head) {
20429 return false;
20430 }
20431 for (const style of targetDocument.head.querySelectorAll(
20432 `style[${STYLE_HASH_ATTRIBUTE17}]`
20433 )) {
20434 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) {
20435 return true;
20436 }
20437 }
20438 return false;
20439 }
20440 function injectStyle17(targetDocument, hash, css) {
20441 if (!targetDocument.head) {
20442 return;
20443 }
20444 const runtime = getRuntime17();
20445 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20446 if (!injectedStyles) {
20447 injectedStyles = /* @__PURE__ */ new Set();
20448 runtime.injectedStyles.set(targetDocument, injectedStyles);
20449 }
20450 if (injectedStyles.has(hash)) {
20451 return;
20452 }
20453 if (documentContainsStyleHash17(targetDocument, hash)) {
20454 injectedStyles.add(hash);
20455 return;
20456 }
20457 const style = targetDocument.createElement("style");
20458 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash);
20459 style.appendChild(targetDocument.createTextNode(css));
20460 targetDocument.head.appendChild(style);
20461 injectedStyles.add(hash);
20462 }
20463 function registerDocument17(targetDocument) {
20464 const runtime = getRuntime17();
20465 runtime.documents.set(
20466 targetDocument,
20467 (runtime.documents.get(targetDocument) ?? 0) + 1
20468 );
20469 for (const [hash, css] of runtime.styles) {
20470 injectStyle17(targetDocument, hash, css);
20471 }
20472 return () => {
20473 const count = runtime.documents.get(targetDocument);
20474 if (count === void 0) {
20475 return;
20476 }
20477 if (count <= 1) {
20478 runtime.documents.delete(targetDocument);
20479 return;
20480 }
20481 runtime.documents.set(targetDocument, count - 1);
20482 };
20483 }
20484 function registerStyle17(hash, css) {
20485 const runtime = getRuntime17();
20486 runtime.styles.set(hash, css);
20487 for (const targetDocument of runtime.documents.keys()) {
20488 injectStyle17(targetDocument, hash, css);
20489 }
20490 }
20491 if (typeof process === "undefined" || true) {
20492 registerStyle17("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}}");
20493 }
20494 var style_default16 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
20495 var DEFAULT_TAG2 = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", {});
20496 var HeaderDescription = (0, import_element42.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, id: idProp, render: render4 = DEFAULT_TAG2, ...restProps }, ref) {
20497 const generatedId = (0, import_element42.useId)();
20498 const descriptionId = idProp ?? generatedId;
20499 const context = (0, import_element42.useContext)(HeaderDescriptionIdContext);
20500 if (!context) {
20501 throw new Error(
20502 "CollapsibleCard.HeaderDescription: Missing parent <CollapsibleCard.Header>. Render <CollapsibleCard.HeaderDescription> inside <CollapsibleCard.Header>."
20503 );
20504 }
20505 (0, import_element42.useEffect)(() => {
20506 return context?.registerDescriptionId(descriptionId);
20507 }, [context, descriptionId]);
20508 return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
20509 Text,
20510 {
20511 ref,
20512 variant: "body-md",
20513 render: render4,
20514 id: descriptionId,
20515 "aria-hidden": "true",
20516 className: clsx_default(style_default16["header-description"], className),
20517 ...restProps,
20518 children
20519 }
20520 );
20521 });
20522
20523 // packages/ui/build-module/collapsible-card/content.mjs
20524 var import_element43 = __toESM(require_element(), 1);
20525 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
20526 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash";
20527 function getRuntime18() {
20528 const globalScope = globalThis;
20529 if (globalScope.__wpStyleRuntime) {
20530 return globalScope.__wpStyleRuntime;
20531 }
20532 globalScope.__wpStyleRuntime = {
20533 documents: /* @__PURE__ */ new Map(),
20534 styles: /* @__PURE__ */ new Map(),
20535 injectedStyles: /* @__PURE__ */ new WeakMap()
20536 };
20537 if (typeof document !== "undefined") {
20538 registerDocument18(document);
20539 }
20540 return globalScope.__wpStyleRuntime;
20541 }
20542 function documentContainsStyleHash18(targetDocument, hash) {
20543 if (!targetDocument.head) {
20544 return false;
20545 }
20546 for (const style of targetDocument.head.querySelectorAll(
20547 `style[${STYLE_HASH_ATTRIBUTE18}]`
20548 )) {
20549 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) {
20550 return true;
20551 }
20552 }
20553 return false;
20554 }
20555 function injectStyle18(targetDocument, hash, css) {
20556 if (!targetDocument.head) {
20557 return;
20558 }
20559 const runtime = getRuntime18();
20560 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20561 if (!injectedStyles) {
20562 injectedStyles = /* @__PURE__ */ new Set();
20563 runtime.injectedStyles.set(targetDocument, injectedStyles);
20564 }
20565 if (injectedStyles.has(hash)) {
20566 return;
20567 }
20568 if (documentContainsStyleHash18(targetDocument, hash)) {
20569 injectedStyles.add(hash);
20570 return;
20571 }
20572 const style = targetDocument.createElement("style");
20573 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash);
20574 style.appendChild(targetDocument.createTextNode(css));
20575 targetDocument.head.appendChild(style);
20576 injectedStyles.add(hash);
20577 }
20578 function registerDocument18(targetDocument) {
20579 const runtime = getRuntime18();
20580 runtime.documents.set(
20581 targetDocument,
20582 (runtime.documents.get(targetDocument) ?? 0) + 1
20583 );
20584 for (const [hash, css] of runtime.styles) {
20585 injectStyle18(targetDocument, hash, css);
20586 }
20587 return () => {
20588 const count = runtime.documents.get(targetDocument);
20589 if (count === void 0) {
20590 return;
20591 }
20592 if (count <= 1) {
20593 runtime.documents.delete(targetDocument);
20594 return;
20595 }
20596 runtime.documents.set(targetDocument, count - 1);
20597 };
20598 }
20599 function registerStyle18(hash, css) {
20600 const runtime = getRuntime18();
20601 runtime.styles.set(hash, css);
20602 for (const targetDocument of runtime.documents.keys()) {
20603 injectStyle18(targetDocument, hash, css);
20604 }
20605 }
20606 if (typeof process === "undefined" || true) {
20607 registerStyle18("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}}");
20608 }
20609 var style_default17 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" };
20610 var Content2 = (0, import_element43.forwardRef)(
20611 function CollapsibleCardContent({ className, render: render4, children, hiddenUntilFound = true, ...restProps }, ref) {
20612 return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
20613 Panel,
20614 {
20615 ref,
20616 className: (state) => clsx_default(
20617 style_default17.content,
20618 state.open && state.transitionStatus === "idle" && style_default17["overflow-visible"],
20619 className
20620 ),
20621 hiddenUntilFound,
20622 ...restProps,
20623 children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
20624 Content,
20625 {
20626 className: style_default17["content-inner"],
20627 render: render4,
20628 children
20629 }
20630 )
20631 }
20632 );
20633 }
20634 );
20635
20636 // packages/ui/build-module/stack/stack.mjs
20637 var import_element44 = __toESM(require_element(), 1);
20638 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash";
20639 function getRuntime19() {
20640 const globalScope = globalThis;
20641 if (globalScope.__wpStyleRuntime) {
20642 return globalScope.__wpStyleRuntime;
20643 }
20644 globalScope.__wpStyleRuntime = {
20645 documents: /* @__PURE__ */ new Map(),
20646 styles: /* @__PURE__ */ new Map(),
20647 injectedStyles: /* @__PURE__ */ new WeakMap()
20648 };
20649 if (typeof document !== "undefined") {
20650 registerDocument19(document);
20651 }
20652 return globalScope.__wpStyleRuntime;
20653 }
20654 function documentContainsStyleHash19(targetDocument, hash) {
20655 if (!targetDocument.head) {
20656 return false;
20657 }
20658 for (const style of targetDocument.head.querySelectorAll(
20659 `style[${STYLE_HASH_ATTRIBUTE19}]`
20660 )) {
20661 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) {
20662 return true;
20663 }
20664 }
20665 return false;
20666 }
20667 function injectStyle19(targetDocument, hash, css) {
20668 if (!targetDocument.head) {
20669 return;
20670 }
20671 const runtime = getRuntime19();
20672 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20673 if (!injectedStyles) {
20674 injectedStyles = /* @__PURE__ */ new Set();
20675 runtime.injectedStyles.set(targetDocument, injectedStyles);
20676 }
20677 if (injectedStyles.has(hash)) {
20678 return;
20679 }
20680 if (documentContainsStyleHash19(targetDocument, hash)) {
20681 injectedStyles.add(hash);
20682 return;
20683 }
20684 const style = targetDocument.createElement("style");
20685 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash);
20686 style.appendChild(targetDocument.createTextNode(css));
20687 targetDocument.head.appendChild(style);
20688 injectedStyles.add(hash);
20689 }
20690 function registerDocument19(targetDocument) {
20691 const runtime = getRuntime19();
20692 runtime.documents.set(
20693 targetDocument,
20694 (runtime.documents.get(targetDocument) ?? 0) + 1
20695 );
20696 for (const [hash, css] of runtime.styles) {
20697 injectStyle19(targetDocument, hash, css);
20698 }
20699 return () => {
20700 const count = runtime.documents.get(targetDocument);
20701 if (count === void 0) {
20702 return;
20703 }
20704 if (count <= 1) {
20705 runtime.documents.delete(targetDocument);
20706 return;
20707 }
20708 runtime.documents.set(targetDocument, count - 1);
20709 };
20710 }
20711 function registerStyle19(hash, css) {
20712 const runtime = getRuntime19();
20713 runtime.styles.set(hash, css);
20714 for (const targetDocument of runtime.documents.keys()) {
20715 injectStyle19(targetDocument, hash, css);
20716 }
20717 }
20718 if (typeof process === "undefined" || true) {
20719 registerStyle19("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}");
20720 }
20721 var style_default18 = { "stack": "_19ce0419607e1896__stack" };
20722 var gapTokens = {
20723 xs: "var(--wpds-dimension-gap-xs, 4px)",
20724 sm: "var(--wpds-dimension-gap-sm, 8px)",
20725 md: "var(--wpds-dimension-gap-md, 12px)",
20726 lg: "var(--wpds-dimension-gap-lg, 16px)",
20727 xl: "var(--wpds-dimension-gap-xl, 24px)",
20728 "2xl": "var(--wpds-dimension-gap-2xl, 32px)",
20729 "3xl": "var(--wpds-dimension-gap-3xl, 40px)"
20730 };
20731 var Stack = (0, import_element44.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) {
20732 const style = {
20733 gap: gap && gapTokens[gap],
20734 alignItems: align,
20735 justifyContent: justify,
20736 flexDirection: direction,
20737 flexWrap: wrap
20738 };
20739 const element = useRender({
20740 render: render4,
20741 ref,
20742 props: mergeProps(props, { style, className: style_default18.stack })
20743 });
20744 return element;
20745 });
20746
20747 // packages/ui/build-module/form/primitives/input/input.mjs
20748 var import_element47 = __toESM(require_element(), 1);
20749
20750 // packages/ui/build-module/form/primitives/input-layout/input-layout.mjs
20751 var import_element45 = __toESM(require_element(), 1);
20752 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1);
20753 var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash";
20754 function getRuntime20() {
20755 const globalScope = globalThis;
20756 if (globalScope.__wpStyleRuntime) {
20757 return globalScope.__wpStyleRuntime;
20758 }
20759 globalScope.__wpStyleRuntime = {
20760 documents: /* @__PURE__ */ new Map(),
20761 styles: /* @__PURE__ */ new Map(),
20762 injectedStyles: /* @__PURE__ */ new WeakMap()
20763 };
20764 if (typeof document !== "undefined") {
20765 registerDocument20(document);
20766 }
20767 return globalScope.__wpStyleRuntime;
20768 }
20769 function documentContainsStyleHash20(targetDocument, hash) {
20770 if (!targetDocument.head) {
20771 return false;
20772 }
20773 for (const style of targetDocument.head.querySelectorAll(
20774 `style[${STYLE_HASH_ATTRIBUTE20}]`
20775 )) {
20776 if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) {
20777 return true;
20778 }
20779 }
20780 return false;
20781 }
20782 function injectStyle20(targetDocument, hash, css) {
20783 if (!targetDocument.head) {
20784 return;
20785 }
20786 const runtime = getRuntime20();
20787 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20788 if (!injectedStyles) {
20789 injectedStyles = /* @__PURE__ */ new Set();
20790 runtime.injectedStyles.set(targetDocument, injectedStyles);
20791 }
20792 if (injectedStyles.has(hash)) {
20793 return;
20794 }
20795 if (documentContainsStyleHash20(targetDocument, hash)) {
20796 injectedStyles.add(hash);
20797 return;
20798 }
20799 const style = targetDocument.createElement("style");
20800 style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash);
20801 style.appendChild(targetDocument.createTextNode(css));
20802 targetDocument.head.appendChild(style);
20803 injectedStyles.add(hash);
20804 }
20805 function registerDocument20(targetDocument) {
20806 const runtime = getRuntime20();
20807 runtime.documents.set(
20808 targetDocument,
20809 (runtime.documents.get(targetDocument) ?? 0) + 1
20810 );
20811 for (const [hash, css] of runtime.styles) {
20812 injectStyle20(targetDocument, hash, css);
20813 }
20814 return () => {
20815 const count = runtime.documents.get(targetDocument);
20816 if (count === void 0) {
20817 return;
20818 }
20819 if (count <= 1) {
20820 runtime.documents.delete(targetDocument);
20821 return;
20822 }
20823 runtime.documents.set(targetDocument, count - 1);
20824 };
20825 }
20826 function registerStyle20(hash, css) {
20827 const runtime = getRuntime20();
20828 runtime.styles.set(hash, css);
20829 for (const targetDocument of runtime.documents.keys()) {
20830 injectStyle20(targetDocument, hash, css);
20831 }
20832 }
20833 if (typeof process === "undefined" || true) {
20834 registerStyle20("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
20835 }
20836 var global_css_defense_default6 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
20837 if (typeof process === "undefined" || true) {
20838 registerStyle20("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
20839 }
20840 var resets_default6 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
20841 if (typeof process === "undefined" || true) {
20842 registerStyle20("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}');
20843 }
20844 var style_default19 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" };
20845 var InputLayout = (0, import_element45.forwardRef)(
20846 function InputLayout2({
20847 className,
20848 children,
20849 visuallyDisabled,
20850 size: size4 = "default",
20851 isBorderless,
20852 prefix,
20853 suffix,
20854 ...restProps
20855 }, ref) {
20856 return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
20857 "div",
20858 {
20859 ref,
20860 className: clsx_default(
20861 global_css_defense_default6.div,
20862 resets_default6["box-sizing"],
20863 style_default19["input-layout"],
20864 style_default19[`is-size-${size4}`],
20865 visuallyDisabled && style_default19["is-disabled"],
20866 isBorderless && style_default19["is-borderless"],
20867 className
20868 ),
20869 ...restProps,
20870 children: [
20871 import_element45.Children.count(prefix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
20872 "div",
20873 {
20874 className: style_default19["slot-wrapper"],
20875 "data-slot-type": "prefix",
20876 children: prefix
20877 }
20878 ),
20879 children,
20880 import_element45.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
20881 "div",
20882 {
20883 className: style_default19["slot-wrapper"],
20884 "data-slot-type": "suffix",
20885 children: suffix
20886 }
20887 )
20888 ]
20889 }
20890 );
20891 }
20892 );
20893
20894 // packages/ui/build-module/form/primitives/input-layout/slot.mjs
20895 var import_element46 = __toESM(require_element(), 1);
20896 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
20897 var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash";
20898 function getRuntime21() {
20899 const globalScope = globalThis;
20900 if (globalScope.__wpStyleRuntime) {
20901 return globalScope.__wpStyleRuntime;
20902 }
20903 globalScope.__wpStyleRuntime = {
20904 documents: /* @__PURE__ */ new Map(),
20905 styles: /* @__PURE__ */ new Map(),
20906 injectedStyles: /* @__PURE__ */ new WeakMap()
20907 };
20908 if (typeof document !== "undefined") {
20909 registerDocument21(document);
20910 }
20911 return globalScope.__wpStyleRuntime;
20912 }
20913 function documentContainsStyleHash21(targetDocument, hash) {
20914 if (!targetDocument.head) {
20915 return false;
20916 }
20917 for (const style of targetDocument.head.querySelectorAll(
20918 `style[${STYLE_HASH_ATTRIBUTE21}]`
20919 )) {
20920 if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) {
20921 return true;
20922 }
20923 }
20924 return false;
20925 }
20926 function injectStyle21(targetDocument, hash, css) {
20927 if (!targetDocument.head) {
20928 return;
20929 }
20930 const runtime = getRuntime21();
20931 let injectedStyles = runtime.injectedStyles.get(targetDocument);
20932 if (!injectedStyles) {
20933 injectedStyles = /* @__PURE__ */ new Set();
20934 runtime.injectedStyles.set(targetDocument, injectedStyles);
20935 }
20936 if (injectedStyles.has(hash)) {
20937 return;
20938 }
20939 if (documentContainsStyleHash21(targetDocument, hash)) {
20940 injectedStyles.add(hash);
20941 return;
20942 }
20943 const style = targetDocument.createElement("style");
20944 style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash);
20945 style.appendChild(targetDocument.createTextNode(css));
20946 targetDocument.head.appendChild(style);
20947 injectedStyles.add(hash);
20948 }
20949 function registerDocument21(targetDocument) {
20950 const runtime = getRuntime21();
20951 runtime.documents.set(
20952 targetDocument,
20953 (runtime.documents.get(targetDocument) ?? 0) + 1
20954 );
20955 for (const [hash, css] of runtime.styles) {
20956 injectStyle21(targetDocument, hash, css);
20957 }
20958 return () => {
20959 const count = runtime.documents.get(targetDocument);
20960 if (count === void 0) {
20961 return;
20962 }
20963 if (count <= 1) {
20964 runtime.documents.delete(targetDocument);
20965 return;
20966 }
20967 runtime.documents.set(targetDocument, count - 1);
20968 };
20969 }
20970 function registerStyle21(hash, css) {
20971 const runtime = getRuntime21();
20972 runtime.styles.set(hash, css);
20973 for (const targetDocument of runtime.documents.keys()) {
20974 injectStyle21(targetDocument, hash, css);
20975 }
20976 }
20977 if (typeof process === "undefined" || true) {
20978 registerStyle21("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}');
20979 }
20980 var style_default20 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" };
20981 var InputLayoutSlot = (0, import_element46.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) {
20982 return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
20983 "div",
20984 {
20985 ref,
20986 className: clsx_default(
20987 style_default20["input-layout-slot"],
20988 style_default20[`is-padding-${padding}`],
20989 className
20990 ),
20991 ...restProps
20992 }
20993 );
20994 });
20995 InputLayoutSlot.displayName = "InputLayout.Slot";
20996
20997 // packages/ui/build-module/form/primitives/input-layout/index.mjs
20998 var InputLayout3 = Object.assign(InputLayout, {
20999 Slot: InputLayoutSlot
21000 });
21001
21002 // packages/ui/build-module/form/primitives/input/input.mjs
21003 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
21004 var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash";
21005 function getRuntime22() {
21006 const globalScope = globalThis;
21007 if (globalScope.__wpStyleRuntime) {
21008 return globalScope.__wpStyleRuntime;
21009 }
21010 globalScope.__wpStyleRuntime = {
21011 documents: /* @__PURE__ */ new Map(),
21012 styles: /* @__PURE__ */ new Map(),
21013 injectedStyles: /* @__PURE__ */ new WeakMap()
21014 };
21015 if (typeof document !== "undefined") {
21016 registerDocument22(document);
21017 }
21018 return globalScope.__wpStyleRuntime;
21019 }
21020 function documentContainsStyleHash22(targetDocument, hash) {
21021 if (!targetDocument.head) {
21022 return false;
21023 }
21024 for (const style of targetDocument.head.querySelectorAll(
21025 `style[${STYLE_HASH_ATTRIBUTE22}]`
21026 )) {
21027 if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) {
21028 return true;
21029 }
21030 }
21031 return false;
21032 }
21033 function injectStyle22(targetDocument, hash, css) {
21034 if (!targetDocument.head) {
21035 return;
21036 }
21037 const runtime = getRuntime22();
21038 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21039 if (!injectedStyles) {
21040 injectedStyles = /* @__PURE__ */ new Set();
21041 runtime.injectedStyles.set(targetDocument, injectedStyles);
21042 }
21043 if (injectedStyles.has(hash)) {
21044 return;
21045 }
21046 if (documentContainsStyleHash22(targetDocument, hash)) {
21047 injectedStyles.add(hash);
21048 return;
21049 }
21050 const style = targetDocument.createElement("style");
21051 style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash);
21052 style.appendChild(targetDocument.createTextNode(css));
21053 targetDocument.head.appendChild(style);
21054 injectedStyles.add(hash);
21055 }
21056 function registerDocument22(targetDocument) {
21057 const runtime = getRuntime22();
21058 runtime.documents.set(
21059 targetDocument,
21060 (runtime.documents.get(targetDocument) ?? 0) + 1
21061 );
21062 for (const [hash, css] of runtime.styles) {
21063 injectStyle22(targetDocument, hash, css);
21064 }
21065 return () => {
21066 const count = runtime.documents.get(targetDocument);
21067 if (count === void 0) {
21068 return;
21069 }
21070 if (count <= 1) {
21071 runtime.documents.delete(targetDocument);
21072 return;
21073 }
21074 runtime.documents.set(targetDocument, count - 1);
21075 };
21076 }
21077 function registerStyle22(hash, css) {
21078 const runtime = getRuntime22();
21079 runtime.styles.set(hash, css);
21080 for (const targetDocument of runtime.documents.keys()) {
21081 injectStyle22(targetDocument, hash, css);
21082 }
21083 }
21084 if (typeof process === "undefined" || true) {
21085 registerStyle22("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
21086 }
21087 var global_css_defense_default7 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
21088 if (typeof process === "undefined" || true) {
21089 registerStyle22("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}");
21090 }
21091 var focus_module_default5 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" };
21092 if (typeof process === "undefined" || true) {
21093 registerStyle22("1a25f6a232", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2ae7be2fc1bb17a3__input{--_gcd-input-padding:var(--wp-ui-input-padding-block,0px) var(--wp-ui-input-layout-padding-inline,0px);background:transparent;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:inherit;font-size:inherit;line-height:inherit;outline:none;padding-block:var(--wp-ui-input-padding-block,0);padding-inline:var(--wp-ui-input-layout-padding-inline,0);width:100%;&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}&:disabled,&[aria-disabled=true]{--_gcd-input-placeholder-color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}@media (forced-colors:active){color:GrayText}}&[type=email],&[type=url]{direction:ltr}&[type=number]{appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0}}}}}");
21094 }
21095 var style_default21 = { "input": "_2ae7be2fc1bb17a3__input" };
21096 var Input3 = (0, import_element47.forwardRef)(function Input22({ className, size: size4 = "default", prefix, suffix, style, ...restProps }, ref) {
21097 return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
21098 InputLayout3,
21099 {
21100 className: clsx_default(
21101 focus_module_default5["outset-ring--focus-within"],
21102 className
21103 ),
21104 style,
21105 size: size4,
21106 visuallyDisabled: restProps.disabled,
21107 prefix,
21108 suffix,
21109 children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
21110 Input,
21111 {
21112 ref,
21113 className: clsx_default(global_css_defense_default7.input, style_default21.input),
21114 ...restProps
21115 }
21116 )
21117 }
21118 );
21119 });
21120
21121 // packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs
21122 var import_i18n7 = __toESM(require_i18n(), 1);
21123 var import_element49 = __toESM(require_element(), 1);
21124
21125 // packages/ui/build-module/spinner/spinner.mjs
21126 var import_element48 = __toESM(require_element(), 1);
21127 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
21128 var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash";
21129 function getRuntime23() {
21130 const globalScope = globalThis;
21131 if (globalScope.__wpStyleRuntime) {
21132 return globalScope.__wpStyleRuntime;
21133 }
21134 globalScope.__wpStyleRuntime = {
21135 documents: /* @__PURE__ */ new Map(),
21136 styles: /* @__PURE__ */ new Map(),
21137 injectedStyles: /* @__PURE__ */ new WeakMap()
21138 };
21139 if (typeof document !== "undefined") {
21140 registerDocument23(document);
21141 }
21142 return globalScope.__wpStyleRuntime;
21143 }
21144 function documentContainsStyleHash23(targetDocument, hash) {
21145 if (!targetDocument.head) {
21146 return false;
21147 }
21148 for (const style of targetDocument.head.querySelectorAll(
21149 `style[${STYLE_HASH_ATTRIBUTE23}]`
21150 )) {
21151 if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) {
21152 return true;
21153 }
21154 }
21155 return false;
21156 }
21157 function injectStyle23(targetDocument, hash, css) {
21158 if (!targetDocument.head) {
21159 return;
21160 }
21161 const runtime = getRuntime23();
21162 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21163 if (!injectedStyles) {
21164 injectedStyles = /* @__PURE__ */ new Set();
21165 runtime.injectedStyles.set(targetDocument, injectedStyles);
21166 }
21167 if (injectedStyles.has(hash)) {
21168 return;
21169 }
21170 if (documentContainsStyleHash23(targetDocument, hash)) {
21171 injectedStyles.add(hash);
21172 return;
21173 }
21174 const style = targetDocument.createElement("style");
21175 style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash);
21176 style.appendChild(targetDocument.createTextNode(css));
21177 targetDocument.head.appendChild(style);
21178 injectedStyles.add(hash);
21179 }
21180 function registerDocument23(targetDocument) {
21181 const runtime = getRuntime23();
21182 runtime.documents.set(
21183 targetDocument,
21184 (runtime.documents.get(targetDocument) ?? 0) + 1
21185 );
21186 for (const [hash, css] of runtime.styles) {
21187 injectStyle23(targetDocument, hash, css);
21188 }
21189 return () => {
21190 const count = runtime.documents.get(targetDocument);
21191 if (count === void 0) {
21192 return;
21193 }
21194 if (count <= 1) {
21195 runtime.documents.delete(targetDocument);
21196 return;
21197 }
21198 runtime.documents.set(targetDocument, count - 1);
21199 };
21200 }
21201 function registerStyle23(hash, css) {
21202 const runtime = getRuntime23();
21203 runtime.styles.set(hash, css);
21204 for (const targetDocument of runtime.documents.keys()) {
21205 injectStyle23(targetDocument, hash, css);
21206 }
21207 }
21208 if (typeof process === "undefined" || true) {
21209 registerStyle23("bbbecfe373", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.ab4d64c07c0ba587__spinner{background-color:transparent;display:inline-block;height:var(--wpds-dimension-size-2xs,16px);opacity:1;overflow:visible;position:relative;width:var(--wpds-dimension-size-2xs,16px)}.a7654e10245bb7d2__indicator,.dc51f80c84b35fe2__track{fill:transparent;stroke-width:1.5px}.dc51f80c84b35fe2__track{stroke:var(--wpds-color-background-track-neutral,#dbdbdb)}.a7654e10245bb7d2__indicator{stroke:var(--wpds-color-background-thumb-brand,var(--wp-admin-theme-color,#3858e9));stroke-linecap:round;animation:_02322d973909703c__spinner-spin 1.4s linear infinite both;transform-origin:50% 50%}@keyframes _02322d973909703c__spinner-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}}}");
21210 }
21211 var style_default22 = { "spinner": "ab4d64c07c0ba587__spinner", "track": "dc51f80c84b35fe2__track", "indicator": "a7654e10245bb7d2__indicator", "spinner-spin": "_02322d973909703c__spinner-spin" };
21212 var Spinner = (0, import_element48.forwardRef)(
21213 function Spinner2({ className, ...props }, ref) {
21214 return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
21215 "svg",
21216 {
21217 className: clsx_default(style_default22.spinner, className),
21218 viewBox: "0 0 100 100",
21219 xmlns: "http://www.w3.org/2000/svg",
21220 role: "presentation",
21221 focusable: "false",
21222 ...props,
21223 ref,
21224 children: [
21225 /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
21226 "circle",
21227 {
21228 className: style_default22.track,
21229 cx: "50",
21230 cy: "50",
21231 r: "50",
21232 vectorEffect: "non-scaling-stroke"
21233 }
21234 ),
21235 /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
21236 "path",
21237 {
21238 className: style_default22.indicator,
21239 d: "m 50 0 a 50 50 0 0 1 50 50",
21240 vectorEffect: "non-scaling-stroke"
21241 }
21242 )
21243 ]
21244 }
21245 );
21246 }
21247 );
21248
21249 // packages/ui/build-module/form/primitives/validity-indicator/validity-indicator.mjs
21250 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
21251 var STYLE_HASH_ATTRIBUTE24 = "data-wp-hash";
21252 function getRuntime24() {
21253 const globalScope = globalThis;
21254 if (globalScope.__wpStyleRuntime) {
21255 return globalScope.__wpStyleRuntime;
21256 }
21257 globalScope.__wpStyleRuntime = {
21258 documents: /* @__PURE__ */ new Map(),
21259 styles: /* @__PURE__ */ new Map(),
21260 injectedStyles: /* @__PURE__ */ new WeakMap()
21261 };
21262 if (typeof document !== "undefined") {
21263 registerDocument24(document);
21264 }
21265 return globalScope.__wpStyleRuntime;
21266 }
21267 function documentContainsStyleHash24(targetDocument, hash) {
21268 if (!targetDocument.head) {
21269 return false;
21270 }
21271 for (const style of targetDocument.head.querySelectorAll(
21272 `style[${STYLE_HASH_ATTRIBUTE24}]`
21273 )) {
21274 if (style.getAttribute(STYLE_HASH_ATTRIBUTE24) === hash) {
21275 return true;
21276 }
21277 }
21278 return false;
21279 }
21280 function injectStyle24(targetDocument, hash, css) {
21281 if (!targetDocument.head) {
21282 return;
21283 }
21284 const runtime = getRuntime24();
21285 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21286 if (!injectedStyles) {
21287 injectedStyles = /* @__PURE__ */ new Set();
21288 runtime.injectedStyles.set(targetDocument, injectedStyles);
21289 }
21290 if (injectedStyles.has(hash)) {
21291 return;
21292 }
21293 if (documentContainsStyleHash24(targetDocument, hash)) {
21294 injectedStyles.add(hash);
21295 return;
21296 }
21297 const style = targetDocument.createElement("style");
21298 style.setAttribute(STYLE_HASH_ATTRIBUTE24, hash);
21299 style.appendChild(targetDocument.createTextNode(css));
21300 targetDocument.head.appendChild(style);
21301 injectedStyles.add(hash);
21302 }
21303 function registerDocument24(targetDocument) {
21304 const runtime = getRuntime24();
21305 runtime.documents.set(
21306 targetDocument,
21307 (runtime.documents.get(targetDocument) ?? 0) + 1
21308 );
21309 for (const [hash, css] of runtime.styles) {
21310 injectStyle24(targetDocument, hash, css);
21311 }
21312 return () => {
21313 const count = runtime.documents.get(targetDocument);
21314 if (count === void 0) {
21315 return;
21316 }
21317 if (count <= 1) {
21318 runtime.documents.delete(targetDocument);
21319 return;
21320 }
21321 runtime.documents.set(targetDocument, count - 1);
21322 };
21323 }
21324 function registerStyle24(hash, css) {
21325 const runtime = getRuntime24();
21326 runtime.styles.set(hash, css);
21327 for (const targetDocument of runtime.documents.keys()) {
21328 injectStyle24(targetDocument, hash, css);
21329 }
21330 }
21331 if (typeof process === "undefined" || true) {
21332 registerStyle24("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
21333 }
21334 var global_css_defense_default8 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
21335 if (typeof process === "undefined" || true) {
21336 registerStyle24("d11816833c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7a7ac88e306348e7__indicator{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);align-items:flex-start;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);gap:var(--wpds-dimension-gap-xs,4px);line-height:var(--wpds-typography-line-height-xs,16px);@media not (prefers-reduced-motion){animation:_48722cc5dd090ce4__indicator-jump var(--wpds-motion-duration-md,.2s) cubic-bezier(.68,-.55,.27,1.55)}}._57a3bbbfbe38a5c6__is-invalid{color:var(--wpds-color-foreground-content-error-weak,#cc1818)}._9e944dc198aac10b__is-valid{color:var(--wpds-color-foreground-content-success-weak,#008030)}.e482806667437c6a__indicator-icon{flex-shrink:0}._6e46434cc23019d2__indicator-spinner{height:var(--wpds-dimension-size-3xs,12px);margin:2px;width:var(--wpds-dimension-size-3xs,12px)}@keyframes _48722cc5dd090ce4__indicator-jump{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}}}');
21337 }
21338 var style_default23 = { "indicator": "_7a7ac88e306348e7__indicator", "indicator-jump": "_48722cc5dd090ce4__indicator-jump", "is-invalid": "_57a3bbbfbe38a5c6__is-invalid", "is-valid": "_9e944dc198aac10b__is-valid", "indicator-icon": "e482806667437c6a__indicator-icon", "indicator-spinner": "_6e46434cc23019d2__indicator-spinner" };
21339 var ICON = {
21340 valid: published_default,
21341 invalid: error_default
21342 };
21343 function ValidityIndicator({
21344 id,
21345 type,
21346 message: message2
21347 }) {
21348 return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
21349 "p",
21350 {
21351 id,
21352 className: clsx_default(
21353 global_css_defense_default8.p,
21354 style_default23.indicator,
21355 style_default23[`is-${type}`]
21356 ),
21357 children: [
21358 type === "validating" ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Spinner, { className: style_default23["indicator-spinner"] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
21359 Icon,
21360 {
21361 className: style_default23["indicator-icon"],
21362 icon: ICON[type],
21363 size: 16,
21364 fill: "currentColor"
21365 }
21366 ),
21367 message2
21368 ]
21369 }
21370 );
21371 }
21372
21373 // packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs
21374 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1);
21375 var DEFAULT_RENDER = (props) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Stack, { ...props, direction: "column", gap: "sm" });
21376 function appendRequiredIndicator(label, required, markWhenOptional) {
21377 let suffix;
21378 if (required && !markWhenOptional) {
21379 suffix = `(${(0, import_i18n7.__)("Required")})`;
21380 } else if (!required && markWhenOptional) {
21381 suffix = `(${(0, import_i18n7.__)("Optional")})`;
21382 }
21383 if (!suffix) {
21384 return label;
21385 }
21386 if (typeof label === "string") {
21387 return `${label} ${suffix}`;
21388 }
21389 return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
21390 label,
21391 " ",
21392 suffix
21393 ] });
21394 }
21395 var VALIDITY_VISIBLE_ATTRIBUTE = "data-validity-visible";
21396 var ControlWithError = (0, import_element49.forwardRef)(function ControlWithError2({
21397 required,
21398 markWhenOptional,
21399 customValidity,
21400 getValidityTarget,
21401 children,
21402 render: render4 = DEFAULT_RENDER,
21403 ...restProps
21404 }, forwardedRef) {
21405 const [errorMessage, setErrorMessage] = (0, import_element49.useState)();
21406 const [statusMessage, setStatusMessage] = (0, import_element49.useState)();
21407 const [showMessage, setShowMessage] = (0, import_element49.useState)(false);
21408 const [isTouched, setIsTouched] = (0, import_element49.useState)(false);
21409 const wrapperRef = (0, import_element49.useRef)(null);
21410 (0, import_element49.useEffect)(() => {
21411 const validityTarget = getValidityTarget();
21412 const handler = () => {
21413 if (customValidity?.type !== "validating") {
21414 setErrorMessage(validityTarget?.validationMessage);
21415 }
21416 setShowMessage(true);
21417 validityTarget?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, "");
21418 };
21419 validityTarget?.addEventListener("invalid", handler);
21420 return () => validityTarget?.removeEventListener("invalid", handler);
21421 }, [customValidity?.type, getValidityTarget]);
21422 (0, import_element49.useEffect)(() => {
21423 const validityTarget = getValidityTarget();
21424 const suppressNativePopover = (event) => {
21425 event.preventDefault();
21426 if (!event.isTrusted) {
21427 return;
21428 }
21429 const target = event.target;
21430 const firstErrorInForm = Array.from(
21431 target.form?.elements ?? []
21432 ).find((el) => !el.validity.valid);
21433 if (!target.form || firstErrorInForm === target) {
21434 target.focus();
21435 }
21436 };
21437 const radioSiblings = validityTarget?.type === "radio" && validityTarget?.name ? Array.from(
21438 wrapperRef.current?.querySelectorAll(
21439 `input[type="radio"][name="${validityTarget?.name}"]`
21440 ) ?? []
21441 ).filter((sibling) => sibling !== validityTarget) : [];
21442 validityTarget?.addEventListener("invalid", suppressNativePopover);
21443 radioSiblings.forEach(
21444 (sibling) => sibling.addEventListener("invalid", suppressNativePopover)
21445 );
21446 return () => {
21447 validityTarget?.removeEventListener(
21448 "invalid",
21449 suppressNativePopover
21450 );
21451 radioSiblings.forEach(
21452 (sibling) => sibling.removeEventListener("invalid", suppressNativePopover)
21453 );
21454 };
21455 }, [getValidityTarget]);
21456 (0, import_element49.useEffect)(() => {
21457 const validityTarget = getValidityTarget();
21458 if (!customValidity?.type) {
21459 validityTarget?.setCustomValidity("");
21460 setErrorMessage(validityTarget?.validationMessage);
21461 setStatusMessage(void 0);
21462 return;
21463 }
21464 switch (customValidity.type) {
21465 case "validating": {
21466 validityTarget?.setCustomValidity("");
21467 setErrorMessage(void 0);
21468 setStatusMessage({
21469 type: "validating",
21470 message: customValidity.message
21471 });
21472 break;
21473 }
21474 case "valid": {
21475 validityTarget?.setCustomValidity("");
21476 setErrorMessage(validityTarget?.validationMessage);
21477 setStatusMessage({
21478 type: "valid",
21479 message: customValidity.message
21480 });
21481 break;
21482 }
21483 case "invalid": {
21484 validityTarget?.setCustomValidity(
21485 customValidity.message ?? ""
21486 );
21487 setErrorMessage(validityTarget?.validationMessage);
21488 setStatusMessage(void 0);
21489 break;
21490 }
21491 }
21492 }, [customValidity, getValidityTarget]);
21493 (0, import_element49.useEffect)(() => {
21494 if (!isTouched || showMessage) {
21495 return;
21496 }
21497 if (customValidity?.type === "validating") {
21498 const timer = setTimeout(() => {
21499 setShowMessage(true);
21500 }, 1e3);
21501 return () => clearTimeout(timer);
21502 }
21503 setShowMessage(true);
21504 }, [isTouched, customValidity?.type, showMessage]);
21505 const onBlur = (event) => {
21506 if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
21507 return;
21508 }
21509 if (!isTouched) {
21510 setIsTouched(true);
21511 getValidityTarget()?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, "");
21512 }
21513 const validityTarget = getValidityTarget();
21514 const isValidating = customValidity?.type === "validating";
21515 window.queueMicrotask(() => {
21516 if (!isValidating) {
21517 setErrorMessage(validityTarget?.validationMessage);
21518 }
21519 });
21520 };
21521 const messageId = (0, import_element49.useId)();
21522 const message2 = (() => {
21523 if (errorMessage) {
21524 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
21525 ValidityIndicator,
21526 {
21527 id: messageId,
21528 type: "invalid",
21529 message: errorMessage
21530 }
21531 );
21532 }
21533 if (statusMessage?.type) {
21534 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
21535 ValidityIndicator,
21536 {
21537 id: messageId,
21538 type: statusMessage.type,
21539 message: statusMessage.message
21540 }
21541 );
21542 }
21543 return null;
21544 })();
21545 const visibleMessage = showMessage ? message2 : null;
21546 (0, import_element49.useEffect)(() => {
21547 const target = getValidityTarget();
21548 if (!target) {
21549 return;
21550 }
21551 function setDescribedBy(el, shouldAdd) {
21552 const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((id) => id && id !== messageId);
21553 if (shouldAdd) {
21554 ids.push(messageId);
21555 }
21556 if (ids.length) {
21557 el.setAttribute("aria-describedby", ids.join(" "));
21558 } else {
21559 el.removeAttribute("aria-describedby");
21560 }
21561 }
21562 setDescribedBy(target, !!visibleMessage);
21563 return () => setDescribedBy(target, false);
21564 }, [visibleMessage, messageId, getValidityTarget]);
21565 return useRender({
21566 render: render4,
21567 ref: [forwardedRef, wrapperRef],
21568 props: mergeProps(restProps, {
21569 onBlur,
21570 children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
21571 (0, import_element49.cloneElement)(children, {
21572 label: appendRequiredIndicator(
21573 children.props.label,
21574 required,
21575 markWhenOptional
21576 ),
21577 required
21578 }),
21579 visibleMessage
21580 ] })
21581 })
21582 });
21583 });
21584
21585 // packages/ui/build-module/form/primitives/field/index.mjs
21586 var field_exports = {};
21587 __export(field_exports, {
21588 Control: () => Control,
21589 Description: () => Description,
21590 Details: () => Details,
21591 Item: () => Item,
21592 Label: () => Label,
21593 Root: () => Root6,
21594 VisualLabel: () => VisualLabel
21595 });
21596
21597 // packages/ui/build-module/form/primitives/field/root.mjs
21598 var import_element50 = __toESM(require_element(), 1);
21599 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1);
21600 var STYLE_HASH_ATTRIBUTE25 = "data-wp-hash";
21601 function getRuntime25() {
21602 const globalScope = globalThis;
21603 if (globalScope.__wpStyleRuntime) {
21604 return globalScope.__wpStyleRuntime;
21605 }
21606 globalScope.__wpStyleRuntime = {
21607 documents: /* @__PURE__ */ new Map(),
21608 styles: /* @__PURE__ */ new Map(),
21609 injectedStyles: /* @__PURE__ */ new WeakMap()
21610 };
21611 if (typeof document !== "undefined") {
21612 registerDocument25(document);
21613 }
21614 return globalScope.__wpStyleRuntime;
21615 }
21616 function documentContainsStyleHash25(targetDocument, hash) {
21617 if (!targetDocument.head) {
21618 return false;
21619 }
21620 for (const style of targetDocument.head.querySelectorAll(
21621 `style[${STYLE_HASH_ATTRIBUTE25}]`
21622 )) {
21623 if (style.getAttribute(STYLE_HASH_ATTRIBUTE25) === hash) {
21624 return true;
21625 }
21626 }
21627 return false;
21628 }
21629 function injectStyle25(targetDocument, hash, css) {
21630 if (!targetDocument.head) {
21631 return;
21632 }
21633 const runtime = getRuntime25();
21634 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21635 if (!injectedStyles) {
21636 injectedStyles = /* @__PURE__ */ new Set();
21637 runtime.injectedStyles.set(targetDocument, injectedStyles);
21638 }
21639 if (injectedStyles.has(hash)) {
21640 return;
21641 }
21642 if (documentContainsStyleHash25(targetDocument, hash)) {
21643 injectedStyles.add(hash);
21644 return;
21645 }
21646 const style = targetDocument.createElement("style");
21647 style.setAttribute(STYLE_HASH_ATTRIBUTE25, hash);
21648 style.appendChild(targetDocument.createTextNode(css));
21649 targetDocument.head.appendChild(style);
21650 injectedStyles.add(hash);
21651 }
21652 function registerDocument25(targetDocument) {
21653 const runtime = getRuntime25();
21654 runtime.documents.set(
21655 targetDocument,
21656 (runtime.documents.get(targetDocument) ?? 0) + 1
21657 );
21658 for (const [hash, css] of runtime.styles) {
21659 injectStyle25(targetDocument, hash, css);
21660 }
21661 return () => {
21662 const count = runtime.documents.get(targetDocument);
21663 if (count === void 0) {
21664 return;
21665 }
21666 if (count <= 1) {
21667 runtime.documents.delete(targetDocument);
21668 return;
21669 }
21670 runtime.documents.set(targetDocument, count - 1);
21671 };
21672 }
21673 function registerStyle25(hash, css) {
21674 const runtime = getRuntime25();
21675 runtime.styles.set(hash, css);
21676 for (const targetDocument of runtime.documents.keys()) {
21677 injectStyle25(targetDocument, hash, css);
21678 }
21679 }
21680 if (typeof process === "undefined" || true) {
21681 registerStyle25("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}");
21682 }
21683 var resets_default7 = { "box-sizing": "_336cd3e4e743482f__box-sizing" };
21684 var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Stack, { ...props, direction: "column", gap: "sm" });
21685 var Root6 = (0, import_element50.forwardRef)(function Root22({ className, render: render4 = DEFAULT_RENDER2, ...restProps }, ref) {
21686 return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
21687 index_parts_exports2.Root,
21688 {
21689 ref,
21690 className: clsx_default(resets_default7["box-sizing"], className),
21691 render: render4,
21692 ...restProps
21693 }
21694 );
21695 });
21696
21697 // packages/ui/build-module/form/primitives/field/item.mjs
21698 var import_element51 = __toESM(require_element(), 1);
21699 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1);
21700 var Item = (0, import_element51.forwardRef)(function Item2(props, ref) {
21701 return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(index_parts_exports2.Item, { ref, ...props });
21702 });
21703
21704 // packages/ui/build-module/form/primitives/field/label.mjs
21705 var import_element52 = __toESM(require_element(), 1);
21706 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
21707 var STYLE_HASH_ATTRIBUTE26 = "data-wp-hash";
21708 function getRuntime26() {
21709 const globalScope = globalThis;
21710 if (globalScope.__wpStyleRuntime) {
21711 return globalScope.__wpStyleRuntime;
21712 }
21713 globalScope.__wpStyleRuntime = {
21714 documents: /* @__PURE__ */ new Map(),
21715 styles: /* @__PURE__ */ new Map(),
21716 injectedStyles: /* @__PURE__ */ new WeakMap()
21717 };
21718 if (typeof document !== "undefined") {
21719 registerDocument26(document);
21720 }
21721 return globalScope.__wpStyleRuntime;
21722 }
21723 function documentContainsStyleHash26(targetDocument, hash) {
21724 if (!targetDocument.head) {
21725 return false;
21726 }
21727 for (const style of targetDocument.head.querySelectorAll(
21728 `style[${STYLE_HASH_ATTRIBUTE26}]`
21729 )) {
21730 if (style.getAttribute(STYLE_HASH_ATTRIBUTE26) === hash) {
21731 return true;
21732 }
21733 }
21734 return false;
21735 }
21736 function injectStyle26(targetDocument, hash, css) {
21737 if (!targetDocument.head) {
21738 return;
21739 }
21740 const runtime = getRuntime26();
21741 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21742 if (!injectedStyles) {
21743 injectedStyles = /* @__PURE__ */ new Set();
21744 runtime.injectedStyles.set(targetDocument, injectedStyles);
21745 }
21746 if (injectedStyles.has(hash)) {
21747 return;
21748 }
21749 if (documentContainsStyleHash26(targetDocument, hash)) {
21750 injectedStyles.add(hash);
21751 return;
21752 }
21753 const style = targetDocument.createElement("style");
21754 style.setAttribute(STYLE_HASH_ATTRIBUTE26, hash);
21755 style.appendChild(targetDocument.createTextNode(css));
21756 targetDocument.head.appendChild(style);
21757 injectedStyles.add(hash);
21758 }
21759 function registerDocument26(targetDocument) {
21760 const runtime = getRuntime26();
21761 runtime.documents.set(
21762 targetDocument,
21763 (runtime.documents.get(targetDocument) ?? 0) + 1
21764 );
21765 for (const [hash, css] of runtime.styles) {
21766 injectStyle26(targetDocument, hash, css);
21767 }
21768 return () => {
21769 const count = runtime.documents.get(targetDocument);
21770 if (count === void 0) {
21771 return;
21772 }
21773 if (count <= 1) {
21774 runtime.documents.delete(targetDocument);
21775 return;
21776 }
21777 runtime.documents.set(targetDocument, count - 1);
21778 };
21779 }
21780 function registerStyle26(hash, css) {
21781 const runtime = getRuntime26();
21782 runtime.styles.set(hash, css);
21783 for (const targetDocument of runtime.documents.keys()) {
21784 injectStyle26(targetDocument, hash, css);
21785 }
21786 }
21787 if (typeof process === "undefined" || true) {
21788 registerStyle26("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
21789 }
21790 var field_default = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
21791 var Label = (0, import_element52.forwardRef)(
21792 function Label2({ className, hideFromVision, variant, ...restProps }, ref) {
21793 const label = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
21794 index_parts_exports2.Label,
21795 {
21796 ref,
21797 className: clsx_default(
21798 field_default.label,
21799 variant && field_default[`is-${variant}`],
21800 className
21801 ),
21802 ...restProps
21803 }
21804 );
21805 if (hideFromVision) {
21806 return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(VisuallyHidden, { render: label });
21807 }
21808 return label;
21809 }
21810 );
21811
21812 // packages/ui/build-module/form/primitives/field/description.mjs
21813 var import_element53 = __toESM(require_element(), 1);
21814 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
21815 var STYLE_HASH_ATTRIBUTE27 = "data-wp-hash";
21816 function getRuntime27() {
21817 const globalScope = globalThis;
21818 if (globalScope.__wpStyleRuntime) {
21819 return globalScope.__wpStyleRuntime;
21820 }
21821 globalScope.__wpStyleRuntime = {
21822 documents: /* @__PURE__ */ new Map(),
21823 styles: /* @__PURE__ */ new Map(),
21824 injectedStyles: /* @__PURE__ */ new WeakMap()
21825 };
21826 if (typeof document !== "undefined") {
21827 registerDocument27(document);
21828 }
21829 return globalScope.__wpStyleRuntime;
21830 }
21831 function documentContainsStyleHash27(targetDocument, hash) {
21832 if (!targetDocument.head) {
21833 return false;
21834 }
21835 for (const style of targetDocument.head.querySelectorAll(
21836 `style[${STYLE_HASH_ATTRIBUTE27}]`
21837 )) {
21838 if (style.getAttribute(STYLE_HASH_ATTRIBUTE27) === hash) {
21839 return true;
21840 }
21841 }
21842 return false;
21843 }
21844 function injectStyle27(targetDocument, hash, css) {
21845 if (!targetDocument.head) {
21846 return;
21847 }
21848 const runtime = getRuntime27();
21849 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21850 if (!injectedStyles) {
21851 injectedStyles = /* @__PURE__ */ new Set();
21852 runtime.injectedStyles.set(targetDocument, injectedStyles);
21853 }
21854 if (injectedStyles.has(hash)) {
21855 return;
21856 }
21857 if (documentContainsStyleHash27(targetDocument, hash)) {
21858 injectedStyles.add(hash);
21859 return;
21860 }
21861 const style = targetDocument.createElement("style");
21862 style.setAttribute(STYLE_HASH_ATTRIBUTE27, hash);
21863 style.appendChild(targetDocument.createTextNode(css));
21864 targetDocument.head.appendChild(style);
21865 injectedStyles.add(hash);
21866 }
21867 function registerDocument27(targetDocument) {
21868 const runtime = getRuntime27();
21869 runtime.documents.set(
21870 targetDocument,
21871 (runtime.documents.get(targetDocument) ?? 0) + 1
21872 );
21873 for (const [hash, css] of runtime.styles) {
21874 injectStyle27(targetDocument, hash, css);
21875 }
21876 return () => {
21877 const count = runtime.documents.get(targetDocument);
21878 if (count === void 0) {
21879 return;
21880 }
21881 if (count <= 1) {
21882 runtime.documents.delete(targetDocument);
21883 return;
21884 }
21885 runtime.documents.set(targetDocument, count - 1);
21886 };
21887 }
21888 function registerStyle27(hash, css) {
21889 const runtime = getRuntime27();
21890 runtime.styles.set(hash, css);
21891 for (const targetDocument of runtime.documents.keys()) {
21892 injectStyle27(targetDocument, hash, css);
21893 }
21894 }
21895 if (typeof process === "undefined" || true) {
21896 registerStyle27("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
21897 }
21898 var global_css_defense_default9 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
21899 if (typeof process === "undefined" || true) {
21900 registerStyle27("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
21901 }
21902 var field_default2 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
21903 var Description = (0, import_element53.forwardRef)(function Description2({ className, ...restProps }, ref) {
21904 return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
21905 index_parts_exports2.Description,
21906 {
21907 ref,
21908 className: clsx_default(
21909 global_css_defense_default9.p,
21910 field_default2.description,
21911 className
21912 ),
21913 ...restProps
21914 }
21915 );
21916 });
21917
21918 // packages/ui/build-module/form/primitives/field/details.mjs
21919 var import_element54 = __toESM(require_element(), 1);
21920 var import_i18n8 = __toESM(require_i18n(), 1);
21921 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
21922 var STYLE_HASH_ATTRIBUTE28 = "data-wp-hash";
21923 function getRuntime28() {
21924 const globalScope = globalThis;
21925 if (globalScope.__wpStyleRuntime) {
21926 return globalScope.__wpStyleRuntime;
21927 }
21928 globalScope.__wpStyleRuntime = {
21929 documents: /* @__PURE__ */ new Map(),
21930 styles: /* @__PURE__ */ new Map(),
21931 injectedStyles: /* @__PURE__ */ new WeakMap()
21932 };
21933 if (typeof document !== "undefined") {
21934 registerDocument28(document);
21935 }
21936 return globalScope.__wpStyleRuntime;
21937 }
21938 function documentContainsStyleHash28(targetDocument, hash) {
21939 if (!targetDocument.head) {
21940 return false;
21941 }
21942 for (const style of targetDocument.head.querySelectorAll(
21943 `style[${STYLE_HASH_ATTRIBUTE28}]`
21944 )) {
21945 if (style.getAttribute(STYLE_HASH_ATTRIBUTE28) === hash) {
21946 return true;
21947 }
21948 }
21949 return false;
21950 }
21951 function injectStyle28(targetDocument, hash, css) {
21952 if (!targetDocument.head) {
21953 return;
21954 }
21955 const runtime = getRuntime28();
21956 let injectedStyles = runtime.injectedStyles.get(targetDocument);
21957 if (!injectedStyles) {
21958 injectedStyles = /* @__PURE__ */ new Set();
21959 runtime.injectedStyles.set(targetDocument, injectedStyles);
21960 }
21961 if (injectedStyles.has(hash)) {
21962 return;
21963 }
21964 if (documentContainsStyleHash28(targetDocument, hash)) {
21965 injectedStyles.add(hash);
21966 return;
21967 }
21968 const style = targetDocument.createElement("style");
21969 style.setAttribute(STYLE_HASH_ATTRIBUTE28, hash);
21970 style.appendChild(targetDocument.createTextNode(css));
21971 targetDocument.head.appendChild(style);
21972 injectedStyles.add(hash);
21973 }
21974 function registerDocument28(targetDocument) {
21975 const runtime = getRuntime28();
21976 runtime.documents.set(
21977 targetDocument,
21978 (runtime.documents.get(targetDocument) ?? 0) + 1
21979 );
21980 for (const [hash, css] of runtime.styles) {
21981 injectStyle28(targetDocument, hash, css);
21982 }
21983 return () => {
21984 const count = runtime.documents.get(targetDocument);
21985 if (count === void 0) {
21986 return;
21987 }
21988 if (count <= 1) {
21989 runtime.documents.delete(targetDocument);
21990 return;
21991 }
21992 runtime.documents.set(targetDocument, count - 1);
21993 };
21994 }
21995 function registerStyle28(hash, css) {
21996 const runtime = getRuntime28();
21997 runtime.styles.set(hash, css);
21998 for (const targetDocument of runtime.documents.keys()) {
21999 injectStyle28(targetDocument, hash, css);
22000 }
22001 }
22002 if (typeof process === "undefined" || true) {
22003 registerStyle28("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
22004 }
22005 var field_default3 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
22006 var Details = (0, import_element54.forwardRef)(
22007 function Details2({ className, ...restProps }, ref) {
22008 return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
22009 /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(index_parts_exports2.Description, {}), children: (0, import_i18n8.__)("More details follow the field.") }),
22010 /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
22011 "div",
22012 {
22013 ref,
22014 className: clsx_default(field_default3.description, className),
22015 ...restProps
22016 }
22017 )
22018 ] });
22019 }
22020 );
22021
22022 // packages/ui/build-module/form/primitives/field/control.mjs
22023 var import_element55 = __toESM(require_element(), 1);
22024 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
22025 var Control = (0, import_element55.forwardRef)(
22026 function Control2(props, ref) {
22027 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(index_parts_exports2.Control, { ref, ...props });
22028 }
22029 );
22030
22031 // packages/ui/build-module/form/primitives/field/visual-label.mjs
22032 var import_element56 = __toESM(require_element(), 1);
22033 var STYLE_HASH_ATTRIBUTE29 = "data-wp-hash";
22034 function getRuntime29() {
22035 const globalScope = globalThis;
22036 if (globalScope.__wpStyleRuntime) {
22037 return globalScope.__wpStyleRuntime;
22038 }
22039 globalScope.__wpStyleRuntime = {
22040 documents: /* @__PURE__ */ new Map(),
22041 styles: /* @__PURE__ */ new Map(),
22042 injectedStyles: /* @__PURE__ */ new WeakMap()
22043 };
22044 if (typeof document !== "undefined") {
22045 registerDocument29(document);
22046 }
22047 return globalScope.__wpStyleRuntime;
22048 }
22049 function documentContainsStyleHash29(targetDocument, hash) {
22050 if (!targetDocument.head) {
22051 return false;
22052 }
22053 for (const style of targetDocument.head.querySelectorAll(
22054 `style[${STYLE_HASH_ATTRIBUTE29}]`
22055 )) {
22056 if (style.getAttribute(STYLE_HASH_ATTRIBUTE29) === hash) {
22057 return true;
22058 }
22059 }
22060 return false;
22061 }
22062 function injectStyle29(targetDocument, hash, css) {
22063 if (!targetDocument.head) {
22064 return;
22065 }
22066 const runtime = getRuntime29();
22067 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22068 if (!injectedStyles) {
22069 injectedStyles = /* @__PURE__ */ new Set();
22070 runtime.injectedStyles.set(targetDocument, injectedStyles);
22071 }
22072 if (injectedStyles.has(hash)) {
22073 return;
22074 }
22075 if (documentContainsStyleHash29(targetDocument, hash)) {
22076 injectedStyles.add(hash);
22077 return;
22078 }
22079 const style = targetDocument.createElement("style");
22080 style.setAttribute(STYLE_HASH_ATTRIBUTE29, hash);
22081 style.appendChild(targetDocument.createTextNode(css));
22082 targetDocument.head.appendChild(style);
22083 injectedStyles.add(hash);
22084 }
22085 function registerDocument29(targetDocument) {
22086 const runtime = getRuntime29();
22087 runtime.documents.set(
22088 targetDocument,
22089 (runtime.documents.get(targetDocument) ?? 0) + 1
22090 );
22091 for (const [hash, css] of runtime.styles) {
22092 injectStyle29(targetDocument, hash, css);
22093 }
22094 return () => {
22095 const count = runtime.documents.get(targetDocument);
22096 if (count === void 0) {
22097 return;
22098 }
22099 if (count <= 1) {
22100 runtime.documents.delete(targetDocument);
22101 return;
22102 }
22103 runtime.documents.set(targetDocument, count - 1);
22104 };
22105 }
22106 function registerStyle29(hash, css) {
22107 const runtime = getRuntime29();
22108 runtime.styles.set(hash, css);
22109 for (const targetDocument of runtime.documents.keys()) {
22110 injectStyle29(targetDocument, hash, css);
22111 }
22112 }
22113 if (typeof process === "undefined" || true) {
22114 registerStyle29("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}');
22115 }
22116 var field_default4 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" };
22117 var VisualLabel = (0, import_element56.forwardRef)(
22118 function VisualLabel2({ className, render: render4, variant, ...restProps }, ref) {
22119 return useRender({
22120 defaultTagName: "span",
22121 render: render4,
22122 ref,
22123 props: mergeProps(restProps, {
22124 className: clsx_default(
22125 field_default4.label,
22126 variant && field_default4[`is-${variant}`],
22127 className
22128 )
22129 })
22130 });
22131 }
22132 );
22133 VisualLabel.displayName = "Field.VisualLabel";
22134
22135 // packages/ui/build-module/form/primitives/textarea/textarea.mjs
22136 var import_element57 = __toESM(require_element(), 1);
22137 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1);
22138 var STYLE_HASH_ATTRIBUTE30 = "data-wp-hash";
22139 function getRuntime30() {
22140 const globalScope = globalThis;
22141 if (globalScope.__wpStyleRuntime) {
22142 return globalScope.__wpStyleRuntime;
22143 }
22144 globalScope.__wpStyleRuntime = {
22145 documents: /* @__PURE__ */ new Map(),
22146 styles: /* @__PURE__ */ new Map(),
22147 injectedStyles: /* @__PURE__ */ new WeakMap()
22148 };
22149 if (typeof document !== "undefined") {
22150 registerDocument30(document);
22151 }
22152 return globalScope.__wpStyleRuntime;
22153 }
22154 function documentContainsStyleHash30(targetDocument, hash) {
22155 if (!targetDocument.head) {
22156 return false;
22157 }
22158 for (const style of targetDocument.head.querySelectorAll(
22159 `style[${STYLE_HASH_ATTRIBUTE30}]`
22160 )) {
22161 if (style.getAttribute(STYLE_HASH_ATTRIBUTE30) === hash) {
22162 return true;
22163 }
22164 }
22165 return false;
22166 }
22167 function injectStyle30(targetDocument, hash, css) {
22168 if (!targetDocument.head) {
22169 return;
22170 }
22171 const runtime = getRuntime30();
22172 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22173 if (!injectedStyles) {
22174 injectedStyles = /* @__PURE__ */ new Set();
22175 runtime.injectedStyles.set(targetDocument, injectedStyles);
22176 }
22177 if (injectedStyles.has(hash)) {
22178 return;
22179 }
22180 if (documentContainsStyleHash30(targetDocument, hash)) {
22181 injectedStyles.add(hash);
22182 return;
22183 }
22184 const style = targetDocument.createElement("style");
22185 style.setAttribute(STYLE_HASH_ATTRIBUTE30, hash);
22186 style.appendChild(targetDocument.createTextNode(css));
22187 targetDocument.head.appendChild(style);
22188 injectedStyles.add(hash);
22189 }
22190 function registerDocument30(targetDocument) {
22191 const runtime = getRuntime30();
22192 runtime.documents.set(
22193 targetDocument,
22194 (runtime.documents.get(targetDocument) ?? 0) + 1
22195 );
22196 for (const [hash, css] of runtime.styles) {
22197 injectStyle30(targetDocument, hash, css);
22198 }
22199 return () => {
22200 const count = runtime.documents.get(targetDocument);
22201 if (count === void 0) {
22202 return;
22203 }
22204 if (count <= 1) {
22205 runtime.documents.delete(targetDocument);
22206 return;
22207 }
22208 runtime.documents.set(targetDocument, count - 1);
22209 };
22210 }
22211 function registerStyle30(hash, css) {
22212 const runtime = getRuntime30();
22213 runtime.styles.set(hash, css);
22214 for (const targetDocument of runtime.documents.keys()) {
22215 injectStyle30(targetDocument, hash, css);
22216 }
22217 }
22218 if (typeof process === "undefined" || true) {
22219 registerStyle30("1540cbc709", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._1e441c22c9dc5d28__wrapper{--wp-ui-textarea-min-height:var(--wpds-dimension-size-lg,40px)}._414844876c32ecee__textarea{min-height:calc(var(--wp-ui-textarea-min-height) - 2px);resize:block}}@layer compositions{._1e441c22c9dc5d28__wrapper{--wp-ui-input-padding-block:9.9px;height:auto;line-height:1.4}}}");
22220 }
22221 var style_default24 = { "wrapper": "_1e441c22c9dc5d28__wrapper", "textarea": "_414844876c32ecee__textarea" };
22222 if (typeof process === "undefined" || true) {
22223 registerStyle30("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}");
22224 }
22225 var global_css_defense_default10 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" };
22226 var wrappedRender = (render4, restProps) => {
22227 return function textareaRender(props) {
22228 return typeof render4 === "function" ? render4(mergeProps(props, restProps)) : (0, import_element57.cloneElement)(render4, mergeProps(props, restProps));
22229 };
22230 };
22231 var Textarea = (0, import_element57.forwardRef)(
22232 function Textarea2({
22233 className,
22234 defaultValue,
22235 disabled: disabled2,
22236 onValueChange,
22237 render: render4,
22238 rows = 4,
22239 style,
22240 value,
22241 ...restProps
22242 }, ref) {
22243 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
22244 Input3,
22245 {
22246 className: clsx_default(style_default24.wrapper, className),
22247 style,
22248 render: wrappedRender(
22249 render4 || ((props) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("textarea", { ...props })),
22250 {
22251 className: clsx_default(
22252 global_css_defense_default10.textarea,
22253 style_default24.textarea
22254 ),
22255 ref,
22256 rows,
22257 ...restProps
22258 }
22259 ),
22260 value,
22261 defaultValue,
22262 onValueChange,
22263 disabled: disabled2
22264 }
22265 );
22266 }
22267 );
22268
22269 // packages/ui/build-module/form/input-control/input-control.mjs
22270 var import_element58 = __toESM(require_element(), 1);
22271 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1);
22272 var STYLE_HASH_ATTRIBUTE31 = "data-wp-hash";
22273 function getRuntime31() {
22274 const globalScope = globalThis;
22275 if (globalScope.__wpStyleRuntime) {
22276 return globalScope.__wpStyleRuntime;
22277 }
22278 globalScope.__wpStyleRuntime = {
22279 documents: /* @__PURE__ */ new Map(),
22280 styles: /* @__PURE__ */ new Map(),
22281 injectedStyles: /* @__PURE__ */ new WeakMap()
22282 };
22283 if (typeof document !== "undefined") {
22284 registerDocument31(document);
22285 }
22286 return globalScope.__wpStyleRuntime;
22287 }
22288 function documentContainsStyleHash31(targetDocument, hash) {
22289 if (!targetDocument.head) {
22290 return false;
22291 }
22292 for (const style of targetDocument.head.querySelectorAll(
22293 `style[${STYLE_HASH_ATTRIBUTE31}]`
22294 )) {
22295 if (style.getAttribute(STYLE_HASH_ATTRIBUTE31) === hash) {
22296 return true;
22297 }
22298 }
22299 return false;
22300 }
22301 function injectStyle31(targetDocument, hash, css) {
22302 if (!targetDocument.head) {
22303 return;
22304 }
22305 const runtime = getRuntime31();
22306 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22307 if (!injectedStyles) {
22308 injectedStyles = /* @__PURE__ */ new Set();
22309 runtime.injectedStyles.set(targetDocument, injectedStyles);
22310 }
22311 if (injectedStyles.has(hash)) {
22312 return;
22313 }
22314 if (documentContainsStyleHash31(targetDocument, hash)) {
22315 injectedStyles.add(hash);
22316 return;
22317 }
22318 const style = targetDocument.createElement("style");
22319 style.setAttribute(STYLE_HASH_ATTRIBUTE31, hash);
22320 style.appendChild(targetDocument.createTextNode(css));
22321 targetDocument.head.appendChild(style);
22322 injectedStyles.add(hash);
22323 }
22324 function registerDocument31(targetDocument) {
22325 const runtime = getRuntime31();
22326 runtime.documents.set(
22327 targetDocument,
22328 (runtime.documents.get(targetDocument) ?? 0) + 1
22329 );
22330 for (const [hash, css] of runtime.styles) {
22331 injectStyle31(targetDocument, hash, css);
22332 }
22333 return () => {
22334 const count = runtime.documents.get(targetDocument);
22335 if (count === void 0) {
22336 return;
22337 }
22338 if (count <= 1) {
22339 runtime.documents.delete(targetDocument);
22340 return;
22341 }
22342 runtime.documents.set(targetDocument, count - 1);
22343 };
22344 }
22345 function registerStyle31(hash, css) {
22346 const runtime = getRuntime31();
22347 runtime.styles.set(hash, css);
22348 for (const targetDocument of runtime.documents.keys()) {
22349 injectStyle31(targetDocument, hash, css);
22350 }
22351 }
22352 if (typeof process === "undefined" || true) {
22353 registerStyle31("0c752c3d08", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.a9211a7e6af24bed__root input[type=date]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=datetime-local]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=time]:not([data-filled]):not(:focus){--_gcd-input-color:transparent;--_gcd-input-color-disabled:transparent;color:transparent;&:disabled::-webkit-datetime-edit-text{color:transparent}}}}}");
22354 }
22355 var style_default25 = { "root": "a9211a7e6af24bed__root" };
22356 var InputControl = (0, import_element58.forwardRef)(
22357 function InputControl2({
22358 className,
22359 label,
22360 description,
22361 details,
22362 hideLabelFromVision,
22363 ...restProps
22364 }, ref) {
22365 return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(field_exports.Root, { className: clsx_default(style_default25.root, className), children: [
22366 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }),
22367 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Input3, { ref, ...restProps }),
22368 description && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(field_exports.Description, { children: description }),
22369 details && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(field_exports.Details, { children: details })
22370 ] });
22371 }
22372 );
22373
22374 // packages/ui/build-module/form/textarea-control/textarea-control.mjs
22375 var import_element59 = __toESM(require_element(), 1);
22376 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
22377 var TextareaControl = (0, import_element59.forwardRef)(function TextareaControl2({
22378 className,
22379 label,
22380 description,
22381 details,
22382 hideLabelFromVision,
22383 ...restProps
22384 }, ref) {
22385 return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(field_exports.Root, { className, children: [
22386 /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }),
22387 /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Textarea, { ref, ...restProps }),
22388 description && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(field_exports.Description, { children: description }),
22389 details && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(field_exports.Details, { children: details })
22390 ] });
22391 });
22392
22393 // packages/ui/build-module/form/with-validation/validated-input-control/validated-input-control.mjs
22394 var import_element60 = __toESM(require_element(), 1);
22395 var import_compose4 = __toESM(require_compose(), 1);
22396 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1);
22397 var ValidatedInputControl = (0, import_element60.forwardRef)(function ValidatedInputControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) {
22398 const validityTargetRef = (0, import_element60.useRef)(null);
22399 const mergedRefs = (0, import_compose4.useMergeRefs)([forwardedRef, validityTargetRef]);
22400 return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
22401 ControlWithError,
22402 {
22403 required,
22404 markWhenOptional,
22405 customValidity,
22406 getValidityTarget: () => validityTargetRef.current,
22407 children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(InputControl, { ref: mergedRefs, ...restProps })
22408 }
22409 );
22410 });
22411
22412 // packages/ui/build-module/form/with-validation/validated-textarea-control/validated-textarea-control.mjs
22413 var import_element61 = __toESM(require_element(), 1);
22414 var import_compose5 = __toESM(require_compose(), 1);
22415 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1);
22416 var ValidatedTextareaControl = (0, import_element61.forwardRef)(function ValidatedTextareaControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) {
22417 const validityTargetRef = (0, import_element61.useRef)(null);
22418 const mergedRefs = (0, import_compose5.useMergeRefs)([forwardedRef, validityTargetRef]);
22419 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
22420 ControlWithError,
22421 {
22422 required,
22423 markWhenOptional,
22424 customValidity,
22425 getValidityTarget: () => validityTargetRef.current,
22426 children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TextareaControl, { ref: mergedRefs, ...restProps })
22427 }
22428 );
22429 });
22430
22431 // packages/admin-ui/build-module/navigable-region/index.mjs
22432 var import_element62 = __toESM(require_element(), 1);
22433 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1);
22434 var NavigableRegion = (0, import_element62.forwardRef)(
22435 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => {
22436 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
22437 Tag,
22438 {
22439 ref,
22440 className: clsx_default("admin-ui-navigable-region", className),
22441 "aria-label": ariaLabel,
22442 role: "region",
22443 tabIndex: "-1",
22444 ...props,
22445 children
22446 }
22447 );
22448 }
22449 );
22450 NavigableRegion.displayName = "NavigableRegion";
22451 var navigable_region_default = NavigableRegion;
22452
22453 // packages/admin-ui/build-module/navigation/index.mjs
22454 var import_i18n9 = __toESM(require_i18n(), 1);
22455 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
22456 var STYLE_HASH_ATTRIBUTE32 = "data-wp-hash";
22457 function getRuntime32() {
22458 const globalScope = globalThis;
22459 if (globalScope.__wpStyleRuntime) {
22460 return globalScope.__wpStyleRuntime;
22461 }
22462 globalScope.__wpStyleRuntime = {
22463 documents: /* @__PURE__ */ new Map(),
22464 styles: /* @__PURE__ */ new Map(),
22465 injectedStyles: /* @__PURE__ */ new WeakMap()
22466 };
22467 if (typeof document !== "undefined") {
22468 registerDocument32(document);
22469 }
22470 return globalScope.__wpStyleRuntime;
22471 }
22472 function documentContainsStyleHash32(targetDocument, hash) {
22473 if (!targetDocument.head) {
22474 return false;
22475 }
22476 for (const style of targetDocument.head.querySelectorAll(
22477 `style[${STYLE_HASH_ATTRIBUTE32}]`
22478 )) {
22479 if (style.getAttribute(STYLE_HASH_ATTRIBUTE32) === hash) {
22480 return true;
22481 }
22482 }
22483 return false;
22484 }
22485 function injectStyle32(targetDocument, hash, css) {
22486 if (!targetDocument.head) {
22487 return;
22488 }
22489 const runtime = getRuntime32();
22490 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22491 if (!injectedStyles) {
22492 injectedStyles = /* @__PURE__ */ new Set();
22493 runtime.injectedStyles.set(targetDocument, injectedStyles);
22494 }
22495 if (injectedStyles.has(hash)) {
22496 return;
22497 }
22498 if (documentContainsStyleHash32(targetDocument, hash)) {
22499 injectedStyles.add(hash);
22500 return;
22501 }
22502 const style = targetDocument.createElement("style");
22503 style.setAttribute(STYLE_HASH_ATTRIBUTE32, hash);
22504 style.appendChild(targetDocument.createTextNode(css));
22505 targetDocument.head.appendChild(style);
22506 injectedStyles.add(hash);
22507 }
22508 function registerDocument32(targetDocument) {
22509 const runtime = getRuntime32();
22510 runtime.documents.set(
22511 targetDocument,
22512 (runtime.documents.get(targetDocument) ?? 0) + 1
22513 );
22514 for (const [hash, css] of runtime.styles) {
22515 injectStyle32(targetDocument, hash, css);
22516 }
22517 return () => {
22518 const count = runtime.documents.get(targetDocument);
22519 if (count === void 0) {
22520 return;
22521 }
22522 if (count <= 1) {
22523 runtime.documents.delete(targetDocument);
22524 return;
22525 }
22526 runtime.documents.set(targetDocument, count - 1);
22527 };
22528 }
22529 function registerStyle32(hash, css) {
22530 const runtime = getRuntime32();
22531 runtime.styles.set(hash, css);
22532 for (const targetDocument of runtime.documents.keys()) {
22533 injectStyle32(targetDocument, hash, css);
22534 }
22535 }
22536 if (typeof process === "undefined" || true) {
22537 registerStyle32("72ef022400", ".bfb5a2dd8cceebd3__list{--focus-ring-size:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*2);list-style:none;margin:calc(var(--focus-ring-size)*-1);overflow-x:auto;padding:var(--focus-ring-size);scroll-padding:var(--focus-ring-size)}.a4759b4cb2c8bd92__li{flex-shrink:0}._07da506d3f2d9afe__item{align-items:center;color:var(--wpds-color-foreground-interactive-neutral-weak,#707070);display:flex;font-weight:var(--wpds-typography-font-weight-default,400);min-block-size:44px;min-inline-size:44px;text-decoration:none}._07da506d3f2d9afe__item:hover,._07da506d3f2d9afe__item[aria-current=page]{color:var(--wpds-color-foreground-interactive-neutral-weak-active,#1e1e1e)}._07da506d3f2d9afe__item[aria-current=page]{font-weight:var(--wpds-typography-font-weight-emphasis,600)}");
22538 }
22539 var style_default26 = { "list": "bfb5a2dd8cceebd3__list", "li": "a4759b4cb2c8bd92__li", "item": "_07da506d3f2d9afe__item" };
22540 var Navigation = ({
22541 items,
22542 currentHref,
22543 ariaLabel = (0, import_i18n9.__)("Sections"),
22544 linkComponent,
22545 className
22546 }) => {
22547 if (!items.length) {
22548 return null;
22549 }
22550 const LinkComponent = linkComponent ?? "a";
22551 if (true) {
22552 const invalidItem = items.find(
22553 (item) => typeof item.href !== "string"
22554 );
22555 if (invalidItem) {
22556 throw new Error(
22557 `Navigation: item "${invalidItem.label}" is missing an \`href\` prop.`
22558 );
22559 }
22560 const duplicate = items.find(
22561 (item, index2) => items.findIndex((other) => other.href === item.href) !== index2
22562 );
22563 if (duplicate) {
22564 throw new Error(
22565 `Navigation: duplicate \`href\` "${duplicate.href}". Each item must have a unique \`href\` so a single item receives \`aria-current="page"\`.`
22566 );
22567 }
22568 }
22569 return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("nav", { "aria-label": ariaLabel, className, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
22570 Stack,
22571 {
22572 render: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("ul", { role: "list" }),
22573 direction: "row",
22574 align: "center",
22575 gap: "md",
22576 className: style_default26.list,
22577 children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("li", { className: style_default26.li, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
22578 Text,
22579 {
22580 variant: "body-md",
22581 className: style_default26.item,
22582 render: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
22583 Link,
22584 {
22585 variant: "unstyled",
22586 "aria-current": item.href === currentHref ? "page" : void 0,
22587 render: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(LinkComponent, { href: item.href })
22588 }
22589 ),
22590 children: item.label
22591 }
22592 ) }, item.href))
22593 }
22594 ) });
22595 };
22596 var navigation_default = Navigation;
22597
22598 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs
22599 var import_components2 = __toESM(require_components(), 1);
22600 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components2.createSlotFill)("SidebarToggle");
22601
22602 // packages/admin-ui/build-module/page/header.mjs
22603 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1);
22604 var STYLE_HASH_ATTRIBUTE33 = "data-wp-hash";
22605 function getRuntime33() {
22606 const globalScope = globalThis;
22607 if (globalScope.__wpStyleRuntime) {
22608 return globalScope.__wpStyleRuntime;
22609 }
22610 globalScope.__wpStyleRuntime = {
22611 documents: /* @__PURE__ */ new Map(),
22612 styles: /* @__PURE__ */ new Map(),
22613 injectedStyles: /* @__PURE__ */ new WeakMap()
22614 };
22615 if (typeof document !== "undefined") {
22616 registerDocument33(document);
22617 }
22618 return globalScope.__wpStyleRuntime;
22619 }
22620 function documentContainsStyleHash33(targetDocument, hash) {
22621 if (!targetDocument.head) {
22622 return false;
22623 }
22624 for (const style of targetDocument.head.querySelectorAll(
22625 `style[${STYLE_HASH_ATTRIBUTE33}]`
22626 )) {
22627 if (style.getAttribute(STYLE_HASH_ATTRIBUTE33) === hash) {
22628 return true;
22629 }
22630 }
22631 return false;
22632 }
22633 function injectStyle33(targetDocument, hash, css) {
22634 if (!targetDocument.head) {
22635 return;
22636 }
22637 const runtime = getRuntime33();
22638 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22639 if (!injectedStyles) {
22640 injectedStyles = /* @__PURE__ */ new Set();
22641 runtime.injectedStyles.set(targetDocument, injectedStyles);
22642 }
22643 if (injectedStyles.has(hash)) {
22644 return;
22645 }
22646 if (documentContainsStyleHash33(targetDocument, hash)) {
22647 injectedStyles.add(hash);
22648 return;
22649 }
22650 const style = targetDocument.createElement("style");
22651 style.setAttribute(STYLE_HASH_ATTRIBUTE33, hash);
22652 style.appendChild(targetDocument.createTextNode(css));
22653 targetDocument.head.appendChild(style);
22654 injectedStyles.add(hash);
22655 }
22656 function registerDocument33(targetDocument) {
22657 const runtime = getRuntime33();
22658 runtime.documents.set(
22659 targetDocument,
22660 (runtime.documents.get(targetDocument) ?? 0) + 1
22661 );
22662 for (const [hash, css] of runtime.styles) {
22663 injectStyle33(targetDocument, hash, css);
22664 }
22665 return () => {
22666 const count = runtime.documents.get(targetDocument);
22667 if (count === void 0) {
22668 return;
22669 }
22670 if (count <= 1) {
22671 runtime.documents.delete(targetDocument);
22672 return;
22673 }
22674 runtime.documents.set(targetDocument, count - 1);
22675 };
22676 }
22677 function registerStyle33(hash, css) {
22678 const runtime = getRuntime33();
22679 runtime.styles.set(hash, css);
22680 for (const targetDocument of runtime.documents.keys()) {
22681 injectStyle33(targetDocument, hash, css);
22682 }
22683 }
22684 if (typeof process === "undefined" || true) {
22685 registerStyle33("1f3750277d", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8bcd33103b451f30__header-lockup{min-width:0}._8113be94e7caf73c__header-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation,._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation ._60fea2f6bf5319cd__header-subtitle{padding-block-end:0}._673c99dcbfb58211__header-navigation{margin-block-start:var(--wpds-dimension-gap-md,12px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}");
22686 }
22687 var style_default27 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-lockup": "_8bcd33103b451f30__header-lockup", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "has-navigation": "_4b0f17e503d11619__has-navigation", "header-navigation": "_673c99dcbfb58211__header-navigation", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" };
22688 function Header3({
22689 headingLevel = 1,
22690 breadcrumbs,
22691 badges,
22692 visual,
22693 title,
22694 subTitle,
22695 actions,
22696 navigation,
22697 components,
22698 showSidebarToggle = true
22699 }) {
22700 const HeadingTag = `h${headingLevel}`;
22701 const hasNavigation = !!navigation?.items?.length;
22702 return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
22703 Stack,
22704 {
22705 direction: "column",
22706 className: clsx_default(
22707 style_default27.header,
22708 hasNavigation && style_default27["has-navigation"]
22709 ),
22710 children: [
22711 /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
22712 Stack,
22713 {
22714 className: style_default27["header-content"],
22715 direction: "row",
22716 gap: "sm",
22717 justify: "space-between",
22718 children: [
22719 /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
22720 Stack,
22721 {
22722 direction: "row",
22723 gap: "sm",
22724 align: "center",
22725 justify: "start",
22726 className: style_default27["header-lockup"],
22727 children: [
22728 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
22729 SidebarToggleSlot,
22730 {
22731 bubblesVirtually: true,
22732 className: style_default27["sidebar-toggle-slot"]
22733 }
22734 ),
22735 visual && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
22736 "div",
22737 {
22738 className: style_default27["header-visual"],
22739 "aria-hidden": "true",
22740 children: visual
22741 }
22742 ),
22743 title && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
22744 Text,
22745 {
22746 className: style_default27["header-title"],
22747 render: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(HeadingTag, {}),
22748 variant: "heading-lg",
22749 children: title
22750 }
22751 ),
22752 breadcrumbs,
22753 badges
22754 ]
22755 }
22756 ),
22757 actions && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
22758 Stack,
22759 {
22760 align: "center",
22761 className: style_default27["header-actions"],
22762 direction: "row",
22763 gap: "sm",
22764 children: actions
22765 }
22766 )
22767 ]
22768 }
22769 ),
22770 subTitle && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
22771 Text,
22772 {
22773 render: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", {}),
22774 variant: "body-md",
22775 className: style_default27["header-subtitle"],
22776 children: subTitle
22777 }
22778 ),
22779 hasNavigation && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
22780 navigation_default,
22781 {
22782 ...navigation,
22783 linkComponent: components?.link,
22784 className: style_default27["header-navigation"]
22785 }
22786 )
22787 ]
22788 }
22789 );
22790 }
22791
22792 // packages/admin-ui/build-module/page/index.mjs
22793 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1);
22794 var STYLE_HASH_ATTRIBUTE34 = "data-wp-hash";
22795 function getRuntime34() {
22796 const globalScope = globalThis;
22797 if (globalScope.__wpStyleRuntime) {
22798 return globalScope.__wpStyleRuntime;
22799 }
22800 globalScope.__wpStyleRuntime = {
22801 documents: /* @__PURE__ */ new Map(),
22802 styles: /* @__PURE__ */ new Map(),
22803 injectedStyles: /* @__PURE__ */ new WeakMap()
22804 };
22805 if (typeof document !== "undefined") {
22806 registerDocument34(document);
22807 }
22808 return globalScope.__wpStyleRuntime;
22809 }
22810 function documentContainsStyleHash34(targetDocument, hash) {
22811 if (!targetDocument.head) {
22812 return false;
22813 }
22814 for (const style of targetDocument.head.querySelectorAll(
22815 `style[${STYLE_HASH_ATTRIBUTE34}]`
22816 )) {
22817 if (style.getAttribute(STYLE_HASH_ATTRIBUTE34) === hash) {
22818 return true;
22819 }
22820 }
22821 return false;
22822 }
22823 function injectStyle34(targetDocument, hash, css) {
22824 if (!targetDocument.head) {
22825 return;
22826 }
22827 const runtime = getRuntime34();
22828 let injectedStyles = runtime.injectedStyles.get(targetDocument);
22829 if (!injectedStyles) {
22830 injectedStyles = /* @__PURE__ */ new Set();
22831 runtime.injectedStyles.set(targetDocument, injectedStyles);
22832 }
22833 if (injectedStyles.has(hash)) {
22834 return;
22835 }
22836 if (documentContainsStyleHash34(targetDocument, hash)) {
22837 injectedStyles.add(hash);
22838 return;
22839 }
22840 const style = targetDocument.createElement("style");
22841 style.setAttribute(STYLE_HASH_ATTRIBUTE34, hash);
22842 style.appendChild(targetDocument.createTextNode(css));
22843 targetDocument.head.appendChild(style);
22844 injectedStyles.add(hash);
22845 }
22846 function registerDocument34(targetDocument) {
22847 const runtime = getRuntime34();
22848 runtime.documents.set(
22849 targetDocument,
22850 (runtime.documents.get(targetDocument) ?? 0) + 1
22851 );
22852 for (const [hash, css] of runtime.styles) {
22853 injectStyle34(targetDocument, hash, css);
22854 }
22855 return () => {
22856 const count = runtime.documents.get(targetDocument);
22857 if (count === void 0) {
22858 return;
22859 }
22860 if (count <= 1) {
22861 runtime.documents.delete(targetDocument);
22862 return;
22863 }
22864 runtime.documents.set(targetDocument, count - 1);
22865 };
22866 }
22867 function registerStyle34(hash, css) {
22868 const runtime = getRuntime34();
22869 runtime.styles.set(hash, css);
22870 for (const targetDocument of runtime.documents.keys()) {
22871 injectStyle34(targetDocument, hash, css);
22872 }
22873 }
22874 if (typeof process === "undefined" || true) {
22875 registerStyle34("1f3750277d", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-background-surface-neutral,#fcfcfc);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-background-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:var(--wpds-dimension-size-md,32px)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8bcd33103b451f30__header-lockup{min-width:0}._8113be94e7caf73c__header-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:var(--wpds-dimension-size-sm,24px);width:var(--wpds-dimension-size-sm,24px);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-foreground-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation,._0625b55e82a0d93d__header._4b0f17e503d11619__has-navigation ._60fea2f6bf5319cd__header-subtitle{padding-block-end:0}._673c99dcbfb58211__header-navigation{margin-block-start:var(--wpds-dimension-gap-md,12px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}");
22876 }
22877 var style_default28 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-lockup": "_8bcd33103b451f30__header-lockup", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "has-navigation": "_4b0f17e503d11619__has-navigation", "header-navigation": "_673c99dcbfb58211__header-navigation", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" };
22878 function Page({
22879 headingLevel,
22880 breadcrumbs,
22881 badges,
22882 visual,
22883 title,
22884 subTitle,
22885 children,
22886 className,
22887 actions,
22888 navigation,
22889 components,
22890 ariaLabel,
22891 hasPadding = false,
22892 showSidebarToggle = true
22893 }) {
22894 const classes = clsx_default(style_default28.page, className);
22895 const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : "");
22896 return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [
22897 (title || breadcrumbs || badges || actions || visual || !!navigation?.items?.length) && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
22898 Header3,
22899 {
22900 headingLevel,
22901 breadcrumbs,
22902 badges,
22903 visual,
22904 title,
22905 subTitle,
22906 actions,
22907 navigation,
22908 components,
22909 showSidebarToggle
22910 }
22911 ),
22912 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
22913 "div",
22914 {
22915 className: clsx_default(
22916 style_default28.content,
22917 style_default28["has-padding"]
22918 ),
22919 children
22920 }
22921 ) : children
22922 ] });
22923 }
22924 Page.SidebarToggleFill = SidebarToggleFill;
22925 var page_default = Page;
22926
22927 // routes/experiments-home/stage.tsx
22928 var import_components29 = __toESM(require_components());
22929 var import_core_data = __toESM(require_core_data());
22930 var import_data = __toESM(require_data());
22931
22932 // packages/dataviews/build-module/constants.mjs
22933 var import_i18n10 = __toESM(require_i18n(), 1);
22934 var OPERATOR_IS_ANY = "isAny";
22935 var OPERATOR_IS_NONE = "isNone";
22936 var OPERATOR_IS_ALL = "isAll";
22937 var OPERATOR_IS_NOT_ALL = "isNotAll";
22938 var OPERATOR_BETWEEN = "between";
22939 var OPERATOR_IN_THE_PAST = "inThePast";
22940 var OPERATOR_OVER = "over";
22941 var OPERATOR_IS = "is";
22942 var OPERATOR_IS_NOT = "isNot";
22943 var OPERATOR_LESS_THAN = "lessThan";
22944 var OPERATOR_GREATER_THAN = "greaterThan";
22945 var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual";
22946 var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual";
22947 var OPERATOR_BEFORE = "before";
22948 var OPERATOR_AFTER = "after";
22949 var OPERATOR_BEFORE_INC = "beforeInc";
22950 var OPERATOR_AFTER_INC = "afterInc";
22951 var OPERATOR_CONTAINS = "contains";
22952 var OPERATOR_NOT_CONTAINS = "notContains";
22953 var OPERATOR_STARTS_WITH = "startsWith";
22954 var OPERATOR_ON = "on";
22955 var OPERATOR_NOT_ON = "notOn";
22956 var sortLabels = {
22957 asc: (0, import_i18n10.__)("Sort ascending"),
22958 desc: (0, import_i18n10.__)("Sort descending")
22959 };
22960
22961 // packages/dataviews/build-module/hooks/use-elements.mjs
22962 var import_element63 = __toESM(require_element(), 1);
22963 var EMPTY_ARRAY2 = [];
22964 function useElements({
22965 elements,
22966 getElements
22967 }) {
22968 const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY2;
22969 const [records, setRecords] = (0, import_element63.useState)(staticElements);
22970 const [isLoading, setIsLoading] = (0, import_element63.useState)(false);
22971 (0, import_element63.useEffect)(() => {
22972 if (!getElements) {
22973 setRecords(staticElements);
22974 return;
22975 }
22976 let cancelled = false;
22977 setIsLoading(true);
22978 getElements().then((fetchedElements) => {
22979 if (!cancelled) {
22980 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements;
22981 setRecords(dynamicElements);
22982 }
22983 }).catch(() => {
22984 if (!cancelled) {
22985 setRecords(staticElements);
22986 }
22987 }).finally(() => {
22988 if (!cancelled) {
22989 setIsLoading(false);
22990 }
22991 });
22992 return () => {
22993 cancelled = true;
22994 };
22995 }, [getElements, staticElements]);
22996 return {
22997 elements: records,
22998 isLoading
22999 };
23000 }
23001
23002 // packages/dataviews/build-module/utils/operators.mjs
23003 var import_i18n11 = __toESM(require_i18n(), 1);
23004 var import_element64 = __toESM(require_element(), 1);
23005 var import_date2 = __toESM(require_date(), 1);
23006
23007 // packages/dataviews/build-module/field-types/utils/parse-time.mjs
23008 var ZONE_DESIGNATOR = /(?:[Zz]|[+-](?:[01]\d|2[0-3]):?[0-5]\d)$/;
23009 var TIME_FORMATS = ["HH:mm", "HH:mm:ss"];
23010 var REFERENCE_DATE = new Date(2e3, 0, 1);
23011 function parseTime2(value) {
23012 if (typeof value !== "string") {
23013 return null;
23014 }
23015 const time = value.trim().replace(ZONE_DESIGNATOR, "");
23016 for (const timeFormat of TIME_FORMATS) {
23017 const parsed = parse(time, timeFormat, REFERENCE_DATE);
23018 if (isValid(parsed)) {
23019 return parsed.getHours() * 3600 + parsed.getMinutes() * 60 + parsed.getSeconds();
23020 }
23021 }
23022 return null;
23023 }
23024
23025 // packages/dataviews/build-module/utils/operators.mjs
23026 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1);
23027 var filterTextWrappers = {
23028 Name: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }),
23029 Value: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" })
23030 };
23031 function toComparableTemporals(fieldValue, filterValue) {
23032 const filterTime = parseTime2(filterValue);
23033 if (filterTime !== null) {
23034 return [parseTime2(fieldValue) ?? NaN, filterTime];
23035 }
23036 return [
23037 (0, import_date2.getDate)(fieldValue).getTime(),
23038 (0, import_date2.getDate)(filterValue).getTime()
23039 ];
23040 }
23041 function getRelativeDate(value, unit) {
23042 switch (unit) {
23043 case "days":
23044 return subDays(/* @__PURE__ */ new Date(), value);
23045 case "weeks":
23046 return subWeeks(/* @__PURE__ */ new Date(), value);
23047 case "months":
23048 return subMonths(/* @__PURE__ */ new Date(), value);
23049 case "years":
23050 return subYears(/* @__PURE__ */ new Date(), value);
23051 default:
23052 return /* @__PURE__ */ new Date();
23053 }
23054 }
23055 var isNoneOperatorDefinition = {
23056 /* translators: DataViews operator name */
23057 label: (0, import_i18n11.__)("Is none of"),
23058 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23059 (0, import_i18n11.sprintf)(
23060 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */
23061 (0, import_i18n11.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"),
23062 filter.name,
23063 activeElements.map((element) => element.label).join(", ")
23064 ),
23065 filterTextWrappers
23066 ),
23067 filter: ((item, field, filterValue) => {
23068 if (!filterValue?.length) {
23069 return true;
23070 }
23071 const fieldValue = field.getValue({ item });
23072 if (Array.isArray(fieldValue)) {
23073 return !filterValue.some(
23074 (fv) => fieldValue.includes(fv)
23075 );
23076 } else if (typeof fieldValue === "string" || typeof fieldValue === "number") {
23077 return !filterValue.includes(fieldValue);
23078 }
23079 return false;
23080 }),
23081 selection: "multi"
23082 };
23083 var OPERATORS = [
23084 {
23085 name: OPERATOR_IS_ANY,
23086 /* translators: DataViews operator name */
23087 label: (0, import_i18n11.__)("Includes"),
23088 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23089 (0, import_i18n11.sprintf)(
23090 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */
23091 (0, import_i18n11.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"),
23092 filter.name,
23093 activeElements.map((element) => element.label).join(", ")
23094 ),
23095 filterTextWrappers
23096 ),
23097 filter(item, field, filterValue) {
23098 if (!filterValue?.length) {
23099 return true;
23100 }
23101 const fieldValue = field.getValue({ item });
23102 if (Array.isArray(fieldValue)) {
23103 return filterValue.some(
23104 (fv) => fieldValue.includes(fv)
23105 );
23106 } else if (typeof fieldValue === "string" || typeof fieldValue === "number") {
23107 return filterValue.includes(fieldValue);
23108 }
23109 return false;
23110 },
23111 selection: "multi"
23112 },
23113 {
23114 name: OPERATOR_IS_NONE,
23115 ...isNoneOperatorDefinition
23116 },
23117 {
23118 name: OPERATOR_IS_ALL,
23119 /* translators: DataViews operator name */
23120 label: (0, import_i18n11.__)("Includes all"),
23121 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23122 (0, import_i18n11.sprintf)(
23123 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */
23124 (0, import_i18n11.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"),
23125 filter.name,
23126 activeElements.map((element) => element.label).join(", ")
23127 ),
23128 filterTextWrappers
23129 ),
23130 filter(item, field, filterValue) {
23131 if (!filterValue?.length) {
23132 return true;
23133 }
23134 const fieldValue = field.getValue({ item });
23135 if (!Array.isArray(fieldValue)) {
23136 return false;
23137 }
23138 return filterValue.every(
23139 (value) => fieldValue.includes(value)
23140 );
23141 },
23142 selection: "multi"
23143 },
23144 {
23145 name: OPERATOR_IS_NOT_ALL,
23146 ...isNoneOperatorDefinition
23147 },
23148 {
23149 name: OPERATOR_BETWEEN,
23150 /* translators: DataViews operator name */
23151 label: (0, import_i18n11.__)("Between (inc)"),
23152 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23153 (0, import_i18n11.sprintf)(
23154 /* translators: 1: Filter name (e.g. "Item count"). 2: Filter value min. 3: Filter value max. e.g.: "Item count between (inc): 10 and 180". */
23155 (0, import_i18n11.__)(
23156 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>"
23157 ),
23158 filter.name,
23159 activeElements[0].label[0],
23160 activeElements[0].label[1]
23161 ),
23162 filterTextWrappers
23163 ),
23164 filter(item, field, filterValue) {
23165 if (!Array.isArray(filterValue) || filterValue.length !== 2 || // An unfilled bound is `undefined` from the controls, `''`
23166 // when it arrives from a persisted view, or `null` once
23167 // `undefined` round-trips through JSON persistence.
23168 filterValue.includes(void 0) || filterValue.includes("") || filterValue.includes(null)) {
23169 return true;
23170 }
23171 const fieldValue = field.getValue({ item });
23172 const [min3, max3] = filterValue.map(parseTime2);
23173 if (min3 !== null && max3 !== null) {
23174 const value = parseTime2(fieldValue);
23175 return value !== null && value >= min3 && value <= max3;
23176 }
23177 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") {
23178 return fieldValue >= filterValue[0] && fieldValue <= filterValue[1];
23179 }
23180 return false;
23181 },
23182 selection: "custom"
23183 },
23184 {
23185 name: OPERATOR_IN_THE_PAST,
23186 /* translators: DataViews operator name */
23187 label: (0, import_i18n11.__)("In the past"),
23188 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23189 (0, import_i18n11.sprintf)(
23190 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */
23191 (0, import_i18n11.__)(
23192 "<Name>%1$s is in the past: </Name><Value>%2$s</Value>"
23193 ),
23194 filter.name,
23195 `${activeElements[0].value.value} ${activeElements[0].value.unit}`
23196 ),
23197 filterTextWrappers
23198 ),
23199 filter(item, field, filterValue) {
23200 if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
23201 return true;
23202 }
23203 const targetDate = getRelativeDate(
23204 filterValue.value,
23205 filterValue.unit
23206 );
23207 const fieldValue = (0, import_date2.getDate)(field.getValue({ item }));
23208 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date();
23209 },
23210 selection: "custom"
23211 },
23212 {
23213 name: OPERATOR_OVER,
23214 /* translators: DataViews operator name */
23215 label: (0, import_i18n11.__)("Over"),
23216 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23217 (0, import_i18n11.sprintf)(
23218 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */
23219 (0, import_i18n11.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"),
23220 filter.name,
23221 `${activeElements[0].value.value} ${activeElements[0].value.unit}`
23222 ),
23223 filterTextWrappers
23224 ),
23225 filter(item, field, filterValue) {
23226 if (filterValue?.value === void 0 || filterValue?.unit === void 0) {
23227 return true;
23228 }
23229 const targetDate = getRelativeDate(
23230 filterValue.value,
23231 filterValue.unit
23232 );
23233 const fieldValue = (0, import_date2.getDate)(field.getValue({ item }));
23234 return fieldValue < targetDate;
23235 },
23236 selection: "custom"
23237 },
23238 {
23239 name: OPERATOR_IS,
23240 /* translators: DataViews operator name */
23241 label: (0, import_i18n11.__)("Is"),
23242 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23243 (0, import_i18n11.sprintf)(
23244 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */
23245 (0, import_i18n11.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
23246 filter.name,
23247 activeElements[0].label
23248 ),
23249 filterTextWrappers
23250 ),
23251 filter(item, field, filterValue) {
23252 return filterValue === field.getValue({ item }) || filterValue === void 0;
23253 },
23254 selection: "single"
23255 },
23256 {
23257 name: OPERATOR_IS_NOT,
23258 /* translators: DataViews operator name */
23259 label: (0, import_i18n11.__)("Is not"),
23260 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23261 (0, import_i18n11.sprintf)(
23262 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */
23263 (0, import_i18n11.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
23264 filter.name,
23265 activeElements[0].label
23266 ),
23267 filterTextWrappers
23268 ),
23269 filter(item, field, filterValue) {
23270 return filterValue !== field.getValue({ item });
23271 },
23272 selection: "single"
23273 },
23274 {
23275 name: OPERATOR_LESS_THAN,
23276 /* translators: DataViews operator name */
23277 label: (0, import_i18n11.__)("Less than"),
23278 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23279 (0, import_i18n11.sprintf)(
23280 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */
23281 (0, import_i18n11.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"),
23282 filter.name,
23283 activeElements[0].label
23284 ),
23285 filterTextWrappers
23286 ),
23287 filter(item, field, filterValue) {
23288 if (filterValue === void 0) {
23289 return true;
23290 }
23291 const fieldValue = field.getValue({ item });
23292 return fieldValue < filterValue;
23293 },
23294 selection: "single"
23295 },
23296 {
23297 name: OPERATOR_GREATER_THAN,
23298 /* translators: DataViews operator name */
23299 label: (0, import_i18n11.__)("Greater than"),
23300 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23301 (0, import_i18n11.sprintf)(
23302 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */
23303 (0, import_i18n11.__)(
23304 "<Name>%1$s is greater than: </Name><Value>%2$s</Value>"
23305 ),
23306 filter.name,
23307 activeElements[0].label
23308 ),
23309 filterTextWrappers
23310 ),
23311 filter(item, field, filterValue) {
23312 if (filterValue === void 0) {
23313 return true;
23314 }
23315 const fieldValue = field.getValue({ item });
23316 return fieldValue > filterValue;
23317 },
23318 selection: "single"
23319 },
23320 {
23321 name: OPERATOR_LESS_THAN_OR_EQUAL,
23322 /* translators: DataViews operator name */
23323 label: (0, import_i18n11.__)("Less than or equal"),
23324 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23325 (0, import_i18n11.sprintf)(
23326 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */
23327 (0, import_i18n11.__)(
23328 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>"
23329 ),
23330 filter.name,
23331 activeElements[0].label
23332 ),
23333 filterTextWrappers
23334 ),
23335 filter(item, field, filterValue) {
23336 if (filterValue === void 0) {
23337 return true;
23338 }
23339 const fieldValue = field.getValue({ item });
23340 return fieldValue <= filterValue;
23341 },
23342 selection: "single"
23343 },
23344 {
23345 name: OPERATOR_GREATER_THAN_OR_EQUAL,
23346 /* translators: DataViews operator name */
23347 label: (0, import_i18n11.__)("Greater than or equal"),
23348 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23349 (0, import_i18n11.sprintf)(
23350 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */
23351 (0, import_i18n11.__)(
23352 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>"
23353 ),
23354 filter.name,
23355 activeElements[0].label
23356 ),
23357 filterTextWrappers
23358 ),
23359 filter(item, field, filterValue) {
23360 if (filterValue === void 0) {
23361 return true;
23362 }
23363 const fieldValue = field.getValue({ item });
23364 return fieldValue >= filterValue;
23365 },
23366 selection: "single"
23367 },
23368 {
23369 name: OPERATOR_BEFORE,
23370 /* translators: DataViews operator name */
23371 label: (0, import_i18n11.__)("Before"),
23372 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23373 (0, import_i18n11.sprintf)(
23374 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */
23375 (0, import_i18n11.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"),
23376 filter.name,
23377 activeElements[0].label
23378 ),
23379 filterTextWrappers
23380 ),
23381 filter(item, field, filterValue) {
23382 if (filterValue === void 0) {
23383 return true;
23384 }
23385 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23386 field.getValue({ item }),
23387 filterValue
23388 );
23389 return fieldTemporal < filterTemporal;
23390 },
23391 selection: "single"
23392 },
23393 {
23394 name: OPERATOR_AFTER,
23395 /* translators: DataViews operator name */
23396 label: (0, import_i18n11.__)("After"),
23397 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23398 (0, import_i18n11.sprintf)(
23399 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */
23400 (0, import_i18n11.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"),
23401 filter.name,
23402 activeElements[0].label
23403 ),
23404 filterTextWrappers
23405 ),
23406 filter(item, field, filterValue) {
23407 if (filterValue === void 0) {
23408 return true;
23409 }
23410 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23411 field.getValue({ item }),
23412 filterValue
23413 );
23414 return fieldTemporal > filterTemporal;
23415 },
23416 selection: "single"
23417 },
23418 {
23419 name: OPERATOR_BEFORE_INC,
23420 /* translators: DataViews operator name */
23421 label: (0, import_i18n11.__)("Before (inc)"),
23422 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23423 (0, import_i18n11.sprintf)(
23424 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */
23425 (0, import_i18n11.__)(
23426 "<Name>%1$s is on or before: </Name><Value>%2$s</Value>"
23427 ),
23428 filter.name,
23429 activeElements[0].label
23430 ),
23431 filterTextWrappers
23432 ),
23433 filter(item, field, filterValue) {
23434 if (filterValue === void 0) {
23435 return true;
23436 }
23437 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23438 field.getValue({ item }),
23439 filterValue
23440 );
23441 return fieldTemporal <= filterTemporal;
23442 },
23443 selection: "single"
23444 },
23445 {
23446 name: OPERATOR_AFTER_INC,
23447 /* translators: DataViews operator name */
23448 label: (0, import_i18n11.__)("After (inc)"),
23449 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23450 (0, import_i18n11.sprintf)(
23451 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */
23452 (0, import_i18n11.__)(
23453 "<Name>%1$s is on or after: </Name><Value>%2$s</Value>"
23454 ),
23455 filter.name,
23456 activeElements[0].label
23457 ),
23458 filterTextWrappers
23459 ),
23460 filter(item, field, filterValue) {
23461 if (filterValue === void 0) {
23462 return true;
23463 }
23464 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23465 field.getValue({ item }),
23466 filterValue
23467 );
23468 return fieldTemporal >= filterTemporal;
23469 },
23470 selection: "single"
23471 },
23472 {
23473 name: OPERATOR_CONTAINS,
23474 /* translators: DataViews operator name */
23475 label: (0, import_i18n11.__)("Contains"),
23476 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23477 (0, import_i18n11.sprintf)(
23478 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */
23479 (0, import_i18n11.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"),
23480 filter.name,
23481 activeElements[0].label
23482 ),
23483 filterTextWrappers
23484 ),
23485 filter(item, field, filterValue) {
23486 if (filterValue === void 0) {
23487 return true;
23488 }
23489 const fieldValue = field.getValue({ item });
23490 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
23491 },
23492 selection: "single"
23493 },
23494 {
23495 name: OPERATOR_NOT_CONTAINS,
23496 /* translators: DataViews operator name */
23497 label: (0, import_i18n11.__)("Doesn't contain"),
23498 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23499 (0, import_i18n11.sprintf)(
23500 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */
23501 (0, import_i18n11.__)(
23502 "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>"
23503 ),
23504 filter.name,
23505 activeElements[0].label
23506 ),
23507 filterTextWrappers
23508 ),
23509 filter(item, field, filterValue) {
23510 if (filterValue === void 0) {
23511 return true;
23512 }
23513 const fieldValue = field.getValue({ item });
23514 return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase());
23515 },
23516 selection: "single"
23517 },
23518 {
23519 name: OPERATOR_STARTS_WITH,
23520 /* translators: DataViews operator name */
23521 label: (0, import_i18n11.__)("Starts with"),
23522 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23523 (0, import_i18n11.sprintf)(
23524 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */
23525 (0, import_i18n11.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"),
23526 filter.name,
23527 activeElements[0].label
23528 ),
23529 filterTextWrappers
23530 ),
23531 filter(item, field, filterValue) {
23532 if (filterValue === void 0) {
23533 return true;
23534 }
23535 const fieldValue = field.getValue({ item });
23536 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase());
23537 },
23538 selection: "single"
23539 },
23540 {
23541 name: OPERATOR_ON,
23542 /* translators: DataViews operator name */
23543 label: (0, import_i18n11.__)("On"),
23544 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23545 (0, import_i18n11.sprintf)(
23546 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */
23547 (0, import_i18n11.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"),
23548 filter.name,
23549 activeElements[0].label
23550 ),
23551 filterTextWrappers
23552 ),
23553 filter(item, field, filterValue) {
23554 if (filterValue === void 0) {
23555 return true;
23556 }
23557 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23558 field.getValue({ item }),
23559 filterValue
23560 );
23561 return fieldTemporal === filterTemporal;
23562 },
23563 selection: "single"
23564 },
23565 {
23566 name: OPERATOR_NOT_ON,
23567 /* translators: DataViews operator name */
23568 label: (0, import_i18n11.__)("Not on"),
23569 filterText: (filter, activeElements) => (0, import_element64.createInterpolateElement)(
23570 (0, import_i18n11.sprintf)(
23571 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */
23572 (0, import_i18n11.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"),
23573 filter.name,
23574 activeElements[0].label
23575 ),
23576 filterTextWrappers
23577 ),
23578 filter(item, field, filterValue) {
23579 if (filterValue === void 0) {
23580 return true;
23581 }
23582 const [fieldTemporal, filterTemporal] = toComparableTemporals(
23583 field.getValue({ item }),
23584 filterValue
23585 );
23586 return fieldTemporal !== filterTemporal;
23587 },
23588 selection: "single"
23589 }
23590 ];
23591 var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name);
23592 var getAllOperatorNames = () => OPERATORS.map((op) => op.name);
23593
23594 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
23595 var import_element73 = __toESM(require_element(), 1);
23596
23597 // packages/dataviews/build-module/components/validated-form-controls/checkbox-control.mjs
23598 var import_element65 = __toESM(require_element(), 1);
23599 var import_compose6 = __toESM(require_compose(), 1);
23600 var import_components3 = __toESM(require_components(), 1);
23601 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1);
23602 var UnforwardedValidatedCheckboxControl = ({
23603 required,
23604 customValidity,
23605 markWhenOptional,
23606 ...restProps
23607 }, forwardedRef) => {
23608 const validityTargetRef = (0, import_element65.useRef)(null);
23609 const mergedRefs = (0, import_compose6.useMergeRefs)([forwardedRef, validityTargetRef]);
23610 return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
23611 ControlWithError,
23612 {
23613 className: "dataviews-validated-control",
23614 required,
23615 markWhenOptional,
23616 ref: mergedRefs,
23617 customValidity,
23618 getValidityTarget: () => validityTargetRef.current?.querySelector(
23619 'input[type="checkbox"]'
23620 ),
23621 children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
23622 import_components3.CheckboxControl,
23623 {
23624 ...restProps
23625 }
23626 )
23627 }
23628 );
23629 };
23630 var ValidatedCheckboxControl = (0, import_element65.forwardRef)(UnforwardedValidatedCheckboxControl);
23631 ValidatedCheckboxControl.displayName = "ValidatedCheckboxControl";
23632
23633 // packages/dataviews/build-module/components/validated-form-controls/combobox-control.mjs
23634 var import_element66 = __toESM(require_element(), 1);
23635 var import_compose7 = __toESM(require_compose(), 1);
23636 var import_components4 = __toESM(require_components(), 1);
23637 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1);
23638 var UnforwardedValidatedComboboxControl = ({
23639 required,
23640 customValidity,
23641 markWhenOptional,
23642 ...restProps
23643 }, forwardedRef) => {
23644 const validityTargetRef = (0, import_element66.useRef)(null);
23645 const mergedRefs = (0, import_compose7.useMergeRefs)([forwardedRef, validityTargetRef]);
23646 (0, import_element66.useEffect)(() => {
23647 const input = validityTargetRef.current?.querySelector(
23648 'input[role="combobox"]'
23649 );
23650 if (input) {
23651 input.required = required ?? false;
23652 }
23653 }, [required]);
23654 return (
23655 // TODO: Bug - Missing value error is not cleared immediately on change, waits for blur.
23656 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
23657 ControlWithError,
23658 {
23659 className: "dataviews-validated-control",
23660 required,
23661 markWhenOptional,
23662 ref: mergedRefs,
23663 customValidity,
23664 getValidityTarget: () => validityTargetRef.current?.querySelector(
23665 'input[role="combobox"]'
23666 ),
23667 children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components4.ComboboxControl, { ...restProps })
23668 }
23669 )
23670 );
23671 };
23672 var ValidatedComboboxControl = (0, import_element66.forwardRef)(UnforwardedValidatedComboboxControl);
23673 ValidatedComboboxControl.displayName = "ValidatedComboboxControl";
23674
23675 // packages/dataviews/build-module/components/validated-form-controls/form-token-field.mjs
23676 var import_element67 = __toESM(require_element(), 1);
23677 var import_components5 = __toESM(require_components(), 1);
23678 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1);
23679 var UnforwardedValidatedFormTokenField = ({
23680 required,
23681 customValidity,
23682 markWhenOptional,
23683 ...restProps
23684 }, forwardedRef) => {
23685 const validityTargetRef = (0, import_element67.useRef)(null);
23686 return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
23687 "div",
23688 {
23689 className: "dataviews-validated-control__wrapper-with-error-delegate",
23690 ref: forwardedRef,
23691 children: [
23692 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
23693 ControlWithError,
23694 {
23695 className: "dataviews-validated-control",
23696 required,
23697 markWhenOptional,
23698 customValidity,
23699 getValidityTarget: () => validityTargetRef.current,
23700 children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components5.FormTokenField, { ...restProps })
23701 }
23702 ),
23703 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
23704 "input",
23705 {
23706 className: "dataviews-validated-control__error-delegate",
23707 type: "text",
23708 ref: validityTargetRef,
23709 required,
23710 value: restProps.value && restProps.value.length > 0 ? "hasvalue" : "",
23711 tabIndex: -1,
23712 onChange: () => {
23713 },
23714 onFocus: (e) => {
23715 e.target.previousElementSibling?.querySelector(
23716 'input[type="text"]'
23717 )?.focus();
23718 }
23719 }
23720 )
23721 ]
23722 }
23723 );
23724 };
23725 var ValidatedFormTokenField = (0, import_element67.forwardRef)(UnforwardedValidatedFormTokenField);
23726 ValidatedFormTokenField.displayName = "ValidatedFormTokenField";
23727
23728 // packages/dataviews/build-module/components/validated-form-controls/number-control.mjs
23729 var import_element68 = __toESM(require_element(), 1);
23730 var import_compose8 = __toESM(require_compose(), 1);
23731 var import_components6 = __toESM(require_components(), 1);
23732 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1);
23733 var UnforwardedValidatedNumberControl = ({
23734 required,
23735 customValidity,
23736 markWhenOptional,
23737 ...restProps
23738 }, forwardedRef) => {
23739 const validityTargetRef = (0, import_element68.useRef)(null);
23740 const mergedRefs = (0, import_compose8.useMergeRefs)([forwardedRef, validityTargetRef]);
23741 return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
23742 ControlWithError,
23743 {
23744 className: "dataviews-validated-control",
23745 required,
23746 markWhenOptional,
23747 customValidity,
23748 getValidityTarget: () => validityTargetRef.current,
23749 children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components6.__experimentalNumberControl, { ref: mergedRefs, ...restProps })
23750 }
23751 );
23752 };
23753 var ValidatedNumberControl = (0, import_element68.forwardRef)(UnforwardedValidatedNumberControl);
23754 ValidatedNumberControl.displayName = "ValidatedNumberControl";
23755
23756 // packages/dataviews/build-module/components/validated-form-controls/radio-control.mjs
23757 var import_element69 = __toESM(require_element(), 1);
23758 var import_compose9 = __toESM(require_compose(), 1);
23759 var import_components7 = __toESM(require_components(), 1);
23760 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1);
23761 var UnforwardedValidatedRadioControl = ({
23762 required,
23763 customValidity,
23764 markWhenOptional,
23765 ...restProps
23766 }, forwardedRef) => {
23767 const validityTargetRef = (0, import_element69.useRef)(null);
23768 const mergedRefs = (0, import_compose9.useMergeRefs)([forwardedRef, validityTargetRef]);
23769 return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
23770 ControlWithError,
23771 {
23772 className: "dataviews-validated-control",
23773 required,
23774 markWhenOptional,
23775 ref: mergedRefs,
23776 customValidity,
23777 getValidityTarget: () => validityTargetRef.current?.querySelector(
23778 'input[type="radio"]'
23779 ),
23780 children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_components7.RadioControl, { ...restProps })
23781 }
23782 );
23783 };
23784 var ValidatedRadioControl = (0, import_element69.forwardRef)(UnforwardedValidatedRadioControl);
23785 ValidatedRadioControl.displayName = "ValidatedRadioControl";
23786
23787 // packages/dataviews/build-module/components/validated-form-controls/select-control.mjs
23788 var import_element70 = __toESM(require_element(), 1);
23789 var import_compose10 = __toESM(require_compose(), 1);
23790 var import_components8 = __toESM(require_components(), 1);
23791 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1);
23792 var UnforwardedValidatedSelectControl = ({
23793 required,
23794 customValidity,
23795 markWhenOptional,
23796 ...restProps
23797 }, forwardedRef) => {
23798 const validityTargetRef = (0, import_element70.useRef)(null);
23799 const mergedRefs = (0, import_compose10.useMergeRefs)([forwardedRef, validityTargetRef]);
23800 return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
23801 ControlWithError,
23802 {
23803 className: "dataviews-validated-control",
23804 required,
23805 markWhenOptional,
23806 customValidity,
23807 getValidityTarget: () => validityTargetRef.current,
23808 children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
23809 import_components8.SelectControl,
23810 {
23811 ref: mergedRefs,
23812 // A runtime boolean cannot statically discriminate
23813 // SelectControl's single/multiple props union.
23814 ...restProps
23815 }
23816 )
23817 }
23818 );
23819 };
23820 var ValidatedSelectControl = (0, import_element70.forwardRef)(UnforwardedValidatedSelectControl);
23821 ValidatedSelectControl.displayName = "ValidatedSelectControl";
23822
23823 // packages/dataviews/build-module/components/validated-form-controls/toggle-control.mjs
23824 var import_element71 = __toESM(require_element(), 1);
23825 var import_compose11 = __toESM(require_compose(), 1);
23826 var import_components9 = __toESM(require_components(), 1);
23827 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1);
23828 var UnforwardedValidatedToggleControl = ({
23829 required,
23830 customValidity,
23831 markWhenOptional,
23832 ...restProps
23833 }, forwardedRef) => {
23834 const validityTargetRef = (0, import_element71.useRef)(null);
23835 const mergedRefs = (0, import_compose11.useMergeRefs)([forwardedRef, validityTargetRef]);
23836 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
23837 ControlWithError,
23838 {
23839 className: "dataviews-validated-control",
23840 required,
23841 markWhenOptional,
23842 customValidity,
23843 getValidityTarget: () => validityTargetRef.current,
23844 children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
23845 import_components9.ToggleControl,
23846 {
23847 ref: mergedRefs,
23848 required,
23849 ...restProps
23850 }
23851 )
23852 }
23853 );
23854 };
23855 var ValidatedToggleControl = (0, import_element71.forwardRef)(UnforwardedValidatedToggleControl);
23856 ValidatedToggleControl.displayName = "ValidatedToggleControl";
23857
23858 // packages/dataviews/build-module/components/validated-form-controls/toggle-group-control.mjs
23859 var import_element72 = __toESM(require_element(), 1);
23860 var import_components10 = __toESM(require_components(), 1);
23861 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1);
23862 var UnforwardedValidatedToggleGroupControl = ({
23863 required,
23864 customValidity,
23865 markWhenOptional,
23866 ...restProps
23867 }, forwardedRef) => {
23868 const validityTargetRef = (0, import_element72.useRef)(null);
23869 const nameAttr = (0, import_element72.useId)();
23870 return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "dataviews-validated-control__wrapper-with-error-delegate", children: [
23871 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
23872 ControlWithError,
23873 {
23874 className: "dataviews-validated-control",
23875 required,
23876 markWhenOptional,
23877 customValidity,
23878 getValidityTarget: () => validityTargetRef.current,
23879 children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components10.__experimentalToggleGroupControl, { ref: forwardedRef, ...restProps })
23880 }
23881 ),
23882 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
23883 "input",
23884 {
23885 className: "dataviews-validated-control__error-delegate",
23886 type: "radio",
23887 ref: validityTargetRef,
23888 required,
23889 checked: restProps.value !== void 0,
23890 tabIndex: -1,
23891 name: nameAttr,
23892 onChange: () => {
23893 },
23894 onFocus: (e) => {
23895 e.target.previousElementSibling?.querySelector(
23896 '[data-active-item="true"]'
23897 )?.focus();
23898 }
23899 }
23900 )
23901 ] });
23902 };
23903 var ValidatedToggleGroupControl = (0, import_element72.forwardRef)(UnforwardedValidatedToggleGroupControl);
23904 ValidatedToggleGroupControl.displayName = "ValidatedToggleGroupControl";
23905
23906 // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs
23907 function getCustomValidity(isValid2, validity) {
23908 let customValidity;
23909 if (isValid2?.required && validity?.required) {
23910 customValidity = validity.required.message ? {
23911 type: validity.required.type,
23912 message: validity.required.message
23913 } : void 0;
23914 } else if (isValid2?.pattern && validity?.pattern) {
23915 customValidity = validity.pattern;
23916 } else if (isValid2?.min && validity?.min) {
23917 customValidity = validity.min;
23918 } else if (isValid2?.max && validity?.max) {
23919 customValidity = validity.max;
23920 } else if (isValid2?.minLength && validity?.minLength) {
23921 customValidity = validity.minLength;
23922 } else if (isValid2?.maxLength && validity?.maxLength) {
23923 customValidity = validity.maxLength;
23924 } else if (isValid2?.elements && validity?.elements) {
23925 customValidity = validity.elements;
23926 } else if (validity?.custom) {
23927 customValidity = validity.custom;
23928 }
23929 return customValidity;
23930 }
23931
23932 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs
23933 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1);
23934 function Checkbox({
23935 field,
23936 onChange,
23937 data,
23938 hideLabelFromVision,
23939 markWhenOptional,
23940 validity
23941 }) {
23942 const { getValue, setValue, label, description, isValid: isValid2 } = field;
23943 const disabled2 = field.isDisabled({ item: data, field });
23944 const onChangeControl = (0, import_element73.useCallback)(() => {
23945 onChange(
23946 setValue({ item: data, value: !getValue({ item: data }) })
23947 );
23948 }, [data, getValue, onChange, setValue]);
23949 return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
23950 ValidatedCheckboxControl,
23951 {
23952 required: !!field.isValid?.required,
23953 markWhenOptional,
23954 customValidity: getCustomValidity(isValid2, validity),
23955 hidden: hideLabelFromVision,
23956 label,
23957 help: description,
23958 checked: getValue({ item: data }),
23959 onChange: onChangeControl,
23960 disabled: disabled2
23961 }
23962 );
23963 }
23964
23965 // packages/dataviews/build-module/components/dataform-controls/combobox.mjs
23966 var import_components11 = __toESM(require_components(), 1);
23967 var import_element74 = __toESM(require_element(), 1);
23968 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1);
23969 function Combobox({
23970 data,
23971 field,
23972 onChange,
23973 hideLabelFromVision,
23974 validity
23975 }) {
23976 const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field;
23977 const value = getValue({ item: data }) ?? "";
23978 const onChangeControl = (0, import_element74.useCallback)(
23979 (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })),
23980 [data, onChange, setValue]
23981 );
23982 const { elements, isLoading } = useElements({
23983 elements: field.elements,
23984 getElements: field.getElements
23985 });
23986 if (isLoading) {
23987 return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_components11.Spinner, {});
23988 }
23989 return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
23990 ValidatedComboboxControl,
23991 {
23992 required: !!field.isValid?.required,
23993 customValidity: getCustomValidity(isValid2, validity),
23994 label,
23995 value,
23996 help: description,
23997 placeholder,
23998 options: elements,
23999 onChange: onChangeControl,
24000 hideLabelFromVision,
24001 allowReset: true,
24002 expandOnFocus: true
24003 }
24004 );
24005 }
24006
24007 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
24008 var import_components13 = __toESM(require_components(), 1);
24009 var import_element77 = __toESM(require_element(), 1);
24010 var import_i18n14 = __toESM(require_i18n(), 1);
24011 var import_date5 = __toESM(require_date(), 1);
24012 import { speak as speak2 } from "@wordpress/a11y";
24013
24014 // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs
24015 var import_components12 = __toESM(require_components(), 1);
24016 var import_element75 = __toESM(require_element(), 1);
24017 var import_i18n12 = __toESM(require_i18n(), 1);
24018 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1);
24019 var TIME_UNITS_OPTIONS = {
24020 [OPERATOR_IN_THE_PAST]: [
24021 { value: "days", label: (0, import_i18n12.__)("Days") },
24022 { value: "weeks", label: (0, import_i18n12.__)("Weeks") },
24023 { value: "months", label: (0, import_i18n12.__)("Months") },
24024 { value: "years", label: (0, import_i18n12.__)("Years") }
24025 ],
24026 [OPERATOR_OVER]: [
24027 { value: "days", label: (0, import_i18n12.__)("Days ago") },
24028 { value: "weeks", label: (0, import_i18n12.__)("Weeks ago") },
24029 { value: "months", label: (0, import_i18n12.__)("Months ago") },
24030 { value: "years", label: (0, import_i18n12.__)("Years ago") }
24031 ]
24032 };
24033 function RelativeDateControl({
24034 className,
24035 data,
24036 field,
24037 onChange,
24038 hideLabelFromVision,
24039 operator
24040 }) {
24041 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"];
24042 const { id, label, description, getValue, setValue } = field;
24043 const disabled2 = field.isDisabled({ item: data, field });
24044 const fieldValue = getValue({ item: data });
24045 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {};
24046 const onChangeValue = (0, import_element75.useCallback)(
24047 (newValue) => onChange(
24048 setValue({
24049 item: data,
24050 value: { value: Number(newValue), unit }
24051 })
24052 ),
24053 [onChange, setValue, data, unit]
24054 );
24055 const onChangeUnit = (0, import_element75.useCallback)(
24056 (newUnit) => onChange(
24057 setValue({
24058 item: data,
24059 value: { value: relValue, unit: newUnit }
24060 })
24061 ),
24062 [onChange, setValue, data, relValue]
24063 );
24064 return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
24065 import_components12.BaseControl,
24066 {
24067 id,
24068 className: clsx_default(className, "dataviews-controls__relative-date"),
24069 label,
24070 hideLabelFromVision,
24071 help: description,
24072 children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(Stack, { direction: "row", gap: "sm", children: [
24073 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
24074 import_components12.__experimentalNumberControl,
24075 {
24076 className: "dataviews-controls__relative-date-number",
24077 spinControls: "none",
24078 min: 1,
24079 step: 1,
24080 value: relValue,
24081 onChange: onChangeValue,
24082 disabled: disabled2
24083 }
24084 ),
24085 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
24086 import_components12.SelectControl,
24087 {
24088 className: "dataviews-controls__relative-date-unit",
24089 label: (0, import_i18n12.__)("Unit"),
24090 value: unit,
24091 options,
24092 onChange: onChangeUnit,
24093 hideLabelFromVision: true,
24094 disabled: disabled2
24095 }
24096 )
24097 ] })
24098 }
24099 );
24100 }
24101
24102 // packages/dataviews/build-module/components/dataform-controls/utils/to-calendar-date.mjs
24103 function toCalendarDate(date, timeZone) {
24104 return timeZone ? new TZDate(date, timeZone) : date;
24105 }
24106
24107 // packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs
24108 var import_element76 = __toESM(require_element(), 1);
24109 function useDisabledDateMatchers(isValid2, parseDateFn) {
24110 const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0;
24111 const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0;
24112 const disabledMatchers = (0, import_element76.useMemo)(() => {
24113 const matchers = [];
24114 if (minConstraint) {
24115 const minDate = parseDateFn(minConstraint);
24116 if (minDate) {
24117 matchers.push({ before: minDate });
24118 }
24119 }
24120 if (maxConstraint) {
24121 const maxDate = parseDateFn(maxConstraint);
24122 if (maxDate) {
24123 matchers.push({ after: maxDate });
24124 }
24125 }
24126 return matchers.length > 0 ? matchers : void 0;
24127 }, [minConstraint, maxConstraint, parseDateFn]);
24128 return { minConstraint, maxConstraint, disabledMatchers };
24129 }
24130
24131 // packages/dataviews/build-module/components/dataform-controls/utils/get-calendar-locale.mjs
24132 var LANGUAGE_ALIASES = {
24133 ary: "ar-MA",
24134 // Moroccan Arabic.
24135 haz: "fa"
24136 // Hazaragi, a variety of Persian.
24137 };
24138 function getCalendarLocale(wpLocale) {
24139 const subtags = wpLocale?.trim().split(/[_-]/) ?? [];
24140 const language = subtags.shift()?.toLowerCase();
24141 if (!language) {
24142 return void 0;
24143 }
24144 const normalized = [LANGUAGE_ALIASES[language] ?? language];
24145 for (const subtag of subtags) {
24146 if (/^[a-z]{4}$/i.test(subtag) || /^([a-z]{2}|\d{3})$/i.test(subtag)) {
24147 normalized.push(subtag);
24148 }
24149 }
24150 return normalized.join("-");
24151 }
24152
24153 // packages/dataviews/build-module/components/dataform-controls/utils/get-timezone-description.mjs
24154 var import_date3 = __toESM(require_date(), 1);
24155 var import_i18n13 = __toESM(require_i18n(), 1);
24156 function getTimezoneDescription() {
24157 const { timezone } = (0, import_date3.getSettings)();
24158 const userTimezoneOffset = -1 * ((/* @__PURE__ */ new Date()).getTimezoneOffset() / 60);
24159 if (Number(timezone.offset) === userTimezoneOffset) {
24160 return void 0;
24161 }
24162 const offsetSymbol = Number(timezone.offset) >= 0 ? "+" : "";
24163 const zoneAbbr = "" !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offsetFormatted}`;
24164 const prettyTimezoneString = timezone.string.replaceAll("_", " ");
24165 let timezoneDetail = zoneAbbr;
24166 if ("UTC" === timezone.string) {
24167 timezoneDetail = (0, import_i18n13.__)("Coordinated Universal Time");
24168 } else if (prettyTimezoneString.trim().length > 0) {
24169 timezoneDetail = `(${zoneAbbr}) ${prettyTimezoneString}`;
24170 }
24171 return (0, import_i18n13.sprintf)(
24172 /* translators: %s: timezone detail, e.g. "(CEST) Europe/Madrid" or "UTC+3". */
24173 (0, import_i18n13.__)("Timezone: %s"),
24174 timezoneDetail
24175 );
24176 }
24177
24178 // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs
24179 var import_date4 = __toESM(require_date(), 1);
24180 function parseDateTime(dateTimeString) {
24181 if (!dateTimeString) {
24182 return null;
24183 }
24184 const parsed = (0, import_date4.getDate)(dateTimeString);
24185 return parsed && isValid(parsed) ? parsed : null;
24186 }
24187
24188 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs
24189 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1);
24190 var formatDateTime = (value) => {
24191 if (!value) {
24192 return "";
24193 }
24194 return (0, import_date5.dateI18n)("Y-m-d\\TH:i", (0, import_date5.getDate)(value));
24195 };
24196 function CalendarDateTimeControl({
24197 data,
24198 field,
24199 onChange,
24200 hideLabelFromVision,
24201 markWhenOptional,
24202 validity,
24203 config
24204 }) {
24205 const { compact } = config || {};
24206 const { id, label, description, setValue, getValue, isValid: isValid2 } = field;
24207 const disabled2 = field.isDisabled({ item: data, field });
24208 const fieldValue = getValue({ item: data });
24209 const value = typeof fieldValue === "string" ? fieldValue : void 0;
24210 const { timezone } = (0, import_date5.getSettings)();
24211 const timeZone = timezone.string || (0, import_date5.dateI18n)("P");
24212 const [calendarMonth, setCalendarMonth] = (0, import_element77.useState)(() => {
24213 const parsedDate = parseDateTime(value);
24214 return toCalendarDate(parsedDate || /* @__PURE__ */ new Date(), timeZone);
24215 });
24216 (0, import_element77.useEffect)(() => {
24217 const parsedDate = parseDateTime(value);
24218 if (parsedDate) {
24219 const targetMonth = toCalendarDate(parsedDate, timeZone);
24220 setCalendarMonth(
24221 (currentMonth) => isSameMonth(
24222 targetMonth,
24223 toCalendarDate(currentMonth, timeZone)
24224 ) ? currentMonth : targetMonth
24225 );
24226 }
24227 }, [timeZone, value]);
24228 const inputControlRef = (0, import_element77.useRef)(null);
24229 const validationTimeoutRef = (0, import_element77.useRef)(void 0);
24230 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime);
24231 const onChangeCallback = (0, import_element77.useCallback)(
24232 (newValue) => onChange(setValue({ item: data, value: newValue })),
24233 [data, onChange, setValue]
24234 );
24235 (0, import_element77.useEffect)(() => {
24236 return () => clearTimeout(validationTimeoutRef.current);
24237 }, []);
24238 const onSelectDate = (0, import_element77.useCallback)(
24239 (newDate) => {
24240 if (newDate) {
24241 const wpDate = (0, import_date5.dateI18n)("Y-m-d", newDate);
24242 const wpTime = value ? (0, import_date5.dateI18n)("H:i", (0, import_date5.getDate)(value)) : "00:00";
24243 const finalDateTime = (0, import_date5.getDate)(`${wpDate}T${wpTime}`);
24244 onChangeCallback(finalDateTime.toISOString());
24245 } else {
24246 onChangeCallback(void 0);
24247 }
24248 clearTimeout(validationTimeoutRef.current);
24249 validationTimeoutRef.current = setTimeout(() => {
24250 const input = inputControlRef.current;
24251 if (!input) {
24252 return;
24253 }
24254 input.dispatchEvent(
24255 new Event("invalid", { cancelable: true })
24256 );
24257 if (input.validationMessage) {
24258 speak2(input.validationMessage);
24259 }
24260 }, 0);
24261 },
24262 [onChangeCallback, value]
24263 );
24264 const handleManualDateTimeChange = (0, import_element77.useCallback)(
24265 (newValue) => {
24266 if (newValue) {
24267 const dateTime = (0, import_date5.getDate)(newValue);
24268 onChangeCallback(dateTime.toISOString());
24269 const parsedDate = parseDateTime(dateTime.toISOString());
24270 if (parsedDate) {
24271 setCalendarMonth(toCalendarDate(parsedDate, timeZone));
24272 }
24273 } else {
24274 onChangeCallback(void 0);
24275 }
24276 },
24277 [onChangeCallback, timeZone]
24278 );
24279 const { format: fieldFormat } = field;
24280 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek;
24281 const locale = getCalendarLocale((0, import_date5.getSettings)().l10n.locale);
24282 let displayLabel = label;
24283 if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) {
24284 displayLabel = `${label} (${(0, import_i18n14.__)("Required")})`;
24285 } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) {
24286 displayLabel = `${label} (${(0, import_i18n14.__)("Optional")})`;
24287 }
24288 return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
24289 import_components13.BaseControl,
24290 {
24291 id,
24292 label: displayLabel,
24293 help: description,
24294 hideLabelFromVision,
24295 children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(Stack, { direction: "column", gap: "lg", children: [
24296 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
24297 ValidatedInputControl,
24298 {
24299 ref: inputControlRef,
24300 required: !!isValid2?.required,
24301 customValidity: getCustomValidity(isValid2, validity),
24302 type: "datetime-local",
24303 label: (0, import_i18n14.__)("Date time"),
24304 hideLabelFromVision: true,
24305 value: formatDateTime(value),
24306 onValueChange: handleManualDateTimeChange,
24307 disabled: disabled2,
24308 description: getTimezoneDescription(),
24309 min: minConstraint ? formatDateTime(minConstraint) : void 0,
24310 max: maxConstraint ? formatDateTime(maxConstraint) : void 0
24311 }
24312 ),
24313 !compact && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
24314 Calendar,
24315 {
24316 style: { width: "100%" },
24317 value: value ? parseDateTime(value) : null,
24318 onValueChange: onSelectDate,
24319 month: calendarMonth,
24320 onMonthChange: setCalendarMonth,
24321 timeZone,
24322 locale,
24323 dir: (0, import_i18n14.isRTL)() ? "rtl" : "ltr",
24324 weekStartsOn,
24325 disabled: disabled2 || disabledMatchers
24326 }
24327 )
24328 ] })
24329 }
24330 );
24331 }
24332 function DateTime({
24333 data,
24334 field,
24335 onChange,
24336 hideLabelFromVision,
24337 markWhenOptional,
24338 operator,
24339 validity,
24340 config
24341 }) {
24342 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
24343 return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
24344 RelativeDateControl,
24345 {
24346 className: "dataviews-controls__datetime",
24347 data,
24348 field,
24349 onChange,
24350 hideLabelFromVision,
24351 operator
24352 }
24353 );
24354 }
24355 return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
24356 CalendarDateTimeControl,
24357 {
24358 data,
24359 field,
24360 onChange,
24361 hideLabelFromVision,
24362 markWhenOptional,
24363 validity,
24364 config
24365 }
24366 );
24367 }
24368
24369 // packages/dataviews/build-module/components/dataform-controls/date.mjs
24370 var import_components14 = __toESM(require_components(), 1);
24371 var import_element78 = __toESM(require_element(), 1);
24372 var import_i18n15 = __toESM(require_i18n(), 1);
24373 var import_date6 = __toESM(require_date(), 1);
24374 import { speak as speak3 } from "@wordpress/a11y";
24375 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1);
24376 var DATE_PRESETS = [
24377 {
24378 id: "today",
24379 label: (0, import_i18n15.__)("Today"),
24380 getValue: () => (0, import_date6.getDate)(null)
24381 },
24382 {
24383 id: "yesterday",
24384 label: (0, import_i18n15.__)("Yesterday"),
24385 getValue: () => {
24386 const today = (0, import_date6.getDate)(null);
24387 return subDays(today, 1);
24388 }
24389 },
24390 {
24391 id: "past-week",
24392 label: (0, import_i18n15.__)("Past week"),
24393 getValue: () => {
24394 const today = (0, import_date6.getDate)(null);
24395 return subDays(today, 7);
24396 }
24397 },
24398 {
24399 id: "past-month",
24400 label: (0, import_i18n15.__)("Past month"),
24401 getValue: () => {
24402 const today = (0, import_date6.getDate)(null);
24403 return subMonths(today, 1);
24404 }
24405 }
24406 ];
24407 var DATE_RANGE_PRESETS = [
24408 {
24409 id: "last-7-days",
24410 label: (0, import_i18n15.__)("Last 7 days"),
24411 getValue: () => {
24412 const today = (0, import_date6.getDate)(null);
24413 return [subDays(today, 7), today];
24414 }
24415 },
24416 {
24417 id: "last-30-days",
24418 label: (0, import_i18n15.__)("Last 30 days"),
24419 getValue: () => {
24420 const today = (0, import_date6.getDate)(null);
24421 return [subDays(today, 30), today];
24422 }
24423 },
24424 {
24425 id: "month-to-date",
24426 label: (0, import_i18n15.__)("Month to date"),
24427 getValue: () => {
24428 const today = (0, import_date6.getDate)(null);
24429 return [startOfMonth(today), today];
24430 }
24431 },
24432 {
24433 id: "last-year",
24434 label: (0, import_i18n15.__)("Last year"),
24435 getValue: () => {
24436 const today = (0, import_date6.getDate)(null);
24437 return [subYears(today, 1), today];
24438 }
24439 },
24440 {
24441 id: "year-to-date",
24442 label: (0, import_i18n15.__)("Year to date"),
24443 getValue: () => {
24444 const today = (0, import_date6.getDate)(null);
24445 return [startOfYear(today), today];
24446 }
24447 }
24448 ];
24449 var parseDate2 = (dateString) => {
24450 if (!dateString) {
24451 return null;
24452 }
24453 const parsed = parseISO(dateString);
24454 return isValid(parsed) ? parsed : null;
24455 };
24456 var formatDate = (date) => {
24457 if (!date) {
24458 return "";
24459 }
24460 return typeof date === "string" ? date : format(date, "yyyy-MM-dd");
24461 };
24462 function ValidatedDateControl({
24463 field,
24464 validity,
24465 inputRefs,
24466 isTouched,
24467 setIsTouched,
24468 children
24469 }) {
24470 const { isValid: isValid2 } = field;
24471 const [customValidity, setCustomValidity] = (0, import_element78.useState)(void 0);
24472 const validateRefs = (0, import_element78.useCallback)(() => {
24473 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
24474 for (const ref of refs) {
24475 const input = ref.current;
24476 if (input && !input.validity.valid) {
24477 setCustomValidity({
24478 type: "invalid",
24479 message: input.validationMessage
24480 });
24481 return;
24482 }
24483 }
24484 setCustomValidity(void 0);
24485 }, [inputRefs]);
24486 (0, import_element78.useEffect)(() => {
24487 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
24488 const result = validity ? getCustomValidity(isValid2, validity) : void 0;
24489 for (const ref of refs) {
24490 const input = ref.current;
24491 if (input) {
24492 input.setCustomValidity(
24493 result?.type === "invalid" && result.message ? result.message : ""
24494 );
24495 }
24496 }
24497 }, [inputRefs, isValid2, validity]);
24498 (0, import_element78.useEffect)(() => {
24499 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs];
24500 const handleInvalid = (event) => {
24501 event.preventDefault();
24502 setIsTouched(true);
24503 };
24504 for (const ref of refs) {
24505 ref.current?.addEventListener("invalid", handleInvalid);
24506 }
24507 return () => {
24508 for (const ref of refs) {
24509 ref.current?.removeEventListener("invalid", handleInvalid);
24510 }
24511 };
24512 }, [inputRefs, setIsTouched]);
24513 (0, import_element78.useEffect)(() => {
24514 if (!isTouched) {
24515 return;
24516 }
24517 const result = validity ? getCustomValidity(isValid2, validity) : void 0;
24518 if (result) {
24519 setCustomValidity(result);
24520 } else {
24521 validateRefs();
24522 }
24523 }, [isTouched, isValid2, validity, validateRefs]);
24524 (0, import_element78.useEffect)(() => {
24525 if (isTouched && customValidity?.message) {
24526 speak3(customValidity.message);
24527 }
24528 }, [isTouched, customValidity?.message]);
24529 const onBlur = (event) => {
24530 if (isTouched) {
24531 return;
24532 }
24533 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) {
24534 setIsTouched(true);
24535 }
24536 };
24537 return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Stack, { direction: "column", gap: "sm", onBlur, children: [
24538 children,
24539 customValidity && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24540 ValidityIndicator,
24541 {
24542 type: customValidity.type,
24543 message: customValidity.message
24544 }
24545 )
24546 ] });
24547 }
24548 function CalendarDateControl({
24549 data,
24550 field,
24551 onChange,
24552 hideLabelFromVision,
24553 markWhenOptional,
24554 validity
24555 }) {
24556 const {
24557 id,
24558 label,
24559 description,
24560 setValue,
24561 getValue,
24562 isValid: isValid2,
24563 format: fieldFormat
24564 } = field;
24565 const disabled2 = field.isDisabled({ item: data, field });
24566 const [selectedPresetId, setSelectedPresetId] = (0, import_element78.useState)(
24567 null
24568 );
24569 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek;
24570 const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale);
24571 const fieldValue = getValue({ item: data });
24572 const value = typeof fieldValue === "string" ? fieldValue : void 0;
24573 const [calendarMonth, setCalendarMonth] = (0, import_element78.useState)(() => {
24574 const parsedDate = parseDate2(value);
24575 return parsedDate || /* @__PURE__ */ new Date();
24576 });
24577 (0, import_element78.useEffect)(() => {
24578 const parsedDate = parseDate2(value);
24579 if (parsedDate) {
24580 setCalendarMonth(
24581 (currentMonth) => isSameMonth(parsedDate, currentMonth) ? currentMonth : parsedDate
24582 );
24583 }
24584 }, [value]);
24585 const [isTouched, setIsTouched] = (0, import_element78.useState)(false);
24586 const validityTargetRef = (0, import_element78.useRef)(null);
24587 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2);
24588 const onChangeCallback = (0, import_element78.useCallback)(
24589 (newValue) => onChange(setValue({ item: data, value: newValue })),
24590 [data, onChange, setValue]
24591 );
24592 const onSelectDate = (0, import_element78.useCallback)(
24593 (newDate) => {
24594 const dateValue = newDate ? formatDate(newDate) : void 0;
24595 onChangeCallback(dateValue);
24596 setSelectedPresetId(null);
24597 setIsTouched(true);
24598 },
24599 [onChangeCallback]
24600 );
24601 const handlePresetClick = (0, import_element78.useCallback)(
24602 (preset) => {
24603 const presetDate = preset.getValue();
24604 const dateValue = formatDate(presetDate);
24605 setCalendarMonth(presetDate);
24606 onChangeCallback(dateValue);
24607 setSelectedPresetId(preset.id);
24608 setIsTouched(true);
24609 },
24610 [onChangeCallback]
24611 );
24612 const handleManualDateChange = (0, import_element78.useCallback)(
24613 (newValue) => {
24614 onChangeCallback(newValue);
24615 if (newValue) {
24616 const parsedDate = parseDate2(newValue);
24617 if (parsedDate) {
24618 setCalendarMonth(parsedDate);
24619 }
24620 }
24621 setSelectedPresetId(null);
24622 setIsTouched(true);
24623 },
24624 [onChangeCallback]
24625 );
24626 let displayLabel = label;
24627 if (isValid2?.required && !markWhenOptional) {
24628 displayLabel = `${label} (${(0, import_i18n15.__)("Required")})`;
24629 } else if (!isValid2?.required && markWhenOptional) {
24630 displayLabel = `${label} (${(0, import_i18n15.__)("Optional")})`;
24631 }
24632 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24633 ValidatedDateControl,
24634 {
24635 field,
24636 validity,
24637 inputRefs: validityTargetRef,
24638 isTouched,
24639 setIsTouched,
24640 children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24641 import_components14.BaseControl,
24642 {
24643 id,
24644 className: "dataviews-controls__date",
24645 label: displayLabel,
24646 help: description,
24647 hideLabelFromVision,
24648 children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Stack, { direction: "column", gap: "lg", children: [
24649 /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
24650 Stack,
24651 {
24652 direction: "row",
24653 gap: "sm",
24654 wrap: "wrap",
24655 justify: "flex-start",
24656 children: [
24657 DATE_PRESETS.map((preset) => {
24658 const isSelected = selectedPresetId === preset.id;
24659 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24660 import_components14.Button,
24661 {
24662 className: "dataviews-controls__date-preset",
24663 variant: "tertiary",
24664 isPressed: isSelected,
24665 size: "small",
24666 disabled: disabled2,
24667 accessibleWhenDisabled: true,
24668 onClick: () => handlePresetClick(preset),
24669 children: preset.label
24670 },
24671 preset.id
24672 );
24673 }),
24674 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24675 import_components14.Button,
24676 {
24677 className: "dataviews-controls__date-preset",
24678 variant: "tertiary",
24679 isPressed: !selectedPresetId,
24680 size: "small",
24681 disabled: !!selectedPresetId || disabled2,
24682 accessibleWhenDisabled: true,
24683 children: (0, import_i18n15.__)("Custom")
24684 }
24685 )
24686 ]
24687 }
24688 ),
24689 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24690 import_components14.__experimentalInputControl,
24691 {
24692 ref: validityTargetRef,
24693 type: "date",
24694 label: (0, import_i18n15.__)("Date"),
24695 hideLabelFromVision: true,
24696 value,
24697 onChange: handleManualDateChange,
24698 required: !!field.isValid?.required,
24699 disabled: disabled2,
24700 min: minConstraint,
24701 max: maxConstraint
24702 }
24703 ),
24704 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24705 Calendar,
24706 {
24707 style: { width: "100%" },
24708 value: value ? parseDate2(value) : null,
24709 onValueChange: onSelectDate,
24710 month: calendarMonth,
24711 onMonthChange: setCalendarMonth,
24712 locale,
24713 dir: (0, import_i18n15.isRTL)() ? "rtl" : "ltr",
24714 weekStartsOn,
24715 disabled: disabled2 || disabledMatchers,
24716 disableNavigation: disabled2
24717 }
24718 )
24719 ] })
24720 }
24721 )
24722 }
24723 );
24724 }
24725 function CalendarDateRangeControl({
24726 data,
24727 field,
24728 onChange,
24729 hideLabelFromVision,
24730 markWhenOptional,
24731 validity
24732 }) {
24733 const {
24734 id,
24735 label,
24736 description,
24737 getValue,
24738 setValue,
24739 isValid: isValid2,
24740 format: fieldFormat
24741 } = field;
24742 const disabled2 = field.isDisabled({ item: data, field });
24743 let value;
24744 const fieldValue = getValue({ item: data });
24745 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) {
24746 value = fieldValue;
24747 }
24748 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek;
24749 const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale);
24750 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2);
24751 const onChangeCallback = (0, import_element78.useCallback)(
24752 (newValue) => {
24753 onChange(
24754 setValue({
24755 item: data,
24756 value: newValue
24757 })
24758 );
24759 },
24760 [data, onChange, setValue]
24761 );
24762 const [selectedPresetId, setSelectedPresetId] = (0, import_element78.useState)(
24763 null
24764 );
24765 const selectedRange = (0, import_element78.useMemo)(() => {
24766 if (!value) {
24767 return null;
24768 }
24769 const [from, to] = value;
24770 return {
24771 from: parseDate2(from) || void 0,
24772 to: parseDate2(to) || void 0
24773 };
24774 }, [value]);
24775 const [calendarMonth, setCalendarMonth] = (0, import_element78.useState)(() => {
24776 return selectedRange?.from || /* @__PURE__ */ new Date();
24777 });
24778 const [fromValue, toValue] = value ?? [];
24779 (0, import_element78.useEffect)(() => {
24780 setCalendarMonth((currentMonth) => {
24781 const from = parseDate2(fromValue);
24782 const to = parseDate2(toValue);
24783 const targetMonth = from ?? to;
24784 const isRangeVisible = from && to ? areIntervalsOverlapping(
24785 { start: from, end: to },
24786 {
24787 start: startOfMonth(currentMonth),
24788 end: endOfMonth(currentMonth)
24789 },
24790 { inclusive: true }
24791 ) : [from, to].some(
24792 (date) => date && isSameMonth(date, currentMonth)
24793 );
24794 return targetMonth && !isRangeVisible ? targetMonth : currentMonth;
24795 });
24796 }, [fromValue, toValue]);
24797 const [isTouched, setIsTouched] = (0, import_element78.useState)(false);
24798 const fromInputRef = (0, import_element78.useRef)(null);
24799 const toInputRef = (0, import_element78.useRef)(null);
24800 const updateDateRange = (0, import_element78.useCallback)(
24801 (fromDate, toDate2) => {
24802 if (!fromDate && !toDate2) {
24803 onChangeCallback(void 0);
24804 return;
24805 }
24806 onChangeCallback([
24807 formatDate(fromDate),
24808 formatDate(toDate2)
24809 ]);
24810 },
24811 [onChangeCallback]
24812 );
24813 const onSelectCalendarRange = (0, import_element78.useCallback)(
24814 (newRange) => {
24815 updateDateRange(newRange?.from, newRange?.to);
24816 setSelectedPresetId(null);
24817 setIsTouched(true);
24818 },
24819 [updateDateRange]
24820 );
24821 const handlePresetClick = (0, import_element78.useCallback)(
24822 (preset) => {
24823 const [startDate, endDate] = preset.getValue();
24824 setCalendarMonth(startDate);
24825 updateDateRange(startDate, endDate);
24826 setSelectedPresetId(preset.id);
24827 setIsTouched(true);
24828 },
24829 [updateDateRange]
24830 );
24831 const handleManualDateChange = (0, import_element78.useCallback)(
24832 (fromOrTo, newValue) => {
24833 const [currentFrom, currentTo] = value || [
24834 void 0,
24835 void 0
24836 ];
24837 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom;
24838 const updatedTo = fromOrTo === "to" ? newValue : currentTo;
24839 updateDateRange(updatedFrom, updatedTo);
24840 if (newValue) {
24841 const parsedDate = parseDate2(newValue);
24842 if (parsedDate) {
24843 setCalendarMonth(parsedDate);
24844 }
24845 }
24846 setSelectedPresetId(null);
24847 setIsTouched(true);
24848 },
24849 [value, updateDateRange]
24850 );
24851 let displayLabel = label;
24852 if (field.isValid?.required && !markWhenOptional) {
24853 displayLabel = `${label} (${(0, import_i18n15.__)("Required")})`;
24854 } else if (!field.isValid?.required && markWhenOptional) {
24855 displayLabel = `${label} (${(0, import_i18n15.__)("Optional")})`;
24856 }
24857 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24858 ValidatedDateControl,
24859 {
24860 field,
24861 validity,
24862 inputRefs: [fromInputRef, toInputRef],
24863 isTouched,
24864 setIsTouched,
24865 children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24866 import_components14.BaseControl,
24867 {
24868 id,
24869 className: "dataviews-controls__date",
24870 label: displayLabel,
24871 help: description,
24872 hideLabelFromVision,
24873 children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(Stack, { direction: "column", gap: "lg", children: [
24874 /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
24875 Stack,
24876 {
24877 direction: "row",
24878 gap: "sm",
24879 wrap: "wrap",
24880 justify: "flex-start",
24881 children: [
24882 DATE_RANGE_PRESETS.map((preset) => {
24883 const isSelected = selectedPresetId === preset.id;
24884 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24885 import_components14.Button,
24886 {
24887 className: "dataviews-controls__date-preset",
24888 variant: "tertiary",
24889 isPressed: isSelected,
24890 size: "small",
24891 disabled: disabled2,
24892 accessibleWhenDisabled: true,
24893 onClick: () => handlePresetClick(preset),
24894 children: preset.label
24895 },
24896 preset.id
24897 );
24898 }),
24899 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24900 import_components14.Button,
24901 {
24902 className: "dataviews-controls__date-preset",
24903 variant: "tertiary",
24904 isPressed: !selectedPresetId,
24905 size: "small",
24906 accessibleWhenDisabled: true,
24907 disabled: !!selectedPresetId || disabled2,
24908 children: (0, import_i18n15.__)("Custom")
24909 }
24910 )
24911 ]
24912 }
24913 ),
24914 /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
24915 Stack,
24916 {
24917 direction: "row",
24918 gap: "sm",
24919 justify: "space-between",
24920 className: "dataviews-controls__date-range-inputs",
24921 children: [
24922 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24923 import_components14.__experimentalInputControl,
24924 {
24925 ref: fromInputRef,
24926 type: "date",
24927 label: (0, import_i18n15.__)("From"),
24928 hideLabelFromVision: true,
24929 value: value?.[0],
24930 onChange: (newValue) => handleManualDateChange("from", newValue),
24931 required: !!field.isValid?.required,
24932 disabled: disabled2,
24933 min: minConstraint,
24934 max: maxConstraint
24935 }
24936 ),
24937 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24938 import_components14.__experimentalInputControl,
24939 {
24940 ref: toInputRef,
24941 type: "date",
24942 label: (0, import_i18n15.__)("To"),
24943 hideLabelFromVision: true,
24944 value: value?.[1],
24945 onChange: (newValue) => handleManualDateChange("to", newValue),
24946 required: !!field.isValid?.required,
24947 disabled: disabled2,
24948 min: minConstraint,
24949 max: maxConstraint
24950 }
24951 )
24952 ]
24953 }
24954 ),
24955 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24956 RangeCalendar,
24957 {
24958 style: { width: "100%" },
24959 value: selectedRange,
24960 onValueChange: onSelectCalendarRange,
24961 month: calendarMonth,
24962 onMonthChange: setCalendarMonth,
24963 locale,
24964 dir: (0, import_i18n15.isRTL)() ? "rtl" : "ltr",
24965 weekStartsOn,
24966 disabled: disabled2 || disabledMatchers
24967 }
24968 )
24969 ] })
24970 }
24971 )
24972 }
24973 );
24974 }
24975 function DateControl({
24976 data,
24977 field,
24978 onChange,
24979 hideLabelFromVision,
24980 markWhenOptional,
24981 operator,
24982 validity
24983 }) {
24984 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) {
24985 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24986 RelativeDateControl,
24987 {
24988 className: "dataviews-controls__date",
24989 data,
24990 field,
24991 onChange,
24992 hideLabelFromVision,
24993 operator
24994 }
24995 );
24996 }
24997 if (operator === OPERATOR_BETWEEN) {
24998 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
24999 CalendarDateRangeControl,
25000 {
25001 data,
25002 field,
25003 onChange,
25004 hideLabelFromVision,
25005 markWhenOptional,
25006 validity
25007 }
25008 );
25009 }
25010 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
25011 CalendarDateControl,
25012 {
25013 data,
25014 field,
25015 onChange,
25016 hideLabelFromVision,
25017 markWhenOptional,
25018 validity
25019 }
25020 );
25021 }
25022
25023 // packages/dataviews/build-module/components/dataform-controls/select.mjs
25024 var import_components15 = __toESM(require_components(), 1);
25025 var import_element79 = __toESM(require_element(), 1);
25026 var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
25027 function Select2({
25028 data,
25029 field,
25030 onChange,
25031 hideLabelFromVision,
25032 markWhenOptional,
25033 validity
25034 }) {
25035 const { type, label, description, getValue, setValue, isValid: isValid2 } = field;
25036 const disabled2 = field.isDisabled({ item: data, field });
25037 const isMultiple = type === "array";
25038 const value = getValue({ item: data }) ?? (isMultiple ? [] : "");
25039 const onChangeControl = (0, import_element79.useCallback)(
25040 (newValue) => onChange(setValue({ item: data, value: newValue })),
25041 [data, onChange, setValue]
25042 );
25043 const { elements, isLoading } = useElements({
25044 elements: field.elements,
25045 getElements: field.getElements
25046 });
25047 if (isLoading) {
25048 return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_components15.Spinner, {});
25049 }
25050 return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
25051 ValidatedSelectControl,
25052 {
25053 required: !!field.isValid?.required,
25054 markWhenOptional,
25055 customValidity: getCustomValidity(isValid2, validity),
25056 label,
25057 value,
25058 help: description,
25059 options: elements,
25060 onChange: onChangeControl,
25061 hideLabelFromVision,
25062 multiple: isMultiple,
25063 disabled: disabled2
25064 }
25065 );
25066 }
25067
25068 // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs
25069 var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
25070 var ELEMENTS_THRESHOLD = 10;
25071 function AdaptiveSelect(props) {
25072 const { field } = props;
25073 const { elements } = useElements({
25074 elements: field.elements,
25075 getElements: field.getElements
25076 });
25077 if (elements.length >= ELEMENTS_THRESHOLD) {
25078 return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Combobox, { ...props });
25079 }
25080 return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Select2, { ...props });
25081 }
25082
25083 // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs
25084 var import_element80 = __toESM(require_element(), 1);
25085 var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
25086 function ValidatedText({
25087 data,
25088 field,
25089 onChange,
25090 hideLabelFromVision,
25091 markWhenOptional,
25092 type,
25093 prefix,
25094 suffix,
25095 validity
25096 }) {
25097 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
25098 const value = getValue({ item: data });
25099 const disabled2 = field.isDisabled({ item: data, field });
25100 const onValueChangeControl = (0, import_element80.useCallback)(
25101 (newValue) => onChange(
25102 setValue({
25103 item: data,
25104 value: newValue
25105 })
25106 ),
25107 [data, setValue, onChange]
25108 );
25109 return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
25110 ValidatedInputControl,
25111 {
25112 required: !!isValid2.required,
25113 markWhenOptional,
25114 customValidity: getCustomValidity(isValid2, validity),
25115 label,
25116 placeholder,
25117 value: value ?? "",
25118 description: typeof description === "string" ? description : void 0,
25119 details: typeof description === "string" ? void 0 : description,
25120 onValueChange: onValueChangeControl,
25121 hideLabelFromVision,
25122 type,
25123 prefix,
25124 suffix,
25125 disabled: disabled2,
25126 pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0,
25127 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
25128 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0
25129 }
25130 );
25131 }
25132
25133 // packages/dataviews/build-module/components/dataform-controls/email.mjs
25134 var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
25135 function Email({
25136 data,
25137 field,
25138 onChange,
25139 hideLabelFromVision,
25140 markWhenOptional,
25141 validity
25142 }) {
25143 return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
25144 ValidatedText,
25145 {
25146 ...{
25147 data,
25148 field,
25149 onChange,
25150 hideLabelFromVision,
25151 markWhenOptional,
25152 validity,
25153 type: "email",
25154 prefix: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Icon, { icon: envelope_default }) })
25155 }
25156 }
25157 );
25158 }
25159
25160 // packages/dataviews/build-module/components/dataform-controls/telephone.mjs
25161 var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
25162 function Telephone({
25163 data,
25164 field,
25165 onChange,
25166 hideLabelFromVision,
25167 markWhenOptional,
25168 validity
25169 }) {
25170 return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
25171 ValidatedText,
25172 {
25173 ...{
25174 data,
25175 field,
25176 onChange,
25177 hideLabelFromVision,
25178 markWhenOptional,
25179 validity,
25180 type: "tel",
25181 prefix: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Icon, { icon: mobile_default }) })
25182 }
25183 }
25184 );
25185 }
25186
25187 // packages/dataviews/build-module/components/dataform-controls/url.mjs
25188 var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
25189 function Url({
25190 data,
25191 field,
25192 onChange,
25193 hideLabelFromVision,
25194 markWhenOptional,
25195 validity
25196 }) {
25197 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
25198 ValidatedText,
25199 {
25200 ...{
25201 data,
25202 field,
25203 onChange,
25204 hideLabelFromVision,
25205 markWhenOptional,
25206 validity,
25207 type: "url",
25208 prefix: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Icon, { icon: link_default }) })
25209 }
25210 }
25211 );
25212 }
25213
25214 // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs
25215 var import_components16 = __toESM(require_components(), 1);
25216 var import_element81 = __toESM(require_element(), 1);
25217 var import_i18n16 = __toESM(require_i18n(), 1);
25218 var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
25219 function toNumberOrEmpty(value) {
25220 if (value === "" || value === void 0) {
25221 return "";
25222 }
25223 const number = Number(value);
25224 return Number.isFinite(number) ? number : "";
25225 }
25226 function BetweenControls({
25227 value,
25228 onChange,
25229 hideLabelFromVision,
25230 step
25231 }) {
25232 const [min3 = "", max3 = ""] = value;
25233 const onChangeMin = (0, import_element81.useCallback)(
25234 (newValue) => onChange([toNumberOrEmpty(newValue), max3]),
25235 [onChange, max3]
25236 );
25237 const onChangeMax = (0, import_element81.useCallback)(
25238 (newValue) => onChange([min3, toNumberOrEmpty(newValue)]),
25239 [onChange, min3]
25240 );
25241 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
25242 import_components16.BaseControl,
25243 {
25244 help: (0, import_i18n16.__)("The max. value must be greater than the min. value."),
25245 children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_components16.Flex, { direction: "row", gap: 4, children: [
25246 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
25247 import_components16.__experimentalNumberControl,
25248 {
25249 label: (0, import_i18n16.__)("Min."),
25250 value: min3,
25251 max: max3 ? Number(max3) - step : void 0,
25252 onChange: onChangeMin,
25253 hideLabelFromVision,
25254 step
25255 }
25256 ),
25257 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
25258 import_components16.__experimentalNumberControl,
25259 {
25260 label: (0, import_i18n16.__)("Max."),
25261 value: max3,
25262 min: min3 ? Number(min3) + step : void 0,
25263 onChange: onChangeMax,
25264 hideLabelFromVision,
25265 step
25266 }
25267 )
25268 ] })
25269 }
25270 );
25271 }
25272 function ValidatedNumber({
25273 data,
25274 field,
25275 onChange,
25276 hideLabelFromVision,
25277 markWhenOptional,
25278 operator,
25279 validity
25280 }) {
25281 const decimals = field.format?.decimals ?? 0;
25282 const step = Math.pow(10, Math.abs(decimals) * -1);
25283 const { label, description, getValue, setValue, isValid: isValid2 } = field;
25284 const value = getValue({ item: data }) ?? "";
25285 const disabled2 = field.isDisabled({ item: data, field });
25286 const onChangeControl = (0, import_element81.useCallback)(
25287 (newValue) => {
25288 onChange(
25289 setValue({
25290 item: data,
25291 // Do not convert an empty string or undefined to a number,
25292 // otherwise there's a mismatch between the UI control (empty)
25293 // and the data relied by onChange (0).
25294 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue)
25295 })
25296 );
25297 },
25298 [data, onChange, setValue]
25299 );
25300 const onChangeBetweenControls = (0, import_element81.useCallback)(
25301 (newValue) => {
25302 onChange(
25303 setValue({
25304 item: data,
25305 value: newValue
25306 })
25307 );
25308 },
25309 [data, onChange, setValue]
25310 );
25311 if (operator === OPERATOR_BETWEEN) {
25312 let valueBetween = ["", ""];
25313 if (Array.isArray(value) && value.length === 2 && value.every(
25314 (element) => typeof element === "number" || element === ""
25315 )) {
25316 valueBetween = value;
25317 }
25318 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
25319 BetweenControls,
25320 {
25321 value: valueBetween,
25322 onChange: onChangeBetweenControls,
25323 hideLabelFromVision,
25324 step
25325 }
25326 );
25327 }
25328 return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
25329 ValidatedNumberControl,
25330 {
25331 required: !!isValid2.required,
25332 markWhenOptional,
25333 customValidity: getCustomValidity(isValid2, validity),
25334 label,
25335 help: description,
25336 value,
25337 onChange: onChangeControl,
25338 hideLabelFromVision,
25339 step,
25340 min: typeof isValid2.min?.constraint === "number" ? isValid2.min.constraint : void 0,
25341 max: typeof isValid2.max?.constraint === "number" ? isValid2.max.constraint : void 0,
25342 disabled: disabled2
25343 }
25344 );
25345 }
25346
25347 // packages/dataviews/build-module/components/dataform-controls/integer.mjs
25348 var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1);
25349 function Integer(props) {
25350 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(ValidatedNumber, { ...props });
25351 }
25352
25353 // packages/dataviews/build-module/components/dataform-controls/number.mjs
25354 var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1);
25355 function Number2(props) {
25356 return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ValidatedNumber, { ...props });
25357 }
25358
25359 // packages/dataviews/build-module/components/dataform-controls/radio.mjs
25360 var import_components17 = __toESM(require_components(), 1);
25361 var import_element82 = __toESM(require_element(), 1);
25362 var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1);
25363 function Radio({
25364 data,
25365 field,
25366 onChange,
25367 hideLabelFromVision,
25368 markWhenOptional,
25369 validity
25370 }) {
25371 const { label, description, getValue, setValue, isValid: isValid2 } = field;
25372 const disabled2 = field.isDisabled({ item: data, field });
25373 const { elements, isLoading } = useElements({
25374 elements: field.elements,
25375 getElements: field.getElements
25376 });
25377 const value = getValue({ item: data });
25378 const onChangeControl = (0, import_element82.useCallback)(
25379 (newValue) => onChange(setValue({ item: data, value: newValue })),
25380 [data, onChange, setValue]
25381 );
25382 if (isLoading) {
25383 return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_components17.Spinner, {});
25384 }
25385 return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
25386 ValidatedRadioControl,
25387 {
25388 required: !!field.isValid?.required,
25389 markWhenOptional,
25390 customValidity: getCustomValidity(isValid2, validity),
25391 label,
25392 help: description,
25393 onChange: onChangeControl,
25394 options: elements,
25395 selected: value,
25396 hideLabelFromVision,
25397 disabled: disabled2
25398 }
25399 );
25400 }
25401
25402 // packages/dataviews/build-module/components/dataform-controls/text.mjs
25403 var import_element83 = __toESM(require_element(), 1);
25404 var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1);
25405 function Text3({
25406 data,
25407 field,
25408 onChange,
25409 hideLabelFromVision,
25410 markWhenOptional,
25411 config,
25412 validity
25413 }) {
25414 const { prefix, suffix } = config || {};
25415 return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
25416 ValidatedText,
25417 {
25418 ...{
25419 data,
25420 field,
25421 onChange,
25422 hideLabelFromVision,
25423 markWhenOptional,
25424 validity,
25425 prefix: prefix ? (0, import_element83.createElement)(prefix) : void 0,
25426 suffix: suffix ? (0, import_element83.createElement)(suffix) : void 0
25427 }
25428 }
25429 );
25430 }
25431
25432 // packages/dataviews/build-module/components/dataform-controls/time.mjs
25433 var import_components18 = __toESM(require_components(), 1);
25434 var import_element84 = __toESM(require_element(), 1);
25435 var import_i18n17 = __toESM(require_i18n(), 1);
25436 var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1);
25437 function getStep(timeFormat, values) {
25438 const tokens = (timeFormat ?? "").replace(/\\./g, "");
25439 const hasSeconds = tokens.includes("s") || values.some((value) => (parseTime2(value) ?? 0) % 60 !== 0);
25440 return hasSeconds ? 1 : void 0;
25441 }
25442 function toInputValue(value) {
25443 const seconds = parseTime2(value);
25444 if (seconds === null) {
25445 return "";
25446 }
25447 const parts = [
25448 Math.floor(seconds / 3600),
25449 Math.floor(seconds % 3600 / 60)
25450 ];
25451 if (seconds % 60 !== 0) {
25452 parts.push(seconds % 60);
25453 }
25454 return parts.map((part) => String(part).padStart(2, "0")).join(":");
25455 }
25456 function BetweenControls2({
25457 value,
25458 onChange,
25459 hideLabelFromVision,
25460 disabled: disabled2,
25461 step,
25462 min: min3,
25463 max: max3
25464 }) {
25465 const [from = "", to = ""] = value;
25466 const onChangeFrom = (0, import_element84.useCallback)(
25467 (newValue) => onChange([newValue ?? "", to]),
25468 [onChange, to]
25469 );
25470 const onChangeTo = (0, import_element84.useCallback)(
25471 (newValue) => onChange([from, newValue ?? ""]),
25472 [onChange, from]
25473 );
25474 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
25475 import_components18.BaseControl,
25476 {
25477 help: (0, import_i18n17.__)("The end time must be later than the start time."),
25478 children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(Stack, { direction: "row", gap: "sm", justify: "space-between", children: [
25479 /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
25480 ValidatedInputControl,
25481 {
25482 type: "time",
25483 label: (0, import_i18n17.__)("From"),
25484 value: from,
25485 onValueChange: onChangeFrom,
25486 hideLabelFromVision,
25487 disabled: disabled2,
25488 step,
25489 min: min3,
25490 max: to || max3
25491 }
25492 ),
25493 /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
25494 ValidatedInputControl,
25495 {
25496 type: "time",
25497 label: (0, import_i18n17.__)("To"),
25498 value: to,
25499 onValueChange: onChangeTo,
25500 hideLabelFromVision,
25501 disabled: disabled2,
25502 step,
25503 min: from || min3,
25504 max: max3
25505 }
25506 )
25507 ] })
25508 }
25509 );
25510 }
25511 function Time({
25512 data,
25513 field,
25514 onChange,
25515 hideLabelFromVision,
25516 markWhenOptional,
25517 operator,
25518 validity
25519 }) {
25520 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
25521 const value = getValue({ item: data });
25522 const disabled2 = field.isDisabled({ item: data, field });
25523 const timeFormat = field.format?.time;
25524 const min3 = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0;
25525 const max3 = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0;
25526 const onChangeControl = (0, import_element84.useCallback)(
25527 (newValue) => onChange(
25528 setValue({
25529 item: data,
25530 value: newValue === "" ? void 0 : newValue
25531 })
25532 ),
25533 [data, onChange, setValue]
25534 );
25535 const onChangeBetweenControls = (0, import_element84.useCallback)(
25536 ([from, to]) => onChange(
25537 setValue({
25538 item: data,
25539 // An unfilled bound is stored as `undefined`, which the
25540 // `between` operator reads as "do not apply the filter".
25541 value: [from || void 0, to || void 0]
25542 })
25543 ),
25544 [data, onChange, setValue]
25545 );
25546 if (operator === OPERATOR_BETWEEN) {
25547 let valueBetween = ["", ""];
25548 if (Array.isArray(value) && value.length === 2) {
25549 valueBetween = [
25550 toInputValue(value[0]),
25551 toInputValue(value[1])
25552 ];
25553 }
25554 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
25555 BetweenControls2,
25556 {
25557 value: valueBetween,
25558 onChange: onChangeBetweenControls,
25559 hideLabelFromVision,
25560 disabled: disabled2,
25561 step: getStep(timeFormat, valueBetween),
25562 min: min3,
25563 max: max3
25564 }
25565 );
25566 }
25567 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
25568 ValidatedInputControl,
25569 {
25570 required: !!isValid2.required,
25571 markWhenOptional,
25572 customValidity: getCustomValidity(isValid2, validity),
25573 type: "time",
25574 label,
25575 placeholder,
25576 description: typeof description === "string" ? description : void 0,
25577 details: typeof description === "string" ? void 0 : description,
25578 value: toInputValue(value),
25579 onValueChange: onChangeControl,
25580 hideLabelFromVision,
25581 disabled: disabled2,
25582 step: getStep(timeFormat, [value]),
25583 min: min3,
25584 max: max3
25585 }
25586 );
25587 }
25588
25589 // packages/dataviews/build-module/components/dataform-controls/toggle.mjs
25590 var import_element85 = __toESM(require_element(), 1);
25591 var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1);
25592 function Toggle({
25593 field,
25594 onChange,
25595 data,
25596 hideLabelFromVision,
25597 markWhenOptional,
25598 validity
25599 }) {
25600 const { label, description, getValue, setValue, isValid: isValid2 } = field;
25601 const disabled2 = field.isDisabled({ item: data, field });
25602 const onChangeControl = (0, import_element85.useCallback)(() => {
25603 onChange(
25604 setValue({ item: data, value: !getValue({ item: data }) })
25605 );
25606 }, [onChange, setValue, data, getValue]);
25607 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
25608 ValidatedToggleControl,
25609 {
25610 required: !!isValid2.required,
25611 markWhenOptional,
25612 customValidity: getCustomValidity(isValid2, validity),
25613 hidden: hideLabelFromVision,
25614 label,
25615 help: description,
25616 checked: getValue({ item: data }),
25617 onChange: onChangeControl,
25618 disabled: disabled2
25619 }
25620 );
25621 }
25622
25623 // packages/dataviews/build-module/components/dataform-controls/textarea.mjs
25624 var import_element86 = __toESM(require_element(), 1);
25625 var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1);
25626 function Textarea3({
25627 data,
25628 field,
25629 onChange,
25630 hideLabelFromVision,
25631 markWhenOptional,
25632 config,
25633 validity
25634 }) {
25635 const { rows = 4 } = config || {};
25636 const disabled2 = field.isDisabled({ item: data, field });
25637 const { label, placeholder, description, setValue, isValid: isValid2 } = field;
25638 const value = field.getValue({ item: data });
25639 const onValueChangeControl = (0, import_element86.useCallback)(
25640 (newValue) => onChange(setValue({ item: data, value: newValue })),
25641 [data, onChange, setValue]
25642 );
25643 return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(
25644 ValidatedTextareaControl,
25645 {
25646 required: !!isValid2.required,
25647 markWhenOptional,
25648 customValidity: getCustomValidity(isValid2, validity),
25649 label,
25650 placeholder,
25651 value: value ?? "",
25652 description: typeof description === "string" ? description : void 0,
25653 details: typeof description === "string" ? void 0 : description,
25654 onValueChange: onValueChangeControl,
25655 rows,
25656 disabled: disabled2,
25657 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0,
25658 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0,
25659 hideLabelFromVision
25660 }
25661 );
25662 }
25663
25664 // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs
25665 var import_components19 = __toESM(require_components(), 1);
25666 var import_element87 = __toESM(require_element(), 1);
25667 var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1);
25668 function ToggleGroup({
25669 data,
25670 field,
25671 onChange,
25672 hideLabelFromVision,
25673 markWhenOptional,
25674 validity
25675 }) {
25676 const { getValue, setValue, isValid: isValid2 } = field;
25677 const disabled2 = field.isDisabled({ item: data, field });
25678 const value = getValue({ item: data });
25679 const onChangeControl = (0, import_element87.useCallback)(
25680 (newValue) => onChange(setValue({ item: data, value: newValue })),
25681 [data, onChange, setValue]
25682 );
25683 const { elements, isLoading } = useElements({
25684 elements: field.elements,
25685 getElements: field.getElements
25686 });
25687 if (isLoading) {
25688 return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_components19.Spinner, {});
25689 }
25690 if (elements.length === 0) {
25691 return null;
25692 }
25693 const selectedOption = elements.find((el) => el.value === value);
25694 return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
25695 ValidatedToggleGroupControl,
25696 {
25697 required: !!field.isValid?.required,
25698 markWhenOptional,
25699 customValidity: getCustomValidity(isValid2, validity),
25700 isBlock: true,
25701 label: field.label,
25702 help: selectedOption?.description || field.description,
25703 onChange: onChangeControl,
25704 value,
25705 hideLabelFromVision,
25706 children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
25707 import_components19.__experimentalToggleGroupControlOption,
25708 {
25709 label: el.label,
25710 value: el.value,
25711 disabled: disabled2
25712 },
25713 el.value
25714 ))
25715 }
25716 );
25717 }
25718
25719 // packages/dataviews/build-module/components/dataform-controls/array.mjs
25720 var import_components20 = __toESM(require_components(), 1);
25721 var import_element88 = __toESM(require_element(), 1);
25722 var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1);
25723 function ArrayControl({
25724 data,
25725 field,
25726 onChange,
25727 hideLabelFromVision,
25728 markWhenOptional,
25729 validity
25730 }) {
25731 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field;
25732 const value = getValue({ item: data });
25733 const disabled2 = field.isDisabled({ item: data, field });
25734 const { elements, isLoading } = useElements({
25735 elements: field.elements,
25736 getElements: field.getElements
25737 });
25738 const arrayValueAsElements = (0, import_element88.useMemo)(
25739 () => Array.isArray(value) ? value.map((token) => {
25740 const element = elements?.find(
25741 (suggestion) => suggestion.value === token
25742 );
25743 return element || { value: token, label: token };
25744 }) : [],
25745 [value, elements]
25746 );
25747 const onChangeControl = (0, import_element88.useCallback)(
25748 (tokens) => {
25749 const valueTokens = tokens.map((token) => {
25750 if (typeof token === "object" && "value" in token) {
25751 return token.value;
25752 }
25753 return token;
25754 });
25755 onChange(setValue({ item: data, value: valueTokens }));
25756 },
25757 [onChange, setValue, data]
25758 );
25759 if (isLoading) {
25760 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_components20.Spinner, {});
25761 }
25762 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
25763 ValidatedFormTokenField,
25764 {
25765 required: !!isValid2?.required,
25766 markWhenOptional,
25767 customValidity: getCustomValidity(isValid2, validity),
25768 label: hideLabelFromVision ? void 0 : label,
25769 value: arrayValueAsElements,
25770 onChange: onChangeControl,
25771 placeholder,
25772 suggestions: elements?.map((element) => element.value),
25773 disabled: disabled2,
25774 __experimentalValidateInput: (token) => {
25775 if (field.isValid?.elements && elements) {
25776 return elements.some(
25777 (element) => element.value === token || element.label === token
25778 );
25779 }
25780 return true;
25781 },
25782 __experimentalExpandOnFocus: elements && elements.length > 0,
25783 help: description ?? (field.isValid?.elements ? "" : void 0),
25784 displayTransform: (token) => {
25785 if (typeof token === "object" && "label" in token) {
25786 return token.label;
25787 }
25788 if (typeof token === "string" && elements) {
25789 const element = elements.find(
25790 (el) => el.value === token
25791 );
25792 return element?.label || token;
25793 }
25794 return token;
25795 },
25796 __experimentalRenderItem: ({ item }) => {
25797 if (typeof item === "string" && elements) {
25798 const element = elements.find(
25799 (el) => el.value === item
25800 );
25801 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { children: element?.label || item });
25802 }
25803 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("span", { children: item });
25804 }
25805 }
25806 );
25807 }
25808
25809 // node_modules/colord/index.mjs
25810 for (r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, t = function(r3) {
25811 return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3;
25812 }, n = function(r3, t2, n2) {
25813 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0;
25814 }, u = function(r3, t2, n2) {
25815 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2;
25816 }, e = function(r3) {
25817 return (r3 = isFinite(r3) ? r3 % 360 : 0) < 0 ? r3 + 360 : r3;
25818 }, o = function(r3, t2) {
25819 return void 0 === t2 && (t2 = 0), n(r3, t2) % 360;
25820 }, a = function(r3) {
25821 return { r: u(r3.r, 0, 255), g: u(r3.g, 0, 255), b: u(r3.b, 0, 255), a: u(r3.a) };
25822 }, i = function(r3) {
25823 return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) };
25824 }, s = /^#([0-9a-f]{3,8})$/i, d = function(r3, t2) {
25825 var n2 = r3.charCodeAt(t2);
25826 return (15 & n2) + 9 * (n2 >> 6);
25827 }, h = function(r3, t2) {
25828 return d(r3, t2) << 4 | d(r3, t2 + 1);
25829 }, b = [], f = 0; f < 256; f++) b.push((f < 16 ? "0" : "") + f.toString(16));
25830 var r2;
25831 var t;
25832 var n;
25833 var u;
25834 var e;
25835 var o;
25836 var a;
25837 var i;
25838 var s;
25839 var d;
25840 var h;
25841 var b;
25842 var f;
25843 var g = function(r2) {
25844 return b[u(r2, 0, 255)];
25845 };
25846 var c = function(r2) {
25847 var t = r2.r, n = r2.g, u = r2.b, e = r2.a, o = Math.max(t, n, u), a = o - Math.min(t, n, u), i = a ? o === t ? (n - u) / a : o === n ? 2 + (u - t) / a : 4 + (t - n) / a : 0;
25848 return { h: 60 * (i < 0 ? i + 6 : i), s: o ? a / o * 100 : 0, v: o / 255 * 100, a: e };
25849 };
25850 var v = function(r2) {
25851 var t = r2.h, n = r2.s, u = r2.v, e = r2.a;
25852 t = t / 360 * 6, n /= 100, u /= 100;
25853 var o = Math.floor(t), a = u * (1 - n), i = u * (1 - (t - o) * n), s = u * (1 - (1 - t + o) * n), d = o % 6;
25854 return { r: 255 * [u, i, a, a, s, u][d], g: 255 * [s, u, u, i, a, a][d], b: 255 * [a, a, s, u, u, i][d], a: e };
25855 };
25856 var l = function(r2) {
25857 return { h: e(r2.h), s: u(r2.s, 0, 100), l: u(r2.l, 0, 100), a: u(r2.a) };
25858 };
25859 var p = function(r2) {
25860 return { h: o(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) };
25861 };
25862 var m = function(r2) {
25863 return v((n = (t = r2).s, { h: t.h, s: (n *= ((u = t.l) < 50 ? u : 100 - u) / 100) > 0 ? 2 * n / (u + n) * 100 : 0, v: u + n, a: t.a }));
25864 var t, n, u;
25865 };
25866 var y = function(r2) {
25867 return { h: (t = c(r2)).h, s: (e = (200 - (n = t.s)) * (u = t.v) / 100) > 0 && e < 200 ? n * u / 100 / (e <= 100 ? e : 200 - e) * 100 : 0, l: e / 2, a: t.a };
25868 var t, n, u, e;
25869 };
25870 var N = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
25871 var x = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
25872 var M = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
25873 var H = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i;
25874 var $ = { string: [[function(r2) {
25875 if (!s.test(r2)) return null;
25876 var t = r2.length;
25877 return t <= 5 ? { r: 17 * d(r2, 1), g: 17 * d(r2, 2), b: 17 * d(r2, 3), a: 5 === t ? n(17 * d(r2, 4) / 255, 2) : 1 } : 7 === t || 9 === t ? { r: h(r2, 1), g: h(r2, 3), b: h(r2, 5), a: 9 === t ? n(h(r2, 7) / 255, 2) : 1 } : null;
25878 }, "hex"], [function(r2) {
25879 var t = M.exec(r2) || H.exec(r2);
25880 return t ? t[2] !== t[4] || t[4] !== t[6] ? null : a({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: void 0 === t[7] ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null;
25881 }, "rgb"], [function(t) {
25882 var n = N.exec(t) || x.exec(t);
25883 if (!n) return null;
25884 var u, e, o = l({ h: (u = n[1], e = n[2], void 0 === e && (e = "deg"), Number(u) * (r2[e] || 1)), s: Number(n[3]), l: Number(n[4]), a: void 0 === n[5] ? 1 : Number(n[5]) / (n[6] ? 100 : 1) });
25885 return m(o);
25886 }, "hsl"]], object: [[function(r2) {
25887 var n = r2.r, u = r2.g, e = r2.b, o = r2.a, i = void 0 === o ? 1 : o;
25888 return t(n) && t(u) && t(e) ? a({ r: Number(n), g: Number(u), b: Number(e), a: Number(i) }) : null;
25889 }, "rgb"], [function(r2) {
25890 var n = r2.h, u = r2.s, e = r2.l, o = r2.a, a = void 0 === o ? 1 : o;
25891 if (!t(n) || !t(u) || !t(e)) return null;
25892 var i = l({ h: Number(n), s: Number(u), l: Number(e), a: Number(a) });
25893 return m(i);
25894 }, "hsl"], [function(r2) {
25895 var n = r2.h, o = r2.s, a = r2.v, i = r2.a, s = void 0 === i ? 1 : i;
25896 if (!t(n) || !t(o) || !t(a)) return null;
25897 var d = (function(r3) {
25898 return { h: e(r3.h), s: u(r3.s, 0, 100), v: u(r3.v, 0, 100), a: u(r3.a) };
25899 })({ h: Number(n), s: Number(o), v: Number(a), a: Number(s) });
25900 return v(d);
25901 }, "hsv"]] };
25902 var j = function(r2, t) {
25903 for (var n = 0; n < t.length; n++) {
25904 var u = t[n][0](r2);
25905 if (u) return [u, t[n][1]];
25906 }
25907 return [null, void 0];
25908 };
25909 var w = function(r2) {
25910 return "string" == typeof r2 ? j(r2.trim(), $.string) : "object" == typeof r2 && null !== r2 ? j(r2, $.object) : [null, void 0];
25911 };
25912 var k = function(r2, t) {
25913 var n = y(r2);
25914 return { h: n.h, s: u(n.s + 100 * t, 0, 100), l: n.l, a: n.a };
25915 };
25916 var E = function(r2) {
25917 return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255;
25918 };
25919 var R = function(r2, t) {
25920 var n = y(r2);
25921 return { h: n.h, s: n.s, l: u(n.l + 100 * t, 0, 100), a: n.a };
25922 };
25923 var q = (function() {
25924 function r2(r3) {
25925 this.parsed = w(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
25926 }
25927 return r2.prototype.isValid = function() {
25928 return null !== this.parsed;
25929 }, r2.prototype.brightness = function() {
25930 return n(E(this.rgba), 2);
25931 }, r2.prototype.isDark = function() {
25932 return E(this.rgba) < 0.5;
25933 }, r2.prototype.isLight = function() {
25934 return E(this.rgba) >= 0.5;
25935 }, r2.prototype.toHex = function() {
25936 return r3 = i(this.rgba), t = r3.r, u = r3.g, e = r3.b, a = (o = r3.a) < 1 ? g(n(255 * o)) : "", "#" + g(t) + g(u) + g(e) + a;
25937 var r3, t, u, e, o, a;
25938 }, r2.prototype.toRgb = function() {
25939 return i(this.rgba);
25940 }, r2.prototype.toRgbString = function() {
25941 return r3 = i(this.rgba), t = r3.r, n = r3.g, u = r3.b, (e = r3.a) < 1 ? "rgba(" + t + ", " + n + ", " + u + ", " + e + ")" : "rgb(" + t + ", " + n + ", " + u + ")";
25942 var r3, t, n, u, e;
25943 }, r2.prototype.toHsl = function() {
25944 return p(y(this.rgba));
25945 }, r2.prototype.toHslString = function() {
25946 return r3 = p(y(this.rgba)), t = r3.h, n = r3.s, u = r3.l, (e = r3.a) < 1 ? "hsla(" + t + ", " + n + "%, " + u + "%, " + e + ")" : "hsl(" + t + ", " + n + "%, " + u + "%)";
25947 var r3, t, n, u, e;
25948 }, r2.prototype.toHsv = function() {
25949 return r3 = c(this.rgba), { h: o(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) };
25950 var r3;
25951 }, r2.prototype.invert = function() {
25952 return A({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a });
25953 var r3;
25954 }, r2.prototype.saturate = function(r3) {
25955 return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, r3));
25956 }, r2.prototype.desaturate = function(r3) {
25957 return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, -r3));
25958 }, r2.prototype.grayscale = function() {
25959 return A(k(this.rgba, -1));
25960 }, r2.prototype.lighten = function(r3) {
25961 return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, r3));
25962 }, r2.prototype.darken = function(r3) {
25963 return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, -r3));
25964 }, r2.prototype.rotate = function(r3) {
25965 return void 0 === r3 && (r3 = 15), this.hue(y(this.rgba).h + r3);
25966 }, r2.prototype.alpha = function(r3) {
25967 return "number" == typeof r3 ? A({ r: (t = this.rgba).r, g: t.g, b: t.b, a: r3 }) : n(this.rgba.a, 3);
25968 var t;
25969 }, r2.prototype.hue = function(r3) {
25970 var t = y(this.rgba);
25971 return "number" == typeof r3 ? A({ h: r3, s: t.s, l: t.l, a: t.a }) : o(t.h);
25972 }, r2.prototype.isEqual = function(r3) {
25973 return this.toHex() === A(r3).toHex();
25974 }, r2;
25975 })();
25976 var A = function(r2) {
25977 return r2 instanceof q ? r2 : new q(r2);
25978 };
25979
25980 // packages/dataviews/build-module/components/dataform-controls/color.mjs
25981 var import_components21 = __toESM(require_components(), 1);
25982 var import_element89 = __toESM(require_element(), 1);
25983 var import_i18n18 = __toESM(require_i18n(), 1);
25984 var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1);
25985 var ColorPickerDropdown = ({
25986 color,
25987 onColorChange,
25988 disabled: disabled2
25989 }) => {
25990 const validColor = color && A(color).isValid() ? color : "#ffffff";
25991 return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
25992 import_components21.Dropdown,
25993 {
25994 className: "dataviews-controls__color-picker-dropdown",
25995 popoverProps: { resize: false },
25996 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
25997 import_components21.Button,
25998 {
25999 onClick: onToggle,
26000 "aria-label": (0, import_i18n18.__)("Open color picker"),
26001 size: "small",
26002 disabled: disabled2,
26003 accessibleWhenDisabled: true,
26004 icon: () => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components21.ColorIndicator, { colorValue: validColor })
26005 }
26006 ),
26007 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components21.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
26008 import_components21.ColorPicker,
26009 {
26010 color: validColor,
26011 onChange: onColorChange,
26012 enableAlpha: true
26013 }
26014 ) })
26015 }
26016 );
26017 };
26018 function Color({
26019 data,
26020 field,
26021 onChange,
26022 hideLabelFromVision,
26023 markWhenOptional,
26024 validity
26025 }) {
26026 const { label, placeholder, description, setValue, isValid: isValid2 } = field;
26027 const disabled2 = field.isDisabled({ item: data, field });
26028 const value = field.getValue({ item: data }) || "";
26029 const handleColorChange = (0, import_element89.useCallback)(
26030 (newColor) => {
26031 onChange(setValue({ item: data, value: newColor }));
26032 },
26033 [data, onChange, setValue]
26034 );
26035 const handleInputChange = (0, import_element89.useCallback)(
26036 (newValue) => {
26037 onChange(setValue({ item: data, value: newValue || "" }));
26038 },
26039 [data, onChange, setValue]
26040 );
26041 return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
26042 ValidatedInputControl,
26043 {
26044 required: !!field.isValid?.required,
26045 markWhenOptional,
26046 customValidity: getCustomValidity(isValid2, validity),
26047 label,
26048 placeholder,
26049 value,
26050 description: typeof description === "string" ? description : void 0,
26051 details: typeof description === "string" ? void 0 : description,
26052 onValueChange: handleInputChange,
26053 hideLabelFromVision,
26054 type: "text",
26055 disabled: disabled2,
26056 prefix: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
26057 ColorPickerDropdown,
26058 {
26059 color: value,
26060 onColorChange: handleColorChange,
26061 disabled: disabled2
26062 }
26063 ) })
26064 }
26065 );
26066 }
26067
26068 // packages/dataviews/build-module/components/dataform-controls/password.mjs
26069 var import_components22 = __toESM(require_components(), 1);
26070 var import_element90 = __toESM(require_element(), 1);
26071 var import_i18n19 = __toESM(require_i18n(), 1);
26072 var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1);
26073 function Password({
26074 data,
26075 field,
26076 onChange,
26077 hideLabelFromVision,
26078 markWhenOptional,
26079 validity
26080 }) {
26081 const [isVisible, setIsVisible] = (0, import_element90.useState)(false);
26082 const disabled2 = field.isDisabled({ item: data, field });
26083 const toggleVisibility = (0, import_element90.useCallback)(() => {
26084 setIsVisible((prev) => !prev);
26085 }, []);
26086 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
26087 ValidatedText,
26088 {
26089 ...{
26090 data,
26091 field,
26092 onChange,
26093 hideLabelFromVision,
26094 markWhenOptional,
26095 validity,
26096 type: isVisible ? "text" : "password",
26097 suffix: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
26098 import_components22.Button,
26099 {
26100 icon: isVisible ? unseen_default : seen_default,
26101 onClick: toggleVisibility,
26102 size: "small",
26103 label: isVisible ? (0, import_i18n19.__)("Hide password") : (0, import_i18n19.__)("Show password"),
26104 disabled: disabled2,
26105 accessibleWhenDisabled: true
26106 }
26107 ) })
26108 }
26109 }
26110 );
26111 }
26112
26113 // packages/dataviews/build-module/field-types/utils/has-elements.mjs
26114 function hasElements(field) {
26115 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function";
26116 }
26117
26118 // packages/dataviews/build-module/components/dataform-controls/index.mjs
26119 var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1);
26120 var FORM_CONTROLS = {
26121 adaptiveSelect: AdaptiveSelect,
26122 array: ArrayControl,
26123 checkbox: Checkbox,
26124 color: Color,
26125 combobox: Combobox,
26126 datetime: DateTime,
26127 date: DateControl,
26128 email: Email,
26129 telephone: Telephone,
26130 url: Url,
26131 integer: Integer,
26132 number: Number2,
26133 password: Password,
26134 radio: Radio,
26135 select: Select2,
26136 text: Text3,
26137 time: Time,
26138 toggle: Toggle,
26139 textarea: Textarea3,
26140 toggleGroup: ToggleGroup
26141 };
26142 function isEditConfig(value) {
26143 return value && typeof value === "object" && typeof value.control === "string";
26144 }
26145 function createConfiguredControl(config) {
26146 const { control, ...controlConfig } = config;
26147 const BaseControlType = getControlByType(control);
26148 if (BaseControlType === null) {
26149 return null;
26150 }
26151 return function ConfiguredControl(props) {
26152 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(BaseControlType, { ...props, config: controlConfig });
26153 };
26154 }
26155 function getControl(field, fallback) {
26156 if (typeof field.Edit === "function") {
26157 return field.Edit;
26158 }
26159 if (typeof field.Edit === "string") {
26160 return getControlByType(field.Edit);
26161 }
26162 if (isEditConfig(field.Edit)) {
26163 return createConfiguredControl(field.Edit);
26164 }
26165 if (hasElements(field) && field.type !== "array") {
26166 return getControlByType("adaptiveSelect");
26167 }
26168 if (fallback === null) {
26169 return null;
26170 }
26171 return getControlByType(fallback);
26172 }
26173 function getControlByType(type) {
26174 if (Object.keys(FORM_CONTROLS).includes(type)) {
26175 return FORM_CONTROLS[type];
26176 }
26177 return null;
26178 }
26179
26180 // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs
26181 function getFilterBy(field, defaultOperators, validOperators) {
26182 if (field.filterBy === false) {
26183 return false;
26184 }
26185 const operators = field.filterBy?.operators?.filter(
26186 (op) => validOperators.includes(op)
26187 ) ?? defaultOperators;
26188 if (operators.length === 0) {
26189 return false;
26190 }
26191 return {
26192 isPrimary: !!field.filterBy?.isPrimary,
26193 operators
26194 };
26195 }
26196 var get_filter_by_default = getFilterBy;
26197
26198 // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs
26199 var getValueFromId = (id) => ({ item }) => {
26200 const path = id.split(".");
26201 let value = item;
26202 for (const segment of path) {
26203 if (value.hasOwnProperty(segment)) {
26204 value = value[segment];
26205 } else {
26206 value = void 0;
26207 }
26208 }
26209 return value;
26210 };
26211 var get_value_from_id_default = getValueFromId;
26212
26213 // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs
26214 var setValueFromId = (id) => ({ value }) => {
26215 const path = id.split(".");
26216 const result = {};
26217 let current = result;
26218 for (const segment of path.slice(0, -1)) {
26219 current[segment] = {};
26220 current = current[segment];
26221 }
26222 current[path.at(-1)] = value;
26223 return result;
26224 };
26225 var set_value_from_id_default = setValueFromId;
26226
26227 // packages/dataviews/build-module/field-types/email.mjs
26228 var import_i18n20 = __toESM(require_i18n(), 1);
26229
26230 // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs
26231 function RenderFromElements({
26232 item,
26233 field
26234 }) {
26235 const { elements, isLoading } = useElements({
26236 elements: field.elements,
26237 getElements: field.getElements
26238 });
26239 const value = field.getValue({ item });
26240 if (isLoading) {
26241 return value;
26242 }
26243 if (elements.length === 0) {
26244 return value;
26245 }
26246 return elements?.find((element) => element.value === value)?.label || field.getValue({ item });
26247 }
26248
26249 // packages/dataviews/build-module/field-types/utils/render-default.mjs
26250 var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1);
26251 function render({
26252 item,
26253 field
26254 }) {
26255 if (field.hasElements) {
26256 return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(RenderFromElements, { item, field });
26257 }
26258 return field.getValueFormatted({ item, field });
26259 }
26260
26261 // packages/dataviews/build-module/field-types/utils/sort-text.mjs
26262 var sort_text_default = (a, b, direction) => {
26263 return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a);
26264 };
26265
26266 // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs
26267 function isValidRequired(item, field) {
26268 const value = field.getValue({ item });
26269 return ![void 0, "", null].includes(value);
26270 }
26271
26272 // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs
26273 function isValidMinLength(item, field) {
26274 if (typeof field.isValid.minLength?.constraint !== "number") {
26275 return false;
26276 }
26277 const value = field.getValue({ item });
26278 if ([void 0, "", null].includes(value)) {
26279 return true;
26280 }
26281 return String(value).length >= field.isValid.minLength.constraint;
26282 }
26283
26284 // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs
26285 function isValidMaxLength(item, field) {
26286 if (typeof field.isValid.maxLength?.constraint !== "number") {
26287 return false;
26288 }
26289 const value = field.getValue({ item });
26290 if ([void 0, "", null].includes(value)) {
26291 return true;
26292 }
26293 return String(value).length <= field.isValid.maxLength.constraint;
26294 }
26295
26296 // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs
26297 function isValidPattern(item, field) {
26298 if (field.isValid.pattern?.constraint === void 0) {
26299 return true;
26300 }
26301 try {
26302 const regexp = new RegExp(field.isValid.pattern.constraint);
26303 const value = field.getValue({ item });
26304 if ([void 0, "", null].includes(value)) {
26305 return true;
26306 }
26307 return regexp.test(String(value));
26308 } catch {
26309 return false;
26310 }
26311 }
26312
26313 // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs
26314 function isValidElements(item, field) {
26315 const elements = field.elements ?? [];
26316 const validValues = elements.map((el) => el.value);
26317 if (validValues.length === 0) {
26318 return true;
26319 }
26320 const value = field.getValue({ item });
26321 return [].concat(value).every((v2) => validValues.includes(v2));
26322 }
26323
26324 // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs
26325 function getValueFormatted({
26326 item,
26327 field
26328 }) {
26329 return field.getValue({ item });
26330 }
26331 var get_value_formatted_default_default = getValueFormatted;
26332
26333 // packages/dataviews/build-module/field-types/email.mjs
26334 var emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
26335 function isValidCustom(item, field) {
26336 const value = field.getValue({ item });
26337 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) {
26338 return (0, import_i18n20.__)("Value must be a valid email address.");
26339 }
26340 return null;
26341 }
26342 var email_default = {
26343 type: "email",
26344 render,
26345 Edit: "email",
26346 sort: sort_text_default,
26347 enableSorting: true,
26348 enableGlobalSearch: false,
26349 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26350 validOperators: [
26351 OPERATOR_IS,
26352 OPERATOR_IS_NOT,
26353 OPERATOR_CONTAINS,
26354 OPERATOR_NOT_CONTAINS,
26355 OPERATOR_STARTS_WITH,
26356 // Multiple selection
26357 OPERATOR_IS_ANY,
26358 OPERATOR_IS_NONE,
26359 OPERATOR_IS_NOT_ALL
26360 ],
26361 format: {},
26362 getValueFormatted: get_value_formatted_default_default,
26363 validate: {
26364 required: isValidRequired,
26365 pattern: isValidPattern,
26366 minLength: isValidMinLength,
26367 maxLength: isValidMaxLength,
26368 elements: isValidElements,
26369 custom: isValidCustom
26370 }
26371 };
26372
26373 // packages/dataviews/build-module/field-types/integer.mjs
26374 var import_i18n21 = __toESM(require_i18n(), 1);
26375
26376 // packages/dataviews/build-module/field-types/utils/sort-number.mjs
26377 var sort_number_default = (a, b, direction) => {
26378 return direction === "asc" ? a - b : b - a;
26379 };
26380
26381 // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs
26382 function isValidMin(item, field) {
26383 if (typeof field.isValid.min?.constraint !== "number") {
26384 return false;
26385 }
26386 const value = field.getValue({ item });
26387 if ([void 0, "", null].includes(value)) {
26388 return true;
26389 }
26390 return Number(value) >= field.isValid.min.constraint;
26391 }
26392
26393 // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs
26394 function isValidMax(item, field) {
26395 if (typeof field.isValid.max?.constraint !== "number") {
26396 return false;
26397 }
26398 const value = field.getValue({ item });
26399 if ([void 0, "", null].includes(value)) {
26400 return true;
26401 }
26402 return Number(value) <= field.isValid.max.constraint;
26403 }
26404
26405 // packages/dataviews/build-module/field-types/integer.mjs
26406 var format2 = {
26407 separatorThousand: ","
26408 };
26409 function getValueFormatted2({
26410 item,
26411 field
26412 }) {
26413 let value = field.getValue({ item });
26414 if (value === null || value === void 0) {
26415 return "";
26416 }
26417 value = Number(value);
26418 if (!Number.isFinite(value)) {
26419 return String(value);
26420 }
26421 let formatInteger;
26422 if (field.type !== "integer") {
26423 formatInteger = format2;
26424 } else {
26425 formatInteger = field.format;
26426 }
26427 const { separatorThousand } = formatInteger;
26428 const integerValue = Math.trunc(value);
26429 if (!separatorThousand) {
26430 return String(integerValue);
26431 }
26432 return String(integerValue).replace(
26433 /\B(?=(\d{3})+(?!\d))/g,
26434 separatorThousand
26435 );
26436 }
26437 function isValidCustom2(item, field) {
26438 const value = field.getValue({ item });
26439 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) {
26440 return (0, import_i18n21.__)("Value must be an integer.");
26441 }
26442 return null;
26443 }
26444 var integer_default = {
26445 type: "integer",
26446 render,
26447 Edit: "integer",
26448 sort: sort_number_default,
26449 enableSorting: true,
26450 enableGlobalSearch: false,
26451 defaultOperators: [
26452 OPERATOR_IS,
26453 OPERATOR_IS_NOT,
26454 OPERATOR_LESS_THAN,
26455 OPERATOR_GREATER_THAN,
26456 OPERATOR_LESS_THAN_OR_EQUAL,
26457 OPERATOR_GREATER_THAN_OR_EQUAL,
26458 OPERATOR_BETWEEN
26459 ],
26460 validOperators: [
26461 // Single-selection
26462 OPERATOR_IS,
26463 OPERATOR_IS_NOT,
26464 OPERATOR_LESS_THAN,
26465 OPERATOR_GREATER_THAN,
26466 OPERATOR_LESS_THAN_OR_EQUAL,
26467 OPERATOR_GREATER_THAN_OR_EQUAL,
26468 OPERATOR_BETWEEN,
26469 // Multiple-selection
26470 OPERATOR_IS_ANY,
26471 OPERATOR_IS_NONE,
26472 OPERATOR_IS_NOT_ALL
26473 ],
26474 format: format2,
26475 getValueFormatted: getValueFormatted2,
26476 validate: {
26477 required: isValidRequired,
26478 min: isValidMin,
26479 max: isValidMax,
26480 elements: isValidElements,
26481 custom: isValidCustom2
26482 }
26483 };
26484
26485 // packages/dataviews/build-module/field-types/number.mjs
26486 var import_i18n22 = __toESM(require_i18n(), 1);
26487 var format3 = {
26488 separatorThousand: ",",
26489 separatorDecimal: ".",
26490 decimals: 2
26491 };
26492 function getValueFormatted3({
26493 item,
26494 field
26495 }) {
26496 let value = field.getValue({ item });
26497 if (value === null || value === void 0) {
26498 return "";
26499 }
26500 value = Number(value);
26501 if (!Number.isFinite(value)) {
26502 return String(value);
26503 }
26504 let formatNumber;
26505 if (field.type !== "number") {
26506 formatNumber = format3;
26507 } else {
26508 formatNumber = field.format;
26509 }
26510 const { separatorThousand, separatorDecimal, decimals } = formatNumber;
26511 const fixedValue = value.toFixed(decimals);
26512 const [integerPart, decimalPart] = fixedValue.split(".");
26513 const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart;
26514 return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart;
26515 }
26516 function isEmpty(value) {
26517 return value === "" || value === void 0 || value === null;
26518 }
26519 function isValidCustom3(item, field) {
26520 const value = field.getValue({ item });
26521 if (!isEmpty(value) && !Number.isFinite(value)) {
26522 return (0, import_i18n22.__)("Value must be a number.");
26523 }
26524 return null;
26525 }
26526 var number_default = {
26527 type: "number",
26528 render,
26529 Edit: "number",
26530 sort: sort_number_default,
26531 enableSorting: true,
26532 enableGlobalSearch: false,
26533 defaultOperators: [
26534 OPERATOR_IS,
26535 OPERATOR_IS_NOT,
26536 OPERATOR_LESS_THAN,
26537 OPERATOR_GREATER_THAN,
26538 OPERATOR_LESS_THAN_OR_EQUAL,
26539 OPERATOR_GREATER_THAN_OR_EQUAL,
26540 OPERATOR_BETWEEN
26541 ],
26542 validOperators: [
26543 // Single-selection
26544 OPERATOR_IS,
26545 OPERATOR_IS_NOT,
26546 OPERATOR_LESS_THAN,
26547 OPERATOR_GREATER_THAN,
26548 OPERATOR_LESS_THAN_OR_EQUAL,
26549 OPERATOR_GREATER_THAN_OR_EQUAL,
26550 OPERATOR_BETWEEN,
26551 // Multiple-selection
26552 OPERATOR_IS_ANY,
26553 OPERATOR_IS_NONE,
26554 OPERATOR_IS_NOT_ALL
26555 ],
26556 format: format3,
26557 getValueFormatted: getValueFormatted3,
26558 validate: {
26559 required: isValidRequired,
26560 min: isValidMin,
26561 max: isValidMax,
26562 elements: isValidElements,
26563 custom: isValidCustom3
26564 }
26565 };
26566
26567 // packages/dataviews/build-module/field-types/text.mjs
26568 var text_default = {
26569 type: "text",
26570 render,
26571 Edit: "text",
26572 sort: sort_text_default,
26573 enableSorting: true,
26574 enableGlobalSearch: false,
26575 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26576 validOperators: [
26577 // Single selection
26578 OPERATOR_IS,
26579 OPERATOR_IS_NOT,
26580 OPERATOR_CONTAINS,
26581 OPERATOR_NOT_CONTAINS,
26582 OPERATOR_STARTS_WITH,
26583 // Multiple selection
26584 OPERATOR_IS_ANY,
26585 OPERATOR_IS_NONE,
26586 OPERATOR_IS_NOT_ALL
26587 ],
26588 format: {},
26589 getValueFormatted: get_value_formatted_default_default,
26590 validate: {
26591 required: isValidRequired,
26592 pattern: isValidPattern,
26593 minLength: isValidMinLength,
26594 maxLength: isValidMaxLength,
26595 elements: isValidElements
26596 }
26597 };
26598
26599 // packages/dataviews/build-module/field-types/datetime.mjs
26600 var import_date9 = __toESM(require_date(), 1);
26601
26602 // packages/dataviews/build-module/field-types/utils/is-valid-boundary.mjs
26603 var import_date8 = __toESM(require_date(), 1);
26604 function parseDateLike(value) {
26605 if (!isValid(new Date(value))) {
26606 return null;
26607 }
26608 const parsed = (0, import_date8.getDate)(value);
26609 return parsed && isValid(parsed) ? parsed.getTime() : null;
26610 }
26611 function validateBoundary(item, field, boundary, parse2) {
26612 const constraint = field.isValid[boundary]?.constraint;
26613 if (typeof constraint !== "string") {
26614 return false;
26615 }
26616 const value = field.getValue({ item });
26617 const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value;
26618 if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") {
26619 return true;
26620 }
26621 const parsedConstraint = parse2(constraint);
26622 const parsedValue = parse2(String(boundaryValue));
26623 if (parsedConstraint === null || parsedValue === null) {
26624 return false;
26625 }
26626 return boundary === "min" ? parsedValue >= parsedConstraint : parsedValue <= parsedConstraint;
26627 }
26628 function isValidMinDate(item, field) {
26629 return validateBoundary(item, field, "min", parseDateLike);
26630 }
26631 function isValidMaxDate(item, field) {
26632 return validateBoundary(item, field, "max", parseDateLike);
26633 }
26634 function isValidMinTime(item, field) {
26635 return validateBoundary(item, field, "min", parseTime2);
26636 }
26637 function isValidMaxTime(item, field) {
26638 return validateBoundary(item, field, "max", parseTime2);
26639 }
26640
26641 // packages/dataviews/build-module/field-types/datetime.mjs
26642 var format4 = {
26643 datetime: (0, import_date9.getSettings)().formats.datetime,
26644 weekStartsOn: (0, import_date9.getSettings)().l10n.startOfWeek
26645 };
26646 function getValueFormatted4({
26647 item,
26648 field
26649 }) {
26650 const value = field.getValue({ item });
26651 if (["", void 0, null].includes(value)) {
26652 return "";
26653 }
26654 let formatDatetime;
26655 if (field.type !== "datetime") {
26656 formatDatetime = format4;
26657 } else {
26658 formatDatetime = field.format;
26659 }
26660 return (0, import_date9.dateI18n)(formatDatetime.datetime, (0, import_date9.getDate)(value));
26661 }
26662 var sort = (a, b, direction) => {
26663 const timeA = new Date(a).getTime();
26664 const timeB = new Date(b).getTime();
26665 return direction === "asc" ? timeA - timeB : timeB - timeA;
26666 };
26667 var datetime_default = {
26668 type: "datetime",
26669 render,
26670 Edit: "datetime",
26671 sort,
26672 enableSorting: true,
26673 enableGlobalSearch: false,
26674 defaultOperators: [
26675 OPERATOR_ON,
26676 OPERATOR_NOT_ON,
26677 OPERATOR_BEFORE,
26678 OPERATOR_AFTER,
26679 OPERATOR_BEFORE_INC,
26680 OPERATOR_AFTER_INC,
26681 OPERATOR_IN_THE_PAST,
26682 OPERATOR_OVER
26683 ],
26684 validOperators: [
26685 OPERATOR_ON,
26686 OPERATOR_NOT_ON,
26687 OPERATOR_BEFORE,
26688 OPERATOR_AFTER,
26689 OPERATOR_BEFORE_INC,
26690 OPERATOR_AFTER_INC,
26691 OPERATOR_IN_THE_PAST,
26692 OPERATOR_OVER
26693 ],
26694 format: format4,
26695 getValueFormatted: getValueFormatted4,
26696 validate: {
26697 required: isValidRequired,
26698 elements: isValidElements,
26699 min: isValidMinDate,
26700 max: isValidMaxDate
26701 }
26702 };
26703
26704 // packages/dataviews/build-module/field-types/date.mjs
26705 var import_date10 = __toESM(require_date(), 1);
26706 var format5 = {
26707 date: (0, import_date10.getSettings)().formats.date,
26708 weekStartsOn: (0, import_date10.getSettings)().l10n.startOfWeek
26709 };
26710 function getValueFormatted5({
26711 item,
26712 field
26713 }) {
26714 const value = field.getValue({ item });
26715 if (["", void 0, null].includes(value)) {
26716 return "";
26717 }
26718 let formatDate2;
26719 if (field.type !== "date") {
26720 formatDate2 = format5;
26721 } else {
26722 formatDate2 = field.format;
26723 }
26724 return (0, import_date10.dateI18n)(formatDate2.date, (0, import_date10.getDate)(value));
26725 }
26726 var sort2 = (a, b, direction) => {
26727 const timeA = new Date(a).getTime();
26728 const timeB = new Date(b).getTime();
26729 return direction === "asc" ? timeA - timeB : timeB - timeA;
26730 };
26731 var date_default = {
26732 type: "date",
26733 render,
26734 Edit: "date",
26735 sort: sort2,
26736 enableSorting: true,
26737 enableGlobalSearch: false,
26738 defaultOperators: [
26739 OPERATOR_ON,
26740 OPERATOR_NOT_ON,
26741 OPERATOR_BEFORE,
26742 OPERATOR_AFTER,
26743 OPERATOR_BEFORE_INC,
26744 OPERATOR_AFTER_INC,
26745 OPERATOR_IN_THE_PAST,
26746 OPERATOR_OVER,
26747 OPERATOR_BETWEEN
26748 ],
26749 validOperators: [
26750 OPERATOR_ON,
26751 OPERATOR_NOT_ON,
26752 OPERATOR_BEFORE,
26753 OPERATOR_AFTER,
26754 OPERATOR_BEFORE_INC,
26755 OPERATOR_AFTER_INC,
26756 OPERATOR_IN_THE_PAST,
26757 OPERATOR_OVER,
26758 OPERATOR_BETWEEN
26759 ],
26760 format: format5,
26761 getValueFormatted: getValueFormatted5,
26762 validate: {
26763 required: isValidRequired,
26764 elements: isValidElements,
26765 min: isValidMinDate,
26766 max: isValidMaxDate
26767 }
26768 };
26769
26770 // packages/dataviews/build-module/field-types/time.mjs
26771 var import_date11 = __toESM(require_date(), 1);
26772 var format6 = {
26773 time: (0, import_date11.getSettings)().formats.time
26774 };
26775 var ANCHOR_DATE = "2000-01-01";
26776 function toAnchoredDate(secondsSinceMidnight) {
26777 const hours = Math.floor(secondsSinceMidnight / 3600);
26778 const minutes = Math.floor(secondsSinceMidnight % 3600 / 60);
26779 const seconds = secondsSinceMidnight % 60;
26780 const time = [hours, minutes, seconds].map((part) => String(part).padStart(2, "0")).join(":");
26781 return (0, import_date11.getDate)(`${ANCHOR_DATE}T${time}`);
26782 }
26783 function getValueFormatted6({
26784 item,
26785 field
26786 }) {
26787 const secondsSinceMidnight = parseTime2(field.getValue({ item }));
26788 if (secondsSinceMidnight === null) {
26789 return "";
26790 }
26791 let formatTime;
26792 if (field.type !== "time") {
26793 formatTime = format6;
26794 } else {
26795 formatTime = field.format;
26796 }
26797 return (0, import_date11.dateI18n)(formatTime.time, toAnchoredDate(secondsSinceMidnight));
26798 }
26799 var sort3 = (a, b, direction) => {
26800 const timeA = parseTime2(a);
26801 const timeB = parseTime2(b);
26802 if (timeA === null || timeB === null) {
26803 if (timeA === timeB) {
26804 return 0;
26805 }
26806 return timeA === null ? 1 : -1;
26807 }
26808 return direction === "asc" ? timeA - timeB : timeB - timeA;
26809 };
26810 var time_default = {
26811 type: "time",
26812 render,
26813 Edit: "time",
26814 sort: sort3,
26815 enableSorting: true,
26816 enableGlobalSearch: false,
26817 defaultOperators: [
26818 OPERATOR_ON,
26819 OPERATOR_NOT_ON,
26820 OPERATOR_BEFORE,
26821 OPERATOR_AFTER,
26822 OPERATOR_BEFORE_INC,
26823 OPERATOR_AFTER_INC,
26824 OPERATOR_BETWEEN
26825 ],
26826 validOperators: [
26827 OPERATOR_ON,
26828 OPERATOR_NOT_ON,
26829 OPERATOR_BEFORE,
26830 OPERATOR_AFTER,
26831 OPERATOR_BEFORE_INC,
26832 OPERATOR_AFTER_INC,
26833 OPERATOR_BETWEEN
26834 ],
26835 format: format6,
26836 getValueFormatted: getValueFormatted6,
26837 validate: {
26838 required: isValidRequired,
26839 elements: isValidElements,
26840 min: isValidMinTime,
26841 max: isValidMaxTime
26842 }
26843 };
26844
26845 // packages/dataviews/build-module/field-types/boolean.mjs
26846 var import_i18n23 = __toESM(require_i18n(), 1);
26847
26848 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs
26849 function isValidRequiredForBool(item, field) {
26850 const value = field.getValue({ item });
26851 return value === true;
26852 }
26853
26854 // packages/dataviews/build-module/field-types/boolean.mjs
26855 function getValueFormatted7({
26856 item,
26857 field
26858 }) {
26859 const value = field.getValue({ item });
26860 if (value === true) {
26861 return (0, import_i18n23.__)("True");
26862 }
26863 if (value === false) {
26864 return (0, import_i18n23.__)("False");
26865 }
26866 return "";
26867 }
26868 function isValidCustom4(item, field) {
26869 const value = field.getValue({ item });
26870 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) {
26871 return (0, import_i18n23.__)("Value must be true, false, or undefined");
26872 }
26873 return null;
26874 }
26875 var sort4 = (a, b, direction) => {
26876 const boolA = Boolean(a);
26877 const boolB = Boolean(b);
26878 if (boolA === boolB) {
26879 return 0;
26880 }
26881 if (direction === "asc") {
26882 return boolA ? 1 : -1;
26883 }
26884 return boolA ? -1 : 1;
26885 };
26886 var boolean_default = {
26887 type: "boolean",
26888 render,
26889 Edit: "checkbox",
26890 sort: sort4,
26891 validate: {
26892 required: isValidRequiredForBool,
26893 elements: isValidElements,
26894 custom: isValidCustom4
26895 },
26896 enableSorting: true,
26897 enableGlobalSearch: false,
26898 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
26899 validOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
26900 format: {},
26901 getValueFormatted: getValueFormatted7
26902 };
26903
26904 // packages/dataviews/build-module/field-types/media.mjs
26905 var media_default = {
26906 type: "media",
26907 render: () => null,
26908 Edit: null,
26909 sort: () => 0,
26910 enableSorting: false,
26911 enableGlobalSearch: false,
26912 defaultOperators: [],
26913 validOperators: [],
26914 format: {},
26915 getValueFormatted: get_value_formatted_default_default,
26916 // cannot validate any constraint, so
26917 // the only available validation for the field author
26918 // would be providing a custom validator.
26919 validate: {}
26920 };
26921
26922 // packages/dataviews/build-module/field-types/array.mjs
26923 var import_i18n24 = __toESM(require_i18n(), 1);
26924
26925 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs
26926 function isValidRequiredForArray(item, field) {
26927 const value = field.getValue({ item });
26928 return Array.isArray(value) && value.length > 0 && value.every(
26929 (element) => ![void 0, "", null].includes(element)
26930 );
26931 }
26932
26933 // packages/dataviews/build-module/field-types/array.mjs
26934 function getValueFormatted8({
26935 item,
26936 field
26937 }) {
26938 const value = field.getValue({ item });
26939 const arr = Array.isArray(value) ? value : [];
26940 return arr.join(", ");
26941 }
26942 function render2({ item, field }) {
26943 return getValueFormatted8({ item, field });
26944 }
26945 function isValidCustom5(item, field) {
26946 const value = field.getValue({ item });
26947 if ([void 0, "", null].includes(value)) {
26948 return null;
26949 }
26950 if (!Array.isArray(value)) {
26951 return (0, import_i18n24.__)("Value must be an array.");
26952 }
26953 if (!value.every((v2) => typeof v2 === "string")) {
26954 return (0, import_i18n24.__)("Every value must be a string.");
26955 }
26956 return null;
26957 }
26958 var sort5 = (a, b, direction) => {
26959 const arrA = Array.isArray(a) ? a : [];
26960 const arrB = Array.isArray(b) ? b : [];
26961 if (arrA.length !== arrB.length) {
26962 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length;
26963 }
26964 const joinedA = arrA.join(",");
26965 const joinedB = arrB.join(",");
26966 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA);
26967 };
26968 var array_default = {
26969 type: "array",
26970 render: render2,
26971 Edit: "array",
26972 sort: sort5,
26973 enableSorting: true,
26974 enableGlobalSearch: false,
26975 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
26976 validOperators: [
26977 OPERATOR_IS_ANY,
26978 OPERATOR_IS_NONE,
26979 OPERATOR_IS_ALL,
26980 OPERATOR_IS_NOT_ALL
26981 ],
26982 format: {},
26983 getValueFormatted: getValueFormatted8,
26984 validate: {
26985 required: isValidRequiredForArray,
26986 elements: isValidElements,
26987 custom: isValidCustom5
26988 }
26989 };
26990
26991 // packages/dataviews/build-module/field-types/password.mjs
26992 function getValueFormatted9({
26993 item,
26994 field
26995 }) {
26996 return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : "";
26997 }
26998 var password_default = {
26999 type: "password",
27000 render,
27001 Edit: "password",
27002 sort: () => 0,
27003 // Passwords should not be sortable for security reasons
27004 enableSorting: false,
27005 enableGlobalSearch: false,
27006 defaultOperators: [],
27007 validOperators: [],
27008 format: {},
27009 getValueFormatted: getValueFormatted9,
27010 validate: {
27011 required: isValidRequired,
27012 pattern: isValidPattern,
27013 minLength: isValidMinLength,
27014 maxLength: isValidMaxLength,
27015 elements: isValidElements
27016 }
27017 };
27018
27019 // packages/dataviews/build-module/field-types/telephone.mjs
27020 var telephone_default = {
27021 type: "telephone",
27022 render,
27023 Edit: "telephone",
27024 sort: sort_text_default,
27025 enableSorting: true,
27026 enableGlobalSearch: false,
27027 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27028 validOperators: [
27029 OPERATOR_IS,
27030 OPERATOR_IS_NOT,
27031 OPERATOR_CONTAINS,
27032 OPERATOR_NOT_CONTAINS,
27033 OPERATOR_STARTS_WITH,
27034 // Multiple selection
27035 OPERATOR_IS_ANY,
27036 OPERATOR_IS_NONE,
27037 OPERATOR_IS_NOT_ALL
27038 ],
27039 format: {},
27040 getValueFormatted: get_value_formatted_default_default,
27041 validate: {
27042 required: isValidRequired,
27043 pattern: isValidPattern,
27044 minLength: isValidMinLength,
27045 maxLength: isValidMaxLength,
27046 elements: isValidElements
27047 }
27048 };
27049
27050 // packages/dataviews/build-module/field-types/color.mjs
27051 var import_i18n25 = __toESM(require_i18n(), 1);
27052 var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1);
27053 function render3({ item, field }) {
27054 if (field.hasElements) {
27055 return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(RenderFromElements, { item, field });
27056 }
27057 const value = get_value_formatted_default_default({ item, field });
27058 if (!value || !A(value).isValid()) {
27059 return value;
27060 }
27061 return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
27062 /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
27063 "div",
27064 {
27065 style: {
27066 width: "16px",
27067 height: "16px",
27068 borderRadius: "50%",
27069 backgroundColor: value,
27070 border: "1px solid #ddd",
27071 flexShrink: 0
27072 }
27073 }
27074 ),
27075 /* @__PURE__ */ (0, import_jsx_runtime110.jsx)("span", { children: value })
27076 ] });
27077 }
27078 function isValidCustom6(item, field) {
27079 const value = field.getValue({ item });
27080 if (![void 0, "", null].includes(value) && !A(value).isValid()) {
27081 return (0, import_i18n25.__)("Value must be a valid color.");
27082 }
27083 return null;
27084 }
27085 var sort6 = (a, b, direction) => {
27086 const colorA = A(a);
27087 const colorB = A(b);
27088 if (!colorA.isValid() && !colorB.isValid()) {
27089 return 0;
27090 }
27091 if (!colorA.isValid()) {
27092 return direction === "asc" ? 1 : -1;
27093 }
27094 if (!colorB.isValid()) {
27095 return direction === "asc" ? -1 : 1;
27096 }
27097 const hslA = colorA.toHsl();
27098 const hslB = colorB.toHsl();
27099 if (hslA.h !== hslB.h) {
27100 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h;
27101 }
27102 if (hslA.s !== hslB.s) {
27103 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s;
27104 }
27105 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l;
27106 };
27107 var color_default = {
27108 type: "color",
27109 render: render3,
27110 Edit: "color",
27111 sort: sort6,
27112 enableSorting: true,
27113 enableGlobalSearch: false,
27114 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27115 validOperators: [
27116 OPERATOR_IS,
27117 OPERATOR_IS_NOT,
27118 OPERATOR_IS_ANY,
27119 OPERATOR_IS_NONE
27120 ],
27121 format: {},
27122 getValueFormatted: get_value_formatted_default_default,
27123 validate: {
27124 required: isValidRequired,
27125 elements: isValidElements,
27126 custom: isValidCustom6
27127 }
27128 };
27129
27130 // packages/dataviews/build-module/field-types/url.mjs
27131 var url_default = {
27132 type: "url",
27133 render,
27134 Edit: "url",
27135 sort: sort_text_default,
27136 enableSorting: true,
27137 enableGlobalSearch: false,
27138 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE],
27139 validOperators: [
27140 OPERATOR_IS,
27141 OPERATOR_IS_NOT,
27142 OPERATOR_CONTAINS,
27143 OPERATOR_NOT_CONTAINS,
27144 OPERATOR_STARTS_WITH,
27145 // Multiple selection
27146 OPERATOR_IS_ANY,
27147 OPERATOR_IS_NONE,
27148 OPERATOR_IS_NOT_ALL
27149 ],
27150 format: {},
27151 getValueFormatted: get_value_formatted_default_default,
27152 validate: {
27153 required: isValidRequired,
27154 pattern: isValidPattern,
27155 minLength: isValidMinLength,
27156 maxLength: isValidMaxLength,
27157 elements: isValidElements
27158 }
27159 };
27160
27161 // packages/dataviews/build-module/field-types/no-type.mjs
27162 var sort7 = (a, b, direction) => {
27163 if (typeof a === "number" && typeof b === "number") {
27164 return sort_number_default(a, b, direction);
27165 }
27166 return sort_text_default(a, b, direction);
27167 };
27168 var no_type_default = {
27169 // type: no type for this one
27170 render,
27171 Edit: null,
27172 sort: sort7,
27173 enableSorting: true,
27174 enableGlobalSearch: false,
27175 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT],
27176 validOperators: getAllOperatorNames(),
27177 format: {},
27178 getValueFormatted: get_value_formatted_default_default,
27179 validate: {
27180 required: isValidRequired,
27181 elements: isValidElements
27182 }
27183 };
27184
27185 // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs
27186 function supportsNumericRangeConstraint(type) {
27187 return type === "integer" || type === "number";
27188 }
27189 function supportsStringRangeConstraint(type) {
27190 return type === "date" || type === "datetime" || type === "time";
27191 }
27192 function normalizeRangeRule(value, fieldType, key) {
27193 const validator = fieldType.validate[key];
27194 if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsStringRangeConstraint(fieldType.type))) {
27195 return { constraint: value, validate: validator };
27196 }
27197 return void 0;
27198 }
27199 function getIsValid(field, fieldType) {
27200 const rules = field.isValid;
27201 let required;
27202 if (rules?.required === true && fieldType.validate.required !== void 0) {
27203 required = {
27204 constraint: true,
27205 validate: fieldType.validate.required
27206 };
27207 }
27208 let elements;
27209 if ((rules?.elements === true || // elements is enabled unless the field opts-out
27210 rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) {
27211 elements = {
27212 constraint: true,
27213 validate: fieldType.validate.elements
27214 };
27215 }
27216 const min3 = normalizeRangeRule(rules?.min, fieldType, "min");
27217 const max3 = normalizeRangeRule(rules?.max, fieldType, "max");
27218 const minLengthValue = rules?.minLength;
27219 let minLength;
27220 if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) {
27221 minLength = {
27222 constraint: minLengthValue,
27223 validate: fieldType.validate.minLength
27224 };
27225 }
27226 const maxLengthValue = rules?.maxLength;
27227 let maxLength;
27228 if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) {
27229 maxLength = {
27230 constraint: maxLengthValue,
27231 validate: fieldType.validate.maxLength
27232 };
27233 }
27234 const patternValue = rules?.pattern;
27235 let pattern;
27236 if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) {
27237 pattern = {
27238 constraint: patternValue,
27239 validate: fieldType.validate.pattern
27240 };
27241 }
27242 const custom = rules?.custom ?? fieldType.validate.custom;
27243 return {
27244 required,
27245 elements,
27246 min: min3,
27247 max: max3,
27248 minLength,
27249 maxLength,
27250 pattern,
27251 custom
27252 };
27253 }
27254
27255 // packages/dataviews/build-module/field-types/utils/get-filter.mjs
27256 function getFilter(fieldType) {
27257 return fieldType.validOperators.reduce((accumulator, operator) => {
27258 const operatorObj = getOperatorByName(operator);
27259 if (operatorObj?.filter) {
27260 accumulator[operator] = operatorObj.filter;
27261 }
27262 return accumulator;
27263 }, {});
27264 }
27265
27266 // packages/dataviews/build-module/field-types/utils/get-format.mjs
27267 function getFormat(field, fieldType) {
27268 return {
27269 ...fieldType.format,
27270 ...field.format
27271 };
27272 }
27273 var get_format_default = getFormat;
27274
27275 // packages/dataviews/build-module/field-types/index.mjs
27276 function getFieldTypeByName(type) {
27277 const found = [
27278 email_default,
27279 integer_default,
27280 number_default,
27281 text_default,
27282 datetime_default,
27283 date_default,
27284 time_default,
27285 boolean_default,
27286 media_default,
27287 array_default,
27288 password_default,
27289 telephone_default,
27290 color_default,
27291 url_default
27292 ].find((fieldType) => fieldType?.type === type);
27293 if (!!found) {
27294 return found;
27295 }
27296 return no_type_default;
27297 }
27298 function normalizeFields(fields) {
27299 return fields.map((field) => {
27300 const fieldType = getFieldTypeByName(field.type);
27301 const getValue = field.getValue || get_value_from_id_default(field.id);
27302 const sort8 = function(a, b, direction) {
27303 const aValue = getValue({ item: a });
27304 const bValue = getValue({ item: b });
27305 return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction);
27306 };
27307 return {
27308 id: field.id,
27309 label: field.label || field.id,
27310 header: field.header || field.label || field.id,
27311 description: field.description,
27312 placeholder: field.placeholder,
27313 getValue,
27314 setValue: field.setValue || set_value_from_id_default(field.id),
27315 elements: field.elements,
27316 getElements: field.getElements,
27317 hasElements: hasElements(field),
27318 isVisible: field.isVisible,
27319 isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled,
27320 enableHiding: field.enableHiding ?? true,
27321 readOnly: field.readOnly ?? false,
27322 // The type provides defaults for the following props
27323 type: fieldType.type,
27324 render: field.render ?? fieldType.render,
27325 Edit: getControl(field, fieldType.Edit),
27326 sort: sort8,
27327 enableSorting: field.enableSorting ?? fieldType.enableSorting,
27328 enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch,
27329 isValid: getIsValid(field, fieldType),
27330 filterBy: get_filter_by_default(
27331 field,
27332 fieldType.defaultOperators,
27333 fieldType.validOperators
27334 ),
27335 filter: getFilter(fieldType),
27336 format: get_format_default(field, fieldType),
27337 getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted
27338 };
27339 });
27340 }
27341
27342 // packages/dataviews/build-module/dataform/index.mjs
27343 var import_element101 = __toESM(require_element(), 1);
27344
27345 // packages/dataviews/build-module/components/dataform-context/index.mjs
27346 var import_element91 = __toESM(require_element(), 1);
27347 var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1);
27348 var DataFormContext = (0, import_element91.createContext)({
27349 fields: []
27350 });
27351 DataFormContext.displayName = "DataFormContext";
27352 function DataFormProvider({
27353 fields,
27354 children
27355 }) {
27356 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(DataFormContext.Provider, { value: { fields }, children });
27357 }
27358 var dataform_context_default = DataFormContext;
27359
27360 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
27361 var import_element100 = __toESM(require_element(), 1);
27362
27363 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
27364 var import_element92 = __toESM(require_element(), 1);
27365 var import_components23 = __toESM(require_components(), 1);
27366
27367 // packages/dataviews/build-module/components/dataform-layouts/can-render-field.mjs
27368 function canRenderField(field) {
27369 return !!field && (field.readOnly === true || !!field.Edit);
27370 }
27371
27372 // packages/dataviews/build-module/components/dataform-layouts/normalize-form.mjs
27373 var import_i18n26 = __toESM(require_i18n(), 1);
27374 var DEFAULT_LAYOUT = {
27375 type: "regular",
27376 labelPosition: "top"
27377 };
27378 var normalizeCardSummaryField = (sum) => {
27379 if (typeof sum === "string") {
27380 return [{ id: sum, visibility: "when-collapsed" }];
27381 }
27382 return sum.map((item) => {
27383 if (typeof item === "string") {
27384 return { id: item, visibility: "when-collapsed" };
27385 }
27386 return { id: item.id, visibility: item.visibility };
27387 });
27388 };
27389 function normalizeLayout(layout) {
27390 let normalizedLayout = DEFAULT_LAYOUT;
27391 if (layout?.type === "regular") {
27392 normalizedLayout = {
27393 type: "regular",
27394 labelPosition: layout?.labelPosition ?? "top"
27395 };
27396 } else if (layout?.type === "panel") {
27397 const summary = layout.summary ?? [];
27398 const normalizedSummary = Array.isArray(summary) ? summary : [summary];
27399 const openAs = layout?.openAs;
27400 let normalizedOpenAs;
27401 if (typeof openAs === "object" && openAs.type === "modal") {
27402 normalizedOpenAs = {
27403 type: "modal",
27404 applyLabel: openAs.applyLabel?.trim() || (0, import_i18n26.__)("Apply"),
27405 cancelLabel: openAs.cancelLabel?.trim() || (0, import_i18n26.__)("Cancel")
27406 };
27407 } else if (openAs === "modal") {
27408 normalizedOpenAs = {
27409 type: "modal",
27410 applyLabel: (0, import_i18n26.__)("Apply"),
27411 cancelLabel: (0, import_i18n26.__)("Cancel")
27412 };
27413 } else {
27414 normalizedOpenAs = { type: "dropdown" };
27415 }
27416 normalizedLayout = {
27417 type: "panel",
27418 labelPosition: layout?.labelPosition ?? "side",
27419 openAs: normalizedOpenAs,
27420 summary: normalizedSummary,
27421 editVisibility: layout?.editVisibility ?? "on-hover",
27422 showPlaceholderIfEmpty: layout?.showPlaceholderIfEmpty ?? false
27423 };
27424 } else if (layout?.type === "card") {
27425 if (layout.withHeader === false) {
27426 normalizedLayout = {
27427 type: "card",
27428 withHeader: false,
27429 isOpened: true,
27430 summary: [],
27431 isCollapsible: false
27432 };
27433 } else {
27434 const summary = layout.summary ?? [];
27435 normalizedLayout = {
27436 type: "card",
27437 withHeader: true,
27438 isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true,
27439 summary: normalizeCardSummaryField(summary),
27440 isCollapsible: layout.isCollapsible === void 0 ? true : layout.isCollapsible
27441 };
27442 }
27443 } else if (layout?.type === "row") {
27444 normalizedLayout = {
27445 type: "row",
27446 alignment: layout?.alignment ?? "center",
27447 styles: layout?.styles ?? {}
27448 };
27449 } else if (layout?.type === "details") {
27450 normalizedLayout = {
27451 type: "details",
27452 summary: layout?.summary ?? ""
27453 };
27454 }
27455 return normalizedLayout;
27456 }
27457 function normalizeForm(form) {
27458 const normalizedFormLayout = normalizeLayout(form?.layout);
27459 const normalizedFields = (form.fields ?? []).map(
27460 (field) => {
27461 if (typeof field === "string") {
27462 return {
27463 id: field,
27464 layout: normalizedFormLayout
27465 };
27466 }
27467 const fieldLayout = field.layout ? normalizeLayout(field.layout) : normalizedFormLayout;
27468 return {
27469 id: field.id,
27470 layout: fieldLayout,
27471 ...!!field.label && { label: field.label },
27472 ...!!field.description && {
27473 description: field.description
27474 },
27475 ..."children" in field && Array.isArray(field.children) && {
27476 children: normalizeForm({
27477 fields: field.children,
27478 layout: DEFAULT_LAYOUT
27479 }).fields
27480 }
27481 };
27482 }
27483 );
27484 return {
27485 layout: normalizedFormLayout,
27486 fields: normalizedFields
27487 };
27488 }
27489 var normalize_form_default = normalizeForm;
27490
27491 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs
27492 var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1);
27493 function Header4({ title }) {
27494 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
27495 Stack,
27496 {
27497 direction: "column",
27498 className: "dataforms-layouts-regular__header",
27499 gap: "lg",
27500 children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components23.__experimentalHeading, { level: 2, size: 13, children: title }) })
27501 }
27502 );
27503 }
27504 function FormRegularField({
27505 data,
27506 field,
27507 onChange,
27508 hideLabelFromVision,
27509 markWhenOptional,
27510 validity
27511 }) {
27512 const { fields } = (0, import_element92.useContext)(dataform_context_default);
27513 const layout = field.layout;
27514 const form = (0, import_element92.useMemo)(
27515 () => ({
27516 layout: DEFAULT_LAYOUT,
27517 fields: !!field.children ? field.children : []
27518 }),
27519 [field]
27520 );
27521 if (!!field.children) {
27522 return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
27523 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Header4, { title: field.label }),
27524 /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
27525 DataFormLayout,
27526 {
27527 data,
27528 form,
27529 onChange,
27530 validity: validity?.children
27531 }
27532 )
27533 ] });
27534 }
27535 const labelPosition = layout.labelPosition;
27536 const fieldDefinition = fields.find(
27537 (fieldDef) => fieldDef.id === field.id
27538 );
27539 if (!canRenderField(fieldDefinition)) {
27540 return null;
27541 }
27542 if (labelPosition === "side") {
27543 return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(
27544 Stack,
27545 {
27546 direction: "row",
27547 className: "dataforms-layouts-regular__field",
27548 gap: "sm",
27549 children: [
27550 /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
27551 "div",
27552 {
27553 className: clsx_default(
27554 "dataforms-layouts-regular__field-label",
27555 `dataforms-layouts-regular__field-label--label-position-${labelPosition}`
27556 ),
27557 children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components23.BaseControl.VisualLabel, { children: fieldDefinition.label })
27558 }
27559 ),
27560 /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
27561 fieldDefinition.render,
27562 {
27563 item: data,
27564 field: fieldDefinition
27565 }
27566 ) : fieldDefinition.Edit && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
27567 fieldDefinition.Edit,
27568 {
27569 data,
27570 field: fieldDefinition,
27571 onChange,
27572 hideLabelFromVision: true,
27573 markWhenOptional,
27574 validity
27575 },
27576 fieldDefinition.id
27577 ) })
27578 ]
27579 }
27580 );
27581 }
27582 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_jsx_runtime112.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(import_jsx_runtime112.Fragment, { children: [
27583 !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components23.BaseControl.VisualLabel, { children: fieldDefinition.label }),
27584 /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
27585 fieldDefinition.render,
27586 {
27587 item: data,
27588 field: fieldDefinition
27589 }
27590 )
27591 ] }) }) : fieldDefinition.Edit && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
27592 fieldDefinition.Edit,
27593 {
27594 data,
27595 field: fieldDefinition,
27596 onChange,
27597 hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision,
27598 markWhenOptional,
27599 validity
27600 }
27601 ) });
27602 }
27603
27604 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
27605 var import_deepmerge2 = __toESM(require_cjs(), 1);
27606 var import_components26 = __toESM(require_components(), 1);
27607 var import_element96 = __toESM(require_element(), 1);
27608 var import_compose13 = __toESM(require_compose(), 1);
27609
27610 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
27611 var import_components25 = __toESM(require_components(), 1);
27612 var import_i18n27 = __toESM(require_i18n(), 1);
27613 var import_compose12 = __toESM(require_compose(), 1);
27614
27615 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs
27616 function getLabelClassName(labelPosition, showError) {
27617 return clsx_default(
27618 "dataforms-layouts-panel__field-label",
27619 `dataforms-layouts-panel__field-label--label-position-${labelPosition}`,
27620 { "has-error": showError }
27621 );
27622 }
27623 var get_label_classname_default = getLabelClassName;
27624
27625 // packages/dataviews/build-module/components/dataform-layouts/panel/field-label-content.mjs
27626 var import_components24 = __toESM(require_components(), 1);
27627 var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1);
27628 function FieldLabelContent({
27629 showError,
27630 errorMessage,
27631 fieldLabel,
27632 errorId
27633 }) {
27634 if (!showError) {
27635 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_jsx_runtime113.Fragment, { children: fieldLabel });
27636 }
27637 return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [
27638 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_components24.Icon, { icon: error_default, size: 16 }),
27639 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(VisuallyHidden, { id: errorId, children: errorMessage }),
27640 fieldLabel
27641 ] });
27642 }
27643 var field_label_content_default = FieldLabelContent;
27644
27645 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs
27646 function getFirstValidationError(validity) {
27647 if (!validity) {
27648 return void 0;
27649 }
27650 const validityRules = Object.keys(validity).filter(
27651 (key) => key !== "children"
27652 );
27653 for (const key of validityRules) {
27654 const rule = validity[key];
27655 if (rule === void 0) {
27656 continue;
27657 }
27658 if (rule.type === "invalid") {
27659 if (rule.message) {
27660 return rule.message;
27661 }
27662 if (key === "required") {
27663 return "A required field is empty";
27664 }
27665 return "Unidentified validation error";
27666 }
27667 }
27668 if (validity.children) {
27669 for (const childValidity of Object.values(validity.children)) {
27670 const childError = getFirstValidationError(childValidity);
27671 if (childError) {
27672 return childError;
27673 }
27674 }
27675 }
27676 return void 0;
27677 }
27678 var get_first_validation_error_default = getFirstValidationError;
27679
27680 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs
27681 var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1);
27682 function SummaryValue({
27683 item,
27684 field,
27685 showPlaceholderIfEmpty
27686 }) {
27687 if (showPlaceholderIfEmpty && field.placeholder && [void 0, null, ""].includes(field.getValue({ item }))) {
27688 return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("span", { className: "dataforms-layouts-panel__field-placeholder", children: field.placeholder });
27689 }
27690 return /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(field.render, { item, field });
27691 }
27692 function SummaryButton({
27693 data,
27694 field,
27695 fieldLabel,
27696 summaryFields,
27697 validity,
27698 touched,
27699 disabled: disabled2,
27700 isOpen,
27701 onClick
27702 }) {
27703 const { labelPosition, editVisibility, showPlaceholderIfEmpty } = field.layout;
27704 const errorMessage = get_first_validation_error_default(validity);
27705 const showError = touched && !!errorMessage;
27706 const labelClassName = get_label_classname_default(labelPosition, showError);
27707 const className = clsx_default(
27708 "dataforms-layouts-panel__field-trigger",
27709 `dataforms-layouts-panel__field-trigger--label-${labelPosition}`,
27710 {
27711 "is-disabled": disabled2,
27712 "dataforms-layouts-panel__field-trigger--edit-always": editVisibility === "always"
27713 }
27714 );
27715 const controlId = (0, import_compose12.useInstanceId)(
27716 SummaryButton,
27717 "dataforms-layouts-panel__field-control"
27718 );
27719 const errorId = `${controlId}-error`;
27720 const ariaLabel = showError ? (0, import_i18n27.sprintf)(
27721 // translators: %s: Field name.
27722 (0, import_i18n27._x)("Edit %s (has errors)", "field"),
27723 fieldLabel || ""
27724 ) : (0, import_i18n27.sprintf)(
27725 // translators: %s: Field name.
27726 (0, import_i18n27._x)("Edit %s", "field"),
27727 fieldLabel || ""
27728 );
27729 return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className, children: [
27730 labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("span", { className: labelClassName, children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
27731 field_label_content_default,
27732 {
27733 showError,
27734 errorMessage,
27735 fieldLabel,
27736 errorId
27737 }
27738 ) }),
27739 labelPosition === "none" && showError && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
27740 field_label_content_default,
27741 {
27742 showError: true,
27743 errorMessage,
27744 errorId
27745 }
27746 ),
27747 /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
27748 "span",
27749 {
27750 id: `${controlId}`,
27751 className: "dataforms-layouts-panel__field-control",
27752 children: summaryFields.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
27753 "span",
27754 {
27755 style: {
27756 display: "flex",
27757 flexDirection: "column",
27758 alignItems: "flex-start",
27759 width: "100%",
27760 gap: "2px"
27761 },
27762 children: summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
27763 "span",
27764 {
27765 style: { width: "100%" },
27766 children: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
27767 SummaryValue,
27768 {
27769 item: data,
27770 field: summaryField,
27771 showPlaceholderIfEmpty
27772 }
27773 )
27774 },
27775 summaryField.id
27776 ))
27777 }
27778 ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
27779 SummaryValue,
27780 {
27781 item: data,
27782 field: summaryField,
27783 showPlaceholderIfEmpty
27784 },
27785 summaryField.id
27786 ))
27787 }
27788 ),
27789 !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
27790 import_components25.Button,
27791 {
27792 className: "dataforms-layouts-panel__field-trigger-icon",
27793 label: ariaLabel,
27794 icon: pencil_default,
27795 size: "small",
27796 "aria-expanded": isOpen,
27797 "aria-haspopup": "dialog",
27798 "aria-describedby": showError ? `${controlId} ${errorId}` : controlId,
27799 onClick
27800 }
27801 )
27802 ] });
27803 }
27804
27805 // packages/dataviews/build-module/hooks/use-form-validity.mjs
27806 var import_deepmerge = __toESM(require_cjs(), 1);
27807 var import_es6 = __toESM(require_es6(), 1);
27808 var import_element93 = __toESM(require_element(), 1);
27809 var import_i18n28 = __toESM(require_i18n(), 1);
27810 function isFormValid(formValidity) {
27811 if (!formValidity) {
27812 return true;
27813 }
27814 return Object.values(formValidity).every((fieldValidation) => {
27815 return Object.entries(fieldValidation).every(
27816 ([key, validation]) => {
27817 if (key === "children" && validation && typeof validation === "object") {
27818 return isFormValid(validation);
27819 }
27820 return validation.type !== "invalid" && validation.type !== "validating";
27821 }
27822 );
27823 });
27824 }
27825 function getFormFieldsToValidate(form, fields) {
27826 const normalizedForm = normalize_form_default(form);
27827 if (normalizedForm.fields.length === 0) {
27828 return [];
27829 }
27830 const fieldsMap = /* @__PURE__ */ new Map();
27831 fields.forEach((field) => {
27832 fieldsMap.set(field.id, field);
27833 });
27834 function processFormField(formField) {
27835 if ("children" in formField && Array.isArray(formField.children)) {
27836 const processedChildren = formField.children.map(processFormField).filter((child) => child !== null);
27837 if (processedChildren.length === 0) {
27838 return null;
27839 }
27840 return {
27841 id: formField.id,
27842 children: processedChildren
27843 };
27844 }
27845 const fieldDef = fieldsMap.get(formField.id);
27846 if (!fieldDef) {
27847 return null;
27848 }
27849 const [normalizedField] = normalizeFields([fieldDef]);
27850 return {
27851 id: formField.id,
27852 children: [],
27853 field: normalizedField
27854 };
27855 }
27856 const toValidate = normalizedForm.fields.map(processFormField).filter((field) => field !== null);
27857 return toValidate;
27858 }
27859 function setValidityAtPath(formValidity, fieldValidity, path) {
27860 if (!formValidity) {
27861 formValidity = {};
27862 }
27863 if (path.length === 0) {
27864 return formValidity;
27865 }
27866 const result = { ...formValidity };
27867 let current = result;
27868 for (let i = 0; i < path.length - 1; i++) {
27869 const segment = path[i];
27870 if (!current[segment]) {
27871 current[segment] = {};
27872 }
27873 current[segment] = { ...current[segment] };
27874 current = current[segment];
27875 }
27876 const finalKey = path[path.length - 1];
27877 current[finalKey] = {
27878 ...current[finalKey] || {},
27879 ...fieldValidity
27880 };
27881 return result;
27882 }
27883 function removeValidationProperty(formValidity, path, property) {
27884 if (!formValidity || path.length === 0) {
27885 return formValidity;
27886 }
27887 const result = { ...formValidity };
27888 let current = result;
27889 for (let i = 0; i < path.length - 1; i++) {
27890 const segment = path[i];
27891 if (!current[segment]) {
27892 return formValidity;
27893 }
27894 current[segment] = { ...current[segment] };
27895 current = current[segment];
27896 }
27897 const finalKey = path[path.length - 1];
27898 if (!current[finalKey]) {
27899 return formValidity;
27900 }
27901 const fieldValidity = { ...current[finalKey] };
27902 delete fieldValidity[property];
27903 if (Object.keys(fieldValidity).length === 0) {
27904 delete current[finalKey];
27905 } else {
27906 current[finalKey] = fieldValidity;
27907 }
27908 if (Object.keys(result).length === 0) {
27909 return void 0;
27910 }
27911 return result;
27912 }
27913 function handleElementsValidationAsync(promise, formField, promiseHandler) {
27914 const { elementsCounterRef, setFormValidity, path, item } = promiseHandler;
27915 const currentToken = (elementsCounterRef.current[formField.id] || 0) + 1;
27916 elementsCounterRef.current[formField.id] = currentToken;
27917 promise.then((result) => {
27918 if (currentToken !== elementsCounterRef.current[formField.id]) {
27919 return;
27920 }
27921 if (!Array.isArray(result)) {
27922 setFormValidity((prev) => {
27923 const newFormValidity = setValidityAtPath(
27924 prev,
27925 {
27926 elements: {
27927 type: "invalid",
27928 message: (0, import_i18n28.__)("Could not validate elements.")
27929 }
27930 },
27931 [...path, formField.id]
27932 );
27933 return newFormValidity;
27934 });
27935 return;
27936 }
27937 if (formField.field?.isValid.elements && !formField.field.isValid.elements.validate(item, {
27938 ...formField.field,
27939 elements: result
27940 })) {
27941 setFormValidity((prev) => {
27942 const newFormValidity = setValidityAtPath(
27943 prev,
27944 {
27945 elements: {
27946 type: "invalid",
27947 message: (0, import_i18n28.__)(
27948 "Value must be one of the elements."
27949 )
27950 }
27951 },
27952 [...path, formField.id]
27953 );
27954 return newFormValidity;
27955 });
27956 } else {
27957 setFormValidity((prev) => {
27958 return removeValidationProperty(
27959 prev,
27960 [...path, formField.id],
27961 "elements"
27962 );
27963 });
27964 }
27965 }).catch((error2) => {
27966 if (currentToken !== elementsCounterRef.current[formField.id]) {
27967 return;
27968 }
27969 let errorMessage;
27970 if (error2 instanceof Error) {
27971 errorMessage = error2.message;
27972 } else {
27973 errorMessage = String(error2) || (0, import_i18n28.__)(
27974 "Unknown error when running elements validation asynchronously."
27975 );
27976 }
27977 setFormValidity((prev) => {
27978 const newFormValidity = setValidityAtPath(
27979 prev,
27980 {
27981 elements: {
27982 type: "invalid",
27983 message: errorMessage
27984 }
27985 },
27986 [...path, formField.id]
27987 );
27988 return newFormValidity;
27989 });
27990 });
27991 }
27992 function handleCustomValidationAsync(promise, formField, promiseHandler) {
27993 const { customCounterRef, setFormValidity, path } = promiseHandler;
27994 const currentToken = (customCounterRef.current[formField.id] || 0) + 1;
27995 customCounterRef.current[formField.id] = currentToken;
27996 promise.then((result) => {
27997 if (currentToken !== customCounterRef.current[formField.id]) {
27998 return;
27999 }
28000 if (result === null) {
28001 setFormValidity((prev) => {
28002 return removeValidationProperty(
28003 prev,
28004 [...path, formField.id],
28005 "custom"
28006 );
28007 });
28008 return;
28009 }
28010 if (typeof result === "string") {
28011 setFormValidity((prev) => {
28012 const newFormValidity = setValidityAtPath(
28013 prev,
28014 {
28015 custom: {
28016 type: "invalid",
28017 message: result
28018 }
28019 },
28020 [...path, formField.id]
28021 );
28022 return newFormValidity;
28023 });
28024 return;
28025 }
28026 setFormValidity((prev) => {
28027 const newFormValidity = setValidityAtPath(
28028 prev,
28029 {
28030 custom: {
28031 type: "invalid",
28032 message: (0, import_i18n28.__)("Validation could not be processed.")
28033 }
28034 },
28035 [...path, formField.id]
28036 );
28037 return newFormValidity;
28038 });
28039 }).catch((error2) => {
28040 if (currentToken !== customCounterRef.current[formField.id]) {
28041 return;
28042 }
28043 let errorMessage;
28044 if (error2 instanceof Error) {
28045 errorMessage = error2.message;
28046 } else {
28047 errorMessage = String(error2) || (0, import_i18n28.__)(
28048 "Unknown error when running custom validation asynchronously."
28049 );
28050 }
28051 setFormValidity((prev) => {
28052 const newFormValidity = setValidityAtPath(
28053 prev,
28054 {
28055 custom: {
28056 type: "invalid",
28057 message: errorMessage
28058 }
28059 },
28060 [...path, formField.id]
28061 );
28062 return newFormValidity;
28063 });
28064 });
28065 }
28066 function isFormFieldHidden(formField, item) {
28067 return formField.children.length === 0 && !!formField.field?.isVisible && !formField.field.isVisible(item);
28068 }
28069 function validateFormField(item, formField, promiseHandler) {
28070 if (isFormFieldHidden(formField, item)) {
28071 const { customCounterRef, elementsCounterRef } = promiseHandler;
28072 if (customCounterRef.current[formField.id]) {
28073 customCounterRef.current[formField.id] += 1;
28074 }
28075 if (elementsCounterRef.current[formField.id]) {
28076 elementsCounterRef.current[formField.id] += 1;
28077 }
28078 return void 0;
28079 }
28080 if (formField.field?.isValid.required && !formField.field.isValid.required.validate(item, formField.field)) {
28081 return {
28082 required: { type: "invalid" }
28083 };
28084 }
28085 if (formField.field?.isValid.pattern && !formField.field.isValid.pattern.validate(item, formField.field)) {
28086 return {
28087 pattern: {
28088 type: "invalid",
28089 message: (0, import_i18n28.__)("Value does not match the required pattern.")
28090 }
28091 };
28092 }
28093 if (formField.field?.isValid.min && !formField.field.isValid.min.validate(item, formField.field)) {
28094 return {
28095 min: {
28096 type: "invalid",
28097 message: (0, import_i18n28.__)("Value is below the minimum.")
28098 }
28099 };
28100 }
28101 if (formField.field?.isValid.max && !formField.field.isValid.max.validate(item, formField.field)) {
28102 return {
28103 max: {
28104 type: "invalid",
28105 message: (0, import_i18n28.__)("Value is above the maximum.")
28106 }
28107 };
28108 }
28109 if (formField.field?.isValid.minLength && !formField.field.isValid.minLength.validate(item, formField.field)) {
28110 return {
28111 minLength: {
28112 type: "invalid",
28113 message: (0, import_i18n28.__)("Value is too short.")
28114 }
28115 };
28116 }
28117 if (formField.field?.isValid.maxLength && !formField.field.isValid.maxLength.validate(item, formField.field)) {
28118 return {
28119 maxLength: {
28120 type: "invalid",
28121 message: (0, import_i18n28.__)("Value is too long.")
28122 }
28123 };
28124 }
28125 if (formField.field?.isValid.elements && formField.field.hasElements && !formField.field.getElements && Array.isArray(formField.field.elements) && !formField.field.isValid.elements.validate(item, formField.field)) {
28126 return {
28127 elements: {
28128 type: "invalid",
28129 message: (0, import_i18n28.__)("Value must be one of the elements.")
28130 }
28131 };
28132 }
28133 let customError;
28134 if (!!formField.field && formField.field.isValid.custom) {
28135 try {
28136 const value = formField.field.getValue({ item });
28137 customError = formField.field.isValid.custom(
28138 (0, import_deepmerge.default)(
28139 item,
28140 formField.field.setValue({
28141 item,
28142 value
28143 })
28144 ),
28145 formField.field
28146 );
28147 } catch (error2) {
28148 let errorMessage;
28149 if (error2 instanceof Error) {
28150 errorMessage = error2.message;
28151 } else {
28152 errorMessage = String(error2) || (0, import_i18n28.__)("Unknown error when running custom validation.");
28153 }
28154 return {
28155 custom: {
28156 type: "invalid",
28157 message: errorMessage
28158 }
28159 };
28160 }
28161 }
28162 if (typeof customError === "string") {
28163 return {
28164 custom: {
28165 type: "invalid",
28166 message: customError
28167 }
28168 };
28169 }
28170 const fieldValidity = {};
28171 if (!!formField.field && formField.field.isValid.elements && formField.field.hasElements && typeof formField.field.getElements === "function") {
28172 handleElementsValidationAsync(
28173 formField.field.getElements(),
28174 formField,
28175 promiseHandler
28176 );
28177 fieldValidity.elements = {
28178 type: "validating",
28179 message: (0, import_i18n28.__)("Validating\u2026")
28180 };
28181 }
28182 if (customError instanceof Promise) {
28183 handleCustomValidationAsync(customError, formField, promiseHandler);
28184 fieldValidity.custom = {
28185 type: "validating",
28186 message: (0, import_i18n28.__)("Validating\u2026")
28187 };
28188 }
28189 if (Object.keys(fieldValidity).length > 0) {
28190 return fieldValidity;
28191 }
28192 if (formField.children.length > 0) {
28193 const result = {};
28194 formField.children.forEach((child) => {
28195 result[child.id] = validateFormField(item, child, {
28196 ...promiseHandler,
28197 path: [...promiseHandler.path, formField.id, "children"]
28198 });
28199 });
28200 const filteredResult = {};
28201 Object.entries(result).forEach(([key, value]) => {
28202 if (value !== void 0) {
28203 filteredResult[key] = value;
28204 }
28205 });
28206 if (Object.keys(filteredResult).length === 0) {
28207 return void 0;
28208 }
28209 return {
28210 children: filteredResult
28211 };
28212 }
28213 return void 0;
28214 }
28215 function getFormFieldValue(formField, item) {
28216 const fieldValue = formField?.field?.getValue({ item });
28217 const isHidden = isFormFieldHidden(formField, item);
28218 if (formField.children.length === 0) {
28219 return { value: fieldValue, isHidden };
28220 }
28221 const childrenValues = formField.children.map(
28222 (child) => getFormFieldValue(child, item)
28223 );
28224 return {
28225 value: fieldValue,
28226 isHidden,
28227 children: childrenValues
28228 };
28229 }
28230 function useFormValidity(item, fields, form) {
28231 const [formValidity, setFormValidity] = (0, import_element93.useState)();
28232 const customCounterRef = (0, import_element93.useRef)({});
28233 const elementsCounterRef = (0, import_element93.useRef)({});
28234 const previousValuesRef = (0, import_element93.useRef)({});
28235 const validate = (0, import_element93.useCallback)(() => {
28236 const promiseHandler = {
28237 customCounterRef,
28238 elementsCounterRef,
28239 setFormValidity,
28240 path: [],
28241 item
28242 };
28243 const formFieldsToValidate = getFormFieldsToValidate(form, fields);
28244 if (formFieldsToValidate.length === 0) {
28245 setFormValidity(void 0);
28246 return;
28247 }
28248 const newFormValidity = {};
28249 const untouchedFields = [];
28250 formFieldsToValidate.forEach((formField) => {
28251 const value = getFormFieldValue(formField, item);
28252 if (previousValuesRef.current.hasOwnProperty(formField.id) && (0, import_es6.default)(
28253 previousValuesRef.current[formField.id],
28254 value
28255 )) {
28256 untouchedFields.push(formField.id);
28257 return;
28258 }
28259 previousValuesRef.current[formField.id] = value;
28260 const fieldValidity = validateFormField(
28261 item,
28262 formField,
28263 promiseHandler
28264 );
28265 if (fieldValidity !== void 0) {
28266 newFormValidity[formField.id] = fieldValidity;
28267 }
28268 });
28269 setFormValidity((existingFormValidity) => {
28270 let validity = {
28271 ...existingFormValidity,
28272 ...newFormValidity
28273 };
28274 const fieldsToKeep = [
28275 ...untouchedFields,
28276 ...Object.keys(newFormValidity)
28277 ];
28278 Object.keys(validity).forEach((key) => {
28279 if (validity && !fieldsToKeep.includes(key)) {
28280 delete validity[key];
28281 }
28282 });
28283 if (Object.keys(validity).length === 0) {
28284 validity = void 0;
28285 }
28286 const areEqual = (0, import_es6.default)(existingFormValidity, validity);
28287 if (areEqual) {
28288 return existingFormValidity;
28289 }
28290 return validity;
28291 });
28292 }, [item, fields, form]);
28293 (0, import_element93.useEffect)(() => {
28294 validate();
28295 }, [validate]);
28296 return {
28297 validity: formValidity,
28298 isValid: isFormValid(formValidity)
28299 };
28300 }
28301 var use_form_validity_default = useFormValidity;
28302
28303 // packages/dataviews/build-module/hooks/use-reveal-validity.mjs
28304 var import_element94 = __toESM(require_element(), 1);
28305 function useRevealValidity(ref, shouldReveal) {
28306 const revealValidity = (0, import_element94.useCallback)(() => {
28307 const inputs = ref.current?.querySelectorAll("input, textarea, select");
28308 let revealedCount = 0;
28309 inputs?.forEach((input) => {
28310 if (input.willValidate && !input.validity.valid) {
28311 revealedCount++;
28312 input.dispatchEvent(
28313 new Event("invalid", { cancelable: true })
28314 );
28315 }
28316 });
28317 return revealedCount;
28318 }, [ref]);
28319 (0, import_element94.useEffect)(() => {
28320 if (shouldReveal) {
28321 revealValidity();
28322 }
28323 }, [shouldReveal, revealValidity]);
28324 return revealValidity;
28325 }
28326
28327 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
28328 var import_element95 = __toESM(require_element(), 1);
28329
28330 // packages/dataviews/build-module/components/dataform-layouts/get-summary-fields.mjs
28331 function extractSummaryIds(summary) {
28332 if (Array.isArray(summary)) {
28333 return summary.map(
28334 (item) => typeof item === "string" ? item : item.id
28335 );
28336 }
28337 return [];
28338 }
28339 var getSummaryFields = (summaryField, fields) => {
28340 if (Array.isArray(summaryField) && summaryField.length > 0) {
28341 const summaryIds = extractSummaryIds(summaryField);
28342 return summaryIds.map(
28343 (summaryId) => fields.find((_field) => _field.id === summaryId)
28344 ).filter((_field) => _field !== void 0);
28345 }
28346 return [];
28347 };
28348
28349 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs
28350 var getFieldDefinition = (field, fields) => {
28351 if (!!field.children) {
28352 const simpleChildren = field.children.filter(
28353 (child) => !child.children
28354 );
28355 if (simpleChildren.length === 0) {
28356 return void 0;
28357 }
28358 return fields.find(
28359 (_field) => _field.id === simpleChildren[0].id
28360 );
28361 }
28362 return fields.find((_field) => _field.id === field.id);
28363 };
28364 function useFieldFromFormField(field) {
28365 const { fields } = (0, import_element95.useContext)(dataform_context_default);
28366 const layout = field.layout;
28367 const summaryFields = getSummaryFields(layout.summary, fields);
28368 const fieldDefinition = getFieldDefinition(field, fields);
28369 const fieldLabel = !!field.children ? field.label : fieldDefinition?.label;
28370 if (summaryFields.length === 0) {
28371 return {
28372 summaryFields: fieldDefinition ? [fieldDefinition] : [],
28373 fieldDefinition,
28374 fieldLabel
28375 };
28376 }
28377 return {
28378 summaryFields,
28379 fieldDefinition,
28380 fieldLabel
28381 };
28382 }
28383 var use_field_from_form_field_default = useFieldFromFormField;
28384
28385 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs
28386 var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1);
28387 function ModalContent({
28388 data,
28389 field,
28390 onChange,
28391 fieldLabel,
28392 onClose,
28393 touched
28394 }) {
28395 const { openAs } = field.layout;
28396 const { applyLabel, cancelLabel } = openAs;
28397 const { fields } = (0, import_element96.useContext)(dataform_context_default);
28398 const [changes, setChanges] = (0, import_element96.useState)({});
28399 const modalData = (0, import_element96.useMemo)(() => {
28400 return (0, import_deepmerge2.default)(data, changes, {
28401 arrayMerge: (target, source) => source
28402 });
28403 }, [data, changes]);
28404 const form = (0, import_element96.useMemo)(
28405 () => ({
28406 layout: DEFAULT_LAYOUT,
28407 fields: !!field.children ? field.children : (
28408 // If not explicit children return the field id itself.
28409 [{ id: field.id, layout: DEFAULT_LAYOUT }]
28410 )
28411 }),
28412 [field]
28413 );
28414 const fieldsAsFieldType = fields.map((f) => ({
28415 ...f,
28416 Edit: f.Edit === null ? void 0 : f.Edit,
28417 isValid: {
28418 required: f.isValid.required?.constraint,
28419 elements: f.isValid.elements?.constraint,
28420 min: f.isValid.min?.constraint,
28421 max: f.isValid.max?.constraint,
28422 pattern: f.isValid.pattern?.constraint,
28423 minLength: f.isValid.minLength?.constraint,
28424 maxLength: f.isValid.maxLength?.constraint
28425 }
28426 }));
28427 const { validity } = use_form_validity_default(modalData, fieldsAsFieldType, form);
28428 const onApply = () => {
28429 onChange(changes);
28430 onClose();
28431 };
28432 const handleOnChange = (newValue) => {
28433 setChanges(
28434 (prev) => (0, import_deepmerge2.default)(prev, newValue, {
28435 arrayMerge: (target, source) => source
28436 })
28437 );
28438 };
28439 const focusOnMountRef = (0, import_compose13.useFocusOnMount)("firstInputElement");
28440 const contentRef = (0, import_element96.useRef)(null);
28441 const mergedRef = (0, import_compose13.useMergeRefs)([focusOnMountRef, contentRef]);
28442 useRevealValidity(contentRef, touched);
28443 return /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
28444 import_components26.Modal,
28445 {
28446 className: "dataforms-layouts-panel__modal",
28447 onRequestClose: onClose,
28448 isFullScreen: false,
28449 title: fieldLabel,
28450 size: "medium",
28451 children: [
28452 /* @__PURE__ */ (0, import_jsx_runtime115.jsx)("div", { ref: mergedRef, children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
28453 DataFormLayout,
28454 {
28455 data: modalData,
28456 form,
28457 onChange: handleOnChange,
28458 validity,
28459 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
28460 FieldLayout,
28461 {
28462 data: modalData,
28463 field: childField,
28464 onChange: handleOnChange,
28465 hideLabelFromVision: form.fields.length < 2,
28466 markWhenOptional,
28467 validity: childFieldValidity
28468 },
28469 childField.id
28470 )
28471 }
28472 ) }),
28473 /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(
28474 Stack,
28475 {
28476 direction: "row",
28477 className: "dataforms-layouts-panel__modal-footer",
28478 gap: "md",
28479 children: [
28480 /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(import_components26.__experimentalSpacer, { style: { flex: 1 } }),
28481 /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
28482 import_components26.Button,
28483 {
28484 variant: "tertiary",
28485 onClick: onClose,
28486 __next40pxDefaultSize: true,
28487 children: cancelLabel
28488 }
28489 ),
28490 /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
28491 import_components26.Button,
28492 {
28493 variant: "primary",
28494 onClick: onApply,
28495 __next40pxDefaultSize: true,
28496 children: applyLabel
28497 }
28498 )
28499 ]
28500 }
28501 )
28502 ]
28503 }
28504 );
28505 }
28506 function PanelModal({
28507 data,
28508 field,
28509 onChange,
28510 validity
28511 }) {
28512 const [touched, setTouched] = (0, import_element96.useState)(false);
28513 const [isOpen, setIsOpen] = (0, import_element96.useState)(false);
28514 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
28515 if (!fieldDefinition) {
28516 return null;
28517 }
28518 const isDisabled = fieldDefinition.readOnly === true || fieldDefinition.isDisabled({ item: data, field: fieldDefinition });
28519 const handleClose = () => {
28520 setIsOpen(false);
28521 setTouched(true);
28522 };
28523 return /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(import_jsx_runtime115.Fragment, { children: [
28524 /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
28525 SummaryButton,
28526 {
28527 data,
28528 field,
28529 fieldLabel,
28530 summaryFields,
28531 validity,
28532 touched,
28533 disabled: isDisabled,
28534 onClick: () => setIsOpen(true),
28535 isOpen
28536 }
28537 ),
28538 isOpen && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
28539 ModalContent,
28540 {
28541 data,
28542 field,
28543 onChange,
28544 fieldLabel: fieldLabel ?? "",
28545 onClose: handleClose,
28546 touched
28547 }
28548 )
28549 ] });
28550 }
28551 var modal_default = PanelModal;
28552
28553 // packages/dataviews/build-module/components/dataform-layouts/panel/dropdown.mjs
28554 var import_components27 = __toESM(require_components(), 1);
28555 var import_i18n29 = __toESM(require_i18n(), 1);
28556 var import_element97 = __toESM(require_element(), 1);
28557 var import_compose14 = __toESM(require_compose(), 1);
28558 var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1);
28559 function DropdownHeader({
28560 title,
28561 onClose
28562 }) {
28563 return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
28564 Stack,
28565 {
28566 direction: "column",
28567 className: "dataforms-layouts-panel__dropdown-header",
28568 gap: "lg",
28569 children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", children: [
28570 title && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_components27.__experimentalHeading, { level: 2, size: 13, children: title }),
28571 /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(import_components27.__experimentalSpacer, { style: { flex: 1 } }),
28572 onClose && /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
28573 import_components27.Button,
28574 {
28575 label: (0, import_i18n29.__)("Close"),
28576 icon: close_small_default,
28577 onClick: onClose,
28578 size: "small"
28579 }
28580 )
28581 ] })
28582 }
28583 );
28584 }
28585 function DropdownContentWithValidation({
28586 touched,
28587 children
28588 }) {
28589 const ref = (0, import_element97.useRef)(null);
28590 useRevealValidity(ref, touched);
28591 return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { ref, children });
28592 }
28593 function PanelDropdown({
28594 data,
28595 field,
28596 onChange,
28597 validity
28598 }) {
28599 const [touched, setTouched] = (0, import_element97.useState)(false);
28600 const [popoverAnchor, setPopoverAnchor] = (0, import_element97.useState)(
28601 null
28602 );
28603 const popoverProps = (0, import_element97.useMemo)(
28604 () => ({
28605 // Anchor the popover to the middle of the entire row so that it doesn't
28606 // move around when the label changes.
28607 anchor: popoverAnchor,
28608 placement: "left-start",
28609 offset: 36,
28610 shift: true
28611 }),
28612 [popoverAnchor]
28613 );
28614 const [dialogRef, dialogProps] = (0, import_compose14.__experimentalUseDialog)({
28615 focusOnMount: "firstInputElement"
28616 });
28617 const form = (0, import_element97.useMemo)(
28618 () => ({
28619 layout: DEFAULT_LAYOUT,
28620 fields: !!field.children ? field.children : (
28621 // If not explicit children return the field id itself.
28622 [{ id: field.id, layout: DEFAULT_LAYOUT }]
28623 )
28624 }),
28625 [field]
28626 );
28627 const formValidity = (0, import_element97.useMemo)(() => {
28628 if (validity === void 0) {
28629 return void 0;
28630 }
28631 if (!!field.children) {
28632 return validity?.children;
28633 }
28634 return { [field.id]: validity };
28635 }, [validity, field]);
28636 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field);
28637 if (!fieldDefinition) {
28638 return null;
28639 }
28640 const isDisabled = fieldDefinition.readOnly === true || fieldDefinition.isDisabled({ item: data, field: fieldDefinition });
28641 return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
28642 "div",
28643 {
28644 ref: setPopoverAnchor,
28645 className: "dataforms-layouts-panel__field-dropdown-anchor",
28646 children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
28647 import_components27.Dropdown,
28648 {
28649 contentClassName: "dataforms-layouts-panel__field-dropdown",
28650 popoverProps,
28651 focusOnMount: false,
28652 onToggle: (willOpen) => {
28653 if (!willOpen) {
28654 setTouched(true);
28655 }
28656 },
28657 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
28658 SummaryButton,
28659 {
28660 data,
28661 field,
28662 fieldLabel,
28663 summaryFields,
28664 validity,
28665 touched,
28666 disabled: isDisabled,
28667 isOpen,
28668 onClick: onToggle
28669 }
28670 ),
28671 renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ (0, import_jsx_runtime116.jsxs)("div", { ref: dialogRef, ...dialogProps, children: [
28672 /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
28673 DropdownHeader,
28674 {
28675 title: fieldLabel,
28676 onClose
28677 }
28678 ),
28679 /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
28680 DataFormLayout,
28681 {
28682 data,
28683 form,
28684 onChange,
28685 validity: formValidity,
28686 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
28687 FieldLayout,
28688 {
28689 data,
28690 field: childField,
28691 onChange,
28692 hideLabelFromVision: (form?.fields ?? []).length < 2,
28693 markWhenOptional,
28694 validity: childFieldValidity
28695 },
28696 childField.id
28697 )
28698 }
28699 )
28700 ] }) })
28701 }
28702 )
28703 }
28704 );
28705 }
28706 var dropdown_default = PanelDropdown;
28707
28708 // packages/dataviews/build-module/components/dataform-layouts/panel/index.mjs
28709 var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1);
28710 function FormPanelField({
28711 data,
28712 field,
28713 onChange,
28714 validity
28715 }) {
28716 const layout = field.layout;
28717 if (layout.openAs.type === "modal") {
28718 return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
28719 modal_default,
28720 {
28721 data,
28722 field,
28723 onChange,
28724 validity
28725 }
28726 );
28727 }
28728 return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
28729 dropdown_default,
28730 {
28731 data,
28732 field,
28733 onChange,
28734 validity
28735 }
28736 );
28737 }
28738
28739 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
28740 var import_element98 = __toESM(require_element(), 1);
28741 var import_compose15 = __toESM(require_compose(), 1);
28742 import { speak as speak4 } from "@wordpress/a11y";
28743
28744 // packages/dataviews/build-module/components/dataform-layouts/get-validation-message.mjs
28745 var import_i18n30 = __toESM(require_i18n(), 1);
28746 function countInvalidFields(validity) {
28747 if (!validity) {
28748 return 0;
28749 }
28750 let count = 0;
28751 const validityRules = Object.keys(validity).filter(
28752 (key) => key !== "children"
28753 );
28754 for (const key of validityRules) {
28755 const rule = validity[key];
28756 if (rule?.type === "invalid") {
28757 count++;
28758 }
28759 }
28760 if (validity.children) {
28761 for (const childValidity of Object.values(validity.children)) {
28762 count += countInvalidFields(childValidity);
28763 }
28764 }
28765 return count;
28766 }
28767 function getValidationMessage(validity) {
28768 const invalidCount = countInvalidFields(validity);
28769 if (invalidCount === 0) {
28770 return void 0;
28771 }
28772 return (0, import_i18n30.sprintf)(
28773 /* translators: %d: Number of fields that need attention */
28774 (0, import_i18n30._n)(
28775 "%d field needs attention",
28776 "%d fields need attention",
28777 invalidCount
28778 ),
28779 invalidCount
28780 );
28781 }
28782
28783 // packages/dataviews/build-module/components/dataform-layouts/validation-badge.mjs
28784 var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1);
28785 function ValidationBadge({
28786 validity
28787 }) {
28788 const message2 = getValidationMessage(validity);
28789 if (!message2) {
28790 return null;
28791 }
28792 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Badge, { intent: "high", children: message2 });
28793 }
28794
28795 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs
28796 var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1);
28797 function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) {
28798 if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) {
28799 return false;
28800 }
28801 const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig];
28802 const fieldConfig = summaryConfigArray.find((config) => {
28803 if (typeof config === "string") {
28804 return config === summaryField.id;
28805 }
28806 if (typeof config === "object" && "id" in config) {
28807 return config.id === summaryField.id;
28808 }
28809 return false;
28810 });
28811 if (!fieldConfig) {
28812 return false;
28813 }
28814 if (typeof fieldConfig === "string") {
28815 return true;
28816 }
28817 if (typeof fieldConfig === "object" && "visibility" in fieldConfig) {
28818 return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen;
28819 }
28820 return true;
28821 }
28822 function HeaderContent({
28823 data,
28824 fields,
28825 label,
28826 layout,
28827 isOpen,
28828 touched,
28829 validity
28830 }) {
28831 const summaryFields = getSummaryFields(layout.summary, fields);
28832 const visibleSummaryFields = summaryFields.filter(
28833 (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen)
28834 );
28835 const hasBadge = touched && layout.isCollapsible;
28836 const hasSummary = visibleSummaryFields.length > 0 && layout.withHeader;
28837 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
28838 Stack,
28839 {
28840 align: "center",
28841 justify: "space-between",
28842 className: "dataforms-layouts-card__field-header-content",
28843 children: [
28844 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(card_exports.Title, { children: label }),
28845 (hasBadge || hasSummary) && /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(collapsible_card_exports.HeaderDescription, { className: "dataforms-layouts-card__field-header-content-description", children: [
28846 hasBadge && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(ValidationBadge, { validity }),
28847 hasSummary && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
28848 summaryField.render,
28849 {
28850 item: data,
28851 field: summaryField
28852 },
28853 summaryField.id
28854 )) })
28855 ] })
28856 ]
28857 }
28858 );
28859 }
28860 function BodyContent({
28861 data,
28862 field,
28863 form,
28864 onChange,
28865 hideLabelFromVision,
28866 markWhenOptional,
28867 validity,
28868 withHeader
28869 }) {
28870 if (field.children) {
28871 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(import_jsx_runtime119.Fragment, { children: [
28872 field.description && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }),
28873 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
28874 DataFormLayout,
28875 {
28876 data,
28877 form,
28878 onChange,
28879 validity: validity?.children
28880 }
28881 )
28882 ] });
28883 }
28884 const SingleFieldLayout = getFormFieldLayout("regular")?.component;
28885 if (!SingleFieldLayout) {
28886 return null;
28887 }
28888 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
28889 SingleFieldLayout,
28890 {
28891 data,
28892 field,
28893 onChange,
28894 hideLabelFromVision: hideLabelFromVision || withHeader,
28895 markWhenOptional,
28896 validity
28897 }
28898 );
28899 }
28900 function FormCardField({
28901 data,
28902 field,
28903 onChange,
28904 hideLabelFromVision,
28905 markWhenOptional,
28906 validity
28907 }) {
28908 const { fields } = (0, import_element98.useContext)(dataform_context_default);
28909 const layout = field.layout;
28910 const contentRef = (0, import_element98.useRef)(null);
28911 const hasFocusedContentRef = (0, import_element98.useRef)(false);
28912 const form = (0, import_element98.useMemo)(
28913 () => ({
28914 layout: DEFAULT_LAYOUT,
28915 fields: field.children ?? []
28916 }),
28917 [field]
28918 );
28919 const { isOpened, isCollapsible } = layout;
28920 const [isOpen, setIsOpen] = (0, import_element98.useState)(isOpened);
28921 const [touched, setTouched] = (0, import_element98.useState)(false);
28922 (0, import_element98.useEffect)(() => {
28923 setIsOpen(isOpened);
28924 }, [isOpened]);
28925 const handleOpenChange = (0, import_element98.useCallback)((open3) => {
28926 if (!open3) {
28927 setTouched(true);
28928 }
28929 setIsOpen(open3);
28930 }, []);
28931 const revealValidity = useRevealValidity(
28932 contentRef,
28933 (isCollapsible ? isOpen : true) && touched
28934 );
28935 const handleContentFocus = (0, import_element98.useCallback)(() => {
28936 hasFocusedContentRef.current = true;
28937 }, []);
28938 const handleFocusOutside = (0, import_element98.useCallback)(() => {
28939 if (!hasFocusedContentRef.current) {
28940 return;
28941 }
28942 setTouched(true);
28943 if (isCollapsible && !isOpen) {
28944 return;
28945 }
28946 const revealedCount = revealValidity();
28947 const message2 = getValidationMessage(validity);
28948 if (revealedCount > 0 && message2) {
28949 speak4(message2, "polite");
28950 }
28951 }, [isCollapsible, isOpen, revealValidity, validity]);
28952 const focusOutsideProps = (0, import_compose15.__experimentalUseFocusOutside)(handleFocusOutside);
28953 let label = field.label;
28954 let withHeader;
28955 if (field.children) {
28956 withHeader = !!label && layout.withHeader;
28957 } else {
28958 const fieldDefinition = fields.find(
28959 (fieldDef) => fieldDef.id === field.id
28960 );
28961 if (!canRenderField(fieldDefinition)) {
28962 return null;
28963 }
28964 label = fieldDefinition.label;
28965 withHeader = !!label && layout.withHeader;
28966 }
28967 const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
28968 BodyContent,
28969 {
28970 data,
28971 field,
28972 form,
28973 onChange,
28974 hideLabelFromVision,
28975 markWhenOptional,
28976 validity,
28977 withHeader
28978 }
28979 );
28980 const headerContent = /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
28981 HeaderContent,
28982 {
28983 data,
28984 fields,
28985 label,
28986 layout,
28987 isOpen: isCollapsible ? !!isOpen : true,
28988 touched,
28989 validity
28990 }
28991 );
28992 if (withHeader && isCollapsible) {
28993 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
28994 collapsible_card_exports.Root,
28995 {
28996 className: "dataforms-layouts-card__field",
28997 open: isOpen,
28998 onOpenChange: handleOpenChange,
28999 ...focusOutsideProps,
29000 children: [
29001 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(collapsible_card_exports.Header, { children: headerContent }),
29002 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
29003 collapsible_card_exports.Content,
29004 {
29005 ref: contentRef,
29006 onFocus: handleContentFocus,
29007 children: bodyContent
29008 }
29009 )
29010 ]
29011 }
29012 );
29013 }
29014 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(
29015 card_exports.Root,
29016 {
29017 className: "dataforms-layouts-card__field",
29018 ...focusOutsideProps,
29019 children: [
29020 withHeader && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(card_exports.Header, { children: headerContent }),
29021 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(card_exports.Content, { ref: contentRef, onFocus: handleContentFocus, children: bodyContent })
29022 ]
29023 }
29024 );
29025 }
29026
29027 // packages/dataviews/build-module/components/dataform-layouts/row/index.mjs
29028 var import_components28 = __toESM(require_components(), 1);
29029 var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1);
29030 function Header5({ title }) {
29031 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
29032 Stack,
29033 {
29034 direction: "column",
29035 className: "dataforms-layouts-row__header",
29036 gap: "lg",
29037 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_components28.__experimentalHeading, { level: 2, size: 13, children: title }) })
29038 }
29039 );
29040 }
29041 var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_jsx_runtime120.Fragment, { children });
29042 function FormRowField({
29043 data,
29044 field,
29045 onChange,
29046 hideLabelFromVision,
29047 markWhenOptional,
29048 validity
29049 }) {
29050 const layout = field.layout;
29051 if (!!field.children) {
29052 const form = {
29053 layout: DEFAULT_LAYOUT,
29054 fields: field.children
29055 };
29056 return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "dataforms-layouts-row__field", children: [
29057 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Header5, { title: field.label }),
29058 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
29059 DataFormLayout,
29060 {
29061 data,
29062 form,
29063 onChange,
29064 validity: validity?.children,
29065 as: EMPTY_WRAPPER,
29066 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
29067 "div",
29068 {
29069 className: "dataforms-layouts-row__field-control",
29070 style: layout.styles[childField.id],
29071 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
29072 FieldLayout,
29073 {
29074 data,
29075 field: childField,
29076 onChange,
29077 hideLabelFromVision,
29078 markWhenOptional,
29079 validity: childFieldValidity
29080 }
29081 )
29082 },
29083 childField.id
29084 )
29085 }
29086 ) })
29087 ] });
29088 }
29089 const RegularLayout = getFormFieldLayout("regular")?.component;
29090 if (!RegularLayout) {
29091 return null;
29092 }
29093 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_jsx_runtime120.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
29094 RegularLayout,
29095 {
29096 data,
29097 field,
29098 onChange,
29099 markWhenOptional,
29100 validity
29101 }
29102 ) }) });
29103 }
29104
29105 // packages/dataviews/build-module/components/dataform-layouts/details/index.mjs
29106 var import_element99 = __toESM(require_element(), 1);
29107 var import_i18n31 = __toESM(require_i18n(), 1);
29108 var import_compose16 = __toESM(require_compose(), 1);
29109 import { speak as speak5 } from "@wordpress/a11y";
29110 var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1);
29111 function FormDetailsField({
29112 data,
29113 field,
29114 onChange,
29115 validity
29116 }) {
29117 const { fields } = (0, import_element99.useContext)(dataform_context_default);
29118 const detailsRef = (0, import_element99.useRef)(null);
29119 const contentRef = (0, import_element99.useRef)(null);
29120 const hasFocusedContentRef = (0, import_element99.useRef)(false);
29121 const [touched, setTouched] = (0, import_element99.useState)(false);
29122 const [isOpen, setIsOpen] = (0, import_element99.useState)(false);
29123 const form = (0, import_element99.useMemo)(
29124 () => ({
29125 layout: DEFAULT_LAYOUT,
29126 fields: field.children ?? []
29127 }),
29128 [field]
29129 );
29130 (0, import_element99.useEffect)(() => {
29131 const details = detailsRef.current;
29132 if (!details) {
29133 return;
29134 }
29135 const handleToggle = () => {
29136 const nowOpen = details.open;
29137 if (!nowOpen) {
29138 setTouched(true);
29139 }
29140 setIsOpen(nowOpen);
29141 };
29142 details.addEventListener("toggle", handleToggle);
29143 return () => {
29144 details.removeEventListener("toggle", handleToggle);
29145 };
29146 }, []);
29147 const revealValidity = useRevealValidity(contentRef, isOpen && touched);
29148 const handleContentFocus = (0, import_element99.useCallback)(() => {
29149 hasFocusedContentRef.current = true;
29150 }, []);
29151 const handleFocusOutside = (0, import_element99.useCallback)(() => {
29152 if (!hasFocusedContentRef.current) {
29153 return;
29154 }
29155 setTouched(true);
29156 if (!detailsRef.current?.open) {
29157 return;
29158 }
29159 const revealedCount = revealValidity();
29160 const message2 = getValidationMessage(validity);
29161 if (revealedCount > 0 && message2) {
29162 speak5(message2, "polite");
29163 }
29164 }, [revealValidity, validity]);
29165 const focusOutsideProps = (0, import_compose16.__experimentalUseFocusOutside)(handleFocusOutside);
29166 if (!field.children) {
29167 return null;
29168 }
29169 const summaryFieldId = field.layout.summary ?? "";
29170 const summaryField = summaryFieldId ? fields.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0;
29171 let summaryContent;
29172 if (summaryField && summaryField.render) {
29173 summaryContent = /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(summaryField.render, { item: data, field: summaryField });
29174 } else {
29175 summaryContent = field.label || (0, import_i18n31.__)("More details");
29176 }
29177 return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
29178 "details",
29179 {
29180 ref: detailsRef,
29181 className: "dataforms-layouts-details__details",
29182 ...focusOutsideProps,
29183 children: [
29184 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
29185 Stack,
29186 {
29187 direction: "row",
29188 align: "center",
29189 gap: "md",
29190 className: "dataforms-layouts-details__summary-content",
29191 children: [
29192 summaryContent,
29193 touched && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ValidationBadge, { validity })
29194 ]
29195 }
29196 ) }),
29197 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
29198 "div",
29199 {
29200 ref: contentRef,
29201 className: "dataforms-layouts-details__content",
29202 onFocus: handleContentFocus,
29203 children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
29204 DataFormLayout,
29205 {
29206 data,
29207 form,
29208 onChange,
29209 validity: validity?.children
29210 }
29211 )
29212 }
29213 )
29214 ]
29215 }
29216 );
29217 }
29218
29219 // packages/dataviews/build-module/components/dataform-layouts/index.mjs
29220 var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1);
29221 var FORM_FIELD_LAYOUTS = [
29222 {
29223 type: "regular",
29224 component: FormRegularField,
29225 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
29226 Stack,
29227 {
29228 direction: "column",
29229 className: "dataforms-layouts__wrapper",
29230 gap: "lg",
29231 children
29232 }
29233 )
29234 },
29235 {
29236 type: "panel",
29237 component: FormPanelField,
29238 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
29239 Stack,
29240 {
29241 direction: "column",
29242 className: "dataforms-layouts__wrapper",
29243 gap: "md",
29244 children
29245 }
29246 )
29247 },
29248 {
29249 type: "card",
29250 component: FormCardField,
29251 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
29252 Stack,
29253 {
29254 direction: "column",
29255 className: "dataforms-layouts__wrapper",
29256 gap: "xl",
29257 children
29258 }
29259 )
29260 },
29261 {
29262 type: "row",
29263 component: FormRowField,
29264 wrapper: ({
29265 children,
29266 layout
29267 }) => /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
29268 Stack,
29269 {
29270 direction: "column",
29271 className: "dataforms-layouts__wrapper",
29272 gap: "lg",
29273 children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
29274 Stack,
29275 {
29276 direction: "row",
29277 gap: "lg",
29278 align: layout.alignment,
29279 children
29280 }
29281 ) })
29282 }
29283 )
29284 },
29285 {
29286 type: "details",
29287 component: FormDetailsField
29288 }
29289 ];
29290 function getFormFieldLayout(type) {
29291 return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type);
29292 }
29293
29294 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs
29295 var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1);
29296 var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children });
29297 function DataFormLayout({
29298 data,
29299 form,
29300 onChange,
29301 validity,
29302 children,
29303 as
29304 }) {
29305 const { fields: fieldDefinitions } = (0, import_element100.useContext)(dataform_context_default);
29306 const markWhenOptional = (0, import_element100.useMemo)(() => {
29307 const requiredCount = fieldDefinitions.filter(
29308 (f) => !!f.isValid?.required
29309 ).length;
29310 const optionalCount = fieldDefinitions.length - requiredCount;
29311 return requiredCount > optionalCount;
29312 }, [fieldDefinitions]);
29313 function getFieldDefinition2(field) {
29314 return fieldDefinitions.find(
29315 (fieldDefinition) => fieldDefinition.id === field.id
29316 );
29317 }
29318 const Wrapper = as ?? getFormFieldLayout(form.layout.type)?.wrapper ?? DEFAULT_WRAPPER;
29319 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Wrapper, { layout: form.layout, children: form.fields.map((formField) => {
29320 const FieldLayout = getFormFieldLayout(
29321 formField.layout.type
29322 )?.component;
29323 if (!FieldLayout) {
29324 return null;
29325 }
29326 const fieldDefinition = !formField.children ? getFieldDefinition2(formField) : void 0;
29327 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) {
29328 return null;
29329 }
29330 if (children) {
29331 return children(
29332 FieldLayout,
29333 formField,
29334 validity?.[formField.id],
29335 markWhenOptional
29336 );
29337 }
29338 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
29339 FieldLayout,
29340 {
29341 data,
29342 field: formField,
29343 onChange,
29344 markWhenOptional,
29345 validity: validity?.[formField.id]
29346 },
29347 formField.id
29348 );
29349 }) });
29350 }
29351
29352 // packages/dataviews/build-module/dataform/index.mjs
29353 var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1);
29354 function DataForm({
29355 data,
29356 form,
29357 fields,
29358 onChange,
29359 validity
29360 }) {
29361 const normalizedForm = (0, import_element101.useMemo)(() => normalize_form_default(form), [form]);
29362 const normalizedFields = (0, import_element101.useMemo)(
29363 () => normalizeFields(fields),
29364 [fields]
29365 );
29366 if (!form.fields) {
29367 return null;
29368 }
29369 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
29370 DataFormLayout,
29371 {
29372 data,
29373 form: normalizedForm,
29374 onChange,
29375 validity
29376 }
29377 ) });
29378 }
29379
29380 // routes/experiments-home/stage.tsx
29381 var import_element102 = __toESM(require_element());
29382 var import_i18n32 = __toESM(require_i18n());
29383 var import_notices = __toESM(require_notices());
29384
29385 // routes/experiments-home/style.scss
29386 if (typeof document !== "undefined" && (typeof process === "undefined" || true) && !document.head.querySelector("style[data-wp-hash='97a1d43e1a']")) {
29387 const style = document.createElement("style");
29388 style.setAttribute("data-wp-hash", "97a1d43e1a");
29389 style.appendChild(document.createTextNode(".experiments-page__container{box-sizing:border-box;margin-inline:auto;max-width:680px;padding:24px;width:100%}"));
29390 document.head.appendChild(style);
29391 }
29392
29393 // routes/experiments-home/api.ts
29394 var import_api_fetch = __toESM(require_api_fetch());
29395 async function fetchExperiments() {
29396 const response = await (0, import_api_fetch.default)({
29397 path: "/wp/v2/settings",
29398 method: "OPTIONS"
29399 });
29400 const properties = response?.schema?.properties?.["gutenberg-experiments"]?.properties ?? {};
29401 return Object.entries(properties).map(([id, schema]) => ({
29402 id,
29403 label: schema.title ?? id,
29404 description: schema.description ?? "",
29405 group: schema.group ?? "other",
29406 groupLabel: schema.group_label ?? ""
29407 }));
29408 }
29409
29410 // routes/experiments-home/stage.tsx
29411 var import_jsx_runtime125 = __toESM(require_jsx_runtime());
29412 function ExperimentsPage() {
29413 const [experiments, setExperiments] = (0, import_element102.useState)(
29414 null
29415 );
29416 (0, import_element102.useEffect)(() => {
29417 fetchExperiments().then(setExperiments).catch(() => setExperiments([]));
29418 }, []);
29419 const {
29420 editedRecord,
29421 save: saveSettings,
29422 edit
29423 } = (0, import_core_data.useEntityRecord)("root", "site", void 0);
29424 const siteSettings = editedRecord;
29425 const { createSuccessNotice, createErrorNotice } = (0, import_data.useDispatch)(import_notices.store);
29426 const gutenbergExperiments = (0, import_element102.useMemo)(
29427 () => siteSettings?.["gutenberg-experiments"] || {},
29428 [siteSettings]
29429 );
29430 const settings = (0, import_element102.useMemo)(() => {
29431 const combined = {};
29432 for (const exp of experiments ?? []) {
29433 combined[exp.id] = false;
29434 }
29435 for (const [key, value] of Object.entries(gutenbergExperiments)) {
29436 combined[key] = Boolean(value);
29437 }
29438 return combined;
29439 }, [experiments, gutenbergExperiments]);
29440 const setSettings = async (values) => {
29441 const [changedId] = Object.keys(values);
29442 const changedExperiment = (experiments ?? []).find(
29443 (exp) => exp.id === changedId
29444 );
29445 const editPayload = {
29446 "gutenberg-experiments": {
29447 ...gutenbergExperiments,
29448 ...values
29449 }
29450 };
29451 const groupLabel = changedExperiment?.groupLabel ?? "";
29452 edit(editPayload);
29453 try {
29454 await saveSettings();
29455 createSuccessNotice(
29456 (0, import_i18n32.sprintf)(
29457 /* translators: %s: Experiment group name, e.g. "Blocks". */
29458 (0, import_i18n32.__)("%s settings updated."),
29459 groupLabel
29460 ),
29461 { type: "snackbar" }
29462 );
29463 } catch {
29464 createErrorNotice(
29465 (0, import_i18n32.sprintf)(
29466 /* translators: %s: Experiment group name, e.g. "Blocks". */
29467 (0, import_i18n32.__)("Failed to update %s settings."),
29468 groupLabel
29469 ),
29470 { type: "snackbar" }
29471 );
29472 }
29473 };
29474 const fields = (0, import_element102.useMemo)(() => {
29475 if (!experiments?.length) {
29476 return [];
29477 }
29478 return experiments.map((experiment) => ({
29479 Edit: "toggle",
29480 id: experiment.id,
29481 label: experiment.label,
29482 description: experiment.description,
29483 type: "boolean"
29484 }));
29485 }, [experiments]);
29486 const formFields = (0, import_element102.useMemo)(() => {
29487 if (!experiments?.length) {
29488 return [];
29489 }
29490 const groups = /* @__PURE__ */ new Map();
29491 experiments.forEach((experiment) => {
29492 const slug = experiment.group || "other";
29493 if (!groups.has(slug)) {
29494 groups.set(slug, {
29495 label: experiment.groupLabel || slug,
29496 items: []
29497 });
29498 }
29499 groups.get(slug).items.push(experiment.id);
29500 });
29501 return Array.from(groups.entries()).map(([slug, group]) => ({
29502 id: `gutenberg-experiments--${slug}`,
29503 label: group.label,
29504 layout: {
29505 type: "card",
29506 withHeader: true,
29507 isCollapsible: true,
29508 isOpened: true
29509 },
29510 children: group.items
29511 }));
29512 }, [experiments]);
29513 if (experiments === null || !siteSettings) {
29514 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components29.Spinner, {});
29515 }
29516 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
29517 page_default,
29518 {
29519 title: (0, import_i18n32.__)("Gutenberg Experiments"),
29520 subTitle: (0, import_i18n32.__)(
29521 "The latest block and full site editing features before they ship in a WordPress release."
29522 ),
29523 children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
29524 Stack,
29525 {
29526 className: "experiments-page__container",
29527 direction: "column",
29528 gap: "md",
29529 children: [
29530 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(card_exports.Root, { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(card_exports.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(Stack, { direction: "column", gap: "md", children: [
29531 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Text, { variant: "body-lg", render: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", {}), children: (0, import_i18n32.__)(
29532 "The Gutenberg plugin adds editing, customization, and site building to WordPress, and gives early adopters access to the latest block and full site editing features before they ship in a WordPress release."
29533 ) }),
29534 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Text, { variant: "body-lg", render: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", {}), children: (0, import_element102.createInterpolateElement)(
29535 (0, import_i18n32.__)(
29536 "The experiments below are in active development, so expect rough edges and changes over time. To learn more about the project and how to build with blocks, see the <a>Block Editor Handbook</a>."
29537 ),
29538 {
29539 a: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
29540 Link,
29541 {
29542 href: "https://developer.wordpress.org/block-editor/",
29543 openInNewTab: true
29544 }
29545 )
29546 }
29547 ) })
29548 ] }) }) }),
29549 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
29550 DataForm,
29551 {
29552 data: settings,
29553 fields,
29554 form: {
29555 layout: { type: "card" },
29556 fields: formFields
29557 },
29558 onChange: (values) => {
29559 setSettings(values);
29560 }
29561 }
29562 )
29563 ]
29564 }
29565 )
29566 }
29567 );
29568 }
29569 function Stage() {
29570 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ExperimentsPage, {});
29571 }
29572 var stage = Stage;
29573 export {
29574 stage
29575 };
29576 /*! Bundled license information:
29577
29578 use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
29579 (**
29580 * @license React
29581 * use-sync-external-store-shim.development.js
29582 *
29583 * Copyright (c) Meta Platforms, Inc. and affiliates.
29584 *
29585 * This source code is licensed under the MIT license found in the
29586 * LICENSE file in the root directory of this source tree.
29587 *)
29588
29589 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js:
29590 (**
29591 * @license React
29592 * use-sync-external-store-shim/with-selector.development.js
29593 *
29594 * Copyright (c) Meta Platforms, Inc. and affiliates.
29595 *
29596 * This source code is licensed under the MIT license found in the
29597 * LICENSE file in the root directory of this source tree.
29598 *)
29599 */
29600