@opengovsg/confetti 0.3.3 → 0.4.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.
package/README.md CHANGED
@@ -63,11 +63,12 @@ connect-src https://confetti.gov.sg;
63
63
 
64
64
  Choose the component that best fits your use case:
65
65
 
66
- | Component | Use Case | Behavior |
67
- | ------------------ | --------------------------------- | --------------------------------------------------------- |
68
- | `EmbeddedConfetti` | Inline surveys, feedback sections | Shows questions in an inline manner with a submit button |
69
- | `PopoverConfetti` | Floating feedback widgets | Dismissible popover, step-by-step questions, auto-submits |
70
- | `StepperConfetti` | Guided surveys | One question at a time, auto-submits after last question |
66
+ | Component | Use Case | Behavior |
67
+ | ------------------ | --------------------------------- | ------------------------------------------------------------ |
68
+ | `EmbeddedConfetti` | Inline surveys, feedback sections | Shows questions in an inline manner with a submit button |
69
+ | `ModalConfetti` | Interruptive, centered surveys | Centered modal overlay, step-by-step questions, auto-submits |
70
+ | `PopoverConfetti` | Floating feedback widgets | Dismissible popover, step-by-step questions, auto-submits |
71
+ | `StepperConfetti` | Guided surveys | One question at a time, auto-submits after last question |
71
72
 
72
73
  ## Visibility Hooks
73
74
 
@@ -92,3 +93,39 @@ import { useVisibleAfterScroll } from '@opengovsg/confetti'
92
93
 
93
94
  const { isVisible } = useVisibleAfterScroll({ threshold: 500 }) // 500px
