@frigade/react 2.0.0-alpha.43 → 2.0.0-alpha.44

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/dist/index.d.ts CHANGED
@@ -8,6 +8,41 @@ import { EmotionJSX } from '@emotion/react/types/jsx-namespace';
8
8
  import { ControllerFieldState, Message, ValidationRule } from 'react-hook-form';
9
9
  import * as Popover from '@radix-ui/react-popover';
10
10
 
11
+ type FlowHandlerProp = (flow: Flow, event?: React.MouseEvent<unknown>) => Promise<boolean | void> | (boolean | void);
12
+ interface FlowHandlerProps {
13
+ onComplete?: FlowHandlerProp;
14
+ onDismiss?: FlowHandlerProp;
15
+ }
16
+ type DismissHandler = (e: React.MouseEvent<unknown>) => Promise<boolean | void>;
17
+ declare function useFlowHandlers(flow: Flow, { onComplete, onDismiss }?: FlowHandlerProps): {
18
+ handleDismiss: DismissHandler;
19
+ };
20
+
21
+ type StepHandlerProp = (step: FlowStep, event?: React.MouseEvent<unknown>) => Promise<boolean | void> | (boolean | void);
22
+ interface StepHandlerProps {
23
+ onPrimary?: StepHandlerProp;
24
+ onSecondary?: StepHandlerProp;
25
+ }
26
+ type StepHandler = (e: React.MouseEvent<unknown>) => Promise<boolean | void>;
27
+ declare function useStepHandlers(step: FlowStep, { onPrimary, onSecondary }?: StepHandlerProps): {
28
+ handlePrimary: StepHandler;
29
+ handleSecondary: StepHandler;
30
+ };
31
+
32
+ type DeepPartial<T> = {
33
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
34
+ };
35
+ interface FlowComponentProps extends Omit<BoxProps, 'container'> {
36
+ container?: 'dialog' | 'none';
37
+ dismissible?: boolean;
38
+ flowId: string;
39
+ onComplete?: FlowHandlerProp;
40
+ onDismiss?: FlowHandlerProp;
41
+ onPrimary?: StepHandlerProp;
42
+ onSecondary?: StepHandlerProp;
43
+ variables?: Record<string, unknown>;
44
+ }
45
+
11
46
  declare const tokens: {
12
47
  radii: {
13
48
  md: string;
@@ -206,8 +241,8 @@ declare const tokens: {
206
241
  };
207
242
  type Tokens = typeof tokens;
208
243
 
209
- type Theme = Partial<Tokens>;
210
- declare const theme: Partial<{
244
+ type Theme = DeepPartial<Tokens>;
245
+ declare const theme: DeepPartial<{
211
246
  radii: {
212
247
  md: string;
213
248
  lg: string;
@@ -413,25 +448,25 @@ declare const themedStyleProps: {
413
448
  readonly color: Record<ColorName, string>;
414
449
  readonly backgroundColor: Record<ColorName, string>;
415
450
  readonly borderColor: Record<ColorName, string>;
416
- readonly border: {
451
+ readonly border: DeepPartial<{
417
452
  md: string;
418
- };
419
- readonly borderRadius: {
453
+ }>;
454
+ readonly borderRadius: DeepPartial<{
420
455
  md: string;
421
456
  lg: string;
422
457
  round: string;
423
- };
424
- readonly borderWidth: {
458
+ }>;
459
+ readonly borderWidth: DeepPartial<{
425
460
  0: string;
426
461
  md: string;
427
- };
428
- readonly boxShadow: {
462
+ }>;
463
+ readonly boxShadow: DeepPartial<{
429
464
  md: string;
430
- };
431
- readonly fontFamily: {
465
+ }>;
466
+ readonly fontFamily: DeepPartial<{
432
467
  default: string;
433
- };
434
- readonly fontSize: {
468
+ }>;
469
+ readonly fontSize: DeepPartial<{
435
470
  xs: string;
436
471
  sm: string;
437
472
  md: string;
@@ -441,8 +476,8 @@ declare const themedStyleProps: {
441
476
  '3xl': string;
442
477
  '4xl': string;
443
478
  '5xl': string;
444
- };
445
- readonly fontWeight: {
479
+ }>;
480
+ readonly fontWeight: DeepPartial<{
446
481
  thin: string;
447
482
  extralight: string;
448
483
  light: string;
@@ -452,8 +487,8 @@ declare const themedStyleProps: {
452
487
  bold: string;
453
488
  extrabold: string;
454
489
  black: string;
455
- };
456
- readonly gap: {
490
+ }>;
491
+ readonly gap: DeepPartial<{
457
492
  0: string;
458
493
  4: string;
459
494
  20: string;
@@ -498,8 +533,8 @@ declare const themedStyleProps: {
498
533
  0.5: string;
499
534
  [-0.5]: string;
500
535
  auto: string;
501
- };
502
- readonly lineHeight: {
536
+ }>;
537
+ readonly lineHeight: DeepPartial<{
503
538
  xs: string;
504
539
  sm: string;
505
540
  md: string;
@@ -508,8 +543,8 @@ declare const themedStyleProps: {
508
543
  '2xl': string;
509
544
  '3xl': string;
510
545
  '4xl': string;
511
- };
512
- readonly margin: {
546
+ }>;
547
+ readonly margin: DeepPartial<{
513
548
  0: string;
514
549
  4: string;
515
550
  20: string;
@@ -554,8 +589,8 @@ declare const themedStyleProps: {
554
589
  0.5: string;
555
590
  [-0.5]: string;
556
591
  auto: string;
557
- };
558
- readonly marginBottom: {
592
+ }>;
593
+ readonly marginBottom: DeepPartial<{
559
594
  0: string;
560
595
  4: string;
561
596
  20: string;
@@ -600,8 +635,8 @@ declare const themedStyleProps: {
600
635
  0.5: string;
601
636
  [-0.5]: string;
602
637
  auto: string;
603
- };
604
- readonly marginLeft: {
638
+ }>;
639
+ readonly marginLeft: DeepPartial<{
605
640
  0: string;
606
641
  4: string;
607
642
  20: string;
@@ -646,8 +681,8 @@ declare const themedStyleProps: {
646
681
  0.5: string;
647
682
  [-0.5]: string;
648
683
  auto: string;
649
- };
650
- readonly marginRight: {
684
+ }>;
685
+ readonly marginRight: DeepPartial<{
651
686
  0: string;
652
687
  4: string;
653
688
  20: string;
@@ -692,8 +727,8 @@ declare const themedStyleProps: {
692
727
  0.5: string;
693
728
  [-0.5]: string;
694
729
  auto: string;
695
- };
696
- readonly marginTop: {
730
+ }>;
731
+ readonly marginTop: DeepPartial<{
697
732
  0: string;
698
733
  4: string;
699
734
  20: string;
@@ -738,8 +773,8 @@ declare const themedStyleProps: {
738
773
  0.5: string;
739
774
  [-0.5]: string;
740
775
  auto: string;
741
- };
742
- readonly padding: {
776
+ }>;
777
+ readonly padding: DeepPartial<{
743
778
  0: string;
744
779
  4: string;
745
780
  20: string;
@@ -784,8 +819,8 @@ declare const themedStyleProps: {
784
819
  0.5: string;
785
820
  [-0.5]: string;
786
821
  auto: string;
787
- };
788
- readonly paddingBottom: {
822
+ }>;
823
+ readonly paddingBottom: DeepPartial<{
789
824
  0: string;
790
825
  4: string;
791
826
  20: string;
@@ -830,8 +865,8 @@ declare const themedStyleProps: {
830
865
  0.5: string;
831
866
  [-0.5]: string;
832
867
  auto: string;
833
- };
834
- readonly paddingLeft: {
868
+ }>;
869
+ readonly paddingLeft: DeepPartial<{
835
870
  0: string;
836
871
  4: string;
837
872
  20: string;
@@ -876,8 +911,8 @@ declare const themedStyleProps: {
876
911
  0.5: string;
877
912
  [-0.5]: string;
878
913
  auto: string;
879
- };
880
- readonly paddingRight: {
914
+ }>;
915
+ readonly paddingRight: DeepPartial<{
881
916
  0: string;
882
917
  4: string;
883
918
  20: string;
@@ -922,8 +957,8 @@ declare const themedStyleProps: {
922
957
  0.5: string;
923
958
  [-0.5]: string;
924
959
  auto: string;
925
- };
926
- readonly paddingTop: {
960
+ }>;
961
+ readonly paddingTop: DeepPartial<{
927
962
  0: string;
928
963
  4: string;
929
964
  20: string;
@@ -968,7 +1003,7 @@ declare const themedStyleProps: {
968
1003
  0.5: string;
969
1004
  [-0.5]: string;
970
1005
  auto: string;
971
- };
1006
+ }>;
972
1007
  };
973
1008
  declare const stylePropShorthands: {
974
1009
  readonly bg: readonly ["backgroundColor"];
@@ -1087,38 +1122,6 @@ declare namespace Text {
1087
1122
  interface DialogProps extends BoxProps {
1088
1123
  }
1089
1124
 
1090
- type FlowHandlerProp = (flow: Flow, event?: React.MouseEvent<unknown>) => Promise<boolean | void> | (boolean | void);
1091
- interface FlowHandlerProps {
1092
- onComplete?: FlowHandlerProp;
1093
- onDismiss?: FlowHandlerProp;
1094
- }
1095
- type DismissHandler = (e: React.MouseEvent<unknown>) => Promise<boolean | void>;
1096
- declare function useFlowHandlers(flow: Flow, { onComplete, onDismiss }?: FlowHandlerProps): {
1097
- handleDismiss: DismissHandler;
1098
- };
1099
-
1100
- type StepHandlerProp = (step: FlowStep, event?: React.MouseEvent<unknown>) => Promise<boolean | void> | (boolean | void);
1101
- interface StepHandlerProps {
1102
- onPrimary?: StepHandlerProp;
1103
- onSecondary?: StepHandlerProp;
1104
- }
1105
- type StepHandler = (e: React.MouseEvent<unknown>) => Promise<boolean | void>;
1106
- declare function useStepHandlers(step: FlowStep, { onPrimary, onSecondary }?: StepHandlerProps): {
1107
- handlePrimary: StepHandler;
1108
- handleSecondary: StepHandler;
1109
- };
1110
-
1111
- interface FlowComponentProps extends Omit<BoxProps, 'container'> {
1112
- container?: 'dialog' | 'none';
1113
- dismissible?: boolean;
1114
- flowId: string;
1115
- onComplete?: FlowHandlerProp;
1116
- onDismiss?: FlowHandlerProp;
1117
- onPrimary?: StepHandlerProp;
1118
- onSecondary?: StepHandlerProp;
1119
- variables?: Record<string, unknown>;
1120
- }
1121
-
1122
1125
  interface AnnouncementProps extends FlowComponentProps, Omit<DialogProps, 'container'> {
1123
1126
  }
1124
1127
  declare function Announcement(props: AnnouncementProps): _emotion_react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -12,11 +12,11 @@ import { Frigade } from '@frigade/js';
12
12
  export { Flow, Frigade } from '@frigade/js';
13
13
  import { useForm, useController } from 'react-hook-form';
14
14
  import * as N from '@radix-ui/react-radio-group';
15
- import * as P from '@radix-ui/react-select';
15
+ import * as b from '@radix-ui/react-select';
16
16
  import { ChevronDownIcon } from '@heroicons/react/24/outline';
17
17
  import * as E from '@radix-ui/react-popover';
18
18
 
19
- var Bo=Object.defineProperty;var Ro=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(o,t)=>(typeof require<"u"?require:o)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var oe=(e,o)=>{for(var t in o)Bo(e,t,{get:o[t],enumerable:!0});};var be={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var Ce={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",inherit:"inherit",red500:"#c00000"};var Se={md:"10px",lg:"20px",round:"50%"};var l=e=>`var(--fr-colors-${e})`,Fe={neutral:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray700"),active:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},focus:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},hover:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")}},primary:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500"),active:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")},focus:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500")},hover:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")}},secondary:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray900"),active:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")},focus:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray900")},hover:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")}}};var Te={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var vo="px",ko=e=>typeof e=="number"?`${4*e}${vo}`:e,Eo=[-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,-.5,0,.5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"auto"],we=Object.fromEntries(Eo.map(e=>[e,ko(e)]));var Be={fontFamilies:{default:"TT Interphases Pro, sans-serif"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",demibold:"600",bold:"700",extrabold:"800",black:"900"},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"}};var me={...be,colors:{...Ce,...Fe},...Be,radii:Se,shadows:Te,space:we};function U(e,o="",t="."){return Object.keys(e).reduce((n,r)=>{let a=`${o.length?`${o}${t}`:""}${r}`,s=e[r];return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(n,U(s,a,t)):n[a]=s,n},{})}function ce(e){return U(e,"--fr","-")}function Re(e,o="--fr"){let t={};return Object.keys(e).forEach(n=>{let r=e[n];typeof r=="object"&&r!==null&&!Array.isArray(r)?t[n]=Re(r,`${o}-${n}`):t[n]=`var(${o}-${n})`;}),t}var ve=ce(me),c=Re(me);var Mo=new Set(["alt","size","src"]),Oo=Do.all.filter(e=>e.indexOf("-")!=0&&!Mo.has(e)).map(e=>[e.replace(/-([a-z])/g,(o,t)=>t.toUpperCase()),null]),Ho=Object.fromEntries(Oo),ue=U(c.colors),Io={color:ue,backgroundColor:ue,borderColor:ue,border:c.borders,borderRadius:c.radii,borderWidth:c.borderWidths,boxShadow:c.shadows,fontFamily:c.fontFamilies,fontSize:c.fontSizes,fontWeight:c.fontWeights,gap:c.space,lineHeight:c.lineHeights,margin:c.space,marginBottom:c.space,marginLeft:c.space,marginRight:c.space,marginTop:c.space,padding:c.space,paddingBottom:c.space,paddingLeft:c.space,paddingRight:c.space,paddingTop:c.space},ke={...Ho,...Io},Ee={bg:["backgroundColor"],m:["margin"],mt:["marginTop"],mr:["marginRight"],mb:["marginBottom"],ml:["marginLeft"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],p:["padding"],pt:["paddingTop"],pr:["paddingRight"],pb:["paddingBottom"],pl:["paddingLeft"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},De=new Set(["active","focus","focusVisible","focusWithin","hover"]);function Ao(e){return Array.isArray(e)?new Map(e.map(o=>[o,o])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):typeof e=="string"||typeof e=="number"?new Map([[e,e]]):new Map}var Me=new Map(Object.entries(ke).map(([e,o])=>[e,Ao(o)])),Vo=new Map(Object.entries(Ee).map(([e,o])=>[e,new Set(o)])),Lo=new Set(["height","width"]),Wo=new Set(["canvas","embed","iframe","img","input","object","video"]);function Oe(e){let[o,t]=e.split(":");return [o,De.has(t)?t:null]}function He(e,o="div"){let t=Object.assign({},e),n={};function r(i){if(i==null)return n;let s=`&:${i.replace(/[A-Z]/g,m=>`-${m.toLocaleLowerCase()}`)}`;return n[s]==null&&(n[s]={}),n[s]}return Object.entries(t).forEach(([i,a])=>{let[s,m]=Oe(i),f=Vo.get(s);f!=null&&(f.forEach(u=>{let S=`${u}${m?":"+m:""}`;t[S]=a;}),delete t[i]);}),Object.entries(t).forEach(([i,a])=>{let[s,m]=Oe(i),f=Me.get(s);if(f!=null){if(typeof a=="string"&&a.indexOf(" ")>-1){let u=a.split(" ");r(m)[s]=u.map(S=>f.get(S.toString())??S).join(" ");}else f.has(a.toString())?r(m)[s]=f.get(a.toString()):r(m)[s]=a;(typeof o!="string"||!Wo.has(o)||!Lo.has(s))&&delete t[i];}}),Object.keys(t).forEach(i=>{let a=i.substring(1);i.indexOf("_")===0&&Me.has(a)&&(t[a]=t[i],delete t[i]);}),{cssFromProps:n,unmatchedProps:t}}function zo(){if(typeof window>"u"){let{JSDOM:e}=Ro("jsdom");return new e("<!DOCTYPE html>").window}return window}function Ie(e){return e?{__html:$o(zo()).sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted"]})}:{__html:""}}function Ko(e){return e&&`fr-${e}`}function Le(e){return e&&(Array.isArray(e)?e.map(o=>Le(o)).join(" "):Ko(e))}function No({as:e,children:o,className:t,css:n={},part:r,...i},a){let s=e??"div",{cssFromProps:m,unmatchedProps:f}=He(i,s),u=Le(r),S=t||u?clsx(t,u):void 0,k=[{boxSizing:"border-box"},m,n];return typeof o=="string"?jsx(s,{className:S,css:k,...f,ref:a,dangerouslySetInnerHTML:Ie(o)}):jsx(s,{className:S,css:k,...f,ref:a,children:o})}var p=xe.forwardRef(No);var d={};oe(d,{Body1:()=>at,Body2:()=>lt,Caption:()=>pt,Display1:()=>ot,Display2:()=>tt,H1:()=>rt,H2:()=>nt,H3:()=>it,H4:()=>st});var fe={};oe(fe,{Body1:()=>Yo,Body2:()=>Qo,Caption:()=>Zo,Display1:()=>jo,Display2:()=>Uo,H1:()=>Go,H2:()=>Xo,H3:()=>Jo,H4:()=>qo});var D={color:"neutral.foreground",fontFamily:"default",margin:"0"},jo={...D,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},Uo={...D,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},Go={...D,fontSize:"3xl",fontWeight:"bold",lineHeight:"2xl"},Xo={...D,fontSize:"2xl",fontWeight:"bold",lineHeight:"xl"},Jo={...D,fontSize:"xl",fontWeight:"bold",lineHeight:"lg"},qo={...D,fontSize:"lg",fontWeight:"bold",lineHeight:"md"},Yo={...D,fontSize:"md",fontWeight:"regular",lineHeight:"md"},Qo={...D,fontSize:"sm",fontWeight:"regular",lineHeight:"md"},Zo={...D,fontSize:"xs",fontWeight:"regular",lineHeight:"sm"};var et=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],M=Object.fromEntries(et.map(e=>{let o=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",t=xe.forwardRef(({as:n=o,children:r,...i},a)=>jsx(p,{as:n,...fe[e],...i,ref:a,children:r}));return t.displayName=`Text.${e}`,[e,t]})),ot=M.Display1,tt=M.Display2,rt=M.H1,nt=M.H2,it=M.H3,st=M.H4,at=M.Body1,lt=M.Body2,pt=M.Caption;var ge={};oe(ge,{Link:()=>ut,Plain:()=>ft,Primary:()=>mt,Secondary:()=>ct});var te={borderWidth:"0",borderRadius:"md",display:"flex",gap:"2",padding:"2 4"},mt={...te,backgroundColor:"primary.surface",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface"},ct={...te,backgroundColor:"secondary.background",borderColor:"secondary.border",borderStyle:"solid",borderWidth:"1px",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background"},ut={...te,backgroundColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"},ft={...te,backgroundColor:"transparent",color:"neutral.foreground"};function $e({as:e,children:o,part:t,title:n,variant:r="Primary",...i}){let a=r.toLocaleLowerCase();return jsxs(p,{as:e??"button",part:[`button-${a}`,t],...ge[r],...i,children:[o,n&&jsx(d.Body2,{flexGrow:"1",fontWeight:"demibold",color:"inherit",children:n})]})}var gt=["Primary","Secondary","Link","Plain"],xt=Object.fromEntries(gt.map(e=>{let o=t=>jsx($e,{...t,variant:e,children:t.children});return o.displayName=`Text.${e}`,[e,o]})),g=Object.assign($e,xt);var x={};oe(x,{Column:()=>Pt,Row:()=>ht});var ht=xe.forwardRef(({children:e,css:o,...t},n)=>jsx(p,{css:[{display:"flex",flexDirection:"row"},o],...t,ref:n,children:e})),Pt=xe.forwardRef(({children:e,css:o,...t},n)=>jsx(p,{css:[{display:"flex",flexDirection:"column"},o],...t,ref:n,children:e}));var R=createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function Rt({children:e,navigate:o,theme:t,...n}){let r=t?ce(t):{},[i,a]=useState(new Set),s=useMemo(()=>new Frigade(n.apiKey,{apiKey:n.apiKey,apiUrl:n.apiUrl,userId:n.userId,groupId:n.groupId,__readOnly:n.__readOnly,__flowConfigOverrides:n.__flowConfigOverrides}),[n.userId,n.groupId,n.apiKey]),m=o??((u,S="_self")=>{window.open(u,S);});useEffect(()=>()=>{s.destroy();},[]);let f=i.size>0?i.values().next().value:null;return jsxs(R.Provider,{value:{modals:i,setModals:a,currentModal:f,navigate:m,...n,frigade:s},children:[jsx(Global,{styles:{":root":{...ve,...r}}}),jsx(ThemeProvider,{theme:c,children:e})]})}function G(e,o){let[t,n]=useState(),[,r]=useState(""),{frigade:i}=useContext(R),a=s=>{s.id===e&&(o!=null&&o.variables&&s.applyVariables(o.variables),n(s),r(Math.random().toString()));};return useEffect(()=>((async()=>{let s=await i.getFlow(e);if(!s||i.hasFailedToLoad()){n(void 0);return}o!=null&&o.variables&&s.applyVariables(o.variables),n(s);})(),i.onStateChange(a),()=>{i.removeStateChangeHandler(a);}),[]),{flow:t}}function V(e,{onComplete:o,onDismiss:t}={}){let n=useRef(null);return useEffect(()=>{e!=null&&(e.isCompleted&&n.current===!1&&(async()=>await(o==null?void 0:o(e)))(),n.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(async r=>{if(await(t==null?void 0:t(e,r))===!1)return r.preventDefault(),!1;await e.skip();},[e])}}function X(e,{onPrimary:o,onSecondary:t}={}){let{navigate:n}=useContext(R);return {handlePrimary:useCallback(async r=>{if(await(o==null?void 0:o(e,r))===!1)return r.preventDefault(),!1;await e.complete(),e.primaryButtonUri!=null&&n(e.primaryButtonUri,e.primaryButtonUriTarget);},[e]),handleSecondary:useCallback(async r=>{if(await(t==null?void 0:t(e,r))===!1)return r.preventDefault(),!1;await e.complete(),e.secondaryButtonUri!=null&&n(e.secondaryButtonUri,e.secondaryButtonUriTarget);},[e])}}function J(e){let{currentModal:o,modals:t,setModals:n}=useContext(R),[r,i]=useState(!1);useEffect(()=>{e!=null&&e.isVisible&&e&&!t.has(e.id)&&n(s=>new Set(s).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),useEffect(()=>{let s=o===(e==null?void 0:e.id);(e==null?void 0:e.id)!=null&&s!==r&&i(s);},[e==null?void 0:e.id,o]);function a(){t.has(e==null?void 0:e.id)&&n(s=>{let m=new Set(s);return m.delete(e==null?void 0:e.id),m});}return {isCurrentModal:r,removeModal:a}}function $t(e){return jsx(g.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})}function H({as:e,container:o,dismissible:t=!0,flowId:n,onComplete:r,onDismiss:i,onPrimary:a,onSecondary:s,variables:m,...f}){let u=o==="dialog"?F:e??p,S=u.Close??$t,k=function({children:le,...Y}){let{flow:b}=G(n,{variables:m}),j=b==null?void 0:b.getCurrentStep(),{handleDismiss:Q}=V(b,{onComplete:r,onDismiss:i}),{handlePrimary:pe,handleSecondary:de}=X(j,{onPrimary:a,onSecondary:s}),{isCurrentModal:_,removeModal:Z}=J(b);return useEffect(()=>{!(b!=null&&b.isVisible)&&_&&Z();},[b==null?void 0:b.isVisible,_]),b==null||!b.isVisible||!_?null:(b.start(),j.start(),jsxs(u,{position:"relative",...Y,...f,children:[t&&jsx(S,{onClick:Q}),le({flow:b,handleDismiss:Q,handlePrimary:pe,handleSecondary:de,step:j})]}))};return {FlowComponent:useMemo(()=>k,[])}}function Xe(e){let{FlowComponent:o}=H(e);return jsx(o,{as:y,gap:5,children:({handlePrimary:t,handleSecondary:n,step:r})=>jsxs(Fragment,{children:[jsx(y.Title,{children:r.title}),jsx(y.Subtitle,{children:r.subtitle}),jsx(y.Media,{src:r.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxs(x.Row,{gap:3,justifyContent:"flex-end",children:[jsx(y.Secondary,{title:r.secondaryButtonTitle,onClick:n}),jsx(y.Primary,{title:r.primaryButtonTitle??"Continue",onClick:t})]})]})})}function Je({part:e,src:o,...t}){return jsx(p,{as:"img",part:["image",e],src:o,...t})}function Nt(e){var o,t,n;if(e.includes("youtube"))return `https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`;if(e.includes("vimeo"))return `https://player.vimeo.com/video/${(t=e.split("vimeo.com/")[1])==null?void 0:t.split("&")[0]}`;if(e.includes("wistia"))return `https://fast.wistia.net/embed/iframe/${(n=e.split("wistia.com/medias/")[1])==null?void 0:n.split("&")[0]}`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia).")}function qe({part:e,src:o,...t}){let n=Nt(o);return jsx(p,{allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:n,...t})}function L({src:e,type:o,...t}){return jsx(o==="video"?qe:Je,{src:e,...t})}var y=xe.forwardRef(({as:e,children:o,...t},n)=>{if(t.flowId!=null)return jsx(Xe,{as:e,...t});let r=e??x.Column;return jsx(r,{backgroundColor:"neutral.background",borderRadius:"md",gap:5,p:5,...t,ref:n,children:o})});y.Media=({src:e,...o})=>e==null?null:jsx(L,{borderRadius:"md",src:e,...o});y.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Primary,{title:o,onClick:e,...t});y.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Secondary,{title:o,onClick:e,...t});y.Subtitle=({children:e,...o})=>e==null?null:jsx(d.Body2,{display:"block",part:"subtitle",mt:1,...o,children:e});y.Title=({children:e,...o})=>e==null?null:jsx(d.Body1,{display:"block",fontWeight:"bold",part:"title",...o,children:e});function F({children:e,...o}){return jsx(T.Root,{defaultOpen:!0,modal:!0,children:jsx(T.Portal,{children:jsxs(p,{inset:"0",position:"fixed",zIndex:"9999",children:[jsx(T.Overlay,{asChild:!0,children:jsx(p,{background:"rgb(0 0 0 / 0.5)",part:"dialog-overlay",position:"fixed",inset:"0"})}),jsx(T.Content,{asChild:!0,onOpenAutoFocus:t=>t.preventDefault(),onPointerDownOutside:t=>t.preventDefault(),children:jsx(y,{boxShadow:"md",left:"50%",maxWidth:"430px",p:8,part:"dialog-content",position:"fixed",textAlign:"center",top:"50%",transform:"translate(-50%, -50%)",...o,children:e})})]})})})}F.Close=e=>jsx(T.Close,{"aria-label":"Close",asChild:!0,children:jsx(g.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})});F.Subtitle=({children:e,...o})=>jsx(T.Description,{asChild:!0,children:jsx(d.Body2,{mb:5,part:"subtitle",...o,children:e})});F.Media=({src:e,...o})=>e==null?null:jsx(L,{borderRadius:"md",src:e,...o});F.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Primary,{title:o,onClick:e,...t});F.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((n,r)=>jsx("circle",{r:4,cx:4+16*r,cy:"4px",fill:e===r?c.colors.blue500:c.colors.blue800},r));return jsx(p,{as:"svg",height:"8px",margin:"5 auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};F.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Secondary,{title:o,onClick:e,...t});F.Title=({children:e,...o})=>jsx(T.Title,{asChild:!0,children:jsx(d.H3,{mb:1,part:"title",...o,children:e})});function Jt(e){let{FlowComponent:o}=H({...e,container:"dialog"});return jsx(o,{children:({flow:t,handlePrimary:n,handleSecondary:r,step:i})=>jsxs(Fragment,{children:[jsx(F.Title,{children:i.title}),jsx(F.Subtitle,{children:i.subtitle}),jsx(F.Media,{src:i.imageUri,css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsx(F.ProgressDots,{current:t.getNumberOfCompletedSteps(),total:t.getNumberOfAvailableSteps()}),jsxs(x.Row,{css:{"& > button":{flexGrow:1}},gap:3,children:[i.secondaryButtonTitle&&jsx(F.Secondary,{title:i.secondaryButtonTitle,onClick:r}),jsx(F.Primary,{title:i.primaryButtonTitle??"Continue",onClick:n})]})]})})}function Qt(e){let{FlowComponent:o}=H(e);return jsx(o,{as:y,border:"md",borderColor:"gray900",display:"flex",flexDirection:"row",gap:3,justifyContent:"space-between",children:({handleDismiss:t,handlePrimary:n,handleSecondary:r,step:i})=>jsxs(Fragment,{children:[jsxs(x.Row,{gap:3,children:[i.imageUri&&jsx("img",{src:i.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxs(x.Column,{children:[jsx(d.H4,{mb:1,children:i.title}),jsx(d.Body2,{children:i.subtitle})]})]}),jsxs(x.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[i.secondaryButtonTitle&&jsx(g.Secondary,{title:i.secondaryButtonTitle,onClick:r}),jsx(g.Primary,{title:i.primaryButtonTitle,onClick:n}),e.dismissible&&e.container!="dialog"&&jsx(g.Plain,{part:"banner-close",onClick:t,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})]})]})})}var tr=new Set(["required","min","max","minLength","maxLength","pattern"]);function rr({fieldComponent:e,control:o,fieldData:t}){t.pattern!=null&&(typeof t.pattern=="string"?t.pattern=new RegExp(t.pattern.replace(/^\/|\/$/g,"")):typeof t.pattern=="object"&&typeof t.pattern.value=="string"&&(t.pattern.value=new RegExp(t.pattern.value.replace(/^\/|\/$/g,""))));let n=Object.fromEntries(Object.entries(t).filter(([i])=>tr.has(i))),r=useController({name:t.id,control:o,rules:n});return jsx(e,{...r,fieldData:t})}function Ze({fieldTypes:e,step:o}){var a;let{control:t,handleSubmit:n}=useForm({delayError:2e3,mode:"onChange"}),r=[];function i(s){o.complete(s);}return (a=o.fields)==null||a.forEach(s=>{e[s.type]!=null&&r.push(jsx(rr,{control:t,fieldComponent:e[s.type],fieldData:s},s.id));}),jsxs(Fragment,{children:[r,jsx(x.Row,{justifyContent:"flex-end",children:jsx(g.Primary,{title:o.primaryButtonTitle??"Submit",onClick:n(i)})},"form-footer")]})}function eo({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsx(d.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function oo({children:e,id:o,required:t=!1}){return jsxs(d.Body2,{as:"label",htmlFor:o,fontWeight:"demibold",part:"field-label",children:[e,t&&" *"]})}var to={marginBottom:"5"},q={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function A({children:e,field:o,fieldData:t,fieldState:n}){let{id:r,label:i,placeholder:a}=t,{error:s}=n,m={id:r,...o,...a?{placeholder:a}:{},...q,"aria-invalid":!!s,value:o.value??""};return jsxs(p,{...to,part:"field",children:[jsx(oo,{id:r,required:!!t.required,children:i}),e(m),jsx(eo,{error:s})]})}var pr=()=>jsx(p,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),dr=xe.forwardRef(({label:e,value:o},t)=>jsxs(p,{as:"label",htmlFor:o,display:"flex",justifyContent:"space-between",part:"field-radio",px:4,py:2,borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"md",children:[jsx(d.Body2,{part:"field-radio-label",children:e}),jsx(N.Item,{id:o,value:o,ref:t,asChild:!0,children:jsx(p,{as:"button",backgroundColor:"neutral.background",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"24px",width:"24px",children:jsx(p,{as:N.Indicator,alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsx(pr,{})})})})]}));function so(e){let{field:{onChange:o,value:t},fieldData:{options:n=[]}}=e,r=n.map(({label:i,value:a})=>jsx(dr,{value:a,label:i},a));return jsx(A,{...e,children:()=>jsx(N.Root,{value:t,onValueChange:o,asChild:!0,children:jsx(x.Column,{gap:2,part:"field-radio-group",children:r})})})}var ur=xe.forwardRef(({label:e,value:o},t)=>jsx(P.Item,{value:o,ref:t,asChild:!0,children:jsx(p,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsx(P.ItemText,{asChild:!0,children:jsx(d.Body2,{part:"field-select-option-label",children:e})})})}));function po(e){let{field:{onChange:o,value:t},fieldData:{options:n=[],placeholder:r}}=e,i=n.map(({label:a,value:s})=>jsx(ur,{value:s,label:a},s));return jsx(A,{...e,children:()=>jsxs(P.Root,{value:t,onValueChange:o,children:[jsx(P.Trigger,{asChild:!0,children:jsxs(d.Body2,{...q,alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsx(P.Value,{placeholder:r??"Select one"}),jsx(P.Icon,{children:jsx(p,{as:ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]})}),jsx(P.Portal,{children:jsx(P.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsx(p,{...q,p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsx(P.Viewport,{children:i})})})})]})})}function co(e){return jsx(A,{...e,children:o=>jsx(d.Body2,{as:"input",part:"field-text",type:"text",...o})})}function fo(e){return jsx(A,{...e,children:o=>jsx(d.Body2,{as:"textarea",part:"field-textarea",...o})})}var fr={radio:so,select:po,text:co,textarea:fo};function gr({fieldTypes:e={},...o}){let{FlowComponent:t}=H(o),n=Object.assign({},fr,e);return jsx(t,{children:({step:r})=>jsx(Ze,{fieldTypes:n,step:r,...o})})}function ie(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[o,t]=useState(e),[n,r]=useState(null),i=useCallback(a=>{r(a);},[]);return useLayoutEffect(()=>{if(!n)return;let a=()=>{let s=n.getBoundingClientRect();t(s);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[n]),{node:n,rect:o,ref:i}}var Pr=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function ho({style:e={},part:o="",...t}){return jsxs(p,{part:`dot-wrapper ${o}`,style:{height:"48px",position:"absolute",width:"48px",...e},...t,children:[jsx(p,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${Pr}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(p,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function Po({props:e,alignAttr:o,sideAttr:t}){let n=t??"bottom",r={},i=()=>{if(["after","before"].includes(e.align)){if(o=="start")return "before";if(o=="end")return "after"}return e.align??"after"},a="-24px",s={top:"bottom",right:"left",bottom:"top",left:"right"};r[s[n]]=a;let m=i();return ["before","end"].includes(m)?["top","bottom"].includes(n)?r.right=a:r.bottom=a:["after","start"].includes(m)?["top","bottom"].includes(n)?r.left=a:r.top=a:["top","bottom"].includes(n)?r.left=`calc(50% + ${a})`:r.top=`calc(50% + ${a})`,r}var bo={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Co(e,o){let t=Object.fromEntries(bo.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),n=Object.fromEntries(bo.root.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0));if(t.align=t.align??"after",t.side=t.side??"bottom",["before","after"].includes(t.align)){let r={after:"end",before:"start"},i=(S,k)=>["top","bottom"].includes(k)?S=="after"?"marginLeft":"marginRight":S=="after"?"marginTop":"marginBottom",a=t.alignOffset??0,s=t.style??{},m=t.side??"bottom",f=t.align;t.style={...s,[i(f,m)]:a};let u=["top","bottom"].includes(m)?o.width:o.height;t.alignOffset=(u+a)*-1,t.align=r[f];}return {contentProps:t,rootProps:n}}function C({anchor:e,children:o,className:t,spotlight:n=!1,style:r,...i}){let{node:a,rect:s,ref:m}=ie(),{node:f,rect:u,ref:S}=ie(),{contentProps:k,rootProps:Pe}=Co(i,s),[ae,le]=useState(k.align),[Y,b]=useState(k.side),[j,Q]=useState(0),[pe,de]=useState(0);if(a!==null){let O=a.getAttribute("data-align"),ee=a.getAttribute("data-side");ae!==O&&le(O),Y!==ee&&b(ee);}let _=useRef(null);if(useEffect(()=>{let O=document.querySelector(e);O!=null&&(S(O),_.current=O);},[e]),useEffect(()=>{let{scrollX:O,scrollY:ee}=window;Q(u.left+O),de(u.top+ee);},[u.left,u.top]),f==null)return null;let Z="0";typeof window<"u"&&(Z=window.getComputedStyle(f).borderRadius);let wo=Po({props:i,alignAttr:ae,sideAttr:Y});return jsxs(E.Root,{defaultOpen:!0,...Pe,children:[jsx(E.Anchor,{virtualRef:_}),jsx(E.Portal,{children:jsxs("div",{className:t,css:{bottom:0,left:0,position:"absolute",right:0,top:0,zIndex:9999},children:[n&&jsx(p,{part:"tooltip-spotlight",position:"absolute",style:{borderRadius:Z,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",height:u.height,left:j,top:pe,width:u.width}}),jsx(E.Content,{asChild:!0,...k,ref:m,children:jsxs(y,{boxShadow:"md",part:"tooltip-content",position:"relative",css:{maxWidth:"360px",...r},children:[jsx(ho,{style:wo}),o]})})]})})]})}C.Close=e=>jsx(E.Close,{"aria-label":"Close",asChild:!0,children:jsx(g.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})});C.Media=({src:e,...o})=>e==null?null:jsx(L,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:e,...o});C.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Primary,{title:o,onClick:e,...t});C.Progress=({children:e,...o})=>e==null?null:jsx(d.Body2,{fontWeight:"demibold",part:"progress",...o,children:e});C.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Secondary,{title:o,onClick:e,...t});C.Subtitle=({children:e,...o})=>e==null?null:jsx(d.Body2,{part:"subtitle",...o,children:e});C.Title=({children:e,...o})=>e==null?null:jsx(d.Body1,{fontWeight:"bold",mb:1,part:"title",...o,children:e});function To({dismissible:e=!0,flow:o,onDismiss:t,onPrimary:n,onSecondary:r,step:i,...a}){let{handleDismiss:s}=V(o,{onDismiss:t}),{handlePrimary:m,handleSecondary:f}=X(i,{onPrimary:n,onSecondary:r});return jsxs(C,{anchor:i.selector,onOpenAutoFocus:u=>u.preventDefault(),onPointerDownOutside:u=>u.preventDefault(),...a,children:[e&&jsx(C.Close,{onClick:s}),jsx(C.Media,{src:i.videoUri??i.imageUri,type:i.videoUri?"video":"image"}),jsx(C.Title,{children:i.title}),jsx(C.Subtitle,{children:i.subtitle}),jsxs(x.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",pt:4,children:[jsx(C.Progress,{children:`${o.getNumberOfCompletedSteps()+1}/${o.getNumberOfAvailableSteps()}`}),jsx(C.Secondary,{marginLeft:"auto",title:i.secondaryButtonTitle,onClick:f}),jsx(C.Primary,{title:i.primaryButtonTitle,onClick:m})]})]},i.id)}function Tr({flowId:e,onComplete:o,variables:t,...n}){let{flow:r}=G(e,{variables:t});V(r,{onComplete:o});let{isCurrentModal:i,removeModal:a}=J(r);if(useEffect(()=>{!(r!=null&&r.isVisible)&&i&&a();},[r==null?void 0:r.isVisible,i]),r==null||r.isVisible===!1||!i)return null;r.start();let s=r.getCurrentStep();return s==null||s.start(),jsx(To,{step:s,flow:r,...n})}function Rr(){let{frigade:e}=useContext(R);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function kr(){let{userId:e,frigade:o}=useContext(R);async function t(r){await o.identify(e,r);}async function n(r,i){await o.track(r,i);}return {userId:e,setProperties:t,track:n}}function Dr(){let{groupId:e,frigade:o}=useContext(R);async function t(r){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}await o.group(e,r);}async function n(r,i){await o.track(r,i);}return {groupId:e,setProperties:t,track:n}}
19
+ var Bo=Object.defineProperty;var Ro=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(o,t)=>(typeof require<"u"?require:o)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var oe=(e,o)=>{for(var t in o)Bo(e,t,{get:o[t],enumerable:!0});};var Pe={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var Ce={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",inherit:"inherit",red500:"#c00000"};var Se={md:"10px",lg:"20px",round:"50%"};var l=e=>`var(--fr-colors-${e})`,Fe={neutral:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray700"),active:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},focus:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},hover:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")}},primary:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500"),active:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")},focus:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500")},hover:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")}},secondary:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray900"),active:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")},focus:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray900")},hover:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")}}};var Te={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var vo="px",ko=e=>typeof e=="number"?`${4*e}${vo}`:e,Eo=[-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,-.5,0,.5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"auto"],we=Object.fromEntries(Eo.map(e=>[e,ko(e)]));var Be={fontFamilies:{default:"inherit"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",demibold:"600",bold:"700",extrabold:"800",black:"900"},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"}};var me={...Pe,colors:{...Ce,...Fe},...Be,radii:Se,shadows:Te,space:we};function U(e,o="",t="."){return Object.keys(e).reduce((n,r)=>{let a=`${o.length?`${o}${t}`:""}${r}`,s=e[r];return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(n,U(s,a,t)):n[a]=s,n},{})}function ce(e){return U(e,"--fr","-")}function Re(e,o="--fr"){let t={};return Object.keys(e).forEach(n=>{let r=e[n];typeof r=="object"&&r!==null&&!Array.isArray(r)?t[n]=Re(r,`${o}-${n}`):t[n]=`var(${o}-${n})`;}),t}var ve=ce(me),c=Re(me);var Mo=new Set(["alt","size","src"]),Oo=Do.all.filter(e=>e.indexOf("-")!=0&&!Mo.has(e)).map(e=>[e.replace(/-([a-z])/g,(o,t)=>t.toUpperCase()),null]),Ho=Object.fromEntries(Oo),ue=U(c.colors),Io={color:ue,backgroundColor:ue,borderColor:ue,border:c.borders,borderRadius:c.radii,borderWidth:c.borderWidths,boxShadow:c.shadows,fontFamily:c.fontFamilies,fontSize:c.fontSizes,fontWeight:c.fontWeights,gap:c.space,lineHeight:c.lineHeights,margin:c.space,marginBottom:c.space,marginLeft:c.space,marginRight:c.space,marginTop:c.space,padding:c.space,paddingBottom:c.space,paddingLeft:c.space,paddingRight:c.space,paddingTop:c.space},ke={...Ho,...Io},Ee={bg:["backgroundColor"],m:["margin"],mt:["marginTop"],mr:["marginRight"],mb:["marginBottom"],ml:["marginLeft"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],p:["padding"],pt:["paddingTop"],pr:["paddingRight"],pb:["paddingBottom"],pl:["paddingLeft"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},De=new Set(["active","focus","focusVisible","focusWithin","hover"]);function Ao(e){return Array.isArray(e)?new Map(e.map(o=>[o,o])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):typeof e=="string"||typeof e=="number"?new Map([[e,e]]):new Map}var Me=new Map(Object.entries(ke).map(([e,o])=>[e,Ao(o)])),Vo=new Map(Object.entries(Ee).map(([e,o])=>[e,new Set(o)])),Lo=new Set(["height","width"]),Wo=new Set(["canvas","embed","iframe","img","input","object","video"]);function Oe(e){let[o,t]=e.split(":");return [o,De.has(t)?t:null]}function He(e,o="div"){let t=Object.assign({},e),n={};function r(i){if(i==null)return n;let s=`&:${i.replace(/[A-Z]/g,m=>`-${m.toLocaleLowerCase()}`)}`;return n[s]==null&&(n[s]={}),n[s]}return Object.entries(t).forEach(([i,a])=>{let[s,m]=Oe(i),f=Vo.get(s);f!=null&&(f.forEach(u=>{let S=`${u}${m?":"+m:""}`;t[S]=a;}),delete t[i]);}),Object.entries(t).forEach(([i,a])=>{let[s,m]=Oe(i),f=Me.get(s);if(f!=null){if(typeof a=="string"&&a.indexOf(" ")>-1){let u=a.split(" ");r(m)[s]=u.map(S=>f.get(S.toString())??S).join(" ");}else f.has(a.toString())?r(m)[s]=f.get(a.toString()):r(m)[s]=a;(typeof o!="string"||!Wo.has(o)||!Lo.has(s))&&delete t[i];}}),Object.keys(t).forEach(i=>{let a=i.substring(1);i.indexOf("_")===0&&Me.has(a)&&(t[a]=t[i],delete t[i]);}),{cssFromProps:n,unmatchedProps:t}}function zo(){if(typeof window>"u"){let{JSDOM:e}=Ro("jsdom");return new e("<!DOCTYPE html>").window}return window}function Ie(e){return e?{__html:$o(zo()).sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted"]})}:{__html:""}}function Ko(e){return e&&`fr-${e}`}function Le(e){return e&&(Array.isArray(e)?e.map(o=>Le(o)).join(" "):Ko(e))}function No({as:e,children:o,className:t,css:n={},part:r,...i},a){let s=e??"div",{cssFromProps:m,unmatchedProps:f}=He(i,s),u=Le(r),S=t||u?clsx(t,u):void 0,k=[{boxSizing:"border-box"},m,n];return typeof o=="string"?jsx(s,{className:S,css:k,...f,ref:a,dangerouslySetInnerHTML:Ie(o)}):jsx(s,{className:S,css:k,...f,ref:a,children:o})}var p=xe.forwardRef(No);var d={};oe(d,{Body1:()=>at,Body2:()=>lt,Caption:()=>pt,Display1:()=>ot,Display2:()=>tt,H1:()=>rt,H2:()=>nt,H3:()=>it,H4:()=>st});var fe={};oe(fe,{Body1:()=>Yo,Body2:()=>Qo,Caption:()=>Zo,Display1:()=>jo,Display2:()=>Uo,H1:()=>Go,H2:()=>Xo,H3:()=>Jo,H4:()=>qo});var D={color:"neutral.foreground",fontFamily:"default",margin:"0"},jo={...D,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},Uo={...D,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},Go={...D,fontSize:"3xl",fontWeight:"bold",lineHeight:"2xl"},Xo={...D,fontSize:"2xl",fontWeight:"bold",lineHeight:"xl"},Jo={...D,fontSize:"xl",fontWeight:"bold",lineHeight:"lg"},qo={...D,fontSize:"lg",fontWeight:"bold",lineHeight:"md"},Yo={...D,fontSize:"md",fontWeight:"regular",lineHeight:"md"},Qo={...D,fontSize:"sm",fontWeight:"regular",lineHeight:"md"},Zo={...D,fontSize:"xs",fontWeight:"regular",lineHeight:"sm"};var et=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],M=Object.fromEntries(et.map(e=>{let o=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",t=xe.forwardRef(({as:n=o,children:r,...i},a)=>jsx(p,{as:n,...fe[e],...i,ref:a,children:r}));return t.displayName=`Text.${e}`,[e,t]})),ot=M.Display1,tt=M.Display2,rt=M.H1,nt=M.H2,it=M.H3,st=M.H4,at=M.Body1,lt=M.Body2,pt=M.Caption;var ge={};oe(ge,{Link:()=>ut,Plain:()=>ft,Primary:()=>mt,Secondary:()=>ct});var te={borderWidth:"0",borderRadius:"md",display:"flex",gap:"2",padding:"2 4"},mt={...te,backgroundColor:"primary.surface",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface"},ct={...te,backgroundColor:"secondary.background",borderColor:"secondary.border",borderStyle:"solid",borderWidth:"1px",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background"},ut={...te,backgroundColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"},ft={...te,backgroundColor:"transparent",color:"neutral.foreground"};function $e({as:e,children:o,part:t,title:n,variant:r="Primary",...i}){let a=r.toLocaleLowerCase();return jsxs(p,{as:e??"button",part:[`button-${a}`,t],...ge[r],...i,children:[o,n&&jsx(d.Body2,{flexGrow:"1",fontWeight:"demibold",color:"inherit",children:n})]})}var gt=["Primary","Secondary","Link","Plain"],xt=Object.fromEntries(gt.map(e=>{let o=t=>jsx($e,{...t,variant:e,children:t.children});return o.displayName=`Text.${e}`,[e,o]})),g=Object.assign($e,xt);var x={};oe(x,{Column:()=>bt,Row:()=>ht});var ht=xe.forwardRef(({children:e,css:o,...t},n)=>jsx(p,{css:[{display:"flex",flexDirection:"row"},o],...t,ref:n,children:e})),bt=xe.forwardRef(({children:e,css:o,...t},n)=>jsx(p,{css:[{display:"flex",flexDirection:"column"},o],...t,ref:n,children:e}));var R=createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function Rt({children:e,navigate:o,theme:t,...n}){let r=t?ce(t):{},[i,a]=useState(new Set),s=useMemo(()=>new Frigade(n.apiKey,{apiKey:n.apiKey,apiUrl:n.apiUrl,userId:n.userId,groupId:n.groupId,__readOnly:n.__readOnly,__flowConfigOverrides:n.__flowConfigOverrides}),[n.userId,n.groupId,n.apiKey]),m=o??((u,S="_self")=>{window.open(u,S);});useEffect(()=>()=>{s.destroy();},[]);let f=i.size>0?i.values().next().value:null;return jsxs(R.Provider,{value:{modals:i,setModals:a,currentModal:f,navigate:m,...n,frigade:s},children:[jsx(Global,{styles:{":root":{...ve,...r}}}),jsx(ThemeProvider,{theme:c,children:e})]})}function G(e,o){let[t,n]=useState(),[,r]=useState(""),{frigade:i}=useContext(R),a=s=>{s.id===e&&(o!=null&&o.variables&&s.applyVariables(o.variables),n(s),r(Math.random().toString()));};return useEffect(()=>((async()=>{let s=await i.getFlow(e);if(!s||i.hasFailedToLoad()){n(void 0);return}o!=null&&o.variables&&s.applyVariables(o.variables),n(s);})(),i.onStateChange(a),()=>{i.removeStateChangeHandler(a);}),[]),{flow:t}}function V(e,{onComplete:o,onDismiss:t}={}){let n=useRef(null);return useEffect(()=>{e!=null&&(e.isCompleted&&n.current===!1&&(async()=>await(o==null?void 0:o(e)))(),n.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(async r=>{if(await(t==null?void 0:t(e,r))===!1)return r.preventDefault(),!1;await e.skip();},[e])}}function X(e,{onPrimary:o,onSecondary:t}={}){let{navigate:n}=useContext(R);return {handlePrimary:useCallback(async r=>{if(await(o==null?void 0:o(e,r))===!1)return r.preventDefault(),!1;await e.complete(),e.primaryButtonUri!=null&&n(e.primaryButtonUri,e.primaryButtonUriTarget);},[e]),handleSecondary:useCallback(async r=>{if(await(t==null?void 0:t(e,r))===!1)return r.preventDefault(),!1;await e.complete(),e.secondaryButtonUri!=null&&n(e.secondaryButtonUri,e.secondaryButtonUriTarget);},[e])}}function J(e){let{currentModal:o,modals:t,setModals:n}=useContext(R),[r,i]=useState(!1);useEffect(()=>{e!=null&&e.isVisible&&e&&!t.has(e.id)&&n(s=>new Set(s).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),useEffect(()=>{let s=o===(e==null?void 0:e.id);(e==null?void 0:e.id)!=null&&s!==r&&i(s);},[e==null?void 0:e.id,o]);function a(){t.has(e==null?void 0:e.id)&&n(s=>{let m=new Set(s);return m.delete(e==null?void 0:e.id),m});}return {isCurrentModal:r,removeModal:a}}function $t(e){return jsx(g.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})}function H({as:e,container:o,dismissible:t=!0,flowId:n,onComplete:r,onDismiss:i,onPrimary:a,onSecondary:s,variables:m,...f}){let u=o==="dialog"?F:e??p,S=u.Close??$t,k=function({children:le,...Y}){let{flow:P}=G(n,{variables:m}),j=P==null?void 0:P.getCurrentStep(),{handleDismiss:Q}=V(P,{onComplete:r,onDismiss:i}),{handlePrimary:pe,handleSecondary:de}=X(j,{onPrimary:a,onSecondary:s}),{isCurrentModal:_,removeModal:Z}=J(P);return useEffect(()=>{!(P!=null&&P.isVisible)&&_&&Z();},[P==null?void 0:P.isVisible,_]),P==null||!P.isVisible||!_?null:(P.start(),j.start(),jsxs(u,{position:"relative",...Y,...f,children:[t&&jsx(S,{onClick:Q}),le({flow:P,handleDismiss:Q,handlePrimary:pe,handleSecondary:de,step:j})]}))};return {FlowComponent:useMemo(()=>k,[])}}function Xe(e){let{FlowComponent:o}=H(e);return jsx(o,{as:y,gap:5,children:({handlePrimary:t,handleSecondary:n,step:r})=>jsxs(Fragment,{children:[jsx(y.Title,{children:r.title}),jsx(y.Subtitle,{children:r.subtitle}),jsx(y.Media,{src:r.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxs(x.Row,{gap:3,justifyContent:"flex-end",children:[jsx(y.Secondary,{title:r.secondaryButtonTitle,onClick:n}),jsx(y.Primary,{title:r.primaryButtonTitle??"Continue",onClick:t})]})]})})}function Je({part:e,src:o,...t}){return jsx(p,{as:"img",part:["image",e],src:o,...t})}function Nt(e){var o,t,n,r;if(e.includes("youtube"))return `https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`;if(e.includes("vimeo"))return `https://player.vimeo.com/video/${(t=e.split("vimeo.com/")[1])==null?void 0:t.split("&")[0]}`;if(e.includes("wistia"))return `https://fast.wistia.net/embed/iframe/${(n=e.split("wistia.com/medias/")[1])==null?void 0:n.split("&")[0]}`;if(e.includes("loom"))return `https://loom.com/embed/${(r=e.split("loom.com/share/")[1])==null?void 0:r.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia, Loom).")}function qe({part:e,src:o,...t}){let n=Nt(o);return jsx(p,{allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:n,...t})}function L({src:e,type:o,...t}){return jsx(o==="video"?qe:Je,{src:e,...t})}var y=xe.forwardRef(({as:e,children:o,...t},n)=>{if(t.flowId!=null)return jsx(Xe,{as:e,...t});let r=e??x.Column;return jsx(r,{backgroundColor:"neutral.background",borderRadius:"md",gap:5,p:5,...t,ref:n,children:o})});y.Media=({src:e,...o})=>e==null?null:jsx(L,{borderRadius:"md",src:e,...o});y.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Primary,{title:o,onClick:e,...t});y.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Secondary,{title:o,onClick:e,...t});y.Subtitle=({children:e,...o})=>e==null?null:jsx(d.Body2,{display:"block",part:"subtitle",mt:1,...o,children:e});y.Title=({children:e,...o})=>e==null?null:jsx(d.Body1,{display:"block",fontWeight:"bold",part:"title",...o,children:e});function F({children:e,...o}){return jsx(T.Root,{defaultOpen:!0,modal:!0,children:jsx(T.Portal,{children:jsxs(p,{inset:"0",position:"fixed",zIndex:"9999",children:[jsx(T.Overlay,{asChild:!0,children:jsx(p,{background:"rgb(0 0 0 / 0.5)",part:"dialog-overlay",position:"fixed",inset:"0"})}),jsx(T.Content,{asChild:!0,onOpenAutoFocus:t=>t.preventDefault(),onPointerDownOutside:t=>t.preventDefault(),children:jsx(y,{boxShadow:"md",left:"50%",maxWidth:"430px",p:8,part:"dialog-content",position:"fixed",textAlign:"center",top:"50%",transform:"translate(-50%, -50%)",...o,children:e})})]})})})}F.Close=e=>jsx(T.Close,{"aria-label":"Close",asChild:!0,children:jsx(g.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})});F.Subtitle=({children:e,...o})=>jsx(T.Description,{asChild:!0,children:jsx(d.Body2,{mb:5,part:"subtitle",...o,children:e})});F.Media=({src:e,...o})=>e==null?null:jsx(L,{borderRadius:"md",src:e,...o});F.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Primary,{title:o,onClick:e,...t});F.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((n,r)=>jsx("circle",{r:4,cx:4+16*r,cy:"4px",fill:e===r?c.colors.blue500:c.colors.blue800},r));return jsx(p,{as:"svg",height:"8px",margin:"5 auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};F.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Secondary,{title:o,onClick:e,...t});F.Title=({children:e,...o})=>jsx(T.Title,{asChild:!0,children:jsx(d.H3,{mb:1,part:"title",...o,children:e})});function Jt(e){let{FlowComponent:o}=H({...e,container:"dialog"});return jsx(o,{children:({flow:t,handlePrimary:n,handleSecondary:r,step:i})=>jsxs(Fragment,{children:[jsx(F.Title,{children:i.title}),jsx(F.Subtitle,{children:i.subtitle}),jsx(F.Media,{src:i.videoUri??i.imageUri,type:i.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsx(F.ProgressDots,{current:t.getNumberOfCompletedSteps(),total:t.getNumberOfAvailableSteps()}),jsxs(x.Row,{css:{"& > button":{flexGrow:1}},gap:3,children:[i.secondaryButtonTitle&&jsx(F.Secondary,{title:i.secondaryButtonTitle,onClick:r}),jsx(F.Primary,{title:i.primaryButtonTitle??"Continue",onClick:n})]})]})})}function Qt(e){let{FlowComponent:o}=H(e);return jsx(o,{as:y,border:"md",borderColor:"gray900",display:"flex",flexDirection:"row",gap:3,justifyContent:"space-between",children:({handleDismiss:t,handlePrimary:n,handleSecondary:r,step:i})=>jsxs(Fragment,{children:[jsxs(x.Row,{gap:3,children:[i.imageUri&&jsx("img",{src:i.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxs(x.Column,{children:[jsx(d.H4,{mb:1,children:i.title}),jsx(d.Body2,{children:i.subtitle})]})]}),jsxs(x.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[i.secondaryButtonTitle&&jsx(g.Secondary,{title:i.secondaryButtonTitle,onClick:r}),jsx(g.Primary,{title:i.primaryButtonTitle,onClick:n}),e.dismissible&&e.container!="dialog"&&jsx(g.Plain,{part:"banner-close",onClick:t,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})]})]})})}var tr=new Set(["required","min","max","minLength","maxLength","pattern"]);function rr({fieldComponent:e,control:o,fieldData:t}){t.pattern!=null&&(typeof t.pattern=="string"?t.pattern=new RegExp(t.pattern.replace(/^\/|\/$/g,"")):typeof t.pattern=="object"&&typeof t.pattern.value=="string"&&(t.pattern.value=new RegExp(t.pattern.value.replace(/^\/|\/$/g,""))));let n=Object.fromEntries(Object.entries(t).filter(([i])=>tr.has(i))),r=useController({name:t.id,control:o,rules:n});return jsx(e,{...r,fieldData:t})}function Ze({fieldTypes:e,step:o}){var a;let{control:t,handleSubmit:n}=useForm({delayError:2e3,mode:"onChange"}),r=[];function i(s){o.complete(s);}return (a=o.fields)==null||a.forEach(s=>{e[s.type]!=null&&r.push(jsx(rr,{control:t,fieldComponent:e[s.type],fieldData:s},s.id));}),jsxs(Fragment,{children:[r,jsx(x.Row,{justifyContent:"flex-end",children:jsx(g.Primary,{title:o.primaryButtonTitle??"Submit",onClick:n(i)})},"form-footer")]})}function eo({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsx(d.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function oo({children:e,id:o,required:t=!1}){return jsxs(d.Body2,{as:"label",htmlFor:o,fontWeight:"demibold",part:"field-label",children:[e,t&&" *"]})}var to={marginBottom:"5"},q={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function A({children:e,field:o,fieldData:t,fieldState:n}){let{id:r,label:i,placeholder:a}=t,{error:s}=n,m={id:r,...o,...a?{placeholder:a}:{},...q,"aria-invalid":!!s,value:o.value??""};return jsxs(p,{...to,part:"field",children:[jsx(oo,{id:r,required:!!t.required,children:i}),e(m),jsx(eo,{error:s})]})}var pr=()=>jsx(p,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),dr=xe.forwardRef(({label:e,value:o},t)=>jsxs(p,{as:"label",htmlFor:o,display:"flex",justifyContent:"space-between",part:"field-radio",px:4,py:2,borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"md",children:[jsx(d.Body2,{part:"field-radio-label",children:e}),jsx(N.Item,{id:o,value:o,ref:t,asChild:!0,children:jsx(p,{as:"button",backgroundColor:"neutral.background",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"24px",width:"24px",children:jsx(p,{as:N.Indicator,alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsx(pr,{})})})})]}));function so(e){let{field:{onChange:o,value:t},fieldData:{options:n=[]}}=e,r=n.map(({label:i,value:a})=>jsx(dr,{value:a,label:i},a));return jsx(A,{...e,children:()=>jsx(N.Root,{value:t,onValueChange:o,asChild:!0,children:jsx(x.Column,{gap:2,part:"field-radio-group",children:r})})})}var ur=xe.forwardRef(({label:e,value:o},t)=>jsx(b.Item,{value:o,ref:t,asChild:!0,children:jsx(p,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsx(b.ItemText,{asChild:!0,children:jsx(d.Body2,{part:"field-select-option-label",children:e})})})}));function po(e){let{field:{onChange:o,value:t},fieldData:{options:n=[],placeholder:r}}=e,i=n.map(({label:a,value:s})=>jsx(ur,{value:s,label:a},s));return jsx(A,{...e,children:()=>jsxs(b.Root,{value:t,onValueChange:o,children:[jsx(b.Trigger,{asChild:!0,children:jsxs(d.Body2,{...q,alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsx(b.Value,{placeholder:r??"Select one"}),jsx(b.Icon,{children:jsx(p,{as:ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]})}),jsx(b.Portal,{children:jsx(b.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsx(p,{...q,p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsx(b.Viewport,{children:i})})})})]})})}function co(e){return jsx(A,{...e,children:o=>jsx(d.Body2,{as:"input",part:"field-text",type:"text",...o})})}function fo(e){return jsx(A,{...e,children:o=>jsx(d.Body2,{as:"textarea",part:"field-textarea",...o})})}var fr={radio:so,select:po,text:co,textarea:fo};function gr({fieldTypes:e={},...o}){let{FlowComponent:t}=H(o),n=Object.assign({},fr,e);return jsx(t,{children:({step:r})=>jsx(Ze,{fieldTypes:n,step:r,...o})})}function ie(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[o,t]=useState(e),[n,r]=useState(null),i=useCallback(a=>{r(a);},[]);return useLayoutEffect(()=>{if(!n)return;let a=()=>{let s=n.getBoundingClientRect();t(s);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[n]),{node:n,rect:o,ref:i}}var br=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function ho({style:e={},part:o="",...t}){return jsxs(p,{part:`dot-wrapper ${o}`,style:{height:"48px",position:"absolute",width:"48px",...e},...t,children:[jsx(p,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${br}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(p,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function bo({props:e,alignAttr:o,sideAttr:t}){let n=t??"bottom",r={},i=()=>{if(["after","before"].includes(e.align)){if(o=="start")return "before";if(o=="end")return "after"}return e.align??"after"},a="-24px",s={top:"bottom",right:"left",bottom:"top",left:"right"};r[s[n]]=a;let m=i();return ["before","end"].includes(m)?["top","bottom"].includes(n)?r.right=a:r.bottom=a:["after","start"].includes(m)?["top","bottom"].includes(n)?r.left=a:r.top=a:["top","bottom"].includes(n)?r.left=`calc(50% + ${a})`:r.top=`calc(50% + ${a})`,r}var Po={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Co(e,o){let t=Object.fromEntries(Po.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),n=Object.fromEntries(Po.root.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0));if(t.align=t.align??"after",t.side=t.side??"bottom",["before","after"].includes(t.align)){let r={after:"end",before:"start"},i=(S,k)=>["top","bottom"].includes(k)?S=="after"?"marginLeft":"marginRight":S=="after"?"marginTop":"marginBottom",a=t.alignOffset??0,s=t.style??{},m=t.side??"bottom",f=t.align;t.style={...s,[i(f,m)]:a};let u=["top","bottom"].includes(m)?o.width:o.height;t.alignOffset=(u+a)*-1,t.align=r[f];}return {contentProps:t,rootProps:n}}function C({anchor:e,children:o,className:t,spotlight:n=!1,style:r,...i}){let{node:a,rect:s,ref:m}=ie(),{node:f,rect:u,ref:S}=ie(),{contentProps:k,rootProps:be}=Co(i,s),[ae,le]=useState(k.align),[Y,P]=useState(k.side),[j,Q]=useState(0),[pe,de]=useState(0);if(a!==null){let O=a.getAttribute("data-align"),ee=a.getAttribute("data-side");ae!==O&&le(O),Y!==ee&&P(ee);}let _=useRef(null);if(useEffect(()=>{let O=document.querySelector(e);O!=null&&(S(O),_.current=O);},[e]),useEffect(()=>{let{scrollX:O,scrollY:ee}=window;Q(u.left+O),de(u.top+ee);},[u.left,u.top]),f==null)return null;let Z="0";typeof window<"u"&&(Z=window.getComputedStyle(f).borderRadius);let wo=bo({props:i,alignAttr:ae,sideAttr:Y});return jsxs(E.Root,{defaultOpen:!0,...be,children:[jsx(E.Anchor,{virtualRef:_}),jsx(E.Portal,{children:jsxs("div",{className:t,css:{bottom:0,left:0,position:"absolute",right:0,top:0,zIndex:9999},children:[n&&jsx(p,{part:"tooltip-spotlight",position:"absolute",style:{borderRadius:Z,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",height:u.height,left:j,top:pe,width:u.width}}),jsx(E.Content,{asChild:!0,...k,ref:m,children:jsxs(y,{boxShadow:"md",part:"tooltip-content",position:"relative",css:{maxWidth:"360px",...r},children:[jsx(ho,{style:wo}),o]})})]})})]})}C.Close=e=>jsx(E.Close,{"aria-label":"Close",asChild:!0,children:jsx(g.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})});C.Media=({src:e,...o})=>e==null?null:jsx(L,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:e,...o});C.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Primary,{title:o,onClick:e,...t});C.Progress=({children:e,...o})=>e==null?null:jsx(d.Body2,{fontWeight:"demibold",part:"progress",...o,children:e});C.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(g.Secondary,{title:o,onClick:e,...t});C.Subtitle=({children:e,...o})=>e==null?null:jsx(d.Body2,{part:"subtitle",...o,children:e});C.Title=({children:e,...o})=>e==null?null:jsx(d.Body1,{fontWeight:"bold",mb:1,part:"title",...o,children:e});function To({dismissible:e=!0,flow:o,onDismiss:t,onPrimary:n,onSecondary:r,step:i,...a}){let{handleDismiss:s}=V(o,{onDismiss:t}),{handlePrimary:m,handleSecondary:f}=X(i,{onPrimary:n,onSecondary:r});return jsxs(C,{anchor:i.selector,onOpenAutoFocus:u=>u.preventDefault(),onPointerDownOutside:u=>u.preventDefault(),...a,children:[e&&jsx(C.Close,{onClick:s}),jsx(C.Media,{src:i.videoUri??i.imageUri,type:i.videoUri?"video":"image"}),jsx(C.Title,{children:i.title}),jsx(C.Subtitle,{children:i.subtitle}),jsxs(x.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",pt:4,children:[jsx(C.Progress,{children:`${o.getNumberOfCompletedSteps()+1}/${o.getNumberOfAvailableSteps()}`}),jsx(C.Secondary,{marginLeft:"auto",title:i.secondaryButtonTitle,onClick:f}),jsx(C.Primary,{title:i.primaryButtonTitle,onClick:m})]})]},i.id)}function Tr({flowId:e,onComplete:o,variables:t,...n}){let{flow:r}=G(e,{variables:t});V(r,{onComplete:o});let{isCurrentModal:i,removeModal:a}=J(r);if(useEffect(()=>{!(r!=null&&r.isVisible)&&i&&a();},[r==null?void 0:r.isVisible,i]),r==null||r.isVisible===!1||!i)return null;r.start();let s=r.getCurrentStep();return s==null||s.start(),jsx(To,{step:s,flow:r,...n})}function Rr(){let{frigade:e}=useContext(R);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function kr(){let{userId:e,frigade:o}=useContext(R);async function t(r){await o.identify(e,r);}async function n(r,i){await o.track(r,i);}return {userId:e,setProperties:t,track:n}}function Dr(){let{groupId:e,frigade:o}=useContext(R);async function t(r){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}await o.group(e,r);}async function n(r,i){await o.track(r,i);}return {groupId:e,setProperties:t,track:n}}
20
20
 
21
21
  export { Jt as Announcement, Qt as Banner, p as Box, g as Button, y as Card, x as Flex, gr as Form, Rt as Provider, d as Text, C as Tooltip, Tr as Tour, ie as useBoundingClientRect, G as useFlow, V as useFlowHandlers, Rr as useFrigade, Dr as useGroup, J as useModal, X as useStepHandlers, kr as useUser };
22
22
  //# sourceMappingURL=out.js.map