UNPKG

@frigade/react

Version:
89 lines (84 loc) 94.2 kB
'use strict'; var react$1 = require('@emotion/react'); var q = require('@radix-ui/react-dialog'); var jsxRuntime = require('@emotion/react/jsx-runtime'); var jo = require('react'); var clsx = require('clsx'); var Vn = require('known-css-properties'); var Kn = require('dompurify'); var js = require('@frigade/js'); var Mi = require('embla-carousel-react'); var $e = require('@radix-ui/react-collapsible'); var react = require('@floating-ui/react'); var reactRemoveScroll = require('react-remove-scroll'); var reactHookForm = require('react-hook-form'); var _e = require('@radix-ui/react-radio-group'); var _ = require('@radix-ui/react-select'); var Ro = require('@radix-ui/react-checkbox'); var reactDom = require('react-dom'); var an = require('use-sync-external-store/shim/index.js'); var me = require('@radix-ui/react-popover'); function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n.default = e; return Object.freeze(n); } var q__namespace = /*#__PURE__*/_interopNamespace(q); var jo__namespace = /*#__PURE__*/_interopNamespace(jo); var Vn__default = /*#__PURE__*/_interopDefault(Vn); var Kn__default = /*#__PURE__*/_interopDefault(Kn); var js__namespace = /*#__PURE__*/_interopNamespace(js); var Mi__default = /*#__PURE__*/_interopDefault(Mi); var $e__namespace = /*#__PURE__*/_interopNamespace($e); var react__namespace = /*#__PURE__*/_interopNamespace(react); var _e__namespace = /*#__PURE__*/_interopNamespace(_e); var ___namespace = /*#__PURE__*/_interopNamespace(_); var Ro__namespace = /*#__PURE__*/_interopNamespace(Ro); var an__namespace = /*#__PURE__*/_interopNamespace(an); var me__namespace = /*#__PURE__*/_interopNamespace(me); var It=Object.defineProperty,On=Object.defineProperties;var En=Object.getOwnPropertyDescriptors;var ao=Object.getOwnPropertySymbols;var Dt=Object.prototype.hasOwnProperty,Ht=Object.prototype.propertyIsEnumerable;var Et=(e,o,t)=>o in e?It(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,i=(e,o)=>{for(var t in o||(o={}))Dt.call(o,t)&&Et(e,t,o[t]);if(ao)for(var t of ao(o))Ht.call(o,t)&&Et(e,t,o[t]);return e},p=(e,o)=>On(e,En(o));var In=(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 g=(e,o)=>{var t={};for(var r in e)Dt.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&ao)for(var r of ao(e))o.indexOf(r)<0&&Ht.call(e,r)&&(t[r]=e[r]);return t};var ue=(e,o)=>{for(var t in o)It(e,t,{get:o[t],enumerable:!0});};var $=(e,o,t)=>new Promise((r,n)=>{var a=d=>{try{l(t.next(d));}catch(u){n(u);}},s=d=>{try{l(t.throw(d));}catch(u){n(u);}},l=d=>d.done?r(d.value):Promise.resolve(d.value).then(a,s);l((t=t.apply(e,o)).next());});function Ie(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsxRuntime.jsx("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})}))}var At={borderWidths:{md:"1px"}};var so=[5,10,20,35,50,65,80,95,98],Vt=[...so],No=[...so];Vt[4]=40;No[4]=60;var Dn={blue:{h:213,s:100,l:so},gray:{h:220,s:10,l:so},green:{h:141,s:90,l:Vt},red:{h:9,s:90,l:No},yellow:{h:50,s:90,l:No}};var L={};for(let[e,{h:o,s:t,l:r}]of Object.entries(Dn))L[e]=Object.fromEntries(r.map((n,a)=>[`${(a+1)*100}`,`hsl(${o} ${t}% ${n}%)`]));var Mt=p(i({black:"hsl(0 0% 0%)",white:"hsl(0 0% 100%)"},L),{gray100:L.gray[100],gray200:L.gray[200],gray300:L.gray[300],gray400:L.gray[400],gray500:L.gray[500],gray600:L.gray[600],gray700:L.gray[700],gray800:L.gray[800],gray900:L.gray[900],blue400:L.blue[400],blue500:L.blue[500],blue800:L.blue[800],blue900:L.blue[900],green400:L.green[400],green500:L.green[500],green800:L.green[800],red500:L.red[500],transparent:"#FFFFFF00",inherit:"inherit"});var Lt={md:"8px",lg:"20px",round:"50%"};var m=e=>`var(--fr-colors-${e})`,Wt={negative:{100:m("red-100"),200:m("red-200"),300:m("red-300"),400:m("red-400"),500:m("red-500"),600:m("red-600"),700:m("red-700"),800:m("red-800"),900:m("red-900"),background:m("negative-500"),border:m("negative-500"),foreground:m("white"),surface:m("negative-500"),active:{background:m("negative-400"),border:m("negative-400"),foreground:m("white"),surface:m("negative-400")},focus:{background:m("negative-500"),border:m("negative-500"),foreground:m("white"),surface:m("negative-500")},hover:{background:m("negative-400"),border:m("negative-400"),foreground:m("white"),surface:m("negative-400")}},neutral:{100:m("gray-100"),200:m("gray-200"),300:m("gray-300"),400:m("gray-400"),500:m("gray-500"),600:m("gray-600"),700:m("gray-700"),800:m("gray-800"),900:m("gray-900"),background:m("white"),border:m("neutral-800"),foreground:m("black"),surface:m("neutral-700"),active:{background:m("white"),border:m("neutral-900"),foreground:m("black"),surface:m("neutral-700")},focus:{background:m("white"),border:m("neutral-900"),foreground:m("black"),surface:m("neutral-700")},hover:{background:m("neutral-900"),border:m("neutral-800"),foreground:m("black"),surface:m("neutral-700")}},positive:{100:m("green-100"),200:m("green-200"),300:m("green-300"),400:m("green-400"),500:m("green-500"),600:m("green-600"),700:m("green-700"),800:m("green-800"),900:m("green-900"),background:m("positive-500"),border:m("positive-500"),foreground:m("white"),surface:m("positive-500"),active:{background:m("positive-400"),border:m("positive-400"),foreground:m("white"),surface:m("positive-400")},focus:{background:m("positive-500"),border:m("positive-500"),foreground:m("white"),surface:m("positive-500")},hover:{background:m("positive-400"),border:m("positive-400"),foreground:m("white"),surface:m("positive-400")}},primary:{100:m("blue-100"),200:m("blue-200"),300:m("blue-300"),400:m("blue-400"),500:m("blue-500"),600:m("blue-600"),700:m("blue-700"),800:m("blue-800"),900:m("blue-900"),background:m("primary-500"),border:m("primary-500"),foreground:m("white"),surface:m("primary-500"),active:{background:m("primary-300"),border:m("primary-300"),foreground:m("white"),surface:m("primary-300")},focus:{background:m("primary-500"),border:m("primary-500"),foreground:m("white"),surface:m("primary-500")},hover:{background:m("primary-400"),border:m("primary-400"),foreground:m("white"),surface:m("primary-400")}},secondary:{100:m("gray-100"),200:m("gray-200"),300:m("gray-300"),400:m("gray-400"),500:m("gray-500"),600:m("gray-600"),700:m("gray-700"),800:m("gray-800"),900:m("gray-900"),background:m("white"),border:m("secondary-800"),foreground:m("black"),surface:m("secondary-900"),active:{background:m("secondary-900"),border:m("secondary-800"),foreground:m("black"),surface:m("secondary-800")},focus:{background:m("secondary-900"),border:m("secondary-800"),foreground:m("black"),surface:m("secondary-900")},hover:{background:m("secondary-900"),border:m("secondary-800"),foreground:m("black"),surface:m("secondary-800")}}};var Nt={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Hn="px",$n=e=>typeof e=="number"?`${4*e}${Hn}`:e,An=[-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"],_t=Object.fromEntries(An.map(e=>[e,$n(e)]));var Ut={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 lo=p(i(p(i({},At),{colors:i(i({},Mt),Wt)}),Ut),{radii:Lt,shadows:Nt,space:_t});function Ke(e,o="",t="."){return Object.keys(e).reduce((r,n)=>{let s=`${o.length?`${o}${t}`:""}${n}`,l=e[n];return typeof l=="object"&&l!==null&&!Array.isArray(l)?Object.assign(r,Ke(l,s,t)):r[s]=l,r},{})}function _o(e){let o=Ke(e,"--fr","-");for(let[t,r]of Object.entries(o))if(t.indexOf(".")>-1){let n=t.replace(/\./g,"-");o[n]=r,delete o[t];}return o}function zt(e,o="--fr"){let t={};return Object.keys(e).forEach(r=>{let n=e[r],a=r.replace(/\./g,"-");typeof n=="object"&&n!==null&&!Array.isArray(n)?t[r]=zt(n,`${o}-${r}`):t[r]=`var(${o}-${a})`;}),t}var Uo=_o(lo),I=zt(lo);var Mn=new Set(["alt","size","src"]),Ln=Vn__default.default.all.filter(e=>e.indexOf("-")!=0&&!Mn.has(e)).map(e=>[e.replace(/-([a-z])/g,(o,t)=>t.toUpperCase()),null]),Wn=Object.fromEntries(Ln),po=Ke(I.colors),Nn={color:po,backgroundColor:po,borderColor:po,border:i(i({},I.borderWidths),po),borderRadius:I.radii,borderWidth:I.borderWidths,boxShadow:I.shadows,fontFamily:I.fontFamilies,fontSize:I.fontSizes,fontWeight:I.fontWeights,gap:I.space,lineHeight:I.lineHeights,margin:I.space,marginBottom:I.space,marginLeft:I.space,marginRight:I.space,marginTop:I.space,padding:I.space,paddingBottom:I.space,paddingLeft:I.space,paddingRight:I.space,paddingTop:I.space},Gt=i(i({},Wn),Nn),Kt={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"]},jt=new Set(["active","disabled","focus","focusVisible","focusWithin","hover"]);function _n(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 Xt=new Map(Object.entries(Gt).map(([e,o])=>[e,_n(o)])),Un=new Map(Object.entries(Kt).map(([e,o])=>[e,new Set(o)])),zn=new Set(["height","width"]),Gn=new Set(["canvas","embed","iframe","img","input","object","video"]);function Jt(e){let[o,t]=e.split(":");return [o,jt.has(t)?t:null]}function qt(e,o="div"){let t=Object.assign({},e),r={};function n(a){if(a==null)return r;let l=`&:${a.replace(/[A-Z]/g,d=>`-${d.toLocaleLowerCase()}`)}`;return r[l]==null&&(r[l]={}),r[l]}return Object.entries(t).forEach(([a,s])=>{let[l,d]=Jt(a),u=Un.get(l);u!=null&&(u.forEach(c=>{let f=`${c}${d?":"+d:""}`;t[f]=s;}),delete t[a]);}),Object.entries(t).forEach(([a,s])=>{let[l,d]=Jt(a),u=Xt.get(l);if(u!=null){if(s==null)delete t[a];else if(typeof s=="string"&&s.indexOf(" ")>-1){let c=s.split(" ");n(d)[l]=c.map(f=>{var y;return (y=u.get(f.toString()))!=null?y:f}).join(" ");}else u.has(s.toString())?n(d)[l]=u.get(s.toString()):n(d)[l]=s;(typeof o!="string"||!Gn.has(o)||!zn.has(l))&&delete t[a];}}),Object.keys(t).forEach(a=>{let s=a.substring(1);a.indexOf("_")===0&&Xt.has(s)&&(t[s]=t[a],delete t[a]);}),{cssFromProps:r,unmatchedProps:t}}function jn(){if(typeof window=="undefined"){let{JSDOM:e}=In("jsdom");return new e("<!DOCTYPE html>").window}return window}function Zt(e){return e?{__html:Kn__default.default(jn()).sanitize(e,{ALLOWED_TAGS:["b","strong","i","em","a","span","div","p","pre","s","u","br","img","code","li","ol","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video","p","style"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted","playsinline"]})}:{__html:""}}function Jn(e){return e&&`fr-${e}`}function er(e){return e&&(Array.isArray(e)?e.filter(o=>o!=null).map(o=>er(o)).join(" "):Jn(e))}function qn(l,s){var d=l,{as:e,children:o,className:t,css:r={},part:n}=d,a=g(d,["as","children","className","css","part"]);let u=e!=null?e:"div",{cssFromProps:c,unmatchedProps:f}=qt(a,u),y=er(n),C=t||y?clsx.clsx(t,y):void 0,v=[{boxSizing:"border-box"},c,r];return typeof o=="string"?jsxRuntime.jsx(u,p(i({className:C,css:v},f),{ref:s,dangerouslySetInnerHTML:Zt(o)})):jsxRuntime.jsx(u,p(i({className:C,css:v},f),{ref:s,children:o}))}var x=jo__namespace.forwardRef(qn);var D={};ue(D,{Link:()=>Fi,Plain:()=>Ri,Primary:()=>vi,Secondary:()=>wi});var F={};ue(F,{Body1:()=>mi,Body2:()=>fi,Caption:()=>gi,Display1:()=>si,Display2:()=>li,H1:()=>pi,H2:()=>di,H3:()=>ci,H4:()=>ui});var zo={};ue(zo,{Body1:()=>ri,Body2:()=>ni,Caption:()=>ii,Display1:()=>Zn,Display2:()=>Yn,H1:()=>Qn,H2:()=>ei,H3:()=>oi,H4:()=>ti});var fe={color:"neutral.foreground",fontFamily:"default",margin:"0"},Zn=p(i({},fe),{fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"}),Yn=p(i({},fe),{fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"}),Qn=p(i({},fe),{fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"}),ei=p(i({},fe),{fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"}),oi=p(i({},fe),{fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"}),ti=p(i({},fe),{fontSize:"md",fontWeight:"demibold",lineHeight:"md"}),ri=p(i({},fe),{fontSize:"md",fontWeight:"regular",lineHeight:"md"}),ni=p(i({},fe),{fontSize:"sm",fontWeight:"regular",lineHeight:"sm"}),ii=p(i({},fe),{fontSize:"xs",fontWeight:"regular",lineHeight:"xs"});var ai=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],ge=Object.fromEntries(ai.map(e=>{let o=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",t=jo__namespace.forwardRef((l,s)=>{var d=l,{as:r=o,children:n}=d,a=g(d,["as","children"]);return jsxRuntime.jsx(x,p(i(i({as:r},zo[e]),a),{ref:s,children:n}))});return t.displayName=`Text.${e}`,[e,t]})),si=ge.Display1,li=ge.Display2,pi=ge.H1,di=ge.H2,ci=ge.H3,ui=ge.H4,mi=ge.Body1,fi=ge.Body2,gi=ge.Caption;var Ko={};ue(Ko,{Link:()=>Pi,Plain:()=>Ci,Primary:()=>hi,Secondary:()=>bi,loadingCSSStyle:()=>Go});var co={alignItems:"center",borderWidth:"md",borderRadius:"md",borderStyle:"solid","cursor:disabled":"not-allowed",display:"flex",gap:"2",padding:"2 4",fontFamily:"inherit","opacity:disabled":"0.6","pointerEvents:disabled":"none"},hi=p(i({},co),{backgroundColor:"primary.surface",borderColor:"primary.border",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface","backgroundColor:active":"primary.active.surface","backgroundColor:disabled":"primary.surface"}),bi=p(i({},co),{backgroundColor:"secondary.background",borderColor:"secondary.border",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background","backgroundColor:active":"secondary.active.surface","backgroundColor:disabled":"secondary.background"}),Pi=p(i({},co),{backgroundColor:"transparent",borderColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface","color:active":"primary.active.surface"}),Ci=p(i({},co),{backgroundColor:"transparent",borderColor:"transparent",color:"neutral.foreground"}),Si=react$1.keyframes({from:{transform:"rotate(0turn)"},to:{transform:"rotate(1turn)"}}),Go={position:"relative",color:"transparent","&:after":{content:'""',position:"absolute",width:"16px",height:"16px",top:0,left:0,right:0,bottom:0,margin:"auto",border:"4px solid transparent",borderTopColor:"var(--fr-colors-primary-foreground)",borderRadius:"50%",animation:Si+" 1s ease infinite"}};function uo(s){var l=s,{as:e,children:o,part:t,title:r,variant:n="Primary"}=l,a=g(l,["as","children","part","title","variant"]);var u;let d=n.toLocaleLowerCase();return jsxRuntime.jsxs(x,p(i(p(i({as:e!=null?e:"button",part:[`button-${d}`,t]},Ko[n]),{css:i(i({},(u=a.css)!=null?u:{}),a.loading?Go:{})}),a),{loading:void 0,children:[o,r&&jsxRuntime.jsx(F.Body2,{color:"inherit",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},flexGrow:"1",fontWeight:"medium",lineHeight:"20px",part:"button-title",textWrap:"nowrap",children:r})]}))}function vi(t){var r=t,{children:e}=r,o=g(r,["children"]);return jsxRuntime.jsx(uo,p(i({},o),{variant:"Primary",children:e}))}function wi(t){var r=t,{children:e}=r,o=g(r,["children"]);return jsxRuntime.jsx(uo,p(i({},o),{variant:"Secondary",children:e}))}function Fi(t){var r=t,{children:e}=r,o=g(r,["children"]);return jsxRuntime.jsx(uo,p(i({},o),{variant:"Link",children:e}))}function Ri(t){var r=t,{children:e}=r,o=g(r,["children"]);return jsxRuntime.jsx(uo,p(i({},o),{variant:"Plain",children:e}))}var R={};ue(R,{Column:()=>Bi,Row:()=>ki});var ki=jo__namespace.forwardRef((e,o)=>jsxRuntime.jsx(x,p(i({display:"flex",flexDirection:"row"},e),{ref:o}))),Bi=jo__namespace.forwardRef((e,o)=>jsxRuntime.jsx(x,p(i({display:"flex",flexDirection:"column"},e),{ref:o})));function Xo(t){var r=t,{flowId:e}=r,o=g(r,["flowId"]);return jsxRuntime.jsx(W,p(i({as:null,flowId:e},o),{children:({handleDismiss:n,handlePrimary:a,handleSecondary:s,parentProps:{containerProps:l,dismissible:d},step:u})=>{var C,v,h,b;let c=(v=(C=u.primaryButton)==null?void 0:C.title)!=null?v:u.primaryButtonTitle,f=(b=(h=u.secondaryButton)==null?void 0:h.title)!=null?b:u.secondaryButtonTitle,y=u.$state.blocked;return jsxRuntime.jsxs(P,p(i({alignItems:"center","aria-label":"Banner",borderWidth:"md","data-step-id":u.id,display:"flex",flexDirection:"row",gap:3,justifyContent:"flex-start",part:"banner",role:"complementary"},l),{children:[u.imageUri&&jsxRuntime.jsx(x,{as:"img",part:"image",src:u.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(R.Column,{marginInlineEnd:"auto",part:"banner-title-wrapper",children:[jsxRuntime.jsx(P.Title,{part:"title",children:u.title}),jsxRuntime.jsx(P.Subtitle,{part:"subtitle",children:u.subtitle})]}),jsxRuntime.jsx(P.Secondary,{disabled:y,title:f,onClick:s}),jsxRuntime.jsx(P.Primary,{disabled:y,title:c,onClick:a}),d&&jsxRuntime.jsx(P.Dismiss,{onClick:n})]}))}}))}var vo={};ue(vo,{Carousel:()=>br,Collapsible:()=>xo,CollapsibleStep:()=>Je,Floating:()=>$r});var be={};ue(be,{Bar:()=>he,Dots:()=>ar,Fraction:()=>De,Ring:()=>mo,Segments:()=>fo});function he(r){var n=r,{current:e,total:o}=n,t=g(n,["current","total"]);let a=o>0?Math.min(e/o,1):0,s=a===0?"10px":`${100*a}%`;return jsxRuntime.jsx(x,p(i({"aria-description":"Progress represented as a bar","aria-label":"Progress Bar","aria-valuemin":"0","aria-valuemax":o,"aria-valuenow":e,backgroundColor:"neutral.800",borderRadius:"md",height:"10px",part:"progress-bar",role:"meter"},t),{children:jsxRuntime.jsx(x,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:s},transition:"width 300ms ease-out"})}))}function ar(r){var n=r,{current:e,total:o}=n,t=g(n,["current","total"]);if(o==1)return null;let a=[...Array(o)].map((s,l)=>jsxRuntime.jsx(x,{as:"circle",cx:4+16*l,cy:"4px",fill:e-1===l?I.colors.blue500:I.colors.blue800,part:["progress-dot",e-1===l?"progress-dot-filled":null],r:4},l));return jsxRuntime.jsx(x,p(i({"aria-description":"Progress represented as dots","aria-label":"Progress Dots","aria-valuemin":"0","aria-valuemax":o,"aria-valuenow":e,as:"svg",height:"8px",part:"progress-dots",role:"meter",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8},t),{children:a}))}function De(r){var n=r,{current:e,total:o}=n,t=g(n,["current","total"]);return jsxRuntime.jsx(F.Body2,p(i({"aria-description":"Progress represented as a fraction of a total","aria-label":"Progress Fraction","aria-valuemin":"0","aria-valuemax":o,"aria-valuenow":e,part:"progress-fraction",role:"meter"},t),{children:`${e}/${o}`}))}function mo(d){var u=d,{css:e,current:o,height:t="48px",showLabel:r=!1,strokeWidth:n="8px",total:a,width:s="48px"}=u,l=g(u,["css","current","height","showLabel","strokeWidth","total","width"]);if(a==1)return null;let c=a>0?Math.min(Math.round(o/a*100)/100,1):0;return jsxRuntime.jsxs(x,p(i({"aria-description":"Progress represented as a ring","aria-label":"Progress Ring","aria-valuemin":"0","aria-valuemax":a,"aria-valuenow":o,as:"svg",css:i({"--progress-percent":c,"--radius":`calc((min(${t}, ${s}) - ${n}) / 2)`,"--circumference":"calc(var(--radius) * pi * 2)","--dash-length":"calc(var(--circumference) * var(--progress-percent))","--gap-length":"calc(var(--circumference) - var(--dash-length))"},e),height:t,part:"progress-ring",position:"relative",role:"meter",width:s},l),{children:[jsxRuntime.jsx(x,{as:"circle",cx:"50%",cy:"50%",fill:"transparent",part:"progress-ring-track",r:"var(--radius)",stroke:I.colors.primary[800],strokeWidth:n}),jsxRuntime.jsx(x,{as:"circle",cx:"50%",cy:"50%",fill:"transparent",part:"progress-ring-filled",r:"var(--radius)",stroke:I.colors.primary.surface,strokeWidth:n,style:{strokeDasharray:"var(--dash-length) var(--gap-length)"},transform:"rotate(-90deg)",transformOrigin:"50% 50%",transition:"stroke-dasharray 0.2s ease-out"}),r&&jsxRuntime.jsx(F.Caption,{as:"text",dominantBaseline:"middle",fontWeight:"medium",textAnchor:"middle",_x:"50%",_y:"52%",children:c*100})]}))}function fo(r){var n=r,{current:e,total:o}=n,t=g(n,["current","total"]);let a=[...Array(o)].map((s,l)=>jsxRuntime.jsx(x,{backgroundColor:e-1>=l?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%",minWidth:"10px",part:["progress-segment",e-1===l?"progress-segment-filled":null]},l));return jsxRuntime.jsx(R.Row,p(i({"aria-description":"Progress represented as a segmented bar","aria-label":"Progress Segments","aria-valuemin":"0","aria-valuemax":o,"aria-valuenow":e,gap:1,height:"10px",part:"progress-segments",role:"meter"},t),{children:a}))}function pr(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",className:"size-4"},e),{children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M8 1a3.5 3.5 0 0 0-3.5 3.5V7A1.5 1.5 0 0 0 3 8.5v5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 11.5 7V4.5A3.5 3.5 0 0 0 8 1Zm2 6V4.5a2 2 0 1 0-4 0V7h4Z",clipRule:"evenodd"})}))}function Ii(){return jsxRuntime.jsx(x,{as:"svg",color:"primary.foreground",fill:"none",height:"8px",part:"check-icon",viewBox:"0 0 10 8",width:"10px",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function go(r){var n=r,{checked:e=!1,size:o="22px"}=n,t=g(n,["checked","size"]);return jsxRuntime.jsx(x,p(i({backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"check-indicator",position:"relative",height:o,width:o},t),{children:e&&jsxRuntime.jsx(x,{alignItems:"center",bg:"green500",borderWidth:"md",borderStyle:"solid",borderColor:"green500",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"check-indicator-checked",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsxRuntime.jsx(Ii,{})})}))}function ae(e,{onPrimary:o,onSecondary:t}={}){let{navigate:r}=jo.useContext(V),n=jo.useMemo(()=>e==null?{}:{"flow.back":a=>e.flow.back(a),"flow.complete":a=>e.flow.complete(a),"flow.forward":a=>e.flow.forward(a),"flow.restart":()=>e.flow.restart(),"flow.skip":a=>e.flow.skip(a),"flow.start":a=>e.flow.start(a),"step.complete":(a,s)=>e.complete(a,s),"step.skip":(a,s)=>e.skip(a,s),"step.reset":()=>e.reset(),"step.start":a=>e.start(a)},[e]);return {handlePrimary:jo.useCallback((a,s,l=!0)=>$(this,null,function*(){if((yield o==null?void 0:o(e,a,s))===!1)return a.preventDefault(),!1;if(e.primaryButton!=null){let u=e.primaryButton.action===!1?!1:n[e.primaryButton.action];typeof u=="function"?yield u(s,l):u!==!1&&(yield e.complete(s,l)),e.primaryButton.uri!=null&&r(e.primaryButton.uri,e.primaryButton.target);}else yield e.complete(s,l),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget);return !0}),[r,o,e,n]),handleSecondary:jo.useCallback((a,s)=>$(this,null,function*(){if((yield t==null?void 0:t(e,a,s))===!1)return a.preventDefault(),!1;if(e.secondaryButton!=null){let d=e.secondaryButton.action===!1?!1:n[e.secondaryButton.action];typeof d=="function"?d():d!==!1&&e.complete(s),e.secondaryButton.uri!=null&&r(e.secondaryButton.uri,e.secondaryButton.target);}else e.complete(s),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget);return !0}),[r,t,e,n])}}function cr({onPrimary:e,onSecondary:o,step:t}){var u,c;let{handlePrimary:r,handleSecondary:n}=ae(t,{onPrimary:e,onSecondary:o}),{blocked:a,completed:s,skipped:l}=t.$state,d=s||l||!a?jsxRuntime.jsx(go,{checked:s||l,marginLeft:"auto"}):jsxRuntime.jsx(x,{as:pr,height:"22px",marginLeft:"auto",width:"22px"});return jsxRuntime.jsxs(P,{borderWidth:1,containerType:"inline-size",css:{"@container (max-width: 600px)":{flexBasis:"85%"},"@container (min-width: 601px) and (max-width: 900px)":{flexBasis:"45%"},"@container (min-width: 1200px)":{flexBasis:"25%"}},"data-step-id":t.id,flex:"0 0 30%",gap:"2",p:"4",part:"carousel-step",userSelect:"none",disabled:a,opacity:a?.5:1,children:[jsxRuntime.jsxs(R.Row,{marginBottom:"2",part:"carousel-step-header",children:[t.iconUri&&jsxRuntime.jsx(P.Media,{borderRadius:"0",height:"24px",src:t.iconUri,width:"24px"}),d]}),jsxRuntime.jsx(P.Title,{children:t.title}),jsxRuntime.jsx(P.Subtitle,{children:t.subtitle}),jsxRuntime.jsxs(R.Row,{css:{"@container (max-width: 200px)":{"& > button":{flexBasis:"50%",flexGrow:1},flexDirection:"column-reverse"}},gap:"2",marginTop:"auto",paddingTop:"3",part:"carousel-step-footer",children:[jsxRuntime.jsx(P.Secondary,{disabled:a,onClick:n,title:(u=t.secondaryButton)==null?void 0:u.title}),jsxRuntime.jsx(P.Primary,{disabled:a,onClick:r,title:(c=t.primaryButton)==null?void 0:c.title})]})]})}function mr(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M3 10a.75.75 0 0 1 .75-.75h10.638L10.23 5.29a.75.75 0 1 1 1.04-1.08l5.5 5.25a.75.75 0 0 1 0 1.08l-5.5 5.25a.75.75 0 1 1-1.04-1.08l4.158-3.96H3.75A.75.75 0 0 1 3 10Z",clipRule:"evenodd"})}))}function gr(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M17 10a.75.75 0 0 1-.75.75H5.612l4.158 3.96a.75.75 0 1 1-1.04 1.08l-5.5-5.25a.75.75 0 0 1 0-1.08l5.5-5.25a.75.75 0 1 1 1.04 1.08L5.612 9.25H16.25A.75.75 0 0 1 17 10Z",clipRule:"evenodd"})}))}var yr=react$1.keyframes` from { opacity: 0; } to { opacity: 1; } `;function xr({flow:e,sort:o,onPrimary:t,onSecondary:r}){var h,b;let[n,a]=jo.useState(),[s]=jo.useState({align:"start",container:".fr-carousel-content",skipSnaps:!0,slides:".fr-carousel-step",startIndex:o=="completed-last"?0:(b=(h=Array.from(e.steps.values()).find(S=>!S.$state.completed&&!S.$state.skipped))==null?void 0:h.order)!=null?b:0}),[l,d]=Mi__default.default(s),[u,c]=jo.useState(),[f,y]=jo.useState();jo.useLayoutEffect(()=>{d&&(u==null&&c(d.canScrollNext()),f==null&&y(d.canScrollPrev()),d.on("select",()=>{c(d.canScrollNext()),y(d.canScrollPrev());}));},[d,u,f]),jo.useEffect(()=>{if(!n){let S=Array.from(e.steps.values()),B=S.filter(T=>T.$state.completed||T.$state.skipped).sort((T,k)=>T.order-k.order),O=S.filter(T=>!T.$state.completed&&!T.$state.skipped).sort((T,k)=>T.order-k.order);a(o==="completed-last"?[...O,...B].map(T=>T.id):S.map(T=>T.id));}},[e.steps,o,n]);let C=e.getNumberOfCompletedSteps(),v=e.getNumberOfAvailableSteps();return n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(R.Row,{css:{"@container (max-width: 750px)":{flexDirection:"column",gap:I.space[5]}},justifyContent:"space-between",part:"carousel-header",children:[jsxRuntime.jsxs(R.Column,{part:"carousel-header-content",children:[jsxRuntime.jsx(F.H3,{children:e.title}),jsxRuntime.jsx(F.Body2,{color:"neutral.400",children:e.subtitle})]}),jsxRuntime.jsxs(R.Row,{alignItems:"center",gap:2,part:"progress",children:[jsxRuntime.jsxs(F.Body2,{fontWeight:"demibold",part:"progress-text",children:[C,"/",v]}),jsxRuntime.jsx(he,{current:C,total:v,minWidth:"200px"})]})]}),jsxRuntime.jsxs(x,{margin:`0 ${I.space[-4]}`,overflow:"hidden",part:"carousel-wrapper",px:"4",position:"relative",ref:l,children:[jsxRuntime.jsx(R.Row,{gap:4,part:"carousel-content",children:Array.from(e.steps.values()).filter(S=>S.$state.visible).sort((S,B)=>n.indexOf(S.id)-n.indexOf(B.id)).map(S=>jsxRuntime.jsx(cr,{onPrimary:t,onSecondary:r,step:S},S.id))}),f&&jsxRuntime.jsx(R.Column,{animation:`${yr} 300ms ease-out`,background:"linear-gradient(to right, rgba(255, 255, 255, 0.5), transparent 50%)",bottom:"0",left:"0",justifyContent:"center",paddingLeft:"3",part:"carousel-prev-wrapper",position:"absolute",top:"0",children:jsxRuntime.jsx(D.Plain,{border:"1px solid neutral.border",borderRadius:"100%",boxShadow:"md",backgroundColor:"neutral.background",color:"primary.surface",onClick:()=>d.scrollPrev(),padding:"2",children:jsxRuntime.jsx(gr,{height:"24px",width:"24px"})})}),u&&jsxRuntime.jsx(R.Column,{animation:`${yr} 300ms ease-out`,background:"linear-gradient(to left, rgba(255, 255, 255, 0.5), transparent 50%)",bottom:"0",justifyContent:"center",paddingRight:"3",part:"carousel-next-wrapper",position:"absolute",right:"0",top:"0",children:jsxRuntime.jsx(D.Plain,{border:"1px solid neutral.border",borderRadius:"100%",boxShadow:"md",backgroundColor:"neutral.background",color:"primary.surface",onClick:()=>d.scrollNext(),padding:"2",children:jsxRuntime.jsx(mr,{height:"24px",width:"24px"})})})]})]}):null}function br(o){var e=g(o,[]);return jsxRuntime.jsx(W,p(i({as:P,borderWidth:1,containerType:"inline-size",p:"4",part:"carousel"},e),{children:t=>jsxRuntime.jsx(xr,i(i({},e),t))}))}var Je={};ue(Je,{Content:()=>Zo,Root:()=>Yo,Trigger:()=>Qo});function Cr(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"size-6"},e),{children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})}))}var Wi=react$1.keyframes` from { height: 0; opacity: 0; } to { height: var(--radix-collapsible-content-height); opacity: 1; } `,Ni=react$1.keyframes` from { height: var(--radix-collapsible-content-height); opacity: 1; } to { height: 0; opacity: 0; } `,_i=()=>jsxRuntime.jsx(x,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function Ui({checked:e=!1}){return jsxRuntime.jsx(x,{backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",marginRight:"2",padding:"0",part:"field-radio-value",position:"relative",height:"22px",width:"22px",children:e&&jsxRuntime.jsx(x,{alignItems:"center",bg:"green500",borderWidth:"md",borderStyle:"solid",borderColor:"green500",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:jsxRuntime.jsx(_i,{})})})}function Zo({children:e}){return jsxRuntime.jsx($e__namespace.Content,{asChild:!0,children:jsxRuntime.jsxs(R.Column,{css:{'&[data-state="open"]':{animation:`${Wi} 300ms ease-out`},'&[data-state="closed"]':{animation:`${Ni} 300ms ease-out`},overflow:"hidden"},gap:5,part:"collapsible-content",children:[jsxRuntime.jsx(x,{part:"checklist-spacer"}),e]})})}function Yo(a){var s=a,{children:e,disabled:o=!1,onOpenChange:t=()=>{},open:r=!1}=s,n=g(s,["children","disabled","onOpenChange","open"]);return jsxRuntime.jsx($e__namespace.Root,{asChild:!0,disabled:o,open:r,onOpenChange:t,children:jsxRuntime.jsx(P,p(i({borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0,part:"collapsible-step"},n),{children:e}))})}function Qo({isCompleted:e,isBlocked:o,title:t}){return jsxRuntime.jsx($e__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(R.Row,{alignItems:"center",justifyContent:"flex-start",margin:-5,padding:5,zIndex:1,opacity:o?.4:1,disabled:o,pointerEvents:o?"none":"auto",cursor:o?"not-allowed":"pointer",part:"collapsible-header",children:[jsxRuntime.jsx(Ui,{checked:e}),jsxRuntime.jsx(F.Body2,{fontWeight:"demibold",userSelect:"none",part:"collapsible-title",children:t}),jsxRuntime.jsx(x,{as:Cr,color:"neutral.100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",marginLeft:"auto",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var zi=["autoPlay","controls","controlsList","crossOrigin","disablePictureInPicture","disableRemotePlayback","loop","muted","playsInline","poster","preload","src"];function re(e){let o={},t={};for(let[r,n]of Object.entries(e))zi.some(a=>a===r)?o[r]=n:t[r]=n;return {otherProps:t,videoProps:o}}var wr=jo.createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function Fr({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:r,step:n}){var h,b,S,B,O,T;let{$state:{blocked:a,completed:s,skipped:l},subtitle:d,title:u}=n,c=(b=(h=n.primaryButton)==null?void 0:h.title)!=null?b:n.primaryButtonTitle,f=(B=(S=n.secondaryButton)==null?void 0:S.title)!=null?B:n.secondaryButtonTitle,y=(O=n.props)!=null?O:{},C=!!a,{videoProps:v}=re(y);return jsxRuntime.jsxs(Yo,p(i({"data-step-id":n.id,open:t,onOpenChange:r},y),{children:[jsxRuntime.jsx(Qo,{isBlocked:n.$state.blocked,isCompleted:s||l,title:u}),jsxRuntime.jsxs(Zo,{children:[jsxRuntime.jsx(P.Media,i({aspectRatio:2.5,objectFit:"cover",overflowClipMargin:"unset",src:(T=n.videoUri)!=null?T:n.imageUri,transform:"translate3d(0, 0, 1px)",type:n.videoUri?"video":"image"},v)),jsxRuntime.jsx(P.Subtitle,{color:"neutral.400",children:d}),jsxRuntime.jsxs(R.Row,{gap:3,part:"collapsible-footer",children:[jsxRuntime.jsx(P.Secondary,{title:f,onClick:o}),jsxRuntime.jsx(P.Primary,{disabled:C,title:c,onClick:e})]})]})]}))}var Xi={default:Fr};function Ji(r){var n=r,{flow:e,step:o}=n,t=g(n,["flow","step"]);var h;let{onPrimary:a,onSecondary:s,openStepId:l,setOpenStepId:d,stepTypes:u}=jo.useContext(wr),{handlePrimary:c,handleSecondary:f}=ae(o,{onPrimary:a,onSecondary:s}),y=(l!=null?l:e.getCurrentStep().id)===o.id,C=(h=u[o.type])!=null?h:Fr;function v(b){return $(this,null,function*(){d(b?o.id:""),b&&!o.$state.completed&&(yield o.start(),d(null));})}return jsxRuntime.jsx(C,p(i({flow:e,onOpenChange:v,open:y,step:o},t),{handlePrimary:c,handleSecondary:f}),o.id)}function xo(s){var l=s,{flowId:e,onPrimary:o,onSecondary:t,part:r,stepTypes:n={}}=l,a=g(l,["flowId","onPrimary","onSecondary","part","stepTypes"]);let[d,u]=jo.useState(null),c=i(i({},Xi),n);return jsxRuntime.jsx(wr.Provider,{value:{openStepId:d,setOpenStepId:u,onPrimary:o,onSecondary:t,stepTypes:c},children:jsxRuntime.jsx(W,p(i({as:P,borderWidth:"md",flowId:e,part:["checklist",r]},a),{children:v=>{var h=v,{flow:f,handleDismiss:y}=h,C=g(h,["flow","handleDismiss"]);var k;let S=Array.from(f.steps.entries()).filter(([,w])=>w.$state.visible===!0).map(([,w])=>jsxRuntime.jsx(Ji,p(i({flow:f,handleDismiss:y},C),{step:w}),w.id)),B=f.getNumberOfCompletedSteps(),O=f.getNumberOfAvailableSteps(),T=a.dismissible||!!((k=f==null?void 0:f.props)!=null&&k.dismissible);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(R.Column,{gap:2,part:"checklist-header",children:[jsxRuntime.jsx(P.Header,{dismissible:T,handleDismiss:y,subtitle:f.subtitle,title:f.title}),jsxRuntime.jsxs(R.Row,{alignItems:"center",gap:2,part:"checklist-progress",children:[jsxRuntime.jsxs(F.Body2,{fontWeight:"demibold",part:"progress-text",children:[B,"/",O]}),jsxRuntime.jsx(he,{current:B,total:O,flexGrow:1})]})]}),S]})}}))})}var Qe={};ue(Qe,{Content:()=>Me,Root:()=>Ve,Trigger:()=>Le});function oa(s,a){var l=s,{children:e,lockScroll:o=!0,part:t,opacity:r=.5}=l,n=g(l,["children","lockScroll","part","opacity"]);let d=react$1.keyframes` from { opacity: 0; } to { opacity: ${r} } `,[u,c]=jo.useState(!1);return jo.useEffect(()=>{if(!o){let f=()=>{u||(c(!0),window.removeEventListener("scroll",f));};return window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f);}}},[o,u]),!o&&u?jsxRuntime.jsx(jsxRuntime.Fragment,{children:e}):jsxRuntime.jsx(reactRemoveScroll.RemoveScroll,{forwardProps:!0,ref:a,enabled:o,children:jsxRuntime.jsx(x,p(i({animation:`${d} 300ms ease-out`,backgroundColor:"black",inset:"0",opacity:"0.5",part:["overlay",t],position:"fixed"},n),{children:e}))})}var Ae=jo__namespace.forwardRef(oa);function sa({maxX:e,maxY:o,radius:t,x1:r,x2:n,y1:a,y2:s}){return t>0?`path("${[`M${r+t},${a}`,`H${n-t}`,`A${t} ${t} 0,0,1 ${n} ${a+t}`,`V${s-t}`,`A${t} ${t} 0,0,1 ${n-t} ${s}`,`H${r+t}`,`A${t} ${t} 0,0,1 ${r} ${s-t}`,`V${o}`,`H${e}`,"V0","H0",`V${o}`,`H${r}`,`V${a+t}`,`A${t} ${t} 0,0,1 ${r+t} ${a}`,"Z"].join(" ")}")`:`path("M${r},${a} H${n} V${s} H${r} V${o} H${e} V0 H0 V${o} H${r} Z")`}function la(e){if(!window||!("nodeType"in e))return 0;let o=Number(window.getComputedStyle(e).borderRadius.replace(/\D/g,""));return Number.isNaN(o)?0:o}function qe(a){var s=a,{anchor:e,lockScroll:o=!0,part:t,style:r={}}=s,n=g(s,["anchor","lockScroll","part","style"]);let[l,d]=jo.useState({maxX:0,maxY:0,radius:0,x1:0,x2:0,y1:0,y2:0}),{refs:u}=react.useFloating({middleware:[{name:"clipPath",fn({elements:c,rects:f}){return d({maxX:c.floating.clientWidth,maxY:c.floating.clientHeight,radius:la(c.reference),x1:f.reference.x,x2:f.reference.x+f.reference.width,y1:f.reference.y,y2:f.reference.y+f.reference.height}),{}}}],open:!0,placement:"top-center",transform:!1,whileElementsMounted:react.autoUpdate});return jo.useEffect(()=>{try{let c=document.querySelector(e);c!=null?u.setReference(c):console.debug(`[frigade] Spotlight: No anchor found for selector: ${e}`);}catch(c){}},[e,u]),jsxRuntime.jsx(Ae,i({lockScroll:o,part:["spotlight",t],ref:u.setFloating,style:i({clipPath:sa(l)},r)},n))}function Ze(e,o=!0){let[t,r]=jo.useState(!1);jo.useEffect(()=>{if(!t&&o&&e instanceof Element){let n=typeof o!="boolean"?o:{behavior:"smooth",block:"center"},a;window.addEventListener("scroll",function s(){clearTimeout(a),a=setTimeout(()=>{window.removeEventListener("scroll",s),r(!0);},100);},!0),e.scrollIntoView(n);}else o||r(!0);},[o,e,t]);}function kr(e,o){try{if(e.matches(o)&&Br(e))return e;let t=e.querySelectorAll(o);if(t.length>0&&Br(t[0]))return t[0]}catch(t){return null}}function Br(e){return e instanceof HTMLElement?!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length):!1}function Or(e){let[o,t]=jo.useState(null);return jo.useEffect(()=>{if(typeof e=="string")try{let r=document.querySelector(e);r!=null?(console.debug(`[frigade] Found anchor: ${e}`),t(r)):console.debug(`[frigade] No anchor found for selector: ${e}`);}catch(r){console.debug(`[frigade] Invalid selector for anchor: ${e}`);}},[e]),jo.useEffect(()=>{if(typeof e!="string")return;let r=new MutationObserver(n=>{for(let a of n)if(a.type==="childList"){for(let s of a.addedNodes){if(s.nodeType!==Node.ELEMENT_NODE)continue;let l=kr(s,e);if(l!=null){console.debug(`[frigade] Found anchor: ${e}`),t(l);break}}for(let s of a.removedNodes){if(s.nodeType!==Node.ELEMENT_NODE)continue;if(kr(s,e)!=null){console.debug(`[frigade] Removed anchor: ${e}`),t(null);break}}}});return r.observe(document.querySelector("body"),{childList:!0,subtree:!0}),()=>r.disconnect()},[e]),{anchorElement:o}}function Fa(e){switch(e){case"after":return "end";case"before":return "start";default:return e}}function ho({align:e,alignOffset:o,anchor:t,nodeId:r,onOpenChange:n=()=>{},open:a,side:s,sideOffset:l}){let d=`${s}-${Fa(e)}`;function u({rects:z}){let N={alignmentAxis:o,mainAxis:l};return ["after","before"].includes(e)&&(["bottom","top"].includes(s)?N.alignmentAxis=o-z.floating.width:N.alignmentAxis=o-z.floating.height),N}let H=react.useFloating({middleware:[react.offset(u,[e,o,s,l]),react.flip(),react.shift()],nodeId:r,onOpenChange:n,open:a,placement:d,whileElementsMounted:react.autoUpdate}),{context:c,floatingStyles:f,placement:y,refs:C}=H,v=g(H,["context","floatingStyles","placement","refs"]),h=react.useClick(c),b=react.useDismiss(c,{outsidePress:!1}),S=react.useFocus(c),B=react.useRole(c),O=react.useTransitionStatus(c),{getFloatingProps:T,getReferenceProps:k}=react.useInteractions([h,b,S,B]),{anchorElement:w}=Or(t);jo.useEffect(()=>{w!=null&&C.setReference(w);},[t,w,C]);let E=y.split("-");return e==="before"?E[1]=E[1]==="end"?"after":"before":e==="after"&&(E[1]=E[1]==="start"?"before":"after"),i({context:c,getFloatingProps:T,getReferenceProps:k,floatingStyles:f,placement:E.join("-"),refs:C,status:O},v)}var Ye=jo.createContext({floatingNodeId:null,isOpen:!1,setIsOpen:()=>{}});function Ve(C){var v=C,{align:e="center",alignOffset:o=0,anchor:t,autoScroll:r=!1,children:n,defaultOpen:a=!1,modal:s=!1,onOpenChange:l=()=>{},open:d,side:u="bottom",sideOffset:c=0,spotlight:f=!1}=v,y=g(v,["align","alignOffset","anchor","autoScroll","children","defaultOpen","modal","onOpenChange","open","side","sideOffset","spotlight"]);let[h,b]=jo.useState(a),S=d!=null?d:h,B=react.useFloatingNodeId(),O=ho(i({align:e,alignOffset:o,anchor:t,nodeId:B,onOpenChange:k=>{l(k),d==null&&b(k);},open:S,side:u,sideOffset:c},y)),{refs:T}=O;return Ze(T.reference.current,r),jsxRuntime.jsxs(Ye.Provider,{value:{floating:O,floatingNodeId:B,isOpen:S,setIsOpen:b},children:[f&&S&&jsxRuntime.jsx(qe,{anchor:t}),s&&!f&&S&&jsxRuntime.jsx(Ae,{lockScroll:!0}),n]})}var ot={height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}};function bo(){let e="DOMRect"in globalThis?new DOMRect:ot,[o,t]=jo.useState(e),[r,n]=jo.useState(null),a=jo.useCallback(s=>{n(s);},[]);return jo.useLayoutEffect(()=>{if(!r)return;let s=()=>{let l=r.getBoundingClientRect();t(l);};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[r]),{node:r,rect:o,ref:a}}function Po(e){let[o,t]=jo.useState(!1),[r,n]=jo.useState(ot),a=r.height>0&&r.width>0;return jo.useEffect(()=>{if(e==null)return;let s=new IntersectionObserver(l=>{let d=l[0];n(d.boundingClientRect),t(d.isIntersecting);},{root:null});return s.observe(e),()=>{s.disconnect();}},[e]),{isVisible:o&&a}}function Me(a){var s=a,{children:e,css:o,part:t,style:r}=s,n=g(s,["children","css","part","style"]);let{floating:l,floatingNodeId:d}=jo.useContext(Ye),{isVisible:u}=Po(l==null?void 0:l.refs.reference.current);if(l==null)return null;let{floatingStyles:c,getFloatingProps:f,placement:y,refs:C,status:v}=l;return C.reference.current==null||!u||(v==null?void 0:v.isMounted)===!1?null:jsxRuntime.jsx(react.FloatingNode,{id:d,children:jsxRuntime.jsx(x,p(i(i({autoFocus:!0,css:i({'&[data-status="unmounted"]':{display:"none"}},o),"data-placement":y,"data-status":v.status,part:["popover-content",t],ref:C.setFloating,style:i(i({},c),r)},f()),n),{children:jsxRuntime.jsx(x,{part:"popover-transition-container",children:e})}))})}function Le(r){var n=r,{children:e,part:o}=n,t=g(n,["children","part"]);var d;let{floating:{getReferenceProps:a,refs:s},setIsOpen:l}=jo.useContext(Ye);return jsxRuntime.jsx(x,p(i(i({ref:s==null?void 0:s.setReference,onClick:()=>l(u=>!u),part:["popover-trigger",o]},t),(d=a==null?void 0:a())!=null?d:{}),{children:e}))}var Co={'&[data-status="open"]':{opacity:1,zIndex:1},'&[data-status="close"]':{opacity:0,zIndex:0,'& [data-status="close"]':{display:"none"}},'&[data-status="initial"]':{opacity:.8},'&[data-status="open"], &[data-status="close"]':{transition:"transform 0.2s ease-out, opacity 0.2s ease-out"},'&[data-status="initial"] .fr-popover-transition-container':{transform:"scale(0.8)"},'&[data-status="close"] .fr-popover-transition-container':{transform:"scale(0.3)"},'&[data-status="open"] .fr-popover-transition-container':{transform:"scale(1)"},"& .fr-popover-transition-container":{transformOrigin:"left",transition:"transform 0.2s ease-out"}};function Hr({onPrimary:e,onSecondary:o,openStepId:t,setOpenStepId:r,step:n}){var b,S,B,O,T,k;let a=jo.useRef(),{handlePrimary:s,handleSecondary:l}=ae(n,{onPrimary:e,onSecondary:o}),d=t===n.id;function u(...w){return $(this,null,function*(){(yield s(...w))&&r(null);})}function c(...w){return $(this,null,function*(){(yield l(...w))&&r(null);})}function f(){clearTimeout(a.current),d||(a.current=setTimeout(()=>r(n.id),300));}function y(){clearTimeout(a.current);}let C=(S=(b=n.primaryButton)==null?void 0:b.title)!=null?S:n.primaryButtonTitle,v=(O=(B=n.secondaryButton)==null?void 0:B.title)!=null?O:n.secondaryButtonTitle,{videoProps:h}=re((T=n.props)!=null?T:{});return jsxRuntime.jsxs(Ve,{align:"start",open:d,side:"right",sideOffset:8,children:[jsxRuntime.jsxs(Le,{as:R.Row,alignItems:"center",borderRadius:"md",gap:"2",justifyContent:"space-between",onPointerEnter:f,onPointerLeave:y,padding:"1 2",part:"floating-checklist-step-list-item",style:{backgroundColor:d?"var(--fr-colors-neutral-800)":"transparent"},userSelect:"none",children:[jsxRuntime.jsx(F.Body2,{part:"floating-checklist-step-title",children:n.title}),jsxRuntime.jsx(go,{checked:n.$state.completed||n.$state.skipped,size:"18px"})]}),jsxRuntime.jsx(Me,{css:Co,part:"floating-step",children:jsxRuntime.jsxs(P,{backgroundColor:"neutral.background",border:"md solid neutral.border",borderRadius:"md",gap:"3",minWidth:"400px",p:"2",children:[jsxRuntime.jsx(P.Media,i({src:(k=n.videoUri)!=null?k:n.imageUri,type:n.videoUri?"video":"image",css:{objectFit:"contain",width:"100%"}},h)),jsxRuntime.jsx(P.Header,{dismissible:!1,padding:"0 1",subtitle:n.subtitle}),jsxRuntime.jsxs(R.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsxRuntime.jsx(P.Secondary,{disabled:n.$state.blocked,onClick:c,padding:"1 2",title:v}),jsxRuntime.jsx(P.Primary,{disabled:n.$state.blocked,onClick:u,padding:"1 2",title:C})]})]})})]})}function $r(s){var l=s,{children:e,flowId:o,onPrimary:t,onSecondary:r,part:n}=l,a=g(l,["children","flowId","onPrimary","onSecondary","part"]);let[d,u]=jo.useState(null),c=jo.useRef();function f(){clearTimeout(c.current);}function y(){clearTimeout(c.current),d!=null&&(c.current=setTimeout(()=>u(null),300));}function C(v){!v&&d!=null&&u(null);}return jsxRuntime.jsx(W,p(i({flowId:o,part:["floating-checklist",n]},a),{children:({flow:v})=>{let h=v.getNumberOfCompletedSteps(),b=v.getNumberOfAvailableSteps(),S=e!=null?e:jsxRuntime.jsxs(R.Row,{alignItems:"center",backgroundColor:"neutral.background",border:"md solid neutral.border",borderRadius:"md",cursor:"pointer",gap:"2",padding:"1 2",part:"floating-checklist-anchor",userSelect:"none",children:[jsxRuntime.jsx(F.Body2,{fontWeight:"medium",part:"floating-checklist-title",children:v.title}),jsxRuntime.jsx(mo,{current:h,height:"24px",strokeWidth:"4px",total:b,width:"24px"})]});return jsxRuntime.jsx(react.FloatingTree,{children:jsxRuntime.jsxs(Ve,{align:"start",onOpenChange:C,sideOffset:4,children:[jsxRuntime.jsx(Le,{display:"inline-block",children:S}),jsxRuntime.jsx(Me,{css:p(i({},Co),{'&[data-status="initial"]':{opacity:.3},"& .fr-popover-transition-container":{transformOrigin:"top left",transition:"transform 0.2s ease-out"},'&[data-placement^="top"] .fr-popover-transition-container':{transformOrigin:"bottom left"}}),children:jsxRuntime.jsxs(P,{backgroundColor:"neutral.background",border:"md solid neutral.border",borderRadius:"md",gap:"0",onPointerEnter:f,onPointerLeave:y,p:"0 1 1",part:"floating-checklist-step-list",children:[jsxRuntime.jsx(he,{borderRadius:"md md 0 0",clipPath:"border-box",css:{"& .fr-progress-bar-fill":{borderRadius:0}},current:h,height:"5px",total:b,flexGrow:1,margin:"0 -1 2"}),Array.from(v.steps.values()).map(B=>jsxRuntime.jsx(Hr,{onPrimary:t,onSecondary:r,openStepId:d,setOpenStepId:u,step:B},B.id))]})})]})})}}))}var Xa=new Set(["required","min","max","minLength","maxLength","pattern"]);function Ja({fieldComponent:e,control:o,fieldData:t,submit:r}){let n=reactHookForm.useFormContext();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 a=Object.fromEntries(Object.entries(t).filter(([l])=>Xa.has(l))),s=reactHookForm.useController({name:t.id,control:o,rules:a});return jsxRuntime.jsx(e,p(i({},s),{fieldData:t,formContext:n,submit:r}))}function Vr({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:r,parentProps:{dismissible:n},step:a}){var B,O,T,k;let{__readOnly:s}=jo.useContext(V),l=jo.useMemo(()=>{var w,E;return (E=(w=a.fields)==null?void 0:w.filter(H=>e[H.type]!=null&&H.id))!=null?E:[]},[a.fields,e]),d=reactHookForm.useForm({delayError:2e3,mode:"onChange",defaultValues:l.reduce((w,E)=>{var H;return w[E.id]=(H=E.value)!=null?H:"",w},{})});jo.useEffect(()=>{d.formState.isDirty||d.reset(l.reduce((w,E)=>{var H;return w[E.id]=(H=E.value)!=null?H:"",w},{}));},[l,d]),jo.useEffect(()=>{Object.keys(d.formState.dirtyFields).some(w=>l.some(E=>E.id===w))&&d.trigger();},[l,d,a.id]);let[u,c]=jo.useState(!1),f=[],{control:y,handleSubmit:C}=d;function v(w,E){c(!0),t(E,w,s===!0).then(()=>c(!1));}l.forEach(w=>{e[w.type]!=null&&f.push(jsxRuntime.jsx(Ja,{control:y,fieldComponent:e[w.type],fieldData:w,submit:C(v)},`${a.flow.id}-${w.id}`));});let h=(O=(B=a.primaryButton)==null?void 0:B.title)!=null?O:a.primaryButtonTitle,b=(k=(T=a.secondaryButton)==null?void 0:T.title)!=null?k:a.secondaryButtonTitle,S=!!(a.$state.blocked||!d.formState.isValid);return jo.useEffect(()=>{d.clearErrors();},[d,a]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(P.Header,{dismissible:n,handleDismiss:o,part:"form-step-header",subtitle:a.subtitle,title:a.title}),jsxRuntime.jsx(reactHookForm.FormProvider,p(i({},d),{children:f})),jsxRuntime.jsxs(R.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[b&&jsxRuntime.jsx(D.Secondary,{onClick:r,title:b}),jsxRuntime.jsx(D.Primary,{disabled:S||u,onClick:C(v),title:h!=null?h:"Submit",loading:u})]},`form-footer-${a.id}`)]})}function Mr({error:e}){var o;return (o=e==null?v