@opengovsg/confetti 0.3.4 → 0.5.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.
@@ -0,0 +1,91 @@
1
+ import { i as Dismissable, l as WithProxyable, n as Closable, o as OptionallyDismissable } from "./types-Sf4fgrFJ.js";
2
+ import { d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps } from "./Confetti-gIat3060.js";
3
+
4
+ //#region src/templates/EmbeddedConfettiContent.d.ts
5
+ interface EmbeddedConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Closable {
6
+ respondent: string;
7
+ }
8
+ //#endregion
9
+ //#region src/static/EmbeddedConfetti.d.ts
10
+ type EmbeddedConfettiProps = WithProxyable<WithVisibilityControl<EmbeddedConfettiContentProps>>;
11
+ declare function EmbeddedConfetti(props: EmbeddedConfettiProps): import("react").JSX.Element | null;
12
+ //#endregion
13
+ //#region src/templates/ModalConfettiContent.d.ts
14
+ interface ModalConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, OptionallyDismissable {
15
+ respondent: string;
16
+ }
17
+ //#endregion
18
+ //#region src/static/ModalConfetti.d.ts
19
+ type ModalConfettiProps = WithProxyable<WithVisibilityControl<ModalConfettiContentProps>>;
20
+ declare function ModalConfetti(props: ModalConfettiProps): import("react").JSX.Element | null;
21
+ //#endregion
22
+ //#region src/templates/PopoverConfettiContent.d.ts
23
+ interface PopoverConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Dismissable {
24
+ respondent: string;
25
+ }
26
+ //#endregion
27
+ //#region src/static/PopoverConfetti.d.ts
28
+ type PopoverConfettiProps = WithProxyable<WithVisibilityControl<PopoverConfettiContentProps>>;
29
+ declare function PopoverConfetti(props: PopoverConfettiProps): import("react").JSX.Element | null;
30
+ //#endregion
31
+ //#region src/templates/StepperConfettiContent.d.ts
32
+ interface StepperConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Closable {
33
+ respondent: string;
34
+ }
35
+ //#endregion
36
+ //#region src/static/StepperConfetti.d.ts
37
+ type StepperConfettiProps = WithProxyable<WithVisibilityControl<StepperConfettiContentProps>>;
38
+ declare function StepperConfetti(props: StepperConfettiProps): import("react").JSX.Element | null;
39
+ //#endregion
40
+ //#region src/static/ConfettiTrigger.d.ts
41
+ interface TriggerRenderProps {
42
+ /** Opens the survey. */
43
+ onClick: () => void;
44
+ /** Whether the survey is currently open. */
45
+ isWidgetOpen: boolean;
46
+ /** Whether the respondent has already submitted the survey. */
47
+ hasSubmitted: boolean;
48
+ }
49
+ interface TriggerChildProps extends Pick<ConfettiTriggerProps, 'surveyId' | 'publishableKey' | 'proxyUrl' | 'metadata' | 'options'> {
50
+ /**
51
+ * Invoked when the user dismisses the survey via the close button before
52
+ * submitting. Collapses the popover back to the trigger button.
53
+ */
54
+ onDismiss: () => void;
55
+ /**
56
+ * Invoked when the user completes the survey. Marks the trigger button as
57
+ * submitted, then calls the trigger-level `onFinished`.
58
+ */
59
+ onFinished: () => void;
60
+ /**
61
+ * Invoked on every close path: the close button, the close-on-finish timer,
62
+ * and the Thank-You button. Collapses the popover back to the trigger
63
+ * button. The next click reopens a fresh survey.
64
+ */
65
+ onClose: () => void;
66
+ }
67
+ interface ConfettiTriggerProps extends WithProxyable<Omit<RespondentVisibilityProviderProps, 'children'> & BaseConfettiProps> {
68
+ surveyId: string;
69
+ publishableKey: string;
70
+ /**
71
+ * Renders the element that opens the survey. Receives the click handler and
72
+ * the open and submitted state. Defaults to the built-in trigger button.
73
+ */
74
+ trigger?: (renderProps: TriggerRenderProps) => React.ReactNode;
75
+ /**
76
+ * Renders the survey surface once the trigger is activated. Receives the
77
+ * survey props plus the close, dismiss, and finish handlers.
78
+ */
79
+ children: (triggerProps: TriggerChildProps) => React.ReactNode;
80
+ }
81
+ declare const ConfettiTrigger: ({
82
+ trigger,
83
+ children,
84
+ metadata,
85
+ options,
86
+ onFinished,
87
+ proxyUrl,
88
+ ...providerProps
89
+ }: ConfettiTriggerProps) => import("react").JSX.Element;
90
+ //#endregion
91
+ export { ConfettiTrigger, type ConfettiTriggerProps, EmbeddedConfetti, type EmbeddedConfettiProps, ModalConfetti, type ModalConfettiProps, PopoverConfetti, type PopoverConfettiProps, StepperConfetti, type StepperConfettiProps, type TriggerChildProps, type TriggerRenderProps };
@@ -0,0 +1 @@
1
+ import{t as e}from"./DefaultConfettiTrigger-DFJBQ35H.js";import{c as t,o as n,t as r}from"./ModalContainer-q2SR0m5h.js";import{f as i,i as a,m as o,n as s,p as c,r as l,t as u,u as d}from"./Embed-D-rbeYPB.js";import{useState as f}from"react";import{ErrorBoundary as p}from"react-error-boundary";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";const _=({onClose:e,...r})=>h(p,{fallback:h(m,{}),children:h(t,{type:`embedded`,children:h(n,{...r,children:h(o,{...r,shouldAutoSubmit:!1,children:({questions:t,update:n,isCompleted:i,submit:o,isSubmitted:s,errors:c})=>s?h(l,{onClose:e}):h(u,{onSubmit:o,isCompleted:i,children:t.filter(({visible:e})=>!!e).map(e=>h(a,{question:e,error:c[e.id]||``,maskAllInputs:r.options?.bugReport?.maskAllInputs,onChange:t=>n({question:e.position,answer:t})},e.position))})})})})}),v=e=>{let{respondent:t}=c();return h(_,{...e,respondent:t})};function y(e){let[t,n]=f(!1),{respondent:r,isSurveyVisible:a,proxyUrl:o,...s}=e;return t?null:h(i,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:o,respondent:r,isSurveyVisible:a,children:h(v,{...s,apiBaseUrl:o,onClose:()=>{n(!0),s.onClose?.()}})})}const b=({onDismiss:e,onClose:i,onFinished:s,closeOnFinishMs:c,isDismissable:d,...f})=>h(p,{fallback:h(m,{}),children:h(t,{type:`modal`,children:h(n,{...f,children:h(r,{onDismiss:e,onClose:i,closeOnFinishMs:c,isDismissable:d,children:({setIsSubmitted:e,setIsFinished:t})=>h(o,{...f,shouldAutoSubmit:!1,onSubmitted:()=>e(),onFinished:()=>{t(),s?.()},children:({questions:e,update:t,isCompleted:n,errors:r,submit:o,isSubmitted:s})=>s?h(l,{onClose:i}):h(u,{onSubmit:o,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>h(a,{question:e,error:r[e.id]||``,maskAllInputs:f.options?.bugReport?.maskAllInputs,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})})}),x=e=>{let{respondent:t}=c();return h(b,{...e,respondent:t})};function S(e){let[t,n]=f(!1),{respondent:r,isSurveyVisible:a,proxyUrl:o,...s}=e;return t?null:h(i,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:o,respondent:r,isSurveyVisible:a,children:h(x,{...s,apiBaseUrl:o,onClose:()=>{n(!0),s.onClose?.()}})})}const C=({onDismiss:e,onClose:r,onFinished:i,closeOnFinishMs:c,...u})=>h(p,{fallback:h(m,{}),children:h(t,{type:`popover`,children:h(n,{...u,children:h(d,{onDismiss:e,onClose:r,closeOnFinishMs:c,children:({setIsSubmitted:e,setIsFinished:t})=>h(o,{...u,shouldAutoSubmit:!0,onSubmitted:()=>e(),onFinished:()=>{t(),i?.()},children:({current:e,questions:t,update:n,isSubmitted:i})=>{let o=e===t.length-1;if(i)return h(l,{onClose:r});let c=t[e];return c?h(s,{isLastQuestion:o,question:c,onSubmit:t=>n({question:e,answer:t}),children:e=>h(a,{maskAllInputs:u.options?.bugReport?.maskAllInputs,...e})},c.id):h(m,{})}})})})})}),w=e=>{let{respondent:t}=c();return h(C,{...e,respondent:t})};function T(e){let[t,n]=f(!1),{respondent:r,isSurveyVisible:a,proxyUrl:o,...s}=e;return t?null:h(i,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:o,respondent:r,isSurveyVisible:a,children:h(w,{...s,apiBaseUrl:o,onClose:()=>{n(!0),s.onClose?.()}})})}const E=({onClose:e,...t})=>h(p,{fallback:h(m,{}),children:h(n,{...t,children:h(o,{...t,shouldAutoSubmit:!0,children:({current:n,questions:r,update:i,isSubmitted:o})=>{let c=n===r.length-1;if(o)return h(l,{onClose:e});let u=r[n];return u?h(s,{isLastQuestion:c,question:u,onSubmit:e=>i({question:n,answer:e}),children:e=>h(a,{maskAllInputs:t.options?.bugReport?.maskAllInputs,...e})},u.id):h(m,{})}})})}),D=e=>{let{respondent:t}=c();return h(E,{...e,respondent:t})};function O(e){let[t,n]=f(!1),{respondent:r,isSurveyVisible:a,proxyUrl:o,...s}=e;return t?null:h(i,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:o,respondent:r,isSurveyVisible:a,children:h(D,{...s,apiBaseUrl:o,onClose:()=>{n(!0),s.onClose?.()}})})}const k=({trigger:e,children:t,onFinished:n,...r})=>{let[i,a]=f(!1),[o,s]=f(!1);return g(m,{children:[e({onClick:()=>a(!0),isWidgetOpen:i,hasSubmitted:o}),i&&t({...r,onDismiss:()=>a(!1),onFinished:()=>{s(!0),n?.()},onClose:()=>a(!1)})]})},A=({trigger:t=t=>h(e,{...t}),children:n,metadata:r,options:a,onFinished:o,proxyUrl:s,...c})=>h(p,{fallback:h(m,{}),children:h(i,{...c,apiBaseUrl:s,children:h(k,{trigger:t,surveyId:c.surveyId,publishableKey:c.publishableKey,proxyUrl:s,metadata:r,options:a,onFinished:o,children:n})})});export{A as ConfettiTrigger,y as EmbeddedConfetti,S as ModalConfetti,T as PopoverConfetti,O as StepperConfetti};
@@ -265,5 +265,48 @@ interface ConfettiState {
265
265
  isSubmitted: boolean;
266
266
  errors: Record<Question['id'], string>;
267
267
  }