94
95
  ```
96
+
97
+ ### useVisibleAfterPageVisits
98
+
99
+ Show the survey once the visitor has loaded the current page a given number of times (persisted across sessions via `localStorage`):
100
+
101
+ ```tsx
102
+ import { useVisibleAfterPageVisits } from '@opengovsg/confetti'
103
+
104
+ const { isVisible, reset } = useVisibleAfterPageVisits({
105
+ visits: 3,
106
+ respondent: 'optional-respondent-identifier',
107
+ })
108
+ ```
109
+
110
+ ### useVisibleAfterSessionPageVisits
111
+
112
+ Same as above, but the visit count is scoped to the current browser session via `sessionStorage`:
113
+
114
+ ```tsx
115
+ import { useVisibleAfterSessionPageVisits } from '@opengovsg/confetti'
116
+
117
+ const { isVisible, reset } = useVisibleAfterSessionPageVisits({ visits: 3 })
118
+ ```
119
+
120
+ ## Building Blocks
121
+
122
+ The lower-level primitives that power the [template components](#template-components) are published from the `@opengovsg/confetti/components` subpath. Reach for these to compose your own survey UI.
123
+
124
+ ```tsx
125
+ import {
126
+ ConfettiContext,
127
+ ConfettiController,
128
+ ConfettiProvider,
129
+ useConfetti,
130
+ } from '@opengovsg/confetti/components'
131
+ ```
@@ -0,0 +1,86 @@
1
+ import { i as PublicGetSurveyOutput, n as ConfettiState, r as Question$1, t as Answer } from "./types-CJY8TUUa.js";
2
+
3
+ //#region src/core/ConfettiController.d.ts
4
+ interface ConfettiControllerProps {
5
+ children: (props: ConfettiState) => React.ReactElement;
6
+ /**
7
+ * Control the current question index that is being displayed.
8
+ * If not provided, the component will manage it internally.
9
+ */
10
+ current?: number;
11
+ shouldAutoSubmit?: boolean;
12
+ onFinished?: () => void;
13
+ }
14
+ declare const ConfettiController: ({
15
+ current: currentProp,
16
+ shouldAutoSubmit,
17
+ onFinished,
18
+ children
19
+ }: ConfettiControllerProps) => import("react").JSX.Element;
20
+ //#endregion
21
+ //#region src/contracts/state.d.ts
22
+ interface ConfettiRespondentState {
23
+ lastRespondedAt: Date | null;
24
+ lastDismissedAt: Date | null;
25
+ }
26
+ //#endregion
27
+ //#region src/core/logic/is-visible.d.ts
28
+ type IsSurveyVisible = boolean | ((s: ConfettiRespondentState) => boolean) | undefined;
29
+ //#endregion
30
+ //#region src/core/ConfettiProvider.d.ts
31
+ interface ConfettiContextValue {
32
+ surveyId: string;
33
+ metadata: Record<string, string>;
34
+ submit: ({
35
+ answers
36
+ }: {
37
+ answers: Record<Question$1['id'], Answer>;
38
+ }) => Promise<void>;
39
+ dismiss: () => Promise<void> | void;
40
+ survey: PublicGetSurveyOutput | undefined;
41
+ isVisible: boolean;
42
+ }
43
+ declare const ConfettiContext: import("react").Context<ConfettiContextValue | null>;
44
+ interface ConfettiProviderProps {
45
+ children: React.ReactNode;
46
+ surveyId: string;
47
+ publishableKey: string;
48
+ respondent?: string;
49
+ metadata?: Record<string, string>;
50
+ apiBaseUrl?: string;
51
+ isSurveyVisible?: IsSurveyVisible;
52
+ alwaysRenderChildren?: boolean;
53
+ }
54
+ declare const ConfettiProvider: (props: ConfettiProviderProps) => import("react").JSX.Element;
55
+ declare const useConfetti: () => ConfettiContextValue;
56
+ //#endregion
57
+ //#region src/components/questions/types.d.ts
58
+ type Question = PublicGetSurveyOutput['questions'][number];
59
+ interface BaseFieldProps {
60
+ id: string;
61
+ title: string | null | undefined;
62
+ description?: string | null | undefined;
63
+ required?: boolean;
64
+ onChange: (answer: Answer) => void;
65
+ error?: string;
66
+ }
67
+ //#endregion
68
+ //#region src/components/questions/BugReport/BugReport.d.ts
69
+ interface BugReportOptions {
70
+ maskAllInputs?: boolean;
71
+ }
72
+ //#endregion
73
+ //#region src/components/Confetti.d.ts
74
+ interface ConfettiProps extends Omit<ConfettiProviderProps, 'children'>, Pick<ConfettiControllerProps, 'onFinished' | 'shouldAutoSubmit'> {
75
+ options?: {
76
+ bugReport?: BugReportOptions;
77
+ };
78
+ }
79
+ declare const Confetti: ({
80
+ children,
81
+ onFinished,
82
+ shouldAutoSubmit,
83
+ ...props
84
+ }: ConfettiProps & Pick<ConfettiControllerProps, "children" | "shouldAutoSubmit">) => import("react").JSX.Element;
85
+ //#endregion
86
+ export { Question as a, ConfettiProviderProps as c, ConfettiControllerProps as d, BaseFieldProps as i, useConfetti as l, ConfettiProps as n, ConfettiContext as o, BugReportOptions as r, ConfettiProvider as s, Confetti as t, ConfettiController as u };
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n,r,t as i}from"./internals-B5GhpjgM.js";import{A as a,C as o,D as s,E as c,F as l,G as u,H as d,I as f,J as p,K as m,L as h,M as g,N as _,O as v,P as y,Q as b,R as x,S,T as C,V as w,W as T,X as E,Y as D,_ as O,a as k,b as A,c as ee,d as te,f as ne,g as re,h as ie,i as ae,j,k as oe,l as se,m as ce,o as le,p as ue,q as de,r as fe,s as M,u as pe,v as me,w as N,x as P,y as he,z as ge}from"./ModalContainer-B3QLAjgy.js";import{ErrorBoundary as _e}from"react-error-boundary";import F,{Suspense as ve,createContext as I,forwardRef as L,lazy as ye,useCallback as R,useContext as be,useEffect as z,useMemo as B,useRef as V,useState as H}from"react";import{useTimeout as xe}from"usehooks-ts";import{Fragment as U,jsx as W,jsxs as G}from"react/jsx-runtime";import K from"clsx";import"react-dom";function Se(e){return e.issues[0]?.message??`Invalid input`}const q={rating:({scale:e},t)=>de({scale:e},t),"open-ended":({max:e},t)=>m({maxLength:e},t),"single-select":({editable:e},t)=>p({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>u({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>D(),"bug-report":(e,t)=>T({},t)},Ce=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=q[n];return r(e,t)}case`open-ended`:{let r=q[n];return r(e,t)}case`single-select`:{let r=q[n];return r(e,t)}case`multi-select`:{let r=q[n];return r(e,t)}case`statement`:{let r=q[n];return r(e,t)}case`bug-report`:{let r=q[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},we=({originalQuestions:e,answers:t,errors:r,pointer:i=-1})=>{if(!e)return{questions:[],currentIndex:-1};let a=e.sort((e,t)=>e.position-t.position).map(e=>{let t={...e},n=r[e.id];return n&&(t.error=n),{...t,visible:!1}});for(let e=0;e<a.length;e++){let r=a[e];if(!r)continue;let o=n({index:e,questions:a,answers:t});r.visible=i===e||o}let o=a.findIndex((e,n)=>n>i&&e.visible&&t[e.id]===void 0);return o===-1&&(o=a.findLastIndex(e=>!!e.visible)),{questions:a,currentIndex:o}},Te=({questions:e,answers:t})=>{let n=Ee({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Ee=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),De=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Oe=({current:e,shouldAutoSubmit:t,onFinished:n,children:r})=>{let{survey:a,submit:o}=d(),[s,c]=H({}),[l,u]=H({}),f=B(()=>we({originalQuestions:a?.questions,answers:s,errors:l,pointer:e}),[a?.questions,s,l,e]),p=B(()=>!!f.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>s[e]!==void 0),[s,f.questions]),[m,h]=H(!1),g=R(({answers:e})=>{o({answers:e}).finally(()=>{n?.()})},[n,o]),_=R(()=>{g({answers:Te({questions:f.questions,answers:s})}),h(!0)},[s,f.questions,g]),v=R(({question:n,answer:r})=>{let i=f.questions.at(n);if(!i)return{error:`Question index is invalid`};let o=Ce(i.properties,{required:i.required}).safeParse(r);if(!o.success){let e=Se(o.error);return u(t=>{if(t[i.id]===e)return t;let n={...t};return n[i.id]=e,n}),c(e=>{if(!(i.id in e))return e;let t={...e};return delete t[i.id],t}),{error:e}}u(e=>{if(!e[i.id])return e;let t={...e};return delete t[i.id],t});let d=!i.required&&!r?null:r,p={...s};if(p[i.id]===d)return{next:we({originalQuestions:a?.questions,answers:p,errors:l,pointer:e}).currentIndex};p[i.id]=d;let m=we({originalQuestions:a?.questions,answers:p,errors:l,pointer:e});return p=Ee({questions:m.questions,answers:p}),c(p),u(De({questions:m.questions,errors:l})),m.questions.filter(({visible:e})=>!!e).every(({id:e})=>p[e]!==void 0)&&t&&(g({answers:Te({questions:m.questions,answers:p})}),h(!0)),{next:m.currentIndex}},[f.questions,s,a?.questions,l,t,e,g]);return f.questions.length===0?W(U,{}):W(`div`,{className:`confetti ${i}`,children:r({questions:f.questions,current:e??f.currentIndex,update:v,isCompleted:p,submit:_,isSubmitted:m,errors:l})})},ke=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>W(_e,{fallback:W(U,{}),children:W(w,{...r,children:W(Oe,{shouldAutoSubmit:n,onFinished:t,children:e})})});function Ae(e,t,n){let r=s(e=>{n&&!e.defaultPrevented&&n(t)});z(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function je(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=f(t);let o=f(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=oe({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Me(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=je(e),s=l([!!t,!!n,r,i]),c=l([!!t,!!n,r,i]);return o=j(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function Ne(e,t,n){let{validationBehavior:r,focus:i}=e;h(()=>{if(r===`native`&&n?.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(Fe(n.current))}});let a=V(!1),o=s(()=>{a.current||t.resetValidation()}),c=s(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Ie(r)===n.current&&(i?i():n.current?.focus(),re(`keyboard`)),e.preventDefault()}),l=s(()=>{t.commitValidation()});z(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&_(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,c),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,c),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function Pe(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function Fe(e){return{isInvalid:!e.validity.valid,validationDetails:Pe(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Ie(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(n.validity?.valid===!1)return n}return null}const Le={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Re={...Le,customError:!0,valid:!1},J={isInvalid:!1,validationDetails:Le,validationErrors:[]},ze=I({}),Be=`__reactAriaFormValidationState`;function Y(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Be];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Ve(e)}function Ve(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:s=`aria`}=e;n&&(t||=n===`invalid`);let c=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:Re},l=B(()=>!o||i==null?null:We(Ue(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=be(ze),d=B(()=>r?Array.isArray(r)?r.flatMap(e=>He(u[e])):He(u[r]):[],[u,r]),[f,p]=H(u),[m,h]=H(!1);u!==f&&(p(u),h(!1));let g=B(()=>We(m?[]:d),[m,d]),_=V(J),[v,y]=H(J),b=V(J),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Ge(e,b.current)||(b.current=e,y(e))},[S,C]=H(!1);return z(x),{realtimeValidation:c||g||l||a||J,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!Ge(v,e)?y(e):_.current=e},resetValidation(){let e=J;Ge(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function He(e){return e?Array.isArray(e)?e:[e]:[]}function Ue(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return He(n)}return[]}function We(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Re}:null}function Ge(e,t){return e===t?!0:!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function Ke(...e){let t=new Set,n=!1,r={...Le};for(let i of e){for(let e of i.validationErrors)t.add(e);n||=i.isInvalid;for(let e in r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function qe(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[l,u]=ue(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=ce(e,t),f=Y({...e,value:l}),{isInvalid:p,validationErrors:m,validationDetails:h}=f.displayValidation,{labelProps:g,fieldProps:v,descriptionProps:y,errorMessageProps:b}=Me({...e,isInvalid:p,errorMessage:e.errorMessage||m}),x=a(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=H(l);return Ae(t,e.defaultValue??C,u),Ne(e,f,t),{labelProps:g,inputProps:j(x,n===`input`?S:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":p||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:l,onChange:e=>u(_(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(F.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...d,...v}),descriptionProps:y,errorMessageProps:b,isInvalid:p,validationErrors:m,validationDetails:h}}function Je(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:c,children:l,"aria-label":u,"aria-labelledby":d,validationState:f=`valid`,isInvalid:p,onPressStart:m,onPressEnd:h,onPressChange:g,onPress:v,onPressUp:y,onClick:b}=e,x=e=>{e.stopPropagation(),t.setSelected(_(e).checked)},{pressProps:S,isPressed:C}=O({onPressStart:m,onPressEnd:h,onPressChange:g,onPress:v,onPressUp:y,onClick:b,isDisabled:r}),{pressProps:w,isPressed:T}=O({onPressStart:m,onPressEnd:h,onPressChange:g,onPressUp:y,onClick:b,onPress(e){v?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:E}=ce(e,n),D=j(S,E),k=a(e,{labelable:!0});return Ae(n,t.defaultSelected,t.setSelected),{labelProps:j(w,{onClick:e=>e.preventDefault()}),inputProps:j(k,{"aria-invalid":p||f===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:x,disabled:r,...o==null?{}:{value:o},name:s,form:c,type:`checkbox`,...D}),isSelected:t.isSelected,isPressed:C||T,isDisabled:r,isReadOnly:i,isInvalid:p||f===`invalid`}}function Ye(e,t,n){let r=Y({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:l,isPressed:u,isDisabled:d,isReadOnly:f}=Je({...e,isInvalid:i},t,n);Ne(e,r,n);let{isIndeterminate:p,isRequired:m,validationBehavior:h=`aria`}=e;z(()=>{n.current&&(n.current.indeterminate=!!p)});let{pressProps:g}=O({isDisabled:d||f,onPress(){let{[Be]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:j(s,g,B(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:l,"aria-required":m&&h===`aria`||void 0,required:m&&h===`native`},isSelected:l,isPressed:u,isDisabled:d,isReadOnly:f,isInvalid:i,validationErrors:a,validationDetails:o}}const Xe=new WeakMap;function Ze(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:o=`aria`}=e,{isInvalid:s,validationErrors:c,validationDetails:l}=t.displayValidation,{labelProps:u,fieldProps:d,descriptionProps:f,errorMessageProps:p}=Me({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});Xe.set(t,{name:r,form:i,descriptionId:f.id,errorMessageId:p.id,validationBehavior:o});let m=a(e,{labelable:!0}),{focusWithinProps:h}=ne({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:j(m,{role:`group`,"aria-disabled":n||void 0,...d,...h}),labelProps:u,descriptionProps:f,errorMessageProps:p,isInvalid:s,validationErrors:c,validationDetails:l}}function Qe(e={}){let{isReadOnly:t}=e,[n,r]=ue(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=H(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function $e(e,t,n){let r=Qe({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=Xe.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=Y({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=V(J),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};z(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=Ye({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[Be]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}const et=new WeakMap;function tt(e,t,n){let{value:r,children:i,"aria-label":o,"aria-labelledby":s,onPressStart:c,onPressEnd:l,onPressChange:u,onPress:d,onPressUp:f,onClick:p}=e,m=e.isDisabled||t.isDisabled,h=t.selectedValue===r,g=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:_,isPressed:v}=O({onPressStart:c,onPressEnd:l,onPressChange:u,onPress:d,onPressUp:f,onClick:p,isDisabled:m}),{pressProps:y,isPressed:b}=O({onPressStart:c,onPressEnd:l,onPressChange:u,onPressUp:f,onClick:p,isDisabled:m,onPress(e){d?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:x}=ce(j(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=j(_,x),C=a(e,{labelable:!0}),w=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(w=0):t.selectedValue===r&&(w=0),m&&(w=void 0);let{name:T,form:E,descriptionId:D,errorMessageId:k,validationBehavior:A}=et.get(t);return Ae(n,t.defaultSelectedValue,t.setSelectedValue),Ne({validationBehavior:A},t,n),{labelProps:j(y,B(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:j(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&A===`native`,checked:h,value:r,onChange:g,"aria-describedby":[e[`aria-describedby`],t.isInvalid?k:null,D].filter(Boolean).join(` `)||void 0}),isDisabled:m,isSelected:h,isPressed:v||b}}function nt(e,t){let{name:n,form:r,isReadOnly:i,isRequired:o,isDisabled:s,orientation:c=`vertical`,validationBehavior:l=`aria`}=e,{direction:u}=me(),{isInvalid:d,validationErrors:p,validationDetails:m}=t.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:v,errorMessageProps:b}=Me({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||p}),x=a(e,{labelable:!0}),{focusWithinProps:S}=ne({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),C=e=>{let n;switch(e.key){case`ArrowRight`:n=u===`rtl`&&c!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=u===`rtl`&&c!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=ie(e.currentTarget,{from:_(e),accept:e=>e instanceof y(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},w=f(n);return et.set(t,{name:w,form:r,descriptionId:v.id,errorMessageId:b.id,validationBehavior:l}),{radioGroupProps:j(x,{role:`radiogroup`,onKeyDown:C,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":o||void 0,"aria-disabled":s||void 0,"aria-orientation":c,...g,...S}),labelProps:h,descriptionProps:v,errorMessageProps:b,isInvalid:d,validationErrors:p,validationDetails:m}}const rt=I({}),X=L(function(e,t){[e,t]=A(e,t,rt);let{elementType:n=`span`,...r}=e,i=N[n];return F.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function it(e={}){let[t,n]=ue(e.value,e.defaultValue||[],e.onChange),[r]=H(t),i=!!e.isRequired&&t.length===0,a=V(new Map),o=Y({...e,value:t}),s=o.displayValidation.isInvalid;return{...o,value:t,defaultValue:e.defaultValue??r,setValue(t){e.isReadOnly||e.isDisabled||n(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(e){return t.includes(e)},addValue(t){e.isReadOnly||e.isDisabled||n(e=>e.includes(t)?e:e.concat(t))},removeValue(r){e.isReadOnly||e.isDisabled||t.includes(r)&&n(t.filter(e=>e!==r))},toggleValue(r){e.isReadOnly||e.isDisabled||(t.includes(r)?n(t.filter(e=>e!==r)):n(t.concat(r)))},setInvalid(e,t){let n=new Map(a.current);t.isInvalid?n.set(e,t):n.delete(e),a.current=n,o.updateValidation(Ke(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let at=Math.round(Math.random()*1e10),ot=0;function st(e){let t=B(()=>e.name||`radio-group-${at}-${++ot}`,[e.name]),[n,r]=ue(e.value,e.defaultValue??null,e.onChange),[i]=H(n),[a,o]=H(null),s=Y({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},l=s.displayValidation.isInvalid;return{...s,name:t,selectedValue:n,defaultSelectedValue:e.value===void 0?e.defaultValue??null:i,setSelectedValue:c,lastFocusedValue:a,setLastFocusedValue:o,isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,validationState:e.validationState||(l?`invalid`:null),isInvalid:l}}const Z=I(null),Q=L(function(e,t){return be(Z)?.isInvalid?F.createElement(ct,{...e,ref:t}):null}),ct=L((e,t)=>{let n=be(Z),r=a(e,{global:!0}),i=P({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:F.createElement(X,{slot:`errorMessage`,...r,...i,ref:t})}),lt=I(null),ut=I(null),dt=I(null),ft=L(function(e,t){[e,t]=A(e,t,ut);let{validationBehavior:n}=c(lt)||{},r=e.validationBehavior??n??`native`,i=it({...e,validationBehavior:r}),[o,s]=S(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:l,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=Ze({...e,label:s,validationBehavior:r},i),m=P({...e,values:{isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:e.isRequired||!1,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-CheckboxGroup`}),h=a(e,{global:!0});return F.createElement(N.div,{...j(h,m,l),ref:t,slot:e.slot||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":i.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},F.createElement(he,{values:[[dt,i],[le,{...u,ref:o,elementType:`span`}],[rt,{slots:{description:d,errorMessage:f}}],[Z,p]]},m.children))}),pt=L(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=A(r,t,ge);let{validationBehavior:i}=c(lt)||{},o=e.validationBehavior??i??`native`,s=be(dt),l=v(B(()=>g(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:u,inputProps:d,isSelected:f,isDisabled:p,isReadOnly:m,isPressed:h,isInvalid:_}=s?$e({...C(e),value:e.value,children:typeof e.children==`function`?!0:e.children},s,l):Ye({...C(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},Qe(e),l),{isFocused:y,isFocusVisible:b,focusProps:x}=te(),S=p||m,{hoverProps:w,isHovered:T}=pe({...e,isDisabled:S}),E=P({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:f,isIndeterminate:e.isIndeterminate||!1,isPressed:h,isHovered:T,isFocused:y,isFocusVisible:b,isDisabled:p,isReadOnly:m,isInvalid:_,isRequired:e.isRequired||!1}}),D=a(e,{global:!0});return delete D.id,delete D.onClick,F.createElement(N.label,{...j(D,u,w,E),ref:t,slot:e.slot||void 0,"data-selected":f||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":h||void 0,"data-hovered":T||void 0,"data-focused":y||void 0,"data-focus-visible":b||void 0,"data-disabled":p||void 0,"data-readonly":m||void 0,"data-invalid":_||void 0,"data-required":e.isRequired||void 0},F.createElement(ee,{elementType:`span`},F.createElement(`input`,{...j(d,x),ref:l})),E.children)}),mt=I({}),ht=I({});let gt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const $=se(function(e,t){[e,t]=A(e,t,ht);let{hoverProps:n,isHovered:r}=pe({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=te({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=P({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return F.createElement(N.input,{...j(gt(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),_t=I(null);function vt(e){let t=V({});return F.createElement(_t.Provider,{value:t},e.children)}const yt=I({isSelected:!1}),bt=I(null),xt=I(null),St=I(null),Ct=L(function(e,t){[e,t]=A(e,t,bt);let{validationBehavior:n}=c(lt)||{},r=e.validationBehavior??n??`native`,i=st({...e,validationBehavior:r}),[o,s]=S(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:l,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=nt({...e,label:s,validationBehavior:r},i),m=P({...e,values:{orientation:e.orientation||`vertical`,isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:i.isRequired,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-RadioGroup`}),h=a(e,{global:!0});return F.createElement(N.div,{...j(h,m,l),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":i.isInvalid||void 0,"data-disabled":i.isDisabled||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":i.isRequired||void 0},F.createElement(he,{values:[[St,i],[le,{...u,ref:o,elementType:`span`}],[rt,{slots:{description:d,errorMessage:f}}],[Z,p]]},F.createElement(vt,null,m.children)))}),wt=L(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=A(r,t,xt);let i=F.useContext(St),o=v(B(()=>g(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:l,isDisabled:u,isPressed:d}=tt({...C(e),children:typeof e.children==`function`?!0:e.children},i,o),{isFocused:f,isFocusVisible:p,focusProps:m}=te(),h=u||i.isReadOnly,{hoverProps:_,isHovered:y}=pe({...e,isDisabled:h}),b=P({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:l,isPressed:d,isHovered:y,isFocused:f,isFocusVisible:p,isDisabled:u,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),x=a(e,{global:!0});return delete x.id,delete x.onClick,F.createElement(N.label,{...j(x,s,_,b),ref:t,"data-selected":l||void 0,"data-pressed":d||void 0,"data-hovered":y||void 0,"data-focused":f||void 0,"data-focus-visible":p||void 0,"data-disabled":u||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},F.createElement(ee,{elementType:`span`},F.createElement(`input`,{...j(c,m),ref:o})),F.createElement(yt.Provider,{value:{isSelected:l}},b.children))}),Tt=I({});let Et=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Dt=L(function(e,t){[e,t]=A(e,t,Tt);let{hoverProps:n,isHovered:r}=pe(e),{isFocused:i,isFocusVisible:a,focusProps:o}=te({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=P({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return F.createElement(N.textarea,{...j(Et(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),Ot=I(null),kt=se(function(e,t){[e,t]=A(e,t,Ot);let{validationBehavior:n}=c(lt)||{},r=e.validationBehavior??n??`native`,i=V(null);[e,i]=A(e,i,x);let[o,s]=S(!e[`aria-label`]&&!e[`aria-labelledby`]),[l,u]=H(`input`),{labelProps:d,inputProps:f,descriptionProps:p,errorMessageProps:m,...h}=qe({...C(e),inputElementType:l,label:s,validationBehavior:r},i),g=R(e=>{i.current=e,e&&u(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),_=P({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:h.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),v=a(e,{global:!0});return delete v.id,F.createElement(N.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":h.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},F.createElement(he,{values:[[le,{...d,ref:o}],[ht,{...f,ref:g}],[Tt,{...f,ref:g}],[mt,{role:`presentation`,isInvalid:h.isInvalid,isDisabled:e.isDisabled||!1}],[rt,{slots:{description:p,errorMessage:m}}],[Z,h]]},_.children))}),At=({onPress:e,isDisabled:t,children:n=`Submit`})=>ae()?null:W(k,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),jt=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},Mt=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),Nt=({onSubmit:t,children:n,question:r,isLastQuestion:i})=>{let[a,o]=H(jt(r.properties.type)),s=B(()=>Ce(r.properties,{required:r.required}),[r.properties,r.required]),c=B(()=>{let e=s.safeParse(a);if(!e.success)return Se(e.error)},[a,s]),l=B(()=>{let t=r.routingLogic;if(t.type!==`always`&&!Mt(a)&&r.required)return!0;let n=t.type===`always`?t.target:t.cases.find(t=>e({answer:a,condition:t}))?.target??t.default;return n.type===`end`?!1:n.type===`next`?!i:!0},[a,i,r.required,r.routingLogic]),u=B(()=>r.properties.buttonLabel?r.properties.buttonLabel:l?!r.required&&!Mt(a)?`Skip`:`Next`:`Submit`,[a,l,r.properties.buttonLabel,r.required]),d=R(()=>{switch(r.properties.type){case`statement`:if(r.properties.buttonUrl&&typeof window<`u`){let e=b.safeParse(r.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return t(void 0);default:return t(a)}},[a,t,r.properties]),f=B(()=>{switch(r.properties.type){case`rating`:case`single-select`:return!!r.properties.shouldAutoProgress;default:return!1}},[r.properties]);return G(U,{children:[n({onChange:R(e=>{o(e),f&&Mt(e)&&s.safeParse(e).success&&t(e)},[f,s,t]),question:r,error:c}),(!f||!r.required)&&W(At,{isDisabled:!!c,onPress:d,children:u})]})},Pt=({isCompleted:e,onSubmit:t,children:n})=>G(U,{children:[n,e&&W(At,{onPress:t})]}),Ft=3e4,It=({maskAllInputs:e}={})=>{let[t,n]=H(null),[i,a]=H(!1),[o,s]=H(null),[c,l]=H(30),u=V(null),d=V(null),f=V(null),p=V([]);z(()=>{let e=new CustomEvent(r,{detail:{isRecording:i}});document.dispatchEvent(e)},[i]);let m=R(()=>{d.current&&=(clearInterval(d.current),null),f.current&&=(clearTimeout(f.current),null),u.current=null,l(Ft/1e3)},[]),h=R(()=>{u.current?.(),m(),a(!1),n(JSON.stringify(p.current))},[m]);return{recordingEventsJson:t,isRecording:i,recordingError:o,remainingSeconds:c,startRecording:R(async()=>{a(!0),s(null),n(null),p.current=[];try{let{record:t}=await import(`./record-BZwNFiEW.js`);u.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{p.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=Ft/1e3;l(n),d.current=setInterval(()=>{--n,l(n)},1e3),f.current=setTimeout(()=>{h()},Ft)}catch{s(`Failed to start recording. Please try again.`),a(!1),m()}},[e,h,m]),stopRecording:h,clear:R(()=>{m(),a(!1),n(null),s(null),p.current=[]},[m])}},Lt=e=>e.replace(/\S/g,`*`),Rt=e=>`*`.repeat(e.length),zt=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):zt(n,t)},Bt=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,Rt(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=Rt(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=Rt(t.textContent)},Vt=({maskInputs:e})=>({name:`cfti-redact`,afterClone:n=>{let{clone:r}=n;if(r instanceof HTMLElement){for(let e of r.querySelectorAll(`.${t}`)){zt(e,e=>{e.data=Lt(e.data)}),Bt(e);for(let t of e.querySelectorAll(`input, textarea, select`))Bt(t)}if(e)for(let e of r.querySelectorAll(`input, textarea, select`))Bt(e)}}}),Ht=({maskAllInputs:e}={})=>{let[t,n]=H(null),[r,a]=H(!1),[o,s]=H(null);return{screenshotDataUrl:t,isCapturing:r,captureError:o,capture:R(async()=>{a(!0),s(null);try{let{snapdom:t}=await import(`./snapdom-BQZEILL6.js`),r=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${i}`],excludeMode:`hide`,plugins:[Vt({maskInputs:!!e})],fast:!1})).toCanvas(),a=window.devicePixelRatio||1,o=Math.min(Math.round(window.innerWidth*a),r.width),s=Math.min(Math.round(window.innerHeight*a),r.height),c=document.createElement(`canvas`);c.width=o,c.height=s;let l=c.getContext(`2d`);if(!l)throw Error(`Failed to get 2D context for cropping`);l.drawImage(r,0,0,o,s,0,0,o,s),n(c.toDataURL(`image/png`))}catch{s(`Failed to capture screenshot. Please try again.`)}finally{a(!1)}},[e]),clear:R(()=>{n(null),s(null)},[])}},Ut=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[W(`circle`,{cx:`12`,cy:`12`,r:`10`}),W(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),Wt=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[W(`path`,{d:`M10 11v6`}),W(`path`,{d:`M14 11v6`}),W(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),W(`path`,{d:`M3 6h18`}),W(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function Gt(){if(window.DD_RUM&&typeof window.DD_RUM?.getInternalContext==`function`&&typeof window.DD_RUM?.getSessionReplayLink==`function`)try{let e=window.DD_RUM?.getInternalContext?.(),t=window.DD_RUM?.getSessionReplayLink?.();return{sessionId:e?.session_id,sessionReplayLink:t}}catch{return null}return null}function Kt(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=Gt();return{userAgent:e.userAgent,screenResolution:`${t.width}x${t.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,language:e.language,timestamp:new Date().toISOString(),datadogTraceId:n?.traceId,datadogSessionId:n?.sessionId,datadogSessionReplayLink:n?.sessionReplayLink}}const qt=ye(()=>import(`./RecordingReplayer-BvU_CHwb.js`)),Jt=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c})=>{let l=B(()=>Kt(),[]),[u,d]=H(``),[f,p]=H(``),{screenshotDataUrl:m,isCapturing:h,captureError:g,capture:_,clear:v}=Ht({maskAllInputs:c}),{recordingEventsJson:y,isRecording:b,recordingError:x,remainingSeconds:S,startRecording:C,stopRecording:w,clear:T}=It({maskAllInputs:c}),E=B(()=>({title:u,...f?{description:f}:{},...m?{screenshotDataUrl:m}:{},...y?{recordingEventsJson:y}:{},metadata:l}),[f,l,y,m,u]);z(()=>{i(E)},[E,i]),z(()=>()=>{w()},[w]);let D=B(()=>y?JSON.parse(y):[],[y]);return W(U,{children:b?G(k,{className:K(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:w,children:[W(Ut,{}),G(`span`,{children:[30-S,`s /`,` `,30,`s`]})]}):G(`div`,{className:K(`cf-bug-report`,s?.base),children:[G(kt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:u,onChange:d,className:K(`cf-question`,s?.question),children:[G(`div`,{className:K(`cf-header`,s?.header),children:[G(M,{className:K(`cf-title`,s?.title),children:[t,!a&&G(`span`,{className:K(`cf-label-optional`,s?.optionalLabel),children:[` `,`(optional)`]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,s?.description),children:n})]}),W($,{placeholder:r.placeholder||`Brief description of the issue`,className:K(`cf-input`,s?.input)})]}),G(kt,{name:`${e}-description`,value:f,onChange:p,className:K(`cf-question`,s?.question),children:[W(M,{className:K(`cf-title`,s?.title),children:r.detailsLabel}),W(Dt,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:K(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?G(`section`,{className:K(`cf-question`,s?.question),children:[W(M,{className:K(`cf-title`,s?.title),children:`Attachments`}),G(`div`,{className:K(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&G(`div`,{className:K(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[m?G(`div`,{className:K(`cf-bug-report-media-preview`,s?.mediaPreview),children:[W(`img`,{src:m,alt:`Screenshot preview`,className:K(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),W(`div`,{className:K(`cf-bug-report-media-actions`,s?.mediaActions),children:W(k,{className:K(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:v,"aria-label":`Remove screenshot`,children:W(Wt,{})})})]}):W(k,{className:K(`cf-bug-report-button`,s?.button),onPress:_,isDisabled:h,children:h?`Capturing...`:`Screenshot`}),g&&W(`div`,{className:K(`cf-error`,s?.error),children:g})]}),r.enableRecording&&G(`div`,{className:K(`cf-bug-report-recording-section`,s?.recordingSection),children:[D.length>0?G(`div`,{className:K(`cf-bug-report-media-preview`,s?.mediaPreview),children:[W(ve,{fallback:W(`span`,{className:K(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":`Loading recording preview...`}),children:W(qt,{events:D})}),W(`div`,{className:K(`cf-bug-report-media-actions`,s?.mediaActions),children:W(k,{className:K(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:T,"aria-label":`Remove recording`,children:W(Wt,{})})})]}):W(k,{className:K(`cf-bug-report-button`,s?.button),onPress:C,children:`Record`}),x&&W(`div`,{className:K(`cf-error`,s?.error),children:x})]})]})]}):null,W(Q,{className:K(`cf-error`,s?.error),children:o})]})})},Yt=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[c,l]=H(``);return z(()=>{i(c)},[i,c]),G(kt,{isRequired:o,isInvalid:!!s,name:e,className:K(`cf-question`,a?.question),value:c,onChange:e=>{l(e),i(e)},children:[G(`div`,{className:K(`cf-header`,a?.header),children:[G(M,{className:K(`cf-title`,a?.title),children:[t,!o&&G(`span`,{className:K(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,a?.description),children:n})]}),W(Dt,{className:K(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),W(Q,{className:K(`cf-error`,a?.error),children:s})]})},Xt=({children:e,classNames:t,description:n,...r})=>W(pt,{...r,children:({isIndeterminate:r})=>G(U,{children:[G(`div`,{className:K(`cf-choice-label`,t?.label),children:[W(`div`,{className:K(`cf-checkbox-indicator`,t?.indicator),children:W(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:K(`cf-checkbox-indicator-svg`,t?.svg),children:r?W(`rect`,{x:1,y:7.5,width:16,height:3}):W(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&W(`span`,{className:K(`cf-choice-description`,t?.choiceDescription),children:n})]})}),Zt=({children:e,classNames:t,...n})=>W(pt,{...n,children:W(`div`,{className:K(`cf-tag-label`,t?.tagLabel),children:e})}),Qt=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let c=!!n.editable,l=n.display??`checkbox`,[u,d]=H([]),[f,p]=H(``),m=V(null),h=V(null),g=B(()=>{let e=u.indexOf(E);if(e===-1)return u;let t=[...u];return t[e]=f||`__CONFETTI_CHECKBOX_Others`,t},[f,u]),_=l===`tag`;return z(()=>{i(g)},[i,g]),W(ft,{isRequired:o,isInvalid:!!s,name:a,value:u,onChange:d,className:K(`cf-question`,r?.question),children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(M,{className:K(`cf-title`,r?.title),children:[e,!o&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:t})]}),G(`div`,{className:K(`cf-response-choices`,l===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>W(_?Zt:Xt,{className:K(`cf-choice`,_&&[`cf-tag`,r?.tag],!_&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.value},t)),c&&(_?G(U,{children:[W(Zt,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:K(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:n.editable?.label}),W($,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:f,onChange:e=>{p(e.target.value)},ref:h,className:K(`cf-input cf-tag-input`,r?.othersInput)})]}):G(`div`,{className:K(`cf-choice cf-others-choice`,r?.othersChoice),children:[W(Xt,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:K(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),W($,{value:f,onChange:e=>{p(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:h,onFocus:()=>{m.current?.checked===!1&&m.current.click()},className:K(`cf-input`,r?.othersInput)})]}))]}),W(Q,{className:K(`cf-error`,r?.error),children:s})]})})},$t=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),en=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),tn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),nn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),rn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),an=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:W(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),on=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:W(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),sn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return W(`div`,{className:K(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return W(wt,{className:K(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:W(o?on:an,{})},t)})})},cn=({properties:e,classNames:t})=>W(`div`,{className:K(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return W(wt,{className:K(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),ln=({properties:e,classNames:t,state:n})=>{let r=B(()=>[$t,tn,nn,rn,en],[]),i=B(()=>[tn,nn,rn],[]);return B(()=>e.scale===3||e.scale===5,[e.scale])?W(`div`,{className:K(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return W(wt,{className:K(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&W(c,{})},a)})}):W(cn,{properties:e,classNames:t,state:n})},un=e=>{switch(e.properties.display??`star`){case`emoji`:return W(ln,{...e});case`number`:return W(cn,{...e});case`star`:return W(sn,{...e})}},dn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[c,l]=H(null),u=B(()=>c?Number(c):void 0,[c]);return z(()=>{i(u)},[i,u]),W(Ct,{isRequired:s,isInvalid:!!o,name:a,className:K(`cf-question`,r?.question),value:c,onChange:l,children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(M,{className:K(`cf-title`,r?.title),children:[t,!s&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:n})]}),G(`div`,{className:K(`cf-rating-section`,r?.ratingSection),children:[W(un,{state:i,properties:e,classNames:r}),G(`div`,{className:K(`cf-rating-text`,r?.ratingText),children:[W(`span`,{className:K(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),W(`span`,{className:K(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),W(Q,{className:K(`cf-error`,r?.error),children:o})]})})},fn=({classNames:e,className:t,description:n,...r})=>W(wt,{...r,className:K(t,e?.radio),children:o(r.children,t=>G(U,{children:[G(`div`,{className:K(`cf-choice-label`,e?.label),children:[W(`div`,{className:K(`cf-radio-indicator`,e?.indicator)}),t]}),n&&W(`span`,{className:K(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),pn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[c,l]=H(null),[u,d]=H(``),f=!!n.editable,p=V(null),m=V(null),h=B(()=>c===`__CONFETTI_RADIO_Others`?u||`__CONFETTI_RADIO_Others`:c??void 0,[u,c]);return z(()=>{i(h)},[i,h]),W(Ct,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{l(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{m.current&&m.current.focus()})},value:c,className:K(`cf-question`,r?.question),children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(M,{className:K(`cf-title`,r?.title),children:[e,!o&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:t})]}),G(`div`,{className:K(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>W(fn,{classNames:{indicator:r?.indicator,radio:K(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),f&&G(`div`,{className:K(`cf-choice cf-others-choice`,r?.othersChoice),children:[W(fn,{inputRef:p,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:K(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),W($,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:m,value:u,onChange:e=>d(e.target.value),onFocus:()=>{p.current?.checked===!1&&p.current.click()},className:K(`cf-input`,r?.othersInput)})]})]}),W(Q,{className:K(`cf-error`,r?.error),children:s})]})})},mn=({properties:e,title:t,description:n,classNames:r})=>W(`div`,{className:K(`cf-question`,r?.question),children:G(`div`,{className:K(`cf-header`,r?.header),children:[t&&W(`div`,{className:K(`cf-title`,r?.title),children:t}),n&&W(`div`,{className:K(`cf-description`,r?.description),children:n})]})}),hn=({question:e,onChange:t,error:n,maskAllInputs:r})=>{switch(e.properties.type){case`rating`:return W(dn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return W(Yt,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return W(pn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return W(Qt,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return W(mn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return W(Jt,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r},e.id)}return W(`div`,{children:`Unsupported question type`},e.id)},gn=({title:e,description:t,classNames:n})=>{let{survey:r,dismiss:i}=d();if(!r)return null;let a=t||r.confirmation.description;return G(U,{children:[W(`div`,{className:K(`cf-question`,n?.question),children:G(`div`,{className:K(`cf-header`,n?.header),children:[W(M,{className:K(`cf-title`,n?.title),children:e||r.confirmation.title||`Feedback submitted!`}),a&&W(X,{slot:`description`,className:K(`cf-description`,n?.description),children:a})]})}),W(k,{className:`cf-submit-button`,onPress:i,children:r.confirmation.buttonText||`Close`})]})},_n=({children:e,classNames:t,containerProps:n,onDismiss:r,closeOnFinishMs:a=3e3})=>{let{surveyId:o,survey:s,dismiss:c}=d(),[l,u]=H(!1),[f,p]=H(!1),[m,h]=H(!1);return xe(()=>{s&&c()},l&&!(f||m)?a:null),G(`div`,{className:K(`confetti-dialog ${i}`,t?.dialog),id:`${o}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),p(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),p(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),h(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||h(!1)},children:[W(fe,{className:K(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await c(),r?.()}}),typeof e==`function`?e({setIsFinished:()=>u(!0)}):e]})},vn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:G(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[W(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),W(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),W(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),W(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),yn=({onClick:e,isWidgetOpen:t,classNames:n,label:r=`Help us improve`})=>t?null:G(k,{onPress:e,className:K(`confetti-trigger`,n?.trigger),children:[W(`span`,{className:K(`confetti-trigger-icon-wrapper`,n?.iconWrapper),"aria-hidden":!0,children:W(vn,{className:K(`confetti-trigger-icon`,n?.icon),width:24})}),W(`span`,{className:K(`confetti-trigger-label`,n?.label),children:r})]});export{hn as a,dn as c,Pt as d,Nt as f,gn as i,Qt as l,Oe as m,vn as n,mn as o,ke as p,_n as r,pn as s,yn as t,Yt as u};
@@ -0,0 +1,11 @@
1
+ import{i as e,r as t,t as n}from"./internals-B5GhpjgM.js";import r,{createContext as i,forwardRef as a,useCallback as o,useContext as s,useEffect as c,useMemo as l,useReducer as u,useRef as d,useState as f}from"react";import{z as p}from"zod/v4/mini";import m from"ky";import{useLocalStorage as h,useTimeout as g}from"usehooks-ts";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import b from"clsx";import x,{flushSync as S}from"react-dom";const C=p.object({type:p.literal(`next`)}),w=p.object({type:p.literal(`end`)}),ee=p.object({type:p.literal(`jump`),target:p.number({error:`Target question is required`})}),T=p.discriminatedUnion(`type`,[C,ee,w]),te=p.object({type:p.literal(`value`),value:p.union([p.string().check(p.trim(),p.minLength(1,{error:`Value is required`})),p.number({error:`Value is required`})])}),ne=p.object({type:p.literal(`binary-operator`),operator:p.union([p.literal(`equal`),p.literal(`not-equal`),p.literal(`greater`),p.literal(`greater-or-equal`),p.literal(`less`),p.literal(`less-or-equal`),p.literal(`contains`),p.literal(`not-contains`)]),value:te,target:T}),E=p.object({type:p.literal(`switch`),cases:p.array(ne),default:T}),re=p.object({type:p.literal(`always`),target:T}),ie=p.discriminatedUnion(`type`,[re,E]),ae=p.string().check(p.trim(),p.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),D=p.optional(p.string().check(p.trim(),p.maxLength(50))),oe=p.object({value:p.string().check(p.trim(),p.minLength(1,{error:`Value is required`})),description:p.optional(p.string().check(p.trim()))}),se=p.nullable(p.object({label:p.string().check(p.trim(),p.minLength(1,{error:`Value is required`})),max:p.number(),description:p.optional(p.string().check(p.trim()))})),ce=p.optional(p.boolean()),le=p.object({type:p.literal(`rating`),buttonLabel:D,shouldAutoProgress:ce,scale:p.number().check(p.minimum(2),p.maximum(10)),labels:p.optional(p.object({lower:p.optional(p.pipe(p.string().check(p.trim()),p.transform(e=>e===``?void 0:e))),upper:p.optional(p.pipe(p.string().check(p.trim()),p.transform(e=>e===``?void 0:e)))})),display:p.optional(p.literal([`star`,`emoji`,`number`]))}),ue=p.object({type:p.literal(`open-ended`),placeholder:p.optional(p.string()),buttonLabel:D,max:p.number()}),de=p.object({type:p.literal(`single-select`),shouldAutoProgress:ce,options:p.array(oe),buttonLabel:D,editable:se}),fe=p.object({type:p.literal(`multi-select`),buttonLabel:D,options:p.array(oe),editable:se,max:p.optional(p.number()),display:p.optional(p.literal([`checkbox`,`tag`]))}),pe=p.object({type:p.literal(`statement`),buttonLabel:D,buttonUrl:p.optional(ae)}),me=p.object({type:p.literal(`bug-report`),placeholder:p.optional(p.string()),buttonLabel:D,enableScreenshot:p.boolean(),enableRecording:p.boolean(),detailsLabel:p.string().check(p.trim(),p.minLength(1,{error:`Label is required`}),p.maxLength(128)),detailsPlaceholder:p.optional(p.string()),redactClasses:p.optional(p.array(p.string()))}),he=p.discriminatedUnion(`type`,[le,de,ue,fe,pe,me]),ge=`__CONFETTI_CHECKBOX_Others`,_e=`__CONFETTI_RADIO_Others`,ve=p.optional(p.catchall(p.partial(p.looseObject({userAgent:p.string().check(p.trim(),p.maxLength(1e3)),screenResolution:p.string().check(p.trim(),p.maxLength(100)),viewportSize:p.string().check(p.trim(),p.maxLength(100)),pageUrl:p.string(),pageTitle:p.string().check(p.trim(),p.maxLength(1e3)),referrer:p.string(),datadogTraceId:p.optional(p.string()),datadogSessionId:p.optional(p.string()),datadogSessionReplayLink:p.optional(p.string())})),p.optional(p.string())));p.cuid2();const ye=p.looseObject({type:p.literal([0,1,2,3,4,5,6]),data:p.unknown(),timestamp:p.number(),delay:p.optional(p.number())});p.array(ye);const be=p.array(ye),xe=p.string().check(p.refine(e=>{try{return be.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),Se=p.string().check(p.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),Ce=e=>p.object({title:p.string().check(p.trim(),...e?[p.minLength(1,{error:`Title is required`})]:[],p.maxLength(256)),description:p.optional(p.string().check(p.trim(),p.maxLength(4096))),screenshotDataUrl:p.optional(Se),recordingEventsJson:p.optional(xe),metadata:ve}),we=Ce(!0),Te=(e,{required:t})=>Ce(t),Ee=e=>p.number().check(p.int(),p.minimum(1),p.maximum(e)),De=({scale:e},{required:t})=>{let n=Ee(e);return t?n:p.optional(n)},Oe=({maxLength:e},{required:t})=>p.string().check(p.trim(),...t?[p.minLength(1,{error:`This field is required`})]:[],p.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),ke=(e,t)=>p.string().check(p.trim(),...t?[p.minLength(1,{error:`This field is required`})]:[],p.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),p.refine(e=>e!==_e,{error:`Please fill out the free text field`})),Ae=({maxLength:e},{required:t})=>{let n=ke(e,t);return t?n:p.optional(n)},je=({maxSelected:e,maxLength:t},{required:n})=>p.array(p.string().check(p.trim(),...n?[p.minLength(1,{error:`This field is required`})]:[],p.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),p.refine(e=>e!==ge,{error:`Please fill out the free text field`}))).check(...n?[p.minLength(1,{error:`Please select at least one option`})]:[],p.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),Me=()=>p.optional(p.string()),Ne=p.cuid2(),Pe=p.object({title:p.string().check(p.trim()),description:p.string().check(p.trim()),buttonText:p.string().check(p.trim())}),Fe=p.object({title:p.string(),description:p.nullable(p.string()),questions:p.array(p.object({id:p.string(),title:p.string(),description:p.nullable(p.string()),position:p.number(),required:p.boolean(),properties:he,routingLogic:ie})),confirmation:Pe});p.object({surveyId:Ne,responseId:p.union([p.cuid2(),p.uuid()])});const Ie=p.catch(p.partial(p.object({type:p.enum([`embedded`,`popover`,`modal`]),version:p.string().check(p.trim(),p.minLength(1),p.maxLength(50)),build:p.string().check(p.trim(),p.minLength(1),p.maxLength(50))})),{});p.object({respondent:p.string().check(p.trim(),p.minLength(1),p.maxLength(2048)),data:p.record(p.string(),p.union([p.string().check(p.trim(),p.maxLength(2048)),p.number(),p.array(p.string().check(p.trim(),p.maxLength(2048))).check(p.maxLength(1024)),we])),metadata:p.record(p.string().check(p.trim(),p.maxLength(1e3)),p.string().check(p.trim(),p.maxLength(1e3))),telemetry:p.optional(Ie)}),p.object({surveyId:Ne,respondent:p.string().check(p.trim(),p.minLength(1),p.maxLength(2048))}),p.object({surveyId:Ne,respondent:p.string().check(p.trim(),p.minLength(1),p.maxLength(2048))}),p.object({surveyId:Ne});const Le=p.object({lastRespondedAt:p.nullable(p.union([p.iso.datetime(),p.date()])),lastViewedAt:p.nullable(p.union([p.iso.datetime(),p.date()])),lastDismissedAt:p.nullable(p.union([p.iso.datetime(),p.date()]))});p.object({type:p.enum([`view`,`dismiss`])});const Re=m.create({prefixUrl:`https://confetti.gov.sg/api`,retry:{limit:3,methods:[`get`]},timeout:6e4});function ze({publishableKey:e,apiBaseUrl:t}){return l(()=>{let n={headers:{"x-cfti-pk":e}};return t&&(n.prefixUrl=t),Re.extend(n)},[t,e])}function Be({surveyId:e,override:t}){let[n,r]=h(`cfti:${e}:respondent`,``);return c(()=>{n||r(crypto.randomUUID())},[n,r]),t||n}const Ve={lastRespondedAt:null,lastDismissedAt:null};async function He({client:e,surveyId:t,respondent:n,signal:r}){try{let i=await e.get(`v1/cfti/${t}/respondent/${n}`,{signal:r}).json(),a=Le.safeParse(i);return a.success?{lastRespondedAt:a.data.lastRespondedAt?new Date(a.data.lastRespondedAt):null,lastDismissedAt:a.data.lastDismissedAt?new Date(a.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,a.error),Ve)}catch{return Ve}}function Ue({client:e,surveyId:t,respondent:n}){let[r,i]=f(Ve),[a,o]=f(!1),[s,l]=f({client:e,surveyId:t,respondent:n});return(s.client!==e||s.surveyId!==t||s.respondent!==n)&&(l({client:e,surveyId:t,respondent:n}),i(Ve),o(!1)),c(()=>{if(!n||typeof window>`u`||typeof document>`u`)return;let r=null,a=()=>{r?.abort(),r=new AbortController;let a=r;He({client:e,surveyId:t,respondent:n,signal:a.signal}).then(e=>{a.signal.aborted||(i(e),o(!0))})};a();let s=()=>{document.visibilityState===`visible`&&a()};return document.addEventListener(`visibilitychange`,s),()=>{r?.abort(),document.removeEventListener(`visibilitychange`,s)}},[e,t,n]),{state:r,isSettled:a}}function We(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}const Ge=i({}),Ke=()=>s(Ge),qe=i({}),Je=({type:e,children:t})=>{let n=l(()=>({type:e}),[e]);return v(qe.Provider,{value:n,children:t})},Ye=()=>s(qe),Xe=i(null),Ze=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},isSurveyVisible:a,apiBaseUrl:s,alwaysRenderChildren:u})=>{let{type:p}=Ye(),m=Ke(),h=m.version??`0.4.0`,g=m.build,_=d(!1),[y,b]=f(),[x,S]=f(!1),C=Be({surveyId:t,override:r}),w=ze({publishableKey:n,apiBaseUrl:s}),{state:ee,isSettled:T}=Ue({client:w,surveyId:t,respondent:C});c(()=>{(async()=>{_.current=!1,S(!1),b(void 0);try{let e=await w.get(`v1/cfti/${t}`).json(),n=Fe.safeParse(e);if(!n.success)return;b(n.data)}catch{}finally{S(!0)}})()},[w,t]);let te=o(async({answers:e})=>{let n=crypto.randomUUID();await w.put(`v1/cfti/${t}/response/${n}`,{json:{respondent:C,data:e,metadata:i,telemetry:{...p!==void 0&&{type:p},version:h,...g&&{build:g}}}})},[g,w,i,C,t,h,p]),ne=o(()=>{u||b(void 0),w.post(`v1/cfti/${t}/respondent/${C}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[u,w,C,t]),E=l(()=>!x||!T?!1:We(ee,a),[x,T,a,ee]);c(()=>{_.current||E&&y&&C&&(_.current=!0,w.post(`v1/cfti/${t}/respondent/${C}/event`,{json:{type:`view`}}).catch(()=>{}))},[w,E,C,y,t]);let re=E&&!!y;return!u&&!re?null:v(Xe.Provider,{value:{submit:te,dismiss:ne,surveyId:t,survey:y,metadata:i,isVisible:re},children:e})},Qe=e=>s(Xe)?v(_,{children:e.children}):v(Ze,{...e,surveyId:e.surveyId,publishableKey:e.publishableKey}),$e=()=>{let e=s(Xe);if(!e)throw Error(`useConfetti must be used within a ConfettiProvider`);return e},et=i(null);i(null),i(null),i(null),i(null);const tt=i({});i(null);const nt=i(null);function rt(e){if(typeof window>`u`||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function it(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function O(e){let t=null;return()=>(t??=e(),t)}const at=O(function(){return it(/^Mac/i)}),ot=O(function(){return it(/^iPhone/i)}),st=O(function(){return it(/^iPad/i)||at()&&navigator.maxTouchPoints>1}),ct=O(function(){return ot()||st()}),lt=O(function(){return rt(/AppleWebKit/i)&&!ut()}),ut=O(function(){return rt(/Chrome/i)}),dt=O(function(){return rt(/Android/i)}),ft=O(function(){return rt(/Firefox/i)});function pt(e){if(ht())e.focus({preventScroll:!0});else{let t=gt(e);e.focus(),_t(t)}}let mt=null;function ht(){if(mt==null){mt=!1;try{document.createElement(`div`).focus({get preventScroll(){return mt=!0,!0}})}catch{}}return mt}function gt(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function _t(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function k(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;ft()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(at()?r=!0:i=!0);let s=lt()&&at()&&!st()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}):new MouseEvent(`click`,{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o,detail:1,bubbles:!0,cancelable:!0});k.isOpening=n,pt(e),e.dispatchEvent(s),k.isOpening=!1}k.isOpening=!1;const A=typeof document<`u`?r.useLayoutEffect:()=>{},vt={prefix:String(Math.round(Math.random()*1e10)),current:0},yt=r.createContext(vt),bt=r.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let xt=new WeakMap;function St(e=!1){let t=s(yt),n=d(null);if(n.current===null&&!e){let e=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(e){let n=xt.get(e);n==null?xt.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,xt.delete(e))}n.current=++t.current}return n.current}function Ct(e){let t=s(yt),n=St(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function wt(e){let t=r.useId(),[n]=f(kt()),i=n?`react-aria`:`react-aria${vt.prefix}`;return e||`${i}-${t}`}const Tt=typeof r.useId==`function`?wt:Ct;function Et(){return!1}function Dt(){return!0}function Ot(e){return()=>{}}function kt(){return typeof r.useSyncExternalStore==`function`?r.useSyncExternalStore(Ot,Et,Dt):s(bt)}function At(e){let[t,n]=f(e),r=d(t),i=d(null),a=d(()=>{if(!i.current)return;let e=i.current.next();if(e.done){i.current=null;return}r.current===e.value?a.current():n(e.value)});return A(()=>{r.current=t,i.current&&a.current()}),[t,o(e=>{i.current=e(r.current),a.current()},[a])]}let jt=!!(typeof window<`u`&&window.document&&window.document.createElement),Mt=new Map,Nt;typeof FinalizationRegistry<`u`&&(Nt=new FinalizationRegistry(e=>{Mt.delete(e)}));function Pt(e){let[t,n]=f(e),r=d(null),i=Tt(t),a=d(null);if(Nt&&Nt.register(a,i),jt){let e=Mt.get(i);e&&!e.includes(r)?e.push(r):Mt.set(i,[r])}return A(()=>{let e=i;return()=>{Nt&&Nt.unregister(a),Mt.delete(e)}},[i]),c(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function Ft(e,t){if(e===t)return e;let n=Mt.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=Mt.get(t);return r?(r.forEach(t=>t.current=e),e):t}function It(e=[]){let t=Pt(),[n,r]=At(t),i=o(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return A(i,[t,i,...e]),n}function Lt(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const j=e=>e?.ownerDocument??document,M=e=>e&&`window`in e&&e.window===e?e:j(e).defaultView||window;function Rt(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function zt(e){return Rt(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function N(){return!1}function P(e,t){if(!N())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=n.tagName===`SLOT`&&n.assignedSlot?n.assignedSlot.parentNode:zt(n)?n.host:n.parentNode}return!1}const F=(e=document)=>{if(!N())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function I(e){if(N()&&e.target instanceof Element&&e.target.shadowRoot){if(`composedPath`in e)return e.composedPath()[0]??null;if(`composedPath`in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function Bt(e){if(!e)return!1;let t=e.getRootNode(),n=M(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}var Vt=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}else if(typeof this.filter==`function`)return this.filter(e);else if(this.filter?.acceptNode)return this.filter.acceptNode(e);else if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(e){if(!P(this.root,e))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let t=[],n=e,r=e;for(this._currentNode=e;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=n,i=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),n=r=e.host}else n=n.parentNode;let i=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return P(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}else return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Ht(e,t,n,r){return N()?new Vt(e,t,n,r):e.createTreeWalker(t,n,r)}function Ut(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=Wt(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():Wt(e[n],null)})}}}function Wt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function L(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],i=r[e];typeof n==`function`&&typeof i==`function`&&e[0]===`o`&&e[1]===`n`&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=Lt(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=b(n,i):e===`id`&&n&&i?t.id=Ft(n,i):e===`ref`&&n&&i?t.ref=Ut(n,i):t[e]=i===void 0?n:i}}return t}const Gt=new Set([`id`]),Kt=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),qt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),Jt=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),Yt=new Set(`onClick.onAuxClick.onContextMenu.onDoubleClick.onMouseDown.onMouseEnter.onMouseLeave.onMouseMove.onMouseOut.onMouseOver.onMouseUp.onTouchCancel.onTouchEnd.onTouchMove.onTouchStart.onPointerDown.onPointerMove.onPointerUp.onPointerCancel.onPointerEnter.onPointerLeave.onPointerOver.onPointerOut.onGotPointerCapture.onLostPointerCapture.onScroll.onWheel.onAnimationStart.onAnimationEnd.onAnimationIteration.onTransitionCancel.onTransitionEnd.onTransitionRun.onTransitionStart`.split(`.`)),Xt=/^(data-.*)$/;function R(e,t={}){let{labelable:n,isLink:r,global:i,events:a=i,propNames:o}=t,s={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Gt.has(t)||n&&Kt.has(t)||r&&qt.has(t)||i&&Jt.has(t)||a&&(Yt.has(t)||t.endsWith(`Capture`)&&Yt.has(t.slice(0,-7)))||o?.has(t)||Xt.test(t))&&(s[t]=e[t]);return s}let z=new Map,Zt=new Set;function Qt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=I(t);if(!e(t)||!r)return;let i=z.get(r);i||(i=new Set,z.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=I(t);if(!e(t)||!r)return;let i=z.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),z.delete(r)),z.size===0)){for(let e of Zt)e();Zt.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Qt):Qt());function $t(){for(let[e]of z)`isConnected`in e&&!e.isConnected&&z.delete(e)}function en(e){requestAnimationFrame(()=>{$t(),z.size===0?e():Zt.add(e)})}function tn(){let e=d(new Map),t=o((t,n,r,i)=>{let a=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,a,i)},[]),n=o((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),r=o(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return c(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function nn(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=Pt(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function rn(e){let t=d(null),n=d(void 0),r=o(t=>{if(typeof e==`function`){let n=e,r=n(t);return()=>{typeof r==`function`?r():n(null)}}else if(e)return e.current=t,()=>{e.current=null}},[e]);return l(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=r(e))}}),[r])}const an=r.useInsertionEffect??A;function on(e){let t=d(null);return an(()=>{t.current=e},[e]),o((...e)=>{let n=t.current;return n?.(...e)},[])}function sn(e,t){A(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function cn(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function ln(e,t){let n=e;for(cn(n,t)&&(n=n.parentElement);n&&!cn(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const un=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function dn(e){return e instanceof HTMLInputElement&&!un.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let B=typeof document<`u`&&window.visualViewport;function fn(){let e=kt(),[t,n]=f(()=>e?{width:0,height:0}:pn());return c(()=>{let e=e=>{n(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{B&&B.scale>1||e(pn())},r,i=t=>{B&&B.scale>1||dn(I(t))&&(r=requestAnimationFrame(()=>{let t=F();(!t||!dn(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(pn()),ct()&&window.addEventListener(`blur`,i,!0),B?B.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(r),ct()&&window.removeEventListener(`blur`,i,!0),B?B.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),t}function pn(){return{width:B?Math.min(B.width*B.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:B?B.height*B.scale:document.documentElement.clientHeight}}function mn(e){return e.pointerType===``&&e.isTrusted?!0:dt()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function hn(e){return!dt()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function gn(e,t=!0){let[n,r]=f(!0),i=n&&t;return A(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),vn(e,i,o(()=>r(!1),[])),i}function _n(e,t){let[n,r]=f(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return vn(e,i,o(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function vn(e,t,n){A(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||S(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const yn=typeof Element<`u`&&`checkVisibility`in Element.prototype;function bn(e){let t=M(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function xn(e,t){return!e.hasAttribute(`hidden`)&&!e.hasAttribute(`data-react-aria-prevent-focus`)&&(e.nodeName===`DETAILS`&&t&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0)}function Sn(e,t){return yn?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&bn(e)&&xn(e,t)&&(!e.parentElement||Sn(e.parentElement,e))}const Cn=[`input:not([disabled]):not([type=hidden])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`a[href]`,`area[href]`,`summary`,`iframe`,`object`,`embed`,`audio[controls]`,`video[controls]`,`[contenteditable]:not([contenteditable^="false"])`,`permission`],wn=Cn.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;Cn.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const Tn=Cn.join(`:not([hidden]):not([tabindex="-1"]),`);function En(e,t){return e.matches(wn)&&!On(e)&&(t?.skipVisibilityCheck||Sn(e))}function Dn(e){return e.matches(Tn)&&Sn(e)&&!On(e)}function On(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function kn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let An=new WeakMap;function jn(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return kn(t);if(An.has(t))return An.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof M(n).HTMLMetaElement&&(n.nonce||n.content)||kn(t)||void 0;return r!==void 0&&An.set(t,r),r}const Mn=Symbol(`default`);function Nn({values:e,children:t}){for(let[n,i]of e)t=r.createElement(n.Provider,{value:i},t);return t}function Pn(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:o,values:s,render:c}=e;return l(()=>{let e,l,u;return e=typeof t==`function`?t({...s,defaultClassName:i}):t,l=typeof n==`function`?n({...s,defaultStyle:o||{}}):n,u=typeof r==`function`?r({...s,defaultChildren:a}):r??a,{className:e??i,style:l||o?{...o,...l}:void 0,children:u??a,"data-rac":``,render:c?e=>c(e,s):void 0}},[t,n,r,i,a,o,s,c])}function Fn(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function In(e,t){let n=s(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||Mn;if(!n.slots[e]){let e=new Intl.ListFormat().format(Object.keys(n.slots).map(e=>`"${e}"`)),r=t?`Invalid slot "${t}".`:`A slot prop is required.`;throw Error(`${r} Valid slot names are ${e}.`)}return n.slots[e]}return n}function Ln(e,t,n){let{ref:r,...i}=In(n,e.slot)||{},a=rn(l(()=>Ut(t,r),[t,r])),o=L(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?o.style=t=>{let n=typeof i.style==`function`?i.style(t):i.style,r={...t.defaultStyle,...n},a=typeof e.style==`function`?e.style({...t,defaultStyle:r}):e.style;return{...r,...a}}:o.style={...i.style,...e.style}),[o,a]}function Rn(e=!0){let[t,n]=f(e),r=d(!1),i=o(e=>{r.current=!0,n(!!e)},[]);return A(()=>{r.current||n(!1)},[]),[i,t]}function zn(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function Bn(e,t,n){let{render:i,...a}=t,o=d(null),s=l(()=>Ut(n,o),[n,o]);A(()=>{},[e,i]);let c={...a,ref:s};return i?i(c,void 0):r.createElement(e,c)}const Vn={},Hn=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let n=Vn[t];return n||(n=a(Bn.bind(null,t)),Vn[t]=n),n}}),Un=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Wn(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let Gn=new WeakMap,V=[];function Kn(e,t){let n=M(e?.[0]),r=t instanceof n.Element?{root:t}:t,i=r?.root??document.body,a=r?.shouldUseInert&&Un,o=new Set(e),s=new Set,c=e=>a&&e instanceof n.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,l=(e,t)=>{a&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof n.HTMLElement&&(e.inert=!1))},u=new Set;if(N())for(let t of e){let e=t;for(;e&&e!==i;){let t=e.getRootNode();`shadowRoot`in t&&u.add(t.shadowRoot),e=t.parentNode}}let d=e=>{for(let t of e.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))o.add(t);let t=e=>{if(s.has(e)||o.has(e)||e.parentElement&&s.has(e.parentElement)&&e.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let t of o)if(P(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=Ht(j(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&f(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;e!=null;)f(e),e=n.nextNode()}},f=e=>{let t=Gn.get(e)??0;c(e)&&t===0||(t===0&&l(e,!0),s.add(e),Gn.set(e,t+1))};V.length&&V[V.length-1].disconnect(),d(i);let p=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...o,...s].some(e=>P(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Wn(e)?o.add(e):e instanceof Element&&d(e);if(N()){for(let e of u)if(!e.isConnected){p.disconnect();break}}}});p.observe(i,{childList:!0,subtree:!0});let m=new Set;if(N())for(let e of u){let t=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...o,...s].some(e=>P(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Wn(e)?o.add(e):e instanceof Element&&d(e);if(N()){for(let e of u)if(!e.isConnected){p.disconnect();break}}}});t.observe(e,{childList:!0,subtree:!0}),m.add(t)}let h={visibleNodes:o,hiddenNodes:s,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}};return V.push(h),()=>{if(p.disconnect(),N())for(let e of m)e.disconnect();for(let e of s){let t=Gn.get(e);t!=null&&(t===1?(l(e,!1),Gn.delete(e)):Gn.set(e,t-1))}h===V[V.length-1]?(V.pop(),V.length&&V[V.length-1].observe()):V.splice(V.indexOf(h),1)}}const qn=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Jn=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Yn(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n=typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo;if(n)return n.direction===`rtl`;if(t.script)return qn.has(t.script)}let t=e.split(`-`)[0];return Jn.has(t)}const Xn=Symbol.for(`react-aria.i18n.locale`);function Zn(){let e=typeof window<`u`&&window[Xn]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Yn(e)?`rtl`:`ltr`}}let Qn=Zn(),$n=new Set;function er(){Qn=Zn();for(let e of $n)e(Qn)}function tr(){let e=kt(),[t,n]=f(Qn);return c(()=>($n.size===0&&window.addEventListener(`languagechange`,er),$n.add(n),()=>{$n.delete(n),$n.size===0&&window.removeEventListener(`languagechange`,er)}),[]),e?{locale:typeof window<`u`&&window[Xn]||`en-US`,direction:`ltr`}:t}const nr=r.createContext(null);function rr(){let e=tr();return s(nr)||e}const ir=Symbol.for(`react-aria.i18n.locale`),ar=Symbol.for(`react-aria.i18n.strings`);let or;var sr=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=cr(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[ir];if(or===void 0){let t=window[ar];if(!t)return null;or={};for(let r in t)or[r]=new e({[n]:t[r]},n)}let r=or?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function cr(e,t,n=`en-US`){if(t[e])return t[e];let r=lr(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function lr(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const ur=new Map,dr=new Map;var fr=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=ur.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),ur.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=dr.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),dr.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const pr=new WeakMap;function mr(e){let t=pr.get(e);return t||(t=new sr(e),pr.set(e,t)),t}function hr(e,t){return t&&sr.getGlobalDictionaryForPackage(t)||mr(e)}function gr(e,t){let{locale:n}=rr(),r=hr(e,t);return l(()=>new fr(n,r),[n,r])}function _r(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function vr(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function yr(e){let t=d({isFocused:!1,observer:null});return A(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),o(n=>{let r=I(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r;n.addEventListener(`focusout`,r=>{if(t.current.isFocused=!1,n.disabled){let t=_r(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===F()?null:F();n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:e})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}let br=!1;function xr(e){for(;e&&!En(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=M(e),n=t.document.activeElement;if(!n||n===e)return;br=!0;let r=!1,i=e=>{(I(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(I(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,pt(n),c()))},o=t=>{(I(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(I(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,pt(n),c()))};t.addEventListener(`blur`,i,!0),t.addEventListener(`focusout`,a,!0),t.addEventListener(`focusin`,s,!0),t.addEventListener(`focus`,o,!0);let c=()=>{cancelAnimationFrame(l),t.removeEventListener(`blur`,i,!0),t.removeEventListener(`focusout`,a,!0),t.removeEventListener(`focusin`,s,!0),t.removeEventListener(`focus`,o,!0),br=!1,r=!1},l=requestAnimationFrame(c);return c}let Sr=`default`,Cr=``,wr=new WeakMap;function Tr(e){if(ct()){if(Sr==="default"){let t=j(e);Cr=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}Sr=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;wr.set(e,e.style[t]),e.style[t]=`none`}}function Er(e){if(ct()){if(Sr!==`disabled`)return;Sr=`restoring`,setTimeout(()=>{en(()=>{if(Sr===`restoring`){let t=j(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=Cr||``),Cr=``,Sr=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&wr.has(e)){let t=wr.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),wr.delete(e)}}const Dr=r.createContext({register:()=>{}});Dr.displayName=`PressResponderContext`;function Or(e){let t=s(Dr);if(t){let{register:n,ref:r,...i}=t;e=L(i,e),n()}return sn(t,e.ref),e}var kr=class{#e;constructor(e,t,n,r){this.#e=!0;let i=(r?.target??n.currentTarget)?.getBoundingClientRect(),a,o=0,s,c=null;n.clientX!=null&&n.clientY!=null&&(s=n.clientX,c=n.clientY),i&&(s!=null&&c!=null?(a=s-i.left,o=c-i.top):(a=i.width/2,o=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=a,this.y=o,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}};const Ar=Symbol(`linkClicked`),jr=`react-aria-pressable-style`,Mr=`data-react-aria-pressable`;function Nr(e){let{onPress:t,onPressChange:n,onPressStart:r,onPressEnd:i,onPressUp:a,onClick:s,isDisabled:u,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:g,ref:_,...v}=Or(e),[y,b]=f(!1),x=d({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:C}=tn(),w=o((e,t)=>{let i=x.current;if(u||i.didFirePressStart)return!1;let a=!0;if(i.isTriggeringEvent=!0,r){let n=new kr(`pressstart`,t,e);r(n),a=n.shouldStopPropagation}return n&&n(!0),i.isTriggeringEvent=!1,i.didFirePressStart=!0,b(!0),a},[u,r,n]),ee=o((e,r,a=!0)=>{let o=x.current;if(!o.didFirePressStart)return!1;o.didFirePressStart=!1,o.isTriggeringEvent=!0;let s=!0;if(i){let t=new kr(`pressend`,r,e);i(t),s=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&a&&!u){let n=new kr(`press`,r,e);t(n),s&&=n.shouldStopPropagation}return o.isTriggeringEvent=!1,s},[u,i,n,t]),T=on(ee),te=on(o((e,t)=>{let n=x.current;if(u)return!1;if(a){n.isTriggeringEvent=!0;let r=new kr(`pressup`,t,e);return a(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[u,a])),ne=o(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&ee(H(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||Er(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,ee]),E=on(ne),re=o(e=>{h&&ne(e)},[h,ne]),ie=o(e=>{u||s?.(e)},[u,s]),ae=o((e,t)=>{if(!u&&s){let n=new MouseEvent(`click`,e);vr(n,t),s(_r(n))}},[u,s]),D=l(()=>{let e=x.current,t={onKeyDown(t){if(Fr(t.nativeEvent,t.currentTarget)&&P(t.currentTarget,I(t))){Lr(I(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=w(t,`keyboard`));let i=t.currentTarget;S(j(t.currentTarget),`keyup`,Lt(t=>{Fr(t,i)&&!t.repeat&&P(i,I(t))&&e.target&&te(H(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&at()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!P(t.currentTarget,I(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!k.isOpening){let n=!0;if(u&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||mn(t.nativeEvent))){let e=w(t,`virtual`),r=te(t,`virtual`),i=T(t,`virtual`);ie(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=te(H(t.currentTarget,t),r),a=T(H(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,ie(t),E(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&Fr(t,e.target)){Lr(I(t),t.key)&&t.preventDefault();let n=I(t),r=P(e.target,n);T(H(e.target,t),`keyboard`,r),r&&ae(t,e.target),C(),t.key!==`Enter`&&Pr(e.target)&&P(e.target,n)&&!t[Ar]&&(t[Ar]=!0,k(e.target,t,!1)),e.isPressed=!1,e.metaKeyEvents?.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())e.target?.dispatchEvent(new KeyboardEvent(`keyup`,n))}};if(typeof PointerEvent<`u`){t.onPointerDown=t=>{if(t.button!==0||!P(t.currentTarget,I(t)))return;if(hn(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let i=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,g||Tr(e.target),i=w(t,e.pointerType);let a=I(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(j(t.currentTarget),`pointerup`,n,!1),S(j(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(P(t.currentTarget,I(t))&&t.button===0){if(m){let n=xr(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!P(t.currentTarget,I(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&te(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,w(H(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,T(H(e.target,t),e.pointerType,!1),re(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(P(e.target,I(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?E(t):(pt(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else E(t);e.isOverTarget=!1}},r=e=>{E(e)};t.onDragStart=e=>{P(e.currentTarget,I(e))&&E(e)}}return t},[S,u,m,C,g,re,w,ie,ae]);return c(()=>{if(!_)return;let e=j(_.current);if(!e||!e.head||e.getElementById(jr))return;let t=e.createElement(`style`);t.id=jr;let n=jn(e);n&&(t.nonce=n),t.textContent=`
2
+ @layer {
3
+ [${Mr}] {
4
+ touch-action: pan-x pan-y pinch-zoom;
5
+ }
6
+ }
7
+ `.trim(),e.head.prepend(t)},[_]),c(()=>{let e=x.current;return()=>{g||Er(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:L(v,D,{[Mr]:!0})}}function Pr(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function Fr(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof M(i).HTMLInputElement&&!zr(i,n)||i instanceof M(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&Pr(i))&&n!==`Enter`)}function H(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function Ir(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!Pr(e)}function Lr(e,t){return e instanceof HTMLInputElement?!zr(e,t):Ir(e)}const Rr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function zr(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Rr.has(e.type)}let U=null;const Br=new Set;let Vr=new Map,W=!1,Hr=!1;const Ur={Tab:!0,Escape:!0};function Wr(e,t){for(let n of Br)n(e,t)}function Gr(e){return!(e.metaKey||!at()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Kr(e){W=!0,!k.isOpening&&Gr(e)&&(U=`keyboard`,Wr(`keyboard`,e))}function qr(e){U=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(W=!0,Wr(`pointer`,e))}function Jr(e){!k.isOpening&&mn(e)&&(W=!0,U=`virtual`)}function Yr(e){let t=M(I(e)),n=j(I(e));I(e)===t||I(e)===n||br||!e.isTrusted||(!W&&!Hr&&(U=`virtual`,Wr(`virtual`,e)),W=!1,Hr=!1)}function Xr(){br||(W=!1,Hr=!0)}function Zr(e){if(typeof window>`u`||typeof document>`u`)return;let t=M(e),n=j(e);if(Vr.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){W=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Kr,!0),n.addEventListener(`keyup`,Kr,!0),n.addEventListener(`click`,Jr,!0),t.addEventListener(`focus`,Yr,!0),t.addEventListener(`blur`,Xr,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,qr,!0),n.addEventListener(`pointermove`,qr,!0),n.addEventListener(`pointerup`,qr,!0)),t.addEventListener(`beforeunload`,()=>{Qr(e)},{once:!0}),Vr.set(t,{focus:r})}const Qr=(e,t)=>{let n=M(e),r=j(e);t&&r.removeEventListener(`DOMContentLoaded`,t),Vr.has(n)&&(n.HTMLElement.prototype.focus=Vr.get(n).focus,r.removeEventListener(`keydown`,Kr,!0),r.removeEventListener(`keyup`,Kr,!0),r.removeEventListener(`click`,Jr,!0),n.removeEventListener(`focus`,Yr,!0),n.removeEventListener(`blur`,Xr,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,qr,!0),r.removeEventListener(`pointermove`,qr,!0),r.removeEventListener(`pointerup`,qr,!0)),Vr.delete(n))};function $r(e){let t=j(e),n;return t.readyState===`loading`?(n=()=>{Zr(e)},t.addEventListener(`DOMContentLoaded`,n)):Zr(e),()=>Qr(e,n)}typeof document<`u`&&$r();function ei(){return U!==`pointer`}function ti(){return U}function ni(e){U=e,Wr(e,null)}const ri=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function ii(e,t,n){let r=n?I(n):void 0,i=j(r),a=M(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=F(i);return e=e||u instanceof o&&!ri.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!Ur[n.key])}function ai(e,t,n){Zr(),c(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{ii(!!n?.isTextInput,t,r)&&e(ei())};return Br.add(t),()=>{Br.delete(t)}},t)}function oi(e){if(!e.isConnected)return;let t=j(e);if(ti()===`virtual`){let n=F(t);en(()=>{let r=F(t);(r===n||r===t.body)&&e.isConnected&&pt(e)})}else pt(e)}const si=r.createContext(null),ci=`react-aria-focus-scope-restore`;let G=null;function li(e){let{children:t,contain:n,restoreFocus:i,autoFocus:a}=e,o=d(null),u=d(null),f=d([]),{parentNode:p}=s(si)||{},m=l(()=>new Ei({scopeRef:f}),[f]);A(()=>{let e=p||Z.root;if(Z.getTreeNode(e.scopeRef)&&G&&!_i(G,e.scopeRef)){let t=Z.getTreeNode(G);t&&(e=t)}e.addChild(m),Z.addNode(m)},[m,p]),A(()=>{let e=Z.getTreeNode(f);e&&(e.contain=!!n)},[n]),A(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==u.current;)t.push(e),e.addEventListener(ci,n),e=e.nextSibling;return f.current=t,()=>{for(let e of t)e.removeEventListener(ci,n)}},[t]),xi(f,i,n),mi(f,n),Ci(f,i,n),bi(f,a),c(()=>{let e=F(j(f.current?f.current[0]:void 0)),t=null;if(q(e,f.current)){for(let n of Z.traverse())n.scopeRef&&q(e,n.scopeRef.current)&&(t=n);t===Z.getTreeNode(f)&&(G=t.scopeRef)}},[f]),A(()=>()=>{let e=Z.getTreeNode(f)?.parent?.scopeRef??null;(f===G||_i(f,G))&&(!e||Z.getTreeNode(e))&&(G=e),Z.removeTreeNode(f)},[f]);let h=l(()=>ui(f),[]),g=l(()=>({focusManager:h,parentNode:m}),[m,h]);return r.createElement(si.Provider,{value:g},r.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,r.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:u}))}function ui(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||F(j(n[0]??void 0)),c=n[0].previousElementSibling,l=X(K(n),{tabbable:i,accept:o},n);l.currentNode=q(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&Y(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||F(j(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=X(K(n),{tabbable:i,accept:o},n);l.currentNode=q(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&Y(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=X(K(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&Y(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=X(K(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&Y(o,!0),o}}}function K(e){return e[0].parentElement}function di(e){let t=Z.getTreeNode(G);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function fi(e){if(!e.form)return Array.from(j(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=M(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function pi(e){if(e.checked)return!0;let t=fi(e);return t.length>0&&!t.some(e=>e.checked)}function mi(e,t){let n=d(void 0),r=d(void 0);A(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=j(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!di(e)||t.isComposing)return;let n=F(a),r=e.current;if(!r||!q(n,r))return;let i=X(K(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&(Y(o,!0),o instanceof M(o).HTMLInputElement&&o.select())},s=t=>{(!G||_i(G,e))&&q(I(t),e.current)?(G=e,n.current=I(t)):di(e)&&!J(I(t),e)?n.current?n.current.focus():G&&G.current&&yi(G.current):di(e)&&(n.current=I(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ti(),i=(r===`virtual`||r===null)&&dt()&&ut(),o=F(a);if(!i&&o&&di(e)&&!J(o,e)){G=e;let r=I(t);r&&r.isConnected?(n.current=r,n.current?.focus()):G.current&&yi(G.current)}})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),i?.forEach(e=>e.addEventListener(`focusin`,s,!1)),i?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),i?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),A(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function hi(e){return J(e)}function q(e,t){return!e||!t?!1:t.some(t=>P(t,e))}function J(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of Z.traverse(Z.getTreeNode(t)))if(n&&q(e,n.current))return!0;return!1}function gi(e){return J(e,G)}function _i(e,t){let n=Z.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function Y(e,t=!1){if(e!=null&&!t)try{oi(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function vi(e,t=!0){let n=e[0].previousElementSibling,r=K(e),i=X(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=K(e),i=X(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function yi(e,t=!0){Y(vi(e,t))}function bi(e,t){let n=r.useRef(t);c(()=>{n.current&&(G=e,!q(F(j(e.current?e.current[0]:void 0)),G.current)&&e.current&&yi(e.current)),n.current=!1},[e])}function xi(e,t,n){A(()=>{if(t||n)return;let r=e.current,i=j(r?r[0]:void 0),a=t=>{let n=I(t);q(n,e.current)?G=e:hi(n)||(G=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function Si(e){let t=Z.getTreeNode(G);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Ci(e,t,n){let r=d(typeof document<`u`?F(j(e.current?e.current[0]:void 0)):null);A(()=>{let r=e.current,i=j(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!G||_i(G,e))&&q(F(i),e.current)&&(G=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),A(()=>{let r=j(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!di(e)||t.isComposing)return;let n=r.activeElement;if(!J(n,e)||!Si(e))return;let i=Z.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=X(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!J(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(J(s,e));t.preventDefault(),t.stopPropagation(),s?Y(s,!0):hi(a)?Y(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),A(()=>{let n=j(e.current?e.current[0]:void 0);if(!t)return;let i=Z.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=Z.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=F(n);if(t&&i&&(a&&J(a,e)||a===n.body&&Si(e))){let t=Z.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){wi(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&Z.getTreeNode(n.scopeRef)){wi(vi(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function wi(e){e.dispatchEvent(new CustomEvent(ci,{bubbles:!0,cancelable:!0}))&&Y(e)}function X(e,t,n){let r=t?.tabbable?Dn:En,i=j(e?.nodeType===Node.ELEMENT_NODE?e:null),a=Ht(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return P(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!pi(e)||a.currentNode.tagName===`INPUT`&&a.currentNode.type===`radio`&&a.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||q(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}var Ti=class e{constructor(){this.fastMap=new Map,this.root=new Ei({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Ei({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&q(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},Ei=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let Z=new Ti;function Di(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=o(e=>{if(I(e)===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),s=yr(a),c=o(e=>{let t=I(e),r=j(t),a=r?F(r):F();t===e.currentTarget&&t===a&&(n&&n(e),i&&i(!0),s(e))},[i,n,s]);return{focusProps:{onFocus:!t&&(n||i||r)?c:void 0,onBlur:!t&&(r||i)?a:void 0}}}function Oi(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function ki(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Oi(e.onKeyDown),onKeyUp:Oi(e.onKeyUp)}}}let Ai=r.createContext(null);function ji(e){let t=s(Ai)||{};sn(t,e);let{ref:n,...r}=t;return r}function Mi(e,t){let{focusProps:n}=Di(e),{keyboardProps:r}=ki(e),i=L(n,r),a=ji(t),o=e.isDisabled?{}:a,s=d(e.autoFocus);c(()=>{s.current&&t.current&&oi(t.current),s.current=!1},[t]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:L({...i,tabIndex:l},o)}}const Ni=typeof document<`u`?r.useInsertionEffect??r.useLayoutEffect:()=>{};function Pi(e,t,n){let[r,i]=f(e||t),a=d(r),s=d(e!==void 0),l=e!==void 0;c(()=>{s.current,s.current=l},[l]);let p=l?e:r;Ni(()=>{a.current=p});let[,m]=u(()=>({}),{});return[p,o((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),m(),n?.(r,...t))},[n])]}function Fi(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=d({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:c}=tn(),l=o(e=>{P(e.currentTarget,I(e))&&a.current.isFocusWithin&&!P(e.currentTarget,e.relatedTarget)&&(a.current.isFocusWithin=!1,c(),n&&n(e),i&&i(!1))},[n,i,a,c]),u=yr(l),f=o(e=>{if(!P(e.currentTarget,I(e)))return;let t=I(e),n=j(t),o=F(n);if(!a.current.isFocusWithin&&o===t){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,u(e);let t=e.currentTarget;s(n,`focus`,e=>{let r=I(e);if(a.current.isFocusWithin&&!P(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});vr(e,t),l(_r(e))}},{capture:!0})}},[r,i,u,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:l}}}function Ii(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=d({isFocused:!1,isFocusVisible:t||ei()}),[a,s]=f(!1),[c,l]=f(()=>i.current.isFocused&&i.current.isFocusVisible),u=o(()=>l(i.current.isFocused&&i.current.isFocusVisible),[]),p=o(e=>{i.current.isFocused=e,i.current.isFocusVisible=ei(),s(e),u()},[u]);ai(e=>{i.current.isFocusVisible=e,u()},[n,a],{enabled:a,isTextInput:n});let{focusProps:m}=Di({isDisabled:r,onFocusChange:p}),{focusWithinProps:h}=Fi({isDisabled:!r,onFocusWithinChange:p});return{isFocused:a,isFocusVisible:c,focusProps:r?h:m}}function Li({children:e}){let t=l(()=>({register:()=>{}}),[]);return r.createElement(Dr.Provider,{value:t},e)}let Ri=!1,zi=0;function Bi(){Ri=!0,setTimeout(()=>{Ri=!1},500)}function Vi(e){e.pointerType===`touch`&&Bi()}function Hi(){let e=j(null);if(e!==void 0)return zi===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,Vi),zi++,()=>{zi--,!(zi>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,Vi)}}function Ui(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[a,o]=f(!1),s=d({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;c(Hi,[]);let{addGlobalListener:u,removeAllGlobalListeners:p}=tn(),{hoverProps:m,triggerHoverEnd:h}=l(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!P(e.currentTarget,I(e)))return;s.isHovered=!0;let c=e.currentTarget;s.target=c,u(j(I(e)),`pointerover`,e=>{s.isHovered&&s.target&&!P(s.target,I(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:c,pointerType:r}),n&&n(!0),o(!0)},a=(e,t)=>{let i=s.target;s.pointerType=``,s.target=null,!(t===`touch`||!s.isHovered||!i)&&(s.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),o(!1))},c={};return typeof PointerEvent<`u`&&(c.onPointerEnter=t=>{Ri&&t.pointerType===`mouse`||e(t,t.pointerType)},c.onPointerLeave=e=>{!i&&P(e.currentTarget,I(e))&&a(e,e.pointerType)}),{hoverProps:c,triggerHoverEnd:a}},[t,n,r,i,s,u,p]);return c(()=>{i&&h({currentTarget:s.target},s.pointerType)},[i]),{hoverProps:m,isHovered:a}}function Wi(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=d({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=on(e=>{n&&Gi(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=on(e=>{n&&n(e)});c(()=>{let e=a.current;if(r)return;let n=t.current,i=j(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&Gi(n,t)&&s(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,o,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,o,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function Gi(e,t){if(e.button>0)return!1;let n=I(e);if(n){let e=n.ownerDocument;if(!e||!P(e.documentElement,n)||n.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));const Ki=i(!1);function qi(e){let t=(t,n)=>s(Ki)?null:e(t,n);return t.displayName=e.displayName||e.name,a(t)}function Ji(e,t){let{elementType:n=`button`,isDisabled:r,onPress:i,onPressStart:a,onPressEnd:o,onPressUp:s,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:d,href:f,target:p,rel:m,type:h=`button`}=e,g;g=n===`button`?{type:h,disabled:r,form:e.form,formAction:e.formAction,formEncType:e.formEncType,formMethod:e.formMethod,formNoValidate:e.formNoValidate,formTarget:e.formTarget,name:e.name,value:e.value}:{role:`button`,href:n===`a`&&!r?f:void 0,target:n===`a`?p:void 0,type:n===`input`?h:void 0,disabled:n===`input`?r:void 0,"aria-disabled":!r||n===`input`?void 0:r,rel:n===`a`?m:void 0};let{pressProps:_,isPressed:v}=Nr({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Mi(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=L(y,_,R(e,{labelable:!0}));return{isPressed:v,buttonProps:L(g,b,{"aria-haspopup":e[`aria-haspopup`],"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-pressed":e[`aria-pressed`],"aria-current":e[`aria-current`],"aria-disabled":e[`aria-disabled`]})}}const Yi={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function Xi(e={}){let{style:t,isFocusable:n}=e,[r,i]=f(!1),{focusWithinProps:a}=Fi({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=l(()=>r?t:t?{...Yi,...t}:Yi,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Zi(e){let{children:t,elementType:n=`div`,isFocusable:i,style:a,...o}=e,{visuallyHiddenProps:s}=Xi(e);return r.createElement(n,L(o,s),t)}const Qi=i({});function $i(){return s(Qi)??{}}const ea=r.createContext(null);function ta(e){let t=kt(),{portalContainer:n=t?null:document.body,isExiting:i}=e,[a,o]=f(!1),s=l(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=$i();if(!e.portalContainer&&c&&(n=c()),!n)return null;let u=e.children;return e.disableFocusManagement||(u=r.createElement(li,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},u)),u=r.createElement(ea.Provider,{value:s},r.createElement(Li,null,u)),x.createPortal(u,n)}function na(){let e=s(ea)?.setContain;A(()=>{e?.(!0)},[e])}function ra(e,t){let{role:n=`dialog`}=e,r=It();r=e[`aria-label`]?void 0:r;let i=d(!1);return c(()=>{if(t.current&&!Bt(t.current)){oi(t.current);let e=setTimeout(()=>{(F()===t.current||F()===document.body)&&(i.current=!0,t.current&&(t.current.blur(),oi(t.current)),i.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),na(),d(!1),c(()=>{}),{dialogProps:{...R(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||r,onBlur:e=>{i.current&&e.stopPropagation()}},titleProps:{id:r}}}var ia={};ia={dismiss:`تجاهل`};var aa={};aa={dismiss:`Отхвърляне`};var oa={};oa={dismiss:`Odstranit`};var sa={};sa={dismiss:`Luk`};var ca={};ca={dismiss:`Schließen`};var la={};la={dismiss:`Απόρριψη`};var ua={};ua={dismiss:`Dismiss`};var da={};da={dismiss:`Descartar`};var fa={};fa={dismiss:`Lõpeta`};var pa={};pa={dismiss:`Hylkää`};var ma={};ma={dismiss:`Rejeter`};var ha={};ha={dismiss:`התעלם`};var ga={};ga={dismiss:`Odbaci`};var _a={};_a={dismiss:`Elutasítás`};var va={};va={dismiss:`Ignora`};var ya={};ya={dismiss:`閉じる`};var ba={};ba={dismiss:`무시`};var xa={};xa={dismiss:`Atmesti`};var Sa={};Sa={dismiss:`Nerādīt`};var Ca={};Ca={dismiss:`Lukk`};var wa={};wa={dismiss:`Negeren`};var Ta={};Ta={dismiss:`Zignoruj`};var Ea={};Ea={dismiss:`Descartar`};var Da={};Da={dismiss:`Dispensar`};var Oa={};Oa={dismiss:`Revocare`};var ka={};ka={dismiss:`Пропустить`};var Aa={};Aa={dismiss:`Zrušiť`};var ja={};ja={dismiss:`Opusti`};var Ma={};Ma={dismiss:`Odbaci`};var Na={};Na={dismiss:`Avvisa`};var Pa={};Pa={dismiss:`Kapat`};var Fa={};Fa={dismiss:`Скасувати`};var Ia={};Ia={dismiss:`取消`};var La={};La={dismiss:`關閉`};var Ra={};Ra={"ar-AE":ia,"bg-BG":aa,"cs-CZ":oa,"da-DK":sa,"de-DE":ca,"el-GR":la,"en-US":ua,"es-ES":da,"et-EE":fa,"fi-FI":pa,"fr-FR":ma,"he-IL":ha,"hr-HR":ga,"hu-HU":_a,"it-IT":va,"ja-JP":ya,"ko-KR":ba,"lt-LT":xa,"lv-LV":Sa,"nb-NO":Ca,"nl-NL":wa,"pl-PL":Ta,"pt-BR":Ea,"pt-PT":Da,"ro-RO":Oa,"ru-RU":ka,"sk-SK":Aa,"sl-SI":ja,"sr-SP":Ma,"sv-SE":Na,"tr-TR":Pa,"uk-UA":Fa,"zh-CN":Ia,"zh-TW":La};function za(e){return e&&e.__esModule?e.default:e}function Ba(e){let{onDismiss:t,...n}=e,i=nn(n,gr(za(Ra),`@react-aria/overlays`).format(`dismiss`)),a=()=>{t&&t()};return r.createElement(Zi,null,r.createElement(`button`,{...i,tabIndex:-1,onClick:a,style:{width:1,height:1}}))}const Q=[];function Va(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,l=d(void 0);c(()=>{if(i&&!Q.includes(t))return Q.push(t),()=>{let e=Q.indexOf(t);e>=0&&Q.splice(e,1)}},[i,t]);let u=()=>{Q[Q.length-1]===t&&n&&n()},f=e=>{let n=Q[Q.length-1];l.current=n,(!s||s(I(e)))&&n===t&&e.stopPropagation()},p=e=>{(!s||s(I(e)))&&(Q[Q.length-1]===t&&e.stopPropagation(),l.current===t&&u()),l.current=void 0},m=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),u())};Wi({ref:t,onInteractOutside:a&&i?p:void 0,onInteractOutsideStart:f});let{focusWithinProps:h}=Fi({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||gi(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:m,...h},underlayProps:{}}}const Ha=typeof document<`u`&&window.visualViewport;let Ua=0,Wa;function Ga(e={}){let{isDisabled:t}=e;A(()=>{if(!t)return Ua++,Ua===1&&(Wa=ct()?qa():Ka()),()=>{Ua--,Ua===0&&Wa()}},[t])}function Ka(){let e=window.innerWidth-document.documentElement.clientWidth;return Lt(e>0&&(`scrollbarGutter`in document.documentElement.style?Ja(document.documentElement,`scrollbarGutter`,`stable`):Ja(document.documentElement,`paddingRight`,`${e}px`)),Ja(document.documentElement,`overflow`,`hidden`))}function qa(){let e=Ja(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=I(e);t=cn(r)?r:ln(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=jn();a&&(i.nonce=a),i.textContent=`@layer {
8
+ * {
9
+ overscroll-behavior: contain;
10
+ }
11
+ }`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=I(e),n=e.relatedTarget;n&&dn(n)?(n.focus({preventScroll:!0}),Xa(n,dn(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=F(),n=t!=null&&dn(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Xa(this,n)};let l=Lt(Ya(document,`touchstart`,r,{passive:!1,capture:!0}),Ya(document,`touchmove`,o,{passive:!1,capture:!0}),Ya(document,`blur`,s,!0));return()=>{e(),l(),i.remove(),HTMLElement.prototype.focus=c}}function Ja(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ya(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Xa(e,t){t||!Ha?Za(e):Ha.addEventListener(`resize`,()=>Za(e),{once:!0})}function Za(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=ln(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;Ha&&(n=Math.min(n,Ha.offsetTop+Ha.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function Qa(e,t,n){let{overlayProps:r,underlayProps:i}=Va({...e,isOpen:t.isOpen,onClose:t.close},n);return Ga({isDisabled:!t.isOpen}),na(),c(()=>{if(t.isOpen&&n.current)return Kn([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:L(r),underlayProps:i}}const $a=i({}),eo=qi(function(e,t){[e,t]=Ln(e,t,$a);let{elementType:n=`label`,...i}=e,a=Hn[n];return r.createElement(a,{className:`react-aria-Label`,...i,ref:t})}),to=i(null),no=7e3;let $=null;function ro(e,t=`assertive`,n=no){$?$.announce(e,t,n):($=new io,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?$.announce(e,t,n):setTimeout(()=>{$?.isAttached()&&$?.announce(e,t,n)},100))}var io=class{isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=no){var r,i;if(!this.node)return;let a=document.createElement(`div`);typeof e==`object`?(a.setAttribute(`role`,`img`),a.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):a.textContent=e,t===`assertive`?(r=this.assertiveLog)==null||r.appendChild(a):(i=this.politeLog)==null||i.appendChild(a),e!==``&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}};const ao=i({}),oo=qi(function(e,t){[e,t]=Ln(e,t,ao);let n=e,{isPending:i}=n,{buttonProps:a,isPressed:o}=Ji(e,t);a=co(a,i);let{focusProps:s,isFocused:l,isFocusVisible:u}=Ii(e),{hoverProps:f,isHovered:p}=Ui({...e,isDisabled:e.isDisabled||i}),m={isHovered:p,isPressed:(n.isPressed||o)&&!i,isFocused:l,isFocusVisible:u,isDisabled:e.isDisabled||!1,isPending:i??!1},h=Pn({...e,values:m,defaultClassName:`react-aria-Button`}),g=Pt(a.id),_=Pt(),v=a[`aria-labelledby`];i&&(v?v=`${v} ${_}`:a[`aria-label`]&&(v=`${g} ${_}`));let y=d(i);c(()=>{let e={"aria-labelledby":v||g};(!y.current&&l&&i||y.current&&l&&!i)&&ro(e,`assertive`),y.current=i},[i,l,v,g]);let b=R(e,{global:!0});return delete b.onClick,r.createElement(Hn.button,{...L(b,h,a,s,f),type:a.type===`submit`&&i?`button`:a.type,id:g,ref:t,"aria-labelledby":v,slot:e.slot||void 0,"aria-disabled":i?`true`:a[`aria-disabled`],"data-disabled":e.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":l||void 0,"data-pending":i||void 0,"data-focus-visible":u||void 0},r.createElement(to.Provider,{value:{id:_}},h.children))}),so=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function co(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!so.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}function lo(e){let[t,n]=Pi(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:o(()=>{n(!0)},[n]),close:o(()=>{n(!1)},[n]),toggle:o(()=>{n(!t)},[n,t])}}const uo=i(null),fo=i(null),po=a(function(e,t){let n=e[`aria-labelledby`];[e,t]=Ln(e,t,uo);let{dialogProps:i,titleProps:a}=ra({...e,"aria-labelledby":n},t),o=s(fo);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let c=Pn({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),l=R(e,{global:!0});return r.createElement(Hn.section,{...L(l,c,i),render:e.render,ref:t,slot:e.slot||void 0},r.createElement(Nn,{values:[[tt,{slots:{[Mn]:{},title:{...a,level:2}}}],[ao,{slots:{[Mn]:{},close:{onPress:()=>o?.close()}}}]]},c.children))}),mo=i(null),ho=i(null),go=a(function(e,t){if(s(ho))return r.createElement(bo,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,children:l,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p,...m}=e;return r.createElement(vo,{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p},r.createElement(bo,{...m,modalRef:t},l))});function _o(e,t){[e,t]=Ln(e,t,mo);let n=s(fo),i=lo(e),a=e.isOpen!=null||e.defaultOpen!=null||!n?i:n,o=rn(t),c=d(null),l=_n(o,a.isOpen),u=_n(c,a.isOpen),f=l||u||e.isExiting||!1,p=kt();return!a.isOpen&&!f||p?null:r.createElement(yo,{...e,state:a,isExiting:f,overlayRef:o,modalRef:c})}const vo=a(_o);function yo({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Qa(t,i,n),s=gn(t.overlayRef)||t.isEntering||!1,c=Pn({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=fn(),u;if(typeof document<`u`){let e=cn(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return r.createElement(ta,{isExiting:t.isExiting,portalContainer:e},r.createElement(Hn.div,{...L(R(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},r.createElement(Nn,{values:[[ho,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[fo,i]]},c.children)))}function bo(e){let{modalProps:t,modalRef:n,isExiting:i,isDismissable:a}=s(ho),o=s(fo),c=rn(l(()=>Ut(e.modalRef,n),[e.modalRef,n])),u=gn(c),d=Pn({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:u,isExiting:i,state:o}});return r.createElement(Hn.div,{...L(R(e,{global:!0}),t),...d,ref:c,"data-entering":u||void 0,"data-exiting":i||void 0},a&&r.createElement(Ba,{onDismiss:o.close}),d.children)}const xo=()=>{let[n,r]=f(!1);return c(()=>{let n=t=>{let n=e.safeParse(t);n.error||r(n.data.detail.isRecording)};return document.addEventListener(t,n),()=>{document.removeEventListener(t,n)}},[]),n},So=({className:e,iconClassName:t,onClose:n})=>xo()?null:v(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:v(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:v(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),Co=({children:e,classNames:t,isDismissable:r,onDismiss:i,closeOnFinishMs:a})=>{let{survey:o,surveyId:s,dismiss:c}=$e(),[l,u]=f(!1);return g(()=>{o&&c()},l?a:null),y(po,{"aria-label":`Survey`,id:`${s}-popover`,className:b(`confetti-modal-dialog ${n}`,t?.dialog),children:[r&&v(So,{className:b(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await c(),i?.()}}),typeof e==`function`?e({setIsFinished:()=>u(!0)}):e]})},wo=({children:e,classNames:t,onDismiss:r,isDismissable:i=!0,closeOnFinishMs:a=3e3})=>{let{dismiss:o}=$e();return v(vo,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(await o(),r?.())},className:b(`confetti-modal-overlay ${n}`,t?.overlay),children:v(go,{className:b(`confetti-modal ${n}`,t?.modal),children:v(Co,{classNames:t,isDismissable:i,onDismiss:r,closeOnFinishMs:a,children:e})})})};export{R as A,Xe as B,Fn as C,on as D,In as E,It as F,je as G,$e as H,Pt as I,Ae as J,Oe as K,A as L,Ut as M,I as N,rn as O,M as P,ae as Q,nt as R,Rn as S,zn as T,Je as U,Qe as V,Te as W,ge as X,Me as Y,_e as Z,Nr as _,oo as a,Ln as b,Zi as c,Ii as d,Fi as f,ni as g,X as h,xo as i,L as j,nn as k,qi as l,Mi as m,Co as n,$a as o,Pi as p,De as q,So as r,eo as s,wo as t,Ui as u,rr as v,Hn as w,Pn as x,Nn as y,et as z};
@@ -20,13 +20,13 @@ declare const ModalContent: ({
20
20
  isDismissable,
21
21
  onDismiss,
22
22
  closeOnFinishMs
23
- }: ModalContainerProps & Required<Pick<ModalContainerProps, "closeOnFinishMs" | "isDismissable">>) => import("react/jsx-runtime").JSX.Element;
23
+ }: ModalContainerProps & Required<Pick<ModalContainerProps, "closeOnFinishMs" | "isDismissable">>) => import("react").JSX.Element;
24
24
  declare const ModalContainer: ({
25
25
  children,
26
26
  classNames,
27
27
  onDismiss,
28
28
  isDismissable,
29
29
  closeOnFinishMs
30
- }: ModalContainerProps) => import("react/jsx-runtime").JSX.Element;
30
+ }: ModalContainerProps) => import("react").JSX.Element;
31
31
  //#endregion
32
32
  export { ModalContainerProps as n, ModalContent as r, ModalContainer as t };
@@ -1,2 +1,2 @@
1
- import { r as ModalContent } from "./ModalContainer-BT1Bys9H.js";
1
+ import { r as ModalContent } from "./ModalContainer-CPX4GCql.js";
2
2
  export { ModalContent as UnstableModalContent };
@@ -1 +1 @@
1
- import{n as e}from"./ModalContainer-DiVIAVi2.js";export{e as UnstableModalContent};
1
+ import{n as e}from"./ModalContainer-B3QLAjgy.js";export{e as UnstableModalContent};