@wix/editor-react-components 1.2344.0 → 1.2346.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/site/components/AudioPlayer/component.js +3 -4
  2. package/dist/site/components/Breadcrumbs/component.js +1 -1
  3. package/dist/site/components/Button/component.js +1 -1
  4. package/dist/site/components/Checkbox/css.css +4 -4
  5. package/dist/site/components/CheckboxGroup/css.css +4 -4
  6. package/dist/site/components/CollapsibleText/component.js +1 -1
  7. package/dist/site/components/DatePicker/DatePicker.types.d.ts +6 -1
  8. package/dist/site/components/DatePicker/component.js +61 -11
  9. package/dist/site/components/DatePicker/components/DatePickerLabel.d.ts +2 -1
  10. package/dist/site/components/DatePicker/constants.d.ts +8 -0
  11. package/dist/site/components/DatePicker/css.css +13 -0
  12. package/dist/site/components/DatePicker/hooks/useDatePickerValue.d.ts +1 -1
  13. package/dist/site/components/DatePicker/manifest.js +12 -1
  14. package/dist/site/components/Lottie/component.js +1 -1
  15. package/dist/site/components/Menu/component.js +1 -1
  16. package/dist/site/components/Slideshow/component.js +1 -1
  17. package/dist/site/components/TextInput/TextInput.types.d.ts +3 -1
  18. package/dist/site/components/TextInput/component.js +86 -19
  19. package/dist/site/components/TextInput/constants.d.ts +13 -0
  20. package/dist/site/components/TextInput/css.css +47 -4
  21. package/dist/site/components/TextInput/manifest.js +8 -1
  22. package/dist/site/components/TimePicker/TimePicker.types.d.ts +7 -1
  23. package/dist/site/components/TimePicker/component.js +61 -11
  24. package/dist/site/components/TimePicker/constants.d.ts +7 -0
  25. package/dist/site/components/TimePicker/css.css +13 -0
  26. package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +1 -1
  27. package/dist/site/components/TimePicker/manifest.js +8 -1
  28. package/dist/site/components/chunks/Button.js +347 -1057
  29. package/dist/site/components/chunks/{Tooltip.js → DateField.js} +52 -1018
  30. package/dist/site/components/chunks/Group.js +970 -46
  31. package/dist/site/components/chunks/NumberFormatter.js +140 -0
  32. package/dist/site/components/chunks/VisuallyHidden.js +1 -1
  33. package/dist/site/components/chunks/constants2.js +9 -2
  34. package/dist/site/components/chunks/constants3.js +10 -1
  35. package/dist/site/components/chunks/constants33.js +10 -2
  36. package/dist/site/components/chunks/filterDOMProps.js +139 -18
  37. package/dist/site/components/chunks/manifest2.js +73 -0
  38. package/dist/site/components/chunks/useLocalizedStringFormatter.js +1 -1
  39. package/dist/site/components/chunks/useValidatedField.js +1411 -0
  40. package/package.json +5 -5
  41. package/dist/site/components/chunks/Button2.js +0 -365
  42. package/dist/site/components/chunks/I18nProvider.js +0 -125
  43. package/dist/site/components/chunks/Input.js +0 -341