268
+ interface Proxyable {
269
+ /**
270
+ * Origin of the proxy that forwards Confetti API requests. The hosted
271
+ * templates also load the widget bundle and stylesheet from it.
272
+ */
273
+ proxyUrl?: string;
274
+ }
275
+ type WithProxyable<T> = Omit<T, 'apiBaseUrl'> & Proxyable;
276
+ interface Finishable {
277
+ /**
278
+ * Callback is invoked after the survey response is submitted and the
279
+ * submission network call settles.
280
+ */
281
+ onFinished?: () => void;
282
+ }
283
+ interface Closable {
284
+ /**
285
+ * Callback is invoked whenever the survey closes, regardless of how it was closed.
286
+ */
287
+ onClose?: () => void;
288
+ }
289
+ interface Dismissable extends Closable {
290
+ /**
291
+ * The widget will automatically close this many milliseconds
292
+ * after the survey is finished.
293
+ * Set to `null` to disable automatic closing.
294
+ * @default 3000
295
+ */
296
+ closeOnFinishMs?: number | null;
297
+ /**
298
+ * Callback is invoked when the user dismisses the survey before submitting.
299
+ * Closing after submission is not a dismissal and does not invoke this.
300
+ */
301
+ onDismiss?: () => void;
302
+ }
303
+ interface OptionallyDismissable extends Dismissable {
304
+ /**
305
+ * Allows the user to dismiss the modal via the close button and the
306
+ * overlay.
307
+ * @default true
308
+ */
309
+ isDismissable?: boolean;
310
+ }
268
311
  //#endregion
