@opengovsg/confetti 0.3.4 → 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 +42 -5
- package/build/Confetti-X1LYIVnH.d.ts +86 -0
- package/build/DefaultConfettiTrigger-JDSIZWbW.js +1 -0
- package/build/{ModalContainer-Br4sC87A.js → ModalContainer-B3QLAjgy.js} +1 -1
- package/build/{ModalContainer-BT1Bys9H.d.ts → ModalContainer-CPX4GCql.d.ts} +2 -2
- package/build/client-internals.d.ts +1 -1
- package/build/client-internals.js +1 -1
- package/build/components.d.ts +261 -0
- package/build/components.js +1 -0
- package/build/index.d.ts +31 -370
- package/build/index.js +1 -1
- package/package.json +21 -3
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
|
-
| `
|
|
70
|
-
| `
|
|
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
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.3.4`,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=`
|
|
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
2
|
@layer {
|
|
3
3
|
[${Mr}] {
|
|
4
4
|
touch-action: pan-x pan-y pinch-zoom;
|
|
@@ -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
|
|
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
|
|
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-
|
|
1
|
+
import { r as ModalContent } from "./ModalContainer-CPX4GCql.js";
|
|
2
2
|
export { ModalContent as UnstableModalContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./ModalContainer-
|
|
1
|
+
import{n as e}from"./ModalContainer-B3QLAjgy.js";export{e as UnstableModalContent};
|