@opengovsg/confetti 0.1.3 → 0.1.5
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/build/confetti.css +67 -0
- package/build/index.d.ts +55 -18
- package/build/index.js +7 -3
- package/package.json +4 -4
package/build/confetti.css
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
--confetti-disabled-button-opacity: 0.6;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/* Popover Confetti CSS classes */
|
|
39
40
|
.confetti-dialog {
|
|
40
41
|
width: var(--confetti-max-width);
|
|
41
42
|
max-height: 95dvh;
|
|
@@ -84,6 +85,72 @@
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
/* Modal Confetti CSS classes */
|
|
89
|
+
.confetti-modal-overlay {
|
|
90
|
+
position: fixed;
|
|
91
|
+
inset: 0;
|
|
92
|
+
z-index: var(--confetti-z-index);
|
|
93
|
+
background: rgba(0, 0, 0, 0.4);
|
|
94
|
+
display: flex;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
overflow-y: auto;
|
|
97
|
+
overscroll-behavior: none;
|
|
98
|
+
padding: 10vh 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.confetti-modal {
|
|
102
|
+
margin: auto;
|
|
103
|
+
|
|
104
|
+
.confetti-modal-dialog {
|
|
105
|
+
width: var(--confetti-max-width);
|
|
106
|
+
max-width: 100%;
|
|
107
|
+
position: relative;
|
|
108
|
+
box-shadow: var(--confetti-box-shadow);
|
|
109
|
+
border: 1px solid var(--confetti-border-color);
|
|
110
|
+
border-radius: var(--confetti-border-radius);
|
|
111
|
+
background: var(--confetti-background-color);
|
|
112
|
+
padding: var(--confetti-box-padding);
|
|
113
|
+
|
|
114
|
+
&:focus-visible {
|
|
115
|
+
outline: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.confetti-modal-dialog-close {
|
|
119
|
+
position: absolute;
|
|
120
|
+
top: 8px;
|
|
121
|
+
right: 8px;
|
|
122
|
+
background: transparent;
|
|
123
|
+
border: none;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
padding: 8px;
|
|
126
|
+
border-radius: 8px;
|
|
127
|
+
transition: background 200ms;
|
|
128
|
+
|
|
129
|
+
& svg {
|
|
130
|
+
width: 16px;
|
|
131
|
+
height: 16px;
|
|
132
|
+
color: var(--confetti-text-subtle-color);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:hover {
|
|
136
|
+
background: rgba(0, 0, 0, 0.05);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:focus-visible {
|
|
140
|
+
outline: 2px solid var(--confetti-outline-color);
|
|
141
|
+
outline-offset: 2px;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Adjust title padding to accommodate close button */
|
|
146
|
+
.cf-header {
|
|
147
|
+
.cf-title {
|
|
148
|
+
padding-right: 20px;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
87
154
|
.confetti {
|
|
88
155
|
font-family: var(--confetti-font-family);
|
|
89
156
|
display: flex;
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as MultiSelectQuestionProperties, c as StatementQuestionProperties, i as PublicGetSurveyOutput, l as TextQuestionProperties, n as ConfettiState, o as RatingQuestionProperties, r as Question, s as SingleSelectQuestionProperties, t as Answer } from "./types-BnnL5f51.js";
|
|
2
2
|
import * as react0 from "react";
|
|
3
3
|
import { HTMLAttributes, PropsWithChildren } from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/core/ConfettiController.d.ts
|
|
7
7
|
interface ConfettiControllerProps {
|
|
@@ -19,7 +19,7 @@ declare const ConfettiController: ({
|
|
|
19
19
|
shouldAutoSubmit,
|
|
20
20
|
onFinished,
|
|
21
21
|
children
|
|
22
|
-
}: ConfettiControllerProps) =>
|
|
22
|
+
}: ConfettiControllerProps) => react_jsx_runtime7.JSX.Element;
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region src/core/ConfettiProvider.d.ts
|
|
25
25
|
interface ConfettiContextValue {
|
|
@@ -54,7 +54,7 @@ declare const ConfettiProvider: ({
|
|
|
54
54
|
metadata,
|
|
55
55
|
isSurveyVisible: isSurveyVisibleInput,
|
|
56
56
|
apiBaseUrl
|
|
57
|
-
}: ConfettiProviderProps) =>
|
|
57
|
+
}: ConfettiProviderProps) => react_jsx_runtime7.JSX.Element | null;
|
|
58
58
|
declare const useConfetti: () => ConfettiContextValue;
|
|
59
59
|
//#endregion
|
|
60
60
|
//#region src/components/Confetti.d.ts
|
|
@@ -64,7 +64,7 @@ declare const Confetti: ({
|
|
|
64
64
|
onFinished,
|
|
65
65
|
shouldAutoSubmit,
|
|
66
66
|
...props
|
|
67
|
-
}: ConfettiProps & Pick<ConfettiControllerProps, "children" | "shouldAutoSubmit">) =>
|
|
67
|
+
}: ConfettiProps & Pick<ConfettiControllerProps, "children" | "shouldAutoSubmit">) => react_jsx_runtime7.JSX.Element;
|
|
68
68
|
//#endregion
|
|
69
69
|
//#region src/components/ThankYouMessage.d.ts
|
|
70
70
|
interface ThankYouMessageProps {
|
|
@@ -81,7 +81,31 @@ declare const ThankYouMessage: ({
|
|
|
81
81
|
title,
|
|
82
82
|
description,
|
|
83
83
|
classNames
|
|
84
|
-
}: ThankYouMessageProps) =>
|
|
84
|
+
}: ThankYouMessageProps) => react_jsx_runtime7.JSX.Element | null;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/components/container/ModalContainer.d.ts
|
|
87
|
+
interface ModalContainerProps {
|
|
88
|
+
closeOnFinishMs?: number | null;
|
|
89
|
+
isDismissable?: boolean;
|
|
90
|
+
classNames?: {
|
|
91
|
+
overlay?: string;
|
|
92
|
+
modal?: string;
|
|
93
|
+
dialog?: string;
|
|
94
|
+
closeButton?: string;
|
|
95
|
+
icon?: string;
|
|
96
|
+
};
|
|
97
|
+
onDismiss?: () => void;
|
|
98
|
+
children: React.ReactNode | ((props: {
|
|
99
|
+
setIsFinished: () => void;
|
|
100
|
+
}) => React.ReactNode);
|
|
101
|
+
}
|
|
102
|
+
declare const ModalContainer: ({
|
|
103
|
+
children,
|
|
104
|
+
classNames,
|
|
105
|
+
onDismiss,
|
|
106
|
+
isDismissable,
|
|
107
|
+
closeOnFinishMs
|
|
108
|
+
}: ModalContainerProps) => react_jsx_runtime7.JSX.Element;
|
|
85
109
|
//#endregion
|
|
86
110
|
//#region src/components/container/PopoverContainer.d.ts
|
|
87
111
|
interface PopoverContainerProps {
|
|
@@ -103,7 +127,7 @@ declare const PopoverContainer: ({
|
|
|
103
127
|
containerProps,
|
|
104
128
|
onDismiss,
|
|
105
129
|
closeOnFinishMs
|
|
106
|
-
}: PopoverContainerProps) =>
|
|
130
|
+
}: PopoverContainerProps) => react_jsx_runtime7.JSX.Element;
|
|
107
131
|
//#endregion
|
|
108
132
|
//#region src/components/questions/types.d.ts
|
|
109
133
|
type Question$1 = PublicGetSurveyOutput['questions'][number];
|
|
@@ -126,7 +150,7 @@ declare const SurveyQuestionFactory: ({
|
|
|
126
150
|
question,
|
|
127
151
|
onChange,
|
|
128
152
|
error
|
|
129
|
-
}: SurveyQuestionFactoryProps) =>
|
|
153
|
+
}: SurveyQuestionFactoryProps) => react_jsx_runtime7.JSX.Element;
|
|
130
154
|
//#endregion
|
|
131
155
|
//#region src/components/questions/Rating.d.ts
|
|
132
156
|
interface RatingProps extends BaseFieldProps {
|
|
@@ -161,7 +185,7 @@ declare const Rating: ({
|
|
|
161
185
|
id,
|
|
162
186
|
error,
|
|
163
187
|
required
|
|
164
|
-
}: RatingProps) =>
|
|
188
|
+
}: RatingProps) => react_jsx_runtime7.JSX.Element;
|
|
165
189
|
//#endregion
|
|
166
190
|
//#region src/components/questions/FreeText.d.ts
|
|
167
191
|
interface FreeTextProps extends BaseFieldProps {
|
|
@@ -185,7 +209,7 @@ declare const FreeText: ({
|
|
|
185
209
|
classNames,
|
|
186
210
|
required,
|
|
187
211
|
error
|
|
188
|
-
}: FreeTextProps) =>
|
|
212
|
+
}: FreeTextProps) => react_jsx_runtime7.JSX.Element;
|
|
189
213
|
//#endregion
|
|
190
214
|
//#region src/components/questions/SingleChoice.d.ts
|
|
191
215
|
interface SingleChoiceProps extends BaseFieldProps {
|
|
@@ -215,7 +239,7 @@ declare const SingleChoice: ({
|
|
|
215
239
|
id,
|
|
216
240
|
required,
|
|
217
241
|
error
|
|
218
|
-
}: SingleChoiceProps) =>
|
|
242
|
+
}: SingleChoiceProps) => react_jsx_runtime7.JSX.Element;
|
|
219
243
|
//#endregion
|
|
220
244
|
//#region src/components/questions/MultiChoice.d.ts
|
|
221
245
|
interface MultiChoiceProps extends BaseFieldProps {
|
|
@@ -248,7 +272,7 @@ declare const MultiChoice: ({
|
|
|
248
272
|
id,
|
|
249
273
|
required,
|
|
250
274
|
error
|
|
251
|
-
}: MultiChoiceProps) =>
|
|
275
|
+
}: MultiChoiceProps) => react_jsx_runtime7.JSX.Element;
|
|
252
276
|
//#endregion
|
|
253
277
|
//#region src/components/questions/Statement.d.ts
|
|
254
278
|
interface StatementProps extends BaseFieldProps {
|
|
@@ -266,7 +290,7 @@ declare const Statement: ({
|
|
|
266
290
|
title,
|
|
267
291
|
description,
|
|
268
292
|
classNames
|
|
269
|
-
}: StatementProps) =>
|
|
293
|
+
}: StatementProps) => react_jsx_runtime7.JSX.Element;
|
|
270
294
|
//#endregion
|
|
271
295
|
//#region src/components/presentation/Flow.d.ts
|
|
272
296
|
type ChildField = (_: {
|
|
@@ -285,7 +309,7 @@ declare const Flow: ({
|
|
|
285
309
|
children,
|
|
286
310
|
question,
|
|
287
311
|
isLastQuestion
|
|
288
|
-
}: FlowProps) =>
|
|
312
|
+
}: FlowProps) => react_jsx_runtime7.JSX.Element;
|
|
289
313
|
//#endregion
|
|
290
314
|
//#region src/components/presentation/Embed.d.ts
|
|
291
315
|
declare const Embed: ({
|
|
@@ -295,10 +319,23 @@ declare const Embed: ({
|
|
|
295
319
|
}: PropsWithChildren<{
|
|
296
320
|
isCompleted: boolean;
|
|
297
321
|
onSubmit: () => void;
|
|
298
|
-
}>) =>
|
|
322
|
+
}>) => react_jsx_runtime7.JSX.Element;
|
|
299
323
|
//#endregion
|
|
300
324
|
//#region src/templates/EmbeddedConfetti.d.ts
|
|
301
|
-
declare const EmbeddedConfetti: (props: ConfettiProps) =>
|
|
325
|
+
declare const EmbeddedConfetti: (props: ConfettiProps) => react_jsx_runtime7.JSX.Element;
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/templates/ModalConfetti.d.ts
|
|
328
|
+
interface ModalConfettiProps extends ConfettiProps {
|
|
329
|
+
closeOnFinishMs?: number | null;
|
|
330
|
+
onDismiss?: () => void;
|
|
331
|
+
isDismissable?: boolean;
|
|
332
|
+
}
|
|
333
|
+
declare const ModalConfetti: ({
|
|
334
|
+
onDismiss,
|
|
335
|
+
closeOnFinishMs,
|
|
336
|
+
isDismissable,
|
|
337
|
+
...props
|
|
338
|
+
}: ModalConfettiProps) => react_jsx_runtime7.JSX.Element;
|
|
302
339
|
//#endregion
|
|
303
340
|
//#region src/templates/PopoverConfetti.d.ts
|
|
304
341
|
interface PopoverConfettiProps extends ConfettiProps {
|
|
@@ -318,10 +355,10 @@ declare const PopoverConfetti: ({
|
|
|
318
355
|
onDismiss,
|
|
319
356
|
closeOnFinishMs,
|
|
320
357
|
...props
|
|
321
|
-
}: PopoverConfettiProps) =>
|
|
358
|
+
}: PopoverConfettiProps) => react_jsx_runtime7.JSX.Element;
|
|
322
359
|
//#endregion
|
|
323
360
|
//#region src/templates/StepperConfetti.d.ts
|
|
324
|
-
declare const StepperConfetti: (props: ConfettiProps) =>
|
|
361
|
+
declare const StepperConfetti: (props: ConfettiProps) => react_jsx_runtime7.JSX.Element;
|
|
325
362
|
//#endregion
|
|
326
363
|
//#region src/hooks/useVisibleAfterDelay.d.ts
|
|
327
364
|
interface UseVisibleAfterDelayOptions {
|
|
@@ -363,4 +400,4 @@ declare const useVisibleAfterScroll: ({
|
|
|
363
400
|
isVisible: boolean;
|
|
364
401
|
};
|
|
365
402
|
//#endregion
|
|
366
|
-
export { type Answer, Confetti, ConfettiContext, ConfettiController, type ConfettiControllerProps, type ConfettiProps, ConfettiProvider, type ConfettiProviderProps, type ConfettiState, Embed, EmbeddedConfetti, Flow, FreeText, type FreeTextProps, MultiChoice, type MultiChoiceProps, PopoverConfetti, PopoverContainer, type PopoverContainerProps, type Question, Rating, type RatingProps, SingleChoice, type SingleChoiceProps, Statement, type StatementProps, StepperConfetti, SurveyQuestionFactory, type SurveyQuestionFactoryProps, ThankYouMessage, useConfetti, useVisibleAfterDelay, useVisibleAfterPageVisits, useVisibleAfterScroll, useVisibleAfterSessionPageVisits };
|
|
403
|
+
export { type Answer, Confetti, ConfettiContext, ConfettiController, type ConfettiControllerProps, type ConfettiProps, ConfettiProvider, type ConfettiProviderProps, type ConfettiState, Embed, EmbeddedConfetti, Flow, FreeText, type FreeTextProps, ModalConfetti, ModalContainer, type ModalContainerProps, MultiChoice, type MultiChoiceProps, PopoverConfetti, PopoverContainer, type PopoverContainerProps, type Question, Rating, type RatingProps, SingleChoice, type SingleChoiceProps, Statement, type StatementProps, StepperConfetti, SurveyQuestionFactory, type SurveyQuestionFactoryProps, ThankYouMessage, useConfetti, useVisibleAfterDelay, useVisibleAfterPageVisits, useVisibleAfterScroll, useVisibleAfterSessionPageVisits };
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import{n as e,t}from"./routing-ZHrE7mgA.js";import{ErrorBoundary as n}from"react-error-boundary";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{useLocalStorage as p,useSessionStorage as m,useTimeout as h}from"usehooks-ts";import{z as g}from"zod/v4/mini";import _ from"ky";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";import x from"clsx";import"react-dom";function S(e){return e.issues[0]?.message??`Invalid input`}const C=g.object({type:g.literal(`next`)}),w=g.object({type:g.literal(`end`)}),T=g.object({type:g.literal(`jump`),target:g.number({error:`Target question is required`})}),E=g.discriminatedUnion(`type`,[C,T,w]),D=g.object({type:g.literal(`value`),value:g.union([g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),g.number({error:`Value is required`})])}),O=g.object({type:g.literal(`binary-operator`),operator:g.union([g.literal(`equal`),g.literal(`not-equal`),g.literal(`greater`),g.literal(`greater-or-equal`),g.literal(`less`),g.literal(`less-or-equal`),g.literal(`contains`),g.literal(`not-contains`)]),value:D,target:E}),ee=g.object({type:g.literal(`switch`),cases:g.array(O),default:E}),k=g.object({type:g.literal(`always`),target:E}),A=g.discriminatedUnion(`type`,[k,ee]),te=g.string().check(g.trim(),g.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),j=g.optional(g.string().check(g.trim(),g.maxLength(50))),ne=g.object({value:g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),description:g.optional(g.string().check(g.trim()))}),re=g.nullable(g.object({label:g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),max:g.number(),description:g.optional(g.string().check(g.trim()))})),ie=g.object({type:g.literal(`rating`),buttonLabel:j,scale:g.number().check(g.minimum(2),g.maximum(10)),labels:g.optional(g.object({lower:g.optional(g.pipe(g.string().check(g.trim()),g.transform(e=>e===``?void 0:e))),upper:g.optional(g.pipe(g.string().check(g.trim()),g.transform(e=>e===``?void 0:e)))})),display:g.optional(g.literal([`star`,`emoji`,`number`]))}),ae=g.object({type:g.literal(`open-ended`),placeholder:g.optional(g.string()),buttonLabel:j,max:g.number()}),oe=g.object({type:g.literal(`single-select`),options:g.array(ne),buttonLabel:j,editable:re}),se=g.object({type:g.literal(`multi-select`),buttonLabel:j,options:g.array(ne),editable:re,max:g.optional(g.number()),display:g.optional(g.literal([`checkbox`,`tag`]))}),ce=g.object({type:g.literal(`statement`),buttonLabel:j,buttonUrl:g.optional(te)}),le=g.discriminatedUnion(`type`,[ie,oe,ae,se,ce]),M=`__CONFETTI_CHECKBOX_Others`,ue=`__CONFETTI_RADIO_Others`,de=e=>g.number().check(g.int(),g.minimum(1),g.maximum(e)),fe=({scale:e},{required:t})=>{let n=de(e);return t?n:g.optional(n)},pe=({maxLength:e},{required:t})=>g.string().check(g.trim(),...t?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),me=(e,t)=>g.string().check(g.trim(),...t?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),g.refine(e=>e!==ue,{error:`Please fill out the free text field`})),he=({maxLength:e},{required:t})=>{let n=me(e,t);return t?n:g.optional(n)},ge=({maxSelected:e,maxLength:t},{required:n})=>g.array(g.string().check(g.trim(),...n?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),g.refine(e=>e!==M,{error:`Please fill out the free text field`}))).check(...n?[g.minLength(1,{error:`Please select at least one option`})]:[],g.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),_e=()=>g.optional(g.string()),ve=g.object({title:g.string().check(g.trim()),description:g.string().check(g.trim()),buttonText:g.string().check(g.trim())}),ye=g.object({title:g.string(),description:g.nullable(g.string()),questions:g.array(g.object({id:g.string(),title:g.string(),description:g.nullable(g.string()),position:g.number(),required:g.boolean(),properties:le,routingLogic:A})),confirmation:ve});g.object({respondent:g.string().check(g.trim(),g.minLength(1),g.maxLength(2048)),data:g.record(g.string(),g.union([g.string().check(g.trim(),g.maxLength(2048)),g.number(),g.array(g.string().check(g.trim(),g.maxLength(2048))).check(g.maxLength(1024))])),metadata:g.record(g.string().check(g.trim(),g.maxLength(1e3)),g.string().check(g.trim(),g.maxLength(1e3)))});const be=g.object({lastRespondedAt:g.nullable(g.union([g.iso.datetime(),g.date()])),lastViewedAt:g.nullable(g.union([g.iso.datetime(),g.date()])),lastDismissedAt:g.nullable(g.union([g.iso.datetime(),g.date()]))});g.object({type:g.enum([`view`,`dismiss`])});const xe=_.create({prefixUrl:`https://confetti.gov.sg/api`,retry:{limit:3,methods:[`get`]},timeout:6e4}),Se=i(null),Ce=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},isSurveyVisible:a,apiBaseUrl:s})=>{let u=d(!1),[m,h]=f(),[g,_]=f(!1),[v,b]=f(null),[x,S]=f(null),C=l(()=>crypto.randomUUID(),[]),[w,T]=p(`cfti:${t}:respondent`,``);c(()=>{w||T(crypto.randomUUID())},[w,T]);let E=l(()=>r||w,[r,w]),D=l(()=>{let e={headers:{"x-cfti-pk":n}};return s&&(e.prefixUrl=s),xe.extend(e)},[s,n]),O=o(async()=>{if(!E)return;let e=await D.get(`v1/cfti/${t}/respondent/${E}`).json(),n=be.safeParse(e);n.success&&(b(n.data.lastRespondedAt?new Date(n.data.lastRespondedAt):null),S(n.data.lastDismissedAt?new Date(n.data.lastDismissedAt):null))},[D,E,t]);c(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=()=>{document.visibilityState===`visible`&&O()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[O]),c(()=>{(async()=>{u.current=!1,_(!1),h(void 0),b(null),S(null);try{let e=await D.get(`v1/cfti/${t}`).json(),n=ye.safeParse(e);if(!n.success)return;h(n.data),await O()}catch{}finally{_(!0)}})()},[D,O,t]);let ee=o(async({answers:e})=>{await D.put(`v1/cfti/${t}/response/${C}`,{json:{respondent:E,data:e,metadata:i}})},[D,i,E,C,t]),k=o(()=>{h(void 0),D.post(`v1/cfti/${t}/respondent/${E}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[D,E,t]),A=l(()=>g?a===void 0?!0:typeof a==`boolean`?a:a({lastRespondedAt:v,lastDismissedAt:x}):!1,[g,a,v,x]);return c(()=>{u.current||A&&m&&E&&(u.current=!0,D.post(`v1/cfti/${t}/respondent/${E}/event`,{json:{type:`view`}}).catch(()=>{}))},[D,A,E,m,t]),!A||!m?null:y(Se.Provider,{value:{submit:ee,dismiss:k,surveyId:t,survey:m,metadata:i},children:e})},we=()=>{let e=s(Se);if(!e)throw Error(`useConfetti must be used within a ConfettiProvider`);return e},Te={rating:({scale:e},t)=>fe({scale:e},t),"open-ended":({max:e},t)=>pe({maxLength:e},t),"single-select":({editable:e},t)=>he({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>ge({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>_e()},Ee=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=Te[n];return r(e,t)}case`open-ended`:{let r=Te[n];return r(e,t)}case`single-select`:{let r=Te[n];return r(e,t)}case`multi-select`:{let r=Te[n];return r(e,t)}case`statement`:{let r=Te[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},De=({originalQuestions:t,answers:n,errors:r,pointer:i=-1})=>{if(!t)return{questions:[],currentIndex:-1};let a=t.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 t=0;t<a.length;t++){let r=a[t];if(!r)continue;let o=e({index:t,questions:a,answers:n});r.visible=i===t||o}let o=a.findIndex((e,t)=>t>i&&e.visible&&n[e.id]===void 0);return o===-1&&(o=a.findLastIndex(e=>!!e.visible)),{questions:a,currentIndex:o}},Oe=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible).filter(([,e])=>e!==null)),ke=({current:e,shouldAutoSubmit:t,onFinished:n,children:r})=>{let{survey:i,submit:a}=we(),[s,c]=f({}),[u,d]=f({}),p=l(()=>De({originalQuestions:i?.questions,answers:s,errors:u,pointer:e}),[i?.questions,s,u,e]),m=l(()=>!!p.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>s[e]!==void 0),[s,p.questions]),[h,g]=f(!1),_=o(({answers:e})=>{a({answers:e}).finally(()=>{n?.()})},[n,a]),b=o(()=>{_({answers:Oe({questions:p.questions,answers:s})}),g(!0)},[s,p.questions,_]),x=o(({question:n,answer:r})=>{let a=p.questions.at(n);if(!a)return{error:`Question index is invalid`};let o=Ee(a.properties,{required:a.required}).safeParse(r);if(!o.success){let e=S(o.error);return d(t=>{if(t[a.id]===e)return t;let n={...t};return n[a.id]=e,n}),{error:e}}let l=!a.required&&!r?null:r,f={...s};if(f[a.id]===l)return{next:De({originalQuestions:i?.questions,answers:f,errors:u,pointer:e}).currentIndex};f[a.id]=l,c(f);let m=De({originalQuestions:i?.questions,answers:f,errors:u,pointer:e});return m.questions.filter(({visible:e})=>!!e).every(({id:e})=>f[e]!==void 0)&&t&&(_({answers:Oe({questions:m.questions,answers:f})}),g(!0)),{next:m.currentIndex}},[p.questions,s,i?.questions,u,t,e,_]);return p.questions.length===0?y(v,{}):y(`div`,{className:`confetti`,children:r({questions:p.questions,current:e??p.currentIndex,update:x,isCompleted:m,submit:b,isSubmitted:h,errors:u})})},Ae=({children:e,onFinished:t,shouldAutoSubmit:r,...i})=>y(n,{fallback:y(v,{}),children:y(Ce,{...i,children:y(ke,{shouldAutoSubmit:r,onFinished:t,children:e})})}),je=i(null);i(null),i(null),i(null),i(null),i({}),i(null);const Me=i(null),N=typeof document<`u`?r.useLayoutEffect:()=>{};function Ne(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 N(()=>{r.current=t,i.current&&a.current()}),[t,o(e=>{i.current=e(r.current),a.current()},[a])]}const Pe={prefix:String(Math.round(Math.random()*1e10)),current:0},Fe=r.createContext(Pe),Ie=r.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let Le=new WeakMap;function Re(e=!1){let t=s(Fe),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=Le.get(e);n==null?Le.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,Le.delete(e))}n.current=++t.current}return n.current}function ze(e){let t=s(Fe),n=Re(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function Be(e){let t=r.useId(),[n]=f(Ge()),i=n?`react-aria`:`react-aria${Pe.prefix}`;return e||`${i}-${t}`}const Ve=typeof r.useId==`function`?Be:ze;function He(){return!1}function Ue(){return!0}function We(e){return()=>{}}function Ge(){return typeof r.useSyncExternalStore==`function`?r.useSyncExternalStore(We,He,Ue):s(Ie)}let Ke=!!(typeof window<`u`&&window.document&&window.document.createElement),P=new Map,qe;typeof FinalizationRegistry<`u`&&(qe=new FinalizationRegistry(e=>{P.delete(e)}));function F(e){let[t,n]=f(e),r=d(null),i=Ve(t),a=d(null);if(qe&&qe.register(a,i),Ke){let e=P.get(i);e&&!e.includes(r)?e.push(r):P.set(i,[r])}return N(()=>{let e=i;return()=>{qe&&qe.unregister(a),P.delete(e)}},[i]),c(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function Je(e,t){if(e===t)return e;let n=P.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=P.get(t);return r?(r.forEach(t=>t.current=e),e):t}function Ye(e=[]){let t=F(),[n,r]=Ne(t),i=o(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return N(i,[t,i,...e]),n}function Xe(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const I=e=>e?.ownerDocument??document,L=e=>e&&`window`in e&&e.window===e?e:I(e).defaultView||window;function Ze(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Qe(e){return Ze(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function $e(){return!1}function R(e,t){if(!$e())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:Qe(n)?n.host:n.parentNode}return!1}const et=(e=document)=>{if(!$e())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function z(e){return $e()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}var tt=class{get currentNode(){return this._currentNode}set currentNode(e){if(!R(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 R(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}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);if(this.filter?.acceptNode)return this.filter.acceptNode(e);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)}}};function nt(e,t,n,r){return $e()?new tt(e,t,n,r):e.createTreeWalker(t,n,r)}function B(...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]=Xe(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=x(n,i):e===`id`&&n&&i?t.id=Je(n,i):t[e]=i===void 0?n:i}}return t}function rt(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=it(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():it(e[n],null)})}}}function it(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}const at=new Set([`id`]),ot=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),st=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),ct=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),lt=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(`.`)),ut=/^(data-.*)$/;function V(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)&&(at.has(t)||n&&ot.has(t)||r&&st.has(t)||i&&ct.has(t)||a&&(lt.has(t)||t.endsWith(`Capture`)&<.has(t.slice(0,-7)))||o?.has(t)||ut.test(t))&&(s[t]=e[t]);return s}function dt(e){if(pt())e.focus({preventScroll:!0});else{let t=mt(e);e.focus(),ht(t)}}let ft=null;function pt(){if(ft==null){ft=!1;try{document.createElement(`div`).focus({get preventScroll(){return ft=!0,!0}})}catch{}}return ft}function mt(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 ht(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function gt(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 _t(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function H(e){let t=null;return()=>(t??=e(),t)}const vt=H(function(){return _t(/^Mac/i)}),yt=H(function(){return _t(/^iPhone/i)}),bt=H(function(){return _t(/^iPad/i)||vt()&&navigator.maxTouchPoints>1}),xt=H(function(){return yt()||bt()}),St=H(function(){return gt(/AppleWebKit/i)&&!Ct()}),Ct=H(function(){return gt(/Chrome/i)}),wt=H(function(){return gt(/Android/i)}),Tt=H(function(){return gt(/Firefox/i)});function U(e,t,n=!0){var r;let{metaKey:i,ctrlKey:a,altKey:o,shiftKey:s}=t;Tt()&&(r=window.event)!=null&&r.type?.startsWith(`key`)&&e.target===`_blank`&&(vt()?i=!0:a=!0);let c=St()&&vt()&&!bt()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:i,ctrlKey:a,altKey:o,shiftKey:s}):new MouseEvent(`click`,{metaKey:i,ctrlKey:a,altKey:o,shiftKey:s,detail:1,bubbles:!0,cancelable:!0});U.isOpening=n,dt(e),e.dispatchEvent(c),U.isOpening=!1}U.isOpening=!1;let W=new Map,Et=new Set;function Dt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{if(!e(t)||!t.target)return;let r=W.get(t.target);r||(r=new Set,W.set(t.target,r),t.target.addEventListener(`transitioncancel`,n,{once:!0})),r.add(t.propertyName)},n=t=>{if(!e(t)||!t.target)return;let r=W.get(t.target);if(r&&(r.delete(t.propertyName),r.size===0&&(t.target.removeEventListener(`transitioncancel`,n),W.delete(t.target)),W.size===0)){for(let e of Et)e();Et.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Dt):Dt());function Ot(){for(let[e]of W)`isConnected`in e&&!e.isConnected&&W.delete(e)}function kt(e){requestAnimationFrame(()=>{Ot(),W.size===0?e():Et.add(e)})}function At(){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 jt(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=F(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 Mt(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 Nt=r.useInsertionEffect??N;function G(e){let t=d(null);return Nt(()=>{t.current=e},[e]),o((...e)=>{let n=t.current;return n?.(...e)},[])}function Pt(e,t){N(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Ft(e){return e.pointerType===``&&e.isTrusted?!0:wt()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function It(e){return!wt()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function Lt(e,t,n){let r=G(()=>{n&&n(t)});c(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}const Rt=typeof Element<`u`&&`checkVisibility`in Element.prototype;function zt(e){let t=L(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 Bt(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 Vt(e,t){return Rt?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&zt(e)&&Bt(e,t)&&(!e.parentElement||Vt(e.parentElement,e))}const Ht=[`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`],Ut=Ht.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;Ht.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const Wt=Ht.join(`:not([hidden]):not([tabindex="-1"]),`);function Gt(e){return e.matches(Ut)&&Vt(e)&&!qt(e)}function Kt(e){return e.matches(Wt)&&Vt(e)&&!qt(e)}function qt(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const Jt=typeof document<`u`?r.useInsertionEffect??r.useLayoutEffect:()=>{};function Yt(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;Jt(()=>{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])]}const Xt=Symbol(`default`);function Zt({values:e,children:t}){for(let[n,i]of e)t=r.createElement(n.Provider,{value:i},t);return t}function K(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:o,values:s}=e;return l(()=>{let e,c,l;return e=typeof t==`function`?t({...s,defaultClassName:i}):t,c=typeof n==`function`?n({...s,defaultStyle:o||{}}):n,l=typeof r==`function`?r({...s,defaultChildren:a}):r??a,{className:e??i,style:c||o?{...o,...c}:void 0,children:l??a,"data-rac":``}},[t,n,r,i,a,o,s])}function Qt(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function $t(e,t){let n=s(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||Xt;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 q(e,t,n){let{ref:r,...i}=$t(n,e.slot)||{},a=Mt(l(()=>rt(t,r),[t,r])),o=B(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 en(e=!0){let[t,n]=f(e),r=d(!1),i=o(e=>{r.current=!0,n(!!e)},[]);return N(()=>{r.current||n(!1)},[]),[i,t]}function tn(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}const nn=7e3;let J=null;function rn(e,t=`assertive`,n=nn){J?J.announce(e,t,n):(J=new an,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?J.announce(e,t,n):setTimeout(()=>{J?.isAttached()&&J?.announce(e,t,n)},100))}var an=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=nn){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 on=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),sn=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function cn(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 on.has(t.script)}let t=e.split(`-`)[0];return sn.has(t)}const ln=Symbol.for(`react-aria.i18n.locale`);function un(){let e=typeof window<`u`&&window[ln]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:cn(e)?`rtl`:`ltr`}}let dn=un(),fn=new Set;function pn(){dn=un();for(let e of fn)e(dn)}function mn(){let e=Ge(),[t,n]=f(dn);return c(()=>(fn.size===0&&window.addEventListener(`languagechange`,pn),fn.add(n),()=>{fn.delete(n),fn.size===0&&window.removeEventListener(`languagechange`,pn)}),[]),e?{locale:typeof window<`u`&&window[ln]||`en-US`,direction:`ltr`}:t}const hn=r.createContext(null);function gn(){let e=mn();return s(hn)||e}function _n(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function vn(e,t,n){_n(e,t),t.set(e,n)}function yn(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function bn(e,t){Object.defineProperty(e,`target`,{value:t}),Object.defineProperty(e,`currentTarget`,{value:t})}function xn(e){let t=d({isFocused:!1,observer:null});return N(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),o(n=>{if(n.target instanceof HTMLButtonElement||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=n.target;r.addEventListener(`focusout`,n=>{if(t.current.isFocused=!1,r.disabled){let t=yn(n);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;(e=t.current.observer)==null||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:n})),r.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}let Sn=!1;function Cn(e){for(;e&&!Gt(e);)e=e.parentElement;let t=L(e),n=t.document.activeElement;if(!n||n===e)return;Sn=!0;let r=!1,i=e=>{(e.target===n||r)&&e.stopImmediatePropagation()},a=t=>{(t.target===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,dt(n),c()))},o=t=>{(t.target===e||r)&&t.stopImmediatePropagation()},s=t=>{(t.target===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,dt(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),Sn=!1,r=!1},l=requestAnimationFrame(c);return c}let Y=`default`,wn=``,Tn=new WeakMap;function En(e){if(xt()){if(Y===`default`){let t=I(e);wn=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}Y=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;Tn.set(e,e.style[t]),e.style[t]=`none`}}function Dn(e){if(xt()){if(Y!==`disabled`)return;Y=`restoring`,setTimeout(()=>{kt(()=>{if(Y===`restoring`){let t=I(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=wn||``),wn=``,Y=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Tn.has(e)){let t=Tn.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),Tn.delete(e)}}const On=r.createContext({register:()=>{}});On.displayName=`PressResponderContext`;function kn(e,t){return t.get?t.get.call(e):t.value}function An(e,t,n){if(!t.has(e))throw TypeError(`attempted to `+n+` private field on non-instance`);return t.get(e)}function jn(e,t){return kn(e,An(e,t,`get`))}function Mn(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw TypeError(`attempted to set read only private field`);t.value=n}}function Nn(e,t,n){return Mn(e,An(e,t,`set`),n),n}function Pn(e){let t=s(On);if(t){let{register:n,...r}=t;e=B(r,e),n()}return Pt(t,e.ref),e}var Fn=new WeakMap,In=class{continuePropagation(){Nn(this,Fn,!1)}get shouldStopPropagation(){return jn(this,Fn)}constructor(e,t,n,r){vn(this,Fn,{writable:!0,value:void 0}),Nn(this,Fn,!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}};const Ln=Symbol(`linkClicked`),Rn=`react-aria-pressable-style`,zn=`data-react-aria-pressable`;function X(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}=Pn(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,removeGlobalListener:w}=At(),T=o((e,t)=>{let i=x.current;if(u||i.didFirePressStart)return!1;let a=!0;if(i.isTriggeringEvent=!0,r){let n=new In(`pressstart`,t,e);r(n),a=n.shouldStopPropagation}return n&&n(!0),i.isTriggeringEvent=!1,i.didFirePressStart=!0,b(!0),a},[u,r,n]),E=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 In(`pressend`,r,e);i(t),s=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&a&&!u){let n=new In(`press`,r,e);t(n),s&&=n.shouldStopPropagation}return o.isTriggeringEvent=!1,s},[u,i,n,t]),D=G(E),O=o((e,t)=>{let n=x.current;if(u)return!1;if(a){n.isTriggeringEvent=!0;let r=new In(`pressup`,t,e);return a(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[u,a]),ee=G(O),k=o(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&E(Z(t.target,e),t.pointerType,!1),t.isPressed=!1,se(null),t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||Dn(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,E]),A=G(k),te=o(e=>{h&&k(e)},[h,k]),j=o(e=>{u||s?.(e)},[u,s]),ne=o((e,t)=>{if(!u&&s){let n=new MouseEvent(`click`,e);bn(n,t),s(yn(n))}},[u,s]),re=G(ne),[ie,ae]=f(!1);N(()=>{let e=x.current;if(ie){let t=t=>{if(e.isPressed&&e.target&&Vn(t,e.target)){var n;Un(z(t),t.key)&&t.preventDefault();let r=z(t),i=R(e.target,z(t));D(Z(e.target,t),`keyboard`,i),i&&re(t,e.target),C(),t.key!==`Enter`&&Bn(e.target)&&R(e.target,r)&&!t[Ln]&&(t[Ln]=!0,U(e.target,t,!1)),e.isPressed=!1,ae(!1),(n=e.metaKeyEvents)==null||n.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){var r;let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())(r=e.target)==null||r.dispatchEvent(new KeyboardEvent(`keyup`,n))}},n=e.target,r=Xe(t=>{n&&Vn(t,n)&&!t.repeat&&R(n,z(t))&&e.target&&ee(Z(e.target,t),`keyboard`)},t);return S(I(e.target),`keyup`,r,!0),()=>{w(I(e.target),`keyup`,r,!0)}}},[ie,S,C,w]);let[oe,se]=f(null);N(()=>{let e=x.current;if(oe===`pointer`){let t=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(R(e.target,z(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?A(t):(dt(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else A(t);e.isOverTarget=!1}},n=e=>{A(e)};return S(I(e.target),`pointerup`,t,!1),S(I(e.target),`pointercancel`,n,!1),()=>{w(I(e.target),`pointerup`,t,!1),w(I(e.target),`pointercancel`,n,!1)}}},[oe,S,w]);let ce=l(()=>{let e=x.current,t={onKeyDown(t){if(Vn(t.nativeEvent,t.currentTarget)&&R(t.currentTarget,z(t.nativeEvent))){var n;Un(z(t.nativeEvent),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,ae(!0),e.pointerType=`keyboard`,r=T(t,`keyboard`)),r&&t.stopPropagation(),t.metaKey&&vt()&&((n=e.metaKeyEvents)==null||n.set(t.key,t.nativeEvent))}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!R(t.currentTarget,z(t.nativeEvent)))&&t&&t.button===0&&!e.isTriggeringEvent&&!U.isOpening){let n=!0;if(u&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Ft(t.nativeEvent))){let e=T(t,`virtual`),r=O(t,`virtual`),i=E(t,`virtual`);j(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=O(Z(t.currentTarget,t),r),a=E(Z(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,j(t),k(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}};return typeof PointerEvent<`u`&&(t.onPointerDown=t=>{if(t.button!==0||!R(t.currentTarget,z(t.nativeEvent)))return;if(It(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let n=!0;if(!e.isPressed){e.isPressed=!0,se(`pointer`),e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,g||En(e.target),n=T(t,e.pointerType);let r=z(t.nativeEvent);`releasePointerCapture`in r&&r.releasePointerCapture(t.pointerId)}n&&t.stopPropagation()},t.onMouseDown=t=>{if(R(t.currentTarget,z(t.nativeEvent))&&t.button===0){if(m){let n=Cn(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!R(t.currentTarget,z(t.nativeEvent))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&O(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,T(Z(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(Z(e.target,t),e.pointerType,!1),te(t))},t.onDragStart=e=>{R(e.currentTarget,z(e.nativeEvent))&&k(e)}),t},[u,m,C,g,k,te,E,T,O,j,ne]);return c(()=>{if(!_)return;let e=I(_.current);if(!e||!e.head||e.getElementById(Rn))return;let t=e.createElement(`style`);t.id=Rn,t.textContent=`
|
|
1
|
+
import{n as e,t}from"./routing-ZHrE7mgA.js";import{ErrorBoundary as n}from"react-error-boundary";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{useLocalStorage as p,useSessionStorage as m,useTimeout as h}from"usehooks-ts";import{z as g}from"zod/v4/mini";import _ from"ky";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";import x from"clsx";import S,{flushSync as C}from"react-dom";function w(e){return e.issues[0]?.message??`Invalid input`}const T=g.object({type:g.literal(`next`)}),E=g.object({type:g.literal(`end`)}),D=g.object({type:g.literal(`jump`),target:g.number({error:`Target question is required`})}),O=g.discriminatedUnion(`type`,[T,D,E]),ee=g.object({type:g.literal(`value`),value:g.union([g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),g.number({error:`Value is required`})])}),k=g.object({type:g.literal(`binary-operator`),operator:g.union([g.literal(`equal`),g.literal(`not-equal`),g.literal(`greater`),g.literal(`greater-or-equal`),g.literal(`less`),g.literal(`less-or-equal`),g.literal(`contains`),g.literal(`not-contains`)]),value:ee,target:O}),te=g.object({type:g.literal(`switch`),cases:g.array(k),default:O}),ne=g.object({type:g.literal(`always`),target:O}),re=g.discriminatedUnion(`type`,[ne,te]),ie=g.string().check(g.trim(),g.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),ae=g.optional(g.string().check(g.trim(),g.maxLength(50))),oe=g.object({value:g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),description:g.optional(g.string().check(g.trim()))}),se=g.nullable(g.object({label:g.string().check(g.trim(),g.minLength(1,{error:`Value is required`})),max:g.number(),description:g.optional(g.string().check(g.trim()))})),ce=g.object({type:g.literal(`rating`),buttonLabel:ae,scale:g.number().check(g.minimum(2),g.maximum(10)),labels:g.optional(g.object({lower:g.optional(g.pipe(g.string().check(g.trim()),g.transform(e=>e===``?void 0:e))),upper:g.optional(g.pipe(g.string().check(g.trim()),g.transform(e=>e===``?void 0:e)))})),display:g.optional(g.literal([`star`,`emoji`,`number`]))}),le=g.object({type:g.literal(`open-ended`),placeholder:g.optional(g.string()),buttonLabel:ae,max:g.number()}),ue=g.object({type:g.literal(`single-select`),options:g.array(oe),buttonLabel:ae,editable:se}),de=g.object({type:g.literal(`multi-select`),buttonLabel:ae,options:g.array(oe),editable:se,max:g.optional(g.number()),display:g.optional(g.literal([`checkbox`,`tag`]))}),fe=g.object({type:g.literal(`statement`),buttonLabel:ae,buttonUrl:g.optional(ie)}),pe=g.discriminatedUnion(`type`,[ce,ue,le,de,fe]),me=`__CONFETTI_CHECKBOX_Others`,he=`__CONFETTI_RADIO_Others`,ge=e=>g.number().check(g.int(),g.minimum(1),g.maximum(e)),_e=({scale:e},{required:t})=>{let n=ge(e);return t?n:g.optional(n)},ve=({maxLength:e},{required:t})=>g.string().check(g.trim(),...t?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),ye=(e,t)=>g.string().check(g.trim(),...t?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),g.refine(e=>e!==he,{error:`Please fill out the free text field`})),be=({maxLength:e},{required:t})=>{let n=ye(e,t);return t?n:g.optional(n)},xe=({maxSelected:e,maxLength:t},{required:n})=>g.array(g.string().check(g.trim(),...n?[g.minLength(1,{error:`This field is required`})]:[],g.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),g.refine(e=>e!==me,{error:`Please fill out the free text field`}))).check(...n?[g.minLength(1,{error:`Please select at least one option`})]:[],g.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),Se=()=>g.optional(g.string()),Ce=g.object({title:g.string().check(g.trim()),description:g.string().check(g.trim()),buttonText:g.string().check(g.trim())}),we=g.object({title:g.string(),description:g.nullable(g.string()),questions:g.array(g.object({id:g.string(),title:g.string(),description:g.nullable(g.string()),position:g.number(),required:g.boolean(),properties:pe,routingLogic:re})),confirmation:Ce});g.object({respondent:g.string().check(g.trim(),g.minLength(1),g.maxLength(2048)),data:g.record(g.string(),g.union([g.string().check(g.trim(),g.maxLength(2048)),g.number(),g.array(g.string().check(g.trim(),g.maxLength(2048))).check(g.maxLength(1024))])),metadata:g.record(g.string().check(g.trim(),g.maxLength(1e3)),g.string().check(g.trim(),g.maxLength(1e3)))});const Te=g.object({lastRespondedAt:g.nullable(g.union([g.iso.datetime(),g.date()])),lastViewedAt:g.nullable(g.union([g.iso.datetime(),g.date()])),lastDismissedAt:g.nullable(g.union([g.iso.datetime(),g.date()]))});g.object({type:g.enum([`view`,`dismiss`])});const Ee=_.create({prefixUrl:`https://confetti.gov.sg/api`,retry:{limit:3,methods:[`get`]},timeout:6e4}),De=i(null),Oe=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},isSurveyVisible:a,apiBaseUrl:s})=>{let u=d(!1),[m,h]=f(),[g,_]=f(!1),[v,b]=f(null),[x,S]=f(null),C=l(()=>crypto.randomUUID(),[]),[w,T]=p(`cfti:${t}:respondent`,``);c(()=>{w||T(crypto.randomUUID())},[w,T]);let E=l(()=>r||w,[r,w]),D=l(()=>{let e={headers:{"x-cfti-pk":n}};return s&&(e.prefixUrl=s),Ee.extend(e)},[s,n]),O=o(async()=>{if(!E)return;let e=await D.get(`v1/cfti/${t}/respondent/${E}`).json(),n=Te.safeParse(e);n.success&&(b(n.data.lastRespondedAt?new Date(n.data.lastRespondedAt):null),S(n.data.lastDismissedAt?new Date(n.data.lastDismissedAt):null))},[D,E,t]);c(()=>{if(typeof window>`u`||typeof document>`u`)return;let e=()=>{document.visibilityState===`visible`&&O()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[O]),c(()=>{(async()=>{u.current=!1,_(!1),h(void 0),b(null),S(null);try{let e=await D.get(`v1/cfti/${t}`).json(),n=we.safeParse(e);if(!n.success)return;h(n.data),await O()}catch{}finally{_(!0)}})()},[D,O,t]);let ee=o(async({answers:e})=>{await D.put(`v1/cfti/${t}/response/${C}`,{json:{respondent:E,data:e,metadata:i}})},[D,i,E,C,t]),k=o(()=>{h(void 0),D.post(`v1/cfti/${t}/respondent/${E}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[D,E,t]),te=l(()=>g?a===void 0?!0:typeof a==`boolean`?a:a({lastRespondedAt:v,lastDismissedAt:x}):!1,[g,a,v,x]);return c(()=>{u.current||te&&m&&E&&(u.current=!0,D.post(`v1/cfti/${t}/respondent/${E}/event`,{json:{type:`view`}}).catch(()=>{}))},[D,te,E,m,t]),!te||!m?null:y(De.Provider,{value:{submit:ee,dismiss:k,surveyId:t,survey:m,metadata:i},children:e})},ke=()=>{let e=s(De);if(!e)throw Error(`useConfetti must be used within a ConfettiProvider`);return e},Ae={rating:({scale:e},t)=>_e({scale:e},t),"open-ended":({max:e},t)=>ve({maxLength:e},t),"single-select":({editable:e},t)=>be({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>xe({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>Se()},je=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=Ae[n];return r(e,t)}case`open-ended`:{let r=Ae[n];return r(e,t)}case`single-select`:{let r=Ae[n];return r(e,t)}case`multi-select`:{let r=Ae[n];return r(e,t)}case`statement`:{let r=Ae[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Me=({originalQuestions:t,answers:n,errors:r,pointer:i=-1})=>{if(!t)return{questions:[],currentIndex:-1};let a=t.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 t=0;t<a.length;t++){let r=a[t];if(!r)continue;let o=e({index:t,questions:a,answers:n});r.visible=i===t||o}let o=a.findIndex((e,t)=>t>i&&e.visible&&n[e.id]===void 0);return o===-1&&(o=a.findLastIndex(e=>!!e.visible)),{questions:a,currentIndex:o}},Ne=({questions:e,answers:t})=>{let n=Pe({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Pe=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Fe=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Ie=({current:e,shouldAutoSubmit:t,onFinished:n,children:r})=>{let{survey:i,submit:a}=ke(),[s,c]=f({}),[u,d]=f({}),p=l(()=>Me({originalQuestions:i?.questions,answers:s,errors:u,pointer:e}),[i?.questions,s,u,e]),m=l(()=>!!p.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>s[e]!==void 0),[s,p.questions]),[h,g]=f(!1),_=o(({answers:e})=>{a({answers:e}).finally(()=>{n?.()})},[n,a]),b=o(()=>{_({answers:Ne({questions:p.questions,answers:s})}),g(!0)},[s,p.questions,_]),x=o(({question:n,answer:r})=>{let a=p.questions.at(n);if(!a)return{error:`Question index is invalid`};let o=je(a.properties,{required:a.required}).safeParse(r);if(!o.success){let e=w(o.error);return d(t=>{if(t[a.id]===e)return t;let n={...t};return n[a.id]=e,n}),c(e=>{if(!(a.id in e))return e;let t={...e};return delete t[a.id],t}),{error:e}}d(e=>{if(!e[a.id])return e;let t={...e};return delete t[a.id],t});let l=!a.required&&!r?null:r,f={...s};if(f[a.id]===l)return{next:Me({originalQuestions:i?.questions,answers:f,errors:u,pointer:e}).currentIndex};f[a.id]=l;let m=Me({originalQuestions:i?.questions,answers:f,errors:u,pointer:e});return f=Pe({questions:m.questions,answers:f}),c(f),d(Fe({questions:m.questions,errors:u})),m.questions.filter(({visible:e})=>!!e).every(({id:e})=>f[e]!==void 0)&&t&&(_({answers:Ne({questions:m.questions,answers:f})}),g(!0)),{next:m.currentIndex}},[p.questions,s,i?.questions,u,t,e,_]);return p.questions.length===0?y(v,{}):y(`div`,{className:`confetti`,children:r({questions:p.questions,current:e??p.currentIndex,update:x,isCompleted:m,submit:b,isSubmitted:h,errors:u})})},Le=({children:e,onFinished:t,shouldAutoSubmit:r,...i})=>y(n,{fallback:y(v,{}),children:y(Oe,{...i,children:y(Ie,{shouldAutoSubmit:r,onFinished:t,children:e})})}),Re=i(null);i(null),i(null),i(null),i(null);const ze=i({});i(null);const Be=i(null),A=typeof document<`u`?r.useLayoutEffect:()=>{};function Ve(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])]}const He={prefix:String(Math.round(Math.random()*1e10)),current:0},Ue=r.createContext(He),We=r.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let Ge=new WeakMap;function Ke(e=!1){let t=s(Ue),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=Ge.get(e);n==null?Ge.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,Ge.delete(e))}n.current=++t.current}return n.current}function qe(e){let t=s(Ue),n=Ke(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function Je(e){let t=r.useId(),[n]=f($e()),i=n?`react-aria`:`react-aria${He.prefix}`;return e||`${i}-${t}`}const Ye=typeof r.useId==`function`?Je:qe;function Xe(){return!1}function Ze(){return!0}function Qe(e){return()=>{}}function $e(){return typeof r.useSyncExternalStore==`function`?r.useSyncExternalStore(Qe,Xe,Ze):s(We)}let et=!!(typeof window<`u`&&window.document&&window.document.createElement),tt=new Map,nt;typeof FinalizationRegistry<`u`&&(nt=new FinalizationRegistry(e=>{tt.delete(e)}));function rt(e){let[t,n]=f(e),r=d(null),i=Ye(t),a=d(null);if(nt&&nt.register(a,i),et){let e=tt.get(i);e&&!e.includes(r)?e.push(r):tt.set(i,[r])}return A(()=>{let e=i;return()=>{nt&&nt.unregister(a),tt.delete(e)}},[i]),c(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function it(e,t){if(e===t)return e;let n=tt.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=tt.get(t);return r?(r.forEach(t=>t.current=e),e):t}function at(e=[]){let t=rt(),[n,r]=Ve(t),i=o(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return A(i,[t,i,...e]),n}function ot(...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 st(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function ct(e){return st(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function lt(){return!1}function N(e,t){if(!lt())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:ct(n)?n.host:n.parentNode}return!1}const P=(e=document)=>{if(!lt())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function F(e){return lt()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}var ut=class{get currentNode(){return this._currentNode}set currentNode(e){if(!N(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 N(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}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);if(this.filter?.acceptNode)return this.filter.acceptNode(e);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)}}};function dt(e,t,n,r){return lt()?new ut(e,t,n,r):e.createTreeWalker(t,n,r)}function I(...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]=ot(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=x(n,i):e===`id`&&n&&i?t.id=it(n,i):t[e]=i===void 0?n:i}}return t}function ft(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=pt(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():pt(e[n],null)})}}}function pt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}const mt=new Set([`id`]),ht=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),gt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),_t=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),vt=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(`.`)),yt=/^(data-.*)$/;function L(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)&&(mt.has(t)||n&&ht.has(t)||r&>.has(t)||i&&_t.has(t)||a&&(vt.has(t)||t.endsWith(`Capture`)&&vt.has(t.slice(0,-7)))||o?.has(t)||yt.test(t))&&(s[t]=e[t]);return s}function bt(e){if(St())e.focus({preventScroll:!0});else{let t=Ct(e);e.focus(),wt(t)}}let xt=null;function St(){if(xt==null){xt=!1;try{document.createElement(`div`).focus({get preventScroll(){return xt=!0,!0}})}catch{}}return xt}function Ct(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 wt(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function Tt(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 Et(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function R(e){let t=null;return()=>(t??=e(),t)}const Dt=R(function(){return Et(/^Mac/i)}),Ot=R(function(){return Et(/^iPhone/i)}),kt=R(function(){return Et(/^iPad/i)||Dt()&&navigator.maxTouchPoints>1}),At=R(function(){return Ot()||kt()}),jt=R(function(){return Tt(/AppleWebKit/i)&&!Mt()}),Mt=R(function(){return Tt(/Chrome/i)}),Nt=R(function(){return Tt(/Android/i)}),Pt=R(function(){return Tt(/Firefox/i)});function Ft(e,t,n=!0){var r;let{metaKey:i,ctrlKey:a,altKey:o,shiftKey:s}=t;Pt()&&(r=window.event)!=null&&r.type?.startsWith(`key`)&&e.target===`_blank`&&(Dt()?i=!0:a=!0);let c=jt()&&Dt()&&!kt()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:i,ctrlKey:a,altKey:o,shiftKey:s}):new MouseEvent(`click`,{metaKey:i,ctrlKey:a,altKey:o,shiftKey:s,detail:1,bubbles:!0,cancelable:!0});Ft.isOpening=n,bt(e),e.dispatchEvent(c),Ft.isOpening=!1}Ft.isOpening=!1;let z=new Map,It=new Set;function Lt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{if(!e(t)||!t.target)return;let r=z.get(t.target);r||(r=new Set,z.set(t.target,r),t.target.addEventListener(`transitioncancel`,n,{once:!0})),r.add(t.propertyName)},n=t=>{if(!e(t)||!t.target)return;let r=z.get(t.target);if(r&&(r.delete(t.propertyName),r.size===0&&(t.target.removeEventListener(`transitioncancel`,n),z.delete(t.target)),z.size===0)){for(let e of It)e();It.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Lt):Lt());function Rt(){for(let[e]of z)`isConnected`in e&&!e.isConnected&&z.delete(e)}function zt(e){requestAnimationFrame(()=>{Rt(),z.size===0?e():It.add(e)})}function Bt(){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 Vt(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=rt(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 Ht(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 Ut=r.useInsertionEffect??A;function B(e){let t=d(null);return Ut(()=>{t.current=e},[e]),o((...e)=>{let n=t.current;return n?.(...e)},[])}function Wt(e,t){A(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Gt(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return r&&t&&(r=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),r}function Kt(e,t){let n=e;for(Gt(n,t)&&(n=n.parentElement);n&&!Gt(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const qt=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Jt(e){return e instanceof HTMLInputElement&&!qt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let V=typeof document<`u`&&window.visualViewport;function Yt(){let e=$e(),[t,n]=f(()=>e?{width:0,height:0}:Xt());return c(()=>{let e=()=>{V&&V.scale>1||n(e=>{let t=Xt();return t.width===e.width&&t.height===e.height?e:t})},t,r=e=>{V&&V.scale>1||Jt(e.target)&&(t=requestAnimationFrame(()=>{(!document.activeElement||!Jt(document.activeElement))&&n(e=>{let t={width:window.innerWidth,height:window.innerHeight};return t.width===e.width&&t.height===e.height?e:t})}))};return window.addEventListener(`blur`,r,!0),V?V.addEventListener(`resize`,e):window.addEventListener(`resize`,e),()=>{cancelAnimationFrame(t),window.removeEventListener(`blur`,r,!0),V?V.removeEventListener(`resize`,e):window.removeEventListener(`resize`,e)}},[]),t}function Xt(){return{width:V?V.width*V.scale:window.innerWidth,height:V?V.height*V.scale:window.innerHeight}}function Zt(e){return e.pointerType===``&&e.isTrusted?!0:Nt()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Qt(e){return!Nt()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function $t(e,t,n){let r=B(()=>{n&&n(t)});c(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function en(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]),nn(e,i,o(()=>r(!1),[])),i}function tn(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 nn(e,i,o(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function nn(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.all(t.map(e=>e.finished)).then(()=>{r||C(()=>{n()})}).catch(()=>{}),()=>{r=!0}}},[e,t,n])}const rn=typeof Element<`u`&&`checkVisibility`in Element.prototype;function an(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 on(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 rn?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&an(e)&&on(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`],ln=cn.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;cn.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const un=cn.join(`:not([hidden]):not([tabindex="-1"]),`);function dn(e){return e.matches(ln)&&sn(e)&&!pn(e)}function fn(e){return e.matches(un)&&sn(e)&&!pn(e)}function pn(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const mn=typeof document<`u`?r.useInsertionEffect??r.useLayoutEffect:()=>{};function hn(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;mn(()=>{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])]}const gn=Symbol(`default`);function _n({values:e,children:t}){for(let[n,i]of e)t=r.createElement(n.Provider,{value:i},t);return t}function H(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:o,values:s}=e;return l(()=>{let e,c,l;return e=typeof t==`function`?t({...s,defaultClassName:i}):t,c=typeof n==`function`?n({...s,defaultStyle:o||{}}):n,l=typeof r==`function`?r({...s,defaultChildren:a}):r??a,{className:e??i,style:c||o?{...o,...c}:void 0,children:l??a,"data-rac":``}},[t,n,r,i,a,o,s])}function vn(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function yn(e,t){let n=s(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||gn;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 U(e,t,n){let{ref:r,...i}=yn(n,e.slot)||{},a=Ht(l(()=>ft(t,r),[t,r])),o=I(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 bn(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 xn(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}const Sn=7e3;let Cn=null;function wn(e,t=`assertive`,n=Sn){Cn?Cn.announce(e,t,n):(Cn=new Tn,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?Cn.announce(e,t,n):setTimeout(()=>{Cn?.isAttached()&&Cn?.announce(e,t,n)},100))}var Tn=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=Sn){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 En=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Dn=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function On(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 En.has(t.script)}let t=e.split(`-`)[0];return Dn.has(t)}const kn=Symbol.for(`react-aria.i18n.locale`);function An(){let e=typeof window<`u`&&window[kn]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:On(e)?`rtl`:`ltr`}}let jn=An(),Mn=new Set;function Nn(){jn=An();for(let e of Mn)e(jn)}function Pn(){let e=$e(),[t,n]=f(jn);return c(()=>(Mn.size===0&&window.addEventListener(`languagechange`,Nn),Mn.add(n),()=>{Mn.delete(n),Mn.size===0&&window.removeEventListener(`languagechange`,Nn)}),[]),e?{locale:typeof window<`u`&&window[kn]||`en-US`,direction:`ltr`}:t}const Fn=r.createContext(null);function In(){let e=Pn();return s(Fn)||e}const Ln=Symbol.for(`react-aria.i18n.locale`),Rn=Symbol.for(`react-aria.i18n.strings`);let zn;var Bn=class e{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=Vn(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[Ln];if(zn===void 0){let t=window[Rn];if(!t)return null;for(let r in zn={},t)zn[r]=new e({[n]:t[r]},n)}let r=zn?.[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}constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}};function Vn(e,t,n=`en-US`){if(t[e])return t[e];let r=Hn(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function Hn(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const Un=new Map,Wn=new Map;var Gn=class{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=Un.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),Un.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=Wn.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),Wn.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}constructor(e,t){this.locale=e,this.strings=t}};const Kn=new WeakMap;function qn(e){let t=Kn.get(e);return t||(t=new Bn(e),Kn.set(e,t)),t}function Jn(e,t){return t&&Bn.getGlobalDictionaryForPackage(t)||qn(e)}function Yn(e,t){let{locale:n}=In(),r=Jn(e,t);return l(()=>new Gn(n,r),[n,r])}function Xn(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function Zn(e,t,n){Xn(e,t),t.set(e,n)}function Qn(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function $n(e,t){Object.defineProperty(e,`target`,{value:t}),Object.defineProperty(e,`currentTarget`,{value:t})}function er(e){let t=d({isFocused:!1,observer:null});return A(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),o(n=>{if(n.target instanceof HTMLButtonElement||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLSelectElement){t.current.isFocused=!0;let r=n.target;r.addEventListener(`focusout`,n=>{if(t.current.isFocused=!1,r.disabled){let t=Qn(n);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&r.disabled){var e;(e=t.current.observer)==null||e.disconnect();let n=r===document.activeElement?null:document.activeElement;r.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:n})),r.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:n}))}}),t.current.observer.observe(r,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}let tr=!1;function nr(e){for(;e&&!dn(e);)e=e.parentElement;let t=M(e),n=t.document.activeElement;if(!n||n===e)return;tr=!0;let r=!1,i=e=>{(e.target===n||r)&&e.stopImmediatePropagation()},a=t=>{(t.target===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,bt(n),c()))},o=t=>{(t.target===e||r)&&t.stopImmediatePropagation()},s=t=>{(t.target===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,bt(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),tr=!1,r=!1},l=requestAnimationFrame(c);return c}let rr=`default`,ir=``,ar=new WeakMap;function or(e){if(At()){if(rr===`default`){let t=j(e);ir=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}rr=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;ar.set(e,e.style[t]),e.style[t]=`none`}}function sr(e){if(At()){if(rr!==`disabled`)return;rr=`restoring`,setTimeout(()=>{zt(()=>{if(rr===`restoring`){let t=j(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=ir||``),ir=``,rr=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&ar.has(e)){let t=ar.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),ar.delete(e)}}const cr=r.createContext({register:()=>{}});cr.displayName=`PressResponderContext`;function lr(e,t){return t.get?t.get.call(e):t.value}function ur(e,t,n){if(!t.has(e))throw TypeError(`attempted to `+n+` private field on non-instance`);return t.get(e)}function dr(e,t){return lr(e,ur(e,t,`get`))}function fr(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw TypeError(`attempted to set read only private field`);t.value=n}}function pr(e,t,n){return fr(e,ur(e,t,`set`),n),n}function mr(e){let t=s(cr);if(t){let{register:n,...r}=t;e=I(r,e),n()}return Wt(t,e.ref),e}var hr=new WeakMap,gr=class{continuePropagation(){pr(this,hr,!1)}get shouldStopPropagation(){return dr(this,hr)}constructor(e,t,n,r){Zn(this,hr,{writable:!0,value:void 0}),pr(this,hr,!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}};const _r=Symbol(`linkClicked`),vr=`react-aria-pressable-style`,yr=`data-react-aria-pressable`;function br(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}=mr(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,removeGlobalListener:w}=Bt(),T=o((e,t)=>{let i=x.current;if(u||i.didFirePressStart)return!1;let a=!0;if(i.isTriggeringEvent=!0,r){let n=new gr(`pressstart`,t,e);r(n),a=n.shouldStopPropagation}return n&&n(!0),i.isTriggeringEvent=!1,i.didFirePressStart=!0,b(!0),a},[u,r,n]),E=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 gr(`pressend`,r,e);i(t),s=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&a&&!u){let n=new gr(`press`,r,e);t(n),s&&=n.shouldStopPropagation}return o.isTriggeringEvent=!1,s},[u,i,n,t]),D=B(E),O=o((e,t)=>{let n=x.current;if(u)return!1;if(a){n.isTriggeringEvent=!0;let r=new gr(`pressup`,t,e);return a(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[u,a]),ee=B(O),k=o(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&E(W(t.target,e),t.pointerType,!1),t.isPressed=!1,le(null),t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||sr(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,E]),te=B(k),ne=o(e=>{h&&k(e)},[h,k]),re=o(e=>{u||s?.(e)},[u,s]),ie=o((e,t)=>{if(!u&&s){let n=new MouseEvent(`click`,e);$n(n,t),s(Qn(n))}},[u,s]),ae=B(ie),[oe,se]=f(!1);A(()=>{let e=x.current;if(oe){let t=t=>{if(e.isPressed&&e.target&&Sr(t,e.target)){var n;wr(F(t),t.key)&&t.preventDefault();let r=F(t),i=N(e.target,F(t));D(W(e.target,t),`keyboard`,i),i&&ae(t,e.target),C(),t.key!==`Enter`&&xr(e.target)&&N(e.target,r)&&!t[_r]&&(t[_r]=!0,Ft(e.target,t,!1)),e.isPressed=!1,se(!1),(n=e.metaKeyEvents)==null||n.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){var r;let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())(r=e.target)==null||r.dispatchEvent(new KeyboardEvent(`keyup`,n))}},n=e.target,r=ot(t=>{n&&Sr(t,n)&&!t.repeat&&N(n,F(t))&&e.target&&ee(W(e.target,t),`keyboard`)},t);return S(j(e.target),`keyup`,r,!0),()=>{w(j(e.target),`keyup`,r,!0)}}},[oe,S,C,w]);let[ce,le]=f(null);A(()=>{let e=x.current;if(ce===`pointer`){let t=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(N(e.target,F(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?te(t):(bt(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else te(t);e.isOverTarget=!1}},n=e=>{te(e)};return S(j(e.target),`pointerup`,t,!1),S(j(e.target),`pointercancel`,n,!1),()=>{w(j(e.target),`pointerup`,t,!1),w(j(e.target),`pointercancel`,n,!1)}}},[ce,S,w]);let ue=l(()=>{let e=x.current,t={onKeyDown(t){if(Sr(t.nativeEvent,t.currentTarget)&&N(t.currentTarget,F(t.nativeEvent))){var n;wr(F(t.nativeEvent),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,se(!0),e.pointerType=`keyboard`,r=T(t,`keyboard`)),r&&t.stopPropagation(),t.metaKey&&Dt()&&((n=e.metaKeyEvents)==null||n.set(t.key,t.nativeEvent))}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!N(t.currentTarget,F(t.nativeEvent)))&&t&&t.button===0&&!e.isTriggeringEvent&&!Ft.isOpening){let n=!0;if(u&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Zt(t.nativeEvent))){let e=T(t,`virtual`),r=O(t,`virtual`),i=E(t,`virtual`);re(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=O(W(t.currentTarget,t),r),a=E(W(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,re(t),k(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}};return typeof PointerEvent<`u`&&(t.onPointerDown=t=>{if(t.button!==0||!N(t.currentTarget,F(t.nativeEvent)))return;if(Qt(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let n=!0;if(!e.isPressed){e.isPressed=!0,le(`pointer`),e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,g||or(e.target),n=T(t,e.pointerType);let r=F(t.nativeEvent);`releasePointerCapture`in r&&r.releasePointerCapture(t.pointerId)}n&&t.stopPropagation()},t.onMouseDown=t=>{if(N(t.currentTarget,F(t.nativeEvent))&&t.button===0){if(m){let n=nr(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!N(t.currentTarget,F(t.nativeEvent))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&O(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,T(W(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(W(e.target,t),e.pointerType,!1),ne(t))},t.onDragStart=e=>{N(e.currentTarget,F(e.nativeEvent))&&k(e)}),t},[u,m,C,g,k,ne,E,T,O,re,ie]);return c(()=>{if(!_)return;let e=j(_.current);if(!e||!e.head||e.getElementById(vr))return;let t=e.createElement(`style`);t.id=vr,t.textContent=`
|
|
2
2
|
@layer {
|
|
3
|
-
[${
|
|
3
|
+
[${yr}] {
|
|
4
4
|
touch-action: pan-x pan-y pinch-zoom;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
`.trim(),e.head.prepend(t)},[_]),c(()=>{let e=x.current;return()=>{g||Dn(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:B(v,ce,{[zn]:!0})}}function Bn(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function Vn(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof L(i).HTMLInputElement&&!Gn(i,n)||i instanceof L(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&Bn(i))&&n!==`Enter`)}function Z(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}}function Hn(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!Bn(e)}function Un(e,t){return e instanceof HTMLInputElement?!Gn(e,t):Hn(e)}const Wn=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Gn(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Wn.has(e.type)}let Q=null,Kn=new Set,qn=new Map,$=!1,Jn=!1;const Yn={Tab:!0,Escape:!0};function Xn(e,t){for(let n of Kn)n(e,t)}function Zn(e){return!(e.metaKey||!vt()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Qn(e){$=!0,!U.isOpening&&Zn(e)&&(Q=`keyboard`,Xn(`keyboard`,e))}function $n(e){Q=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&($=!0,Xn(`pointer`,e))}function er(e){!U.isOpening&&Ft(e)&&($=!0,Q=`virtual`)}function tr(e){e.target===window||e.target===document||Sn||!e.isTrusted||(!$&&!Jn&&(Q=`virtual`,Xn(`virtual`,e)),$=!1,Jn=!1)}function nr(){Sn||($=!1,Jn=!0)}function rr(e){if(typeof window>`u`||typeof document>`u`||qn.get(L(e)))return;let t=L(e),n=I(e),r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){$=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Qn,!0),n.addEventListener(`keyup`,Qn,!0),n.addEventListener(`click`,er,!0),t.addEventListener(`focus`,tr,!0),t.addEventListener(`blur`,nr,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,$n,!0),n.addEventListener(`pointermove`,$n,!0),n.addEventListener(`pointerup`,$n,!0)),t.addEventListener(`beforeunload`,()=>{ir(e)},{once:!0}),qn.set(t,{focus:r})}const ir=(e,t)=>{let n=L(e),r=I(e);t&&r.removeEventListener(`DOMContentLoaded`,t),qn.has(n)&&(n.HTMLElement.prototype.focus=qn.get(n).focus,r.removeEventListener(`keydown`,Qn,!0),r.removeEventListener(`keyup`,Qn,!0),r.removeEventListener(`click`,er,!0),n.removeEventListener(`focus`,tr,!0),n.removeEventListener(`blur`,nr,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,$n,!0),r.removeEventListener(`pointermove`,$n,!0),r.removeEventListener(`pointerup`,$n,!0)),qn.delete(n))};function ar(e){let t=I(e),n;return t.readyState===`loading`?(n=()=>{rr(e)},t.addEventListener(`DOMContentLoaded`,n)):rr(e),()=>ir(e,n)}typeof document<`u`&&ar();function or(){return Q!==`pointer`}function sr(){return Q}function cr(e){Q=e,Xn(e,null)}const lr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function ur(e,t,n){let r=I(n?.target),i=typeof window<`u`?L(n?.target).HTMLInputElement:HTMLInputElement,a=typeof window<`u`?L(n?.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<`u`?L(n?.target).HTMLElement:HTMLElement,s=typeof window<`u`?L(n?.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof i&&!lr.has(r.activeElement.type)||r.activeElement instanceof a||r.activeElement instanceof o&&r.activeElement.isContentEditable,!(e&&t===`keyboard`&&n instanceof s&&!Yn[n.key])}function dr(e,t,n){rr(),c(()=>{let t=(t,r)=>{ur(!!n?.isTextInput,t,r)&&e(or())};return Kn.add(t),()=>{Kn.delete(t)}},t)}function fr(e){let t=I(e);if(sr()===`virtual`){let n=et(t);kt(()=>{let r=et(t);(r===n||r===t.body)&&e.isConnected&&dt(e)})}else dt(e)}function pr(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=o(e=>{if(e.target===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),s=xn(a),c=o(e=>{let t=I(e.target),r=t?et(t):et();e.target===e.currentTarget&&r===z(e.nativeEvent)&&(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 mr(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 hr(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:mr(e.onKeyDown),onKeyUp:mr(e.onKeyUp)}}}let gr=r.createContext(null);function _r(e){let t=s(gr)||{};Pt(t,e);let{ref:n,...r}=t;return r}function vr(e,t){let{focusProps:n}=pr(e),{keyboardProps:r}=hr(e),i=B(n,r),a=_r(t),o=e.isDisabled?{}:a,s=d(e.autoFocus);c(()=>{s.current&&t.current&&fr(t.current),s.current=!1},[t]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:B({...i,tabIndex:l},o)}}function yr(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=d({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:c}=At(),l=o(e=>{e.currentTarget.contains(e.target)&&a.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(a.current.isFocusWithin=!1,c(),n&&n(e),i&&i(!1))},[n,i,a,c]),u=xn(l),f=o(e=>{if(!e.currentTarget.contains(e.target))return;let t=I(e.target),n=et(t);if(!a.current.isFocusWithin&&n===z(e.nativeEvent)){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,u(e);let n=e.currentTarget;s(t,`focus`,e=>{if(a.current.isFocusWithin&&!R(n,e.target)){let r=new t.defaultView.FocusEvent(`blur`,{relatedTarget:e.target});bn(r,n),l(yn(r))}},{capture:!0})}},[r,i,u,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:l}}}let br=!1,xr=0;function Sr(){br=!0,setTimeout(()=>{br=!1},50)}function Cr(e){e.pointerType===`touch`&&Sr()}function wr(){if(!(typeof document>`u`))return xr===0&&typeof PointerEvent<`u`&&document.addEventListener(`pointerup`,Cr),xr++,()=>{xr--,!(xr>0)&&typeof PointerEvent<`u`&&document.removeEventListener(`pointerup`,Cr)}}function Tr(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(wr,[]);let{addGlobalListener:u,removeAllGlobalListeners:p}=At(),{hoverProps:m,triggerHoverEnd:h}=l(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!e.currentTarget.contains(e.target))return;s.isHovered=!0;let c=e.currentTarget;s.target=c,u(I(e.target),`pointerover`,e=>{s.isHovered&&s.target&&!R(s.target,e.target)&&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=>{br&&t.pointerType===`mouse`||e(t,t.pointerType)},c.onPointerLeave=e=>{!i&&e.currentTarget.contains(e.target)&&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 Er(e){if(e.checked)return!0;let t=[];return t=e.form?[...e.form?.elements?.namedItem(e.name)??[]]:[...I(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(e=>!e.form),t?!t.some(e=>e.checked):!1}function Dr(e,t){return!e||!t?!1:t.some(t=>t.contains(e))}function Or(e,t,n){let r=t?.tabbable?Kt:Gt,i=I(e?.nodeType===Node.ELEMENT_NODE?e:null),a=nt(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return t!=null&&t.from?.contains(e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!Er(e)||a.currentNode.tagName===`INPUT`&&a.currentNode.type===`radio`&&a.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||Dr(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}var kr=class e{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 Ar({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&&Dr(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}constructor(){this.fastMap=new Map,this.root=new Ar({scopeRef:null}),this.fastMap.set(null,this.root)}},Ar=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}};new kr;function jr(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=d({isFocused:!1,isFocusVisible:t||or()}),[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,s(e),u()},[u]);dr(e=>{i.current.isFocusVisible=e,u()},[],{isTextInput:n});let{focusProps:m}=pr({isDisabled:r,onFocusChange:p}),{focusWithinProps:h}=yr({isDisabled:!r,onFocusWithinChange:p});return{isFocused:a,isFocusVisible:c,focusProps:r?h:m}}const Mr={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 Nr(e={}){let{style:t,isFocusable:n}=e,[r,i]=f(!1),{focusWithinProps:a}=yr({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=l(()=>r?t:t?{...Mr,...t}:Mr,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Pr(e){let{children:t,elementType:n=`div`,isFocusable:i,style:a,...o}=e,{visuallyHiddenProps:s}=Nr(e);return r.createElement(n,B(o,s),t)}function Fr(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=jt({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Ir(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Fr(e),s=Ye([!!t,!!n,r,i]),c=Ye([!!t,!!n,r,i]);return o=B(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}const Lr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Rr={...Lr,customError:!0,valid:!1},zr={isInvalid:!1,validationDetails:Lr,validationErrors:[]},Br=i({}),Vr=`__formValidationState`+Date.now();function Hr(e){if(e[Vr]){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Vr];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Ur(e)}function Ur(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:u=`aria`}=e;n&&(t||=n===`invalid`);let p=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:Rr},m=l(()=>!o||i==null?null:Kr(Gr(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let h=s(Br),g=l(()=>r?Array.isArray(r)?r.flatMap(e=>Wr(h[e])):Wr(h[r]):[],[h,r]),[_,v]=f(h),[y,b]=f(!1);h!==_&&(v(h),b(!1));let x=l(()=>Kr(y?[]:g),[y,g]),S=d(zr),[C,w]=f(zr),T=d(zr),E=()=>{if(!D)return;O(!1);let e=m||a||S.current;qr(e,T.current)||(T.current=e,w(e))},[D,O]=f(!1);return c(E),{realtimeValidation:p||x||m||a||zr,displayValidation:u===`native`?p||x||C:p||x||m||a||C,updateValidation(e){u===`aria`&&!qr(C,e)?w(e):S.current=e},resetValidation(){let e=zr;qr(e,T.current)||(T.current=e,w(e)),u===`native`&&O(!1),b(!0)},commitValidation(){u===`native`&&O(!0),b(!0)}}}function Wr(e){return e?Array.isArray(e)?e:[e]:[]}function Gr(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Wr(n)}return[]}function Kr(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Rr}:null}function qr(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 Jr(...e){let t=new Set,n=!1,r={...Lr};for(let o of e){var i,a;for(let e of o.validationErrors)t.add(e);for(let e in n||=o.isInvalid,r)(i=r)[a=e]||(i[a]=o.validationDetails[e])}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function Yr(e,t,n){let{validationBehavior:r,focus:i}=e;N(()=>{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(Zr(n.current))}});let a=d(!1),o=G(()=>{a.current||t.resetValidation()}),s=G(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;if(!e.defaultPrevented&&n&&r&&Qr(r)===n.current){var a;i?i():(a=n.current)==null||a.focus(),cr(`keyboard`)}e.preventDefault()}),l=G(()=>{t.commitValidation()});c(()=>{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.target instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function Xr(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 Zr(e){return{isInvalid:!e.validity.valid,validationDetails:Xr(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Qr(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(!n.validity.valid)return n}return null}function $r(e,t){let{inputElementType:n=`input`,isDisabled:i=!1,isRequired:a=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[l,u]=Yt(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=vr(e,t),p=Hr({...e,value:l}),{isInvalid:m,validationErrors:h,validationDetails:g}=p.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=Ir({...e,isInvalid:m,errorMessage:e.errorMessage||h}),x=V(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=f(l);return Lt(t,e.defaultValue??C,u),Yr(e,p,t),{labelProps:_,inputProps:B(x,n===`input`?S:void 0,{disabled:i,readOnly:o,required:a&&c===`native`,"aria-required":a&&c===`aria`||void 0,"aria-invalid":m||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.target.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(r.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:m,validationErrors:h,validationDetails:g}}if(typeof HTMLTemplateElement<`u`){let e=Object.getOwnPropertyDescriptor(Node.prototype,`firstChild`).get;Object.defineProperty(HTMLTemplateElement.prototype,`firstChild`,{configurable:!0,enumerable:!0,get:function(){return this.dataset.reactAriaHidden?this.content.firstChild:e.call(this)}})}const ei=i(!1);function ti(e){let t=(t,n)=>s(ei)?null:e(t,n);return t.displayName=e.displayName||e.name,a(t)}function ni(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}=X({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=vr(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=B(y,_,V(e,{labelable:!0}));return{isPressed:v,buttonProps:B(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`]})}}function ri(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:a,name:o,form:s,children:c,"aria-label":l,"aria-labelledby":u,validationState:d=`valid`,isInvalid:f,onPressStart:p,onPressEnd:m,onPressChange:h,onPress:g,onPressUp:_,onClick:v}=e,y=e=>{e.stopPropagation(),t.setSelected(e.target.checked)},{pressProps:b,isPressed:x}=X({onPressStart:p,onPressEnd:m,onPressChange:h,onPress:g,onPressUp:_,onClick:v,isDisabled:r}),{pressProps:S,isPressed:C}=X({onPressStart:p,onPressEnd:m,onPressChange:h,onPressUp:_,onClick:v,onPress(e){var r;g?.(e),t.toggle(),(r=n.current)==null||r.focus()},isDisabled:r||i}),{focusableProps:w}=vr(e,n),T=B(b,w),E=V(e,{labelable:!0});return Lt(n,t.defaultSelected,t.setSelected),{labelProps:B(S,{onClick:e=>e.preventDefault()}),inputProps:B(E,{"aria-invalid":f||d===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:y,disabled:r,...a==null?{}:{value:a},name:o,form:s,type:`checkbox`,...T}),isSelected:t.isSelected,isPressed:x||C,isDisabled:r,isReadOnly:i,isInvalid:f||d===`invalid`}}function ii(e,t,n){let r=Hr({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:u,isSelected:d,isPressed:f,isDisabled:p,isReadOnly:m}=ri({...e,isInvalid:i},t,n);Yr(e,r,n);let{isIndeterminate:h,isRequired:g,validationBehavior:_=`aria`}=e;c(()=>{n.current&&(n.current.indeterminate=!!h)});let{pressProps:v}=X({isDisabled:p||m,onPress(){let{[Vr]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:B(s,v,l(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...u,checked:d,"aria-required":g&&_===`aria`||void 0,required:g&&_===`native`},isSelected:d,isPressed:f,isDisabled:p,isReadOnly:m,isInvalid:i,validationErrors:a,validationDetails:o}}const ai=new WeakMap;function oi(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:a=`aria`}=e,{isInvalid:o,validationErrors:s,validationDetails:c}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:d,errorMessageProps:f}=Ir({...e,labelElementType:`span`,isInvalid:o,errorMessage:e.errorMessage||s});ai.set(t,{name:r,form:i,descriptionId:d.id,errorMessageId:f.id,validationBehavior:a});let p=V(e,{labelable:!0}),{focusWithinProps:m}=yr({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:B(p,{role:`group`,"aria-disabled":n||void 0,...u,...m}),labelProps:l,descriptionProps:d,errorMessageProps:f,isInvalid:o,validationErrors:s,validationDetails:c}}function si(e={}){let{isReadOnly:t}=e,[n,r]=Yt(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=f(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function ci(e,t,n){let r=si({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:l}=ai.get(t);l=e.validationBehavior??l;let{realtimeValidation:u}=Hr({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),f=d(zr),p=()=>{t.setInvalid(e.value,u.isInvalid?u:f.current)};c(p);let m=t.realtimeValidation.isInvalid?t.realtimeValidation:u,h=l===`native`?t.displayValidation:m,g=ii({...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:l,[Vr]:{realtimeValidation:m,displayValidation:h,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){f.current=e,p()}}},r,n);return{...g,inputProps:{...g.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}const li=new WeakMap;function ui(e,t,n){let{value:r,children:i,"aria-label":a,"aria-labelledby":o,onPressStart:s,onPressEnd:c,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}=X({onPressStart:s,onPressEnd:c,onPressChange:u,onPress:d,onPressUp:f,onClick:p,isDisabled:m}),{pressProps:y,isPressed:b}=X({onPressStart:s,onPressEnd:c,onPressChange:u,onPressUp:f,onClick:p,isDisabled:m,onPress(e){var i;d?.(e),t.setSelectedValue(r),(i=n.current)==null||i.focus()}}),{focusableProps:x}=vr(B(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=B(_,x),C=V(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:O,validationBehavior:ee}=li.get(t);return Lt(n,t.defaultSelectedValue,t.setSelectedValue),Yr({validationBehavior:ee},t,n),{labelProps:B(y,l(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:B(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&ee===`native`,checked:h,value:r,onChange:g,"aria-describedby":[e[`aria-describedby`],t.isInvalid?O:null,D].filter(Boolean).join(` `)||void 0}),isDisabled:m,isSelected:h,isPressed:v||b}}function di(e,t){let{name:n,form:r,isReadOnly:i,isRequired:a,isDisabled:o,orientation:s=`vertical`,validationBehavior:c=`aria`}=e,{direction:l}=gn(),{isInvalid:u,validationErrors:d,validationDetails:f}=t.displayValidation,{labelProps:p,fieldProps:m,descriptionProps:h,errorMessageProps:g}=Ir({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||d}),_=V(e,{labelable:!0}),{focusWithinProps:v}=yr({onBlurWithin(n){var r;(r=e.onBlur)==null||r.call(e,n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),y=e=>{let n;switch(e.key){case`ArrowRight`:n=l===`rtl`&&s!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=l===`rtl`&&s!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=Or(e.currentTarget,{from:e.target,accept:e=>e instanceof L(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))},b=F(n);return li.set(t,{name:b,form:r,descriptionId:h.id,errorMessageId:g.id,validationBehavior:c}),{radioGroupProps:B(_,{role:`radiogroup`,onKeyDown:y,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":a||void 0,"aria-disabled":o||void 0,"aria-orientation":s,...m,...v}),labelProps:p,descriptionProps:h,errorMessageProps:g,isInvalid:u,validationErrors:d,validationDetails:f}}const fi=i({}),pi=ti(function(e,t){[e,t]=q(e,t,fi);let{elementType:n=`label`,...i}=e;return r.createElement(n,{className:`react-aria-Label`,...i,ref:t})}),mi=i(null),hi=i({}),gi=ti(function(e,t){[e,t]=q(e,t,hi);let n=e,{isPending:i}=n,{buttonProps:a,isPressed:o}=ni(e,t);a=_i(a,i);let{focusProps:s,isFocused:l,isFocusVisible:u}=jr(e),{hoverProps:f,isHovered:p}=Tr({...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=K({...e,values:m,defaultClassName:`react-aria-Button`}),g=F(a.id),_=F(),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)&&rn(e,`assertive`),y.current=i},[i,l,v,g]);let b=V(e,{global:!0});return delete b.onClick,r.createElement(`button`,{...B(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(mi.Provider,{value:{id:_}},h.children))});function _i(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!(t.includes(`Focus`)||t.includes(`Blur`))&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}const vi=i({}),yi=a(function(e,t){[e,t]=q(e,t,vi);let{elementType:n=`span`,...i}=e;return r.createElement(n,{className:`react-aria-Text`,...i,ref:t})});function bi(e={}){let[t,n]=Yt(e.value,e.defaultValue||[],e.onChange),[r]=f(t),i=!!e.isRequired&&t.length===0,a=d(new Map),o=Hr({...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(Jr(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let xi=Math.round(Math.random()*1e10),Si=0;function Ci(e){let t=l(()=>e.name||`radio-group-${xi}-${++Si}`,[e.name]),[n,r]=Yt(e.value,e.defaultValue??null,e.onChange),[i]=f(n),[a,o]=f(null),s=Hr({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},u=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||(u?`invalid`:null),isInvalid:u}}const wi=i(null),Ti=a(function(e,t){return s(wi)?.isInvalid?r.createElement(Ei,{...e,ref:t}):null}),Ei=a((e,t)=>{let n=s(wi),i=V(e,{global:!0}),a=K({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return a.children==null?null:r.createElement(yi,{slot:`errorMessage`,...i,...a,ref:t})}),Di=i(null),Oi=i(null),ki=i(null),Ai=a(function(e,t){[e,t]=q(e,t,Oi);let{validationBehavior:n}=$t(Di)||{},i=e.validationBehavior??n??`native`,a=bi({...e,validationBehavior:i}),[o,s]=en(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,descriptionProps:u,errorMessageProps:d,...f}=oi({...e,label:s,validationBehavior:i},a),p=K({...e,values:{isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-CheckboxGroup`}),m=V(e,{global:!0});return r.createElement(`div`,{...B(m,p,c),ref:t,slot:e.slot||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},r.createElement(Zt,{values:[[ki,a],[fi,{...l,ref:o,elementType:`span`}],[vi,{slots:{description:u,errorMessage:d}}],[wi,f]]},p.children))}),ji=a(function(e,t){let{inputRef:n=null,...i}=e;[e,t]=q(i,t,je);let{validationBehavior:a}=$t(Di)||{},o=e.validationBehavior??a??`native`,c=s(ki),u=Mt(l(()=>rt(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:p,isDisabled:m,isReadOnly:h,isPressed:g,isInvalid:_}=c?ci({...tn(e),value:e.value,children:typeof e.children==`function`?!0:e.children},c,u):ii({...tn(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},si(e),u),{isFocused:v,isFocusVisible:y,focusProps:b}=jr(),x=m||h,{hoverProps:S,isHovered:C}=Tr({...e,isDisabled:x}),w=K({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:p,isIndeterminate:e.isIndeterminate||!1,isPressed:g,isHovered:C,isFocused:v,isFocusVisible:y,isDisabled:m,isReadOnly:h,isInvalid:_,isRequired:e.isRequired||!1}}),T=V(e,{global:!0});return delete T.id,delete T.onClick,r.createElement(`label`,{...B(T,d,S,w),ref:t,slot:e.slot||void 0,"data-selected":p||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":g||void 0,"data-hovered":C||void 0,"data-focused":v||void 0,"data-focus-visible":y||void 0,"data-disabled":m||void 0,"data-readonly":h||void 0,"data-invalid":_||void 0,"data-required":e.isRequired||void 0},r.createElement(Pr,{elementType:`span`},r.createElement(`input`,{...B(f,b),ref:u})),w.children)}),Mi=i({}),Ni=i({});let Pi=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Fi=ti(function(e,t){[e,t]=q(e,t,Ni);let{hoverProps:n,isHovered:i}=Tr({...e,isDisabled:e.disabled}),{isFocused:a,isFocusVisible:o,focusProps:s}=jr({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=K({...e,values:{isHovered:i,isFocused:a,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-Input`});return r.createElement(`input`,{...B(Pi(e),s,n),...l,ref:t,"data-focused":a||void 0,"data-disabled":e.disabled||void 0,"data-hovered":i||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),Ii=i(null);function Li(e){let t=d({});return r.createElement(Ii.Provider,{value:t},e.children)}const Ri=i({isSelected:!1}),zi=i(null),Bi=i(null),Vi=i(null),Hi=a(function(e,t){[e,t]=q(e,t,zi);let{validationBehavior:n}=$t(Di)||{},i=e.validationBehavior??n??`native`,a=Ci({...e,validationBehavior:i}),[o,s]=en(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:l,descriptionProps:u,errorMessageProps:d,...f}=di({...e,label:s,validationBehavior:i},a),p=K({...e,values:{orientation:e.orientation||`vertical`,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:a.isRequired,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-RadioGroup`}),m=V(e,{global:!0});return r.createElement(`div`,{...B(m,p,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":a.isRequired||void 0},r.createElement(Zt,{values:[[Vi,a],[fi,{...l,ref:o,elementType:`span`}],[vi,{slots:{description:u,errorMessage:d}}],[wi,f]]},r.createElement(Li,null,p.children)))}),Ui=a(function(e,t){let{inputRef:n=null,...i}=e;[e,t]=q(i,t,Bi);let a=r.useContext(Vi),o=Mt(l(()=>rt(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:u,isDisabled:d,isPressed:f}=ui({...tn(e),children:typeof e.children==`function`?!0:e.children},a,o),{isFocused:p,isFocusVisible:m,focusProps:h}=jr(),g=d||a.isReadOnly,{hoverProps:_,isHovered:v}=Tr({...e,isDisabled:g}),y=K({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:u,isPressed:f,isHovered:v,isFocused:p,isFocusVisible:m,isDisabled:d,isReadOnly:a.isReadOnly,isInvalid:a.isInvalid,isRequired:a.isRequired}}),b=V(e,{global:!0});return delete b.id,delete b.onClick,r.createElement(`label`,{...B(b,s,_,y),ref:t,"data-selected":u||void 0,"data-pressed":f||void 0,"data-hovered":v||void 0,"data-focused":p||void 0,"data-focus-visible":m||void 0,"data-disabled":d||void 0,"data-readonly":a.isReadOnly||void 0,"data-invalid":a.isInvalid||void 0,"data-required":a.isRequired||void 0},r.createElement(Pr,{elementType:`span`},r.createElement(`input`,{...B(c,h),ref:o})),r.createElement(Ri.Provider,{value:{isSelected:u}},y.children))}),Wi=i({});let Gi=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Ki=a(function(e,t){[e,t]=q(e,t,Wi);let{hoverProps:n,isHovered:i}=Tr(e),{isFocused:a,isFocusVisible:o,focusProps:s}=jr({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=K({...e,values:{isHovered:i,isFocused:a,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-TextArea`});return r.createElement(`textarea`,{...B(Gi(e),s,n),...l,ref:t,"data-focused":a||void 0,"data-disabled":e.disabled||void 0,"data-hovered":i||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),qi=i(null),Ji=ti(function(e,t){[e,t]=q(e,t,qi);let{validationBehavior:n}=$t(Di)||{},i=e.validationBehavior??n??`native`,a=d(null);[e,a]=q(e,a,Me);let[s,c]=en(!e[`aria-label`]&&!e[`aria-labelledby`]),[l,u]=f(`input`),{labelProps:p,inputProps:m,descriptionProps:h,errorMessageProps:g,..._}=$r({...tn(e),inputElementType:l,label:c,validationBehavior:i},a),v=o(e=>{a.current=e,e&&u(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[a]),y=K({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:_.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),b=V(e,{global:!0});return delete b.id,r.createElement(`div`,{...b,...y,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":_.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},r.createElement(Zt,{values:[[fi,{...p,ref:s}],[Ni,{...m,ref:v}],[Wi,{...m,ref:v}],[Mi,{role:`presentation`,isInvalid:_.isInvalid,isDisabled:e.isDisabled||!1}],[vi,{slots:{description:h,errorMessage:g}}],[wi,_]]},y.children))}),Yi=({title:e,description:t,classNames:n})=>{let{survey:r,dismiss:i}=we();if(!r)return null;let a=t||r.confirmation.description;return b(v,{children:[y(`div`,{className:x(`cf-question`,n?.question),children:b(`div`,{className:x(`cf-header`,n?.header),children:[y(pi,{className:x(`cf-title`,n?.title),children:e||r.confirmation.title||`Feedback submitted!`}),a&&y(yi,{slot:`description`,className:x(`cf-description`,n?.description),children:a})]})}),y(gi,{className:`cf-submit-button`,onPress:i,children:r.confirmation.buttonText||`Close`})]})},Xi=({children:e,classNames:t,containerProps:n,onDismiss:r,closeOnFinishMs:i=3e3})=>{let{surveyId:a,survey:o,dismiss:s}=we(),[c,l]=f(!1);return h(()=>{o&&s()},c?i:null),b(`div`,{className:x(`confetti-dialog`,t?.dialog),id:`${a}-popover`,...n,children:[y(`button`,{type:`button`,className:x(`confetti-dialog-close`,t?.closeButton),"aria-label":`Dismiss`,onClick:async()=>{await s(),r?.()},children:y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:x(t?.icon),children:y(`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`})})}),typeof e==`function`?e({setIsFinished:()=>l(!0)}):e]})},Zi=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[l,u]=f(``);return c(()=>{i(l)},[i,l]),b(Ji,{isRequired:o,isInvalid:!!s,name:e,className:x(`cf-question`,a?.question),value:l,onChange:e=>{u(e),i(e)},children:[b(`div`,{className:x(`cf-header`,a?.header),children:[b(pi,{className:x(`cf-title`,a?.title),children:[t,!o&&b(`span`,{className:x(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&y(yi,{slot:`description`,className:x(`cf-description`,a?.description),children:n})]}),y(Ki,{className:x(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),y(Ti,{className:x(`cf-error`,a?.error),children:s})]})},Qi=({children:e,classNames:t,description:n,...r})=>y(ji,{...r,children:({isIndeterminate:r})=>b(v,{children:[b(`div`,{className:x(`cf-choice-label`,t?.label),children:[y(`div`,{className:x(`cf-checkbox-indicator`,t?.indicator),children:y(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:x(`cf-checkbox-indicator-svg`,t?.svg),children:r?y(`rect`,{x:1,y:7.5,width:16,height:3}):y(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&y(`span`,{className:x(`cf-choice-description`,t?.choiceDescription),children:n})]})}),$i=({children:e,classNames:t,...n})=>y(ji,{...n,children:y(`div`,{className:x(`cf-tag-label`,t?.tagLabel),children:e})}),ea=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let u=!!n.editable,p=n.display??`checkbox`,[m,h]=f([]),[g,_]=f(``),S=d(null),C=d(null),w=l(()=>{let e=m.indexOf(M);if(e===-1)return m;let t=[...m];return t[e]=g||M,t},[g,m]),T=p===`tag`;return c(()=>{i(w)},[i,w]),y(Ai,{isRequired:o,isInvalid:!!s,name:a,value:m,onChange:h,className:x(`cf-question`,r?.question),children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(pi,{className:x(`cf-title`,r?.title),children:[e,!o&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&y(yi,{slot:`description`,className:x(`cf-description`,r?.description),children:t})]}),b(`div`,{className:x(`cf-response-choices`,p===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>y(T?$i:Qi,{className:x(`cf-choice`,T&&[`cf-tag`,r?.tag],!T&&[`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)),u&&(T?b(v,{children:[y($i,{inputRef:S,onChange:e=>{console.log(`hehe`,e),C.current&&e&&requestAnimationFrame(()=>{C.current&&C.current.focus()})},className:x(`cf-choice cf-tag`,r?.tag),value:M,children:n.editable?.label}),y(Fi,{"data-visible":i.value.includes(M)||void 0,value:g,onChange:e=>{_(e.target.value)},ref:C,className:x(`cf-input cf-tag-input`,r?.othersInput)})]}):b(`div`,{className:x(`cf-choice cf-others-choice`,r?.othersChoice),children:[y(Qi,{inputRef:S,onChange:e=>{C.current&&e&&requestAnimationFrame(()=>{C.current&&C.current.focus()})},className:x(`cf-checkbox`,r?.checkbox),value:M,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),y(Fi,{value:g,onChange:e=>{_(e.target.value)},tabIndex:i.value.includes(M)?0:-1,ref:C,onFocus:()=>{S.current?.checked===!1&&S.current.click()},className:x(`cf-input`,r?.othersInput)})]}))]}),y(Ti,{className:x(`cf-error`,r?.error),children:s})]})})},ta=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),na=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),ra=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),ia=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),aa=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),oa=e=>y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:y(`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`})}),sa=e=>y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:y(`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`})}),ca=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return y(`div`,{className:x(`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 y(Ui,{className:x(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:y(o?sa:oa,{})},t)})})},la=({properties:e,classNames:t})=>y(`div`,{className:x(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return y(Ui,{className:x(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),ua=({properties:e,classNames:t,state:n})=>{let r=l(()=>[ta,ra,ia,aa,na],[]),i=l(()=>[ra,ia,aa],[]);return l(()=>e.scale===3||e.scale===5,[e.scale])?y(`div`,{className:x(`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 y(Ui,{className:x(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&y(c,{})},a)})}):y(la,{properties:e,classNames:t,state:n})},da=e=>{switch(e.properties.display??`star`){case`emoji`:return y(ua,{...e});case`number`:return y(la,{...e});case`star`:return y(ca,{...e})}},fa=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[u,d]=f(null),p=l(()=>u?Number(u):void 0,[u]);return c(()=>{i(p)},[i,p]),y(Hi,{isRequired:s,isInvalid:!!o,name:a,className:x(`cf-question`,r?.question),value:u,onChange:d,children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(pi,{className:x(`cf-title`,r?.title),children:[t,!s&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&y(yi,{slot:`description`,className:x(`cf-description`,r?.description),children:n})]}),b(`div`,{className:x(`cf-rating-section`,r?.ratingSection),children:[y(da,{state:i,properties:e,classNames:r}),b(`div`,{className:x(`cf-rating-text`,r?.ratingText),children:[y(`span`,{className:x(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),y(`span`,{className:x(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),y(Ti,{className:x(`cf-error`,r?.error),children:o})]})})},pa=({classNames:e,className:t,description:n,...r})=>y(Ui,{...r,className:x(t,e?.radio),children:Qt(r.children,t=>b(v,{children:[b(`div`,{className:x(`cf-choice-label`,e?.label),children:[y(`div`,{className:x(`cf-radio-indicator`,e?.indicator)}),t]}),n&&y(`span`,{className:x(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),ma=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[u,p]=f(null),[m,h]=f(``),g=!!n.editable,_=d(null),S=d(null),C=l(()=>u===ue?m||ue:u??void 0,[m,u]);return c(()=>{i(C)},[i,C]),y(Hi,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{p(e),e===ue&&requestAnimationFrame(()=>{S.current&&S.current.focus()})},value:u,className:x(`cf-question`,r?.question),children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(pi,{className:x(`cf-title`,r?.title),children:[e,!o&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&y(yi,{slot:`description`,className:x(`cf-description`,r?.description),children:t})]}),b(`div`,{className:x(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>y(pa,{classNames:{indicator:r?.indicator,radio:x(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),g&&b(`div`,{className:x(`cf-choice cf-others-choice`,r?.othersChoice),children:[y(pa,{inputRef:_,value:ue,classNames:{indicator:r?.indicator,radio:x(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),y(Fi,{tabIndex:i.selectedValue===ue?0:-1,ref:S,value:m,onChange:e=>h(e.target.value),onFocus:()=>{_.current?.checked===!1&&_.current.click()},className:x(`cf-input`,r?.othersInput)})]})]}),y(Ti,{className:x(`cf-error`,r?.error),children:s})]})})},ha=({properties:e,title:t,description:n,classNames:r})=>y(`div`,{className:x(`cf-question`,r?.question),children:b(`div`,{className:x(`cf-header`,r?.header),children:[t&&y(`div`,{className:x(`cf-title`,r?.title),children:t}),n&&y(`div`,{className:x(`cf-description`,r?.description),children:n})]})}),ga=({question:e,onChange:t,error:n})=>{switch(e.properties.type){case`rating`:return y(fa,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return y(Zi,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return y(ma,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return y(ea,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return y(ha,{...e,properties:e.properties,onChange:t,error:n},e.id)}return y(`div`,{children:`Unsupported question type`},e.id)},_a=({onPress:e,isDisabled:t,children:n=`Submit`})=>y(gi,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),va=e=>{switch(e){case`multi-select`:return[];case`statement`:return;default:return``}},ya=({onSubmit:e,children:n,question:r,isLastQuestion:i})=>{let[a,s]=f(va(r.properties.type)),c=l(()=>Ee(r.properties,{required:r.required}),[r.properties,r.required]),u=l(()=>{let e=c.safeParse(a);if(!e.success)return S(e.error)},[a,c]),d=l(()=>{let e=r.routingLogic;if(e.type!==`always`&&(a===``||Array.isArray(a)&&a.length===0)&&r.required)return!0;let n=e.type===`always`?e.target:e.cases.find(e=>t({answer:a,condition:e}))?.target??e.default;return n.type===`end`?!1:n.type===`next`?!i:!0},[a,i,r.required,r.routingLogic]),p=l(()=>r.properties.buttonLabel?r.properties.buttonLabel:d?`Next`:`Submit`,[d,r.properties.buttonLabel]),m=o(()=>{switch(r.properties.type){case`statement`:if(r.properties.buttonUrl&&typeof window<`u`){let e=te.safeParse(r.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(a)}},[a,e,r.properties]);return b(v,{children:[n({onChange:s,question:r,error:u}),y(_a,{isDisabled:!!u,onPress:m,children:p})]})},ba=({isCompleted:e,onSubmit:t,children:n})=>b(v,{children:[n,e&&y(_a,{onPress:t})]}),xa=e=>y(Ae,{...e,shouldAutoSubmit:!1,children:({questions:e,update:t,isCompleted:n,submit:r,isSubmitted:i})=>i?y(Yi,{}):y(ba,{onSubmit:r,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>y(ga,{question:e,onChange:n=>n&&t({question:e.position,answer:n})},e.position))})}),Sa=({onDismiss:e,closeOnFinishMs:t,...n})=>y(Ce,{...n,children:y(Xi,{onDismiss:e,closeOnFinishMs:t,children:({setIsFinished:e})=>y(ke,{shouldAutoSubmit:!0,...n,onFinished:()=>{e(),n.onFinished?.()},children:({current:e,questions:t,update:n,isSubmitted:r})=>{let i=e===t.length-1;if(r)return y(Yi,{});let a=t[e];return a?y(ya,{isLastQuestion:i,question:a,onSubmit:t=>n({question:e,answer:t}),children:e=>y(ga,{...e})}):y(v,{})}})})}),Ca=e=>y(Ae,{...e,shouldAutoSubmit:!0,children:({current:e,questions:t,update:n,isSubmitted:r})=>{let i=e===t.length-1;if(r)return y(Yi,{});let a=t[e];return a?y(ya,{isLastQuestion:i,question:a,onSubmit:t=>n({question:e,answer:t}),children:e=>y(ga,{...e})}):y(v,{})}}),wa=({delay:e})=>{let[t,n]=f(!1),r=l(()=>e,[]);return c(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},Ta=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${l(()=>window.location.pathname,[])}:visits:${t??``}`,0);return c(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},Ea=({visits:e,respondent:t})=>{let[n,r]=m(`cfti:${l(()=>window.location.pathname,[])}:visits:${t??``}`,0);return c(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},Da=({threshold:e})=>{let[t,n]=f(()=>typeof window>`u`?!1:window.scrollY>=e);return c(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{Ae as Confetti,Se as ConfettiContext,ke as ConfettiController,Ce as ConfettiProvider,ba as Embed,xa as EmbeddedConfetti,ya as Flow,Zi as FreeText,ea as MultiChoice,Sa as PopoverConfetti,Xi as PopoverContainer,fa as Rating,ma as SingleChoice,ha as Statement,Ca as StepperConfetti,ga as SurveyQuestionFactory,Yi as ThankYouMessage,we as useConfetti,wa as useVisibleAfterDelay,Ta as useVisibleAfterPageVisits,Da as useVisibleAfterScroll,Ea as useVisibleAfterSessionPageVisits};
|
|
7
|
+
`.trim(),e.head.prepend(t)},[_]),c(()=>{let e=x.current;return()=>{g||sr(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:I(v,ue,{[yr]:!0})}}function xr(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function Sr(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&&!Er(i,n)||i instanceof M(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&xr(i))&&n!==`Enter`)}function W(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}}function Cr(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!xr(e)}function wr(e,t){return e instanceof HTMLInputElement?!Er(e,t):Cr(e)}const Tr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Er(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Tr.has(e.type)}let Dr=null,Or=new Set,kr=new Map,G=!1,Ar=!1;const jr={Tab:!0,Escape:!0};function Mr(e,t){for(let n of Or)n(e,t)}function Nr(e){return!(e.metaKey||!Dt()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Pr(e){G=!0,!Ft.isOpening&&Nr(e)&&(Dr=`keyboard`,Mr(`keyboard`,e))}function Fr(e){Dr=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(G=!0,Mr(`pointer`,e))}function Ir(e){!Ft.isOpening&&Zt(e)&&(G=!0,Dr=`virtual`)}function Lr(e){e.target===window||e.target===document||tr||!e.isTrusted||(!G&&!Ar&&(Dr=`virtual`,Mr(`virtual`,e)),G=!1,Ar=!1)}function Rr(){tr||(G=!1,Ar=!0)}function zr(e){if(typeof window>`u`||typeof document>`u`||kr.get(M(e)))return;let t=M(e),n=j(e),r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){G=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Pr,!0),n.addEventListener(`keyup`,Pr,!0),n.addEventListener(`click`,Ir,!0),t.addEventListener(`focus`,Lr,!0),t.addEventListener(`blur`,Rr,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Fr,!0),n.addEventListener(`pointermove`,Fr,!0),n.addEventListener(`pointerup`,Fr,!0)),t.addEventListener(`beforeunload`,()=>{Br(e)},{once:!0}),kr.set(t,{focus:r})}const Br=(e,t)=>{let n=M(e),r=j(e);t&&r.removeEventListener(`DOMContentLoaded`,t),kr.has(n)&&(n.HTMLElement.prototype.focus=kr.get(n).focus,r.removeEventListener(`keydown`,Pr,!0),r.removeEventListener(`keyup`,Pr,!0),r.removeEventListener(`click`,Ir,!0),n.removeEventListener(`focus`,Lr,!0),n.removeEventListener(`blur`,Rr,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Fr,!0),r.removeEventListener(`pointermove`,Fr,!0),r.removeEventListener(`pointerup`,Fr,!0)),kr.delete(n))};function Vr(e){let t=j(e),n;return t.readyState===`loading`?(n=()=>{zr(e)},t.addEventListener(`DOMContentLoaded`,n)):zr(e),()=>Br(e,n)}typeof document<`u`&&Vr();function Hr(){return Dr!==`pointer`}function Ur(){return Dr}function Wr(e){Dr=e,Mr(e,null)}const Gr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Kr(e,t,n){let r=j(n?.target),i=typeof window<`u`?M(n?.target).HTMLInputElement:HTMLInputElement,a=typeof window<`u`?M(n?.target).HTMLTextAreaElement:HTMLTextAreaElement,o=typeof window<`u`?M(n?.target).HTMLElement:HTMLElement,s=typeof window<`u`?M(n?.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof i&&!Gr.has(r.activeElement.type)||r.activeElement instanceof a||r.activeElement instanceof o&&r.activeElement.isContentEditable,!(e&&t===`keyboard`&&n instanceof s&&!jr[n.key])}function qr(e,t,n){zr(),c(()=>{let t=(t,r)=>{Kr(!!n?.isTextInput,t,r)&&e(Hr())};return Or.add(t),()=>{Or.delete(t)}},t)}function Jr(e){let t=j(e);if(Ur()===`virtual`){let n=P(t);zt(()=>{let r=P(t);(r===n||r===t.body)&&e.isConnected&&bt(e)})}else bt(e)}function Yr(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=o(e=>{if(e.target===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),s=er(a),c=o(e=>{let t=j(e.target),r=t?P(t):P();e.target===e.currentTarget&&r===F(e.nativeEvent)&&(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 Xr(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 Zr(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Xr(e.onKeyDown),onKeyUp:Xr(e.onKeyUp)}}}let Qr=r.createContext(null);function $r(e){let t=s(Qr)||{};Wt(t,e);let{ref:n,...r}=t;return r}function ei(e,t){let{focusProps:n}=Yr(e),{keyboardProps:r}=Zr(e),i=I(n,r),a=$r(t),o=e.isDisabled?{}:a,s=d(e.autoFocus);c(()=>{s.current&&t.current&&Jr(t.current),s.current=!1},[t]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:I({...i,tabIndex:l},o)}}function ti({children:e}){let t=l(()=>({register:()=>{}}),[]);return r.createElement(cr.Provider,{value:t},e)}function ni(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=d({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:c}=Bt(),l=o(e=>{e.currentTarget.contains(e.target)&&a.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(a.current.isFocusWithin=!1,c(),n&&n(e),i&&i(!1))},[n,i,a,c]),u=er(l),f=o(e=>{if(!e.currentTarget.contains(e.target))return;let t=j(e.target),n=P(t);if(!a.current.isFocusWithin&&n===F(e.nativeEvent)){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,u(e);let n=e.currentTarget;s(t,`focus`,e=>{if(a.current.isFocusWithin&&!N(n,e.target)){let r=new t.defaultView.FocusEvent(`blur`,{relatedTarget:e.target});$n(r,n),l(Qn(r))}},{capture:!0})}},[r,i,u,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:l}}}let ri=!1,ii=0;function ai(){ri=!0,setTimeout(()=>{ri=!1},50)}function oi(e){e.pointerType===`touch`&&ai()}function si(){if(!(typeof document>`u`))return ii===0&&typeof PointerEvent<`u`&&document.addEventListener(`pointerup`,oi),ii++,()=>{ii--,!(ii>0)&&typeof PointerEvent<`u`&&document.removeEventListener(`pointerup`,oi)}}function ci(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(si,[]);let{addGlobalListener:u,removeAllGlobalListeners:p}=Bt(),{hoverProps:m,triggerHoverEnd:h}=l(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!e.currentTarget.contains(e.target))return;s.isHovered=!0;let c=e.currentTarget;s.target=c,u(j(e.target),`pointerover`,e=>{s.isHovered&&s.target&&!N(s.target,e.target)&&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&&e.currentTarget.contains(e.target)&&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 li(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=d({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=B(e=>{n&&ui(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=B(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&&ui(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 ui(e,t){if(e.button>0)return!1;if(e.target){let t=e.target.ownerDocument;if(!t||!t.documentElement.contains(e.target)||e.target.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}const di=r.createContext(null),fi=`react-aria-focus-scope-restore`;let K=null;function pi(e){let{children:t,contain:n,restoreFocus:i,autoFocus:a}=e,o=d(null),u=d(null),f=d([]),{parentNode:p}=s(di)||{},m=l(()=>new Ai({scopeRef:f}),[f]);A(()=>{let e=p||Z.root;if(Z.getTreeNode(e.scopeRef)&&K&&!xi(K,e.scopeRef)){let t=Z.getTreeNode(K);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(fi,n),e=e.nextSibling;return f.current=t,()=>{for(let e of t)e.removeEventListener(fi,n)}},[t]),Ti(f,i,n),vi(f,n),Di(f,i,n),wi(f,a),c(()=>{let e=P(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)&&(K=t.scopeRef)}},[f]),A(()=>()=>{let e=Z.getTreeNode(f)?.parent?.scopeRef??null;(f===K||xi(f,K))&&(!e||Z.getTreeNode(e))&&(K=e),Z.removeTreeNode(f)},[f]);let h=l(()=>mi(f),[]),g=l(()=>({focusManager:h,parentNode:m}),[m,h]);return r.createElement(di.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 mi(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||P(j(n[0]??void 0)),c=n[0].previousElementSibling,l=X(hi(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||P(j(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=X(hi(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(hi(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(hi(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&Y(o,!0),o}}}function hi(e){return e[0].parentElement}function gi(e){let t=Z.getTreeNode(K);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function _i(e){if(e.checked)return!0;let t=[];return t=e.form?[...e.form?.elements?.namedItem(e.name)??[]]:[...j(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(e=>!e.form),t?!t.some(e=>e.checked):!1}function vi(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||!gi(e)||t.isComposing)return;let n=P(a),r=e.current;if(!r||!q(n,r))return;let i=X(hi(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)},s=t=>{(!K||xi(K,e))&&q(F(t),e.current)?(K=e,n.current=F(t)):gi(e)&&!J(F(t),e)?n.current?n.current.focus():K&&K.current&&Ci(K.current):gi(e)&&(n.current=F(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=Ur(),i=(r===`virtual`||r===null)&&Nt()&&Mt(),o=P(a);if(!i&&o&&gi(e)&&!J(o,e)){K=e;let r=F(t);if(r&&r.isConnected){var s;n.current=r,(s=n.current)==null||s.focus()}else K.current&&Ci(K.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 yi(e){return J(e)}function q(e,t){return!e||!t?!1:t.some(t=>t.contains(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 bi(e){return J(e,K)}function xi(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{Jr(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Si(e,t=!0){let n=e[0].previousElementSibling,r=hi(e),i=X(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=hi(e),i=X(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function Ci(e,t=!0){Y(Si(e,t))}function wi(e,t){let n=r.useRef(t);c(()=>{n.current&&(K=e,!q(P(j(e.current?e.current[0]:void 0)),K.current)&&e.current&&Ci(e.current)),n.current=!1},[e])}function Ti(e,t,n){A(()=>{if(t||n)return;let r=e.current,i=j(r?r[0]:void 0),a=t=>{let n=F(t);q(n,e.current)?K=e:yi(n)||(K=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 Ei(e){let t=Z.getTreeNode(K);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Di(e,t,n){let r=d(typeof document<`u`?P(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=()=>{(!K||xi(K,e))&&q(P(i),e.current)&&(K=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||!gi(e)||t.isComposing)return;let n=r.activeElement;if(!J(n,e)||!Ei(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):yi(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=P(n);if(t&&i&&(a&&J(a,e)||a===n.body&&Ei(e))){let t=Z.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){Oi(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&Z.getTreeNode(n.scopeRef)){Oi(Si(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function Oi(e){e.dispatchEvent(new CustomEvent(fi,{bubbles:!0,cancelable:!0}))&&Y(e)}function X(e,t,n){let r=t?.tabbable?fn:dn,i=j(e?.nodeType===Node.ELEMENT_NODE?e:null),a=dt(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return t!=null&&t.from?.contains(e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!_i(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 ki=class e{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 Ai({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}constructor(){this.fastMap=new Map,this.root=new Ai({scopeRef:null}),this.fastMap.set(null,this.root)}},Ai=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}};let Z=new ki;function ji(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=d({isFocused:!1,isFocusVisible:t||Hr()}),[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,s(e),u()},[u]);qr(e=>{i.current.isFocusVisible=e,u()},[],{isTextInput:n});let{focusProps:m}=Yr({isDisabled:r,onFocusChange:p}),{focusWithinProps:h}=ni({isDisabled:!r,onFocusWithinChange:p});return{isFocused:a,isFocusVisible:c,focusProps:r?h:m}}const Q=[];function Mi(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e;c(()=>{if(i&&!Q.includes(t))return Q.push(t),()=>{let e=Q.indexOf(t);e>=0&&Q.splice(e,1)}},[i,t]);let l=()=>{Q[Q.length-1]===t&&n&&n()},u=e=>{(!s||s(e.target))&&Q[Q.length-1]===t&&(e.stopPropagation(),e.preventDefault())},d=e=>{(!s||s(e.target))&&(Q[Q.length-1]===t&&(e.stopPropagation(),e.preventDefault()),l())},f=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};li({ref:t,onInteractOutside:a&&i?d:void 0,onInteractOutsideStart:u});let{focusWithinProps:p}=ni({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||bi(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}}),m=e=>{e.target===e.currentTarget&&e.preventDefault()};return{overlayProps:{onKeyDown:f,...p},underlayProps:{onPointerDown:m}}}const Ni=typeof document<`u`&&window.visualViewport;let Pi=0,Fi;function Ii(e={}){let{isDisabled:t}=e;A(()=>{if(!t)return Pi++,Pi===1&&(Fi=At()?Ri():Li()),()=>{Pi--,Pi===0&&Fi()}},[t])}function Li(){let e=window.innerWidth-document.documentElement.clientWidth;return ot(e>0&&(`scrollbarGutter`in document.documentElement.style?zi(document.documentElement,`scrollbarGutter`,`stable`):zi(document.documentElement,`paddingRight`,`${e}px`)),zi(document.documentElement,`overflow`,`hidden`))}function Ri(){let e,t=!1,n=n=>{let r=n.target;e=Gt(r)?r:Kt(r,!0),t=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(t=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(t=!0)},r=document.createElement(`style`);r.textContent=`@layer {
|
|
8
|
+
* {
|
|
9
|
+
overscroll-behavior: contain;
|
|
10
|
+
}
|
|
11
|
+
}`,document.head.prepend(r);let i=n=>{if(!(n.touches.length===2||t)){if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&n.preventDefault()}},a=e=>{let t=e.target,n=e.relatedTarget;n&&Jt(n)?(n.focus({preventScroll:!0}),Vi(n,Jt(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},o=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=document.activeElement!=null&&Jt(document.activeElement);o.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Vi(this,t)};let s=ot(Bi(document,`touchstart`,n,{passive:!1,capture:!0}),Bi(document,`touchmove`,i,{passive:!1,capture:!0}),Bi(document,`blur`,a,!0));return()=>{s(),r.remove(),HTMLElement.prototype.focus=o}}function zi(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Bi(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Vi(e,t){t||!Ni?Hi(e):Ni.addEventListener(`resize`,()=>Hi(e),{once:!0})}function Hi(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Kt(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;Ni&&(n=Math.min(n,Ni.offsetTop+Ni.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}}const Ui=i({});function Wi(){return s(Ui)??{}}var Gi={};Gi={dismiss:`تجاهل`};var Ki={};Ki={dismiss:`Отхвърляне`};var qi={};qi={dismiss:`Odstranit`};var Ji={};Ji={dismiss:`Luk`};var Yi={};Yi={dismiss:`Schließen`};var Xi={};Xi={dismiss:`Απόρριψη`};var Zi={};Zi={dismiss:`Dismiss`};var Qi={};Qi={dismiss:`Descartar`};var $i={};$i={dismiss:`Lõpeta`};var ea={};ea={dismiss:`Hylkää`};var ta={};ta={dismiss:`Rejeter`};var na={};na={dismiss:`התעלם`};var ra={};ra={dismiss:`Odbaci`};var ia={};ia={dismiss:`Elutasítás`};var aa={};aa={dismiss:`Ignora`};var oa={};oa={dismiss:`閉じる`};var sa={};sa={dismiss:`무시`};var ca={};ca={dismiss:`Atmesti`};var la={};la={dismiss:`Nerādīt`};var ua={};ua={dismiss:`Lukk`};var da={};da={dismiss:`Negeren`};var fa={};fa={dismiss:`Zignoruj`};var pa={};pa={dismiss:`Descartar`};var ma={};ma={dismiss:`Dispensar`};var ha={};ha={dismiss:`Revocare`};var ga={};ga={dismiss:`Пропустить`};var _a={};_a={dismiss:`Zrušiť`};var va={};va={dismiss:`Opusti`};var ya={};ya={dismiss:`Odbaci`};var ba={};ba={dismiss:`Avvisa`};var xa={};xa={dismiss:`Kapat`};var Sa={};Sa={dismiss:`Скасувати`};var Ca={};Ca={dismiss:`取消`};var wa={};wa={dismiss:`關閉`};var Ta={};Ta={"ar-AE":Gi,"bg-BG":Ki,"cs-CZ":qi,"da-DK":Ji,"de-DE":Yi,"el-GR":Xi,"en-US":Zi,"es-ES":Qi,"et-EE":$i,"fi-FI":ea,"fr-FR":ta,"he-IL":na,"hr-HR":ra,"hu-HU":ia,"it-IT":aa,"ja-JP":oa,"ko-KR":sa,"lt-LT":ca,"lv-LV":la,"nb-NO":ua,"nl-NL":da,"pl-PL":fa,"pt-BR":pa,"pt-PT":ma,"ro-RO":ha,"ru-RU":ga,"sk-SK":_a,"sl-SI":va,"sr-SP":ya,"sv-SE":ba,"tr-TR":xa,"uk-UA":Sa,"zh-CN":Ca,"zh-TW":wa};const Ea={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 Da(e={}){let{style:t,isFocusable:n}=e,[r,i]=f(!1),{focusWithinProps:a}=ni({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=l(()=>r?t:t?{...Ea,...t}:Ea,[r]);return{visuallyHiddenProps:{...a,style:o}}}function Oa(e){let{children:t,elementType:n=`div`,isFocusable:i,style:a,...o}=e,{visuallyHiddenProps:s}=Da(e);return r.createElement(n,I(o,s),t)}function ka(e){return e&&e.__esModule?e.default:e}function Aa(e){let{onDismiss:t,...n}=e,i=Vt(n,Yn(ka(Ta),`@react-aria/overlays`).format(`dismiss`)),a=()=>{t&&t()};return r.createElement(Oa,null,r.createElement(`button`,{...i,tabIndex:-1,onClick:a,style:{width:1,height:1}}))}const ja=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;let Ma=new WeakMap,$=[];function Na(e,t){let n=M(e?.[0]),r=t instanceof n.Element?{root:t}:t,i=r?.root??document.body,a=r?.shouldUseInert&&ja,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=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(e.contains(t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&d(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;e!=null;)d(e),e=n.nextNode()}},d=e=>{let t=Ma.get(e)??0;c(e)&&t===0||(t===0&&l(e,!0),s.add(e),Ma.set(e,t+1))};$.length&&$[$.length-1].disconnect(),u(i);let f=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`&&![...o,...s].some(e=>e.contains(t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&(e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer===`true`)?o.add(e):e instanceof Element&&u(e)});f.observe(i,{childList:!0,subtree:!0});let p={visibleNodes:o,hiddenNodes:s,observe(){f.observe(i,{childList:!0,subtree:!0})},disconnect(){f.disconnect()}};return $.push(p),()=>{f.disconnect();for(let e of s){let t=Ma.get(e);t!=null&&(t===1?(l(e,!1),Ma.delete(e)):Ma.set(e,t-1))}p===$[$.length-1]?($.pop(),$.length&&$[$.length-1].observe()):$.splice($.indexOf(p),1)}}const Pa=r.createContext(null);function Fa(e){let t=$e(),{portalContainer:n=t?null:document.body,isExiting:i}=e,[a,o]=f(!1),s=l(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Wi();if(!e.portalContainer&&c&&(n=c()),!n)return null;let u=e.children;return e.disableFocusManagement||(u=r.createElement(pi,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},u)),u=r.createElement(Pa.Provider,{value:s},r.createElement(ti,null,u)),S.createPortal(u,n)}function Ia(){let e=s(Pa)?.setContain;A(()=>{e?.(!0)},[e])}function La(e,t,n){let{overlayProps:r,underlayProps:i}=Mi({...e,isOpen:t.isOpen,onClose:t.close},n);return Ii({isDisabled:!t.isOpen}),Ia(),c(()=>{if(t.isOpen&&n.current)return Na([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:I(r),underlayProps:i}}function Ra(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=rt(t);let o=rt(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=Vt({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function za(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Ra(e),s=at([!!t,!!n,r,i]),c=at([!!t,!!n,r,i]);return o=I(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}const Ba={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Va={...Ba,customError:!0,valid:!1},Ha={isInvalid:!1,validationDetails:Ba,validationErrors:[]},Ua=i({}),Wa=`__formValidationState`+Date.now();function Ga(e){if(e[Wa]){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Wa];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Ka(e)}function Ka(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:u=`aria`}=e;n&&(t||=n===`invalid`);let p=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:Va},m=l(()=>!o||i==null?null:Ya(Ja(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let h=s(Ua),g=l(()=>r?Array.isArray(r)?r.flatMap(e=>qa(h[e])):qa(h[r]):[],[h,r]),[_,v]=f(h),[y,b]=f(!1);h!==_&&(v(h),b(!1));let x=l(()=>Ya(y?[]:g),[y,g]),S=d(Ha),[C,w]=f(Ha),T=d(Ha),E=()=>{if(!D)return;O(!1);let e=m||a||S.current;Xa(e,T.current)||(T.current=e,w(e))},[D,O]=f(!1);return c(E),{realtimeValidation:p||x||m||a||Ha,displayValidation:u===`native`?p||x||C:p||x||m||a||C,updateValidation(e){u===`aria`&&!Xa(C,e)?w(e):S.current=e},resetValidation(){let e=Ha;Xa(e,T.current)||(T.current=e,w(e)),u===`native`&&O(!1),b(!0)},commitValidation(){u===`native`&&O(!0),b(!0)}}}function qa(e){return e?Array.isArray(e)?e:[e]:[]}function Ja(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return qa(n)}return[]}function Ya(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Va}:null}function Xa(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 Za(...e){let t=new Set,n=!1,r={...Ba};for(let o of e){var i,a;for(let e of o.validationErrors)t.add(e);for(let e in n||=o.isInvalid,r)(i=r)[a=e]||(i[a]=o.validationDetails[e])}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function Qa(e,t,n){let{validationBehavior:r,focus:i}=e;A(()=>{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(eo(n.current))}});let a=d(!1),o=B(()=>{a.current||t.resetValidation()}),s=B(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;if(!e.defaultPrevented&&n&&r&&to(r)===n.current){var a;i?i():(a=n.current)==null||a.focus(),Wr(`keyboard`)}e.preventDefault()}),l=B(()=>{t.commitValidation()});c(()=>{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.target instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function $a(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 eo(e){return{isInvalid:!e.validity.valid,validationDetails:$a(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function to(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(!n.validity.valid)return n}return null}function no(e,t){let{inputElementType:n=`input`,isDisabled:i=!1,isRequired:a=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[l,u]=hn(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=ei(e,t),p=Ga({...e,value:l}),{isInvalid:m,validationErrors:h,validationDetails:g}=p.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=za({...e,isInvalid:m,errorMessage:e.errorMessage||h}),x=L(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=f(l);return $t(t,e.defaultValue??C,u),Qa(e,p,t),{labelProps:_,inputProps:I(x,n===`input`?S:void 0,{disabled:i,readOnly:o,required:a&&c===`native`,"aria-required":a&&c===`aria`||void 0,"aria-invalid":m||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.target.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(r.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:m,validationErrors:h,validationDetails:g}}if(typeof HTMLTemplateElement<`u`){let e=Object.getOwnPropertyDescriptor(Node.prototype,`firstChild`).get;Object.defineProperty(HTMLTemplateElement.prototype,`firstChild`,{configurable:!0,enumerable:!0,get:function(){return this.dataset.reactAriaHidden?this.content.firstChild:e.call(this)}})}const ro=i(!1);function io(e){let t=(t,n)=>s(ro)?null:e(t,n);return t.displayName=e.displayName||e.name,a(t)}function ao(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}=br({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=ei(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=I(y,_,L(e,{labelable:!0}));return{isPressed:v,buttonProps:I(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`]})}}function oo(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:a,name:o,form:s,children:c,"aria-label":l,"aria-labelledby":u,validationState:d=`valid`,isInvalid:f,onPressStart:p,onPressEnd:m,onPressChange:h,onPress:g,onPressUp:_,onClick:v}=e,y=e=>{e.stopPropagation(),t.setSelected(e.target.checked)},{pressProps:b,isPressed:x}=br({onPressStart:p,onPressEnd:m,onPressChange:h,onPress:g,onPressUp:_,onClick:v,isDisabled:r}),{pressProps:S,isPressed:C}=br({onPressStart:p,onPressEnd:m,onPressChange:h,onPressUp:_,onClick:v,onPress(e){var r;g?.(e),t.toggle(),(r=n.current)==null||r.focus()},isDisabled:r||i}),{focusableProps:w}=ei(e,n),T=I(b,w),E=L(e,{labelable:!0});return $t(n,t.defaultSelected,t.setSelected),{labelProps:I(S,{onClick:e=>e.preventDefault()}),inputProps:I(E,{"aria-invalid":f||d===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:y,disabled:r,...a==null?{}:{value:a},name:o,form:s,type:`checkbox`,...T}),isSelected:t.isSelected,isPressed:x||C,isDisabled:r,isReadOnly:i,isInvalid:f||d===`invalid`}}function so(e,t,n){let r=Ga({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:u,isSelected:d,isPressed:f,isDisabled:p,isReadOnly:m}=oo({...e,isInvalid:i},t,n);Qa(e,r,n);let{isIndeterminate:h,isRequired:g,validationBehavior:_=`aria`}=e;c(()=>{n.current&&(n.current.indeterminate=!!h)});let{pressProps:v}=br({isDisabled:p||m,onPress(){let{[Wa]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:I(s,v,l(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...u,checked:d,"aria-required":g&&_===`aria`||void 0,required:g&&_===`native`},isSelected:d,isPressed:f,isDisabled:p,isReadOnly:m,isInvalid:i,validationErrors:a,validationDetails:o}}const co=new WeakMap;function lo(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:a=`aria`}=e,{isInvalid:o,validationErrors:s,validationDetails:c}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:d,errorMessageProps:f}=za({...e,labelElementType:`span`,isInvalid:o,errorMessage:e.errorMessage||s});co.set(t,{name:r,form:i,descriptionId:d.id,errorMessageId:f.id,validationBehavior:a});let p=L(e,{labelable:!0}),{focusWithinProps:m}=ni({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:I(p,{role:`group`,"aria-disabled":n||void 0,...u,...m}),labelProps:l,descriptionProps:d,errorMessageProps:f,isInvalid:o,validationErrors:s,validationDetails:c}}function uo(e={}){let{isReadOnly:t}=e,[n,r]=hn(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=f(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function fo(e,t,n){let r=uo({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:l}=co.get(t);l=e.validationBehavior??l;let{realtimeValidation:u}=Ga({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),f=d(Ha),p=()=>{t.setInvalid(e.value,u.isInvalid?u:f.current)};c(p);let m=t.realtimeValidation.isInvalid?t.realtimeValidation:u,h=l===`native`?t.displayValidation:m,g=so({...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:l,[Wa]:{realtimeValidation:m,displayValidation:h,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){f.current=e,p()}}},r,n);return{...g,inputProps:{...g.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}function po(e,t){let{role:n=`dialog`}=e,r=at();r=e[`aria-label`]?void 0:r;let i=d(!1);return c(()=>{if(t.current&&!t.current.contains(document.activeElement)){Jr(t.current);let e=setTimeout(()=>{(document.activeElement===t.current||document.activeElement===document.body)&&(i.current=!0,t.current&&(t.current.blur(),Jr(t.current)),i.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Ia(),{dialogProps:{...L(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||r,onBlur:e=>{i.current&&e.stopPropagation()}},titleProps:{id:r}}}const mo=new WeakMap;function ho(e,t,n){let{value:r,children:i,"aria-label":a,"aria-labelledby":o,onPressStart:s,onPressEnd:c,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}=br({onPressStart:s,onPressEnd:c,onPressChange:u,onPress:d,onPressUp:f,onClick:p,isDisabled:m}),{pressProps:y,isPressed:b}=br({onPressStart:s,onPressEnd:c,onPressChange:u,onPressUp:f,onClick:p,isDisabled:m,onPress(e){var i;d?.(e),t.setSelectedValue(r),(i=n.current)==null||i.focus()}}),{focusableProps:x}=ei(I(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=I(_,x),C=L(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:O,validationBehavior:ee}=mo.get(t);return $t(n,t.defaultSelectedValue,t.setSelectedValue),Qa({validationBehavior:ee},t,n),{labelProps:I(y,l(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:I(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&ee===`native`,checked:h,value:r,onChange:g,"aria-describedby":[e[`aria-describedby`],t.isInvalid?O:null,D].filter(Boolean).join(` `)||void 0}),isDisabled:m,isSelected:h,isPressed:v||b}}function go(e,t){let{name:n,form:r,isReadOnly:i,isRequired:a,isDisabled:o,orientation:s=`vertical`,validationBehavior:c=`aria`}=e,{direction:l}=In(),{isInvalid:u,validationErrors:d,validationDetails:f}=t.displayValidation,{labelProps:p,fieldProps:m,descriptionProps:h,errorMessageProps:g}=za({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||d}),_=L(e,{labelable:!0}),{focusWithinProps:v}=ni({onBlurWithin(n){var r;(r=e.onBlur)==null||r.call(e,n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),y=e=>{let n;switch(e.key){case`ArrowRight`:n=l===`rtl`&&s!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=l===`rtl`&&s!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=X(e.currentTarget,{from:e.target,accept:e=>e instanceof M(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))},b=rt(n);return mo.set(t,{name:b,form:r,descriptionId:h.id,errorMessageId:g.id,validationBehavior:c}),{radioGroupProps:I(_,{role:`radiogroup`,onKeyDown:y,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":a||void 0,"aria-disabled":o||void 0,"aria-orientation":s,...m,...v}),labelProps:p,descriptionProps:h,errorMessageProps:g,isInvalid:u,validationErrors:d,validationDetails:f}}const _o=i({}),vo=io(function(e,t){[e,t]=U(e,t,_o);let{elementType:n=`label`,...i}=e;return r.createElement(n,{className:`react-aria-Label`,...i,ref:t})}),yo=i(null),bo=i({}),xo=io(function(e,t){[e,t]=U(e,t,bo);let n=e,{isPending:i}=n,{buttonProps:a,isPressed:o}=ao(e,t);a=So(a,i);let{focusProps:s,isFocused:l,isFocusVisible:u}=ji(e),{hoverProps:f,isHovered:p}=ci({...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=H({...e,values:m,defaultClassName:`react-aria-Button`}),g=rt(a.id),_=rt(),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)&&wn(e,`assertive`),y.current=i},[i,l,v,g]);let b=L(e,{global:!0});return delete b.onClick,r.createElement(`button`,{...I(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(yo.Provider,{value:{id:_}},h.children))});function So(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!(t.includes(`Focus`)||t.includes(`Blur`))&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}const Co=i({}),wo=a(function(e,t){[e,t]=U(e,t,Co);let{elementType:n=`span`,...i}=e;return r.createElement(n,{className:`react-aria-Text`,...i,ref:t})});function To(e={}){let[t,n]=hn(e.value,e.defaultValue||[],e.onChange),[r]=f(t),i=!!e.isRequired&&t.length===0,a=d(new Map),o=Ga({...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(Za(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}function Eo(e){let[t,n]=hn(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])}}let Do=Math.round(Math.random()*1e10),Oo=0;function ko(e){let t=l(()=>e.name||`radio-group-${Do}-${++Oo}`,[e.name]),[n,r]=hn(e.value,e.defaultValue??null,e.onChange),[i]=f(n),[a,o]=f(null),s=Ga({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},u=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||(u?`invalid`:null),isInvalid:u}}const Ao=i(null),jo=a(function(e,t){return s(Ao)?.isInvalid?r.createElement(Mo,{...e,ref:t}):null}),Mo=a((e,t)=>{let n=s(Ao),i=L(e,{global:!0}),a=H({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return a.children==null?null:r.createElement(wo,{slot:`errorMessage`,...i,...a,ref:t})}),No=i(null),Po=i(null),Fo=i(null),Io=a(function(e,t){[e,t]=U(e,t,Po);let{validationBehavior:n}=yn(No)||{},i=e.validationBehavior??n??`native`,a=To({...e,validationBehavior:i}),[o,s]=bn(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,descriptionProps:u,errorMessageProps:d,...f}=lo({...e,label:s,validationBehavior:i},a),p=H({...e,values:{isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:e.isRequired||!1,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-CheckboxGroup`}),m=L(e,{global:!0});return r.createElement(`div`,{...I(m,p,c),ref:t,slot:e.slot||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":a.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},r.createElement(_n,{values:[[Fo,a],[_o,{...l,ref:o,elementType:`span`}],[Co,{slots:{description:u,errorMessage:d}}],[Ao,f]]},p.children))}),Lo=a(function(e,t){let{inputRef:n=null,...i}=e;[e,t]=U(i,t,Re);let{validationBehavior:a}=yn(No)||{},o=e.validationBehavior??a??`native`,c=s(Fo),u=Ht(l(()=>ft(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:p,isDisabled:m,isReadOnly:h,isPressed:g,isInvalid:_}=c?fo({...xn(e),value:e.value,children:typeof e.children==`function`?!0:e.children},c,u):so({...xn(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},uo(e),u),{isFocused:v,isFocusVisible:y,focusProps:b}=ji(),x=m||h,{hoverProps:S,isHovered:C}=ci({...e,isDisabled:x}),w=H({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:p,isIndeterminate:e.isIndeterminate||!1,isPressed:g,isHovered:C,isFocused:v,isFocusVisible:y,isDisabled:m,isReadOnly:h,isInvalid:_,isRequired:e.isRequired||!1}}),T=L(e,{global:!0});return delete T.id,delete T.onClick,r.createElement(`label`,{...I(T,d,S,w),ref:t,slot:e.slot||void 0,"data-selected":p||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":g||void 0,"data-hovered":C||void 0,"data-focused":v||void 0,"data-focus-visible":y||void 0,"data-disabled":m||void 0,"data-readonly":h||void 0,"data-invalid":_||void 0,"data-required":e.isRequired||void 0},r.createElement(Oa,{elementType:`span`},r.createElement(`input`,{...I(f,b),ref:u})),w.children)}),Ro=i({}),zo=i({});let Bo=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Vo=io(function(e,t){[e,t]=U(e,t,zo);let{hoverProps:n,isHovered:i}=ci({...e,isDisabled:e.disabled}),{isFocused:a,isFocusVisible:o,focusProps:s}=ji({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=H({...e,values:{isHovered:i,isFocused:a,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-Input`});return r.createElement(`input`,{...I(Bo(e),s,n),...l,ref:t,"data-focused":a||void 0,"data-disabled":e.disabled||void 0,"data-hovered":i||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),Ho=i(null);function Uo(e){let t=d({});return r.createElement(Ho.Provider,{value:t},e.children)}const Wo=i({isSelected:!1}),Go=i(null),Ko=i(null),qo=a(function(e,t){let n=e[`aria-labelledby`];[e,t]=U(e,t,Go);let{dialogProps:i,titleProps:a}=po({...e,"aria-labelledby":n},t),o=s(Ko);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let c=H({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),l=L(e,{global:!0});return r.createElement(`section`,{...I(l,c,i),ref:t,slot:e.slot||void 0},r.createElement(_n,{values:[[ze,{slots:{[gn]:{},title:{...a,level:2}}}],[bo,{slots:{[gn]:{},close:{onPress:()=>o?.close()}}}]]},c.children))}),Jo=i(null),Yo=i(null),Xo=a(function(e,t){if(s(Yo))return r.createElement(es,{...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(Qo,{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p},r.createElement(es,{...m,modalRef:t},l))});function Zo(e,t){[e,t]=U(e,t,Jo);let n=s(Ko),i=Eo(e),a=e.isOpen!=null||e.defaultOpen!=null||!n?i:n,o=Ht(t),c=d(null),l=tn(o,a.isOpen),u=tn(c,a.isOpen),f=l||u||e.isExiting||!1,p=$e();return!a.isOpen&&!f||p?null:r.createElement($o,{...e,state:a,isExiting:f,overlayRef:o,modalRef:c})}const Qo=a(Zo);function $o({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=La(t,i,n),s=en(t.overlayRef)||t.isEntering||!1,c=H({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=Yt(),u;if(typeof document<`u`){let e=Gt(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(Fa,{isExiting:t.isExiting,portalContainer:e},r.createElement(`div`,{...I(L(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},r.createElement(_n,{values:[[Yo,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Ko,i]]},c.children)))}function es(e){let{modalProps:t,modalRef:n,isExiting:i,isDismissable:a}=s(Yo),o=s(Ko),c=Ht(l(()=>ft(e.modalRef,n),[e.modalRef,n])),u=en(c),d=H({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:u,isExiting:i,state:o}});return r.createElement(`div`,{...I(L(e,{global:!0}),t),...d,ref:c,"data-entering":u||void 0,"data-exiting":i||void 0},a&&r.createElement(Aa,{onDismiss:o.close}),d.children)}const ts=i(null),ns=i(null),rs=i(null),is=a(function(e,t){[e,t]=U(e,t,ts);let{validationBehavior:n}=yn(No)||{},i=e.validationBehavior??n??`native`,a=ko({...e,validationBehavior:i}),[o,s]=bn(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:l,descriptionProps:u,errorMessageProps:d,...f}=go({...e,label:s,validationBehavior:i},a),p=H({...e,values:{orientation:e.orientation||`vertical`,isDisabled:a.isDisabled,isReadOnly:a.isReadOnly,isRequired:a.isRequired,isInvalid:a.isInvalid,state:a},defaultClassName:`react-aria-RadioGroup`}),m=L(e,{global:!0});return r.createElement(`div`,{...I(m,p,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":a.isInvalid||void 0,"data-disabled":a.isDisabled||void 0,"data-readonly":a.isReadOnly||void 0,"data-required":a.isRequired||void 0},r.createElement(_n,{values:[[rs,a],[_o,{...l,ref:o,elementType:`span`}],[Co,{slots:{description:u,errorMessage:d}}],[Ao,f]]},r.createElement(Uo,null,p.children)))}),as=a(function(e,t){let{inputRef:n=null,...i}=e;[e,t]=U(i,t,ns);let a=r.useContext(rs),o=Ht(l(()=>ft(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:u,isDisabled:d,isPressed:f}=ho({...xn(e),children:typeof e.children==`function`?!0:e.children},a,o),{isFocused:p,isFocusVisible:m,focusProps:h}=ji(),g=d||a.isReadOnly,{hoverProps:_,isHovered:v}=ci({...e,isDisabled:g}),y=H({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:u,isPressed:f,isHovered:v,isFocused:p,isFocusVisible:m,isDisabled:d,isReadOnly:a.isReadOnly,isInvalid:a.isInvalid,isRequired:a.isRequired}}),b=L(e,{global:!0});return delete b.id,delete b.onClick,r.createElement(`label`,{...I(b,s,_,y),ref:t,"data-selected":u||void 0,"data-pressed":f||void 0,"data-hovered":v||void 0,"data-focused":p||void 0,"data-focus-visible":m||void 0,"data-disabled":d||void 0,"data-readonly":a.isReadOnly||void 0,"data-invalid":a.isInvalid||void 0,"data-required":a.isRequired||void 0},r.createElement(Oa,{elementType:`span`},r.createElement(`input`,{...I(c,h),ref:o})),r.createElement(Wo.Provider,{value:{isSelected:u}},y.children))}),os=i({});let ss=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const cs=a(function(e,t){[e,t]=U(e,t,os);let{hoverProps:n,isHovered:i}=ci(e),{isFocused:a,isFocusVisible:o,focusProps:s}=ji({isTextInput:!0,autoFocus:e.autoFocus}),c=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,l=H({...e,values:{isHovered:i,isFocused:a,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:c},defaultClassName:`react-aria-TextArea`});return r.createElement(`textarea`,{...I(ss(e),s,n),...l,ref:t,"data-focused":a||void 0,"data-disabled":e.disabled||void 0,"data-hovered":i||void 0,"data-focus-visible":o||void 0,"data-invalid":c||void 0})}),ls=i(null),us=io(function(e,t){[e,t]=U(e,t,ls);let{validationBehavior:n}=yn(No)||{},i=e.validationBehavior??n??`native`,a=d(null);[e,a]=U(e,a,Be);let[s,c]=bn(!e[`aria-label`]&&!e[`aria-labelledby`]),[l,u]=f(`input`),{labelProps:p,inputProps:m,descriptionProps:h,errorMessageProps:g,..._}=no({...xn(e),inputElementType:l,label:c,validationBehavior:i},a),v=o(e=>{a.current=e,e&&u(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[a]),y=H({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:_.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),b=L(e,{global:!0});return delete b.id,r.createElement(`div`,{...b,...y,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":_.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},r.createElement(_n,{values:[[_o,{...p,ref:s}],[zo,{...m,ref:v}],[os,{...m,ref:v}],[Ro,{role:`presentation`,isInvalid:_.isInvalid,isDisabled:e.isDisabled||!1}],[Co,{slots:{description:h,errorMessage:g}}],[Ao,_]]},y.children))}),ds=({title:e,description:t,classNames:n})=>{let{survey:r,dismiss:i}=ke();if(!r)return null;let a=t||r.confirmation.description;return b(v,{children:[y(`div`,{className:x(`cf-question`,n?.question),children:b(`div`,{className:x(`cf-header`,n?.header),children:[y(vo,{className:x(`cf-title`,n?.title),children:e||r.confirmation.title||`Feedback submitted!`}),a&&y(wo,{slot:`description`,className:x(`cf-description`,n?.description),children:a})]})}),y(xo,{className:`cf-submit-button`,onPress:i,children:r.confirmation.buttonText||`Close`})]})},fs=({className:e,iconClassName:t,onClose:n})=>y(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:y(`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`})})}),ps=({children:e,classNames:t,onDismiss:n,isDismissable:r=!0,closeOnFinishMs:i=3e3})=>{let{survey:a,surveyId:o,dismiss:s}=ke(),[c,l]=f(!1);return h(()=>{a&&s()},c?i:null),y(Qo,{isOpen:!0,isDismissable:r,isKeyboardDismissDisabled:!r,onOpenChange:async e=>{e||(await s(),n?.())},className:x(`confetti-modal-overlay`,t?.overlay),children:y(Xo,{className:x(`confetti-modal`,t?.modal),children:b(qo,{"aria-label":`Survey`,id:`${o}-popover`,className:x(`confetti-modal-dialog`,t?.dialog),children:[r&&y(fs,{className:x(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await s(),n?.()}}),typeof e==`function`?e({setIsFinished:()=>l(!0)}):e]})})})},ms=({children:e,classNames:t,containerProps:n,onDismiss:r,closeOnFinishMs:i=3e3})=>{let{surveyId:a,survey:o,dismiss:s}=ke(),[c,l]=f(!1);return h(()=>{o&&s()},c?i:null),b(`div`,{className:x(`confetti-dialog`,t?.dialog),id:`${a}-popover`,...n,children:[y(fs,{className:x(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await s(),r?.()}}),typeof e==`function`?e({setIsFinished:()=>l(!0)}):e]})},hs=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[l,u]=f(``);return c(()=>{i(l)},[i,l]),b(us,{isRequired:o,isInvalid:!!s,name:e,className:x(`cf-question`,a?.question),value:l,onChange:e=>{u(e),i(e)},children:[b(`div`,{className:x(`cf-header`,a?.header),children:[b(vo,{className:x(`cf-title`,a?.title),children:[t,!o&&b(`span`,{className:x(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&y(wo,{slot:`description`,className:x(`cf-description`,a?.description),children:n})]}),y(cs,{className:x(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),y(jo,{className:x(`cf-error`,a?.error),children:s})]})},gs=({children:e,classNames:t,description:n,...r})=>y(Lo,{...r,children:({isIndeterminate:r})=>b(v,{children:[b(`div`,{className:x(`cf-choice-label`,t?.label),children:[y(`div`,{className:x(`cf-checkbox-indicator`,t?.indicator),children:y(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:x(`cf-checkbox-indicator-svg`,t?.svg),children:r?y(`rect`,{x:1,y:7.5,width:16,height:3}):y(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&y(`span`,{className:x(`cf-choice-description`,t?.choiceDescription),children:n})]})}),_s=({children:e,classNames:t,...n})=>y(Lo,{...n,children:y(`div`,{className:x(`cf-tag-label`,t?.tagLabel),children:e})}),vs=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let u=!!n.editable,p=n.display??`checkbox`,[m,h]=f([]),[g,_]=f(``),S=d(null),C=d(null),w=l(()=>{let e=m.indexOf(me);if(e===-1)return m;let t=[...m];return t[e]=g||me,t},[g,m]),T=p===`tag`;return c(()=>{i(w)},[i,w]),y(Io,{isRequired:o,isInvalid:!!s,name:a,value:m,onChange:h,className:x(`cf-question`,r?.question),children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(vo,{className:x(`cf-title`,r?.title),children:[e,!o&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&y(wo,{slot:`description`,className:x(`cf-description`,r?.description),children:t})]}),b(`div`,{className:x(`cf-response-choices`,p===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>y(T?_s:gs,{className:x(`cf-choice`,T&&[`cf-tag`,r?.tag],!T&&[`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)),u&&(T?b(v,{children:[y(_s,{inputRef:S,onChange:e=>{C.current&&e&&requestAnimationFrame(()=>{C.current&&C.current.focus()})},className:x(`cf-choice cf-tag`,r?.tag),value:me,children:n.editable?.label}),y(Vo,{"data-visible":i.value.includes(me)||void 0,value:g,onChange:e=>{_(e.target.value)},ref:C,className:x(`cf-input cf-tag-input`,r?.othersInput)})]}):b(`div`,{className:x(`cf-choice cf-others-choice`,r?.othersChoice),children:[y(gs,{inputRef:S,onChange:e=>{C.current&&e&&requestAnimationFrame(()=>{C.current&&C.current.focus()})},className:x(`cf-checkbox`,r?.checkbox),value:me,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),y(Vo,{value:g,onChange:e=>{_(e.target.value)},tabIndex:i.value.includes(me)?0:-1,ref:C,onFocus:()=>{S.current?.checked===!1&&S.current.click()},className:x(`cf-input`,r?.othersInput)})]}))]}),y(jo,{className:x(`cf-error`,r?.error),children:s})]})})},ys=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),bs=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),xs=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),Ss=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),Cs=e=>b(`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:[y(`circle`,{cx:12,cy:12,r:10}),y(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),ws=e=>y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:y(`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`})}),Ts=e=>y(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:y(`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`})}),Es=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return y(`div`,{className:x(`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 y(as,{className:x(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:y(o?Ts:ws,{})},t)})})},Ds=({properties:e,classNames:t})=>y(`div`,{className:x(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return y(as,{className:x(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),Os=({properties:e,classNames:t,state:n})=>{let r=l(()=>[ys,xs,Ss,Cs,bs],[]),i=l(()=>[xs,Ss,Cs],[]);return l(()=>e.scale===3||e.scale===5,[e.scale])?y(`div`,{className:x(`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 y(as,{className:x(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&y(c,{})},a)})}):y(Ds,{properties:e,classNames:t,state:n})},ks=e=>{switch(e.properties.display??`star`){case`emoji`:return y(Os,{...e});case`number`:return y(Ds,{...e});case`star`:return y(Es,{...e})}},As=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[u,d]=f(null),p=l(()=>u?Number(u):void 0,[u]);return c(()=>{i(p)},[i,p]),y(is,{isRequired:s,isInvalid:!!o,name:a,className:x(`cf-question`,r?.question),value:u,onChange:d,children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(vo,{className:x(`cf-title`,r?.title),children:[t,!s&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),n&&y(wo,{slot:`description`,className:x(`cf-description`,r?.description),children:n})]}),b(`div`,{className:x(`cf-rating-section`,r?.ratingSection),children:[y(ks,{state:i,properties:e,classNames:r}),b(`div`,{className:x(`cf-rating-text`,r?.ratingText),children:[y(`span`,{className:x(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),y(`span`,{className:x(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),y(jo,{className:x(`cf-error`,r?.error),children:o})]})})},js=({classNames:e,className:t,description:n,...r})=>y(as,{...r,className:x(t,e?.radio),children:vn(r.children,t=>b(v,{children:[b(`div`,{className:x(`cf-choice-label`,e?.label),children:[y(`div`,{className:x(`cf-radio-indicator`,e?.indicator)}),t]}),n&&y(`span`,{className:x(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),Ms=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[u,p]=f(null),[m,h]=f(``),g=!!n.editable,_=d(null),S=d(null),C=l(()=>u===he?m||he:u??void 0,[m,u]);return c(()=>{i(C)},[i,C]),y(is,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{p(e),e===he&&requestAnimationFrame(()=>{S.current&&S.current.focus()})},value:u,className:x(`cf-question`,r?.question),children:({state:i})=>b(v,{children:[b(`div`,{className:x(`cf-header`,r?.header),children:[b(vo,{className:x(`cf-title`,r?.title),children:[e,!o&&b(`span`,{className:x(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&y(wo,{slot:`description`,className:x(`cf-description`,r?.description),children:t})]}),b(`div`,{className:x(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>y(js,{classNames:{indicator:r?.indicator,radio:x(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),g&&b(`div`,{className:x(`cf-choice cf-others-choice`,r?.othersChoice),children:[y(js,{inputRef:_,value:he,classNames:{indicator:r?.indicator,radio:x(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),y(Vo,{tabIndex:i.selectedValue===he?0:-1,ref:S,value:m,onChange:e=>h(e.target.value),onFocus:()=>{_.current?.checked===!1&&_.current.click()},className:x(`cf-input`,r?.othersInput)})]})]}),y(jo,{className:x(`cf-error`,r?.error),children:s})]})})},Ns=({properties:e,title:t,description:n,classNames:r})=>y(`div`,{className:x(`cf-question`,r?.question),children:b(`div`,{className:x(`cf-header`,r?.header),children:[t&&y(`div`,{className:x(`cf-title`,r?.title),children:t}),n&&y(`div`,{className:x(`cf-description`,r?.description),children:n})]})}),Ps=({question:e,onChange:t,error:n})=>{switch(e.properties.type){case`rating`:return y(As,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return y(hs,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return y(Ms,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return y(vs,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return y(Ns,{...e,properties:e.properties,onChange:t,error:n},e.id)}return y(`div`,{children:`Unsupported question type`},e.id)},Fs=({onPress:e,isDisabled:t,children:n=`Submit`})=>y(xo,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),Is=e=>{switch(e){case`multi-select`:return[];case`statement`:return;default:return``}},Ls=({onSubmit:e,children:n,question:r,isLastQuestion:i})=>{let[a,s]=f(Is(r.properties.type)),c=l(()=>je(r.properties,{required:r.required}),[r.properties,r.required]),u=l(()=>{let e=c.safeParse(a);if(!e.success)return w(e.error)},[a,c]),d=l(()=>{let e=r.routingLogic;if(e.type!==`always`&&(a===``||Array.isArray(a)&&a.length===0)&&r.required)return!0;let n=e.type===`always`?e.target:e.cases.find(e=>t({answer:a,condition:e}))?.target??e.default;return n.type===`end`?!1:n.type===`next`?!i:!0},[a,i,r.required,r.routingLogic]),p=l(()=>r.properties.buttonLabel?r.properties.buttonLabel:d?`Next`:`Submit`,[d,r.properties.buttonLabel]),m=o(()=>{switch(r.properties.type){case`statement`:if(r.properties.buttonUrl&&typeof window<`u`){let e=ie.safeParse(r.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(a)}},[a,e,r.properties]);return b(v,{children:[n({onChange:s,question:r,error:u}),y(Fs,{isDisabled:!!u,onPress:m,children:p})]})},Rs=({isCompleted:e,onSubmit:t,children:n})=>b(v,{children:[n,e&&y(Fs,{onPress:t})]}),zs=e=>y(Le,{...e,shouldAutoSubmit:!1,children:({questions:e,update:t,isCompleted:n,submit:r,isSubmitted:i,errors:a})=>i?y(ds,{}):y(Rs,{onSubmit:r,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>y(Ps,{question:e,error:a[e.id]||``,onChange:n=>t({question:e.position,answer:n})},e.position))})}),Bs=({onDismiss:e,closeOnFinishMs:t,isDismissable:r,...i})=>y(n,{fallback:y(v,{}),children:y(Oe,{...i,children:y(ps,{onDismiss:e,closeOnFinishMs:t,isDismissable:r,children:({setIsFinished:e})=>y(Ie,{...i,shouldAutoSubmit:!1,onFinished:()=>{e(),i.onFinished?.()},children:({questions:e,update:t,isCompleted:n,errors:r,submit:i,isSubmitted:a})=>a?y(ds,{}):y(Rs,{onSubmit:i,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>y(Ps,{question:e,error:r[e.id]||``,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})}),Vs=({onDismiss:e,closeOnFinishMs:t,...r})=>y(n,{fallback:y(v,{}),children:y(Oe,{...r,children:y(ms,{onDismiss:e,closeOnFinishMs:t,children:({setIsFinished:e})=>y(Ie,{shouldAutoSubmit:!0,...r,onFinished:()=>{e(),r.onFinished?.()},children:({current:e,questions:t,update:n,isSubmitted:r})=>{let i=e===t.length-1;if(r)return y(ds,{});let a=t[e];return a?y(Ls,{isLastQuestion:i,question:a,onSubmit:t=>n({question:e,answer:t}),children:e=>y(Ps,{...e})}):y(v,{})}})})})}),Hs=e=>y(Le,{...e,shouldAutoSubmit:!0,children:({current:e,questions:t,update:n,isSubmitted:r})=>{let i=e===t.length-1;if(r)return y(ds,{});let a=t[e];return a?y(Ls,{isLastQuestion:i,question:a,onSubmit:t=>n({question:e,answer:t}),children:e=>y(Ps,{...e})}):y(v,{})}}),Us=({delay:e})=>{let[t,n]=f(!1),r=l(()=>e,[]);return c(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},Ws=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${l(()=>window.location.pathname,[])}:visits:${t??``}`,0);return c(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},Gs=({visits:e,respondent:t})=>{let[n,r]=m(`cfti:${l(()=>window.location.pathname,[])}:visits:${t??``}`,0);return c(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},Ks=({threshold:e})=>{let[t,n]=f(()=>typeof window>`u`?!1:window.scrollY>=e);return c(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{Le as Confetti,De as ConfettiContext,Ie as ConfettiController,Oe as ConfettiProvider,Rs as Embed,zs as EmbeddedConfetti,Ls as Flow,hs as FreeText,Bs as ModalConfetti,ps as ModalContainer,vs as MultiChoice,Vs as PopoverConfetti,ms as PopoverContainer,As as Rating,Ms as SingleChoice,Ns as Statement,Hs as StepperConfetti,Ps as SurveyQuestionFactory,ds as ThankYouMessage,ke as useConfetti,Us as useVisibleAfterDelay,Ws as useVisibleAfterPageVisits,Ks as useVisibleAfterScroll,Gs as useVisibleAfterSessionPageVisits};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengovsg/confetti",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "Widgets for Confetti",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"react-aria-components": "1.14.0",
|
|
47
47
|
"tsdown": "0.19.0",
|
|
48
48
|
"typescript": "^5.9.3",
|
|
49
|
-
"@confetti/
|
|
50
|
-
"@confetti/validators": "0.0.0",
|
|
49
|
+
"@confetti/eslint-config": "0.0.0",
|
|
51
50
|
"@confetti/prettier-config": "0.0.0",
|
|
52
|
-
"@confetti/
|
|
51
|
+
"@confetti/tsconfig": "0.0.0",
|
|
52
|
+
"@confetti/validators": "0.0.0"
|
|
53
53
|
},
|
|
54
54
|
"prettier": "@confetti/prettier-config",
|
|
55
55
|
"scripts": {
|