269
- export { MultiSelectQuestionProperties as a, StatementQuestionProperties as c, PublicGetSurveyOutput as i, TextQuestionProperties as l, ConfettiState as n, RatingQuestionProperties as o, Question as r, SingleSelectQuestionProperties as s, Answer as t, BinaryOperatorCondition as u };
312
+ export { Finishable as a, Question as c, MultiSelectQuestionProperties as d, RatingQuestionProperties as f, BinaryOperatorCondition as g, TextQuestionProperties as h, Dismissable as i, WithProxyable as l, StatementQuestionProperties as m, Closable as n, OptionallyDismissable as o, SingleSelectQuestionProperties as p, ConfettiState as r, Proxyable as s, Answer as t, PublicGetSurveyOutput as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/confetti",
3
- "version": "0.3.4",
3
+ "version": "0.5.0",
4
4
  "sideEffects": false,
5
5
  "description": "Widgets for Confetti",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -15,6 +15,16 @@
15
15
  "default": "./build/index.js",
16
16
  "types": "./build/index.d.ts"
17
17
  },
18
+ "./components": {
19
+ "import": "./build/components.js",
20
+ "default": "./build/components.js",
21
+ "types": "./build/components.d.ts"
22
+ },
23
+ "./static": {
24
+ "import": "./build/static.js",
25
+ "default": "./build/static.js",
26
+ "types": "./build/static.d.ts"
27
+ },
18
28
  "./internals": {
19
29
  "import": "./build/internals.js",
20
30
  "default": "./build/internals.js",
@@ -27,6 +37,22 @@
27
37
  },
28
38
  "./confetti.css": "./build/confetti.css"
29
39
  },
40
+ "typesVersions": {
41
+ "*": {
42
+ "components": [
43
+ "./build/components.d.ts"
44
+ ],
45
+ "static": [
46
+ "./build/static.d.ts"
47
+ ],
48
+ "internals": [
49
+ "./build/internals.d.ts"
50
+ ],
51
+ "client-internals": [
52
+ "./build/client-internals.d.ts"
53
+ ]
54
+ }
55
+ },
30
56
  "files": [
31
57
  "./build/**/*.d.ts",
32
58
  "./build/**/*.js",
@@ -56,10 +82,10 @@
56
82
  "@csstools/postcss-minify": "^3.0.0",
57
83
  "@rrweb/types": "2.0.0-alpha.20",
58
84
  "@types/node": "24.10.8",
59
- "@types/react": "^19.2.15",
85
+ "@types/react": "^19.2.16",
60
86
  "@types/react-dom": "^19.2.3",
61
87
  "dotenv-cli": "^11.0.0",
62
- "esbuild": "^0.27.2",
88
+ "esbuild": "^0.28.1",
63
89
  "eslint": "^9.39.2",
64
90
  "postcss": "^8.5.10",
65
91
  "postcss-cli": "^11.0.1",
@@ -70,8 +96,8 @@
70
96
  "typescript": "^5.9.3",
71
97
  "@confetti/prettier-config": "0.0.0",
72
98
  "@confetti/tsconfig": "0.0.0",
73
- "@confetti/eslint-config": "0.0.0",
74
- "@confetti/validators": "0.0.0"
99
+ "@confetti/validators": "0.0.0",
100
+ "@confetti/eslint-config": "0.0.0"
75
101
  },
76
102
  "prettier": "@confetti/prettier-config",