@@ -0,0 +1,1411 @@
1
+ import { q as $c4867b2f328c2698$export$e5c5a5f917a5871c, v as $fe16bffc7a557bf0$export$7f54fc3180508a52, F as $8f5a2122b0992be3$export$8397ddfc504fdb9a, g as $23f2114a1b82827e$export$e58f029f0fbfdb29, G as $0beb20c9744a2065$export$8467354a121f1b9f, H as $390e54f620492c70$export$b4cc09c592e8fdb8, f as $bbaa08b3cd72f041$export$9d1611c77c2fe928, k as $23f2114a1b82827e$export$4282f70798064fe0, I as $2add3ce32c6007eb$export$78551043582a6a98, J as $240e9101ba2842f5$export$7d15b64cf5a3a4c4, K as $23f2114a1b82827e$export$b4f377a2b6254582, l as $23f2114a1b82827e$export$cd4e5573fbe2b576, E as $e969f22b6713ca4a$export$ae780daf29e6d456, A as $390e54f620492c70$export$f680877a34711e37, d as $d1116acdf220c2da$export$4c014de7c8940b4c, u as $8f5a2122b0992be3$export$630ff653c5ada6a9, L as $8f5a2122b0992be3$export$b9b3dfddab17db27, c as $3e6197669829fe11$export$40bfa8c7b0832715, D as $0c4a58759813079a$export$4e328f61c538687f, M as $d1116acdf220c2da$export$13f3202a3e5ddd5 } from "./Group.js";
2
+ import React__default, { useState, useCallback, useRef, useEffect, useMemo, useContext, createContext, forwardRef } from "react";
3
+ import { m as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, n as $c7eafbbe1ea5834e$export$535bd6ca7f90a273, k as $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7, a as $8e9d2fae0ecb9001$export$457c3d6518dd4c6f, c as $64fa3d84918910a7$export$29f1550f4b0d4415, h as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, g as $64fa3d84918910a7$export$4d86445c2cf5e3, b as $f39a9eba43920ace$export$86427a43e3e48ebb, i as $64fa3d84918910a7$export$2881499e37b75b9a } from "./filterDOMProps.js";
4
+ import __rspack_external_react_dom_7136dc57__default, { flushSync } from "react-dom";
5
+ function $d3f049242431219c$export$6d3443f2c48bfc20(ref, isReady = true) {
6
+ let [isEntering, setEntering] = useState(true);
7
+ let isAnimationReady = isEntering && isReady;
8
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
9
+ if (isAnimationReady && ref.current && "getAnimations" in ref.current) {
10
+ for (let animation of ref.current.getAnimations()) if (animation instanceof CSSTransition) animation.cancel();
11
+ }
12
+ }, [
13
+ ref,
14
+ isAnimationReady
15
+ ]);
16
+ $d3f049242431219c$var$useAnimation(ref, isAnimationReady, useCallback(() => setEntering(false), []));
17
+ return isAnimationReady;
18
+ }
19
+ function $d3f049242431219c$export$45fda7c47f93fd48(ref, isOpen) {
20
+ let [exitState, setExitState] = useState(isOpen ? "open" : "closed");
21
+ switch (exitState) {
22
+ case "open":
23
+ if (!isOpen) setExitState("exiting");
24
+ break;
25
+ case "closed":
26
+ case "exiting":
27
+ if (isOpen) setExitState("open");
28
+ break;
29
+ }
30
+ let isExiting = exitState === "exiting";
31
+ $d3f049242431219c$var$useAnimation(ref, isExiting, useCallback(() => {
32
+ setExitState((state) => state === "exiting" ? "closed" : state);
33
+ }, []));
34
+ return isExiting;
35
+ }
36
+ function $d3f049242431219c$var$useAnimation(ref, isActive, onEnd) {
37
+ $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
38
+ if (isActive && ref.current) {
39
+ if (!("getAnimations" in ref.current)) {
40
+ onEnd();
41
+ return;
42
+ }
43
+ let animations = ref.current.getAnimations();
44
+ if (animations.length === 0) {
45
+ onEnd();
46
+ return;
47
+ }
48
+ let canceled = false;
49
+ Promise.all(animations.map((a) => a.finished)).then(() => {
50
+ if (!canceled) flushSync(() => {
51
+ onEnd();
52
+ });
53
+ }).catch(() => {
54
+ });
55
+ return () => {
56
+ canceled = true;
57
+ };
58
+ }
59
+ }, [
60
+ ref,
61
+ isActive,
62
+ onEnd
63
+ ]);
64
+ }
65
+ function $860f7da480e22816$export$b8473d3665f3a75a(props, state, ref) {
66
+ let { validationBehavior, focus } = props;
67
+ $c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
68
+ if (validationBehavior === "native" && (ref == null ? void 0 : ref.current) && !ref.current.disabled) {
69
+ let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
70
+ ref.current.setCustomValidity(errorMessage);
71
+ if (!ref.current.hasAttribute("title")) ref.current.title = "";
72
+ if (!state.realtimeValidation.isInvalid) state.updateValidation($860f7da480e22816$var$getNativeValidity(ref.current));
73
+ }
74
+ });
75
+ let isIgnoredReset = useRef(false);
76
+ let onReset = $fe16bffc7a557bf0$export$7f54fc3180508a52(() => {
77
+ if (!isIgnoredReset.current) state.resetValidation();
78
+ });
79
+ let onInvalid = $fe16bffc7a557bf0$export$7f54fc3180508a52((e) => {
80
+ var _a, _b;
81
+ if (!state.displayValidation.isInvalid) state.commitValidation();
82
+ let form = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.form;
83
+ if (!e.defaultPrevented && ref && form && $860f7da480e22816$var$getFirstInvalidInput(form) === ref.current) {
84
+ if (focus) focus();
85
+ else (_b = ref.current) == null ? void 0 : _b.focus();
86
+ $8f5a2122b0992be3$export$8397ddfc504fdb9a("keyboard");
87
+ }
88
+ e.preventDefault();
89
+ });
90
+ let onChange = $fe16bffc7a557bf0$export$7f54fc3180508a52(() => {
91
+ state.commitValidation();
92
+ });
93
+ useEffect(() => {
94
+ let input = ref == null ? void 0 : ref.current;
95
+ if (!input) return;
96
+ let form = input.form;
97
+ let reset = form == null ? void 0 : form.reset;
98
+ if (form)
99
+ form.reset = () => {
100
+ isIgnoredReset.current = !window.event || window.event.type === "message" && $23f2114a1b82827e$export$e58f029f0fbfdb29(window.event) instanceof MessagePort;
101
+ reset == null ? void 0 : reset.call(form);
102
+ isIgnoredReset.current = false;
103
+ };
104
+ input.addEventListener("invalid", onInvalid);
105
+ input.addEventListener("change", onChange);
106
+ form == null ? void 0 : form.addEventListener("reset", onReset);
107
+ return () => {
108
+ input.removeEventListener("invalid", onInvalid);
109
+ input.removeEventListener("change", onChange);
110
+ form == null ? void 0 : form.removeEventListener("reset", onReset);
111
+ if (form)
112
+ form.reset = reset;
113
+ };
114
+ }, [
115
+ ref,
116
+ validationBehavior
117
+ ]);
118
+ }
119
+ function $860f7da480e22816$var$getValidity(input) {
120
+ let validity = input.validity;
121
+ return {
122
+ badInput: validity.badInput,
123
+ customError: validity.customError,
124
+ patternMismatch: validity.patternMismatch,
125
+ rangeOverflow: validity.rangeOverflow,
126
+ rangeUnderflow: validity.rangeUnderflow,
127
+ stepMismatch: validity.stepMismatch,
128
+ tooLong: validity.tooLong,
129
+ tooShort: validity.tooShort,
130
+ typeMismatch: validity.typeMismatch,
131
+ valueMissing: validity.valueMissing,
132
+ valid: validity.valid
133
+ };
134
+ }
135
+ function $860f7da480e22816$var$getNativeValidity(input) {
136
+ return {
137
+ isInvalid: !input.validity.valid,
138
+ validationDetails: $860f7da480e22816$var$getValidity(input),
139
+ validationErrors: input.validationMessage ? [
140
+ input.validationMessage
141
+ ] : []
142
+ };
143
+ }
144
+ function $860f7da480e22816$var$getFirstInvalidInput(form) {
145
+ var _a;
146
+ for (let i = 0; i < form.elements.length; i++) {
147
+ let element = form.elements[i];
148
+ if (((_a = element.validity) == null ? void 0 : _a.valid) === false) return element;
149
+ }
150
+ return null;
151
+ }
152
+ const $fd2148440a13ec26$export$aca958c65c314e6c = {
153
+ badInput: false,
154
+ customError: false,
155
+ patternMismatch: false,
156
+ rangeOverflow: false,
157
+ rangeUnderflow: false,
158
+ stepMismatch: false,
159
+ tooLong: false,
160
+ tooShort: false,
161
+ typeMismatch: false,
162
+ valueMissing: false,
163
+ valid: true
164
+ };
165
+ const $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE = {
166
+ ...$fd2148440a13ec26$export$aca958c65c314e6c,
167
+ customError: true,
168
+ valid: false
169
+ };
170
+ const $fd2148440a13ec26$export$dad6ae84456c676a = {
171
+ isInvalid: false,
172
+ validationDetails: $fd2148440a13ec26$export$aca958c65c314e6c,
173
+ validationErrors: []
174
+ };
175
+ const $fd2148440a13ec26$export$571b5131b7e65c11 = createContext({});
176
+ const $fd2148440a13ec26$export$a763b9476acd3eb = "__reactAriaFormValidationState";
177
+ function $fd2148440a13ec26$export$fc1a364ae1f3ff10(props) {
178
+ if (props[$fd2148440a13ec26$export$a763b9476acd3eb]) {
179
+ let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$fd2148440a13ec26$export$a763b9476acd3eb];
180
+ return {
181
+ realtimeValidation,
182
+ displayValidation,
183
+ updateValidation,
184
+ resetValidation,
185
+ commitValidation
186
+ };
187
+ }
188
+ return $fd2148440a13ec26$var$useFormValidationStateImpl(props);
189
+ }
190
+ function $fd2148440a13ec26$var$useFormValidationStateImpl(props) {
191
+ let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
192
+ if (validationState) isInvalid || (isInvalid = validationState === "invalid");
193
+ let controlledError = isInvalid !== void 0 ? {
194
+ isInvalid,
195
+ validationErrors: [],
196
+ validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
197
+ } : null;
198
+ let clientError = useMemo(() => {
199
+ if (!validate || value == null) return null;
200
+ let validateErrors = $fd2148440a13ec26$var$runValidate(validate, value);
201
+ return $fd2148440a13ec26$var$getValidationResult(validateErrors);
202
+ }, [
203
+ validate,
204
+ value
205
+ ]);
206
+ if (builtinValidation == null ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = void 0;
207
+ let serverErrors = useContext($fd2148440a13ec26$export$571b5131b7e65c11);
208
+ let serverErrorMessages = useMemo(() => {
209
+ if (name) return Array.isArray(name) ? name.flatMap((name2) => $fd2148440a13ec26$var$asArray(serverErrors[name2])) : $fd2148440a13ec26$var$asArray(serverErrors[name]);
210
+ return [];
211
+ }, [
212
+ serverErrors,
213
+ name
214
+ ]);
215
+ let [lastServerErrors, setLastServerErrors] = useState(serverErrors);
216
+ let [isServerErrorCleared, setServerErrorCleared] = useState(false);
217
+ if (serverErrors !== lastServerErrors) {
218
+ setLastServerErrors(serverErrors);
219
+ setServerErrorCleared(false);
220
+ }
221
+ let serverError = useMemo(() => $fd2148440a13ec26$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
222
+ isServerErrorCleared,
223
+ serverErrorMessages
224
+ ]);
225
+ let nextValidation = useRef($fd2148440a13ec26$export$dad6ae84456c676a);
226
+ let [currentValidity, setCurrentValidity] = useState($fd2148440a13ec26$export$dad6ae84456c676a);
227
+ let lastError = useRef($fd2148440a13ec26$export$dad6ae84456c676a);
228
+ let commitValidation = () => {
229
+ if (!commitQueued) return;
230
+ setCommitQueued(false);
231
+ let error = clientError || builtinValidation || nextValidation.current;
232
+ if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
233
+ lastError.current = error;
234
+ setCurrentValidity(error);
235
+ }
236
+ };
237
+ let [commitQueued, setCommitQueued] = useState(false);
238
+ useEffect(commitValidation);
239
+ let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $fd2148440a13ec26$export$dad6ae84456c676a;
240
+ let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
241
+ return {
242
+ realtimeValidation,
243
+ displayValidation,
244
+ updateValidation(value2) {
245
+ if (validationBehavior === "aria" && !$fd2148440a13ec26$var$isEqualValidation(currentValidity, value2)) setCurrentValidity(value2);
246
+ else nextValidation.current = value2;
247
+ },
248
+ resetValidation() {
249
+ let error = $fd2148440a13ec26$export$dad6ae84456c676a;
250
+ if (!$fd2148440a13ec26$var$isEqualValidation(error, lastError.current)) {
251
+ lastError.current = error;
252
+ setCurrentValidity(error);
253
+ }
254
+ if (validationBehavior === "native") setCommitQueued(false);
255
+ setServerErrorCleared(true);
256
+ },
257
+ commitValidation() {
258
+ if (validationBehavior === "native") setCommitQueued(true);
259
+ setServerErrorCleared(true);
260
+ }
261
+ };
262
+ }
263
+ function $fd2148440a13ec26$var$asArray(v) {
264
+ if (!v) return [];
265
+ return Array.isArray(v) ? v : [
266
+ v
267
+ ];
268
+ }
269
+ function $fd2148440a13ec26$var$runValidate(validate, value) {
270
+ if (typeof validate === "function") {
271
+ let e = validate(value);
272
+ if (e && typeof e !== "boolean") return $fd2148440a13ec26$var$asArray(e);
273
+ }
274
+ return [];
275
+ }
276
+ function $fd2148440a13ec26$var$getValidationResult(errors) {
277
+ return errors.length ? {
278
+ isInvalid: true,
279
+ validationErrors: errors,
280
+ validationDetails: $fd2148440a13ec26$var$CUSTOM_VALIDITY_STATE
281
+ } : null;
282
+ }
283
+ function $fd2148440a13ec26$var$isEqualValidation(a, b) {
284
+ if (a === b) return true;
285
+ return !!a && !!b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
286
+ }
287
+ function $fd2148440a13ec26$export$75ee7c75d68f5b0e(...results) {
288
+ let errors = /* @__PURE__ */ new Set();
289
+ let isInvalid = false;
290
+ let validationDetails = {
291
+ ...$fd2148440a13ec26$export$aca958c65c314e6c
292
+ };
293
+ for (let v of results) {
294
+ for (let e of v.validationErrors) errors.add(e);
295
+ isInvalid || (isInvalid = v.isInvalid);
296
+ for (let key in validationDetails) validationDetails[key] || (validationDetails[key] = v.validationDetails[key]);
297
+ }
298
+ validationDetails.valid = !isInvalid;
299
+ return {
300
+ isInvalid,
301
+ validationErrors: [
302
+ ...errors
303
+ ],
304
+ validationDetails
305
+ };
306
+ }
307
+ function $191c9b6d48a0a4e2$export$294aa081a6c6f55d(props) {
308
+ let { description, errorMessage, isInvalid, validationState } = props;
309
+ let { labelProps, fieldProps } = $0beb20c9744a2065$export$8467354a121f1b9f(props);
310
+ let descriptionId = $390e54f620492c70$export$b4cc09c592e8fdb8([
311
+ Boolean(description),
312
+ Boolean(errorMessage),
313
+ isInvalid,
314
+ validationState
315
+ ]);
316
+ let errorMessageId = $390e54f620492c70$export$b4cc09c592e8fdb8([
317
+ Boolean(description),
318
+ Boolean(errorMessage),
319
+ isInvalid,
320
+ validationState
321
+ ]);
322
+ fieldProps = $bbaa08b3cd72f041$export$9d1611c77c2fe928(fieldProps, {
323
+ "aria-describedby": [
324
+ descriptionId,
325
+ // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
326
+ errorMessageId,
327
+ props["aria-describedby"]
328
+ ].filter(Boolean).join(" ") || void 0
329
+ });
330
+ return {
331
+ labelProps,
332
+ fieldProps,
333
+ descriptionProps: {
334
+ id: descriptionId
335
+ },
336
+ errorMessageProps: {
337
+ id: errorMessageId
338
+ }
339
+ };
340
+ }
341
+ const $22e2f5f6490788e8$export$f6211563215e3b37 = /* @__PURE__ */ new WeakMap();
342
+ function $22e2f5f6490788e8$export$18fc8428861184da(opts) {
343
+ let { triggerRef, isOpen, onClose } = opts;
344
+ useEffect(() => {
345
+ if (!isOpen || onClose === null) return;
346
+ let onScroll = (e) => {
347
+ let target = $23f2114a1b82827e$export$e58f029f0fbfdb29(e);
348
+ if (!triggerRef.current || target instanceof Node && !$23f2114a1b82827e$export$4282f70798064fe0(target, triggerRef.current)) return;
349
+ if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) return;
350
+ let onCloseHandler = onClose || $22e2f5f6490788e8$export$f6211563215e3b37.get(triggerRef.current);
351
+ if (onCloseHandler) onCloseHandler();
352
+ };
353
+ window.addEventListener("scroll", onScroll, true);
354
+ return () => {
355
+ window.removeEventListener("scroll", onScroll, true);
356
+ };
357
+ }, [
358
+ isOpen,
359
+ onClose,
360
+ triggerRef
361
+ ]);
362
+ }
363
+ const $72abaeab4d80592f$export$60d741e20e0aa309 = /* @__PURE__ */ createContext({});
364
+ function $72abaeab4d80592f$export$9fc1347d4195ccb3() {
365
+ return useContext($72abaeab4d80592f$export$60d741e20e0aa309) ?? {};
366
+ }
367
+ function $970072cf4b13fde3$var$hasResizeObserver() {
368
+ return typeof window.ResizeObserver !== "undefined";
369
+ }
370
+ function $970072cf4b13fde3$export$683480f191c0e3ea(options) {
371
+ const { ref, box, onResize } = options;
372
+ let onResizeEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(onResize);
373
+ useEffect(() => {
374
+ let element = ref == null ? void 0 : ref.current;
375
+ if (!element) return;
376
+ if (!$970072cf4b13fde3$var$hasResizeObserver()) {
377
+ window.addEventListener("resize", onResizeEvent, false);
378
+ return () => {
379
+ window.removeEventListener("resize", onResizeEvent, false);
380
+ };
381
+ } else {
382
+ const resizeObserverInstance = new window.ResizeObserver((entries) => {
383
+ if (!entries.length) return;
384
+ onResizeEvent();
385
+ });
386
+ resizeObserverInstance.observe(element, {
387
+ box
388
+ });
389
+ return () => {
390
+ if (element) resizeObserverInstance.unobserve(element);
391
+ };
392
+ }
393
+ }, [
394
+ ref,
395
+ box
396
+ ]);
397
+ }
398
+ const $c07df45195231803$var$Context = /* @__PURE__ */ React__default.createContext(null);
399
+ function $c07df45195231803$export$178405afcd8c5eb(props) {
400
+ let { children } = props;
401
+ let parent = useContext($c07df45195231803$var$Context);
402
+ let [modalCount, setModalCount] = useState(0);
403
+ let context = useMemo(() => ({
404
+ parent,
405
+ modalCount,
406
+ addModal() {
407
+ setModalCount((count) => count + 1);
408
+ if (parent) parent.addModal();
409
+ },
410
+ removeModal() {
411
+ setModalCount((count) => count - 1);
412
+ if (parent) parent.removeModal();
413
+ }
414
+ }), [
415
+ parent,
416
+ modalCount
417
+ ]);
418
+ return /* @__PURE__ */ React__default.createElement($c07df45195231803$var$Context.Provider, {
419
+ value: context
420
+ }, children);
421
+ }
422
+ function $c07df45195231803$export$d9aaed4c3ece1bc0() {
423
+ let context = useContext($c07df45195231803$var$Context);
424
+ return {
425
+ modalProviderProps: {
426
+ "aria-hidden": context && context.modalCount > 0 ? true : void 0
427
+ }
428
+ };
429
+ }
430
+ function $c07df45195231803$var$OverlayContainerDOM(props) {
431
+ let { modalProviderProps } = $c07df45195231803$export$d9aaed4c3ece1bc0();
432
+ return /* @__PURE__ */ React__default.createElement("div", {
433
+ "data-overlay-container": true,
434
+ ...props,
435
+ ...modalProviderProps
436
+ });
437
+ }
438
+ function $c07df45195231803$export$bf688221f59024e5(props) {
439
+ return /* @__PURE__ */ React__default.createElement($c07df45195231803$export$178405afcd8c5eb, null, /* @__PURE__ */ React__default.createElement($c07df45195231803$var$OverlayContainerDOM, props));
440
+ }
441
+ function $c07df45195231803$export$b47c3594eab58386(props) {
442
+ let isSSR = $c7eafbbe1ea5834e$export$535bd6ca7f90a273();
443
+ let { portalContainer = isSSR ? null : document.body, ...rest } = props;
444
+ let { getContainer } = $72abaeab4d80592f$export$9fc1347d4195ccb3();
445
+ if (!props.portalContainer && getContainer) portalContainer = getContainer();
446
+ React__default.useEffect(() => {
447
+ if (portalContainer == null ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
448
+ }, [
449
+ portalContainer
450
+ ]);
451
+ if (!portalContainer) return null;
452
+ let contents = /* @__PURE__ */ React__default.createElement($c07df45195231803$export$bf688221f59024e5, rest);
453
+ return /* @__PURE__ */ __rspack_external_react_dom_7136dc57__default.createPortal(contents, portalContainer);
454
+ }
455
+ const $954926fb6168ae2a$var$AXIS = {
456
+ top: "top",
457
+ bottom: "top",
458
+ left: "left",
459
+ right: "left"
460
+ };
461
+ const $954926fb6168ae2a$var$FLIPPED_DIRECTION = {
462
+ top: "bottom",
463
+ bottom: "top",
464
+ left: "right",
465
+ right: "left"
466
+ };
467
+ const $954926fb6168ae2a$var$CROSS_AXIS = {
468
+ top: "left",
469
+ left: "top"
470
+ };
471
+ const $954926fb6168ae2a$var$AXIS_SIZE = {
472
+ top: "height",
473
+ left: "width"
474
+ };
475
+ const $954926fb6168ae2a$var$TOTAL_SIZE = {
476
+ width: "totalWidth",
477
+ height: "totalHeight"
478
+ };
479
+ const $954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE = {};
480
+ let $954926fb6168ae2a$var$getVisualViewport = () => typeof document !== "undefined" ? window.visualViewport : null;
481
+ function $954926fb6168ae2a$var$getContainerDimensions(containerNode, visualViewport) {
482
+ let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
483
+ let scroll = {};
484
+ let isPinchZoomedIn = ((visualViewport == null ? void 0 : visualViewport.scale) ?? 1) > 1;
485
+ if (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") {
486
+ let documentElement = document.documentElement;
487
+ totalWidth = documentElement.clientWidth;
488
+ totalHeight = documentElement.clientHeight;
489
+ width = (visualViewport == null ? void 0 : visualViewport.width) ?? totalWidth;
490
+ height = (visualViewport == null ? void 0 : visualViewport.height) ?? totalHeight;
491
+ scroll.top = documentElement.scrollTop || containerNode.scrollTop;
492
+ scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
493
+ if (visualViewport) {
494
+ top = visualViewport.offsetTop;
495
+ left = visualViewport.offsetLeft;
496
+ }
497
+ } else {
498
+ ({ width, height, top, left } = $954926fb6168ae2a$var$getOffset(containerNode, false));
499
+ scroll.top = containerNode.scrollTop;
500
+ scroll.left = containerNode.scrollLeft;
501
+ totalWidth = width;
502
+ totalHeight = height;
503
+ }
504
+ if ($2add3ce32c6007eb$export$78551043582a6a98() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
505
+ scroll.top = 0;
506
+ scroll.left = 0;
507
+ top = (visualViewport == null ? void 0 : visualViewport.pageTop) ?? 0;
508
+ left = (visualViewport == null ? void 0 : visualViewport.pageLeft) ?? 0;
509
+ }
510
+ return {
511
+ width,
512
+ height,
513
+ totalWidth,
514
+ totalHeight,
515
+ scroll,
516
+ top,
517
+ left
518
+ };
519
+ }
520
+ function $954926fb6168ae2a$var$getScroll(node) {
521
+ return {
522
+ top: node.scrollTop,
523
+ left: node.scrollLeft,
524
+ width: node.scrollWidth,
525
+ height: node.scrollHeight
526
+ };
527
+ }
528
+ function $954926fb6168ae2a$var$getDelta(axis, offset, size, boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary) {
529
+ let containerScroll = containerDimensions.scroll[axis] ?? 0;
530
+ let boundarySize = boundaryDimensions[$954926fb6168ae2a$var$AXIS_SIZE[axis]];
531
+ let boundaryStartEdge = containerOffsetWithBoundary[axis] + boundaryDimensions.scroll[$954926fb6168ae2a$var$AXIS[axis]] + padding;
532
+ let boundaryEndEdge = containerOffsetWithBoundary[axis] + boundaryDimensions.scroll[$954926fb6168ae2a$var$AXIS[axis]] + boundarySize - padding;
533
+ let startEdgeOffset = offset - containerScroll + boundaryDimensions.scroll[$954926fb6168ae2a$var$AXIS[axis]] + containerOffsetWithBoundary[axis] - boundaryDimensions[$954926fb6168ae2a$var$AXIS[axis]];
534
+ let endEdgeOffset = offset - containerScroll + size + boundaryDimensions.scroll[$954926fb6168ae2a$var$AXIS[axis]] + containerOffsetWithBoundary[axis] - boundaryDimensions[$954926fb6168ae2a$var$AXIS[axis]];
535
+ if (startEdgeOffset < boundaryStartEdge) return boundaryStartEdge - startEdgeOffset;
536
+ else if (endEdgeOffset > boundaryEndEdge) return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
537
+ else return 0;
538
+ }
539
+ function $954926fb6168ae2a$var$getMargins(node) {
540
+ let style = window.getComputedStyle(node);
541
+ return {
542
+ top: parseInt(style.marginTop, 10) || 0,
543
+ bottom: parseInt(style.marginBottom, 10) || 0,
544
+ left: parseInt(style.marginLeft, 10) || 0,
545
+ right: parseInt(style.marginRight, 10) || 0
546
+ };
547
+ }
548
+ function $954926fb6168ae2a$var$parsePlacement(input) {
549
+ if ($954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE[input]) return $954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE[input];
550
+ let [placement, crossPlacement] = input.split(" ");
551
+ let axis = $954926fb6168ae2a$var$AXIS[placement] || "right";
552
+ let crossAxis = $954926fb6168ae2a$var$CROSS_AXIS[axis];
553
+ if (!$954926fb6168ae2a$var$AXIS[crossPlacement]) crossPlacement = "center";
554
+ let size = $954926fb6168ae2a$var$AXIS_SIZE[axis];
555
+ let crossSize = $954926fb6168ae2a$var$AXIS_SIZE[crossAxis];
556
+ $954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE[input] = {
557
+ placement,
558
+ crossPlacement,
559
+ axis,
560
+ crossAxis,
561
+ size,
562
+ crossSize
563
+ };
564
+ return $954926fb6168ae2a$var$PARSED_PLACEMENT_CACHE[input];
565
+ }
566
+ function $954926fb6168ae2a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions) {
567
+ let { placement, crossPlacement, axis, crossAxis, size, crossSize } = placementInfo;
568
+ let position = {};
569
+ position[crossAxis] = childOffset[crossAxis] ?? 0;
570
+ if (crossPlacement === "center")
571
+ position[crossAxis] += ((childOffset[crossSize] ?? 0) - (overlaySize[crossSize] ?? 0)) / 2;
572
+ else if (crossPlacement !== crossAxis)
573
+ position[crossAxis] += (childOffset[crossSize] ?? 0) - (overlaySize[crossSize] ?? 0);
574
+ position[crossAxis] += crossOffset;
575
+ const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
576
+ const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
577
+ position[crossAxis] = $240e9101ba2842f5$export$7d15b64cf5a3a4c4(position[crossAxis], minPosition, maxPosition);
578
+ if (placement === axis) {
579
+ let containerHeight = isContainerPositioned ? containerDimensions[size] : containerDimensions[$954926fb6168ae2a$var$TOTAL_SIZE[size]];
580
+ position[$954926fb6168ae2a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
581
+ } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
582
+ return position;
583
+ }
584
+ function $954926fb6168ae2a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection, containerDimensions, isContainerDescendentOfBoundary, visualViewport) {
585
+ let overlayTop = (position.top != null ? position.top : containerDimensions[$954926fb6168ae2a$var$TOTAL_SIZE.height] - (position.bottom ?? 0) - overlayHeight) - (containerDimensions.scroll.top ?? 0);
586
+ let boundaryToContainerTransformOffset = isContainerDescendentOfBoundary ? containerOffsetWithBoundary.top : 0;
587
+ let boundingRect = {
588
+ // This should be boundary top in container coord system vs viewport top in container coord system
589
+ // For the viewport top, there are several cases
590
+ // 1. pinchzoom case where we want the viewports offset top as top here
591
+ // 2. case where container is offset from the boundary and is contained by the boundary. In this case the top we want here is NOT 0, we want to take boundary's top even though is is a negative number OR the visual viewport, whichever is more restrictive
592
+ top: Math.max(boundaryDimensions.top + boundaryToContainerTransformOffset, ((visualViewport == null ? void 0 : visualViewport.offsetTop) ?? boundaryDimensions.top) + boundaryToContainerTransformOffset),
593
+ bottom: Math.min(boundaryDimensions.top + boundaryDimensions.height + boundaryToContainerTransformOffset, ((visualViewport == null ? void 0 : visualViewport.offsetTop) ?? 0) + ((visualViewport == null ? void 0 : visualViewport.height) ?? 0))
594
+ };
595
+ let maxHeight = heightGrowthDirection !== "top" ? (
596
+ // We want the distance between the top of the overlay to the bottom of the boundary
597
+ Math.max(0, boundingRect.bottom - overlayTop - ((margins.top ?? 0) + (margins.bottom ?? 0) + padding))
598
+ ) : Math.max(0, overlayTop + overlayHeight - boundingRect.top - ((margins.top ?? 0) + (margins.bottom ?? 0) + padding));
599
+ return maxHeight;
600
+ }
601
+ function $954926fb6168ae2a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo, containerDimensions, isContainerDescendentOfBoundary) {
602
+ let { placement, axis, size } = placementInfo;
603
+ if (placement === axis) return Math.max(0, childOffset[axis] - (containerDimensions.scroll[axis] ?? 0) - (boundaryDimensions[axis] + (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0)) - (margins[axis] ?? 0) - margins[$954926fb6168ae2a$var$FLIPPED_DIRECTION[axis]] - padding);
604
+ return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0) - childOffset[axis] - childOffset[size] + (containerDimensions.scroll[axis] ?? 0) - (margins[axis] ?? 0) - margins[$954926fb6168ae2a$var$FLIPPED_DIRECTION[axis]] - padding);
605
+ }
606
+ function $954926fb6168ae2a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport) {
607
+ let placementInfo = $954926fb6168ae2a$var$parsePlacement(placementInput);
608
+ let { size, crossAxis, crossSize, placement, crossPlacement } = placementInfo;
609
+ let position = $954926fb6168ae2a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
610
+ let normalizedOffset = offset;
611
+ let space = $954926fb6168ae2a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo, containerDimensions, isContainerDescendentOfBoundary);
612
+ if (flip && overlaySize[size] > space) {
613
+ let flippedPlacementInfo = $954926fb6168ae2a$var$parsePlacement(`${$954926fb6168ae2a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
614
+ let flippedPosition = $954926fb6168ae2a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
615
+ let flippedSpace = $954926fb6168ae2a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo, containerDimensions, isContainerDescendentOfBoundary);
616
+ if (flippedSpace > space) {
617
+ placementInfo = flippedPlacementInfo;
618
+ position = flippedPosition;
619
+ normalizedOffset = offset;
620
+ }
621
+ }
622
+ let heightGrowthDirection = "bottom";
623
+ if (placementInfo.axis === "top") {
624
+ if (placementInfo.placement === "top") heightGrowthDirection = "top";
625
+ else if (placementInfo.placement === "bottom") heightGrowthDirection = "bottom";
626
+ } else if (placementInfo.crossAxis === "top") {
627
+ if (placementInfo.crossPlacement === "top") heightGrowthDirection = "bottom";
628
+ else if (placementInfo.crossPlacement === "bottom") heightGrowthDirection = "top";
629
+ }
630
+ let delta = $954926fb6168ae2a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
631
+ position[crossAxis] += delta;
632
+ let maxHeight = $954926fb6168ae2a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection, containerDimensions, isContainerDescendentOfBoundary, visualViewport);
633
+ if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
634
+ overlaySize.height = Math.min(overlaySize.height, maxHeight);
635
+ position = $954926fb6168ae2a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
636
+ delta = $954926fb6168ae2a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
637
+ position[crossAxis] += delta;
638
+ let arrowPosition = {};
639
+ let origin = childOffset[crossAxis] - position[crossAxis] - margins[$954926fb6168ae2a$var$AXIS[crossAxis]];
640
+ let preferredArrowPosition = origin + 0.5 * childOffset[crossSize];
641
+ const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
642
+ const overlayMargin = $954926fb6168ae2a$var$AXIS[crossAxis] === "left" ? (margins.left ?? 0) + (margins.right ?? 0) : (margins.top ?? 0) + (margins.bottom ?? 0);
643
+ const arrowMaxPosition = overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;
644
+ const arrowOverlappingChildMinEdge = childOffset[crossAxis] + arrowSize / 2 - (position[crossAxis] + margins[$954926fb6168ae2a$var$AXIS[crossAxis]]);
645
+ const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - arrowSize / 2 - (position[crossAxis] + margins[$954926fb6168ae2a$var$AXIS[crossAxis]]);
646
+ const arrowPositionOverlappingChild = $240e9101ba2842f5$export$7d15b64cf5a3a4c4(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
647
+ arrowPosition[crossAxis] = $240e9101ba2842f5$export$7d15b64cf5a3a4c4(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
648
+ ({ placement, crossPlacement } = placementInfo);
649
+ if (arrowSize) origin = arrowPosition[crossAxis];
650
+ else if (crossPlacement === "right") origin += childOffset[crossSize];
651
+ else if (crossPlacement === "center") origin += childOffset[crossSize] / 2;
652
+ let crossOrigin = placement === "left" || placement === "top" ? overlaySize[size] : 0;
653
+ let triggerAnchorPoint = {
654
+ x: placement === "top" || placement === "bottom" ? origin : crossOrigin,
655
+ y: placement === "left" || placement === "right" ? origin : crossOrigin
656
+ };
657
+ return {
658
+ position,
659
+ maxHeight,
660
+ arrowOffsetLeft: arrowPosition.left,
661
+ arrowOffsetTop: arrowPosition.top,
662
+ placement,
663
+ triggerAnchorPoint
664
+ };
665
+ }
666
+ function $954926fb6168ae2a$export$b3ceb0cbf1056d98(opts) {
667
+ let { placement, targetNode, overlayNode, scrollNode, padding, shouldFlip, boundaryElement, offset, crossOffset, maxHeight, arrowSize = 0, arrowBoundaryOffset = 0 } = opts;
668
+ let visualViewport = $954926fb6168ae2a$var$getVisualViewport();
669
+ let container = overlayNode instanceof HTMLElement ? $954926fb6168ae2a$var$getContainingBlock(overlayNode) : document.documentElement;
670
+ let isViewportContainer = container === document.documentElement;
671
+ const containerPositionStyle = window.getComputedStyle(container).position;
672
+ let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
673
+ let childOffset = isViewportContainer ? $954926fb6168ae2a$var$getOffset(targetNode, false) : $954926fb6168ae2a$var$getPosition(targetNode, container, false);
674
+ if (!isViewportContainer) {
675
+ let { marginTop, marginLeft } = window.getComputedStyle(targetNode);
676
+ childOffset.top += parseInt(marginTop, 10) || 0;
677
+ childOffset.left += parseInt(marginLeft, 10) || 0;
678
+ }
679
+ let overlaySize = $954926fb6168ae2a$var$getOffset(overlayNode, true);
680
+ let margins = $954926fb6168ae2a$var$getMargins(overlayNode);
681
+ overlaySize.width += (margins.left ?? 0) + (margins.right ?? 0);
682
+ overlaySize.height += (margins.top ?? 0) + (margins.bottom ?? 0);
683
+ let scrollSize = $954926fb6168ae2a$var$getScroll(scrollNode);
684
+ let boundaryDimensions = $954926fb6168ae2a$var$getContainerDimensions(boundaryElement, visualViewport);
685
+ let containerDimensions = $954926fb6168ae2a$var$getContainerDimensions(container, visualViewport);
686
+ let containerOffsetWithBoundary;
687
+ if ((boundaryElement.tagName === "BODY" || boundaryElement.tagName === "HTML") && !isViewportContainer) {
688
+ let containerRect = $954926fb6168ae2a$export$4b834cebd9e5cebe(container, false);
689
+ containerOffsetWithBoundary = {
690
+ top: -(containerRect.top - boundaryDimensions.top),
691
+ left: -(containerRect.left - boundaryDimensions.left),
692
+ width: 0,
693
+ height: 0
694
+ };
695
+ } else if ((boundaryElement.tagName === "BODY" || boundaryElement.tagName === "HTML") && isViewportContainer)
696
+ containerOffsetWithBoundary = {
697
+ top: 0,
698
+ left: 0,
699
+ width: 0,
700
+ height: 0
701
+ };
702
+ else
703
+ containerOffsetWithBoundary = $954926fb6168ae2a$var$getPosition(boundaryElement, container, false);
704
+ let isContainerDescendentOfBoundary = $23f2114a1b82827e$export$4282f70798064fe0(boundaryElement, container);
705
+ return $954926fb6168ae2a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport);
706
+ }
707
+ function $954926fb6168ae2a$export$4b834cebd9e5cebe(node, ignoreScale) {
708
+ let { top, left, width, height } = node.getBoundingClientRect();
709
+ if (ignoreScale && node instanceof node.ownerDocument.defaultView.HTMLElement) {
710
+ width = node.offsetWidth;
711
+ height = node.offsetHeight;
712
+ }
713
+ return {
714
+ top,
715
+ left,
716
+ width,
717
+ height
718
+ };
719
+ }
720
+ function $954926fb6168ae2a$var$getOffset(node, ignoreScale) {
721
+ let { top, left, width, height } = $954926fb6168ae2a$export$4b834cebd9e5cebe(node, ignoreScale);
722
+ let { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement;
723
+ return {
724
+ top: top + scrollTop - clientTop,
725
+ left: left + scrollLeft - clientLeft,
726
+ width,
727
+ height
728
+ };
729
+ }
730
+ function $954926fb6168ae2a$var$getPosition(node, parent, ignoreScale) {
731
+ let style = window.getComputedStyle(node);
732
+ let offset;
733
+ if (style.position === "fixed") offset = $954926fb6168ae2a$export$4b834cebd9e5cebe(node, ignoreScale);
734
+ else {
735
+ offset = $954926fb6168ae2a$var$getOffset(node, ignoreScale);
736
+ let parentOffset = $954926fb6168ae2a$var$getOffset(parent, ignoreScale);
737
+ let parentStyle = window.getComputedStyle(parent);
738
+ parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
739
+ parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
740
+ offset.top -= parentOffset.top;
741
+ offset.left -= parentOffset.left;
742
+ }
743
+ offset.top -= parseInt(style.marginTop, 10) || 0;
744
+ offset.left -= parseInt(style.marginLeft, 10) || 0;
745
+ return offset;
746
+ }
747
+ function $954926fb6168ae2a$var$getContainingBlock(node) {
748
+ let offsetParent = node.offsetParent;
749
+ if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$954926fb6168ae2a$var$isContainingBlock(offsetParent)) offsetParent = document.documentElement;
750
+ if (offsetParent == null) {
751
+ offsetParent = node.parentElement;
752
+ while (offsetParent && !$954926fb6168ae2a$var$isContainingBlock(offsetParent)) offsetParent = offsetParent.parentElement;
753
+ }
754
+ return offsetParent || document.documentElement;
755
+ }
756
+ function $954926fb6168ae2a$var$isContainingBlock(node) {
757
+ let style = window.getComputedStyle(node);
758
+ return style.transform !== "none" || /transform|perspective/.test(style.willChange) || style.filter !== "none" || style.contain === "paint" || "backdropFilter" in style && style.backdropFilter !== "none" || "WebkitBackdropFilter" in style && style.WebkitBackdropFilter !== "none";
759
+ }
760
+ let $b3526bc71400be8d$var$visualViewport = typeof document !== "undefined" ? window.visualViewport : null;
761
+ function $b3526bc71400be8d$export$d39e1813b3bdd0e1(props) {
762
+ let { direction } = $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7();
763
+ let { arrowSize, targetRef, overlayRef, arrowRef, scrollRef = overlayRef, placement = "bottom", containerPadding = 12, shouldFlip = true, boundaryElement = typeof document !== "undefined" ? document.body : null, offset = 0, crossOffset = 0, shouldUpdatePosition = true, isOpen = true, onClose, maxHeight, arrowBoundaryOffset = 0 } = props;
764
+ let [position, setPosition] = useState(null);
765
+ let deps = [
766
+ shouldUpdatePosition,
767
+ placement,
768
+ overlayRef.current,
769
+ targetRef.current,
770
+ arrowRef == null ? void 0 : arrowRef.current,
771
+ scrollRef.current,
772
+ containerPadding,
773
+ shouldFlip,
774
+ boundaryElement,
775
+ offset,
776
+ crossOffset,
777
+ isOpen,
778
+ direction,
779
+ maxHeight,
780
+ arrowBoundaryOffset,
781
+ arrowSize
782
+ ];
783
+ let lastScale = useRef($b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.scale);
784
+ useEffect(() => {
785
+ if (isOpen) lastScale.current = $b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.scale;
786
+ }, [
787
+ isOpen
788
+ ]);
789
+ let updatePosition = useCallback(() => {
790
+ var _a, _b;
791
+ if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !boundaryElement) return;
792
+ if (($b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.scale) !== lastScale.current) return;
793
+ let anchor = null;
794
+ if (scrollRef.current && $23f2114a1b82827e$export$b4f377a2b6254582(scrollRef.current)) {
795
+ let anchorRect = (_a = $23f2114a1b82827e$export$cd4e5573fbe2b576()) == null ? void 0 : _a.getBoundingClientRect();
796
+ let scrollRect = scrollRef.current.getBoundingClientRect();
797
+ anchor = {
798
+ type: "top",
799
+ offset: ((anchorRect == null ? void 0 : anchorRect.top) ?? 0) - scrollRect.top
800
+ };
801
+ if (anchor.offset > scrollRect.height / 2) {
802
+ anchor.type = "bottom";
803
+ anchor.offset = ((anchorRect == null ? void 0 : anchorRect.bottom) ?? 0) - scrollRect.bottom;
804
+ }
805
+ }
806
+ let overlay = overlayRef.current;
807
+ if (!maxHeight && overlayRef.current) {
808
+ overlay.style.top = "0px";
809
+ overlay.style.bottom = "";
810
+ overlay.style.maxHeight = (((_b = window.visualViewport) == null ? void 0 : _b.height) ?? window.innerHeight) + "px";
811
+ }
812
+ let position2 = $954926fb6168ae2a$export$b3ceb0cbf1056d98({
813
+ placement: $b3526bc71400be8d$var$translateRTL(placement, direction),
814
+ overlayNode: overlayRef.current,
815
+ targetNode: targetRef.current,
816
+ scrollNode: scrollRef.current || overlayRef.current,
817
+ padding: containerPadding,
818
+ shouldFlip,
819
+ boundaryElement,
820
+ offset,
821
+ crossOffset,
822
+ maxHeight,
823
+ arrowSize: arrowSize ?? ((arrowRef == null ? void 0 : arrowRef.current) ? $954926fb6168ae2a$export$4b834cebd9e5cebe(arrowRef.current, true).width : 0),
824
+ arrowBoundaryOffset
825
+ });
826
+ if (!position2.position) return;
827
+ overlay.style.top = "";
828
+ overlay.style.bottom = "";
829
+ overlay.style.left = "";
830
+ overlay.style.right = "";
831
+ Object.keys(position2.position).forEach((key) => overlay.style[key] = position2.position[key] + "px");
832
+ overlay.style.maxHeight = position2.maxHeight != null ? position2.maxHeight + "px" : "";
833
+ let activeElement = $23f2114a1b82827e$export$cd4e5573fbe2b576();
834
+ if (anchor && activeElement && scrollRef.current) {
835
+ let anchorRect = activeElement.getBoundingClientRect();
836
+ let scrollRect = scrollRef.current.getBoundingClientRect();
837
+ let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];
838
+ scrollRef.current.scrollTop += newOffset - anchor.offset;
839
+ }
840
+ setPosition(position2);
841
+ }, deps);
842
+ $c4867b2f328c2698$export$e5c5a5f917a5871c(updatePosition, deps);
843
+ $b3526bc71400be8d$var$useResize(updatePosition);
844
+ $970072cf4b13fde3$export$683480f191c0e3ea({
845
+ ref: overlayRef,
846
+ onResize: updatePosition
847
+ });
848
+ $970072cf4b13fde3$export$683480f191c0e3ea({
849
+ ref: targetRef,
850
+ onResize: updatePosition
851
+ });
852
+ let isResizing = useRef(false);
853
+ $c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
854
+ let timeout;
855
+ let onResize = () => {
856
+ isResizing.current = true;
857
+ clearTimeout(timeout);
858
+ timeout = setTimeout(() => {
859
+ isResizing.current = false;
860
+ }, 500);
861
+ updatePosition();
862
+ };
863
+ let onScroll = () => {
864
+ if (isResizing.current) onResize();
865
+ };
866
+ $b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.addEventListener("resize", onResize);
867
+ $b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.addEventListener("scroll", onScroll);
868
+ return () => {
869
+ $b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.removeEventListener("resize", onResize);
870
+ $b3526bc71400be8d$var$visualViewport == null ? void 0 : $b3526bc71400be8d$var$visualViewport.removeEventListener("scroll", onScroll);
871
+ };
872
+ }, [
873
+ updatePosition
874
+ ]);
875
+ let close = useCallback(() => {
876
+ if (!isResizing.current) onClose == null ? void 0 : onClose();
877
+ }, [
878
+ onClose,
879
+ isResizing
880
+ ]);
881
+ $22e2f5f6490788e8$export$18fc8428861184da({
882
+ triggerRef: targetRef,
883
+ isOpen,
884
+ onClose: onClose && close
885
+ });
886
+ return {
887
+ overlayProps: {
888
+ style: {
889
+ position: position ? "absolute" : "fixed",
890
+ top: !position ? 0 : void 0,
891
+ left: !position ? 0 : void 0,
892
+ zIndex: 1e5,
893
+ ...position == null ? void 0 : position.position,
894
+ maxHeight: (position == null ? void 0 : position.maxHeight) ?? "100vh"
895
+ }
896
+ },
897
+ placement: (position == null ? void 0 : position.placement) ?? null,
898
+ triggerAnchorPoint: (position == null ? void 0 : position.triggerAnchorPoint) ?? null,
899
+ arrowProps: {
900
+ "aria-hidden": "true",
901
+ role: "presentation",
902
+ style: {
903
+ left: position == null ? void 0 : position.arrowOffsetLeft,
904
+ top: position == null ? void 0 : position.arrowOffsetTop
905
+ }
906
+ },
907
+ updatePosition
908
+ };
909
+ }
910
+ function $b3526bc71400be8d$var$useResize(onResize) {
911
+ $c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
912
+ window.addEventListener("resize", onResize, false);
913
+ return () => {
914
+ window.removeEventListener("resize", onResize, false);
915
+ };
916
+ }, [
917
+ onResize
918
+ ]);
919
+ }
920
+ function $b3526bc71400be8d$var$translateRTL(position, direction) {
921
+ if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
922
+ return position.replace("start", "left").replace("end", "right");
923
+ }
924
+ function $8c383cffc84c9982$export$1c4b08e0eca38426(props, state) {
925
+ let domProps = $8e9d2fae0ecb9001$export$457c3d6518dd4c6f(props, {
926
+ labelable: true
927
+ });
928
+ let { hoverProps } = $e969f22b6713ca4a$export$ae780daf29e6d456({
929
+ onHoverStart: () => state == null ? void 0 : state.open(true),
930
+ onHoverEnd: () => state == null ? void 0 : state.close()
931
+ });
932
+ return {
933
+ tooltipProps: $bbaa08b3cd72f041$export$9d1611c77c2fe928(domProps, hoverProps, {
934
+ role: "tooltip"
935
+ })
936
+ };
937
+ }
938
+ function $85908aa8a35f0fac$export$a6da6c504e4bba8b(props, state, ref) {
939
+ let { isDisabled, trigger, shouldCloseOnPress = true } = props;
940
+ let tooltipId = $390e54f620492c70$export$f680877a34711e37();
941
+ let isHovered = useRef(false);
942
+ let isFocused = useRef(false);
943
+ let handleShow = () => {
944
+ if (isHovered.current || isFocused.current) state.open(isFocused.current);
945
+ };
946
+ let handleHide = (immediate) => {
947
+ if (!isHovered.current && !isFocused.current) state.close(immediate);
948
+ };
949
+ useEffect(() => {
950
+ let onKeyDown = (e) => {
951
+ if (ref && ref.current) {
952
+ if (e.key === "Escape") {
953
+ e.stopPropagation();
954
+ state.close(true);
955
+ }
956
+ }
957
+ };
958
+ if (state.isOpen) {
959
+ document.addEventListener("keydown", onKeyDown, true);
960
+ return () => {
961
+ document.removeEventListener("keydown", onKeyDown, true);
962
+ };
963
+ }
964
+ }, [
965
+ ref,
966
+ state
967
+ ]);
968
+ let onHoverStart = () => {
969
+ if (trigger === "focus") return;
970
+ if ($8f5a2122b0992be3$export$630ff653c5ada6a9() === "pointer") isHovered.current = true;
971
+ else isHovered.current = false;
972
+ handleShow();
973
+ };
974
+ let onHoverEnd = () => {
975
+ if (trigger === "focus") return;
976
+ isFocused.current = false;
977
+ isHovered.current = false;
978
+ handleHide();
979
+ };
980
+ let onPressStart = () => {
981
+ if (!shouldCloseOnPress) return;
982
+ isFocused.current = false;
983
+ isHovered.current = false;
984
+ handleHide(true);
985
+ };
986
+ let onFocus = () => {
987
+ let isVisible = $8f5a2122b0992be3$export$b9b3dfddab17db27();
988
+ if (isVisible) {
989
+ isFocused.current = true;
990
+ handleShow();
991
+ }
992
+ };
993
+ let onBlur = () => {
994
+ isFocused.current = false;
995
+ isHovered.current = false;
996
+ handleHide(true);
997
+ };
998
+ let { hoverProps } = $e969f22b6713ca4a$export$ae780daf29e6d456({
999
+ isDisabled,
1000
+ onHoverStart,
1001
+ onHoverEnd
1002
+ });
1003
+ let { focusableProps } = $d1116acdf220c2da$export$4c014de7c8940b4c({
1004
+ isDisabled,
1005
+ onFocus,
1006
+ onBlur
1007
+ }, ref);
1008
+ return {
1009
+ triggerProps: {
1010
+ "aria-describedby": state.isOpen ? tooltipId : void 0,
1011
+ ...$bbaa08b3cd72f041$export$9d1611c77c2fe928(focusableProps, hoverProps, {
1012
+ onPointerDown: onPressStart,
1013
+ onKeyDown: onPressStart
1014
+ }),
1015
+ tabIndex: void 0
1016
+ },
1017
+ tooltipProps: {
1018
+ id: tooltipId
1019
+ }
1020
+ };
1021
+ }
1022
+ const $514c0188e459b4c0$export$9afb8bc826b033ea = /* @__PURE__ */ createContext({});
1023
+ const $514c0188e459b4c0$export$5f1af8db9871e1d6 = /* @__PURE__ */ forwardRef(function Text(props, ref) {
1024
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $514c0188e459b4c0$export$9afb8bc826b033ea);
1025
+ let { elementType: ElementType = "span", ...domProps } = props;
1026
+ return /* @__PURE__ */ React__default.createElement(ElementType, {
1027
+ className: "react-aria-Text",
1028
+ ...domProps,
1029
+ ref
1030
+ });
1031
+ });
1032
+ function $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props) {
1033
+ let [isOpen, setOpen] = $3e6197669829fe11$export$40bfa8c7b0832715(props.isOpen, props.defaultOpen || false, props.onOpenChange);
1034
+ const open = useCallback(() => {
1035
+ setOpen(true);
1036
+ }, [
1037
+ setOpen
1038
+ ]);
1039
+ const close = useCallback(() => {
1040
+ setOpen(false);
1041
+ }, [
1042
+ setOpen
1043
+ ]);
1044
+ const toggle = useCallback(() => {
1045
+ setOpen(!isOpen);
1046
+ }, [
1047
+ setOpen,
1048
+ isOpen
1049
+ ]);
1050
+ return {
1051
+ isOpen,
1052
+ setOpen,
1053
+ open,
1054
+ close,
1055
+ toggle
1056
+ };
1057
+ }
1058
+ const $3834487504f4fc00$var$TOOLTIP_DELAY = 1500;
1059
+ const $3834487504f4fc00$var$TOOLTIP_COOLDOWN = 500;
1060
+ let $3834487504f4fc00$var$tooltips = {};
1061
+ let $3834487504f4fc00$var$tooltipId = 0;
1062
+ let $3834487504f4fc00$var$globalWarmedUp = false;
1063
+ let $3834487504f4fc00$var$globalWarmUpTimeout = null;
1064
+ let $3834487504f4fc00$var$globalCooldownTimeout = null;
1065
+ function $3834487504f4fc00$export$4d40659c25ecb50b(props = {}) {
1066
+ let { delay = $3834487504f4fc00$var$TOOLTIP_DELAY, closeDelay = $3834487504f4fc00$var$TOOLTIP_COOLDOWN } = props;
1067
+ let { isOpen, open, close } = $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props);
1068
+ let id = useMemo(() => `${++$3834487504f4fc00$var$tooltipId}`, []);
1069
+ let closeTimeout = useRef(null);
1070
+ let closeCallback = useRef(close);
1071
+ let ensureTooltipEntry = () => {
1072
+ $3834487504f4fc00$var$tooltips[id] = hideTooltip;
1073
+ };
1074
+ let closeOpenTooltips = () => {
1075
+ for (let hideTooltipId in $3834487504f4fc00$var$tooltips) if (hideTooltipId !== id) {
1076
+ $3834487504f4fc00$var$tooltips[hideTooltipId](true);
1077
+ delete $3834487504f4fc00$var$tooltips[hideTooltipId];
1078
+ }
1079
+ };
1080
+ let showTooltip = () => {
1081
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1082
+ closeTimeout.current = null;
1083
+ closeOpenTooltips();
1084
+ ensureTooltipEntry();
1085
+ $3834487504f4fc00$var$globalWarmedUp = true;
1086
+ open();
1087
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) {
1088
+ clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1089
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1090
+ }
1091
+ if ($3834487504f4fc00$var$globalCooldownTimeout) {
1092
+ clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
1093
+ $3834487504f4fc00$var$globalCooldownTimeout = null;
1094
+ }
1095
+ };
1096
+ let hideTooltip = (immediate) => {
1097
+ if (immediate || closeDelay <= 0) {
1098
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1099
+ closeTimeout.current = null;
1100
+ closeCallback.current();
1101
+ } else if (!closeTimeout.current) closeTimeout.current = setTimeout(() => {
1102
+ closeTimeout.current = null;
1103
+ closeCallback.current();
1104
+ }, closeDelay);
1105
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) {
1106
+ clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1107
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1108
+ }
1109
+ if ($3834487504f4fc00$var$globalWarmedUp) {
1110
+ if ($3834487504f4fc00$var$globalCooldownTimeout) clearTimeout($3834487504f4fc00$var$globalCooldownTimeout);
1111
+ $3834487504f4fc00$var$globalCooldownTimeout = setTimeout(() => {
1112
+ delete $3834487504f4fc00$var$tooltips[id];
1113
+ $3834487504f4fc00$var$globalCooldownTimeout = null;
1114
+ $3834487504f4fc00$var$globalWarmedUp = false;
1115
+ }, Math.max($3834487504f4fc00$var$TOOLTIP_COOLDOWN, closeDelay));
1116
+ }
1117
+ };
1118
+ let warmupTooltip = () => {
1119
+ closeOpenTooltips();
1120
+ ensureTooltipEntry();
1121
+ if (!isOpen && !$3834487504f4fc00$var$globalWarmedUp) {
1122
+ if ($3834487504f4fc00$var$globalWarmUpTimeout) clearTimeout($3834487504f4fc00$var$globalWarmUpTimeout);
1123
+ $3834487504f4fc00$var$globalWarmUpTimeout = setTimeout(() => {
1124
+ $3834487504f4fc00$var$globalWarmUpTimeout = null;
1125
+ $3834487504f4fc00$var$globalWarmedUp = true;
1126
+ showTooltip();
1127
+ }, delay);
1128
+ } else if (!isOpen) showTooltip();
1129
+ };
1130
+ useEffect(() => {
1131
+ closeCallback.current = close;
1132
+ }, [
1133
+ close
1134
+ ]);
1135
+ useEffect(() => {
1136
+ return () => {
1137
+ if (closeTimeout.current) clearTimeout(closeTimeout.current);
1138
+ let tooltip = $3834487504f4fc00$var$tooltips[id];
1139
+ if (tooltip) delete $3834487504f4fc00$var$tooltips[id];
1140
+ };
1141
+ }, [
1142
+ id
1143
+ ]);
1144
+ return {
1145
+ isOpen,
1146
+ open: (immediate) => {
1147
+ if (!immediate && delay > 0 && !closeTimeout.current) warmupTooltip();
1148
+ else showTooltip();
1149
+ },
1150
+ close: hideTooltip
1151
+ };
1152
+ }
1153
+ const $ee014567cb39d3f0$export$ff05c3ac10437e03 = /* @__PURE__ */ createContext(null);
1154
+ const $ee014567cb39d3f0$export$f551688fc98f2e09 = /* @__PURE__ */ forwardRef(function FieldError(props, ref) {
1155
+ let validation = useContext($ee014567cb39d3f0$export$ff05c3ac10437e03);
1156
+ if (!(validation === null || validation === void 0 ? void 0 : validation.isInvalid)) return null;
1157
+ return /* @__PURE__ */ React__default.createElement($ee014567cb39d3f0$var$FieldErrorInner, {
1158
+ ...props,
1159
+ ref
1160
+ });
1161
+ });
1162
+ const $ee014567cb39d3f0$var$FieldErrorInner = /* @__PURE__ */ forwardRef((props, ref) => {
1163
+ let validation = useContext($ee014567cb39d3f0$export$ff05c3ac10437e03);
1164
+ let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
1165
+ global: true
1166
+ });
1167
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
1168
+ ...props,
1169
+ defaultClassName: "react-aria-FieldError",
1170
+ defaultChildren: validation.validationErrors.length === 0 ? void 0 : validation.validationErrors.join(" "),
1171
+ values: validation
1172
+ });
1173
+ if (renderProps.children == null) return null;
1174
+ return /* @__PURE__ */ React__default.createElement($514c0188e459b4c0$export$5f1af8db9871e1d6, {
1175
+ slot: "errorMessage",
1176
+ ...domProps,
1177
+ ...renderProps,
1178
+ ref
1179
+ });
1180
+ });
1181
+ const $d3e0e05bdfcf66bd$export$c24727297075ec6a = /* @__PURE__ */ createContext(null);
1182
+ const $3985021b0ad6602f$export$37fb8590cf2c088c = /* @__PURE__ */ createContext({});
1183
+ let $3985021b0ad6602f$var$filterHoverProps = (props) => {
1184
+ let { onHoverStart, onHoverChange, onHoverEnd, ...otherProps } = props;
1185
+ return otherProps;
1186
+ };
1187
+ const $3985021b0ad6602f$export$f5b8910cec6cf069 = /* @__PURE__ */ $f39a9eba43920ace$export$86427a43e3e48ebb(function Input(props, ref) {
1188
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $3985021b0ad6602f$export$37fb8590cf2c088c);
1189
+ let { hoverProps, isHovered } = $e969f22b6713ca4a$export$ae780daf29e6d456(props);
1190
+ let { isFocused, isFocusVisible, focusProps } = $0c4a58759813079a$export$4e328f61c538687f({
1191
+ isTextInput: true,
1192
+ autoFocus: props.autoFocus
1193
+ });
1194
+ let isInvalid = !!props["aria-invalid"] && props["aria-invalid"] !== "false";
1195
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
1196
+ ...props,
1197
+ values: {
1198
+ isHovered,
1199
+ isFocused,
1200
+ isFocusVisible,
1201
+ isDisabled: props.disabled || false,
1202
+ isInvalid
1203
+ },
1204
+ defaultClassName: "react-aria-Input"
1205
+ });
1206
+ return /* @__PURE__ */ React__default.createElement("input", {
1207
+ ...$bbaa08b3cd72f041$export$9d1611c77c2fe928($3985021b0ad6602f$var$filterHoverProps(props), focusProps, hoverProps),
1208
+ ...renderProps,
1209
+ ref,
1210
+ "data-focused": isFocused || void 0,
1211
+ "data-disabled": props.disabled || void 0,
1212
+ "data-hovered": isHovered || void 0,
1213
+ "data-focus-visible": isFocusVisible || void 0,
1214
+ "data-invalid": isInvalid || void 0
1215
+ });
1216
+ });
1217
+ const $44f671af83e7d9e0$export$2de4954e8ae13b9f = /* @__PURE__ */ createContext({
1218
+ placement: "bottom"
1219
+ });
1220
+ const $4e3b923658d69c60$export$7a7623236eec67fa = /* @__PURE__ */ createContext(null);
1221
+ const $4e3b923658d69c60$export$39ae08fa83328b12 = /* @__PURE__ */ createContext(null);
1222
+ function $4e3b923658d69c60$export$8c610744efcf8a1d(props) {
1223
+ let state = $3834487504f4fc00$export$4d40659c25ecb50b(props);
1224
+ let ref = useRef(null);
1225
+ let { triggerProps, tooltipProps } = $85908aa8a35f0fac$export$a6da6c504e4bba8b(props, state, ref);
1226
+ return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
1227
+ values: [
1228
+ [
1229
+ $4e3b923658d69c60$export$7a7623236eec67fa,
1230
+ state
1231
+ ],
1232
+ [
1233
+ $4e3b923658d69c60$export$39ae08fa83328b12,
1234
+ {
1235
+ ...tooltipProps,
1236
+ triggerRef: ref
1237
+ }
1238
+ ]
1239
+ ]
1240
+ }, /* @__PURE__ */ React__default.createElement($d1116acdf220c2da$export$13f3202a3e5ddd5, {
1241
+ ...triggerProps,
1242
+ ref
1243
+ }, props.children));
1244
+ }
1245
+ const $4e3b923658d69c60$export$28c660c63b792dea = /* @__PURE__ */ forwardRef(function Tooltip({ UNSTABLE_portalContainer, ...props }, ref) {
1246
+ [props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $4e3b923658d69c60$export$39ae08fa83328b12);
1247
+ let contextState = useContext($4e3b923658d69c60$export$7a7623236eec67fa);
1248
+ let localState = $3834487504f4fc00$export$4d40659c25ecb50b(props);
1249
+ let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
1250
+ let isExiting = $d3f049242431219c$export$45fda7c47f93fd48(ref, state.isOpen) || props.isExiting || false;
1251
+ if (!state.isOpen && !isExiting) return null;
1252
+ return /* @__PURE__ */ React__default.createElement($c07df45195231803$export$b47c3594eab58386, {
1253
+ portalContainer: UNSTABLE_portalContainer
1254
+ }, /* @__PURE__ */ React__default.createElement($4e3b923658d69c60$var$TooltipInner, {
1255
+ ...props,
1256
+ tooltipRef: ref,
1257
+ isExiting
1258
+ }));
1259
+ });
1260
+ function $4e3b923658d69c60$var$TooltipInner(props) {
1261
+ let state = useContext($4e3b923658d69c60$export$7a7623236eec67fa);
1262
+ let arrowRef = useRef(null);
1263
+ let { overlayProps, arrowProps, placement, triggerAnchorPoint } = $b3526bc71400be8d$export$d39e1813b3bdd0e1({
1264
+ placement: props.placement || "top",
1265
+ targetRef: props.triggerRef,
1266
+ overlayRef: props.tooltipRef,
1267
+ arrowRef,
1268
+ offset: props.offset,
1269
+ crossOffset: props.crossOffset,
1270
+ isOpen: state.isOpen,
1271
+ arrowBoundaryOffset: props.arrowBoundaryOffset,
1272
+ shouldFlip: props.shouldFlip,
1273
+ containerPadding: props.containerPadding,
1274
+ onClose: () => state.close(true)
1275
+ });
1276
+ let isEntering = $d3f049242431219c$export$6d3443f2c48bfc20(props.tooltipRef, !!placement) || props.isEntering || false;
1277
+ let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
1278
+ ...props,
1279
+ defaultClassName: "react-aria-Tooltip",
1280
+ values: {
1281
+ placement,
1282
+ isEntering,
1283
+ isExiting: props.isExiting,
1284
+ state
1285
+ }
1286
+ });
1287
+ props = $bbaa08b3cd72f041$export$9d1611c77c2fe928(props, overlayProps);
1288
+ let { tooltipProps } = $8c383cffc84c9982$export$1c4b08e0eca38426(props, state);
1289
+ let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
1290
+ global: true
1291
+ });
1292
+ return /* @__PURE__ */ React__default.createElement("div", {
1293
+ ...$bbaa08b3cd72f041$export$9d1611c77c2fe928(DOMProps, renderProps, tooltipProps),
1294
+ ref: props.tooltipRef,
1295
+ style: {
1296
+ ...overlayProps.style,
1297
+ "--trigger-anchor-point": triggerAnchorPoint ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px` : void 0,
1298
+ ...renderProps.style
1299
+ },
1300
+ "data-placement": placement !== null && placement !== void 0 ? placement : void 0,
1301
+ "data-entering": isEntering || void 0,
1302
+ "data-exiting": props.isExiting || void 0
1303
+ }, /* @__PURE__ */ React__default.createElement($44f671af83e7d9e0$export$2de4954e8ae13b9f.Provider, {
1304
+ value: {
1305
+ ...arrowProps,
1306
+ placement,
1307
+ ref: arrowRef
1308
+ }
1309
+ }, renderProps.children));
1310
+ }
1311
+ const sameValidity = (a, b) => a !== null && a.valid === b.valid && a.validationMessage === b.validationMessage;
1312
+ function useValidatedField({
1313
+ value,
1314
+ valueKey,
1315
+ intrinsic,
1316
+ fieldValidity,
1317
+ showValidityIndication,
1318
+ onValidate,
1319
+ onValidityChange
1320
+ }) {
1321
+ const isGateControlled = showValidityIndication !== void 0;
1322
+ const [touched, setTouched] = useState(false);
1323
+ const showIndication = isGateControlled ? Boolean(showValidityIndication) : touched;
1324
+ const changeKey = valueKey === void 0 ? value : valueKey;
1325
+ const customInvalid = (fieldValidity == null ? void 0 : fieldValidity.valid) === false;
1326
+ const customMessage = (fieldValidity == null ? void 0 : fieldValidity.validationMessage) ?? "";
1327
+ const validity = useMemo(() => {
1328
+ const valid = intrinsic.valid && !customInvalid;
1329
+ let validationMessage = "";
1330
+ if (!intrinsic.valid) {
1331
+ validationMessage = intrinsic.validationMessage;
1332
+ } else if (customInvalid) {
1333
+ validationMessage = customMessage;
1334
+ }
1335
+ return { valid, validationMessage };
1336
+ }, [
1337
+ intrinsic.valid,
1338
+ intrinsic.validationMessage,
1339
+ customInvalid,
1340
+ customMessage
1341
+ ]);
1342
+ const onValidateRef = useRef(onValidate);
1343
+ onValidateRef.current = onValidate;
1344
+ const onValidityChangeRef = useRef(onValidityChange);
1345
+ onValidityChangeRef.current = onValidityChange;
1346
+ const valueRef = useRef(value);
1347
+ valueRef.current = value;
1348
+ const lastEmittedRef = useRef(null);
1349
+ useEffect(() => {
1350
+ var _a;
1351
+ if (sameValidity(lastEmittedRef.current, validity)) {
1352
+ return;
1353
+ }
1354
+ lastEmittedRef.current = validity;
1355
+ (_a = onValidityChangeRef.current) == null ? void 0 : _a.call(onValidityChangeRef, validity);
1356
+ }, [validity]);
1357
+ const mountedRef = useRef(false);
1358
+ const prevKeyRef = useRef(changeKey);
1359
+ useEffect(() => {
1360
+ var _a;
1361
+ (_a = onValidateRef.current) == null ? void 0 : _a.call(onValidateRef, valueRef.current, "mount");
1362
+ mountedRef.current = true;
1363
+ prevKeyRef.current = changeKey;
1364
+ }, []);
1365
+ useEffect(() => {
1366
+ var _a;
1367
+ if (!mountedRef.current) {
1368
+ return;
1369
+ }
1370
+ if (prevKeyRef.current === changeKey) {
1371
+ return;
1372
+ }
1373
+ prevKeyRef.current = changeKey;
1374
+ if (showIndication) {
1375
+ (_a = onValidateRef.current) == null ? void 0 : _a.call(onValidateRef, valueRef.current, "change");
1376
+ }
1377
+ }, [changeKey, showIndication]);
1378
+ const handleBlur = useCallback(() => {
1379
+ var _a;
1380
+ if (!isGateControlled) {
1381
+ setTouched(true);
1382
+ }
1383
+ (_a = onValidateRef.current) == null ? void 0 : _a.call(onValidateRef, valueRef.current, "blur");
1384
+ }, [isGateControlled]);
1385
+ return { validity, showValidityIndication: showIndication, handleBlur };
1386
+ }
1387
+ export {
1388
+ $4e3b923658d69c60$export$8c610744efcf8a1d as $,
1389
+ $4e3b923658d69c60$export$28c660c63b792dea as a,
1390
+ $514c0188e459b4c0$export$5f1af8db9871e1d6 as b,
1391
+ $ee014567cb39d3f0$export$f551688fc98f2e09 as c,
1392
+ $fd2148440a13ec26$export$fc1a364ae1f3ff10 as d,
1393
+ $191c9b6d48a0a4e2$export$294aa081a6c6f55d as e,
1394
+ $860f7da480e22816$export$b8473d3665f3a75a as f,
1395
+ $d3e0e05bdfcf66bd$export$c24727297075ec6a as g,
1396
+ $3985021b0ad6602f$export$37fb8590cf2c088c as h,
1397
+ $514c0188e459b4c0$export$9afb8bc826b033ea as i,
1398
+ $ee014567cb39d3f0$export$ff05c3ac10437e03 as j,
1399
+ $3985021b0ad6602f$export$f5b8910cec6cf069 as k,
1400
+ $fd2148440a13ec26$export$75ee7c75d68f5b0e as l,
1401
+ $fd2148440a13ec26$export$aca958c65c314e6c as m,
1402
+ $fd2148440a13ec26$export$a763b9476acd3eb as n,
1403
+ $fd2148440a13ec26$export$dad6ae84456c676a as o,
1404
+ $72abaeab4d80592f$export$9fc1347d4195ccb3 as p,
1405
+ $b3526bc71400be8d$export$d39e1813b3bdd0e1 as q,
1406
+ $f11fb0bcf1b2687a$export$61c6a8c84e605fb6 as r,
1407
+ $d3f049242431219c$export$45fda7c47f93fd48 as s,
1408
+ $d3f049242431219c$export$6d3443f2c48bfc20 as t,
1409
+ useValidatedField as u,
1410
+ $44f671af83e7d9e0$export$2de4954e8ae13b9f as v
1411
+ };