@frigade/react 2.0.30 → 2.0.31
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45,7 +45,7 @@ var de__namespace = /*#__PURE__*/_interopNamespace(de);
|
|
|
45
45
|
var v__namespace = /*#__PURE__*/_interopNamespace(v);
|
|
46
46
|
var ___namespace = /*#__PURE__*/_interopNamespace(_);
|
|
47
47
|
|
|
48
|
-
var no=Object.defineProperty,ht=Object.defineProperties;var Pt=Object.getOwnPropertyDescriptors;var Pe=Object.getOwnPropertySymbols;var io=Object.prototype.hasOwnProperty,so=Object.prototype.propertyIsEnumerable;var ro=(e,o,t)=>o in e?no(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,i=(e,o)=>{for(var t in o||(o={}))io.call(o,t)&&ro(e,t,o[t]);if(Pe)for(var t of Pe(o))so.call(o,t)&&ro(e,t,o[t]);return e},l=(e,o)=>ht(e,Pt(o));var Ct=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(o,t)=>(typeof require!="undefined"?require:o)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var c=(e,o)=>{var t={};for(var r in e)io.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&Pe)for(var r of Pe(e))o.indexOf(r)<0&&so.call(e,r)&&(t[r]=e[r]);return t};var z=(e,o)=>{for(var t in o)no(e,t,{get:o[t],enumerable:!0});};var D=(e,o,t)=>new Promise((r,n)=>{var s=u=>{try{p(t.next(u));}catch(d){n(d);}},a=u=>{try{p(t.throw(u));}catch(d){n(d);}},p=u=>u.done?r(u.value):Promise.resolve(u.value).then(s,a);p((t=t.apply(e,o)).next());});var ao={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var lo={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 po={md:"10px",lg:"20px",round:"50%"};var f=e=>`var(--fr-colors-${e})`,co={neutral:{background:f("white"),border:f("gray800"),foreground:f("black"),surface:f("gray700"),active:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")},focus:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")},hover:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")}},primary:{background:f("blue500"),border:f("blue500"),foreground:f("white"),surface:f("blue500"),active:{background:f("blue400"),border:f("blue400"),foreground:f("white"),surface:f("blue400")},focus:{background:f("blue500"),border:f("blue500"),foreground:f("white"),surface:f("blue500")},hover:{background:f("blue400"),border:f("blue400"),foreground:f("white"),surface:f("blue400")}},secondary:{background:f("white"),border:f("gray800"),foreground:f("black"),surface:f("gray900"),active:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray800")},focus:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray900")},hover:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray800")}}};var uo={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var St="px",Ft=e=>typeof e=="number"?`${4*e}${St}`:e,Tt=[-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"],mo=Object.fromEntries(Tt.map(e=>[e,Ft(e)]));var fo={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 Ie=l(i(l(i({},ao),{colors:i(i({},lo),co)}),fo),{radii:po,shadows:uo,space:mo});function fe(e,o="",t="."){return Object.keys(e).reduce((r,n)=>{let a=`${o.length?`${o}${t}`:""}${n}`,p=e[n];return typeof p=="object"&&p!==null&&!Array.isArray(p)?Object.assign(r,fe(p,a,t)):r[a]=p,r},{})}function He(e){return fe(e,"--fr","-")}function go(e,o="--fr"){let t={};return Object.keys(e).forEach(r=>{let n=e[r];typeof n=="object"&&n!==null&&!Array.isArray(n)?t[r]=go(n,`${o}-${r}`):t[r]=`var(${o}-${r})`;}),t}var We=He(Ie),F=go(Ie);var Rt=new Set(["alt","size","src"]),Bt=wt__default.default.all.filter(e=>e.indexOf("-")!=0&&!Rt.has(e)).map(e=>[e.replace(/-([a-z])/g,(o,t)=>t.toUpperCase()),null]),vt=Object.fromEntries(Bt),Ae=fe(F.colors),kt={color:Ae,backgroundColor:Ae,borderColor:Ae,border:F.borders,borderRadius:F.radii,borderWidth:F.borderWidths,boxShadow:F.shadows,fontFamily:F.fontFamilies,fontSize:F.fontSizes,fontWeight:F.fontWeights,gap:F.space,lineHeight:F.lineHeights,margin:F.space,marginBottom:F.space,marginLeft:F.space,marginRight:F.space,marginTop:F.space,padding:F.space,paddingBottom:F.space,paddingLeft:F.space,paddingRight:F.space,paddingTop:F.space},xo=i(i({},vt),kt),yo={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"]},bo=new Set(["active","disabled","focus","focusVisible","focusWithin","hover"]);function Dt(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 ho=new Map(Object.entries(xo).map(([e,o])=>[e,Dt(o)])),Et=new Map(Object.entries(yo).map(([e,o])=>[e,new Set(o)])),Ot=new Set(["height","width"]),Mt=new Set(["canvas","embed","iframe","img","input","object","video"]);function Po(e){let[o,t]=e.split(":");return [o,bo.has(t)?t:null]}function Co(e,o="div"){let t=Object.assign({},e),r={};function n(s){if(s==null)return r;let p=`&:${s.replace(/[A-Z]/g,u=>`-${u.toLocaleLowerCase()}`)}`;return r[p]==null&&(r[p]={}),r[p]}return Object.entries(t).forEach(([s,a])=>{let[p,u]=Po(s),d=Et.get(p);d!=null&&(d.forEach(g=>{let P=`${g}${u?":"+u:""}`;t[P]=a;}),delete t[s]);}),Object.entries(t).forEach(([s,a])=>{let[p,u]=Po(s),d=ho.get(p);if(d!=null){if(typeof a=="string"&&a.indexOf(" ")>-1){let g=a.split(" ");n(u)[p]=g.map(P=>{var C;return (C=d.get(P.toString()))!=null?C:P}).join(" ");}else d.has(a.toString())?n(u)[p]=d.get(a.toString()):n(u)[p]=a;(typeof o!="string"||!Mt.has(o)||!Ot.has(p))&&delete t[s];}}),Object.keys(t).forEach(s=>{let a=s.substring(1);s.indexOf("_")===0&&ho.has(a)&&(t[a]=t[s],delete t[s]);}),{cssFromProps:r,unmatchedProps:t}}function Ht(){if(typeof window=="undefined"){let{JSDOM:e}=Ct("jsdom");return new e("<!DOCTYPE html>").window}return window}function So(e){return e?{__html:It__default.default(Ht()).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 At(e){return e&&`fr-${e}`}function wo(e){return e&&(Array.isArray(e)?e.map(o=>wo(o)).join(" "):At(e))}function Lt(p,a){var u=p,{as:e,children:o,className:t,css:r={},part:n}=u,s=c(u,["as","children","className","css","part"]);let d=e!=null?e:"div",{cssFromProps:g,unmatchedProps:P}=Co(s,d),C=wo(n),T=t||C?clsx.clsx(t,C):void 0,h=[{boxSizing:"border-box"},g,r];return typeof o=="string"?jsxRuntime.jsx(d,l(i({className:T,css:h},P),{ref:a,dangerouslySetInnerHTML:So(o)})):jsxRuntime.jsx(d,l(i({className:T,css:h},P),{ref:a,children:o}))}var m=$e__namespace.forwardRef(Lt);var w={};z(w,{Link:()=>cr,Plain:()=>ur,Primary:()=>pr,Secondary:()=>dr});var y={};z(y,{Body1:()=>or,Body2:()=>tr,Caption:()=>rr,Display1:()=>Jt,Display2:()=>qt,H1:()=>Yt,H2:()=>Qt,H3:()=>Zt,H4:()=>er});var Le={};z(Le,{Body1:()=>Kt,Body2:()=>Ut,Caption:()=>Gt,Display1:()=>Vt,Display2:()=>$t,H1:()=>Nt,H2:()=>_t,H3:()=>zt,H4:()=>jt});var j={color:"neutral.foreground",fontFamily:"default",margin:"0"},Vt=l(i({},j),{fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"}),$t=l(i({},j),{fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"}),Nt=l(i({},j),{fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"}),_t=l(i({},j),{fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"}),zt=l(i({},j),{fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"}),jt=l(i({},j),{fontSize:"md",fontWeight:"demibold",lineHeight:"md"}),Kt=l(i({},j),{fontSize:"md",fontWeight:"regular",lineHeight:"md"}),Ut=l(i({},j),{fontSize:"sm",fontWeight:"regular",lineHeight:"sm"}),Gt=l(i({},j),{fontSize:"xs",fontWeight:"regular",lineHeight:"xs"});var Xt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],K=Object.fromEntries(Xt.map(e=>{let o=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",t=$e__namespace.forwardRef((p,a)=>{var u=p,{as:r=o,children:n}=u,s=c(u,["as","children"]);return jsxRuntime.jsx(m,l(i(i({as:r},Le[e]),s),{ref:a,children:n}))});return t.displayName=`Text.${e}`,[e,t]})),Jt=K.Display1,qt=K.Display2,Yt=K.H1,Qt=K.H2,Zt=K.H3,er=K.H4,or=K.Body1,tr=K.Body2,rr=K.Caption;var Ve={};z(Ve,{Link:()=>ar,Plain:()=>lr,Primary:()=>ir,Secondary:()=>sr});var Ce={borderWidth:"md",borderRadius:"md",borderStyle:"solid",display:"flex",gap:"2",padding:"2 4"},ir=l(i({},Ce),{backgroundColor:"primary.surface",borderColor:"primary.border",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface","backgroundColor:disabled":"primary.surface","opacity:disabled":"0.7"}),sr=l(i({},Ce),{backgroundColor:"secondary.background",borderColor:"secondary.border",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background","backgroundColor:disabled":"secondary.background","opacity:disabled":"0.7"}),ar=l(i({},Ce),{backgroundColor:"transparent",borderColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"}),lr=l(i({},Ce),{backgroundColor:"transparent",borderColor:"transparent",color:"neutral.foreground"});function Se(a){var p=a,{as:e,children:o,part:t,title:r,variant:n="Primary"}=p,s=c(p,["as","children","part","title","variant"]);let u=n.toLocaleLowerCase();return jsxRuntime.jsxs(m,l(i(i({as:e!=null?e:"button",part:[`button-${u}`,t]},Ve[n]),s),{children:[o,r&&jsxRuntime.jsx(y.Body2,{color:"inherit",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},flexGrow:"1",fontWeight:"demibold",part:"button-title",children:r})]}))}function pr(t){var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(Se,l(i({},o),{variant:"Primary",children:e}))}function dr(t){var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(Se,l(i({},o),{variant:"Secondary",children:e}))}function cr(t){var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(Se,l(i({},o),{variant:"Link",children:e}))}function ur(t){var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(Se,l(i({},o),{variant:"Plain",children:e}))}var x={};z(x,{Column:()=>gr,Row:()=>fr});var fr=$e__namespace.forwardRef((e,o)=>jsxRuntime.jsx(m,l(i({display:"flex",flexDirection:"row"},e),{ref:o}))),gr=$e__namespace.forwardRef((e,o)=>jsxRuntime.jsx(m,l(i({display:"flex",flexDirection:"column"},e),{ref:o})));var E=$e.createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function ko(n){var s=n,{children:e,navigate:o,theme:t}=s,r=c(s,["children","navigate","theme"]);let a=t?He(t):{},[p,u]=$e.useState(new Set),d=$e.useMemo(()=>new js.Frigade(r.apiKey,{apiKey:r.apiKey,apiUrl:r.apiUrl,userId:r.userId,groupId:r.groupId,__readOnly:r.__readOnly,__flowConfigOverrides:r.__flowConfigOverrides}),[r.userId,r.groupId,r.apiKey]),g=o!=null?o:(C,T="_self")=>{window.open(C,T);};$e.useEffect(()=>()=>{d.destroy();},[]);let P=p.size>0?p.values().next().value:null;return jsxRuntime.jsxs(E.Provider,{value:l(i({modals:p,setModals:u,currentModal:P,navigate:g},r),{frigade:d}),children:[jsxRuntime.jsx(react.Global,{styles:{":root":i(i({},We),a)}}),jsxRuntime.jsx(react.ThemeProvider,{theme:F,children:e})]})}function ee(e,o){let[t,r]=$e.useState(),[,n]=$e.useState(""),{frigade:s}=$e.useContext(E),a=$e.useCallback(p=>{p.id===e&&(o!=null&&o.variables&&p.applyVariables(o.variables),r(p),n(Math.random().toString()));},[o==null?void 0:o.variables]);return $e.useEffect(()=>(D(this,null,function*(){let p=yield s.getFlow(e);if(!p||s.hasFailedToLoad()){r(void 0);return}o!=null&&o.variables&&p.applyVariables(o.variables),r(p);}),s.onStateChange(a),()=>{s.removeStateChangeHandler(a);}),[a]),$e.useEffect(()=>{!(o!=null&&o.variables)||!t||a(t);},[o==null?void 0:o.variables]),{flow:t}}function oe(e,{onComplete:o,onDismiss:t}={}){let r=$e.useRef(null);return $e.useEffect(()=>{e!=null&&(e.isCompleted&&r.current===!1&&D(this,null,function*(){yield o==null?void 0:o(e);}),r.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:$e.useCallback(n=>D(this,null,function*(){if((yield t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;e.skip();}),[e])}}function te(e,{onPrimary:o,onSecondary:t}={}){let{navigate:r}=$e.useContext(E);return {handlePrimary:$e.useCallback((n,s)=>D(this,null,function*(){return (yield o==null?void 0:o(e,n))===!1?(n.preventDefault(),!1):(e.complete(s),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget),!0)}),[e]),handleSecondary:$e.useCallback((n,s)=>D(this,null,function*(){return (yield t==null?void 0:t(e,n))===!1?(n.preventDefault(),!1):(e.complete(s),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget),!0)}),[e])}}function xe(e,o=!0){let{currentModal:t,modals:r,setModals:n}=$e.useContext(E),[s,a]=$e.useState(!1);$e.useEffect(()=>{o&&(e!=null&&e.isVisible)&&e&&!r.has(e.id)&&n(u=>new Set(u).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),$e.useEffect(()=>{let u=t===(e==null?void 0:e.id);o&&(e==null?void 0:e.id)!=null&&u!==s&&a(u);},[e==null?void 0:e.id,t]);function p(){o&&r.has(e==null?void 0:e.id)&&n(u=>{let d=new Set(u);return d.delete(e==null?void 0:e.id),d});}return {isCurrentModal:s||!o,removeModal:p}}function N(C){var T=C,{as:e,children:o,container:t,dismissible:r=!1,flowId:n,onComplete:s,onDismiss:a,onPrimary:p,onSecondary:u,variables:d,forceMount:g}=T,P=c(T,["as","children","container","dismissible","flowId","onComplete","onDismiss","onPrimary","onSecondary","variables","forceMount"]);let{flow:h}=ee(n,{variables:d}),S=h==null?void 0:h.getCurrentStep(),{handleDismiss:O}=oe(h,{onComplete:s,onDismiss:a}),{handlePrimary:$,handleSecondary:G}=te(S,{onPrimary:p,onSecondary:u}),Y=e&&typeof e=="function"&&(e.displayName==="Dialog"||e.displayName==="Modal"),{isCurrentModal:ce,removeModal:Ee}=xe(h,Y);if($e.useEffect(()=>{!(h!=null&&h.isVisible)&&ce&&Ee();},[h==null?void 0:h.isVisible,ce]),h==null||!ce)return null;let Oe=g&&h.isCompleted;if(!h.isVisible&&!Oe)return null;!h.isCompleted&&!h.isSkipped&&S.start();let Me=e!=null?e:m;return jsxRuntime.jsx(Me,l(i({position:"relative"},P),{children:o({flow:h,handleDismiss:O,handlePrimary:$,handleSecondary:G,parentProps:i({container:t,dismissible:r,flowId:n,variables:d},P),step:S})}))}function Io(e){return jsxRuntime.jsx(N,l(i({as:b,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:"card"},e),{children:({handleDismiss:o,handlePrimary:t,handleSecondary:r,parentProps:{dismissible:n},step:s})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(x.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"card-header",children:[jsxRuntime.jsx(b.Title,{children:s.title}),n&&jsxRuntime.jsx(b.Dismiss,{onClick:o}),jsxRuntime.jsx(b.Subtitle,{flexBasis:"100%",children:s.subtitle})]}),jsxRuntime.jsx(b.Media,{src:s.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxRuntime.jsxs(x.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsxRuntime.jsx(b.Secondary,{title:s.secondaryButtonTitle,onClick:r}),jsxRuntime.jsx(b.Primary,{title:s.primaryButtonTitle,onClick:t})]})]})}))}function _e(r){var n=r,{part:e,src:o}=n,t=c(n,["part","src"]);return jsxRuntime.jsx(m,i({as:"img",part:["image",e],src:o},t))}function Wr(e){var o,t,r,n;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(t=e.split("vimeo.com/")[1])==null?void 0:t.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(r=e.split("wistia.com/medias/")[1])==null?void 0:r.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(n=e.split("loom.com/share/")[1])==null?void 0:n.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function ze(r){var n=r,{part:e,src:o}=n,t=c(n,["part","src"]);let s=Wr(o);return s?jsxRuntime.jsx(m,i({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:s},t)):o!=null&&o.endsWith(".mp4")?jsxRuntime.jsx(m,i({as:"video",controls:!0,part:["video",e],src:o},t)):(console.error(`Could not map videoUri ${o} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function ne(r){var n=r,{src:e,type:o}=n,t=c(n,["src","type"]);return jsxRuntime.jsx(o==="video"?ze:_e,i({src:e},t))}var b=$e__namespace.forwardRef((n,r)=>{var s=n,{children:e,flowId:o}=s,t=c(s,["children","flowId"]);var p;if(o!=null)return jsxRuntime.jsx(Io,i({flowId:o},t));let a=(p=t.as)!=null?p:x.Column;return jsxRuntime.jsx(a,l(i({backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5},t),{ref:r,children:e}))});b.Dismiss=e=>jsxRuntime.jsx(w.Plain,l(i({part:"dismiss",padding:0},e),{children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})}));b.Media=t=>{var r=t,{src:e}=r,o=c(r,["src"]);return e==null?null:jsxRuntime.jsx(ne,i({borderRadius:"md",src:e},o))};b.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=c(n,["onClick","title"]);return o==null?null:jsxRuntime.jsx(w.Primary,i({title:o,onClick:e},t))};b.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=c(n,["onClick","title"]);return o==null?null:jsxRuntime.jsx(w.Secondary,i({title:o,onClick:e},t))};b.Subtitle=t=>{var r=t,{children:e}=r,o=c(r,["children"]);return e==null?null:jsxRuntime.jsx(y.Body2,l(i({display:"block",part:"subtitle"},o),{children:e}))};b.Title=t=>{var r=t,{children:e}=r,o=c(r,["children"]);return e==null?null:jsxRuntime.jsx(y.Body1,l(i({display:"block",fontWeight:"bold",part:"title"},o),{children:e}))};var Fe={content:["onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","onInteractOutside"],root:["defaultOpen","modal","onOpenChange","open"]};function Ao(e){let o=Object.fromEntries(Fe.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),t=Object.fromEntries(Fe.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r={};for(let n of Object.keys(e))!Fe.content.includes(n)&&!Fe.root.includes(n)&&(r[n]=e[n]);return {contentProps:o,otherProps:r,rootProps:t}}function R(n){var s=n,{children:e,className:o,modal:t=!0}=s,r=c(s,["children","className","modal"]);let{rootProps:a,contentProps:p,otherProps:u}=Ao(r);return jsxRuntime.jsx(M__namespace.Root,l(i({defaultOpen:!0,modal:t},a),{children:jsxRuntime.jsx(M__namespace.Portal,{children:jsxRuntime.jsxs(m,{className:o,display:"grid",inset:"0",padding:"6",pointerEvents:"none",position:"fixed",children:[jsxRuntime.jsx(M__namespace.Overlay,{asChild:!0,children:jsxRuntime.jsx(m,{background:"rgb(0 0 0 / 0.5)",inset:"0",part:"dialog-overlay",position:"absolute"})}),jsxRuntime.jsx(M__namespace.Content,l(i({asChild:!0,onOpenAutoFocus:d=>d.preventDefault(),onPointerDownOutside:d=>d.preventDefault()},p),{children:jsxRuntime.jsx(b,l(i({alignSelf:"center",boxShadow:"md",justifySelf:"center",maxWidth:"430px",p:8,part:"dialog",pointerEvents:"auto",position:"relative"},u),{children:e}))}))]})})}))}R.Dismiss=e=>jsxRuntime.jsx(M__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(w.Plain,l(i({part:"close",position:"absolute",right:"-4px",top:"4px"},e),{children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})}))});R.Subtitle=t=>{var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(M__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(y.Body2,l(i({part:"subtitle"},o),{children:e}))})};R.Media=t=>{var r=t,{src:e}=r,o=c(r,["src"]);return e==null?null:jsxRuntime.jsx(ne,i({borderRadius:"md",src:e},o))};R.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=c(n,["onClick","title"]);return o==null?null:jsxRuntime.jsx(w.Primary,i({title:o,onClick:e},t))};R.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((r,n)=>jsxRuntime.jsx(m,{as:"circle",r:4,cx:4+16*n,cy:"4px",fill:e===n?F.colors.blue500:F.colors.blue800,part:e===n?"progress-dot-selected":"progress-dot"},n));return jsxRuntime.jsx(m,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};R.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=c(n,["onClick","title"]);return o==null?null:jsxRuntime.jsx(w.Secondary,i({title:o,onClick:e},t))};R.Title=t=>{var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(M__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(y.H3,l(i({part:"title"},o),{children:e}))})};R.displayName="Dialog";function Nr(t){var r=t,{flowId:e}=r,o=c(r,["flowId"]);return jsxRuntime.jsx(N,l(i({as:R,dismissible:!0,flowId:e,part:"announcement",textAlign:"center"},o),{children:({flow:n,handleDismiss:s,handlePrimary:a,handleSecondary:p,parentProps:{dismissible:u},step:d})=>{var P,C,T;let g=(P=d.props)!=null?P:{};return jsxRuntime.jsxs(x.Column,l(i({gap:5,part:"announcement-step"},g),{children:[u&&jsxRuntime.jsx(R.Dismiss,{onClick:s}),jsxRuntime.jsxs(x.Column,{gap:1,part:"announcement-header",children:[jsxRuntime.jsx(R.Title,{children:d.title}),jsxRuntime.jsx(R.Subtitle,{children:d.subtitle})]}),jsxRuntime.jsx(R.Media,{src:(C=d.videoUri)!=null?C:d.imageUri,type:d.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(R.ProgressDots,{current:n.getNumberOfCompletedSteps(),total:n.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(x.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[d.secondaryButtonTitle&&jsxRuntime.jsx(R.Secondary,{onClick:p,title:d.secondaryButtonTitle}),d.primaryButtonTitle&&jsxRuntime.jsx(R.Primary,{onClick:a,title:(T=d.primaryButtonTitle)!=null?T:"Continue"})]})]}))}}))}function _r(t){var r=t,{flowId:e}=r,o=c(r,["flowId"]);return jsxRuntime.jsx(N,l(i({as:b,borderWidth:"md",flowId:e,part:"banner"},o),{children:({handleDismiss:n,handlePrimary:s,handleSecondary:a,step:p})=>{var d;let u=(d=p.props)!=null?d:{};return jsxRuntime.jsxs(m,l(i({display:"flex",flexDirection:"row",gap:3,justifyContent:"space-between",part:"banner-step"},u),{children:[jsxRuntime.jsxs(x.Row,{gap:3,children:[p.imageUri&&jsxRuntime.jsx(m,{as:"img",part:"image",src:p.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(x.Column,{children:[jsxRuntime.jsx(y.H4,{part:"title",children:p.title}),jsxRuntime.jsx(y.Body2,{part:"subtitle",children:p.subtitle})]})]}),jsxRuntime.jsxs(x.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[p.secondaryButtonTitle&&jsxRuntime.jsx(w.Secondary,{title:p.secondaryButtonTitle,onClick:a}),jsxRuntime.jsx(w.Primary,{title:p.primaryButtonTitle,onClick:s}),o.dismissible&&jsxRuntime.jsx(b.Dismiss,{onClick:n})]})]}))}}))}var Je={};z(Je,{Collapsible:()=>Uo,CollapsibleStep:()=>ye});var ye={};z(ye,{Content:()=>Ue,Root:()=>Ge,Trigger:()=>Xe});var jr=react.keyframes`
|
|
48
|
+
var no=Object.defineProperty,ht=Object.defineProperties;var Pt=Object.getOwnPropertyDescriptors;var Pe=Object.getOwnPropertySymbols;var io=Object.prototype.hasOwnProperty,so=Object.prototype.propertyIsEnumerable;var ro=(e,o,t)=>o in e?no(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,i=(e,o)=>{for(var t in o||(o={}))io.call(o,t)&&ro(e,t,o[t]);if(Pe)for(var t of Pe(o))so.call(o,t)&&ro(e,t,o[t]);return e},l=(e,o)=>ht(e,Pt(o));var Ct=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(o,t)=>(typeof require!="undefined"?require:o)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var c=(e,o)=>{var t={};for(var r in e)io.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&Pe)for(var r of Pe(e))o.indexOf(r)<0&&so.call(e,r)&&(t[r]=e[r]);return t};var z=(e,o)=>{for(var t in o)no(e,t,{get:o[t],enumerable:!0});};var D=(e,o,t)=>new Promise((r,n)=>{var s=u=>{try{p(t.next(u));}catch(d){n(d);}},a=u=>{try{p(t.throw(u));}catch(d){n(d);}},p=u=>u.done?r(u.value):Promise.resolve(u.value).then(s,a);p((t=t.apply(e,o)).next());});var ao={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var lo={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 po={md:"10px",lg:"20px",round:"50%"};var f=e=>`var(--fr-colors-${e})`,co={neutral:{background:f("white"),border:f("gray800"),foreground:f("black"),surface:f("gray700"),active:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")},focus:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")},hover:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")}},primary:{background:f("blue500"),border:f("blue500"),foreground:f("white"),surface:f("blue500"),active:{background:f("blue400"),border:f("blue400"),foreground:f("white"),surface:f("blue400")},focus:{background:f("blue500"),border:f("blue500"),foreground:f("white"),surface:f("blue500")},hover:{background:f("blue400"),border:f("blue400"),foreground:f("white"),surface:f("blue400")}},secondary:{background:f("white"),border:f("gray800"),foreground:f("black"),surface:f("gray900"),active:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray800")},focus:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray900")},hover:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray800")}}};var uo={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var St="px",Ft=e=>typeof e=="number"?`${4*e}${St}`:e,Tt=[-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"],mo=Object.fromEntries(Tt.map(e=>[e,Ft(e)]));var fo={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 Ie=l(i(l(i({},ao),{colors:i(i({},lo),co)}),fo),{radii:po,shadows:uo,space:mo});function fe(e,o="",t="."){return Object.keys(e).reduce((r,n)=>{let a=`${o.length?`${o}${t}`:""}${n}`,p=e[n];return typeof p=="object"&&p!==null&&!Array.isArray(p)?Object.assign(r,fe(p,a,t)):r[a]=p,r},{})}function He(e){return fe(e,"--fr","-")}function go(e,o="--fr"){let t={};return Object.keys(e).forEach(r=>{let n=e[r];typeof n=="object"&&n!==null&&!Array.isArray(n)?t[r]=go(n,`${o}-${r}`):t[r]=`var(${o}-${r})`;}),t}var We=He(Ie),F=go(Ie);var Rt=new Set(["alt","size","src"]),Bt=wt__default.default.all.filter(e=>e.indexOf("-")!=0&&!Rt.has(e)).map(e=>[e.replace(/-([a-z])/g,(o,t)=>t.toUpperCase()),null]),vt=Object.fromEntries(Bt),Ae=fe(F.colors),kt={color:Ae,backgroundColor:Ae,borderColor:Ae,border:F.borders,borderRadius:F.radii,borderWidth:F.borderWidths,boxShadow:F.shadows,fontFamily:F.fontFamilies,fontSize:F.fontSizes,fontWeight:F.fontWeights,gap:F.space,lineHeight:F.lineHeights,margin:F.space,marginBottom:F.space,marginLeft:F.space,marginRight:F.space,marginTop:F.space,padding:F.space,paddingBottom:F.space,paddingLeft:F.space,paddingRight:F.space,paddingTop:F.space},xo=i(i({},vt),kt),yo={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"]},bo=new Set(["active","disabled","focus","focusVisible","focusWithin","hover"]);function Dt(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 ho=new Map(Object.entries(xo).map(([e,o])=>[e,Dt(o)])),Et=new Map(Object.entries(yo).map(([e,o])=>[e,new Set(o)])),Ot=new Set(["height","width"]),Mt=new Set(["canvas","embed","iframe","img","input","object","video"]);function Po(e){let[o,t]=e.split(":");return [o,bo.has(t)?t:null]}function Co(e,o="div"){let t=Object.assign({},e),r={};function n(s){if(s==null)return r;let p=`&:${s.replace(/[A-Z]/g,u=>`-${u.toLocaleLowerCase()}`)}`;return r[p]==null&&(r[p]={}),r[p]}return Object.entries(t).forEach(([s,a])=>{let[p,u]=Po(s),d=Et.get(p);d!=null&&(d.forEach(g=>{let P=`${g}${u?":"+u:""}`;t[P]=a;}),delete t[s]);}),Object.entries(t).forEach(([s,a])=>{let[p,u]=Po(s),d=ho.get(p);if(d!=null){if(typeof a=="string"&&a.indexOf(" ")>-1){let g=a.split(" ");n(u)[p]=g.map(P=>{var C;return (C=d.get(P.toString()))!=null?C:P}).join(" ");}else d.has(a.toString())?n(u)[p]=d.get(a.toString()):n(u)[p]=a;(typeof o!="string"||!Mt.has(o)||!Ot.has(p))&&delete t[s];}}),Object.keys(t).forEach(s=>{let a=s.substring(1);s.indexOf("_")===0&&ho.has(a)&&(t[a]=t[s],delete t[s]);}),{cssFromProps:r,unmatchedProps:t}}function Ht(){if(typeof window=="undefined"){let{JSDOM:e}=Ct("jsdom");return new e("<!DOCTYPE html>").window}return window}function So(e){return e?{__html:It__default.default(Ht()).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 At(e){return e&&`fr-${e}`}function wo(e){return e&&(Array.isArray(e)?e.map(o=>wo(o)).join(" "):At(e))}function Lt(p,a){var u=p,{as:e,children:o,className:t,css:r={},part:n}=u,s=c(u,["as","children","className","css","part"]);let d=e!=null?e:"div",{cssFromProps:g,unmatchedProps:P}=Co(s,d),C=wo(n),T=t||C?clsx.clsx(t,C):void 0,h=[{boxSizing:"border-box"},g,r];return typeof o=="string"?jsxRuntime.jsx(d,l(i({className:T,css:h},P),{ref:a,dangerouslySetInnerHTML:So(o)})):jsxRuntime.jsx(d,l(i({className:T,css:h},P),{ref:a,children:o}))}var m=$e__namespace.forwardRef(Lt);var w={};z(w,{Link:()=>cr,Plain:()=>ur,Primary:()=>pr,Secondary:()=>dr});var y={};z(y,{Body1:()=>or,Body2:()=>tr,Caption:()=>rr,Display1:()=>Jt,Display2:()=>qt,H1:()=>Yt,H2:()=>Qt,H3:()=>Zt,H4:()=>er});var Le={};z(Le,{Body1:()=>Kt,Body2:()=>Ut,Caption:()=>Gt,Display1:()=>Vt,Display2:()=>$t,H1:()=>Nt,H2:()=>_t,H3:()=>zt,H4:()=>jt});var j={color:"neutral.foreground",fontFamily:"default",margin:"0"},Vt=l(i({},j),{fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"}),$t=l(i({},j),{fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"}),Nt=l(i({},j),{fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"}),_t=l(i({},j),{fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"}),zt=l(i({},j),{fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"}),jt=l(i({},j),{fontSize:"md",fontWeight:"demibold",lineHeight:"md"}),Kt=l(i({},j),{fontSize:"md",fontWeight:"regular",lineHeight:"md"}),Ut=l(i({},j),{fontSize:"sm",fontWeight:"regular",lineHeight:"sm"}),Gt=l(i({},j),{fontSize:"xs",fontWeight:"regular",lineHeight:"xs"});var Xt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],K=Object.fromEntries(Xt.map(e=>{let o=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",t=$e__namespace.forwardRef((p,a)=>{var u=p,{as:r=o,children:n}=u,s=c(u,["as","children"]);return jsxRuntime.jsx(m,l(i(i({as:r},Le[e]),s),{ref:a,children:n}))});return t.displayName=`Text.${e}`,[e,t]})),Jt=K.Display1,qt=K.Display2,Yt=K.H1,Qt=K.H2,Zt=K.H3,er=K.H4,or=K.Body1,tr=K.Body2,rr=K.Caption;var Ve={};z(Ve,{Link:()=>ar,Plain:()=>lr,Primary:()=>ir,Secondary:()=>sr});var Ce={borderWidth:"md",borderRadius:"md",borderStyle:"solid",display:"flex",gap:"2",padding:"2 4"},ir=l(i({},Ce),{backgroundColor:"primary.surface",borderColor:"primary.border",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface","backgroundColor:disabled":"primary.surface","opacity:disabled":"0.7"}),sr=l(i({},Ce),{backgroundColor:"secondary.background",borderColor:"secondary.border",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background","backgroundColor:disabled":"secondary.background","opacity:disabled":"0.7"}),ar=l(i({},Ce),{backgroundColor:"transparent",borderColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"}),lr=l(i({},Ce),{backgroundColor:"transparent",borderColor:"transparent",color:"neutral.foreground"});function Se(a){var p=a,{as:e,children:o,part:t,title:r,variant:n="Primary"}=p,s=c(p,["as","children","part","title","variant"]);let u=n.toLocaleLowerCase();return jsxRuntime.jsxs(m,l(i(i({as:e!=null?e:"button",part:[`button-${u}`,t]},Ve[n]),s),{children:[o,r&&jsxRuntime.jsx(y.Body2,{color:"inherit",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},flexGrow:"1",fontWeight:"demibold",part:"button-title",children:r})]}))}function pr(t){var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(Se,l(i({},o),{variant:"Primary",children:e}))}function dr(t){var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(Se,l(i({},o),{variant:"Secondary",children:e}))}function cr(t){var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(Se,l(i({},o),{variant:"Link",children:e}))}function ur(t){var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(Se,l(i({},o),{variant:"Plain",children:e}))}var x={};z(x,{Column:()=>gr,Row:()=>fr});var fr=$e__namespace.forwardRef((e,o)=>jsxRuntime.jsx(m,l(i({display:"flex",flexDirection:"row"},e),{ref:o}))),gr=$e__namespace.forwardRef((e,o)=>jsxRuntime.jsx(m,l(i({display:"flex",flexDirection:"column"},e),{ref:o})));var E=$e.createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function ko(n){var s=n,{children:e,navigate:o,theme:t}=s,r=c(s,["children","navigate","theme"]);let a=t?He(t):{},[p,u]=$e.useState(new Set),d=$e.useMemo(()=>new js.Frigade(r.apiKey,{apiKey:r.apiKey,apiUrl:r.apiUrl,userId:r.userId,groupId:r.groupId,__readOnly:r.__readOnly,__flowConfigOverrides:r.__flowConfigOverrides}),[r.userId,r.groupId,r.apiKey]),g=o!=null?o:(C,T="_self")=>{window.open(C,T);};$e.useEffect(()=>()=>{d.destroy();},[]);let P=p.size>0?p.values().next().value:null;return jsxRuntime.jsxs(E.Provider,{value:l(i({modals:p,setModals:u,currentModal:P,navigate:g},r),{frigade:d}),children:[jsxRuntime.jsx(react.Global,{styles:{":root":i(i({},We),a)}}),jsxRuntime.jsx(react.ThemeProvider,{theme:F,children:e})]})}function ee(e,o){let[t,r]=$e.useState(),[,n]=$e.useState(""),{frigade:s}=$e.useContext(E),a=$e.useCallback(p=>{p.id===e&&(o!=null&&o.variables&&p.applyVariables(o.variables),r(p),n(Math.random().toString()));},[o==null?void 0:o.variables]);return $e.useEffect(()=>(D(this,null,function*(){let p=yield s.getFlow(e);if(!p||s.hasFailedToLoad()){r(void 0);return}o!=null&&o.variables&&p.applyVariables(o.variables),r(p);}),s.onStateChange(a),()=>{s.removeStateChangeHandler(a);}),[a]),$e.useEffect(()=>{!(o!=null&&o.variables)||!t||a(t);},[o==null?void 0:o.variables]),{flow:t}}function oe(e,{onComplete:o,onDismiss:t}={}){let r=$e.useRef(null);return $e.useEffect(()=>{e!=null&&(e.isCompleted&&r.current===!1&&D(this,null,function*(){yield o==null?void 0:o(e);}),r.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:$e.useCallback(n=>D(this,null,function*(){if((yield t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;e.skip();}),[e])}}function te(e,{onPrimary:o,onSecondary:t}={}){let{navigate:r}=$e.useContext(E);return {handlePrimary:$e.useCallback((n,s)=>D(this,null,function*(){return (yield o==null?void 0:o(e,n))===!1?(n.preventDefault(),!1):(e.complete(s),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget),!0)}),[e]),handleSecondary:$e.useCallback((n,s)=>D(this,null,function*(){return (yield t==null?void 0:t(e,n))===!1?(n.preventDefault(),!1):(e.complete(s),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget),!0)}),[e])}}function xe(e,o=!0){let{currentModal:t,modals:r,setModals:n}=$e.useContext(E),[s,a]=$e.useState(!1);$e.useEffect(()=>{o&&(e!=null&&e.isVisible)&&e&&!r.has(e.id)&&n(u=>new Set(u).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),$e.useEffect(()=>{let u=t===(e==null?void 0:e.id);o&&(e==null?void 0:e.id)!=null&&u!==s&&a(u);},[e==null?void 0:e.id,t]);function p(){o&&r.has(e==null?void 0:e.id)&&n(u=>{let d=new Set(u);return d.delete(e==null?void 0:e.id),d});}return {isCurrentModal:s||!o,removeModal:p}}function N(C){var T=C,{as:e,children:o,container:t,dismissible:r=!1,flowId:n,onComplete:s,onDismiss:a,onPrimary:p,onSecondary:u,variables:d,forceMount:g}=T,P=c(T,["as","children","container","dismissible","flowId","onComplete","onDismiss","onPrimary","onSecondary","variables","forceMount"]);let{flow:h}=ee(n,{variables:d}),S=h==null?void 0:h.getCurrentStep(),{handleDismiss:O}=oe(h,{onComplete:s,onDismiss:a}),{handlePrimary:$,handleSecondary:G}=te(S,{onPrimary:p,onSecondary:u}),Y=e&&typeof e=="function"&&(e.displayName==="Dialog"||e.displayName==="Modal"),{isCurrentModal:ce,removeModal:Ee}=xe(h,Y);if($e.useEffect(()=>{!(h!=null&&h.isVisible)&&ce&&Ee();},[h==null?void 0:h.isVisible,ce]),h==null||!ce)return null;let Oe=g&&h.isCompleted;if(!h.isVisible&&!Oe)return null;!h.isCompleted&&!h.isSkipped&&S.start();let Me=e!=null?e:m;return jsxRuntime.jsx(Me,l(i({position:"relative"},P),{children:o({flow:h,handleDismiss:O,handlePrimary:$,handleSecondary:G,parentProps:i({container:t,dismissible:r,flowId:n,variables:d},P),step:S})}))}function Io(e){return jsxRuntime.jsx(N,l(i({as:b,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:"card"},e),{children:({handleDismiss:o,handlePrimary:t,handleSecondary:r,parentProps:{dismissible:n},step:s})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(x.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"card-header",children:[jsxRuntime.jsx(b.Title,{children:s.title}),n&&jsxRuntime.jsx(b.Dismiss,{onClick:o}),jsxRuntime.jsx(b.Subtitle,{flexBasis:"100%",children:s.subtitle})]}),jsxRuntime.jsx(b.Media,{src:s.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxRuntime.jsxs(x.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsxRuntime.jsx(b.Secondary,{title:s.secondaryButtonTitle,onClick:r}),jsxRuntime.jsx(b.Primary,{title:s.primaryButtonTitle,onClick:t})]})]})}))}function _e(r){var n=r,{part:e,src:o}=n,t=c(n,["part","src"]);return jsxRuntime.jsx(m,i({as:"img",part:["image",e],src:o},t))}function Wr(e){var o,t,r,n;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(t=e.split("vimeo.com/")[1])==null?void 0:t.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(r=e.split("wistia.com/medias/")[1])==null?void 0:r.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(n=e.split("loom.com/share/")[1])==null?void 0:n.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function ze(r){var n=r,{part:e,src:o}=n,t=c(n,["part","src"]);let s=Wr(o);return s?jsxRuntime.jsx(m,i({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:s},t)):o!=null&&o.endsWith(".mp4")?jsxRuntime.jsx(m,i({as:"video",controls:!0,part:["video",e],src:o},t)):(console.error(`Could not map videoUri ${o} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function ne(r){var n=r,{src:e,type:o}=n,t=c(n,["src","type"]);return jsxRuntime.jsx(o==="video"?ze:_e,i({src:e},t))}var b=$e__namespace.forwardRef((n,r)=>{var s=n,{children:e,flowId:o}=s,t=c(s,["children","flowId"]);var p;if(o!=null)return jsxRuntime.jsx(Io,i({flowId:o},t));let a=(p=t.as)!=null?p:x.Column;return jsxRuntime.jsx(a,l(i({backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5},t),{ref:r,children:e}))});b.Dismiss=e=>jsxRuntime.jsx(w.Plain,l(i({part:"dismiss",padding:0},e),{children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})}));b.Media=t=>{var r=t,{src:e}=r,o=c(r,["src"]);return e==null?null:jsxRuntime.jsx(ne,i({borderRadius:"md",src:e},o))};b.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=c(n,["onClick","title"]);return o==null?null:jsxRuntime.jsx(w.Primary,i({title:o,onClick:e},t))};b.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=c(n,["onClick","title"]);return o==null?null:jsxRuntime.jsx(w.Secondary,i({title:o,onClick:e},t))};b.Subtitle=t=>{var r=t,{children:e}=r,o=c(r,["children"]);return e==null?null:jsxRuntime.jsx(y.Body2,l(i({display:"block",part:"subtitle"},o),{children:e}))};b.Title=t=>{var r=t,{children:e}=r,o=c(r,["children"]);return e==null?null:jsxRuntime.jsx(y.Body1,l(i({display:"block",fontWeight:"bold",part:"title"},o),{children:e}))};var Fe={content:["onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","onInteractOutside"],root:["defaultOpen","modal","onOpenChange","open"]};function Ao(e){let o=Object.fromEntries(Fe.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),t=Object.fromEntries(Fe.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r={};for(let n of Object.keys(e))!Fe.content.includes(n)&&!Fe.root.includes(n)&&(r[n]=e[n]);return {contentProps:o,otherProps:r,rootProps:t}}function R(n){var s=n,{children:e,className:o,modal:t=!0}=s,r=c(s,["children","className","modal"]);let{rootProps:a,contentProps:p,otherProps:u}=Ao(r);return jsxRuntime.jsx(M__namespace.Root,l(i({defaultOpen:!0,modal:t},a),{children:jsxRuntime.jsx(M__namespace.Portal,{children:jsxRuntime.jsxs(m,{className:o,display:"grid",inset:"0",padding:"6",pointerEvents:"none",position:"fixed",children:[jsxRuntime.jsx(M__namespace.Overlay,{asChild:!0,children:jsxRuntime.jsx(m,{background:"rgb(0 0 0 / 0.5)",inset:"0",part:"dialog-overlay",position:"absolute"})}),jsxRuntime.jsx(M__namespace.Content,l(i({asChild:!0,onOpenAutoFocus:d=>d.preventDefault(),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault()},p),{children:jsxRuntime.jsx(b,l(i({alignSelf:"center",boxShadow:"md",justifySelf:"center",maxWidth:"430px",p:8,part:"dialog",pointerEvents:"auto",position:"relative"},u),{children:e}))}))]})})}))}R.Dismiss=e=>jsxRuntime.jsx(M__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(w.Plain,l(i({part:"close",position:"absolute",right:"-4px",top:"4px"},e),{children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})}))});R.Subtitle=t=>{var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(M__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(y.Body2,l(i({part:"subtitle"},o),{children:e}))})};R.Media=t=>{var r=t,{src:e}=r,o=c(r,["src"]);return e==null?null:jsxRuntime.jsx(ne,i({borderRadius:"md",src:e},o))};R.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=c(n,["onClick","title"]);return o==null?null:jsxRuntime.jsx(w.Primary,i({title:o,onClick:e},t))};R.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((r,n)=>jsxRuntime.jsx(m,{as:"circle",r:4,cx:4+16*n,cy:"4px",fill:e===n?F.colors.blue500:F.colors.blue800,part:e===n?"progress-dot-selected":"progress-dot"},n));return jsxRuntime.jsx(m,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};R.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=c(n,["onClick","title"]);return o==null?null:jsxRuntime.jsx(w.Secondary,i({title:o,onClick:e},t))};R.Title=t=>{var r=t,{children:e}=r,o=c(r,["children"]);return jsxRuntime.jsx(M__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(y.H3,l(i({part:"title"},o),{children:e}))})};R.displayName="Dialog";function Nr(t){var r=t,{flowId:e}=r,o=c(r,["flowId"]);return jsxRuntime.jsx(N,l(i({as:R,dismissible:!0,flowId:e,part:"announcement",textAlign:"center"},o),{children:({flow:n,handleDismiss:s,handlePrimary:a,handleSecondary:p,parentProps:{dismissible:u},step:d})=>{var P,C,T;let g=(P=d.props)!=null?P:{};return jsxRuntime.jsxs(x.Column,l(i({gap:5,part:"announcement-step"},g),{children:[u&&jsxRuntime.jsx(R.Dismiss,{onClick:s}),jsxRuntime.jsxs(x.Column,{gap:1,part:"announcement-header",children:[jsxRuntime.jsx(R.Title,{children:d.title}),jsxRuntime.jsx(R.Subtitle,{children:d.subtitle})]}),jsxRuntime.jsx(R.Media,{src:(C=d.videoUri)!=null?C:d.imageUri,type:d.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(R.ProgressDots,{current:n.getNumberOfCompletedSteps(),total:n.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(x.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[d.secondaryButtonTitle&&jsxRuntime.jsx(R.Secondary,{onClick:p,title:d.secondaryButtonTitle}),d.primaryButtonTitle&&jsxRuntime.jsx(R.Primary,{onClick:a,title:(T=d.primaryButtonTitle)!=null?T:"Continue"})]})]}))}}))}function _r(t){var r=t,{flowId:e}=r,o=c(r,["flowId"]);return jsxRuntime.jsx(N,l(i({as:b,borderWidth:"md",flowId:e,part:"banner"},o),{children:({handleDismiss:n,handlePrimary:s,handleSecondary:a,step:p})=>{var d;let u=(d=p.props)!=null?d:{};return jsxRuntime.jsxs(m,l(i({display:"flex",flexDirection:"row",gap:3,justifyContent:"space-between",part:"banner-step"},u),{children:[jsxRuntime.jsxs(x.Row,{gap:3,children:[p.imageUri&&jsxRuntime.jsx(m,{as:"img",part:"image",src:p.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(x.Column,{children:[jsxRuntime.jsx(y.H4,{part:"title",children:p.title}),jsxRuntime.jsx(y.Body2,{part:"subtitle",children:p.subtitle})]})]}),jsxRuntime.jsxs(x.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[p.secondaryButtonTitle&&jsxRuntime.jsx(w.Secondary,{title:p.secondaryButtonTitle,onClick:a}),jsxRuntime.jsx(w.Primary,{title:p.primaryButtonTitle,onClick:s}),o.dismissible&&jsxRuntime.jsx(b.Dismiss,{onClick:n})]})]}))}}))}var Je={};z(Je,{Collapsible:()=>Uo,CollapsibleStep:()=>ye});var ye={};z(ye,{Content:()=>Ue,Root:()=>Ge,Trigger:()=>Xe});var jr=react.keyframes`
|
|
49
49
|
from {
|
|
50
50
|
height: 0;
|
|
51
51
|
opacity: 0;
|