77
103
  "scripts": {
@@ -1,32 +0,0 @@
1
- //#region src/components/container/ModalContainer.d.ts
2
- interface ModalContainerProps {
3
- closeOnFinishMs?: number | null;
4
- isDismissable?: boolean;
5
- classNames?: {
6
- overlay?: string;
7
- modal?: string;
8
- dialog?: string;
9
- closeButton?: string;
10
- icon?: string;
11
- };
12
- onDismiss?: () => void;
13
- children: React.ReactNode | ((props: {
14
- setIsFinished: () => void;
15
- }) => React.ReactNode);
16
- }
17
- declare const ModalContent: ({
18
- children,
19
- classNames,
20
- isDismissable,
21
- onDismiss,
22
- closeOnFinishMs
23
- }: ModalContainerProps & Required<Pick<ModalContainerProps, "closeOnFinishMs" | "isDismissable">>) => import("react/jsx-runtime").JSX.Element;
24
- declare const ModalContainer: ({
25
- children,
26
- classNames,
27
- onDismiss,
28
- isDismissable,
29
- closeOnFinishMs
30
- }: ModalContainerProps) => import("react/jsx-runtime").JSX.Element;
31
- //#endregion
32
- export { ModalContainerProps as n, ModalContent as r, ModalContainer as t };
@@ -1,11 +0,0 @@
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=`
2
- @layer {
3
- [${Mr}] {
4
- touch-action: pan-x pan-y pinch-zoom;
5
- }
6
- }
7
- `.trim(),e.head.prepend(t)},[_]),c(()=>{let e=x.current;return()=>{g||Er(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:L(v,D,{[Mr]:!0})}}function Pr(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function Fr(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof M(i).HTMLInputElement&&!zr(i,n)||i instanceof M(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&Pr(i))&&n!==`Enter`)}function H(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function Ir(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!Pr(e)}function Lr(e,t){return e instanceof HTMLInputElement?!zr(e,t):Ir(e)}const Rr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function zr(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Rr.has(e.type)}let U=null;const Br=new Set;let Vr=new Map,W=!1,Hr=!1;const Ur={Tab:!0,Escape:!0};function Wr(e,t){for(let n of Br)n(e,t)}function Gr(e){return!(e.metaKey||!at()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Kr(e){W=!0,!k.isOpening&&Gr(e)&&(U=`keyboard`,Wr(`keyboard`,e))}function qr(e){U=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(W=!0,Wr(`pointer`,e))}function Jr(e){!k.isOpening&&mn(e)&&(W=!0,U=`virtual`)}function Yr(e){let t=M(I(e)),n=j(I(e));I(e)===t||I(e)===n||br||!e.isTrusted||(!W&&!Hr&&(U=`virtual`,Wr(`virtual`,e)),W=!1,Hr=!1)}function Xr(){br||(W=!1,Hr=!0)}function Zr(e){if(typeof window>`u`||typeof document>`u`)return;let t=M(e),n=j(e);if(Vr.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){W=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Kr,!0),n.addEventListener(`keyup`,Kr,!0),n.addEventListener(`click`,Jr,!0),t.addEventListener(`focus`,Yr,!0),t.addEventListener(`blur`,Xr,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,qr,!0),n.addEventListener(`pointermove`,qr,!0),n.addEventListener(`pointerup`,qr,!0)),t.addEventListener(`beforeunload`,()=>{Qr(e)},{once:!0}),Vr.set(t,{focus:r})}const Qr=(e,t)=>{let n=M(e),r=j(e);t&&r.removeEventListener(`DOMContentLoaded`,t),Vr.has(n)&&(n.HTMLElement.prototype.focus=Vr.get(n).focus,r.removeEventListener(`keydown`,Kr,!0),r.removeEventListener(`keyup`,Kr,!0),r.removeEventListener(`click`,Jr,!0),n.removeEventListener(`focus`,Yr,!0),n.removeEventListener(`blur`,Xr,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,qr,!0),r.removeEventListener(`pointermove`,qr,!0),r.removeEventListener(`pointerup`,qr,!0)),Vr.delete(n))};function $r(e){let t=j(e),n;return t.readyState===`loading`?(n=()=>{Zr(e)},t.addEventListener(`DOMContentLoaded`,n)):Zr(e),()=>Qr(e,n)}typeof document<`u`&&$r();function ei(){return U!==`pointer`}function ti(){return U}function ni(e){U=e,Wr(e,null)}const ri=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function ii(e,t,n){let r=n?I(n):void 0,i=j(r),a=M(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=F(i);return e=e||u instanceof o&&!ri.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!Ur[n.key])}function ai(e,t,n){Zr(),c(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{ii(!!n?.isTextInput,t,r)&&e(ei())};return Br.add(t),()=>{Br.delete(t)}},t)}function oi(e){if(!e.isConnected)return;let t=j(e);if(ti()===`virtual`){let n=F(t);en(()=>{let r=F(t);(r===n||r===t.body)&&e.isConnected&&pt(e)})}else pt(e)}const si=r.createContext(null),ci=`react-aria-focus-scope-restore`;let G=null;function li(e){let{children:t,contain:n,restoreFocus:i,autoFocus:a}=e,o=d(null),u=d(null),f=d([]),{parentNode:p}=s(si)||{},m=l(()=>new Ei({scopeRef:f}),[f]);A(()=>{let e=p||Z.root;if(Z.getTreeNode(e.scopeRef)&&G&&!_i(G,e.scopeRef)){let t=Z.getTreeNode(G);t&&(e=t)}e.addChild(m),Z.addNode(m)},[m,p]),A(()=>{let e=Z.getTreeNode(f);e&&(e.contain=!!n)},[n]),A(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==u.current;)t.push(e),e.addEventListener(ci,n),e=e.nextSibling;return f.current=t,()=>{for(let e of t)e.removeEventListener(ci,n)}},[t]),xi(f,i,n),mi(f,n),Ci(f,i,n),bi(f,a),c(()=>{let e=F(j(f.current?f.current[0]:void 0)),t=null;if(q(e,f.current)){for(let n of Z.traverse())n.scopeRef&&q(e,n.scopeRef.current)&&(t=n);t===Z.getTreeNode(f)&&(G=t.scopeRef)}},[f]),A(()=>()=>{let e=Z.getTreeNode(f)?.parent?.scopeRef??null;(f===G||_i(f,G))&&(!e||Z.getTreeNode(e))&&(G=e),Z.removeTreeNode(f)},[f]);let h=l(()=>ui(f),[]),g=l(()=>({focusManager:h,parentNode:m}),[m,h]);return r.createElement(si.Provider,{value:g},r.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,r.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:u}))}function ui(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||F(j(n[0]??void 0)),c=n[0].previousElementSibling,l=X(K(n),{tabbable:i,accept:o},n);l.currentNode=q(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&Y(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||F(j(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=X(K(n),{tabbable:i,accept:o},n);l.currentNode=q(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&Y(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=X(K(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&Y(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=X(K(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&Y(o,!0),o}}}function K(e){return e[0].parentElement}function di(e){let t=Z.getTreeNode(G);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function fi(e){if(!e.form)return Array.from(j(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=M(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function pi(e){if(e.checked)return!0;let t=fi(e);return t.length>0&&!t.some(e=>e.checked)}function mi(e,t){let n=d(void 0),r=d(void 0);A(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=j(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!di(e)||t.isComposing)return;let n=F(a),r=e.current;if(!r||!q(n,r))return;let i=X(K(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&(Y(o,!0),o instanceof M(o).HTMLInputElement&&o.select())},s=t=>{(!G||_i(G,e))&&q(I(t),e.current)?(G=e,n.current=I(t)):di(e)&&!J(I(t),e)?n.current?n.current.focus():G&&G.current&&yi(G.current):di(e)&&(n.current=I(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ti(),i=(r===`virtual`||r===null)&&dt()&&ut(),o=F(a);if(!i&&o&&di(e)&&!J(o,e)){G=e;let r=I(t);r&&r.isConnected?(n.current=r,n.current?.focus()):G.current&&yi(G.current)}})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),i?.forEach(e=>e.addEventListener(`focusin`,s,!1)),i?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),i?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),A(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function hi(e){return J(e)}function q(e,t){return!e||!t?!1:t.some(t=>P(t,e))}function J(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of Z.traverse(Z.getTreeNode(t)))if(n&&q(e,n.current))return!0;return!1}function gi(e){return J(e,G)}function _i(e,t){let n=Z.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function Y(e,t=!1){if(e!=null&&!t)try{oi(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function vi(e,t=!0){let n=e[0].previousElementSibling,r=K(e),i=X(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=K(e),i=X(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function yi(e,t=!0){Y(vi(e,t))}function bi(e,t){let n=r.useRef(t);c(()=>{n.current&&(G=e,!q(F(j(e.current?e.current[0]:void 0)),G.current)&&e.current&&yi(e.current)),n.current=!1},[e])}function xi(e,t,n){A(()=>{if(t||n)return;let r=e.current,i=j(r?r[0]:void 0),a=t=>{let n=I(t);q(n,e.current)?G=e:hi(n)||(G=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function Si(e){let t=Z.getTreeNode(G);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Ci(e,t,n){let r=d(typeof document<`u`?F(j(e.current?e.current[0]:void 0)):null);A(()=>{let r=e.current,i=j(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!G||_i(G,e))&&q(F(i),e.current)&&(G=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),A(()=>{let r=j(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!di(e)||t.isComposing)return;let n=r.activeElement;if(!J(n,e)||!Si(e))return;let i=Z.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=X(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!J(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(J(s,e));t.preventDefault(),t.stopPropagation(),s?Y(s,!0):hi(a)?Y(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),A(()=>{let n=j(e.current?e.current[0]:void 0);if(!t)return;let i=Z.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=Z.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=F(n);if(t&&i&&(a&&J(a,e)||a===n.body&&Si(e))){let t=Z.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){wi(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&Z.getTreeNode(n.scopeRef)){wi(vi(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function wi(e){e.dispatchEvent(new CustomEvent(ci,{bubbles:!0,cancelable:!0}))&&Y(e)}function X(e,t,n){let r=t?.tabbable?Dn:En,i=j(e?.nodeType===Node.ELEMENT_NODE?e:null),a=Ht(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return P(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!pi(e)||a.currentNode.tagName===`INPUT`&&a.currentNode.type===`radio`&&a.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||q(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}var Ti=class e{constructor(){this.fastMap=new Map,this.root=new Ei({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Ei({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&q(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},Ei=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let Z=new Ti;function Di(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=o(e=>{if(I(e)===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),s=yr(a),c=o(e=>{let t=I(e),r=j(t),a=r?F(r):F();t===e.currentTarget&&t===a&&(n&&n(e),i&&i(!0),s(e))},[i,n,s]);return{focusProps:{onFocus:!t&&(n||i||r)?c:void 0,onBlur:!t&&(r||i)?a:void 0}}}function Oi(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function ki(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Oi(e.onKeyDown),onKeyUp:Oi(e.onKeyUp)}}}let Ai=r.createContext(null);function ji(e){let t=s(Ai)||{};sn(t,e);let{ref:n,...r}=t;return r}function Mi(e,t){let{focusProps:n}=Di(e),{keyboardProps:r}=ki(e),i=L(n,r),a=ji(t),o=e.isDisabled?{}:a,s=d(e.autoFocus);c(()=>{s.current&&t.current&&oi(t.current),s.current=!1},[t]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:L({...i,tabIndex:l},o)}}const Ni=typeof document<`u`?r.useInsertionEffect??r.useLayoutEffect:()=>{};function Pi(e,t,n){let[r,i]=f(e||t),a=d(r),s=d(e!==void 0),l=e!==void 0;c(()=>{s.current,s.current=l},[l]);let p=l?e:r;Ni(()=>{a.current=p});let[,m]=u(()=>({}),{});return[p,o((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),m(),n?.(r,...t))},[n])]}function Fi(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=d({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:c}=tn(),l=o(e=>{P(e.currentTarget,I(e))&&a.current.isFocusWithin&&!P(e.currentTarget,e.relatedTarget)&&(a.current.isFocusWithin=!1,c(),n&&n(e),i&&i(!1))},[n,i,a,c]),u=yr(l),f=o(e=>{if(!P(e.currentTarget,I(e)))return;let t=I(e),n=j(t),o=F(n);if(!a.current.isFocusWithin&&o===t){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,u(e);let t=e.currentTarget;s(n,`focus`,e=>{let r=I(e);if(a.current.isFocusWithin&&!P(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});vr(e,t),l(_r(e))}},{capture:!0})}},[r,i,u,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:l}}}function Ii(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=d({isFocused:!1,isFocusVisible:t||ei()}),[a,s]=f(!1),[c,l]=f(()=>i.current.isFocused&&i.current.isFocusVisible),u=o(()=>l(i.current.isFocused&&i.current.isFocusVisible),[]),p=o(e=>{i.current.isFocused=e,i.current.isFocusVisible=ei(),s(e),u()},[u]);ai(e=>{i.current.isFocusVisible=e,u()},[n,a],{enabled:a,isTextInput:n});let{focusProps:m}=Di({isDisabled:r,onFocusChange:p}),{focusWithinProps:h}=Fi({isDisabled:!r,onFocusWithinChange:p});return{isFocused:a,isFocusVisible:c,focusProps:r?h:m}}function Li({children:e}){let t=l(()=>({register:()=>{}}),[]);return r.createElement(Dr.Provider,{value:t},e)}let Ri=!1,zi=0;function Bi(){Ri=!0,setTimeout(()=>{Ri=!1},500)}function Vi(e){e.pointerType===`touch`&&Bi()}function Hi(){let e=j(null);if(e!==void 0)return zi===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,Vi),zi++,()=>{zi--,!(zi>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,Vi)}}function Ui(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[a,o]=f(!1),s=d({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;c(Hi,[]);let{addGlobalListener:u,removeAllGlobalListeners:p}=tn(),{hoverProps:m,triggerHoverEnd:h}=l(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!P(e.currentTarget,I(e)))return;s.isHovered=!0;let c=e.currentTarget;s.target=c,u(j(I(e)),`pointerover`,e=>{s.isHovered&&s.target&&!P(s.target,I(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:c,pointerType:r}),n&&n(!0),o(!0)},a=(e,t)=>{let i=s.target;s.pointerType=``,s.target=null,!(t===`touch`||!s.isHovered||!i)&&(s.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),o(!1))},c={};return typeof PointerEvent<`u`&&(c.onPointerEnter=t=>{Ri&&t.pointerType===`mouse`||e(t,t.pointerType)},c.onPointerLeave=e=>{!i&&P(e.currentTarget,I(e))&&a(e,e.pointerType)}),{hoverProps:c,triggerHoverEnd:a}},[t,n,r,i,s,u,p]);return c(()=>{i&&h({currentTarget:s.target},s.pointerType)},[i]),{hoverProps:m,isHovered:a}}function Wi(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=d({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=on(e=>{n&&Gi(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=on(e=>{n&&n(e)});c(()=>{let e=a.current;if(r)return;let n=t.current,i=j(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&Gi(n,t)&&s(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,o,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,o,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function Gi(e,t){if(e.button>0)return!1;let n=I(e);if(n){let e=n.ownerDocument;if(!e||!P(e.documentElement,n)||n.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));const Ki=i(!1);function qi(e){let t=(t,n)=>s(Ki)?null:e(t,n);return t.displayName=e.displayName||e.name,a(t)}function Ji(e,t){let{elementType:n=`button`,isDisabled:r,onPress:i,onPressStart:a,onPressEnd:o,onPressUp:s,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:d,href:f,target:p,rel:m,type:h=`button`}=e,g;g=n===`button`?{type:h,disabled:r,form:e.form,formAction:e.formAction,formEncType:e.formEncType,formMethod:e.formMethod,formNoValidate:e.formNoValidate,formTarget:e.formTarget,name:e.name,value:e.value}:{role:`button`,href:n===`a`&&!r?f:void 0,target:n===`a`?p:void 0,type:n===`input`?h:void 0,disabled:n===`input`?r:void 0,"aria-disabled":!r||n===`input`?void 0:r,rel:n===`a`?m:void 0};let{pressProps:_,isPressed:v}=Nr({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Mi(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=L(y,_,R(e,{labelable:!0}));return{isPressed:v,buttonProps:L(g,b,{"aria-haspopup":e[`aria-haspopup`],"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-pressed":e[`aria-pressed`],"aria-current":e[`aria-current`],"aria-disabled":e[`aria-disabled`]})}}const Yi={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function Xi(e={}){let{style:t,isFocusable:n}=e,[r,i]=f(!1),{focusWithinProps:a}=Fi({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=l(()=>r?t:t?{...Yi,...t}:Yi,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Zi(e){let{children:t,elementType:n=`div`,isFocusable:i,style:a,...o}=e,{visuallyHiddenProps:s}=Xi(e);return r.createElement(n,L(o,s),t)}const Qi=i({});function $i(){return s(Qi)??{}}const ea=r.createContext(null);function ta(e){let t=kt(),{portalContainer:n=t?null:document.body,isExiting:i}=e,[a,o]=f(!1),s=l(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=$i();if(!e.portalContainer&&c&&(n=c()),!n)return null;let u=e.children;return e.disableFocusManagement||(u=r.createElement(li,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},u)),u=r.createElement(ea.Provider,{value:s},r.createElement(Li,null,u)),x.createPortal(u,n)}function na(){let e=s(ea)?.setContain;A(()=>{e?.(!0)},[e])}function ra(e,t){let{role:n=`dialog`}=e,r=It();r=e[`aria-label`]?void 0:r;let i=d(!1);return c(()=>{if(t.current&&!Bt(t.current)){oi(t.current);let e=setTimeout(()=>{(F()===t.current||F()===document.body)&&(i.current=!0,t.current&&(t.current.blur(),oi(t.current)),i.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),na(),d(!1),c(()=>{}),{dialogProps:{...R(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||r,onBlur:e=>{i.current&&e.stopPropagation()}},titleProps:{id:r}}}var ia={};ia={dismiss:`تجاهل`};var aa={};aa={dismiss:`Отхвърляне`};var oa={};oa={dismiss:`Odstranit`};var sa={};sa={dismiss:`Luk`};var ca={};ca={dismiss:`Schließen`};var la={};la={dismiss:`Απόρριψη`};var ua={};ua={dismiss:`Dismiss`};var da={};da={dismiss:`Descartar`};var fa={};fa={dismiss:`Lõpeta`};var pa={};pa={dismiss:`Hylkää`};var ma={};ma={dismiss:`Rejeter`};var ha={};ha={dismiss:`התעלם`};var ga={};ga={dismiss:`Odbaci`};var _a={};_a={dismiss:`Elutasítás`};var va={};va={dismiss:`Ignora`};var ya={};ya={dismiss:`閉じる`};var ba={};ba={dismiss:`무시`};var xa={};xa={dismiss:`Atmesti`};var Sa={};Sa={dismiss:`Nerādīt`};var Ca={};Ca={dismiss:`Lukk`};var wa={};wa={dismiss:`Negeren`};var Ta={};Ta={dismiss:`Zignoruj`};var Ea={};Ea={dismiss:`Descartar`};var Da={};Da={dismiss:`Dispensar`};var Oa={};Oa={dismiss:`Revocare`};var ka={};ka={dismiss:`Пропустить`};var Aa={};Aa={dismiss:`Zrušiť`};var ja={};ja={dismiss:`Opusti`};var Ma={};Ma={dismiss:`Odbaci`};var Na={};Na={dismiss:`Avvisa`};var Pa={};Pa={dismiss:`Kapat`};var Fa={};Fa={dismiss:`Скасувати`};var Ia={};Ia={dismiss:`取消`};var La={};La={dismiss:`關閉`};var Ra={};Ra={"ar-AE":ia,"bg-BG":aa,"cs-CZ":oa,"da-DK":sa,"de-DE":ca,"el-GR":la,"en-US":ua,"es-ES":da,"et-EE":fa,"fi-FI":pa,"fr-FR":ma,"he-IL":ha,"hr-HR":ga,"hu-HU":_a,"it-IT":va,"ja-JP":ya,"ko-KR":ba,"lt-LT":xa,"lv-LV":Sa,"nb-NO":Ca,"nl-NL":wa,"pl-PL":Ta,"pt-BR":Ea,"pt-PT":Da,"ro-RO":Oa,"ru-RU":ka,"sk-SK":Aa,"sl-SI":ja,"sr-SP":Ma,"sv-SE":Na,"tr-TR":Pa,"uk-UA":Fa,"zh-CN":Ia,"zh-TW":La};function za(e){return e&&e.__esModule?e.default:e}function Ba(e){let{onDismiss:t,...n}=e,i=nn(n,gr(za(Ra),`@react-aria/overlays`).format(`dismiss`)),a=()=>{t&&t()};return r.createElement(Zi,null,r.createElement(`button`,{...i,tabIndex:-1,onClick:a,style:{width:1,height:1}}))}const Q=[];function Va(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,l=d(void 0);c(()=>{if(i&&!Q.includes(t))return Q.push(t),()=>{let e=Q.indexOf(t);e>=0&&Q.splice(e,1)}},[i,t]);let u=()=>{Q[Q.length-1]===t&&n&&n()},f=e=>{let n=Q[Q.length-1];l.current=n,(!s||s(I(e)))&&n===t&&e.stopPropagation()},p=e=>{(!s||s(I(e)))&&(Q[Q.length-1]===t&&e.stopPropagation(),l.current===t&&u()),l.current=void 0},m=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),u())};Wi({ref:t,onInteractOutside:a&&i?p:void 0,onInteractOutsideStart:f});let{focusWithinProps:h}=Fi({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||gi(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:m,...h},underlayProps:{}}}const Ha=typeof document<`u`&&window.visualViewport;let Ua=0,Wa;function Ga(e={}){let{isDisabled:t}=e;A(()=>{if(!t)return Ua++,Ua===1&&(Wa=ct()?qa():Ka()),()=>{Ua--,Ua===0&&Wa()}},[t])}function Ka(){let e=window.innerWidth-document.documentElement.clientWidth;return Lt(e>0&&(`scrollbarGutter`in document.documentElement.style?Ja(document.documentElement,`scrollbarGutter`,`stable`):Ja(document.documentElement,`paddingRight`,`${e}px`)),Ja(document.documentElement,`overflow`,`hidden`))}function qa(){let e=Ja(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=I(e);t=cn(r)?r:ln(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=jn();a&&(i.nonce=a),i.textContent=`@layer {
8
- * {
9
- overscroll-behavior: contain;
10
- }
11
- }`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=I(e),n=e.relatedTarget;n&&dn(n)?(n.focus({preventScroll:!0}),Xa(n,dn(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=F(),n=t!=null&&dn(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Xa(this,n)};let l=Lt(Ya(document,`touchstart`,r,{passive:!1,capture:!0}),Ya(document,`touchmove`,o,{passive:!1,capture:!0}),Ya(document,`blur`,s,!0));return()=>{e(),l(),i.remove(),HTMLElement.prototype.focus=c}}function Ja(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ya(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Xa(e,t){t||!Ha?Za(e):Ha.addEventListener(`resize`,()=>Za(e),{once:!0})}function Za(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=ln(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;Ha&&(n=Math.min(n,Ha.offsetTop+Ha.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function Qa(e,t,n){let{overlayProps:r,underlayProps:i}=Va({...e,isOpen:t.isOpen,onClose:t.close},n);return Ga({isDisabled:!t.isOpen}),na(),c(()=>{if(t.isOpen&&n.current)return Kn([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:L(r),underlayProps:i}}const $a=i({}),eo=qi(function(e,t){[e,t]=Ln(e,t,$a);let{elementType:n=`label`,...i}=e,a=Hn[n];return r.createElement(a,{className:`react-aria-Label`,...i,ref:t})}),to=i(null),no=7e3;let $=null;function ro(e,t=`assertive`,n=no){$?$.announce(e,t,n):($=new io,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?$.announce(e,t,n):setTimeout(()=>{$?.isAttached()&&$?.announce(e,t,n)},100))}var io=class{isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=no){var r,i;if(!this.node)return;let a=document.createElement(`div`);typeof e==`object`?(a.setAttribute(`role`,`img`),a.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):a.textContent=e,t===`assertive`?(r=this.assertiveLog)==null||r.appendChild(a):(i=this.politeLog)==null||i.appendChild(a),e!==``&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}};const ao=i({}),oo=qi(function(e,t){[e,t]=Ln(e,t,ao);let n=e,{isPending:i}=n,{buttonProps:a,isPressed:o}=Ji(e,t);a=co(a,i);let{focusProps:s,isFocused:l,isFocusVisible:u}=Ii(e),{hoverProps:f,isHovered:p}=Ui({...e,isDisabled:e.isDisabled||i}),m={isHovered:p,isPressed:(n.isPressed||o)&&!i,isFocused:l,isFocusVisible:u,isDisabled:e.isDisabled||!1,isPending:i??!1},h=Pn({...e,values:m,defaultClassName:`react-aria-Button`}),g=Pt(a.id),_=Pt(),v=a[`aria-labelledby`];i&&(v?v=`${v} ${_}`:a[`aria-label`]&&(v=`${g} ${_}`));let y=d(i);c(()=>{let e={"aria-labelledby":v||g};(!y.current&&l&&i||y.current&&l&&!i)&&ro(e,`assertive`),y.current=i},[i,l,v,g]);let b=R(e,{global:!0});return delete b.onClick,r.createElement(Hn.button,{...L(b,h,a,s,f),type:a.type===`submit`&&i?`button`:a.type,id:g,ref:t,"aria-labelledby":v,slot:e.slot||void 0,"aria-disabled":i?`true`:a[`aria-disabled`],"data-disabled":e.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":l||void 0,"data-pending":i||void 0,"data-focus-visible":u||void 0},r.createElement(to.Provider,{value:{id:_}},h.children))}),so=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function co(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!so.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}function lo(e){let[t,n]=Pi(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:o(()=>{n(!0)},[n]),close:o(()=>{n(!1)},[n]),toggle:o(()=>{n(!t)},[n,t])}}const uo=i(null),fo=i(null),po=a(function(e,t){let n=e[`aria-labelledby`];[e,t]=Ln(e,t,uo);let{dialogProps:i,titleProps:a}=ra({...e,"aria-labelledby":n},t),o=s(fo);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let c=Pn({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),l=R(e,{global:!0});return r.createElement(Hn.section,{...L(l,c,i),render:e.render,ref:t,slot:e.slot||void 0},r.createElement(Nn,{values:[[tt,{slots:{[Mn]:{},title:{...a,level:2}}}],[ao,{slots:{[Mn]:{},close:{onPress:()=>o?.close()}}}]]},c.children))}),mo=i(null),ho=i(null),go=a(function(e,t){if(s(ho))return r.createElement(bo,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,children:l,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p,...m}=e;return r.createElement(vo,{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p},r.createElement(bo,{...m,modalRef:t},l))});function _o(e,t){[e,t]=Ln(e,t,mo);let n=s(fo),i=lo(e),a=e.isOpen!=null||e.defaultOpen!=null||!n?i:n,o=rn(t),c=d(null),l=_n(o,a.isOpen),u=_n(c,a.isOpen),f=l||u||e.isExiting||!1,p=kt();return!a.isOpen&&!f||p?null:r.createElement(yo,{...e,state:a,isExiting:f,overlayRef:o,modalRef:c})}const vo=a(_o);function yo({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Qa(t,i,n),s=gn(t.overlayRef)||t.isEntering||!1,c=Pn({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=fn(),u;if(typeof document<`u`){let e=cn(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return r.createElement(ta,{isExiting:t.isExiting,portalContainer:e},r.createElement(Hn.div,{...L(R(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},r.createElement(Nn,{values:[[ho,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[fo,i]]},c.children)))}function bo(e){let{modalProps:t,modalRef:n,isExiting:i,isDismissable:a}=s(ho),o=s(fo),c=rn(l(()=>Ut(e.modalRef,n),[e.modalRef,n])),u=gn(c),d=Pn({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:u,isExiting:i,state:o}});return r.createElement(Hn.div,{...L(R(e,{global:!0}),t),...d,ref:c,"data-entering":u||void 0,"data-exiting":i||void 0},a&&r.createElement(Ba,{onDismiss:o.close}),d.children)}const xo=()=>{let[n,r]=f(!1);return c(()=>{let n=t=>{let n=e.safeParse(t);n.error||r(n.data.detail.isRecording)};return document.addEventListener(t,n),()=>{document.removeEventListener(t,n)}},[]),n},So=({className:e,iconClassName:t,onClose:n})=>xo()?null:v(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:v(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:v(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),Co=({children:e,classNames:t,isDismissable:r,onDismiss:i,closeOnFinishMs:a})=>{let{survey:o,surveyId:s,dismiss:c}=$e(),[l,u]=f(!1);return g(()=>{o&&c()},l?a:null),y(po,{"aria-label":`Survey`,id:`${s}-popover`,className:b(`confetti-modal-dialog ${n}`,t?.dialog),children:[r&&v(So,{className:b(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await c(),i?.()}}),typeof e==`function`?e({setIsFinished:()=>u(!0)}):e]})},wo=({children:e,classNames:t,onDismiss:r,isDismissable:i=!0,closeOnFinishMs:a=3e3})=>{let{dismiss:o}=$e();return v(vo,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(await o(),r?.())},className:b(`confetti-modal-overlay ${n}`,t?.overlay),children:v(go,{className:b(`confetti-modal ${n}`,t?.modal),children:v(Co,{classNames:t,isDismissable:i,onDismiss:r,closeOnFinishMs:a,children:e})})})};export{R as A,Xe as B,Fn as C,on as D,In as E,It as F,je as G,$e as H,Pt as I,Ae as J,Oe as K,A as L,Ut as M,I as N,rn as O,M as P,ae as Q,nt as R,Rn as S,zn as T,Je as U,Qe as V,Te as W,ge as X,Me as Y,_e as Z,Nr as _,oo as a,Ln as b,Zi as c,Ii as d,Fi as f,ni as g,X as h,xo as i,L as j,nn as k,qi as l,Mi as m,Co as n,$a as o,Pi as p,De as q,So as r,eo as s,wo as t,Ui as u,rr as v,Hn as w,Pn as x,Nn as y,et as z};