@embedreach/components 0.2.44 → 0.2.45

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.umd.js CHANGED
@@ -82,7 +82,7 @@ function QQ(e,a){return e?function(e){return"function"==typeof e&&(()=>{const a=
82
82
  * LICENSE.md file in the root directory of this source tree.
83
83
  *
84
84
  * @license MIT
85
- */(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);r+="; Expires="+n.expires.toUTCString()}n.httpOnly&&(r+="; HttpOnly");n.secure&&(r+="; Secure");n.partitioned&&(r+="; Partitioned");if(n.priority){switch("string"==typeof n.priority?n.priority.toLowerCase():void 0){case"low":r+="; Priority=Low";break;case"medium":r+="; Priority=Medium";break;case"high":r+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}}if(n.sameSite){switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"none":r+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}}return r};const c4=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,d4=/^[\u0021-\u003A\u003C-\u007E]*$/,m4=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,h4=/^[\u0020-\u003A\u003D-\u007E]*$/,p4=Object.prototype.toString,g4=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function v4(e,a,n){do{const n=e.charCodeAt(a);if(32!==n&&9!==n)return a}while(++a<n);return n}function f4(e,a,n){for(;a>n;){const n=e.charCodeAt(--a);if(32!==n&&9!==n)return a+1}return n}function y4(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(uBe){return e}}function k4(e={}){let a,{initialEntries:n=["/"],initialIndex:t,v5Compat:i=!1}=e;a=n.map(((e,a)=>c(e,"string"==typeof e?null:e.state,0===a?"default":void 0)));let r=l(null==t?a.length-1:t),o="POP",s=null;function l(e){return Math.min(Math.max(e,0),a.length-1)}function u(){return a[r]}function c(e,n=null,t){let i=function(e,a,n=null,t){let i={pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof a?C4(a):a,state:n,key:a&&a.key||t||A4()};return i}(a?u().pathname:"/",e,n,t);return S4("/"===i.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),i}function d(e){return"string"==typeof e?e:w4(e)}return{get index(){return r},get action(){return o},get location(){return u()},createHref:d,createURL:e=>new URL(d(e),"http://localhost"),encodeLocation(e){let a="string"==typeof e?C4(e):e;return{pathname:a.pathname||"",search:a.search||"",hash:a.hash||""}},push(e,n){o="PUSH";let t=c(e,n);r+=1,a.splice(r,a.length,t),i&&s&&s({action:o,location:t,delta:1})},replace(e,n){o="REPLACE";let t=c(e,n);a[r]=t,i&&s&&s({action:o,location:t,delta:0})},go(e){o="POP";let n=l(r+e);r=n,s&&s({action:o,location:a[n],delta:e})},listen:e=>(s=e,()=>{s=null})}}function b4(e,a){if(!1===e||null==e)throw new Error(a)}function S4(e,a){if(!e)try{throw new Error(a)}catch(uBe){}}function A4(){return Math.random().toString(36).substring(2,10)}function w4({pathname:e="/",search:a="",hash:n=""}){return a&&"?"!==a&&(e+="?"===a.charAt(0)?a:"?"+a),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function C4(e){let a={};if(e){let n=e.indexOf("#");n>=0&&(a.hash=e.substring(n),e=e.substring(0,n));let t=e.indexOf("?");t>=0&&(a.search=e.substring(t),e=e.substring(0,t)),e&&(a.pathname=e)}return a}function M4(e,a,n="/"){return function(e,a,n,t){let i="string"==typeof a?C4(a):a,r=H4(i.pathname||"/",n);if(null==r)return null;let o=T4(e);!function(e){e.sort(((e,a)=>e.score!==a.score?a.score-e.score:function(e,a){let n=e.length===a.length&&e.slice(0,-1).every(((e,n)=>e===a[n]));return n?e[e.length-1]-a[a.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),a.routesMeta.map((e=>e.childrenIndex)))))}(o);let s=null;for(let l=0;null==s&&l<o.length;++l){let e=K4(r);s=_4(o[l],e,t)}return s}(e,a,n,!1)}function T4(e,a=[],n=[],t=""){let i=(e,i,r)=>{let o={relativePath:void 0===r?e.path||"":r,caseSensitive:!0===e.caseSensitive,childrenIndex:i,route:e};o.relativePath.startsWith("/")&&(b4(o.relativePath.startsWith(t),`Absolute route path "${o.relativePath}" nested under path "${t}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(t.length));let s=V4([t,o.relativePath]),l=n.concat(o);e.children&&e.children.length>0&&(b4(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${s}".`),T4(e.children,a,l,s)),(null!=e.path||e.index)&&a.push({path:s,score:R4(s,e.index),routesMeta:l})};return e.forEach(((e,a)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of N4(e.path))i(e,a,n);else i(e,a)})),a}function N4(e){let a=e.split("/");if(0===a.length)return[];let[n,...t]=a,i=n.endsWith("?"),r=n.replace(/\?$/,"");if(0===t.length)return i?[r,""]:[r];let o=N4(t.join("/")),s=[];return s.push(...o.map((e=>""===e?r:[r,e].join("/")))),i&&s.push(...o),s.map((a=>e.startsWith("/")&&""===a?"/":a))}var x4=/^:[\w-]+$/,E4=3,P4=2,j4=1,L4=10,B4=-2,z4=e=>"*"===e;function R4(e,a){let n=e.split("/"),t=n.length;return n.some(z4)&&(t+=B4),a&&(t+=P4),n.filter((e=>!z4(e))).reduce(((e,a)=>e+(x4.test(a)?E4:""===a?j4:L4)),t)}function _4(e,a,n=!1){let{routesMeta:t}=e,i={},r="/",o=[];for(let s=0;s<t.length;++s){let e=t[s],l=s===t.length-1,u="/"===r?a:a.slice(r.length)||"/",c=D4({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},u),d=e.route;if(!c&&l&&n&&!t[t.length-1].route.index&&(c=D4({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},u)),!c)return null;Object.assign(i,c.params),o.push({params:i,pathname:V4([r,c.pathname]),pathnameBase:F4(V4([r,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(r=V4([r,c.pathnameBase]))}return o}function D4(e,a){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,t]=function(e,a=!1,n=!0){S4("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let t=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,a,n)=>(t.push({paramName:a,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(t.push({paramName:"*"}),i+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":""!==e&&"/"!==e&&(i+="(?:(?=\\/|$))");let r=new RegExp(i,a?void 0:"i");return[r,t]}(e.path,e.caseSensitive,e.end),i=a.match(n);if(!i)return null;let r=i[0],o=r.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:t.reduce(((e,{paramName:a,isOptional:n},t)=>{if("*"===a){o=r.slice(0,r.length-(s[t]||"").length).replace(/(.)\/+$/,"$1")}const i=s[t];return e[a]=n&&!i?void 0:(i||"").replace(/%2F/g,"/"),e}),{}),pathname:r,pathnameBase:o,pattern:e}}function K4(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(a){return S4(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),e}}function H4(e,a){if("/"===a)return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let n=a.endsWith("/")?a.length-1:a.length,t=e.charAt(n);return t&&"/"!==t?null:e.slice(n)||"/"}function O4(e,a,n,t){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(t)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function I4(e){let a=function(e){return e.filter(((e,a)=>0===a||e.route.path&&e.route.path.length>0))}(e);return a.map(((e,n)=>n===a.length-1?e.pathname:e.pathnameBase))}function G4(e,a,n,t=!1){let i;"string"==typeof e?i=C4(e):(i={...e},b4(!i.pathname||!i.pathname.includes("?"),O4("?","pathname","search",i)),b4(!i.pathname||!i.pathname.includes("#"),O4("#","pathname","hash",i)),b4(!i.search||!i.search.includes("#"),O4("#","search","hash",i)));let r,o=""===e||""===i.pathname,s=o?"/":i.pathname;if(null==s)r=n;else{let e=a.length-1;if(!t&&s.startsWith("..")){let a=s.split("/");for(;".."===a[0];)a.shift(),e-=1;i.pathname=a.join("/")}r=e>=0?a[e]:"/"}let l=function(e,a="/"){let{pathname:n,search:t="",hash:i=""}="string"==typeof e?C4(e):e,r=n?n.startsWith("/")?n:function(e,a){let n=a.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,a):a;return{pathname:r,search:J4(t),hash:U4(i)}}(i,r),u=s&&"/"!==s&&s.endsWith("/"),c=(o||"."===s)&&n.endsWith("/");return l.pathname.endsWith("/")||!u&&!c||(l.pathname+="/"),l}var V4=e=>e.join("/").replace(/\/\/+/g,"/"),F4=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),J4=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",U4=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var W4=["POST","PUT","PATCH","DELETE"];new Set(W4);var q4=["GET",...W4];new Set(q4);var Z4=r.createContext(null);Z4.displayName="DataRouter";var $4=r.createContext(null);$4.displayName="DataRouterState";var Y4=r.createContext({isTransitioning:!1});Y4.displayName="ViewTransition",r.createContext(new Map).displayName="Fetchers",r.createContext(null).displayName="Await";var Q4=r.createContext(null);Q4.displayName="Navigation";var X4=r.createContext(null);X4.displayName="Location";var e5=r.createContext({outlet:null,matches:[],isDataRoute:!1});e5.displayName="Route";var a5=r.createContext(null);function n5(){return null!=r.useContext(X4)}function t5(){return b4(n5(),"useLocation() may be used only in the context of a <Router> component."),r.useContext(X4).location}a5.displayName="RouteError";var i5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function r5(e){r.useContext(Q4).static||r.useLayoutEffect(e)}function o5(){let{isDataRoute:e}=r.useContext(e5);return e?function(){let{router:e}=function(e){let a=r.useContext(Z4);return b4(a,h5(e)),a}("useNavigate"),a=p5("useNavigate"),n=r.useRef(!1);return r5((()=>{n.current=!0})),r.useCallback((async(t,i={})=>{S4(n.current,i5),n.current&&("number"==typeof t?e.navigate(t):await e.navigate(t,{fromRouteId:a,...i}))}),[e,a])}():function(){b4(n5(),"useNavigate() may be used only in the context of a <Router> component.");let e=r.useContext(Z4),{basename:a,navigator:n}=r.useContext(Q4),{matches:t}=r.useContext(e5),{pathname:i}=t5(),o=JSON.stringify(I4(t)),s=r.useRef(!1);return r5((()=>{s.current=!0})),r.useCallback(((t,r={})=>{if(S4(s.current,i5),!s.current)return;if("number"==typeof t)return void n.go(t);let l=G4(t,JSON.parse(o),i,"path"===r.relative);null==e&&"/"!==a&&(l.pathname="/"===l.pathname?a:V4([a,l.pathname])),(r.replace?n.replace:n.push)(l,r.state,r)}),[a,n,o,i,e])}()}function s5(e,{relative:a}={}){let{matches:n}=r.useContext(e5),{pathname:t}=t5(),i=JSON.stringify(I4(n));return r.useMemo((()=>G4(e,JSON.parse(i),t,"path"===a)),[e,i,t,a])}function l5(e,a,n,t){b4(n5(),"useRoutes() may be used only in the context of a <Router> component.");let i,{navigator:o,static:s}=r.useContext(Q4),{matches:l}=r.useContext(e5),u=l[l.length-1],c=u?u.params:{},d=u?u.pathname:"/",m=u?u.pathnameBase:"/",h=u&&u.route;{let e=h&&h.path||"";v5(d,!h||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}i=t5();let p=i.pathname||"/",g=p;if("/"!==m){let e=m.replace(/^\//,"").split("/");g="/"+p.replace(/^\//,"").split("/").slice(e.length).join("/")}let v=!s&&n&&n.matches&&n.matches.length>0?n.matches:M4(e,{pathname:g});S4(h||null!=v,`No routes matched location "${i.pathname}${i.search}${i.hash}" `),S4(null==v||void 0!==v[v.length-1].route.element||void 0!==v[v.length-1].route.Component||void 0!==v[v.length-1].route.lazy,`Matched leaf route at location "${i.pathname}${i.search}${i.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let f=function(e,a=[],n=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==a.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let t=e,i=n?.errors;if(null!=i){let e=t.findIndex((e=>e.route.id&&void 0!==i?.[e.route.id]));b4(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),t=t.slice(0,Math.min(t.length,e+1))}let o=!1,s=-1;if(n)for(let r=0;r<t.length;r++){let e=t[r];if((e.route.HydrateFallback||e.route.hydrateFallbackElement)&&(s=r),e.route.id){let{loaderData:a,errors:i}=n,r=e.route.loader&&!a.hasOwnProperty(e.route.id)&&(!i||void 0===i[e.route.id]);if(e.route.lazy||r){o=!0,t=s>=0?t.slice(0,s+1):[t[0]];break}}}return t.reduceRight(((e,l,u)=>{let c,d=!1,m=null,h=null;n&&(c=i&&l.route.id?i[l.route.id]:void 0,m=l.route.errorElement||c5,o&&(s<0&&0===u?(v5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,h=null):s===u&&(d=!0,h=l.route.hydrateFallbackElement||null)));let p=a.concat(t.slice(0,u+1)),g=()=>{let a;return a=c?m:d?h:l.route.Component?r.createElement(l.route.Component,null):l.route.element?l.route.element:e,r.createElement(m5,{match:l,routeContext:{outlet:e,matches:p,isDataRoute:null!=n},children:a})};return n&&(l.route.ErrorBoundary||l.route.errorElement||0===u)?r.createElement(d5,{location:n.location,revalidation:n.revalidation,component:m,error:c,children:g(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):g()}),null)}(v&&v.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:V4([m,o.encodeLocation?o.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?m:V4([m,o.encodeLocation?o.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,n,t);return f}function u5(){let e=function(){let e=r.useContext(a5),a=function(e){let a=r.useContext($4);return b4(a,h5(e)),a}("useRouteError"),n=p5("useRouteError");if(void 0!==e)return e;return a.errors?.[n]}(),a=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,t="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:t},o={padding:"2px 4px",backgroundColor:t},s=null;return s=r.createElement(r.Fragment,null,r.createElement("p",null,"💿 Hey developer 👋"),r.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",r.createElement("code",{style:o},"ErrorBoundary")," or"," ",r.createElement("code",{style:o},"errorElement")," prop on your route.")),r.createElement(r.Fragment,null,r.createElement("h2",null,"Unexpected Application Error!"),r.createElement("h3",{style:{fontStyle:"italic"}},a),n?r.createElement("pre",{style:i},n):null,s)}r.createContext(null);var c5=r.createElement(u5,null),d5=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,a){return a.location!==e.location||"idle"!==a.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){}render(){return void 0!==this.state.error?r.createElement(e5.Provider,{value:this.props.routeContext},r.createElement(a5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function m5({routeContext:e,match:a,children:n}){let t=r.useContext(Z4);return t&&t.static&&t.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(t.staticContext._deepestRenderedBoundaryId=a.route.id),r.createElement(e5.Provider,{value:e},n)}function h5(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function p5(e){let a=function(e){let a=r.useContext(e5);return b4(a,h5(e)),a}(e),n=a.matches[a.matches.length-1];return b4(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}var g5={};function v5(e,a,n){a||g5[e]||(g5[e]=!0,S4(!1,n))}function f5({basename:e,children:a,initialEntries:n,initialIndex:t}){let i=r.useRef();null==i.current&&(i.current=k4({initialEntries:n,initialIndex:t,v5Compat:!0}));let o=i.current,[s,l]=r.useState({action:o.action,location:o.location}),u=r.useCallback((e=>{r.startTransition((()=>l(e)))}),[l]);return r.useLayoutEffect((()=>o.listen(u)),[o,u]),r.createElement(y5,{basename:e,children:a,location:s.location,navigationType:s.action,navigator:o})}function y5({basename:e="/",children:a=null,location:n,navigationType:t="POP",navigator:i,static:o=!1}){b4(!n5(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=r.useMemo((()=>({basename:s,navigator:i,static:o,future:{}})),[s,i,o]);"string"==typeof n&&(n=C4(n));let{pathname:u="/",search:c="",hash:d="",state:m=null,key:h="default"}=n,p=r.useMemo((()=>{let e=H4(u,s);return null==e?null:{location:{pathname:e,search:c,hash:d,state:m,key:h},navigationType:t}}),[s,u,c,d,m,h,t]);return S4(null!=p,`<Router basename="${s}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),null==p?null:r.createElement(Q4.Provider,{value:l},r.createElement(X4.Provider,{children:a,value:p}))}r.memo((function({routes:e,future:a,state:n}){return l5(e,0,n,a)}));var k5="get",b5="application/x-www-form-urlencoded";function S5(e){return null!=e&&"string"==typeof e.tagName}function A5(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((a,n)=>{let t=e[n];return a.concat(Array.isArray(t)?t.map((e=>[n,e])):[[n,t]])}),[]))}var w5=null;var C5=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function M5(e){return null==e||C5.has(e)?e:(S4(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${b5}"`),null)}function T5(e,a){let n,t,i,r,o;if(function(e){return S5(e)&&"form"===e.tagName.toLowerCase()}(e)){let o=e.getAttribute("action");t=o?H4(o,a):null,n=e.getAttribute("method")||k5,i=M5(e.getAttribute("enctype"))||b5,r=new FormData(e)}else if(function(e){return S5(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return S5(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let o=e.form;if(null==o)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||o.getAttribute("action");if(t=s?H4(s,a):null,n=e.getAttribute("formmethod")||o.getAttribute("method")||k5,i=M5(e.getAttribute("formenctype"))||M5(o.getAttribute("enctype"))||b5,r=new FormData(o,e),!function(){if(null===w5)try{new FormData(document.createElement("form"),0),w5=!1}catch(uBe){w5=!0}return w5}()){let{name:a,type:n,value:t}=e;if("image"===n){let e=a?`${a}.`:"";r.append(`${e}x`,"0"),r.append(`${e}y`,"0")}else a&&r.append(a,t)}}else{if(S5(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=k5,t=null,i=b5,o=e}return r&&"text/plain"===i&&(o=r,r=void 0),{action:t,method:n.toLowerCase(),encType:i,formData:r,body:o}}function N5(e,a){if(!1===e||null==e)throw new Error(a)}function x5(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function E5(e,a,n){return function(e,a){let n=new Set;return new Set(a),e.reduce(((e,a)=>{let t=JSON.stringify(function(e){let a={},n=Object.keys(e).sort();for(let t of n)a[t]=e[t];return a}(a));return n.has(t)||(n.add(t),e.push({key:t,link:a})),e}),[])}((await Promise.all(e.map((async e=>{let t=a.routes[e.route.id];if(t){let e=await async function(e,a){if(e.id in a)return a[e.id];try{let n=await import(e.module);return a[e.id]=n,n}catch(n){return window.__reactRouterContext&&window,window.location.reload(),new Promise((()=>{}))}}(t,n);return e.links?e.links():[]}return[]})))).flat(1).filter(x5).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function P5(e,a,n,t,i,r){let o=(e,a)=>!n[a]||e.route.id!==n[a].route.id,s=(e,a)=>n[a].pathname!==e.pathname||n[a].route.path?.endsWith("*")&&n[a].params["*"]!==e.params["*"];return"assets"===r?a.filter(((e,a)=>o(e,a)||s(e,a))):"data"===r?a.filter(((a,r)=>{let l=t.routes[a.route.id];if(!l||!l.hasLoader)return!1;if(o(a,r)||s(a,r))return!0;if(a.route.shouldRevalidate){let t=a.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:a.params,defaultShouldRevalidate:!0});if("boolean"==typeof t)return t}return!0})):[]}function j5(e,a,{includeHydrateFallback:n}={}){return t=e.map((e=>{let t=a.routes[e.route.id];if(!t)return[];let i=[t.module];return t.clientActionModule&&(i=i.concat(t.clientActionModule)),t.clientLoaderModule&&(i=i.concat(t.clientLoaderModule)),n&&t.hydrateFallbackModule&&(i=i.concat(t.hydrateFallbackModule)),t.imports&&(i=i.concat(t.imports)),i})).flat(1),[...new Set(t)];var t}function L5(){let e=r.useContext(Z4);return N5(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}var B5=r.createContext(void 0);function z5(){let e=r.useContext(B5);return N5(e,"You must render this element inside a <HydratedRouter> element"),e}function R5(e,a){return n=>{e&&e(n),n.defaultPrevented||a(n)}}function _5({page:e,...a}){let{router:n}=L5(),t=r.useMemo((()=>M4(n.routes,e,n.basename)),[n.routes,e,n.basename]);return t?r.createElement(D5,{page:e,matches:t,...a}):null}function D5({page:e,matches:a,...n}){let t=t5(),{manifest:i,routeModules:o}=z5(),{basename:s}=L5(),{loaderData:l,matches:u}=function(){let e=r.useContext($4);return N5(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}(),c=r.useMemo((()=>P5(e,a,u,i,t,"data")),[e,a,u,i,t]),d=r.useMemo((()=>P5(e,a,u,i,t,"assets")),[e,a,u,i,t]),m=r.useMemo((()=>{if(e===t.pathname+t.search+t.hash)return[];let n=new Set,r=!1;if(a.forEach((e=>{let a=i.routes[e.route.id];a&&a.hasLoader&&(!c.some((a=>a.route.id===e.route.id))&&e.route.id in l&&o[e.route.id]?.shouldRevalidate||a.hasClientLoader?r=!0:n.add(e.route.id))})),0===n.size)return[];let u=function(e,a){let n="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return n.pathname="/"===n.pathname?"_root.data":a&&"/"===H4(n.pathname,a)?`${a.replace(/\/$/,"")}/_root.data`:`${n.pathname.replace(/\/$/,"")}.data`,n}(e,s);return r&&n.size>0&&u.searchParams.set("_routes",a.filter((e=>n.has(e.route.id))).map((e=>e.route.id)).join(",")),[u.pathname+u.search]}),[s,l,t,i,c,a,e,o]),h=r.useMemo((()=>j5(d,i)),[d,i]),p=function(e){let{manifest:a,routeModules:n}=z5(),[t,i]=r.useState([]);return r.useEffect((()=>{let t=!1;return E5(e,a,n).then((e=>{t||i(e)})),()=>{t=!0}}),[e,a,n]),t}(d);return r.createElement(r.Fragment,null,m.map((e=>r.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),h.map((e=>r.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),p.map((({key:e,link:a})=>r.createElement("link",{key:e,...a}))))}function K5(...e){return a=>{e.forEach((e=>{"function"==typeof e?e(a):null!=e&&(e.current=a)}))}}B5.displayName="FrameworkContext";var H5="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{H5&&(window.__reactRouterVersion="7.5.2")}catch(uBe){}var O5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,I5=r.forwardRef((function({onClick:e,discover:a="render",prefetch:n="none",relative:t,reloadDocument:i,replace:o,state:s,target:l,to:u,preventScrollReset:c,viewTransition:d,...m},h){let p,{basename:g}=r.useContext(Q4),v="string"==typeof u&&O5.test(u),f=!1;if("string"==typeof u&&v&&(p=u,H5))try{let e=new URL(window.location.href),a=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=H4(a.pathname,g);a.origin===e.origin&&null!=n?u=n+a.search+a.hash:f=!0}catch(uBe){S4(!1,`<Link to="${u}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let y=function(e,{relative:a}={}){b4(n5(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:t}=r.useContext(Q4),{hash:i,pathname:o,search:s}=s5(e,{relative:a}),l=o;return"/"!==n&&(l="/"===o?n:V4([n,o])),t.createHref({pathname:l,search:s,hash:i})}(u,{relative:t}),[k,b,S]=function(e,a){let n=r.useContext(B5),[t,i]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:m}=a,h=r.useRef(null);r.useEffect((()=>{if("render"===e&&s(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return h.current&&e.observe(h.current),()=>{e.disconnect()}}}),[e]),r.useEffect((()=>{if(t){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[t]);let p=()=>{i(!0)},g=()=>{i(!1),s(!1)};return n?"intent"!==e?[o,h,{}]:[o,h,{onFocus:R5(l,p),onBlur:R5(u,g),onMouseEnter:R5(c,p),onMouseLeave:R5(d,g),onTouchStart:R5(m,p)}]:[!1,h,{}]}(n,m),A=function(e,{target:a,replace:n,state:t,preventScrollReset:i,relative:o,viewTransition:s}={}){let l=o5(),u=t5(),c=s5(e,{relative:o});return r.useCallback((r=>{if(function(e,a){return!(0!==e.button||a&&"_self"!==a||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(r,a)){r.preventDefault();let a=void 0!==n?n:w4(u)===w4(c);l(e,{replace:a,state:t,preventScrollReset:i,relative:o,viewTransition:s})}}),[u,l,c,n,t,a,e,i,o,s])}(u,{replace:o,state:s,target:l,preventScrollReset:c,relative:t,viewTransition:d});let w=r.createElement("a",{...m,...S,href:p||y,onClick:f||i?e:function(a){e&&e(a),a.defaultPrevented||A(a)},ref:K5(h,b),target:l,"data-discover":v||"render"!==a?void 0:"true"});return k&&!v?r.createElement(r.Fragment,null,w,r.createElement(_5,{page:y})):w}));I5.displayName="Link",r.forwardRef((function({"aria-current":e="page",caseSensitive:a=!1,className:n="",end:t=!1,style:i,to:o,viewTransition:s,children:l,...u},c){let d=s5(o,{relative:u.relative}),m=t5(),h=r.useContext($4),{navigator:p,basename:g}=r.useContext(Q4),v=null!=h&&function(e,a={}){let n=r.useContext(Y4);b4(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:t}=V5("useViewTransitionState"),i=s5(e,{relative:a.relative});if(!n.isTransitioning)return!1;let o=H4(n.currentLocation.pathname,t)||n.currentLocation.pathname,s=H4(n.nextLocation.pathname,t)||n.nextLocation.pathname;return null!=D4(i.pathname,s)||null!=D4(i.pathname,o)}(d)&&!0===s,f=p.encodeLocation?p.encodeLocation(d).pathname:d.pathname,y=m.pathname,k=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;a||(y=y.toLowerCase(),k=k?k.toLowerCase():null,f=f.toLowerCase()),k&&g&&(k=H4(k,g)||k);const b="/"!==f&&f.endsWith("/")?f.length-1:f.length;let S,A=y===f||!t&&y.startsWith(f)&&"/"===y.charAt(b),w=null!=k&&(k===f||!t&&k.startsWith(f)&&"/"===k.charAt(f.length)),C={isActive:A,isPending:w,isTransitioning:v},M=A?e:void 0;S="function"==typeof n?n(C):[n,A?"active":null,w?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T="function"==typeof i?i(C):i;return r.createElement(I5,{...u,"aria-current":M,className:S,ref:c,style:T,to:o,viewTransition:s},"function"==typeof l?l(C):l)})).displayName="NavLink";var G5=r.forwardRef((({discover:e="render",fetcherKey:a,navigate:n,reloadDocument:t,replace:i,state:o,method:s=k5,action:l,onSubmit:u,relative:c,preventScrollReset:d,viewTransition:m,...h},p)=>{let g=function(){let{router:e}=V5("useSubmit"),{basename:a}=r.useContext(Q4),n=p5("useRouteId");return r.useCallback((async(t,i={})=>{let{action:r,method:o,encType:s,formData:l,body:u}=T5(t,a);if(!1===i.navigate){let a=i.fetcherKey||U5();await e.fetch(a,n,i.action||r,{preventScrollReset:i.preventScrollReset,formData:l,body:u,formMethod:i.method||o,formEncType:i.encType||s,flushSync:i.flushSync})}else await e.navigate(i.action||r,{preventScrollReset:i.preventScrollReset,formData:l,body:u,formMethod:i.method||o,formEncType:i.encType||s,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})}),[e,a,n])}(),v=function(e,{relative:a}={}){let{basename:n}=r.useContext(Q4),t=r.useContext(e5);b4(t,"useFormAction must be used inside a RouteContext");let[i]=t.matches.slice(-1),o={...s5(e||".",{relative:a})},s=t5();if(null==e){o.search=s.search;let e=new URLSearchParams(o.search),a=e.getAll("index");if(a.some((e=>""===e))){e.delete("index"),a.filter((e=>e)).forEach((a=>e.append("index",a)));let n=e.toString();o.search=n?`?${n}`:""}}e&&"."!==e||!i.route.index||(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(o.pathname="/"===o.pathname?n:V4([n,o.pathname]));return w4(o)}(l,{relative:c}),f="get"===s.toLowerCase()?"get":"post",y="string"==typeof l&&O5.test(l);return r.createElement("form",{ref:p,method:f,action:v,onSubmit:t?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,r=t?.getAttribute("formmethod")||s;g(t||e.currentTarget,{fetcherKey:a,method:r,navigate:n,replace:i,state:o,relative:c,preventScrollReset:d,viewTransition:m})},...h,"data-discover":y||"render"!==e?void 0:"true"})}));function V5(e){let a=r.useContext(Z4);return b4(a,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(e)),a}function F5(e){S4("undefined"!=typeof URLSearchParams,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let a=r.useRef(A5(e)),n=r.useRef(!1),t=t5(),i=r.useMemo((()=>function(e,a){let n=A5(e);return a&&a.forEach(((e,t)=>{n.has(t)||a.getAll(t).forEach((e=>{n.append(t,e)}))})),n}(t.search,n.current?null:a.current)),[t.search]),o=o5(),s=r.useCallback(((e,a)=>{const t=A5("function"==typeof e?e(i):e);n.current=!0,o("?"+t,a)}),[o,i]);return[i,s]}G5.displayName="Form";var J5=0,U5=()=>`__${String(++J5)}__`;new TextEncoder;var W5,q5="dismissableLayer.update",Z5="dismissableLayer.pointerDownOutside",$5="dismissableLayer.focusOutside",Y5=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Q5=r.forwardRef(((e,a)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:u,...c}=e,d=r.useContext(Y5),[m,h]=r.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=r.useState({}),v=tO(a,(e=>h(e))),f=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=f.indexOf(y),b=m?f.indexOf(m):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,A=b>=k,w=function(e,a=globalThis?.document){const n=nX(e),t=r.useRef(!1),i=r.useRef((()=>{}));return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){let t=function(){e6(Z5,n,r,{discrete:!0})};const r={originalEvent:e};"touch"===e.pointerType?(a.removeEventListener("click",i.current),i.current=t,a.addEventListener("click",i.current,{once:!0})):t()}else a.removeEventListener("click",i.current);t.current=!1},r=window.setTimeout((()=>{a.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),a.removeEventListener("pointerdown",e),a.removeEventListener("click",i.current)}}),[a,n]),{onPointerDownCapture:()=>t.current=!0}}((e=>{const a=e.target,n=[...d.branches].some((e=>e.contains(a)));A&&!n&&(o?.(e),l?.(e),e.defaultPrevented||u?.())}),p),C=function(e,a=globalThis?.document){const n=nX(e),t=r.useRef(!1);return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){e6($5,n,{originalEvent:e},{discrete:!1})}};return a.addEventListener("focusin",e),()=>a.removeEventListener("focusin",e)}),[a,n]),{onFocusCapture:()=>t.current=!0,onBlurCapture:()=>t.current=!1}}((e=>{const a=e.target;[...d.branches].some((e=>e.contains(a)))||(s?.(e),l?.(e),e.defaultPrevented||u?.())}),p);return pX((e=>{b===d.layers.size-1&&(i?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))}),p),r.useEffect((()=>{if(m)return t&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(W5=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),X5(),()=>{t&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=W5)}}),[m,p,t,d]),r.useEffect((()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),X5())}),[m,d]),r.useEffect((()=>{const e=()=>g({});return document.addEventListener(q5,e),()=>document.removeEventListener(q5,e)}),[]),n.jsx(uX.div,{...c,ref:v,style:{pointerEvents:S?A?"auto":"none":void 0,...e.style},onFocusCapture:XQ(e.onFocusCapture,C.onFocusCapture),onBlurCapture:XQ(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:XQ(e.onPointerDownCapture,w.onPointerDownCapture)})}));Q5.displayName="DismissableLayer";function X5(){const e=new CustomEvent(q5);document.dispatchEvent(e)}function e6(e,a,n,{discrete:t}){const i=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});a&&i.addEventListener(e,a,{once:!0}),t?cX(i,r):i.dispatchEvent(r)}r.forwardRef(((e,a)=>{const t=r.useContext(Y5),i=r.useRef(null),o=tO(a,i);return r.useEffect((()=>{const e=i.current;if(e)return t.branches.add(e),()=>{t.branches.delete(e)}}),[t.branches]),n.jsx(uX.div,{...e,ref:o})})).displayName="DismissableLayerBranch";var a6=r.forwardRef(((e,a)=>n.jsx(uX.span,{...e,ref:a,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}})));a6.displayName="VisuallyHidden";var n6=a6,[t6,i6]=eX("Tooltip",[k1]),r6=k1(),o6="TooltipProvider",s6=700,l6="tooltip.open",[u6,c6]=t6(o6),d6=e=>{const{__scopeTooltip:a,delayDuration:t=s6,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:s}=e,[l,u]=r.useState(!0),c=r.useRef(!1),d=r.useRef(0);return r.useEffect((()=>{const e=d.current;return()=>window.clearTimeout(e)}),[]),n.jsx(u6,{scope:a,isOpenDelayed:l,delayDuration:t,onOpen:r.useCallback((()=>{window.clearTimeout(d.current),u(!1)}),[]),onClose:r.useCallback((()=>{window.clearTimeout(d.current),d.current=window.setTimeout((()=>u(!0)),i)}),[i]),isPointerInTransitRef:c,onPointerInTransitChange:r.useCallback((e=>{c.current=e}),[]),disableHoverableContent:o,children:s})};d6.displayName=o6;var m6="Tooltip",[h6,p6]=t6(m6),g6=e=>{const{__scopeTooltip:a,children:t,open:i,defaultOpen:o=!1,onOpenChange:s,disableHoverableContent:l,delayDuration:u}=e,c=c6(m6,e.__scopeTooltip),d=r6(a),[m,h]=r.useState(null),p=HX(),g=r.useRef(0),v=l??c.disableHoverableContent,f=u??c.delayDuration,y=r.useRef(!1),[k=!1,b]=tX({prop:i,defaultProp:o,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(l6))):c.onClose(),s?.(e)}}),S=r.useMemo((()=>k?y.current?"delayed-open":"instant-open":"closed"),[k]),A=r.useCallback((()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,b(!0)}),[b]),w=r.useCallback((()=>{window.clearTimeout(g.current),g.current=0,b(!1)}),[b]),C=r.useCallback((()=>{window.clearTimeout(g.current),g.current=window.setTimeout((()=>{y.current=!0,b(!0),g.current=0}),f)}),[f,b]);return r.useEffect((()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)}),[]),n.jsx(R1,{...d,children:n.jsx(h6,{scope:a,contentId:p,open:k,stateAttribute:S,trigger:m,onTriggerChange:h,onTriggerEnter:r.useCallback((()=>{c.isOpenDelayed?C():A()}),[c.isOpenDelayed,C,A]),onTriggerLeave:r.useCallback((()=>{v?w():(window.clearTimeout(g.current),g.current=0)}),[w,v]),onOpen:A,onClose:w,disableHoverableContent:v,children:t})})};g6.displayName=m6;var v6="TooltipTrigger",f6=r.forwardRef(((e,a)=>{const{__scopeTooltip:t,...i}=e,o=p6(v6,t),s=c6(v6,t),l=r6(t),u=tO(a,r.useRef(null),o.onTriggerChange),c=r.useRef(!1),d=r.useRef(!1),m=r.useCallback((()=>c.current=!1),[]);return r.useEffect((()=>()=>document.removeEventListener("pointerup",m)),[m]),n.jsx(_1,{asChild:!0,...l,children:n.jsx(uX.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:u,onPointerMove:XQ(e.onPointerMove,(e=>{"touch"!==e.pointerType&&(d.current||s.isPointerInTransitRef.current||(o.onTriggerEnter(),d.current=!0))})),onPointerLeave:XQ(e.onPointerLeave,(()=>{o.onTriggerLeave(),d.current=!1})),onPointerDown:XQ(e.onPointerDown,(()=>{c.current=!0,document.addEventListener("pointerup",m,{once:!0})})),onFocus:XQ(e.onFocus,(()=>{c.current||o.onOpen()})),onBlur:XQ(e.onBlur,o.onClose),onClick:XQ(e.onClick,o.onClose)})})}));f6.displayName=v6;var y6="TooltipPortal",[k6,b6]=t6(y6,{forceMount:void 0}),S6=e=>{const{__scopeTooltip:a,forceMount:t,children:i,container:r}=e,o=p6(y6,a);return n.jsx(k6,{scope:a,forceMount:t,children:n.jsx(O1,{present:t||o.open,children:n.jsx(H1,{asChild:!0,container:r,children:i})})})};S6.displayName=y6;var A6="TooltipContent",w6=r.forwardRef(((e,a)=>{const t=b6(A6,e.__scopeTooltip),{forceMount:i=t.forceMount,side:r="top",...o}=e,s=p6(A6,e.__scopeTooltip);return n.jsx(O1,{present:i||s.open,children:n.jsx(s.disableHoverableContent?N6:C6,{side:r,...o,ref:a})})})),C6=r.forwardRef(((e,a)=>{const t=p6(A6,e.__scopeTooltip),i=c6(A6,e.__scopeTooltip),o=r.useRef(null),s=tO(a,o),[l,u]=r.useState(null),{trigger:c,onClose:d}=t,m=o.current,{onPointerInTransitChange:h}=i,p=r.useCallback((()=>{u(null),h(!1)}),[h]),g=r.useCallback(((e,a)=>{const n={x:e.clientX,y:e.clientY},t=function(e,a,n=5){const t=[];switch(a){case"top":t.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":t.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":t.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":t.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return t}(n,function(e,a){const n=Math.abs(a.top-e.y),t=Math.abs(a.bottom-e.y),i=Math.abs(a.right-e.x),r=Math.abs(a.left-e.x);switch(Math.min(n,t,i,r)){case r:return"left";case i:return"right";case n:return"top";case t:return"bottom";default:throw new Error("unreachable")}}(n,e.currentTarget.getBoundingClientRect())),i=function(e){const a=e.slice();return a.sort(((e,a)=>e.x<a.x?-1:e.x>a.x?1:e.y<a.y?-1:e.y>a.y?1:0)),function(e){if(e.length<=1)return e.slice();const a=[];for(let t=0;t<e.length;t++){const n=e[t];for(;a.length>=2;){const e=a[a.length-1],t=a[a.length-2];if(!((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x)))break;a.pop()}a.push(n)}a.pop();const n=[];for(let t=e.length-1;t>=0;t--){const a=e[t];for(;n.length>=2;){const e=n[n.length-1],t=n[n.length-2];if(!((e.x-t.x)*(a.y-t.y)>=(e.y-t.y)*(a.x-t.x)))break;n.pop()}n.push(a)}return n.pop(),1===a.length&&1===n.length&&a[0].x===n[0].x&&a[0].y===n[0].y?a:a.concat(n)}(a)}([...t,...function(e){const{top:a,right:n,bottom:t,left:i}=e;return[{x:i,y:a},{x:n,y:a},{x:n,y:t},{x:i,y:t}]}(a.getBoundingClientRect())]);u(i),h(!0)}),[h]);return r.useEffect((()=>()=>p()),[p]),r.useEffect((()=>{if(c&&m){const e=e=>g(e,m),a=e=>g(e,c);return c.addEventListener("pointerleave",e),m.addEventListener("pointerleave",a),()=>{c.removeEventListener("pointerleave",e),m.removeEventListener("pointerleave",a)}}}),[c,m,g,p]),r.useEffect((()=>{if(l){const e=e=>{const a=e.target,n={x:e.clientX,y:e.clientY},t=c?.contains(a)||m?.contains(a),i=!function(e,a){const{x:n,y:t}=e;let i=!1;for(let r=0,o=a.length-1;r<a.length;o=r++){const e=a[r].x,s=a[r].y,l=a[o].y;s>t!=l>t&&n<(a[o].x-e)*(t-s)/(l-s)+e&&(i=!i)}return i}(n,l);t?p():i&&(p(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[c,m,l,d,p]),n.jsx(N6,{...e,ref:s})})),[M6,T6]=t6(m6,{isInside:!1}),N6=r.forwardRef(((e,a)=>{const{__scopeTooltip:t,children:i,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:l,...u}=e,c=p6(A6,t),d=r6(t),{onClose:m}=c;return r.useEffect((()=>(document.addEventListener(l6,m),()=>document.removeEventListener(l6,m))),[m]),r.useEffect((()=>{if(c.trigger){const e=e=>{const a=e.target;a?.contains(c.trigger)&&m()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[c.trigger,m]),n.jsx(Q5,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:m,children:n.jsxs(D1,{"data-state":c.stateAttribute,...d,...u,ref:a,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[n.jsx(oX,{children:i}),n.jsx(M6,{scope:t,isInside:!0,children:n.jsx(n6,{id:c.contentId,role:"tooltip",children:o||i})})]})})}));w6.displayName=A6;var x6="TooltipArrow";r.forwardRef(((e,a)=>{const{__scopeTooltip:t,...i}=e,r=r6(t);return T6(x6,t).isInside?null:n.jsx(K1,{...r,...i,ref:a})})).displayName=x6;var E6=S6,P6=w6;const j6=d6,L6=g6,B6=f6,z6=r.forwardRef((({className:e,sideOffset:a=4,...t},i)=>n.jsx(E6,{children:n.jsx(P6,{ref:i,sideOffset:a,className:im("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})})));z6.displayName=P6.displayName;const R6=({rowOriginal:e,constructNavigationUrl:a,cellText:t,cellIcon:i=null,tooltipIcon:r=null,tooltipText:o=null})=>{const s=o5();return o?n.jsx(j6,{children:n.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:n.jsxs(L6,{children:[n.jsx(B6,{asChild:!0,children:n.jsxs(jY,{variant:"outline",onClick:()=>s(a(e.id)),children:[i,t,r]})}),n.jsx(z6,{className:"max-w-[300px] text-sm bg-white border border-gray-200 rounded-lg p-4",children:n.jsx("p",{className:"text-muted-foreground",children:o})})]})})}):n.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:n.jsxs(jY,{variant:"outline",onClick:()=>s(a(e.id)),children:[i,t,r]})})};var _6,D6="dismissableLayer.update",K6="dismissableLayer.pointerDownOutside",H6="dismissableLayer.focusOutside",O6=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),I6=r.forwardRef(((e,a)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:u,...c}=e,d=r.useContext(O6),[m,h]=r.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=r.useState({}),v=tO(a,(e=>h(e))),f=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=f.indexOf(y),b=m?f.indexOf(m):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,A=b>=k,w=function(e,a=globalThis?.document){const n=nX(e),t=r.useRef(!1),i=r.useRef((()=>{}));return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){let t=function(){V6(K6,n,r,{discrete:!0})};const r={originalEvent:e};"touch"===e.pointerType?(a.removeEventListener("click",i.current),i.current=t,a.addEventListener("click",i.current,{once:!0})):t()}else a.removeEventListener("click",i.current);t.current=!1},r=window.setTimeout((()=>{a.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),a.removeEventListener("pointerdown",e),a.removeEventListener("click",i.current)}}),[a,n]),{onPointerDownCapture:()=>t.current=!0}}((e=>{const a=e.target,n=[...d.branches].some((e=>e.contains(a)));A&&!n&&(o?.(e),l?.(e),e.defaultPrevented||u?.())}),p),C=function(e,a=globalThis?.document){const n=nX(e),t=r.useRef(!1);return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){V6(H6,n,{originalEvent:e},{discrete:!1})}};return a.addEventListener("focusin",e),()=>a.removeEventListener("focusin",e)}),[a,n]),{onFocusCapture:()=>t.current=!0,onBlurCapture:()=>t.current=!1}}((e=>{const a=e.target;[...d.branches].some((e=>e.contains(a)))||(s?.(e),l?.(e),e.defaultPrevented||u?.())}),p);return pX((e=>{b===d.layers.size-1&&(i?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))}),p),r.useEffect((()=>{if(m)return t&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(_6=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),G6(),()=>{t&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=_6)}}),[m,p,t,d]),r.useEffect((()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),G6())}),[m,d]),r.useEffect((()=>{const e=()=>g({});return document.addEventListener(D6,e),()=>document.removeEventListener(D6,e)}),[]),n.jsx(uX.div,{...c,ref:v,style:{pointerEvents:S?A?"auto":"none":void 0,...e.style},onFocusCapture:XQ(e.onFocusCapture,C.onFocusCapture),onBlurCapture:XQ(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:XQ(e.onPointerDownCapture,w.onPointerDownCapture)})}));I6.displayName="DismissableLayer";function G6(){const e=new CustomEvent(D6);document.dispatchEvent(e)}function V6(e,a,n,{discrete:t}){const i=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});a&&i.addEventListener(e,a,{once:!0}),t?cX(i,r):i.dispatchEvent(r)}r.forwardRef(((e,a)=>{const t=r.useContext(O6),i=r.useRef(null),o=tO(a,i);return r.useEffect((()=>{const e=i.current;if(e)return t.branches.add(e),()=>{t.branches.delete(e)}}),[t.branches]),n.jsx(uX.div,{...e,ref:o})})).displayName="DismissableLayerBranch";var F6="Popover",[J6,U6]=eX(F6,[k1]),W6=k1(),[q6,Z6]=J6(F6),$6=e=>{const{__scopePopover:a,children:t,open:i,defaultOpen:o,onOpenChange:s,modal:l=!1}=e,u=W6(a),c=r.useRef(null),[d,m]=r.useState(!1),[h=!1,p]=tX({prop:i,defaultProp:o,onChange:s});return n.jsx(R1,{...u,children:n.jsx(q6,{scope:a,contentId:HX(),triggerRef:c,open:h,onOpenChange:p,onOpenToggle:r.useCallback((()=>p((e=>!e))),[p]),hasCustomAnchor:d,onCustomAnchorAdd:r.useCallback((()=>m(!0)),[]),onCustomAnchorRemove:r.useCallback((()=>m(!1)),[]),modal:l,children:t})})};$6.displayName=F6;var Y6="PopoverAnchor";r.forwardRef(((e,a)=>{const{__scopePopover:t,...i}=e,o=Z6(Y6,t),s=W6(t),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=o;return r.useEffect((()=>(l(),()=>u())),[l,u]),n.jsx(_1,{...s,...i,ref:a})})).displayName=Y6;var Q6="PopoverTrigger",X6=r.forwardRef(((e,a)=>{const{__scopePopover:t,...i}=e,r=Z6(Q6,t),o=W6(t),s=tO(a,r.triggerRef),l=n.jsx(uX.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":c9(r.open),...i,ref:s,onClick:XQ(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?l:n.jsx(_1,{asChild:!0,...o,children:l})}));X6.displayName=Q6;var e9="PopoverPortal",[a9,n9]=J6(e9,{forceMount:void 0}),t9=e=>{const{__scopePopover:a,forceMount:t,children:i,container:r}=e,o=Z6(e9,a);return n.jsx(a9,{scope:a,forceMount:t,children:n.jsx(O1,{present:t||o.open,children:n.jsx(H1,{asChild:!0,container:r,children:i})})})};t9.displayName=e9;var i9="PopoverContent",r9=r.forwardRef(((e,a)=>{const t=n9(i9,e.__scopePopover),{forceMount:i=t.forceMount,...r}=e,o=Z6(i9,e.__scopePopover);return n.jsx(O1,{present:i||o.open,children:n.jsx(o.modal?o9:s9,{...r,ref:a})})}));r9.displayName=i9;var o9=r.forwardRef(((e,a)=>{const t=Z6(i9,e.__scopePopover),i=r.useRef(null),o=tO(a,i),s=r.useRef(!1);return r.useEffect((()=>{const e=i.current;if(e)return JI(e)}),[]),n.jsx(KI,{as:iX,allowPinchZoom:!0,children:n.jsx(l9,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:XQ(e.onCloseAutoFocus,(e=>{e.preventDefault(),s.current||t.triggerRef.current?.focus()})),onPointerDownOutside:XQ(e.onPointerDownOutside,(e=>{const a=e.detail.originalEvent;s.current=2===a.button||0===a.button&&!0===a.ctrlKey}),{checkForDefaultPrevented:!1}),onFocusOutside:XQ(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})})})})),s9=r.forwardRef(((e,a)=>{const t=Z6(i9,e.__scopePopover),i=r.useRef(!1),o=r.useRef(!1);return n.jsx(l9,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(i.current||t.triggerRef.current?.focus(),a.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(i.current=!0,"pointerdown"===a.detail.originalEvent.type&&(o.current=!0));const n=a.target,r=t.triggerRef.current?.contains(n);r&&a.preventDefault(),"focusin"===a.detail.originalEvent.type&&o.current&&a.preventDefault()}})})),l9=r.forwardRef(((e,a)=>{const{__scopePopover:t,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:c,onInteractOutside:d,...m}=e,h=Z6(i9,t),p=W6(t);return CX(),n.jsx(EX,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:o,children:n.jsx(I6,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:n.jsx(D1,{"data-state":c9(h.open),role:"dialog",id:h.contentId,...p,...m,ref:a,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})})),u9="PopoverClose";r.forwardRef(((e,a)=>{const{__scopePopover:t,...i}=e,r=Z6(u9,t);return n.jsx(uX.button,{type:"button",...i,ref:a,onClick:XQ(e.onClick,(()=>r.onOpenChange(!1)))})})).displayName=u9;function c9(e){return e?"open":"closed"}r.forwardRef(((e,a)=>{const{__scopePopover:t,...i}=e,r=W6(t);return n.jsx(K1,{...r,...i,ref:a})})).displayName="PopoverArrow";var d9=t9,m9=r9;const h9=$6,p9=X6,g9=a.forwardRef((({className:e,align:a="center",sideOffset:t=4,...i},r)=>n.jsx(d9,{children:n.jsx(m9,{ref:r,align:a,sideOffset:t,className:im("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})})));g9.displayName=m9.displayName;const v9={[Xe.DRAFT]:"Draft",[Xe.ACTIVE]:"Active",[Xe.RUNNING]:"Running",[Xe.COMPLETED]:"Completed",[Xe.FAILED]:"Failed",[Xe.DEACTIVATED]:"Deactivated"},f9={[Xe.DRAFT]:"bg-gray-500",[Xe.ACTIVE]:"bg-blue-500",[Xe.RUNNING]:"bg-yellow-500",[Xe.COMPLETED]:"bg-green-500",[Xe.FAILED]:"bg-red-500",[Xe.DEACTIVATED]:"bg-red-500"},y9={[Xe.DRAFT]:"bg-gray-100 text-gray-700 px-2 py-1",[Xe.ACTIVE]:"bg-blue-100 text-blue-700 px-2 py-1",[Xe.RUNNING]:"bg-yellow-100 text-yellow-700 px-2 py-1",[Xe.COMPLETED]:"bg-green-100 text-green-700 px-2 py-1",[Xe.FAILED]:"bg-red-100 text-red-700 px-2 py-1",[Xe.DEACTIVATED]:"bg-red-100 text-red-700 px-2 py-1"},k9={[Xe.DRAFT]:`Draft ${yh("engage:automation")?.toLowerCase()} can be activated or deactivated`,[Xe.ACTIVE]:`Active ${yh("engage:automation")?.toLowerCase()} can be drafted, deactivated, run, or marked as failed`,[Xe.RUNNING]:`Running ${yh("engage:automation")?.toLowerCase()} can be completed or marked as failed`,[Xe.COMPLETED]:`Completed ${yh("engage:automation")?.toLowerCase()} can only be marked as failed`,[Xe.FAILED]:`Failed ${yh("engage:automation")?.toLowerCase()} requires manual intervention to change state`,[Xe.DEACTIVATED]:`Deactivated ${yh("engage:automation")?.toLowerCase()} cannot be reactivated - create a new one instead`},b9={[Xe.DRAFT]:[Xe.ACTIVE,Xe.DEACTIVATED],[Xe.ACTIVE]:[Xe.DRAFT],[Xe.RUNNING]:[],[Xe.COMPLETED]:[],[Xe.FAILED]:[],[Xe.DEACTIVATED]:[]},S9=({rowOriginal:e,id:t,onToggle:i,className:r="",vsaasManaged:o=!1})=>{const[s,l]=a.useState(!1),u=e.status,c=(b9[u]||[]).filter((e=>!1===o||e!==Xe.DEACTIVATED)),d=c.length>0;return n.jsx("div",{className:`${r}`,onClick:e=>e.stopPropagation(),children:n.jsx(j6,{children:n.jsxs(h9,{open:!!d&&s,onOpenChange:l,children:[n.jsx(p9,{asChild:!0,children:n.jsx("div",{className:"relative",children:n.jsxs(jY,{variant:"outline",className:`flex items-center justify-between px-4 py-2 rounded-md w-full ${y9[u]} ${d?"":"cursor-not-allowed opacity-80"}`,onClick:e=>{e.stopPropagation(),d&&l(!s)},children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${f9[u]}`}),n.jsx("span",{children:v9[u]})]}),d?n.jsx(yc,{className:"h-4 w-4 ml-2"}):n.jsxs(L6,{children:[n.jsx(B6,{asChild:!0,children:n.jsx(zc,{className:"h-4 w-4 ml-2 text-gray-500"})}),n.jsx(z6,{className:"max-w-xs p-2",children:n.jsx("p",{children:k9[u]})})]})]})})}),d&&n.jsx(g9,{className:"w-full p-2",align:"center",sideOffset:5,children:n.jsx("div",{className:"py-1 flex flex-col gap-2 justify-start items-center",onClick:e=>e.stopPropagation(),children:c.map((e=>n.jsxs(jY,{variant:"ghost",className:"flex justify-start items-center px-4 py-2 text-sm w-full text-left hover:bg-gray-100 rounded-none "+(u===e?"font-medium":""),onClick:()=>(i(t,e),void l(!1)),children:[n.jsx("div",{className:`w-2 h-2 rounded-full ${f9[e]} mr-2`}),v9[e]]},e)))})})]})})})},{Context:A9,Provider:w9}=hm(((e,a)=>"SET_SELECTED_CHANNELS"===a.type?{...e,selectedChannels:a.payload}:e),{setSelectedChannels:e=>a=>{e({type:"SET_SELECTED_CHANNELS",payload:a})}},{selectedChannels:[]},[]),C9={all:["channel-accounts"]},M9=()=>{const e=ye({queryKey:C9.all,queryFn:()=>(async()=>(await Pe("/channel/accounts",{method:"GET"})).data)()});return{channelAccounts:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelAccounts:e.refetch}};var T9=(e=>(e.REACH_MANAGED="reach-managed",e.TWILLIO="twillio",e))(T9||{});const N9={all:["channel-senders"]},x9=()=>{const e=ye({queryKey:N9.all,queryFn:()=>(async()=>{let e=[],a=null,n=!0;do{const t=a?`${c}?cursor=${encodeURIComponent(a)}`:`${c}`,i=(await Pe(t,{method:"GET"})).data;e=e.concat(i.results),n=i.pagination?.hasNextPage??!1,a=i.pagination?.cursor??null}while(n&&a);return{results:e}})()});return{channelSenders:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelSenders:e.refetch}},E9=()=>{const e=ce(),a=ke({mutationFn:e=>(async(e,a)=>(await Pe(`${c}/${a}`,{method:"PATCH",body:JSON.stringify(e)})).data)(e.toUpdate,e.id),onSuccess:()=>{e.invalidateQueries({queryKey:N9.all})}});return{updateChannelSender:a.mutate,isUpdating:a.isPending,updateError:a.error}},P9={all:["sms-registration-application"]},j9=async()=>(await Pe(`${h}/`)).data,L9=()=>({...ye({queryKey:P9.all,queryFn:j9,...we})}),B9=()=>{const e=ce(),a=ke({mutationFn:e=>(async e=>(await Pe(`${h}/`,{method:"POST",body:JSON.stringify({application:e.application})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:P9.all}),e.invalidateQueries({queryKey:N9.all}),e.invalidateQueries({queryKey:C9.all})}});return{createSmsRegistrationApplication:a.mutate,isCreating:a.isPending,createError:a.error,isCreateSuccess:a.isSuccess}};var z9,R9,_9;(R9=z9||(z9={})).assertEqual=e=>e,R9.assertIs=function(e){},R9.assertNever=function(e){throw new Error},R9.arrayToEnum=e=>{const a={};for(const n of e)a[n]=n;return a},R9.getValidEnumValues=e=>{const a=R9.objectKeys(e).filter((a=>"number"!=typeof e[e[a]])),n={};for(const t of a)n[t]=e[t];return R9.objectValues(n)},R9.objectValues=e=>R9.objectKeys(e).map((function(a){return e[a]})),R9.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const a=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&a.push(n);return a},R9.find=(e,a)=>{for(const n of e)if(a(n))return n},R9.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,R9.joinValues=function(e,a=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(a)},R9.jsonStringifyReplacer=(e,a)=>"bigint"==typeof a?a.toString():a,(_9||(_9={})).mergeShapes=(e,a)=>({...e,...a});const D9=z9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),K9=e=>{switch(typeof e){case"undefined":return D9.undefined;case"string":return D9.string;case"number":return isNaN(e)?D9.nan:D9.number;case"boolean":return D9.boolean;case"function":return D9.function;case"bigint":return D9.bigint;case"symbol":return D9.symbol;case"object":return Array.isArray(e)?D9.array:null===e?D9.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?D9.promise:"undefined"!=typeof Map&&e instanceof Map?D9.map:"undefined"!=typeof Set&&e instanceof Set?D9.set:"undefined"!=typeof Date&&e instanceof Date?D9.date:D9.object;default:return D9.unknown}},H9=z9.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class O9 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(e){return e.message},n={_errors:[]},t=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(t);else if("invalid_return_type"===i.code)t(i.returnTypeError);else if("invalid_arguments"===i.code)t(i.argumentsError);else if(0===i.path.length)n._errors.push(a(i));else{let e=n,t=0;for(;t<i.path.length;){const n=i.path[t];t===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(a(i))):e[n]=e[n]||{_errors:[]},e=e[n],t++}}};return t(this),n}static assert(e){if(!(e instanceof O9))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z9.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const a={},n=[];for(const t of this.issues)t.path.length>0?(a[t.path[0]]=a[t.path[0]]||[],a[t.path[0]].push(e(t))):n.push(e(t));return{formErrors:n,fieldErrors:a}}get formErrors(){return this.flatten()}}O9.create=e=>new O9(e);const I9=(e,a)=>{let n;switch(e.code){case H9.invalid_type:n=e.received===D9.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case H9.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,z9.jsonStringifyReplacer)}`;break;case H9.unrecognized_keys:n=`Unrecognized key(s) in object: ${z9.joinValues(e.keys,", ")}`;break;case H9.invalid_union:n="Invalid input";break;case H9.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${z9.joinValues(e.options)}`;break;case H9.invalid_enum_value:n=`Invalid enum value. Expected ${z9.joinValues(e.options)}, received '${e.received}'`;break;case H9.invalid_arguments:n="Invalid function arguments";break;case H9.invalid_return_type:n="Invalid function return type";break;case H9.invalid_date:n="Invalid date";break;case H9.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:z9.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case H9.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case H9.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case H9.custom:n="Invalid input";break;case H9.invalid_intersection_types:n="Intersection results could not be merged";break;case H9.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case H9.not_finite:n="Number must be finite";break;default:n=a.defaultError,z9.assertNever(e)}return{message:n}};let G9=I9;function V9(){return G9}const F9=e=>{const{data:a,path:n,errorMaps:t,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const l=t.filter((e=>!!e)).slice().reverse();for(const u of l)s=u(o,{data:a,defaultError:s}).message;return{...i,path:r,message:s}};function J9(e,a){const n=V9(),t=F9({issueData:a,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===I9?void 0:I9].filter((e=>!!e))});e.common.issues.push(t)}class U9{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,a){const n=[];for(const t of a){if("aborted"===t.status)return W9;"dirty"===t.status&&e.dirty(),n.push(t.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,a){const n=[];for(const t of a){const e=await t.key,a=await t.value;n.push({key:e,value:a})}return U9.mergeObjectSync(e,n)}static mergeObjectSync(e,a){const n={};for(const t of a){const{key:a,value:i}=t;if("aborted"===a.status)return W9;if("aborted"===i.status)return W9;"dirty"===a.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===a.value||void 0===i.value&&!t.alwaysSet||(n[a.value]=i.value)}return{status:e.value,value:n}}}const W9=Object.freeze({status:"aborted"}),q9=e=>({status:"dirty",value:e}),Z9=e=>({status:"valid",value:e}),$9=e=>"aborted"===e.status,Y9=e=>"dirty"===e.status,Q9=e=>"valid"===e.status,X9=e=>"undefined"!=typeof Promise&&e instanceof Promise;function e8(e,a,n,t){if("function"==typeof a||!a.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a.get(e)}function a8(e,a,n,t,i){if("function"==typeof a||!a.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a.set(e,n),n}var n8,t8,i8,r8;"function"==typeof SuppressedError&&SuppressedError,(t8=n8||(n8={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},t8.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class o8{constructor(e,a,n,t){this._cachedPath=[],this.parent=e,this.data=a,this._path=n,this._key=t}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const s8=(e,a)=>{if(Q9(a))return{success:!0,data:a.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new O9(e.common.issues);return this._error=a,this._error}}};function l8(e){if(!e)return{};const{errorMap:a,invalid_type_error:n,required_error:t,description:i}=e;if(a&&(n||t))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(a)return{errorMap:a,description:i};return{errorMap:(a,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===a.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:t)&&void 0!==r?r:i.defaultError}:"invalid_type"!==a.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class u8{get description(){return this._def.description}_getType(e){return K9(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:K9(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new U9,ctx:{common:e.parent.common,data:e.data,parsedType:K9(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(X9(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const n=this.safeParse(e,a);if(n.success)return n.data;throw n.error}safeParse(e,a){var n;const t={common:{issues:[],async:null!==(n=null==a?void 0:a.async)&&void 0!==n&&n,contextualErrorMap:null==a?void 0:a.errorMap},path:(null==a?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K9(e)},i=this._parseSync({data:e,path:t.path,parent:t});return s8(t,i)}"~validate"(e){var a,n;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K9(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Q9(a)?{value:a.value}:{issues:t.common.issues}}catch(cBe){(null===(n=null===(a=null==cBe?void 0:cBe.message)||void 0===a?void 0:a.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>Q9(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,a){const n=await this.safeParseAsync(e,a);if(n.success)return n.data;throw n.error}async safeParseAsync(e,a){const n={common:{issues:[],contextualErrorMap:null==a?void 0:a.errorMap,async:!0},path:(null==a?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K9(e)},t=this._parse({data:e,path:n.path,parent:n}),i=await(X9(t)?t:Promise.resolve(t));return s8(n,i)}refine(e,a){const n=e=>"string"==typeof a||void 0===a?{message:a}:"function"==typeof a?a(e):a;return this._refinement(((a,t)=>{const i=e(a),r=()=>t.addIssue({code:H9.custom,...n(a)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,a){return this._refinement(((n,t)=>!!e(n)||(t.addIssue("function"==typeof a?a(n,t):a),!1)))}_refinement(e){return new u7({schema:this,typeName:A7.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return c7.create(this,this._def)}nullable(){return d7.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F8.create(this)}promise(){return l7.create(this,this._def)}or(e){return W8.create([this,e],this._def)}and(e){return Y8.create(this,e,this._def)}transform(e){return new u7({...l8(this._def),schema:this,typeName:A7.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a="function"==typeof e?e:()=>e;return new m7({...l8(this._def),innerType:this,defaultValue:a,typeName:A7.ZodDefault})}brand(){return new v7({typeName:A7.ZodBranded,type:this,...l8(this._def)})}catch(e){const a="function"==typeof e?e:()=>e;return new h7({...l8(this._def),innerType:this,catchValue:a,typeName:A7.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return f7.create(this,e)}readonly(){return y7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const c8=/^c[^\s-]{8,}$/i,d8=/^[0-9a-z]+$/,m8=/^[0-9A-HJKMNP-TV-Z]{26}$/i,h8=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,p8=/^[a-z0-9_-]{21}$/i,g8=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,v8=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,f8=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let y8;const k8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,b8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,S8=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,A8=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,w8=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,C8=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,M8="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",T8=new RegExp(`^${M8}$`);function N8(e){let a="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?a=`${a}\\.\\d{${e.precision}}`:null==e.precision&&(a=`${a}(\\.\\d+)?`),a}function x8(e){let a=`${M8}T${N8(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${n.join("|")})`,new RegExp(`^${a}$`)}function E8(e,a){if(!g8.test(e))return!1;try{const[n]=e.split("."),t=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(t));return"object"==typeof i&&null!==i&&(!(!i.typ||!i.alg)&&(!a||i.alg===a))}catch(dBe){return!1}}function P8(e,a){return!("v4"!==a&&a||!b8.test(e))||!("v6"!==a&&a||!A8.test(e))}class j8 extends u8{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==D9.string){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.string,received:a.parsedType}),W9}const a=new U9;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),a.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),a.dirty());else if("length"===r.kind){const t=e.data.length>r.value,i=e.data.length<r.value;(t||i)&&(n=this._getOrReturnCtx(e,n),t?J9(n,{code:H9.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):i&&J9(n,{code:H9.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),a.dirty())}else if("email"===r.kind)f8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"email",code:H9.invalid_string,message:r.message}),a.dirty());else if("emoji"===r.kind)y8||(y8=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),y8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"emoji",code:H9.invalid_string,message:r.message}),a.dirty());else if("uuid"===r.kind)h8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"uuid",code:H9.invalid_string,message:r.message}),a.dirty());else if("nanoid"===r.kind)p8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"nanoid",code:H9.invalid_string,message:r.message}),a.dirty());else if("cuid"===r.kind)c8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"cuid",code:H9.invalid_string,message:r.message}),a.dirty());else if("cuid2"===r.kind)d8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"cuid2",code:H9.invalid_string,message:r.message}),a.dirty());else if("ulid"===r.kind)m8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"ulid",code:H9.invalid_string,message:r.message}),a.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(dBe){n=this._getOrReturnCtx(e,n),J9(n,{validation:"url",code:H9.invalid_string,message:r.message}),a.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"regex",code:H9.invalid_string,message:r.message}),a.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),a.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:{startsWith:r.value},message:r.message}),a.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:{endsWith:r.value},message:r.message}),a.dirty());else if("datetime"===r.kind){x8(r).test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:"datetime",message:r.message}),a.dirty())}else if("date"===r.kind){T8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:"date",message:r.message}),a.dirty())}else if("time"===r.kind){new RegExp(`^${N8(r)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:"time",message:r.message}),a.dirty())}else"duration"===r.kind?v8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"duration",code:H9.invalid_string,message:r.message}),a.dirty()):"ip"===r.kind?(t=e.data,("v4"!==(i=r.version)&&i||!k8.test(t))&&("v6"!==i&&i||!S8.test(t))&&(n=this._getOrReturnCtx(e,n),J9(n,{validation:"ip",code:H9.invalid_string,message:r.message}),a.dirty())):"jwt"===r.kind?E8(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"jwt",code:H9.invalid_string,message:r.message}),a.dirty()):"cidr"===r.kind?P8(e.data,r.version)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"cidr",code:H9.invalid_string,message:r.message}),a.dirty()):"base64"===r.kind?w8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"base64",code:H9.invalid_string,message:r.message}),a.dirty()):"base64url"===r.kind?C8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"base64url",code:H9.invalid_string,message:r.message}),a.dirty()):z9.assertNever(r);var t,i;return{status:a.value,value:e.data}}_regex(e,a,n){return this.refinement((a=>e.test(a)),{validation:a,code:H9.invalid_string,...n8.errToObj(n)})}_addCheck(e){return new j8({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...n8.errToObj(e)})}url(e){return this._addCheck({kind:"url",...n8.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...n8.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...n8.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...n8.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...n8.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...n8.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...n8.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...n8.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...n8.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...n8.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...n8.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...n8.errToObj(e)})}datetime(e){var a,n;return this._addCheck("string"==typeof e?{kind:"datetime",precision:null,offset:!1,local:!1,message:e}:{kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(a=null==e?void 0:e.offset)&&void 0!==a&&a,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...n8.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return this._addCheck("string"==typeof e?{kind:"time",precision:null,message:e}:{kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...n8.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...n8.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...n8.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:null==a?void 0:a.position,...n8.errToObj(null==a?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...n8.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...n8.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...n8.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...n8.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...n8.errToObj(a)})}nonempty(e){return this.min(1,n8.errToObj(e))}trim(){return new j8({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j8({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j8({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const a of this._def.checks)"min"===a.kind&&(null===e||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)"max"===a.kind&&(null===e||a.value<e)&&(e=a.value);return e}}function L8(e,a){const n=(e.toString().split(".")[1]||"").length,t=(a.toString().split(".")[1]||"").length,i=n>t?n:t;return parseInt(e.toFixed(i).replace(".",""))%parseInt(a.toFixed(i).replace(".",""))/Math.pow(10,i)}j8.create=e=>{var a;return new j8({checks:[],typeName:A7.ZodString,coerce:null!==(a=null==e?void 0:e.coerce)&&void 0!==a&&a,...l8(e)})};class B8 extends u8{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==D9.number){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.number,received:a.parsedType}),W9}let a;const n=new U9;for(const t of this._def.checks)if("int"===t.kind)z9.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.invalid_type,expected:"integer",received:"float",message:t.message}),n.dirty());else if("min"===t.kind){(t.inclusive?e.data<t.value:e.data<=t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.too_small,minimum:t.value,type:"number",inclusive:t.inclusive,exact:!1,message:t.message}),n.dirty())}else if("max"===t.kind){(t.inclusive?e.data>t.value:e.data>=t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.too_big,maximum:t.value,type:"number",inclusive:t.inclusive,exact:!1,message:t.message}),n.dirty())}else"multipleOf"===t.kind?0!==L8(e.data,t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.not_multiple_of,multipleOf:t.value,message:t.message}),n.dirty()):"finite"===t.kind?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.not_finite,message:t.message}),n.dirty()):z9.assertNever(t);return{status:n.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,n8.toString(a))}gt(e,a){return this.setLimit("min",e,!1,n8.toString(a))}lte(e,a){return this.setLimit("max",e,!0,n8.toString(a))}lt(e,a){return this.setLimit("max",e,!1,n8.toString(a))}setLimit(e,a,n,t){return new B8({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:n,message:n8.toString(t)}]})}_addCheck(e){return new B8({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:n8.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:n8.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:n8.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:n8.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:n8.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:n8.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:n8.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:n8.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:n8.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)"min"===a.kind&&(null===e||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)"max"===a.kind&&(null===e||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&z9.isInteger(e.value)))}get isFinite(){let e=null,a=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===a||n.value>a)&&(a=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(a)&&Number.isFinite(e)}}B8.create=e=>new B8({checks:[],typeName:A7.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...l8(e)});class z8 extends u8{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(dBe){return this._getInvalidInput(e)}if(this._getType(e)!==D9.bigint)return this._getInvalidInput(e);let a;const n=new U9;for(const t of this._def.checks)if("min"===t.kind){(t.inclusive?e.data<t.value:e.data<=t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.too_small,type:"bigint",minimum:t.value,inclusive:t.inclusive,message:t.message}),n.dirty())}else if("max"===t.kind){(t.inclusive?e.data>t.value:e.data>=t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.too_big,type:"bigint",maximum:t.value,inclusive:t.inclusive,message:t.message}),n.dirty())}else"multipleOf"===t.kind?e.data%t.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.not_multiple_of,multipleOf:t.value,message:t.message}),n.dirty()):z9.assertNever(t);return{status:n.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.bigint,received:a.parsedType}),W9}gte(e,a){return this.setLimit("min",e,!0,n8.toString(a))}gt(e,a){return this.setLimit("min",e,!1,n8.toString(a))}lte(e,a){return this.setLimit("max",e,!0,n8.toString(a))}lt(e,a){return this.setLimit("max",e,!1,n8.toString(a))}setLimit(e,a,n,t){return new z8({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:n,message:n8.toString(t)}]})}_addCheck(e){return new z8({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:n8.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:n8.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:n8.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:n8.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:n8.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)"min"===a.kind&&(null===e||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)"max"===a.kind&&(null===e||a.value<e)&&(e=a.value);return e}}z8.create=e=>{var a;return new z8({checks:[],typeName:A7.ZodBigInt,coerce:null!==(a=null==e?void 0:e.coerce)&&void 0!==a&&a,...l8(e)})};class R8 extends u8{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==D9.boolean){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.boolean,received:a.parsedType}),W9}return Z9(e.data)}}R8.create=e=>new R8({typeName:A7.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...l8(e)});class _8 extends u8{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==D9.date){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.date,received:a.parsedType}),W9}if(isNaN(e.data.getTime())){return J9(this._getOrReturnCtx(e),{code:H9.invalid_date}),W9}const a=new U9;let n;for(const t of this._def.checks)"min"===t.kind?e.data.getTime()<t.value&&(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.too_small,message:t.message,inclusive:!0,exact:!1,minimum:t.value,type:"date"}),a.dirty()):"max"===t.kind?e.data.getTime()>t.value&&(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.too_big,message:t.message,inclusive:!0,exact:!1,maximum:t.value,type:"date"}),a.dirty()):z9.assertNever(t);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new _8({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:n8.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:n8.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)"min"===a.kind&&(null===e||a.value>e)&&(e=a.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)"max"===a.kind&&(null===e||a.value<e)&&(e=a.value);return null!=e?new Date(e):null}}_8.create=e=>new _8({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:A7.ZodDate,...l8(e)});class D8 extends u8{_parse(e){if(this._getType(e)!==D9.symbol){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.symbol,received:a.parsedType}),W9}return Z9(e.data)}}D8.create=e=>new D8({typeName:A7.ZodSymbol,...l8(e)});class K8 extends u8{_parse(e){if(this._getType(e)!==D9.undefined){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.undefined,received:a.parsedType}),W9}return Z9(e.data)}}K8.create=e=>new K8({typeName:A7.ZodUndefined,...l8(e)});class H8 extends u8{_parse(e){if(this._getType(e)!==D9.null){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.null,received:a.parsedType}),W9}return Z9(e.data)}}H8.create=e=>new H8({typeName:A7.ZodNull,...l8(e)});class O8 extends u8{constructor(){super(...arguments),this._any=!0}_parse(e){return Z9(e.data)}}O8.create=e=>new O8({typeName:A7.ZodAny,...l8(e)});class I8 extends u8{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z9(e.data)}}I8.create=e=>new I8({typeName:A7.ZodUnknown,...l8(e)});class G8 extends u8{_parse(e){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.never,received:a.parsedType}),W9}}G8.create=e=>new G8({typeName:A7.ZodNever,...l8(e)});class V8 extends u8{_parse(e){if(this._getType(e)!==D9.undefined){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.void,received:a.parsedType}),W9}return Z9(e.data)}}V8.create=e=>new V8({typeName:A7.ZodVoid,...l8(e)});class F8 extends u8{_parse(e){const{ctx:a,status:n}=this._processInputParams(e),t=this._def;if(a.parsedType!==D9.array)return J9(a,{code:H9.invalid_type,expected:D9.array,received:a.parsedType}),W9;if(null!==t.exactLength){const e=a.data.length>t.exactLength.value,i=a.data.length<t.exactLength.value;(e||i)&&(J9(a,{code:e?H9.too_big:H9.too_small,minimum:i?t.exactLength.value:void 0,maximum:e?t.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:t.exactLength.message}),n.dirty())}if(null!==t.minLength&&a.data.length<t.minLength.value&&(J9(a,{code:H9.too_small,minimum:t.minLength.value,type:"array",inclusive:!0,exact:!1,message:t.minLength.message}),n.dirty()),null!==t.maxLength&&a.data.length>t.maxLength.value&&(J9(a,{code:H9.too_big,maximum:t.maxLength.value,type:"array",inclusive:!0,exact:!1,message:t.maxLength.message}),n.dirty()),a.common.async)return Promise.all([...a.data].map(((e,n)=>t.type._parseAsync(new o8(a,e,a.path,n))))).then((e=>U9.mergeArray(n,e)));const i=[...a.data].map(((e,n)=>t.type._parseSync(new o8(a,e,a.path,n))));return U9.mergeArray(n,i)}get element(){return this._def.type}min(e,a){return new F8({...this._def,minLength:{value:e,message:n8.toString(a)}})}max(e,a){return new F8({...this._def,maxLength:{value:e,message:n8.toString(a)}})}length(e,a){return new F8({...this._def,exactLength:{value:e,message:n8.toString(a)}})}nonempty(e){return this.min(1,e)}}function J8(e){if(e instanceof U8){const a={};for(const n in e.shape){a[n]=c7.create(J8(e.shape[n]))}return new U8({...e._def,shape:()=>a})}return e instanceof F8?new F8({...e._def,type:J8(e.element)}):e instanceof c7?c7.create(J8(e.unwrap())):e instanceof d7?d7.create(J8(e.unwrap())):e instanceof Q8?Q8.create(e.items.map((e=>J8(e)))):e}F8.create=(e,a)=>new F8({type:e,minLength:null,maxLength:null,exactLength:null,typeName:A7.ZodArray,...l8(a)});class U8 extends u8{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),a=z9.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==D9.object){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.object,received:a.parsedType}),W9}const{status:a,ctx:n}=this._processInputParams(e),{shape:t,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof G8&&"strip"===this._def.unknownKeys))for(const s in n.data)i.includes(s)||r.push(s);const o=[];for(const s of i){o.push({key:{status:"valid",value:s},value:t[s]._parse(new o8(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof G8){const e=this._def.unknownKeys;if("passthrough"===e)for(const a of r)o.push({key:{status:"valid",value:a},value:{status:"valid",value:n.data[a]}});else if("strict"===e)r.length>0&&(J9(n,{code:H9.unrecognized_keys,keys:r}),a.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const a of r){o.push({key:{status:"valid",value:a},value:e._parse(new o8(n,n.data[a],n.path,a)),alwaysSet:a in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const a of o){const n=await a.key,t=await a.value;e.push({key:n,value:t,alwaysSet:a.alwaysSet})}return e})).then((e=>U9.mergeObjectSync(a,e))):U9.mergeObjectSync(a,o)}get shape(){return this._def.shape()}strict(e){return new U8({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(a,n)=>{var t,i,r,o;const s=null!==(r=null===(i=(t=this._def).errorMap)||void 0===i?void 0:i.call(t,a,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===a.code?{message:null!==(o=n8.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new U8({...this._def,unknownKeys:"strip"})}passthrough(){return new U8({...this._def,unknownKeys:"passthrough"})}extend(e){return new U8({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new U8({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A7.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new U8({...this._def,catchall:e})}pick(e){const a={};return z9.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(a[n]=this.shape[n])})),new U8({...this._def,shape:()=>a})}omit(e){const a={};return z9.objectKeys(this.shape).forEach((n=>{e[n]||(a[n]=this.shape[n])})),new U8({...this._def,shape:()=>a})}deepPartial(){return J8(this)}partial(e){const a={};return z9.objectKeys(this.shape).forEach((n=>{const t=this.shape[n];a[n]=e&&!e[n]?t:t.optional()})),new U8({...this._def,shape:()=>a})}required(e){const a={};return z9.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])a[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof c7;)e=e._def.innerType;a[n]=e}})),new U8({...this._def,shape:()=>a})}keyof(){return r7(z9.objectKeys(this.shape))}}U8.create=(e,a)=>new U8({shape:()=>e,unknownKeys:"strip",catchall:G8.create(),typeName:A7.ZodObject,...l8(a)}),U8.strictCreate=(e,a)=>new U8({shape:()=>e,unknownKeys:"strict",catchall:G8.create(),typeName:A7.ZodObject,...l8(a)}),U8.lazycreate=(e,a)=>new U8({shape:e,unknownKeys:"strip",catchall:G8.create(),typeName:A7.ZodObject,...l8(a)});class W8 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e),n=this._def.options;if(a.common.async)return Promise.all(n.map((async e=>{const n={...a,common:{...a.common,issues:[]},parent:null};return{result:await e._parseAsync({data:a.data,path:a.path,parent:n}),ctx:n}}))).then((function(e){for(const a of e)if("valid"===a.result.status)return a.result;for(const t of e)if("dirty"===t.result.status)return a.common.issues.push(...t.ctx.common.issues),t.result;const n=e.map((e=>new O9(e.ctx.common.issues)));return J9(a,{code:H9.invalid_union,unionErrors:n}),W9}));{let e;const t=[];for(const r of n){const n={...a,common:{...a.common,issues:[]},parent:null},i=r._parseSync({data:a.data,path:a.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&t.push(n.common.issues)}if(e)return a.common.issues.push(...e.ctx.common.issues),e.result;const i=t.map((e=>new O9(e)));return J9(a,{code:H9.invalid_union,unionErrors:i}),W9}}get options(){return this._def.options}}W8.create=(e,a)=>new W8({options:e,typeName:A7.ZodUnion,...l8(a)});const q8=e=>e instanceof t7?q8(e.schema):e instanceof u7?q8(e.innerType()):e instanceof i7?[e.value]:e instanceof o7?e.options:e instanceof s7?z9.objectValues(e.enum):e instanceof m7?q8(e._def.innerType):e instanceof K8?[void 0]:e instanceof H8?[null]:e instanceof c7?[void 0,...q8(e.unwrap())]:e instanceof d7?[null,...q8(e.unwrap())]:e instanceof v7||e instanceof y7?q8(e.unwrap()):e instanceof h7?q8(e._def.innerType):[];class Z8 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==D9.object)return J9(a,{code:H9.invalid_type,expected:D9.object,received:a.parsedType}),W9;const n=this.discriminator,t=this.optionsMap.get(a.data[n]);return t?a.common.async?t._parseAsync({data:a.data,path:a.path,parent:a}):t._parseSync({data:a.data,path:a.path,parent:a}):(J9(a,{code:H9.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),W9)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,n){const t=new Map;for(const i of a){const a=q8(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of a){if(t.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);t.set(n,i)}}return new Z8({typeName:A7.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:t,...l8(n)})}}function $8(e,a){const n=K9(e),t=K9(a);if(e===a)return{valid:!0,data:e};if(n===D9.object&&t===D9.object){const n=z9.objectKeys(a),t=z9.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...a};for(const r of t){const n=$8(e[r],a[r]);if(!n.valid)return{valid:!1};i[r]=n.data}return{valid:!0,data:i}}if(n===D9.array&&t===D9.array){if(e.length!==a.length)return{valid:!1};const n=[];for(let t=0;t<e.length;t++){const i=$8(e[t],a[t]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===D9.date&&t===D9.date&&+e==+a?{valid:!0,data:e}:{valid:!1}}class Y8 extends u8{_parse(e){const{status:a,ctx:n}=this._processInputParams(e),t=(e,t)=>{if($9(e)||$9(t))return W9;const i=$8(e.value,t.value);return i.valid?((Y9(e)||Y9(t))&&a.dirty(),{status:a.value,value:i.data}):(J9(n,{code:H9.invalid_intersection_types}),W9)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,a])=>t(e,a))):t(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Y8.create=(e,a,n)=>new Y8({left:e,right:a,typeName:A7.ZodIntersection,...l8(n)});class Q8 extends u8{_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.parsedType!==D9.array)return J9(n,{code:H9.invalid_type,expected:D9.array,received:n.parsedType}),W9;if(n.data.length<this._def.items.length)return J9(n,{code:H9.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W9;!this._def.rest&&n.data.length>this._def.items.length&&(J9(n,{code:H9.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const t=[...n.data].map(((e,a)=>{const t=this._def.items[a]||this._def.rest;return t?t._parse(new o8(n,e,n.path,a)):null})).filter((e=>!!e));return n.common.async?Promise.all(t).then((e=>U9.mergeArray(a,e))):U9.mergeArray(a,t)}get items(){return this._def.items}rest(e){return new Q8({...this._def,rest:e})}}Q8.create=(e,a)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q8({items:e,typeName:A7.ZodTuple,rest:null,...l8(a)})};class X8 extends u8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.parsedType!==D9.object)return J9(n,{code:H9.invalid_type,expected:D9.object,received:n.parsedType}),W9;const t=[],i=this._def.keyType,r=this._def.valueType;for(const o in n.data)t.push({key:i._parse(new o8(n,o,n.path,o)),value:r._parse(new o8(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?U9.mergeObjectAsync(a,t):U9.mergeObjectSync(a,t)}get element(){return this._def.valueType}static create(e,a,n){return new X8(a instanceof u8?{keyType:e,valueType:a,typeName:A7.ZodRecord,...l8(n)}:{keyType:j8.create(),valueType:e,typeName:A7.ZodRecord,...l8(a)})}}class e7 extends u8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.parsedType!==D9.map)return J9(n,{code:H9.invalid_type,expected:D9.map,received:n.parsedType}),W9;const t=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,a],r)=>({key:t._parse(new o8(n,e,n.path,[r,"key"])),value:i._parse(new o8(n,a,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const t=await n.key,i=await n.value;if("aborted"===t.status||"aborted"===i.status)return W9;"dirty"!==t.status&&"dirty"!==i.status||a.dirty(),e.set(t.value,i.value)}return{status:a.value,value:e}}))}{const e=new Map;for(const n of r){const t=n.key,i=n.value;if("aborted"===t.status||"aborted"===i.status)return W9;"dirty"!==t.status&&"dirty"!==i.status||a.dirty(),e.set(t.value,i.value)}return{status:a.value,value:e}}}}e7.create=(e,a,n)=>new e7({valueType:a,keyType:e,typeName:A7.ZodMap,...l8(n)});class a7 extends u8{_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.parsedType!==D9.set)return J9(n,{code:H9.invalid_type,expected:D9.set,received:n.parsedType}),W9;const t=this._def;null!==t.minSize&&n.data.size<t.minSize.value&&(J9(n,{code:H9.too_small,minimum:t.minSize.value,type:"set",inclusive:!0,exact:!1,message:t.minSize.message}),a.dirty()),null!==t.maxSize&&n.data.size>t.maxSize.value&&(J9(n,{code:H9.too_big,maximum:t.maxSize.value,type:"set",inclusive:!0,exact:!1,message:t.maxSize.message}),a.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const t of e){if("aborted"===t.status)return W9;"dirty"===t.status&&a.dirty(),n.add(t.value)}return{status:a.value,value:n}}const o=[...n.data.values()].map(((e,a)=>i._parse(new o8(n,e,n.path,a))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,a){return new a7({...this._def,minSize:{value:e,message:n8.toString(a)}})}max(e,a){return new a7({...this._def,maxSize:{value:e,message:n8.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}a7.create=(e,a)=>new a7({valueType:e,minSize:null,maxSize:null,typeName:A7.ZodSet,...l8(a)});class n7 extends u8{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==D9.function)return J9(a,{code:H9.invalid_type,expected:D9.function,received:a.parsedType}),W9;function n(e,n){return F9({data:e,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,V9(),I9].filter((e=>!!e)),issueData:{code:H9.invalid_arguments,argumentsError:n}})}function t(e,n){return F9({data:e,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,V9(),I9].filter((e=>!!e)),issueData:{code:H9.invalid_return_type,returnTypeError:n}})}const i={errorMap:a.common.contextualErrorMap},r=a.data;if(this._def.returns instanceof l7){const e=this;return Z9((async function(...a){const o=new O9([]),s=await e._def.args.parseAsync(a,i).catch((e=>{throw o.addIssue(n(a,e)),o})),l=await Reflect.apply(r,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch((e=>{throw o.addIssue(t(l,e)),o}))}))}{const e=this;return Z9((function(...a){const o=e._def.args.safeParse(a,i);if(!o.success)throw new O9([n(a,o.error)]);const s=Reflect.apply(r,this,o.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new O9([t(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n7({...this._def,args:Q8.create(e).rest(I8.create())})}returns(e){return new n7({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,n){return new n7({args:e||Q8.create([]).rest(I8.create()),returns:a||I8.create(),typeName:A7.ZodFunction,...l8(n)})}}class t7 extends u8{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}t7.create=(e,a)=>new t7({getter:e,typeName:A7.ZodLazy,...l8(a)});class i7 extends u8{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return J9(a,{received:a.data,code:H9.invalid_literal,expected:this._def.value}),W9}return{status:"valid",value:e.data}}get value(){return this._def.value}}function r7(e,a){return new o7({values:e,typeName:A7.ZodEnum,...l8(a)})}i7.create=(e,a)=>new i7({value:e,typeName:A7.ZodLiteral,...l8(a)});class o7 extends u8{constructor(){super(...arguments),i8.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const a=this._getOrReturnCtx(e);return J9(a,{expected:z9.joinValues(this._def.values),received:a.parsedType,code:H9.invalid_type}),W9}if(e8(this,i8)||a8(this,i8,new Set(this._def.values)),!e8(this,i8).has(e.data)){const a=this._getOrReturnCtx(e);return J9(a,{received:a.data,code:H9.invalid_enum_value,options:this._def.values}),W9}return Z9(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return o7.create(e,{...this._def,...a})}exclude(e,a=this._def){return o7.create(this.options.filter((a=>!e.includes(a))),{...this._def,...a})}}i8=new WeakMap,o7.create=r7;class s7 extends u8{constructor(){super(...arguments),r8.set(this,void 0)}_parse(e){const a=z9.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==D9.string&&n.parsedType!==D9.number){const e=z9.objectValues(a);return J9(n,{expected:z9.joinValues(e),received:n.parsedType,code:H9.invalid_type}),W9}if(e8(this,r8)||a8(this,r8,new Set(z9.getValidEnumValues(this._def.values))),!e8(this,r8).has(e.data)){const e=z9.objectValues(a);return J9(n,{received:n.data,code:H9.invalid_enum_value,options:e}),W9}return Z9(e.data)}get enum(){return this._def.values}}r8=new WeakMap,s7.create=(e,a)=>new s7({values:e,typeName:A7.ZodNativeEnum,...l8(a)});class l7 extends u8{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==D9.promise&&!1===a.common.async)return J9(a,{code:H9.invalid_type,expected:D9.promise,received:a.parsedType}),W9;const n=a.parsedType===D9.promise?a.data:Promise.resolve(a.data);return Z9(n.then((e=>this._def.type.parseAsync(e,{path:a.path,errorMap:a.common.contextualErrorMap}))))}}l7.create=(e,a)=>new l7({type:e,typeName:A7.ZodPromise,...l8(a)});class u7 extends u8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A7.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:n}=this._processInputParams(e),t=this._def.effect||null,i={addIssue:e=>{J9(n,e),e.fatal?a.abort():a.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===t.type){const e=t.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===a.value)return W9;const t=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===t.status?W9:"dirty"===t.status||"dirty"===a.value?q9(t.value):t}));{if("aborted"===a.value)return W9;const t=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===t.status?W9:"dirty"===t.status||"dirty"===a.value?q9(t.value):t}}if("refinement"===t.type){const e=e=>{const a=t.refinement(e,i);if(n.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const t=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===t.status?W9:("dirty"===t.status&&a.dirty(),e(t.value),{status:a.value,value:t.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?W9:("dirty"===n.status&&a.dirty(),e(n.value).then((()=>({status:a.value,value:n.value}))))))}if("transform"===t.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Q9(e))return e;const r=t.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Q9(e)?Promise.resolve(t.transform(e.value,i)).then((e=>({status:a.value,value:e}))):e))}z9.assertNever(t)}}u7.create=(e,a,n)=>new u7({schema:e,typeName:A7.ZodEffects,effect:a,...l8(n)}),u7.createWithPreprocess=(e,a,n)=>new u7({schema:a,effect:{type:"preprocess",transform:e},typeName:A7.ZodEffects,...l8(n)});class c7 extends u8{_parse(e){return this._getType(e)===D9.undefined?Z9(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}c7.create=(e,a)=>new c7({innerType:e,typeName:A7.ZodOptional,...l8(a)});class d7 extends u8{_parse(e){return this._getType(e)===D9.null?Z9(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}d7.create=(e,a)=>new d7({innerType:e,typeName:A7.ZodNullable,...l8(a)});class m7 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e);let n=a.data;return a.parsedType===D9.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}m7.create=(e,a)=>new m7({innerType:e,typeName:A7.ZodDefault,defaultValue:"function"==typeof a.default?a.default:()=>a.default,...l8(a)});class h7 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e),n={...a,common:{...a.common,issues:[]}},t=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return X9(t)?t.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new O9(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===t.status?t.value:this._def.catchValue({get error(){return new O9(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}h7.create=(e,a)=>new h7({innerType:e,typeName:A7.ZodCatch,catchValue:"function"==typeof a.catch?a.catch:()=>a.catch,...l8(a)});class p7 extends u8{_parse(e){if(this._getType(e)!==D9.nan){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.nan,received:a.parsedType}),W9}return{status:"valid",value:e.data}}}p7.create=e=>new p7({typeName:A7.ZodNaN,...l8(e)});const g7=Symbol("zod_brand");class v7 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.type._parse({data:a.data,path:a.path,parent:a})}unwrap(){return this._def.type}}class f7 extends u8{_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?W9:"dirty"===e.status?(a.dirty(),q9(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?W9:"dirty"===e.status?(a.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,a){return new f7({in:e,out:a,typeName:A7.ZodPipeline})}}class y7 extends u8{_parse(e){const a=this._def.innerType._parse(e),n=e=>(Q9(e)&&(e.value=Object.freeze(e.value)),e);return X9(a)?a.then((e=>n(e))):n(a)}unwrap(){return this._def.innerType}}function k7(e,a){const n="function"==typeof e?e(a):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function b7(e,a={},n){return e?O8.create().superRefine(((t,i)=>{var r,o;const s=e(t);if(s instanceof Promise)return s.then((e=>{var r,o;if(!e){const e=k7(a,t),s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o;i.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=k7(a,t),s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o;i.addIssue({code:"custom",...e,fatal:s})}})):O8.create()}y7.create=(e,a)=>new y7({innerType:e,typeName:A7.ZodReadonly,...l8(a)});const S7={object:U8.lazycreate};var A7,w7;(w7=A7||(A7={})).ZodString="ZodString",w7.ZodNumber="ZodNumber",w7.ZodNaN="ZodNaN",w7.ZodBigInt="ZodBigInt",w7.ZodBoolean="ZodBoolean",w7.ZodDate="ZodDate",w7.ZodSymbol="ZodSymbol",w7.ZodUndefined="ZodUndefined",w7.ZodNull="ZodNull",w7.ZodAny="ZodAny",w7.ZodUnknown="ZodUnknown",w7.ZodNever="ZodNever",w7.ZodVoid="ZodVoid",w7.ZodArray="ZodArray",w7.ZodObject="ZodObject",w7.ZodUnion="ZodUnion",w7.ZodDiscriminatedUnion="ZodDiscriminatedUnion",w7.ZodIntersection="ZodIntersection",w7.ZodTuple="ZodTuple",w7.ZodRecord="ZodRecord",w7.ZodMap="ZodMap",w7.ZodSet="ZodSet",w7.ZodFunction="ZodFunction",w7.ZodLazy="ZodLazy",w7.ZodLiteral="ZodLiteral",w7.ZodEnum="ZodEnum",w7.ZodEffects="ZodEffects",w7.ZodNativeEnum="ZodNativeEnum",w7.ZodOptional="ZodOptional",w7.ZodNullable="ZodNullable",w7.ZodDefault="ZodDefault",w7.ZodCatch="ZodCatch",w7.ZodPromise="ZodPromise",w7.ZodBranded="ZodBranded",w7.ZodPipeline="ZodPipeline",w7.ZodReadonly="ZodReadonly";const C7=j8.create,M7=B8.create,T7=p7.create,N7=z8.create,x7=R8.create,E7=_8.create,P7=D8.create,j7=K8.create,L7=H8.create,B7=O8.create,z7=I8.create,R7=G8.create,_7=V8.create,D7=F8.create,K7=U8.create,H7=U8.strictCreate,O7=W8.create,I7=Z8.create,G7=Y8.create,V7=Q8.create,F7=X8.create,J7=e7.create,U7=a7.create,W7=n7.create,q7=t7.create,Z7=i7.create,$7=o7.create,Y7=s7.create,Q7=l7.create,X7=u7.create,eee=c7.create,aee=d7.create,nee=u7.createWithPreprocess,tee=f7.create,iee={string:e=>j8.create({...e,coerce:!0}),number:e=>B8.create({...e,coerce:!0}),boolean:e=>R8.create({...e,coerce:!0}),bigint:e=>z8.create({...e,coerce:!0}),date:e=>_8.create({...e,coerce:!0})},ree=W9;var oee=Object.freeze({__proto__:null,defaultErrorMap:I9,setErrorMap:function(e){G9=e},getErrorMap:V9,makeIssue:F9,EMPTY_PATH:[],addIssueToContext:J9,ParseStatus:U9,INVALID:W9,DIRTY:q9,OK:Z9,isAborted:$9,isDirty:Y9,isValid:Q9,isAsync:X9,get util(){return z9},get objectUtil(){return _9},ZodParsedType:D9,getParsedType:K9,ZodType:u8,datetimeRegex:x8,ZodString:j8,ZodNumber:B8,ZodBigInt:z8,ZodBoolean:R8,ZodDate:_8,ZodSymbol:D8,ZodUndefined:K8,ZodNull:H8,ZodAny:O8,ZodUnknown:I8,ZodNever:G8,ZodVoid:V8,ZodArray:F8,ZodObject:U8,ZodUnion:W8,ZodDiscriminatedUnion:Z8,ZodIntersection:Y8,ZodTuple:Q8,ZodRecord:X8,ZodMap:e7,ZodSet:a7,ZodFunction:n7,ZodLazy:t7,ZodLiteral:i7,ZodEnum:o7,ZodNativeEnum:s7,ZodPromise:l7,ZodEffects:u7,ZodTransformer:u7,ZodOptional:c7,ZodNullable:d7,ZodDefault:m7,ZodCatch:h7,ZodNaN:p7,BRAND:g7,ZodBranded:v7,ZodPipeline:f7,ZodReadonly:y7,custom:b7,Schema:u8,ZodSchema:u8,late:S7,get ZodFirstPartyTypeKind(){return A7},coerce:iee,any:B7,array:D7,bigint:N7,boolean:x7,date:E7,discriminatedUnion:I7,effect:X7,enum:$7,function:W7,instanceof:(e,a={message:`Input not instance of ${e.name}`})=>b7((a=>a instanceof e),a),intersection:G7,lazy:q7,literal:Z7,map:J7,nan:T7,nativeEnum:Y7,never:R7,null:L7,nullable:aee,number:M7,object:K7,oboolean:()=>x7().optional(),onumber:()=>M7().optional(),optional:eee,ostring:()=>C7().optional(),pipeline:tee,preprocess:nee,promise:Q7,record:F7,set:U7,strictObject:H7,string:C7,symbol:P7,transformer:X7,tuple:V7,undefined:j7,union:O7,unknown:z7,void:_7,NEVER:ree,ZodIssueCode:H9,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:O9}),see=(e=>(e.AWS_TOLL_FREE_NUMBER="aws_toll_free_number",e))(see||{}),lee=(e=>(e.TWO_FACTOR_AUTH="two_factor_authentication",e.ONE_TIME_PASSWORD="one_time_passwords",e.NOTIFICATIONS="notifications",e.POLLING_SURVEYS="polling_and_surveys",e.INFO_ON_DEMAND="info_on_demand",e.PROMOTIONS_MARKETING="promotions_and_marketing",e.OTHER="other",e))(lee||{});const uee=oee.object({type:oee.literal("aws_toll_free_number"),tollFreeNumber:oee.string(),company:oee.object({name:oee.string().describe("The legal name of the company"),website:oee.string().url(),address1:oee.string(),address2:oee.string().optional(),city:oee.string(),stateProvince:oee.string(),zipCode:oee.string(),country:oee.string().length(2)}),contact:oee.object({firstName:oee.string(),lastName:oee.string(),email:oee.string().email(),phoneNumber:oee.string().regex(/^\+\d+$/,{message:"Phone number must start with '+' and contain only digits"})}),messagingUseCase:oee.object({monthlyVolume:oee.number().int().positive(),category:oee.nativeEnum(lee),useCaseDetails:oee.string().optional().refine((e=>void 0!==e||""!==e),{message:"Use case details are required when category is 'Other'"})}),messageSamples:oee.array(oee.string()).min(1).max(3).describe("Enter an example message of an SMS message body that will be sent to your end users")}),cee=oee.discriminatedUnion("type",[uee]);var dee=(e=>(e.PENDING="pending",e.APPROVED="approved",e.REJECTED="rejected",e))(dee||{});const mee=e=>{const{channelSenders:a,channelAccounts:n,smsApplication:t}=e;return(a?.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid||e.channelSenderMetadata.friendlyName))||[]).map((e=>{const a=n.find((a=>a.id===e.channelAccountId));return a&&t&&a.channelAccountMetadata.smsApplicationReferenceId===t?.id?{channelSender:e,smsApplication:t}:{channelSender:e,smsApplication:null}}))};function hee(e){const a=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===a?new e.constructor(+e):"number"==typeof e||"[object Number]"===a||"string"==typeof e||"[object String]"===a?new Date(e):new Date(NaN)}function pee(e,a){return e instanceof Date?new e.constructor(a):new Date(a)}const gee=6048e5,vee=43200;let fee={};function yee(){return fee}function kee(e,a){const n=yee(),t=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=hee(e),r=i.getDay(),o=(r<t?7:0)+r-t;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function bee(e){return kee(e,{weekStartsOn:1})}function See(e){const a=hee(e),n=a.getFullYear(),t=pee(e,0);t.setFullYear(n+1,0,4),t.setHours(0,0,0,0);const i=bee(t),r=pee(e,0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);const o=bee(r);return a.getTime()>=i.getTime()?n+1:a.getTime()>=o.getTime()?n:n-1}function Aee(e){const a=hee(e);return a.setHours(0,0,0,0),a}function wee(e){const a=hee(e),n=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()));return n.setUTCFullYear(a.getFullYear()),+e-+n}function Cee(e,a){return function(e,a){return pee(e,+hee(e)+a)}(e,6e4*a)}function Mee(e,a){const n=hee(e),t=hee(a),i=n.getTime()-t.getTime();return i<0?-1:i>0?1:i}function Tee(e){if(!(a=e,a instanceof Date||"object"==typeof a&&"[object Date]"===Object.prototype.toString.call(a)||"number"==typeof e))return!1;var a;const n=hee(e);return!isNaN(Number(n))}function Nee(e){const a=hee(e);return+function(e){const a=hee(e);return a.setHours(23,59,59,999),a}(a)==+function(e){const a=hee(e),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(23,59,59,999),a}(a)}function xee(e,a){const n=hee(e),t=hee(a),i=Mee(n,t),r=Math.abs(function(e,a){const n=hee(e),t=hee(a);return 12*(n.getFullYear()-t.getFullYear())+(n.getMonth()-t.getMonth())}(n,t));let o;if(r<1)o=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*r);let a=Mee(n,t)===-i;Nee(hee(e))&&1===r&&1===Mee(e,t)&&(a=!1),o=i*(r-Number(a))}return 0===o?0:o}function Eee(e,a,n){const t=function(e,a){return+hee(e)-+hee(a)}(e,a)/1e3;return(i=n?.roundingMethod,e=>{const a=(i?Math[i]:Math.trunc)(e);return 0===a?0:a})(t);var i}const Pee={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function jee(e){return(a={})=>{const n=a.width?String(a.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Lee={date:jee({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:jee({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:jee({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Bee={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function zee(e){return(a,n)=>{let t;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):a;t=e.formattingValues[i]||e.formattingValues[a]}else{const a=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;t=e.values[i]||e.values[a]}return t[e.argumentCallback?e.argumentCallback(a):a]}}function Ree(e){return(a,n={})=>{const t=n.width,i=a.match(t&&e.matchPatterns[t]||e.matchPatterns[e.defaultMatchWidth]);if(!i)return null;const r=i[0],o=t&&e.parsePatterns[t]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(o)?function(e,a){for(let n=0;n<e.length;n++)if(a(e[n]))return n;return}(o,(e=>e.test(r))):function(e,a){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&a(e[n]))return n;return}(o,(e=>e.test(r)));let l;l=e.valueCallback?e.valueCallback(s):s,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:a.slice(r.length)}}}var _ee;const Dee={code:"en-US",formatDistance:(e,a,n)=>{let t;const i=Pee[e];return t="string"==typeof i?i:1===a?i.one:i.other.replace("{{count}}",a.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+t:t+" ago":t},formatLong:Lee,formatRelative:(e,a,n,t)=>Bee[e],localize:{ordinalNumber:(e,a)=>{const n=Number(e),t=n%100;if(t>20||t<10)switch(t%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:zee({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:zee({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:zee({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:zee({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:zee({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(_ee={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,a={})=>{const n=e.match(_ee.matchPattern);if(!n)return null;const t=n[0],i=e.match(_ee.parsePattern);if(!i)return null;let r=_ee.valueCallback?_ee.valueCallback(i[0]):i[0];return r=a.valueCallback?a.valueCallback(r):r,{value:r,rest:e.slice(t.length)}}),era:Ree({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Ree({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ree({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Ree({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Ree({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Kee(e){const a=hee(e),n=function(e,a){const n=Aee(e),t=Aee(a),i=+n-wee(n),r=+t-wee(t);return Math.round((i-r)/864e5)}(a,function(e){const a=hee(e),n=pee(e,0);return n.setFullYear(a.getFullYear(),0,1),n.setHours(0,0,0,0),n}(a));return n+1}function Hee(e){const a=hee(e),n=+bee(a)-+function(e){const a=See(e),n=pee(e,0);return n.setFullYear(a,0,4),n.setHours(0,0,0,0),bee(n)}(a);return Math.round(n/gee)+1}function Oee(e,a){const n=hee(e),t=n.getFullYear(),i=yee(),r=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=pee(e,0);o.setFullYear(t+1,0,r),o.setHours(0,0,0,0);const s=kee(o,a),l=pee(e,0);l.setFullYear(t,0,r),l.setHours(0,0,0,0);const u=kee(l,a);return n.getTime()>=s.getTime()?t+1:n.getTime()>=u.getTime()?t:t-1}function Iee(e,a){const n=hee(e),t=+kee(n,a)-+function(e,a){const n=yee(),t=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Oee(e,a),r=pee(e,0);return r.setFullYear(i,0,t),r.setHours(0,0,0,0),kee(r,a)}(n,a);return Math.round(t/gee)+1}function Gee(e,a){return(e<0?"-":"")+Math.abs(e).toString().padStart(a,"0")}const Vee={y(e,a){const n=e.getFullYear(),t=n>0?n:1-n;return Gee("yy"===a?t%100:t,a.length)},M(e,a){const n=e.getMonth();return"M"===a?String(n+1):Gee(n+1,2)},d:(e,a)=>Gee(e.getDate(),a.length),a(e,a){const n=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,a)=>Gee(e.getHours()%12||12,a.length),H:(e,a)=>Gee(e.getHours(),a.length),m:(e,a)=>Gee(e.getMinutes(),a.length),s:(e,a)=>Gee(e.getSeconds(),a.length),S(e,a){const n=a.length,t=e.getMilliseconds();return Gee(Math.trunc(t*Math.pow(10,n-3)),a.length)}},Fee="midnight",Jee="noon",Uee="morning",Wee="afternoon",qee="evening",Zee="night",$ee={G:function(e,a,n){const t=e.getFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return n.era(t,{width:"abbreviated"});case"GGGGG":return n.era(t,{width:"narrow"});default:return n.era(t,{width:"wide"})}},y:function(e,a,n){if("yo"===a){const a=e.getFullYear();return n.ordinalNumber(a>0?a:1-a,{unit:"year"})}return Vee.y(e,a)},Y:function(e,a,n,t){const i=Oee(e,t),r=i>0?i:1-i;if("YY"===a){return Gee(r%100,2)}return"Yo"===a?n.ordinalNumber(r,{unit:"year"}):Gee(r,a.length)},R:function(e,a){return Gee(See(e),a.length)},u:function(e,a){return Gee(e.getFullYear(),a.length)},Q:function(e,a,n){const t=Math.ceil((e.getMonth()+1)/3);switch(a){case"Q":return String(t);case"QQ":return Gee(t,2);case"Qo":return n.ordinalNumber(t,{unit:"quarter"});case"QQQ":return n.quarter(t,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(t,{width:"narrow",context:"formatting"});default:return n.quarter(t,{width:"wide",context:"formatting"})}},q:function(e,a,n){const t=Math.ceil((e.getMonth()+1)/3);switch(a){case"q":return String(t);case"qq":return Gee(t,2);case"qo":return n.ordinalNumber(t,{unit:"quarter"});case"qqq":return n.quarter(t,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(t,{width:"narrow",context:"standalone"});default:return n.quarter(t,{width:"wide",context:"standalone"})}},M:function(e,a,n){const t=e.getMonth();switch(a){case"M":case"MM":return Vee.M(e,a);case"Mo":return n.ordinalNumber(t+1,{unit:"month"});case"MMM":return n.month(t,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(t,{width:"narrow",context:"formatting"});default:return n.month(t,{width:"wide",context:"formatting"})}},L:function(e,a,n){const t=e.getMonth();switch(a){case"L":return String(t+1);case"LL":return Gee(t+1,2);case"Lo":return n.ordinalNumber(t+1,{unit:"month"});case"LLL":return n.month(t,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(t,{width:"narrow",context:"standalone"});default:return n.month(t,{width:"wide",context:"standalone"})}},w:function(e,a,n,t){const i=Iee(e,t);return"wo"===a?n.ordinalNumber(i,{unit:"week"}):Gee(i,a.length)},I:function(e,a,n){const t=Hee(e);return"Io"===a?n.ordinalNumber(t,{unit:"week"}):Gee(t,a.length)},d:function(e,a,n){return"do"===a?n.ordinalNumber(e.getDate(),{unit:"date"}):Vee.d(e,a)},D:function(e,a,n){const t=Kee(e);return"Do"===a?n.ordinalNumber(t,{unit:"dayOfYear"}):Gee(t,a.length)},E:function(e,a,n){const t=e.getDay();switch(a){case"E":case"EE":case"EEE":return n.day(t,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(t,{width:"short",context:"formatting"});default:return n.day(t,{width:"wide",context:"formatting"})}},e:function(e,a,n,t){const i=e.getDay(),r=(i-t.weekStartsOn+8)%7||7;switch(a){case"e":return String(r);case"ee":return Gee(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,a,n,t){const i=e.getDay(),r=(i-t.weekStartsOn+8)%7||7;switch(a){case"c":return String(r);case"cc":return Gee(r,a.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,a,n){const t=e.getDay(),i=0===t?7:t;switch(a){case"i":return String(i);case"ii":return Gee(i,a.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(t,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(t,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(t,{width:"short",context:"formatting"});default:return n.day(t,{width:"wide",context:"formatting"})}},a:function(e,a,n){const t=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(t,{width:"narrow",context:"formatting"});default:return n.dayPeriod(t,{width:"wide",context:"formatting"})}},b:function(e,a,n){const t=e.getHours();let i;switch(i=12===t?Jee:0===t?Fee:t/12>=1?"pm":"am",a){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,a,n){const t=e.getHours();let i;switch(i=t>=17?qee:t>=12?Wee:t>=4?Uee:Zee,a){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,a,n){if("ho"===a){let a=e.getHours()%12;return 0===a&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return Vee.h(e,a)},H:function(e,a,n){return"Ho"===a?n.ordinalNumber(e.getHours(),{unit:"hour"}):Vee.H(e,a)},K:function(e,a,n){const t=e.getHours()%12;return"Ko"===a?n.ordinalNumber(t,{unit:"hour"}):Gee(t,a.length)},k:function(e,a,n){let t=e.getHours();return 0===t&&(t=24),"ko"===a?n.ordinalNumber(t,{unit:"hour"}):Gee(t,a.length)},m:function(e,a,n){return"mo"===a?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Vee.m(e,a)},s:function(e,a,n){return"so"===a?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Vee.s(e,a)},S:function(e,a){return Vee.S(e,a)},X:function(e,a,n){const t=e.getTimezoneOffset();if(0===t)return"Z";switch(a){case"X":return Qee(t);case"XXXX":case"XX":return Xee(t);default:return Xee(t,":")}},x:function(e,a,n){const t=e.getTimezoneOffset();switch(a){case"x":return Qee(t);case"xxxx":case"xx":return Xee(t);default:return Xee(t,":")}},O:function(e,a,n){const t=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+Yee(t,":");default:return"GMT"+Xee(t,":")}},z:function(e,a,n){const t=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+Yee(t,":");default:return"GMT"+Xee(t,":")}},t:function(e,a,n){return Gee(Math.trunc(e.getTime()/1e3),a.length)},T:function(e,a,n){return Gee(e.getTime(),a.length)}};function Yee(e,a=""){const n=e>0?"-":"+",t=Math.abs(e),i=Math.trunc(t/60),r=t%60;return 0===r?n+String(i):n+String(i)+a+Gee(r,2)}function Qee(e,a){if(e%60==0){return(e>0?"-":"+")+Gee(Math.abs(e)/60,2)}return Xee(e,a)}function Xee(e,a=""){const n=e>0?"-":"+",t=Math.abs(e);return n+Gee(Math.trunc(t/60),2)+a+Gee(t%60,2)}const eae=(e,a)=>{switch(e){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});default:return a.date({width:"full"})}},aae=(e,a)=>{switch(e){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});default:return a.time({width:"full"})}},nae={p:aae,P:(e,a)=>{const n=e.match(/(P+)(p+)?/)||[],t=n[1],i=n[2];if(!i)return eae(e,a);let r;switch(t){case"P":r=a.dateTime({width:"short"});break;case"PP":r=a.dateTime({width:"medium"});break;case"PPP":r=a.dateTime({width:"long"});break;default:r=a.dateTime({width:"full"})}return r.replace("{{date}}",eae(t,a)).replace("{{time}}",aae(i,a))}},tae=/^D+$/,iae=/^Y+$/,rae=["D","DD","YY","YYYY"];const oae=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,sae=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,lae=/^'([^]*?)'?$/,uae=/''/g,cae=/[a-zA-Z]/;function dae(e,a,n){const t=yee(),i=t.locale??Dee,r=t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,o=t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=hee(e);if(!Tee(s))throw new RangeError("Invalid time value");let l=a.match(sae).map((e=>{const a=e[0];if("p"===a||"P"===a){return(0,nae[a])(e,i.formatLong)}return e})).join("").match(oae).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const a=e[0];if("'"===a)return{isToken:!1,value:mae(e)};if($ee[a])return{isToken:!0,value:e};if(a.match(cae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(l=i.localize.preprocessor(s,l));const u={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return l.map((n=>{if(!n.isToken)return n.value;const t=n.value;(function(e){return iae.test(e)}(t)||function(e){return tae.test(e)}(t))&&function(e,a,n){const t=function(e,a,n){const t="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${a}\`) for formatting ${t} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,a,n);if(rae.includes(e))throw new RangeError(t)}(t,a,String(e));return(0,$ee[t[0]])(s,t,i.localize,u)})).join("")}function mae(e){const a=e.match(lae);return a?a[1].replace(uae,"'"):e}function hae(e,a){return function(e,a,n){const t=yee(),i=n?.locale??t.locale??Dee,r=Mee(e,a);if(isNaN(r))throw new RangeError("Invalid time value");const o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:r});let s,l;r>0?(s=hee(a),l=hee(e)):(s=hee(e),l=hee(a));const u=Eee(l,s),c=(wee(l)-wee(s))/1e3,d=Math.round((u-c)/60);let m;if(d<2)return n?.includeSeconds?u<5?i.formatDistance("lessThanXSeconds",5,o):u<10?i.formatDistance("lessThanXSeconds",10,o):u<20?i.formatDistance("lessThanXSeconds",20,o):u<40?i.formatDistance("halfAMinute",0,o):i.formatDistance(u<60?"lessThanXMinutes":"xMinutes",1,o):0===d?i.formatDistance("lessThanXMinutes",1,o):i.formatDistance("xMinutes",d,o);if(d<45)return i.formatDistance("xMinutes",d,o);if(d<90)return i.formatDistance("aboutXHours",1,o);if(d<1440){const e=Math.round(d/60);return i.formatDistance("aboutXHours",e,o)}if(d<2520)return i.formatDistance("xDays",1,o);if(d<vee){const e=Math.round(d/1440);return i.formatDistance("xDays",e,o)}if(d<86400)return m=Math.round(d/vee),i.formatDistance("aboutXMonths",m,o);if(m=xee(l,s),m<12){const e=Math.round(d/vee);return i.formatDistance("xMonths",e,o)}{const e=m%12,a=Math.trunc(m/12);return e<3?i.formatDistance("aboutXYears",a,o):e<9?i.formatDistance("overXYears",a,o):i.formatDistance("almostXYears",a+1,o)}}(e,function(e){return pee(e,Date.now())}(e),a)}function pae({accessorKey:e,header:a,meta:t,size:i,minSize:r,maxSize:o,enableSorting:s=!0,enableHiding:l=!0,headerClassName:u,cellClassName:c,cellFormatter:d}){return{accessorKey:e,header:()=>n.jsx("div",{className:`flex items-center h-8 px-3 font-medium whitespace-nowrap text-muted-foreground ${"right"===t?.align?"justify-end float-right":"center"===t?.align?"justify-center":"justify-start"} ${u||""}`.trim(),children:"function"==typeof a?a():n.jsx("span",{children:a})}),cell:e=>n.jsx("div",{className:`flex items-center h-8 ${"right"===t?.align?"justify-end":"center"===t?.align?"justify-center":"justify-start"} ${c||""} ${t?.className||""}`.trim(),children:d?d(e):e.getValue()}),size:i,minSize:r,maxSize:o,enableSorting:s,enableHiding:l,meta:t}}const gae=(e,a,n,t="Error",i="Please try again")=>{e(!1),"error"===n&&a({title:t,description:i,variant:"destructive"})},vae=e=>{switch(e){case Xe.ACTIVE:return"statusActive";case Xe.COMPLETED:return"statusCompleted";case Xe.DRAFT:return"statusDraft";case Xe.DEACTIVATED:return"statusDeactivated";case Xe.FAILED:return"statusFailed";case Xe.RUNNING:return"statusRunning";default:throw W$(e,Xe)}},fae=e=>{switch(e){case bY.ALL_USERS:return`Default ${yh("engage:segment").toLowerCase()} that contains all ${yh("engage:user").toLowerCase()}}. This is not editable or deletable.`;case bY.MANAGED:return`System-defined ${yh("engage:segment").toLowerCase()} that are not editable or deletable.`;case bY.CUSTOM:return`Custom ${yh("engage:segment").toLowerCase()} that you can edit and delete as needed.`;default:throw W$(e,bY)}};function yae(e="name",a,t=!1){return pae({accessorKey:e,header:a,meta:{align:"left",displayName:a,className:"min-w-[240px] w-full"},cellClassName:"pl-3 pr-2",cellFormatter:e=>{const a=e.getValue(),{original:i}=e.row,r=i.status,o=i.type,s=r?r[0].toUpperCase()+r.slice(1):"",l={[Xe.ACTIVE]:"bg-blue-500",[Xe.COMPLETED]:"bg-green-500",[Xe.DRAFT]:"bg-gray-500",[Xe.DEACTIVATED]:"bg-red-500",[Xe.FAILED]:"bg-red-500",[Xe.RUNNING]:"bg-yellow-500"};return n.jsxs("div",{className:"w-full flex gap-6 justify-between items-center",children:[n.jsxs("div",{className:"flex gap-1 items-center w-full",children:[n.jsx("div",{className:`w-2 h-2 rounded-full mr-3 flex-shrink-0 ${o?{[bY.ALL_USERS]:"bg-purple-500",[bY.MANAGED]:"bg-teal-500",[bY.CUSTOM]:"bg-amber-500"}[o]:r?l[r]:"bg-blue-500"}`}),n.jsxs("div",{className:"flex-1 flex flex-col gap-0.5",children:[n.jsx("span",{className:"leading-tight font-medium text-sm overflow-hidden text-ellipsis",children:a}),t&&i?.description&&n.jsx("div",{className:"relative h-4",children:n.jsx("div",{className:"absolute inset-0 text-muted-foreground text-xs truncate whitespace-nowrap overflow-hidden w-full",children:i?.description})})]})]}),r&&n.jsx("div",{className:"flex-shrink-0",children:n.jsx(UY,{variant:vae(r),children:s})})]})}})}function kae(){return pae({accessorKey:"type",header:"Type",meta:{align:"right",displayName:`${yh("engage:segment")} type`},cellClassName:"pr-4",cellFormatter:e=>{const a=e.getValue(),t=a?a.split("_").map((e=>e[0].toUpperCase()+e.slice(1).toLowerCase())).join(" "):"Unknown";let i;if(!a||a!==bY.ALL_USERS&&a!==bY.MANAGED&&a!==bY.CUSTOM)i="statusDraft";else try{i=(e=>{switch(e){case bY.ALL_USERS:return"segmentAllUsers";case bY.MANAGED:return"segmentManaged";case bY.CUSTOM:return"segmentCustom";default:throw W$(e,bY)}})(a)}catch(uBe){if(!(uBe instanceof W$))throw uBe;i="statusDraft"}return n.jsx(j6,{children:n.jsxs(L6,{children:[n.jsx(B6,{asChild:!0,children:n.jsx(UY,{variant:i,className:"cursor-help",children:t})}),n.jsx(z6,{side:"top",className:"max-w-[250px] text-sm bg-white border border-gray-200 rounded-lg p-3",children:n.jsx("p",{className:"text-muted-foreground",children:a&&fae(a)||`Unknown ${yh("engage:segment").toLowerCase()} type`})})]})})}})}function bae(e="updated_at"){return function({accessorKey:e,header:a,meta:t={align:"right"},size:i=160,minSize:r,maxSize:o,enableSorting:s=!0,enableHiding:l=!0,headerClassName:u,cellClassName:c,formatType:d="relative"}){return{accessorKey:e,header:()=>n.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${u||""}`.trim(),children:n.jsx("span",{children:a})}),cell:e=>{const a=e.getValue();let i="N/A";return a&&(i="relative"===d?hae(new Date(a),{addSuffix:!0}):new Date(a).toLocaleDateString()),n.jsx("div",{className:`font-variant-numeric w-full h-8 flex items-center justify-end pr-4 whitespace-nowrap ${c||""} ${t?.className||""}`.trim(),children:i})},size:i,minSize:r,maxSize:o,enableSorting:s,enableHiding:l,meta:t}}({accessorKey:e,header:"Last Modified",formatType:"relative",size:160,meta:{align:"right",displayName:"Last Modified"}})}function Sae(e,a,t){return function({accessorKey:e,header:a,meta:t={align:"right"},size:i,minSize:r,maxSize:o=120,enableSorting:s=!0,enableHiding:l=!0,headerClassName:u,cellClassName:c,prefix:d="",suffix:m="",localeStringOptions:h}){return{accessorKey:e,header:()=>n.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${u||""}`.trim(),children:"function"==typeof a?a():n.jsx("span",{children:a})}),cell:e=>{const a=e.getValue()??0;return n.jsxs("div",{className:`font-variant-numeric h-8 flex items-center justify-end pr-4 ${c||""} ${t?.className||""}`.trim(),children:[d,a.toLocaleString(void 0,h),m]})},size:i||(t?.className?.includes("w-")?void 0:100),minSize:r,maxSize:o,enableSorting:s,enableHiding:l,meta:t}}({accessorKey:e,header:a,prefix:t,meta:{align:"right",displayName:a}})}function Aae(e){const{setUrl:a,onToggle:t,automationName:i,vsaasManaged:r}=e;return pae({accessorKey:"status",header:"Status",enableHiding:!1,size:180,maxSize:200,meta:{align:"right"},cellClassName:"pr-4",cellFormatter:e=>{const{original:o}=e.row;return(o.status??null)===Xe.DRAFT&&a&&!1===r?n.jsx(R6,{rowOriginal:o,constructNavigationUrl:()=>a(o.id),cellText:"Action Required",tooltipIcon:n.jsx(zc,{className:"h-4 w-4 text-muted-foreground !cursor-help z-99"}),tooltipText:`Your ${i?.toLowerCase()} is currently in draft mode. Please review and activate it to begin sending messages.`}):n.jsx(S9,{className:"flex items-center justify-end",rowOriginal:o,id:o.id,onToggle:t||(()=>{}),vsaasManaged:r})}})}function wae(e){const a={align:"right",displayName:`Update ${yh("engage:segment").toLowerCase()}`};return function({id:e="actions",header:a,meta:t={align:"center"},text:i,size:r=80,minSize:o=80,maxSize:s=80,enableSorting:l=!1,enableHiding:u=!1,headerClassName:c,icon:d,onAction:m,actionButtonVariant:h="outline",actionButtonSize:p="default"}){return{id:e,header:()=>n.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:"function"==typeof a?a():n.jsx("span",{children:a})}),cell:e=>{const a=e.row.original,r=a?.type,o="custom"!==r;return n.jsx("div",{className:`flex items-center h-8 pr-3 ${"right"===t?.align?"justify-end":"center"===t?.align?"justify-center":"justify-start"} ${t?.className||""}`.trim(),children:n.jsxs(jY,{variant:h,size:p,disabled:o,onClick:()=>m(a),children:[n.jsx(d,{className:"h-4 w-4"}),n.jsx("span",{children:i})]})})},size:r,minSize:o,maxSize:s,enableSorting:l,enableHiding:u,meta:t}}({id:"edit",header:`${yh("engage:segment")} actions`,icon:Jc,onAction:a=>{e(a.id)},text:"Edit",enableHiding:!1,size:80,meta:a})}function Cae(e){const{automationName:a,setUrl:n,onToggle:t,vsaasManaged:i=!1}=e;return[yae("name","Name",!0),Sae("derivedRevenue","Sales","$"),Sae("emailsSent","Email Sent"),Sae("smsSent","SMS Sent"),bae(),Aae({setUrl:n,onToggle:t,automationName:a,vsaasManaged:i})]}const Mae=({title:e,alertText:t,Icon:i=zc,onClick:r,asChild:o=!0,link:s,size:l="medium",iconColor:u="text-gray-400"})=>{const[c,d]=a.useState(!1);return n.jsx(j6,{children:n.jsxs(L6,{open:c,onOpenChange:d,children:[n.jsx(B6,{asChild:o,onClick:e=>{e.stopPropagation(),s&&window.open(s.url,"_blank"),r?(r(),d(!1)):d(!c)},children:n.jsx(i,{className:LG({small:"h-3 w-3",medium:"h-4 w-4",large:"h-5 w-5"}[l],"cursor-pointer transition-colors",u)})}),n.jsx(z6,{className:"bg-white text-gray-900 border border-gray-200 shadow-lg text-left",children:n.jsxs("div",{className:"flex flex-col items-center justify-center w-full gap-2 max-w-[300px]",children:[t&&n.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[n.jsx(RY.AlertTriangleIcon,{className:"text-amber-500 w-6 h-6"}),n.jsx("p",{className:"font-medium text-amber-500 text-center text-[14px]",children:t})]}),n.jsx("p",{className:"text-[13px] leading-relaxed text-black text-center",children:e}),s&&n.jsx("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"text-[13px] text-blue-500 hover:text-blue-600 hover:underline transition-colors text-center",onClick:e=>e.stopPropagation(),children:s.text??"Click to learn more"})]})})]})})},Tae=({handleBack:e,handleNext:a,handleSkipAndSaveAsDraft:t,backText:i,nextText:r,backDisabled:o,nextDisabled:s,hideBack:l,getInfoTooltipTitle:u})=>{const c=u?.();return n.jsxs("div",{className:"flex gap-4 py-2 items-center",children:[!l&&n.jsxs(jY,{onClick:e,disabled:o,variant:"secondary",className:im("flex items-center gap-2",o&&"opacity-50 cursor-not-allowed"),children:[n.jsx(RY.BackButton,{}),n.jsx("span",{children:i})]}),n.jsx(jY,{onClick:t,variant:"secondary",className:"flex items-center gap-2",children:"Skip & Save as Draft"}),n.jsxs(jY,{onClick:a,disabled:s,className:im("flex items-center gap-2 --reach-destructive",s&&"opacity-50 cursor-not-allowed"),children:[n.jsx("span",{children:r}),n.jsx(RY.NextButton,{})]}),c&&n.jsx(Mae,{title:c})]})},Nae=({content:e,className:a})=>n.jsx("div",{className:LG("flex flex-col gap-4 w-full p-6",a),children:n.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 relative",children:e})}),xae=(e,n)=>{const[t,i]=a.useState(e);return a.useEffect((()=>{const a=setTimeout((()=>{i(e)}),n);return()=>clearTimeout(a)}),[e,n]),t};function Eae(e,a){if("function"==typeof e)return e(a);null!=e&&(e.current=a)}function Pae(e){const a=jae(e),t=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),l=s.find(Bae);if(l){const e=l.props.children,i=s.map((a=>a===l?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(a,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n.jsx(a,{...o,ref:t,children:i})}));return t.displayName=`${e}.Slot`,t}function jae(e){const a=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{r(...e),i(...e)}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?function(...e){return a=>{let n=!1;const t=e.map((e=>{const t=Eae(e,a);return n||"function"!=typeof t||(n=!0),t}));if(n)return()=>{for(let a=0;a<t.length;a++){const n=t[a];"function"==typeof n?n():Eae(e[a],null)}}}}(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));return a.displayName=`${e}.SlotClone`,a}var Lae=Symbol("radix.slottable");function Bae(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Lae}var zae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,a)=>{const t=Pae(`Primitive.${a}`),i=r.forwardRef(((e,i)=>{const{asChild:r,...o}=e,s=r?t:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(s,{...o,ref:i})}));return i.displayName=`Primitive.${a}`,{...e,[a]:i}}),{}),Rae=r.forwardRef(((e,a)=>n.jsx(zae.label,{...e,ref:a,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(e.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}})));Rae.displayName="Label";var _ae=Rae;const Dae=lc("text-foreground text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Kae=r.forwardRef((({className:e,...a},t)=>n.jsx(_ae,{ref:t,className:im(Dae(),e),...a})));function Hae(e,[a,n]){return Math.min(n,Math.max(a,e))}function Oae(e,a,{checkForDefaultPrevented:n=!0}={}){return function(t){if(e?.(t),!1===n||!t.defaultPrevented)return a?.(t)}}function Iae(e,a=[]){let t=[];const i=()=>{const a=t.map((e=>r.createContext(e)));return function(n){const t=n?.[e]||a;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:t}})),[n,t])}};return i.scopeName=e,[function(a,i){const o=r.createContext(i),s=t.length;t=[...t,i];const l=a=>{const{scope:t,children:i,...l}=a,u=t?.[e]?.[s]||o,c=r.useMemo((()=>l),Object.values(l));return n.jsx(u.Provider,{value:c,children:i})};return l.displayName=a+"Provider",[l,function(n,t){const l=r.useContext(t?.[e]?.[s]||o);if(l)return l;if(void 0!==i)return i;throw new Error(`\`${n}\` must be used within \`${a}\``)}]},Gae(i,...a)]}function Gae(...e){const a=e[0];if(1===e.length)return a;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const t=n.reduce(((a,{useScope:n,scopeName:t})=>({...a,...n(e)[`__scope${t}`]})),{});return r.useMemo((()=>({[`__scope${a.scopeName}`]:t})),[t])}};return n.scopeName=a.scopeName,n}function Vae(e,a){if("function"==typeof e)return e(a);null!=e&&(e.current=a)}function Fae(...e){return a=>{let n=!1;const t=e.map((e=>{const t=Vae(e,a);return n||"function"!=typeof t||(n=!0),t}));if(n)return()=>{for(let a=0;a<t.length;a++){const n=t[a];"function"==typeof n?n():Vae(e[a],null)}}}}function Jae(...e){return r.useCallback(Fae(...e),e)}function Uae(e){const a=Wae(e),t=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),l=s.find(Zae);if(l){const e=l.props.children,i=s.map((a=>a===l?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(a,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n.jsx(a,{...o,ref:t,children:i})}));return t.displayName=`${e}.Slot`,t}function Wae(e){const a=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{r(...e),i(...e)}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?Fae(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));return a.displayName=`${e}.SlotClone`,a}Kae.displayName=_ae.displayName;var qae=Symbol("radix.slottable");function Zae(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===qae}var $ae=r.createContext(void 0);var Yae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,a)=>{const t=Uae(`Primitive.${a}`),i=r.forwardRef(((e,i)=>{const{asChild:r,...o}=e,s=r?t:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(s,{...o,ref:i})}));return i.displayName=`Primitive.${a}`,{...e,[a]:i}}),{});function Qae(e){const a=r.useRef(e);return r.useEffect((()=>{a.current=e})),r.useMemo((()=>(...e)=>a.current?.(...e)),[])}var Xae,ene="dismissableLayer.update",ane="dismissableLayer.pointerDownOutside",nne="dismissableLayer.focusOutside",tne=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ine=r.forwardRef(((e,a)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:u,...c}=e,d=r.useContext(tne),[m,h]=r.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=r.useState({}),v=Jae(a,(e=>h(e))),f=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=f.indexOf(y),b=m?f.indexOf(m):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,A=b>=k,w=function(e,a=globalThis?.document){const n=Qae(e),t=r.useRef(!1),i=r.useRef((()=>{}));return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){let t=function(){one(ane,n,r,{discrete:!0})};const r={originalEvent:e};"touch"===e.pointerType?(a.removeEventListener("click",i.current),i.current=t,a.addEventListener("click",i.current,{once:!0})):t()}else a.removeEventListener("click",i.current);t.current=!1},r=window.setTimeout((()=>{a.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),a.removeEventListener("pointerdown",e),a.removeEventListener("click",i.current)}}),[a,n]),{onPointerDownCapture:()=>t.current=!0}}((e=>{const a=e.target,n=[...d.branches].some((e=>e.contains(a)));A&&!n&&(o?.(e),l?.(e),e.defaultPrevented||u?.())}),p),C=function(e,a=globalThis?.document){const n=Qae(e),t=r.useRef(!1);return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){one(nne,n,{originalEvent:e},{discrete:!1})}};return a.addEventListener("focusin",e),()=>a.removeEventListener("focusin",e)}),[a,n]),{onFocusCapture:()=>t.current=!0,onBlurCapture:()=>t.current=!1}}((e=>{const a=e.target;[...d.branches].some((e=>e.contains(a)))||(s?.(e),l?.(e),e.defaultPrevented||u?.())}),p);return function(e,a=globalThis?.document){const n=Qae(e);r.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return a.addEventListener("keydown",e,{capture:!0}),()=>a.removeEventListener("keydown",e,{capture:!0})}),[n,a])}((e=>{b===d.layers.size-1&&(i?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))}),p),r.useEffect((()=>{if(m)return t&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(Xae=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),rne(),()=>{t&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Xae)}}),[m,p,t,d]),r.useEffect((()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),rne())}),[m,d]),r.useEffect((()=>{const e=()=>g({});return document.addEventListener(ene,e),()=>document.removeEventListener(ene,e)}),[]),n.jsx(Yae.div,{...c,ref:v,style:{pointerEvents:S?A?"auto":"none":void 0,...e.style},onFocusCapture:Oae(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Oae(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Oae(e.onPointerDownCapture,w.onPointerDownCapture)})}));ine.displayName="DismissableLayer";function rne(){const e=new CustomEvent(ene);document.dispatchEvent(e)}function one(e,a,n,{discrete:t}){const i=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});a&&i.addEventListener(e,a,{once:!0}),t?function(e,a){e&&o.flushSync((()=>e.dispatchEvent(a)))}(i,r):i.dispatchEvent(r)}r.forwardRef(((e,a)=>{const t=r.useContext(tne),i=r.useRef(null),o=Jae(a,i);return r.useEffect((()=>{const e=i.current;if(e)return t.branches.add(e),()=>{t.branches.delete(e)}}),[t.branches]),n.jsx(Yae.div,{...e,ref:o})})).displayName="DismissableLayerBranch";var sne=0;function lne(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var une="focusScope.autoFocusOnMount",cne="focusScope.autoFocusOnUnmount",dne={bubbles:!1,cancelable:!0},mne=r.forwardRef(((e,a)=>{const{loop:t=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=e,[u,c]=r.useState(null),d=Qae(o),m=Qae(s),h=r.useRef(null),p=Jae(a,(e=>c(e))),g=r.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;r.useEffect((()=>{if(i){let e=function(e){if(g.paused||!u)return;const a=e.target;u.contains(a)?h.current=a:vne(h.current,{select:!0})},a=function(e){if(g.paused||!u)return;const a=e.relatedTarget;null!==a&&(u.contains(a)||vne(h.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const a of e)a.removedNodes.length>0&&vne(u)};document.addEventListener("focusin",e),document.addEventListener("focusout",a);const t=new MutationObserver(n);return u&&t.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",a),t.disconnect()}}}),[i,u,g.paused]),r.useEffect((()=>{if(u){fne.add(g);const a=document.activeElement;if(!u.contains(a)){const n=new CustomEvent(une,dne);u.addEventListener(une,d),u.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:a=!1}={}){const n=document.activeElement;for(const t of e)if(vne(t,{select:a}),document.activeElement!==n)return}((e=hne(u),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===a&&vne(u))}return()=>{u.removeEventListener(une,d),setTimeout((()=>{const e=new CustomEvent(cne,dne);u.addEventListener(cne,m),u.dispatchEvent(e),e.defaultPrevented||vne(a??document.body,{select:!0}),u.removeEventListener(cne,m),fne.remove(g)}),0)}}var e}),[u,d,m,g]);const v=r.useCallback((e=>{if(!t&&!i)return;if(g.paused)return;const a=document.activeElement;if("Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&a){const n=e.currentTarget,[i,r]=function(e){const a=hne(e),n=pne(a,e),t=pne(a.reverse(),e);return[n,t]}(n);i&&r?e.shiftKey||a!==r?e.shiftKey&&a===i&&(e.preventDefault(),t&&vne(r,{select:!0})):(e.preventDefault(),t&&vne(i,{select:!0})):a===n&&e.preventDefault()}}),[t,i,g.paused]);return n.jsx(Yae.div,{tabIndex:-1,...l,ref:p,onKeyDown:v})}));function hne(e){const a=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)a.push(n.currentNode);return a}function pne(e,a){for(const n of e)if(!gne(n,{upTo:a}))return n}function gne(e,{upTo:a}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==a&&e===a)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function vne(e,{select:a=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&a&&e.select()}}mne.displayName="FocusScope";var fne=function(){let e=[];return{add(a){const n=e[0];a!==n&&n?.pause(),e=yne(e,a),e.unshift(a)},remove(a){e=yne(e,a),e[0]?.resume()}}}();function yne(e,a){const n=[...e],t=n.indexOf(a);return-1!==t&&n.splice(t,1),n}var kne=globalThis?.document?r.useLayoutEffect:()=>{},bne=r[" useId ".trim().toString()]||(()=>{}),Sne=0;function Ane(e){const[a,n]=r.useState(bne());return kne((()=>{n((e=>e??String(Sne++)))}),[e]),e||(a?`radix-${a}`:"")}var wne=r.forwardRef(((e,a)=>{const{children:t,width:i=10,height:r=5,...o}=e;return n.jsx(Yae.svg,{...o,ref:a,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?t:n.jsx("polygon",{points:"0,0 30,0 15,10"})})}));wne.displayName="Arrow";var Cne=wne;var Mne="Popper",[Tne,Nne]=Iae(Mne),[xne,Ene]=Tne(Mne),Pne=e=>{const{__scopePopper:a,children:t}=e,[i,o]=r.useState(null);return n.jsx(xne,{scope:a,anchor:i,onAnchorChange:o,children:t})};Pne.displayName=Mne;var jne="PopperAnchor",Lne=r.forwardRef(((e,a)=>{const{__scopePopper:t,virtualRef:i,...o}=e,s=Ene(jne,t),l=r.useRef(null),u=Jae(a,l);return r.useEffect((()=>{s.onAnchorChange(i?.current||l.current)})),i?null:n.jsx(Yae.div,{...o,ref:u})}));Lne.displayName=jne;var Bne="PopperContent",[zne,Rne]=Tne(Bne),_ne=r.forwardRef(((e,a)=>{const{__scopePopper:t,side:i="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:v,...f}=e,y=Ene(Bne,t),[k,b]=r.useState(null),S=Jae(a,(e=>b(e))),[A,w]=r.useState(null),C=function(e){const[a,n]=r.useState(void 0);return kne((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver((a=>{if(!Array.isArray(a))return;if(!a.length)return;const t=a[0];let i,r;if("borderBoxSize"in t){const e=t.borderBoxSize,a=Array.isArray(e)?e[0]:e;i=a.inlineSize,r=a.blockSize}else i=e.offsetWidth,r=e.offsetHeight;n({width:i,height:r})}));return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}n(void 0)}),[e]),a}(A),M=C?.width??0,T=C?.height??0,N=i+("center"!==s?"-"+s:""),x="number"==typeof m?m:{top:0,right:0,bottom:0,left:0,...m},E=Array.isArray(d)?d:[d],P=E.length>0,j={padding:x,boundary:E.filter(One),altBoundary:P},{refs:L,floatingStyles:B,placement:z,isPositioned:R,middlewareData:_}=r1({strategy:"fixed",placement:N,whileElementsMounted:(...e)=>J0(...e,{animationFrame:"always"===g}),elements:{reference:y.anchor},middleware:[s1({mainAxis:o+T,alignmentAxis:l}),c&&l1({mainAxis:!0,crossAxis:!1,limiter:"partial"===h?u1():void 0,...j}),c&&c1({...j}),d1({...j,apply:({elements:e,rects:a,availableWidth:n,availableHeight:t})=>{const{width:i,height:r}=a.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${n}px`),o.setProperty("--radix-popper-available-height",`${t}px`),o.setProperty("--radix-popper-anchor-width",`${i}px`),o.setProperty("--radix-popper-anchor-height",`${r}px`)}}),A&&h1({element:A,padding:u}),Ine({arrowWidth:M,arrowHeight:T}),p&&m1({strategy:"referenceHidden",...j})]}),[D,K]=Gne(z),H=Qae(v);kne((()=>{R&&H?.()}),[R,H]);const O=_.arrow?.x,I=_.arrow?.y,G=0!==_.arrow?.centerOffset,[V,F]=r.useState();return kne((()=>{k&&F(window.getComputedStyle(k).zIndex)}),[k]),n.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:R?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[_.transformOrigin?.x,_.transformOrigin?.y].join(" "),..._.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:n.jsx(zne,{scope:t,placedSide:D,onArrowChange:w,arrowX:O,arrowY:I,shouldHideArrow:G,children:n.jsx(Yae.div,{"data-side":D,"data-align":K,...f,ref:S,style:{...f.style,animation:R?void 0:"none"}})})})}));_ne.displayName=Bne;var Dne="PopperArrow",Kne={top:"bottom",right:"left",bottom:"top",left:"right"},Hne=r.forwardRef((function(e,a){const{__scopePopper:t,...i}=e,r=Rne(Dne,t),o=Kne[r.placedSide];return n.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:n.jsx(Cne,{...i,ref:a,style:{...i.style,display:"block"}})})}));function One(e){return null!==e}Hne.displayName=Dne;var Ine=e=>({name:"transformOrigin",options:e,fn(a){const{placement:n,rects:t,middlewareData:i}=a,r=0!==i.arrow?.centerOffset,o=r?0:e.arrowWidth,s=r?0:e.arrowHeight,[l,u]=Gne(n),c={start:"0%",center:"50%",end:"100%"}[u],d=(i.arrow?.x??0)+o/2,m=(i.arrow?.y??0)+s/2;let h="",p="";return"bottom"===l?(h=r?c:`${d}px`,p=-s+"px"):"top"===l?(h=r?c:`${d}px`,p=`${t.floating.height+s}px`):"right"===l?(h=-s+"px",p=r?c:`${m}px`):"left"===l&&(h=`${t.floating.width+s}px`,p=r?c:`${m}px`),{data:{x:h,y:p}}}});function Gne(e){const[a,n="center"]=e.split("-");return[a,n]}var Vne=Pne,Fne=Lne,Jne=_ne,Une=Hne,Wne=r.forwardRef(((e,a)=>{const{container:i,...o}=e,[s,l]=r.useState(!1);kne((()=>l(!0)),[]);const u=i||s&&globalThis?.document?.body;return u?t.createPortal(n.jsx(Yae.div,{...o,ref:a}),u):null}));Wne.displayName="Portal";var qne=r[" useInsertionEffect ".trim().toString()]||kne;function Zne({prop:e,defaultProp:a,onChange:n=()=>{},caller:t}){const[i,o,s]=function({defaultProp:e,onChange:a}){const[n,t]=r.useState(e),i=r.useRef(n),o=r.useRef(a);return qne((()=>{o.current=a}),[a]),r.useEffect((()=>{i.current!==n&&(o.current?.(n),i.current=n)}),[n,i]),[n,t,o]}({defaultProp:a,onChange:n}),l=void 0!==e,u=l?e:i;{const a=r.useRef(void 0!==e);r.useEffect((()=>{const e=a.current;if(e!==l){}a.current=l}),[l,t])}const c=r.useCallback((a=>{if(l){const n=function(e){return"function"==typeof e}(a)?a(e):a;n!==e&&s.current?.(n)}else o(a)}),[l,e,o,s]);return[u,c]}var $ne=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});r.forwardRef(((e,a)=>n.jsx(Yae.span,{...e,ref:a,style:{...$ne,...e.style}}))).displayName="VisuallyHidden";var Yne=[" ","Enter","ArrowUp","ArrowDown"],Qne=[" ","Enter"],Xne="Select",[ete,ate,nte]=function(e){const t=e+"CollectionProvider",[i,r]=Iae(t),[o,s]=i(t,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:t,children:i}=e,r=a.useRef(null),s=a.useRef(new Map).current;return n.jsx(o,{scope:t,itemMap:s,collectionRef:r,children:i})};l.displayName=t;const u=e+"CollectionSlot",c=Uae(u),d=a.forwardRef(((e,a)=>{const{scope:t,children:i}=e,r=Jae(a,s(u,t).collectionRef);return n.jsx(c,{ref:r,children:i})}));d.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",p=Uae(m),g=a.forwardRef(((e,t)=>{const{scope:i,children:r,...o}=e,l=a.useRef(null),u=Jae(t,l),c=s(m,i);return a.useEffect((()=>(c.itemMap.set(l,{ref:l,...o}),()=>{c.itemMap.delete(l)}))),n.jsx(p,{[h]:"",ref:u,children:r})}));return g.displayName=m,[{Provider:l,Slot:d,ItemSlot:g},function(n){const t=s(e+"CollectionConsumer",n);return a.useCallback((()=>{const e=t.collectionRef.current;if(!e)return[];const a=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(t.itemMap.values()).sort(((e,n)=>a.indexOf(e.ref.current)-a.indexOf(n.ref.current)))}),[t.collectionRef,t.itemMap])},r]}(Xne),[tte,ite]=Iae(Xne,[nte,Nne]),rte=Nne(),[ote,ste]=tte(Xne),[lte,ute]=tte(Xne),cte=e=>{const{__scopeSelect:a,children:t,open:i,defaultOpen:o,onOpenChange:s,value:l,defaultValue:u,onValueChange:c,dir:d,name:m,autoComplete:h,disabled:p,required:g,form:v}=e,f=rte(a),[y,k]=r.useState(null),[b,S]=r.useState(null),[A,w]=r.useState(!1),C=function(e){const a=r.useContext($ae);return e||a||"ltr"}(d),[M,T]=Zne({prop:i,defaultProp:o??!1,onChange:s,caller:Xne}),[N,x]=Zne({prop:l,defaultProp:u,onChange:c,caller:Xne}),E=r.useRef(null),P=!y||(v||!!y.closest("form")),[j,L]=r.useState(new Set),B=Array.from(j).map((e=>e.props.value)).join(";");return n.jsx(Vne,{...f,children:n.jsxs(ote,{required:g,scope:a,trigger:y,onTriggerChange:k,valueNode:b,onValueNodeChange:S,valueNodeHasChildren:A,onValueNodeHasChildrenChange:w,contentId:Ane(),value:N,onValueChange:x,open:M,onOpenChange:T,dir:C,triggerPointerDownPosRef:E,disabled:p,children:[n.jsx(ete.Provider,{scope:a,children:n.jsx(lte,{scope:e.__scopeSelect,onNativeOptionAdd:r.useCallback((e=>{L((a=>new Set(a).add(e)))}),[]),onNativeOptionRemove:r.useCallback((e=>{L((a=>{const n=new Set(a);return n.delete(e),n}))}),[]),children:t})}),P?n.jsxs(Yte,{"aria-hidden":!0,required:g,tabIndex:-1,name:m,autoComplete:h,value:N,onChange:e=>x(e.target.value),disabled:p,form:v,children:[void 0===N?n.jsx("option",{value:""}):null,Array.from(j)]},B):null]})})};cte.displayName=Xne;var dte="SelectTrigger",mte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,disabled:i=!1,...o}=e,s=rte(t),l=ste(dte,t),u=l.disabled||i,c=Jae(a,l.onTriggerChange),d=ate(t),m=r.useRef("touch"),[h,p,g]=Xte((e=>{const a=d().filter((e=>!e.disabled)),n=a.find((e=>e.value===l.value)),t=eie(a,e,n);void 0!==t&&l.onValueChange(t.value)})),v=e=>{u||(l.onOpenChange(!0),g()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return n.jsx(Fne,{asChild:!0,...s,children:n.jsx(Yae.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":Qte(l.value)?"":void 0,...o,ref:c,onClick:Oae(o.onClick,(e=>{e.currentTarget.focus(),"mouse"!==m.current&&v(e)})),onPointerDown:Oae(o.onPointerDown,(e=>{m.current=e.pointerType;const a=e.target;a.hasPointerCapture(e.pointerId)&&a.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(v(e),e.preventDefault())})),onKeyDown:Oae(o.onKeyDown,(e=>{const a=""!==h.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),a&&" "===e.key||Yne.includes(e.key)&&(v(),e.preventDefault())}))})})}));mte.displayName=dte;var hte="SelectValue",pte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,className:i,style:r,children:o,placeholder:s="",...l}=e,u=ste(hte,t),{onValueNodeHasChildrenChange:c}=u,d=void 0!==o,m=Jae(a,u.onValueNodeChange);return kne((()=>{c(d)}),[c,d]),n.jsx(Yae.span,{...l,ref:m,style:{pointerEvents:"none"},children:Qte(u.value)?n.jsx(n.Fragment,{children:s}):o})}));pte.displayName=hte;var gte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,children:i,...r}=e;return n.jsx(Yae.span,{"aria-hidden":!0,...r,ref:a,children:i||"▼"})}));gte.displayName="SelectIcon";var vte=e=>n.jsx(Wne,{asChild:!0,...e});vte.displayName="SelectPortal";var fte="SelectContent",yte=r.forwardRef(((e,a)=>{const t=ste(fte,e.__scopeSelect),[i,s]=r.useState();if(kne((()=>{s(new DocumentFragment)}),[]),!t.open){const a=i;return a?o.createPortal(n.jsx(bte,{scope:e.__scopeSelect,children:n.jsx(ete.Slot,{scope:e.__scopeSelect,children:n.jsx("div",{children:e.children})})}),a):null}return n.jsx(wte,{...e,ref:a})}));yte.displayName=fte;var kte=10,[bte,Ste]=tte(fte),Ate=Uae("SelectContent.RemoveScroll"),wte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:l,side:u,sideOffset:c,align:d,alignOffset:m,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:f,avoidCollisions:y,...k}=e,b=ste(fte,t),[S,A]=r.useState(null),[w,C]=r.useState(null),M=Jae(a,(e=>A(e))),[T,N]=r.useState(null),[x,E]=r.useState(null),P=ate(t),[j,L]=r.useState(!1),B=r.useRef(!1);r.useEffect((()=>{if(S)return JI(S)}),[S]),r.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lne()),document.body.insertAdjacentElement("beforeend",e[1]??lne()),sne++,()=>{1===sne&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),sne--}}),[]);const z=r.useCallback((e=>{const[a,...n]=P().map((e=>e.ref.current)),[t]=n.slice(-1),i=document.activeElement;for(const r of e){if(r===i)return;if(r?.scrollIntoView({block:"nearest"}),r===a&&w&&(w.scrollTop=0),r===t&&w&&(w.scrollTop=w.scrollHeight),r?.focus(),document.activeElement!==i)return}}),[P,w]),R=r.useCallback((()=>z([T,S])),[z,T,S]);r.useEffect((()=>{j&&R()}),[j,R]);const{onOpenChange:_,triggerPointerDownPosRef:D}=b;r.useEffect((()=>{if(S){let e={x:0,y:0};const a=a=>{e={x:Math.abs(Math.round(a.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(a.pageY)-(D.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():S.contains(n.target)||_(!1),document.removeEventListener("pointermove",a),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",a),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",n,{capture:!0})}}}),[S,_,D]),r.useEffect((()=>{const e=()=>_(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}}),[_]);const[K,H]=Xte((e=>{const a=P().filter((e=>!e.disabled)),n=a.find((e=>e.ref.current===document.activeElement)),t=eie(a,e,n);t&&setTimeout((()=>t.ref.current.focus()))})),O=r.useCallback(((e,a,n)=>{const t=!B.current&&!n;(void 0!==b.value&&b.value===a||t)&&(N(e),t&&(B.current=!0))}),[b.value]),I=r.useCallback((()=>S?.focus()),[S]),G=r.useCallback(((e,a,n)=>{(void 0!==b.value&&b.value===a||!B.current&&!n)&&E(e)}),[b.value]),V="popper"===i?Mte:Cte,F=V===Mte?{side:u,sideOffset:c,align:d,alignOffset:m,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:f,avoidCollisions:y}:{};return n.jsx(bte,{scope:t,content:S,viewport:w,onViewportChange:C,itemRefCallback:O,selectedItem:T,onItemLeave:I,itemTextRefCallback:G,focusSelectedItem:R,selectedItemText:x,position:i,isPositioned:j,searchRef:K,children:n.jsx(KI,{as:Ate,allowPinchZoom:!0,children:n.jsx(mne,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Oae(o,(e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()})),children:n.jsx(ine,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:n.jsx(V,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:e=>e.preventDefault(),...k,...F,onPlaced:()=>L(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Oae(k.onKeyDown,(e=>{const a=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),a||1!==e.key.length||H(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let a=P().filter((e=>!e.disabled)).map((e=>e.ref.current));if(["ArrowUp","End"].includes(e.key)&&(a=a.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=a.indexOf(e.target);a=a.slice(n+1)}setTimeout((()=>z(a))),e.preventDefault()}}))})})})})})}));wte.displayName="SelectContentImpl";var Cte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,onPlaced:i,...o}=e,s=ste(fte,t),l=Ste(fte,t),[u,c]=r.useState(null),[d,m]=r.useState(null),h=Jae(a,(e=>m(e))),p=ate(t),g=r.useRef(!1),v=r.useRef(!0),{viewport:f,selectedItem:y,selectedItemText:k,focusSelectedItem:b}=l,S=r.useCallback((()=>{if(s.trigger&&s.valueNode&&u&&d&&f&&y&&k){const e=s.trigger.getBoundingClientRect(),a=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),t=k.getBoundingClientRect();if("rtl"!==s.dir){const i=n.left-(t.left-a.left),r=e.width+(e.left-i),o=Math.max(r,a.width),s=window.innerWidth-kte,l=Hae(i,[kte,Math.max(kte,s-o)]);u.style.minWidth=r+"px",u.style.left=l+"px"}else{const i=window.innerWidth-n.right-(a.right-t.right),r=window.innerWidth-e.right-i,o=e.width+r,s=Math.max(o,a.width),l=window.innerWidth-kte,c=Hae(i,[kte,Math.max(kte,l-s)]);u.style.minWidth=o+"px",u.style.right=c+"px"}const r=p(),o=window.innerHeight-2*kte,l=f.scrollHeight,c=window.getComputedStyle(d),m=parseInt(c.borderTopWidth,10),h=parseInt(c.paddingTop,10),v=parseInt(c.borderBottomWidth,10),b=m+h+l+parseInt(c.paddingBottom,10)+v,S=Math.min(5*y.offsetHeight,b),A=window.getComputedStyle(f),w=parseInt(A.paddingTop,10),C=parseInt(A.paddingBottom,10),M=e.top+e.height/2-kte,T=o-M,N=y.offsetHeight/2,x=m+h+(y.offsetTop+N),E=b-x;if(x<=M){const e=r.length>0&&y===r[r.length-1].ref.current;u.style.bottom="0px";const a=Math.max(T,N+(e?C:0)+(d.clientHeight-f.offsetTop-f.offsetHeight)+v);u.style.height=x+a+"px"}else{const e=r.length>0&&y===r[0].ref.current;u.style.top="0px";const a=Math.max(M,m+f.offsetTop+(e?w:0)+N);u.style.height=a+E+"px",f.scrollTop=x-M+f.offsetTop}u.style.margin=`${kte}px 0`,u.style.minHeight=S+"px",u.style.maxHeight=o+"px",i?.(),requestAnimationFrame((()=>g.current=!0))}}),[p,s.trigger,s.valueNode,u,d,f,y,k,s.dir,i]);kne((()=>S()),[S]);const[A,w]=r.useState();kne((()=>{d&&w(window.getComputedStyle(d).zIndex)}),[d]);const C=r.useCallback((e=>{e&&!0===v.current&&(S(),b?.(),v.current=!1)}),[S,b]);return n.jsx(Tte,{scope:t,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:C,children:n.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:n.jsx(Yae.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})}));Cte.displayName="SelectItemAlignedPosition";var Mte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,align:i="start",collisionPadding:r=kte,...o}=e,s=rte(t);return n.jsx(Jne,{...s,...o,ref:a,align:i,collisionPadding:r,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})}));Mte.displayName="SelectPopperPosition";var[Tte,Nte]=tte(fte,{}),xte="SelectViewport",Ete=r.forwardRef(((e,a)=>{const{__scopeSelect:t,nonce:i,...o}=e,s=Ste(xte,t),l=Nte(xte,t),u=Jae(a,s.onViewportChange),c=r.useRef(0);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),n.jsx(ete.Slot,{scope:t,children:n.jsx(Yae.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Oae(o.onScroll,(e=>{const a=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:t}=l;if(t?.current&&n){const e=Math.abs(c.current-a.scrollTop);if(e>0){const t=window.innerHeight-2*kte,i=parseFloat(n.style.minHeight),r=parseFloat(n.style.height),o=Math.max(i,r);if(o<t){const i=o+e,r=Math.min(t,i),s=i-r;n.style.height=r+"px","0px"===n.style.bottom&&(a.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}c.current=a.scrollTop}))})})]})}));Ete.displayName=xte;var Pte="SelectGroup",[jte,Lte]=tte(Pte),Bte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e,r=Ane();return n.jsx(jte,{scope:t,id:r,children:n.jsx(Yae.div,{role:"group","aria-labelledby":r,...i,ref:a})})}));Bte.displayName=Pte;var zte="SelectLabel",Rte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e,r=Lte(zte,t);return n.jsx(Yae.div,{id:r.id,...i,ref:a})}));Rte.displayName=zte;var _te="SelectItem",[Dte,Kte]=tte(_te),Hte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,value:i,disabled:o=!1,textValue:s,...l}=e,u=ste(_te,t),c=Ste(_te,t),d=u.value===i,[m,h]=r.useState(s??""),[p,g]=r.useState(!1),v=Jae(a,(e=>c.itemRefCallback?.(e,i,o))),f=Ane(),y=r.useRef("touch"),k=()=>{o||(u.onValueChange(i),u.onOpenChange(!1))};if(""===i)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return n.jsx(Dte,{scope:t,value:i,disabled:o,textId:f,isSelected:d,onItemTextChange:r.useCallback((e=>{h((a=>a||(e?.textContent??"").trim()))}),[]),children:n.jsx(ete.ItemSlot,{scope:t,value:i,disabled:o,textValue:m,children:n.jsx(Yae.div,{role:"option","aria-labelledby":f,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:v,onFocus:Oae(l.onFocus,(()=>g(!0))),onBlur:Oae(l.onBlur,(()=>g(!1))),onClick:Oae(l.onClick,(()=>{"mouse"!==y.current&&k()})),onPointerUp:Oae(l.onPointerUp,(()=>{"mouse"===y.current&&k()})),onPointerDown:Oae(l.onPointerDown,(e=>{y.current=e.pointerType})),onPointerMove:Oae(l.onPointerMove,(e=>{y.current=e.pointerType,o?c.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})})),onPointerLeave:Oae(l.onPointerLeave,(e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()})),onKeyDown:Oae(l.onKeyDown,(e=>{""!==c.searchRef?.current&&" "===e.key||(Qne.includes(e.key)&&k()," "===e.key&&e.preventDefault())}))})})})}));Hte.displayName=_te;var Ote="SelectItemText",Ite=r.forwardRef(((e,a)=>{const{__scopeSelect:t,className:i,style:s,...l}=e,u=ste(Ote,t),c=Ste(Ote,t),d=Kte(Ote,t),m=ute(Ote,t),[h,p]=r.useState(null),g=Jae(a,(e=>p(e)),d.onItemTextChange,(e=>c.itemTextRefCallback?.(e,d.value,d.disabled))),v=h?.textContent,f=r.useMemo((()=>n.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value)),[d.disabled,d.value,v]),{onNativeOptionAdd:y,onNativeOptionRemove:k}=m;return kne((()=>(y(f),()=>k(f))),[y,k,f]),n.jsxs(n.Fragment,{children:[n.jsx(Yae.span,{id:d.textId,...l,ref:g}),d.isSelected&&u.valueNode&&!u.valueNodeHasChildren?o.createPortal(l.children,u.valueNode):null]})}));Ite.displayName=Ote;var Gte="SelectItemIndicator",Vte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e;return Kte(Gte,t).isSelected?n.jsx(Yae.span,{"aria-hidden":!0,...i,ref:a}):null}));Vte.displayName=Gte;var Fte="SelectScrollUpButton",Jte=r.forwardRef(((e,a)=>{const t=Ste(Fte,e.__scopeSelect),i=Nte(Fte,e.__scopeSelect),[o,s]=r.useState(!1),l=Jae(a,i.onScrollButtonChange);return kne((()=>{if(t.viewport&&t.isPositioned){let e=function(){s(a.scrollTop>0)};const a=t.viewport;return e(),a.addEventListener("scroll",e),()=>a.removeEventListener("scroll",e)}}),[t.viewport,t.isPositioned]),o?n.jsx(qte,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:a}=t;e&&a&&(e.scrollTop=e.scrollTop-a.offsetHeight)}}):null}));Jte.displayName=Fte;var Ute="SelectScrollDownButton",Wte=r.forwardRef(((e,a)=>{const t=Ste(Ute,e.__scopeSelect),i=Nte(Ute,e.__scopeSelect),[o,s]=r.useState(!1),l=Jae(a,i.onScrollButtonChange);return kne((()=>{if(t.viewport&&t.isPositioned){let e=function(){const e=a.scrollHeight-a.clientHeight,n=Math.ceil(a.scrollTop)<e;s(n)};const a=t.viewport;return e(),a.addEventListener("scroll",e),()=>a.removeEventListener("scroll",e)}}),[t.viewport,t.isPositioned]),o?n.jsx(qte,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:a}=t;e&&a&&(e.scrollTop=e.scrollTop+a.offsetHeight)}}):null}));Wte.displayName=Ute;var qte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,onAutoScroll:i,...o}=e,s=Ste("SelectScrollButton",t),l=r.useRef(null),u=ate(t),c=r.useCallback((()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)}),[]);return r.useEffect((()=>()=>c()),[c]),kne((()=>{const e=u().find((e=>e.ref.current===document.activeElement));e?.ref.current?.scrollIntoView({block:"nearest"})}),[u]),n.jsx(Yae.div,{"aria-hidden":!0,...o,ref:a,style:{flexShrink:0,...o.style},onPointerDown:Oae(o.onPointerDown,(()=>{null===l.current&&(l.current=window.setInterval(i,50))})),onPointerMove:Oae(o.onPointerMove,(()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(i,50))})),onPointerLeave:Oae(o.onPointerLeave,(()=>{c()}))})})),Zte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e;return n.jsx(Yae.div,{"aria-hidden":!0,...i,ref:a})}));Zte.displayName="SelectSeparator";var $te="SelectArrow";r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e,r=rte(t),o=ste($te,t),s=Ste($te,t);return o.open&&"popper"===s.position?n.jsx(Une,{...r,...i,ref:a}):null})).displayName=$te;var Yte=r.forwardRef((({__scopeSelect:e,value:a,...t},i)=>{const o=r.useRef(null),s=Jae(i,o),l=function(e){const a=r.useRef({value:e,previous:e});return r.useMemo((()=>(a.current.value!==e&&(a.current.previous=a.current.value,a.current.value=e),a.current.previous)),[e])}(a);return r.useEffect((()=>{const e=o.current;if(!e)return;const n=window.HTMLSelectElement.prototype,t=Object.getOwnPropertyDescriptor(n,"value").set;if(l!==a&&t){const n=new Event("change",{bubbles:!0});t.call(e,a),e.dispatchEvent(n)}}),[l,a]),n.jsx(Yae.select,{...t,style:{...$ne,...t.style},ref:s,defaultValue:a})}));function Qte(e){return""===e||void 0===e}function Xte(e){const a=Qae(e),n=r.useRef(""),t=r.useRef(0),i=r.useCallback((e=>{const i=n.current+e;a(i),function e(a){n.current=a,window.clearTimeout(t.current),""!==a&&(t.current=window.setTimeout((()=>e("")),1e3))}(i)}),[a]),o=r.useCallback((()=>{n.current="",window.clearTimeout(t.current)}),[]);return r.useEffect((()=>()=>window.clearTimeout(t.current)),[]),[n,i,o]}function eie(e,a,n){const t=a.length>1&&Array.from(a).every((e=>e===a[0]))?a[0]:a,i=n?e.indexOf(n):-1;let r=(o=e,s=Math.max(i,0),o.map(((e,a)=>o[(s+a)%o.length])));var o,s;1===t.length&&(r=r.filter((e=>e!==n)));const l=r.find((e=>e.textValue.toLowerCase().startsWith(t.toLowerCase())));return l!==n?l:void 0}Yte.displayName="SelectBubbleInput";var aie=mte,nie=gte,tie=vte,iie=yte,rie=Ete,oie=Rte,sie=Hte,lie=Ite,uie=Vte,cie=Jte,die=Wte,mie=Zte;const hie=cte,pie=Bte,gie=pte,vie=r.forwardRef((({className:e,children:a,...t},i)=>n.jsxs(aie,{ref:i,className:im("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-border/10 px-3 py-2 text-sm shadow-sm ring-offset-background !placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...t,children:[a,n.jsx(nie,{asChild:!0,children:n.jsx(yc,{className:"h-4 w-4 opacity-50"})})]})));vie.displayName=aie.displayName;const fie=r.forwardRef((({className:e,...a},t)=>n.jsx(cie,{ref:t,className:im("flex cursor-default items-center justify-center py-1",e),...a,children:n.jsx(Sc,{className:"h-4 w-4"})})));fie.displayName=cie.displayName;const yie=r.forwardRef((({className:e,...a},t)=>n.jsx(die,{ref:t,className:im("flex cursor-default items-center justify-center py-1",e),...a,children:n.jsx(yc,{className:"h-4 w-4"})})));yie.displayName=die.displayName;const kie=r.forwardRef((({className:e,children:a,position:t="popper",...i},r)=>n.jsx(tie,{children:n.jsxs(iie,{ref:r,className:im("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===t&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:t,...i,children:[n.jsx(fie,{}),n.jsx(rie,{className:im("p-1","popper"===t&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),n.jsx(yie,{})]})})));kie.displayName=iie.displayName;r.forwardRef((({className:e,...a},t)=>n.jsx(oie,{ref:t,className:im("px-2 py-1.5 text-sm font-semibold text-muted-foreground",e),...a}))).displayName=oie.displayName;const bie=r.forwardRef((({className:e,children:a,...t},i)=>n.jsxs(sie,{ref:i,className:im("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t,children:[n.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(uie,{children:n.jsx(fc,{className:"h-4 w-4"})})}),n.jsx(lie,{children:a})]})));bie.displayName=sie.displayName;r.forwardRef((({className:e,...a},t)=>n.jsx(mie,{ref:t,className:im("-mx-1 my-1 h-px bg-muted",e),...a}))).displayName=mie.displayName;const Sie=({type:e})=>n.jsxs("div",{className:"w-full h-full min-h-[300px] flex flex-col items-center justify-center bg-gradient-to-b from-gray-50 to-white p-8",children:[n.jsx("div",{className:"mb-4 text-gray-300",children:n.jsx("svg",{className:"w-16 h-16",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z"})})}),n.jsxs("p",{className:"text-gray-400 font-medium text-lg text-center mb-2",children:["No ","email"===e?"Email":"SMS"," Preview Available"]}),n.jsxs("p",{className:"text-gray-400 text-sm text-center",children:["Edit your ","email"===e?"Email":"SMS"," template to see a preview here"]})]}),Aie=({html:e,height:a,width:t})=>n.jsx("div",{className:"w-full h-full bg-white rounded-lg border-0 overflow-hidden transition-all duration-300 ease-in-out flex flex-col items-center justify-center",children:e?n.jsx("div",{className:"w-full h-full flex items-center justify-center",children:n.jsx("iframe",{title:"Email Preview",srcDoc:e,className:"transition-opacity duration-300",style:{border:"none",backgroundColor:"white",height:a||"100%",width:t||"100%",maxWidth:"100%",maxHeight:"100%"}})}):n.jsx(Sie,{type:"email"})}),wie=()=>n.jsxs("div",{className:"p-6 overflow-y-auto",children:[n.jsxs("div",{className:"mb-8 text-center",children:[n.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Email Editor Help Center"}),n.jsx("p",{className:"text-gray-500",children:"Learn how to use our email editor's powerful features"})]}),n.jsxs("div",{className:"space-y-4 max-w-xl mx-auto",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Using Dynamic Content"}),n.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-gray-50",children:[n.jsx("img",{src:"https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",alt:"Merge Tags Demo",className:"w-full shadow-lg max-w-md mx-auto"}),n.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 to-transparent p-4",children:n.jsx("p",{className:"text-white text-sm",children:"Demonstration: Adding merge tags to personalize your emails"})})]}),n.jsx("div",{className:"px-2",children:n.jsx(zY,{onClick:()=>{},title:"Dynamic Content",subtitle:"Dynamic content is a way to insert dynamic content into your email such as the customer's name, email, or other details.",icon:n.jsx(Oc,{}),selected:!0})})]})]}),Cie=({type:e})=>n.jsxs("div",{className:"flex items-start space-x-2 text-sm text-gray-600",children:[n.jsx("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),n.jsxs("span",{children:["Please configure at least one ",e," sender before editing the template"]})]}),Mie=({containerRef:e,stripoDialogDimensions:t,showSaving:i})=>(a.useEffect((()=>{const a=a=>{const n=e.current;if(!n)return;const t=n.querySelector("ui-editor");if(!t)return;const i=t.shadowRoot;if(!i)return;const r=i.host.getBoundingClientRect();const o=function(e){for(;e;){const a=getComputedStyle(e);if(("auto"===a.overflowY||"scroll"===a.overflowY)&&e.scrollHeight>e.clientHeight)return e;e=e.parentElement}return null}(i.elementFromPoint(a.clientX-r.left,a.clientY-r.top))||i.firstElementChild;o&&(o.scrollTop+=a.deltaY,o.scrollLeft+=a.deltaX,a.preventDefault())},n=e.current;return n&&n.addEventListener("wheel",a,{passive:!1}),()=>{n&&n.removeEventListener("wheel",a)}}),[e]),n.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center",children:[n.jsx("div",{id:"externalSystemContainer",className:"flex items-center px-4 py-2"}),i&&n.jsx("div",{className:"absolute top-0 left-0 w-full h-full bg-black/50 flex items-center justify-center z-50",children:n.jsx(xY,{textColor:"text-white",text:["Saving..."]})}),n.jsx("div",{id:"stripoEditorContainer",ref:e,style:{width:t.width-75,height:t.height-75},className:"z-10"})]})),Tie="UiEditorScript",Nie=e=>new Promise(((a,n)=>{const t=()=>{let n=!0;e.updatedFromDefault&&(n=!1),window.UIEditor&&(window.UIEditor.initEditor(e.container,{forceRecreate:n,metadata:{emailId:e.emailId},html:e.html,css:e.css,locale:"en",onTokenRefreshRequest:e=>{Promise.resolve().then((async()=>{try{const{token:a}=await(async()=>(await Pe(`${m}/token`)).data)();e(a)}catch(a){}}))},messageSettingsEnabled:!1,conditionsEnabled:!1,syncModulesEnabled:!1,notifications:{info:console.info,error:console.error,warn:console.warn,success:console.log},mergeTags:e.mergeFields}),a(void 0))};if(document.getElementById(Tie))t();else{const e=document.createElement("script");e.id=Tie,e.type="module",e.src="https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",e.onload=()=>{window.UIEditor?t():n(new Error("UIEditor not found after script load"))},e.onerror=e=>{n(e)},document.head.appendChild(e)}})),xie=({automation:e,setShowStripoEditor:t,saveClicked:i,setSaveClicked:r,stripoDialogDimensions:o,mergeFieldsResponse:s,cancelClicked:l,setCancelClicked:u,actionId:c})=>{const d=a.useRef(!1),m=a.useRef(null),{data:h,isLoading:p}=(e=>{const{automationId:a,actionId:n}=e;return ye({queryKey:tY.templateForActionId(a,n),queryFn:()=>rY({automationId:a,actionId:n}),...we})})({automationId:e.id,actionId:c}),{data:g,isLoading:v}=(()=>{const e=ce();return{...ye({queryKey:tY.editorData(),queryFn:iY,...we}),invalidateEditorData:()=>e.invalidateQueries({queryKey:tY.editorData()})}})(),[f,y]=a.useState(!1),[k,b]=a.useState(!1),{updateCommunicationGroup:S}=lY(),A=a.useCallback((()=>{r(!1),u(!1),y(!1),b(!1),t(!1)}),[r,u,y,b,t]);return a.useEffect((()=>{if(i&&window.UIEditor&&h?.communicationGroupId&&window.StripoEditorApi?.actionsApi){window.StripoEditorApi.actionsApi.compileEmail({callback:function(e,a){e||(S({groupId:h.communicationGroupId,params:{emailHtmlBody:a}}),b(!0))},minimize:!0,mergeTags:[],forceAmp:!1,resetDataSavedFlag:!1,disableLineHeightsReplace:!0});window.StripoEditorApi.actionsApi.save((function(e){e||y(!0)}))}}),[i,m,r,t,h,S]),a.useEffect((()=>{(async()=>{f&&k&&(window.UIEditor&&window.UIEditor.removeEditor(),A())})()}),[f,k,t,r,A]),a.useEffect((()=>{l&&(window.UIEditor&&window.UIEditor.removeEditor(),A())}),[l,A]),a.useEffect((()=>{g?.businessId&&m.current&&h&&(d.current||(Nie({emailId:h.communicationGroupId,html:h.html||"<div></div>",css:h.css||"",container:m.current,businessId:g.businessId,mergeFields:s.mergeFields||[],updatedFromDefault:h.updatedFromDefault}).catch((e=>{})),d.current=!0))}),[g,s,h]),n.jsx("div",p||v||!g||!h?{className:"w-full h-full flex flex-col items-center justify-center",children:n.jsx(xY,{text:["Loading editor..."]})}:{className:"w-full h-full flex flex-col",children:n.jsx(Mie,{containerRef:m,stripoDialogDimensions:o,showSaving:i})})},Eie=({mergeFieldsResponse:e})=>{const t=CY(),i=wY(),{updateCommunicationGroup:r}=lY(),{refetchAutomation:o}=Ge(i?.id||""),{channelSenders:s}=x9(),{channelAccounts:l}=M9(),{state:{selectedActionId:u}}=a.useContext(X$),{state:{replyToSettingsText:c,replyToSettingsLink:d,fromNameSettingsText:m,fromNameSettingsLink:h}}=a.useContext(cO),[p,g]=a.useState(!1),[v,f]=a.useState(t?.emailChannelSenderId||null),[y,k]=a.useState(t?.emailSubject||null),[b,S]=a.useState(t?.emailPreviewText||null),[A,w]=a.useState(t?.emailHtmlBody||null),[C,M]=a.useState(!1),[T,N]=a.useState(!1),[x,E]=a.useState(!1),[P,j]=a.useState(""),[L,B]=a.useState(""),[z,R]=a.useState(!1),_=a.useRef(!0),[D,K]=a.useState(!0),[H,O]=a.useState(!1),[I,G]=a.useState({width:0,height:0}),V=xae(y,500),F=xae(b,500),J=a.useMemo((()=>s?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const a=l?.results?.find((a=>a.id===e.channelAccountId));return a&&a.channelAccountMetadata.type===T9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[s?.results,l?.results]),U=a.useMemo((()=>({width:800,height:400})),[]),W=a.useRef(null);return a.useEffect((()=>{const e=setTimeout((()=>{_.current=!1}),500);return()=>clearTimeout(e)}),[]),a.useEffect((()=>{t?.emailHtmlBody&&w(t.emailHtmlBody)}),[t?.emailHtmlBody,o]),a.useEffect((()=>{if(p){const e=setTimeout((()=>{g(!1)}),2e3);return()=>clearTimeout(e)}}),[p]),a.useEffect((()=>{const e=()=>{G({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),a.useEffect((()=>{if(!_.current&&v&&V&&A&&t?.id){g(!0);(async()=>{try{r({groupId:t.id,params:{emailChannelSenderId:v,emailHtmlBody:A,emailSubject:V,...F&&{emailPreviewText:F}}})}catch(e){}finally{g(!1)}})()}}),[v,V,F,A,t?.id,r]),a.useEffect((()=>{if(s?.results&&v){const e=s.results.find((e=>e.id===v));e&&(H&&!D||B(e.channelSenderMetadata.emailReplyTo),D&&j(e.channelSenderMetadata.emailFromName),K(!1))}}),[s?.results,v,H,D]),a.useEffect((()=>{if(s?.results&&!v){const e=s.results.filter((e=>e.channelSenderMetadata.userPart));if(e[0]){const a=e[0];f(a.id),r({groupId:t?.id||"",params:{emailChannelSenderId:a.id}})}}}),[s?.results,v,t?.id,r]),a.useEffect((()=>{!1===C&&t?.id&&o()}),[C,t?.id,o]),l&&s&&u?n.jsxs("div",{className:"relative",children:[n.jsx(BG,{open:z,onOpenChange:R,children:n.jsxs(DG,{className:"max-h-[86vh] gap-0 overflow-visible max-w-3xl w-full h-full",children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Email Preview Help"}),n.jsx(IG,{children:"Learn more about the email preview and how to use it to create your email."})]}),n.jsx(wie,{})]})}),n.jsx(BG,{open:C,onOpenChange:M,children:n.jsxs(DG,{className:"min-w-[100vw] min-h-[100vh]",hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault()},children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Email Editor"}),n.jsx(IG,{children:"Learn more about the email editor and how to use it to create your email."})]}),n.jsxs("div",{className:"w-full h-full",children:[n.jsxs("div",{className:"flex justify-between items-center p-1 border-b",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h2",{className:"text-lg font-medium",children:"Email Editor"}),n.jsx(jY,{size:"sm",onClick:()=>R(!0),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-medium text-sm",children:"Help"}),n.jsx(RY.InfoIcon,{className:"w-4 h-4"})]})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(jY,{variant:"destructive",onClick:()=>{E(!0)},className:"text-sm px-3 py-1 rounded",children:"Cancel"}),n.jsx(jY,{onClick:()=>N(!0),className:"text-sm px-3 py-1 rounded",children:"Save"})]})]}),n.jsx("div",{className:" w-full",children:i&&n.jsx(xie,{cancelClicked:x,setCancelClicked:E,showStripoEditor:C,automation:i,setShowStripoEditor:M,saveClicked:T,setSaveClicked:N,stripoDialogDimensions:I,mergeFieldsResponse:e,actionId:u})})]})]})}),n.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx(Kae,{className:"text-foreground",children:"From Email"}),n.jsxs(hie,{onValueChange:e=>{f(e),K(!0),O(!1)},value:v??void 0,disabled:p,children:[n.jsx(vie,{children:n.jsx(gie,{placeholder:"Select email",className:"text-muted-foreground",children:v?J?.find((e=>e.channelSenderId===v))?.fullDomain:""})}),n.jsx(kie,{children:J?.map((e=>n.jsx(bie,{value:e.channelSenderId,children:e.fullDomain},e.channelSenderId)))})]})]}),n.jsxs("div",{children:[n.jsx(Kae,{children:n.jsxs("div",{className:"flex items-center gap-2 py-1",children:["From Name",n.jsx(Mae,{title:m||"From name can be configured under settings in the home screen",link:h?{url:h}:void 0})]})}),n.jsx(o4,{value:P??"",className:"text-muted-foreground",disabled:!0})]}),n.jsxs("div",{children:[n.jsx(Kae,{children:n.jsxs("div",{className:"flex items-center gap-2 py-1",children:["Reply To Email",n.jsx(Mae,{title:c||"Reply to email can be configured under settings in the home screen",link:d?{url:d}:void 0})]})}),n.jsx(o4,{value:L??(v?J?.find((e=>e.channelSenderId===v))?.fullDomain:""),className:"text-muted-foreground",disabled:!0})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-0 py-1",children:[n.jsx(Kae,{className:"text-foreground",children:"Subject"}),n.jsx("span",{className:"text-xs text-red-500 ml-1 align-super",children:"*"})]}),n.jsx(o4,{placeholder:"Enter email subject",className:"text-muted-foreground",value:y??"",onChange:e=>k(e.target.value),disabled:p||D})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 py-1",children:[n.jsx(Kae,{className:"text-foreground",children:"Preview Text"}),n.jsx(Mae,{title:"This text will be used for the preview text of the email in the inbox"})]}),n.jsx(o4,{placeholder:"Enter preview text",className:"text-muted-foreground",value:b??"",onChange:e=>S(e.target.value),disabled:p||D})]})]}),n.jsxs("div",{className:"border rounded-lg p-4 h-full flex flex-col",children:[n.jsxs("div",{className:"flex justify-between items-center mb-4",children:[n.jsx("h3",{className:"font-medium",children:"Preview"}),n.jsxs("div",{children:[n.jsx(jY,{onClick:()=>M(!0),className:"text-sm px-3 py-1 rounded",disabled:p||0===(J?.length??0),children:"Edit"}),0===(J?.length??0)&&n.jsx("div",{className:"relative inline-block",children:n.jsx("div",{className:"absolute right-0 top-full mt-2 w-64 p-3 bg-white border rounded-lg shadow-lg z-10",children:n.jsx(Cie,{type:"email"})})})]})]}),n.jsx("div",{className:"flex-1 w-full overflow-auto",ref:W,style:{height:"400px"},children:n.jsx(Aie,{html:A??"",height:U.height,width:U.width})})]})]})]}):n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Email Preview..."]})})};var Pie=(e=>(e.CUSTOM="custom",e.MANAGED="managed",e))(Pie||{}),jie=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(jie||{}),Lie=(e=>(e.EMAIL="email",e.SMS="sms",e))(Lie||{});const Bie=({title:e,type:t})=>{const i=CY(),r=wY(),{toast:o}=Ie(),[s,l]=a.useState(!1),{resetCommunicationGroupToDefault:u,isPending:c}=dY(),d=!!i&&(i.type===Pie.MANAGED&&("sms"===t?i.updatedFromDefault?.text_message_body:i.updatedFromDefault?.email_text_body||i.updatedFromDefault?.email_html_body));return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h4",{className:"text-xl font-medium text-foreground",children:e}),n.jsx("div",{className:"flex items-center gap-2",children:d&&n.jsx(n.Fragment,{children:c?n.jsx(xY,{}):n.jsx(jY,{variant:"outline",size:"sm",onClick:()=>l(!0),children:"Reset To Default"})})})]}),n.jsx(BG,{open:s,onOpenChange:l,children:n.jsxs(DG,{className:"sm:max-w-[425px]",children:[n.jsxs(KG,{children:[n.jsx(OG,{className:"text-xl font-semibold",children:"Reset to Default"}),n.jsxs(IG,{className:"text-base text-muted-foreground",children:["Are you sure you want to reset this"," ","email"===t?"email":"SMS"," template to its default state? This action cannot be undone."]})]}),n.jsxs(HG,{className:"flex flex-row justify-end gap-3 mt-6",children:[n.jsx(jY,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),n.jsx(jY,{variant:"destructive",onClick:async()=>{i&&r?u({communicationGroupId:i.id,automationId:r.id,type:t},{onSuccess:()=>{o({title:"Communication reset to default!"}),l(!1)},onSettled:()=>{l(!1)},onError:()=>{o({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})}}):o({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})},children:"Reset to Default"})]})]})})]})},zie=e=>{const{channelSenders:a,channelAccounts:n}=e;return a?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const a=n?.find((a=>a.id===e.channelAccountId));return a&&a.channelAccountMetadata.type===T9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSender:e}]:[]}))||[]},Rie=()=>{const e=a.useRef(null),t=CY(),{channelSenders:i}=x9(),{channelAccounts:r}=M9(),{getMergeFields:o,isGetting:s}=uY(t?.id??void 0),l=a.useMemo((()=>zie({channelSenders:i?.results??[],channelAccounts:r?.results??[]})),[i?.results,r?.results]);return!s&&o&&l?n.jsxs("div",{className:"bg-card text-card-foreground rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",ref:e,children:[n.jsx(Bie,{title:"Email Campaign",type:"email"}),n.jsx(Eie,{mergeFieldsResponse:o,emailChannelSendersWithChannelAccounts:l})]}):n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-card text-card-foreground rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Content..."]})})};var _ie=e=>"checkbox"===e.type,Die=e=>e instanceof Date,Kie=e=>null==e;const Hie=e=>"object"==typeof e;var Oie=e=>!Kie(e)&&!Array.isArray(e)&&Hie(e)&&!Die(e),Iie=e=>Oie(e)&&e.target?_ie(e.target)?e.target.checked:e.target.value:e,Gie=(e,a)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(a)),Vie="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Fie(e){let a;const n=Array.isArray(e),t="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)a=new Date(e);else if(e instanceof Set)a=new Set(e);else{if(Vie&&(e instanceof Blob||t)||!n&&!Oie(e))return e;if(a=n?[]:{},n||(e=>{const a=e.constructor&&e.constructor.prototype;return Oie(a)&&a.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(a[n]=Fie(e[n]));else a=e}return a}var Jie=e=>Array.isArray(e)?e.filter(Boolean):[],Uie=e=>void 0===e,Wie=(e,a,n)=>{if(!a||!Oie(e))return n;const t=Jie(a.split(/[,[\].]+?/)).reduce(((e,a)=>Kie(e)?e:e[a]),e);return Uie(t)||t===e?Uie(e[a])?n:e[a]:t},qie=e=>"boolean"==typeof e,Zie=e=>/^\w*$/.test(e),$ie=e=>Jie(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Yie=(e,a,n)=>{let t=-1;const i=Zie(a)?[a]:$ie(a),r=i.length,o=r-1;for(;++t<r;){const a=i[t];let r=n;if(t!==o){const n=e[a];r=Oie(n)||Array.isArray(n)?n:isNaN(+i[t+1])?{}:[]}if("__proto__"===a||"constructor"===a||"prototype"===a)return;e[a]=r,e=e[a]}};const Qie="blur",Xie="focusout",ere="change",are="onBlur",nre="onChange",tre="onSubmit",ire="onTouched",rre="all",ore="max",sre="min",lre="maxLength",ure="minLength",cre="pattern",dre="required",mre="validate",hre=a.createContext(null),pre=()=>a.useContext(hre);var gre=(e,a,n,t=!0)=>{const i={defaultValues:a._defaultValues};for(const r in e)Object.defineProperty(i,r,{get:()=>{const i=r;return a._proxyFormState[i]!==rre&&(a._proxyFormState[i]=!t||rre),n&&(n[i]=!0),e[i]}});return i},vre=e=>Kie(e)||!Hie(e);function fre(e,a){if(vre(e)||vre(a))return e===a;if(Die(e)&&Die(a))return e.getTime()===a.getTime();const n=Object.keys(e),t=Object.keys(a);if(n.length!==t.length)return!1;for(const i of n){const n=e[i];if(!t.includes(i))return!1;if("ref"!==i){const e=a[i];if(Die(n)&&Die(e)||Oie(n)&&Oie(e)||Array.isArray(n)&&Array.isArray(e)?!fre(n,e):n!==e)return!1}}return!0}const yre=(e,n)=>{const t=a.useRef(n);fre(n,t.current)||(t.current=n),a.useEffect(e,t.current)};var kre=e=>"string"==typeof e,bre=(e,a,n,t,i)=>kre(e)?(t&&a.watch.add(e),Wie(n,e,i)):Array.isArray(e)?e.map((e=>(t&&a.watch.add(e),Wie(n,e)))):(t&&(a.watchAll=!0),n);function Sre(e){const n=pre(),{name:t,disabled:i,control:r=n.control,shouldUnregister:o}=e,s=Gie(r._names.array,t),l=function(e){const n=pre(),{control:t=n.control,name:i,defaultValue:r,disabled:o,exact:s}=e||{},[l,u]=a.useState(t._getWatch(i,r));return yre((()=>t._subscribe({name:i,formState:{values:!0},exact:s,callback:e=>!o&&u(bre(i,t._names,e.values||t._formValues,!1,r))})),[i,r,o,s]),a.useEffect((()=>t._removeUnmounted())),l}({control:r,name:t,defaultValue:Wie(r._formValues,t,Wie(r._defaultValues,t,e.defaultValue)),exact:!0}),u=function(e){const n=pre(),{control:t=n.control,disabled:i,name:r,exact:o}=e||{},[s,l]=a.useState(t._formState),u=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return yre((()=>t._subscribe({name:r,formState:u.current,exact:o,callback:e=>{!i&&l({...t._formState,...e})}})),[r,i,o]),a.useEffect((()=>{u.current.isValid&&t._setValid(!0)}),[t]),a.useMemo((()=>gre(s,t,u.current,!1)),[s,t])}({control:r,name:t,exact:!0}),c=a.useRef(e),d=a.useRef(r.register(t,{...e.rules,value:l,...qie(e.disabled)?{disabled:e.disabled}:{}})),m=a.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Wie(u.errors,t)},isDirty:{enumerable:!0,get:()=>!!Wie(u.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!Wie(u.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!Wie(u.validatingFields,t)},error:{enumerable:!0,get:()=>Wie(u.errors,t)}})),[u,t]),h=a.useCallback((e=>d.current.onChange({target:{value:Iie(e),name:t},type:ere})),[t]),p=a.useCallback((()=>d.current.onBlur({target:{value:Wie(r._formValues,t),name:t},type:Qie})),[t,r._formValues]),g=a.useCallback((e=>{const a=Wie(r._fields,t);a&&e&&(a._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:a=>e.setCustomValidity(a),reportValidity:()=>e.reportValidity()})}),[r._fields,t]),v=a.useMemo((()=>({name:t,value:l,...qie(i)||u.disabled?{disabled:u.disabled||i}:{},onChange:h,onBlur:p,ref:g})),[t,i,u.disabled,h,p,g,l]);return a.useEffect((()=>{const e=r._options.shouldUnregister||o;r.register(t,{...c.current.rules,...qie(c.current.disabled)?{disabled:c.current.disabled}:{}});const a=(e,a)=>{const n=Wie(r._fields,e);n&&n._f&&(n._f.mount=a)};if(a(t,!0),e){const e=Fie(Wie(r._options.defaultValues,t));Yie(r._defaultValues,t,e),Uie(Wie(r._formValues,t))&&Yie(r._formValues,t,e)}return!s&&r.register(t),()=>{(s?e&&!r._state.action:e)?r.unregister(t):a(t,!1)}}),[t,r,s,o]),a.useEffect((()=>{r._setDisabledField({disabled:i,name:t})}),[i,t,r]),a.useMemo((()=>({field:v,formState:u,fieldState:m})),[v,u,m])}const Are=e=>e.render(Sre(e));var wre=(e,a,n,t,i)=>a?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[t]:i||!0}}:{},Cre=e=>Array.isArray(e)?e:[e],Mre=()=>{let e=[];return{get observers(){return e},next:a=>{for(const n of e)n.next&&n.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter((e=>e!==a))}}),unsubscribe:()=>{e=[]}}},Tre=e=>Oie(e)&&!Object.keys(e).length,Nre=e=>"file"===e.type,xre=e=>"function"==typeof e,Ere=e=>{if(!Vie)return!1;const a=e?e.ownerDocument:0;return e instanceof(a&&a.defaultView?a.defaultView.HTMLElement:HTMLElement)},Pre=e=>"select-multiple"===e.type,jre=e=>"radio"===e.type,Lre=e=>Ere(e)&&e.isConnected;function Bre(e,a){const n=Array.isArray(a)?a:Zie(a)?[a]:$ie(a),t=1===n.length?e:function(e,a){const n=a.slice(0,-1).length;let t=0;for(;t<n;)e=Uie(e)?t++:e[a[t++]];return e}(e,n),i=n.length-1;return t&&delete t[n[i]],0!==i&&(Oie(t)&&Tre(t)||Array.isArray(t)&&function(e){for(const a in e)if(e.hasOwnProperty(a)&&!Uie(e[a]))return!1;return!0}(t))&&Bre(e,n.slice(0,-1)),e}var zre=e=>{for(const a in e)if(xre(e[a]))return!0;return!1};function Rre(e,a={}){const n=Array.isArray(e);if(Oie(e)||n)for(const t in e)Array.isArray(e[t])||Oie(e[t])&&!zre(e[t])?(a[t]=Array.isArray(e[t])?[]:{},Rre(e[t],a[t])):Kie(e[t])||(a[t]=!0);return a}function _re(e,a,n){const t=Array.isArray(e);if(Oie(e)||t)for(const i in e)Array.isArray(e[i])||Oie(e[i])&&!zre(e[i])?Uie(a)||vre(n[i])?n[i]=Array.isArray(e[i])?Rre(e[i],[]):{...Rre(e[i])}:_re(e[i],Kie(a)?{}:a[i],n[i]):n[i]=!fre(e[i],a[i]);return n}var Dre=(e,a)=>_re(e,a,Rre(a));const Kre={value:!1,isValid:!1},Hre={value:!0,isValid:!0};var Ore=e=>{if(Array.isArray(e)){if(e.length>1){const a=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:a,isValid:!!a.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Uie(e[0].attributes.value)?Uie(e[0].value)||""===e[0].value?Hre:{value:e[0].value,isValid:!0}:Hre:Kre}return Kre},Ire=(e,{valueAsNumber:a,valueAsDate:n,setValueAs:t})=>Uie(e)?e:a?""===e?NaN:e?+e:e:n&&kre(e)?new Date(e):t?t(e):e;const Gre={isValid:!1,value:null};var Vre=e=>Array.isArray(e)?e.reduce(((e,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:e),Gre):Gre;function Fre(e){const a=e.ref;return Nre(a)?a.files:jre(a)?Vre(e.refs).value:Pre(a)?[...a.selectedOptions].map((({value:e})=>e)):_ie(a)?Ore(e.refs).value:Ire(Uie(a.value)?e.ref.value:a.value,e)}var Jre=e=>e instanceof RegExp,Ure=e=>Uie(e)?e:Jre(e)?e.source:Oie(e)?Jre(e.value)?e.value.source:e.value:e,Wre=e=>({isOnSubmit:!e||e===tre,isOnBlur:e===are,isOnChange:e===nre,isOnAll:e===rre,isOnTouch:e===ire});const qre="AsyncFunction";var Zre=(e,a,n)=>!n&&(a.watchAll||a.watch.has(e)||[...a.watch].some((a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length)))));const $re=(e,a,n,t)=>{for(const i of n||Object.keys(e)){const n=Wie(e,i);if(n){const{_f:e,...r}=n;if(e){if(e.refs&&e.refs[0]&&a(e.refs[0],i)&&!t)return!0;if(e.ref&&a(e.ref,e.name)&&!t)return!0;if($re(r,a))break}else if(Oie(r)&&$re(r,a))break}}};function Yre(e,a,n){const t=Wie(e,n);if(t||Zie(n))return{error:t,name:n};const i=n.split(".");for(;i.length;){const t=i.join("."),r=Wie(a,t),o=Wie(e,t);if(r&&!Array.isArray(r)&&n!==t)return{name:n};if(o&&o.type)return{name:t,error:o};i.pop()}return{name:n}}var Qre=(e,a,n)=>{const t=Cre(Wie(e,n));return Yie(t,"root",a[n]),Yie(e,n,t),e},Xre=e=>kre(e);function eoe(e,a,n="validate"){if(Xre(e)||Array.isArray(e)&&e.every(Xre)||qie(e)&&!e)return{type:n,message:Xre(e)?e:"",ref:a}}var aoe=e=>Oie(e)&&!Jre(e)?e:{value:e,message:""},noe=async(e,a,n,t,i,r)=>{const{ref:o,refs:s,required:l,maxLength:u,minLength:c,min:d,max:m,pattern:h,validate:p,name:g,valueAsNumber:v,mount:f}=e._f,y=Wie(n,g);if(!f||a.has(g))return{};const k=s?s[0]:o,b=e=>{i&&k.reportValidity&&(k.setCustomValidity(qie(e)?"":e||""),k.reportValidity())},S={},A=jre(o),w=_ie(o),C=A||w,M=(v||Nre(o))&&Uie(o.value)&&Uie(y)||Ere(o)&&""===o.value||""===y||Array.isArray(y)&&!y.length,T=wre.bind(null,g,t,S),N=(e,a,n,t=lre,i=ure)=>{const r=e?a:n;S[g]={type:e?t:i,message:r,ref:o,...T(e?t:i,r)}};if(r?!Array.isArray(y)||!y.length:l&&(!C&&(M||Kie(y))||qie(y)&&!y||w&&!Ore(s).isValid||A&&!Vre(s).isValid)){const{value:e,message:a}=Xre(l)?{value:!!l,message:l}:aoe(l);if(e&&(S[g]={type:dre,message:a,ref:k,...T(dre,a)},!t))return b(a),S}if(!(M||Kie(d)&&Kie(m))){let e,a;const n=aoe(m),i=aoe(d);if(Kie(y)||isNaN(y)){const t=o.valueAsDate||new Date(y),r=e=>new Date((new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;kre(n.value)&&y&&(e=s?r(y)>r(n.value):l?y>n.value:t>new Date(n.value)),kre(i.value)&&y&&(a=s?r(y)<r(i.value):l?y<i.value:t<new Date(i.value))}else{const t=o.valueAsNumber||(y?+y:y);Kie(n.value)||(e=t>n.value),Kie(i.value)||(a=t<i.value)}if((e||a)&&(N(!!e,n.message,i.message,ore,sre),!t))return b(S[g].message),S}if((u||c)&&!M&&(kre(y)||r&&Array.isArray(y))){const e=aoe(u),a=aoe(c),n=!Kie(e.value)&&y.length>+e.value,i=!Kie(a.value)&&y.length<+a.value;if((n||i)&&(N(n,e.message,a.message),!t))return b(S[g].message),S}if(h&&!M&&kre(y)){const{value:e,message:a}=aoe(h);if(Jre(e)&&!y.match(e)&&(S[g]={type:cre,message:a,ref:o,...T(cre,a)},!t))return b(a),S}if(p)if(xre(p)){const e=eoe(await p(y,n),k);if(e&&(S[g]={...e,...T(mre,e.message)},!t))return b(e.message),S}else if(Oie(p)){let e={};for(const a in p){if(!Tre(e)&&!t)break;const i=eoe(await p[a](y,n),k,a);i&&(e={...i,...T(a,i.message)},b(i.message),t&&(S[g]=e))}if(!Tre(e)&&(S[g]={ref:k,...e},!t))return S}return b(!0),S};const toe={mode:tre,reValidateMode:nre,shouldFocusError:!0};function ioe(e={}){let a={...toe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:xre(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:a.errors||{},disabled:a.disabled||!1};const t={};let i,r=(Oie(a.defaultValues)||Oie(a.values))&&Fie(a.values||a.defaultValues)||{},o=a.shouldUnregister?{}:Fie(r),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let d={...c};const m={array:Mre(),state:Mre()},h=Wre(a.mode),p=Wre(a.reValidateMode),g=a.criteriaMode===rre,v=async e=>{if(!a.disabled&&(c.isValid||d.isValid||e)){const e=a.resolver?Tre((await S()).errors):await A(t,!0);e!==n.isValid&&m.state.next({isValid:e})}},f=(e,t)=>{!a.disabled&&(c.isValidating||c.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(t?Yie(n.validatingFields,e,t):Bre(n.validatingFields,e))})),m.state.next({validatingFields:n.validatingFields,isValidating:!Tre(n.validatingFields)}))},y=(e,a,n,i)=>{const l=Wie(t,e);if(l){const t=Wie(o,e,Uie(n)?Wie(r,e):n);Uie(t)||i&&i.defaultChecked||a?Yie(o,e,a?t:Fre(l._f)):M(e,t),s.mount&&v()}},k=(e,t,i,o,s)=>{let l=!1,u=!1;const h={name:e};if(!a.disabled){if(!i||o){(c.isDirty||d.isDirty)&&(u=n.isDirty,n.isDirty=h.isDirty=w(),l=u!==h.isDirty);const a=fre(Wie(r,e),t);u=!!Wie(n.dirtyFields,e),a?Bre(n.dirtyFields,e):Yie(n.dirtyFields,e,!0),h.dirtyFields=n.dirtyFields,l=l||(c.dirtyFields||d.dirtyFields)&&u!==!a}if(i){const a=Wie(n.touchedFields,e);a||(Yie(n.touchedFields,e,i),h.touchedFields=n.touchedFields,l=l||(c.touchedFields||d.touchedFields)&&a!==i)}l&&s&&m.state.next(h)}return l?h:{}},b=(e,t,r,o)=>{const s=Wie(n.errors,e),l=(c.isValid||d.isValid)&&qie(t)&&n.isValid!==t;if(a.delayError&&r?(i=(e=>a=>{clearTimeout(u),u=setTimeout(e,a)})((()=>((e,a)=>{Yie(n.errors,e,a),m.state.next({errors:n.errors})})(e,r))),i(a.delayError)):(clearTimeout(u),i=null,r?Yie(n.errors,e,r):Bre(n.errors,e)),(r?!fre(s,r):s)||!Tre(o)||l){const a={...o,...l&&qie(t)?{isValid:t}:{},errors:n.errors,name:e};n={...n,...a},m.state.next(a)}},S=async e=>{f(e,!0);const n=await a.resolver(o,a.context,((e,a,n,t)=>{const i={};for(const r of e){const e=Wie(a,r);e&&Yie(i,r,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:t}})(e||l.mount,t,a.criteriaMode,a.shouldUseNativeValidation));return f(e),n},A=async(e,t,i={valid:!0})=>{for(const s in e){const u=e[s];if(u){const{_f:e,...d}=u;if(e){const d=l.array.has(e.name),m=u._f&&(!!(r=u._f)&&!!r.validate&&!!(xre(r.validate)&&r.validate.constructor.name===qre||Oie(r.validate)&&Object.values(r.validate).find((e=>e.constructor.name===qre))));m&&c.validatingFields&&f([s],!0);const h=await noe(u,l.disabled,o,g,a.shouldUseNativeValidation&&!t,d);if(m&&c.validatingFields&&f([s]),h[e.name]&&(i.valid=!1,t))break;!t&&(Wie(h,e.name)?d?Qre(n.errors,h,e.name):Yie(n.errors,e.name,h[e.name]):Bre(n.errors,e.name))}!Tre(d)&&await A(d,t,i)}}var r;return i.valid},w=(e,n)=>!a.disabled&&(e&&n&&Yie(o,e,n),!fre(j(),r)),C=(e,a,n)=>bre(e,l,{...s.mount?o:Uie(a)?r:kre(e)?{[e]:a}:a},n,a),M=(e,a,n={})=>{const i=Wie(t,e);let r=a;if(i){const n=i._f;n&&(!n.disabled&&Yie(o,e,Ire(a,n)),r=Ere(n.ref)&&Kie(a)?"":a,Pre(n.ref)?[...n.ref.options].forEach((e=>e.selected=r.includes(e.value))):n.refs?_ie(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(r)?!!r.find((a=>a===e.value)):r===e.value))):n.refs[0]&&(n.refs[0].checked=!!r):n.refs.forEach((e=>e.checked=e.value===r)):Nre(n.ref)?n.ref.value="":(n.ref.value=r,n.ref.type||m.state.next({name:e,values:Fie(o)})))}(n.shouldDirty||n.shouldTouch)&&k(e,r,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&P(e)},T=(e,a,n)=>{for(const i in a){const r=a[i],o=`${e}.${i}`,s=Wie(t,o);(l.array.has(e)||Oie(r)||s&&!s._f)&&!Die(r)?T(o,r,n):M(o,r,n)}},N=(e,a,i={})=>{const u=Wie(t,e),h=l.array.has(e),p=Fie(a);Yie(o,e,p),h?(m.array.next({name:e,values:Fie(o)}),(c.isDirty||c.dirtyFields||d.isDirty||d.dirtyFields)&&i.shouldDirty&&m.state.next({name:e,dirtyFields:Dre(r,o),isDirty:w(e,p)})):!u||u._f||Kie(p)?M(e,p,i):T(e,p,i),Zre(e,l)&&m.state.next({...n}),m.state.next({name:s.mount?e:void 0,values:Fie(o)})},x=async e=>{s.mount=!0;const r=e.target;let u=r.name,y=!0;const w=Wie(t,u),C=e=>{y=Number.isNaN(e)||Die(e)&&isNaN(e.getTime())||fre(e,Wie(o,u,e))};if(w){let s,T;const N=r.type?Fre(w._f):Iie(e),x=e.type===Qie||e.type===Xie,E=!((M=w._f).mount&&(M.required||M.min||M.max||M.maxLength||M.minLength||M.pattern||M.validate)||a.resolver||Wie(n.errors,u)||w._f.deps)||((e,a,n,t,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(a||e):(n?t.isOnBlur:i.isOnBlur)?!e:!(n?t.isOnChange:i.isOnChange)||e))(x,Wie(n.touchedFields,u),n.isSubmitted,p,h),j=Zre(u,l,x);Yie(o,u,N),x?(w._f.onBlur&&w._f.onBlur(e),i&&i(0)):w._f.onChange&&w._f.onChange(e);const L=k(u,N,x),B=!Tre(L)||j;if(!x&&m.state.next({name:u,type:e.type,values:Fie(o)}),E)return(c.isValid||d.isValid)&&("onBlur"===a.mode?x&&v():x||v()),B&&m.state.next({name:u,...j?{}:L});if(!x&&j&&m.state.next({...n}),a.resolver){const{errors:e}=await S([u]);if(C(N),y){const a=Yre(n.errors,t,u),i=Yre(e,t,a.name||u);s=i.error,u=i.name,T=Tre(e)}}else f([u],!0),s=(await noe(w,l.disabled,o,g,a.shouldUseNativeValidation))[u],f([u]),C(N),y&&(s?T=!1:(c.isValid||d.isValid)&&(T=await A(t,!0)));y&&(w._f.deps&&P(w._f.deps),b(u,T,s,L))}var M},E=(e,a)=>{if(Wie(n.errors,a)&&e.focus)return e.focus(),1},P=async(e,i={})=>{let r,o;const s=Cre(e);if(a.resolver){const a=await(async e=>{const{errors:a}=await S(e);if(e)for(const t of e){const e=Wie(a,t);e?Yie(n.errors,t,e):Bre(n.errors,t)}else n.errors=a;return a})(Uie(e)?e:s);r=Tre(a),o=e?!s.some((e=>Wie(a,e))):r}else e?(o=(await Promise.all(s.map((async e=>{const a=Wie(t,e);return await A(a&&a._f?{[e]:a}:a)})))).every(Boolean),(o||n.isValid)&&v()):o=r=await A(t);return m.state.next({...!kre(e)||(c.isValid||d.isValid)&&r!==n.isValid?{}:{name:e},...a.resolver||!e?{isValid:r}:{},errors:n.errors}),i.shouldFocus&&!o&&$re(t,E,e?s:l.mount),o},j=e=>{const a={...s.mount?o:r};return Uie(e)?a:kre(e)?Wie(a,e):e.map((e=>Wie(a,e)))},L=(e,a)=>({invalid:!!Wie((a||n).errors,e),isDirty:!!Wie((a||n).dirtyFields,e),error:Wie((a||n).errors,e),isValidating:!!Wie(n.validatingFields,e),isTouched:!!Wie((a||n).touchedFields,e)}),B=(e,a,i)=>{const r=(Wie(t,e,{_f:{}})._f||{}).ref,o=Wie(n.errors,e)||{},{ref:s,message:l,type:u,...c}=o;Yie(n.errors,e,{...c,...a,ref:r}),m.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&r&&r.focus&&r.focus()},z=e=>m.state.subscribe({next:a=>{var t,i,r;i=a.name,r=e.exact,(t=e.name)&&i&&t!==i&&!Cre(t).some((e=>e&&(r?e===i:e.startsWith(i)||i.startsWith(e))))||!((e,a,n,t)=>{n(e);const{name:i,...r}=e;return Tre(r)||Object.keys(r).length>=Object.keys(a).length||Object.keys(r).find((e=>a[e]===(!t||rre)))})(a,e.formState||c,G,e.reRenderRoot)||e.callback({values:{...o},...n,...a})}}).unsubscribe,R=(e,i={})=>{for(const s of e?Cre(e):l.mount)l.mount.delete(s),l.array.delete(s),i.keepValue||(Bre(t,s),Bre(o,s)),!i.keepError&&Bre(n.errors,s),!i.keepDirty&&Bre(n.dirtyFields,s),!i.keepTouched&&Bre(n.touchedFields,s),!i.keepIsValidating&&Bre(n.validatingFields,s),!a.shouldUnregister&&!i.keepDefaultValue&&Bre(r,s);m.state.next({values:Fie(o)}),m.state.next({...n,...i.keepDirty?{isDirty:w()}:{}}),!i.keepIsValid&&v()},_=({disabled:e,name:a})=>{(qie(e)&&s.mount||e||l.disabled.has(a))&&(e?l.disabled.add(a):l.disabled.delete(a))},D=(e,n={})=>{let i=Wie(t,e);const o=qie(n.disabled)||qie(a.disabled);return Yie(t,e,{...i||{},_f:{...i&&i._f?i._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),i?_({disabled:qie(n.disabled)?n.disabled:a.disabled,name:e}):y(e,!0,n.value),{...o?{disabled:n.disabled||a.disabled}:{},...a.progressive?{required:!!n.required,min:Ure(n.min),max:Ure(n.max),minLength:Ure(n.minLength),maxLength:Ure(n.maxLength),pattern:Ure(n.pattern)}:{},name:e,onChange:x,onBlur:x,ref:o=>{if(o){D(e,n),i=Wie(t,e);const a=Uie(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=(e=>jre(e)||_ie(e))(a),l=i._f.refs||[];if(s?l.find((e=>e===a)):a===i._f.ref)return;Yie(t,e,{_f:{...i._f,...s?{refs:[...l.filter(Lre),a,...Array.isArray(Wie(r,e))?[{}]:[]],ref:{type:a.type,name:e}}:{ref:a}}}),y(e,!1,void 0,a)}else i=Wie(t,e,{}),i._f&&(i._f.mount=!1),(a.shouldUnregister||n.shouldUnregister)&&(!Gie(l.array,e)||!s.action)&&l.unMount.add(e)}}},K=()=>a.shouldFocusError&&$re(t,E,l.mount),H=(e,i)=>async r=>{let s;r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let u=Fie(o);if(m.state.next({isSubmitting:!0}),a.resolver){const{errors:e,values:a}=await S();n.errors=e,u=a}else await A(t);if(l.disabled.size)for(const e of l.disabled)Yie(u,e,void 0);if(Bre(n.errors,"root"),Tre(n.errors)){m.state.next({errors:{}});try{await e(u,r)}catch(c){s=c}}else i&&await i({...n.errors},r),K(),setTimeout(K);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Tre(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},O=(e,i={})=>{const u=e?Fie(e):r,d=Fie(u),h=Tre(e),p=h?r:d;if(i.keepDefaultValues||(r=u),!i.keepValues){if(i.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Dre(r,o))]);for(const a of Array.from(e))Wie(n.dirtyFields,a)?Yie(p,a,Wie(o,a)):N(a,Wie(p,a))}else{if(Vie&&Uie(e))for(const e of l.mount){const a=Wie(t,e);if(a&&a._f){const e=Array.isArray(a._f.refs)?a._f.refs[0]:a._f.ref;if(Ere(e)){const a=e.closest("form");if(a){a.reset();break}}}}for(const e of l.mount)N(e,Wie(p,e))}o=Fie(p),m.array.next({values:{...p}}),m.state.next({values:{...p}})}l={mount:i.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!c.isValid||!!i.keepIsValid||!!i.keepDirtyValues,s.watch=!!a.shouldUnregister,m.state.next({submitCount:i.keepSubmitCount?n.submitCount:0,isDirty:!h&&(i.keepDirty?n.isDirty:!(!i.keepDefaultValues||fre(e,r))),isSubmitted:!!i.keepIsSubmitted&&n.isSubmitted,dirtyFields:h?{}:i.keepDirtyValues?i.keepDefaultValues&&o?Dre(r,o):n.dirtyFields:i.keepDefaultValues&&e?Dre(r,e):i.keepDirty?n.dirtyFields:{},touchedFields:i.keepTouched?n.touchedFields:{},errors:i.keepErrors?n.errors:{},isSubmitSuccessful:!!i.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},I=(e,a)=>O(xre(e)?e(o):e,a),G=e=>{n={...n,...e}},V={control:{register:D,unregister:R,getFieldState:L,handleSubmit:H,setError:B,_subscribe:z,_runSchema:S,_getWatch:C,_getDirty:w,_setValid:v,_setFieldArray:(e,i=[],l,u,h=!0,p=!0)=>{if(u&&l&&!a.disabled){if(s.action=!0,p&&Array.isArray(Wie(t,e))){const a=l(Wie(t,e),u.argA,u.argB);h&&Yie(t,e,a)}if(p&&Array.isArray(Wie(n.errors,e))){const a=l(Wie(n.errors,e),u.argA,u.argB);h&&Yie(n.errors,e,a),((e,a)=>{!Jie(Wie(e,a)).length&&Bre(e,a)})(n.errors,e)}if((c.touchedFields||d.touchedFields)&&p&&Array.isArray(Wie(n.touchedFields,e))){const a=l(Wie(n.touchedFields,e),u.argA,u.argB);h&&Yie(n.touchedFields,e,a)}(c.dirtyFields||d.dirtyFields)&&(n.dirtyFields=Dre(r,o)),m.state.next({name:e,isDirty:w(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Yie(o,e,i)},_setDisabledField:_,_setErrors:e=>{n.errors=e,m.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Jie(Wie(s.mount?o:r,e,a.shouldUnregister?Wie(r,e,[]):[])),_reset:O,_resetDefaultValues:()=>xre(a.defaultValues)&&a.defaultValues().then((e=>{I(e,a.resetOptions),m.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const a=Wie(t,e);a&&(a._f.refs?a._f.refs.every((e=>!Lre(e))):!Lre(a._f.ref))&&R(e)}l.unMount=new Set},_disableForm:e=>{qie(e)&&(m.state.next({disabled:e}),$re(t,((a,n)=>{const i=Wie(t,n);i&&(a.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach((a=>{a.disabled=i._f.disabled||e})))}),0,!1))},_subjects:m,_proxyFormState:c,get _fields(){return t},get _formValues(){return o},get _state(){return s},set _state(e){s=e},get _defaultValues(){return r},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return a},set _options(e){a={...a,...e}}},subscribe:e=>(s.mount=!0,d={...d,...e.formState},z({...e,formState:d})),trigger:P,register:D,handleSubmit:H,watch:(e,a)=>xre(e)?m.state.subscribe({next:n=>e(C(void 0,a),n)}):C(e,a,!0),setValue:N,getValues:j,reset:I,resetField:(e,a={})=>{Wie(t,e)&&(Uie(a.defaultValue)?N(e,Fie(Wie(r,e))):(N(e,a.defaultValue),Yie(r,e,Fie(a.defaultValue))),a.keepTouched||Bre(n.touchedFields,e),a.keepDirty||(Bre(n.dirtyFields,e),n.isDirty=a.defaultValue?w(e,Fie(Wie(r,e))):w()),a.keepError||(Bre(n.errors,e),c.isValid&&v()),m.state.next({...n}))},clearErrors:e=>{e&&Cre(e).forEach((e=>Bre(n.errors,e))),m.state.next({errors:e?n.errors:{}})},unregister:R,setError:B,setFocus:(e,a={})=>{const n=Wie(t,e),i=n&&n._f;if(i){const e=i.refs?i.refs[0]:i.ref;e.focus&&(e.focus(),a.shouldSelect&&xre(e.select)&&e.select())}},getFieldState:L};return{...V,formControl:V}}const roe="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;function ooe(e={}){const n=a.useRef(void 0),t=a.useRef(void 0),[i,r]=a.useState({isDirty:!1,isValidating:!1,isLoading:xre(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:xre(e.defaultValues)?void 0:e.defaultValues});n.current||(n.current={...e.formControl?e.formControl:ioe(e),formState:i},e.formControl&&e.defaultValues&&!xre(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const o=n.current.control;return o._options=e,roe((()=>{const e=o._subscribe({formState:o._proxyFormState,callback:()=>r({...o._formState}),reRenderRoot:!0});return r((e=>({...e,isReady:!0}))),e}),[o]),a.useEffect((()=>o._disableForm(e.disabled)),[o,e.disabled]),a.useEffect((()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode),e.errors&&!Tre(e.errors)&&o._setErrors(e.errors)}),[o,e.errors,e.mode,e.reValidateMode]),a.useEffect((()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})}),[o,e.shouldUnregister]),a.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,i.isDirty]),a.useEffect((()=>{e.values&&!fre(e.values,t.current)?(o._reset(e.values,o._options.resetOptions),t.current=e.values,r((e=>({...e})))):o._resetDefaultValues()}),[o,e.values]),a.useEffect((()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),n.current.formState=gre(i,o),n.current}const soe=(e,a,n)=>{if(e&&"reportValidity"in e){const t=Wie(n,a);e.setCustomValidity(t&&t.message||""),e.reportValidity()}},loe=(e,a)=>{for(const n in a.fields){const t=a.fields[n];t&&t.ref&&"reportValidity"in t.ref?soe(t.ref,n,e):t.refs&&t.refs.forEach((a=>soe(a,n,e)))}},uoe=(e,a)=>{a.shouldUseNativeValidation&&loe(e,a);const n={};for(const t in e){const i=Wie(a.fields,t),r=Object.assign(e[t]||{},{ref:i&&i.ref});if(coe(a.names||Object.keys(e),t)){const e=Object.assign({},Wie(n,t));Yie(e,"root",r),Yie(n,t,e)}else Yie(n,t,r)}return n},coe=(e,a)=>e.some((e=>e.startsWith(a+".")));var doe=function(e,a){for(var n={};e.length;){var t=e[0],i=t.code,r=t.message,o=t.path.join(".");if(!n[o])if("unionErrors"in t){var s=t.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:r,type:i};if("unionErrors"in t&&t.unionErrors.forEach((function(a){return a.errors.forEach((function(a){return e.push(a)}))})),a){var l=n[o].types,u=l&&l[t.code];n[o]=wre(o,a,n,i,u?[].concat(u,t.message):t.message)}e.shift()}return n},moe=function(e,a,n){return void 0===n&&(n={}),function(t,i,r){try{return Promise.resolve(function(i,o){try{var s=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](t,a)).then((function(e){return r.shouldUseNativeValidation&&loe({},r),{errors:{},values:n.raw?t:e}}))}catch(tje){return o(tje)}return s&&s.then?s.then(void 0,o):s}(0,(function(e){if(a=e,Array.isArray(null==a?void 0:a.errors))return{values:{},errors:uoe(doe(e.errors,!r.shouldUseNativeValidation&&"all"===r.criteriaMode),r)};var a;throw e})))}catch(tje){return Promise.reject(tje)}}};const hoe=e=>{const{children:n,...t}=e;return a.createElement(hre.Provider,{value:t},n)},poe=r.createContext({}),goe=({...e})=>n.jsx(poe.Provider,{value:{name:e.name},children:n.jsx(Are,{...e})}),voe=()=>{const e=r.useContext(poe),a=r.useContext(foe),{getFieldState:n,formState:t}=pre(),i=n(e.name,t);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:o}=a;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},foe=r.createContext({}),yoe=r.forwardRef((({className:e,...a},t)=>{const i=r.useId();return n.jsx(foe.Provider,{value:{id:i},children:n.jsx("div",{ref:t,className:im("space-y-2",e),...a})})}));yoe.displayName="FormItem";const koe=r.forwardRef((({className:e,...a},t)=>{const{error:i,formItemId:r}=voe();return n.jsx(Kae,{ref:t,className:im(i&&"text-destructive",e),htmlFor:r,...a})}));koe.displayName="FormLabel";const boe=r.forwardRef((({...e},a)=>{const{error:t,formItemId:i,formDescriptionId:r,formMessageId:o}=voe();return n.jsx(iO,{ref:a,id:i,"aria-describedby":t?`${r} ${o}`:`${r}`,"aria-invalid":!!t,...e})}));boe.displayName="FormControl";r.forwardRef((({className:e,...a},t)=>{const{formDescriptionId:i}=voe();return n.jsx("p",{ref:t,id:i,className:im("text-[0.8rem] text-muted-foreground",e),...a})})).displayName="FormDescription";const Soe=r.forwardRef((({className:e,children:a,...t},i)=>{const{error:r,formMessageId:o}=voe(),s=r?String(r?.message):a;return s?n.jsx("p",{ref:i,id:o,className:im("text-[0.8rem] font-medium text-destructive",e),...t,children:s}):null}));Soe.displayName="FormMessage";const Aoe=({title:e,description:a,children:t})=>n.jsxs("div",{className:"text-left",children:[n.jsx("h3",{className:"text-lg font-medium text-foreground mb-1",children:e}),n.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:a}),n.jsx("div",{className:"space-y-4",children:t})]}),woe=cee,Coe=({control:e,name:a,label:t,placeholder:i,type:r="text",disabled:o})=>n.jsx(goe,{control:e,name:a,render:({field:e})=>n.jsxs(yoe,{children:[n.jsx(koe,{className:"text-sm font-medium",children:t}),n.jsx(boe,{children:n.jsx(o4,{...e,value:"number"===r?e.value||"":e.value,type:r,placeholder:i,className:"h-10",disabled:o,onChange:a=>{if("number"===r){const n=""===a.target.value?"":Number(a.target.value);e.onChange(n)}else e.onChange(a)}})}),n.jsx(Soe,{})]})}),Moe=({isSubmitting:e,onSubmit:a})=>{const t=ooe({resolver:moe(woe),defaultValues:{type:see.AWS_TOLL_FREE_NUMBER,tollFreeNumber:"",company:{name:"",website:"",address1:"",address2:"",city:"",stateProvince:"",zipCode:"",country:""},contact:{firstName:"",lastName:"",email:"",phoneNumber:""},messagingUseCase:{monthlyVolume:0,category:lee.PROMOTIONS_MARKETING,useCaseDetails:""},messageSamples:[""]},values:void 0}),i=t.watch("messageSamples");return n.jsx("div",{className:"w-full max-w-4xl",children:n.jsx(hoe,{...t,children:n.jsxs("form",{onSubmit:t.handleSubmit((async e=>{const n={...e,messagingUseCase:{...e.messagingUseCase,monthlyVolume:Number(e.messagingUseCase.monthlyVolume)}};await a(n)})),className:"space-y-6",children:[n.jsxs(Aoe,{title:"Legal business settings",description:"Provide your legal business information required for SMS channel verification and future communications.",children:[n.jsx(Coe,{control:t.control,name:"company.name",label:"Business Name",placeholder:"Enter your business name",disabled:e}),n.jsx(Coe,{control:t.control,name:"company.website",label:"Business Website",placeholder:"https://example.com",type:"url",disabled:e}),n.jsxs("div",{children:[n.jsx(koe,{className:"text-sm font-medium",children:"Business Address"}),n.jsxs("div",{className:"grid grid-cols-1 gap-3 mt-2",children:[n.jsx(Coe,{control:t.control,name:"company.address1",placeholder:"Street address",disabled:e}),n.jsx(Coe,{control:t.control,name:"company.address2",placeholder:"Apartment, suite, unit, etc. (optional)",disabled:e}),n.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[n.jsx(Coe,{control:t.control,name:"company.city",placeholder:"City",disabled:e}),n.jsx(Coe,{control:t.control,name:"company.stateProvince",placeholder:"State/Province",disabled:e}),n.jsx(Coe,{control:t.control,name:"company.zipCode",placeholder:"ZIP code",disabled:e})]}),n.jsx(Coe,{control:t.control,name:"company.country",placeholder:"Country code (e.g., US)",disabled:e})]})]})]}),n.jsxs(Aoe,{title:"Contact Information",description:"Provide the contact information of the person authorized to represent your business.",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(Coe,{control:t.control,name:"contact.firstName",label:"First Name",placeholder:"First name",disabled:e}),n.jsx(Coe,{control:t.control,name:"contact.lastName",label:"Last Name",placeholder:"Last name",disabled:e})]}),n.jsx(Coe,{control:t.control,name:"contact.email",label:"Email",placeholder:"Email address",type:"email",disabled:e}),n.jsx(Coe,{control:t.control,name:"contact.phoneNumber",label:"Contact Phone",placeholder:"+1234567890",type:"tel",disabled:e})]}),n.jsxs(Aoe,{title:"Messaging Use Case",description:"Tell us about how you plan to use SMS messaging.",children:[n.jsx(Coe,{control:t.control,name:"messagingUseCase.monthlyVolume",label:"Expected Monthly Volume",placeholder:"1000",type:"number",disabled:e}),n.jsx(Coe,{control:t.control,name:"messagingUseCase.useCaseDetails",label:"Use Case Details",placeholder:"Describe your use case in detail",disabled:e})]}),n.jsxs(Aoe,{title:"Message Samples",description:"Provide examples of messages you plan to send (up to 3 samples).",children:[n.jsx(aV,{children:i.map(((a,r)=>n.jsxs(H$.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2},className:"relative",children:[n.jsx(Coe,{control:t.control,name:`messageSamples.${r}`,label:`Sample Message ${r+1}`,placeholder:"Enter a sample message",disabled:e}),i.length>1&&n.jsx(H$.button,{type:"button",onClick:()=>(e=>{if(i.length>1){const a=i.filter(((a,n)=>n!==e));t.setValue("messageSamples",a)}})(r),className:"absolute -right-2 -top-2 rounded-full bg-red-100 p-1 text-red-600 hover:bg-red-200",whileHover:{scale:1.1},whileTap:{scale:.9},children:n.jsx(RY.CloseButton,{className:"h-4 w-4"})})]},r)))}),i.length<3&&n.jsxs(H$.button,{type:"button",onClick:()=>{i.length<3&&t.setValue("messageSamples",[...i,""])},className:"mt-4 flex items-center gap-2 rounded-lg border border-dashed border-gray-300 px-4 py-2 text-sm text-gray-600 hover:border-gray-400 hover:text-gray-700",whileHover:{scale:1.02},whileTap:{scale:.98},children:[n.jsx(RY.PlusIcon,{className:"h-4 w-4"}),"Add another sample"]})]}),n.jsx("div",{className:"flex gap-3 pt-4 justify-end",children:n.jsx(jY,{type:"submit",disabled:e,children:e?"Submitting...":"Submit for approval"})})]})})})},Toe=()=>{const[e,t]=a.useState(!1),{data:i,isLoading:r}=L9(),{createSmsRegistrationApplication:o,isCreating:s}=B9(),{toast:l}=Ie();if(!i||r)return n.jsx("div",{className:"flex flex-col items-center justify-center p-8",children:n.jsx(xY,{text:["Loading business information..."]})});const u={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.4,0,.2,1]}}},c=i&&i.status===dee.PENDING;return n.jsxs(H$.div,{initial:"hidden",animate:"visible",exit:"exit",variants:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.4,0,.2,1],staggerChildren:.1}},exit:{opacity:0,y:-20,transition:{duration:.3,ease:[.4,0,1,1]}}},className:im("flex flex-col items-center text-center w-full max-w-[72ch] rounded-xl p-6 gap-3 border border-border mx-auto mb-16","bg-background"),children:[n.jsx(H$.div,{variants:u,className:"w-16 h-16 rounded-xl flex items-center justify-center",children:n.jsx(RY.SmsIcon,{})}),n.jsx(H$.h2,{variants:u,className:"text-sm font-medium text-foreground",children:"Request your SMS sending number"}),n.jsxs(H$.div,{variants:u,className:"max-w-xl mx-auto",children:[n.jsx("p",{className:"text-sm font-normal text-muted-foreground mb-2",children:"Before you can send messages, we need to verify your business info with our SMS provider. Once approved, we'll assign you a phone number to send SMS campaigns."}),n.jsx("p",{className:"text-sm font-normal text-muted-foreground",children:"This usually takes 3-7 business days."})]}),n.jsx(aV,{mode:"wait",children:e?n.jsx(H$.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.3,ease:[.4,0,.2,1]},className:"w-full",children:n.jsx(Moe,{isSubmitting:s,onSubmit:async e=>{try{o({application:e},{onSuccess:()=>{l({title:"SMS setup submission successful"}),t(!1)},onError:()=>{l({title:"SMS setup submission failed",description:"Please contact your administrator."})}})}catch(a){}}})},"form"):c?n.jsxs(H$.div,{variants:u,className:"flex items-center gap-2 px-3 py-1.5 bg-orange-50 border border-orange-200 rounded-full",children:[n.jsx(H$.div,{animate:{scale:[1,1.2,1],opacity:[1,.8,1]},transition:{duration:2,repeat:Number.POSITIVE_INFINITY,ease:"easeInOut"},className:"w-2 h-2 bg-orange-500 rounded-full"}),n.jsx("span",{className:"text-sm font-medium text-orange-800",children:"Pending approval"})]},"pending"):n.jsx(H$.div,{variants:u,children:n.jsx(jY,{variant:"outline",className:"bg-background",onClick:()=>t(!0),children:"Request approval"})},"button")})]})},Noe=async()=>(await Pe(s)).data,xoe=["me"],Eoe=()=>ye({queryKey:xoe,queryFn:Noe,...we}),Poe=()=>{const e=ce(),a=Eoe(),n=ke({mutationFn:e=>(async e=>(await Pe(s,{method:"PATCH",body:JSON.stringify({website:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:xoe})}}),t=ke({mutationFn:e=>(async e=>(await Pe(s,{method:"PATCH",body:JSON.stringify({locations:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:xoe})}}),i=ke({mutationFn:e=>(async e=>(await Pe(s,{method:"PATCH",body:JSON.stringify({branding:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:xoe})}});return{data:a.data,isLoading:a.isLoading,error:a.error,refetch:a.refetch,updateWebsite:n.mutate,updateLocations:t.mutate,updateBrandSettings:i.mutate,isUpdatingWebsite:n.isPending,isUpdatingLocations:t.isPending,isUpdatingBrandSettings:i.isPending}},joe="undefined"!=typeof window&&"undefined"!=typeof document;var Loe=.999,Boe=/[\\\/_+.#"@\[\(\{&]/,zoe=/[\\\/_+.#"@\[\(\{&]/g,Roe=/[\s-]/,_oe=/[\s-]/g;function Doe(e,a,n,t,i,r,o){if(r===a.length)return i===e.length?1:.99;var s=`${i},${r}`;if(void 0!==o[s])return o[s];for(var l,u,c,d,m=t.charAt(r),h=n.indexOf(m,i),p=0;h>=0;)(l=Doe(e,a,n,t,h+1,r+1,o))>p&&(h===i?l*=1:Boe.test(e.charAt(h-1))?(l*=.8,(c=e.slice(i,h-1).match(zoe))&&i>0&&(l*=Math.pow(Loe,c.length))):Roe.test(e.charAt(h-1))?(l*=.9,(d=e.slice(i,h-1).match(_oe))&&i>0&&(l*=Math.pow(Loe,d.length))):(l*=.17,i>0&&(l*=Math.pow(Loe,h-i))),e.charAt(h)!==a.charAt(r)&&(l*=.9999)),(l<.1&&n.charAt(h-1)===t.charAt(r+1)||t.charAt(r+1)===t.charAt(r)&&n.charAt(h-1)!==t.charAt(r))&&(.1*(u=Doe(e,a,n,t,h+1,r+2,o))>l&&(l=.1*u)),l>p&&(p=l),h=n.indexOf(m,h+1);return o[s]=p,p}function Koe(e){return e.toLowerCase().replace(_oe," ")}function Hoe(e,a,n){return Doe(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,a,Koe(e),Koe(a),0,0,{})}var Ooe,Ioe={exports:{}},Goe={};var Voe,Foe={};
85
+ */(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);r+="; Expires="+n.expires.toUTCString()}n.httpOnly&&(r+="; HttpOnly");n.secure&&(r+="; Secure");n.partitioned&&(r+="; Partitioned");if(n.priority){switch("string"==typeof n.priority?n.priority.toLowerCase():void 0){case"low":r+="; Priority=Low";break;case"medium":r+="; Priority=Medium";break;case"high":r+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}}if(n.sameSite){switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"none":r+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}}return r};const c4=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,d4=/^[\u0021-\u003A\u003C-\u007E]*$/,m4=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,h4=/^[\u0020-\u003A\u003D-\u007E]*$/,p4=Object.prototype.toString,g4=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function v4(e,a,n){do{const n=e.charCodeAt(a);if(32!==n&&9!==n)return a}while(++a<n);return n}function f4(e,a,n){for(;a>n;){const n=e.charCodeAt(--a);if(32!==n&&9!==n)return a+1}return n}function y4(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(uBe){return e}}function k4(e={}){let a,{initialEntries:n=["/"],initialIndex:t,v5Compat:i=!1}=e;a=n.map(((e,a)=>c(e,"string"==typeof e?null:e.state,0===a?"default":void 0)));let r=l(null==t?a.length-1:t),o="POP",s=null;function l(e){return Math.min(Math.max(e,0),a.length-1)}function u(){return a[r]}function c(e,n=null,t){let i=function(e,a,n=null,t){let i={pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof a?C4(a):a,state:n,key:a&&a.key||t||A4()};return i}(a?u().pathname:"/",e,n,t);return S4("/"===i.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),i}function d(e){return"string"==typeof e?e:w4(e)}return{get index(){return r},get action(){return o},get location(){return u()},createHref:d,createURL:e=>new URL(d(e),"http://localhost"),encodeLocation(e){let a="string"==typeof e?C4(e):e;return{pathname:a.pathname||"",search:a.search||"",hash:a.hash||""}},push(e,n){o="PUSH";let t=c(e,n);r+=1,a.splice(r,a.length,t),i&&s&&s({action:o,location:t,delta:1})},replace(e,n){o="REPLACE";let t=c(e,n);a[r]=t,i&&s&&s({action:o,location:t,delta:0})},go(e){o="POP";let n=l(r+e);r=n,s&&s({action:o,location:a[n],delta:e})},listen:e=>(s=e,()=>{s=null})}}function b4(e,a){if(!1===e||null==e)throw new Error(a)}function S4(e,a){if(!e)try{throw new Error(a)}catch(uBe){}}function A4(){return Math.random().toString(36).substring(2,10)}function w4({pathname:e="/",search:a="",hash:n=""}){return a&&"?"!==a&&(e+="?"===a.charAt(0)?a:"?"+a),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function C4(e){let a={};if(e){let n=e.indexOf("#");n>=0&&(a.hash=e.substring(n),e=e.substring(0,n));let t=e.indexOf("?");t>=0&&(a.search=e.substring(t),e=e.substring(0,t)),e&&(a.pathname=e)}return a}function M4(e,a,n="/"){return function(e,a,n,t){let i="string"==typeof a?C4(a):a,r=H4(i.pathname||"/",n);if(null==r)return null;let o=T4(e);!function(e){e.sort(((e,a)=>e.score!==a.score?a.score-e.score:function(e,a){let n=e.length===a.length&&e.slice(0,-1).every(((e,n)=>e===a[n]));return n?e[e.length-1]-a[a.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),a.routesMeta.map((e=>e.childrenIndex)))))}(o);let s=null;for(let l=0;null==s&&l<o.length;++l){let e=K4(r);s=_4(o[l],e,t)}return s}(e,a,n,!1)}function T4(e,a=[],n=[],t=""){let i=(e,i,r)=>{let o={relativePath:void 0===r?e.path||"":r,caseSensitive:!0===e.caseSensitive,childrenIndex:i,route:e};o.relativePath.startsWith("/")&&(b4(o.relativePath.startsWith(t),`Absolute route path "${o.relativePath}" nested under path "${t}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(t.length));let s=V4([t,o.relativePath]),l=n.concat(o);e.children&&e.children.length>0&&(b4(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${s}".`),T4(e.children,a,l,s)),(null!=e.path||e.index)&&a.push({path:s,score:R4(s,e.index),routesMeta:l})};return e.forEach(((e,a)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of N4(e.path))i(e,a,n);else i(e,a)})),a}function N4(e){let a=e.split("/");if(0===a.length)return[];let[n,...t]=a,i=n.endsWith("?"),r=n.replace(/\?$/,"");if(0===t.length)return i?[r,""]:[r];let o=N4(t.join("/")),s=[];return s.push(...o.map((e=>""===e?r:[r,e].join("/")))),i&&s.push(...o),s.map((a=>e.startsWith("/")&&""===a?"/":a))}var x4=/^:[\w-]+$/,E4=3,P4=2,j4=1,L4=10,B4=-2,z4=e=>"*"===e;function R4(e,a){let n=e.split("/"),t=n.length;return n.some(z4)&&(t+=B4),a&&(t+=P4),n.filter((e=>!z4(e))).reduce(((e,a)=>e+(x4.test(a)?E4:""===a?j4:L4)),t)}function _4(e,a,n=!1){let{routesMeta:t}=e,i={},r="/",o=[];for(let s=0;s<t.length;++s){let e=t[s],l=s===t.length-1,u="/"===r?a:a.slice(r.length)||"/",c=D4({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},u),d=e.route;if(!c&&l&&n&&!t[t.length-1].route.index&&(c=D4({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},u)),!c)return null;Object.assign(i,c.params),o.push({params:i,pathname:V4([r,c.pathname]),pathnameBase:F4(V4([r,c.pathnameBase])),route:d}),"/"!==c.pathnameBase&&(r=V4([r,c.pathnameBase]))}return o}function D4(e,a){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,t]=function(e,a=!1,n=!0){S4("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let t=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,a,n)=>(t.push({paramName:a,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(t.push({paramName:"*"}),i+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":""!==e&&"/"!==e&&(i+="(?:(?=\\/|$))");let r=new RegExp(i,a?void 0:"i");return[r,t]}(e.path,e.caseSensitive,e.end),i=a.match(n);if(!i)return null;let r=i[0],o=r.replace(/(.)\/+$/,"$1"),s=i.slice(1);return{params:t.reduce(((e,{paramName:a,isOptional:n},t)=>{if("*"===a){o=r.slice(0,r.length-(s[t]||"").length).replace(/(.)\/+$/,"$1")}const i=s[t];return e[a]=n&&!i?void 0:(i||"").replace(/%2F/g,"/"),e}),{}),pathname:r,pathnameBase:o,pattern:e}}function K4(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(a){return S4(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),e}}function H4(e,a){if("/"===a)return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let n=a.endsWith("/")?a.length-1:a.length,t=e.charAt(n);return t&&"/"!==t?null:e.slice(n)||"/"}function O4(e,a,n,t){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(t)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function I4(e){let a=function(e){return e.filter(((e,a)=>0===a||e.route.path&&e.route.path.length>0))}(e);return a.map(((e,n)=>n===a.length-1?e.pathname:e.pathnameBase))}function G4(e,a,n,t=!1){let i;"string"==typeof e?i=C4(e):(i={...e},b4(!i.pathname||!i.pathname.includes("?"),O4("?","pathname","search",i)),b4(!i.pathname||!i.pathname.includes("#"),O4("#","pathname","hash",i)),b4(!i.search||!i.search.includes("#"),O4("#","search","hash",i)));let r,o=""===e||""===i.pathname,s=o?"/":i.pathname;if(null==s)r=n;else{let e=a.length-1;if(!t&&s.startsWith("..")){let a=s.split("/");for(;".."===a[0];)a.shift(),e-=1;i.pathname=a.join("/")}r=e>=0?a[e]:"/"}let l=function(e,a="/"){let{pathname:n,search:t="",hash:i=""}="string"==typeof e?C4(e):e,r=n?n.startsWith("/")?n:function(e,a){let n=a.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,a):a;return{pathname:r,search:J4(t),hash:U4(i)}}(i,r),u=s&&"/"!==s&&s.endsWith("/"),c=(o||"."===s)&&n.endsWith("/");return l.pathname.endsWith("/")||!u&&!c||(l.pathname+="/"),l}var V4=e=>e.join("/").replace(/\/\/+/g,"/"),F4=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),J4=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",U4=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var W4=["POST","PUT","PATCH","DELETE"];new Set(W4);var q4=["GET",...W4];new Set(q4);var Z4=r.createContext(null);Z4.displayName="DataRouter";var $4=r.createContext(null);$4.displayName="DataRouterState";var Y4=r.createContext({isTransitioning:!1});Y4.displayName="ViewTransition",r.createContext(new Map).displayName="Fetchers",r.createContext(null).displayName="Await";var Q4=r.createContext(null);Q4.displayName="Navigation";var X4=r.createContext(null);X4.displayName="Location";var e5=r.createContext({outlet:null,matches:[],isDataRoute:!1});e5.displayName="Route";var a5=r.createContext(null);function n5(){return null!=r.useContext(X4)}function t5(){return b4(n5(),"useLocation() may be used only in the context of a <Router> component."),r.useContext(X4).location}a5.displayName="RouteError";var i5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function r5(e){r.useContext(Q4).static||r.useLayoutEffect(e)}function o5(){let{isDataRoute:e}=r.useContext(e5);return e?function(){let{router:e}=function(e){let a=r.useContext(Z4);return b4(a,h5(e)),a}("useNavigate"),a=p5("useNavigate"),n=r.useRef(!1);return r5((()=>{n.current=!0})),r.useCallback((async(t,i={})=>{S4(n.current,i5),n.current&&("number"==typeof t?e.navigate(t):await e.navigate(t,{fromRouteId:a,...i}))}),[e,a])}():function(){b4(n5(),"useNavigate() may be used only in the context of a <Router> component.");let e=r.useContext(Z4),{basename:a,navigator:n}=r.useContext(Q4),{matches:t}=r.useContext(e5),{pathname:i}=t5(),o=JSON.stringify(I4(t)),s=r.useRef(!1);return r5((()=>{s.current=!0})),r.useCallback(((t,r={})=>{if(S4(s.current,i5),!s.current)return;if("number"==typeof t)return void n.go(t);let l=G4(t,JSON.parse(o),i,"path"===r.relative);null==e&&"/"!==a&&(l.pathname="/"===l.pathname?a:V4([a,l.pathname])),(r.replace?n.replace:n.push)(l,r.state,r)}),[a,n,o,i,e])}()}function s5(e,{relative:a}={}){let{matches:n}=r.useContext(e5),{pathname:t}=t5(),i=JSON.stringify(I4(n));return r.useMemo((()=>G4(e,JSON.parse(i),t,"path"===a)),[e,i,t,a])}function l5(e,a,n,t){b4(n5(),"useRoutes() may be used only in the context of a <Router> component.");let i,{navigator:o,static:s}=r.useContext(Q4),{matches:l}=r.useContext(e5),u=l[l.length-1],c=u?u.params:{},d=u?u.pathname:"/",m=u?u.pathnameBase:"/",h=u&&u.route;{let e=h&&h.path||"";v5(d,!h||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}i=t5();let p=i.pathname||"/",g=p;if("/"!==m){let e=m.replace(/^\//,"").split("/");g="/"+p.replace(/^\//,"").split("/").slice(e.length).join("/")}let v=!s&&n&&n.matches&&n.matches.length>0?n.matches:M4(e,{pathname:g});S4(h||null!=v,`No routes matched location "${i.pathname}${i.search}${i.hash}" `),S4(null==v||void 0!==v[v.length-1].route.element||void 0!==v[v.length-1].route.Component||void 0!==v[v.length-1].route.lazy,`Matched leaf route at location "${i.pathname}${i.search}${i.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let f=function(e,a=[],n=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==a.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let t=e,i=n?.errors;if(null!=i){let e=t.findIndex((e=>e.route.id&&void 0!==i?.[e.route.id]));b4(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),t=t.slice(0,Math.min(t.length,e+1))}let o=!1,s=-1;if(n)for(let r=0;r<t.length;r++){let e=t[r];if((e.route.HydrateFallback||e.route.hydrateFallbackElement)&&(s=r),e.route.id){let{loaderData:a,errors:i}=n,r=e.route.loader&&!a.hasOwnProperty(e.route.id)&&(!i||void 0===i[e.route.id]);if(e.route.lazy||r){o=!0,t=s>=0?t.slice(0,s+1):[t[0]];break}}}return t.reduceRight(((e,l,u)=>{let c,d=!1,m=null,h=null;n&&(c=i&&l.route.id?i[l.route.id]:void 0,m=l.route.errorElement||c5,o&&(s<0&&0===u?(v5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,h=null):s===u&&(d=!0,h=l.route.hydrateFallbackElement||null)));let p=a.concat(t.slice(0,u+1)),g=()=>{let a;return a=c?m:d?h:l.route.Component?r.createElement(l.route.Component,null):l.route.element?l.route.element:e,r.createElement(m5,{match:l,routeContext:{outlet:e,matches:p,isDataRoute:null!=n},children:a})};return n&&(l.route.ErrorBoundary||l.route.errorElement||0===u)?r.createElement(d5,{location:n.location,revalidation:n.revalidation,component:m,error:c,children:g(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):g()}),null)}(v&&v.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:V4([m,o.encodeLocation?o.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?m:V4([m,o.encodeLocation?o.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,n,t);return f}function u5(){let e=function(){let e=r.useContext(a5),a=function(e){let a=r.useContext($4);return b4(a,h5(e)),a}("useRouteError"),n=p5("useRouteError");if(void 0!==e)return e;return a.errors?.[n]}(),a=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,t="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:t},o={padding:"2px 4px",backgroundColor:t},s=null;return s=r.createElement(r.Fragment,null,r.createElement("p",null,"💿 Hey developer 👋"),r.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",r.createElement("code",{style:o},"ErrorBoundary")," or"," ",r.createElement("code",{style:o},"errorElement")," prop on your route.")),r.createElement(r.Fragment,null,r.createElement("h2",null,"Unexpected Application Error!"),r.createElement("h3",{style:{fontStyle:"italic"}},a),n?r.createElement("pre",{style:i},n):null,s)}r.createContext(null);var c5=r.createElement(u5,null),d5=class extends r.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,a){return a.location!==e.location||"idle"!==a.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){}render(){return void 0!==this.state.error?r.createElement(e5.Provider,{value:this.props.routeContext},r.createElement(a5.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function m5({routeContext:e,match:a,children:n}){let t=r.useContext(Z4);return t&&t.static&&t.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(t.staticContext._deepestRenderedBoundaryId=a.route.id),r.createElement(e5.Provider,{value:e},n)}function h5(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function p5(e){let a=function(e){let a=r.useContext(e5);return b4(a,h5(e)),a}(e),n=a.matches[a.matches.length-1];return b4(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}var g5={};function v5(e,a,n){a||g5[e]||(g5[e]=!0,S4(!1,n))}function f5({basename:e,children:a,initialEntries:n,initialIndex:t}){let i=r.useRef();null==i.current&&(i.current=k4({initialEntries:n,initialIndex:t,v5Compat:!0}));let o=i.current,[s,l]=r.useState({action:o.action,location:o.location}),u=r.useCallback((e=>{r.startTransition((()=>l(e)))}),[l]);return r.useLayoutEffect((()=>o.listen(u)),[o,u]),r.createElement(y5,{basename:e,children:a,location:s.location,navigationType:s.action,navigator:o})}function y5({basename:e="/",children:a=null,location:n,navigationType:t="POP",navigator:i,static:o=!1}){b4(!n5(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=r.useMemo((()=>({basename:s,navigator:i,static:o,future:{}})),[s,i,o]);"string"==typeof n&&(n=C4(n));let{pathname:u="/",search:c="",hash:d="",state:m=null,key:h="default"}=n,p=r.useMemo((()=>{let e=H4(u,s);return null==e?null:{location:{pathname:e,search:c,hash:d,state:m,key:h},navigationType:t}}),[s,u,c,d,m,h,t]);return S4(null!=p,`<Router basename="${s}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),null==p?null:r.createElement(Q4.Provider,{value:l},r.createElement(X4.Provider,{children:a,value:p}))}r.memo((function({routes:e,future:a,state:n}){return l5(e,0,n,a)}));var k5="get",b5="application/x-www-form-urlencoded";function S5(e){return null!=e&&"string"==typeof e.tagName}function A5(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((a,n)=>{let t=e[n];return a.concat(Array.isArray(t)?t.map((e=>[n,e])):[[n,t]])}),[]))}var w5=null;var C5=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function M5(e){return null==e||C5.has(e)?e:(S4(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${b5}"`),null)}function T5(e,a){let n,t,i,r,o;if(function(e){return S5(e)&&"form"===e.tagName.toLowerCase()}(e)){let o=e.getAttribute("action");t=o?H4(o,a):null,n=e.getAttribute("method")||k5,i=M5(e.getAttribute("enctype"))||b5,r=new FormData(e)}else if(function(e){return S5(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return S5(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let o=e.form;if(null==o)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||o.getAttribute("action");if(t=s?H4(s,a):null,n=e.getAttribute("formmethod")||o.getAttribute("method")||k5,i=M5(e.getAttribute("formenctype"))||M5(o.getAttribute("enctype"))||b5,r=new FormData(o,e),!function(){if(null===w5)try{new FormData(document.createElement("form"),0),w5=!1}catch(uBe){w5=!0}return w5}()){let{name:a,type:n,value:t}=e;if("image"===n){let e=a?`${a}.`:"";r.append(`${e}x`,"0"),r.append(`${e}y`,"0")}else a&&r.append(a,t)}}else{if(S5(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=k5,t=null,i=b5,o=e}return r&&"text/plain"===i&&(o=r,r=void 0),{action:t,method:n.toLowerCase(),encType:i,formData:r,body:o}}function N5(e,a){if(!1===e||null==e)throw new Error(a)}function x5(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function E5(e,a,n){return function(e,a){let n=new Set;return new Set(a),e.reduce(((e,a)=>{let t=JSON.stringify(function(e){let a={},n=Object.keys(e).sort();for(let t of n)a[t]=e[t];return a}(a));return n.has(t)||(n.add(t),e.push({key:t,link:a})),e}),[])}((await Promise.all(e.map((async e=>{let t=a.routes[e.route.id];if(t){let e=await async function(e,a){if(e.id in a)return a[e.id];try{let n=await import(e.module);return a[e.id]=n,n}catch(n){return window.__reactRouterContext&&window,window.location.reload(),new Promise((()=>{}))}}(t,n);return e.links?e.links():[]}return[]})))).flat(1).filter(x5).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function P5(e,a,n,t,i,r){let o=(e,a)=>!n[a]||e.route.id!==n[a].route.id,s=(e,a)=>n[a].pathname!==e.pathname||n[a].route.path?.endsWith("*")&&n[a].params["*"]!==e.params["*"];return"assets"===r?a.filter(((e,a)=>o(e,a)||s(e,a))):"data"===r?a.filter(((a,r)=>{let l=t.routes[a.route.id];if(!l||!l.hasLoader)return!1;if(o(a,r)||s(a,r))return!0;if(a.route.shouldRevalidate){let t=a.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:a.params,defaultShouldRevalidate:!0});if("boolean"==typeof t)return t}return!0})):[]}function j5(e,a,{includeHydrateFallback:n}={}){return t=e.map((e=>{let t=a.routes[e.route.id];if(!t)return[];let i=[t.module];return t.clientActionModule&&(i=i.concat(t.clientActionModule)),t.clientLoaderModule&&(i=i.concat(t.clientLoaderModule)),n&&t.hydrateFallbackModule&&(i=i.concat(t.hydrateFallbackModule)),t.imports&&(i=i.concat(t.imports)),i})).flat(1),[...new Set(t)];var t}function L5(){let e=r.useContext(Z4);return N5(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}var B5=r.createContext(void 0);function z5(){let e=r.useContext(B5);return N5(e,"You must render this element inside a <HydratedRouter> element"),e}function R5(e,a){return n=>{e&&e(n),n.defaultPrevented||a(n)}}function _5({page:e,...a}){let{router:n}=L5(),t=r.useMemo((()=>M4(n.routes,e,n.basename)),[n.routes,e,n.basename]);return t?r.createElement(D5,{page:e,matches:t,...a}):null}function D5({page:e,matches:a,...n}){let t=t5(),{manifest:i,routeModules:o}=z5(),{basename:s}=L5(),{loaderData:l,matches:u}=function(){let e=r.useContext($4);return N5(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}(),c=r.useMemo((()=>P5(e,a,u,i,t,"data")),[e,a,u,i,t]),d=r.useMemo((()=>P5(e,a,u,i,t,"assets")),[e,a,u,i,t]),m=r.useMemo((()=>{if(e===t.pathname+t.search+t.hash)return[];let n=new Set,r=!1;if(a.forEach((e=>{let a=i.routes[e.route.id];a&&a.hasLoader&&(!c.some((a=>a.route.id===e.route.id))&&e.route.id in l&&o[e.route.id]?.shouldRevalidate||a.hasClientLoader?r=!0:n.add(e.route.id))})),0===n.size)return[];let u=function(e,a){let n="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return n.pathname="/"===n.pathname?"_root.data":a&&"/"===H4(n.pathname,a)?`${a.replace(/\/$/,"")}/_root.data`:`${n.pathname.replace(/\/$/,"")}.data`,n}(e,s);return r&&n.size>0&&u.searchParams.set("_routes",a.filter((e=>n.has(e.route.id))).map((e=>e.route.id)).join(",")),[u.pathname+u.search]}),[s,l,t,i,c,a,e,o]),h=r.useMemo((()=>j5(d,i)),[d,i]),p=function(e){let{manifest:a,routeModules:n}=z5(),[t,i]=r.useState([]);return r.useEffect((()=>{let t=!1;return E5(e,a,n).then((e=>{t||i(e)})),()=>{t=!0}}),[e,a,n]),t}(d);return r.createElement(r.Fragment,null,m.map((e=>r.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),h.map((e=>r.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),p.map((({key:e,link:a})=>r.createElement("link",{key:e,...a}))))}function K5(...e){return a=>{e.forEach((e=>{"function"==typeof e?e(a):null!=e&&(e.current=a)}))}}B5.displayName="FrameworkContext";var H5="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{H5&&(window.__reactRouterVersion="7.5.2")}catch(uBe){}var O5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,I5=r.forwardRef((function({onClick:e,discover:a="render",prefetch:n="none",relative:t,reloadDocument:i,replace:o,state:s,target:l,to:u,preventScrollReset:c,viewTransition:d,...m},h){let p,{basename:g}=r.useContext(Q4),v="string"==typeof u&&O5.test(u),f=!1;if("string"==typeof u&&v&&(p=u,H5))try{let e=new URL(window.location.href),a=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=H4(a.pathname,g);a.origin===e.origin&&null!=n?u=n+a.search+a.hash:f=!0}catch(uBe){S4(!1,`<Link to="${u}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let y=function(e,{relative:a}={}){b4(n5(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:t}=r.useContext(Q4),{hash:i,pathname:o,search:s}=s5(e,{relative:a}),l=o;return"/"!==n&&(l="/"===o?n:V4([n,o])),t.createHref({pathname:l,search:s,hash:i})}(u,{relative:t}),[k,b,S]=function(e,a){let n=r.useContext(B5),[t,i]=r.useState(!1),[o,s]=r.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:d,onTouchStart:m}=a,h=r.useRef(null);r.useEffect((()=>{if("render"===e&&s(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return h.current&&e.observe(h.current),()=>{e.disconnect()}}}),[e]),r.useEffect((()=>{if(t){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[t]);let p=()=>{i(!0)},g=()=>{i(!1),s(!1)};return n?"intent"!==e?[o,h,{}]:[o,h,{onFocus:R5(l,p),onBlur:R5(u,g),onMouseEnter:R5(c,p),onMouseLeave:R5(d,g),onTouchStart:R5(m,p)}]:[!1,h,{}]}(n,m),A=function(e,{target:a,replace:n,state:t,preventScrollReset:i,relative:o,viewTransition:s}={}){let l=o5(),u=t5(),c=s5(e,{relative:o});return r.useCallback((r=>{if(function(e,a){return!(0!==e.button||a&&"_self"!==a||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(r,a)){r.preventDefault();let a=void 0!==n?n:w4(u)===w4(c);l(e,{replace:a,state:t,preventScrollReset:i,relative:o,viewTransition:s})}}),[u,l,c,n,t,a,e,i,o,s])}(u,{replace:o,state:s,target:l,preventScrollReset:c,relative:t,viewTransition:d});let w=r.createElement("a",{...m,...S,href:p||y,onClick:f||i?e:function(a){e&&e(a),a.defaultPrevented||A(a)},ref:K5(h,b),target:l,"data-discover":v||"render"!==a?void 0:"true"});return k&&!v?r.createElement(r.Fragment,null,w,r.createElement(_5,{page:y})):w}));I5.displayName="Link",r.forwardRef((function({"aria-current":e="page",caseSensitive:a=!1,className:n="",end:t=!1,style:i,to:o,viewTransition:s,children:l,...u},c){let d=s5(o,{relative:u.relative}),m=t5(),h=r.useContext($4),{navigator:p,basename:g}=r.useContext(Q4),v=null!=h&&function(e,a={}){let n=r.useContext(Y4);b4(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:t}=V5("useViewTransitionState"),i=s5(e,{relative:a.relative});if(!n.isTransitioning)return!1;let o=H4(n.currentLocation.pathname,t)||n.currentLocation.pathname,s=H4(n.nextLocation.pathname,t)||n.nextLocation.pathname;return null!=D4(i.pathname,s)||null!=D4(i.pathname,o)}(d)&&!0===s,f=p.encodeLocation?p.encodeLocation(d).pathname:d.pathname,y=m.pathname,k=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;a||(y=y.toLowerCase(),k=k?k.toLowerCase():null,f=f.toLowerCase()),k&&g&&(k=H4(k,g)||k);const b="/"!==f&&f.endsWith("/")?f.length-1:f.length;let S,A=y===f||!t&&y.startsWith(f)&&"/"===y.charAt(b),w=null!=k&&(k===f||!t&&k.startsWith(f)&&"/"===k.charAt(f.length)),C={isActive:A,isPending:w,isTransitioning:v},M=A?e:void 0;S="function"==typeof n?n(C):[n,A?"active":null,w?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T="function"==typeof i?i(C):i;return r.createElement(I5,{...u,"aria-current":M,className:S,ref:c,style:T,to:o,viewTransition:s},"function"==typeof l?l(C):l)})).displayName="NavLink";var G5=r.forwardRef((({discover:e="render",fetcherKey:a,navigate:n,reloadDocument:t,replace:i,state:o,method:s=k5,action:l,onSubmit:u,relative:c,preventScrollReset:d,viewTransition:m,...h},p)=>{let g=function(){let{router:e}=V5("useSubmit"),{basename:a}=r.useContext(Q4),n=p5("useRouteId");return r.useCallback((async(t,i={})=>{let{action:r,method:o,encType:s,formData:l,body:u}=T5(t,a);if(!1===i.navigate){let a=i.fetcherKey||U5();await e.fetch(a,n,i.action||r,{preventScrollReset:i.preventScrollReset,formData:l,body:u,formMethod:i.method||o,formEncType:i.encType||s,flushSync:i.flushSync})}else await e.navigate(i.action||r,{preventScrollReset:i.preventScrollReset,formData:l,body:u,formMethod:i.method||o,formEncType:i.encType||s,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})}),[e,a,n])}(),v=function(e,{relative:a}={}){let{basename:n}=r.useContext(Q4),t=r.useContext(e5);b4(t,"useFormAction must be used inside a RouteContext");let[i]=t.matches.slice(-1),o={...s5(e||".",{relative:a})},s=t5();if(null==e){o.search=s.search;let e=new URLSearchParams(o.search),a=e.getAll("index");if(a.some((e=>""===e))){e.delete("index"),a.filter((e=>e)).forEach((a=>e.append("index",a)));let n=e.toString();o.search=n?`?${n}`:""}}e&&"."!==e||!i.route.index||(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(o.pathname="/"===o.pathname?n:V4([n,o.pathname]));return w4(o)}(l,{relative:c}),f="get"===s.toLowerCase()?"get":"post",y="string"==typeof l&&O5.test(l);return r.createElement("form",{ref:p,method:f,action:v,onSubmit:t?u:e=>{if(u&&u(e),e.defaultPrevented)return;e.preventDefault();let t=e.nativeEvent.submitter,r=t?.getAttribute("formmethod")||s;g(t||e.currentTarget,{fetcherKey:a,method:r,navigate:n,replace:i,state:o,relative:c,preventScrollReset:d,viewTransition:m})},...h,"data-discover":y||"render"!==e?void 0:"true"})}));function V5(e){let a=r.useContext(Z4);return b4(a,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(e)),a}function F5(e){S4("undefined"!=typeof URLSearchParams,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let a=r.useRef(A5(e)),n=r.useRef(!1),t=t5(),i=r.useMemo((()=>function(e,a){let n=A5(e);return a&&a.forEach(((e,t)=>{n.has(t)||a.getAll(t).forEach((e=>{n.append(t,e)}))})),n}(t.search,n.current?null:a.current)),[t.search]),o=o5(),s=r.useCallback(((e,a)=>{const t=A5("function"==typeof e?e(i):e);n.current=!0,o("?"+t,a)}),[o,i]);return[i,s]}G5.displayName="Form";var J5=0,U5=()=>`__${String(++J5)}__`;new TextEncoder;var W5,q5="dismissableLayer.update",Z5="dismissableLayer.pointerDownOutside",$5="dismissableLayer.focusOutside",Y5=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Q5=r.forwardRef(((e,a)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:u,...c}=e,d=r.useContext(Y5),[m,h]=r.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=r.useState({}),v=tO(a,(e=>h(e))),f=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=f.indexOf(y),b=m?f.indexOf(m):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,A=b>=k,w=function(e,a=globalThis?.document){const n=nX(e),t=r.useRef(!1),i=r.useRef((()=>{}));return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){let t=function(){e6(Z5,n,r,{discrete:!0})};const r={originalEvent:e};"touch"===e.pointerType?(a.removeEventListener("click",i.current),i.current=t,a.addEventListener("click",i.current,{once:!0})):t()}else a.removeEventListener("click",i.current);t.current=!1},r=window.setTimeout((()=>{a.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),a.removeEventListener("pointerdown",e),a.removeEventListener("click",i.current)}}),[a,n]),{onPointerDownCapture:()=>t.current=!0}}((e=>{const a=e.target,n=[...d.branches].some((e=>e.contains(a)));A&&!n&&(o?.(e),l?.(e),e.defaultPrevented||u?.())}),p),C=function(e,a=globalThis?.document){const n=nX(e),t=r.useRef(!1);return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){e6($5,n,{originalEvent:e},{discrete:!1})}};return a.addEventListener("focusin",e),()=>a.removeEventListener("focusin",e)}),[a,n]),{onFocusCapture:()=>t.current=!0,onBlurCapture:()=>t.current=!1}}((e=>{const a=e.target;[...d.branches].some((e=>e.contains(a)))||(s?.(e),l?.(e),e.defaultPrevented||u?.())}),p);return pX((e=>{b===d.layers.size-1&&(i?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))}),p),r.useEffect((()=>{if(m)return t&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(W5=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),X5(),()=>{t&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=W5)}}),[m,p,t,d]),r.useEffect((()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),X5())}),[m,d]),r.useEffect((()=>{const e=()=>g({});return document.addEventListener(q5,e),()=>document.removeEventListener(q5,e)}),[]),n.jsx(uX.div,{...c,ref:v,style:{pointerEvents:S?A?"auto":"none":void 0,...e.style},onFocusCapture:XQ(e.onFocusCapture,C.onFocusCapture),onBlurCapture:XQ(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:XQ(e.onPointerDownCapture,w.onPointerDownCapture)})}));Q5.displayName="DismissableLayer";function X5(){const e=new CustomEvent(q5);document.dispatchEvent(e)}function e6(e,a,n,{discrete:t}){const i=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});a&&i.addEventListener(e,a,{once:!0}),t?cX(i,r):i.dispatchEvent(r)}r.forwardRef(((e,a)=>{const t=r.useContext(Y5),i=r.useRef(null),o=tO(a,i);return r.useEffect((()=>{const e=i.current;if(e)return t.branches.add(e),()=>{t.branches.delete(e)}}),[t.branches]),n.jsx(uX.div,{...e,ref:o})})).displayName="DismissableLayerBranch";var a6=r.forwardRef(((e,a)=>n.jsx(uX.span,{...e,ref:a,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}})));a6.displayName="VisuallyHidden";var n6=a6,[t6,i6]=eX("Tooltip",[k1]),r6=k1(),o6="TooltipProvider",s6=700,l6="tooltip.open",[u6,c6]=t6(o6),d6=e=>{const{__scopeTooltip:a,delayDuration:t=s6,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:s}=e,[l,u]=r.useState(!0),c=r.useRef(!1),d=r.useRef(0);return r.useEffect((()=>{const e=d.current;return()=>window.clearTimeout(e)}),[]),n.jsx(u6,{scope:a,isOpenDelayed:l,delayDuration:t,onOpen:r.useCallback((()=>{window.clearTimeout(d.current),u(!1)}),[]),onClose:r.useCallback((()=>{window.clearTimeout(d.current),d.current=window.setTimeout((()=>u(!0)),i)}),[i]),isPointerInTransitRef:c,onPointerInTransitChange:r.useCallback((e=>{c.current=e}),[]),disableHoverableContent:o,children:s})};d6.displayName=o6;var m6="Tooltip",[h6,p6]=t6(m6),g6=e=>{const{__scopeTooltip:a,children:t,open:i,defaultOpen:o=!1,onOpenChange:s,disableHoverableContent:l,delayDuration:u}=e,c=c6(m6,e.__scopeTooltip),d=r6(a),[m,h]=r.useState(null),p=HX(),g=r.useRef(0),v=l??c.disableHoverableContent,f=u??c.delayDuration,y=r.useRef(!1),[k=!1,b]=tX({prop:i,defaultProp:o,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(l6))):c.onClose(),s?.(e)}}),S=r.useMemo((()=>k?y.current?"delayed-open":"instant-open":"closed"),[k]),A=r.useCallback((()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,b(!0)}),[b]),w=r.useCallback((()=>{window.clearTimeout(g.current),g.current=0,b(!1)}),[b]),C=r.useCallback((()=>{window.clearTimeout(g.current),g.current=window.setTimeout((()=>{y.current=!0,b(!0),g.current=0}),f)}),[f,b]);return r.useEffect((()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)}),[]),n.jsx(R1,{...d,children:n.jsx(h6,{scope:a,contentId:p,open:k,stateAttribute:S,trigger:m,onTriggerChange:h,onTriggerEnter:r.useCallback((()=>{c.isOpenDelayed?C():A()}),[c.isOpenDelayed,C,A]),onTriggerLeave:r.useCallback((()=>{v?w():(window.clearTimeout(g.current),g.current=0)}),[w,v]),onOpen:A,onClose:w,disableHoverableContent:v,children:t})})};g6.displayName=m6;var v6="TooltipTrigger",f6=r.forwardRef(((e,a)=>{const{__scopeTooltip:t,...i}=e,o=p6(v6,t),s=c6(v6,t),l=r6(t),u=tO(a,r.useRef(null),o.onTriggerChange),c=r.useRef(!1),d=r.useRef(!1),m=r.useCallback((()=>c.current=!1),[]);return r.useEffect((()=>()=>document.removeEventListener("pointerup",m)),[m]),n.jsx(_1,{asChild:!0,...l,children:n.jsx(uX.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:u,onPointerMove:XQ(e.onPointerMove,(e=>{"touch"!==e.pointerType&&(d.current||s.isPointerInTransitRef.current||(o.onTriggerEnter(),d.current=!0))})),onPointerLeave:XQ(e.onPointerLeave,(()=>{o.onTriggerLeave(),d.current=!1})),onPointerDown:XQ(e.onPointerDown,(()=>{c.current=!0,document.addEventListener("pointerup",m,{once:!0})})),onFocus:XQ(e.onFocus,(()=>{c.current||o.onOpen()})),onBlur:XQ(e.onBlur,o.onClose),onClick:XQ(e.onClick,o.onClose)})})}));f6.displayName=v6;var y6="TooltipPortal",[k6,b6]=t6(y6,{forceMount:void 0}),S6=e=>{const{__scopeTooltip:a,forceMount:t,children:i,container:r}=e,o=p6(y6,a);return n.jsx(k6,{scope:a,forceMount:t,children:n.jsx(O1,{present:t||o.open,children:n.jsx(H1,{asChild:!0,container:r,children:i})})})};S6.displayName=y6;var A6="TooltipContent",w6=r.forwardRef(((e,a)=>{const t=b6(A6,e.__scopeTooltip),{forceMount:i=t.forceMount,side:r="top",...o}=e,s=p6(A6,e.__scopeTooltip);return n.jsx(O1,{present:i||s.open,children:n.jsx(s.disableHoverableContent?N6:C6,{side:r,...o,ref:a})})})),C6=r.forwardRef(((e,a)=>{const t=p6(A6,e.__scopeTooltip),i=c6(A6,e.__scopeTooltip),o=r.useRef(null),s=tO(a,o),[l,u]=r.useState(null),{trigger:c,onClose:d}=t,m=o.current,{onPointerInTransitChange:h}=i,p=r.useCallback((()=>{u(null),h(!1)}),[h]),g=r.useCallback(((e,a)=>{const n={x:e.clientX,y:e.clientY},t=function(e,a,n=5){const t=[];switch(a){case"top":t.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":t.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":t.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":t.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return t}(n,function(e,a){const n=Math.abs(a.top-e.y),t=Math.abs(a.bottom-e.y),i=Math.abs(a.right-e.x),r=Math.abs(a.left-e.x);switch(Math.min(n,t,i,r)){case r:return"left";case i:return"right";case n:return"top";case t:return"bottom";default:throw new Error("unreachable")}}(n,e.currentTarget.getBoundingClientRect())),i=function(e){const a=e.slice();return a.sort(((e,a)=>e.x<a.x?-1:e.x>a.x?1:e.y<a.y?-1:e.y>a.y?1:0)),function(e){if(e.length<=1)return e.slice();const a=[];for(let t=0;t<e.length;t++){const n=e[t];for(;a.length>=2;){const e=a[a.length-1],t=a[a.length-2];if(!((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x)))break;a.pop()}a.push(n)}a.pop();const n=[];for(let t=e.length-1;t>=0;t--){const a=e[t];for(;n.length>=2;){const e=n[n.length-1],t=n[n.length-2];if(!((e.x-t.x)*(a.y-t.y)>=(e.y-t.y)*(a.x-t.x)))break;n.pop()}n.push(a)}return n.pop(),1===a.length&&1===n.length&&a[0].x===n[0].x&&a[0].y===n[0].y?a:a.concat(n)}(a)}([...t,...function(e){const{top:a,right:n,bottom:t,left:i}=e;return[{x:i,y:a},{x:n,y:a},{x:n,y:t},{x:i,y:t}]}(a.getBoundingClientRect())]);u(i),h(!0)}),[h]);return r.useEffect((()=>()=>p()),[p]),r.useEffect((()=>{if(c&&m){const e=e=>g(e,m),a=e=>g(e,c);return c.addEventListener("pointerleave",e),m.addEventListener("pointerleave",a),()=>{c.removeEventListener("pointerleave",e),m.removeEventListener("pointerleave",a)}}}),[c,m,g,p]),r.useEffect((()=>{if(l){const e=e=>{const a=e.target,n={x:e.clientX,y:e.clientY},t=c?.contains(a)||m?.contains(a),i=!function(e,a){const{x:n,y:t}=e;let i=!1;for(let r=0,o=a.length-1;r<a.length;o=r++){const e=a[r].x,s=a[r].y,l=a[o].y;s>t!=l>t&&n<(a[o].x-e)*(t-s)/(l-s)+e&&(i=!i)}return i}(n,l);t?p():i&&(p(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[c,m,l,d,p]),n.jsx(N6,{...e,ref:s})})),[M6,T6]=t6(m6,{isInside:!1}),N6=r.forwardRef(((e,a)=>{const{__scopeTooltip:t,children:i,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:l,...u}=e,c=p6(A6,t),d=r6(t),{onClose:m}=c;return r.useEffect((()=>(document.addEventListener(l6,m),()=>document.removeEventListener(l6,m))),[m]),r.useEffect((()=>{if(c.trigger){const e=e=>{const a=e.target;a?.contains(c.trigger)&&m()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[c.trigger,m]),n.jsx(Q5,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:m,children:n.jsxs(D1,{"data-state":c.stateAttribute,...d,...u,ref:a,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[n.jsx(oX,{children:i}),n.jsx(M6,{scope:t,isInside:!0,children:n.jsx(n6,{id:c.contentId,role:"tooltip",children:o||i})})]})})}));w6.displayName=A6;var x6="TooltipArrow";r.forwardRef(((e,a)=>{const{__scopeTooltip:t,...i}=e,r=r6(t);return T6(x6,t).isInside?null:n.jsx(K1,{...r,...i,ref:a})})).displayName=x6;var E6=S6,P6=w6;const j6=d6,L6=g6,B6=f6,z6=r.forwardRef((({className:e,sideOffset:a=4,...t},i)=>n.jsx(E6,{children:n.jsx(P6,{ref:i,sideOffset:a,className:im("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})})));z6.displayName=P6.displayName;const R6=({rowOriginal:e,constructNavigationUrl:a,cellText:t,cellIcon:i=null,tooltipIcon:r=null,tooltipText:o=null})=>{const s=o5();return o?n.jsx(j6,{children:n.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:n.jsxs(L6,{children:[n.jsx(B6,{asChild:!0,children:n.jsxs(jY,{variant:"outline",onClick:()=>s(a(e.id)),children:[i,t,r]})}),n.jsx(z6,{className:"max-w-[300px] text-sm bg-white border border-gray-200 rounded-lg p-4",children:n.jsx("p",{className:"text-muted-foreground",children:o})})]})})}):n.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:n.jsxs(jY,{variant:"outline",onClick:()=>s(a(e.id)),children:[i,t,r]})})};var _6,D6="dismissableLayer.update",K6="dismissableLayer.pointerDownOutside",H6="dismissableLayer.focusOutside",O6=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),I6=r.forwardRef(((e,a)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:u,...c}=e,d=r.useContext(O6),[m,h]=r.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=r.useState({}),v=tO(a,(e=>h(e))),f=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=f.indexOf(y),b=m?f.indexOf(m):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,A=b>=k,w=function(e,a=globalThis?.document){const n=nX(e),t=r.useRef(!1),i=r.useRef((()=>{}));return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){let t=function(){V6(K6,n,r,{discrete:!0})};const r={originalEvent:e};"touch"===e.pointerType?(a.removeEventListener("click",i.current),i.current=t,a.addEventListener("click",i.current,{once:!0})):t()}else a.removeEventListener("click",i.current);t.current=!1},r=window.setTimeout((()=>{a.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),a.removeEventListener("pointerdown",e),a.removeEventListener("click",i.current)}}),[a,n]),{onPointerDownCapture:()=>t.current=!0}}((e=>{const a=e.target,n=[...d.branches].some((e=>e.contains(a)));A&&!n&&(o?.(e),l?.(e),e.defaultPrevented||u?.())}),p),C=function(e,a=globalThis?.document){const n=nX(e),t=r.useRef(!1);return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){V6(H6,n,{originalEvent:e},{discrete:!1})}};return a.addEventListener("focusin",e),()=>a.removeEventListener("focusin",e)}),[a,n]),{onFocusCapture:()=>t.current=!0,onBlurCapture:()=>t.current=!1}}((e=>{const a=e.target;[...d.branches].some((e=>e.contains(a)))||(s?.(e),l?.(e),e.defaultPrevented||u?.())}),p);return pX((e=>{b===d.layers.size-1&&(i?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))}),p),r.useEffect((()=>{if(m)return t&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(_6=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),G6(),()=>{t&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=_6)}}),[m,p,t,d]),r.useEffect((()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),G6())}),[m,d]),r.useEffect((()=>{const e=()=>g({});return document.addEventListener(D6,e),()=>document.removeEventListener(D6,e)}),[]),n.jsx(uX.div,{...c,ref:v,style:{pointerEvents:S?A?"auto":"none":void 0,...e.style},onFocusCapture:XQ(e.onFocusCapture,C.onFocusCapture),onBlurCapture:XQ(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:XQ(e.onPointerDownCapture,w.onPointerDownCapture)})}));I6.displayName="DismissableLayer";function G6(){const e=new CustomEvent(D6);document.dispatchEvent(e)}function V6(e,a,n,{discrete:t}){const i=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});a&&i.addEventListener(e,a,{once:!0}),t?cX(i,r):i.dispatchEvent(r)}r.forwardRef(((e,a)=>{const t=r.useContext(O6),i=r.useRef(null),o=tO(a,i);return r.useEffect((()=>{const e=i.current;if(e)return t.branches.add(e),()=>{t.branches.delete(e)}}),[t.branches]),n.jsx(uX.div,{...e,ref:o})})).displayName="DismissableLayerBranch";var F6="Popover",[J6,U6]=eX(F6,[k1]),W6=k1(),[q6,Z6]=J6(F6),$6=e=>{const{__scopePopover:a,children:t,open:i,defaultOpen:o,onOpenChange:s,modal:l=!1}=e,u=W6(a),c=r.useRef(null),[d,m]=r.useState(!1),[h=!1,p]=tX({prop:i,defaultProp:o,onChange:s});return n.jsx(R1,{...u,children:n.jsx(q6,{scope:a,contentId:HX(),triggerRef:c,open:h,onOpenChange:p,onOpenToggle:r.useCallback((()=>p((e=>!e))),[p]),hasCustomAnchor:d,onCustomAnchorAdd:r.useCallback((()=>m(!0)),[]),onCustomAnchorRemove:r.useCallback((()=>m(!1)),[]),modal:l,children:t})})};$6.displayName=F6;var Y6="PopoverAnchor";r.forwardRef(((e,a)=>{const{__scopePopover:t,...i}=e,o=Z6(Y6,t),s=W6(t),{onCustomAnchorAdd:l,onCustomAnchorRemove:u}=o;return r.useEffect((()=>(l(),()=>u())),[l,u]),n.jsx(_1,{...s,...i,ref:a})})).displayName=Y6;var Q6="PopoverTrigger",X6=r.forwardRef(((e,a)=>{const{__scopePopover:t,...i}=e,r=Z6(Q6,t),o=W6(t),s=tO(a,r.triggerRef),l=n.jsx(uX.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":c9(r.open),...i,ref:s,onClick:XQ(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?l:n.jsx(_1,{asChild:!0,...o,children:l})}));X6.displayName=Q6;var e9="PopoverPortal",[a9,n9]=J6(e9,{forceMount:void 0}),t9=e=>{const{__scopePopover:a,forceMount:t,children:i,container:r}=e,o=Z6(e9,a);return n.jsx(a9,{scope:a,forceMount:t,children:n.jsx(O1,{present:t||o.open,children:n.jsx(H1,{asChild:!0,container:r,children:i})})})};t9.displayName=e9;var i9="PopoverContent",r9=r.forwardRef(((e,a)=>{const t=n9(i9,e.__scopePopover),{forceMount:i=t.forceMount,...r}=e,o=Z6(i9,e.__scopePopover);return n.jsx(O1,{present:i||o.open,children:n.jsx(o.modal?o9:s9,{...r,ref:a})})}));r9.displayName=i9;var o9=r.forwardRef(((e,a)=>{const t=Z6(i9,e.__scopePopover),i=r.useRef(null),o=tO(a,i),s=r.useRef(!1);return r.useEffect((()=>{const e=i.current;if(e)return JI(e)}),[]),n.jsx(KI,{as:iX,allowPinchZoom:!0,children:n.jsx(l9,{...e,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:XQ(e.onCloseAutoFocus,(e=>{e.preventDefault(),s.current||t.triggerRef.current?.focus()})),onPointerDownOutside:XQ(e.onPointerDownOutside,(e=>{const a=e.detail.originalEvent;s.current=2===a.button||0===a.button&&!0===a.ctrlKey}),{checkForDefaultPrevented:!1}),onFocusOutside:XQ(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})})})})),s9=r.forwardRef(((e,a)=>{const t=Z6(i9,e.__scopePopover),i=r.useRef(!1),o=r.useRef(!1);return n.jsx(l9,{...e,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(i.current||t.triggerRef.current?.focus(),a.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(i.current=!0,"pointerdown"===a.detail.originalEvent.type&&(o.current=!0));const n=a.target,r=t.triggerRef.current?.contains(n);r&&a.preventDefault(),"focusin"===a.detail.originalEvent.type&&o.current&&a.preventDefault()}})})),l9=r.forwardRef(((e,a)=>{const{__scopePopover:t,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:c,onInteractOutside:d,...m}=e,h=Z6(i9,t),p=W6(t);return CX(),n.jsx(EX,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:o,children:n.jsx(I6,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:d,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:n.jsx(D1,{"data-state":c9(h.open),role:"dialog",id:h.contentId,...p,...m,ref:a,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})})),u9="PopoverClose";r.forwardRef(((e,a)=>{const{__scopePopover:t,...i}=e,r=Z6(u9,t);return n.jsx(uX.button,{type:"button",...i,ref:a,onClick:XQ(e.onClick,(()=>r.onOpenChange(!1)))})})).displayName=u9;function c9(e){return e?"open":"closed"}r.forwardRef(((e,a)=>{const{__scopePopover:t,...i}=e,r=W6(t);return n.jsx(K1,{...r,...i,ref:a})})).displayName="PopoverArrow";var d9=t9,m9=r9;const h9=$6,p9=X6,g9=a.forwardRef((({className:e,align:a="center",sideOffset:t=4,...i},r)=>n.jsx(d9,{"data-reach-root":!0,children:n.jsx(m9,{ref:r,align:a,sideOffset:t,className:im("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})})));g9.displayName=m9.displayName;const v9={[Xe.DRAFT]:"Draft",[Xe.ACTIVE]:"Active",[Xe.RUNNING]:"Running",[Xe.COMPLETED]:"Completed",[Xe.FAILED]:"Failed",[Xe.DEACTIVATED]:"Deactivated"},f9={[Xe.DRAFT]:"bg-gray-500",[Xe.ACTIVE]:"bg-blue-500",[Xe.RUNNING]:"bg-yellow-500",[Xe.COMPLETED]:"bg-green-500",[Xe.FAILED]:"bg-red-500",[Xe.DEACTIVATED]:"bg-red-500"},y9={[Xe.DRAFT]:"bg-gray-100 text-gray-700 px-2 py-1",[Xe.ACTIVE]:"bg-blue-100 text-blue-700 px-2 py-1",[Xe.RUNNING]:"bg-yellow-100 text-yellow-700 px-2 py-1",[Xe.COMPLETED]:"bg-green-100 text-green-700 px-2 py-1",[Xe.FAILED]:"bg-red-100 text-red-700 px-2 py-1",[Xe.DEACTIVATED]:"bg-red-100 text-red-700 px-2 py-1"},k9={[Xe.DRAFT]:`Draft ${yh("engage:automation")?.toLowerCase()} can be activated or deactivated`,[Xe.ACTIVE]:`Active ${yh("engage:automation")?.toLowerCase()} can be drafted, deactivated, run, or marked as failed`,[Xe.RUNNING]:`Running ${yh("engage:automation")?.toLowerCase()} can be completed or marked as failed`,[Xe.COMPLETED]:`Completed ${yh("engage:automation")?.toLowerCase()} can only be marked as failed`,[Xe.FAILED]:`Failed ${yh("engage:automation")?.toLowerCase()} requires manual intervention to change state`,[Xe.DEACTIVATED]:`Deactivated ${yh("engage:automation")?.toLowerCase()} cannot be reactivated - create a new one instead`},b9={[Xe.DRAFT]:[Xe.ACTIVE,Xe.DEACTIVATED],[Xe.ACTIVE]:[Xe.DRAFT],[Xe.RUNNING]:[],[Xe.COMPLETED]:[],[Xe.FAILED]:[],[Xe.DEACTIVATED]:[]},S9=({rowOriginal:e,id:t,onToggle:i,className:r="",vsaasManaged:o=!1})=>{const[s,l]=a.useState(!1),u=e.status,c=(b9[u]||[]).filter((e=>!1===o||e!==Xe.DEACTIVATED)),d=c.length>0;return n.jsx("div",{className:`${r}`,onClick:e=>e.stopPropagation(),children:n.jsx(j6,{children:n.jsxs(h9,{open:!!d&&s,onOpenChange:l,children:[n.jsx(p9,{asChild:!0,children:n.jsx("div",{className:"relative",children:n.jsxs(jY,{variant:"outline",className:`flex items-center justify-between px-4 py-2 rounded-md w-full ${y9[u]} ${d?"":"cursor-not-allowed opacity-80"}`,onClick:e=>{e.stopPropagation(),d&&l(!s)},children:[n.jsxs("div",{className:"flex items-center",children:[n.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${f9[u]}`}),n.jsx("span",{children:v9[u]})]}),d?n.jsx(yc,{className:"h-4 w-4 ml-2"}):n.jsxs(L6,{children:[n.jsx(B6,{asChild:!0,children:n.jsx(zc,{className:"h-4 w-4 ml-2 text-gray-500"})}),n.jsx(z6,{className:"max-w-xs p-2",children:n.jsx("p",{children:k9[u]})})]})]})})}),d&&n.jsx(g9,{className:"w-full p-2",align:"center",sideOffset:5,children:n.jsx("div",{className:"py-1 flex flex-col gap-2 justify-start items-center",onClick:e=>e.stopPropagation(),children:c.map((e=>n.jsxs(jY,{variant:"ghost",className:"flex justify-start items-center px-4 py-2 text-sm w-full text-left hover:bg-gray-100 rounded-none "+(u===e?"font-medium":""),onClick:()=>(i(t,e),void l(!1)),children:[n.jsx("div",{className:`w-2 h-2 rounded-full ${f9[e]} mr-2`}),v9[e]]},e)))})})]})})})},{Context:A9,Provider:w9}=hm(((e,a)=>"SET_SELECTED_CHANNELS"===a.type?{...e,selectedChannels:a.payload}:e),{setSelectedChannels:e=>a=>{e({type:"SET_SELECTED_CHANNELS",payload:a})}},{selectedChannels:[]},[]),C9={all:["channel-accounts"]},M9=()=>{const e=ye({queryKey:C9.all,queryFn:()=>(async()=>(await Pe("/channel/accounts",{method:"GET"})).data)()});return{channelAccounts:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelAccounts:e.refetch}};var T9=(e=>(e.REACH_MANAGED="reach-managed",e.TWILLIO="twillio",e))(T9||{});const N9={all:["channel-senders"]},x9=()=>{const e=ye({queryKey:N9.all,queryFn:()=>(async()=>{let e=[],a=null,n=!0;do{const t=a?`${c}?cursor=${encodeURIComponent(a)}`:`${c}`,i=(await Pe(t,{method:"GET"})).data;e=e.concat(i.results),n=i.pagination?.hasNextPage??!1,a=i.pagination?.cursor??null}while(n&&a);return{results:e}})()});return{channelSenders:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelSenders:e.refetch}},E9=()=>{const e=ce(),a=ke({mutationFn:e=>(async(e,a)=>(await Pe(`${c}/${a}`,{method:"PATCH",body:JSON.stringify(e)})).data)(e.toUpdate,e.id),onSuccess:()=>{e.invalidateQueries({queryKey:N9.all})}});return{updateChannelSender:a.mutate,isUpdating:a.isPending,updateError:a.error}},P9={all:["sms-registration-application"]},j9=async()=>(await Pe(`${h}/`)).data,L9=()=>({...ye({queryKey:P9.all,queryFn:j9,...we})}),B9=()=>{const e=ce(),a=ke({mutationFn:e=>(async e=>(await Pe(`${h}/`,{method:"POST",body:JSON.stringify({application:e.application})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:P9.all}),e.invalidateQueries({queryKey:N9.all}),e.invalidateQueries({queryKey:C9.all})}});return{createSmsRegistrationApplication:a.mutate,isCreating:a.isPending,createError:a.error,isCreateSuccess:a.isSuccess}};var z9,R9,_9;(R9=z9||(z9={})).assertEqual=e=>e,R9.assertIs=function(e){},R9.assertNever=function(e){throw new Error},R9.arrayToEnum=e=>{const a={};for(const n of e)a[n]=n;return a},R9.getValidEnumValues=e=>{const a=R9.objectKeys(e).filter((a=>"number"!=typeof e[e[a]])),n={};for(const t of a)n[t]=e[t];return R9.objectValues(n)},R9.objectValues=e=>R9.objectKeys(e).map((function(a){return e[a]})),R9.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const a=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&a.push(n);return a},R9.find=(e,a)=>{for(const n of e)if(a(n))return n},R9.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,R9.joinValues=function(e,a=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(a)},R9.jsonStringifyReplacer=(e,a)=>"bigint"==typeof a?a.toString():a,(_9||(_9={})).mergeShapes=(e,a)=>({...e,...a});const D9=z9.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),K9=e=>{switch(typeof e){case"undefined":return D9.undefined;case"string":return D9.string;case"number":return isNaN(e)?D9.nan:D9.number;case"boolean":return D9.boolean;case"function":return D9.function;case"bigint":return D9.bigint;case"symbol":return D9.symbol;case"object":return Array.isArray(e)?D9.array:null===e?D9.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?D9.promise:"undefined"!=typeof Map&&e instanceof Map?D9.map:"undefined"!=typeof Set&&e instanceof Set?D9.set:"undefined"!=typeof Date&&e instanceof Date?D9.date:D9.object;default:return D9.unknown}},H9=z9.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class O9 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(e){return e.message},n={_errors:[]},t=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(t);else if("invalid_return_type"===i.code)t(i.returnTypeError);else if("invalid_arguments"===i.code)t(i.argumentsError);else if(0===i.path.length)n._errors.push(a(i));else{let e=n,t=0;for(;t<i.path.length;){const n=i.path[t];t===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(a(i))):e[n]=e[n]||{_errors:[]},e=e[n],t++}}};return t(this),n}static assert(e){if(!(e instanceof O9))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,z9.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const a={},n=[];for(const t of this.issues)t.path.length>0?(a[t.path[0]]=a[t.path[0]]||[],a[t.path[0]].push(e(t))):n.push(e(t));return{formErrors:n,fieldErrors:a}}get formErrors(){return this.flatten()}}O9.create=e=>new O9(e);const I9=(e,a)=>{let n;switch(e.code){case H9.invalid_type:n=e.received===D9.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case H9.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,z9.jsonStringifyReplacer)}`;break;case H9.unrecognized_keys:n=`Unrecognized key(s) in object: ${z9.joinValues(e.keys,", ")}`;break;case H9.invalid_union:n="Invalid input";break;case H9.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${z9.joinValues(e.options)}`;break;case H9.invalid_enum_value:n=`Invalid enum value. Expected ${z9.joinValues(e.options)}, received '${e.received}'`;break;case H9.invalid_arguments:n="Invalid function arguments";break;case H9.invalid_return_type:n="Invalid function return type";break;case H9.invalid_date:n="Invalid date";break;case H9.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:z9.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case H9.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case H9.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case H9.custom:n="Invalid input";break;case H9.invalid_intersection_types:n="Intersection results could not be merged";break;case H9.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case H9.not_finite:n="Number must be finite";break;default:n=a.defaultError,z9.assertNever(e)}return{message:n}};let G9=I9;function V9(){return G9}const F9=e=>{const{data:a,path:n,errorMaps:t,issueData:i}=e,r=[...n,...i.path||[]],o={...i,path:r};if(void 0!==i.message)return{...i,path:r,message:i.message};let s="";const l=t.filter((e=>!!e)).slice().reverse();for(const u of l)s=u(o,{data:a,defaultError:s}).message;return{...i,path:r,message:s}};function J9(e,a){const n=V9(),t=F9({issueData:a,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===I9?void 0:I9].filter((e=>!!e))});e.common.issues.push(t)}class U9{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,a){const n=[];for(const t of a){if("aborted"===t.status)return W9;"dirty"===t.status&&e.dirty(),n.push(t.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,a){const n=[];for(const t of a){const e=await t.key,a=await t.value;n.push({key:e,value:a})}return U9.mergeObjectSync(e,n)}static mergeObjectSync(e,a){const n={};for(const t of a){const{key:a,value:i}=t;if("aborted"===a.status)return W9;if("aborted"===i.status)return W9;"dirty"===a.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===a.value||void 0===i.value&&!t.alwaysSet||(n[a.value]=i.value)}return{status:e.value,value:n}}}const W9=Object.freeze({status:"aborted"}),q9=e=>({status:"dirty",value:e}),Z9=e=>({status:"valid",value:e}),$9=e=>"aborted"===e.status,Y9=e=>"dirty"===e.status,Q9=e=>"valid"===e.status,X9=e=>"undefined"!=typeof Promise&&e instanceof Promise;function e8(e,a,n,t){if("function"==typeof a||!a.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a.get(e)}function a8(e,a,n,t,i){if("function"==typeof a||!a.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a.set(e,n),n}var n8,t8,i8,r8;"function"==typeof SuppressedError&&SuppressedError,(t8=n8||(n8={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},t8.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class o8{constructor(e,a,n,t){this._cachedPath=[],this.parent=e,this.data=a,this._path=n,this._key=t}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const s8=(e,a)=>{if(Q9(a))return{success:!0,data:a.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new O9(e.common.issues);return this._error=a,this._error}}};function l8(e){if(!e)return{};const{errorMap:a,invalid_type_error:n,required_error:t,description:i}=e;if(a&&(n||t))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(a)return{errorMap:a,description:i};return{errorMap:(a,i)=>{var r,o;const{message:s}=e;return"invalid_enum_value"===a.code?{message:null!=s?s:i.defaultError}:void 0===i.data?{message:null!==(r=null!=s?s:t)&&void 0!==r?r:i.defaultError}:"invalid_type"!==a.code?{message:i.defaultError}:{message:null!==(o=null!=s?s:n)&&void 0!==o?o:i.defaultError}},description:i}}class u8{get description(){return this._def.description}_getType(e){return K9(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:K9(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new U9,ctx:{common:e.parent.common,data:e.data,parsedType:K9(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(X9(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const n=this.safeParse(e,a);if(n.success)return n.data;throw n.error}safeParse(e,a){var n;const t={common:{issues:[],async:null!==(n=null==a?void 0:a.async)&&void 0!==n&&n,contextualErrorMap:null==a?void 0:a.errorMap},path:(null==a?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K9(e)},i=this._parseSync({data:e,path:t.path,parent:t});return s8(t,i)}"~validate"(e){var a,n;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K9(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Q9(a)?{value:a.value}:{issues:t.common.issues}}catch(cBe){(null===(n=null===(a=null==cBe?void 0:cBe.message)||void 0===a?void 0:a.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>Q9(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,a){const n=await this.safeParseAsync(e,a);if(n.success)return n.data;throw n.error}async safeParseAsync(e,a){const n={common:{issues:[],contextualErrorMap:null==a?void 0:a.errorMap,async:!0},path:(null==a?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K9(e)},t=this._parse({data:e,path:n.path,parent:n}),i=await(X9(t)?t:Promise.resolve(t));return s8(n,i)}refine(e,a){const n=e=>"string"==typeof a||void 0===a?{message:a}:"function"==typeof a?a(e):a;return this._refinement(((a,t)=>{const i=e(a),r=()=>t.addIssue({code:H9.custom,...n(a)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(r(),!1))):!!i||(r(),!1)}))}refinement(e,a){return this._refinement(((n,t)=>!!e(n)||(t.addIssue("function"==typeof a?a(n,t):a),!1)))}_refinement(e){return new u7({schema:this,typeName:A7.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return c7.create(this,this._def)}nullable(){return d7.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F8.create(this)}promise(){return l7.create(this,this._def)}or(e){return W8.create([this,e],this._def)}and(e){return Y8.create(this,e,this._def)}transform(e){return new u7({...l8(this._def),schema:this,typeName:A7.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a="function"==typeof e?e:()=>e;return new m7({...l8(this._def),innerType:this,defaultValue:a,typeName:A7.ZodDefault})}brand(){return new v7({typeName:A7.ZodBranded,type:this,...l8(this._def)})}catch(e){const a="function"==typeof e?e:()=>e;return new h7({...l8(this._def),innerType:this,catchValue:a,typeName:A7.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return f7.create(this,e)}readonly(){return y7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const c8=/^c[^\s-]{8,}$/i,d8=/^[0-9a-z]+$/,m8=/^[0-9A-HJKMNP-TV-Z]{26}$/i,h8=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,p8=/^[a-z0-9_-]{21}$/i,g8=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,v8=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,f8=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let y8;const k8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,b8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,S8=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,A8=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,w8=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,C8=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,M8="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",T8=new RegExp(`^${M8}$`);function N8(e){let a="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?a=`${a}\\.\\d{${e.precision}}`:null==e.precision&&(a=`${a}(\\.\\d+)?`),a}function x8(e){let a=`${M8}T${N8(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${n.join("|")})`,new RegExp(`^${a}$`)}function E8(e,a){if(!g8.test(e))return!1;try{const[n]=e.split("."),t=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(t));return"object"==typeof i&&null!==i&&(!(!i.typ||!i.alg)&&(!a||i.alg===a))}catch(dBe){return!1}}function P8(e,a){return!("v4"!==a&&a||!b8.test(e))||!("v6"!==a&&a||!A8.test(e))}class j8 extends u8{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==D9.string){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.string,received:a.parsedType}),W9}const a=new U9;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),a.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),a.dirty());else if("length"===r.kind){const t=e.data.length>r.value,i=e.data.length<r.value;(t||i)&&(n=this._getOrReturnCtx(e,n),t?J9(n,{code:H9.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):i&&J9(n,{code:H9.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),a.dirty())}else if("email"===r.kind)f8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"email",code:H9.invalid_string,message:r.message}),a.dirty());else if("emoji"===r.kind)y8||(y8=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),y8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"emoji",code:H9.invalid_string,message:r.message}),a.dirty());else if("uuid"===r.kind)h8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"uuid",code:H9.invalid_string,message:r.message}),a.dirty());else if("nanoid"===r.kind)p8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"nanoid",code:H9.invalid_string,message:r.message}),a.dirty());else if("cuid"===r.kind)c8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"cuid",code:H9.invalid_string,message:r.message}),a.dirty());else if("cuid2"===r.kind)d8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"cuid2",code:H9.invalid_string,message:r.message}),a.dirty());else if("ulid"===r.kind)m8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"ulid",code:H9.invalid_string,message:r.message}),a.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(dBe){n=this._getOrReturnCtx(e,n),J9(n,{validation:"url",code:H9.invalid_string,message:r.message}),a.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"regex",code:H9.invalid_string,message:r.message}),a.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),a.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:{startsWith:r.value},message:r.message}),a.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:{endsWith:r.value},message:r.message}),a.dirty());else if("datetime"===r.kind){x8(r).test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:"datetime",message:r.message}),a.dirty())}else if("date"===r.kind){T8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:"date",message:r.message}),a.dirty())}else if("time"===r.kind){new RegExp(`^${N8(r)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.invalid_string,validation:"time",message:r.message}),a.dirty())}else"duration"===r.kind?v8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"duration",code:H9.invalid_string,message:r.message}),a.dirty()):"ip"===r.kind?(t=e.data,("v4"!==(i=r.version)&&i||!k8.test(t))&&("v6"!==i&&i||!S8.test(t))&&(n=this._getOrReturnCtx(e,n),J9(n,{validation:"ip",code:H9.invalid_string,message:r.message}),a.dirty())):"jwt"===r.kind?E8(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"jwt",code:H9.invalid_string,message:r.message}),a.dirty()):"cidr"===r.kind?P8(e.data,r.version)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"cidr",code:H9.invalid_string,message:r.message}),a.dirty()):"base64"===r.kind?w8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"base64",code:H9.invalid_string,message:r.message}),a.dirty()):"base64url"===r.kind?C8.test(e.data)||(n=this._getOrReturnCtx(e,n),J9(n,{validation:"base64url",code:H9.invalid_string,message:r.message}),a.dirty()):z9.assertNever(r);var t,i;return{status:a.value,value:e.data}}_regex(e,a,n){return this.refinement((a=>e.test(a)),{validation:a,code:H9.invalid_string,...n8.errToObj(n)})}_addCheck(e){return new j8({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...n8.errToObj(e)})}url(e){return this._addCheck({kind:"url",...n8.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...n8.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...n8.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...n8.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...n8.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...n8.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...n8.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...n8.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...n8.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...n8.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...n8.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...n8.errToObj(e)})}datetime(e){var a,n;return this._addCheck("string"==typeof e?{kind:"datetime",precision:null,offset:!1,local:!1,message:e}:{kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(a=null==e?void 0:e.offset)&&void 0!==a&&a,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...n8.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return this._addCheck("string"==typeof e?{kind:"time",precision:null,message:e}:{kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...n8.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...n8.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...n8.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:null==a?void 0:a.position,...n8.errToObj(null==a?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...n8.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...n8.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...n8.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...n8.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...n8.errToObj(a)})}nonempty(e){return this.min(1,n8.errToObj(e))}trim(){return new j8({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new j8({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new j8({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const a of this._def.checks)"min"===a.kind&&(null===e||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)"max"===a.kind&&(null===e||a.value<e)&&(e=a.value);return e}}function L8(e,a){const n=(e.toString().split(".")[1]||"").length,t=(a.toString().split(".")[1]||"").length,i=n>t?n:t;return parseInt(e.toFixed(i).replace(".",""))%parseInt(a.toFixed(i).replace(".",""))/Math.pow(10,i)}j8.create=e=>{var a;return new j8({checks:[],typeName:A7.ZodString,coerce:null!==(a=null==e?void 0:e.coerce)&&void 0!==a&&a,...l8(e)})};class B8 extends u8{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==D9.number){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.number,received:a.parsedType}),W9}let a;const n=new U9;for(const t of this._def.checks)if("int"===t.kind)z9.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.invalid_type,expected:"integer",received:"float",message:t.message}),n.dirty());else if("min"===t.kind){(t.inclusive?e.data<t.value:e.data<=t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.too_small,minimum:t.value,type:"number",inclusive:t.inclusive,exact:!1,message:t.message}),n.dirty())}else if("max"===t.kind){(t.inclusive?e.data>t.value:e.data>=t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.too_big,maximum:t.value,type:"number",inclusive:t.inclusive,exact:!1,message:t.message}),n.dirty())}else"multipleOf"===t.kind?0!==L8(e.data,t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.not_multiple_of,multipleOf:t.value,message:t.message}),n.dirty()):"finite"===t.kind?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.not_finite,message:t.message}),n.dirty()):z9.assertNever(t);return{status:n.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,n8.toString(a))}gt(e,a){return this.setLimit("min",e,!1,n8.toString(a))}lte(e,a){return this.setLimit("max",e,!0,n8.toString(a))}lt(e,a){return this.setLimit("max",e,!1,n8.toString(a))}setLimit(e,a,n,t){return new B8({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:n,message:n8.toString(t)}]})}_addCheck(e){return new B8({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:n8.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:n8.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:n8.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:n8.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:n8.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:n8.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:n8.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:n8.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:n8.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)"min"===a.kind&&(null===e||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)"max"===a.kind&&(null===e||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&z9.isInteger(e.value)))}get isFinite(){let e=null,a=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===a||n.value>a)&&(a=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(a)&&Number.isFinite(e)}}B8.create=e=>new B8({checks:[],typeName:A7.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...l8(e)});class z8 extends u8{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(dBe){return this._getInvalidInput(e)}if(this._getType(e)!==D9.bigint)return this._getInvalidInput(e);let a;const n=new U9;for(const t of this._def.checks)if("min"===t.kind){(t.inclusive?e.data<t.value:e.data<=t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.too_small,type:"bigint",minimum:t.value,inclusive:t.inclusive,message:t.message}),n.dirty())}else if("max"===t.kind){(t.inclusive?e.data>t.value:e.data>=t.value)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.too_big,type:"bigint",maximum:t.value,inclusive:t.inclusive,message:t.message}),n.dirty())}else"multipleOf"===t.kind?e.data%t.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),J9(a,{code:H9.not_multiple_of,multipleOf:t.value,message:t.message}),n.dirty()):z9.assertNever(t);return{status:n.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.bigint,received:a.parsedType}),W9}gte(e,a){return this.setLimit("min",e,!0,n8.toString(a))}gt(e,a){return this.setLimit("min",e,!1,n8.toString(a))}lte(e,a){return this.setLimit("max",e,!0,n8.toString(a))}lt(e,a){return this.setLimit("max",e,!1,n8.toString(a))}setLimit(e,a,n,t){return new z8({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:n,message:n8.toString(t)}]})}_addCheck(e){return new z8({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:n8.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:n8.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:n8.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:n8.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:n8.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)"min"===a.kind&&(null===e||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)"max"===a.kind&&(null===e||a.value<e)&&(e=a.value);return e}}z8.create=e=>{var a;return new z8({checks:[],typeName:A7.ZodBigInt,coerce:null!==(a=null==e?void 0:e.coerce)&&void 0!==a&&a,...l8(e)})};class R8 extends u8{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==D9.boolean){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.boolean,received:a.parsedType}),W9}return Z9(e.data)}}R8.create=e=>new R8({typeName:A7.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...l8(e)});class _8 extends u8{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==D9.date){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.date,received:a.parsedType}),W9}if(isNaN(e.data.getTime())){return J9(this._getOrReturnCtx(e),{code:H9.invalid_date}),W9}const a=new U9;let n;for(const t of this._def.checks)"min"===t.kind?e.data.getTime()<t.value&&(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.too_small,message:t.message,inclusive:!0,exact:!1,minimum:t.value,type:"date"}),a.dirty()):"max"===t.kind?e.data.getTime()>t.value&&(n=this._getOrReturnCtx(e,n),J9(n,{code:H9.too_big,message:t.message,inclusive:!0,exact:!1,maximum:t.value,type:"date"}),a.dirty()):z9.assertNever(t);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new _8({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:n8.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:n8.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)"min"===a.kind&&(null===e||a.value>e)&&(e=a.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)"max"===a.kind&&(null===e||a.value<e)&&(e=a.value);return null!=e?new Date(e):null}}_8.create=e=>new _8({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:A7.ZodDate,...l8(e)});class D8 extends u8{_parse(e){if(this._getType(e)!==D9.symbol){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.symbol,received:a.parsedType}),W9}return Z9(e.data)}}D8.create=e=>new D8({typeName:A7.ZodSymbol,...l8(e)});class K8 extends u8{_parse(e){if(this._getType(e)!==D9.undefined){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.undefined,received:a.parsedType}),W9}return Z9(e.data)}}K8.create=e=>new K8({typeName:A7.ZodUndefined,...l8(e)});class H8 extends u8{_parse(e){if(this._getType(e)!==D9.null){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.null,received:a.parsedType}),W9}return Z9(e.data)}}H8.create=e=>new H8({typeName:A7.ZodNull,...l8(e)});class O8 extends u8{constructor(){super(...arguments),this._any=!0}_parse(e){return Z9(e.data)}}O8.create=e=>new O8({typeName:A7.ZodAny,...l8(e)});class I8 extends u8{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z9(e.data)}}I8.create=e=>new I8({typeName:A7.ZodUnknown,...l8(e)});class G8 extends u8{_parse(e){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.never,received:a.parsedType}),W9}}G8.create=e=>new G8({typeName:A7.ZodNever,...l8(e)});class V8 extends u8{_parse(e){if(this._getType(e)!==D9.undefined){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.void,received:a.parsedType}),W9}return Z9(e.data)}}V8.create=e=>new V8({typeName:A7.ZodVoid,...l8(e)});class F8 extends u8{_parse(e){const{ctx:a,status:n}=this._processInputParams(e),t=this._def;if(a.parsedType!==D9.array)return J9(a,{code:H9.invalid_type,expected:D9.array,received:a.parsedType}),W9;if(null!==t.exactLength){const e=a.data.length>t.exactLength.value,i=a.data.length<t.exactLength.value;(e||i)&&(J9(a,{code:e?H9.too_big:H9.too_small,minimum:i?t.exactLength.value:void 0,maximum:e?t.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:t.exactLength.message}),n.dirty())}if(null!==t.minLength&&a.data.length<t.minLength.value&&(J9(a,{code:H9.too_small,minimum:t.minLength.value,type:"array",inclusive:!0,exact:!1,message:t.minLength.message}),n.dirty()),null!==t.maxLength&&a.data.length>t.maxLength.value&&(J9(a,{code:H9.too_big,maximum:t.maxLength.value,type:"array",inclusive:!0,exact:!1,message:t.maxLength.message}),n.dirty()),a.common.async)return Promise.all([...a.data].map(((e,n)=>t.type._parseAsync(new o8(a,e,a.path,n))))).then((e=>U9.mergeArray(n,e)));const i=[...a.data].map(((e,n)=>t.type._parseSync(new o8(a,e,a.path,n))));return U9.mergeArray(n,i)}get element(){return this._def.type}min(e,a){return new F8({...this._def,minLength:{value:e,message:n8.toString(a)}})}max(e,a){return new F8({...this._def,maxLength:{value:e,message:n8.toString(a)}})}length(e,a){return new F8({...this._def,exactLength:{value:e,message:n8.toString(a)}})}nonempty(e){return this.min(1,e)}}function J8(e){if(e instanceof U8){const a={};for(const n in e.shape){a[n]=c7.create(J8(e.shape[n]))}return new U8({...e._def,shape:()=>a})}return e instanceof F8?new F8({...e._def,type:J8(e.element)}):e instanceof c7?c7.create(J8(e.unwrap())):e instanceof d7?d7.create(J8(e.unwrap())):e instanceof Q8?Q8.create(e.items.map((e=>J8(e)))):e}F8.create=(e,a)=>new F8({type:e,minLength:null,maxLength:null,exactLength:null,typeName:A7.ZodArray,...l8(a)});class U8 extends u8{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),a=z9.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==D9.object){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.object,received:a.parsedType}),W9}const{status:a,ctx:n}=this._processInputParams(e),{shape:t,keys:i}=this._getCached(),r=[];if(!(this._def.catchall instanceof G8&&"strip"===this._def.unknownKeys))for(const s in n.data)i.includes(s)||r.push(s);const o=[];for(const s of i){o.push({key:{status:"valid",value:s},value:t[s]._parse(new o8(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof G8){const e=this._def.unknownKeys;if("passthrough"===e)for(const a of r)o.push({key:{status:"valid",value:a},value:{status:"valid",value:n.data[a]}});else if("strict"===e)r.length>0&&(J9(n,{code:H9.unrecognized_keys,keys:r}),a.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const a of r){o.push({key:{status:"valid",value:a},value:e._parse(new o8(n,n.data[a],n.path,a)),alwaysSet:a in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const a of o){const n=await a.key,t=await a.value;e.push({key:n,value:t,alwaysSet:a.alwaysSet})}return e})).then((e=>U9.mergeObjectSync(a,e))):U9.mergeObjectSync(a,o)}get shape(){return this._def.shape()}strict(e){return new U8({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(a,n)=>{var t,i,r,o;const s=null!==(r=null===(i=(t=this._def).errorMap)||void 0===i?void 0:i.call(t,a,n).message)&&void 0!==r?r:n.defaultError;return"unrecognized_keys"===a.code?{message:null!==(o=n8.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new U8({...this._def,unknownKeys:"strip"})}passthrough(){return new U8({...this._def,unknownKeys:"passthrough"})}extend(e){return new U8({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new U8({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A7.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new U8({...this._def,catchall:e})}pick(e){const a={};return z9.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(a[n]=this.shape[n])})),new U8({...this._def,shape:()=>a})}omit(e){const a={};return z9.objectKeys(this.shape).forEach((n=>{e[n]||(a[n]=this.shape[n])})),new U8({...this._def,shape:()=>a})}deepPartial(){return J8(this)}partial(e){const a={};return z9.objectKeys(this.shape).forEach((n=>{const t=this.shape[n];a[n]=e&&!e[n]?t:t.optional()})),new U8({...this._def,shape:()=>a})}required(e){const a={};return z9.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])a[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof c7;)e=e._def.innerType;a[n]=e}})),new U8({...this._def,shape:()=>a})}keyof(){return r7(z9.objectKeys(this.shape))}}U8.create=(e,a)=>new U8({shape:()=>e,unknownKeys:"strip",catchall:G8.create(),typeName:A7.ZodObject,...l8(a)}),U8.strictCreate=(e,a)=>new U8({shape:()=>e,unknownKeys:"strict",catchall:G8.create(),typeName:A7.ZodObject,...l8(a)}),U8.lazycreate=(e,a)=>new U8({shape:e,unknownKeys:"strip",catchall:G8.create(),typeName:A7.ZodObject,...l8(a)});class W8 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e),n=this._def.options;if(a.common.async)return Promise.all(n.map((async e=>{const n={...a,common:{...a.common,issues:[]},parent:null};return{result:await e._parseAsync({data:a.data,path:a.path,parent:n}),ctx:n}}))).then((function(e){for(const a of e)if("valid"===a.result.status)return a.result;for(const t of e)if("dirty"===t.result.status)return a.common.issues.push(...t.ctx.common.issues),t.result;const n=e.map((e=>new O9(e.ctx.common.issues)));return J9(a,{code:H9.invalid_union,unionErrors:n}),W9}));{let e;const t=[];for(const r of n){const n={...a,common:{...a.common,issues:[]},parent:null},i=r._parseSync({data:a.data,path:a.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&t.push(n.common.issues)}if(e)return a.common.issues.push(...e.ctx.common.issues),e.result;const i=t.map((e=>new O9(e)));return J9(a,{code:H9.invalid_union,unionErrors:i}),W9}}get options(){return this._def.options}}W8.create=(e,a)=>new W8({options:e,typeName:A7.ZodUnion,...l8(a)});const q8=e=>e instanceof t7?q8(e.schema):e instanceof u7?q8(e.innerType()):e instanceof i7?[e.value]:e instanceof o7?e.options:e instanceof s7?z9.objectValues(e.enum):e instanceof m7?q8(e._def.innerType):e instanceof K8?[void 0]:e instanceof H8?[null]:e instanceof c7?[void 0,...q8(e.unwrap())]:e instanceof d7?[null,...q8(e.unwrap())]:e instanceof v7||e instanceof y7?q8(e.unwrap()):e instanceof h7?q8(e._def.innerType):[];class Z8 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==D9.object)return J9(a,{code:H9.invalid_type,expected:D9.object,received:a.parsedType}),W9;const n=this.discriminator,t=this.optionsMap.get(a.data[n]);return t?a.common.async?t._parseAsync({data:a.data,path:a.path,parent:a}):t._parseSync({data:a.data,path:a.path,parent:a}):(J9(a,{code:H9.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),W9)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,n){const t=new Map;for(const i of a){const a=q8(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of a){if(t.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);t.set(n,i)}}return new Z8({typeName:A7.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:t,...l8(n)})}}function $8(e,a){const n=K9(e),t=K9(a);if(e===a)return{valid:!0,data:e};if(n===D9.object&&t===D9.object){const n=z9.objectKeys(a),t=z9.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...a};for(const r of t){const n=$8(e[r],a[r]);if(!n.valid)return{valid:!1};i[r]=n.data}return{valid:!0,data:i}}if(n===D9.array&&t===D9.array){if(e.length!==a.length)return{valid:!1};const n=[];for(let t=0;t<e.length;t++){const i=$8(e[t],a[t]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===D9.date&&t===D9.date&&+e==+a?{valid:!0,data:e}:{valid:!1}}class Y8 extends u8{_parse(e){const{status:a,ctx:n}=this._processInputParams(e),t=(e,t)=>{if($9(e)||$9(t))return W9;const i=$8(e.value,t.value);return i.valid?((Y9(e)||Y9(t))&&a.dirty(),{status:a.value,value:i.data}):(J9(n,{code:H9.invalid_intersection_types}),W9)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,a])=>t(e,a))):t(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Y8.create=(e,a,n)=>new Y8({left:e,right:a,typeName:A7.ZodIntersection,...l8(n)});class Q8 extends u8{_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.parsedType!==D9.array)return J9(n,{code:H9.invalid_type,expected:D9.array,received:n.parsedType}),W9;if(n.data.length<this._def.items.length)return J9(n,{code:H9.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W9;!this._def.rest&&n.data.length>this._def.items.length&&(J9(n,{code:H9.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const t=[...n.data].map(((e,a)=>{const t=this._def.items[a]||this._def.rest;return t?t._parse(new o8(n,e,n.path,a)):null})).filter((e=>!!e));return n.common.async?Promise.all(t).then((e=>U9.mergeArray(a,e))):U9.mergeArray(a,t)}get items(){return this._def.items}rest(e){return new Q8({...this._def,rest:e})}}Q8.create=(e,a)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Q8({items:e,typeName:A7.ZodTuple,rest:null,...l8(a)})};class X8 extends u8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.parsedType!==D9.object)return J9(n,{code:H9.invalid_type,expected:D9.object,received:n.parsedType}),W9;const t=[],i=this._def.keyType,r=this._def.valueType;for(const o in n.data)t.push({key:i._parse(new o8(n,o,n.path,o)),value:r._parse(new o8(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?U9.mergeObjectAsync(a,t):U9.mergeObjectSync(a,t)}get element(){return this._def.valueType}static create(e,a,n){return new X8(a instanceof u8?{keyType:e,valueType:a,typeName:A7.ZodRecord,...l8(n)}:{keyType:j8.create(),valueType:e,typeName:A7.ZodRecord,...l8(a)})}}class e7 extends u8{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.parsedType!==D9.map)return J9(n,{code:H9.invalid_type,expected:D9.map,received:n.parsedType}),W9;const t=this._def.keyType,i=this._def.valueType,r=[...n.data.entries()].map((([e,a],r)=>({key:t._parse(new o8(n,e,n.path,[r,"key"])),value:i._parse(new o8(n,a,n.path,[r,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of r){const t=await n.key,i=await n.value;if("aborted"===t.status||"aborted"===i.status)return W9;"dirty"!==t.status&&"dirty"!==i.status||a.dirty(),e.set(t.value,i.value)}return{status:a.value,value:e}}))}{const e=new Map;for(const n of r){const t=n.key,i=n.value;if("aborted"===t.status||"aborted"===i.status)return W9;"dirty"!==t.status&&"dirty"!==i.status||a.dirty(),e.set(t.value,i.value)}return{status:a.value,value:e}}}}e7.create=(e,a,n)=>new e7({valueType:a,keyType:e,typeName:A7.ZodMap,...l8(n)});class a7 extends u8{_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.parsedType!==D9.set)return J9(n,{code:H9.invalid_type,expected:D9.set,received:n.parsedType}),W9;const t=this._def;null!==t.minSize&&n.data.size<t.minSize.value&&(J9(n,{code:H9.too_small,minimum:t.minSize.value,type:"set",inclusive:!0,exact:!1,message:t.minSize.message}),a.dirty()),null!==t.maxSize&&n.data.size>t.maxSize.value&&(J9(n,{code:H9.too_big,maximum:t.maxSize.value,type:"set",inclusive:!0,exact:!1,message:t.maxSize.message}),a.dirty());const i=this._def.valueType;function r(e){const n=new Set;for(const t of e){if("aborted"===t.status)return W9;"dirty"===t.status&&a.dirty(),n.add(t.value)}return{status:a.value,value:n}}const o=[...n.data.values()].map(((e,a)=>i._parse(new o8(n,e,n.path,a))));return n.common.async?Promise.all(o).then((e=>r(e))):r(o)}min(e,a){return new a7({...this._def,minSize:{value:e,message:n8.toString(a)}})}max(e,a){return new a7({...this._def,maxSize:{value:e,message:n8.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}a7.create=(e,a)=>new a7({valueType:e,minSize:null,maxSize:null,typeName:A7.ZodSet,...l8(a)});class n7 extends u8{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==D9.function)return J9(a,{code:H9.invalid_type,expected:D9.function,received:a.parsedType}),W9;function n(e,n){return F9({data:e,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,V9(),I9].filter((e=>!!e)),issueData:{code:H9.invalid_arguments,argumentsError:n}})}function t(e,n){return F9({data:e,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,V9(),I9].filter((e=>!!e)),issueData:{code:H9.invalid_return_type,returnTypeError:n}})}const i={errorMap:a.common.contextualErrorMap},r=a.data;if(this._def.returns instanceof l7){const e=this;return Z9((async function(...a){const o=new O9([]),s=await e._def.args.parseAsync(a,i).catch((e=>{throw o.addIssue(n(a,e)),o})),l=await Reflect.apply(r,this,s);return await e._def.returns._def.type.parseAsync(l,i).catch((e=>{throw o.addIssue(t(l,e)),o}))}))}{const e=this;return Z9((function(...a){const o=e._def.args.safeParse(a,i);if(!o.success)throw new O9([n(a,o.error)]);const s=Reflect.apply(r,this,o.data),l=e._def.returns.safeParse(s,i);if(!l.success)throw new O9([t(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n7({...this._def,args:Q8.create(e).rest(I8.create())})}returns(e){return new n7({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,n){return new n7({args:e||Q8.create([]).rest(I8.create()),returns:a||I8.create(),typeName:A7.ZodFunction,...l8(n)})}}class t7 extends u8{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}t7.create=(e,a)=>new t7({getter:e,typeName:A7.ZodLazy,...l8(a)});class i7 extends u8{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return J9(a,{received:a.data,code:H9.invalid_literal,expected:this._def.value}),W9}return{status:"valid",value:e.data}}get value(){return this._def.value}}function r7(e,a){return new o7({values:e,typeName:A7.ZodEnum,...l8(a)})}i7.create=(e,a)=>new i7({value:e,typeName:A7.ZodLiteral,...l8(a)});class o7 extends u8{constructor(){super(...arguments),i8.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const a=this._getOrReturnCtx(e);return J9(a,{expected:z9.joinValues(this._def.values),received:a.parsedType,code:H9.invalid_type}),W9}if(e8(this,i8)||a8(this,i8,new Set(this._def.values)),!e8(this,i8).has(e.data)){const a=this._getOrReturnCtx(e);return J9(a,{received:a.data,code:H9.invalid_enum_value,options:this._def.values}),W9}return Z9(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return o7.create(e,{...this._def,...a})}exclude(e,a=this._def){return o7.create(this.options.filter((a=>!e.includes(a))),{...this._def,...a})}}i8=new WeakMap,o7.create=r7;class s7 extends u8{constructor(){super(...arguments),r8.set(this,void 0)}_parse(e){const a=z9.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==D9.string&&n.parsedType!==D9.number){const e=z9.objectValues(a);return J9(n,{expected:z9.joinValues(e),received:n.parsedType,code:H9.invalid_type}),W9}if(e8(this,r8)||a8(this,r8,new Set(z9.getValidEnumValues(this._def.values))),!e8(this,r8).has(e.data)){const e=z9.objectValues(a);return J9(n,{received:n.data,code:H9.invalid_enum_value,options:e}),W9}return Z9(e.data)}get enum(){return this._def.values}}r8=new WeakMap,s7.create=(e,a)=>new s7({values:e,typeName:A7.ZodNativeEnum,...l8(a)});class l7 extends u8{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==D9.promise&&!1===a.common.async)return J9(a,{code:H9.invalid_type,expected:D9.promise,received:a.parsedType}),W9;const n=a.parsedType===D9.promise?a.data:Promise.resolve(a.data);return Z9(n.then((e=>this._def.type.parseAsync(e,{path:a.path,errorMap:a.common.contextualErrorMap}))))}}l7.create=(e,a)=>new l7({type:e,typeName:A7.ZodPromise,...l8(a)});class u7 extends u8{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A7.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:n}=this._processInputParams(e),t=this._def.effect||null,i={addIssue:e=>{J9(n,e),e.fatal?a.abort():a.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===t.type){const e=t.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===a.value)return W9;const t=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===t.status?W9:"dirty"===t.status||"dirty"===a.value?q9(t.value):t}));{if("aborted"===a.value)return W9;const t=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===t.status?W9:"dirty"===t.status||"dirty"===a.value?q9(t.value):t}}if("refinement"===t.type){const e=e=>{const a=t.refinement(e,i);if(n.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const t=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===t.status?W9:("dirty"===t.status&&a.dirty(),e(t.value),{status:a.value,value:t.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?W9:("dirty"===n.status&&a.dirty(),e(n.value).then((()=>({status:a.value,value:n.value}))))))}if("transform"===t.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Q9(e))return e;const r=t.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:r}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Q9(e)?Promise.resolve(t.transform(e.value,i)).then((e=>({status:a.value,value:e}))):e))}z9.assertNever(t)}}u7.create=(e,a,n)=>new u7({schema:e,typeName:A7.ZodEffects,effect:a,...l8(n)}),u7.createWithPreprocess=(e,a,n)=>new u7({schema:a,effect:{type:"preprocess",transform:e},typeName:A7.ZodEffects,...l8(n)});class c7 extends u8{_parse(e){return this._getType(e)===D9.undefined?Z9(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}c7.create=(e,a)=>new c7({innerType:e,typeName:A7.ZodOptional,...l8(a)});class d7 extends u8{_parse(e){return this._getType(e)===D9.null?Z9(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}d7.create=(e,a)=>new d7({innerType:e,typeName:A7.ZodNullable,...l8(a)});class m7 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e);let n=a.data;return a.parsedType===D9.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}m7.create=(e,a)=>new m7({innerType:e,typeName:A7.ZodDefault,defaultValue:"function"==typeof a.default?a.default:()=>a.default,...l8(a)});class h7 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e),n={...a,common:{...a.common,issues:[]}},t=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return X9(t)?t.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new O9(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===t.status?t.value:this._def.catchValue({get error(){return new O9(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}h7.create=(e,a)=>new h7({innerType:e,typeName:A7.ZodCatch,catchValue:"function"==typeof a.catch?a.catch:()=>a.catch,...l8(a)});class p7 extends u8{_parse(e){if(this._getType(e)!==D9.nan){const a=this._getOrReturnCtx(e);return J9(a,{code:H9.invalid_type,expected:D9.nan,received:a.parsedType}),W9}return{status:"valid",value:e.data}}}p7.create=e=>new p7({typeName:A7.ZodNaN,...l8(e)});const g7=Symbol("zod_brand");class v7 extends u8{_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.type._parse({data:a.data,path:a.path,parent:a})}unwrap(){return this._def.type}}class f7 extends u8{_parse(e){const{status:a,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?W9:"dirty"===e.status?(a.dirty(),q9(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?W9:"dirty"===e.status?(a.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,a){return new f7({in:e,out:a,typeName:A7.ZodPipeline})}}class y7 extends u8{_parse(e){const a=this._def.innerType._parse(e),n=e=>(Q9(e)&&(e.value=Object.freeze(e.value)),e);return X9(a)?a.then((e=>n(e))):n(a)}unwrap(){return this._def.innerType}}function k7(e,a){const n="function"==typeof e?e(a):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function b7(e,a={},n){return e?O8.create().superRefine(((t,i)=>{var r,o;const s=e(t);if(s instanceof Promise)return s.then((e=>{var r,o;if(!e){const e=k7(a,t),s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o;i.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=k7(a,t),s=null===(o=null!==(r=e.fatal)&&void 0!==r?r:n)||void 0===o||o;i.addIssue({code:"custom",...e,fatal:s})}})):O8.create()}y7.create=(e,a)=>new y7({innerType:e,typeName:A7.ZodReadonly,...l8(a)});const S7={object:U8.lazycreate};var A7,w7;(w7=A7||(A7={})).ZodString="ZodString",w7.ZodNumber="ZodNumber",w7.ZodNaN="ZodNaN",w7.ZodBigInt="ZodBigInt",w7.ZodBoolean="ZodBoolean",w7.ZodDate="ZodDate",w7.ZodSymbol="ZodSymbol",w7.ZodUndefined="ZodUndefined",w7.ZodNull="ZodNull",w7.ZodAny="ZodAny",w7.ZodUnknown="ZodUnknown",w7.ZodNever="ZodNever",w7.ZodVoid="ZodVoid",w7.ZodArray="ZodArray",w7.ZodObject="ZodObject",w7.ZodUnion="ZodUnion",w7.ZodDiscriminatedUnion="ZodDiscriminatedUnion",w7.ZodIntersection="ZodIntersection",w7.ZodTuple="ZodTuple",w7.ZodRecord="ZodRecord",w7.ZodMap="ZodMap",w7.ZodSet="ZodSet",w7.ZodFunction="ZodFunction",w7.ZodLazy="ZodLazy",w7.ZodLiteral="ZodLiteral",w7.ZodEnum="ZodEnum",w7.ZodEffects="ZodEffects",w7.ZodNativeEnum="ZodNativeEnum",w7.ZodOptional="ZodOptional",w7.ZodNullable="ZodNullable",w7.ZodDefault="ZodDefault",w7.ZodCatch="ZodCatch",w7.ZodPromise="ZodPromise",w7.ZodBranded="ZodBranded",w7.ZodPipeline="ZodPipeline",w7.ZodReadonly="ZodReadonly";const C7=j8.create,M7=B8.create,T7=p7.create,N7=z8.create,x7=R8.create,E7=_8.create,P7=D8.create,j7=K8.create,L7=H8.create,B7=O8.create,z7=I8.create,R7=G8.create,_7=V8.create,D7=F8.create,K7=U8.create,H7=U8.strictCreate,O7=W8.create,I7=Z8.create,G7=Y8.create,V7=Q8.create,F7=X8.create,J7=e7.create,U7=a7.create,W7=n7.create,q7=t7.create,Z7=i7.create,$7=o7.create,Y7=s7.create,Q7=l7.create,X7=u7.create,eee=c7.create,aee=d7.create,nee=u7.createWithPreprocess,tee=f7.create,iee={string:e=>j8.create({...e,coerce:!0}),number:e=>B8.create({...e,coerce:!0}),boolean:e=>R8.create({...e,coerce:!0}),bigint:e=>z8.create({...e,coerce:!0}),date:e=>_8.create({...e,coerce:!0})},ree=W9;var oee=Object.freeze({__proto__:null,defaultErrorMap:I9,setErrorMap:function(e){G9=e},getErrorMap:V9,makeIssue:F9,EMPTY_PATH:[],addIssueToContext:J9,ParseStatus:U9,INVALID:W9,DIRTY:q9,OK:Z9,isAborted:$9,isDirty:Y9,isValid:Q9,isAsync:X9,get util(){return z9},get objectUtil(){return _9},ZodParsedType:D9,getParsedType:K9,ZodType:u8,datetimeRegex:x8,ZodString:j8,ZodNumber:B8,ZodBigInt:z8,ZodBoolean:R8,ZodDate:_8,ZodSymbol:D8,ZodUndefined:K8,ZodNull:H8,ZodAny:O8,ZodUnknown:I8,ZodNever:G8,ZodVoid:V8,ZodArray:F8,ZodObject:U8,ZodUnion:W8,ZodDiscriminatedUnion:Z8,ZodIntersection:Y8,ZodTuple:Q8,ZodRecord:X8,ZodMap:e7,ZodSet:a7,ZodFunction:n7,ZodLazy:t7,ZodLiteral:i7,ZodEnum:o7,ZodNativeEnum:s7,ZodPromise:l7,ZodEffects:u7,ZodTransformer:u7,ZodOptional:c7,ZodNullable:d7,ZodDefault:m7,ZodCatch:h7,ZodNaN:p7,BRAND:g7,ZodBranded:v7,ZodPipeline:f7,ZodReadonly:y7,custom:b7,Schema:u8,ZodSchema:u8,late:S7,get ZodFirstPartyTypeKind(){return A7},coerce:iee,any:B7,array:D7,bigint:N7,boolean:x7,date:E7,discriminatedUnion:I7,effect:X7,enum:$7,function:W7,instanceof:(e,a={message:`Input not instance of ${e.name}`})=>b7((a=>a instanceof e),a),intersection:G7,lazy:q7,literal:Z7,map:J7,nan:T7,nativeEnum:Y7,never:R7,null:L7,nullable:aee,number:M7,object:K7,oboolean:()=>x7().optional(),onumber:()=>M7().optional(),optional:eee,ostring:()=>C7().optional(),pipeline:tee,preprocess:nee,promise:Q7,record:F7,set:U7,strictObject:H7,string:C7,symbol:P7,transformer:X7,tuple:V7,undefined:j7,union:O7,unknown:z7,void:_7,NEVER:ree,ZodIssueCode:H9,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:O9}),see=(e=>(e.AWS_TOLL_FREE_NUMBER="aws_toll_free_number",e))(see||{}),lee=(e=>(e.TWO_FACTOR_AUTH="two_factor_authentication",e.ONE_TIME_PASSWORD="one_time_passwords",e.NOTIFICATIONS="notifications",e.POLLING_SURVEYS="polling_and_surveys",e.INFO_ON_DEMAND="info_on_demand",e.PROMOTIONS_MARKETING="promotions_and_marketing",e.OTHER="other",e))(lee||{});const uee=oee.object({type:oee.literal("aws_toll_free_number"),tollFreeNumber:oee.string(),company:oee.object({name:oee.string().describe("The legal name of the company"),website:oee.string().url(),address1:oee.string(),address2:oee.string().optional(),city:oee.string(),stateProvince:oee.string(),zipCode:oee.string(),country:oee.string().length(2)}),contact:oee.object({firstName:oee.string(),lastName:oee.string(),email:oee.string().email(),phoneNumber:oee.string().regex(/^\+\d+$/,{message:"Phone number must start with '+' and contain only digits"})}),messagingUseCase:oee.object({monthlyVolume:oee.number().int().positive(),category:oee.nativeEnum(lee),useCaseDetails:oee.string().optional().refine((e=>void 0!==e||""!==e),{message:"Use case details are required when category is 'Other'"})}),messageSamples:oee.array(oee.string()).min(1).max(3).describe("Enter an example message of an SMS message body that will be sent to your end users")}),cee=oee.discriminatedUnion("type",[uee]);var dee=(e=>(e.PENDING="pending",e.APPROVED="approved",e.REJECTED="rejected",e))(dee||{});const mee=e=>{const{channelSenders:a,channelAccounts:n,smsApplication:t}=e;return(a?.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid||e.channelSenderMetadata.friendlyName))||[]).map((e=>{const a=n.find((a=>a.id===e.channelAccountId));return a&&t&&a.channelAccountMetadata.smsApplicationReferenceId===t?.id?{channelSender:e,smsApplication:t}:{channelSender:e,smsApplication:null}}))};function hee(e){const a=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===a?new e.constructor(+e):"number"==typeof e||"[object Number]"===a||"string"==typeof e||"[object String]"===a?new Date(e):new Date(NaN)}function pee(e,a){return e instanceof Date?new e.constructor(a):new Date(a)}const gee=6048e5,vee=43200;let fee={};function yee(){return fee}function kee(e,a){const n=yee(),t=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=hee(e),r=i.getDay(),o=(r<t?7:0)+r-t;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function bee(e){return kee(e,{weekStartsOn:1})}function See(e){const a=hee(e),n=a.getFullYear(),t=pee(e,0);t.setFullYear(n+1,0,4),t.setHours(0,0,0,0);const i=bee(t),r=pee(e,0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);const o=bee(r);return a.getTime()>=i.getTime()?n+1:a.getTime()>=o.getTime()?n:n-1}function Aee(e){const a=hee(e);return a.setHours(0,0,0,0),a}function wee(e){const a=hee(e),n=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()));return n.setUTCFullYear(a.getFullYear()),+e-+n}function Cee(e,a){return function(e,a){return pee(e,+hee(e)+a)}(e,6e4*a)}function Mee(e,a){const n=hee(e),t=hee(a),i=n.getTime()-t.getTime();return i<0?-1:i>0?1:i}function Tee(e){if(!(a=e,a instanceof Date||"object"==typeof a&&"[object Date]"===Object.prototype.toString.call(a)||"number"==typeof e))return!1;var a;const n=hee(e);return!isNaN(Number(n))}function Nee(e){const a=hee(e);return+function(e){const a=hee(e);return a.setHours(23,59,59,999),a}(a)==+function(e){const a=hee(e),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(23,59,59,999),a}(a)}function xee(e,a){const n=hee(e),t=hee(a),i=Mee(n,t),r=Math.abs(function(e,a){const n=hee(e),t=hee(a);return 12*(n.getFullYear()-t.getFullYear())+(n.getMonth()-t.getMonth())}(n,t));let o;if(r<1)o=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*r);let a=Mee(n,t)===-i;Nee(hee(e))&&1===r&&1===Mee(e,t)&&(a=!1),o=i*(r-Number(a))}return 0===o?0:o}function Eee(e,a,n){const t=function(e,a){return+hee(e)-+hee(a)}(e,a)/1e3;return(i=n?.roundingMethod,e=>{const a=(i?Math[i]:Math.trunc)(e);return 0===a?0:a})(t);var i}const Pee={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function jee(e){return(a={})=>{const n=a.width?String(a.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Lee={date:jee({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:jee({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:jee({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Bee={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function zee(e){return(a,n)=>{let t;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,i=n?.width?String(n.width):a;t=e.formattingValues[i]||e.formattingValues[a]}else{const a=e.defaultWidth,i=n?.width?String(n.width):e.defaultWidth;t=e.values[i]||e.values[a]}return t[e.argumentCallback?e.argumentCallback(a):a]}}function Ree(e){return(a,n={})=>{const t=n.width,i=a.match(t&&e.matchPatterns[t]||e.matchPatterns[e.defaultMatchWidth]);if(!i)return null;const r=i[0],o=t&&e.parsePatterns[t]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(o)?function(e,a){for(let n=0;n<e.length;n++)if(a(e[n]))return n;return}(o,(e=>e.test(r))):function(e,a){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&a(e[n]))return n;return}(o,(e=>e.test(r)));let l;l=e.valueCallback?e.valueCallback(s):s,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:a.slice(r.length)}}}var _ee;const Dee={code:"en-US",formatDistance:(e,a,n)=>{let t;const i=Pee[e];return t="string"==typeof i?i:1===a?i.one:i.other.replace("{{count}}",a.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+t:t+" ago":t},formatLong:Lee,formatRelative:(e,a,n,t)=>Bee[e],localize:{ordinalNumber:(e,a)=>{const n=Number(e),t=n%100;if(t>20||t<10)switch(t%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:zee({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:zee({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:zee({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:zee({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:zee({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(_ee={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,a={})=>{const n=e.match(_ee.matchPattern);if(!n)return null;const t=n[0],i=e.match(_ee.parsePattern);if(!i)return null;let r=_ee.valueCallback?_ee.valueCallback(i[0]):i[0];return r=a.valueCallback?a.valueCallback(r):r,{value:r,rest:e.slice(t.length)}}),era:Ree({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Ree({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ree({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Ree({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Ree({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Kee(e){const a=hee(e),n=function(e,a){const n=Aee(e),t=Aee(a),i=+n-wee(n),r=+t-wee(t);return Math.round((i-r)/864e5)}(a,function(e){const a=hee(e),n=pee(e,0);return n.setFullYear(a.getFullYear(),0,1),n.setHours(0,0,0,0),n}(a));return n+1}function Hee(e){const a=hee(e),n=+bee(a)-+function(e){const a=See(e),n=pee(e,0);return n.setFullYear(a,0,4),n.setHours(0,0,0,0),bee(n)}(a);return Math.round(n/gee)+1}function Oee(e,a){const n=hee(e),t=n.getFullYear(),i=yee(),r=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=pee(e,0);o.setFullYear(t+1,0,r),o.setHours(0,0,0,0);const s=kee(o,a),l=pee(e,0);l.setFullYear(t,0,r),l.setHours(0,0,0,0);const u=kee(l,a);return n.getTime()>=s.getTime()?t+1:n.getTime()>=u.getTime()?t:t-1}function Iee(e,a){const n=hee(e),t=+kee(n,a)-+function(e,a){const n=yee(),t=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Oee(e,a),r=pee(e,0);return r.setFullYear(i,0,t),r.setHours(0,0,0,0),kee(r,a)}(n,a);return Math.round(t/gee)+1}function Gee(e,a){return(e<0?"-":"")+Math.abs(e).toString().padStart(a,"0")}const Vee={y(e,a){const n=e.getFullYear(),t=n>0?n:1-n;return Gee("yy"===a?t%100:t,a.length)},M(e,a){const n=e.getMonth();return"M"===a?String(n+1):Gee(n+1,2)},d:(e,a)=>Gee(e.getDate(),a.length),a(e,a){const n=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,a)=>Gee(e.getHours()%12||12,a.length),H:(e,a)=>Gee(e.getHours(),a.length),m:(e,a)=>Gee(e.getMinutes(),a.length),s:(e,a)=>Gee(e.getSeconds(),a.length),S(e,a){const n=a.length,t=e.getMilliseconds();return Gee(Math.trunc(t*Math.pow(10,n-3)),a.length)}},Fee="midnight",Jee="noon",Uee="morning",Wee="afternoon",qee="evening",Zee="night",$ee={G:function(e,a,n){const t=e.getFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return n.era(t,{width:"abbreviated"});case"GGGGG":return n.era(t,{width:"narrow"});default:return n.era(t,{width:"wide"})}},y:function(e,a,n){if("yo"===a){const a=e.getFullYear();return n.ordinalNumber(a>0?a:1-a,{unit:"year"})}return Vee.y(e,a)},Y:function(e,a,n,t){const i=Oee(e,t),r=i>0?i:1-i;if("YY"===a){return Gee(r%100,2)}return"Yo"===a?n.ordinalNumber(r,{unit:"year"}):Gee(r,a.length)},R:function(e,a){return Gee(See(e),a.length)},u:function(e,a){return Gee(e.getFullYear(),a.length)},Q:function(e,a,n){const t=Math.ceil((e.getMonth()+1)/3);switch(a){case"Q":return String(t);case"QQ":return Gee(t,2);case"Qo":return n.ordinalNumber(t,{unit:"quarter"});case"QQQ":return n.quarter(t,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(t,{width:"narrow",context:"formatting"});default:return n.quarter(t,{width:"wide",context:"formatting"})}},q:function(e,a,n){const t=Math.ceil((e.getMonth()+1)/3);switch(a){case"q":return String(t);case"qq":return Gee(t,2);case"qo":return n.ordinalNumber(t,{unit:"quarter"});case"qqq":return n.quarter(t,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(t,{width:"narrow",context:"standalone"});default:return n.quarter(t,{width:"wide",context:"standalone"})}},M:function(e,a,n){const t=e.getMonth();switch(a){case"M":case"MM":return Vee.M(e,a);case"Mo":return n.ordinalNumber(t+1,{unit:"month"});case"MMM":return n.month(t,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(t,{width:"narrow",context:"formatting"});default:return n.month(t,{width:"wide",context:"formatting"})}},L:function(e,a,n){const t=e.getMonth();switch(a){case"L":return String(t+1);case"LL":return Gee(t+1,2);case"Lo":return n.ordinalNumber(t+1,{unit:"month"});case"LLL":return n.month(t,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(t,{width:"narrow",context:"standalone"});default:return n.month(t,{width:"wide",context:"standalone"})}},w:function(e,a,n,t){const i=Iee(e,t);return"wo"===a?n.ordinalNumber(i,{unit:"week"}):Gee(i,a.length)},I:function(e,a,n){const t=Hee(e);return"Io"===a?n.ordinalNumber(t,{unit:"week"}):Gee(t,a.length)},d:function(e,a,n){return"do"===a?n.ordinalNumber(e.getDate(),{unit:"date"}):Vee.d(e,a)},D:function(e,a,n){const t=Kee(e);return"Do"===a?n.ordinalNumber(t,{unit:"dayOfYear"}):Gee(t,a.length)},E:function(e,a,n){const t=e.getDay();switch(a){case"E":case"EE":case"EEE":return n.day(t,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(t,{width:"short",context:"formatting"});default:return n.day(t,{width:"wide",context:"formatting"})}},e:function(e,a,n,t){const i=e.getDay(),r=(i-t.weekStartsOn+8)%7||7;switch(a){case"e":return String(r);case"ee":return Gee(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,a,n,t){const i=e.getDay(),r=(i-t.weekStartsOn+8)%7||7;switch(a){case"c":return String(r);case"cc":return Gee(r,a.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,a,n){const t=e.getDay(),i=0===t?7:t;switch(a){case"i":return String(i);case"ii":return Gee(i,a.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(t,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(t,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(t,{width:"short",context:"formatting"});default:return n.day(t,{width:"wide",context:"formatting"})}},a:function(e,a,n){const t=e.getHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(t,{width:"narrow",context:"formatting"});default:return n.dayPeriod(t,{width:"wide",context:"formatting"})}},b:function(e,a,n){const t=e.getHours();let i;switch(i=12===t?Jee:0===t?Fee:t/12>=1?"pm":"am",a){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,a,n){const t=e.getHours();let i;switch(i=t>=17?qee:t>=12?Wee:t>=4?Uee:Zee,a){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,a,n){if("ho"===a){let a=e.getHours()%12;return 0===a&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return Vee.h(e,a)},H:function(e,a,n){return"Ho"===a?n.ordinalNumber(e.getHours(),{unit:"hour"}):Vee.H(e,a)},K:function(e,a,n){const t=e.getHours()%12;return"Ko"===a?n.ordinalNumber(t,{unit:"hour"}):Gee(t,a.length)},k:function(e,a,n){let t=e.getHours();return 0===t&&(t=24),"ko"===a?n.ordinalNumber(t,{unit:"hour"}):Gee(t,a.length)},m:function(e,a,n){return"mo"===a?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Vee.m(e,a)},s:function(e,a,n){return"so"===a?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Vee.s(e,a)},S:function(e,a){return Vee.S(e,a)},X:function(e,a,n){const t=e.getTimezoneOffset();if(0===t)return"Z";switch(a){case"X":return Qee(t);case"XXXX":case"XX":return Xee(t);default:return Xee(t,":")}},x:function(e,a,n){const t=e.getTimezoneOffset();switch(a){case"x":return Qee(t);case"xxxx":case"xx":return Xee(t);default:return Xee(t,":")}},O:function(e,a,n){const t=e.getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+Yee(t,":");default:return"GMT"+Xee(t,":")}},z:function(e,a,n){const t=e.getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+Yee(t,":");default:return"GMT"+Xee(t,":")}},t:function(e,a,n){return Gee(Math.trunc(e.getTime()/1e3),a.length)},T:function(e,a,n){return Gee(e.getTime(),a.length)}};function Yee(e,a=""){const n=e>0?"-":"+",t=Math.abs(e),i=Math.trunc(t/60),r=t%60;return 0===r?n+String(i):n+String(i)+a+Gee(r,2)}function Qee(e,a){if(e%60==0){return(e>0?"-":"+")+Gee(Math.abs(e)/60,2)}return Xee(e,a)}function Xee(e,a=""){const n=e>0?"-":"+",t=Math.abs(e);return n+Gee(Math.trunc(t/60),2)+a+Gee(t%60,2)}const eae=(e,a)=>{switch(e){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});default:return a.date({width:"full"})}},aae=(e,a)=>{switch(e){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});default:return a.time({width:"full"})}},nae={p:aae,P:(e,a)=>{const n=e.match(/(P+)(p+)?/)||[],t=n[1],i=n[2];if(!i)return eae(e,a);let r;switch(t){case"P":r=a.dateTime({width:"short"});break;case"PP":r=a.dateTime({width:"medium"});break;case"PPP":r=a.dateTime({width:"long"});break;default:r=a.dateTime({width:"full"})}return r.replace("{{date}}",eae(t,a)).replace("{{time}}",aae(i,a))}},tae=/^D+$/,iae=/^Y+$/,rae=["D","DD","YY","YYYY"];const oae=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,sae=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,lae=/^'([^]*?)'?$/,uae=/''/g,cae=/[a-zA-Z]/;function dae(e,a,n){const t=yee(),i=t.locale??Dee,r=t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,o=t.weekStartsOn??t.locale?.options?.weekStartsOn??0,s=hee(e);if(!Tee(s))throw new RangeError("Invalid time value");let l=a.match(sae).map((e=>{const a=e[0];if("p"===a||"P"===a){return(0,nae[a])(e,i.formatLong)}return e})).join("").match(oae).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const a=e[0];if("'"===a)return{isToken:!1,value:mae(e)};if($ee[a])return{isToken:!0,value:e};if(a.match(cae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");return{isToken:!1,value:e}}));i.localize.preprocessor&&(l=i.localize.preprocessor(s,l));const u={firstWeekContainsDate:r,weekStartsOn:o,locale:i};return l.map((n=>{if(!n.isToken)return n.value;const t=n.value;(function(e){return iae.test(e)}(t)||function(e){return tae.test(e)}(t))&&function(e,a,n){const t=function(e,a,n){const t="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${a}\`) for formatting ${t} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,a,n);if(rae.includes(e))throw new RangeError(t)}(t,a,String(e));return(0,$ee[t[0]])(s,t,i.localize,u)})).join("")}function mae(e){const a=e.match(lae);return a?a[1].replace(uae,"'"):e}function hae(e,a){return function(e,a,n){const t=yee(),i=n?.locale??t.locale??Dee,r=Mee(e,a);if(isNaN(r))throw new RangeError("Invalid time value");const o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:r});let s,l;r>0?(s=hee(a),l=hee(e)):(s=hee(e),l=hee(a));const u=Eee(l,s),c=(wee(l)-wee(s))/1e3,d=Math.round((u-c)/60);let m;if(d<2)return n?.includeSeconds?u<5?i.formatDistance("lessThanXSeconds",5,o):u<10?i.formatDistance("lessThanXSeconds",10,o):u<20?i.formatDistance("lessThanXSeconds",20,o):u<40?i.formatDistance("halfAMinute",0,o):i.formatDistance(u<60?"lessThanXMinutes":"xMinutes",1,o):0===d?i.formatDistance("lessThanXMinutes",1,o):i.formatDistance("xMinutes",d,o);if(d<45)return i.formatDistance("xMinutes",d,o);if(d<90)return i.formatDistance("aboutXHours",1,o);if(d<1440){const e=Math.round(d/60);return i.formatDistance("aboutXHours",e,o)}if(d<2520)return i.formatDistance("xDays",1,o);if(d<vee){const e=Math.round(d/1440);return i.formatDistance("xDays",e,o)}if(d<86400)return m=Math.round(d/vee),i.formatDistance("aboutXMonths",m,o);if(m=xee(l,s),m<12){const e=Math.round(d/vee);return i.formatDistance("xMonths",e,o)}{const e=m%12,a=Math.trunc(m/12);return e<3?i.formatDistance("aboutXYears",a,o):e<9?i.formatDistance("overXYears",a,o):i.formatDistance("almostXYears",a+1,o)}}(e,function(e){return pee(e,Date.now())}(e),a)}function pae({accessorKey:e,header:a,meta:t,size:i,minSize:r,maxSize:o,enableSorting:s=!0,enableHiding:l=!0,headerClassName:u,cellClassName:c,cellFormatter:d}){return{accessorKey:e,header:()=>n.jsx("div",{className:`flex items-center h-8 px-3 font-medium whitespace-nowrap text-muted-foreground ${"right"===t?.align?"justify-end float-right":"center"===t?.align?"justify-center":"justify-start"} ${u||""}`.trim(),children:"function"==typeof a?a():n.jsx("span",{children:a})}),cell:e=>n.jsx("div",{className:`flex items-center h-8 ${"right"===t?.align?"justify-end":"center"===t?.align?"justify-center":"justify-start"} ${c||""} ${t?.className||""}`.trim(),children:d?d(e):e.getValue()}),size:i,minSize:r,maxSize:o,enableSorting:s,enableHiding:l,meta:t}}const gae=(e,a,n,t="Error",i="Please try again")=>{e(!1),"error"===n&&a({title:t,description:i,variant:"destructive"})},vae=e=>{switch(e){case Xe.ACTIVE:return"statusActive";case Xe.COMPLETED:return"statusCompleted";case Xe.DRAFT:return"statusDraft";case Xe.DEACTIVATED:return"statusDeactivated";case Xe.FAILED:return"statusFailed";case Xe.RUNNING:return"statusRunning";default:throw W$(e,Xe)}},fae=e=>{switch(e){case bY.ALL_USERS:return`Default ${yh("engage:segment").toLowerCase()} that contains all ${yh("engage:user").toLowerCase()}}. This is not editable or deletable.`;case bY.MANAGED:return`System-defined ${yh("engage:segment").toLowerCase()} that are not editable or deletable.`;case bY.CUSTOM:return`Custom ${yh("engage:segment").toLowerCase()} that you can edit and delete as needed.`;default:throw W$(e,bY)}};function yae(e="name",a,t=!1){return pae({accessorKey:e,header:a,meta:{align:"left",displayName:a,className:"min-w-[240px] w-full"},cellClassName:"pl-3 pr-2",cellFormatter:e=>{const a=e.getValue(),{original:i}=e.row,r=i.status,o=i.type,s=r?r[0].toUpperCase()+r.slice(1):"",l={[Xe.ACTIVE]:"bg-blue-500",[Xe.COMPLETED]:"bg-green-500",[Xe.DRAFT]:"bg-gray-500",[Xe.DEACTIVATED]:"bg-red-500",[Xe.FAILED]:"bg-red-500",[Xe.RUNNING]:"bg-yellow-500"};return n.jsxs("div",{className:"w-full flex gap-6 justify-between items-center",children:[n.jsxs("div",{className:"flex gap-1 items-center w-full",children:[n.jsx("div",{className:`w-2 h-2 rounded-full mr-3 flex-shrink-0 ${o?{[bY.ALL_USERS]:"bg-purple-500",[bY.MANAGED]:"bg-teal-500",[bY.CUSTOM]:"bg-amber-500"}[o]:r?l[r]:"bg-blue-500"}`}),n.jsxs("div",{className:"flex-1 flex flex-col gap-0.5",children:[n.jsx("span",{className:"leading-tight font-medium text-sm overflow-hidden text-ellipsis",children:a}),t&&i?.description&&n.jsx("div",{className:"relative h-4",children:n.jsx("div",{className:"absolute inset-0 text-muted-foreground text-xs truncate whitespace-nowrap overflow-hidden w-full",children:i?.description})})]})]}),r&&n.jsx("div",{className:"flex-shrink-0",children:n.jsx(UY,{variant:vae(r),children:s})})]})}})}function kae(){return pae({accessorKey:"type",header:"Type",meta:{align:"right",displayName:`${yh("engage:segment")} type`},cellClassName:"pr-4",cellFormatter:e=>{const a=e.getValue(),t=a?a.split("_").map((e=>e[0].toUpperCase()+e.slice(1).toLowerCase())).join(" "):"Unknown";let i;if(!a||a!==bY.ALL_USERS&&a!==bY.MANAGED&&a!==bY.CUSTOM)i="statusDraft";else try{i=(e=>{switch(e){case bY.ALL_USERS:return"segmentAllUsers";case bY.MANAGED:return"segmentManaged";case bY.CUSTOM:return"segmentCustom";default:throw W$(e,bY)}})(a)}catch(uBe){if(!(uBe instanceof W$))throw uBe;i="statusDraft"}return n.jsx(j6,{children:n.jsxs(L6,{children:[n.jsx(B6,{asChild:!0,children:n.jsx(UY,{variant:i,className:"cursor-help",children:t})}),n.jsx(z6,{side:"top",className:"max-w-[250px] text-sm bg-white border border-gray-200 rounded-lg p-3",children:n.jsx("p",{className:"text-muted-foreground",children:a&&fae(a)||`Unknown ${yh("engage:segment").toLowerCase()} type`})})]})})}})}function bae(e="updated_at"){return function({accessorKey:e,header:a,meta:t={align:"right"},size:i=160,minSize:r,maxSize:o,enableSorting:s=!0,enableHiding:l=!0,headerClassName:u,cellClassName:c,formatType:d="relative"}){return{accessorKey:e,header:()=>n.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${u||""}`.trim(),children:n.jsx("span",{children:a})}),cell:e=>{const a=e.getValue();let i="N/A";return a&&(i="relative"===d?hae(new Date(a),{addSuffix:!0}):new Date(a).toLocaleDateString()),n.jsx("div",{className:`font-variant-numeric w-full h-8 flex items-center justify-end pr-4 whitespace-nowrap ${c||""} ${t?.className||""}`.trim(),children:i})},size:i,minSize:r,maxSize:o,enableSorting:s,enableHiding:l,meta:t}}({accessorKey:e,header:"Last Modified",formatType:"relative",size:160,meta:{align:"right",displayName:"Last Modified"}})}function Sae(e,a,t){return function({accessorKey:e,header:a,meta:t={align:"right"},size:i,minSize:r,maxSize:o=120,enableSorting:s=!0,enableHiding:l=!0,headerClassName:u,cellClassName:c,prefix:d="",suffix:m="",localeStringOptions:h}){return{accessorKey:e,header:()=>n.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${u||""}`.trim(),children:"function"==typeof a?a():n.jsx("span",{children:a})}),cell:e=>{const a=e.getValue()??0;return n.jsxs("div",{className:`font-variant-numeric h-8 flex items-center justify-end pr-4 ${c||""} ${t?.className||""}`.trim(),children:[d,a.toLocaleString(void 0,h),m]})},size:i||(t?.className?.includes("w-")?void 0:100),minSize:r,maxSize:o,enableSorting:s,enableHiding:l,meta:t}}({accessorKey:e,header:a,prefix:t,meta:{align:"right",displayName:a}})}function Aae(e){const{setUrl:a,onToggle:t,automationName:i,vsaasManaged:r}=e;return pae({accessorKey:"status",header:"Status",enableHiding:!1,size:180,maxSize:200,meta:{align:"right"},cellClassName:"pr-4",cellFormatter:e=>{const{original:o}=e.row;return(o.status??null)===Xe.DRAFT&&a&&!1===r?n.jsx(R6,{rowOriginal:o,constructNavigationUrl:()=>a(o.id),cellText:"Action Required",tooltipIcon:n.jsx(zc,{className:"h-4 w-4 text-muted-foreground !cursor-help z-99"}),tooltipText:`Your ${i?.toLowerCase()} is currently in draft mode. Please review and activate it to begin sending messages.`}):n.jsx(S9,{className:"flex items-center justify-end",rowOriginal:o,id:o.id,onToggle:t||(()=>{}),vsaasManaged:r})}})}function wae(e){const a={align:"right",displayName:`Update ${yh("engage:segment").toLowerCase()}`};return function({id:e="actions",header:a,meta:t={align:"center"},text:i,size:r=80,minSize:o=80,maxSize:s=80,enableSorting:l=!1,enableHiding:u=!1,headerClassName:c,icon:d,onAction:m,actionButtonVariant:h="outline",actionButtonSize:p="default"}){return{id:e,header:()=>n.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:"function"==typeof a?a():n.jsx("span",{children:a})}),cell:e=>{const a=e.row.original,r=a?.type,o="custom"!==r;return n.jsx("div",{className:`flex items-center h-8 pr-3 ${"right"===t?.align?"justify-end":"center"===t?.align?"justify-center":"justify-start"} ${t?.className||""}`.trim(),children:n.jsxs(jY,{variant:h,size:p,disabled:o,onClick:()=>m(a),children:[n.jsx(d,{className:"h-4 w-4"}),n.jsx("span",{children:i})]})})},size:r,minSize:o,maxSize:s,enableSorting:l,enableHiding:u,meta:t}}({id:"edit",header:`${yh("engage:segment")} actions`,icon:Jc,onAction:a=>{e(a.id)},text:"Edit",enableHiding:!1,size:80,meta:a})}function Cae(e){const{automationName:a,setUrl:n,onToggle:t,vsaasManaged:i=!1}=e;return[yae("name","Name",!0),Sae("derivedRevenue","Sales","$"),Sae("emailsSent","Email Sent"),Sae("smsSent","SMS Sent"),bae(),Aae({setUrl:n,onToggle:t,automationName:a,vsaasManaged:i})]}const Mae=({title:e,alertText:t,Icon:i=zc,onClick:r,asChild:o=!0,link:s,size:l="medium",iconColor:u="text-gray-400"})=>{const[c,d]=a.useState(!1);return n.jsx(j6,{children:n.jsxs(L6,{open:c,onOpenChange:d,children:[n.jsx(B6,{asChild:o,onClick:e=>{e.stopPropagation(),s&&window.open(s.url,"_blank"),r?(r(),d(!1)):d(!c)},children:n.jsx(i,{className:LG({small:"h-3 w-3",medium:"h-4 w-4",large:"h-5 w-5"}[l],"cursor-pointer transition-colors",u)})}),n.jsx(z6,{className:"bg-white text-gray-900 border border-gray-200 shadow-lg text-left",children:n.jsxs("div",{className:"flex flex-col items-center justify-center w-full gap-2 max-w-[300px]",children:[t&&n.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[n.jsx(RY.AlertTriangleIcon,{className:"text-amber-500 w-6 h-6"}),n.jsx("p",{className:"font-medium text-amber-500 text-center text-[14px]",children:t})]}),n.jsx("p",{className:"text-[13px] leading-relaxed text-black text-center",children:e}),s&&n.jsx("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"text-[13px] text-blue-500 hover:text-blue-600 hover:underline transition-colors text-center",onClick:e=>e.stopPropagation(),children:s.text??"Click to learn more"})]})})]})})},Tae=({handleBack:e,handleNext:a,handleSkipAndSaveAsDraft:t,backText:i,nextText:r,backDisabled:o,nextDisabled:s,hideBack:l,getInfoTooltipTitle:u})=>{const c=u?.();return n.jsxs("div",{className:"flex gap-4 py-2 items-center",children:[!l&&n.jsxs(jY,{onClick:e,disabled:o,variant:"secondary",className:im("flex items-center gap-2",o&&"opacity-50 cursor-not-allowed"),children:[n.jsx(RY.BackButton,{}),n.jsx("span",{children:i})]}),n.jsx(jY,{onClick:t,variant:"secondary",className:"flex items-center gap-2",children:"Skip & Save as Draft"}),n.jsxs(jY,{onClick:a,disabled:s,className:im("flex items-center gap-2 --reach-destructive",s&&"opacity-50 cursor-not-allowed"),children:[n.jsx("span",{children:r}),n.jsx(RY.NextButton,{})]}),c&&n.jsx(Mae,{title:c})]})},Nae=({content:e,className:a})=>n.jsx("div",{className:LG("flex flex-col gap-4 w-full p-6",a),children:n.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 relative",children:e})}),xae=(e,n)=>{const[t,i]=a.useState(e);return a.useEffect((()=>{const a=setTimeout((()=>{i(e)}),n);return()=>clearTimeout(a)}),[e,n]),t};function Eae(e,a){if("function"==typeof e)return e(a);null!=e&&(e.current=a)}function Pae(e){const a=jae(e),t=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),l=s.find(Bae);if(l){const e=l.props.children,i=s.map((a=>a===l?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(a,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n.jsx(a,{...o,ref:t,children:i})}));return t.displayName=`${e}.Slot`,t}function jae(e){const a=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{r(...e),i(...e)}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?function(...e){return a=>{let n=!1;const t=e.map((e=>{const t=Eae(e,a);return n||"function"!=typeof t||(n=!0),t}));if(n)return()=>{for(let a=0;a<t.length;a++){const n=t[a];"function"==typeof n?n():Eae(e[a],null)}}}}(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));return a.displayName=`${e}.SlotClone`,a}var Lae=Symbol("radix.slottable");function Bae(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Lae}var zae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,a)=>{const t=Pae(`Primitive.${a}`),i=r.forwardRef(((e,i)=>{const{asChild:r,...o}=e,s=r?t:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(s,{...o,ref:i})}));return i.displayName=`Primitive.${a}`,{...e,[a]:i}}),{}),Rae=r.forwardRef(((e,a)=>n.jsx(zae.label,{...e,ref:a,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(e.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}})));Rae.displayName="Label";var _ae=Rae;const Dae=lc("text-foreground text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Kae=r.forwardRef((({className:e,...a},t)=>n.jsx(_ae,{ref:t,className:im(Dae(),e),...a})));function Hae(e,[a,n]){return Math.min(n,Math.max(a,e))}function Oae(e,a,{checkForDefaultPrevented:n=!0}={}){return function(t){if(e?.(t),!1===n||!t.defaultPrevented)return a?.(t)}}function Iae(e,a=[]){let t=[];const i=()=>{const a=t.map((e=>r.createContext(e)));return function(n){const t=n?.[e]||a;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:t}})),[n,t])}};return i.scopeName=e,[function(a,i){const o=r.createContext(i),s=t.length;t=[...t,i];const l=a=>{const{scope:t,children:i,...l}=a,u=t?.[e]?.[s]||o,c=r.useMemo((()=>l),Object.values(l));return n.jsx(u.Provider,{value:c,children:i})};return l.displayName=a+"Provider",[l,function(n,t){const l=r.useContext(t?.[e]?.[s]||o);if(l)return l;if(void 0!==i)return i;throw new Error(`\`${n}\` must be used within \`${a}\``)}]},Gae(i,...a)]}function Gae(...e){const a=e[0];if(1===e.length)return a;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const t=n.reduce(((a,{useScope:n,scopeName:t})=>({...a,...n(e)[`__scope${t}`]})),{});return r.useMemo((()=>({[`__scope${a.scopeName}`]:t})),[t])}};return n.scopeName=a.scopeName,n}function Vae(e,a){if("function"==typeof e)return e(a);null!=e&&(e.current=a)}function Fae(...e){return a=>{let n=!1;const t=e.map((e=>{const t=Vae(e,a);return n||"function"!=typeof t||(n=!0),t}));if(n)return()=>{for(let a=0;a<t.length;a++){const n=t[a];"function"==typeof n?n():Vae(e[a],null)}}}}function Jae(...e){return r.useCallback(Fae(...e),e)}function Uae(e){const a=Wae(e),t=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),l=s.find(Zae);if(l){const e=l.props.children,i=s.map((a=>a===l?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(a,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n.jsx(a,{...o,ref:t,children:i})}));return t.displayName=`${e}.Slot`,t}function Wae(e){const a=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{r(...e),i(...e)}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?Fae(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));return a.displayName=`${e}.SlotClone`,a}Kae.displayName=_ae.displayName;var qae=Symbol("radix.slottable");function Zae(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===qae}var $ae=r.createContext(void 0);var Yae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,a)=>{const t=Uae(`Primitive.${a}`),i=r.forwardRef(((e,i)=>{const{asChild:r,...o}=e,s=r?t:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(s,{...o,ref:i})}));return i.displayName=`Primitive.${a}`,{...e,[a]:i}}),{});function Qae(e){const a=r.useRef(e);return r.useEffect((()=>{a.current=e})),r.useMemo((()=>(...e)=>a.current?.(...e)),[])}var Xae,ene="dismissableLayer.update",ane="dismissableLayer.pointerDownOutside",nne="dismissableLayer.focusOutside",tne=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ine=r.forwardRef(((e,a)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:u,...c}=e,d=r.useContext(tne),[m,h]=r.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=r.useState({}),v=Jae(a,(e=>h(e))),f=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),k=f.indexOf(y),b=m?f.indexOf(m):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,A=b>=k,w=function(e,a=globalThis?.document){const n=Qae(e),t=r.useRef(!1),i=r.useRef((()=>{}));return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){let t=function(){one(ane,n,r,{discrete:!0})};const r={originalEvent:e};"touch"===e.pointerType?(a.removeEventListener("click",i.current),i.current=t,a.addEventListener("click",i.current,{once:!0})):t()}else a.removeEventListener("click",i.current);t.current=!1},r=window.setTimeout((()=>{a.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),a.removeEventListener("pointerdown",e),a.removeEventListener("click",i.current)}}),[a,n]),{onPointerDownCapture:()=>t.current=!0}}((e=>{const a=e.target,n=[...d.branches].some((e=>e.contains(a)));A&&!n&&(o?.(e),l?.(e),e.defaultPrevented||u?.())}),p),C=function(e,a=globalThis?.document){const n=Qae(e),t=r.useRef(!1);return r.useEffect((()=>{const e=e=>{if(e.target&&!t.current){one(nne,n,{originalEvent:e},{discrete:!1})}};return a.addEventListener("focusin",e),()=>a.removeEventListener("focusin",e)}),[a,n]),{onFocusCapture:()=>t.current=!0,onBlurCapture:()=>t.current=!1}}((e=>{const a=e.target;[...d.branches].some((e=>e.contains(a)))||(s?.(e),l?.(e),e.defaultPrevented||u?.())}),p);return function(e,a=globalThis?.document){const n=Qae(e);r.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return a.addEventListener("keydown",e,{capture:!0}),()=>a.removeEventListener("keydown",e,{capture:!0})}),[n,a])}((e=>{b===d.layers.size-1&&(i?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))}),p),r.useEffect((()=>{if(m)return t&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(Xae=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),rne(),()=>{t&&1===d.layersWithOutsidePointerEventsDisabled.size&&(p.body.style.pointerEvents=Xae)}}),[m,p,t,d]),r.useEffect((()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),rne())}),[m,d]),r.useEffect((()=>{const e=()=>g({});return document.addEventListener(ene,e),()=>document.removeEventListener(ene,e)}),[]),n.jsx(Yae.div,{...c,ref:v,style:{pointerEvents:S?A?"auto":"none":void 0,...e.style},onFocusCapture:Oae(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Oae(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Oae(e.onPointerDownCapture,w.onPointerDownCapture)})}));ine.displayName="DismissableLayer";function rne(){const e=new CustomEvent(ene);document.dispatchEvent(e)}function one(e,a,n,{discrete:t}){const i=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});a&&i.addEventListener(e,a,{once:!0}),t?function(e,a){e&&o.flushSync((()=>e.dispatchEvent(a)))}(i,r):i.dispatchEvent(r)}r.forwardRef(((e,a)=>{const t=r.useContext(tne),i=r.useRef(null),o=Jae(a,i);return r.useEffect((()=>{const e=i.current;if(e)return t.branches.add(e),()=>{t.branches.delete(e)}}),[t.branches]),n.jsx(Yae.div,{...e,ref:o})})).displayName="DismissableLayerBranch";var sne=0;function lne(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var une="focusScope.autoFocusOnMount",cne="focusScope.autoFocusOnUnmount",dne={bubbles:!1,cancelable:!0},mne=r.forwardRef(((e,a)=>{const{loop:t=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...l}=e,[u,c]=r.useState(null),d=Qae(o),m=Qae(s),h=r.useRef(null),p=Jae(a,(e=>c(e))),g=r.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;r.useEffect((()=>{if(i){let e=function(e){if(g.paused||!u)return;const a=e.target;u.contains(a)?h.current=a:vne(h.current,{select:!0})},a=function(e){if(g.paused||!u)return;const a=e.relatedTarget;null!==a&&(u.contains(a)||vne(h.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const a of e)a.removedNodes.length>0&&vne(u)};document.addEventListener("focusin",e),document.addEventListener("focusout",a);const t=new MutationObserver(n);return u&&t.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",a),t.disconnect()}}}),[i,u,g.paused]),r.useEffect((()=>{if(u){fne.add(g);const a=document.activeElement;if(!u.contains(a)){const n=new CustomEvent(une,dne);u.addEventListener(une,d),u.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:a=!1}={}){const n=document.activeElement;for(const t of e)if(vne(t,{select:a}),document.activeElement!==n)return}((e=hne(u),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===a&&vne(u))}return()=>{u.removeEventListener(une,d),setTimeout((()=>{const e=new CustomEvent(cne,dne);u.addEventListener(cne,m),u.dispatchEvent(e),e.defaultPrevented||vne(a??document.body,{select:!0}),u.removeEventListener(cne,m),fne.remove(g)}),0)}}var e}),[u,d,m,g]);const v=r.useCallback((e=>{if(!t&&!i)return;if(g.paused)return;const a=document.activeElement;if("Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&a){const n=e.currentTarget,[i,r]=function(e){const a=hne(e),n=pne(a,e),t=pne(a.reverse(),e);return[n,t]}(n);i&&r?e.shiftKey||a!==r?e.shiftKey&&a===i&&(e.preventDefault(),t&&vne(r,{select:!0})):(e.preventDefault(),t&&vne(i,{select:!0})):a===n&&e.preventDefault()}}),[t,i,g.paused]);return n.jsx(Yae.div,{tabIndex:-1,...l,ref:p,onKeyDown:v})}));function hne(e){const a=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)a.push(n.currentNode);return a}function pne(e,a){for(const n of e)if(!gne(n,{upTo:a}))return n}function gne(e,{upTo:a}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==a&&e===a)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function vne(e,{select:a=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&a&&e.select()}}mne.displayName="FocusScope";var fne=function(){let e=[];return{add(a){const n=e[0];a!==n&&n?.pause(),e=yne(e,a),e.unshift(a)},remove(a){e=yne(e,a),e[0]?.resume()}}}();function yne(e,a){const n=[...e],t=n.indexOf(a);return-1!==t&&n.splice(t,1),n}var kne=globalThis?.document?r.useLayoutEffect:()=>{},bne=r[" useId ".trim().toString()]||(()=>{}),Sne=0;function Ane(e){const[a,n]=r.useState(bne());return kne((()=>{n((e=>e??String(Sne++)))}),[e]),e||(a?`radix-${a}`:"")}var wne=r.forwardRef(((e,a)=>{const{children:t,width:i=10,height:r=5,...o}=e;return n.jsx(Yae.svg,{...o,ref:a,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?t:n.jsx("polygon",{points:"0,0 30,0 15,10"})})}));wne.displayName="Arrow";var Cne=wne;var Mne="Popper",[Tne,Nne]=Iae(Mne),[xne,Ene]=Tne(Mne),Pne=e=>{const{__scopePopper:a,children:t}=e,[i,o]=r.useState(null);return n.jsx(xne,{scope:a,anchor:i,onAnchorChange:o,children:t})};Pne.displayName=Mne;var jne="PopperAnchor",Lne=r.forwardRef(((e,a)=>{const{__scopePopper:t,virtualRef:i,...o}=e,s=Ene(jne,t),l=r.useRef(null),u=Jae(a,l);return r.useEffect((()=>{s.onAnchorChange(i?.current||l.current)})),i?null:n.jsx(Yae.div,{...o,ref:u})}));Lne.displayName=jne;var Bne="PopperContent",[zne,Rne]=Tne(Bne),_ne=r.forwardRef(((e,a)=>{const{__scopePopper:t,side:i="bottom",sideOffset:o=0,align:s="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:v,...f}=e,y=Ene(Bne,t),[k,b]=r.useState(null),S=Jae(a,(e=>b(e))),[A,w]=r.useState(null),C=function(e){const[a,n]=r.useState(void 0);return kne((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver((a=>{if(!Array.isArray(a))return;if(!a.length)return;const t=a[0];let i,r;if("borderBoxSize"in t){const e=t.borderBoxSize,a=Array.isArray(e)?e[0]:e;i=a.inlineSize,r=a.blockSize}else i=e.offsetWidth,r=e.offsetHeight;n({width:i,height:r})}));return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}n(void 0)}),[e]),a}(A),M=C?.width??0,T=C?.height??0,N=i+("center"!==s?"-"+s:""),x="number"==typeof m?m:{top:0,right:0,bottom:0,left:0,...m},E=Array.isArray(d)?d:[d],P=E.length>0,j={padding:x,boundary:E.filter(One),altBoundary:P},{refs:L,floatingStyles:B,placement:z,isPositioned:R,middlewareData:_}=r1({strategy:"fixed",placement:N,whileElementsMounted:(...e)=>J0(...e,{animationFrame:"always"===g}),elements:{reference:y.anchor},middleware:[s1({mainAxis:o+T,alignmentAxis:l}),c&&l1({mainAxis:!0,crossAxis:!1,limiter:"partial"===h?u1():void 0,...j}),c&&c1({...j}),d1({...j,apply:({elements:e,rects:a,availableWidth:n,availableHeight:t})=>{const{width:i,height:r}=a.reference,o=e.floating.style;o.setProperty("--radix-popper-available-width",`${n}px`),o.setProperty("--radix-popper-available-height",`${t}px`),o.setProperty("--radix-popper-anchor-width",`${i}px`),o.setProperty("--radix-popper-anchor-height",`${r}px`)}}),A&&h1({element:A,padding:u}),Ine({arrowWidth:M,arrowHeight:T}),p&&m1({strategy:"referenceHidden",...j})]}),[D,K]=Gne(z),H=Qae(v);kne((()=>{R&&H?.()}),[R,H]);const O=_.arrow?.x,I=_.arrow?.y,G=0!==_.arrow?.centerOffset,[V,F]=r.useState();return kne((()=>{k&&F(window.getComputedStyle(k).zIndex)}),[k]),n.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:R?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[_.transformOrigin?.x,_.transformOrigin?.y].join(" "),..._.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:n.jsx(zne,{scope:t,placedSide:D,onArrowChange:w,arrowX:O,arrowY:I,shouldHideArrow:G,children:n.jsx(Yae.div,{"data-side":D,"data-align":K,...f,ref:S,style:{...f.style,animation:R?void 0:"none"}})})})}));_ne.displayName=Bne;var Dne="PopperArrow",Kne={top:"bottom",right:"left",bottom:"top",left:"right"},Hne=r.forwardRef((function(e,a){const{__scopePopper:t,...i}=e,r=Rne(Dne,t),o=Kne[r.placedSide];return n.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:n.jsx(Cne,{...i,ref:a,style:{...i.style,display:"block"}})})}));function One(e){return null!==e}Hne.displayName=Dne;var Ine=e=>({name:"transformOrigin",options:e,fn(a){const{placement:n,rects:t,middlewareData:i}=a,r=0!==i.arrow?.centerOffset,o=r?0:e.arrowWidth,s=r?0:e.arrowHeight,[l,u]=Gne(n),c={start:"0%",center:"50%",end:"100%"}[u],d=(i.arrow?.x??0)+o/2,m=(i.arrow?.y??0)+s/2;let h="",p="";return"bottom"===l?(h=r?c:`${d}px`,p=-s+"px"):"top"===l?(h=r?c:`${d}px`,p=`${t.floating.height+s}px`):"right"===l?(h=-s+"px",p=r?c:`${m}px`):"left"===l&&(h=`${t.floating.width+s}px`,p=r?c:`${m}px`),{data:{x:h,y:p}}}});function Gne(e){const[a,n="center"]=e.split("-");return[a,n]}var Vne=Pne,Fne=Lne,Jne=_ne,Une=Hne,Wne=r.forwardRef(((e,a)=>{const{container:i,...o}=e,[s,l]=r.useState(!1);kne((()=>l(!0)),[]);const u=i||s&&globalThis?.document?.body;return u?t.createPortal(n.jsx(Yae.div,{...o,ref:a}),u):null}));Wne.displayName="Portal";var qne=r[" useInsertionEffect ".trim().toString()]||kne;function Zne({prop:e,defaultProp:a,onChange:n=()=>{},caller:t}){const[i,o,s]=function({defaultProp:e,onChange:a}){const[n,t]=r.useState(e),i=r.useRef(n),o=r.useRef(a);return qne((()=>{o.current=a}),[a]),r.useEffect((()=>{i.current!==n&&(o.current?.(n),i.current=n)}),[n,i]),[n,t,o]}({defaultProp:a,onChange:n}),l=void 0!==e,u=l?e:i;{const a=r.useRef(void 0!==e);r.useEffect((()=>{const e=a.current;if(e!==l){}a.current=l}),[l,t])}const c=r.useCallback((a=>{if(l){const n=function(e){return"function"==typeof e}(a)?a(e):a;n!==e&&s.current?.(n)}else o(a)}),[l,e,o,s]);return[u,c]}var $ne=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});r.forwardRef(((e,a)=>n.jsx(Yae.span,{...e,ref:a,style:{...$ne,...e.style}}))).displayName="VisuallyHidden";var Yne=[" ","Enter","ArrowUp","ArrowDown"],Qne=[" ","Enter"],Xne="Select",[ete,ate,nte]=function(e){const t=e+"CollectionProvider",[i,r]=Iae(t),[o,s]=i(t,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:t,children:i}=e,r=a.useRef(null),s=a.useRef(new Map).current;return n.jsx(o,{scope:t,itemMap:s,collectionRef:r,children:i})};l.displayName=t;const u=e+"CollectionSlot",c=Uae(u),d=a.forwardRef(((e,a)=>{const{scope:t,children:i}=e,r=Jae(a,s(u,t).collectionRef);return n.jsx(c,{ref:r,children:i})}));d.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",p=Uae(m),g=a.forwardRef(((e,t)=>{const{scope:i,children:r,...o}=e,l=a.useRef(null),u=Jae(t,l),c=s(m,i);return a.useEffect((()=>(c.itemMap.set(l,{ref:l,...o}),()=>{c.itemMap.delete(l)}))),n.jsx(p,{[h]:"",ref:u,children:r})}));return g.displayName=m,[{Provider:l,Slot:d,ItemSlot:g},function(n){const t=s(e+"CollectionConsumer",n);return a.useCallback((()=>{const e=t.collectionRef.current;if(!e)return[];const a=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(t.itemMap.values()).sort(((e,n)=>a.indexOf(e.ref.current)-a.indexOf(n.ref.current)))}),[t.collectionRef,t.itemMap])},r]}(Xne),[tte,ite]=Iae(Xne,[nte,Nne]),rte=Nne(),[ote,ste]=tte(Xne),[lte,ute]=tte(Xne),cte=e=>{const{__scopeSelect:a,children:t,open:i,defaultOpen:o,onOpenChange:s,value:l,defaultValue:u,onValueChange:c,dir:d,name:m,autoComplete:h,disabled:p,required:g,form:v}=e,f=rte(a),[y,k]=r.useState(null),[b,S]=r.useState(null),[A,w]=r.useState(!1),C=function(e){const a=r.useContext($ae);return e||a||"ltr"}(d),[M,T]=Zne({prop:i,defaultProp:o??!1,onChange:s,caller:Xne}),[N,x]=Zne({prop:l,defaultProp:u,onChange:c,caller:Xne}),E=r.useRef(null),P=!y||(v||!!y.closest("form")),[j,L]=r.useState(new Set),B=Array.from(j).map((e=>e.props.value)).join(";");return n.jsx(Vne,{...f,children:n.jsxs(ote,{required:g,scope:a,trigger:y,onTriggerChange:k,valueNode:b,onValueNodeChange:S,valueNodeHasChildren:A,onValueNodeHasChildrenChange:w,contentId:Ane(),value:N,onValueChange:x,open:M,onOpenChange:T,dir:C,triggerPointerDownPosRef:E,disabled:p,children:[n.jsx(ete.Provider,{scope:a,children:n.jsx(lte,{scope:e.__scopeSelect,onNativeOptionAdd:r.useCallback((e=>{L((a=>new Set(a).add(e)))}),[]),onNativeOptionRemove:r.useCallback((e=>{L((a=>{const n=new Set(a);return n.delete(e),n}))}),[]),children:t})}),P?n.jsxs(Yte,{"aria-hidden":!0,required:g,tabIndex:-1,name:m,autoComplete:h,value:N,onChange:e=>x(e.target.value),disabled:p,form:v,children:[void 0===N?n.jsx("option",{value:""}):null,Array.from(j)]},B):null]})})};cte.displayName=Xne;var dte="SelectTrigger",mte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,disabled:i=!1,...o}=e,s=rte(t),l=ste(dte,t),u=l.disabled||i,c=Jae(a,l.onTriggerChange),d=ate(t),m=r.useRef("touch"),[h,p,g]=Xte((e=>{const a=d().filter((e=>!e.disabled)),n=a.find((e=>e.value===l.value)),t=eie(a,e,n);void 0!==t&&l.onValueChange(t.value)})),v=e=>{u||(l.onOpenChange(!0),g()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return n.jsx(Fne,{asChild:!0,...s,children:n.jsx(Yae.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":Qte(l.value)?"":void 0,...o,ref:c,onClick:Oae(o.onClick,(e=>{e.currentTarget.focus(),"mouse"!==m.current&&v(e)})),onPointerDown:Oae(o.onPointerDown,(e=>{m.current=e.pointerType;const a=e.target;a.hasPointerCapture(e.pointerId)&&a.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(v(e),e.preventDefault())})),onKeyDown:Oae(o.onKeyDown,(e=>{const a=""!==h.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),a&&" "===e.key||Yne.includes(e.key)&&(v(),e.preventDefault())}))})})}));mte.displayName=dte;var hte="SelectValue",pte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,className:i,style:r,children:o,placeholder:s="",...l}=e,u=ste(hte,t),{onValueNodeHasChildrenChange:c}=u,d=void 0!==o,m=Jae(a,u.onValueNodeChange);return kne((()=>{c(d)}),[c,d]),n.jsx(Yae.span,{...l,ref:m,style:{pointerEvents:"none"},children:Qte(u.value)?n.jsx(n.Fragment,{children:s}):o})}));pte.displayName=hte;var gte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,children:i,...r}=e;return n.jsx(Yae.span,{"aria-hidden":!0,...r,ref:a,children:i||"▼"})}));gte.displayName="SelectIcon";var vte=e=>n.jsx(Wne,{asChild:!0,...e});vte.displayName="SelectPortal";var fte="SelectContent",yte=r.forwardRef(((e,a)=>{const t=ste(fte,e.__scopeSelect),[i,s]=r.useState();if(kne((()=>{s(new DocumentFragment)}),[]),!t.open){const a=i;return a?o.createPortal(n.jsx(bte,{scope:e.__scopeSelect,children:n.jsx(ete.Slot,{scope:e.__scopeSelect,children:n.jsx("div",{children:e.children})})}),a):null}return n.jsx(wte,{...e,ref:a})}));yte.displayName=fte;var kte=10,[bte,Ste]=tte(fte),Ate=Uae("SelectContent.RemoveScroll"),wte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:l,side:u,sideOffset:c,align:d,alignOffset:m,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:f,avoidCollisions:y,...k}=e,b=ste(fte,t),[S,A]=r.useState(null),[w,C]=r.useState(null),M=Jae(a,(e=>A(e))),[T,N]=r.useState(null),[x,E]=r.useState(null),P=ate(t),[j,L]=r.useState(!1),B=r.useRef(!1);r.useEffect((()=>{if(S)return JI(S)}),[S]),r.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lne()),document.body.insertAdjacentElement("beforeend",e[1]??lne()),sne++,()=>{1===sne&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),sne--}}),[]);const z=r.useCallback((e=>{const[a,...n]=P().map((e=>e.ref.current)),[t]=n.slice(-1),i=document.activeElement;for(const r of e){if(r===i)return;if(r?.scrollIntoView({block:"nearest"}),r===a&&w&&(w.scrollTop=0),r===t&&w&&(w.scrollTop=w.scrollHeight),r?.focus(),document.activeElement!==i)return}}),[P,w]),R=r.useCallback((()=>z([T,S])),[z,T,S]);r.useEffect((()=>{j&&R()}),[j,R]);const{onOpenChange:_,triggerPointerDownPosRef:D}=b;r.useEffect((()=>{if(S){let e={x:0,y:0};const a=a=>{e={x:Math.abs(Math.round(a.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(a.pageY)-(D.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():S.contains(n.target)||_(!1),document.removeEventListener("pointermove",a),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",a),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",n,{capture:!0})}}}),[S,_,D]),r.useEffect((()=>{const e=()=>_(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}}),[_]);const[K,H]=Xte((e=>{const a=P().filter((e=>!e.disabled)),n=a.find((e=>e.ref.current===document.activeElement)),t=eie(a,e,n);t&&setTimeout((()=>t.ref.current.focus()))})),O=r.useCallback(((e,a,n)=>{const t=!B.current&&!n;(void 0!==b.value&&b.value===a||t)&&(N(e),t&&(B.current=!0))}),[b.value]),I=r.useCallback((()=>S?.focus()),[S]),G=r.useCallback(((e,a,n)=>{(void 0!==b.value&&b.value===a||!B.current&&!n)&&E(e)}),[b.value]),V="popper"===i?Mte:Cte,F=V===Mte?{side:u,sideOffset:c,align:d,alignOffset:m,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:f,avoidCollisions:y}:{};return n.jsx(bte,{scope:t,content:S,viewport:w,onViewportChange:C,itemRefCallback:O,selectedItem:T,onItemLeave:I,itemTextRefCallback:G,focusSelectedItem:R,selectedItemText:x,position:i,isPositioned:j,searchRef:K,children:n.jsx(KI,{as:Ate,allowPinchZoom:!0,children:n.jsx(mne,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Oae(o,(e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()})),children:n.jsx(ine,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:n.jsx(V,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:e=>e.preventDefault(),...k,...F,onPlaced:()=>L(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Oae(k.onKeyDown,(e=>{const a=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),a||1!==e.key.length||H(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let a=P().filter((e=>!e.disabled)).map((e=>e.ref.current));if(["ArrowUp","End"].includes(e.key)&&(a=a.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=a.indexOf(e.target);a=a.slice(n+1)}setTimeout((()=>z(a))),e.preventDefault()}}))})})})})})}));wte.displayName="SelectContentImpl";var Cte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,onPlaced:i,...o}=e,s=ste(fte,t),l=Ste(fte,t),[u,c]=r.useState(null),[d,m]=r.useState(null),h=Jae(a,(e=>m(e))),p=ate(t),g=r.useRef(!1),v=r.useRef(!0),{viewport:f,selectedItem:y,selectedItemText:k,focusSelectedItem:b}=l,S=r.useCallback((()=>{if(s.trigger&&s.valueNode&&u&&d&&f&&y&&k){const e=s.trigger.getBoundingClientRect(),a=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),t=k.getBoundingClientRect();if("rtl"!==s.dir){const i=n.left-(t.left-a.left),r=e.width+(e.left-i),o=Math.max(r,a.width),s=window.innerWidth-kte,l=Hae(i,[kte,Math.max(kte,s-o)]);u.style.minWidth=r+"px",u.style.left=l+"px"}else{const i=window.innerWidth-n.right-(a.right-t.right),r=window.innerWidth-e.right-i,o=e.width+r,s=Math.max(o,a.width),l=window.innerWidth-kte,c=Hae(i,[kte,Math.max(kte,l-s)]);u.style.minWidth=o+"px",u.style.right=c+"px"}const r=p(),o=window.innerHeight-2*kte,l=f.scrollHeight,c=window.getComputedStyle(d),m=parseInt(c.borderTopWidth,10),h=parseInt(c.paddingTop,10),v=parseInt(c.borderBottomWidth,10),b=m+h+l+parseInt(c.paddingBottom,10)+v,S=Math.min(5*y.offsetHeight,b),A=window.getComputedStyle(f),w=parseInt(A.paddingTop,10),C=parseInt(A.paddingBottom,10),M=e.top+e.height/2-kte,T=o-M,N=y.offsetHeight/2,x=m+h+(y.offsetTop+N),E=b-x;if(x<=M){const e=r.length>0&&y===r[r.length-1].ref.current;u.style.bottom="0px";const a=Math.max(T,N+(e?C:0)+(d.clientHeight-f.offsetTop-f.offsetHeight)+v);u.style.height=x+a+"px"}else{const e=r.length>0&&y===r[0].ref.current;u.style.top="0px";const a=Math.max(M,m+f.offsetTop+(e?w:0)+N);u.style.height=a+E+"px",f.scrollTop=x-M+f.offsetTop}u.style.margin=`${kte}px 0`,u.style.minHeight=S+"px",u.style.maxHeight=o+"px",i?.(),requestAnimationFrame((()=>g.current=!0))}}),[p,s.trigger,s.valueNode,u,d,f,y,k,s.dir,i]);kne((()=>S()),[S]);const[A,w]=r.useState();kne((()=>{d&&w(window.getComputedStyle(d).zIndex)}),[d]);const C=r.useCallback((e=>{e&&!0===v.current&&(S(),b?.(),v.current=!1)}),[S,b]);return n.jsx(Tte,{scope:t,contentWrapper:u,shouldExpandOnScrollRef:g,onScrollButtonChange:C,children:n.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:n.jsx(Yae.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})}));Cte.displayName="SelectItemAlignedPosition";var Mte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,align:i="start",collisionPadding:r=kte,...o}=e,s=rte(t);return n.jsx(Jne,{...s,...o,ref:a,align:i,collisionPadding:r,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})}));Mte.displayName="SelectPopperPosition";var[Tte,Nte]=tte(fte,{}),xte="SelectViewport",Ete=r.forwardRef(((e,a)=>{const{__scopeSelect:t,nonce:i,...o}=e,s=Ste(xte,t),l=Nte(xte,t),u=Jae(a,s.onViewportChange),c=r.useRef(0);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),n.jsx(ete.Slot,{scope:t,children:n.jsx(Yae.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Oae(o.onScroll,(e=>{const a=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:t}=l;if(t?.current&&n){const e=Math.abs(c.current-a.scrollTop);if(e>0){const t=window.innerHeight-2*kte,i=parseFloat(n.style.minHeight),r=parseFloat(n.style.height),o=Math.max(i,r);if(o<t){const i=o+e,r=Math.min(t,i),s=i-r;n.style.height=r+"px","0px"===n.style.bottom&&(a.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}c.current=a.scrollTop}))})})]})}));Ete.displayName=xte;var Pte="SelectGroup",[jte,Lte]=tte(Pte),Bte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e,r=Ane();return n.jsx(jte,{scope:t,id:r,children:n.jsx(Yae.div,{role:"group","aria-labelledby":r,...i,ref:a})})}));Bte.displayName=Pte;var zte="SelectLabel",Rte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e,r=Lte(zte,t);return n.jsx(Yae.div,{id:r.id,...i,ref:a})}));Rte.displayName=zte;var _te="SelectItem",[Dte,Kte]=tte(_te),Hte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,value:i,disabled:o=!1,textValue:s,...l}=e,u=ste(_te,t),c=Ste(_te,t),d=u.value===i,[m,h]=r.useState(s??""),[p,g]=r.useState(!1),v=Jae(a,(e=>c.itemRefCallback?.(e,i,o))),f=Ane(),y=r.useRef("touch"),k=()=>{o||(u.onValueChange(i),u.onOpenChange(!1))};if(""===i)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return n.jsx(Dte,{scope:t,value:i,disabled:o,textId:f,isSelected:d,onItemTextChange:r.useCallback((e=>{h((a=>a||(e?.textContent??"").trim()))}),[]),children:n.jsx(ete.ItemSlot,{scope:t,value:i,disabled:o,textValue:m,children:n.jsx(Yae.div,{role:"option","aria-labelledby":f,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:v,onFocus:Oae(l.onFocus,(()=>g(!0))),onBlur:Oae(l.onBlur,(()=>g(!1))),onClick:Oae(l.onClick,(()=>{"mouse"!==y.current&&k()})),onPointerUp:Oae(l.onPointerUp,(()=>{"mouse"===y.current&&k()})),onPointerDown:Oae(l.onPointerDown,(e=>{y.current=e.pointerType})),onPointerMove:Oae(l.onPointerMove,(e=>{y.current=e.pointerType,o?c.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})})),onPointerLeave:Oae(l.onPointerLeave,(e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()})),onKeyDown:Oae(l.onKeyDown,(e=>{""!==c.searchRef?.current&&" "===e.key||(Qne.includes(e.key)&&k()," "===e.key&&e.preventDefault())}))})})})}));Hte.displayName=_te;var Ote="SelectItemText",Ite=r.forwardRef(((e,a)=>{const{__scopeSelect:t,className:i,style:s,...l}=e,u=ste(Ote,t),c=Ste(Ote,t),d=Kte(Ote,t),m=ute(Ote,t),[h,p]=r.useState(null),g=Jae(a,(e=>p(e)),d.onItemTextChange,(e=>c.itemTextRefCallback?.(e,d.value,d.disabled))),v=h?.textContent,f=r.useMemo((()=>n.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value)),[d.disabled,d.value,v]),{onNativeOptionAdd:y,onNativeOptionRemove:k}=m;return kne((()=>(y(f),()=>k(f))),[y,k,f]),n.jsxs(n.Fragment,{children:[n.jsx(Yae.span,{id:d.textId,...l,ref:g}),d.isSelected&&u.valueNode&&!u.valueNodeHasChildren?o.createPortal(l.children,u.valueNode):null]})}));Ite.displayName=Ote;var Gte="SelectItemIndicator",Vte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e;return Kte(Gte,t).isSelected?n.jsx(Yae.span,{"aria-hidden":!0,...i,ref:a}):null}));Vte.displayName=Gte;var Fte="SelectScrollUpButton",Jte=r.forwardRef(((e,a)=>{const t=Ste(Fte,e.__scopeSelect),i=Nte(Fte,e.__scopeSelect),[o,s]=r.useState(!1),l=Jae(a,i.onScrollButtonChange);return kne((()=>{if(t.viewport&&t.isPositioned){let e=function(){s(a.scrollTop>0)};const a=t.viewport;return e(),a.addEventListener("scroll",e),()=>a.removeEventListener("scroll",e)}}),[t.viewport,t.isPositioned]),o?n.jsx(qte,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:a}=t;e&&a&&(e.scrollTop=e.scrollTop-a.offsetHeight)}}):null}));Jte.displayName=Fte;var Ute="SelectScrollDownButton",Wte=r.forwardRef(((e,a)=>{const t=Ste(Ute,e.__scopeSelect),i=Nte(Ute,e.__scopeSelect),[o,s]=r.useState(!1),l=Jae(a,i.onScrollButtonChange);return kne((()=>{if(t.viewport&&t.isPositioned){let e=function(){const e=a.scrollHeight-a.clientHeight,n=Math.ceil(a.scrollTop)<e;s(n)};const a=t.viewport;return e(),a.addEventListener("scroll",e),()=>a.removeEventListener("scroll",e)}}),[t.viewport,t.isPositioned]),o?n.jsx(qte,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:a}=t;e&&a&&(e.scrollTop=e.scrollTop+a.offsetHeight)}}):null}));Wte.displayName=Ute;var qte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,onAutoScroll:i,...o}=e,s=Ste("SelectScrollButton",t),l=r.useRef(null),u=ate(t),c=r.useCallback((()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)}),[]);return r.useEffect((()=>()=>c()),[c]),kne((()=>{const e=u().find((e=>e.ref.current===document.activeElement));e?.ref.current?.scrollIntoView({block:"nearest"})}),[u]),n.jsx(Yae.div,{"aria-hidden":!0,...o,ref:a,style:{flexShrink:0,...o.style},onPointerDown:Oae(o.onPointerDown,(()=>{null===l.current&&(l.current=window.setInterval(i,50))})),onPointerMove:Oae(o.onPointerMove,(()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(i,50))})),onPointerLeave:Oae(o.onPointerLeave,(()=>{c()}))})})),Zte=r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e;return n.jsx(Yae.div,{"aria-hidden":!0,...i,ref:a})}));Zte.displayName="SelectSeparator";var $te="SelectArrow";r.forwardRef(((e,a)=>{const{__scopeSelect:t,...i}=e,r=rte(t),o=ste($te,t),s=Ste($te,t);return o.open&&"popper"===s.position?n.jsx(Une,{...r,...i,ref:a}):null})).displayName=$te;var Yte=r.forwardRef((({__scopeSelect:e,value:a,...t},i)=>{const o=r.useRef(null),s=Jae(i,o),l=function(e){const a=r.useRef({value:e,previous:e});return r.useMemo((()=>(a.current.value!==e&&(a.current.previous=a.current.value,a.current.value=e),a.current.previous)),[e])}(a);return r.useEffect((()=>{const e=o.current;if(!e)return;const n=window.HTMLSelectElement.prototype,t=Object.getOwnPropertyDescriptor(n,"value").set;if(l!==a&&t){const n=new Event("change",{bubbles:!0});t.call(e,a),e.dispatchEvent(n)}}),[l,a]),n.jsx(Yae.select,{...t,style:{...$ne,...t.style},ref:s,defaultValue:a})}));function Qte(e){return""===e||void 0===e}function Xte(e){const a=Qae(e),n=r.useRef(""),t=r.useRef(0),i=r.useCallback((e=>{const i=n.current+e;a(i),function e(a){n.current=a,window.clearTimeout(t.current),""!==a&&(t.current=window.setTimeout((()=>e("")),1e3))}(i)}),[a]),o=r.useCallback((()=>{n.current="",window.clearTimeout(t.current)}),[]);return r.useEffect((()=>()=>window.clearTimeout(t.current)),[]),[n,i,o]}function eie(e,a,n){const t=a.length>1&&Array.from(a).every((e=>e===a[0]))?a[0]:a,i=n?e.indexOf(n):-1;let r=(o=e,s=Math.max(i,0),o.map(((e,a)=>o[(s+a)%o.length])));var o,s;1===t.length&&(r=r.filter((e=>e!==n)));const l=r.find((e=>e.textValue.toLowerCase().startsWith(t.toLowerCase())));return l!==n?l:void 0}Yte.displayName="SelectBubbleInput";var aie=mte,nie=gte,tie=vte,iie=yte,rie=Ete,oie=Rte,sie=Hte,lie=Ite,uie=Vte,cie=Jte,die=Wte,mie=Zte;const hie=cte,pie=Bte,gie=pte,vie=r.forwardRef((({className:e,children:a,...t},i)=>n.jsxs(aie,{ref:i,className:im("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-border/10 px-3 py-2 text-sm shadow-sm ring-offset-background !placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...t,children:[a,n.jsx(nie,{asChild:!0,children:n.jsx(yc,{className:"h-4 w-4 opacity-50"})})]})));vie.displayName=aie.displayName;const fie=r.forwardRef((({className:e,...a},t)=>n.jsx(cie,{ref:t,className:im("flex cursor-default items-center justify-center py-1",e),...a,children:n.jsx(Sc,{className:"h-4 w-4"})})));fie.displayName=cie.displayName;const yie=r.forwardRef((({className:e,...a},t)=>n.jsx(die,{ref:t,className:im("flex cursor-default items-center justify-center py-1",e),...a,children:n.jsx(yc,{className:"h-4 w-4"})})));yie.displayName=die.displayName;const kie=r.forwardRef((({className:e,children:a,position:t="popper",...i},r)=>n.jsx(tie,{children:n.jsxs(iie,{ref:r,className:im("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===t&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:t,...i,children:[n.jsx(fie,{}),n.jsx(rie,{className:im("p-1","popper"===t&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),n.jsx(yie,{})]})})));kie.displayName=iie.displayName;r.forwardRef((({className:e,...a},t)=>n.jsx(oie,{ref:t,className:im("px-2 py-1.5 text-sm font-semibold text-muted-foreground",e),...a}))).displayName=oie.displayName;const bie=r.forwardRef((({className:e,children:a,...t},i)=>n.jsxs(sie,{ref:i,className:im("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t,children:[n.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(uie,{children:n.jsx(fc,{className:"h-4 w-4"})})}),n.jsx(lie,{children:a})]})));bie.displayName=sie.displayName;r.forwardRef((({className:e,...a},t)=>n.jsx(mie,{ref:t,className:im("-mx-1 my-1 h-px bg-muted",e),...a}))).displayName=mie.displayName;const Sie=({type:e})=>n.jsxs("div",{className:"w-full h-full min-h-[300px] flex flex-col items-center justify-center bg-gradient-to-b from-gray-50 to-white p-8",children:[n.jsx("div",{className:"mb-4 text-gray-300",children:n.jsx("svg",{className:"w-16 h-16",fill:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z"})})}),n.jsxs("p",{className:"text-gray-400 font-medium text-lg text-center mb-2",children:["No ","email"===e?"Email":"SMS"," Preview Available"]}),n.jsxs("p",{className:"text-gray-400 text-sm text-center",children:["Edit your ","email"===e?"Email":"SMS"," template to see a preview here"]})]}),Aie=({html:e,height:a,width:t})=>n.jsx("div",{className:"w-full h-full bg-white rounded-lg border-0 overflow-hidden transition-all duration-300 ease-in-out flex flex-col items-center justify-center",children:e?n.jsx("div",{className:"w-full h-full flex items-center justify-center",children:n.jsx("iframe",{title:"Email Preview",srcDoc:e,className:"transition-opacity duration-300",style:{border:"none",backgroundColor:"white",height:a||"100%",width:t||"100%",maxWidth:"100%",maxHeight:"100%"}})}):n.jsx(Sie,{type:"email"})}),wie=()=>n.jsxs("div",{className:"p-6 overflow-y-auto",children:[n.jsxs("div",{className:"mb-8 text-center",children:[n.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Email Editor Help Center"}),n.jsx("p",{className:"text-gray-500",children:"Learn how to use our email editor's powerful features"})]}),n.jsxs("div",{className:"space-y-4 max-w-xl mx-auto",children:[n.jsx("h3",{className:"text-lg font-medium",children:"Using Dynamic Content"}),n.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-gray-50",children:[n.jsx("img",{src:"https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",alt:"Merge Tags Demo",className:"w-full shadow-lg max-w-md mx-auto"}),n.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 to-transparent p-4",children:n.jsx("p",{className:"text-white text-sm",children:"Demonstration: Adding merge tags to personalize your emails"})})]}),n.jsx("div",{className:"px-2",children:n.jsx(zY,{onClick:()=>{},title:"Dynamic Content",subtitle:"Dynamic content is a way to insert dynamic content into your email such as the customer's name, email, or other details.",icon:n.jsx(Oc,{}),selected:!0})})]})]}),Cie=({type:e})=>n.jsxs("div",{className:"flex items-start space-x-2 text-sm text-gray-600",children:[n.jsx("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:n.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),n.jsxs("span",{children:["Please configure at least one ",e," sender before editing the template"]})]}),Mie=({containerRef:e,stripoDialogDimensions:t,showSaving:i})=>(a.useEffect((()=>{const a=a=>{const n=e.current;if(!n)return;const t=n.querySelector("ui-editor");if(!t)return;const i=t.shadowRoot;if(!i)return;const r=i.host.getBoundingClientRect();const o=function(e){for(;e;){const a=getComputedStyle(e);if(("auto"===a.overflowY||"scroll"===a.overflowY)&&e.scrollHeight>e.clientHeight)return e;e=e.parentElement}return null}(i.elementFromPoint(a.clientX-r.left,a.clientY-r.top))||i.firstElementChild;o&&(o.scrollTop+=a.deltaY,o.scrollLeft+=a.deltaX,a.preventDefault())},n=e.current;return n&&n.addEventListener("wheel",a,{passive:!1}),()=>{n&&n.removeEventListener("wheel",a)}}),[e]),n.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center",children:[n.jsx("div",{id:"externalSystemContainer",className:"flex items-center px-4 py-2"}),i&&n.jsx("div",{className:"absolute top-0 left-0 w-full h-full bg-black/50 flex items-center justify-center z-50",children:n.jsx(xY,{textColor:"text-white",text:["Saving..."]})}),n.jsx("div",{id:"stripoEditorContainer",ref:e,style:{width:t.width-75,height:t.height-75},className:"z-10"})]})),Tie="UiEditorScript",Nie=e=>new Promise(((a,n)=>{const t=()=>{let n=!0;e.updatedFromDefault&&(n=!1),window.UIEditor&&(window.UIEditor.initEditor(e.container,{forceRecreate:n,metadata:{emailId:e.emailId},html:e.html,css:e.css,locale:"en",onTokenRefreshRequest:e=>{Promise.resolve().then((async()=>{try{const{token:a}=await(async()=>(await Pe(`${m}/token`)).data)();e(a)}catch(a){}}))},messageSettingsEnabled:!1,conditionsEnabled:!1,syncModulesEnabled:!1,notifications:{info:console.info,error:console.error,warn:console.warn,success:console.log},mergeTags:e.mergeFields}),a(void 0))};if(document.getElementById(Tie))t();else{const e=document.createElement("script");e.id=Tie,e.type="module",e.src="https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",e.onload=()=>{window.UIEditor?t():n(new Error("UIEditor not found after script load"))},e.onerror=e=>{n(e)},document.head.appendChild(e)}})),xie=({automation:e,setShowStripoEditor:t,saveClicked:i,setSaveClicked:r,stripoDialogDimensions:o,mergeFieldsResponse:s,cancelClicked:l,setCancelClicked:u,actionId:c})=>{const d=a.useRef(!1),m=a.useRef(null),{data:h,isLoading:p}=(e=>{const{automationId:a,actionId:n}=e;return ye({queryKey:tY.templateForActionId(a,n),queryFn:()=>rY({automationId:a,actionId:n}),...we})})({automationId:e.id,actionId:c}),{data:g,isLoading:v}=(()=>{const e=ce();return{...ye({queryKey:tY.editorData(),queryFn:iY,...we}),invalidateEditorData:()=>e.invalidateQueries({queryKey:tY.editorData()})}})(),[f,y]=a.useState(!1),[k,b]=a.useState(!1),{updateCommunicationGroup:S}=lY(),A=a.useCallback((()=>{r(!1),u(!1),y(!1),b(!1),t(!1)}),[r,u,y,b,t]);return a.useEffect((()=>{if(i&&window.UIEditor&&h?.communicationGroupId&&window.StripoEditorApi?.actionsApi){window.StripoEditorApi.actionsApi.compileEmail({callback:function(e,a){e||(S({groupId:h.communicationGroupId,params:{emailHtmlBody:a}}),b(!0))},minimize:!0,mergeTags:[],forceAmp:!1,resetDataSavedFlag:!1,disableLineHeightsReplace:!0});window.StripoEditorApi.actionsApi.save((function(e){e||y(!0)}))}}),[i,m,r,t,h,S]),a.useEffect((()=>{(async()=>{f&&k&&(window.UIEditor&&window.UIEditor.removeEditor(),A())})()}),[f,k,t,r,A]),a.useEffect((()=>{l&&(window.UIEditor&&window.UIEditor.removeEditor(),A())}),[l,A]),a.useEffect((()=>{g?.businessId&&m.current&&h&&(d.current||(Nie({emailId:h.communicationGroupId,html:h.html||"<div></div>",css:h.css||"",container:m.current,businessId:g.businessId,mergeFields:s.mergeFields||[],updatedFromDefault:h.updatedFromDefault}).catch((e=>{})),d.current=!0))}),[g,s,h]),n.jsx("div",p||v||!g||!h?{className:"w-full h-full flex flex-col items-center justify-center",children:n.jsx(xY,{text:["Loading editor..."]})}:{className:"w-full h-full flex flex-col",children:n.jsx(Mie,{containerRef:m,stripoDialogDimensions:o,showSaving:i})})},Eie=({mergeFieldsResponse:e})=>{const t=CY(),i=wY(),{updateCommunicationGroup:r}=lY(),{refetchAutomation:o}=Ge(i?.id||""),{channelSenders:s}=x9(),{channelAccounts:l}=M9(),{state:{selectedActionId:u}}=a.useContext(X$),{state:{replyToSettingsText:c,replyToSettingsLink:d,fromNameSettingsText:m,fromNameSettingsLink:h}}=a.useContext(cO),[p,g]=a.useState(!1),[v,f]=a.useState(t?.emailChannelSenderId||null),[y,k]=a.useState(t?.emailSubject||null),[b,S]=a.useState(t?.emailPreviewText||null),[A,w]=a.useState(t?.emailHtmlBody||null),[C,M]=a.useState(!1),[T,N]=a.useState(!1),[x,E]=a.useState(!1),[P,j]=a.useState(""),[L,B]=a.useState(""),[z,R]=a.useState(!1),_=a.useRef(!0),[D,K]=a.useState(!0),[H,O]=a.useState(!1),[I,G]=a.useState({width:0,height:0}),V=xae(y,500),F=xae(b,500),J=a.useMemo((()=>s?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const a=l?.results?.find((a=>a.id===e.channelAccountId));return a&&a.channelAccountMetadata.type===T9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[s?.results,l?.results]),U=a.useMemo((()=>({width:800,height:400})),[]),W=a.useRef(null);return a.useEffect((()=>{const e=setTimeout((()=>{_.current=!1}),500);return()=>clearTimeout(e)}),[]),a.useEffect((()=>{t?.emailHtmlBody&&w(t.emailHtmlBody)}),[t?.emailHtmlBody,o]),a.useEffect((()=>{if(p){const e=setTimeout((()=>{g(!1)}),2e3);return()=>clearTimeout(e)}}),[p]),a.useEffect((()=>{const e=()=>{G({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),a.useEffect((()=>{if(!_.current&&v&&V&&A&&t?.id){g(!0);(async()=>{try{r({groupId:t.id,params:{emailChannelSenderId:v,emailHtmlBody:A,emailSubject:V,...F&&{emailPreviewText:F}}})}catch(e){}finally{g(!1)}})()}}),[v,V,F,A,t?.id,r]),a.useEffect((()=>{if(s?.results&&v){const e=s.results.find((e=>e.id===v));e&&(H&&!D||B(e.channelSenderMetadata.emailReplyTo),D&&j(e.channelSenderMetadata.emailFromName),K(!1))}}),[s?.results,v,H,D]),a.useEffect((()=>{if(s?.results&&!v){const e=s.results.filter((e=>e.channelSenderMetadata.userPart));if(e[0]){const a=e[0];f(a.id),r({groupId:t?.id||"",params:{emailChannelSenderId:a.id}})}}}),[s?.results,v,t?.id,r]),a.useEffect((()=>{!1===C&&t?.id&&o()}),[C,t?.id,o]),l&&s&&u?n.jsxs("div",{className:"relative",children:[n.jsx(BG,{open:z,onOpenChange:R,children:n.jsxs(DG,{className:"max-h-[86vh] gap-0 overflow-visible max-w-3xl w-full h-full",children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Email Preview Help"}),n.jsx(IG,{children:"Learn more about the email preview and how to use it to create your email."})]}),n.jsx(wie,{})]})}),n.jsx(BG,{open:C,onOpenChange:M,children:n.jsxs(DG,{className:"min-w-[100vw] min-h-[100vh]",hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault()},children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Email Editor"}),n.jsx(IG,{children:"Learn more about the email editor and how to use it to create your email."})]}),n.jsxs("div",{className:"w-full h-full",children:[n.jsxs("div",{className:"flex justify-between items-center p-1 border-b",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h2",{className:"text-lg font-medium",children:"Email Editor"}),n.jsx(jY,{size:"sm",onClick:()=>R(!0),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-medium text-sm",children:"Help"}),n.jsx(RY.InfoIcon,{className:"w-4 h-4"})]})})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(jY,{variant:"destructive",onClick:()=>{E(!0)},className:"text-sm px-3 py-1 rounded",children:"Cancel"}),n.jsx(jY,{onClick:()=>N(!0),className:"text-sm px-3 py-1 rounded",children:"Save"})]})]}),n.jsx("div",{className:" w-full",children:i&&n.jsx(xie,{cancelClicked:x,setCancelClicked:E,showStripoEditor:C,automation:i,setShowStripoEditor:M,saveClicked:T,setSaveClicked:N,stripoDialogDimensions:I,mergeFieldsResponse:e,actionId:u})})]})]})}),n.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx(Kae,{className:"text-foreground",children:"From Email"}),n.jsxs(hie,{onValueChange:e=>{f(e),K(!0),O(!1)},value:v??void 0,disabled:p,children:[n.jsx(vie,{children:n.jsx(gie,{placeholder:"Select email",className:"text-muted-foreground",children:v?J?.find((e=>e.channelSenderId===v))?.fullDomain:""})}),n.jsx(kie,{children:J?.map((e=>n.jsx(bie,{value:e.channelSenderId,children:e.fullDomain},e.channelSenderId)))})]})]}),n.jsxs("div",{children:[n.jsx(Kae,{children:n.jsxs("div",{className:"flex items-center gap-2 py-1",children:["From Name",n.jsx(Mae,{title:m||"From name can be configured under settings in the home screen",link:h?{url:h}:void 0})]})}),n.jsx(o4,{value:P??"",className:"text-muted-foreground",disabled:!0})]}),n.jsxs("div",{children:[n.jsx(Kae,{children:n.jsxs("div",{className:"flex items-center gap-2 py-1",children:["Reply To Email",n.jsx(Mae,{title:c||"Reply to email can be configured under settings in the home screen",link:d?{url:d}:void 0})]})}),n.jsx(o4,{value:L??(v?J?.find((e=>e.channelSenderId===v))?.fullDomain:""),className:"text-muted-foreground",disabled:!0})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-0 py-1",children:[n.jsx(Kae,{className:"text-foreground",children:"Subject"}),n.jsx("span",{className:"text-xs text-red-500 ml-1 align-super",children:"*"})]}),n.jsx(o4,{placeholder:"Enter email subject",className:"text-muted-foreground",value:y??"",onChange:e=>k(e.target.value),disabled:p||D})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 py-1",children:[n.jsx(Kae,{className:"text-foreground",children:"Preview Text"}),n.jsx(Mae,{title:"This text will be used for the preview text of the email in the inbox"})]}),n.jsx(o4,{placeholder:"Enter preview text",className:"text-muted-foreground",value:b??"",onChange:e=>S(e.target.value),disabled:p||D})]})]}),n.jsxs("div",{className:"border rounded-lg p-4 h-full flex flex-col",children:[n.jsxs("div",{className:"flex justify-between items-center mb-4",children:[n.jsx("h3",{className:"font-medium",children:"Preview"}),n.jsxs("div",{children:[n.jsx(jY,{onClick:()=>M(!0),className:"text-sm px-3 py-1 rounded",disabled:p||0===(J?.length??0),children:"Edit"}),0===(J?.length??0)&&n.jsx("div",{className:"relative inline-block",children:n.jsx("div",{className:"absolute right-0 top-full mt-2 w-64 p-3 bg-white border rounded-lg shadow-lg z-10",children:n.jsx(Cie,{type:"email"})})})]})]}),n.jsx("div",{className:"flex-1 w-full overflow-auto",ref:W,style:{height:"400px"},children:n.jsx(Aie,{html:A??"",height:U.height,width:U.width})})]})]})]}):n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Email Preview..."]})})};var Pie=(e=>(e.CUSTOM="custom",e.MANAGED="managed",e))(Pie||{}),jie=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(jie||{}),Lie=(e=>(e.EMAIL="email",e.SMS="sms",e))(Lie||{});const Bie=({title:e,type:t})=>{const i=CY(),r=wY(),{toast:o}=Ie(),[s,l]=a.useState(!1),{resetCommunicationGroupToDefault:u,isPending:c}=dY(),d=!!i&&(i.type===Pie.MANAGED&&("sms"===t?i.updatedFromDefault?.text_message_body:i.updatedFromDefault?.email_text_body||i.updatedFromDefault?.email_html_body));return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h4",{className:"text-xl font-medium text-foreground",children:e}),n.jsx("div",{className:"flex items-center gap-2",children:d&&n.jsx(n.Fragment,{children:c?n.jsx(xY,{}):n.jsx(jY,{variant:"outline",size:"sm",onClick:()=>l(!0),children:"Reset To Default"})})})]}),n.jsx(BG,{open:s,onOpenChange:l,children:n.jsxs(DG,{className:"sm:max-w-[425px]",children:[n.jsxs(KG,{children:[n.jsx(OG,{className:"text-xl font-semibold",children:"Reset to Default"}),n.jsxs(IG,{className:"text-base text-muted-foreground",children:["Are you sure you want to reset this"," ","email"===t?"email":"SMS"," template to its default state? This action cannot be undone."]})]}),n.jsxs(HG,{className:"flex flex-row justify-end gap-3 mt-6",children:[n.jsx(jY,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),n.jsx(jY,{variant:"destructive",onClick:async()=>{i&&r?u({communicationGroupId:i.id,automationId:r.id,type:t},{onSuccess:()=>{o({title:"Communication reset to default!"}),l(!1)},onSettled:()=>{l(!1)},onError:()=>{o({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})}}):o({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})},children:"Reset to Default"})]})]})})]})},zie=e=>{const{channelSenders:a,channelAccounts:n}=e;return a?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const a=n?.find((a=>a.id===e.channelAccountId));return a&&a.channelAccountMetadata.type===T9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSender:e}]:[]}))||[]},Rie=()=>{const e=a.useRef(null),t=CY(),{channelSenders:i}=x9(),{channelAccounts:r}=M9(),{getMergeFields:o,isGetting:s}=uY(t?.id??void 0),l=a.useMemo((()=>zie({channelSenders:i?.results??[],channelAccounts:r?.results??[]})),[i?.results,r?.results]);return!s&&o&&l?n.jsxs("div",{className:"bg-card text-card-foreground rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",ref:e,children:[n.jsx(Bie,{title:"Email Campaign",type:"email"}),n.jsx(Eie,{mergeFieldsResponse:o,emailChannelSendersWithChannelAccounts:l})]}):n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-card text-card-foreground rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Content..."]})})};var _ie=e=>"checkbox"===e.type,Die=e=>e instanceof Date,Kie=e=>null==e;const Hie=e=>"object"==typeof e;var Oie=e=>!Kie(e)&&!Array.isArray(e)&&Hie(e)&&!Die(e),Iie=e=>Oie(e)&&e.target?_ie(e.target)?e.target.checked:e.target.value:e,Gie=(e,a)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(a)),Vie="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Fie(e){let a;const n=Array.isArray(e),t="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)a=new Date(e);else if(e instanceof Set)a=new Set(e);else{if(Vie&&(e instanceof Blob||t)||!n&&!Oie(e))return e;if(a=n?[]:{},n||(e=>{const a=e.constructor&&e.constructor.prototype;return Oie(a)&&a.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(a[n]=Fie(e[n]));else a=e}return a}var Jie=e=>Array.isArray(e)?e.filter(Boolean):[],Uie=e=>void 0===e,Wie=(e,a,n)=>{if(!a||!Oie(e))return n;const t=Jie(a.split(/[,[\].]+?/)).reduce(((e,a)=>Kie(e)?e:e[a]),e);return Uie(t)||t===e?Uie(e[a])?n:e[a]:t},qie=e=>"boolean"==typeof e,Zie=e=>/^\w*$/.test(e),$ie=e=>Jie(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Yie=(e,a,n)=>{let t=-1;const i=Zie(a)?[a]:$ie(a),r=i.length,o=r-1;for(;++t<r;){const a=i[t];let r=n;if(t!==o){const n=e[a];r=Oie(n)||Array.isArray(n)?n:isNaN(+i[t+1])?{}:[]}if("__proto__"===a||"constructor"===a||"prototype"===a)return;e[a]=r,e=e[a]}};const Qie="blur",Xie="focusout",ere="change",are="onBlur",nre="onChange",tre="onSubmit",ire="onTouched",rre="all",ore="max",sre="min",lre="maxLength",ure="minLength",cre="pattern",dre="required",mre="validate",hre=a.createContext(null),pre=()=>a.useContext(hre);var gre=(e,a,n,t=!0)=>{const i={defaultValues:a._defaultValues};for(const r in e)Object.defineProperty(i,r,{get:()=>{const i=r;return a._proxyFormState[i]!==rre&&(a._proxyFormState[i]=!t||rre),n&&(n[i]=!0),e[i]}});return i},vre=e=>Kie(e)||!Hie(e);function fre(e,a){if(vre(e)||vre(a))return e===a;if(Die(e)&&Die(a))return e.getTime()===a.getTime();const n=Object.keys(e),t=Object.keys(a);if(n.length!==t.length)return!1;for(const i of n){const n=e[i];if(!t.includes(i))return!1;if("ref"!==i){const e=a[i];if(Die(n)&&Die(e)||Oie(n)&&Oie(e)||Array.isArray(n)&&Array.isArray(e)?!fre(n,e):n!==e)return!1}}return!0}const yre=(e,n)=>{const t=a.useRef(n);fre(n,t.current)||(t.current=n),a.useEffect(e,t.current)};var kre=e=>"string"==typeof e,bre=(e,a,n,t,i)=>kre(e)?(t&&a.watch.add(e),Wie(n,e,i)):Array.isArray(e)?e.map((e=>(t&&a.watch.add(e),Wie(n,e)))):(t&&(a.watchAll=!0),n);function Sre(e){const n=pre(),{name:t,disabled:i,control:r=n.control,shouldUnregister:o}=e,s=Gie(r._names.array,t),l=function(e){const n=pre(),{control:t=n.control,name:i,defaultValue:r,disabled:o,exact:s}=e||{},[l,u]=a.useState(t._getWatch(i,r));return yre((()=>t._subscribe({name:i,formState:{values:!0},exact:s,callback:e=>!o&&u(bre(i,t._names,e.values||t._formValues,!1,r))})),[i,r,o,s]),a.useEffect((()=>t._removeUnmounted())),l}({control:r,name:t,defaultValue:Wie(r._formValues,t,Wie(r._defaultValues,t,e.defaultValue)),exact:!0}),u=function(e){const n=pre(),{control:t=n.control,disabled:i,name:r,exact:o}=e||{},[s,l]=a.useState(t._formState),u=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return yre((()=>t._subscribe({name:r,formState:u.current,exact:o,callback:e=>{!i&&l({...t._formState,...e})}})),[r,i,o]),a.useEffect((()=>{u.current.isValid&&t._setValid(!0)}),[t]),a.useMemo((()=>gre(s,t,u.current,!1)),[s,t])}({control:r,name:t,exact:!0}),c=a.useRef(e),d=a.useRef(r.register(t,{...e.rules,value:l,...qie(e.disabled)?{disabled:e.disabled}:{}})),m=a.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Wie(u.errors,t)},isDirty:{enumerable:!0,get:()=>!!Wie(u.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!Wie(u.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!Wie(u.validatingFields,t)},error:{enumerable:!0,get:()=>Wie(u.errors,t)}})),[u,t]),h=a.useCallback((e=>d.current.onChange({target:{value:Iie(e),name:t},type:ere})),[t]),p=a.useCallback((()=>d.current.onBlur({target:{value:Wie(r._formValues,t),name:t},type:Qie})),[t,r._formValues]),g=a.useCallback((e=>{const a=Wie(r._fields,t);a&&e&&(a._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:a=>e.setCustomValidity(a),reportValidity:()=>e.reportValidity()})}),[r._fields,t]),v=a.useMemo((()=>({name:t,value:l,...qie(i)||u.disabled?{disabled:u.disabled||i}:{},onChange:h,onBlur:p,ref:g})),[t,i,u.disabled,h,p,g,l]);return a.useEffect((()=>{const e=r._options.shouldUnregister||o;r.register(t,{...c.current.rules,...qie(c.current.disabled)?{disabled:c.current.disabled}:{}});const a=(e,a)=>{const n=Wie(r._fields,e);n&&n._f&&(n._f.mount=a)};if(a(t,!0),e){const e=Fie(Wie(r._options.defaultValues,t));Yie(r._defaultValues,t,e),Uie(Wie(r._formValues,t))&&Yie(r._formValues,t,e)}return!s&&r.register(t),()=>{(s?e&&!r._state.action:e)?r.unregister(t):a(t,!1)}}),[t,r,s,o]),a.useEffect((()=>{r._setDisabledField({disabled:i,name:t})}),[i,t,r]),a.useMemo((()=>({field:v,formState:u,fieldState:m})),[v,u,m])}const Are=e=>e.render(Sre(e));var wre=(e,a,n,t,i)=>a?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[t]:i||!0}}:{},Cre=e=>Array.isArray(e)?e:[e],Mre=()=>{let e=[];return{get observers(){return e},next:a=>{for(const n of e)n.next&&n.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter((e=>e!==a))}}),unsubscribe:()=>{e=[]}}},Tre=e=>Oie(e)&&!Object.keys(e).length,Nre=e=>"file"===e.type,xre=e=>"function"==typeof e,Ere=e=>{if(!Vie)return!1;const a=e?e.ownerDocument:0;return e instanceof(a&&a.defaultView?a.defaultView.HTMLElement:HTMLElement)},Pre=e=>"select-multiple"===e.type,jre=e=>"radio"===e.type,Lre=e=>Ere(e)&&e.isConnected;function Bre(e,a){const n=Array.isArray(a)?a:Zie(a)?[a]:$ie(a),t=1===n.length?e:function(e,a){const n=a.slice(0,-1).length;let t=0;for(;t<n;)e=Uie(e)?t++:e[a[t++]];return e}(e,n),i=n.length-1;return t&&delete t[n[i]],0!==i&&(Oie(t)&&Tre(t)||Array.isArray(t)&&function(e){for(const a in e)if(e.hasOwnProperty(a)&&!Uie(e[a]))return!1;return!0}(t))&&Bre(e,n.slice(0,-1)),e}var zre=e=>{for(const a in e)if(xre(e[a]))return!0;return!1};function Rre(e,a={}){const n=Array.isArray(e);if(Oie(e)||n)for(const t in e)Array.isArray(e[t])||Oie(e[t])&&!zre(e[t])?(a[t]=Array.isArray(e[t])?[]:{},Rre(e[t],a[t])):Kie(e[t])||(a[t]=!0);return a}function _re(e,a,n){const t=Array.isArray(e);if(Oie(e)||t)for(const i in e)Array.isArray(e[i])||Oie(e[i])&&!zre(e[i])?Uie(a)||vre(n[i])?n[i]=Array.isArray(e[i])?Rre(e[i],[]):{...Rre(e[i])}:_re(e[i],Kie(a)?{}:a[i],n[i]):n[i]=!fre(e[i],a[i]);return n}var Dre=(e,a)=>_re(e,a,Rre(a));const Kre={value:!1,isValid:!1},Hre={value:!0,isValid:!0};var Ore=e=>{if(Array.isArray(e)){if(e.length>1){const a=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:a,isValid:!!a.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Uie(e[0].attributes.value)?Uie(e[0].value)||""===e[0].value?Hre:{value:e[0].value,isValid:!0}:Hre:Kre}return Kre},Ire=(e,{valueAsNumber:a,valueAsDate:n,setValueAs:t})=>Uie(e)?e:a?""===e?NaN:e?+e:e:n&&kre(e)?new Date(e):t?t(e):e;const Gre={isValid:!1,value:null};var Vre=e=>Array.isArray(e)?e.reduce(((e,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:e),Gre):Gre;function Fre(e){const a=e.ref;return Nre(a)?a.files:jre(a)?Vre(e.refs).value:Pre(a)?[...a.selectedOptions].map((({value:e})=>e)):_ie(a)?Ore(e.refs).value:Ire(Uie(a.value)?e.ref.value:a.value,e)}var Jre=e=>e instanceof RegExp,Ure=e=>Uie(e)?e:Jre(e)?e.source:Oie(e)?Jre(e.value)?e.value.source:e.value:e,Wre=e=>({isOnSubmit:!e||e===tre,isOnBlur:e===are,isOnChange:e===nre,isOnAll:e===rre,isOnTouch:e===ire});const qre="AsyncFunction";var Zre=(e,a,n)=>!n&&(a.watchAll||a.watch.has(e)||[...a.watch].some((a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length)))));const $re=(e,a,n,t)=>{for(const i of n||Object.keys(e)){const n=Wie(e,i);if(n){const{_f:e,...r}=n;if(e){if(e.refs&&e.refs[0]&&a(e.refs[0],i)&&!t)return!0;if(e.ref&&a(e.ref,e.name)&&!t)return!0;if($re(r,a))break}else if(Oie(r)&&$re(r,a))break}}};function Yre(e,a,n){const t=Wie(e,n);if(t||Zie(n))return{error:t,name:n};const i=n.split(".");for(;i.length;){const t=i.join("."),r=Wie(a,t),o=Wie(e,t);if(r&&!Array.isArray(r)&&n!==t)return{name:n};if(o&&o.type)return{name:t,error:o};i.pop()}return{name:n}}var Qre=(e,a,n)=>{const t=Cre(Wie(e,n));return Yie(t,"root",a[n]),Yie(e,n,t),e},Xre=e=>kre(e);function eoe(e,a,n="validate"){if(Xre(e)||Array.isArray(e)&&e.every(Xre)||qie(e)&&!e)return{type:n,message:Xre(e)?e:"",ref:a}}var aoe=e=>Oie(e)&&!Jre(e)?e:{value:e,message:""},noe=async(e,a,n,t,i,r)=>{const{ref:o,refs:s,required:l,maxLength:u,minLength:c,min:d,max:m,pattern:h,validate:p,name:g,valueAsNumber:v,mount:f}=e._f,y=Wie(n,g);if(!f||a.has(g))return{};const k=s?s[0]:o,b=e=>{i&&k.reportValidity&&(k.setCustomValidity(qie(e)?"":e||""),k.reportValidity())},S={},A=jre(o),w=_ie(o),C=A||w,M=(v||Nre(o))&&Uie(o.value)&&Uie(y)||Ere(o)&&""===o.value||""===y||Array.isArray(y)&&!y.length,T=wre.bind(null,g,t,S),N=(e,a,n,t=lre,i=ure)=>{const r=e?a:n;S[g]={type:e?t:i,message:r,ref:o,...T(e?t:i,r)}};if(r?!Array.isArray(y)||!y.length:l&&(!C&&(M||Kie(y))||qie(y)&&!y||w&&!Ore(s).isValid||A&&!Vre(s).isValid)){const{value:e,message:a}=Xre(l)?{value:!!l,message:l}:aoe(l);if(e&&(S[g]={type:dre,message:a,ref:k,...T(dre,a)},!t))return b(a),S}if(!(M||Kie(d)&&Kie(m))){let e,a;const n=aoe(m),i=aoe(d);if(Kie(y)||isNaN(y)){const t=o.valueAsDate||new Date(y),r=e=>new Date((new Date).toDateString()+" "+e),s="time"==o.type,l="week"==o.type;kre(n.value)&&y&&(e=s?r(y)>r(n.value):l?y>n.value:t>new Date(n.value)),kre(i.value)&&y&&(a=s?r(y)<r(i.value):l?y<i.value:t<new Date(i.value))}else{const t=o.valueAsNumber||(y?+y:y);Kie(n.value)||(e=t>n.value),Kie(i.value)||(a=t<i.value)}if((e||a)&&(N(!!e,n.message,i.message,ore,sre),!t))return b(S[g].message),S}if((u||c)&&!M&&(kre(y)||r&&Array.isArray(y))){const e=aoe(u),a=aoe(c),n=!Kie(e.value)&&y.length>+e.value,i=!Kie(a.value)&&y.length<+a.value;if((n||i)&&(N(n,e.message,a.message),!t))return b(S[g].message),S}if(h&&!M&&kre(y)){const{value:e,message:a}=aoe(h);if(Jre(e)&&!y.match(e)&&(S[g]={type:cre,message:a,ref:o,...T(cre,a)},!t))return b(a),S}if(p)if(xre(p)){const e=eoe(await p(y,n),k);if(e&&(S[g]={...e,...T(mre,e.message)},!t))return b(e.message),S}else if(Oie(p)){let e={};for(const a in p){if(!Tre(e)&&!t)break;const i=eoe(await p[a](y,n),k,a);i&&(e={...i,...T(a,i.message)},b(i.message),t&&(S[g]=e))}if(!Tre(e)&&(S[g]={ref:k,...e},!t))return S}return b(!0),S};const toe={mode:tre,reValidateMode:nre,shouldFocusError:!0};function ioe(e={}){let a={...toe,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:xre(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:a.errors||{},disabled:a.disabled||!1};const t={};let i,r=(Oie(a.defaultValues)||Oie(a.values))&&Fie(a.values||a.defaultValues)||{},o=a.shouldUnregister?{}:Fie(r),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let d={...c};const m={array:Mre(),state:Mre()},h=Wre(a.mode),p=Wre(a.reValidateMode),g=a.criteriaMode===rre,v=async e=>{if(!a.disabled&&(c.isValid||d.isValid||e)){const e=a.resolver?Tre((await S()).errors):await A(t,!0);e!==n.isValid&&m.state.next({isValid:e})}},f=(e,t)=>{!a.disabled&&(c.isValidating||c.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(t?Yie(n.validatingFields,e,t):Bre(n.validatingFields,e))})),m.state.next({validatingFields:n.validatingFields,isValidating:!Tre(n.validatingFields)}))},y=(e,a,n,i)=>{const l=Wie(t,e);if(l){const t=Wie(o,e,Uie(n)?Wie(r,e):n);Uie(t)||i&&i.defaultChecked||a?Yie(o,e,a?t:Fre(l._f)):M(e,t),s.mount&&v()}},k=(e,t,i,o,s)=>{let l=!1,u=!1;const h={name:e};if(!a.disabled){if(!i||o){(c.isDirty||d.isDirty)&&(u=n.isDirty,n.isDirty=h.isDirty=w(),l=u!==h.isDirty);const a=fre(Wie(r,e),t);u=!!Wie(n.dirtyFields,e),a?Bre(n.dirtyFields,e):Yie(n.dirtyFields,e,!0),h.dirtyFields=n.dirtyFields,l=l||(c.dirtyFields||d.dirtyFields)&&u!==!a}if(i){const a=Wie(n.touchedFields,e);a||(Yie(n.touchedFields,e,i),h.touchedFields=n.touchedFields,l=l||(c.touchedFields||d.touchedFields)&&a!==i)}l&&s&&m.state.next(h)}return l?h:{}},b=(e,t,r,o)=>{const s=Wie(n.errors,e),l=(c.isValid||d.isValid)&&qie(t)&&n.isValid!==t;if(a.delayError&&r?(i=(e=>a=>{clearTimeout(u),u=setTimeout(e,a)})((()=>((e,a)=>{Yie(n.errors,e,a),m.state.next({errors:n.errors})})(e,r))),i(a.delayError)):(clearTimeout(u),i=null,r?Yie(n.errors,e,r):Bre(n.errors,e)),(r?!fre(s,r):s)||!Tre(o)||l){const a={...o,...l&&qie(t)?{isValid:t}:{},errors:n.errors,name:e};n={...n,...a},m.state.next(a)}},S=async e=>{f(e,!0);const n=await a.resolver(o,a.context,((e,a,n,t)=>{const i={};for(const r of e){const e=Wie(a,r);e&&Yie(i,r,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:t}})(e||l.mount,t,a.criteriaMode,a.shouldUseNativeValidation));return f(e),n},A=async(e,t,i={valid:!0})=>{for(const s in e){const u=e[s];if(u){const{_f:e,...d}=u;if(e){const d=l.array.has(e.name),m=u._f&&(!!(r=u._f)&&!!r.validate&&!!(xre(r.validate)&&r.validate.constructor.name===qre||Oie(r.validate)&&Object.values(r.validate).find((e=>e.constructor.name===qre))));m&&c.validatingFields&&f([s],!0);const h=await noe(u,l.disabled,o,g,a.shouldUseNativeValidation&&!t,d);if(m&&c.validatingFields&&f([s]),h[e.name]&&(i.valid=!1,t))break;!t&&(Wie(h,e.name)?d?Qre(n.errors,h,e.name):Yie(n.errors,e.name,h[e.name]):Bre(n.errors,e.name))}!Tre(d)&&await A(d,t,i)}}var r;return i.valid},w=(e,n)=>!a.disabled&&(e&&n&&Yie(o,e,n),!fre(j(),r)),C=(e,a,n)=>bre(e,l,{...s.mount?o:Uie(a)?r:kre(e)?{[e]:a}:a},n,a),M=(e,a,n={})=>{const i=Wie(t,e);let r=a;if(i){const n=i._f;n&&(!n.disabled&&Yie(o,e,Ire(a,n)),r=Ere(n.ref)&&Kie(a)?"":a,Pre(n.ref)?[...n.ref.options].forEach((e=>e.selected=r.includes(e.value))):n.refs?_ie(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(r)?!!r.find((a=>a===e.value)):r===e.value))):n.refs[0]&&(n.refs[0].checked=!!r):n.refs.forEach((e=>e.checked=e.value===r)):Nre(n.ref)?n.ref.value="":(n.ref.value=r,n.ref.type||m.state.next({name:e,values:Fie(o)})))}(n.shouldDirty||n.shouldTouch)&&k(e,r,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&P(e)},T=(e,a,n)=>{for(const i in a){const r=a[i],o=`${e}.${i}`,s=Wie(t,o);(l.array.has(e)||Oie(r)||s&&!s._f)&&!Die(r)?T(o,r,n):M(o,r,n)}},N=(e,a,i={})=>{const u=Wie(t,e),h=l.array.has(e),p=Fie(a);Yie(o,e,p),h?(m.array.next({name:e,values:Fie(o)}),(c.isDirty||c.dirtyFields||d.isDirty||d.dirtyFields)&&i.shouldDirty&&m.state.next({name:e,dirtyFields:Dre(r,o),isDirty:w(e,p)})):!u||u._f||Kie(p)?M(e,p,i):T(e,p,i),Zre(e,l)&&m.state.next({...n}),m.state.next({name:s.mount?e:void 0,values:Fie(o)})},x=async e=>{s.mount=!0;const r=e.target;let u=r.name,y=!0;const w=Wie(t,u),C=e=>{y=Number.isNaN(e)||Die(e)&&isNaN(e.getTime())||fre(e,Wie(o,u,e))};if(w){let s,T;const N=r.type?Fre(w._f):Iie(e),x=e.type===Qie||e.type===Xie,E=!((M=w._f).mount&&(M.required||M.min||M.max||M.maxLength||M.minLength||M.pattern||M.validate)||a.resolver||Wie(n.errors,u)||w._f.deps)||((e,a,n,t,i)=>!i.isOnAll&&(!n&&i.isOnTouch?!(a||e):(n?t.isOnBlur:i.isOnBlur)?!e:!(n?t.isOnChange:i.isOnChange)||e))(x,Wie(n.touchedFields,u),n.isSubmitted,p,h),j=Zre(u,l,x);Yie(o,u,N),x?(w._f.onBlur&&w._f.onBlur(e),i&&i(0)):w._f.onChange&&w._f.onChange(e);const L=k(u,N,x),B=!Tre(L)||j;if(!x&&m.state.next({name:u,type:e.type,values:Fie(o)}),E)return(c.isValid||d.isValid)&&("onBlur"===a.mode?x&&v():x||v()),B&&m.state.next({name:u,...j?{}:L});if(!x&&j&&m.state.next({...n}),a.resolver){const{errors:e}=await S([u]);if(C(N),y){const a=Yre(n.errors,t,u),i=Yre(e,t,a.name||u);s=i.error,u=i.name,T=Tre(e)}}else f([u],!0),s=(await noe(w,l.disabled,o,g,a.shouldUseNativeValidation))[u],f([u]),C(N),y&&(s?T=!1:(c.isValid||d.isValid)&&(T=await A(t,!0)));y&&(w._f.deps&&P(w._f.deps),b(u,T,s,L))}var M},E=(e,a)=>{if(Wie(n.errors,a)&&e.focus)return e.focus(),1},P=async(e,i={})=>{let r,o;const s=Cre(e);if(a.resolver){const a=await(async e=>{const{errors:a}=await S(e);if(e)for(const t of e){const e=Wie(a,t);e?Yie(n.errors,t,e):Bre(n.errors,t)}else n.errors=a;return a})(Uie(e)?e:s);r=Tre(a),o=e?!s.some((e=>Wie(a,e))):r}else e?(o=(await Promise.all(s.map((async e=>{const a=Wie(t,e);return await A(a&&a._f?{[e]:a}:a)})))).every(Boolean),(o||n.isValid)&&v()):o=r=await A(t);return m.state.next({...!kre(e)||(c.isValid||d.isValid)&&r!==n.isValid?{}:{name:e},...a.resolver||!e?{isValid:r}:{},errors:n.errors}),i.shouldFocus&&!o&&$re(t,E,e?s:l.mount),o},j=e=>{const a={...s.mount?o:r};return Uie(e)?a:kre(e)?Wie(a,e):e.map((e=>Wie(a,e)))},L=(e,a)=>({invalid:!!Wie((a||n).errors,e),isDirty:!!Wie((a||n).dirtyFields,e),error:Wie((a||n).errors,e),isValidating:!!Wie(n.validatingFields,e),isTouched:!!Wie((a||n).touchedFields,e)}),B=(e,a,i)=>{const r=(Wie(t,e,{_f:{}})._f||{}).ref,o=Wie(n.errors,e)||{},{ref:s,message:l,type:u,...c}=o;Yie(n.errors,e,{...c,...a,ref:r}),m.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&r&&r.focus&&r.focus()},z=e=>m.state.subscribe({next:a=>{var t,i,r;i=a.name,r=e.exact,(t=e.name)&&i&&t!==i&&!Cre(t).some((e=>e&&(r?e===i:e.startsWith(i)||i.startsWith(e))))||!((e,a,n,t)=>{n(e);const{name:i,...r}=e;return Tre(r)||Object.keys(r).length>=Object.keys(a).length||Object.keys(r).find((e=>a[e]===(!t||rre)))})(a,e.formState||c,G,e.reRenderRoot)||e.callback({values:{...o},...n,...a})}}).unsubscribe,R=(e,i={})=>{for(const s of e?Cre(e):l.mount)l.mount.delete(s),l.array.delete(s),i.keepValue||(Bre(t,s),Bre(o,s)),!i.keepError&&Bre(n.errors,s),!i.keepDirty&&Bre(n.dirtyFields,s),!i.keepTouched&&Bre(n.touchedFields,s),!i.keepIsValidating&&Bre(n.validatingFields,s),!a.shouldUnregister&&!i.keepDefaultValue&&Bre(r,s);m.state.next({values:Fie(o)}),m.state.next({...n,...i.keepDirty?{isDirty:w()}:{}}),!i.keepIsValid&&v()},_=({disabled:e,name:a})=>{(qie(e)&&s.mount||e||l.disabled.has(a))&&(e?l.disabled.add(a):l.disabled.delete(a))},D=(e,n={})=>{let i=Wie(t,e);const o=qie(n.disabled)||qie(a.disabled);return Yie(t,e,{...i||{},_f:{...i&&i._f?i._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),i?_({disabled:qie(n.disabled)?n.disabled:a.disabled,name:e}):y(e,!0,n.value),{...o?{disabled:n.disabled||a.disabled}:{},...a.progressive?{required:!!n.required,min:Ure(n.min),max:Ure(n.max),minLength:Ure(n.minLength),maxLength:Ure(n.maxLength),pattern:Ure(n.pattern)}:{},name:e,onChange:x,onBlur:x,ref:o=>{if(o){D(e,n),i=Wie(t,e);const a=Uie(o.value)&&o.querySelectorAll&&o.querySelectorAll("input,select,textarea")[0]||o,s=(e=>jre(e)||_ie(e))(a),l=i._f.refs||[];if(s?l.find((e=>e===a)):a===i._f.ref)return;Yie(t,e,{_f:{...i._f,...s?{refs:[...l.filter(Lre),a,...Array.isArray(Wie(r,e))?[{}]:[]],ref:{type:a.type,name:e}}:{ref:a}}}),y(e,!1,void 0,a)}else i=Wie(t,e,{}),i._f&&(i._f.mount=!1),(a.shouldUnregister||n.shouldUnregister)&&(!Gie(l.array,e)||!s.action)&&l.unMount.add(e)}}},K=()=>a.shouldFocusError&&$re(t,E,l.mount),H=(e,i)=>async r=>{let s;r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let u=Fie(o);if(m.state.next({isSubmitting:!0}),a.resolver){const{errors:e,values:a}=await S();n.errors=e,u=a}else await A(t);if(l.disabled.size)for(const e of l.disabled)Yie(u,e,void 0);if(Bre(n.errors,"root"),Tre(n.errors)){m.state.next({errors:{}});try{await e(u,r)}catch(c){s=c}}else i&&await i({...n.errors},r),K(),setTimeout(K);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Tre(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},O=(e,i={})=>{const u=e?Fie(e):r,d=Fie(u),h=Tre(e),p=h?r:d;if(i.keepDefaultValues||(r=u),!i.keepValues){if(i.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Dre(r,o))]);for(const a of Array.from(e))Wie(n.dirtyFields,a)?Yie(p,a,Wie(o,a)):N(a,Wie(p,a))}else{if(Vie&&Uie(e))for(const e of l.mount){const a=Wie(t,e);if(a&&a._f){const e=Array.isArray(a._f.refs)?a._f.refs[0]:a._f.ref;if(Ere(e)){const a=e.closest("form");if(a){a.reset();break}}}}for(const e of l.mount)N(e,Wie(p,e))}o=Fie(p),m.array.next({values:{...p}}),m.state.next({values:{...p}})}l={mount:i.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!c.isValid||!!i.keepIsValid||!!i.keepDirtyValues,s.watch=!!a.shouldUnregister,m.state.next({submitCount:i.keepSubmitCount?n.submitCount:0,isDirty:!h&&(i.keepDirty?n.isDirty:!(!i.keepDefaultValues||fre(e,r))),isSubmitted:!!i.keepIsSubmitted&&n.isSubmitted,dirtyFields:h?{}:i.keepDirtyValues?i.keepDefaultValues&&o?Dre(r,o):n.dirtyFields:i.keepDefaultValues&&e?Dre(r,e):i.keepDirty?n.dirtyFields:{},touchedFields:i.keepTouched?n.touchedFields:{},errors:i.keepErrors?n.errors:{},isSubmitSuccessful:!!i.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},I=(e,a)=>O(xre(e)?e(o):e,a),G=e=>{n={...n,...e}},V={control:{register:D,unregister:R,getFieldState:L,handleSubmit:H,setError:B,_subscribe:z,_runSchema:S,_getWatch:C,_getDirty:w,_setValid:v,_setFieldArray:(e,i=[],l,u,h=!0,p=!0)=>{if(u&&l&&!a.disabled){if(s.action=!0,p&&Array.isArray(Wie(t,e))){const a=l(Wie(t,e),u.argA,u.argB);h&&Yie(t,e,a)}if(p&&Array.isArray(Wie(n.errors,e))){const a=l(Wie(n.errors,e),u.argA,u.argB);h&&Yie(n.errors,e,a),((e,a)=>{!Jie(Wie(e,a)).length&&Bre(e,a)})(n.errors,e)}if((c.touchedFields||d.touchedFields)&&p&&Array.isArray(Wie(n.touchedFields,e))){const a=l(Wie(n.touchedFields,e),u.argA,u.argB);h&&Yie(n.touchedFields,e,a)}(c.dirtyFields||d.dirtyFields)&&(n.dirtyFields=Dre(r,o)),m.state.next({name:e,isDirty:w(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Yie(o,e,i)},_setDisabledField:_,_setErrors:e=>{n.errors=e,m.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Jie(Wie(s.mount?o:r,e,a.shouldUnregister?Wie(r,e,[]):[])),_reset:O,_resetDefaultValues:()=>xre(a.defaultValues)&&a.defaultValues().then((e=>{I(e,a.resetOptions),m.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const a=Wie(t,e);a&&(a._f.refs?a._f.refs.every((e=>!Lre(e))):!Lre(a._f.ref))&&R(e)}l.unMount=new Set},_disableForm:e=>{qie(e)&&(m.state.next({disabled:e}),$re(t,((a,n)=>{const i=Wie(t,n);i&&(a.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach((a=>{a.disabled=i._f.disabled||e})))}),0,!1))},_subjects:m,_proxyFormState:c,get _fields(){return t},get _formValues(){return o},get _state(){return s},set _state(e){s=e},get _defaultValues(){return r},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return a},set _options(e){a={...a,...e}}},subscribe:e=>(s.mount=!0,d={...d,...e.formState},z({...e,formState:d})),trigger:P,register:D,handleSubmit:H,watch:(e,a)=>xre(e)?m.state.subscribe({next:n=>e(C(void 0,a),n)}):C(e,a,!0),setValue:N,getValues:j,reset:I,resetField:(e,a={})=>{Wie(t,e)&&(Uie(a.defaultValue)?N(e,Fie(Wie(r,e))):(N(e,a.defaultValue),Yie(r,e,Fie(a.defaultValue))),a.keepTouched||Bre(n.touchedFields,e),a.keepDirty||(Bre(n.dirtyFields,e),n.isDirty=a.defaultValue?w(e,Fie(Wie(r,e))):w()),a.keepError||(Bre(n.errors,e),c.isValid&&v()),m.state.next({...n}))},clearErrors:e=>{e&&Cre(e).forEach((e=>Bre(n.errors,e))),m.state.next({errors:e?n.errors:{}})},unregister:R,setError:B,setFocus:(e,a={})=>{const n=Wie(t,e),i=n&&n._f;if(i){const e=i.refs?i.refs[0]:i.ref;e.focus&&(e.focus(),a.shouldSelect&&xre(e.select)&&e.select())}},getFieldState:L};return{...V,formControl:V}}const roe="undefined"!=typeof window?a.useLayoutEffect:a.useEffect;function ooe(e={}){const n=a.useRef(void 0),t=a.useRef(void 0),[i,r]=a.useState({isDirty:!1,isValidating:!1,isLoading:xre(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:xre(e.defaultValues)?void 0:e.defaultValues});n.current||(n.current={...e.formControl?e.formControl:ioe(e),formState:i},e.formControl&&e.defaultValues&&!xre(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const o=n.current.control;return o._options=e,roe((()=>{const e=o._subscribe({formState:o._proxyFormState,callback:()=>r({...o._formState}),reRenderRoot:!0});return r((e=>({...e,isReady:!0}))),e}),[o]),a.useEffect((()=>o._disableForm(e.disabled)),[o,e.disabled]),a.useEffect((()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode),e.errors&&!Tre(e.errors)&&o._setErrors(e.errors)}),[o,e.errors,e.mode,e.reValidateMode]),a.useEffect((()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})}),[o,e.shouldUnregister]),a.useEffect((()=>{if(o._proxyFormState.isDirty){const e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}}),[o,i.isDirty]),a.useEffect((()=>{e.values&&!fre(e.values,t.current)?(o._reset(e.values,o._options.resetOptions),t.current=e.values,r((e=>({...e})))):o._resetDefaultValues()}),[o,e.values]),a.useEffect((()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()})),n.current.formState=gre(i,o),n.current}const soe=(e,a,n)=>{if(e&&"reportValidity"in e){const t=Wie(n,a);e.setCustomValidity(t&&t.message||""),e.reportValidity()}},loe=(e,a)=>{for(const n in a.fields){const t=a.fields[n];t&&t.ref&&"reportValidity"in t.ref?soe(t.ref,n,e):t.refs&&t.refs.forEach((a=>soe(a,n,e)))}},uoe=(e,a)=>{a.shouldUseNativeValidation&&loe(e,a);const n={};for(const t in e){const i=Wie(a.fields,t),r=Object.assign(e[t]||{},{ref:i&&i.ref});if(coe(a.names||Object.keys(e),t)){const e=Object.assign({},Wie(n,t));Yie(e,"root",r),Yie(n,t,e)}else Yie(n,t,r)}return n},coe=(e,a)=>e.some((e=>e.startsWith(a+".")));var doe=function(e,a){for(var n={};e.length;){var t=e[0],i=t.code,r=t.message,o=t.path.join(".");if(!n[o])if("unionErrors"in t){var s=t.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:r,type:i};if("unionErrors"in t&&t.unionErrors.forEach((function(a){return a.errors.forEach((function(a){return e.push(a)}))})),a){var l=n[o].types,u=l&&l[t.code];n[o]=wre(o,a,n,i,u?[].concat(u,t.message):t.message)}e.shift()}return n},moe=function(e,a,n){return void 0===n&&(n={}),function(t,i,r){try{return Promise.resolve(function(i,o){try{var s=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](t,a)).then((function(e){return r.shouldUseNativeValidation&&loe({},r),{errors:{},values:n.raw?t:e}}))}catch(tje){return o(tje)}return s&&s.then?s.then(void 0,o):s}(0,(function(e){if(a=e,Array.isArray(null==a?void 0:a.errors))return{values:{},errors:uoe(doe(e.errors,!r.shouldUseNativeValidation&&"all"===r.criteriaMode),r)};var a;throw e})))}catch(tje){return Promise.reject(tje)}}};const hoe=e=>{const{children:n,...t}=e;return a.createElement(hre.Provider,{value:t},n)},poe=r.createContext({}),goe=({...e})=>n.jsx(poe.Provider,{value:{name:e.name},children:n.jsx(Are,{...e})}),voe=()=>{const e=r.useContext(poe),a=r.useContext(foe),{getFieldState:n,formState:t}=pre(),i=n(e.name,t);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:o}=a;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},foe=r.createContext({}),yoe=r.forwardRef((({className:e,...a},t)=>{const i=r.useId();return n.jsx(foe.Provider,{value:{id:i},children:n.jsx("div",{ref:t,className:im("space-y-2",e),...a})})}));yoe.displayName="FormItem";const koe=r.forwardRef((({className:e,...a},t)=>{const{error:i,formItemId:r}=voe();return n.jsx(Kae,{ref:t,className:im(i&&"text-destructive",e),htmlFor:r,...a})}));koe.displayName="FormLabel";const boe=r.forwardRef((({...e},a)=>{const{error:t,formItemId:i,formDescriptionId:r,formMessageId:o}=voe();return n.jsx(iO,{ref:a,id:i,"aria-describedby":t?`${r} ${o}`:`${r}`,"aria-invalid":!!t,...e})}));boe.displayName="FormControl";r.forwardRef((({className:e,...a},t)=>{const{formDescriptionId:i}=voe();return n.jsx("p",{ref:t,id:i,className:im("text-[0.8rem] text-muted-foreground",e),...a})})).displayName="FormDescription";const Soe=r.forwardRef((({className:e,children:a,...t},i)=>{const{error:r,formMessageId:o}=voe(),s=r?String(r?.message):a;return s?n.jsx("p",{ref:i,id:o,className:im("text-[0.8rem] font-medium text-destructive",e),...t,children:s}):null}));Soe.displayName="FormMessage";const Aoe=({title:e,description:a,children:t})=>n.jsxs("div",{className:"text-left",children:[n.jsx("h3",{className:"text-lg font-medium text-foreground mb-1",children:e}),n.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:a}),n.jsx("div",{className:"space-y-4",children:t})]}),woe=cee,Coe=({control:e,name:a,label:t,placeholder:i,type:r="text",disabled:o})=>n.jsx(goe,{control:e,name:a,render:({field:e})=>n.jsxs(yoe,{children:[n.jsx(koe,{className:"text-sm font-medium",children:t}),n.jsx(boe,{children:n.jsx(o4,{...e,value:"number"===r?e.value||"":e.value,type:r,placeholder:i,className:"h-10",disabled:o,onChange:a=>{if("number"===r){const n=""===a.target.value?"":Number(a.target.value);e.onChange(n)}else e.onChange(a)}})}),n.jsx(Soe,{})]})}),Moe=({isSubmitting:e,onSubmit:a})=>{const t=ooe({resolver:moe(woe),defaultValues:{type:see.AWS_TOLL_FREE_NUMBER,tollFreeNumber:"",company:{name:"",website:"",address1:"",address2:"",city:"",stateProvince:"",zipCode:"",country:""},contact:{firstName:"",lastName:"",email:"",phoneNumber:""},messagingUseCase:{monthlyVolume:0,category:lee.PROMOTIONS_MARKETING,useCaseDetails:""},messageSamples:[""]},values:void 0}),i=t.watch("messageSamples");return n.jsx("div",{className:"w-full max-w-4xl",children:n.jsx(hoe,{...t,children:n.jsxs("form",{onSubmit:t.handleSubmit((async e=>{const n={...e,messagingUseCase:{...e.messagingUseCase,monthlyVolume:Number(e.messagingUseCase.monthlyVolume)}};await a(n)})),className:"space-y-6",children:[n.jsxs(Aoe,{title:"Legal business settings",description:"Provide your legal business information required for SMS channel verification and future communications.",children:[n.jsx(Coe,{control:t.control,name:"company.name",label:"Business Name",placeholder:"Enter your business name",disabled:e}),n.jsx(Coe,{control:t.control,name:"company.website",label:"Business Website",placeholder:"https://example.com",type:"url",disabled:e}),n.jsxs("div",{children:[n.jsx(koe,{className:"text-sm font-medium",children:"Business Address"}),n.jsxs("div",{className:"grid grid-cols-1 gap-3 mt-2",children:[n.jsx(Coe,{control:t.control,name:"company.address1",placeholder:"Street address",disabled:e}),n.jsx(Coe,{control:t.control,name:"company.address2",placeholder:"Apartment, suite, unit, etc. (optional)",disabled:e}),n.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[n.jsx(Coe,{control:t.control,name:"company.city",placeholder:"City",disabled:e}),n.jsx(Coe,{control:t.control,name:"company.stateProvince",placeholder:"State/Province",disabled:e}),n.jsx(Coe,{control:t.control,name:"company.zipCode",placeholder:"ZIP code",disabled:e})]}),n.jsx(Coe,{control:t.control,name:"company.country",placeholder:"Country code (e.g., US)",disabled:e})]})]})]}),n.jsxs(Aoe,{title:"Contact Information",description:"Provide the contact information of the person authorized to represent your business.",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(Coe,{control:t.control,name:"contact.firstName",label:"First Name",placeholder:"First name",disabled:e}),n.jsx(Coe,{control:t.control,name:"contact.lastName",label:"Last Name",placeholder:"Last name",disabled:e})]}),n.jsx(Coe,{control:t.control,name:"contact.email",label:"Email",placeholder:"Email address",type:"email",disabled:e}),n.jsx(Coe,{control:t.control,name:"contact.phoneNumber",label:"Contact Phone",placeholder:"+1234567890",type:"tel",disabled:e})]}),n.jsxs(Aoe,{title:"Messaging Use Case",description:"Tell us about how you plan to use SMS messaging.",children:[n.jsx(Coe,{control:t.control,name:"messagingUseCase.monthlyVolume",label:"Expected Monthly Volume",placeholder:"1000",type:"number",disabled:e}),n.jsx(Coe,{control:t.control,name:"messagingUseCase.useCaseDetails",label:"Use Case Details",placeholder:"Describe your use case in detail",disabled:e})]}),n.jsxs(Aoe,{title:"Message Samples",description:"Provide examples of messages you plan to send (up to 3 samples).",children:[n.jsx(aV,{children:i.map(((a,r)=>n.jsxs(H$.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2},className:"relative",children:[n.jsx(Coe,{control:t.control,name:`messageSamples.${r}`,label:`Sample Message ${r+1}`,placeholder:"Enter a sample message",disabled:e}),i.length>1&&n.jsx(H$.button,{type:"button",onClick:()=>(e=>{if(i.length>1){const a=i.filter(((a,n)=>n!==e));t.setValue("messageSamples",a)}})(r),className:"absolute -right-2 -top-2 rounded-full bg-red-100 p-1 text-red-600 hover:bg-red-200",whileHover:{scale:1.1},whileTap:{scale:.9},children:n.jsx(RY.CloseButton,{className:"h-4 w-4"})})]},r)))}),i.length<3&&n.jsxs(H$.button,{type:"button",onClick:()=>{i.length<3&&t.setValue("messageSamples",[...i,""])},className:"mt-4 flex items-center gap-2 rounded-lg border border-dashed border-gray-300 px-4 py-2 text-sm text-gray-600 hover:border-gray-400 hover:text-gray-700",whileHover:{scale:1.02},whileTap:{scale:.98},children:[n.jsx(RY.PlusIcon,{className:"h-4 w-4"}),"Add another sample"]})]}),n.jsx("div",{className:"flex gap-3 pt-4 justify-end",children:n.jsx(jY,{type:"submit",disabled:e,children:e?"Submitting...":"Submit for approval"})})]})})})},Toe=()=>{const[e,t]=a.useState(!1),{data:i,isLoading:r}=L9(),{createSmsRegistrationApplication:o,isCreating:s}=B9(),{toast:l}=Ie();if(!i||r)return n.jsx("div",{className:"flex flex-col items-center justify-center p-8",children:n.jsx(xY,{text:["Loading business information..."]})});const u={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.4,0,.2,1]}}},c=i&&i.status===dee.PENDING;return n.jsxs(H$.div,{initial:"hidden",animate:"visible",exit:"exit",variants:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.4,0,.2,1],staggerChildren:.1}},exit:{opacity:0,y:-20,transition:{duration:.3,ease:[.4,0,1,1]}}},className:im("flex flex-col items-center text-center w-full max-w-[72ch] rounded-xl p-6 gap-3 border border-border mx-auto mb-16","bg-background"),children:[n.jsx(H$.div,{variants:u,className:"w-16 h-16 rounded-xl flex items-center justify-center",children:n.jsx(RY.SmsIcon,{})}),n.jsx(H$.h2,{variants:u,className:"text-sm font-medium text-foreground",children:"Request your SMS sending number"}),n.jsxs(H$.div,{variants:u,className:"max-w-xl mx-auto",children:[n.jsx("p",{className:"text-sm font-normal text-muted-foreground mb-2",children:"Before you can send messages, we need to verify your business info with our SMS provider. Once approved, we'll assign you a phone number to send SMS campaigns."}),n.jsx("p",{className:"text-sm font-normal text-muted-foreground",children:"This usually takes 3-7 business days."})]}),n.jsx(aV,{mode:"wait",children:e?n.jsx(H$.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.3,ease:[.4,0,.2,1]},className:"w-full",children:n.jsx(Moe,{isSubmitting:s,onSubmit:async e=>{try{o({application:e},{onSuccess:()=>{l({title:"SMS setup submission successful"}),t(!1)},onError:()=>{l({title:"SMS setup submission failed",description:"Please contact your administrator."})}})}catch(a){}}})},"form"):c?n.jsxs(H$.div,{variants:u,className:"flex items-center gap-2 px-3 py-1.5 bg-orange-50 border border-orange-200 rounded-full",children:[n.jsx(H$.div,{animate:{scale:[1,1.2,1],opacity:[1,.8,1]},transition:{duration:2,repeat:Number.POSITIVE_INFINITY,ease:"easeInOut"},className:"w-2 h-2 bg-orange-500 rounded-full"}),n.jsx("span",{className:"text-sm font-medium text-orange-800",children:"Pending approval"})]},"pending"):n.jsx(H$.div,{variants:u,children:n.jsx(jY,{variant:"outline",className:"bg-background",onClick:()=>t(!0),children:"Request approval"})},"button")})]})},Noe=async()=>(await Pe(s)).data,xoe=["me"],Eoe=()=>ye({queryKey:xoe,queryFn:Noe,...we}),Poe=()=>{const e=ce(),a=Eoe(),n=ke({mutationFn:e=>(async e=>(await Pe(s,{method:"PATCH",body:JSON.stringify({website:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:xoe})}}),t=ke({mutationFn:e=>(async e=>(await Pe(s,{method:"PATCH",body:JSON.stringify({locations:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:xoe})}}),i=ke({mutationFn:e=>(async e=>(await Pe(s,{method:"PATCH",body:JSON.stringify({branding:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:xoe})}});return{data:a.data,isLoading:a.isLoading,error:a.error,refetch:a.refetch,updateWebsite:n.mutate,updateLocations:t.mutate,updateBrandSettings:i.mutate,isUpdatingWebsite:n.isPending,isUpdatingLocations:t.isPending,isUpdatingBrandSettings:i.isPending}},joe="undefined"!=typeof window&&"undefined"!=typeof document;var Loe=.999,Boe=/[\\\/_+.#"@\[\(\{&]/,zoe=/[\\\/_+.#"@\[\(\{&]/g,Roe=/[\s-]/,_oe=/[\s-]/g;function Doe(e,a,n,t,i,r,o){if(r===a.length)return i===e.length?1:.99;var s=`${i},${r}`;if(void 0!==o[s])return o[s];for(var l,u,c,d,m=t.charAt(r),h=n.indexOf(m,i),p=0;h>=0;)(l=Doe(e,a,n,t,h+1,r+1,o))>p&&(h===i?l*=1:Boe.test(e.charAt(h-1))?(l*=.8,(c=e.slice(i,h-1).match(zoe))&&i>0&&(l*=Math.pow(Loe,c.length))):Roe.test(e.charAt(h-1))?(l*=.9,(d=e.slice(i,h-1).match(_oe))&&i>0&&(l*=Math.pow(Loe,d.length))):(l*=.17,i>0&&(l*=Math.pow(Loe,h-i))),e.charAt(h)!==a.charAt(r)&&(l*=.9999)),(l<.1&&n.charAt(h-1)===t.charAt(r+1)||t.charAt(r+1)===t.charAt(r)&&n.charAt(h-1)!==t.charAt(r))&&(.1*(u=Doe(e,a,n,t,h+1,r+2,o))>l&&(l=.1*u)),l>p&&(p=l),h=n.indexOf(m,h+1);return o[s]=p,p}function Koe(e){return e.toLowerCase().replace(_oe," ")}function Hoe(e,a,n){return Doe(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,a,Koe(e),Koe(a),0,0,{})}var Ooe,Ioe={exports:{}},Goe={};var Voe,Foe={};
86
86
  /**
87
87
  * @license React
88
88
  * use-sync-external-store-shim.development.js
@@ -91,7 +91,7 @@ function QQ(e,a){return e?function(e){return"function"==typeof e&&(()=>{const a=
91
91
  *
92
92
  * This source code is licensed under the MIT license found in the
93
93
  * LICENSE file in the root directory of this source tree.
94
- */Ioe.exports="production"===process.env.NODE_ENV?function(){if(Ooe)return Goe;Ooe=1;var e="function"==typeof Object.is?Object.is:function(e,a){return e===a&&(0!==e||1/e==1/a)||e!=e&&a!=a},n=a.useState,t=a.useEffect,i=a.useLayoutEffect,r=a.useDebugValue;function o(a){var n=a.getSnapshot;a=a.value;try{var t=n();return!e(a,t)}catch(i){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,a){return a()}:function(e,a){var s=a(),l=n({inst:{value:s,getSnapshot:a}}),u=l[0].inst,c=l[1];return i((function(){u.value=s,u.getSnapshot=a,o(u)&&c({inst:u})}),[e,s,a]),t((function(){return o(u)&&c({inst:u}),e((function(){o(u)&&c({inst:u})}))}),[e]),r(s),s};return Goe.useSyncExternalStore=void 0!==a.useSyncExternalStore?a.useSyncExternalStore:s,Goe}():(Voe||(Voe=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var a=e.getSnapshot;e=e.value;try{var n=a();return!t(e,n)}catch(i){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=a,t="function"==typeof Object.is?Object.is:function(e,a){return e===a&&(0!==e||1/e==1/a)||e!=e&&a!=a},i=n.useState,r=n.useEffect,o=n.useLayoutEffect,s=n.useDebugValue,l=!1,u=!1,c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,a){return a()}:function(a,c){l||void 0===n.startTransition||(l=!0);var d=c();if(!u){var m=c();t(d,m)||(u=!0)}var h=(m=i({inst:{value:d,getSnapshot:c}}))[0].inst,p=m[1];return o((function(){h.value=d,h.getSnapshot=c,e(h)&&p({inst:h})}),[a,d,c]),r((function(){return e(h)&&p({inst:h}),a((function(){e(h)&&p({inst:h})}))}),[a]),s(d),d};Foe.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Foe);var Joe=Ioe.exports,Uoe='[cmdk-group=""]',Woe='[cmdk-group-items=""]',qoe='[cmdk-item=""]',Zoe=`${qoe}:not([aria-disabled="true"])`,$oe="cmdk-item-select",Yoe="data-value",Qoe=(e,a,n)=>Hoe(e,a,n),Xoe=r.createContext(void 0),ese=()=>r.useContext(Xoe),ase=r.createContext(void 0),nse=()=>r.useContext(ase),tse=r.createContext(void 0),ise=r.forwardRef(((e,a)=>{let n=yse((()=>{var a,n;return{search:"",value:null!=(n=null!=(a=e.value)?a:e.defaultValue)?n:"",filtered:{count:0,items:new Map,groups:new Set}}})),t=yse((()=>new Set)),i=yse((()=>new Map)),o=yse((()=>new Map)),s=yse((()=>new Set)),l=vse(e),{label:u,children:c,value:d,onValueChange:m,filter:h,shouldFilter:p,loop:g,disablePointerSelection:v=!1,vimBindings:f=!0,...y}=e,k=HX(),b=HX(),S=HX(),A=r.useRef(null),w=Ase();fse((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,C.emit()}}),[d]),fse((()=>{w(6,P)}),[]);let C=r.useMemo((()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,a,t)=>{var i,r,o;if(!Object.is(n.current[e],a)){if(n.current[e]=a,"search"===e)E(),N(),w(1,x);else if("value"===e&&(t||w(5,P),void 0!==(null==(i=l.current)?void 0:i.value))){return void(null==(o=(r=l.current).onValueChange)||o.call(r,null!=a?a:""))}C.emit()}},emit:()=>{s.current.forEach((e=>e()))}})),[]),M=r.useMemo((()=>({value:(e,a,t)=>{var i;a!==(null==(i=o.current.get(e))?void 0:i.value)&&(o.current.set(e,{value:a,keywords:t}),n.current.filtered.items.set(e,T(a,t)),w(2,(()=>{N(),C.emit()})))},item:(e,a)=>(t.current.add(e),a&&(i.current.has(a)?i.current.get(a).add(e):i.current.set(a,new Set([e]))),w(3,(()=>{E(),N(),n.current.value||x(),C.emit()})),()=>{o.current.delete(e),t.current.delete(e),n.current.filtered.items.delete(e);let a=j();w(4,(()=>{E(),(null==a?void 0:a.getAttribute("id"))===e&&x(),C.emit()}))}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{o.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:k,inputId:S,labelId:b,listInnerRef:A})),[]);function T(e,a){var t,i;let r=null!=(i=null==(t=l.current)?void 0:t.filter)?i:Qoe;return e?r(e,n.current.search,a):0}function N(){if(!n.current.search||!1===l.current.shouldFilter)return;let e=n.current.filtered.items,a=[];n.current.filtered.groups.forEach((n=>{let t=i.current.get(n),r=0;t.forEach((a=>{let n=e.get(a);r=Math.max(n,r)})),a.push([n,r])}));let t=A.current;L().sort(((a,n)=>{var t,i;let r=a.getAttribute("id"),o=n.getAttribute("id");return(null!=(t=e.get(o))?t:0)-(null!=(i=e.get(r))?i:0)})).forEach((e=>{let a=e.closest(Woe);a?a.appendChild(e.parentElement===a?e:e.closest(`${Woe} > *`)):t.appendChild(e.parentElement===t?e:e.closest(`${Woe} > *`))})),a.sort(((e,a)=>a[1]-e[1])).forEach((e=>{var a;let n=null==(a=A.current)?void 0:a.querySelector(`${Uoe}[${Yoe}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function x(){let e=L().find((e=>"true"!==e.getAttribute("aria-disabled"))),a=null==e?void 0:e.getAttribute(Yoe);C.setState("value",a||void 0)}function E(){var e,a,r,s;if(!n.current.search||!1===l.current.shouldFilter)return void(n.current.filtered.count=t.current.size);n.current.filtered.groups=new Set;let u=0;for(let i of t.current){let t=T(null!=(a=null==(e=o.current.get(i))?void 0:e.value)?a:"",null!=(s=null==(r=o.current.get(i))?void 0:r.keywords)?s:[]);n.current.filtered.items.set(i,t),t>0&&u++}for(let[t,o]of i.current)for(let e of o)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(t);break}n.current.filtered.count=u}function P(){var e,a,n;let t=j();t&&((null==(e=t.parentElement)?void 0:e.firstChild)===t&&(null==(n=null==(a=t.closest(Uoe))?void 0:a.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),t.scrollIntoView({block:"nearest"}))}function j(){var e;return null==(e=A.current)?void 0:e.querySelector(`${qoe}[aria-selected="true"]`)}function L(){var e;return Array.from((null==(e=A.current)?void 0:e.querySelectorAll(Zoe))||[])}function B(e){let a=L()[e];a&&C.setState("value",a.getAttribute(Yoe))}function z(e){var a;let n=j(),t=L(),i=t.findIndex((e=>e===n)),r=t[i+e];null!=(a=l.current)&&a.loop&&(r=i+e<0?t[t.length-1]:i+e===t.length?t[0]:t[i+e]),r&&C.setState("value",r.getAttribute(Yoe))}function R(e){let a,n=j(),t=null==n?void 0:n.closest(Uoe);for(;t&&!a;)t=e>0?pse(t,Uoe):gse(t,Uoe),a=null==t?void 0:t.querySelector(Zoe);a?C.setState("value",a.getAttribute(Yoe)):z(e)}let _=()=>B(L().length-1),D=e=>{e.preventDefault(),e.metaKey?_():e.altKey?R(1):z(1)},K=e=>{e.preventDefault(),e.metaKey?B(0):e.altKey?R(-1):z(-1)};return r.createElement(uX.div,{ref:a,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var a;if(null==(a=y.onKeyDown)||a.call(y,e),!e.defaultPrevented)switch(e.key){case"n":case"j":f&&e.ctrlKey&&D(e);break;case"ArrowDown":D(e);break;case"p":case"k":f&&e.ctrlKey&&K(e);break;case"ArrowUp":K(e);break;case"Home":e.preventDefault(),B(0);break;case"End":e.preventDefault(),_();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let a=j();if(a){let e=new Event($oe);a.dispatchEvent(e)}}}}},r.createElement("label",{"cmdk-label":"",htmlFor:M.inputId,id:M.labelId,style:Cse},u),wse(e,(e=>r.createElement(ase.Provider,{value:C},r.createElement(Xoe.Provider,{value:M},e)))))})),rse=r.forwardRef(((e,a)=>{var n,t;let i=HX(),o=r.useRef(null),s=r.useContext(tse),l=ese(),u=vse(e),c=null!=(t=null==(n=u.current)?void 0:n.forceMount)?t:null==s?void 0:s.forceMount;fse((()=>{if(!c)return l.item(i,null==s?void 0:s.id)}),[c]);let d=Sse(i,o,[e.value,e.children,o],e.keywords),m=nse(),h=bse((e=>e.value&&e.value===d.current)),p=bse((e=>!(!c&&!1!==l.filter())||(!e.search||e.filtered.items.get(i)>0)));function g(){var e,a;v(),null==(a=(e=u.current).onSelect)||a.call(e,d.current)}function v(){m.setState("value",d.current,!0)}if(r.useEffect((()=>{let a=o.current;if(a&&!e.disabled)return a.addEventListener($oe,g),()=>a.removeEventListener($oe,g)}),[p,e.onSelect,e.disabled]),!p)return null;let{disabled:f,value:y,onSelect:k,forceMount:b,keywords:S,...A}=e;return r.createElement(uX.div,{ref:kse([o,a]),...A,id:i,"cmdk-item":"",role:"option","aria-disabled":!!f,"aria-selected":!!h,"data-disabled":!!f,"data-selected":!!h,onPointerMove:f||l.getDisablePointerSelection()?void 0:v,onClick:f?void 0:g},e.children)})),ose=r.forwardRef(((e,a)=>{let{heading:n,children:t,forceMount:i,...o}=e,s=HX(),l=r.useRef(null),u=r.useRef(null),c=HX(),d=ese(),m=bse((e=>!(!i&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));fse((()=>d.group(s)),[]),Sse(s,l,[e.value,e.heading,u]);let h=r.useMemo((()=>({id:s,forceMount:i})),[i]);return r.createElement(uX.div,{ref:kse([l,a]),...o,"cmdk-group":"",role:"presentation",hidden:!m||void 0},n&&r.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),wse(e,(e=>r.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},r.createElement(tse.Provider,{value:h},e)))))})),sse=r.forwardRef(((e,a)=>{let{alwaysRender:n,...t}=e,i=r.useRef(null),o=bse((e=>!e.search));return n||o?r.createElement(uX.div,{ref:kse([i,a]),...t,"cmdk-separator":"",role:"separator"}):null})),lse=r.forwardRef(((e,a)=>{let{onValueChange:n,...t}=e,i=null!=e.value,o=nse(),s=bse((e=>e.search)),l=bse((e=>e.value)),u=ese(),c=r.useMemo((()=>{var e;let a=null==(e=u.listInnerRef.current)?void 0:e.querySelector(`${qoe}[${Yoe}="${encodeURIComponent(l)}"]`);return null==a?void 0:a.getAttribute("id")}),[]);return r.useEffect((()=>{null!=e.value&&o.setState("search",e.value)}),[e.value]),r.createElement(uX.input,{ref:a,...t,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":c,id:u.inputId,type:"text",value:i?e.value:s,onChange:e=>{i||o.setState("search",e.target.value),null==n||n(e.target.value)}})})),use=r.forwardRef(((e,a)=>{let{children:n,label:t="Suggestions",...i}=e,o=r.useRef(null),s=r.useRef(null),l=ese();return r.useEffect((()=>{if(s.current&&o.current){let e,a=s.current,n=o.current,t=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{n.style.setProperty("--cmdk-list-height",a.offsetHeight.toFixed(1)+"px")}))}));return t.observe(a),()=>{cancelAnimationFrame(e),t.unobserve(a)}}}),[]),r.createElement(uX.div,{ref:kse([o,a]),...i,"cmdk-list":"",role:"listbox","aria-label":t,id:l.listId},wse(e,(e=>r.createElement("div",{ref:kse([s,l.listInnerRef]),"cmdk-list-sizer":""},e))))})),cse=r.forwardRef(((e,a)=>{let{open:n,onOpenChange:t,overlayClassName:i,contentClassName:o,container:s,...l}=e;return r.createElement(MG,{open:n,onOpenChange:t},r.createElement(TG,{container:s},r.createElement(NG,{"cmdk-overlay":"",className:i}),r.createElement(xG,{"aria-label":e.label,"cmdk-dialog":"",className:o},r.createElement(ise,{ref:a,...l}))))})),dse=r.forwardRef(((e,a)=>bse((e=>0===e.filtered.count))?r.createElement(uX.div,{ref:a,...e,"cmdk-empty":"",role:"presentation"}):null)),mse=r.forwardRef(((e,a)=>{let{progress:n,children:t,label:i="Loading...",...o}=e;return r.createElement(uX.div,{ref:a,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},wse(e,(e=>r.createElement("div",{"aria-hidden":!0},e))))})),hse=Object.assign(ise,{List:use,Item:rse,Input:lse,Group:ose,Separator:sse,Dialog:cse,Empty:dse,Loading:mse});function pse(e,a){let n=e.nextElementSibling;for(;n;){if(n.matches(a))return n;n=n.nextElementSibling}}function gse(e,a){let n=e.previousElementSibling;for(;n;){if(n.matches(a))return n;n=n.previousElementSibling}}function vse(e){let a=r.useRef(e);return fse((()=>{a.current=e})),a}var fse="undefined"==typeof window?r.useEffect:r.useLayoutEffect;function yse(e){let a=r.useRef();return void 0===a.current&&(a.current=e()),a}function kse(e){return a=>{e.forEach((e=>{"function"==typeof e?e(a):null!=e&&(e.current=a)}))}}function bse(e){let a=nse(),n=()=>e(a.snapshot());return Joe.useSyncExternalStore(a.subscribe,n,n)}function Sse(e,a,n,t=[]){let i=r.useRef(),o=ese();return fse((()=>{var r;let s=(()=>{var e;for(let a of n){if("string"==typeof a)return a.trim();if("object"==typeof a&&"current"in a)return a.current?null==(e=a.current.textContent)?void 0:e.trim():i.current}})(),l=t.map((e=>e.trim()));o.value(e,s,l),null==(r=a.current)||r.setAttribute(Yoe,s),i.current=s})),i}var Ase=()=>{let[e,a]=r.useState(),n=yse((()=>new Map));return fse((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,t)=>{n.current.set(e,t),a({})}};function wse({asChild:e,children:a},n){return e&&r.isValidElement(a)?r.cloneElement(function(e){let a=e.type;return"function"==typeof a?a(e.props):"render"in a?a.render(e.props):e}(a),{ref:a.ref},n(a.props.children)):n(a)}var Cse={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Mse=r.forwardRef((({className:e,...a},t)=>n.jsx(hse,{ref:t,className:im("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...a})));Mse.displayName=hse.displayName;const Tse=r.forwardRef((({className:e,searchIcon:a,...t},i)=>n.jsxs("div",{className:"flex items-center border-b px-3",children:[a||n.jsx($c,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),n.jsx(hse.Input,{ref:i,className:im("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})));Tse.displayName=hse.Input.displayName;const Nse=r.forwardRef((({className:e,...a},t)=>n.jsx(hse.List,{ref:t,className:im("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...a})));Nse.displayName=hse.List.displayName;const xse=r.forwardRef(((e,a)=>n.jsx(hse.Empty,{ref:a,className:"py-6 text-center text-sm",...e})));xse.displayName=hse.Empty.displayName;const Ese=r.forwardRef((({className:e,...a},t)=>n.jsx(hse.Group,{ref:t,className:im("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...a})));Ese.displayName=hse.Group.displayName;r.forwardRef((({className:e,...a},t)=>n.jsx(hse.Separator,{ref:t,className:im("-mx-1 h-px bg-border",e),...a}))).displayName=hse.Separator.displayName;const Pse=r.forwardRef((({className:e,...a},t)=>n.jsx(hse.Item,{ref:t,className:im("relative flex cursor-pointer gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...a})));Pse.displayName=hse.Item.displayName;const jse=r.forwardRef((({className:e,...a},t)=>n.jsx("textarea",{className:im("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:t,...a})));jse.displayName="Textarea";const Lse=e=>{const{companyName:a,smsBody:n}=e;return a&&n?`${a}:\n${n}`:n??""},Bse=({body:e,imageUrls:a})=>n.jsx("div",{className:"sms-preview-outer @container",children:n.jsxs("div",{className:"sms-phone-mockup",children:[n.jsx("div",{className:"sms-phone-notch"}),n.jsxs("div",{className:"sms-phone-inner",children:[a&&a.length>0&&a.map(((e,a)=>n.jsx("div",{className:"sms-message-row",children:n.jsx("div",{className:"sms-message-bubble",children:n.jsx("img",{src:e,alt:"MMS attachment",className:"sms-message-image",loading:"lazy"})})},e+a))),n.jsx("div",{className:"sms-message-row",children:n.jsx("div",{className:"sms-message-bubble",children:e})})]}),n.jsx("div",{className:"sms-phone-home-indicator"})]})}),zse=({mergeFieldsResponse:e})=>{const t=1500,i=wY(),r=CY(),{data:o}=L9(),s=a.useCallback((()=>{const e=i?.actionData?.find((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId===r?.id));return e?.actionMetadata.communicationGroupId}),[i?.actionData,r?.id]),{channelSenders:l}=x9(),{data:u,isLoading:c}=Eoe(),{channelAccounts:d}=M9(),{toast:m}=Ie(),{updateCommunicationGroup:h,isUpdating:p}=lY(),[g,v]=a.useState(null),[f,y]=a.useState(!1),[k,b]=a.useState(null),[S,A]=a.useState(null),[w,C]=a.useState([]),[M,T]=a.useState(null),[N,x]=a.useState(!1),[E,P]=a.useState(!1),j=a.useRef(null),L=a.useRef(null),[B,z]=a.useState(null),[R,_]=a.useState(null),[D,K]=a.useState(!1),H=a.useMemo((()=>mee({channelSenders:l?.results??[],channelAccounts:d?.results??[],smsApplication:o})),[l,d,o]);a.useEffect((()=>{N&&(T(S),w.length>0&&!B&&!D&&z(w[0]))}),[N,S,w,B,D]),a.useEffect((()=>{N||(z(w.length>0?w[0]:null),_(null),K(!1))}),[N,w]);a.useEffect((()=>{r&&(v(r.smsChannelSenderId),A(r.smsMessageBody),r.textMessageCompanyName&&b(r.textMessageCompanyName),r.textMessageMediaUrls&&C(r.textMessageMediaUrls))}),[r]);a.useEffect((()=>{void 0!==l&&(g||H?.[0]&&(v(H[0].channelSender.id),r?.id&&h({groupId:r.id,params:{smsChannelSenderId:H[0].channelSender.id}})))}),[l,g,r?.id,h,o,d?.results,r?.emailChannelSenderId,H]),a.useEffect((()=>{k||!u?.name||f||(y(!0),b(u.name))}),[k,u?.name,f]);return d&&l&&!c&&void 0!==H&&void 0!==o?0===H?.length&&o?.status!==dee.PENDING?n.jsx(Toe,{}):n.jsxs("div",{children:[n.jsx(BG,{open:N,onOpenChange:x,children:n.jsxs(DG,{hideCloseButton:!0,className:"max-w-[50vw]",children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"SMS Editor"}),n.jsx(IG,{children:"Learn more about the SMS editor and how to use it to create your SMS."})]}),n.jsxs("div",{className:"",children:[B&&n.jsx("div",{className:"flex justify-center mb-6",children:n.jsxs("div",{className:"relative group w-fit",children:[n.jsx("img",{src:B,alt:"SMS attachment preview",className:"max-h-48 max-w-xs rounded-xl shadow-lg border border-gray-200 object-contain bg-white transition-transform duration-200 group-hover:scale-105",style:{boxShadow:"0 4px 24px 0 rgba(0,0,0,0.08)"}}),n.jsx(jY,{variant:"ghost",size:"icon",className:"absolute -top-3 -right-3 bg-white/80 hover:bg-red-100 text-gray-500 hover:text-red-500 shadow-md border border-gray-200 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{z(null),_(null),K(!0)},style:{boxShadow:"0 2px 8px 0 rgba(0,0,0,0.10)"},children:n.jsx(cd,{className:"h-4 w-4"})})]})}),n.jsx(jse,{ref:j,className:"min-h-[300px]",placeholder:"Text message content...",value:M??"",onChange:e=>{T(e.target.value)},maxLength:t-(k?.length||0)}),n.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(h9,{modal:!0,open:E,onOpenChange:P,children:[n.jsx(p9,{asChild:!0,children:n.jsx(jY,{variant:"outline",role:"combobox",className:"w-[50px] justify-center",children:n.jsx(RY.MergeField,{className:"w-4 h-4 text-primary"})})}),n.jsx(g9,{className:"w-[300px] p-0",align:"start",children:n.jsxs(Mse,{children:[n.jsx(Tse,{placeholder:"Search merge fields..."}),n.jsxs(Nse,{children:[n.jsx(xse,{children:"No merge fields found."}),e?.mergeFields?.map((e=>n.jsx(Ese,{heading:e.category,children:e.entries.map((e=>n.jsx(Pse,{onSelect:()=>{const a=j.current,n=M||"",t=a?.selectionStart??n.length,i=a?.selectionEnd??n.length,r=n.slice(0,t)+e.value+n.slice(i);T(r),P(!1),setTimeout((()=>{const n=t+e.value.length;a?.focus(),a?.setSelectionRange(n,n)}),0)},children:e.label},e.value)))},e.category)))]})]})})]}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Merge Fields"}),n.jsx(Mae,{title:"Dynamic content is a way to insert dynamic content into your messages such as the customer's name, email, or other details."})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"file",ref:L,onChange:async e=>{const a=e.target.files?.[0];if(a){const e=new FileReader;e.onloadend=async()=>{try{const a=await async function(e){if(!joe)throw new Error("Image conversion is only supported in browser environments");return new Promise(((a,n)=>{try{const t=new window.Image;t.crossOrigin="anonymous",t.onload=()=>{try{const e=document.createElement("canvas");e.width=t.naturalWidth,e.height=t.naturalHeight;const i=e.getContext("2d");if(!i)return void n(new Error("Failed to get canvas context"));i.drawImage(t,0,0);const r=e.toDataURL("image/png",1);a(r)}catch(e){n(e)}},t.onerror=()=>{n(new Error("Failed to load image"))},t.src=e}catch(t){n(t)}}))}(e.result),n=function(e){if(!e.startsWith("data:"))throw new Error('Invalid data URL: must start with "data:"');const a=e.split(",");if(2!==a.length)throw new Error("Invalid data URL format: missing base64 data");if(!a[0].includes(";base64"))throw new Error("Invalid data URL format: missing base64 encoding");return a[1]}(a);_(n),z(a),K(!1)}catch(a){m({title:"Error converting image",description:"Failed to convert image to PNG format",variant:"destructive"})}},e.readAsDataURL(a)}},accept:"image/*",className:"hidden"}),n.jsx(jY,{variant:"outline",onClick:()=>{L.current?.click()},className:"px-4",disabled:w.length>=1||D||null!==R,children:"Add Image"}),n.jsx(jY,{variant:"outline",onClick:()=>{T(S),x(!1),z(w.length>0?w[0]:null),_(null),K(!1)},className:"px-4",children:"Cancel"}),n.jsx(jY,{onClick:()=>{if(M&&M.length>t)return void m({title:"SMS is too long",description:"Please shorten your message"});A(M);const e=s();e&&h({groupId:e,params:{smsChannelSenderId:g,smsMessageBody:M,textMessageCompanyName:k,textMessageMedia:R?[R]:D?[]:void 0}},{onSuccess:()=>{x(!1),z(null),_(null),K(!1)},onError:()=>{m({title:"Error updating SMS",description:"Please contact your administrator"})}})},className:"px-4",disabled:p,children:"Save Changes"})]})]}),n.jsxs("div",{className:"flex justify-end mt-2 text-sm transition-colors duration-300 items-center gap-2 "+(M&&M.length>320?M.length>=t?"text-red-500":"text-amber-500":"text-gray-500"),children:[M?M.length:0,"/",t-(k?.length||0)," characters",M&&M.length>320&&n.jsx(Mae,{title:"The best delivery rates are achieved when the message is 320 characters or less.",onClick:()=>{window.open("https://help.twilio.com/articles/360033806753-Maximum-Message-Length-with-Twilio-Programmable-Messaging","_blank")},link:{url:"https://help.twilio.com/articles/360033806753-Maximum-Message-Length-with-Twilio-Programmable-Messaging",text:"The maximum number of characters for an SMS is 1500. This includes the company name, if you have one, and the merge fields. The recommended limit is 320 characters for best delivery rates. Click to learn more"}})]})]})]})}),n.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx(Kae,{className:"text-foreground",children:"From Number"}),n.jsxs(hie,{onValueChange:e=>{v(e)},value:g??void 0,children:[n.jsx(vie,{children:n.jsx(gie,{placeholder:"Select number",children:g?(O=g,H?.find((e=>e.channelSender.id===O))?.channelSender.channelSenderMetadata.friendlyName??H?.find((e=>e.channelSender.id===O))?.channelSender.channelSenderMetadata.from??O):"Select number"})}),n.jsx(kie,{children:H?.map((e=>n.jsx(bie,{value:e.channelSender.id,children:e.channelSender.channelSenderMetadata.friendlyName??e.channelSender.channelSenderMetadata.from??"Select number"},e.channelSender.id)))})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 py-1",children:[n.jsx(Kae,{className:"text-foreground",children:"Company Name"}),n.jsx(Mae,{title:"Adding your company name can help customers identify who they are talking to"})]}),n.jsx(o4,{placeholder:"Enter company name",value:k??"",className:"text-muted-foreground",onChange:e=>{b(e.target.value??null)},disabled:!g&&!o})]})]}),n.jsxs("div",{className:"border rounded-lg p-4",children:[n.jsxs("div",{className:"flex justify-between items-center mb-4",children:[n.jsx("h3",{className:"font-medium",children:"Preview"}),n.jsx("div",{children:n.jsx(jY,{onClick:()=>x(!0),className:"text-sm px-3 py-1 rounded ",disabled:0===(H?.length??0)&&void 0===o,children:"Edit"})})]}),n.jsx("div",{children:o?g||o?n.jsx(n.Fragment,{children:S?n.jsx(Bse,{body:Lse({companyName:k??void 0,smsBody:S}),imageUrls:w}):n.jsx(Sie,{type:"sms"})}):n.jsx(Cie,{type:"sms"}):n.jsx("div",{children:"Submit an application"})})]})]})]}):n.jsx("div",{children:n.jsx(xY,{text:["Loading..."]})});var O},Rse=()=>{const e=CY(),{getMergeFields:a,isGetting:t}=uY(e?.id??void 0);return t||!a?n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Content..."]})}):n.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:[n.jsx(Bie,{title:"SMS Campaign",type:"sms"}),n.jsx(zse,{mergeFieldsResponse:a})]})},_se=e=>e.friendlyName||e.from||e.messageServiceSid||"Unknown Sender";function Dse(e,a){throw new Error(`Unreachable case statement: ${JSON.stringify(e)}. Valid values are: ${Object.values(a).join(", ")}`)}function Kse(e,a,{checkForDefaultPrevented:n=!0}={}){return function(t){if(e?.(t),!1===n||!t.defaultPrevented)return a?.(t)}}function Hse(e,a=[]){let t=[];const i=()=>{const a=t.map((e=>r.createContext(e)));return function(n){const t=n?.[e]||a;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:t}})),[n,t])}};return i.scopeName=e,[function(a,i){const o=r.createContext(i),s=t.length;t=[...t,i];const l=a=>{const{scope:t,children:i,...l}=a,u=t?.[e]?.[s]||o,c=r.useMemo((()=>l),Object.values(l));return n.jsx(u.Provider,{value:c,children:i})};return l.displayName=a+"Provider",[l,function(n,t){const l=r.useContext(t?.[e]?.[s]||o);if(l)return l;if(void 0!==i)return i;throw new Error(`\`${n}\` must be used within \`${a}\``)}]},Ose(i,...a)]}function Ose(...e){const a=e[0];if(1===e.length)return a;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const t=n.reduce(((a,{useScope:n,scopeName:t})=>({...a,...n(e)[`__scope${t}`]})),{});return r.useMemo((()=>({[`__scope${a.scopeName}`]:t})),[t])}};return n.scopeName=a.scopeName,n}function Ise(e,a){if("function"==typeof e)return e(a);null!=e&&(e.current=a)}function Gse(...e){return a=>{let n=!1;const t=e.map((e=>{const t=Ise(e,a);return n||"function"!=typeof t||(n=!0),t}));if(n)return()=>{for(let a=0;a<t.length;a++){const n=t[a];"function"==typeof n?n():Ise(e[a],null)}}}}function Vse(...e){return r.useCallback(Gse(...e),e)}function Fse(e){const a=Jse(e),t=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),l=s.find(Wse);if(l){const e=l.props.children,i=s.map((a=>a===l?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(a,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n.jsx(a,{...o,ref:t,children:i})}));return t.displayName=`${e}.Slot`,t}function Jse(e){const a=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{r(...e),i(...e)}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?Gse(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));return a.displayName=`${e}.SlotClone`,a}var Use=Symbol("radix.slottable");function Wse(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Use}var qse=globalThis?.document?r.useLayoutEffect:()=>{},Zse=r[" useId ".trim().toString()]||(()=>{}),$se=0;function Yse(e){const[a,n]=r.useState(Zse());return qse((()=>{n((e=>e??String($se++)))}),[e]),e||(a?`radix-${a}`:"")}var Qse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,a)=>{const t=Fse(`Primitive.${a}`),i=r.forwardRef(((e,i)=>{const{asChild:r,...o}=e,s=r?t:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(s,{...o,ref:i})}));return i.displayName=`Primitive.${a}`,{...e,[a]:i}}),{});var Xse=r[" useInsertionEffect ".trim().toString()]||qse;function ele({prop:e,defaultProp:a,onChange:n=()=>{},caller:t}){const[i,o,s]=function({defaultProp:e,onChange:a}){const[n,t]=r.useState(e),i=r.useRef(n),o=r.useRef(a);return Xse((()=>{o.current=a}),[a]),r.useEffect((()=>{i.current!==n&&(o.current?.(n),i.current=n)}),[n,i]),[n,t,o]}({defaultProp:a,onChange:n}),l=void 0!==e,u=l?e:i;{const a=r.useRef(void 0!==e);r.useEffect((()=>{const e=a.current;if(e!==l){}a.current=l}),[l,t])}const c=r.useCallback((a=>{if(l){const n=function(e){return"function"==typeof e}(a)?a(e):a;n!==e&&s.current?.(n)}else o(a)}),[l,e,o,s]);return[u,c]}var ale=r.createContext(void 0);function nle(e){const a=r.useContext(ale);return e||a||"ltr"}var tle="rovingFocusGroup.onEntryFocus",ile={bubbles:!1,cancelable:!0},rle="RovingFocusGroup",[ole,sle,lle]=function(e){const t=e+"CollectionProvider",[i,r]=Hse(t),[o,s]=i(t,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:t,children:i}=e,r=a.useRef(null),s=a.useRef(new Map).current;return n.jsx(o,{scope:t,itemMap:s,collectionRef:r,children:i})};l.displayName=t;const u=e+"CollectionSlot",c=Fse(u),d=a.forwardRef(((e,a)=>{const{scope:t,children:i}=e,r=Vse(a,s(u,t).collectionRef);return n.jsx(c,{ref:r,children:i})}));d.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",p=Fse(m),g=a.forwardRef(((e,t)=>{const{scope:i,children:r,...o}=e,l=a.useRef(null),u=Vse(t,l),c=s(m,i);return a.useEffect((()=>(c.itemMap.set(l,{ref:l,...o}),()=>{c.itemMap.delete(l)}))),n.jsx(p,{[h]:"",ref:u,children:r})}));return g.displayName=m,[{Provider:l,Slot:d,ItemSlot:g},function(n){const t=s(e+"CollectionConsumer",n);return a.useCallback((()=>{const e=t.collectionRef.current;if(!e)return[];const a=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(t.itemMap.values()).sort(((e,n)=>a.indexOf(e.ref.current)-a.indexOf(n.ref.current)))}),[t.collectionRef,t.itemMap])},r]}(rle),[ule,cle]=Hse(rle,[lle]),[dle,mle]=ule(rle),hle=r.forwardRef(((e,a)=>n.jsx(ole.Provider,{scope:e.__scopeRovingFocusGroup,children:n.jsx(ole.Slot,{scope:e.__scopeRovingFocusGroup,children:n.jsx(ple,{...e,ref:a})})})));hle.displayName=rle;var ple=r.forwardRef(((e,a)=>{const{__scopeRovingFocusGroup:t,orientation:i,loop:o=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:m=!1,...h}=e,p=r.useRef(null),g=Vse(a,p),v=nle(s),[f,y]=ele({prop:l,defaultProp:u??null,onChange:c,caller:rle}),[k,b]=r.useState(!1),S=function(e){const a=r.useRef(e);return r.useEffect((()=>{a.current=e})),r.useMemo((()=>(...e)=>a.current?.(...e)),[])}(d),A=sle(t),w=r.useRef(!1),[C,M]=r.useState(0);return r.useEffect((()=>{const e=p.current;if(e)return e.addEventListener(tle,S),()=>e.removeEventListener(tle,S)}),[S]),n.jsx(dle,{scope:t,orientation:i,dir:v,loop:o,currentTabStopId:f,onItemFocus:r.useCallback((e=>y(e)),[y]),onItemShiftTab:r.useCallback((()=>b(!0)),[]),onFocusableItemAdd:r.useCallback((()=>M((e=>e+1))),[]),onFocusableItemRemove:r.useCallback((()=>M((e=>e-1))),[]),children:n.jsx(Qse.div,{tabIndex:k||0===C?-1:0,"data-orientation":i,...h,ref:g,style:{outline:"none",...e.style},onMouseDown:Kse(e.onMouseDown,(()=>{w.current=!0})),onFocus:Kse(e.onFocus,(e=>{if(e.target===e.currentTarget&&!w.current&&!k){const a=new CustomEvent(tle,ile);if(e.currentTarget.dispatchEvent(a),!a.defaultPrevented){const e=A().filter((e=>e.focusable));yle([e.find((e=>e.active)),e.find((e=>e.id===f)),...e].filter(Boolean).map((e=>e.ref.current)),m)}}w.current=!1})),onBlur:Kse(e.onBlur,(()=>b(!1)))})})})),gle="RovingFocusGroupItem",vle=r.forwardRef(((e,a)=>{const{__scopeRovingFocusGroup:t,focusable:i=!0,active:o=!1,tabStopId:s,children:l,...u}=e,c=Yse(),d=s||c,m=mle(gle,t),h=m.currentTabStopId===d,p=sle(t),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:f}=m;return r.useEffect((()=>{if(i)return g(),()=>v()}),[i,g,v]),n.jsx(ole.ItemSlot,{scope:t,id:d,focusable:i,active:o,children:n.jsx(Qse.span,{tabIndex:h?0:-1,"data-orientation":m.orientation,...u,ref:a,onMouseDown:Kse(e.onMouseDown,(e=>{i?m.onItemFocus(d):e.preventDefault()})),onFocus:Kse(e.onFocus,(()=>m.onItemFocus(d))),onKeyDown:Kse(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void m.onItemShiftTab();if(e.target!==e.currentTarget)return;const a=function(e,a,n){const t=function(e,a){return"rtl"!==a?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===a&&["ArrowLeft","ArrowRight"].includes(t)||"horizontal"===a&&["ArrowUp","ArrowDown"].includes(t)?void 0:fle[t]}(e,m.orientation,m.dir);if(void 0!==a){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=p().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===a)i.reverse();else if("prev"===a||"next"===a){"prev"===a&&i.reverse();const r=i.indexOf(e.currentTarget);i=m.loop?(t=r+1,(n=i).map(((e,a)=>n[(t+a)%n.length]))):i.slice(r+1)}setTimeout((()=>yle(i)))}var n,t})),children:"function"==typeof l?l({isCurrentTabStop:h,hasTabStop:null!=f}):l})})}));vle.displayName=gle;var fle={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function yle(e,a=!1){const n=document.activeElement;for(const t of e){if(t===n)return;if(t.focus({preventScroll:a}),document.activeElement!==n)return}}var kle=hle,ble=vle;var Sle=e=>{const{present:a,children:n}=e,t=function(e){const[a,n]=r.useState(),t=r.useRef(null),i=r.useRef(e),o=r.useRef("none"),s=e?"mounted":"unmounted",[l,u]=function(e,a){return r.useReducer(((e,n)=>a[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect((()=>{const e=Ale(t.current);o.current="mounted"===l?e:"none"}),[l]),qse((()=>{const a=t.current,n=i.current;if(n!==e){const t=o.current,r=Ale(a);if(e)u("MOUNT");else if("none"===r||"none"===a?.display)u("UNMOUNT");else{u(n&&t!==r?"ANIMATION_OUT":"UNMOUNT")}i.current=e}}),[e,u]),qse((()=>{if(a){let e;const n=a.ownerDocument.defaultView??window,r=r=>{const o=Ale(t.current).includes(r.animationName);if(r.target===a&&o&&(u("ANIMATION_END"),!i.current)){const t=a.style.animationFillMode;a.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===a.style.animationFillMode&&(a.style.animationFillMode=t)}))}},s=e=>{e.target===a&&(o.current=Ale(t.current))};return a.addEventListener("animationstart",s),a.addEventListener("animationcancel",r),a.addEventListener("animationend",r),()=>{n.clearTimeout(e),a.removeEventListener("animationstart",s),a.removeEventListener("animationcancel",r),a.removeEventListener("animationend",r)}}u("ANIMATION_END")}),[a,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:r.useCallback((e=>{t.current=e?getComputedStyle(e):null,n(e)}),[])}}(a),i="function"==typeof n?n({present:t.isPresent}):r.Children.only(n),o=Vse(t.ref,function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof n||t.isPresent?r.cloneElement(i,{ref:o}):null};function Ale(e){return e?.animationName||"none"}Sle.displayName="Presence";var wle="Tabs",[Cle,Mle]=Hse(wle,[cle]),Tle=cle(),[Nle,xle]=Cle(wle),Ele=r.forwardRef(((e,a)=>{const{__scopeTabs:t,value:i,onValueChange:r,defaultValue:o,orientation:s="horizontal",dir:l,activationMode:u="automatic",...c}=e,d=nle(l),[m,h]=ele({prop:i,onChange:r,defaultProp:o??"",caller:wle});return n.jsx(Nle,{scope:t,baseId:Yse(),value:m,onValueChange:h,orientation:s,dir:d,activationMode:u,children:n.jsx(Qse.div,{dir:d,"data-orientation":s,...c,ref:a})})}));Ele.displayName=wle;var Ple="TabsList",jle=r.forwardRef(((e,a)=>{const{__scopeTabs:t,loop:i=!0,...r}=e,o=xle(Ple,t),s=Tle(t);return n.jsx(kle,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:n.jsx(Qse.div,{role:"tablist","aria-orientation":o.orientation,...r,ref:a})})}));jle.displayName=Ple;var Lle="TabsTrigger",Ble=r.forwardRef(((e,a)=>{const{__scopeTabs:t,value:i,disabled:r=!1,...o}=e,s=xle(Lle,t),l=Tle(t),u=_le(s.baseId,i),c=Dle(s.baseId,i),d=i===s.value;return n.jsx(ble,{asChild:!0,...l,focusable:!r,active:d,children:n.jsx(Qse.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:u,...o,ref:a,onMouseDown:Kse(e.onMouseDown,(e=>{r||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(i)})),onKeyDown:Kse(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(i)})),onFocus:Kse(e.onFocus,(()=>{d||r||!("manual"!==s.activationMode)||s.onValueChange(i)}))})})}));Ble.displayName=Lle;var zle="TabsContent",Rle=r.forwardRef(((e,a)=>{const{__scopeTabs:t,value:i,forceMount:o,children:s,...l}=e,u=xle(zle,t),c=_le(u.baseId,i),d=Dle(u.baseId,i),m=i===u.value,h=r.useRef(m);return r.useEffect((()=>{const e=requestAnimationFrame((()=>h.current=!1));return()=>cancelAnimationFrame(e)}),[]),n.jsx(Sle,{present:o||m,children:({present:t})=>n.jsx(Qse.div,{"data-state":m?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":c,hidden:!t,id:d,tabIndex:0,...l,ref:a,style:{...e.style,animationDuration:h.current?"0s":void 0},children:t&&s})})}));function _le(e,a){return`${e}-trigger-${a}`}function Dle(e,a){return`${e}-content-${a}`}Rle.displayName=zle;var Kle=jle,Hle=Ble,Ole=Rle;const Ile=Ele,Gle=r.forwardRef((({className:e,...a},t)=>n.jsx(Kle,{ref:t,className:im("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...a})));Gle.displayName=Kle.displayName;const Vle=r.forwardRef((({className:e,...a},t)=>n.jsx(Hle,{ref:t,className:im("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...a})));Vle.displayName=Hle.displayName;const Fle=r.forwardRef((({className:e,...a},t)=>n.jsx(Ole,{ref:t,className:im("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a})));Fle.displayName=Ole.displayName;const Jle=({onOpenChange:e})=>n.jsx("div",{role:"button",tabIndex:0,"aria-label":"Close dialog",onClick:()=>e(!1),onKeyDown:a=>{"Enter"!==a.key&&" "!==a.key||e(!1)},className:"absolute top-3 right-3 z-20 rounded-full p-2 bg-white/80 shadow-lg border border-gray-200 hover:bg-primary/90 hover:text-white active:bg-primary/95 transition-all duration-200 focus:outline-none focus:ring-4 focus:ring-primary/30 focus:ring-offset-2 group cursor-pointer",style:{boxShadow:"0 4px 24px 0 rgba(0,0,0,0.10)"},children:n.jsx(RY.CloseButton,{className:"w-5 h-5 text-primary group-hover:text-primary-foreground group-active:text-primary-foreground transition-colors duration-200"})});function Ule(e){const a=r.useRef({value:e,previous:e});return r.useMemo((()=>(a.current.value!==e&&(a.current.previous=a.current.value,a.current.value=e),a.current.previous)),[e])}var Wle="Checkbox",[qle,Zle]=eX(Wle),[$le,Yle]=qle(Wle),Qle=r.forwardRef(((e,a)=>{const{__scopeCheckbox:t,name:i,checked:o,defaultChecked:s,required:l,disabled:u,value:c="on",onCheckedChange:d,form:m,...h}=e,[p,g]=r.useState(null),v=tO(a,(e=>g(e))),f=r.useRef(!1),y=!p||(m||!!p.closest("form")),[k=!1,b]=tX({prop:o,defaultProp:s,onChange:d}),S=r.useRef(k);return r.useEffect((()=>{const e=p?.form;if(e){const a=()=>b(S.current);return e.addEventListener("reset",a),()=>e.removeEventListener("reset",a)}}),[p,b]),n.jsxs($le,{scope:t,state:k,disabled:u,children:[n.jsx(uX.button,{type:"button",role:"checkbox","aria-checked":nue(k)?"mixed":k,"aria-required":l,"data-state":tue(k),"data-disabled":u?"":void 0,disabled:u,value:c,...h,ref:v,onKeyDown:XQ(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:XQ(e.onClick,(e=>{b((e=>!!nue(e)||!e)),y&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())}))}),y&&n.jsx(aue,{control:p,bubbles:!f.current,name:i,value:c,checked:k,required:l,disabled:u,form:m,style:{transform:"translateX(-100%)"},defaultChecked:!nue(s)&&s})]})}));Qle.displayName=Wle;var Xle="CheckboxIndicator",eue=r.forwardRef(((e,a)=>{const{__scopeCheckbox:t,forceMount:i,...r}=e,o=Yle(Xle,t);return n.jsx(O1,{present:i||nue(o.state)||!0===o.state,children:n.jsx(uX.span,{"data-state":tue(o.state),"data-disabled":o.disabled?"":void 0,...r,ref:a,style:{pointerEvents:"none",...e.style}})})}));eue.displayName=Xle;var aue=e=>{const{control:a,checked:t,bubbles:i=!0,defaultChecked:o,...s}=e,l=r.useRef(null),u=Ule(t),c=v1(a);r.useEffect((()=>{const e=l.current,a=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(a,"checked").set;if(u!==t&&n){const a=new Event("click",{bubbles:i});e.indeterminate=nue(t),n.call(e,!nue(t)&&t),e.dispatchEvent(a)}}),[u,t,i]);const d=r.useRef(!nue(t)&&t);return n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??d.current,...s,tabIndex:-1,ref:l,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function nue(e){return"indeterminate"===e}function tue(e){return nue(e)?"indeterminate":e?"checked":"unchecked"}var iue=Qle,rue=eue;const oue=({selectedChannels:e,setSelectedChannels:a,hasEmailChannelSenders:t,hasSmsChannelSenders:i,automationType:r})=>{const{toast:o}=Ie(),s=[...t?[{label:"Email",value:"email",icon:RY.EmailIcon,checked:e.includes("email")}]:[],...i?[{label:"SMS",value:"sms",icon:RY.SmsIcon,checked:e.includes("sms")}]:[]];return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-xl font-medium text-foreground",children:"Message Types"}),n.jsxs("p",{className:"text-muted-foreground mb-2 text-sm",children:["Select the channels you want to use in this"," ",r===Ze.ONE_TIME?yh("engage:broadcast").toLowerCase():yh("engage:automation").toLowerCase()]})]}),n.jsx("div",{className:"w-full grid grid-cols-2 gap-3",children:s.map((t=>n.jsxs(iue,{checked:t.checked,onCheckedChange:()=>{"email"===t.value?e.includes("email")?e.includes("sms")?a(["sms"]):o({title:"Cant Remove Email",description:`At least one channel is required for an ${r===Ze.ONE_TIME?yh("engage:broadcast").toLowerCase():yh("engage:automation").toLowerCase()}`,variant:"destructive"}):a([...e,"email"]):e.includes("sms")?e.includes("email")?a(["email"]):o({title:"Cant Remove SMS",description:`At least one channel is required for an ${r===Ze.ONE_TIME?yh("engage:broadcast").toLowerCase():yh("engage:automation").toLowerCase()}`,variant:"destructive"}):a([...e,"sms"])},className:"relative ring-[1px] ring-border rounded-lg px-4 py-3 text-start text-muted-foreground data-[state=checked]:ring-2 data-[state=checked]:ring-primary data-[state=checked]:font-medium",children:[n.jsx(t.icon,{className:"mb-3",size:20}),n.jsx("span",{className:"font-medium tracking-tight",children:t.label}),n.jsx(rue,{className:"absolute top-2 right-2",children:n.jsx(Mc,{className:"fill-primary text-primary-foreground"})})]},t.value)))})]})},sue=({getExtraMergeFields:e})=>{const[t,i]=a.useState(null),r=a.useRef(null),{toast:o}=Ie(),s=CY(),{channelSenders:l}=x9(),{channelAccounts:u}=M9(),{updateCommunicationGroup:c}=lY(),d=wY(),{data:m}=L9(),{setSelectedSubStepType:h}=a.useContext(X$),{getMergeFields:p,isGetting:g}=uY(s?.id??void 0),[v,f]=a.useState(void 0);a.useEffect((()=>{const e=s?.id;e&&t&&(t.includes("email")||null===s?.emailChannelSenderId||c({groupId:e,params:{emailChannelSenderId:null}}),t.includes("sms")||null===s?.smsChannelSenderId||c({groupId:e,params:{smsChannelSenderId:null}}),1===t.length&&("email"===t[0]&&h(Lie.EMAIL),"sms"===t[0]&&h(Lie.SMS)))}),[t,c,s,m,h]),a.useEffect((()=>{const e=s?.id;e||0!==t?.length||i(["email"])}),[d,s,t]);const y=a.useCallback((e=>{const a=[];e.emailChannelSenderId&&a.push("email"),e.smsChannelSenderId&&a.push("sms"),0===a.length&&a.push("email"),i(a)}),[]);a.useEffect((()=>{s&&!t&&y(s)}),[s,y,t]),a.useEffect((()=>{g||void 0===v&&(e?e().then((e=>{s?.id&&(y(s),c({groupId:s?.id,params:{extraMergeFields:e}},{onSuccess:async()=>{try{const e=await nY(s?.id);f(e)}catch{o({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}},onError:e=>{o({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}}))})):f(p))}),[e,c,s,o,g,p,v,y]);const k=a.useMemo((()=>zie({channelSenders:l?.results??[],channelAccounts:u?.results??[]})),[l?.results,u?.results]),b=a.useMemo((()=>mee({channelSenders:l?.results??[],channelAccounts:u?.results??[],smsApplication:m})),[l?.results,u?.results,m]);if(!t||g||!v||!k||!b)return n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Content..."]})});const S=k.length>0,A=b.length>0;return n.jsxs("div",{className:"flex flex-col gap-4 flex-shrink-0",children:[n.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(oue,{automationType:d?.triggerMetadata?.triggerType,selectedChannels:t,setSelectedChannels:i,hasEmailChannelSenders:S,hasSmsChannelSenders:A})}),t.includes("email")&&n.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",ref:r,children:[n.jsx(Bie,{title:"Email Campaign",type:"email"}),n.jsx(Eie,{mergeFieldsResponse:v,emailChannelSendersWithChannelAccounts:k})]}),t.includes("sms")&&n.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:[n.jsx(Bie,{title:"SMS Campaign",type:"sms"}),n.jsx(zse,{mergeFieldsResponse:v})]})]})},lue=({open:e,onOpenChange:a})=>n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{className:"max-w-[75vw] min-h-[75vh] overflow-y-auto max-h-[90vh] po",hideCloseButton:!0,children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Edit Campaign Content"}),n.jsx(IG,{children:"Edit the content of the campaign"})]}),n.jsx(Jle,{onOpenChange:a}),n.jsx(sue,{})]})}),uue=()=>n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),n.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),n.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"})]}),cue=({children:e,actionButtons:a})=>n.jsxs("div",{className:"flex-1 w-full relative overflow-hidden max-w-screen-lg mx-auto",children:[n.jsxs("div",{className:"h-full relative w-full rounded-2xl bg-white border border-zinc-200 overflow-hidden min-h-[500px] flex flex-col",style:{containerType:"inline-size"},children:[n.jsxs("div",{className:"flex items-center space-x-3 pt-3 px-4 z-10 w-full justify-between",children:[n.jsx(uue,{}),a&&n.jsx("div",{className:"flex items-center space-x-2",children:a})]}),e]}),n.jsx("div",{className:"text-center text-sm text-muted-foreground mt-4",children:n.jsx("p",{children:"These previews show exactly how your messages will appear to your customers"})})]}),due=()=>{const e=wY(),t=CY(),{channelSenders:i}=x9(),{channelAccounts:r}=M9(),o=a.useMemo((()=>i?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const a=r?.results?.find((a=>a.id===e.channelAccountId));return a&&a.channelAccountMetadata.type===T9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSenderMetadata:e.channelSenderMetadata}]:[]}))||[]),[i?.results,r?.results]),s=t?.emailChannelSenderId;if(!(e&&t&&o&&s))return null;const l=o.find((e=>e.channelSenderId===s)),u=l?.fullDomain,c=l?.channelSenderMetadata.emailReplyTo,d=t.emailSubject,m=t.emailPreviewText,h=l?.channelSenderMetadata.emailFromName;return n.jsxs("div",{className:"space-y-1 overflow-hidden",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),n.jsxs("div",{className:"text-base font-medium",children:[u,h&&n.jsxs("span",{className:"text-muted-foreground",children:["<",h,">"]})]})]}),c&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Reply-To"}),n.jsx("div",{className:"text-base font-medium",children:c})]}),d&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Subject"}),n.jsx("div",{className:"text-base font-medium",children:d})]}),m&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Preview Text"}),n.jsx("div",{className:"text-sm font-medium line-clamp-2",children:m})]})]})},mue=({emailBody:e})=>{const[t,i]=a.useState({width:0,height:0}),r=a.useRef(null);return a.useEffect((()=>{const e=()=>{r.current&&requestAnimationFrame((()=>{i({width:r.current?r.current.offsetWidth-75:0,height:r.current?r.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[r]),n.jsxs(cue,{children:[n.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:n.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:n.jsx(due,{})})}),n.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",ref:r,children:n.jsx(Aie,{html:e,height:t.height,width:t.width})})]})},hue=({expandDialogContent:e})=>{const[t,i]=a.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsx(BG,{open:t,onOpenChange:i,children:n.jsxs(DG,{hideCloseButton:!0,className:"w-[80vw] h-[80vh] max-h-none bg-transparent border-none max-w-screen-lg ",children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Expanded Preview"}),n.jsx(IG,{children:"Expanded view of communication content"})]}),n.jsxs("div",{className:"h-full flex flex-col overflow-hidden rounded-xl",children:[n.jsx(Jle,{onOpenChange:i}),e]})]})}),n.jsx(jY,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>i(!0),children:n.jsx(RY.ExpandIcon,{className:"w-4 h-4 text-muted-foreground"})})]})},pue=({type:e,disablePreviewSubtext:a=!1})=>{const t="sms"===e?"SMS":"Email";return n.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center",children:n.jsxs("div",{className:"flex flex-col items-center justify-center bg-zinc-50/80 border border-zinc-100 rounded-2xl shadow-md px-6 py-12 max-w-[90vw] w-full sm:max-w-md mx-auto text-center",style:{containerType:"inline-size"},children:[n.jsx("sms"===e?RY.SmsIcon:RY.EmailIcon,{className:"w-12 h-12 text-zinc-500 mb-4"}),n.jsxs("h2",{className:"text-xl font-semibold text-zinc-800 mb-2",children:["No ",t," Content Yet"]}),!a&&n.jsxs("p",{className:"text-zinc-500 text-base mb-1",children:["Click"," ",n.jsx("span",{className:"font-medium text-zinc-700",children:"Edit content"})," to start crafting your ",t," message."]})]})})},gue=({onClick:e})=>n.jsxs(jY,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:e,children:[n.jsx(RY.PreviewButton,{className:"w-4 h-4"}),n.jsx("span",{className:"font-medium text-sm",children:"Test"})]}),vue=e=>/^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/.test(e),fue=e=>{if(!/^[0-9\s()+.-]+$/.test(e))return!1;const a=e.replace(/\D/g,"");return e.startsWith("+")?a.length>=10&&a.length<=15:10===a.length||!(11!==a.length||!a.startsWith("1"))},yue=e=>{const a=e.replace(/\D/g,"");if(10===a.length)return`(${a.slice(0,3)}) ${a.slice(3,6)}-${a.slice(6)}`;if(11===a.length&&a.startsWith("1"))return`+1 (${a.slice(1,4)}) ${a.slice(4,7)}-${a.slice(7)}`;if(a.length>0){const n=e.startsWith("+")?"+":"",t=a.slice((e.startsWith("+"),0));return`${n}${t.match(/.{1,4}/g)?.join("-")||t}`}return e},kue=({automation:e,type:t,setOpenSendPreviewPopup:i,open:r})=>{const[o,s]=a.useState(""),[l,u]=a.useState(""),[c,d]=a.useState(null),[m,h]=a.useState(!1),[p,g]=a.useState(""),{sendTestCommunication:v,sendError:f,isSendSuccess:y}=cY(),{toast:k}=Ie(),b=e.actionData?.find((e=>"send_communication"===e.actionType)),S=b?.actionMetadata.communicationGroupId,{communicationGroup:A,isGetting:w}=sY(S??void 0),{data:C}=vY({includeSegments:e.includeSegmentIds,excludeSegments:e.excludeSegmentIds,automationId:e.id}),M=a.useCallback((()=>{if(!S)return Promise.resolve(null);if(!A)return Promise.reject(new Error("Communication group not loaded"));switch(t){case"email":return Promise.resolve(A.emailChannelSenderId);case"sms":return Promise.resolve(A.smsChannelSenderId);default:return Promise.reject(new Error(`Unsupported type: ${t}`))}}),[A,t,S]);a.useEffect((()=>{(async()=>{try{const e=await M();d(e)}catch(e){d(null)}finally{h(!0)}})()}),[M]),a.useEffect((()=>{y&&(k({title:"Success",description:`Preview ${"email"===t?"email":"SMS"} sent successfully!`}),i(!1))}),[y,t,i,k]),a.useEffect((()=>{f&&(k({title:"Error",description:`Failed to send preview: ${f.message}`,variant:"destructive"}),i(!1))}),[f,k,i]),a.useEffect((()=>{r&&(s(""),u(""),g(""))}),[r]);return m&&!w&&C?c?n.jsxs("div",{className:"",children:[n.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:["Send Test ","email"===t?"Email":"Text"]}),n.jsx(o4,{type:"email"===t?"email":"tel",placeholder:"email"===t?"Enter email address":"Enter phone number",value:o,onChange:e=>{s(e.target.value),u("")},className:"w-full px-3 py-3 border border-gray-300 rounded-lg text-base \n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent\n placeholder-gray-400"}),n.jsxs("p",{className:"text-sm text-muted-foreground mt-1.5",children:["Enter a valid ","email"===t?"email address":"phone number"," to send a test to that recipient."]}),n.jsx("div",{className:"my-4 border-t border-gray-200"}),n.jsxs("div",{className:"mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(hie,{value:p,onValueChange:e=>{g(e)},children:[n.jsx(vie,{className:"w-full bg-white border border-gray-300 rounded-lg text-base\n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:n.jsx(gie,{children:p?C?.recipients.find((e=>e.id===p))?.firstName+" "+C?.recipients.find((e=>e.id===p))?.lastName:"Preview as"})}),n.jsx(kie,{children:n.jsx(pie,{children:(C?.recipients??[]).map((e=>n.jsx(bie,{value:e.id,className:"cursor-pointer hover:bg-gray-50",children:n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("span",{className:"font-medium",children:[e.firstName," ",e.lastName]}),n.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.email&&`Email: ${e.email}`,e.email&&e.phone&&" • ",e.phone&&`Phone: ${e.phone}`]})]})},`${e.firstName}-${e.lastName}`)))})})]}),p&&n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>g(""),className:"h-10 w-10 rounded-lg hover:bg-gray-100",title:"Clear selection",children:n.jsx(RY.CloseButton,{className:"h-4 w-4 text-gray-500"})})]}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1.5",children:"Optional: Test as a specific recipient to see how the message will appear with their data. If not selected, raw merge tags will be used."})]}),l&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"my-4 border-t border-gray-200"}),n.jsx("p",{className:"text-red-500 text-sm mb-4 -mt-2",children:l})]}),n.jsx(jY,{onClick:()=>{if(!("email"===t?vue(o):fue(o)))return void u("Please enter a valid "+("email"===t?"email address":"phone number"));if(!c)return void u("No sender found, please update the automation first!");const a=e.actionData?.find((e=>"send_communication"===e.actionType)),n=a?.actionMetadata.communicationGroupId;if(!n)return Promise.resolve(null);v({id:n,params:"email"===t?{emailAddress:o,previewAsRecipientId:p}:{phoneNumber:o,previewAsRecipientId:p}})},disabled:!o,className:"w-full bg-blue-600 text-white py-3 px-6 rounded-lg font-medium\n hover:bg-blue-700 transition-colors duration-200\n disabled:bg-gray-400 disabled:cursor-not-allowed",children:"Send Test"})]}):n.jsx("div",{className:"flex justify-center items-center h-full",children:n.jsxs("div",{className:"text-center flex flex-col justify-center items-center gap-2",children:[n.jsx(RY.AlertCircleIcon,{className:"h-12 w-12 text-gray-400 mb-4"}),n.jsx("h3",{className:"text-lg font-semibold text-gray-700 mb-2",children:"No sender found"}),n.jsx("p",{className:"text-gray-500",children:"Please update the automation to include a sender for this type"})]})}):n.jsx("div",{className:"flex justify-center items-center h-full",children:n.jsx(xY,{text:["Fetching sender data","Fetching recipients"]})})},bue=({open:e,onOpenChange:a,automation:t})=>n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Send Preview Email"}),n.jsx(IG,{children:"Send a preview email to the automation."})]}),n.jsx(kue,{automation:t,type:"email",setOpenSendPreviewPopup:a,open:e})]})}),Sue=({disablePreview:e=!1,disableEditContent:t=!1,disablePreviewSubtext:i=!1})=>{const r=wY(),o=CY(),{channelSenders:s}=x9(),{channelAccounts:l}=M9(),[u,c]=a.useState({width:0,height:0}),[d,m]=a.useState(!1),[h,p]=a.useState(!1),g=a.useRef(null);if(a.useEffect((()=>{const e=()=>{g.current&&requestAnimationFrame((()=>{c({width:g.current?g.current.offsetWidth-75:0,height:g.current?g.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[g]),!r||!o||void 0===s||void 0===l)return null;const v=o?.emailHtmlBody||"",f=o?.emailChannelSenderId&&v.length>0,y=zie({channelSenders:s?.results??[],channelAccounts:l?.results??[]});return n.jsxs("div",{className:"flex-1 flex flex-col items-center w-full",children:[n.jsx(lue,{open:h,onOpenChange:p}),y.length>0&&n.jsx(bue,{open:d,onOpenChange:m,automation:r}),n.jsx(cue,{actionButtons:n.jsx(n.Fragment,{children:n.jsxs("div",{className:"flex items-center space-x-2",children:[!e&&f&&n.jsx(gue,{onClick:()=>m(!0)}),!t&&r.status===Xe.DRAFT&&n.jsx(jY,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>p(!0),children:"Edit content"}),f&&n.jsx(hue,{expandDialogContent:n.jsx(mue,{emailBody:v})})]})}),children:f?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:n.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:n.jsx(due,{})})}),n.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),n.jsx("div",{className:"flex-1 w-full overflow-auto h-full min-h-[500px]",ref:g,children:n.jsx(Aie,{html:v,height:u.height,width:u.width})})]}):n.jsx(pue,{type:"email",disablePreviewSubtext:i})})]})},Aue=()=>{const e=wY(),t=CY(),{channelSenders:i}=x9(),{channelAccounts:r}=M9(),{data:o}=L9(),s=a.useMemo((()=>mee({channelSenders:i?.results??[],channelAccounts:r?.results??[],smsApplication:o})),[i?.results,r?.results,o]),l=s?.find((e=>e.channelSender.id===t?.smsChannelSenderId));if(!l&&!o)return null;if(!(e&&t&&i&&r&&s&&(void 0!==o||l)))return null;const u=l?.channelSender.channelSenderMetadata.from&&null!==l.channelSender.channelSenderMetadata.from?l.channelSender.channelSenderMetadata.from:null,c=l?.channelSender.channelSenderMetadata.friendlyName??(u&&null!==u?yue(u??""):l?.channelSender.channelSenderMetadata.messageServiceSid);return n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),n.jsx("div",{className:"text-base font-medium font-mono text-zinc-800",children:c})]})})},wue=({smsBody:e,imageUrls:a})=>n.jsxs(cue,{children:[n.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:n.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:n.jsx(Aue,{})})}),n.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",children:n.jsx(Bse,{body:e,imageUrls:a})})]}),Cue=({open:e,onOpenChange:a,automation:t})=>n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Send Preview SMS"}),n.jsx(IG,{children:"Send a preview SMS to the automation."})]}),n.jsx(kue,{automation:t,type:"sms",setOpenSendPreviewPopup:a,open:e})]})}),Mue=({disablePreview:e=!1,disableEditContent:t=!1,disablePreviewSubtext:i=!1,setupRequired:r=!1})=>{const[o,s]=a.useState(!1),{channelSenders:l}=x9(),u=wY(),c=CY(),[d,m]=a.useState(!1),{data:h}=L9(),[p,g]=a.useState(r);if(a.useEffect((()=>{h&&h.status===dee.PENDING&&g(!1)}),[h]),!u||void 0===l)return null;const v=c?.smsMessageBody||"",f=(h||c?.smsChannelSenderId)&&v.length>0,y=Lse({companyName:c?.textMessageCompanyName??void 0,smsBody:v}),k=c?.textMessageMediaUrls??[];return n.jsx(aV,{children:p?n.jsx("div",{className:"w-full pt-8 mx-auto",children:n.jsx(Toe,{})}):n.jsxs(H$.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:[.16,1,.3,1]},className:"flex flex-col items-center w-full h-full",children:[n.jsx(lue,{open:d,onOpenChange:m}),n.jsx(Cue,{open:o,onOpenChange:s,automation:u}),n.jsx(cue,{actionButtons:n.jsxs(n.Fragment,{children:[!e&&f&&n.jsx(gue,{onClick:()=>s(!0)}),(u.status===Xe.DRAFT||!t)&&n.jsx(jY,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>m(!0),children:"Edit content"}),f&&n.jsx(hue,{expandDialogContent:n.jsx(wue,{smsBody:y,imageUrls:k})})]}),children:f?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:n.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:n.jsx(Aue,{})})}),n.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),n.jsx("div",{className:"flex-1 w-full overflow-auto h-full flex items-center justify-center",children:n.jsx(Bse,{body:y,imageUrls:k})})]}):n.jsx(pue,{type:"sms",disablePreviewSubtext:i})})]})})},Tue=({disablePreview:e=!1,disableEditContent:t=!1,disablePreviewSubtext:i=!1})=>{const[r,o]=a.useState(null),s=CY(),{channelAccounts:l}=M9(),{state:{hideSms:u}}=a.useContext(cO),{channelSenders:c}=x9(),{data:d}=L9(),m=a.useMemo((()=>mee({channelSenders:c?.results??[],channelAccounts:l?.results??[],smsApplication:d})),[c?.results,l?.results,d]);if(a.useEffect((()=>{r||o(s?.emailChannelSenderId?"email":"sms")}),[s?.emailChannelSenderId,r]),!s||!c||!r)return n.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:n.jsx(xY,{text:["Loading..."]})});const h=0===m.length&&!d;return n.jsxs(Ile,{defaultValue:"email",value:r,onValueChange:e=>o("email"===e?"email":"sms"),className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md pb-4",children:[n.jsx("div",{className:"max-w-[640px] mx-auto w-full",children:n.jsxs(Gle,{className:"grid w-full "+(u?"grid-cols-1":"grid-cols-2"),children:[n.jsx(Vle,{value:"email",className:"group data-[state=active]:bg-white",children:n.jsxs("div",{className:"flex items-center",children:[n.jsx(RY.EmailIcon,{className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block text-primary"}),n.jsx(RY.EmailIcon,{className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden text-gray-400"}),n.jsx("span",{children:"Email"})]})}),!u&&n.jsx(Vle,{value:"sms",className:"group data-[state=active]:bg-white",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(RY.SmsIcon,{className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block text-primary"}),n.jsx(RY.SmsIcon,{className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden text-gray-400"}),n.jsx("span",{children:"SMS"}),h&&n.jsx(Mae,{title:"To enable SMS, please complete your business information and request approval from Twilio"})]})})]})}),n.jsx(Fle,{value:"email",children:n.jsx(Sue,{disablePreview:e,disableEditContent:t,disablePreviewSubtext:i})}),n.jsx(Fle,{value:"sms",children:n.jsx(Mue,{disablePreview:e,disableEditContent:t,disablePreviewSubtext:i,setupRequired:h})})]})},Nue="reach-styles-module__h2___J-48W",xue="reach-styles-module__h3___QiFj-",Eue="reach-styles-module__minorText___1TEN6",Pue=({children:e,className:a})=>n.jsx("h2",{className:im(Nue,a),children:e}),jue=({children:e,className:a})=>n.jsx("h3",{className:im(xue,a),children:e}),Lue=({children:e,className:a})=>n.jsx("p",{className:im(Eue,a),children:e}),Bue=({title:e,children:a,headerActions:t})=>n.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1 flex flex-col gap-4 pt-4",children:[n.jsxs("div",{className:"px-4 flex",children:[n.jsx(Pue,{className:"text-primary",children:e}),t&&n.jsx("div",{className:"ml-auto",children:t})]}),a]}),zue=()=>n.jsx(Bue,{title:"Preview & Schedule",children:n.jsx(Tue,{disablePreview:!0,disableEditContent:!0,disablePreviewSubtext:!0})}),Rue=()=>{const e=wY(),t=CY(),{channelSenders:i}=x9(),{channelAccounts:r}=M9(),{data:o}=L9(),[s,l]=a.useState(null),[u,c]=a.useState(null),[d,m]=a.useState(null),[h,p]=a.useState(null);return a.useEffect((()=>{i&&m(i),r&&p(r)}),[i,r]),a.useEffect((()=>{if(t&&d&&h){const e=t.emailChannelSenderId,a=t.smsChannelSenderId,n=d.results.find((a=>a.id===e)),i=d.results.find((e=>e.id===a));if(n&&t.emailSubject&&t.emailHtmlBody){const e=n.channelSenderMetadata?.userPart,a=h.results.find((e=>e.id===n.channelAccountId));if(a)switch(a.channelAccountMetadata.type){case T9.REACH_MANAGED:l({fromEmail:`${e}@${a.channelAccountMetadata.baseDomain}.embedreach.com`,fromName:n.channelSenderMetadata?.emailFromName,subject:t.emailSubject,previewText:t.emailPreviewText,body:t.emailHtmlBody});break;case T9.TWILLIO:break;default:throw Dse(a.channelAccountMetadata.type,T9)}}(o||i)&&t.smsMessageBody&&c({fromPhone:i?_se(i.channelSenderMetadata):"",body:t.smsMessageBody,companyName:t.textMessageCompanyName})}}),[t,d,h,o]),e?n.jsx("div",s||u?{className:"w-full",children:n.jsx("div",{className:"flex flex-col gap-4 w-full",children:n.jsx(zue,{})})}:{className:"flex justify-center items-center h-full",children:n.jsx("div",{children:"No preview data Please complete previous steps"})}):n.jsx(xY,{text:["Loading..."]})};function _ue(e){return(_ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Due(e){if(null===e||!0===e||!1===e)return NaN;var a=Number(e);return isNaN(a)?a:a<0?Math.ceil(a):Math.floor(a)}function Kue(e,a){if(a.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+a.length+" present")}function Hue(e){Kue(1,arguments);var a=Object.prototype.toString.call(e);return e instanceof Date||"object"===_ue(e)&&"[object Date]"===a?new Date(e.getTime()):"number"==typeof e||"[object Number]"===a?new Date(e):new Date(NaN)}function Oue(e,a){Kue(2,arguments);var n=Hue(e),t=Due(a);return isNaN(t)?new Date(NaN):t?(n.setDate(n.getDate()+t),n):n}function Iue(e,a){Kue(2,arguments);var n=Hue(e),t=Due(a);if(isNaN(t))return new Date(NaN);if(!t)return n;var i=n.getDate(),r=new Date(n.getTime());return r.setMonth(n.getMonth()+t+1,0),i>=r.getDate()?r:(n.setFullYear(r.getFullYear(),r.getMonth(),i),n)}var Gue={};function Vue(){return Gue}function Fue(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.weekStartsOn)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==i?i:c.weekStartsOn)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var m=Hue(e),h=m.getDay(),p=(h<d?7:0)+h-d;return m.setDate(m.getDate()-p),m.setHours(0,0,0,0),m}function Jue(e){return Kue(1,arguments),Fue(e,{weekStartsOn:1})}function Uue(e){Kue(1,arguments);var a=function(e){Kue(1,arguments);var a=Hue(e),n=a.getFullYear(),t=new Date(0);t.setFullYear(n+1,0,4),t.setHours(0,0,0,0);var i=Jue(t),r=new Date(0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);var o=Jue(r);return a.getTime()>=i.getTime()?n+1:a.getTime()>=o.getTime()?n:n-1}(e),n=new Date(0);return n.setFullYear(a,0,4),n.setHours(0,0,0,0),Jue(n)}function Wue(e){var a=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return a.setUTCFullYear(e.getFullYear()),e.getTime()-a.getTime()}function que(e){Kue(1,arguments);var a=Hue(e);return a.setHours(0,0,0,0),a}function Zue(e,a){Kue(2,arguments);var n=que(e),t=que(a),i=n.getTime()-Wue(n),r=t.getTime()-Wue(t);return Math.round((i-r)/864e5)}function $ue(e,a){return Kue(2,arguments),Oue(e,7*Due(a))}function Yue(e,a){return Kue(2,arguments),Iue(e,12*Due(a))}function Que(e,a){Kue(2,arguments);var n=que(e),t=que(a);return n.getTime()===t.getTime()}function Xue(e){return Kue(1,arguments),e instanceof Date||"object"===_ue(e)&&"[object Date]"===Object.prototype.toString.call(e)}function ece(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return 12*(n.getFullYear()-t.getFullYear())+(n.getMonth()-t.getMonth())}function ace(e){Kue(1,arguments);var a=Hue(e),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(23,59,59,999),a}function nce(e){Kue(1,arguments);var a=Hue(e);return a.setDate(1),a.setHours(0,0,0,0),a}function tce(e){Kue(1,arguments);var a=Hue(e),n=new Date(0);return n.setFullYear(a.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ice(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.weekStartsOn)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==i?i:c.weekStartsOn)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var m=Hue(e),h=m.getDay(),p=6+(h<d?-7:0)-(h-d);return m.setDate(m.getDate()+p),m.setHours(23,59,59,999),m}function rce(e){return Kue(1,arguments),ice(e,{weekStartsOn:1})}function oce(e,a){return Kue(2,arguments),function(e,a){Kue(2,arguments);var n=Hue(e).getTime(),t=Due(a);return new Date(n+t)}(e,-Due(a))}function sce(e){Kue(1,arguments);var a=Hue(e),n=a.getUTCDay(),t=(n<1?7:0)+n-1;return a.setUTCDate(a.getUTCDate()-t),a.setUTCHours(0,0,0,0),a}function lce(e){Kue(1,arguments);var a=Hue(e),n=a.getUTCFullYear(),t=new Date(0);t.setUTCFullYear(n+1,0,4),t.setUTCHours(0,0,0,0);var i=sce(t),r=new Date(0);r.setUTCFullYear(n,0,4),r.setUTCHours(0,0,0,0);var o=sce(r);return a.getTime()>=i.getTime()?n+1:a.getTime()>=o.getTime()?n:n-1}function uce(e){Kue(1,arguments);var a=Hue(e),n=sce(a).getTime()-function(e){Kue(1,arguments);var a=lce(e),n=new Date(0);return n.setUTCFullYear(a,0,4),n.setUTCHours(0,0,0,0),sce(n)}(a).getTime();return Math.round(n/6048e5)+1}function cce(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.weekStartsOn)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==i?i:c.weekStartsOn)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var m=Hue(e),h=m.getUTCDay(),p=(h<d?7:0)+h-d;return m.setUTCDate(m.getUTCDate()-p),m.setUTCHours(0,0,0,0),m}function dce(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Hue(e),d=c.getUTCFullYear(),m=Vue(),h=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.firstWeekContainsDate)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:m.firstWeekContainsDate)&&void 0!==t?t:null===(l=m.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==n?n:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(d+1,0,h),p.setUTCHours(0,0,0,0);var g=cce(p,a),v=new Date(0);v.setUTCFullYear(d,0,h),v.setUTCHours(0,0,0,0);var f=cce(v,a);return c.getTime()>=g.getTime()?d+1:c.getTime()>=f.getTime()?d:d-1}function mce(e,a){Kue(1,arguments);var n=Hue(e),t=cce(n,a).getTime()-function(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.firstWeekContainsDate)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:c.firstWeekContainsDate)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==n?n:1),m=dce(e,a),h=new Date(0);return h.setUTCFullYear(m,0,d),h.setUTCHours(0,0,0,0),cce(h,a)}(n,a).getTime();return Math.round(t/6048e5)+1}function hce(e,a){for(var n=e<0?"-":"",t=Math.abs(e).toString();t.length<a;)t="0"+t;return n+t}var pce=function(e,a){var n=e.getUTCFullYear(),t=n>0?n:1-n;return hce("yy"===a?t%100:t,a.length)},gce=function(e,a){var n=e.getUTCMonth();return"M"===a?String(n+1):hce(n+1,2)},vce=function(e,a){return hce(e.getUTCDate(),a.length)},fce=function(e,a){return hce(e.getUTCHours()%12||12,a.length)},yce=function(e,a){return hce(e.getUTCHours(),a.length)},kce=function(e,a){return hce(e.getUTCMinutes(),a.length)},bce=function(e,a){return hce(e.getUTCSeconds(),a.length)},Sce=function(e,a){var n=a.length,t=e.getUTCMilliseconds();return hce(Math.floor(t*Math.pow(10,n-3)),a.length)},Ace="midnight",wce="noon",Cce="morning",Mce="afternoon",Tce="evening",Nce="night",xce={G:function(e,a,n){var t=e.getUTCFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return n.era(t,{width:"abbreviated"});case"GGGGG":return n.era(t,{width:"narrow"});default:return n.era(t,{width:"wide"})}},y:function(e,a,n){if("yo"===a){var t=e.getUTCFullYear();return n.ordinalNumber(t>0?t:1-t,{unit:"year"})}return pce(e,a)},Y:function(e,a,n,t){var i=dce(e,t),r=i>0?i:1-i;return"YY"===a?hce(r%100,2):"Yo"===a?n.ordinalNumber(r,{unit:"year"}):hce(r,a.length)},R:function(e,a){return hce(lce(e),a.length)},u:function(e,a){return hce(e.getUTCFullYear(),a.length)},Q:function(e,a,n){var t=Math.ceil((e.getUTCMonth()+1)/3);switch(a){case"Q":return String(t);case"QQ":return hce(t,2);case"Qo":return n.ordinalNumber(t,{unit:"quarter"});case"QQQ":return n.quarter(t,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(t,{width:"narrow",context:"formatting"});default:return n.quarter(t,{width:"wide",context:"formatting"})}},q:function(e,a,n){var t=Math.ceil((e.getUTCMonth()+1)/3);switch(a){case"q":return String(t);case"qq":return hce(t,2);case"qo":return n.ordinalNumber(t,{unit:"quarter"});case"qqq":return n.quarter(t,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(t,{width:"narrow",context:"standalone"});default:return n.quarter(t,{width:"wide",context:"standalone"})}},M:function(e,a,n){var t=e.getUTCMonth();switch(a){case"M":case"MM":return gce(e,a);case"Mo":return n.ordinalNumber(t+1,{unit:"month"});case"MMM":return n.month(t,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(t,{width:"narrow",context:"formatting"});default:return n.month(t,{width:"wide",context:"formatting"})}},L:function(e,a,n){var t=e.getUTCMonth();switch(a){case"L":return String(t+1);case"LL":return hce(t+1,2);case"Lo":return n.ordinalNumber(t+1,{unit:"month"});case"LLL":return n.month(t,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(t,{width:"narrow",context:"standalone"});default:return n.month(t,{width:"wide",context:"standalone"})}},w:function(e,a,n,t){var i=mce(e,t);return"wo"===a?n.ordinalNumber(i,{unit:"week"}):hce(i,a.length)},I:function(e,a,n){var t=uce(e);return"Io"===a?n.ordinalNumber(t,{unit:"week"}):hce(t,a.length)},d:function(e,a,n){return"do"===a?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):vce(e,a)},D:function(e,a,n){var t=function(e){Kue(1,arguments);var a=Hue(e),n=a.getTime();a.setUTCMonth(0,1),a.setUTCHours(0,0,0,0);var t=a.getTime();return Math.floor((n-t)/864e5)+1}(e);return"Do"===a?n.ordinalNumber(t,{unit:"dayOfYear"}):hce(t,a.length)},E:function(e,a,n){var t=e.getUTCDay();switch(a){case"E":case"EE":case"EEE":return n.day(t,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(t,{width:"short",context:"formatting"});default:return n.day(t,{width:"wide",context:"formatting"})}},e:function(e,a,n,t){var i=e.getUTCDay(),r=(i-t.weekStartsOn+8)%7||7;switch(a){case"e":return String(r);case"ee":return hce(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,a,n,t){var i=e.getUTCDay(),r=(i-t.weekStartsOn+8)%7||7;switch(a){case"c":return String(r);case"cc":return hce(r,a.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,a,n){var t=e.getUTCDay(),i=0===t?7:t;switch(a){case"i":return String(i);case"ii":return hce(i,a.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(t,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(t,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(t,{width:"short",context:"formatting"});default:return n.day(t,{width:"wide",context:"formatting"})}},a:function(e,a,n){var t=e.getUTCHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(t,{width:"narrow",context:"formatting"});default:return n.dayPeriod(t,{width:"wide",context:"formatting"})}},b:function(e,a,n){var t,i=e.getUTCHours();switch(t=12===i?wce:0===i?Ace:i/12>=1?"pm":"am",a){case"b":case"bb":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(t,{width:"narrow",context:"formatting"});default:return n.dayPeriod(t,{width:"wide",context:"formatting"})}},B:function(e,a,n){var t,i=e.getUTCHours();switch(t=i>=17?Tce:i>=12?Mce:i>=4?Cce:Nce,a){case"B":case"BB":case"BBB":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(t,{width:"narrow",context:"formatting"});default:return n.dayPeriod(t,{width:"wide",context:"formatting"})}},h:function(e,a,n){if("ho"===a){var t=e.getUTCHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return fce(e,a)},H:function(e,a,n){return"Ho"===a?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):yce(e,a)},K:function(e,a,n){var t=e.getUTCHours()%12;return"Ko"===a?n.ordinalNumber(t,{unit:"hour"}):hce(t,a.length)},k:function(e,a,n){var t=e.getUTCHours();return 0===t&&(t=24),"ko"===a?n.ordinalNumber(t,{unit:"hour"}):hce(t,a.length)},m:function(e,a,n){return"mo"===a?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):kce(e,a)},s:function(e,a,n){return"so"===a?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):bce(e,a)},S:function(e,a){return Sce(e,a)},X:function(e,a,n,t){var i=(t._originalDate||e).getTimezoneOffset();if(0===i)return"Z";switch(a){case"X":return Pce(i);case"XXXX":case"XX":return jce(i);default:return jce(i,":")}},x:function(e,a,n,t){var i=(t._originalDate||e).getTimezoneOffset();switch(a){case"x":return Pce(i);case"xxxx":case"xx":return jce(i);default:return jce(i,":")}},O:function(e,a,n,t){var i=(t._originalDate||e).getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+Ece(i,":");default:return"GMT"+jce(i,":")}},z:function(e,a,n,t){var i=(t._originalDate||e).getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+Ece(i,":");default:return"GMT"+jce(i,":")}},t:function(e,a,n,t){return hce(Math.floor((t._originalDate||e).getTime()/1e3),a.length)},T:function(e,a,n,t){return hce((t._originalDate||e).getTime(),a.length)}};function Ece(e,a){var n=e>0?"-":"+",t=Math.abs(e),i=Math.floor(t/60),r=t%60;if(0===r)return n+String(i);var o=a;return n+String(i)+o+hce(r,2)}function Pce(e,a){return e%60==0?(e>0?"-":"+")+hce(Math.abs(e)/60,2):jce(e,a)}function jce(e,a){var n=a||"",t=e>0?"-":"+",i=Math.abs(e);return t+hce(Math.floor(i/60),2)+n+hce(i%60,2)}var Lce=function(e,a){switch(e){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});default:return a.date({width:"full"})}},Bce=function(e,a){switch(e){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});default:return a.time({width:"full"})}},zce={p:Bce,P:function(e,a){var n,t=e.match(/(P+)(p+)?/)||[],i=t[1],r=t[2];if(!r)return Lce(e,a);switch(i){case"P":n=a.dateTime({width:"short"});break;case"PP":n=a.dateTime({width:"medium"});break;case"PPP":n=a.dateTime({width:"long"});break;default:n=a.dateTime({width:"full"})}return n.replace("{{date}}",Lce(i,a)).replace("{{time}}",Bce(r,a))}},Rce=["D","DD"],_ce=["YY","YYYY"];function Dce(e,a,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(a,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(a,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(a,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(a,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Kce={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function Hce(e){return function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=a.width?String(a.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Oce={date:Hce({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Hce({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Hce({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ice={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Gce(e){return function(a,n){var t;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,r=null!=n&&n.width?String(n.width):i;t=e.formattingValues[r]||e.formattingValues[i]}else{var o=e.defaultWidth,s=null!=n&&n.width?String(n.width):e.defaultWidth;t=e.values[s]||e.values[o]}return t[e.argumentCallback?e.argumentCallback(a):a]}}var Vce={ordinalNumber:function(e,a){var n=Number(e),t=n%100;if(t>20||t<10)switch(t%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Gce({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Gce({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Gce({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Gce({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Gce({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function Fce(e){return function(a){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.width,i=a.match(t&&e.matchPatterns[t]||e.matchPatterns[e.defaultMatchWidth]);if(!i)return null;var r,o=i[0],s=t&&e.parsePatterns[t]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,a){for(var n=0;n<e.length;n++)if(a(e[n]))return n;return}(s,(function(e){return e.test(o)})):function(e,a){for(var n in e)if(e.hasOwnProperty(n)&&a(e[n]))return n;return}(s,(function(e){return e.test(o)}));return r=e.valueCallback?e.valueCallback(l):l,{value:r=n.valueCallback?n.valueCallback(r):r,rest:a.slice(o.length)}}}var Jce={ordinalNumber:function(e){return function(a){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=a.match(e.matchPattern);if(!t)return null;var i=t[0],r=a.match(e.parsePattern);if(!r)return null;var o=e.valueCallback?e.valueCallback(r[0]):r[0];return{value:o=n.valueCallback?n.valueCallback(o):o,rest:a.slice(i.length)}}}({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Fce({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Fce({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:Fce({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Fce({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Fce({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},Uce={code:"en-US",formatDistance:function(e,a,n){var t,i=Kce[e];return t="string"==typeof i?i:1===a?i.one:i.other.replace("{{count}}",a.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+t:t+" ago":t},formatLong:Oce,formatRelative:function(e,a,n,t){return Ice[e]},localize:Vce,match:Jce,options:{weekStartsOn:0,firstWeekContainsDate:1}},Wce=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qce=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zce=/^'([^]*?)'?$/,$ce=/''/g,Yce=/[a-zA-Z]/;function Qce(e,a,n){var t,i,r,o,s,l,u,c,d,m,h,p,g,v,f,y,k,b;Kue(2,arguments);var S=String(a),A=Vue(),w=null!==(t=null!==(i=null==n?void 0:n.locale)&&void 0!==i?i:A.locale)&&void 0!==t?t:Uce,C=Due(null!==(r=null!==(o=null!==(s=null!==(l=null==n?void 0:n.firstWeekContainsDate)&&void 0!==l?l:null==n||null===(u=n.locale)||void 0===u||null===(c=u.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==s?s:A.firstWeekContainsDate)&&void 0!==o?o:null===(d=A.locale)||void 0===d||null===(m=d.options)||void 0===m?void 0:m.firstWeekContainsDate)&&void 0!==r?r:1);if(!(C>=1&&C<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var M=Due(null!==(h=null!==(p=null!==(g=null!==(v=null==n?void 0:n.weekStartsOn)&&void 0!==v?v:null==n||null===(f=n.locale)||void 0===f||null===(y=f.options)||void 0===y?void 0:y.weekStartsOn)&&void 0!==g?g:A.weekStartsOn)&&void 0!==p?p:null===(k=A.locale)||void 0===k||null===(b=k.options)||void 0===b?void 0:b.weekStartsOn)&&void 0!==h?h:0);if(!(M>=0&&M<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!w.localize)throw new RangeError("locale must contain localize property");if(!w.formatLong)throw new RangeError("locale must contain formatLong property");var T=Hue(e);if(!function(e){if(Kue(1,arguments),!Xue(e)&&"number"!=typeof e)return!1;var a=Hue(e);return!isNaN(Number(a))}(T))throw new RangeError("Invalid time value");var N=oce(T,Wue(T)),x={firstWeekContainsDate:C,weekStartsOn:M,locale:w,_originalDate:T};return S.match(qce).map((function(e){var a=e[0];return"p"===a||"P"===a?(0,zce[a])(e,w.formatLong):e})).join("").match(Wce).map((function(t){if("''"===t)return"'";var i=t[0];if("'"===i)return function(e){var a=e.match(Zce);if(!a)return e;return a[1].replace($ce,"'")}(t);var r=xce[i];if(r)return null!=n&&n.useAdditionalWeekYearTokens||-1===_ce.indexOf(t)||Dce(t,a,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==Rce.indexOf(e)}(t)||Dce(t,a,String(e)),r(N,t,w.localize,x);if(i.match(Yce))throw new RangeError("Format string contains an unescaped latin alphabet character `"+i+"`");return t})).join("")}function Xce(e){return Kue(1,arguments),Math.floor(function(e){return Kue(1,arguments),Hue(e).getTime()}(e)/1e3)}function ede(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.firstWeekContainsDate)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:c.firstWeekContainsDate)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==n?n:1),m=function(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Hue(e),d=c.getFullYear(),m=Vue(),h=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.firstWeekContainsDate)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:m.firstWeekContainsDate)&&void 0!==t?t:null===(l=m.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==n?n:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setFullYear(d+1,0,h),p.setHours(0,0,0,0);var g=Fue(p,a),v=new Date(0);v.setFullYear(d,0,h),v.setHours(0,0,0,0);var f=Fue(v,a);return c.getTime()>=g.getTime()?d+1:c.getTime()>=f.getTime()?d:d-1}(e,a),h=new Date(0);return h.setFullYear(m,0,d),h.setHours(0,0,0,0),Fue(h,a)}function ade(e,a){return Kue(1,arguments),function(e,a,n){Kue(2,arguments);var t=Fue(e,n),i=Fue(a,n),r=t.getTime()-Wue(t),o=i.getTime()-Wue(i);return Math.round((r-o)/6048e5)}(function(e){Kue(1,arguments);var a=Hue(e),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(0,0,0,0),a}(e),nce(e),a)+1}function nde(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return n.getTime()>t.getTime()}function tde(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return n.getTime()<t.getTime()}function ide(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()}function rde(e,a){return Kue(2,arguments),Oue(e,-Due(a))}function ode(e,a){Kue(2,arguments);var n=Hue(e),t=Due(a),i=n.getFullYear(),r=n.getDate(),o=new Date(0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);var s=function(e){Kue(1,arguments);var a=Hue(e),n=a.getFullYear(),t=a.getMonth(),i=new Date(0);return i.setFullYear(n,t+1,0),i.setHours(0,0,0,0),i.getDate()}(o);return n.setMonth(t,Math.min(r,s)),n}function sde(e,a){Kue(2,arguments);var n=Hue(e),t=Due(a);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(t),n)}var lde=function(){return lde=Object.assign||function(e){for(var a,n=1,t=arguments.length;n<t;n++)for(var i in a=arguments[n])Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);return e},lde.apply(this,arguments)};function ude(e,a,n){for(var t,i=0,r=a.length;i<r;i++)!t&&i in a||(t||(t=Array.prototype.slice.call(a,0,i)),t[i]=a[i]);return e.concat(t||Array.prototype.slice.call(a))}function cde(e){return"multiple"===e.mode}function dde(e){return"range"===e.mode}function mde(e){return"single"===e.mode}"function"==typeof SuppressedError&&SuppressedError;var hde={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};var pde=Object.freeze({__proto__:null,formatCaption:function(e,a){return Qce(e,"LLLL y",a)},formatDay:function(e,a){return Qce(e,"d",a)},formatMonthCaption:function(e,a){return Qce(e,"LLLL",a)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,a){return Qce(e,"cccccc",a)},formatYearCaption:function(e,a){return Qce(e,"yyyy",a)}}),gde=Object.freeze({__proto__:null,labelDay:function(e,a,n){return Qce(e,"do MMMM (EEEE)",n)},labelMonthDropdown:function(){return"Month: "},labelNext:function(){return"Go to next month"},labelPrevious:function(){return"Go to previous month"},labelWeekNumber:function(e){return"Week n. ".concat(e)},labelWeekday:function(e,a){return Qce(e,"cccc",a)},labelYearDropdown:function(){return"Year: "}});var vde=a.createContext(void 0);function fde(e){var a,t,i=e.initialProps,r={captionLayout:"buttons",classNames:hde,formatters:pde,labels:gde,locale:Uce,modifiersClassNames:{},modifiers:{},numberOfMonths:1,styles:{},today:new Date,mode:"default"},o=function(e){var a=e.fromYear,n=e.toYear,t=e.fromMonth,i=e.toMonth,r=e.fromDate,o=e.toDate;return t?r=nce(t):a&&(r=new Date(a,0,1)),i?o=ace(i):n&&(o=new Date(n,11,31)),{fromDate:r?que(r):void 0,toDate:o?que(o):void 0}}(i),s=o.fromDate,l=o.toDate,u=null!==(a=i.captionLayout)&&void 0!==a?a:r.captionLayout;"buttons"===u||s&&l||(u="buttons"),(mde(i)||cde(i)||dde(i))&&(t=i.onSelect);var c=lde(lde(lde({},r),i),{captionLayout:u,classNames:lde(lde({},r.classNames),i.classNames),components:lde({},i.components),formatters:lde(lde({},r.formatters),i.formatters),fromDate:s,labels:lde(lde({},r.labels),i.labels),mode:i.mode||r.mode,modifiers:lde(lde({},r.modifiers),i.modifiers),modifiersClassNames:lde(lde({},r.modifiersClassNames),i.modifiersClassNames),onSelect:t,styles:lde(lde({},r.styles),i.styles),toDate:l});return n.jsx(vde.Provider,{value:c,children:e.children})}function yde(){var e=a.useContext(vde);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function kde(e){var a=yde();return n.jsx("div",{className:a.classNames.caption_label,style:a.styles.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:(0,a.formatters.formatCaption)(e.displayMonth,{locale:a.locale})})}function bde(e){return n.jsx("svg",lde({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:n.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Sde(e){var a,t,i=e.onChange,r=e.value,o=e.children,s=e.caption,l=e.className,u=e.style,c=yde(),d=null!==(t=null===(a=c.components)||void 0===a?void 0:a.IconDropdown)&&void 0!==t?t:bde;return n.jsxs("div",{className:l,style:u,children:[n.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),n.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:r,onChange:i,children:o}),n.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,n.jsx(d,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function Ade(e){var a,t=yde(),i=t.fromDate,r=t.toDate,o=t.styles,s=t.locale,l=t.formatters.formatMonthCaption,u=t.classNames,c=t.components,d=t.labels.labelMonthDropdown;if(!i)return n.jsx(n.Fragment,{});if(!r)return n.jsx(n.Fragment,{});var m=[];if(function(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return n.getFullYear()===t.getFullYear()}(i,r))for(var h=nce(i),p=i.getMonth();p<=r.getMonth();p++)m.push(ode(h,p));else for(h=nce(new Date),p=0;p<=11;p++)m.push(ode(h,p));var g=null!==(a=null==c?void 0:c.Dropdown)&&void 0!==a?a:Sde;return n.jsx(g,{name:"months","aria-label":d(),className:u.dropdown_month,style:o.dropdown_month,onChange:function(a){var n=Number(a.target.value),t=ode(nce(e.displayMonth),n);e.onChange(t)},value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:s}),children:m.map((function(e){return n.jsx("option",{value:e.getMonth(),children:l(e,{locale:s})},e.getMonth())}))})}function wde(e){var a,t=e.displayMonth,i=yde(),r=i.fromDate,o=i.toDate,s=i.locale,l=i.styles,u=i.classNames,c=i.components,d=i.formatters.formatYearCaption,m=i.labels.labelYearDropdown,h=[];if(!r)return n.jsx(n.Fragment,{});if(!o)return n.jsx(n.Fragment,{});for(var p=r.getFullYear(),g=o.getFullYear(),v=p;v<=g;v++)h.push(sde(tce(new Date),v));var f=null!==(a=null==c?void 0:c.Dropdown)&&void 0!==a?a:Sde;return n.jsx(f,{name:"years","aria-label":m(),className:u.dropdown_year,style:l.dropdown_year,onChange:function(a){var n=sde(nce(t),Number(a.target.value));e.onChange(n)},value:t.getFullYear(),caption:d(t,{locale:s}),children:h.map((function(e){return n.jsx("option",{value:e.getFullYear(),children:d(e,{locale:s})},e.getFullYear())}))})}function Cde(){var e=yde(),n=function(e){var a=e.month||e.defaultMonth||e.today||new Date,n=e.toDate,t=e.fromDate,i=e.numberOfMonths,r=void 0===i?1:i;return n&&ece(n,a)<0&&(a=Iue(n,-1*(r-1))),t&&ece(a,t)<0&&(a=t),nce(a)}(e),t=function(e,n){var t=a.useState(e);return[void 0===n?t[0]:n,t[1]]}(n,e.month),i=t[1];return[t[0],function(a){var n;if(!e.disableNavigation){var t=nce(a);i(t),null===(n=e.onMonthChange)||void 0===n||n.call(e,t)}}]}var Mde=a.createContext(void 0);function Tde(e){var a=yde(),t=Cde(),i=t[0],r=t[1],o=function(e,a){for(var n=a.reverseMonths,t=a.numberOfMonths,i=nce(e),r=ece(nce(Iue(i,t)),i),o=[],s=0;s<r;s++){var l=Iue(i,s);o.push(l)}return n&&(o=o.reverse()),o}(i,a),s=function(e,a){if(!a.disableNavigation){var n=a.toDate,t=a.numberOfMonths,i=void 0===t?1:t,r=a.pagedNavigation?i:1,o=nce(e);if(!n)return Iue(o,r);if(!(ece(n,e)<i))return Iue(o,r)}}(i,a),l=function(e,a){if(!a.disableNavigation){var n=a.fromDate,t=a.numberOfMonths,i=a.pagedNavigation?void 0===t?1:t:1,r=nce(e);if(!n)return Iue(r,-i);if(!(ece(r,n)<=0))return Iue(r,-i)}}(i,a),u=function(e){return o.some((function(a){return ide(e,a)}))};return n.jsx(Mde.Provider,{value:{currentMonth:i,displayMonths:o,goToMonth:r,goToDate:function(e,n){u(e)||(n&&tde(e,n)?r(Iue(e,1+-1*a.numberOfMonths)):r(e))},previousMonth:l,nextMonth:s,isDateDisplayed:u},children:e.children})}function Nde(){var e=a.useContext(Mde);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function xde(e){var a,t=yde(),i=t.classNames,r=t.styles,o=t.components,s=Nde().goToMonth,l=function(a){s(Iue(a,e.displayIndex?-e.displayIndex:0))},u=null!==(a=null==o?void 0:o.CaptionLabel)&&void 0!==a?a:kde,c=n.jsx(u,{id:e.id,displayMonth:e.displayMonth});return n.jsxs("div",{className:i.caption_dropdowns,style:r.caption_dropdowns,children:[n.jsx("div",{className:i.vhidden,children:c}),n.jsx(Ade,{onChange:l,displayMonth:e.displayMonth}),n.jsx(wde,{onChange:l,displayMonth:e.displayMonth})]})}function Ede(e){return n.jsx("svg",lde({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:n.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Pde(e){return n.jsx("svg",lde({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:n.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var jde=a.forwardRef((function(e,a){var t=yde(),i=t.classNames,r=t.styles,o=[i.button_reset,i.button];e.className&&o.push(e.className);var s=o.join(" "),l=lde(lde({},r.button_reset),r.button);return e.style&&Object.assign(l,e.style),n.jsx("button",lde({},e,{ref:a,type:"button",className:s,style:l}))}));function Lde(e){var a,t,i=yde(),r=i.dir,o=i.locale,s=i.classNames,l=i.styles,u=i.labels,c=u.labelPrevious,d=u.labelNext,m=i.components;if(!e.nextMonth&&!e.previousMonth)return n.jsx(n.Fragment,{});var h=c(e.previousMonth,{locale:o}),p=[s.nav_button,s.nav_button_previous].join(" "),g=d(e.nextMonth,{locale:o}),v=[s.nav_button,s.nav_button_next].join(" "),f=null!==(a=null==m?void 0:m.IconRight)&&void 0!==a?a:Pde,y=null!==(t=null==m?void 0:m.IconLeft)&&void 0!==t?t:Ede;return n.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&n.jsx(jde,{name:"previous-month","aria-label":h,className:p,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:n.jsx("rtl"===r?f:y,{className:s.nav_icon,style:l.nav_icon})}),!e.hideNext&&n.jsx(jde,{name:"next-month","aria-label":g,className:v,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:n.jsx("rtl"===r?y:f,{className:s.nav_icon,style:l.nav_icon})})]})}function Bde(e){var a=yde().numberOfMonths,t=Nde(),i=t.previousMonth,r=t.nextMonth,o=t.goToMonth,s=t.displayMonths,l=s.findIndex((function(a){return ide(e.displayMonth,a)})),u=0===l,c=l===s.length-1;return n.jsx(Lde,{displayMonth:e.displayMonth,hideNext:a>1&&(u||!c),hidePrevious:a>1&&(c||!u),nextMonth:r,previousMonth:i,onPreviousClick:function(){i&&o(i)},onNextClick:function(){r&&o(r)}})}function zde(e){var a,t,i=yde(),r=i.classNames,o=i.styles,s=i.captionLayout,l=i.components,u=null!==(a=null==l?void 0:l.CaptionLabel)&&void 0!==a?a:kde;return t=i.disableNavigation?n.jsx(u,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===s?n.jsx(xde,{displayMonth:e.displayMonth,id:e.id}):n.jsxs(n.Fragment,"dropdown-buttons"===s?{children:[n.jsx(xde,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),n.jsx(Bde,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}:{children:[n.jsx(u,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),n.jsx(Bde,{displayMonth:e.displayMonth,id:e.id})]}),n.jsx("div",{className:r.caption,style:o.caption,children:t})}function Rde(e){var a=yde(),t=a.footer;return t?n.jsx("tfoot",{className:a.classNames.tfoot,style:a.styles.tfoot,children:n.jsx("tr",{children:n.jsx("td",{colSpan:8,children:t})})}):n.jsx(n.Fragment,{})}function _de(){var e=yde(),a=e.classNames,t=e.styles,i=e.showWeekNumber,r=e.locale,o=e.formatters.formatWeekdayName,s=e.labels.labelWeekday,l=function(e,a,n){for(var t=n?Jue(new Date):Fue(new Date,{locale:e,weekStartsOn:a}),i=[],r=0;r<7;r++){var o=Oue(t,r);i.push(o)}return i}(r,e.weekStartsOn,e.ISOWeek);return n.jsxs("tr",{style:t.head_row,className:a.head_row,children:[i&&n.jsx("td",{style:t.head_cell,className:a.head_cell}),l.map((function(e,i){return n.jsx("th",{scope:"col",className:a.head_cell,style:t.head_cell,"aria-label":s(e,{locale:r}),children:o(e,{locale:r})},i)}))]})}function Dde(){var e,a=yde(),t=a.components,i=null!==(e=null==t?void 0:t.HeadRow)&&void 0!==e?e:_de;return n.jsx("thead",{style:a.styles.head,className:a.classNames.head,children:n.jsx(i,{})})}function Kde(e){var a=yde();return n.jsx(n.Fragment,{children:(0,a.formatters.formatDay)(e.date,{locale:a.locale})})}var Hde=a.createContext(void 0);function Ode(e){if(!cde(e.initialProps)){return n.jsx(Hde.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}return n.jsx(Ide,{initialProps:e.initialProps,children:e.children})}function Ide(e){var a=e.initialProps,t=e.children,i=a.selected,r=a.min,o=a.max,s={disabled:[]};return i&&s.disabled.push((function(e){var a=o&&i.length>o-1,n=i.some((function(a){return Que(a,e)}));return Boolean(a&&!n)})),n.jsx(Hde.Provider,{value:{selected:i,onDayClick:function(e,n,t){var s,l;if((null===(s=a.onDayClick)||void 0===s||s.call(a,e,n,t),!Boolean(n.selected&&r&&(null==i?void 0:i.length)===r))&&!Boolean(!n.selected&&o&&(null==i?void 0:i.length)===o)){var u=i?ude([],i):[];if(n.selected){var c=u.findIndex((function(a){return Que(e,a)}));u.splice(c,1)}else u.push(e);null===(l=a.onSelect)||void 0===l||l.call(a,u,e,n,t)}},modifiers:s},children:t})}function Gde(){var e=a.useContext(Hde);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var Vde,Fde,Jde=a.createContext(void 0);function Ude(e){if(!dde(e.initialProps)){return n.jsx(Jde.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}return n.jsx(Wde,{initialProps:e.initialProps,children:e.children})}function Wde(e){var a=e.initialProps,t=e.children,i=a.selected,r=i||{},o=r.from,s=r.to,l=a.min,u=a.max,c={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(c.range_start=[o],s?(c.range_end=[s],Que(o,s)||(c.range_middle=[{after:o,before:s}])):c.range_end=[o]):s&&(c.range_start=[s],c.range_end=[s]),l&&(o&&!s&&c.disabled.push({after:rde(o,l-1),before:Oue(o,l-1)}),o&&s&&c.disabled.push({after:o,before:Oue(o,l-1)}),!o&&s&&c.disabled.push({after:rde(s,l-1),before:Oue(s,l-1)})),u){if(o&&!s&&(c.disabled.push({before:Oue(o,1-u)}),c.disabled.push({after:Oue(o,u-1)})),o&&s){var d=u-(Zue(s,o)+1);c.disabled.push({before:rde(o,d)}),c.disabled.push({after:Oue(s,d)})}!o&&s&&(c.disabled.push({before:Oue(s,1-u)}),c.disabled.push({after:Oue(s,u-1)}))}return n.jsx(Jde.Provider,{value:{selected:i,onDayClick:function(e,n,t){var r,o;null===(r=a.onDayClick)||void 0===r||r.call(a,e,n,t);var s=function(e,a){var n=a||{},t=n.from,i=n.to;if(t&&i){if(Que(i,e)&&Que(t,e))return;if(Que(i,e))return{from:i,to:void 0};if(Que(t,e))return;return nde(t,e)?{from:e,to:i}:{from:t,to:e}}return i?nde(e,i)?{from:i,to:e}:{from:e,to:i}:t?tde(e,t)?{from:e,to:t}:{from:t,to:e}:{from:e,to:void 0}}(e,i);null===(o=a.onSelect)||void 0===o||o.call(a,s,e,n,t)},modifiers:c},children:t})}function qde(){var e=a.useContext(Jde);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Zde(e){return Array.isArray(e)?ude([],e):void 0!==e?[e]:[]}(Fde=Vde||(Vde={})).Outside="outside",Fde.Disabled="disabled",Fde.Selected="selected",Fde.Hidden="hidden",Fde.Today="today",Fde.RangeStart="range_start",Fde.RangeEnd="range_end",Fde.RangeMiddle="range_middle";var $de=Vde.Selected,Yde=Vde.Disabled,Qde=Vde.Hidden,Xde=Vde.Today,eme=Vde.RangeEnd,ame=Vde.RangeMiddle,nme=Vde.RangeStart,tme=Vde.Outside;var ime=a.createContext(void 0);function rme(e){var a=yde(),t=function(e,a,n){var t,i=((t={})[$de]=Zde(e.selected),t[Yde]=Zde(e.disabled),t[Qde]=Zde(e.hidden),t[Xde]=[e.today],t[eme]=[],t[ame]=[],t[nme]=[],t[tme]=[],t);return e.fromDate&&i[Yde].push({before:e.fromDate}),e.toDate&&i[Yde].push({after:e.toDate}),cde(e)?i[Yde]=i[Yde].concat(a.modifiers[Yde]):dde(e)&&(i[Yde]=i[Yde].concat(n.modifiers[Yde]),i[nme]=n.modifiers[nme],i[ame]=n.modifiers[ame],i[eme]=n.modifiers[eme]),i}(a,Gde(),qde()),i=function(e){var a={};return Object.entries(e).forEach((function(e){a[e[0]]=Zde(e[1])})),a}(a.modifiers),r=lde(lde({},t),i);return n.jsx(ime.Provider,{value:r,children:e.children})}function ome(){var e=a.useContext(ime);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function sme(e,a){return a.some((function(a){if("boolean"==typeof a)return a;if(Xue(a))return Que(e,a);var n,t,i,r,o;if(function(e){return Array.isArray(e)&&e.every(Xue)}(a))return a.includes(e);if(function(e){return Boolean(e&&"object"==typeof e&&"from"in e)}(a))return n=e,o=(t=a).to,(r=t.from)&&o?(Zue(o,r)<0&&(r=(i=[o,r])[0],o=i[1]),Zue(n,r)>=0&&Zue(o,n)>=0):o?Que(o,n):!!r&&Que(r,n);if(function(e){return Boolean(e&&"object"==typeof e&&"dayOfWeek"in e)}(a))return a.dayOfWeek.includes(e.getDay());if(function(e){return Boolean(e&&"object"==typeof e&&"before"in e&&"after"in e)}(a)){var s=Zue(a.before,e)>0,l=Zue(a.after,e)<0;return nde(a.before,a.after)?l&&s:s||l}return function(e){return Boolean(e&&"object"==typeof e&&"after"in e)}(a)?Zue(e,a.after)>0:function(e){return Boolean(e&&"object"==typeof e&&"before"in e)}(a)?Zue(a.before,e)>0:"function"==typeof a&&a(e)}))}function lme(e,a,n){var t=Object.keys(a).reduce((function(n,t){return sme(e,a[t])&&n.push(t),n}),[]),i={};return t.forEach((function(e){return i[e]=!0})),n&&!ide(e,n)&&(i.outside=!0),i}function ume(e,a){var n=a.moveBy,t=a.direction,i=a.context,r=a.modifiers,o=a.retry,s=void 0===o?{count:0,lastFocused:e}:o,l=i.weekStartsOn,u=i.fromDate,c=i.toDate,d=i.locale,m={day:Oue,week:$ue,month:Iue,year:Yue,startOfWeek:function(e){return i.ISOWeek?Jue(e):Fue(e,{locale:d,weekStartsOn:l})},endOfWeek:function(e){return i.ISOWeek?rce(e):ice(e,{locale:d,weekStartsOn:l})}}[n](e,"after"===t?1:-1);"before"===t&&u?m=function(e){var a,n;if(Kue(1,arguments),e&&"function"==typeof e.forEach)a=e;else{if("object"!==_ue(e)||null===e)return new Date(NaN);a=Array.prototype.slice.call(e)}return a.forEach((function(e){var a=Hue(e);(void 0===n||n<a||isNaN(Number(a)))&&(n=a)})),n||new Date(NaN)}([u,m]):"after"===t&&c&&(m=function(e){var a,n;if(Kue(1,arguments),e&&"function"==typeof e.forEach)a=e;else{if("object"!==_ue(e)||null===e)return new Date(NaN);a=Array.prototype.slice.call(e)}return a.forEach((function(e){var a=Hue(e);(void 0===n||n>a||isNaN(a.getDate()))&&(n=a)})),n||new Date(NaN)}([c,m]));var h=!0;if(r){var p=lme(m,r);h=!p.disabled&&!p.hidden}return h?m:s.count>365?s.lastFocused:ume(m,{moveBy:n,direction:t,context:i,modifiers:r,retry:lde(lde({},s),{count:s.count+1})})}var cme=a.createContext(void 0);function dme(e){var t=Nde(),i=ome(),r=a.useState(),o=r[0],s=r[1],l=a.useState(),u=l[0],c=l[1],d=function(e,a){for(var n,t,i=nce(e[0]),r=ace(e[e.length-1]),o=i;o<=r;){var s=lme(o,a);if(s.disabled||s.hidden)o=Oue(o,1);else{if(s.selected)return o;s.today&&!t&&(t=o),n||(n=o),o=Oue(o,1)}}return t||n}(t.displayMonths,i),m=(null!=o?o:u&&t.isDateDisplayed(u))?u:d,h=function(e){s(e)},p=yde(),g=function(e,a){if(o){var n=ume(o,{moveBy:e,direction:a,context:p,modifiers:i});Que(o,n)||(t.goToDate(n,o),h(n))}};return n.jsx(cme.Provider,{value:{focusedDay:o,focusTarget:m,blur:function(){c(o),s(void 0)},focus:h,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}},children:e.children})}function mme(){var e=a.useContext(cme);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}var hme=a.createContext(void 0);function pme(e){if(!mde(e.initialProps)){return n.jsx(hme.Provider,{value:{selected:void 0},children:e.children})}return n.jsx(gme,{initialProps:e.initialProps,children:e.children})}function gme(e){var a=e.initialProps;return n.jsx(hme.Provider,{value:{selected:a.selected,onDayClick:function(e,n,t){var i,r,o;null===(i=a.onDayClick)||void 0===i||i.call(a,e,n,t),!n.selected||a.required?null===(o=a.onSelect)||void 0===o||o.call(a,e,e,n,t):null===(r=a.onSelect)||void 0===r||r.call(a,void 0,e,n,t)}},children:e.children})}function vme(){var e=a.useContext(hme);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function fme(e,a){var n=[e.classNames.day];return Object.keys(a).forEach((function(a){var t=e.modifiersClassNames[a];if(t)n.push(t);else if(function(e){return Object.values(Vde).includes(e)}(a)){var i=e.classNames["day_".concat(a)];i&&n.push(i)}})),n}function yme(e,t,i){var r,o,s,l=yde(),u=mme(),c=function(e,a){return lme(e,ome(),a)}(e,t),d=function(e,a){var n=yde(),t=vme(),i=Gde(),r=qde(),o=mme(),s=o.focusDayAfter,l=o.focusDayBefore,u=o.focusWeekAfter,c=o.focusWeekBefore,d=o.blur,m=o.focus,h=o.focusMonthBefore,p=o.focusMonthAfter,g=o.focusYearBefore,v=o.focusYearAfter,f=o.focusStartOfWeek,y=o.focusEndOfWeek;return{onClick:function(o){var s,l,u,c;mde(n)?null===(s=t.onDayClick)||void 0===s||s.call(t,e,a,o):cde(n)?null===(l=i.onDayClick)||void 0===l||l.call(i,e,a,o):dde(n)?null===(u=r.onDayClick)||void 0===u||u.call(r,e,a,o):null===(c=n.onDayClick)||void 0===c||c.call(n,e,a,o)},onFocus:function(t){var i;m(e),null===(i=n.onDayFocus)||void 0===i||i.call(n,e,a,t)},onBlur:function(t){var i;d(),null===(i=n.onDayBlur)||void 0===i||i.call(n,e,a,t)},onKeyDown:function(t){var i;switch(t.key){case"ArrowLeft":t.preventDefault(),t.stopPropagation(),"rtl"===n.dir?s():l();break;case"ArrowRight":t.preventDefault(),t.stopPropagation(),"rtl"===n.dir?l():s();break;case"ArrowDown":t.preventDefault(),t.stopPropagation(),u();break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),c();break;case"PageUp":t.preventDefault(),t.stopPropagation(),t.shiftKey?g():h();break;case"PageDown":t.preventDefault(),t.stopPropagation(),t.shiftKey?v():p();break;case"Home":t.preventDefault(),t.stopPropagation(),f();break;case"End":t.preventDefault(),t.stopPropagation(),y()}null===(i=n.onDayKeyDown)||void 0===i||i.call(n,e,a,t)},onKeyUp:function(t){var i;null===(i=n.onDayKeyUp)||void 0===i||i.call(n,e,a,t)},onMouseEnter:function(t){var i;null===(i=n.onDayMouseEnter)||void 0===i||i.call(n,e,a,t)},onMouseLeave:function(t){var i;null===(i=n.onDayMouseLeave)||void 0===i||i.call(n,e,a,t)},onPointerEnter:function(t){var i;null===(i=n.onDayPointerEnter)||void 0===i||i.call(n,e,a,t)},onPointerLeave:function(t){var i;null===(i=n.onDayPointerLeave)||void 0===i||i.call(n,e,a,t)},onTouchCancel:function(t){var i;null===(i=n.onDayTouchCancel)||void 0===i||i.call(n,e,a,t)},onTouchEnd:function(t){var i;null===(i=n.onDayTouchEnd)||void 0===i||i.call(n,e,a,t)},onTouchMove:function(t){var i;null===(i=n.onDayTouchMove)||void 0===i||i.call(n,e,a,t)},onTouchStart:function(t){var i;null===(i=n.onDayTouchStart)||void 0===i||i.call(n,e,a,t)}}}(e,c),m=function(){var e=yde(),a=vme(),n=Gde(),t=qde();return mde(e)?a.selected:cde(e)?n.selected:dde(e)?t.selected:void 0}(),h=Boolean(l.onDayClick||"default"!==l.mode);a.useEffect((function(){var a;c.outside||u.focusedDay&&h&&Que(u.focusedDay,e)&&(null===(a=i.current)||void 0===a||a.focus())}),[u.focusedDay,e,i,h,c.outside]);var p=fme(l,c).join(" "),g=function(e,a){var n=lde({},e.styles.day);return Object.keys(a).forEach((function(a){var t;n=lde(lde({},n),null===(t=e.modifiersStyles)||void 0===t?void 0:t[a])})),n}(l,c),v=Boolean(c.outside&&!l.showOutsideDays||c.hidden),f=null!==(s=null===(o=l.components)||void 0===o?void 0:o.DayContent)&&void 0!==s?s:Kde,y={style:g,className:p,children:n.jsx(f,{date:e,displayMonth:t,activeModifiers:c}),role:"gridcell"},k=u.focusTarget&&Que(u.focusTarget,e)&&!c.outside,b=u.focusedDay&&Que(u.focusedDay,e),S=lde(lde(lde({},y),((r={disabled:c.disabled,role:"gridcell"})["aria-selected"]=c.selected,r.tabIndex=b||k?0:-1,r)),d);return{isButton:h,isHidden:v,activeModifiers:c,selectedDays:m,buttonProps:S,divProps:y}}function kme(e){var t=a.useRef(null),i=yme(e.date,e.displayMonth,t);return i.isHidden?n.jsx("div",{role:"gridcell"}):i.isButton?n.jsx(jde,lde({name:"day",ref:t},i.buttonProps)):n.jsx("div",lde({},i.divProps))}function bme(e){var a=e.number,t=e.dates,i=yde(),r=i.onWeekNumberClick,o=i.styles,s=i.classNames,l=i.locale,u=i.labels.labelWeekNumber,c=(0,i.formatters.formatWeekNumber)(Number(a),{locale:l});if(!r)return n.jsx("span",{className:s.weeknumber,style:o.weeknumber,children:c});var d=u(Number(a),{locale:l});return n.jsx(jde,{name:"week-number","aria-label":d,className:s.weeknumber,style:o.weeknumber,onClick:function(e){r(a,t,e)},children:c})}function Sme(e){var a,t,i,r=yde(),o=r.styles,s=r.classNames,l=r.components,u=null!==(a=null==l?void 0:l.Day)&&void 0!==a?a:kme,c=null!==(t=null==l?void 0:l.WeekNumber)&&void 0!==t?t:bme;return r.showWeekNumber&&(i=n.jsx("td",{className:s.cell,style:o.cell,children:n.jsx(c,{number:e.weekNumber,dates:e.dates})})),n.jsxs("tr",{className:s.row,style:o.row,children:[i,e.dates.map((function(a){return n.jsx("td",{className:s.cell,style:o.cell,role:"presentation",children:n.jsx(u,{displayMonth:e.displayMonth,date:a})},Xce(a))}))]})}function Ame(e,a,n){for(var t=(null==n?void 0:n.ISOWeek)?rce(a):ice(a,n),i=(null==n?void 0:n.ISOWeek)?Jue(e):Fue(e,n),r=Zue(t,i),o=[],s=0;s<=r;s++)o.push(Oue(i,s));var l=o.reduce((function(e,a){var t=(null==n?void 0:n.ISOWeek)?function(e){Kue(1,arguments);var a=Hue(e),n=Jue(a).getTime()-Uue(a).getTime();return Math.round(n/6048e5)+1}(a):function(e,a){Kue(1,arguments);var n=Hue(e),t=Fue(n,a).getTime()-ede(n,a).getTime();return Math.round(t/6048e5)+1}(a,n),i=e.find((function(e){return e.weekNumber===t}));return i?(i.dates.push(a),e):(e.push({weekNumber:t,dates:[a]}),e)}),[]);return l}function wme(e){var a,t,i,r=yde(),o=r.locale,s=r.classNames,l=r.styles,u=r.hideHead,c=r.components,d=r.weekStartsOn,m=r.firstWeekContainsDate,h=r.ISOWeek,p=function(e,a){var n=Ame(nce(e),ace(e),a);if(null==a?void 0:a.useFixedWeeks){var t=ade(e,a);if(t<6){var i=n[n.length-1],r=i.dates[i.dates.length-1],o=$ue(r,6-t),s=Ame($ue(r,1),o,a);n.push.apply(n,s)}}return n}(e.displayMonth,{useFixedWeeks:Boolean(r.fixedWeeks),ISOWeek:h,locale:o,weekStartsOn:d,firstWeekContainsDate:m}),g=null!==(a=null==c?void 0:c.Head)&&void 0!==a?a:Dde,v=null!==(t=null==c?void 0:c.Row)&&void 0!==t?t:Sme,f=null!==(i=null==c?void 0:c.Footer)&&void 0!==i?i:Rde;return n.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!u&&n.jsx(g,{}),n.jsx("tbody",{className:s.tbody,style:l.tbody,children:p.map((function(a){return n.jsx(v,{displayMonth:e.displayMonth,dates:a.dates,weekNumber:a.weekNumber},a.weekNumber)}))}),n.jsx(f,{displayMonth:e.displayMonth})]})}var Cme="undefined"!=typeof window&&window.document&&window.document.createElement?a.useLayoutEffect:a.useEffect,Mme=!1,Tme=0;function Nme(){return"react-day-picker-".concat(++Tme)}function xme(e){var t,i,r=yde(),o=r.dir,s=r.classNames,l=r.styles,u=r.components,c=Nde().displayMonths,d=function(e){var n,t=null!=e?e:Mme?Nme():null,i=a.useState(t),r=i[0],o=i[1];return Cme((function(){null===r&&o(Nme())}),[]),a.useEffect((function(){!1===Mme&&(Mme=!0)}),[]),null!==(n=null!=e?e:r)&&void 0!==n?n:void 0}(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),m=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,h=[s.month],p=l.month,g=0===e.displayIndex,v=e.displayIndex===c.length-1,f=!g&&!v;"rtl"===o&&(v=(t=[g,v])[0],g=t[1]),g&&(h.push(s.caption_start),p=lde(lde({},p),l.caption_start)),v&&(h.push(s.caption_end),p=lde(lde({},p),l.caption_end)),f&&(h.push(s.caption_between),p=lde(lde({},p),l.caption_between));var y=null!==(i=null==u?void 0:u.Caption)&&void 0!==i?i:zde;return n.jsxs("div",{className:h.join(" "),style:p,children:[n.jsx(y,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),n.jsx(wme,{id:m,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function Eme(e){var a=yde();return n.jsx("div",{className:a.classNames.months,style:a.styles.months,children:e.children})}function Pme(e){var t,i,r=e.initialProps,o=yde(),s=mme(),l=Nde(),u=a.useState(!1),c=u[0],d=u[1];a.useEffect((function(){o.initialFocus&&s.focusTarget&&(c||(s.focus(s.focusTarget),d(!0)))}),[o.initialFocus,c,s.focus,s.focusTarget,s]);var m=[o.classNames.root,o.className];o.numberOfMonths>1&&m.push(o.classNames.multiple_months),o.showWeekNumber&&m.push(o.classNames.with_weeknumber);var h=lde(lde({},o.styles.root),o.style),p=Object.keys(r).filter((function(e){return e.startsWith("data-")})).reduce((function(e,a){var n;return lde(lde({},e),((n={})[a]=r[a],n))}),{}),g=null!==(i=null===(t=r.components)||void 0===t?void 0:t.Months)&&void 0!==i?i:Eme;return n.jsx("div",lde({className:m.join(" "),style:h,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},p,{children:n.jsx(g,{children:l.displayMonths.map((function(e,a){return n.jsx(xme,{displayIndex:a,displayMonth:e},a)}))})}))}function jme(e){var a=e.children,t=function(e,a){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);i<t.length;i++)a.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(n[t[i]]=e[t[i]])}return n}(e,["children"]);return n.jsx(fde,{initialProps:t,children:n.jsx(Tde,{children:n.jsx(pme,{initialProps:t,children:n.jsx(Ode,{initialProps:t,children:n.jsx(Ude,{initialProps:t,children:n.jsx(rme,{children:n.jsx(dme,{children:a})})})})})})})}function Lme(e){return n.jsx(jme,lde({},e,{children:n.jsx(Pme,{initialProps:e})}))}function Bme({className:e,classNames:a,showOutsideDays:t=!0,...i}){return n.jsx(Lme,{"data-reach-root":!0,showOutsideDays:t,className:im("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:im(PY({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground! rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:im("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent! [&:has([aria-selected].day-outside)]:bg-accent/50! [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===i.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:im(PY({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary! text-primary-foreground! hover:bg-primary! hover:text-primary-foreground! focus:bg-primary! focus:text-primary-foreground!",day_today:"bg-accent! text-accent-foreground!",day_outside:"day-outside text-muted-foreground! aria-selected:bg-accent/50! aria-selected:text-muted-foreground!",day_disabled:"text-muted-foreground! opacity-50",day_range_middle:"aria-selected:bg-accent! aria-selected:text-accent-foreground!",day_hidden:"invisible",...a},components:{IconLeft:()=>n.jsx(kc,{className:"h-4 w-4"}),IconRight:()=>n.jsx(bc,{className:"h-4 w-4"})},...i})}Bme.displayName="Calendar";const zme=({data:e,placeholder:a,searchPlaceholder:t,noResultsMessage:i,value:o,setValue:s})=>{const[l,u]=r.useState(!1);return n.jsxs(h9,{open:l,onOpenChange:u,modal:!0,children:[n.jsx(p9,{asChild:!0,children:n.jsxs(jY,{variant:"outline",role:"combobox","aria-expanded":l,className:"w-full max-w-[200px] justify-between bg-background",children:[o?e.find((e=>e.value===o))?.label:a,n.jsx(Ac,{className:"opacity-50"})]})}),n.jsx(g9,{className:"w-[200px] p-0",children:n.jsxs(Mse,{children:[n.jsx(Tse,{placeholder:t,className:"h-9"}),n.jsxs(Nse,{children:[n.jsx(xse,{children:i}),n.jsx(Ese,{children:e.map((e=>n.jsxs(Pse,{value:e.value,onSelect:e=>{s(e===o?"":e),u(!1)},children:[e.label,n.jsx(fc,{className:im("ml-auto",o===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},Rme=({setScheduleTime:e,setTimezone:a,timezone:t,scheduleTime:i,setIsDirty:o})=>{const[s,l]=r.useState(i&&i<(new Date).toISOString()?"Please select a time in the future":null),[u,c]=r.useState(i&&"now"!==i?dae(new Date(i),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),m=a=>{const n=Cee(new Date,15);new Date(a.toLocaleString("en-US",{timeZone:t}))<new Date(n.toLocaleString("en-US",{timeZone:t}))?l("Please select a time at least 15 minutes in the future"):(l(null),e(a.toISOString()),o(!0))};return n.jsx("div",{className:"w-full @container/schedule-time",children:n.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n.jsxs("div",{className:"flex gap-2 w-full @xl/schedule-time:flex-row flex-col items-center justify-center",children:[n.jsxs(h9,{children:[n.jsx(p9,{asChild:!0,children:n.jsxs(jY,{variant:"outline",className:im("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!i&&"text-muted-foreground"),children:[n.jsx(vc,{className:"mr-2 h-4 w-4"}),i?"now"===i?"Send immediately":dae(new Date(i),"PPP"):n.jsx("span",{children:"Pick a date"})]})}),n.jsx(g9,{className:"w-auto p-0 z-[60] pointer-events-auto",children:n.jsx(Bme,{mode:"single",selected:i?new Date(i):void 0,onSelect:e=>{if(!e)return;const[a,n]=u.split(":").map(Number);e.setHours(a,n),m(e)},disabled:e=>{const a=new Date;return a.setHours(0,0,0,0),e<a},initialFocus:!0})})]}),n.jsx("input",{type:"time",value:u,onChange:e=>{if(c(e.target.value),i&&e.target.value){const[a,n]=e.target.value.split(":").map(Number),t=new Date(i);t.setHours(a,n),m(t)}},className:im("flex h-9 w-full sm:w-[150px] rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s&&"border-red-500")}),n.jsx(zme,{data:d,placeholder:"Select timezone...",searchPlaceholder:"Search timezone...",noResultsMessage:"No timezone found",value:t,setValue:e=>{const n=new Date(i||(new Date).toISOString()),t=Cee(new Date,15);n<new Date(t.toLocaleString("en-US",{timeZone:e}))?l("Please select a time at least 15 minutes in the future"):(l(null),a(e),o(!0))}})]}),s&&n.jsxs("p",{className:"text-destructive text-sm mt-2 flex items-center",children:[n.jsx("span",{className:"mr-2",children:"⚠️"}),s]})]})})},_me=({title:e="Edit Schedule Time",autoSave:t=!1})=>{const i=wY(),{updateAutomation:r}=Je(i?.id||""),{toast:o}=Ie(),[s,l]=a.useState(null),[u,c]=a.useState(i?.triggerMetadata?.triggerType===Ze.ONE_TIME?i?.triggerMetadata?.scheduledAt:null),[d,m]=a.useState(i?.triggerMetadata?.triggerType===Ze.ONE_TIME&&i?.triggerMetadata?.timezone||"America/New_York"),[h,p]=a.useState(!1),g=a.useCallback((()=>{if("sendNow"===s)r({trigger:{triggerType:Ze.ONE_TIME,scheduledAt:"now"}}),o({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),p(!1);else{if(!u||!d)return;r({trigger:{triggerType:Ze.ONE_TIME,scheduledAt:u,timezone:d}}),o({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(u).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),p(!1)}}),[s,u,d,r,o]);if(a.useEffect((()=>{}),[i]),a.useEffect((()=>{t&&h&&(g(),p(!1))}),[t,h,g]),!i)return null;const v=i.status===Xe.DRAFT,f=!(h&&v);return n.jsx(Bue,{title:e,headerActions:t?void 0:n.jsxs("div",{className:LG(f?"cursor-not-allowed opacity-50":"cursor-pointer","gap-2 flex items-center"),children:[n.jsx(jY,{onClick:g,disabled:f,children:"Save"}),!v&&n.jsx(Mae,{title:"You can only edit the schedule time if the automation is in draft mode"})]}),children:n.jsx("div",{className:"@container flex-1 mx-4",children:n.jsxs("div",{className:"flex @[1000px]:flex-row flex-col gap-8 items-center",children:[n.jsxs("div",{className:"flex-1 w-full",children:[n.jsxs("div",{className:"grid grid-cols-1 @[480px]:grid-cols-2 gap-4",children:[n.jsx(zY,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:n.jsx(RY.SendButton,{className:"text-primary"}),onClick:()=>{v&&(l("sendNow"),c("now"),m("America/New_York"),p(!0))}}),n.jsx(zY,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:n.jsx(RY.ScheduleButton,{className:"text-primary"}),onClick:()=>{v&&l("schedule")}})]}),n.jsx(aV,{children:"schedule"===s&&n.jsx(EY,{className:"overflow-hidden mt-8",children:n.jsx("div",{className:"bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center",children:n.jsx(Rme,{setScheduleTime:c,setTimezone:m,timezone:d,scheduleTime:u,setIsDirty:p})})})})]}),u&&n.jsx(H$.div,{initial:{opacity:0,y:10,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.6,ease:[.23,1,.32,1],delay:.1},className:"@[1000px]:w-80 max-w-md w-full shrink-0 h-fit p-4 bg-blue-50 rounded-xl border border-blue-100 backdrop-blur-sm",children:n.jsxs(n.Fragment,"now"===u?{children:[n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:.3,duration:.4},className:"text-sm font-medium text-gray-700",children:"Ready to send immediately"}),n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:"Once you mark this automation as active, we'll send it 5 minutes from that moment"})]}:{children:[n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:.3,duration:.4},className:"text-sm font-medium text-gray-700",children:"Currently scheduled for:"}),n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(u).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:d||void 0})})]})})]})})})},Dme=()=>n.jsx("div",{children:n.jsx(_me,{title:"Set Schedule Time",autoSave:!0})});var Kme=(e=>(e.DAYS="days",e))(Kme||{});const Hme={[SY.EQUALS]:"Equals",[SY.NOT_EQUALS]:"Not Equals",[SY.GREATER_THAN]:"Greater Than",[SY.LESS_THAN]:"Less Than",[SY.EXISTS]:"Exists",[SY.EQUALS_MONTH_DAY]:"Month and Day Matches",[SY.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[SY.BETWEEN_MONTH_DAY]:"Between Month Day",[SY.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[SY.ARRAY_CONTAINS]:"Is One Of"},Ome={email:"Email Address",phone:"Phone Number",firstName:"First Name",lastName:"Last Name"},Ime=({options:e,value:a,onChange:t,placeholder:i,className:o="",disableInput:s=!1})=>{const[l,u]=r.useState(!1);return n.jsxs(h9,{modal:!0,open:l,onOpenChange:u,children:[n.jsx(p9,{asChild:!0,children:n.jsxs(jY,{"aria-expanded":l,className:im("w-full overflow-hidden justify-between",o),variant:"outline",children:[a?e.find((e=>e.value===a))?.label:i,n.jsx(Ac,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsx(g9,{className:im("w-full min-w-[120px] max-w-[600px] p-0",o),children:n.jsxs(Mse,{children:[!s&&n.jsx(Tse,{placeholder:`${i}...`}),n.jsxs(Nse,{children:[n.jsxs(xse,{children:["No ",i.toLowerCase()," found."]}),n.jsx(Ese,{children:e.map((e=>n.jsxs(Pse,{value:e.value,onSelect:e=>{t(e===a?"":e),u(!1)},children:[n.jsx(fc,{className:im("mr-2 h-4 w-4",a===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})},Gme=r.forwardRef((({className:e,...a},t)=>n.jsx(iue,{ref:t,className:im("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:n.jsx(rue,{className:im("flex items-center justify-center text-current"),children:n.jsx(fc,{className:"h-4 w-4"})})})));function Vme(e,a){if("function"==typeof e)return e(a);null!=e&&(e.current=a)}function Fme(...e){return a=>{let n=!1;const t=e.map((e=>{const t=Vme(e,a);return n||"function"!=typeof t||(n=!0),t}));if(n)return()=>{for(let a=0;a<t.length;a++){const n=t[a];"function"==typeof n?n():Vme(e[a],null)}}}}function Jme(...e){return r.useCallback(Fme(...e),e)}function Ume(e){const a=Wme(e),t=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),l=s.find(Zme);if(l){const e=l.props.children,i=s.map((a=>a===l?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(a,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n.jsx(a,{...o,ref:t,children:i})}));return t.displayName=`${e}.Slot`,t}function Wme(e){const a=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{const a=r(...e);return i(...e),a}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?Fme(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));return a.displayName=`${e}.SlotClone`,a}Gme.displayName=iue.displayName;var qme=Symbol("radix.slottable");function Zme(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===qme}var $me=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,a)=>{const t=Ume(`Primitive.${a}`),i=r.forwardRef(((e,i)=>{const{asChild:r,...o}=e,s=r?t:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(s,{...o,ref:i})}));return i.displayName=`Primitive.${a}`,{...e,[a]:i}}),{}),Yme=globalThis?.document?r.useLayoutEffect:()=>{};var Qme=e=>{const{present:a,children:n}=e,t=function(e){const[a,n]=r.useState(),t=r.useRef(null),i=r.useRef(e),o=r.useRef("none"),s=e?"mounted":"unmounted",[l,u]=function(e,a){return r.useReducer(((e,n)=>a[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect((()=>{const e=Xme(t.current);o.current="mounted"===l?e:"none"}),[l]),Yme((()=>{const a=t.current,n=i.current;if(n!==e){const t=o.current,r=Xme(a);if(e)u("MOUNT");else if("none"===r||"none"===a?.display)u("UNMOUNT");else{u(n&&t!==r?"ANIMATION_OUT":"UNMOUNT")}i.current=e}}),[e,u]),Yme((()=>{if(a){let e;const n=a.ownerDocument.defaultView??window,r=r=>{const o=Xme(t.current).includes(r.animationName);if(r.target===a&&o&&(u("ANIMATION_END"),!i.current)){const t=a.style.animationFillMode;a.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===a.style.animationFillMode&&(a.style.animationFillMode=t)}))}},s=e=>{e.target===a&&(o.current=Xme(t.current))};return a.addEventListener("animationstart",s),a.addEventListener("animationcancel",r),a.addEventListener("animationend",r),()=>{n.clearTimeout(e),a.removeEventListener("animationstart",s),a.removeEventListener("animationcancel",r),a.removeEventListener("animationend",r)}}u("ANIMATION_END")}),[a,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:r.useCallback((e=>{t.current=e?getComputedStyle(e):null,n(e)}),[])}}(a),i="function"==typeof n?n({present:t.isPresent}):r.Children.only(n),o=Jme(t.ref,function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof n||t.isPresent?r.cloneElement(i,{ref:o}):null};function Xme(e){return e?.animationName||"none"}function ehe(...e){const a=e[0];if(1===e.length)return a;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const t=n.reduce(((a,{useScope:n,scopeName:t})=>({...a,...n(e)[`__scope${t}`]})),{});return r.useMemo((()=>({[`__scope${a.scopeName}`]:t})),[t])}};return n.scopeName=a.scopeName,n}function ahe(e){const a=r.useRef(e);return r.useEffect((()=>{a.current=e})),r.useMemo((()=>(...e)=>a.current?.(...e)),[])}Qme.displayName="Presence";var nhe=r.createContext(void 0);function the(e,a,{checkForDefaultPrevented:n=!0}={}){return function(t){if(e?.(t),!1===n||!t.defaultPrevented)return a?.(t)}}var ihe="ScrollArea",[rhe,ohe]=function(e,a=[]){let t=[];const i=()=>{const a=t.map((e=>r.createContext(e)));return function(n){const t=n?.[e]||a;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:t}})),[n,t])}};return i.scopeName=e,[function(a,i){const o=r.createContext(i),s=t.length;t=[...t,i];const l=a=>{const{scope:t,children:i,...l}=a,u=t?.[e]?.[s]||o,c=r.useMemo((()=>l),Object.values(l));return n.jsx(u.Provider,{value:c,children:i})};return l.displayName=a+"Provider",[l,function(n,t){const l=r.useContext(t?.[e]?.[s]||o);if(l)return l;if(void 0!==i)return i;throw new Error(`\`${n}\` must be used within \`${a}\``)}]},ehe(i,...a)]}(ihe),[she,lhe]=rhe(ihe),uhe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,type:i="hover",dir:o,scrollHideDelay:s=600,...l}=e,[u,c]=r.useState(null),[d,m]=r.useState(null),[h,p]=r.useState(null),[g,v]=r.useState(null),[f,y]=r.useState(null),[k,b]=r.useState(0),[S,A]=r.useState(0),[w,C]=r.useState(!1),[M,T]=r.useState(!1),N=Jme(a,(e=>c(e))),x=function(e){const a=r.useContext(nhe);return e||a||"ltr"}(o);return n.jsx(she,{scope:t,type:i,dir:x,scrollHideDelay:s,scrollArea:u,viewport:d,onViewportChange:m,content:h,onContentChange:p,scrollbarX:g,onScrollbarXChange:v,scrollbarXEnabled:w,onScrollbarXEnabledChange:C,scrollbarY:f,onScrollbarYChange:y,scrollbarYEnabled:M,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:A,children:n.jsx($me.div,{dir:x,...l,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})})}));uhe.displayName=ihe;var che="ScrollAreaViewport",dhe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,children:i,nonce:o,...s}=e,l=lhe(che,t),u=Jme(a,r.useRef(null),l.onViewportChange);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),n.jsx($me.div,{"data-radix-scroll-area-viewport":"",...s,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:n.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})}));dhe.displayName=che;var mhe="ScrollAreaScrollbar",hhe=r.forwardRef(((e,a)=>{const{forceMount:t,...i}=e,o=lhe(mhe,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:l}=o,u="horizontal"===e.orientation;return r.useEffect((()=>(u?s(!0):l(!0),()=>{u?s(!1):l(!1)})),[u,s,l]),"hover"===o.type?n.jsx(phe,{...i,ref:a,forceMount:t}):"scroll"===o.type?n.jsx(ghe,{...i,ref:a,forceMount:t}):"auto"===o.type?n.jsx(vhe,{...i,ref:a,forceMount:t}):"always"===o.type?n.jsx(fhe,{...i,ref:a}):null}));hhe.displayName=mhe;var phe=r.forwardRef(((e,a)=>{const{forceMount:t,...i}=e,o=lhe(mhe,e.__scopeScrollArea),[s,l]=r.useState(!1);return r.useEffect((()=>{const e=o.scrollArea;let a=0;if(e){const n=()=>{window.clearTimeout(a),l(!0)},t=()=>{a=window.setTimeout((()=>l(!1)),o.scrollHideDelay)};return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",t),()=>{window.clearTimeout(a),e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",t)}}}),[o.scrollArea,o.scrollHideDelay]),n.jsx(Qme,{present:t||s,children:n.jsx(vhe,{"data-state":s?"visible":"hidden",...i,ref:a})})})),ghe=r.forwardRef(((e,a)=>{const{forceMount:t,...i}=e,o=lhe(mhe,e.__scopeScrollArea),s="horizontal"===e.orientation,l=_he((()=>c("SCROLL_END")),100),[u,c]=(d={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},r.useReducer(((e,a)=>d[e][a]??e),"hidden"));var d;return r.useEffect((()=>{if("idle"===u){const e=window.setTimeout((()=>c("HIDE")),o.scrollHideDelay);return()=>window.clearTimeout(e)}}),[u,o.scrollHideDelay,c]),r.useEffect((()=>{const e=o.viewport,a=s?"scrollLeft":"scrollTop";if(e){let n=e[a];const t=()=>{const t=e[a];n!==t&&(c("SCROLL"),l()),n=t};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}}),[o.viewport,s,c,l]),n.jsx(Qme,{present:t||"hidden"!==u,children:n.jsx(fhe,{"data-state":"hidden"===u?"hidden":"visible",...i,ref:a,onPointerEnter:the(e.onPointerEnter,(()=>c("POINTER_ENTER"))),onPointerLeave:the(e.onPointerLeave,(()=>c("POINTER_LEAVE")))})})})),vhe=r.forwardRef(((e,a)=>{const t=lhe(mhe,e.__scopeScrollArea),{forceMount:i,...o}=e,[s,l]=r.useState(!1),u="horizontal"===e.orientation,c=_he((()=>{if(t.viewport){l(u?t.viewport.offsetWidth<t.viewport.scrollWidth:t.viewport.offsetHeight<t.viewport.scrollHeight)}}),10);return Dhe(t.viewport,c),Dhe(t.content,c),n.jsx(Qme,{present:i||s,children:n.jsx(fhe,{"data-state":s?"visible":"hidden",...o,ref:a})})})),fhe=r.forwardRef(((e,a)=>{const{orientation:t="vertical",...i}=e,o=lhe(mhe,e.__scopeScrollArea),s=r.useRef(null),l=r.useRef(0),[u,c]=r.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Phe(u.viewport,u.content),m={...i,sizes:u,onSizesChange:c,hasThumb:Boolean(d>0&&d<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function h(e,a){return function(e,a,n,t="ltr"){const i=jhe(n),r=i/2,o=a||r,s=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-(i-o),u=n.content-n.viewport,c="ltr"===t?[0,u]:[-1*u,0];return Bhe([s,l],c)(e)}(e,l.current,u,a)}return"horizontal"===t?n.jsx(yhe,{...m,ref:a,onThumbPositionChange:()=>{if(o.viewport&&s.current){const e=Lhe(o.viewport.scrollLeft,u,o.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=h(e,o.dir))}}):"vertical"===t?n.jsx(khe,{...m,ref:a,onThumbPositionChange:()=>{if(o.viewport&&s.current){const e=Lhe(o.viewport.scrollTop,u);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=h(e))}}):null})),yhe=r.forwardRef(((e,a)=>{const{sizes:t,onSizesChange:i,...o}=e,s=lhe(mhe,e.__scopeScrollArea),[l,u]=r.useState(),c=r.useRef(null),d=Jme(a,c,s.onScrollbarXChange);return r.useEffect((()=>{c.current&&u(getComputedStyle(c.current))}),[c]),n.jsx(Ahe,{"data-orientation":"horizontal",...o,ref:d,sizes:t,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":jhe(t)+"px",...e.style},onThumbPointerDown:a=>e.onThumbPointerDown(a.x),onDragScroll:a=>e.onDragScroll(a.x),onWheelScroll:(a,n)=>{if(s.viewport){const t=s.viewport.scrollLeft+a.deltaX;e.onWheelScroll(t),zhe(t,n)&&a.preventDefault()}},onResize:()=>{c.current&&s.viewport&&l&&i({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Ehe(l.paddingLeft),paddingEnd:Ehe(l.paddingRight)}})}})})),khe=r.forwardRef(((e,a)=>{const{sizes:t,onSizesChange:i,...o}=e,s=lhe(mhe,e.__scopeScrollArea),[l,u]=r.useState(),c=r.useRef(null),d=Jme(a,c,s.onScrollbarYChange);return r.useEffect((()=>{c.current&&u(getComputedStyle(c.current))}),[c]),n.jsx(Ahe,{"data-orientation":"vertical",...o,ref:d,sizes:t,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":jhe(t)+"px",...e.style},onThumbPointerDown:a=>e.onThumbPointerDown(a.y),onDragScroll:a=>e.onDragScroll(a.y),onWheelScroll:(a,n)=>{if(s.viewport){const t=s.viewport.scrollTop+a.deltaY;e.onWheelScroll(t),zhe(t,n)&&a.preventDefault()}},onResize:()=>{c.current&&s.viewport&&l&&i({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Ehe(l.paddingTop),paddingEnd:Ehe(l.paddingBottom)}})}})})),[bhe,She]=rhe(mhe),Ahe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,sizes:i,hasThumb:o,onThumbChange:s,onThumbPointerUp:l,onThumbPointerDown:u,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:m,onResize:h,...p}=e,g=lhe(mhe,t),[v,f]=r.useState(null),y=Jme(a,(e=>f(e))),k=r.useRef(null),b=r.useRef(""),S=g.viewport,A=i.content-i.viewport,w=ahe(m),C=ahe(c),M=_he(h,10);function T(e){if(k.current){d({x:e.clientX-k.current.left,y:e.clientY-k.current.top})}}return r.useEffect((()=>{const e=e=>{const a=e.target,n=v?.contains(a);n&&w(e,A)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})}),[S,v,A,w]),r.useEffect(C,[i,C]),Dhe(v,M),Dhe(g.content,M),n.jsx(bhe,{scope:t,scrollbar:v,hasThumb:o,onThumbChange:ahe(s),onThumbPointerUp:ahe(l),onThumbPositionChange:C,onThumbPointerDown:ahe(u),children:n.jsx($me.div,{...p,ref:y,style:{position:"absolute",...p.style},onPointerDown:the(e.onPointerDown,(e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),k.current=v.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),T(e)}})),onPointerMove:the(e.onPointerMove,T),onPointerUp:the(e.onPointerUp,(e=>{const a=e.target;a.hasPointerCapture(e.pointerId)&&a.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,g.viewport&&(g.viewport.style.scrollBehavior=""),k.current=null}))})})})),whe="ScrollAreaThumb",Che=r.forwardRef(((e,a)=>{const{forceMount:t,...i}=e,r=She(whe,e.__scopeScrollArea);return n.jsx(Qme,{present:t||r.hasThumb,children:n.jsx(Mhe,{ref:a,...i})})})),Mhe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,style:i,...o}=e,s=lhe(whe,t),l=She(whe,t),{onThumbPositionChange:u}=l,c=Jme(a,(e=>l.onThumbChange(e))),d=r.useRef(void 0),m=_he((()=>{d.current&&(d.current(),d.current=void 0)}),100);return r.useEffect((()=>{const e=s.viewport;if(e){const a=()=>{if(m(),!d.current){const a=Rhe(e,u);d.current=a,u()}};return u(),e.addEventListener("scroll",a),()=>e.removeEventListener("scroll",a)}}),[s.viewport,m,u]),n.jsx($me.div,{"data-state":l.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:the(e.onPointerDownCapture,(e=>{const a=e.target.getBoundingClientRect();l.onThumbPointerDown({x:e.clientX-a.left,y:e.clientY-a.top})})),onPointerUp:the(e.onPointerUp,l.onThumbPointerUp)})}));Che.displayName=whe;var The="ScrollAreaCorner",Nhe=r.forwardRef(((e,a)=>{const t=lhe(The,e.__scopeScrollArea),i=Boolean(t.scrollbarX&&t.scrollbarY);return"scroll"!==t.type&&i?n.jsx(xhe,{...e,ref:a}):null}));Nhe.displayName=The;var xhe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,...i}=e,o=lhe(The,t),[s,l]=r.useState(0),[u,c]=r.useState(0),d=Boolean(s&&u);return Dhe(o.scrollbarX,(()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),c(e)})),Dhe(o.scrollbarY,(()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),l(e)})),d?n.jsx($me.div,{...i,ref:a,style:{width:s,height:u,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...e.style}}):null}));function Ehe(e){return e?parseInt(e,10):0}function Phe(e,a){const n=e/a;return isNaN(n)?0:n}function jhe(e){const a=Phe(e.viewport,e.content);return Math.max((e.scrollbar.size-(e.scrollbar.paddingStart+e.scrollbar.paddingEnd))*a,18)}function Lhe(e,a,n="ltr"){const t=jhe(a),i=a.content-a.viewport,r=a.scrollbar.size-(a.scrollbar.paddingStart+a.scrollbar.paddingEnd)-t,o=function(e,[a,n]){return Math.min(n,Math.max(a,e))}(e,"ltr"===n?[0,i]:[-1*i,0]);return Bhe([0,i],[0,r])(o)}function Bhe(e,a){return n=>{if(e[0]===e[1]||a[0]===a[1])return a[0];return a[0]+(a[1]-a[0])/(e[1]-e[0])*(n-e[0])}}function zhe(e,a){return e>0&&e<a}var Rhe=(e,a=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},t=0;return function i(){const r={left:e.scrollLeft,top:e.scrollTop};(n.left!==r.left||n.top!==r.top)&&a(),n=r,t=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(t)};function _he(e,a){const n=ahe(e),t=r.useRef(0);return r.useEffect((()=>()=>window.clearTimeout(t.current)),[]),r.useCallback((()=>{window.clearTimeout(t.current),t.current=window.setTimeout(n,a)}),[n,a])}function Dhe(e,a){const n=ahe(a);Yme((()=>{let a=0;if(e){const t=new ResizeObserver((()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(n)}));return t.observe(e),()=>{window.cancelAnimationFrame(a),t.unobserve(e)}}}),[e,n])}var Khe=uhe,Hhe=dhe,Ohe=Nhe;const Ihe=r.forwardRef((({className:e,children:a,...t},i)=>n.jsxs(Khe,{ref:i,className:LG("relative overflow-hidden",e),...t,children:[n.jsx(Hhe,{className:"h-full w-full rounded-[inherit]",children:a}),n.jsx(Ghe,{}),n.jsx(Ohe,{})]})));Ihe.displayName=Khe.displayName;const Ghe=r.forwardRef((({className:e,orientation:a="vertical",...t},i)=>n.jsx(hhe,{ref:i,orientation:a,className:LG("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...t,children:n.jsx(Che,{className:"relative flex-1 rounded-full bg-border"})})));Ghe.displayName=hhe.displayName;var Vhe=r.forwardRef(((e,a)=>{const{children:t,...i}=e,o=r.Children.toArray(t),s=o.find(Uhe);if(s){const e=s.props.children,t=o.map((a=>a===s?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(Fhe,{...i,ref:a,children:r.isValidElement(e)?r.cloneElement(e,void 0,t):null})}return n.jsx(Fhe,{...i,ref:a,children:t})}));Vhe.displayName="Slot";var Fhe=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{r(...e),i(...e)}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?nO(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));Fhe.displayName="SlotClone";var Jhe=({children:e})=>n.jsx(n.Fragment,{children:e});function Uhe(e){return r.isValidElement(e)&&e.type===Jhe}var Whe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,a)=>{const t=r.forwardRef(((e,t)=>{const{asChild:i,...r}=e,o=i?Vhe:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(o,{...r,ref:t})}));return t.displayName=`Primitive.${a}`,{...e,[a]:t}}),{}),qhe="horizontal",Zhe=["horizontal","vertical"],$he=r.forwardRef(((e,a)=>{const{decorative:t,orientation:i=qhe,...r}=e,o=function(e){return Zhe.includes(e)}(i)?i:qhe;return n.jsx(Whe.div,{"data-orientation":o,...t?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"},...r,ref:a})}));$he.displayName="Separator";var Yhe=$he;const Qhe=r.forwardRef((({className:e,orientation:a="horizontal",decorative:t=!0,...i},r)=>n.jsx(Yhe,{ref:r,decorative:t,orientation:a,className:im("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",e),...i})));function Xhe({options:e,onValueChange:a,selectedValues:t,setSelectedValues:i,maxCount:o,placeholder:s="Select options",title:l="Select Items",searchPlaceholder:u="Search items...",emptyMessage:c="No items found",handleSearchInput:d,extraCommandItems:m=[]}){const[h,p]=r.useState(!1),[g,v]=r.useState(""),[f,y]=r.useState(t),k=r.useMemo((()=>g?e.filter((e=>e.label.toLowerCase().includes(g.toLowerCase()))):e),[e,g]),b=r.useCallback((()=>t.map((a=>{const n=e.find((e=>e.value===a));return{value:a,label:n?.label||a}}))),[t,e]),S=e=>{y((a=>a.includes(e)?a.filter((a=>a!==e)):o&&a.length>=o?a:[...a,e]))};r.useEffect((()=>{h&&(y(t),v(""))}),[h,t]);const A=f.length,w=k.filter((e=>f.includes(e.value))).length,C=b(),M=!o||f.length<o;return n.jsxs(BG,{open:h,onOpenChange:p,children:[n.jsx(zG,{asChild:!0,children:n.jsxs(jY,{variant:"outline",className:"w-full justify-between text-left font-normal h-9 p-3",children:[n.jsx("div",{className:"flex flex-nowrap items-center gap-1 max-w-[70%]",children:0===C.length?n.jsx("span",{className:"text-muted-foreground",children:s}):C.length<=2?C.map((e=>n.jsx(UY,{variant:"secondary",className:"text-xs whitespace-nowrap",children:e.label},e.value))):n.jsxs(n.Fragment,{children:[n.jsx(UY,{variant:"secondary",className:"text-xs whitespace-nowrap",children:C[0].label},C[0].value),n.jsxs(UY,{variant:"secondary",className:"text-xs whitespace-nowrap",children:["+",C.length-1," more"]})]})}),n.jsx(RY.DropdownMenuTrigger,{className:"h-4 w-4 opacity-50 ml-2 flex-shrink-0"})]})}),n.jsxs(DG,{className:"max-w-md w-full max-h-[80vh] p-0",children:[n.jsx(KG,{className:"p-6 pb-4",children:n.jsxs(OG,{className:"flex items-center gap-2 text-xl",children:[n.jsx(RY.UsersIcon,{className:"h-5 w-5 text-primary"}),l]})}),n.jsx("div",{className:"px-6 pb-4",children:n.jsxs("div",{className:"relative",children:[n.jsx(RY.SearchIcon,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx(o4,{placeholder:u,value:g,onChange:e=>v(e.target.value),onKeyDown:e=>{"Enter"===e.key&&g.trim()&&d&&(e.preventDefault(),d(g.trim()),v(""))},className:"pl-10 h-11"}),d&&g.trim()&&n.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:n.jsx(jY,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{d(g.trim()),v("")},children:n.jsx(RY.PlusIcon,{className:"h-3 w-3"})})})]})}),n.jsx("div",{className:"px-6 pb-4",children:n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("span",{className:"text-muted-foreground",children:[A," of ",e.length," selected",o&&` (max ${o})`]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(jY,{variant:"ghost",size:"sm",onClick:()=>{const e=k.filter((e=>!f.includes(e.value))),a=o?e.slice(0,o-f.length):e;y((e=>[...e,...a.map((e=>e.value))]))},disabled:!M||w===k.length,className:"h-8 text-xs",children:"Select All"}),n.jsx(jY,{variant:"ghost",size:"sm",onClick:()=>{const e=new Set(k.map((e=>e.value)));y((a=>a.filter((a=>!e.has(a)))))},disabled:0===w,className:"h-8 text-xs",children:"Clear All"})]})]})}),n.jsx(Qhe,{}),n.jsx(Ihe,{className:"flex-1 max-h-[300px]",children:n.jsx(Mse,{className:"rounded-none border-none",children:n.jsxs(Ese,{children:[m.length>0&&n.jsxs(n.Fragment,{children:[m.map(((e,a)=>n.jsx("div",{className:"px-3 py-2",children:e(p)},`extra-command-${a}`))),n.jsx(Qhe,{className:"my-2"})]}),0===k.length?n.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[n.jsx(RY.SearchIcon,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),n.jsx("p",{children:c}),d&&g.trim()&&n.jsxs(jY,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>{d(g.trim()),v("")},children:[n.jsx(RY.PlusIcon,{className:"h-3 w-3 mr-1"}),'Add "',g,'"']})]}):k.map((e=>{const a=f.includes(e.value),t=!a&&!M;return n.jsxs(Pse,{onSelect:()=>!t&&S(e.value),className:"flex items-center space-x-3 p-3 rounded-lg transition-colors "+(t?"opacity-50 cursor-not-allowed":"hover:bg-muted/50 cursor-pointer"),children:[n.jsx(Gme,{checked:a,disabled:t,onChange:()=>!t&&S(e.value),className:"flex-shrink-0"}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("div",{className:"font-medium text-sm truncate",children:e.label})}),a&&n.jsx(RY.CheckIcon,{className:"h-4 w-4 text-primary flex-shrink-0"})]},e.value)}))]})})}),n.jsx(Qhe,{}),n.jsx("div",{className:"p-6 pt-4",children:n.jsxs("div",{className:"flex gap-3",children:[n.jsx(jY,{variant:"outline",onClick:()=>{y(t),v(""),p(!1)},className:"flex-1",children:"Cancel"}),n.jsxs(jY,{onClick:()=>{a(f),i(f),p(!1)},className:"flex-1 bg-primary hover:bg-primary/90",children:["Apply (",A,")"]})]})})]})]})}Qhe.displayName=Yhe.displayName;var epe="Switch",[ape,npe]=eX(epe),[tpe,ipe]=ape(epe),rpe=r.forwardRef(((e,a)=>{const{__scopeSwitch:t,name:i,checked:o,defaultChecked:s,required:l,disabled:u,value:c="on",onCheckedChange:d,form:m,...h}=e,[p,g]=r.useState(null),v=tO(a,(e=>g(e))),f=r.useRef(!1),y=!p||(m||!!p.closest("form")),[k=!1,b]=tX({prop:o,defaultProp:s,onChange:d});return n.jsxs(tpe,{scope:t,checked:k,disabled:u,children:[n.jsx(uX.button,{type:"button",role:"switch","aria-checked":k,"aria-required":l,"data-state":upe(k),"data-disabled":u?"":void 0,disabled:u,value:c,...h,ref:v,onClick:XQ(e.onClick,(e=>{b((e=>!e)),y&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())}))}),y&&n.jsx(lpe,{control:p,bubbles:!f.current,name:i,value:c,checked:k,required:l,disabled:u,form:m,style:{transform:"translateX(-100%)"}})]})}));rpe.displayName=epe;var ope="SwitchThumb",spe=r.forwardRef(((e,a)=>{const{__scopeSwitch:t,...i}=e,r=ipe(ope,t);return n.jsx(uX.span,{"data-state":upe(r.checked),"data-disabled":r.disabled?"":void 0,...i,ref:a})}));spe.displayName=ope;var lpe=e=>{const{control:a,checked:t,bubbles:i=!0,...o}=e,s=r.useRef(null),l=Ule(t),u=v1(a);return r.useEffect((()=>{const e=s.current,a=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(a,"checked").set;if(l!==t&&n){const a=new Event("click",{bubbles:i});n.call(e,t),e.dispatchEvent(a)}}),[l,t,i]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...o,tabIndex:-1,ref:s,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function upe(e){return e?"checked":"unchecked"}var cpe=rpe,dpe=spe;const mpe=r.forwardRef((({className:e,...a},t)=>n.jsx(cpe,{className:im("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input/50",e),...a,ref:t,children:n.jsx(dpe,{className:im("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})));mpe.displayName=cpe.displayName;const hpe=({onSelect:e,date:a,placeholder:t="Pick a date",monthDayOnly:i=!1})=>n.jsxs(h9,{modal:!0,children:[n.jsx(p9,{asChild:!0,children:n.jsxs(jY,{variant:"outline",className:im("w-[200px] justify-start text-left font-normal h-9",!a&&"text-muted-foreground"),children:[n.jsx(vc,{className:"mr-2 h-4 w-4"}),a?dae(a,i?"MMMM d":"PPP"):n.jsx("span",{children:t})]})}),n.jsx(g9,{className:"w-auto p-0",align:"start",children:n.jsx(Bme,{mode:"single",selected:a,onSelect:e,initialFocus:!0})})]}),ppe=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===Kme.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),gpe=({fieldType:e,operator:a,value:t,onChange:i,options:o,toast:s,metadata:l})=>{const u=t.length>0&&"object"==typeof t[0]&&"type"in t[0]&&"relative"===t[0].type,c=t.length>0&&"object"==typeof t[0]&&"startDate"in t[0]&&"endDate"in t[0],[d,m]=r.useState((e===kY.Date||e===kY.DateTime)&&t.length>0&&t[0]instanceof Date?t[0]:void 0),[h,p]=r.useState(u),[g,v]=r.useState(u?t[0]:{type:"relative",value:0,unit:Kme.DAYS,direction:"before"}),[f,y]=r.useState(c?t[0]:void 0),[k,b]=r.useState(!1);if(r.useEffect((()=>{a!==SY.EQUALS_MONTH_DAY&&a!==SY.EQUALS_MONTH_DAY_YEAR&&h&&(p(!1),i(d?[d]:[]))}),[a,h,d,i]),r.useEffect((()=>{if(c&&f?.startDate){b("object"==typeof f.startDate&&"type"in f.startDate)}}),[c,f]),e===kY.String||e===kY.ReachResource||e===kY.Array)return a===SY.EXISTS?null:n.jsx(Xhe,{options:(o||[]).map((e=>({label:e.displayName,value:e.id}))),onValueChange:e=>{i(e)},selectedValues:t.map((e=>{const a=(o||[]).find((a=>a.id===String(e)||a.displayName===String(e)||a.id===a.displayName&&a.id===String(e)));return a?.id||String(e)})),setSelectedValues:e=>{i(e)},searchPlaceholder:"Enter new value",emptyMessage:"Press enter to add new value",handleSearchInput:e=>{if(e.length>0){const a=(e=>{const{value:a,type:n}=e;switch(n){case kY.ReachResource:case kY.Array:case kY.String:return a.length>0;case kY.Number:return!isNaN(Number(a));case kY.Integer:return!isNaN(Number(a))&&Number(a)%1==0;case kY.Boolean:return"true"===a||"false"===a;case kY.Date:case kY.DateTime:return!isNaN(new Date(a).getTime());default:throw Dse(n,kY)}})({value:e,type:l.type});a?i([...new Set([...t,e])]):s({title:"Invalid value",description:`Please enter a valid value for this field. The value must be a ${l.type} type`,variant:"destructive"})}}});if(e===kY.Date||e===kY.DateTime){const e=a===SY.EQUALS_MONTH_DAY||a===SY.EQUALS_MONTH_DAY_YEAR,t=a===SY.BETWEEN_MONTH_DAY||a===SY.BETWEEN_MONTH_DAY_YEAR,r=e=>{ppe(e)?(v(e),h&&i([e])):s({title:"Invalid relative date",description:"Please enter a valid non-negative number of days.",variant:"destructive"})},o=e=>{const a=e.startDate??f?.startDate,n=e.endDate??f?.endDate,t=a&&"object"==typeof a&&"type"in a,r=n&&"object"==typeof n&&"type"in n;if(a&&n){if(t!==r)return void s({title:"Invalid date range",description:"Both start and end dates must be of the same type (either both absolute or both relative).",variant:"destructive"});if(!t&&!r&&!(e=>!e.finalStartDate||!e.finalEndDate||e.finalStartDate<e.finalEndDate)({finalStartDate:a,finalEndDate:n}))return void s({title:"Invalid date range",description:"Start date must be before end date.",variant:"destructive"});if(t&&(!ppe(a)||!ppe(n)))return void s({title:"Invalid relative date",description:"Please enter valid relative dates.",variant:"destructive"})}y(e),a&&n&&i([{startDate:a,endDate:n}])},l=e=>{e&&(e=>e instanceof Date?!isNaN(e.getTime()):"object"==typeof e&&"type"in e&&"relative"===e.type&&ppe(e))(e)?(m(e),i([e]),p(!1)):e||(m(void 0),i([]),p(!1))},u=e=>{p(e),i(e?[g]:d?[d]:[])};return n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsxs("div",{className:"min-h-[36px] flex items-center",children:[(!h||!e)&&!t&&n.jsx(hpe,{date:d,onSelect:l,monthDayOnly:a===SY.EQUALS_MONTH_DAY}),e&&h&&n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(o4,{type:"number",value:void 0===g.value?"":g.value,onChange:e=>{const a=""===e.target.value?void 0:parseInt(e.target.value,10);r({...g,value:a})},className:"w-20 h-9",min:"0","aria-label":"Relative days value"}),n.jsxs(hie,{value:g.direction,onValueChange:e=>{r({...g,direction:e})},children:[n.jsx(vie,{className:"w-[180px] h-9","aria-label":"Relative direction",children:n.jsx(gie,{placeholder:"Select direction..."})}),n.jsxs(kie,{children:[n.jsx(bie,{value:"before",children:"days before today"}),n.jsx(bie,{value:"after",children:"days after today"})]})]})]}),t&&n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsxs("div",{className:"flex flex-col space-y-2",children:[n.jsx("div",{className:"flex items-center space-x-2",children:k?n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(o4,{type:"number",value:f?.startDate&&"object"==typeof f.startDate&&"type"in f.startDate?f.startDate.value:"",onChange:e=>{const a={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Kme.DAYS,direction:f?.startDate?.direction||"before"};ppe(a)&&(y({...f,startDate:a}),o({...f,startDate:a}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),n.jsxs(hie,{value:f?.startDate&&"object"==typeof f.startDate&&"type"in f.startDate?f.startDate.direction:"before",onValueChange:e=>{const a={type:"relative",value:f?.startDate?.value,unit:Kme.DAYS,direction:e};ppe(a)&&(y({...f,startDate:a}),o({...f,startDate:a}))},children:[n.jsx(vie,{className:"w-[180px] h-9",children:n.jsx(gie,{placeholder:"Select direction..."})}),n.jsxs(kie,{children:[n.jsx(bie,{value:"before",children:"days before today"}),n.jsx(bie,{value:"after",children:"days after today"})]})]}),n.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"Start"})]}):n.jsx(hpe,{placeholder:"Start date",date:f?.startDate instanceof Date||"string"==typeof f?.startDate?f.startDate instanceof Date?f.startDate:new Date(f.startDate):void 0,monthDayOnly:a===SY.BETWEEN_MONTH_DAY,onSelect:e=>{const a=e;a&&(y({...f,startDate:a}),o({...f,startDate:a}))}})}),n.jsx("div",{className:"flex items-center space-x-2",children:k?n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(o4,{type:"number",value:f?.endDate&&"object"==typeof f.endDate&&"type"in f.endDate?f.endDate.value:"",onChange:e=>{const a={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Kme.DAYS,direction:f?.endDate?.direction||"before"};ppe(a)&&(y({...f,endDate:a}),o({...f,endDate:a}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),n.jsxs(hie,{value:f?.endDate&&"object"==typeof f.endDate&&"type"in f.endDate?f.endDate.direction:"before",onValueChange:e=>{const a={type:"relative",value:f?.endDate?.value,unit:Kme.DAYS,direction:e};ppe(a)&&(y({...f,endDate:a}),o({...f,endDate:a}))},children:[n.jsx(vie,{className:"w-[180px] h-9",children:n.jsx(gie,{placeholder:"Select direction..."})}),n.jsxs(kie,{children:[n.jsx(bie,{value:"before",children:"days before today"}),n.jsx(bie,{value:"after",children:"days after today"})]})]}),n.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"End"})]}):n.jsx(hpe,{placeholder:"End date",date:f?.endDate instanceof Date||"string"==typeof f?.endDate?f.endDate instanceof Date?f.endDate:new Date(f.endDate):void 0,monthDayOnly:a===SY.BETWEEN_MONTH_DAY,onSelect:e=>{const a=e;a&&(y({...f,endDate:a}),o({...f,endDate:a}))}})})]}),n.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[n.jsx(mpe,{id:"between-relative-date-switch",checked:k,onCheckedChange:e=>{if(b(e),e){const e={type:"relative",value:0,unit:Kme.DAYS,direction:"before"},a={type:"relative",value:0,unit:Kme.DAYS,direction:"before"};y({startDate:e,endDate:a}),o({startDate:e,endDate:a})}else{const e=new Date,a=new Date(e);a.setDate(a.getDate()+1),y({startDate:e,endDate:a}),o({startDate:e,endDate:a})}},"aria-label":"Toggle relative date input for between dates"}),n.jsx(Kae,{htmlFor:"between-relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})]}),e&&n.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[n.jsx(mpe,{id:"relative-date-switch",checked:h,onCheckedChange:u,"aria-label":"Toggle relative date input"}),n.jsx(Kae,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===kY.Number||e===kY.Integer)return a===SY.EXISTS?null:n.jsx(o4,{type:"number",value:t.length>0?String(t[0]):"",onChange:e=>i([Number(e.target.value)]),className:"w-[200px]"});if(e===kY.Boolean){if(a===SY.EXISTS)return null;const e=t.length>0&&Boolean(t[0]);return n.jsx(mpe,{checked:e,onCheckedChange:e=>i([e])})}return n.jsx(o4,{value:t.length>0?String(t[0]):"",onChange:e=>i([e.target.value]),className:"w-[200px]",disabled:!0})},vpe=({condition:e,onUpdate:a,onDuplicate:t,onDelete:i,segmentsConditions:r})=>{const{toast:o}=Ie(),s=(e=>{const a=r.conditions.find((a=>a.field===e));return a||null})(e.field)||{operators:[],type:kY.String,options:void 0,itemType:void 0},l=s.operators,u=s.type,c=r.conditions.map((e=>e.field)).map((e=>({value:e,label:Ome[e]||e})));return n.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch gap-2 min-w-0 w-full",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row flex-1 items-stretch gap-2 min-w-0 w-full",children:[n.jsx("div",{className:"flex-1 min-w-0 items-center flex",children:n.jsx(Ime,{options:c,value:e.field,onChange:n=>{const t=n,i=r.conditions.find((e=>e.field===t));if(!i)return;const o=i.operators.map((e=>({value:e,label:Hme[e]||e,fieldType:i.type}))),s=o[0]?.value;let l=[];switch(i.type){case kY.Boolean:l=[!1];break;case kY.Number:l=[0];break;case kY.Date:case kY.DateTime:l=[new Date];break;case kY.String:l=i.options?.length?i.options.map((e=>e.displayName)):[];break;default:l=[]}a({...e,field:t,operator:s,value:l})},placeholder:"Select field",className:"w-full",disableInput:!0})}),n.jsxs("div",{className:"flex-1 min-w-0 max-w-xs flex gap-2 items-center",children:[(e.operator===SY.EQUALS_MONTH_DAY||e.operator===SY.EQUALS_MONTH_DAY_YEAR||e.operator===SY.BETWEEN_MONTH_DAY||e.operator===SY.BETWEEN_MONTH_DAY_YEAR)&&n.jsx("div",{className:"flex items-center",children:(e=>{let a;switch(e){case SY.EQUALS_MONTH_DAY:a="This operator will check if only the month and day are equal. This is useful for things like birthday, where year does not matter";break;case SY.EQUALS_MONTH_DAY_YEAR:a="This operator will check if only the month and day are equal. This is useful for things like appointment dates, where specific day and month is important but year does not matter";break;case SY.BETWEEN_MONTH_DAY:a="This operator will check if the date is between the two dates, but only checking the month and the day, not the year. This is helpful for things like birthday, where year does not matter";break;case SY.BETWEEN_MONTH_DAY_YEAR:a="This operator will check if the date is between the two dates, checking the month, day and year. This is helpful for things like appointment dates, where specific day, month and year is important";break;default:return null}return n.jsx(Mae,{title:a})})(e.operator)}),n.jsx(Ime,{options:l.map((e=>({value:e,label:Hme[e]||e}))),value:e.operator,onChange:n=>a({...e,operator:n}),placeholder:"Select operator",className:"w-full",disableInput:!0})]}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(gpe,{fieldType:u,operator:e.operator,options:"string"==typeof e.value[0]&&e.value[0]&&Array.isArray(s.options)?[...(s.options||[]).map((e=>({displayName:e.displayName,id:e.id}))),...e.value.filter((e=>!s.options?.some((a=>a.id===e||a.displayName===e)))).map((e=>({displayName:e,id:e})))]:s.options?.map((e=>({displayName:e.displayName,id:e.id}))),value:e.value,onChange:n=>a({...e,value:n}),toast:o,metadata:{field:e.field,type:u,itemType:s.itemType}})})]}),n.jsxs("div",{className:"flex items-center flex-shrink-0 pl-2",children:[n.jsx(jY,{size:"icon",variant:"ghost",onClick:t,children:n.jsx(xc,{className:"h-4 w-4"})}),n.jsx(jY,{size:"icon",variant:"ghost",onClick:i,children:n.jsx(td,{className:"h-4 w-4"})})]})]})},fpe=({onSelectStyle:e})=>{const[t,i]=a.useState(null);return n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 max-w-4xl mx-auto",children:[n.jsx(zY,{onClick:()=>{i("ai"),e("ai")},title:"Build with AI",subtitle:"Describe your audience in plain language and let AI create the conditions",icon:n.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:n.jsx(ad,{className:"w-full h-full"})})}),selected:"ai"===t}),n.jsx(zY,{onClick:()=>{i("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${yh("engage:segment")} by configuring conditions directly`,icon:n.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:n.jsx(Qc,{className:"w-full h-full"})})}),selected:"manual"===t})]})},ype=({segmentId:e,setOpen:a,setTextToSegment:t,promptBuilderStyle:i,textToSegment:r})=>n.jsx("div",{children:n.jsx(KG,{className:"",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(OG,{className:"text-3xl font-normal",children:e?`Edit ${yh("engage:segment")}`:`Create ${yh("engage:segment")}`}),n.jsxs("div",{className:"flex items-center gap-2",children:[!1===i&&!1===r&&n.jsx(j6,{children:n.jsxs(L6,{children:[n.jsx(B6,{asChild:!0,children:n.jsx(jY,{variant:"outline",size:"sm",onClick:()=>t(!0),children:n.jsx(ad,{className:"h-4 w-3"})})}),n.jsx(z6,{children:n.jsxs("p",{children:["Use AI to create ",yh("engage:segment")," by describing them in natural language"]})})]})}),n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>{a(!1)},className:"h-8 w-8",children:n.jsx(cd,{className:"h-4 w-4"})})]})]})})}),kpe=({setTextToSegment:e,setSegment:t})=>{const[i,r]=a.useState(""),[o,s]=a.useState(!1),{toast:u}=Ie();return n.jsxs("div",{className:"flex flex-col gap-6 p-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Describe your audience"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Describe the audience you want to target in plain language, and our AI will create the conditions for you."})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs(aV,{children:[o&&n.jsx(EY,{children:n.jsx(xY,{})}),!o&&n.jsx(EY,{children:n.jsx(jse,{placeholder:"Describe your target audience...",className:"min-h-[120px] resize-none",value:i,onChange:e=>r(e.target.value)})})]}),n.jsx("div",{className:"flex justify-end gap-2",children:n.jsxs(jY,{onClick:async()=>{if(!i)return void u({title:"Please enter a description",description:"Please enter a description of your target audience",variant:"destructive"});s(!0);const a=await(async e=>(await Pe(`${l}/text-to-segment`,{method:"POST",body:JSON.stringify({text:e})})).data)(i);a.success&&a.conditions?(u({title:`${yh("engage:segment")} conditions built successfully 🚀`,description:`Your ${yh("engage:segment")} conditions have been built successfully`}),t(a.conditions)):u({title:`${yh("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[n.jsx(ad,{className:"h-4 w-4"}),"Generate ",yh("engage:segment")]})})]})]})};function bpe({segmentId:e,setOpen:a,onSegmentUpdated:t}){const{toast:i}=Ie(),o=void 0===e,[s,l]=r.useState(!1),[u,c]=r.useState({version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[]}),{segment:d,isLoading:m}=fY(e||""),{updateSegment:h}=yY(e),{createSegment:p,isCreating:g,segmentsConditions:v}=pY(),[f,y]=r.useState(!1),[k,b]=r.useState(!!o);r.useEffect((()=>{v&&c(d?{version:"1.0",id:d.id,name:d.name,description:d.description,logic:"AND",conditions:d.conditions}:{version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[{field:v.conditions[0].field,operator:v.conditions[0].operators[0],value:[]}]})}),[d,v]);const S=e=>e.value.some((e=>"object"==typeof e&&"type"in e&&"relative"===e.type)),A=e=>e.value.some((e=>"object"==typeof e&&"startDate"in e&&"endDate"in e));if(!v||m)return n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(xY,{})});return n.jsxs(n.Fragment,{children:[n.jsx(ype,{segmentId:e,setOpen:a,setTextToSegment:y,promptBuilderStyle:k,textToSegment:f},"segment-builder-header"),k?n.jsx(EY,{children:n.jsx(fpe,{onSelectStyle:e=>{"ai"===e&&y(!0),b(!1)}})},"prompt-builder-style"):n.jsx(EY,{children:n.jsxs("div",{className:"flex flex-1 flex-col",children:[n.jsx("div",{className:"flex flex-1 flex-col px-8 py-2",children:n.jsx("div",{className:"flex flex-1 flex-col gap-4 overflow-visible",children:n.jsx(aV,{children:f?n.jsx(EY,{children:n.jsx(kpe,{setTextToSegment:y,setSegment:e=>c({...u,conditions:e})})}):n.jsxs(EY,{children:[n.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[n.jsxs("div",{className:"grid gap-2",children:[n.jsxs("div",{className:"flex items-center gap-0",children:[n.jsx(Kae,{className:"text-muted-foreground text-xs",children:"Name"}),n.jsx("span",{className:"text-xs text-red-500 ml-1 align-super",children:"*"})]}),n.jsx(o4,{placeholder:`${yh("engage:segment")} name`,value:u.name,onChange:e=>c({...u,name:e.target.value})})]}),n.jsxs("div",{className:"grid gap-2",children:[n.jsx(Kae,{className:"text-muted-foreground text-xs",children:"Description"}),n.jsx(o4,{placeholder:`${yh("engage:segment")} description`,value:u.description,onChange:e=>c({...u,description:e.target.value})})]})]}),u.conditions.length>0&&n.jsx("div",{className:"flex-1 overflow-y-auto pb-8",children:n.jsx("div",{className:"grid",children:n.jsx(aV,{mode:"popLayout",children:u.conditions.map(((e,a)=>n.jsxs(H$.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{type:"spring",stiffness:300,damping:30,mass:.5},children:[a>0&&n.jsxs(H$.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[n.jsx(H$.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}}),n.jsx(H$.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),n.jsx(H$.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}})]}),n.jsx(vpe,{condition:e,onUpdate:e=>((e,a)=>{const n=[...u.conditions];n[e]=a,c({...u,conditions:n})})(a,e),segmentsConditions:v,onDuplicate:()=>(e=>{const a=[...u.conditions];a.splice(e+1,0,{...u.conditions[e]}),c({...u,conditions:a})})(a),onDelete:()=>(e=>{const a=u.conditions.filter(((a,n)=>n!==e));c({...u,conditions:a})})(a)})]},`${e.field}-${e.operator}-${a}`)))})})})]})})})}),n.jsx("div",{className:"border-t px-8 py-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(jY,f?{variant:"secondary",onClick:()=>y(!1),children:[n.jsx(Qc,{className:"h-4 w-4"}),"Manual Builder"]}:{variant:"secondary",onClick:()=>{c({...u,conditions:[...u.conditions,{field:v.conditions[0].field,operator:v.conditions[0].operators[0],value:[]}]})},children:[n.jsx(qc,{className:"h-4 w-4"}),"Add Condition"]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(jY,{variant:"destructive",onClick:()=>a(!1),children:"Cancel"}),n.jsx(jY,{variant:"default",onClick:async()=>{if(!u.name)return void i({title:"Name is required",description:"Please ensure all fields are filled out",variant:"destructive"});const{valid:n,error:r}=(e=>{for(const a of e){if(!a.field||!a.operator)return{valid:!1,error:"Please ensure all fields are filled out for condition"};if(a.operator!==SY.EXISTS&&0===a.value.length)return{valid:!1,error:`Please ensure a value is selected for ${a.field}`};if(a.operator===SY.EXISTS&&a.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${a.field}`};if(S(a)&&a.operator!==SY.EQUALS_MONTH_DAY&&a.operator!==SY.EQUALS_MONTH_DAY_YEAR)return{valid:!1,error:`Relative dates can only be used with the month and day or month, day, and year operator for ${a.field}`};if(S(a)&&void 0===a.value[0].value)return{valid:!1,error:`Please select a value for the relative date for ${a.field}`};if(A(a)&&a.operator!==SY.BETWEEN_MONTH_DAY&&a.operator!==SY.BETWEEN_MONTH_DAY_YEAR)return{valid:!1,error:`Between dates can only be used with the between month day or between month day year operator for ${a.field}`};if(A(a)&&a.value.length>1)return{valid:!1,error:`Between dates can only have a single value for ${a.field}`};if(A(a)){const e=a.value[0];if(!e.startDate||!e.endDate)return{valid:!1,error:`Please ensure both a start and end date are selected for ${a.field}`};if(e.startDate instanceof Date&&e.endDate instanceof Date&&e.startDate>e.endDate)return{valid:!1,error:`Start date must be before end date for ${a.field}`};if("type"in e.startDate&&"relative"===e.startDate.type&&"type"in e.endDate&&"relative"===e.endDate.type){if(!e.startDate.value||!e.endDate.value)return{valid:!1,error:`Please ensure both a start and end date are selected for ${a.field}`};if(e.startDate.direction!==e.endDate.direction)return{valid:!1,error:`Start and end date must be of the same direction for ${a.field}`};const n=e=>{if(e.unit===Kme.DAYS)return e.value??0;throw W$(e.unit,Kme)};if("before"===e.startDate.direction&&n(e.startDate)>n(e.endDate))return{valid:!1,error:`Start date must be before end date for ${a.field}`};if("after"===e.startDate.direction&&n(e.startDate)<n(e.endDate))return{valid:!1,error:`Start date must be after end date for ${a.field}`}}}}return{valid:!0,error:void 0}})(u.conditions);if(!n)return void i({title:"Conditions are invalid",description:r??"Please ensure all fields are filled out",variant:"destructive"});const o=u.conditions.map((e=>{const a=v?.conditions.find((a=>a.field===e.field));return a?.type===kY.Date&&(e.value=e.value.map((e=>e instanceof Date?e.toISOString().split("T")[0]:e))),e}));l(!0);try{e&&d?h({name:u.name,description:u.description,conditions:o},{onSuccess:()=>{i({title:`${yh("engage:segment")} updated successfully`}),a(!1),t?.(e)},onError:()=>{i({title:`Error updating ${yh("engage:segment")}`,description:"Please try again",variant:"destructive"}),t?.("error")}}):p({name:u.name,description:u.description,conditions:u.conditions},{onSuccess:e=>{i({title:`${yh("engage:segment")} created successfully`}),t?.(e?.id??!1),a(!1)},onError:()=>{i({title:`Error creating ${yh("engage:segment")}`,description:"Please try again",variant:"destructive"}),t?.("error")}})}catch(s){i({title:`Error saving ${yh("engage:segment")}`,description:"Please try again",variant:"destructive"}),t?.("error")}finally{l(!1)}},disabled:s||g,children:s||g?n.jsxs(n.Fragment,{children:[n.jsx(_c,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})}function Spe({open:e,setOpen:a,segmentId:t,onSegmentUpdated:i}){return n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-6xl w-full",hideCloseButton:!0,children:[n.jsxs(uO,{children:[n.jsxs(OG,{children:[yh("engage:segment")," Builder"]}),n.jsxs(IG,{children:["Build a ",yh("engage:segment")," to target your audience"]})]}),n.jsx(bpe,{segmentId:t,setOpen:a,onSegmentUpdated:e=>{i?.(e),a(!1)}})]})})}const Ape=()=>n.jsx(Mae,{title:`These are estimated numbers of ${yh("engage:user",{count:2}).toLocaleLowerCase()} that are matched. The actual count may change at the time of sending. You can see the breakdown of who have opted into email or sms.`}),wpe=({value:e,label:a,percentage:t,variant:i,isLoading:r,selected:o})=>n.jsxs("div",{className:"rounded-md border-2 border-muted-foreground/20 px-2 pt-2 pb-3 duration-300 ease-in-out overflow-x-auto max-w-full min-w-0 "+(o?"scale-[1.02] [border-color:hsl(var(--reach-primary))] shadow-lg":""),style:{containerType:"inline-size"},"data-card-container":!0,children:[n.jsxs("div",{className:"flex flex-col gap-1 items-start w-full min-w-0",children:[n.jsx("div",{className:"flex items-baseline gap-2 w-full min-w-0 @container/num",children:r?n.jsx("span",{className:"animate-pulse",children:"..."}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-semibold pl-2 break-words max-w-full min-w-0 truncate\n text-xl @[250px]/card:text-2xl @[350px]/card:text-3xl @[500px]/card:text-4xl text-primary",children:e.toLocaleString()}),void 0!==t&&e.toLocaleString().replace(/,/g,"").length<5&&n.jsxs("span",{className:"text-muted-foreground/50 text-sm hidden @[120px]/num:inline",children:["(",t,"%)"]})]})}),n.jsx("span",{className:`px-2 sm:px-2.5 py-1 text-xs font-medium rounded-lg ${{default:"bg-gray-100/50 text-gray-700",blue:"bg-blue-100/50 text-blue-700",green:"bg-green-100/50 text-green-700"}[i]}`,children:a})]}),n.jsx("p",{className:"text-sm text-muted-fore hidden @[250px]/card:inline mt-1",children:1===e?"contact":"contacts"})]}),Cpe=({countResponse:e})=>{const t=a.useMemo((()=>e?.recipients?e.recipients.reduce(((a,n)=>({total:e.count,emails:a.emails+(n.email?1:0),phones:a.phones+(n.phone?1:0)})),{total:0,emails:0,phones:0}):{total:0,emails:0,phones:0}),[e]),i=e=>Math.round(e/(t.total||1)*100);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Lue,{children:"Estimated Matches"}),n.jsx(Ape,{})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 md:mb-6 w-full gap-4 mt-3 px-1",children:[n.jsx(wpe,{value:t.total,label:"Total",variant:"default",isLoading:void 0===e}),n.jsx(wpe,{value:t.emails,label:"Subscribed to Email",percentage:i(t.emails),variant:"blue",isLoading:void 0===e}),n.jsx(wpe,{value:t.phones,label:"Subscribed to SMS",percentage:i(t.phones),variant:"green",isLoading:void 0===e})]})]})},Mpe=({recipients:e})=>e?.length?n.jsx("div",{className:"bg-foreground/5 rounded-lg h-full relative overflow-hidden",children:n.jsx("div",{className:"absolute inset-0 w-full h-full overflow-y-auto",children:n.jsxs("table",{className:"w-full",children:[n.jsx("thead",{className:"sticky top-0 bg-foreground/5 backdrop-blur-sm",children:n.jsxs("tr",{children:[n.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Name"}),n.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Contact"})]})}),n.jsx("tbody",{className:"divide-y divide-gray-200/50",children:e.map(((e,a)=>n.jsxs("tr",{className:"hover:bg-white/50 transition-colors",children:[n.jsx("td",{className:"px-3 sm:px-4 py-3 text-sm text-gray-900",children:e.firstName||e.lastName?`${e.firstName||""} ${e.lastName||""}`.trim():"Not Provided"}),n.jsx("td",{className:"px-3 sm:px-4 py-3",children:n.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[e.email&&n.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-blue-100/50 text-blue-700 rounded-lg",children:"Email"}),e.phone&&n.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-green-100/50 text-green-700 rounded-lg",children:"Phone"})]})})]},a)))})]})})}):null,Tpe=({onSelectionChange:e,defaultValue:t="all"})=>{const[i,r]=a.useState(t),o=a=>{r(a),e?.(a)};return n.jsxs(n.Fragment,{children:[n.jsx(Lue,{children:"Filter"}),n.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[n.jsx(zY,{onClick:()=>o("all"),title:`All ${yh("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:n.jsx(RY.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===i}),n.jsx(zY,{onClick:()=>o("segments"),title:`Select ${yh("engage:user",{count:2})}`,subtitle:`Choose from ${yh("engage:segment",{count:2})}`,icon:n.jsx(RY.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===i})]})]})},Npe=({segments:e,allSegments:t,onAddSegment:i,onRemoveSegment:r,setOpenCreateSegmentDialog:o})=>{const[s,l]=a.useState([]),u=t.map((e=>({label:e.name,value:e.id})));return a.useEffect((()=>{l(e)}),[e]),n.jsx("div",{children:n.jsx(Xhe,{selectedValues:s,setSelectedValues:l,options:u,onValueChange:a=>{const n=a.filter((a=>!e.includes(a))),t=e.filter((e=>!a.includes(e)));n.forEach(i),t.forEach(r)},placeholder:"Select segments",maxCount:5,extraCommandItems:[e=>n.jsxs(Pse,{onSelect:()=>{e(!0),o(!0)},className:"cursor-pointer",children:[n.jsx(RY.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},xpe=({includedSegments:e,excludedSegments:t,handleAddSegment:i,handleRemoveSegment:r,setOpenCreateSegmentDialog:o,segments:s,defaultIsExcludeOpen:l=!1})=>{const[u,c]=a.useState(l);return n.jsxs("div",{children:[n.jsx(Npe,{segments:e,allSegments:s||[],onAddSegment:e=>i(e,"include"),onRemoveSegment:e=>r(e,"include"),setOpenCreateSegmentDialog:o}),n.jsx("div",{className:"border-t border-gray-200 my-8"}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs(jY,{onClick:()=>c(!u),className:"flex items-center gap-1 transition-colors",size:"sm",children:[n.jsx(H$.div,{animate:{rotate:u?180:0},transition:{duration:.2},children:n.jsx(RY.DropdownMenuTrigger,{className:"w-5 h-5"})}),n.jsx("span",{children:"Don't send to"})]}),n.jsx(aV,{children:u&&n.jsx(H$.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:n.jsx(Npe,{segments:t,allSegments:s||[],onAddSegment:e=>i(e,"exclude"),onRemoveSegment:e=>r(e,"exclude"),setOpenCreateSegmentDialog:o})})})]})]})},Epe=({title:e="Preview Audience"})=>{const t=wY(),[i,r]=a.useState("all"),[o,s]=a.useState(t?.includeSegmentIds||[]),[l,u]=a.useState(t?.excludeSegmentIds||[]),[c,d]=a.useState(!1),[m,h]=a.useState(!1),{segments:p,isLoading:g}=gY(),{updateAutomation:v}=Je(t?.id??""),[f,y]=a.useState(void 0),k=1===o.length&&0===l.length&&void 0!==p?.find((e=>e.type===bY.ALL_USERS&&e.id===o[0]));a.useEffect((()=>{t&&!m&&(r(k||o.length>0&&0===l.length?"all":"segments"),mY({includeSegments:o,excludeSegments:l}).then((e=>{y(e)})),h(!0))}),[t,k,m,o,l]);a.useEffect((()=>{t&&m&&(JSON.stringify(o)===JSON.stringify(t.includeSegmentIds)&&JSON.stringify(l)===JSON.stringify(t.excludeSegmentIds)||(v({includeSegments:o,excludeSegments:l}),mY({includeSegments:o,excludeSegments:l}).then((e=>{y(e)}))))}),[o,l,t,m,v]);return n.jsxs(Bue,{title:e,children:[!g&&p&&m?n.jsxs("div",{className:"flex gap-8 w-full pb-4 px-4",children:[n.jsxs("div",{className:"flex flex-col flex-1 relative overflow-y-auto pb-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:[n.jsx(Cpe,{countResponse:f}),n.jsx(Tpe,{onSelectionChange:e=>{if(r(e),"all"===e){const e=p?.find((e=>e.type===bY.ALL_USERS));if(!e)return;s([e.id]),u([])}},defaultValue:i}),n.jsx(aV,{children:"segments"===i&&n.jsx(H$.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:"easeInOut"},className:"w-full pt-4",children:n.jsx(xpe,{includedSegments:o,excludedSegments:l,handleAddSegment:(e,a)=>{"include"===a?s((a=>[...a,e])):u((a=>[...a,e]))},handleRemoveSegment:(e,a)=>{"include"===a?s((a=>a.filter((a=>a!==e)))):u((a=>a.filter((a=>a!==e))))},setOpenCreateSegmentDialog:d,segments:p,defaultIsExcludeOpen:l.length>0})})})]}),n.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:f?.recipients&&n.jsx(Mpe,{recipients:f.recipients})})]}):n.jsx("div",{children:n.jsx(xY,{text:["Fetching segments","Finishing up"]})}),n.jsx(Spe,{open:c,setOpen:d,onSegmentUpdated:e=>{e&&s((a=>[...a,e]))}})]})},Ppe=()=>n.jsx(Epe,{title:"Select Audience"}),jpe=()=>{const{channelSenders:e}=x9(),{channelAccounts:t}=M9(),i=CY(),{updateCommunicationGroup:r}=lY(),{state:{selectedChannels:o},setSelectedChannels:s}=a.useContext(A9),l=wY(),{data:u}=L9(),c=a.useCallback((async e=>{s(e),e.includes("email")||i?.id&&r({groupId:i?.id,params:{emailChannelSenderId:null}}),e.includes("sms")||i?.id&&r({groupId:i?.id,params:{smsChannelSenderId:null}})}),[s,r,i?.id]),d=a.useMemo((()=>zie({channelSenders:e?.results??[],channelAccounts:t?.results??[]})),[e?.results,t?.results]),m=a.useMemo((()=>mee({channelSenders:e?.results??[],channelAccounts:t?.results??[],smsApplication:u})),[e?.results,t?.results,u]);if(!o||!d||!m)return n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Content..."]})});const h=d.length>0,p=m.length>0;return n.jsx("div",{className:"flex flex-col gap-4 flex-shrink-0",children:n.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(oue,{automationType:l?.triggerMetadata?.triggerType,selectedChannels:o,setSelectedChannels:c,hasEmailChannelSenders:h,hasSmsChannelSenders:p})})})};var Lpe=(e=>(e[e.SelectAudience=1]="SelectAudience",e[e.SelectSenders=2]="SelectSenders",e[e.EditEmailContent=3]="EditEmailContent",e[e.EditSmsContent=4]="EditSmsContent",e[e.Schedule=5]="Schedule",e[e.PreviewAndSend=6]="PreviewAndSend",e))(Lpe||{});const Bpe="https://assets.embedreach.com/defaults/logo-placeholder-128.png",zpe="You have not uploaded a custom logo. Please make sure to double check your email before sending!",Rpe=()=>{const e=wY(),n=CY(),{state:{selectedChannels:t}}=a.useContext(A9),{data:i}=L9(),{channelSenders:r}=x9(),{channelAccounts:o}=M9(),s=mee({channelSenders:r?.results??[],channelAccounts:o?.results??[],smsApplication:i}),l=a.useCallback((async a=>e?await(async e=>{const{currentStep:a,automation:n,communicationGroup:t,selectedChannels:i,smsChannelSenders:r}=e;switch(a){case Lpe.SelectAudience:return{canMove:n.includeSegmentIds.length>0,errorMessage:"Please ensure you have selected at least one segment"};case Lpe.SelectSenders:return{canMove:i.length>0,errorMessage:"Please ensure you have selected at least one channel"};case Lpe.EditSmsContent:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));if(!e)return{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"};if(!t)return{canMove:!1,errorMessage:"Please ensure you have selected a communication group"};const a=r.find((e=>e.channelSender.id===t.smsChannelSenderId));return a?t.smsMessageBody?a.smsApplication&&a.smsApplication.status!==dee.APPROVED?{canMove:!0,errorMessage:null,warningMessage:"You will only be able to send this message once your SMS application is approved"}:{canMove:!0,errorMessage:null}:{canMove:!1,errorMessage:"Please ensure you have a text body"}:{canMove:!1,errorMessage:"Please ensure you have selected a text sender"}}case Lpe.EditEmailContent:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));if(!e)return{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"};if(!t)return{canMove:!1,errorMessage:"Please ensure you have selected a communication group"};if(!t.emailChannelSenderId)return{canMove:!1,errorMessage:"Please ensure you have selected a email sender"};if(!t.emailHtmlBody||!t.emailSubject)return{canMove:!1,errorMessage:"Please ensure you have a email body and subject"};let a=null;return t.emailHtmlBody?.includes(Bpe)&&(a=zpe),{canMove:!0,errorMessage:null,warningMessage:a}}case Lpe.Schedule:{if(!n.triggerMetadata)return{canMove:!1,errorMessage:"Please make sure to select a time to send before starting!"};if(n.triggerMetadata.triggerType!==Ze.ONE_TIME)return{canMove:Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:null};if(!n.triggerMetadata?.scheduledAt)return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${yh("engage:broadcast")}`};if(!Boolean(n.triggerMetadata?.scheduledAt&&("now"===n.triggerMetadata.scheduledAt||"now"!==n.triggerMetadata.scheduledAt&&new Date(n.triggerMetadata.scheduledAt)>new Date)))return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${yh("engage:broadcast")}`};if(!Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))))return{canMove:!1,errorMessage:"Please ensure you have set a valid email or sms communication"};const e=n.triggerMetadata;return{canMove:Boolean(e.scheduledAt&&("now"===e.scheduledAt||new Date(e.scheduledAt)>new Date)&&n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:`Please ensure you have set a valid future date for your ${yh("engage:broadcast")}`}}case Lpe.PreviewAndSend:return{canMove:!0,errorMessage:null};default:Dse(a,Lpe)}})({currentStep:a,automation:e,communicationGroup:n,selectedChannels:t,smsChannelSenders:s}):{canMove:!1,errorMessage:`${yh("engage:broadcast")} not loaded`}),[e,n,t,s]);return{validateStep:l}},_pe=({onFinish:e,getExtraMergeFields:t,onBeforeSchedule:i})=>{const r=wY(),o=CY(),{updateAutomation:s}=Je(r?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:n}=vY({automationId:e?.id??"",includeSegments:e?.includeSegmentIds??[],excludeSegments:e?.excludeSegmentIds??[]}),t=a.useMemo((()=>n?.recipients?n.recipients.reduce(((e,a)=>({emails:e.emails+(a.email?1:0),phones:e.phones+(a.phone?1:0)})),{emails:0,phones:0}):{emails:0,phones:0}),[n?.recipients]);return{estimatedMatches:n,estimatedMatchesStats:t}})(r??void 0),{state:{selectedChannels:u}}=a.useContext(A9),{validateStep:c}=Rpe(),[d,m]=a.useState([]),{data:h}=L9(),[p,g]=a.useState(!1),{channelSenders:v}=x9(),{channelAccounts:f}=M9(),[y,k]=a.useState(Lpe.SelectAudience);if(a.useEffect((()=>{if(null!==r&&null!==o){const e=mee({channelSenders:v?.results??[],channelAccounts:f?.results??[],smsApplication:h});m((({automation:e,communicationGroup:a,selectedChannels:t,smsChannelSenders:i})=>e?[{id:"audience",title:"Audience",step:1,isValid:()=>e.includeSegmentIds.length>0,content:n.jsx(Nae,{content:n.jsx(Ppe,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Ze.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},{id:"senders",title:"Channel Senders",step:2,isValid:()=>0!==t.length,content:n.jsx(Nae,{content:n.jsx(jpe,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Ze.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},...t.includes("email")?[{id:"edit-email-content",title:"Edit Email Content",step:3,isValid:()=>{const n=e.actionData?.find((e=>"send_communication"===e.actionType));return!!n&&!!a.emailChannelSenderId&&!(!a.emailHtmlBody||!a.emailSubject)},content:n.jsx(Nae,{content:n.jsx(Rie,{})},"audience"),footerConfig:{backText:"",nextText:"",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[],...t.includes("sms")?[{id:"edit-sms-content",title:"Edit SMS Content",step:4,isValid:()=>{const n=e.actionData?.find((e=>"send_communication"===e.actionType));return!!(n&&n.actionMetadata.communicationGroupId&&a.smsChannelSenderId&&a.smsMessageBody)},content:n.jsx(Nae,{content:n.jsx(Rse,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[],{id:"schedule",title:"Schedule",step:5,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Ze.ONE_TIME&&e.triggerMetadata?.scheduledAt&&("now"===e.triggerMetadata.scheduledAt||"now"!==e.triggerMetadata.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date)&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:n.jsx(Nae,{className:"flex-1",content:n.jsx(Dme,{})},"schedule"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"send",title:"Send",step:6,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Ze.ONE_TIME&&e.triggerMetadata?.scheduledAt&&("now"===e.triggerMetadata.scheduledAt||"now"!==e.triggerMetadata.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date(Date.now()+18e4))&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:n.jsx(Nae,{className:"flex-1",content:n.jsx(Rue,{})},"send"),footerConfig:{backText:"Back",nextText:"Schedule",hideBack:!1,backDisabled:!1,getInfoTooltipTitle:()=>{const e=i.find((e=>e.channelSender.id===a.smsChannelSenderId));if(!e||null!==e.smsApplication&&e.smsApplication?.status!==dee.APPROVED)return"You cannot send this yet if you have selected a text channel and don't have an approved SMS application. Please save as draft and try again later."},nextDisabled:()=>{const e=i.find((e=>e.channelSender.id===a.smsChannelSenderId));return!(!a.smsChannelSenderId||e&&(null===e.smsApplication||e.smsApplication?.status===dee.APPROVED))||null===a.smsChannelSenderId&&null===a.emailChannelSenderId}}}]:[])({automation:r,communicationGroup:o,selectedChannels:u,smsChannelSenders:e}))}}),[r,o,t,u,v?.results,f?.results,h]),!(r&&y&&o&&d.length))return n.jsx("div",{className:"flex-1 flex flex-col @container justify-center items-center h-[500px]",children:n.jsx(xY,{text:[`Fetching ${yh("engage:broadcast")} data`,"Finishing up"]})});const b=async()=>{const{canMove:a,errorMessage:n,warningMessage:t}=await c(y);a?(t&&Oe({title:t,variant:"warning"}),y===Lpe.PreviewAndSend?await(async()=>{if(null===o.emailChannelSenderId&&null===o.smsChannelSenderId)return void Oe({title:"Oops!",description:"Please select an email sender or sms sender",variant:"destructive"});const a=mee({channelSenders:v?.results??[],channelAccounts:f?.results??[],smsApplication:h});if(o.smsChannelSenderId){const e=a.find((e=>e.channelSender.id===o.smsChannelSenderId));if(e?.smsApplication?.application&&e?.smsApplication.status!==dee.APPROVED)return void Oe({title:"Oops!",description:"You cant schedule a communication with a pending sms application. Please save as a draft and re-try once the application is approved."})}if(i)try{const a=await i({estimatedEmailRecipients:l?.emails||0,estimatedSmsRecipients:l?.phones||0});!0===a?(s({status:Xe.ACTIVE}),Oe({title:`${yh("engage:broadcast")} scheduled!`}),e()):Oe({title:"Oops!",description:a,variant:"destructive"})}catch(n){Oe({title:"Oops!",description:"An error occurred while checking scheduling conditions",variant:"destructive"})}else s({status:Xe.ACTIVE}),Oe({title:`${yh("engage:broadcast")} scheduled!`}),e()})():k(y===Lpe.SelectSenders&&1===u.length&&"sms"===u[0]?y+2:y+1)):Oe({title:"Oops!",description:n,variant:"destructive"})},S=()=>{y>Lpe.SelectAudience&&k(y===Lpe.EditSmsContent&&1===u.length&&"sms"===u[0]?y-2:y-1)},A=()=>{e()};return n.jsxs("div",{className:"flex-1 flex flex-col @container h-full min-h-0",children:[n.jsxs("header",{className:"w-full flex items-center gap-4 h-16 px-6",children:[n.jsx("h1",{className:"text-xl font-bold leading-none",children:r.name}),n.jsx("div",{className:"flex items-center gap-4",children:n.jsx(UY,{variant:vae(r.status),children:v9[r.status]})})]}),n.jsxs("main",{className:"flex gap-4 flex-1 min-h-0",children:[n.jsx("div",{className:"hidden @[1000px]:block",children:n.jsx("nav",{className:"space-y-0 w-50 self-start pr-6 pl-8 pt-4 ",children:d.map((e=>n.jsx("div",{className:`\n rounded-md transition-colors\n ${e.step===y?"bg-[var(--reach-secondary)] text-[var(--reach-primary-foreground)] font-medium":e.step<y?"text-muted-foreground hover:bg-muted":"text-muted-foreground/60"}\n `,children:n.jsx(nQ,{label:e.title,isActive:e.step===y,isCompleted:e.isValid(),onClick:async()=>{if(!p)if(e.step>y){const{canMove:a,errorMessage:n,warningMessages:t}=await(async e=>{if(e<=y)return{canMove:!0,errorMessage:null};g(!0);try{const a=[];for(let n=y;n<e;n++){const{canMove:e,errorMessage:t,warningMessage:i}=await c(n);if(!e)return{canMove:e,errorMessage:t};i&&a.push(i)}return{canMove:!0,errorMessage:null,warningMessages:a}}finally{g(!1)}})(e.step);if(a){if(t&&t.length>0)for(const e of t)Oe({title:e,variant:"warning"});k(e.step)}else n&&Oe({title:"Cannot navigate to this step",description:n,variant:"destructive"})}else k(e.step)}})},e.step)))})}),n.jsx("section",{className:"flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0",children:n.jsx("div",{className:" overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex",children:n.jsx(aV,{children:n.jsx(EY,{className:"pt-0 h-full",children:d.find((e=>e.step===y))?.content},y)})})})]}),n.jsx("footer",{className:"w-full flex justify-end shadow-md z-10 items-center h-16 px-6",children:n.jsx(Tae,{handleSkipAndSaveAsDraft:A,handleBack:S,handleNext:b,hideBack:d.find((e=>e.step===y))?.footerConfig.hideBack??!1,backText:d.find((e=>e.step===y))?.footerConfig.backText??"Back",nextText:d.find((e=>e.step===y))?.footerConfig.nextText??"Next",backDisabled:d.find((e=>e.step===y))?.footerConfig.backDisabled??!1,nextDisabled:d.find((e=>e.step===y))?.footerConfig.nextDisabled()??!1,getInfoTooltipTitle:d.find((e=>e.step===y))?.footerConfig.getInfoTooltipTitle??void 0})})]})},Dpe=({children:e,actionId:t})=>{const{setActionId:i}=a.useContext(X$);return a.useEffect((()=>{i(t)}),[t,i]),n.jsx("div",{children:n.jsx(w9,{children:e})})},Kpe=()=>n.jsxs("div",{children:[n.jsx("div",{className:HY,children:n.jsx(RY.OneTimeBroadcast,{})}),n.jsx("h3",{className:OY,children:yh("engage:broadcast")}),n.jsx("p",{className:IY,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),Hpe=()=>n.jsxs("div",{children:[n.jsx("div",{className:GY,children:"Coming Soon"}),n.jsx("div",{className:HY,children:n.jsx(RY.RealtimeActivity,{})}),n.jsx("h3",{className:OY,children:"Realtime Activity"}),n.jsx("p",{className:IY,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),Ope=({selectedType:e,setAutomationName:a,automationName:t,setAutomationDescription:i,automationDescription:r})=>n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 max-w-lg mx-auto",children:[n.jsxs("h2",{className:"text-2xl font-semibold mb-8 text-center",children:["Name Your"," ",yh(e===Ze.ONE_TIME?"engage:broadcast":"engage:trigger_based")]}),n.jsxs("div",{className:"w-full space-y-6",children:[n.jsx("div",{className:"bg-gray-50 p-6 rounded-xl items-center justify-center text-center",children:(()=>{switch(e){case Ze.ONE_TIME:return n.jsx(Kpe,{});case Ze.TRIGGER_BASED:return n.jsx(Hpe,{});default:throw Dse(e,Ze)}})()}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[n.jsx("label",{htmlFor:"automationName",className:"block text-sm font-medium text-gray-900",children:"Name"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"Only visible to your team"})]}),n.jsx(o4,{id:"automationName",type:"text",value:t,onChange:e=>a(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500 shadow-sm",placeholder:"e.g. April Newsletter Campaign",autoFocus:!0})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[n.jsx("label",{htmlFor:"automationDescription",className:"block text-sm font-medium text-gray-900",children:"Description"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"Optional"})]}),n.jsx(jse,{id:"automationDescription",value:r,onChange:e=>i(e.target.value),className:"w-full min-h-[80px] resize-none",placeholder:`Add any helpful context for your team. If left blank, we'll generate one for you when you start the ${yh("engage:broadcast").toLowerCase()}`})]})]})]})]}),Ipe=({onClose:e,automationType:t,currentStep:i,setCurrentStep:r,getExtraMergeFields:o,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:u}=Fe(),[c,m]=a.useState(!1),[h,p]=a.useState(void 0),[g,v]=a.useState(void 0),[f,y]=a.useState(!1),[k,b]=a.useState(t?{name:void 0,description:void 0,type:t}:{name:void 0,description:void 0,type:void 0}),S=void 0!==k.name&&void 0!==k.type&&""!==k.name;a.useEffect((()=>{if(k.type&&!k.name&&!f){const e=new Date,a=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=e.toLocaleDateString([],{month:"long",day:"numeric"}),t=`${yh("engage:broadcast")} ${n} ${a}`,i="";b((e=>({...e,name:t,description:i}))),y(!0)}}),[k,f]);if(u||c)return n.jsx("div",{className:KY,children:n.jsx(xY,{text:[`Creating ${yh("engage:broadcast")}`,"Finishing up"]})});return n.jsxs("div",{className:LG("relative overflow-y-auto h-full p-8",i===LY.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[n.jsx(aV,{mode:"wait",children:n.jsx(EY,{className:"h-full",children:(()=>{switch(i){case LY.ChooseAutomationType:return n.jsx(VY,{onNext:e=>{b({...k,type:e}),r(LY.SetAutomationName)}});case LY.SetAutomationName:return k.type?n.jsx(Ope,{selectedType:k.type,setAutomationName:e=>{b({...k,name:e})},automationName:k.name??"",setAutomationDescription:e=>{b({...k,description:e})},automationDescription:k.description??""}):null;case LY.OneTimeWizard:return h&&g?n.jsx(TY,{automationId:h,children:n.jsx(Dpe,{actionId:g,children:n.jsx(_pe,{onFinish:()=>{e?.(h)},getExtraMergeFields:o,onBeforeSchedule:s})})}):null;default:throw W$(i,LY)}})()},i)}),i!==LY.OneTimeWizard&&n.jsx("div",{className:"pt-2",children:n.jsx(BY,{onClose:e,currentStep:i,setCurrentStep:r,isDisabled:!S,createAutomation:async()=>{if(!S||!k.name||!k.type)return;m(!0);l({name:k.name,type:k.type,description:k.description},{onSuccess:async a=>{if(a.id){const n=await(async e=>(await Pe(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),i=U$().toString();await Le(a.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:i}}]}),p(a.id),await rY({automationId:a.id,actionId:i}),t===Ze.ONE_TIME?(r(LY.OneTimeWizard),v(i),m(!1)):e?.(a.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{b({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==t})})]})};function Gpe({open:e,setOpen:t,onClose:i,automationType:r,getExtraMergeFields:o,replyToSettingsText:s,replyToSettingsLink:l,fromNameSettingsText:u,fromNameSettingsLink:c}){const[d,m]=a.useState(r?LY.SetAutomationName:LY.ChooseAutomationType);return a.useEffect((()=>{e&&m(r?LY.SetAutomationName:LY.ChooseAutomationType)}),[e,r]),n.jsx(dO,{children:n.jsx(mO,{replyToSettingsText:s,replyToSettingsLink:l,fromNameSettingsText:u,fromNameSettingsLink:c,children:n.jsx(BG,{open:e,onOpenChange:t,children:n.jsxs(DG,{hideCloseButton:d===LY.OneTimeWizard,className:`flex max-h-[86vh] ${d===LY.OneTimeWizard?"max-w-[90vw]":"max-w-4xl"} flex-col gap-0 overflow-visible p-0`,children:[n.jsx(KG,{children:n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs(uO,{children:[n.jsx(OG,{className:"text-3xl font-normal",children:"Create Automation"}),n.jsx(IG,{children:"Create a new automation to send messages to your customers."})]})})}),n.jsx(Ipe,{onClose:e=>{i?.(e),t(!1)},automationType:r,currentStep:d,setCurrentStep:m,getExtraMergeFields:o})]})})})})}const Vpe=({tabs:e,activeTab:t,onTabChange:i,tabsLocation:r="left",secondaryTabs:o=!1})=>{const s=a.useRef([]),[l,u]=a.useState({width:0,left:0});a.useEffect((()=>{const a=s.current[e.findIndex((e=>e.id===t))];a&&u({width:a.offsetWidth,left:a.offsetLeft})}),[t,e]);const c=e.find((e=>e.id===t));return n.jsxs("div",{className:"flex flex-col gap-4 w-full overflow-x-hidden h-full",children:[n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"relative flex items-center gap-8 "+("left"===r?"w-full justify-start":"w-full justify-center"),children:[n.jsx("div",{className:"absolute bottom-0 h-[1px] rounded-full transition-all duration-300 ease-out\n bg-gradient-to-r from-primary to-primary/90\n shadow-[0_0_8px_rgba(var(--primary-rgb),0.3)]",style:{width:`${l.width}px`,left:`${l.left}px`}}),e.map(((e,a)=>n.jsx("button",{ref:e=>s.current[a]=e,onClick:()=>i(e.id),className:LG("relative px-7 py-3 transition-all duration-200 text-lg",t!==e.id&&"text-muted-foreground",o&&"text-sm"),children:e.label},e.id)))]})}),n.jsx("div",{className:"relative overflow-hidden flex-grow min-h-0",children:n.jsx("div",{className:"relative h-full",children:c?c.content:null})})]})},Fpe=e=>{if(!e)return"$0.00";const a="string"==typeof e?e.replace(/,/g,""):e,n=Number(a);return Number.isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(n)},Jpe="reach-styles-module__header___-izE2",Upe="reach-styles-module__title___n1hA9",Wpe="reach-styles-module__description___EvXM-",qpe="reach-styles-module__content___okv68",Zpe="reach-styles-module__footer___YA4U4",$pe=lc("reach-styles-module__base___zJcoE",{variants:{variant:{default:"reach-styles-module__default___88Q0d",destructive:"reach-styles-module__destructive___5EWhN",outline:"reach-styles-module__outline___gj9sC",secondary:"reach-styles-module__secondary___cN5Wj"}},defaultVariants:{variant:"default"}}),Ype=r.forwardRef((({className:e,variant:a,...t},i)=>n.jsx("div",{ref:i,className:im($pe({variant:a}),e),...t})));Ype.displayName="Card";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(Jpe,e),...a}))).displayName="CardHeader";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(Upe,e),...a}))).displayName="CardTitle";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(Wpe,e),...a}))).displayName="CardDescription";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(qpe,e),...a}))).displayName="CardContent";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(Zpe,e),...a}))).displayName="CardFooter";const Qpe=({Icon:e,title:a,value:t,tooltipText:i,change:r})=>n.jsxs(Ype,{className:"relative flex flex-col justify-between min-h-[130px] transition-all duration-300 hover:shadow-md p-4",children:[n.jsxs("div",{className:"flex justify-between items-start",children:[n.jsx("div",{className:"rounded-lg p-2 bg-primary/10 flex items-center justify-center",children:n.jsx(e,{className:"w-5 h-5 text-primary"})}),n.jsx("div",{className:"absolute top-3 right-3",children:n.jsx(Mae,{title:i})})]}),n.jsxs("div",{className:"mt-4",children:[n.jsx("div",{className:"text-2xl font-bold leading-tight text-primary",children:t}),n.jsx(Lue,{children:a})]}),r&&n.jsx("div",{className:"absolute bottom-3 right-3",children:n.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-green-100 text-green-600 text-xs font-semibold",children:r})})]}),Xpe=({activeTab:e,automation:a})=>{if(!a)return null;const t={sales:[{Icon:RY.SalesAmount,title:"Order Amount",value:Fpe(a.derivedRevenue),tooltipText:"Total derived revenue from this campaign"}]};return n.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:t[e].map(((e,a)=>n.jsx(Qpe,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},a)))})},ege=({activeTab:e,statistics:a})=>{const t={email:[{Icon:RY.MessagesSent,title:"Emails Sent",value:a.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:RY.OpenRate,title:"Open Rate",value:`${(100*a.email.openPercentage).toFixed(2)}%`,tooltipText:"Percentage of recipients who opened the email out of total emails delivered"},{Icon:RY.TotalBounceRate,title:"Total Bounce Rate",value:`${(100*(a.email.softBounceRate+a.email.hardBounceRate)).toFixed(2)}%`,tooltipText:"Percentage of emails that were not delivered due to permanent (hard) or temporary (soft) delivery failures"},{Icon:RY.LinksClicked,title:"Links Clicked",value:a.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:RY.SpamComplies,title:"Spam Complaints",value:`${(100*a.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:RY.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*a.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:RY.MessagesSent,title:"SMS Sent",value:a.sms.numberSent,tooltipText:"Total number of SMS messages that were successfully sent in this campaign"}]};return n.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:t[e].map(((e,a)=>n.jsx(Qpe,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},a)))})},age=({automationId:e,includeSales:t=!1,includeSms:i=!1,automation:r})=>{const[o,s]=a.useState("email"),{statistics:l,isLoading:u}=Ue(e);if(u||!l)return n.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:n.jsx(xY,{text:[`Fetching ${yh("engage:insight",{count:2})}`,"Finishing up"]})});const c=[{id:"email",label:`Email ${yh("engage:insight",{count:2})}`,content:n.jsx(ege,{activeTab:"email",statistics:l})},...i?[{id:"sms",label:`SMS ${yh("engage:insight",{count:2})}`,content:n.jsx(ege,{activeTab:"sms",statistics:l})}]:[],...t?[{id:"sales",label:`Sales ${yh("engage:insight",{count:2})}`,content:n.jsx(Xpe,{activeTab:"sales",automation:r})}]:[]];return n.jsx(Vpe,{tabs:c,activeTab:o,onTabChange:e=>s(e),tabsLocation:"left"})},nge={all:["website"],content:()=>[...nge.all,"content"],analyze:()=>[...nge.all,"analyze"],brandSettings:()=>[...nge.all,"brand-settings"]},tge=async()=>(await Pe("/web-presence/brand-settings",{method:"POST"})).data,ige=({isLoading:e,brandSettings:t,onComplete:i})=>{const[r,o]=a.useState(0),s=[{text:"Analyzing your brand palette",icon:Vc},{text:"Extracting your visual identity",icon:Pc},{text:"Discovering your brand personality",icon:Lc},{text:"Crafting your email style",icon:Kc},{text:"Finalizing your brand profile",icon:Cc}];a.useEffect((()=>{if(!e)return;const a=setInterval((()=>{o((e=>{const n=e+1;return n>=s.length?(clearInterval(a),setTimeout((()=>{i()}),1500),e):n}))}),2500);return()=>clearInterval(a)}),[e,i,s.length]);return n.jsx(H$.div,{className:"flex flex-col items-center justify-center h-full w-full bg-background p-6",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},children:n.jsxs("div",{className:"flex flex-col items-center gap-8 max-w-2xl w-full",children:[n.jsx(H$.div,t?.logoUrl?{className:"w-24 h-24 sm:w-32 sm:h-32 flex items-center justify-center rounded-xl overflow-hidden bg-card shadow-md border",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:n.jsx("img",{src:t.logoUrl,alt:"Brand Logo",className:"max-w-full max-h-full object-contain"})}:{className:"w-24 h-24 sm:w-32 sm:h-32 rounded-xl flex items-center justify-center shadow-md border bg-primary",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:t?.brandName?n.jsx("span",{className:"text-4xl sm:text-5xl font-bold text-white",children:t.brandName.charAt(0)}):n.jsx(ad,{className:"w-12 h-12 sm:w-16 sm:h-16 text-white"})}),n.jsx(H$.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-xl font-medium text-center text-foreground",children:s[r].text},`loading-${r}`),n.jsx("div",{className:"flex items-center justify-center space-x-8 sm:space-x-12",children:s.map(((e,a)=>{const t=a<=r,i=a===r;return n.jsxs(H$.div,{className:"relative flex items-center justify-center w-12 h-12 rounded-full border-2 "+(t?"bg-card shadow-md border-primary":"bg-muted border-muted-foreground/30"),initial:{scale:.8,opacity:.5},animate:{scale:i?1.1:1,opacity:t?1:.5},transition:{duration:.3},children:[n.jsx(e.icon,{className:"w-5 h-5 "+(t?"text-primary":"text-muted-foreground")}),i&&n.jsx(H$.div,{className:"absolute inset-0 rounded-full border-2 border-primary",initial:{scale:1,opacity:.8},animate:{scale:2.5,opacity:0},transition:{duration:3,repeat:1/0,ease:"easeOut"}})]},`step-${a}`)}))}),n.jsx(H$.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.8,duration:.6},className:"w-full",children:n.jsx("div",{className:"h-[140px] w-full max-w-lg mx-auto p-5 bg-gradient-to-br from-card/70 to-card/40 backdrop-blur-md rounded-2xl border border-border/60 shadow-lg",children:n.jsxs("div",{className:"h-full flex flex-col justify-center",children:[0===r&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80 text-center",children:"Extracted Color Palette"}),n.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[t?.primaryColor,...t?.secondaryColors||[]]?.slice(0,4).map(((e,a)=>n.jsx("div",{className:"flex flex-col items-center gap-1",children:n.jsx("div",{className:"w-10 h-10 rounded-xl border-2 border-white/50 shadow-md",style:{backgroundColor:e}})},a)))}),n.jsx("div",{className:"text-center text-xs text-muted-foreground",children:"Brand colors identified"})]}),1===r&&n.jsxs("div",{className:"text-center space-y-2",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Identity"}),t?.brandName?n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xl font-bold",children:t.brandName}),t.brandTagline&&n.jsxs("div",{className:"text-sm text-muted-foreground italic px-4",children:['"',t.brandTagline,'"']}),n.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Visual identity extracted"})]}):n.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Extracting brand elements..."})]}),2===r&&n.jsxs("div",{className:"text-center space-y-3",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Personality"}),t?.brandPersonality?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex justify-center gap-4",children:[t.brandPersonality.tone&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Tone"}),n.jsx("div",{className:"text-sm font-medium text-foreground capitalize px-2 py-1 bg-background/50 rounded-md",children:t.brandPersonality.tone})]}),t.brandPersonality.voice&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Voice"}),n.jsx("div",{className:"text-sm font-medium text-foreground capitalize px-2 py-1 bg-background/50 rounded-md",children:t.brandPersonality.voice})]})]}),t.brandPersonality.values&&t.brandPersonality.values.length>0&&n.jsx("div",{className:"flex justify-center gap-1 flex-wrap",children:t.brandPersonality.values.slice(0,3).map(((e,a)=>n.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded-full",children:e},a)))})]}):n.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Analyzing brand tone and voice..."})]}),3===r&&n.jsxs("div",{className:"text-center space-y-3",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Email Template Preview"}),n.jsxs("div",{className:"bg-background/60 rounded-lg p-3 border border-border/30",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-4 h-4 rounded"}),n.jsx("div",{className:"text-xs font-medium text-foreground",children:t?.brandName||"Your Brand"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground text-left",children:["Email styling applied with your brand colors",t?.brandPersonality?.tone&&`, ${t.brandPersonality.tone} tone`,", and visual identity"]})]})]}),4===r&&n.jsxs("div",{className:"text-center space-y-2",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Kit Complete"}),n.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[n.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Identity"}),n.jsx("div",{className:"text-sm font-medium text-foreground",children:t?.brandName?"✓":"—"})]}),n.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Colors"}),n.jsx("div",{className:"text-sm font-medium text-foreground",children:t?.primaryColor?"✓":"—"})]}),n.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Personality"}),n.jsx("div",{className:"text-sm font-medium text-foreground",children:t?.brandPersonality?.tone?"✓":"—"})]})]})]}),(0===r&&!t?.primaryColor&&!t?.colorPalette||1===r&&!t?.brandName||2===r&&!t?.brandPersonality)&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Analyzing brand data..."}),n.jsx("div",{className:"flex justify-center gap-1 mt-2",children:[...Array(3)].map(((e,a)=>n.jsx(H$.div,{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/50",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:1,repeat:1/0,delay:.2*a}},a)))})]})]})})},`content-${r}`)]})})},rge=({setAutoParse:e,onBrandSettingsGenerated:t,onForceRefresh:i})=>{const{data:r,updateWebsite:o,isUpdatingWebsite:s,updateBrandSettings:l}=Poe(),u=ke({mutationFn:tge,mutationKey:nge.brandSettings()}),[c,d]=a.useState(r?.website||""),[m,h]=a.useState(!1),[p,g]=a.useState(null),[v,f]=a.useState(!1),[y,k]=a.useState(!1),b=()=>{e(!1)};return y&&p?n.jsx(H$.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:n.jsx(sge,{initialBrandSettings:p,onSave:()=>{p&&(l({logoBase64:p.logo_base64,primaryColor:p.primaryColor,secondaryColors:p.secondaryColors,brandTagline:p.brandTagline,brandName:p.brandName,brandPersonality:p.brandPersonality,colorPalette:p.colorPalette}),i&&i(),Oe({title:"Brand settings saved successfully 🚀",description:"Your brand identity has been updated."}),e(!1))},onBack:b,showAutoParseButton:!1})},"results"):n.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[n.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:n.jsxs(aV,{mode:"wait",children:[!v&&!y&&n.jsx(H$.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col h-full",children:n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 space-y-8",children:[n.jsxs("div",{className:"space-y-2 w-full max-w-md",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block text-center",children:"Your Website URL"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-center",children:[n.jsx(o4,{type:"url",value:c,onChange:e=>d(e.target.value),placeholder:"https://example.com",className:"flex-1",disabled:!m}),n.jsx(aV,{mode:"wait",children:m?n.jsxs(H$.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex gap-2",children:[n.jsx(jY,{variant:"outline",size:"sm",onClick:()=>{h(!1),d(r?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),n.jsx(jY,{size:"sm",onClick:async()=>{try{o(c),h(!1),Oe({title:"Website URL updated successfully 🎉",description:"Your website URL has been saved."})}catch(e){Oe({title:"Error updating website URL",description:"Please try again.",variant:"destructive"})}},disabled:s||!c,className:"w-full sm:w-auto",children:s?n.jsx(xY,{}):"Save Changes"})]},"save"):n.jsx(H$.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:n.jsx(jY,{variant:"outline",size:"sm",onClick:()=>h(!0),className:"w-full sm:w-auto",children:"Edit URL"})},"edit")})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl",children:[n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[n.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"What we'll analyze"}),n.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[n.jsx("li",{children:"• Your brand colors and color palette"}),n.jsx("li",{children:"• Your logo (if detectable)"}),n.jsx("li",{children:"• Your brand name and tagline"}),n.jsx("li",{children:"• Your brand's tone and personality"})]})]}),n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[n.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"How it helps you"}),n.jsx("p",{className:"text-sm text-gray-600",children:"Our AI will automatically extract your brand assets to create consistently styled emails that match your website. This helps maintain brand recognition and professionalism in all your communications."})]})]}),n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"text-sm text-muted-foreground text-center max-w-md",children:"We'll use AI to analyze your website and extract your brand elements to create perfectly matched email templates."})]})},"url-confirmation"),v&&p&&n.jsx(H$.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:n.jsx(ige,{isLoading:v,brandSettings:p,onComplete:()=>{f(!1),k(!0),Oe({title:"Brand settings generated successfully!",description:"Your brand identity has been analyzed."})}})},"analyzing"),v&&!p&&n.jsx(H$.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 flex flex-col items-center justify-center h-full",children:n.jsxs(H$.div,{className:"flex flex-col items-center gap-8",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:5,repeat:1/0,repeatType:"reverse"},children:[n.jsxs(H$.div,{className:"relative w-24 h-24 flex items-center justify-center",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:[n.jsx($c,{className:"w-12 h-12 text-primary drop-shadow-md"}),n.jsx(H$.div,{className:"absolute inset-0 rounded-full border-2",style:{borderColor:"var(--primary)"},initial:{scale:1,opacity:.8},animate:{scale:2.5,opacity:0},transition:{duration:3,repeat:1/0,ease:"easeOut"}})]}),n.jsxs("div",{className:"text-center space-y-2",children:[n.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:"Analyzing your website"}),n.jsx(aV,{mode:"wait",children:n.jsx(H$.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-gray-600 max-w-md text-center px-4",children:"Generating your brand's unique visual identity and personality"},"loading-message")})]})]})},"pre-analyzing")]})}),!v&&!y&&n.jsxs(HG,{className:"p-4",children:[n.jsx(jY,{variant:"outline",onClick:b,className:"gap-1",children:"Go Back"}),n.jsxs(jY,{onClick:async()=>{try{f(!0);const e=await u.mutateAsync();g(e),t&&t(e)}catch(e){f(!1),g(null),Oe({title:"Error generating brand settings",description:"Please try again.",variant:"destructive"})}},disabled:!c||u.isPending,className:"gap-1",children:[n.jsx(ad,{className:"h-4 w-4 text-amber-500"}),u.isPending?n.jsx(xY,{}):"Analyze Website"]})]})]})},oge=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],sge=({initialBrandSettings:e,onSave:t,onBack:i,showAutoParseButton:r=!0})=>{const{data:o,isLoading:s,updateBrandSettings:l,isUpdatingBrandSettings:u}=Poe(),[c,d]=a.useState({}),[m,h]=a.useState(!1),[p,g]=a.useState({}),[v,f]=a.useState(""),[y,k]=a.useState(""),[b,S]=a.useState("#000000"),[A,w]=a.useState(Date.now()),[C,M]=a.useState(!1),[T,N]=a.useState(null),[x,E]=a.useState({identity:!0,colors:!0,personality:!0}),P=a.useRef(null),{toast:j}=Ie();a.useEffect((()=>{if(e)return d({brandName:e.brandName,brandTagline:e.brandTagline,logoUrl:e.logoUrl,primaryColor:e.primaryColor||"#000000",secondaryColors:e.secondaryColors||[],brandPersonality:{tone:e.brandPersonality?.tone,voice:e.brandPersonality?.voice,values:e.brandPersonality?.values||[]}}),void w(Date.now());o?.branding&&(d({brandName:o.branding.brandName||o.name,brandTagline:o.branding.brandTagline||"",logoUrl:o.branding.logoUrl||"",primaryColor:o.branding.primaryColor||"#000000",secondaryColors:o.branding.secondaryColors||[],brandPersonality:{tone:o.branding.brandPersonality?.tone,voice:o.branding.brandPersonality?.voice,values:o.branding.brandPersonality?.values||[]}}),w(Date.now()))}),[o,e]);const L=e=>{E((a=>({...a,[e]:!a[e]})))},B=e=>{g((a=>{const n={...a,[e]:!a[e]};return n[e]&&("brandName"===e?f(c.brandName||""):"brandTagline"===e?f(c.brandTagline||""):"primaryColor"===e?f(c.primaryColor||"#000000"):"tone"===e?f(c.brandPersonality?.tone||""):"voice"===e&&f(c.brandPersonality?.voice||"")),n}))},z=e=>{"brandName"===e?d((e=>({...e,brandName:v}))):"brandTagline"===e?d((e=>({...e,brandTagline:v}))):"primaryColor"===e?d((e=>({...e,primaryColor:v}))):"tone"===e?d((e=>({...e,brandPersonality:{...e.brandPersonality,tone:v||void 0}}))):"voice"===e&&d((e=>({...e,brandPersonality:{...e.brandPersonality,voice:v||void 0}}))),B(e)},R=e=>{B(e)},_=e=>{d((a=>({...a,primaryColor:e})))},D=()=>{y.trim()&&(d((e=>{const a=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:[...a,y.trim()]}}})),k(""))};return s?n.jsx("div",{className:"flex justify-center items-center h-full min-h-[500px] w-full bg-white rounded-lg shadow-sm",children:n.jsx(xY,{})}):m?n.jsx(rge,{setAutoParse:h,onForceRefresh:()=>w(Date.now())}):n.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16",children:[n.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 px-6 pt-2",children:[n.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>L("identity"),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:c.primaryColor||"#000000"}}),n.jsx("h3",{className:"text-base font-medium",children:"Brand Identity"})]}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:n.jsx(x.identity?Sc:yc,{className:"h-4 w-4"})})]}),x.identity&&n.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Name"}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("brandName"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),p.brandName?n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{value:v,onChange:e=>f(e.target.value),className:"flex-1",autoFocus:!0}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>R("brandName"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>z("brandName"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}):n.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm font-medium",children:c.brandName})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Tagline"}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("brandTagline"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),p.brandTagline?n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{value:v,onChange:e=>f(e.target.value),className:"flex-1",autoFocus:!0,placeholder:"Your brand's tagline"}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>R("brandTagline"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>z("brandTagline"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}):n.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm italic",children:c.brandTagline||"No tagline set"})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center justify-between mb-3",children:n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Logo"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Square image, 128x128px, PNG recommended"})]})}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs("div",{className:"relative group",children:[n.jsx("div",{className:"w-24 h-24 rounded-lg border-2 border-dashed border-gray-200 flex items-center justify-center bg-gray-50 overflow-hidden",children:c.logoUrl?n.jsx("img",{src:c?.logoUrl,alt:c.brandName||"Brand logo",className:"w-full h-full object-contain"},A):n.jsx(Bc,{className:"h-10 w-10 text-gray-300"})}),n.jsxs("div",{className:"absolute inset-0 bg-black bg-opacity-40 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:[n.jsx("input",{type:"file",ref:P,onChange:e=>{const a=e.target.files?.[0];if(a){const e=new FileReader;e.onloadend=async()=>{const n=e.result.split(",")[1];N(n);const t=URL.createObjectURL(a);d((e=>({...e,logoUrl:t}))),w(Date.now()),l({logoBase64:n})},e.readAsDataURL(a)}},accept:"image/*",className:"hidden"}),n.jsxs(jY,{variant:"ghost",size:"sm",onClick:()=>{P.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[n.jsx(rd,{className:"h-4 w-4 mr-1"}),"Update"]})]})]}),c.logoUrl&&n.jsxs("div",{className:"flex-1 flex items-center gap-2 max-w-md bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[n.jsx("div",{className:"flex-1 truncate text-sm text-gray-600 font-mono",children:c.logoUrl}),n.jsxs(jY,{variant:"ghost",size:"sm",onClick:async()=>{if(c.logoUrl)try{await navigator.clipboard.writeText(c.logoUrl),M(!0),setTimeout((()=>M(!1)),1500),j({title:"Logo URL copied to clipboard"})}catch(cBe){try{const e=document.createElement("textarea");e.value=c.logoUrl,e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.focus(),e.select();const a=document.execCommand("copy");if(document.body.removeChild(e),!a)throw new Error("Fallback copy command failed");M(!0),setTimeout((()=>M(!1)),1500),j({title:"Logo URL copied to clipboard"})}catch(e){j({title:"Failed to copy URL",description:"Could not copy the URL to clipboard. Please try again or copy manually.",variant:"destructive"})}}},className:"h-7 px-2 text-xs shrink-0",children:[C?n.jsx(fc,{className:"h-3.5 w-3.5 mr-1 text-green-500"}):n.jsx(xc,{className:"h-3.5 w-3.5 mr-1"}),C?"Copied":"Copy"]})]})]})]})]})]}),n.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>L("colors"),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:c.primaryColor||"#000000"}}),n.jsx("h3",{className:"text-base font-medium",children:"Brand Colors"})]}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:n.jsx(x.colors?Sc:yc,{className:"h-4 w-4"})})]}),x.colors&&n.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Primary Color"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Your main brand color used throughout the interface"})]}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("primaryColor"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"w-14 h-14 rounded-lg shadow-md",style:{backgroundColor:c.primaryColor||"#000000"}}),n.jsxs("div",p.primaryColor?{className:"flex flex-1 gap-2 max-w-sm",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Vc,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),n.jsx(o4,{type:"text",value:v,onChange:e=>f(e.target.value),className:"pl-10 h-10 font-mono text-sm flex-1",placeholder:"#000000",maxLength:7,autoFocus:!0})]}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>R("primaryColor"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>z("primaryColor"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}:{className:"flex-1 max-w-sm",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[n.jsx(Vc,{className:"h-4 w-4 text-gray-400"}),n.jsx("div",{className:"text-sm font-mono",children:c.primaryColor||"#000000"})]}),n.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[n.jsx(o4,{type:"color",value:c.primaryColor||"#000000",onChange:e=>_(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),n.jsx("div",{className:"flex gap-1 flex-wrap",children:oge.map(((e,a)=>n.jsx(jY,{variant:"ghost",size:"icon",className:"w-6 h-6 rounded-full border border-gray-200 "+(c.primaryColor===e?"ring-2 ring-gray-400 ring-offset-1":""),style:{backgroundColor:e},onClick:()=>_(e)},a)))})]})]})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center justify-between mb-2",children:n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Secondary Colors"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Additional colors that complement your primary brand color"})]})}),n.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[n.jsx("div",{className:"flex flex-wrap gap-3 mb-4",children:c.secondaryColors?.length?c.secondaryColors.map(((e,a)=>n.jsxs("div",{className:"group relative flex flex-col items-center",children:[n.jsx("div",{className:"w-12 h-12 rounded-lg shadow-sm border border-gray-200 mb-1 group-hover:ring-2 ring-gray-200",style:{backgroundColor:e}}),n.jsx("div",{className:"text-xs font-mono text-gray-600",children:e}),n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>{return a=e,void d((e=>{const n=e.secondaryColors||[];return{...e,secondaryColors:n.filter((e=>e!==a))}}));var a},className:"absolute -top-1 -right-1 w-5 h-5 bg-white rounded-full shadow border border-gray-200 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:n.jsx(cd,{className:"w-3 h-3 text-gray-500"})})]},a))):n.jsx("div",{className:"text-sm text-gray-500 italic my-2",children:"No secondary colors set"})}),n.jsxs("div",{className:"flex items-end gap-3",children:[n.jsxs("div",{className:"flex-1 max-w-xs",children:[n.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Add color"}),n.jsxs("div",{className:"flex gap-2 items-center",children:[n.jsx(o4,{type:"color",value:b,onChange:e=>S(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded-md"}),n.jsx(o4,{type:"text",value:b,onChange:e=>S(e.target.value),className:"h-10 font-mono text-sm",placeholder:"#000000",maxLength:7})]})]}),n.jsxs(jY,{variant:"outline",onClick:()=>{b&&(d((e=>{const a=e.secondaryColors||[];return{...e,secondaryColors:[...a,b]}})),S("#000000"))},className:"h-10",children:[n.jsx(qc,{className:"h-4 w-4 mr-1"}),"Add Color"]})]})]})]})]})]}),n.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>L("personality"),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:c.primaryColor||"#000000"}}),n.jsx("h3",{className:"text-base font-medium",children:"Brand Personality"})]}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:n.jsx(x.personality?Sc:yc,{className:"h-4 w-4"})})]}),x.personality&&n.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Tone"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"The overall feeling and attitude your brand conveys"})]}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("tone"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),p.tone?n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{type:"text",value:v,onChange:e=>f(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>R("tone"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>z("tone"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}):n.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:c.brandPersonality?.tone||"No tone set"})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Voice"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"How your brand expresses itself in communication"})]}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("voice"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),p.voice?n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{type:"text",value:v,onChange:e=>f(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>R("voice"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>z("voice"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}):n.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:c.brandPersonality?.voice||"No voice set"})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center justify-between mb-2",children:n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Values"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Core principles and beliefs that drive your brand"})]})}),n.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[n.jsx("div",{className:"mb-4",children:n.jsx("div",c.brandPersonality?.values&&c.brandPersonality.values.length>0?{className:"flex flex-wrap gap-2",children:c.brandPersonality.values.map(((e,a)=>n.jsxs(UY,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",style:{borderColor:`${c.primaryColor}30`||"#f3f4f6",backgroundColor:`${c.primaryColor}08`||"#f9fafb"},children:[e,n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>{return a=e,void d((e=>{const n=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:n.filter((e=>e!==a))}}}));var a},className:"ml-1.5 w-4 h-4 flex items-center justify-center rounded-full bg-gray-200 hover:bg-red-100 hover:text-red-500 transition-colors",children:n.jsx(cd,{className:"w-2.5 h-2.5"})})]},a)))}:{className:"text-sm text-gray-500 italic py-2",children:"No brand values set"})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{placeholder:"Add a brand value",value:y,onChange:e=>k(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&D()}),n.jsxs(jY,{variant:"outline",onClick:D,disabled:!y.trim(),children:[n.jsx(qc,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),n.jsxs(HG,{className:"pb-4 px-6",children:[i?n.jsx(jY,{variant:"outline",className:"gap-1.5",onClick:i,children:"Go Back"}):r&&n.jsxs(jY,{variant:"outline",className:"gap-1.5",onClick:()=>{h(!0)},children:[n.jsx(ad,{className:"h-4 w-4 text-amber-500"}),"Auto Parse"]}),n.jsx(jY,{className:"px-4",onClick:async()=>{let e;T?e=T:c.logoUrl?.startsWith("data:image/png;base64,")?e=c.logoUrl.split(",")[1]:c.logoUrl?.startsWith("blob:")&&(e=void 0),l({brandName:c.brandName,brandTagline:c.brandTagline,logoBase64:e,primaryColor:c.primaryColor,secondaryColors:c.secondaryColors,brandPersonality:c.brandPersonality}),j({title:"Brand settings saved 🚀"}),t&&t(),N(null)},disabled:u,children:u?"Saving":"Save Changes"})]})]})},lge=oee.object({channelSenderId:oee.string().min(1,"Please select a channel sender"),replyTo:oee.string().trim().min(1).email("Please enter a valid email address").or(oee.literal("").transform((()=>null))).or(oee.null()).optional(),fromName:oee.string().trim().min(1).or(oee.literal("").transform((()=>null))).or(oee.null()).optional()}),uge=()=>{const{channelSenders:e,isLoading:t}=x9(),{channelAccounts:i,isLoading:r}=M9(),{updateChannelSender:o,isUpdating:s}=E9(),{toast:l}=Ie(),u=ooe({resolver:moe(lge),defaultValues:{channelSenderId:"",replyTo:"",fromName:""}}),c=a.useMemo((()=>zie({channelSenders:e?.results??[],channelAccounts:i?.results??[]})),[e?.results,i?.results]);if(a.useEffect((()=>{if(c&&c.length>0&&!u.getValues("channelSenderId")){const e=c[0];u.setValue("channelSenderId",e.channelSenderId),u.setValue("replyTo",e.channelSender.channelSenderMetadata.emailReplyTo??""),u.setValue("fromName",e.channelSender.channelSenderMetadata.emailFromName??"")}}),[c,u]),t||void 0===e||r||void 0===i)return n.jsx("div",{className:"flex justify-center items-center h-full py-10",children:n.jsx(xY,{})});return n.jsxs("div",{className:"w-full max-w-4xl mx-auto mt-8",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-gray-900 mb-1",children:"Set up Your Email Channel"}),n.jsx("p",{className:"text-muted-foreground text-base",children:"Define your default sender name, email address, and reply-to to start sending emails with confidence."})]}),n.jsx(hoe,{...u,children:n.jsxs("form",{onSubmit:u.handleSubmit((async e=>{const a=c.find((a=>a.channelSenderId===e.channelSenderId));a&&o({toUpdate:{channelSenderMetadata:{...a.channelSender.channelSenderMetadata,emailReplyTo:e.replyTo?e.replyTo:null,emailFromName:e.fromName?e.fromName:null}},id:a.channelSender.id},{onSuccess:()=>{l({title:"Email channel sender updated successfully!"})},onError:()=>{l({title:"Failed to update email channel sender",description:"Please contact your administrator",variant:"destructive"})}})})),className:"bg-white border border-gray-200 rounded-2xl shadow-sm p-8 space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[n.jsx(koe,{className:"flex items-center gap-1 text-base font-medium mb-2",children:"Email Channel Sender"}),n.jsxs(hie,{value:u.watch("channelSenderId"),onValueChange:e=>{u.setValue("channelSenderId",e);const a=c.find((a=>a.channelSenderId===e));a&&u.setValue("replyTo",a.channelSender.channelSenderMetadata.emailReplyTo??"")},children:[n.jsx(vie,{className:"w-full bg-gray-50 border-gray-200 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 rounded-lg min-h-[48px] text-base",children:n.jsx(gie,{placeholder:"Select a sender"})}),n.jsx(kie,{children:c.map((e=>n.jsx(bie,{value:e.channelSenderId,children:n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-medium",children:e.fullDomain}),n.jsx("span",{className:"text-xs text-muted-foreground",children:e.channelSender.channelSenderMetadata.emailReplyTo||"No reply-to set"})]})},e.channelSenderId)))})]})]}),n.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[n.jsxs(koe,{className:"flex items-center gap-1 text-base font-medium mb-0.5",children:["Reply-to Email",n.jsx(Mae,{title:"Reply to email to use when the reply button is clicked"})]}),n.jsxs("span",{className:"text-xs text-muted-foreground font-normal mb-1",children:["Optional – will use"," ",n.jsx("span",{className:"font-mono",children:u.watch("channelSenderId")?c.find((e=>e.channelSenderId===u.watch("channelSenderId")))?.fullDomain:"sender domain"})," ","if empty"]}),n.jsx(Coe,{control:u.control,name:"replyTo",type:"email",placeholder:"Replies from recipients will go to this email (optional)"})]}),n.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[n.jsxs(koe,{className:"flex items-center gap-1 text-base font-medium mb-0.5",children:["From Name",n.jsx(Mae,{title:"From name to use when the email is sent"})]}),n.jsx(Coe,{control:u.control,name:"fromName",placeholder:"From name to use when the email is sent"})]}),n.jsx("div",{className:"flex gap-3 pt-4 justify-end border-t border-gray-100",children:n.jsx(jY,{type:"submit",disabled:s,className:"min-w-[120px]",children:s?"Saving...":"Save"})})]})})]})},cge=()=>n.jsx("div",{className:"w-full max-w-4xl mx-auto mt-8",children:n.jsx(Toe,{})});function dge({tabs:e,activeTab:a,onTabChange:t,title:i}){return n.jsxs("div",{className:"flex h-full",children:[n.jsxs("div",{className:"w-48 py-2 pl-4",children:[i&&n.jsx("h2",{className:"px-4 pt-4 pb-5 text-lg font-medium",children:i}),e.map((e=>n.jsx(jY,{variant:"ghost",className:im("w-full justify-start mb-1",a===e.id&&"bg-accent"),onClick:()=>t(e.id),children:e.label},e.id)))]}),n.jsx("div",{className:"flex-1 overflow-y-auto pl-6 pr-4 pb-4",children:e.find((e=>e.id===a))?.content})]})}function mge({open:e,setOpen:t}){const[i,r]=a.useState("brand");a.useEffect((()=>{e&&r("brand")}),[e]);const o=[{id:"brand",label:"Brand",content:n.jsx(sge,{})},{id:"email-channel",label:"Email Channel",content:n.jsx(uge,{})},{id:"sms-channel",label:"SMS Channel",content:n.jsx(cge,{})}];return n.jsx(BG,{open:e,onOpenChange:t,children:n.jsxs(DG,{className:"flex w-[90vw] h-[90vh] flex-col gap-0 overflow-hidden sm:max-w-xl md:max-w-3xl lg:max-w-4xl xl:max-w-5xl p-0",children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Settings"}),n.jsx(IG,{children:"Edit your business and brand settings"})]}),n.jsx("div",{className:"flex-1 overflow-hidden",children:n.jsx(dge,{tabs:o,activeTab:i,onTabChange:r,title:"Settings"})})]})})}const hge=e=>{const{updateAutomation:n,updateError:t,isUpdateSuccess:i}=Je(e),{toast:r}=Ie();return a.useEffect((()=>{i?r({title:"Status updated",description:"The status has been updated successfully"}):t&&r({title:"Error updating status",description:"Please try again",variant:"destructive"})}),[i,t,r]),{toggleStatus:async e=>{try{return await n({status:e?Xe.ACTIVE:Xe.DRAFT}),!0}catch(a){return r({title:"Error updating status",description:"Please try again",variant:"destructive"}),!1}}}};function pge(){const{toast:e}=Ie(),[t,i]=a.useState(null),{toggleStatus:r}=hge(t||""),o=o5(),[s,l]=a.useState(10),[u,c]=a.useState(void 0),[d,m]=a.useState(""),{automations:h,nextCursor:p,isLoading:g,error:v,isFetching:f,isPlaceholderData:y}=We({cursor:u,limit:s,triggerType:Ze.TRIGGER_BASED,search:d||void 0});a.useEffect((()=>{v&&e({title:`Error Fetching ${yh("engage:automation")}`,description:v?.message||"Please try again.",variant:"destructive"})}),[v,e]);const k=a.useMemo((()=>(h||[]).map((e=>({...e,emailsSent:0,smsSent:0,updated_at:e.updatedAt||e.createdAt})))),[h]),b=a.useCallback((async(e,a)=>{try{i(e);const n=a===Xe.ACTIVE;await r(n)}finally{i(null)}}),[r,i]),S=a.useCallback((e=>{c(e.cursor),l(e.pageSize)}),[]),A=a.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),w=a.useMemo((()=>Cae({automationName:yh("engage:automation"),setUrl:A,onToggle:b,vsaasManaged:!0})),[b,A]);return n.jsx("div",{className:"w-full h-[75vh] flex flex-col",children:n.jsx("div",{className:"flex-grow min-h-0 p-2",children:n.jsx(l4,{data:k,columns:w,paginationMode:"cursor",initialPageSize:s,isLoading:g&&!y,onRowClick:e=>{o(`/automations/view-modal/${e.id}?showBackButton=true`)},cursorPaginationQueryResult:{nextCursor:p,isLoading:g,isFetching:f,isPlaceholderData:y},onQueryParametersChange:S,searchValue:d,onSearchChange:m})})})}function gge(){const{toast:e}=Ie(),[t,i]=a.useState(!1),[r,o]=a.useState(null),{toggleStatus:s}=hge(r||""),l=o5(),[u,c]=a.useState(10),[d,m]=a.useState(void 0),[h,p]=a.useState(""),{automations:g,nextCursor:v,isLoading:f,error:y,isFetching:k,isPlaceholderData:b}=We({cursor:d,limit:u,triggerType:Ze.ONE_TIME,search:h||void 0});a.useEffect((()=>{y&&e({title:`Error Fetching ${yh("engage:broadcast")}`,description:y?.message||"Please try again.",variant:"destructive"})}),[y,e]);const S=a.useMemo((()=>(g||[]).map((e=>({...e,updated_at:e.updatedAt})))),[g]),A=a.useCallback((async(e,a)=>{try{o(e);const n=a===Xe.ACTIVE;await s(n)}finally{o(null)}}),[s,o]),w=a.useCallback((e=>{m(e.cursor),c(e.pageSize)}),[]),C=a.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),M=a.useMemo((()=>Cae({automationName:yh("engage:broadcast"),setUrl:C,onToggle:A})),[A,C]);return n.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[n.jsx("div",{className:"flex-grow min-h-0 p-2",children:n.jsx(l4,{data:S,columns:M,paginationMode:"cursor",initialPageSize:u,headerActions:n.jsxs(jY,{className:"bg-primary",onClick:()=>i(!0),children:[n.jsx(qc,{className:"h-4 w-4 mr-1"}),"New"]}),isLoading:f&&!b,cursorPaginationQueryResult:{nextCursor:v,isLoading:f,isFetching:k,isPlaceholderData:b},onRowClick:e=>{l(`/automations/view-modal/${e.id}?showBackButton=true`)},onQueryParametersChange:w,searchValue:h,onSearchChange:p})}),n.jsx(Gpe,{open:t,setOpen:i,onClose:a=>{gae(i,e,a,`Error creating ${yh("engage:broadcast")}`,"Please try again"),m(void 0),c(10),p(""),!1!==a&&l(`/automations/view-modal/${a}?showBackButton=true`)},automationType:Ze.ONE_TIME})]})}function vge(){const{toast:e}=Ie(),[t,i]=a.useState(!1),[r,o]=a.useState(null),[s,l]=a.useState(10),[u,c]=a.useState(void 0),[d,m]=a.useState(""),{segments:h,isLoading:p,nextCursor:g,isFetching:v,isPlaceholderData:f}=gY({search:d||void 0,cursor:u,limit:s}),y=a.useCallback((e=>{o(e),i(!0)}),[o]),k=a.useMemo((()=>function(e){return[yae("name",`${yh("engage:segment")} Name`,!0),kae(),pae({accessorKey:"user_count",header:yh("engage:user_other"),meta:{align:"right",displayName:yh("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const a=e.getValue()??0;return`${a.toLocaleString()} ${1===a?yh("engage:user").toLowerCase():yh("engage:user_other").toLowerCase()}`}}),bae("user_count_updated_at"),wae(e||(()=>{}))]}(y)),[y]),b=a.useMemo((()=>h?h.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[h]),S=a.useMemo((()=>n.jsxs(jY,{onClick:()=>{o(null),i(!0)},children:[n.jsx(qc,{className:"h-4 w-4"}),"New List"]})),[]),A=a.useCallback((e=>{c(e.cursor),l(e.pageSize)}),[]);return n.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[n.jsx("div",{className:"flex-grow min-h-0 p-2",children:n.jsx(l4,{data:b,columns:k,paginationMode:"cursor",initialPageSize:s,headerActions:S,isLoading:p&&!f,cursorPaginationQueryResult:{nextCursor:g,isLoading:p,isFetching:v,isPlaceholderData:f},onQueryParametersChange:A,onRowClick:a=>{a.type!==bY.MANAGED?(o(a.id),i(!0)):e({title:`Managed ${yh("engage:segment")} cannot be edited!`,variant:"destructive"})},searchValue:d,onSearchChange:m})}),n.jsx(Spe,{open:t,setOpen:i,segmentId:r??void 0,onSegmentUpdated:a=>{gae(i,e,a,`Error creating ${yh("engage:segment")}`,"Please try again"),c(void 0),l(10),m("")}})]})}const fge=()=>{const e=ce(),[t,i]=a.useState(!1),[r,o]=a.useState(null),{automations:s,isLoading:l}=We({triggerType:Ze.TRIGGER_BASED}),[u,c]=a.useState();return a.useEffect((()=>{e.prefetchQuery({queryKey:je.list()}),e.prefetchQuery({queryKey:hY.lists()})}),[e]),a.useEffect((()=>{if(l||void 0===s)return;const e=[{id:"broadcasts",label:yh("engage:broadcast",{count:2}),content:n.jsx(gge,{})},{id:"segments",label:yh("engage:segment",{count:2}),content:n.jsx(vge,{})},{id:"statistics",label:yh("engage:insight",{count:2}),content:n.jsx(age,{})}];s.length>0?(o("automations"),c([{id:"automations",label:yh("engage:automation",{count:2}),content:n.jsx(pge,{})},...e])):(o("broadcasts"),c(e))}),[s,l]),null===r||null==u?n.jsx("div",{className:"w-full h-full flex justify-center items-center",children:n.jsx(xY,{})}):n.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[n.jsx(mge,{open:t,setOpen:i}),n.jsx("div",{className:"flex justify-end",children:n.jsx(jY,{variant:"outline",onClick:()=>i(!0),children:n.jsx(Xc,{className:"w-4 h-4"})})}),n.jsx("div",{className:"flex-1 w-full h-full flex flex-col gap-4",children:n.jsx(Vpe,{activeTab:r,tabs:u,onTabChange:o})})]})};function yge({value:e,schema:t,onSubmit:i,fieldName:r,className:o,successMessage:s="Updated successfully",errorMessage:l="Failed to update",placeholderText:u}){const[c,d]=a.useState(!1),[m,h]=a.useState(!1),[p,g]=a.useState(0),[v,f]=a.useState(0),[y,k]=a.useState(e),[b,S]=a.useState(e),A=a.useRef(null),w=a.useRef(null),C=a.useRef(null),M=a.useRef(null),{toast:T}=Ie(),N=ooe({resolver:moe(t),defaultValues:{[r]:e}});a.useEffect((()=>{N.reset({[r]:e}),k(e),S(e)}),[e,r,N]),a.useEffect((()=>{w.current&&g(w.current.offsetWidth),M.current&&!c&&f(M.current.offsetWidth)}),[c]),a.useEffect((()=>{C.current&&y&&g(C.current.offsetWidth)}),[y]),a.useEffect((()=>{c&&A.current&&(A.current.focus(),A.current.select())}),[c]);const x=async e=>{h(!0);const a=e[r];try{await i(e),S(a),T({variant:"success",title:s}),d(!1)}catch(n){T({variant:"destructive",title:l})}finally{h(!1)}},E=()=>{N.reset(),d(!1),k(b)},P=e=>{"Escape"===e.key&&E()};return c?n.jsx(hoe,{...N,children:n.jsxs("form",{onSubmit:N.handleSubmit(x),className:LG("inline-flex items-center gap-2 min-h-[20px]",o),style:{minWidth:v?`${v}px`:"auto"},children:[n.jsx("span",{ref:C,className:"absolute invisible whitespace-pre leading-none select-none pointer-events-none",style:{font:"inherit"},children:y||b}),n.jsx(goe,{control:N.control,name:r,render:({field:e})=>n.jsx(yoe,{className:"flex-1 min-w-0",children:n.jsx(boe,{children:n.jsx("input",{...e,ref:A,style:{width:`${Math.max(p+40,120)}px`,minWidth:`${Math.max(p,100)}px`,font:"inherit"},className:"bg-transparent outline-none leading-none h-[20px] border-none p-0 m-0",onChange:a=>{e.onChange(a),k(a.target.value)},onKeyDown:P,disabled:m,onBlur:a=>{e.onBlur(),setTimeout((()=>{a.currentTarget.form?.contains(document.activeElement)||E()}),0)}})})})}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n.jsx(jY,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 p-0",onClick:E,disabled:m,children:n.jsx(cd,{className:"h-3 w-3"})}),n.jsx(jY,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 p-0",disabled:m,onClick:()=>{N.handleSubmit(x)()},children:m?n.jsx(_c,{className:"h-3 w-3 animate-spin"}):n.jsx(fc,{className:"h-3 w-3"})})]})]})}):n.jsxs("button",{ref:M,type:"button",className:LG("group relative inline-flex items-center gap-2 cursor-pointer min-h-[20px] bg-transparent border-none p-0 text-left",o),onClick:()=>d(!0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),d(!0))},"aria-label":"Edit field",children:[n.jsx("span",{ref:w,className:LG("leading-none select-none",o,{italic:!b}),children:b||u}),n.jsx(Jc,{className:"h-3 w-3 transition-opacity duration-200 flex-shrink-0 opacity-0 group-hover:opacity-100"})]})}const kge=K7({name:C7().min(2,"Title must be at least 2 characters"),description:C7()});function bge({open:e,onOpenChange:a,onDuplicationCreated:t}){const i=wY(),{toast:r}=Ie(),o=ooe({resolver:moe(kge),defaultValues:{name:`${i?.name} (copy)`,description:i?.description??""}}),{duplicateAutomation:s}=qe();return n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{className:"sm:max-w-[425px]",children:[n.jsx(KG,{children:n.jsx(OG,{children:"Duplicate Automation"})}),n.jsx(hoe,{...o,children:n.jsxs("form",{onSubmit:o.handleSubmit((async function(e){i&&e.name?s({automationId:i.id,name:e.name,description:e.description},{onSuccess:e=>{e.id&&(t?.(e.id),a(!1))}}):r({title:"Error duplicating automation",description:"Please try again. Please make sure to fill in the name of the automation."})})),className:"space-y-4",children:[n.jsxs("div",{children:["Create a copy of the",n.jsx("span",{className:"font-bold px-1 text-primary",children:i?.name}),"automation with a new title and description."]}),n.jsx(goe,{control:o.control,name:"name",render:({field:e})=>n.jsxs(yoe,{children:[n.jsx(koe,{children:"Title"}),n.jsx(boe,{children:n.jsx(o4,{...e})}),n.jsx(Soe,{})]})}),n.jsx(goe,{control:o.control,name:"description",render:({field:e})=>n.jsxs(yoe,{children:[n.jsx(koe,{children:"Description"}),n.jsx(boe,{children:n.jsx(jse,{...e})}),n.jsx(Soe,{})]})}),n.jsx(HG,{children:n.jsx(jY,{type:"submit",children:"Duplicate"})})]})})]})})}function Sge({open:e,onOpenChange:a,setIsActive:t}){const i=wY(),{updateAutomation:r}=Je(i?.id||""),{toast:o}=Ie();return n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{className:"sm:max-w-[425px]",children:[n.jsx(KG,{children:n.jsxs(OG,{children:["Deactivate ",yh("engage:automation")]})}),n.jsxs("div",{children:["Are you sure you want to deactivate the",n.jsx("span",{className:"font-bold px-1 text-primary",children:i?.name}),yh("engage:automation"),"?"]}),n.jsxs(HG,{className:"gap-2 sm:gap-0",children:[n.jsx(jY,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),n.jsx(jY,{variant:"destructive",onClick:()=>{r({status:Xe.DRAFT}),a(!1),t(!1),o({title:`Updated ${yh("engage:automation")}`,description:`${yh("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const Age=K7({name:C7().min(2,"Title must be at least 2 characters")}),wge=K7({description:C7().max(300,"Description must be less than 300 characters")}),Cge=({showBackButton:e,onDuplicationCreated:t,onBeforeSchedule:i})=>{const r=wY(),o=o5(),{updateAutomation:s}=Je(r?.id||""),{toast:l}=Ie(),u=(()=>{const{state:e}=AY();return e.recipientStats})(),c=CY(),{data:d}=L9(),{channelSenders:m}=x9(),{channelAccounts:h}=M9(),[p,g]=a.useState(void 0),[v,f]=a.useState(!1),[y,k]=a.useState(!1),[b,S]=a.useState(!1),[A,w]=a.useState(0),C=mee({channelSenders:m?.results??[],channelAccounts:h?.results??[],smsApplication:d});a.useEffect((()=>{if(r&&void 0===p)switch(r.status){case Xe.ACTIVE:g(!0);break;case Xe.DRAFT:g(!1);break;case Xe.RUNNING:case Xe.COMPLETED:g(!0);break;case Xe.FAILED:case Xe.DEACTIVATED:g(!1);break;default:throw Dse(r.status,Xe)}}),[r,p]);const M=a.useCallback((()=>{if(!r)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});const e=async e=>{if(p&&!e)k(!0);else{if(S(!0),i&&!0===e){let e=0;for(;!u&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!u)return l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),void S(!1);const a=await i({estimatedEmailRecipients:u?.emails??0,estimatedSmsRecipients:u?.phones??0});if(!0!==a)return l({title:"Error while updating the status",description:a,variant:"destructive"}),void S(!1)}if(c?.emailHtmlBody?.includes(Bpe)){if(0===A)return l({title:zpe,variant:"warning"}),w(A+1),void S(!1);w(A+1)}switch(r.triggerType){case Ze.ONE_TIME:if(!r.triggerMetadata||!("scheduledAt"in r.triggerMetadata)||!r.triggerMetadata?.scheduledAt)return l({title:"Ensure you have selected a scheduled time",variant:"destructive"}),void S(!1);if(!c||!c.emailChannelSenderId&&!c.smsChannelSenderId)return l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"}),void S(!1);break;case Ze.TRIGGER_BASED:break;default:throw Dse(r.triggerType,Ze)}s({status:e?Xe.ACTIVE:Xe.DEACTIVATED},{onSuccess:()=>{g(e),l({title:`${yh("engage:automation")}`,description:`${yh("engage:automation")} status updated to ${e?"active":"inactive"}`}),S(!1)},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),S(!1)}})}};if(!r)return null;let a=!1,t=!0;switch(r.status){case Xe.ACTIVE:case Xe.DRAFT:a=!1;break;case Xe.DEACTIVATED:a=!0,t=!1;break;case Xe.RUNNING:a=!0,t=r.triggerType===Ze.TRIGGER_BASED;break;case Xe.COMPLETED:case Xe.FAILED:a=!0,t=!1;break;default:throw Dse(r.status,Xe)}if(!t)return n.jsx(UY,{variant:vae(r.status),children:v9[r.status]});switch(r.triggerType){case Ze.TRIGGER_BASED:return n.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[n.jsx(p?fc:Tc,{className:"w-4 h-4"}),n.jsx("div",{className:"text-[13px] font-medium",children:p?"Active":"Inactive"}),n.jsx(mpe,{checked:p,onCheckedChange:e,disabled:a})]});case Ze.ONE_TIME:{const t=C.find((e=>e.channelSender.id===c?.smsChannelSenderId));if(!r.triggerMetadata||r.triggerMetadata?.triggerType===Ze.ONE_TIME&&!r.triggerMetadata?.scheduledAt||!c?.emailChannelSenderId&&!c?.smsChannelSenderId||t&&t?.smsApplication?.application&&t?.smsApplication?.status!==dee.APPROVED){const e=()=>t?.smsApplication?.application&&t.smsApplication?.status!==dee.APPROVED?n.jsx(Mae,{title:"Please wait for your SMS application to be approved",alertText:"Before sending, we need to approve your SMS application"}):!r.triggerMetadata||!("scheduledAt"in r.triggerMetadata)||"scheduledAt"in r.triggerMetadata&&!r.triggerMetadata?.scheduledAt?n.jsx(Mae,{title:"Cannot send without a schedule time",alertText:"Before sending, please select a schedule time on the left sidebar"}):null;return n.jsxs("div",{className:"flex items-center gap-2 cursor-not-allowed",children:[n.jsx(jY,{variant:"outline",className:"flex items-center gap-2",disabled:!0,children:"Send Now"}),e()]})}if(!p){let t="Schedule Send";return r.triggerMetadata.triggerType===Ze.ONE_TIME&&r.triggerMetadata.scheduledAt&&("now"===r.triggerMetadata.scheduledAt||"now"!==r.triggerMetadata.scheduledAt&&new Date(r.triggerMetadata.scheduledAt)<new Date(Date.now()+3e5))&&(t="Send Now"),n.jsx(jY,{variant:"default",className:"flex items-center gap-2",onClick:()=>e(!p),disabled:a,children:t})}return n.jsx(jY,{variant:"outline",className:"flex items-center gap-2",onClick:()=>e(!p),disabled:a,children:"Convert to Draft"})}default:throw Dse(r.triggerType,Ze)}}),[r,l,p,i,c,s,u,A,C]);return r&&void 0!==p?n.jsxs("header",{className:"flex px-1 pt-1",children:[n.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e&&n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>o(-1),children:n.jsx(hc,{})}),n.jsxs("div",{className:"flex flex-col gap-0 items-start",children:[n.jsx(yge,{value:r.name,schema:Age,onSubmit:e=>s({name:e.name}),fieldName:"name",className:"text-lg",successMessage:"Automation name updated",errorMessage:"Failed to update automation name"}),r.automationType!==Ye.MANAGED?n.jsx(yge,{value:r.description||"",schema:wge,onSubmit:e=>s({description:e.description}),fieldName:"description",className:"text-sm "+(r.description?"text-current":"text-muted-foreground"),successMessage:"Description updated",errorMessage:"Failed to update description",placeholderText:"Describe the goal of the automation"}):r.description&&n.jsx("div",{className:"text-sm text-current",children:r.description})]})]}),n.jsxs("div",{className:"ml-auto flex gap-4 items-center",children:[n.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:r.triggerType===Ze.ONE_TIME&&n.jsx("div",{role:"button",tabIndex:0,className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",onClick:()=>f(!0),children:n.jsx(Mae,{title:"Duplicate",Icon:RY.DuplicateIcon,asChild:!1,onClick:()=>f(!0)})})}),b?n.jsx("div",{className:"flex items-center text-muted-foreground pr-2",children:n.jsx(xY,{size:"sm"})}):M()]}),n.jsx(bge,{open:v,onOpenChange:f,onDuplicationCreated:t}),n.jsx(Sge,{open:y,onOpenChange:k,setIsActive:g})]}):null},Mge=()=>{const e=wY(),{isLoading:t}=Ue(e?.id),{state:{hideSales:i,hideSms:r}}=a.useContext(cO);return!e||t?n.jsx(xY,{text:[`Fetching ${yh("engage:insight",{count:2})}`,"Finishing up"]}):n.jsx("div",{className:"h-full p-4",children:n.jsx(age,{automationId:e.id,automation:e,includeSales:!i,includeSms:!r})})},Tge=()=>{const e=wY(),[t,i]=a.useState(10),[r,o]=a.useState(void 0),[s,l]=a.useState(""),{sentCommunications:u,isLoading:c,isFetching:d,isPlaceholderData:m,fetchError:h}=Ve({automationId:e?.id??"",cursor:r,limit:t,search:s||void 0}),p=a.useCallback((e=>{o(e.cursor),i(e.pageSize)}),[]),g=[{accessorKey:"communicationsSent",id:"lastCommunication",header:"Updated At",cell:({row:e})=>{const a=e.original.communicationsSent||[];if(0===a.length)return n.jsx("span",{className:"text-gray-400",children:"None"});const t=a.reduce(((e,a)=>e&&e.updatedAt?a.updatedAt&&new Date(a.updatedAt)>new Date(e.updatedAt)?a:e:a));return t?.updatedAt?n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("span",{className:"text-sm text-gray-600",children:dae(new Date(t.updatedAt),"MMM d, yyyy h:mm a")})}):n.jsx("span",{className:"text-gray-400",children:"Not available"})}},{accessorFn:e=>`${e.firstName||""} ${e.lastName||""}`.trim(),id:"name",header:"Name",cell:({row:e})=>{const a=`${e.original.firstName||""} ${e.original.lastName||""}`.trim();return a||n.jsx("span",{className:"text-gray-400",children:"Not provided"})}},{accessorKey:"email",header:"Email",cell:({row:e})=>e.original.email||n.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"phone",header:"Phone",cell:({row:e})=>e.original.phone?yue(e.original.phone):n.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"communicationsSent",id:"communicationsSent",header:"Communications Sent",cell:({row:e})=>{const a=e.original.communicationsSent||[],t=a.filter((e=>e.type===ea.EMAIL)),i=a.filter((e=>e.type===ea.SMS)),r=t.length>0,o=i.length>0,s=t.some((e=>e.delivered)),l=i.some((e=>e.delivered));return n.jsxs("div",{className:"flex items-center gap-3",children:[r&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsxs("div",{className:"relative",children:[n.jsx(RY.EmailIcon,{className:"h-4 w-4 "+(s?"text-green-500":"text-gray-400")}),s&&n.jsx("div",{className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white"})]}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm font-medium",children:"Email"}),n.jsx("span",{className:"text-xs "+(s?"text-green-600":"text-gray-500"),children:s?"Delivered":"Pending"})]})]}),r&&o&&n.jsx("div",{className:"h-8 w-px bg-gray-200"}),o&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsxs("div",{className:"relative",children:[n.jsx(RY.SmsIcon,{className:"h-4 w-4 "+(l?"text-green-500":"text-gray-400")}),l&&n.jsx("div",{className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white"})]}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm font-medium",children:"SMS"}),n.jsx("span",{className:"text-xs "+(l?"text-green-600":"text-gray-500"),children:l?"Delivered":"Pending"})]})]}),!r&&!o&&n.jsx("span",{className:"text-sm text-gray-400",children:"None"})]})}}];return e&&!c&&u?h?n.jsxs("div",{children:["Error: ",h.message]}):!u||!s&&0===u.results.length?n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[n.jsx("div",{className:"mb-4",children:n.jsx(RY.UserIcon,{className:"h-12 w-12 text-gray-400"})}),n.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Communications Sent Yet"}),n.jsxs("p",{className:"text-gray-500",children:["This"," ",yh(e.triggerType===Ze.ONE_TIME?"engage:broadcast":"engage:automation")," ","hasn't sent any communications yet. Please check back later to see recipient details once communications have been sent."]})]}):n.jsx("div",{className:"h-full p-4",children:n.jsx(l4,{data:u.results,columns:g,paginationMode:"cursor",initialPageSize:t,isLoading:c&&!m,cursorPaginationQueryResult:{nextCursor:u.pagination.cursor,isLoading:c,isFetching:d,isPlaceholderData:m},onQueryParametersChange:p,searchValue:s,onSearchChange:l})}):n.jsx(xY,{text:["Fetching Recipients","Finishing up"]})},Nge=()=>{const e=wY();return e?e?.triggerType===Ze.ONE_TIME&&e?.status===Xe.DRAFT?n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[n.jsx("div",{className:"mb-4",children:n.jsx(RY.UserIcon,{className:"h-12 w-12 text-gray-400"})}),n.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Recipients Available Yet"}),n.jsxs("p",{className:"text-gray-500",children:["Recipients will be available once this"," ",yh(e.triggerType===Ze.ONE_TIME?"engage:broadcast":"engage:automation")," ","has completed running. Please check back after the automation has finished."]})]}):n.jsx(Tge,{}):n.jsx(xY,{text:["Fetching Recipients","Finishing up"]})},xge=a.createContext(null);xge.displayName="PanelGroupContext";const Ege="data-panel-group",Pge="data-panel-group-direction",jge="data-panel-group-id",Lge="data-panel",Bge="data-panel-collapsible",zge="data-panel-id",Rge="data-panel-size",_ge="data-resize-handle",Dge="data-resize-handle-active",Kge="data-panel-resize-handle-enabled",Hge="data-panel-resize-handle-id",Oge="data-resize-handle-state",Ige=a.useLayoutEffect,Gge=r["useId".toString()],Vge="function"==typeof Gge?Gge:()=>null;let Fge=0;function Jge(e=null){const n=Vge(),t=a.useRef(e||n||null);return null===t.current&&(t.current=""+Fge++),null!=e?e:t.current}function Uge({children:e,className:n="",collapsedSize:t,collapsible:i,defaultSize:r,forwardedRef:o,id:s,maxSize:l,minSize:u,onCollapse:c,onExpand:d,onResize:m,order:h,style:p,tagName:g="div",...v}){const f=a.useContext(xge);if(null===f)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:k,getPanelSize:b,getPanelStyle:S,groupId:A,isPanelCollapsed:w,reevaluatePanelConstraints:C,registerPanel:M,resizePanel:T,unregisterPanel:N}=f,x=Jge(s),E=a.useRef({callbacks:{onCollapse:c,onExpand:d,onResize:m},constraints:{collapsedSize:t,collapsible:i,defaultSize:r,maxSize:l,minSize:u},id:x,idIsFromProps:void 0!==s,order:h});a.useRef({didLogMissingDefaultSizeWarning:!1}),Ige((()=>{const{callbacks:e,constraints:a}=E.current,n={...a};E.current.id=x,E.current.idIsFromProps=void 0!==s,E.current.order=h,e.onCollapse=c,e.onExpand=d,e.onResize=m,a.collapsedSize=t,a.collapsible=i,a.defaultSize=r,a.maxSize=l,a.minSize=u,n.collapsedSize===a.collapsedSize&&n.collapsible===a.collapsible&&n.maxSize===a.maxSize&&n.minSize===a.minSize||C(E.current,n)})),Ige((()=>{const e=E.current;return M(e),()=>{N(e)}}),[h,x,M,N]),a.useImperativeHandle(o,(()=>({collapse:()=>{y(E.current)},expand:e=>{k(E.current,e)},getId:()=>x,getSize:()=>b(E.current),isCollapsed:()=>w(E.current),isExpanded:()=>!w(E.current),resize:e=>{T(E.current,e)}})),[y,k,b,w,x,T]);const P=S(E.current,r);return a.createElement(g,{...v,children:e,className:n,id:x,style:{...P,...p},[jge]:A,[Lge]:"",[Bge]:i||void 0,[zge]:x,[Rge]:parseFloat(""+P.flexGrow).toFixed(1)})}const Wge=a.forwardRef(((e,n)=>a.createElement(Uge,{...e,forwardedRef:n})));Uge.displayName="Panel",Wge.displayName="forwardRef(Panel)";let qge=null,Zge=-1,$ge=null;function Yge(e,a){var n,t;const i=function(e,a){if(a){const e=!!(a&cve),n=!!(a&dve);if(a&lve)return e?"se-resize":n?"ne-resize":"e-resize";if(a&uve)return e?"sw-resize":n?"nw-resize":"w-resize";if(e)return"s-resize";if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,a);if(qge!==i){var r;if(qge=i,null===$ge&&($ge=document.createElement("style"),document.head.appendChild($ge)),Zge>=0)null===(r=$ge.sheet)||void 0===r||r.removeRule(Zge);Zge=null!==(n=null===(t=$ge.sheet)||void 0===t?void 0:t.insertRule(`*{cursor: ${i} !important;}`))&&void 0!==n?n:-1}}function Qge(e){return"keydown"===e.type}function Xge(e){return e.type.startsWith("pointer")}function eve(e){return e.type.startsWith("mouse")}function ave(e){if(Xge(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(eve(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const nve=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function tve(e){const a=getComputedStyle(e);return"fixed"===a.position||(!("auto"===a.zIndex||"static"===a.position&&!function(e){var a;const n=getComputedStyle(null!==(a=sve(e))&&void 0!==a?a:e).display;return"flex"===n||"inline-flex"===n}(e))||(+a.opacity<1||("transform"in a&&"none"!==a.transform||("webkitTransform"in a&&"none"!==a.webkitTransform||("mixBlendMode"in a&&"normal"!==a.mixBlendMode||("filter"in a&&"none"!==a.filter||("webkitFilter"in a&&"none"!==a.webkitFilter||("isolation"in a&&"isolate"===a.isolation||(!!nve.test(a.willChange)||"touch"===a.webkitOverflowScrolling)))))))))}function ive(e){let a=e.length;for(;a--;){const n=e[a];if(xve(n,"Missing node"),tve(n))return n}return null}function rve(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ove(e){const a=[];for(;e;)a.push(e),e=sve(e);return a}function sve(e){const{parentNode:a}=e;return a&&a instanceof ShadowRoot?a.host:a}const lve=1,uve=2,cve=4,dve=8,mve="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let hve=[],pve=!1,gve=new Map,vve=new Map;const fve=new Set;function yve(e){const{target:a}=e,{x:n,y:t}=ave(e);pve=!0,Ave({target:a,x:n,y:t}),Tve(),hve.length>0&&(Nve("down",e),e.preventDefault(),Sve(a)||e.stopImmediatePropagation())}function kve(e){const{x:a,y:n}=ave(e);if(pve&&0===e.buttons&&(pve=!1,Nve("up",e)),!pve){const{target:t}=e;Ave({target:t,x:a,y:n})}Nve("move",e),Cve(),hve.length>0&&e.preventDefault()}function bve(e){const{target:a}=e,{x:n,y:t}=ave(e);vve.clear(),pve=!1,hve.length>0&&(e.preventDefault(),Sve(a)||e.stopImmediatePropagation()),Nve("up",e),Ave({target:a,x:n,y:t}),Cve(),Tve()}function Sve(e){let a=e;for(;a;){if(a.hasAttribute(_ge))return!0;a=a.parentElement}return!1}function Ave({target:e,x:a,y:n}){hve.splice(0);let t=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(t=e),fve.forEach((e=>{const{element:i,hitAreaMargins:r}=e,o=i.getBoundingClientRect(),{bottom:s,left:l,right:u,top:c}=o,d=mve?r.coarse:r.fine;if(a>=l-d&&a<=u+d&&n>=c-d&&n<=s+d){if(null!==t&&document.contains(t)&&i!==t&&!i.contains(t)&&!t.contains(i)&&function(e,a){if(e===a)throw new Error("Cannot compare node with itself");const n={a:ove(e),b:ove(a)};let t;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),a=n.b.pop(),t=e;xve(t,"Stacking order can only be calculated for elements with a common ancestor");const i=rve(ive(n.a)),r=rve(ive(n.b));if(i===r){const e=t.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let i=e.length;for(;i--;){const n=e[i];if(n===a.a)return 1;if(n===a.b)return-1}}return Math.sign(i-r)}(t,i)>0){let e=t,a=!1;for(;e&&!e.contains(i);){if((m=e.getBoundingClientRect()).x<(h=o).x+h.width&&m.x+m.width>h.x&&m.y<h.y+h.height&&m.y+m.height>h.y){a=!0;break}e=e.parentElement}if(a)return}hve.push(e)}var m,h}))}function wve(e,a){vve.set(e,a)}function Cve(){let e=!1,a=!1;hve.forEach((n=>{const{direction:t}=n;"horizontal"===t?e=!0:a=!0}));let n=0;vve.forEach((e=>{n|=e})),e&&a?Yge("intersection",n):e?Yge("horizontal",n):a?Yge("vertical",n):null!==$ge&&(document.head.removeChild($ge),qge=null,$ge=null,Zge=-1)}let Mve=new AbortController;function Tve(){Mve.abort(),Mve=new AbortController;const e={capture:!0,signal:Mve.signal};fve.size&&(pve?(hve.length>0&&gve.forEach(((a,n)=>{const{body:t}=n;a>0&&(t.addEventListener("contextmenu",bve,e),t.addEventListener("pointerleave",kve,e),t.addEventListener("pointermove",kve,e))})),gve.forEach(((a,n)=>{const{body:t}=n;t.addEventListener("pointerup",bve,e),t.addEventListener("pointercancel",bve,e)}))):gve.forEach(((a,n)=>{const{body:t}=n;a>0&&(t.addEventListener("pointerdown",yve,e),t.addEventListener("pointermove",kve,e))})))}function Nve(e,a){fve.forEach((n=>{const{setResizeHandlerState:t}=n,i=hve.includes(n);t(e,i,a)}))}function xve(e,a){if(!e)throw Error(a)}function Eve(e,a,n=10){return e.toFixed(n)===a.toFixed(n)?0:e>a?1:-1}function Pve(e,a,n=10){return 0===Eve(e,a,n)}function jve(e,a,n){return 0===Eve(e,a,n)}function Lve({panelConstraints:e,panelIndex:a,size:n}){const t=e[a];xve(null!=t,`Panel constraints not found for index ${a}`);let{collapsedSize:i=0,collapsible:r,maxSize:o=100,minSize:s=0}=t;if(Eve(n,s)<0)if(r){n=Eve(n,(i+s)/2)<0?i:s}else n=s;return n=Math.min(o,n),n=parseFloat(n.toFixed(10))}function Bve({delta:e,initialLayout:a,panelConstraints:n,pivotIndices:t,prevLayout:i,trigger:r}){if(jve(e,0))return a;const o=[...a],[s,l]=t;xve(null!=s,"Invalid first pivot index"),xve(null!=l,"Invalid second pivot index");let u=0;if("keyboard"===r){{const t=e<0?l:s,i=n[t];xve(i,`Panel constraints not found for index ${t}`);const{collapsedSize:r=0,collapsible:o,minSize:u=0}=i;if(o){const n=a[t];if(xve(null!=n,`Previous layout not found for panel index ${t}`),jve(n,r)){const a=u-n;Eve(a,Math.abs(e))>0&&(e=e<0?0-a:a)}}}{const t=e<0?s:l,i=n[t];xve(i,`No panel constraints found for index ${t}`);const{collapsedSize:r=0,collapsible:o,minSize:u=0}=i;if(o){const n=a[t];if(xve(null!=n,`Previous layout not found for panel index ${t}`),jve(n,u)){const a=n-r;Eve(a,Math.abs(e))>0&&(e=e<0?0-a:a)}}}}{const t=e<0?1:-1;let i=e<0?l:s,r=0;for(;;){const e=a[i];xve(null!=e,`Previous layout not found for panel index ${i}`);if(r+=Lve({panelConstraints:n,panelIndex:i,size:100})-e,i+=t,i<0||i>=n.length)break}const o=Math.min(Math.abs(e),Math.abs(r));e=e<0?0-o:o}{let t=e<0?s:l;for(;t>=0&&t<n.length;){const i=Math.abs(e)-Math.abs(u),r=a[t];xve(null!=r,`Previous layout not found for panel index ${t}`);const s=Lve({panelConstraints:n,panelIndex:t,size:r-i});if(!jve(r,s)&&(u+=r-s,o[t]=s,u.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,a,n){if(e.length!==a.length)return!1;for(let t=0;t<e.length;t++)if(!jve(e[t],a[t],n))return!1;return!0}(i,o))return i;{const t=e<0?l:s,i=a[t];xve(null!=i,`Previous layout not found for panel index ${t}`);const r=i+u,c=Lve({panelConstraints:n,panelIndex:t,size:r});if(o[t]=c,!jve(c,r)){let a=r-c;let t=e<0?l:s;for(;t>=0&&t<n.length;){const i=o[t];xve(null!=i,`Previous layout not found for panel index ${t}`);const r=Lve({panelConstraints:n,panelIndex:t,size:i+a});if(jve(i,r)||(a-=r-i,o[t]=r),jve(a,0))break;e>0?t--:t++}}}return jve(o.reduce(((e,a)=>a+e),0),100)?o:i}function zve({layout:e,panelsArray:a,pivotIndices:n}){let t=0,i=100,r=0,o=0;const s=n[0];xve(null!=s,"No pivot index found"),a.forEach(((e,a)=>{const{constraints:n}=e,{maxSize:l=100,minSize:u=0}=n;a===s?(t=u,i=l):(r+=u,o+=l)}));return{valueMax:Math.min(i,100-r),valueMin:Math.max(t,100-o),valueNow:e[s]}}function Rve(e,a=document){return Array.from(a.querySelectorAll(`[${Hge}][data-panel-group-id="${e}"]`))}function _ve(e,a,n=document){const t=Rve(e,n).findIndex((e=>e.getAttribute(Hge)===a));return null!=t?t:null}function Dve(e,a,n){const t=_ve(e,a,n);return null!=t?[t,t+1]:[-1,-1]}function Kve(e,a=document){var n;if(a instanceof HTMLElement&&(null==a||null===(n=a.dataset)||void 0===n?void 0:n.panelGroupId)==e)return a;const t=a.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return t||null}function Hve(e,a=document){const n=a.querySelector(`[${Hge}="${e}"]`);return n||null}function Ove({committedValuesRef:e,eagerValuesRef:n,groupId:t,layout:i,panelDataArray:r,panelGroupElement:o,setLayout:s}){a.useRef({didWarnAboutMissingResizeHandle:!1}),Ige((()=>{if(!o)return;const e=Rve(t,o);for(let a=0;a<r.length-1;a++){const{valueMax:n,valueMin:t,valueNow:o}=zve({layout:i,panelsArray:r,pivotIndices:[a,a+1]}),s=e[a];if(null==s);else{const e=r[a];xve(e,`No panel data found for index "${a}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(n)),s.setAttribute("aria-valuemin",""+Math.round(t)),s.setAttribute("aria-valuenow",null!=o?""+Math.round(o):"")}}return()=>{e.forEach(((e,a)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[t,i,r,o]),a.useEffect((()=>{if(!o)return;const e=n.current;xve(e,"Eager values not found");const{panelDataArray:a}=e;xve(null!=Kve(t,o),`No group found for id "${t}"`);const r=Rve(t,o);xve(r,`No resize handles found for group id "${t}"`);const l=r.map((e=>{const n=e.getAttribute(Hge);xve(n,"Resize handle element has no handle id attribute");const[r,l]=function(e,a,n,t=document){var i,r,o,s;const l=Hve(a,t),u=Rve(e,t),c=l?u.indexOf(l):-1;return[null!==(i=null===(r=n[c])||void 0===r?void 0:r.id)&&void 0!==i?i:null,null!==(o=null===(s=n[c+1])||void 0===s?void 0:s.id)&&void 0!==o?o:null]}(t,n,a,o);if(null==r||null==l)return()=>{};const u=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=a.findIndex((e=>e.id===r));if(l>=0){const e=a[l];xve(e,`No panel data found for index ${l}`);const r=i[l],{collapsedSize:u=0,collapsible:c,minSize:d=0}=e.constraints;if(null!=r&&c){const e=Bve({delta:jve(r,u)?d-u:u-r,initialLayout:i,panelConstraints:a.map((e=>e.constraints)),pivotIndices:Dve(t,n,o),prevLayout:i,trigger:"keyboard"});i!==e&&s(e)}}break}}};return e.addEventListener("keydown",u),()=>{e.removeEventListener("keydown",u)}}));return()=>{l.forEach((e=>e()))}}),[o,e,n,t,i,r,s])}function Ive(e,a){if(e.length!==a.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==a[n])return!1;return!0}function Gve(e,a){const n="horizontal"===e,{x:t,y:i}=ave(a);return n?t:i}function Vve(e,a,n,t,i,r){if(Qge(e)){const a="horizontal"===n;let t=0;t=e.shiftKey?100:null!=i?i:10;let r=0;switch(e.key){case"ArrowDown":r=a?0:t;break;case"ArrowLeft":r=a?-t:0;break;case"ArrowRight":r=a?t:0;break;case"ArrowUp":r=a?0:-t;break;case"End":r=100;break;case"Home":r=-100}return r}return null==t?0:function(e,a,n,t,i){const r="horizontal"===n,o=Hve(a,i);xve(o,`No resize handle element found for id "${a}"`);const s=o.getAttribute(jge);xve(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=t;const u=Gve(n,e),c=Kve(s,i);xve(c,`No group element found for id "${s}"`);const d=c.getBoundingClientRect();return(u-l)/(r?d.width:d.height)*100}(e,a,n,t,r)}function Fve(e,a,n){a.forEach(((a,t)=>{const i=e[t];xve(i,`Panel data not found for index ${t}`);const{callbacks:r,constraints:o,id:s}=i,{collapsedSize:l=0,collapsible:u}=o,c=n[s];if(null==c||a!==c){n[s]=a;const{onCollapse:e,onExpand:t,onResize:i}=r;i&&i(a,c),u&&(e||t)&&(!t||null!=c&&!Pve(c,l)||Pve(a,l)||t(),!e||null!=c&&Pve(c,l)||!Pve(a,l)||e())}}))}function Jve(e,a){if(e.length!==a.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=a[n])return!1;return!0}function Uve(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,a)=>{localStorage.setItem(e,a)}}catch(a){e.getItem=()=>null,e.setItem=()=>{}}}function Wve(e){return`react-resizable-panels:${e}`}function qve(e){return e.map((e=>{const{constraints:a,id:n,idIsFromProps:t,order:i}=e;return t?n:i?`${i}:${JSON.stringify(a)}`:JSON.stringify(a)})).sort(((e,a)=>e.localeCompare(a))).join(",")}function Zve(e,a){try{const n=Wve(e),t=a.getItem(n);if(t){const e=JSON.parse(t);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function $ve(e,a,n,t,i){var r;const o=Wve(e),s=qve(a),l=null!==(r=Zve(e,i))&&void 0!==r?r:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:t};try{i.setItem(o,JSON.stringify(l))}catch(u){}}function Yve({layout:e,panelConstraints:a}){const n=[...e],t=n.reduce(((e,a)=>e+a),0);if(n.length!==a.length)throw Error(`Invalid ${a.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!jve(t,100)&&n.length>0)for(let r=0;r<a.length;r++){const e=n[r];xve(null!=e,`No layout data found for index ${r}`);n[r]=100/t*e}let i=0;for(let r=0;r<a.length;r++){const e=n[r];xve(null!=e,`No layout data found for index ${r}`);const t=Lve({panelConstraints:a,panelIndex:r,size:e});e!=t&&(i+=e-t,n[r]=t)}if(!jve(i,0))for(let r=0;r<a.length;r++){const e=n[r];xve(null!=e,`No layout data found for index ${r}`);const t=Lve({panelConstraints:a,panelIndex:r,size:e+i});if(e!==t&&(i-=t-e,n[r]=t,jve(i,0)))break}return n}const Qve={getItem:e=>(Uve(Qve),Qve.getItem(e)),setItem:(e,a)=>{Uve(Qve),Qve.setItem(e,a)}},Xve={};function efe({autoSaveId:e=null,children:n,className:t="",direction:i,forwardedRef:r,id:o=null,onLayout:s=null,keyboardResizeBy:l=null,storage:u=Qve,style:c,tagName:d="div",...m}){const h=Jge(o),p=a.useRef(null),[g,v]=a.useState(null),[f,y]=a.useState([]),k=function(){const[e,n]=a.useState(0);return a.useCallback((()=>n((e=>e+1))),[])}(),b=a.useRef({}),S=a.useRef(new Map),A=a.useRef(0),w=a.useRef({autoSaveId:e,direction:i,dragState:g,id:h,keyboardResizeBy:l,onLayout:s,storage:u}),C=a.useRef({layout:f,panelDataArray:[],panelDataArrayChanged:!1});a.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),a.useImperativeHandle(r,(()=>({getId:()=>w.current.id,getLayout:()=>{const{layout:e}=C.current;return e},setLayout:e=>{const{onLayout:a}=w.current,{layout:n,panelDataArray:t}=C.current,i=Yve({layout:e,panelConstraints:t.map((e=>e.constraints))});Ive(n,i)||(y(i),C.current.layout=i,a&&a(i),Fve(t,i,b.current))}})),[]),Ige((()=>{w.current.autoSaveId=e,w.current.direction=i,w.current.dragState=g,w.current.id=h,w.current.onLayout=s,w.current.storage=u})),Ove({committedValuesRef:w,eagerValuesRef:C,groupId:h,layout:f,panelDataArray:C.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),a.useEffect((()=>{const{panelDataArray:a}=C.current;if(e){if(0===f.length||f.length!==a.length)return;let n=Xve[e];null==n&&(n=function(e,a=10){let n=null;return(...t)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...t)}),a)}}($ve,100),Xve[e]=n);const t=[...a],i=new Map(S.current);n(e,t,i,f,u)}}),[e,f,u]),a.useEffect((()=>{}));const M=a.useCallback((e=>{const{onLayout:a}=w.current,{layout:n,panelDataArray:t}=C.current;if(e.constraints.collapsible){const i=t.map((e=>e.constraints)),{collapsedSize:r=0,panelSize:o,pivotIndices:s}=tfe(t,e,n);if(xve(null!=o,`Panel size not found for panel "${e.id}"`),!Pve(o,r)){S.current.set(e.id,o);const l=Bve({delta:nfe(t,e)===t.length-1?o-r:r-o,initialLayout:n,panelConstraints:i,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Jve(n,l)||(y(l),C.current.layout=l,a&&a(l),Fve(t,l,b.current))}}}),[]),T=a.useCallback(((e,a)=>{const{onLayout:n}=w.current,{layout:t,panelDataArray:i}=C.current;if(e.constraints.collapsible){const r=i.map((e=>e.constraints)),{collapsedSize:o=0,panelSize:s=0,minSize:l=0,pivotIndices:u}=tfe(i,e,t),c=null!=a?a:l;if(Pve(s,o)){const a=S.current.get(e.id),o=null!=a&&a>=c?a:c,l=Bve({delta:nfe(i,e)===i.length-1?s-o:o-s,initialLayout:t,panelConstraints:r,pivotIndices:u,prevLayout:t,trigger:"imperative-api"});Jve(t,l)||(y(l),C.current.layout=l,n&&n(l),Fve(i,l,b.current))}}}),[]),N=a.useCallback((e=>{const{layout:a,panelDataArray:n}=C.current,{panelSize:t}=tfe(n,e,a);return xve(null!=t,`Panel size not found for panel "${e.id}"`),t}),[]),x=a.useCallback(((e,a)=>{const{panelDataArray:n}=C.current,t=nfe(n,e);return function({defaultSize:e,dragState:a,layout:n,panelData:t,panelIndex:i,precision:r=3}){const o=n[i];let s;return s=null==o?null!=e?e.toPrecision(r):"1":1===t.length?"1":o.toPrecision(r),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==a?"none":void 0}}({defaultSize:a,dragState:g,layout:f,panelData:n,panelIndex:t})}),[g,f]),E=a.useCallback((e=>{const{layout:a,panelDataArray:n}=C.current,{collapsedSize:t=0,collapsible:i,panelSize:r}=tfe(n,e,a);return xve(null!=r,`Panel size not found for panel "${e.id}"`),!0===i&&Pve(r,t)}),[]),P=a.useCallback((e=>{const{layout:a,panelDataArray:n}=C.current,{collapsedSize:t=0,collapsible:i,panelSize:r}=tfe(n,e,a);return xve(null!=r,`Panel size not found for panel "${e.id}"`),!i||Eve(r,t)>0}),[]),j=a.useCallback((e=>{const{panelDataArray:a}=C.current;a.push(e),a.sort(((e,a)=>{const n=e.order,t=a.order;return null==n&&null==t?0:null==n?-1:null==t?1:n-t})),C.current.panelDataArrayChanged=!0,k()}),[k]);Ige((()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:a,storage:n}=w.current,{layout:t,panelDataArray:i}=C.current;let r=null;if(e){const a=function(e,a,n){var t,i;return null!==(i=(null!==(t=Zve(e,n))&&void 0!==t?t:{})[qve(a)])&&void 0!==i?i:null}(e,i,n);a&&(S.current=new Map(Object.entries(a.expandToSizes)),r=a.layout)}null==r&&(r=function({panelDataArray:e}){const a=Array(e.length),n=e.map((e=>e.constraints));let t=0,i=100;for(let r=0;r<e.length;r++){const e=n[r];xve(e,`Panel constraints not found for index ${r}`);const{defaultSize:o}=e;null!=o&&(t++,a[r]=o,i-=o)}for(let r=0;r<e.length;r++){const o=n[r];xve(o,`Panel constraints not found for index ${r}`);const{defaultSize:s}=o;if(null!=s)continue;const l=i/(e.length-t);t++,a[r]=l,i-=l}return a}({panelDataArray:i}));const o=Yve({layout:r,panelConstraints:i.map((e=>e.constraints))});Ive(t,o)||(y(o),C.current.layout=o,a&&a(o),Fve(i,o,b.current))}})),Ige((()=>{const e=C.current;return()=>{e.layout=[]}}),[]);const L=a.useCallback((e=>{let a=!1;const n=p.current;if(n){"rtl"===window.getComputedStyle(n,null).getPropertyValue("direction")&&(a=!0)}return function(n){n.preventDefault();const t=p.current;if(!t)return()=>null;const{direction:i,dragState:r,id:o,keyboardResizeBy:s,onLayout:l}=w.current,{layout:u,panelDataArray:c}=C.current,{initialLayout:d}=null!=r?r:{},m=Dve(o,e,t);let h=Vve(n,e,i,r,s,t);const g="horizontal"===i;g&&a&&(h=-h);const v=Bve({delta:h,initialLayout:null!=d?d:u,panelConstraints:c.map((e=>e.constraints)),pivotIndices:m,prevLayout:u,trigger:Qge(n)?"keyboard":"mouse-or-touch"}),f=!Jve(u,v);(Xge(n)||eve(n))&&A.current!=h&&(A.current=h,wve(e,f||0===h?0:g?h<0?lve:uve:h<0?cve:dve)),f&&(y(v),C.current.layout=v,l&&l(v),Fve(c,v,b.current))}}),[]),B=a.useCallback(((e,a)=>{const{onLayout:n}=w.current,{layout:t,panelDataArray:i}=C.current,r=i.map((e=>e.constraints)),{panelSize:o,pivotIndices:s}=tfe(i,e,t);xve(null!=o,`Panel size not found for panel "${e.id}"`);const l=Bve({delta:nfe(i,e)===i.length-1?o-a:a-o,initialLayout:t,panelConstraints:r,pivotIndices:s,prevLayout:t,trigger:"imperative-api"});Jve(t,l)||(y(l),C.current.layout=l,n&&n(l),Fve(i,l,b.current))}),[]),z=a.useCallback(((e,a)=>{const{layout:n,panelDataArray:t}=C.current,{collapsedSize:i=0,collapsible:r}=a,{collapsedSize:o=0,collapsible:s,maxSize:l=100,minSize:u=0}=e.constraints,{panelSize:c}=tfe(t,e,n);null!=c&&(r&&s&&Pve(c,i)?Pve(i,o)||B(e,o):c<u?B(e,u):c>l&&B(e,l))}),[B]),R=a.useCallback(((e,a)=>{const{direction:n}=w.current,{layout:t}=C.current;if(!p.current)return;const i=Hve(e,p.current);xve(i,`Drag handle element not found for id "${e}"`);const r=Gve(n,a);v({dragHandleId:e,dragHandleRect:i.getBoundingClientRect(),initialCursorPosition:r,initialLayout:t})}),[]),_=a.useCallback((()=>{v(null)}),[]),D=a.useCallback((e=>{const{panelDataArray:a}=C.current,n=nfe(a,e);n>=0&&(a.splice(n,1),delete b.current[e.id],C.current.panelDataArrayChanged=!0,k())}),[k]),K=a.useMemo((()=>({collapsePanel:M,direction:i,dragState:g,expandPanel:T,getPanelSize:N,getPanelStyle:x,groupId:h,isPanelCollapsed:E,isPanelExpanded:P,reevaluatePanelConstraints:z,registerPanel:j,registerResizeHandle:L,resizePanel:B,startDragging:R,stopDragging:_,unregisterPanel:D,panelGroupElement:p.current})),[M,g,i,T,N,x,h,E,P,z,j,L,B,R,_,D]);return a.createElement(xge.Provider,{value:K},a.createElement(d,{...m,children:n,className:t,id:o,ref:p,style:{...{display:"flex",flexDirection:"horizontal"===i?"row":"column",height:"100%",overflow:"hidden",width:"100%"},...c},[Ege]:"",[Pge]:i,[jge]:h}))}const afe=a.forwardRef(((e,n)=>a.createElement(efe,{...e,forwardedRef:n})));function nfe(e,a){return e.findIndex((e=>e===a||e.id===a.id))}function tfe(e,a,n){const t=nfe(e,a);return{...a.constraints,panelSize:n[t],pivotIndices:t===e.length-1?[t-1,t]:[t,t+1]}}function ife({children:e=null,className:n="",disabled:t=!1,hitAreaMargins:i,id:r,onBlur:o,onClick:s,onDragging:l,onFocus:u,onPointerDown:c,onPointerUp:d,style:m={},tabIndex:h=0,tagName:p="div",...g}){var v,f;const y=a.useRef(null),k=a.useRef({onClick:s,onDragging:l,onPointerDown:c,onPointerUp:d});a.useEffect((()=>{k.current.onClick=s,k.current.onDragging=l,k.current.onPointerDown=c,k.current.onPointerUp=d}));const b=a.useContext(xge);if(null===b)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:S,groupId:A,registerResizeHandle:w,startDragging:C,stopDragging:M,panelGroupElement:T}=b,N=Jge(r),[x,E]=a.useState("inactive"),[P,j]=a.useState(!1),[L,B]=a.useState(null),z=a.useRef({state:x});Ige((()=>{z.current.state=x})),a.useEffect((()=>{if(t)B(null);else{const e=w(N);B((()=>e))}}),[t,N,w]);const R=null!==(v=null==i?void 0:i.coarse)&&void 0!==v?v:15,_=null!==(f=null==i?void 0:i.fine)&&void 0!==f?f:5;a.useEffect((()=>{if(t||null==L)return;const e=y.current;xve(e,"Element ref not attached");let a=!1;return function(e,a,n,t,i){var r;const{ownerDocument:o}=a,s={direction:n,element:a,hitAreaMargins:t,setResizeHandlerState:i},l=null!==(r=gve.get(o))&&void 0!==r?r:0;return gve.set(o,l+1),fve.add(s),Tve(),function(){var a;vve.delete(e),fve.delete(s);const n=null!==(a=gve.get(o))&&void 0!==a?a:1;if(gve.set(o,n-1),Tve(),1===n&&gve.delete(o),hve.includes(s)){const e=hve.indexOf(s);e>=0&&hve.splice(e,1),Cve(),i("up",!0,null)}}}(N,e,S,{coarse:R,fine:_},((e,n,t)=>{if(n)switch(e){case"down":{E("drag"),a=!1,xve(t,'Expected event to be defined for "down" action'),C(N,t);const{onDragging:e,onPointerDown:n}=k.current;null==e||e(!0),null==n||n();break}case"move":{const{state:e}=z.current;a=!0,"drag"!==e&&E("hover"),xve(t,'Expected event to be defined for "move" action'),L(t);break}case"up":{E("hover"),M();const{onClick:e,onDragging:n,onPointerUp:t}=k.current;null==n||n(!1),null==t||t(),a||null==e||e();break}}else E("inactive")}))}),[R,S,t,_,w,N,L,C,M]),function({disabled:e,handleId:n,resizeHandler:t,panelGroupElement:i}){a.useEffect((()=>{if(e||null==t||null==i)return;const a=Hve(n,i);if(null==a)return;const r=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),t(e);break;case"F6":{e.preventDefault();const t=a.getAttribute(jge);xve(t,`No group element found for id "${t}"`);const r=Rve(t,i),o=_ve(t,n,i);xve(null!==o,`No resize element found for id "${n}"`),r[e.shiftKey?o>0?o-1:r.length-1:o+1<r.length?o+1:0].focus();break}}};return a.addEventListener("keydown",r),()=>{a.removeEventListener("keydown",r)}}),[i,e,n,t])}({disabled:t,handleId:N,resizeHandler:L,panelGroupElement:T});return a.createElement(p,{...g,children:e,className:n,id:r,onBlur:()=>{j(!1),null==o||o()},onFocus:()=>{j(!0),null==u||u()},ref:y,role:"separator",style:{touchAction:"none",userSelect:"none",...m},tabIndex:h,[Pge]:S,[jge]:A,[_ge]:"",[Dge]:"drag"===x?"pointer":P?"keyboard":void 0,[Kge]:!t,[Hge]:N,[Oge]:x})}efe.displayName="PanelGroup",afe.displayName="forwardRef(PanelGroup)",ife.displayName="PanelResizeHandle";const rfe=({className:e,...a})=>n.jsx(afe,{className:LG("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...a}),ofe=Wge,sfe=({withHandle:e,className:a,...t})=>n.jsx(ife,{className:LG("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...t,children:e&&n.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:n.jsx(jc,{className:"h-2.5 w-2.5"})})}),lfe=({copyText:e})=>n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),ufe="rgba(245, 246, 247, 1)",cfe={[Qe.SEND_COMMUNICATION]:{color:{bg:ufe},clickable:!0},[Qe.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:ufe},clickable:!1}},dfe={[Qe.SEND_COMMUNICATION]:"Send Email & SMS",[Qe.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},mfe=({children:e,onClick:a,iconBgColor:t,iconStrokeColor:i,Icon:r,disabled:o=!1,selected:s=!1})=>{const l=r;return n.jsxs(H$.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},style:{backgroundColor:s?t:ufe},onClick:a,className:im("flex gap-2 items-center rounded-md transition-colors group","p-2 border-2 border-transparent overflow-hidden",!o&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:[n.jsx("div",{className:im("bg-purple-50 rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 transition-colors",!o&&"group-hover/trigger-audience:bg-background",t),children:n.jsx(l,{className:im("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",i)})}),e]})},hfe=({segmentName:e})=>n.jsx("span",{className:"inline-flex items-center bg-white border border-gray-200 rounded-md px-2 py-0.5 text-sm font-medium shadow-sm",children:e}),pfe=()=>{const e=wY(),{setActionId:t,state:{selectedActionId:i}}=a.useContext(X$),[r,o]=a.useState(e?.includeSegmentIds||null),[s,l]=a.useState(e?.excludeSegmentIds||null),{segments:u}=gY(),c=a.useCallback((()=>u?.find((e=>e.type===bY.ALL_USERS))),[u]);return a.useEffect((()=>{e&&u&&(null===r&&null===s?(o(e?.includeSegmentIds||null),l(e?.excludeSegmentIds||null),0===e.includeSegmentIds.length&&0===e.excludeSegmentIds.length&&(o([c()?.id||""]),l([]))):(JSON.stringify(e.includeSegmentIds)!==JSON.stringify(r)&&o(e.includeSegmentIds),JSON.stringify(e.excludeSegmentIds)!==JSON.stringify(s)&&l(e.excludeSegmentIds)))}),[e,s,r,u,c]),e&&r&&s?n.jsx(n.Fragment,{children:n.jsx(mfe,{selected:i===jie.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{t(jie.EditAudience)},Icon:RY.AudienceIcon,children:n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[n.jsx(Lue,{children:"Audience"}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx(lfe,{copyText:`Send to all ${yh("engage:user",{count:2})} in ${1===r.length?"this":"these"} ${yh("engage:segment",{count:r.length}).toLowerCase()}`}),n.jsx("div",{className:"flex gap-1 flex-wrap",children:r.map((e=>{const a=u?.find((a=>a.id===e));return a?n.jsx(hfe,{segmentName:a.name},e):null}))})]})]})})}):null},gfe=()=>{const e=wY(),{setActionId:t,state:{selectedActionId:i}}=a.useContext(X$),{segments:r}=gY(),o=yh(e?.triggerType===Ze.TRIGGER_BASED?"engage:automation":"engage:broadcast"),s=`Start this ${o?.toLowerCase()}`;if(!e||!r)return null;return n.jsx(n.Fragment,{children:(()=>{switch(e.triggerType){case Ze.TRIGGER_BASED:{if(e.triggerMetadata.triggerType!==Ze.TRIGGER_BASED||e.triggerMetadata.eventName!==$e.USER_ENTERS_SEGMENT||!e.triggerMetadata.eventFilter.segment_id)return null;const a=e.triggerMetadata.eventFilter.segment_id,t=r.find((e=>e.id===a))?.name;return t?n.jsx(mfe,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:RY.TriggerIcon,children:n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[n.jsx(Lue,{children:s}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx(lfe,{copyText:`When ${yh("engage:user").toLowerCase()} joins the`}),n.jsx(hfe,{segmentName:t})]})]})}):null}case Ze.ONE_TIME:{const a=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return n.jsxs(mfe,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{t(jie.EditTime)},selected:i===jie.EditTime,Icon:RY.TriggerIcon,children:[n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[n.jsx(Lue,{children:s}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx(lfe,a?{copyText:`Click to set the date and time for this ${yh("engage:broadcast")}`}:{copyText:"Bulk send at"}),!1===a&&"scheduledAt"in e.triggerMetadata&&e.triggerMetadata.scheduledAt&&n.jsx("div",{className:"text-xs font-medium",children:n.jsx(hfe,{segmentName:"now"===e.triggerMetadata.scheduledAt?"5 minutes after send":dae(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),n.jsx("div",{className:"",children:a&&n.jsx(Mae,{title:"Please select a time before sending this ${t('engage:broadcast')}.",alertText:`A scheduled time is needed before sending this ${yh("engage:broadcast")}.`,Icon:RY.AlertTriangleIcon,iconColor:"text-red-500",size:"large"})})]})}default:throw Dse(e.triggerType,Ze)}})()})},vfe=({type:e,disabled:t=!1,actionId:i})=>{const{state:{selectedSubStepType:r},setSelectedSubStepType:o,setActionId:s}=a.useContext(X$),l=CY(),u=r===e,c=a.useCallback((()=>{if(!l)return"Need to select a channel";switch(e){case Lie.EMAIL:return l.emailChannelSenderId?l.emailHtmlBody?!!l.emailSubject||"Please add a subject to the email":"Please add content to the email":"Please select a email sender";case Lie.SMS:return l.smsChannelSenderId?!!l.smsMessageBody||"Please add content to the sms":"Please select a sms sender"}}),[l,e]);if(t)return null;const d=c();return n.jsx(H$.div,{layout:!0,initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15,ease:"easeInOut"},className:im("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group","border-2 border-transparent",u&&"border-primary",!t&&"hover:border-muted-foreground/30",t&&"opacity-50 cursor-not-allowed"),style:{backgroundColor:u?"#f5f6f7":ufe},onClick:()=>{t||(s(i),o(e))},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"rounded-md p-1.5 flex items-center justify-center w-6 h-6 flex-shrink-0 bg-white border",children:((e,a)=>{switch(e){case Lie.EMAIL:return n.jsx(RY.EmailIcon,{className:im("w-6 h-6",a?"text-primary":"text-gray-400")});case Lie.SMS:return n.jsx(RY.SmsIcon,{className:im("w-6 h-6",a?"text-primary":"text-gray-400")})}})(e,u)}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("div",{style:{color:u?"#3b82f6":"#64748b"},children:n.jsx(Lue,{className:"text-xs",children:(()=>{switch(e){case Lie.EMAIL:return"Email";case Lie.SMS:return"SMS"}})()})}),n.jsx("div",{className:"text-[10px] font-medium text-muted-foreground",children:(()=>{if(!l)return"";switch(e){case Lie.EMAIL:return l.emailSubject||"No subject set";case Lie.SMS:return l.smsMessageBody?`${l.smsMessageBody.substring(0,40)}${l.smsMessageBody.length>40?"...":""}`:"No message set"}})()}),!0!==d&&n.jsx("div",{className:"text-[10px] text-amber-600 font-medium",children:d})]})]})})},ffe=e=>{switch(e){case Qe.SEND_COMMUNICATION:return"Send Communication";case Qe.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw W$(e,Qe)}},yfe=e=>{switch(e){case Qe.SEND_COMMUNICATION:return n.jsx(RY.CommunicationIcon,{className:"w-4 h-4"});case Qe.WAIT_UNTIL_NEXT_FIXED_TIME:return n.jsx(RY.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw Dse(e,Qe)}},kfe=e=>{if(!(e&&e.actionType===Qe.WAIT_UNTIL_NEXT_FIXED_TIME&&"hour"in e&&"minute"in e&&"timezone"in e))return null;const{hour:a,minute:n,timezone:t}=e;return`Wait until next ${`${a?.toString().padStart(2,"0")}:${n?.toString().padStart(2,"0")}`} ${t}`},bfe=({actionDataWithMetadata:e})=>{const{actionData:t,communicationGroup:i}=e,{state:{selectedActionId:r},setActionId:o,setSelectedCommunicationGroupId:s}=a.useContext(X$),l=a.useMemo((()=>r===t.actionMetadata.currentActionId),[r,t.actionMetadata.currentActionId]),u=cfe[t.actionType],c=u.color,d=u.clickable;return n.jsxs(H$.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:im("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",l&&"border-primary",t.actionType!==Qe.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:l?c.bg:c.bgUnselected??ufe},onClick:()=>{d&&(o(t.actionMetadata.currentActionId),t.actionType===Qe.SEND_COMMUNICATION&&s(t.actionMetadata.communicationGroupId))},children:[n.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[n.jsx("div",{className:"rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white",children:yfe(t.actionType)}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("div",{style:{color:l?c.text:c.textUnselected},children:n.jsx(Lue,{children:dfe[t.actionType]})}),n.jsx("div",t.actionType===Qe.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:kfe(t.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:t.actionType===Qe.SEND_COMMUNICATION&&i?.emailSubject?i?.emailSubject:ffe(t.actionType)})]})]}),t.actionType===Qe.SEND_COMMUNICATION&&n.jsx("div",{className:"flex items-center pr-2",children:n.jsx(RY.NextButton,l?{className:"w-4 h-4 text-muted-foreground rotate-90 transition-transform duration-200"}:{className:"w-4 h-4 text-muted-foreground transition-transform duration-200"})})]})},Sfe=()=>{const e=CY(),[t,i]=a.useState(!1),[r,o]=a.useState(void 0),s=wY(),{setActionId:l,setSelectedSubStepType:u,state:{selectedActionId:c,selectedSubStepType:d}}=a.useContext(X$);if(Je(s?.id||""),a.useEffect((()=>{if(!s)return;if(c)return;const e=s.actionData?.find((e=>"send_communication"===e.actionType));e&&l(e.actionMetadata.currentActionId)}),[s,l,c]),a.useEffect((()=>{if(!s)return;(async()=>{const e=[];for(const a of s.actionData??[])switch(a.actionType){case Qe.SEND_COMMUNICATION:{const n=await aY(a.actionMetadata.communicationGroupId);e.push({actionData:a,communicationGroup:n});break}case Qe.WAIT_UNTIL_NEXT_FIXED_TIME:e.push({actionData:a});break;default:throw W$(a.actionType,Qe)}o(e)})()}),[s]),a.useEffect((()=>{if(c&&r&&e&&null===d){const a=r.find((e=>e.actionData.actionMetadata.currentActionId===c));"send_communication"===a?.actionData.actionType&&u(e?.emailChannelSenderId?Lie.EMAIL:Lie.SMS)}}),[c,r,u,e,d]),!s||!r)return null;const m=(e=>{const{steps:a,rootActionId:n}=e;if(!a||!n)return a??[];const t=new Map(a.map((e=>[e.actionData.actionMetadata.currentActionId,e]))),i=t.get(n);if(!i)return a;const r=[];let o=i;for(;o;){r.push(o);const e=o.actionData.actionMetadata.nextActionId;if(!e)break;o=t.get(e)}return r})({steps:r,rootActionId:s.triggerMetadata?.triggerType===Ze.TRIGGER_BASED?s.triggerMetadata.rootActionId:void 0}).filter((e=>!!t||"send_communication"===e.actionData.actionType));let h=()=>n.jsx("div",{},"empty-trigger-audience");return(t||s.triggerType===Ze.ONE_TIME)&&(h=()=>n.jsxs("div",{className:"flex flex-col gap-3",children:[s.triggerType===Ze.ONE_TIME&&n.jsx(pfe,{}),s.triggerType!==Ze.ONE_TIME&&n.jsx(gfe,{})]})),n.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[s.triggerType===Ze.TRIGGER_BASED&&n.jsxs("div",{className:"flex gap-2 items-center justify-between",children:[n.jsx("div",{className:"text-[13px] text-muted-foreground",children:"Messages sent in listed order"}),n.jsxs("div",{className:"flex gap-2 items-center",children:[n.jsx("div",{className:"text-[13px] font-medium",children:"Show all details"}),n.jsx(mpe,{defaultChecked:t,onCheckedChange:()=>{i(!t)}})]})]}),n.jsx("div",{className:"flex-1 flex flex-col gap-3",children:n.jsxs(aV,{mode:"popLayout",children:[h(),m.map(((a,t)=>n.jsx(H$.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,delay:.05*t,ease:"easeInOut"},children:n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(bfe,{actionDataWithMetadata:a}),"send_communication"===a.actionData.actionType&&c===a.actionData.actionMetadata.currentActionId&&a.actionData.actionMetadata.currentActionId&&n.jsxs("div",{className:"flex gap-3",children:[n.jsx(H$.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,delay:.25*m.length,ease:"easeInOut"},className:"w-12 flex justify-end items-center",children:n.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full rounded-full"})}),n.jsxs("div",{className:"flex flex-col gap-3 flex-1",children:[e?.emailChannelSenderId&&n.jsx(vfe,{type:Lie.EMAIL,actionId:a.actionData.actionMetadata.currentActionId}),e?.smsChannelSenderId&&n.jsx(vfe,{type:Lie.SMS,actionId:a.actionData.actionMetadata.currentActionId})]})]})]})},a.actionData.actionMetadata?.currentActionId??t))),s.triggerType===Ze.ONE_TIME&&n.jsx("div",{className:"flex flex-col gap-3",children:n.jsx(gfe,{})},"one-time-trigger")]})})]})},Afe=()=>{const e=wY(),{segments:a}=gY();return n.jsx("div",e&&a?{className:"h-full pt-4 relative",children:n.jsx("div",{className:"absolute inset-0 overflow-y-auto flex flex-col gap-3",children:n.jsx(Sfe,{})})}:{className:"flex h-full items-center justify-center",children:n.jsx(xY,{text:[`Getting details on your ${yh("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},wfe=({disablePreview:e=!1,disableEditContent:t=!1,disablePreviewSubtext:i=!1,hideSms:r=!1})=>{const{state:{selectedSubStepType:o}}=a.useContext(X$);if(!CY())return n.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:n.jsx(xY,{text:["Loading..."]})});if(!o)return n.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsxs("div",{className:"text-center",children:[n.jsx("h3",{className:"text-lg font-medium text-muted-foreground mb-2",children:"Select Communication Type"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose Email or SMS from the steps on the left to preview and edit content"})]})})});const s={disablePreview:e,disableEditContent:t,disablePreviewSubtext:i};return n.jsxs("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:[o===Lie.EMAIL&&n.jsx(Sue,{...s}),o===Lie.SMS&&!r&&n.jsx(Mue,{...s})]})},Cfe=()=>{const{state:{selectedActionId:e}}=a.useContext(X$),{state:{hideSms:t}}=a.useContext(cO);return n.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:n.jsx(aV,{mode:"wait",children:e===jie.EditTime?n.jsx(_me,{}):e===jie.EditAudience?n.jsx(Epe,{}):n.jsx(wfe,{hideSms:t})})})},Mfe=()=>n.jsxs(rfe,{direction:"horizontal",className:"flex-1",children:[n.jsx(ofe,{defaultSize:30,minSize:16,maxSize:48,children:n.jsx("aside",{className:"h-full",children:n.jsx(Afe,{})})}),n.jsx(sfe,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),n.jsx(ofe,{defaultSize:70,children:n.jsx("main",{className:"h-full",children:n.jsx(Cfe,{})})})]}),Tfe=()=>{const[e,t]=a.useState("workflow"),i=[{id:"workflow",label:"Workflow",content:n.jsx(Mfe,{})},{id:"recipients",label:"Recipients",content:n.jsx(Nge,{})},{id:"insights",label:yh("engage:insight",{count:2}),content:n.jsx(Mge,{})}];return n.jsx(Vpe,{tabs:i,activeTab:e,onTabChange:t,tabsLocation:"left"})},Nfe=({showBackButton:e=!1,onDuplicationCreated:t,onBeforeSchedule:i,getExtraMergeFields:r,hideSms:o,hideSales:s,replyToSettingsText:l,replyToSettingsLink:u,fromNameSettingsText:c,fromNameSettingsLink:d})=>{const m=wY(),h=CY(),{updateCommunicationGroup:p}=lY(),{toast:g}=Ie(),{channelSenders:v}=x9();return a.useEffect((()=>{if(h&&r){(async()=>{const e=await r();JSON.stringify(e)!==JSON.stringify(h.extraMergeFields)&&p({groupId:h?.id,params:{extraMergeFields:e}},{onError:e=>{g({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[h,r,p,g]),a.useEffect((()=>{if(m&&h&&v&&m.automationType===Ye.MANAGED&&null===h.emailChannelSenderId&&null===h.smsChannelSenderId){if(!h.emailChannelSenderId){const e=v.results.filter((e=>e.channelSenderMetadata.userPart));e.length>0&&p({groupId:h.id,params:{emailChannelSenderId:e[0].id}})}if(!h.smsChannelSenderId){const e=v.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid));e.length>0&&p({groupId:h.id,params:{smsChannelSenderId:e[0].id}})}}}),[m,h,v,p]),m&&h?n.jsx(dO,{children:n.jsx(mO,{replyToSettingsText:l,replyToSettingsLink:u,fromNameSettingsText:c,fromNameSettingsLink:d,hideSms:o,hideSales:s,children:n.jsxs("div",{className:"h-full flex flex-col gap-4",children:[n.jsx(Cge,{showBackButton:e,onDuplicationCreated:t,onBeforeSchedule:i}),n.jsx("div",{className:"flex-1 border-t",children:n.jsx(Tfe,{})})]})})}):n.jsx("div",{className:"flex h-screen items-center justify-center",children:n.jsx(xY,{text:[`Fetching ${yh("engage:automation").toLowerCase()} data`,"Finishing up"]})})},xfe=({...e})=>{const a=function(){let{matches:e}=r.useContext(e5),a=e[e.length-1];return a?a.params:{}}(),[t]=F5(),i=e.automationId||a?.automationId||t.get("automationId")||"",o="true"===t.get("showBackButton")||e.showBackButton;return n.jsx(TY,{automationId:i,children:n.jsx("div",{className:"bg-background h-full",children:n.jsx(Nfe,{...e,showBackButton:o})})})};Object.values(Object.assign({}));var Efe=e=>null!=e;var Pfe=e=>"function"!=typeof e||e.length?e:e(),jfe=e=>Array.isArray(e)?e:e?[e]:[];var Lfe=xa;var Bfe,zfe=function(e){const[a,n]=ka(),t=e?.throw?(e,a)=>{throw n(e instanceof Error?e:new Error(a)),e}:(e,a)=>{n(e instanceof Error?e:new Error(a))},i=e?.api?Array.isArray(e.api)?e.api:[e.api]:[globalThis.localStorage].filter(Boolean),r=e?.prefix?`${e.prefix}.`:"",o=new Map,s=new Proxy({},{get(a,n){let s=o.get(n);s||(s=ka(void 0,{equals:!1}),o.set(n,s)),s[0]();const l=i.reduce(((e,a)=>{if(null!==e||!a)return e;try{return a.getItem(`${r}${n}`)}catch(cBe){return t(cBe,`Error reading ${r}${n} from ${a.name}`),null}}),null);return null!==l&&e?.deserializer?e.deserializer(l,n,e.options):l}});return!1!==e?.sync&&Na((()=>{const e=e=>{let a=!1;i.forEach((n=>{try{n!==e.storageArea&&e.key&&e.newValue!==n.getItem(e.key)&&(e.newValue?n.setItem(e.key,e.newValue):n.removeItem(e.key),a=!0)}catch(cBe){t(cBe,`Error synching api ${n.name} from storage event (${e.key}=${e.newValue})`)}})),a&&e.key&&o.get(e.key)?.[1]()};"addEventListener"in globalThis?(globalThis.addEventListener("storage",e),xa((()=>globalThis.removeEventListener("storage",e)))):(i.forEach((a=>a.addEventListener?.("storage",e))),xa((()=>i.forEach((a=>a.removeEventListener?.("storage",e))))))})),[s,(a,n,s)=>{const l=e?.serializer?e.serializer(n,a,s??e.options):n,u=`${r}${a}`;i.forEach((e=>{try{e.getItem(u)!==l&&e.setItem(u,l)}catch(cBe){t(cBe,`Error setting ${r}${a} to ${l} in ${e.name}`)}}));const c=o.get(a);c&&c[1]()},{clear:()=>i.forEach((e=>{try{e.clear()}catch(cBe){t(cBe,`Error clearing ${e.name}`)}})),error:a,remove:e=>i.forEach((a=>{try{a.removeItem(`${r}${e}`)}catch(cBe){t(cBe,`Error removing ${r}${e} from ${a.name}`)}})),toJSON:()=>{const a={},n=(n,t)=>{if(!a.hasOwnProperty(n)){const i=t&&e?.deserializer?e.deserializer(t,n,e.options):t;i&&(a[n]=i)}};return i.forEach((e=>{if("function"==typeof e.getAll){let a;try{a=e.getAll()}catch(cBe){t(cBe,`Error getting all values from in ${e.name}`)}for(const e of a)n(e,a[e])}else{let i,r=0;try{for(;i=e.key(r++);)a.hasOwnProperty(i)||n(i,e.getItem(i))}catch(cBe){t(cBe,`Error getting all values from ${e.name}`)}}})),a}}]},Rfe=e=>{if(!e)return"";let a="";for(const n in e){if(!e.hasOwnProperty(n))continue;const t=e[n];a+=t instanceof Date?`; ${n}=${t.toUTCString()}`:"boolean"==typeof t?`; ${n}`:`; ${n}=${t}`}return a},_fe=("function"==typeof(Bfe={_cookies:[globalThis.document,"cookie"],getItem:e=>_fe._cookies[0][_fe._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,a,n)=>{const t=_fe.getItem(e);_fe._cookies[0][_fe._cookies[1]]=`${e}=${a}${Rfe(n)}`;const i=Object.assign(new Event("storage"),{key:e,oldValue:t,newValue:a,url:globalThis.document.URL,storageArea:_fe});window.dispatchEvent(i)},removeItem:e=>{_fe._cookies[0][_fe._cookies[1]]=`${e}=deleted${Rfe({expires:new Date(0)})}`},key:e=>{let a=null,n=0;return _fe._cookies[0][_fe._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((t,i)=>(!a&&i&&n++===e&&(a=i),""))),a},get length(){let e=0;return _fe._cookies[0][_fe._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(a=>(e+=a?1:0,""))),e}}).clear||(Bfe.clear=()=>{let e;for(;e=Bfe.key(0);)Bfe.removeItem(e)}),Bfe),Dfe=796,Kfe="bottom",Hfe="system",Ofe=Object.keys(It)[0],Ife=Object.keys(Ft)[0],Gfe=Ba({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Vfe(){return za(Gfe)}var Ffe=Ba(void 0),Jfe=e=>{const[a,n]=ka(null),t=()=>{const e=a();null!=e&&(e.close(),n(null))},i=(t,i)=>{if(null!=a())return;const r=window.open("","TSQD-Devtools-Panel",`width=${t},height=${i},popup`);if(!r)throw new Error("Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.");r.document.head.innerHTML="",r.document.body.innerHTML="",function(e=window.document){if(e[wn]){for(let a of e[wn].keys())e.removeEventListener(a,Dn);delete e[wn]}}(r.document),r.document.title="TanStack Query Devtools",r.document.body.style.margin="0",r.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(Vfe().shadowDOMTarget||document).styleSheets].forEach((e=>{try{const a=[...e.cssRules].map((e=>e.cssText)).join(""),n=document.createElement("style"),t=e.ownerNode;let i="";t&&"id"in t&&(i=t.id),i&&n.setAttribute("id",i),n.textContent=a,r.document.head.appendChild(n)}catch(uBe){const n=document.createElement("link");if(null==e.href)return;n.rel="stylesheet",n.type=e.type,n.media=e.media.toString(),n.href=e.href,r.document.head.appendChild(n)}})),Tn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],r.document),e.setLocalStore("pip_open","true"),n(r)};Aa((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||i(Number(window.innerWidth),Number(e.localStore.height||500))})),Aa((()=>{const e=(Vfe().shadowDOMTarget||document).querySelector("#_goober"),n=a();if(e&&n){const a=new MutationObserver((()=>{const a=(Vfe().shadowDOMTarget||n.document).querySelector("#_goober");a&&(a.textContent=e.textContent)}));a.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),xa((()=>{a.disconnect()}))}}));const r=wa((()=>({pipWindow:a(),requestPipWindow:i,closePipWindow:t,disabled:e.disabled??!1})));return Xa(Ffe.Provider,{value:r,get children(){return e.children}})},Ufe=()=>wa((()=>{const e=za(Ffe);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Wfe=Ba((()=>"dark"));function qfe(){return za(Wfe)}var Zfe={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Ấ":"A","Ắ":"A","Ẳ":"A","Ẵ":"A","Ặ":"A","Æ":"AE","Ầ":"A","Ằ":"A","Ȃ":"A","Ç":"C","Ḉ":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ế":"E","Ḗ":"E","Ề":"E","Ḕ":"E","Ḝ":"E","Ȇ":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ḯ":"I","Ȋ":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ố":"O","Ṍ":"O","Ṓ":"O","Ȏ":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ấ":"a","ắ":"a","ẳ":"a","ẵ":"a","ặ":"a","æ":"ae","ầ":"a","ằ":"a","ȃ":"a","ç":"c","ḉ":"c","è":"e","é":"e","ê":"e","ë":"e","ế":"e","ḗ":"e","ề":"e","ḕ":"e","ḝ":"e","ȇ":"e","ì":"i","í":"i","î":"i","ï":"i","ḯ":"i","ȋ":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ố":"o","ṍ":"o","ṓ":"o","ȏ":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","C̆":"C","c̆":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","Ǵ":"G","ĝ":"g","ǵ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ḫ":"H","ḫ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","Ḱ":"K","ḱ":"k","K̆":"K","k̆":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"l","ł":"l","Ḿ":"M","ḿ":"m","M̆":"M","m̆":"m","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","N̆":"N","n̆":"n","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","P̆":"P","p̆":"p","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","R̆":"R","r̆":"r","Ȓ":"R","ȓ":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","Ș":"S","ș":"s","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","ț":"t","Ț":"T","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","T̆":"T","t̆":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ȗ":"U","ȗ":"u","V̆":"V","v̆":"v","Ŵ":"W","ŵ":"w","Ẃ":"W","ẃ":"w","X̆":"X","x̆":"x","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Y̆":"Y","y̆":"y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ſ":"s","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Ǎ":"A","ǎ":"a","Ǐ":"I","ǐ":"i","Ǒ":"O","ǒ":"o","Ǔ":"U","ǔ":"u","Ǖ":"U","ǖ":"u","Ǘ":"U","ǘ":"u","Ǚ":"U","ǚ":"u","Ǜ":"U","ǜ":"u","Ứ":"U","ứ":"u","Ṹ":"U","ṹ":"u","Ǻ":"A","ǻ":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","ǿ":"o","Þ":"TH","þ":"th","Ṕ":"P","ṕ":"p","Ṥ":"S","ṥ":"s","X́":"X","x́":"x","Ѓ":"Г","ѓ":"г","Ќ":"К","ќ":"к","A̋":"A","a̋":"a","E̋":"E","e̋":"e","I̋":"I","i̋":"i","Ǹ":"N","ǹ":"n","Ồ":"O","ồ":"o","Ṑ":"O","ṑ":"o","Ừ":"U","ừ":"u","Ẁ":"W","ẁ":"w","Ỳ":"Y","ỳ":"y","Ȁ":"A","ȁ":"a","Ȅ":"E","ȅ":"e","Ȉ":"I","ȉ":"i","Ȍ":"O","ȍ":"o","Ȑ":"R","ȑ":"r","Ȕ":"U","ȕ":"u","B̌":"B","b̌":"b","Č̣":"C","č̣":"c","Ê̌":"E","ê̌":"e","F̌":"F","f̌":"f","Ǧ":"G","ǧ":"g","Ȟ":"H","ȟ":"h","J̌":"J","ǰ":"j","Ǩ":"K","ǩ":"k","M̌":"M","m̌":"m","P̌":"P","p̌":"p","Q̌":"Q","q̌":"q","Ř̩":"R","ř̩":"r","Ṧ":"S","ṧ":"s","V̌":"V","v̌":"v","W̌":"W","w̌":"w","X̌":"X","x̌":"x","Y̌":"Y","y̌":"y","A̧":"A","a̧":"a","B̧":"B","b̧":"b","Ḑ":"D","ḑ":"d","Ȩ":"E","ȩ":"e","Ɛ̧":"E","ɛ̧":"e","Ḩ":"H","ḩ":"h","I̧":"I","i̧":"i","Ɨ̧":"I","ɨ̧":"i","M̧":"M","m̧":"m","O̧":"O","o̧":"o","Q̧":"Q","q̧":"q","U̧":"U","u̧":"u","X̧":"X","x̧":"x","Z̧":"Z","z̧":"z"},$fe=Object.keys(Zfe).join("|"),Yfe=new RegExp($fe,"g");var Qfe=7,Xfe=6,eye=5,aye=4,nye=3,tye=2,iye=1,rye=0;function oye(e,a,n){var t;if((n=n||{}).threshold=null!=(t=n.threshold)?t:iye,!n.accessors){const t=sye(e,a,n);return{rankedValue:e,rank:t,accessorIndex:-1,accessorThreshold:n.threshold,passed:t>=n.threshold}}const i=function(e,a){const n=[];for(let t=0,i=a.length;t<i;t++){const i=a[t],r=dye(i),o=uye(e,i);for(let e=0,a=o.length;e<a;e++)n.push({itemValue:o[e],attributes:r})}return n}(e,n.accessors),r={rankedValue:e,rank:rye,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let o=0;o<i.length;o++){const e=i[o];let t=sye(e.itemValue,a,n);const{minRanking:s,maxRanking:l,threshold:u=n.threshold}=e.attributes;t<s&&t>=iye?t=s:t>l&&(t=l),t=Math.min(t,l),t>=u&&t>r.rank&&(r.rank=t,r.passed=!0,r.accessorIndex=o,r.accessorThreshold=u,r.rankedValue=e.itemValue)}return r}function sye(e,a,n){return e=lye(e,n),(a=lye(a,n)).length>e.length?rye:e===a?Qfe:(e=e.toLowerCase())===(a=a.toLowerCase())?Xfe:e.startsWith(a)?eye:e.includes(` ${a}`)?aye:e.includes(a)?nye:1===a.length?rye:function(e){let a="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{a+=e.substr(0,1)}))})),a}(e).includes(a)?tye:function(e,a){let n=0,t=0;function i(e,a,t){for(let i=t,r=a.length;i<r;i++){if(a[i]===e)return n+=1,i+1}return-1}function r(e){return iye+n/a.length*(1/e)}const o=i(a[0],e,0);if(o<0)return rye;t=o;for(let s=1,l=a.length;s<l;s++){t=i(a[s],e,t);if(!(t>-1))return rye}return r(t-o)}(e,a)}function lye(e,a){let{keepDiacritics:n}=a;return e=`${e}`,n||(e=e.replace(Yfe,(e=>Zfe[e]))),e}function uye(e,a){let n=a;"object"==typeof a&&(n=a.accessor);const t=n(e);return null==t?[]:Array.isArray(t)?t:[String(t)]}var cye={maxRanking:1/0,minRanking:-1/0};function dye(e){return"function"==typeof e?cye:{...cye,...e}}var mye={data:""},hye=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,pye=/\/\*[^]*?\*\/| +/g,gye=/\n+/g,vye=(e,a)=>{let n="",t="",i="";for(let r in e){let o=e[r];"@"==r[0]?"i"==r[1]?n=r+" "+o+";":t+="f"==r[1]?vye(o,r):r+"{"+vye(o,"k"==r[1]?"":a)+"}":"object"==typeof o?t+=vye(o,a?a.replace(/([^,])+/g,(e=>r.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,(a=>/&/.test(a)?a.replace(/&/g,e):e?e+" "+a:a)))):r):null!=o&&(r=/^--/.test(r)?r:r.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=vye.p?vye.p(r,o):r+":"+o+";")}return n+(a&&i?a+"{"+i+"}":i)+t},fye={},yye=e=>{if("object"==typeof e){let a="";for(let n in e)a+=n+yye(e[n]);return a}return e};function kye(e){let a=this||{},n=e.call?e(a.p):e;return((e,a,n,t,i)=>{let r=yye(e),o=fye[r]||(fye[r]=(e=>{let a=0,n=11;for(;a<e.length;)n=101*n+e.charCodeAt(a++)>>>0;return"go"+n})(r));if(!fye[o]){let a=r!==e?e:(e=>{let a,n,t=[{}];for(;a=hye.exec(e.replace(pye,""));)a[4]?t.shift():a[3]?(n=a[3].replace(gye," ").trim(),t.unshift(t[0][n]=t[0][n]||{})):t[0][a[1]]=a[2].replace(gye," ").trim();return t[0]})(e);fye[o]=vye(i?{["@keyframes "+o]:a}:a,n?"":"."+o)}let s=n&&fye.g?fye.g:null;return n&&(fye.g=fye[o]),l=fye[o],u=a,c=t,(d=s)?u.data=u.data.replace(d,l):-1===u.data.indexOf(l)&&(u.data=c?l+u.data:u.data+l),o;var l,u,c,d})(n.unshift?n.raw?((e,a,n)=>e.reduce(((e,t,i)=>{let r=a[i];if(r&&r.call){let e=r(n),a=e&&e.props&&e.props.className||/^go/.test(e)&&e;r=a?"."+a:e&&"object"==typeof e?e.props?"":vye(e,""):!1===e?"":e}return e+t+(null==r?"":r)}),""))(n,[].slice.call(arguments,1),a.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(a.p):n)),{}):n,(t=a.target,"object"==typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||mye),a.g,a.o,a.k);var t}function bye(e){var a,n,t="";if("string"==typeof e||"number"==typeof e)t+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(a=0;a<i;a++)e[a]&&(n=bye(e[a]))&&(t&&(t+=" "),t+=n)}else for(n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function Sye(){for(var e,a,n=0,t="",i=arguments.length;n<i;n++)(e=arguments[n])&&(a=bye(e))&&(t&&(t+=" "),t+=a);return t}function Aye(e,a){const n=Ma(e),{onChange:t}=a;let i=new Set(a.appear?void 0:n);const r=new WeakSet,[o,s]=ka([],{equals:!1}),[l]=[ja,Pa],u=e=>{s((a=>(a.push.apply(a,e),a)));for(const a of e)r.delete(a)},c=(e,a,n)=>e.splice(n,0,a);return wa((a=>{const n=o(),s=e();if(Ma(l))return l(),a;if(n.length){const e=a.filter((e=>!n.includes(e)));return n.length=0,t({list:e,added:[],removed:[],unchanged:e,finishRemoved:u}),e}return Ma((()=>{const e=new Set(s),n=s.slice(),o=[],l=[],d=[];for(const a of s)(i.has(a)?d:o).push(a);let m=!o.length;for(let t=0;t<a.length;t++){const i=a[t];e.has(i)||(r.has(i)||(l.push(i),r.add(i)),c(n,i,t)),m&&i!==n[t]&&(m=!1)}return!l.length&&m?a:(t({list:n,added:o,removed:l,unchanged:d,finishRemoved:u}),i=e,n)}))}),a.appear?[]:n.slice())}function wye(...e){return a=e,(...e)=>{for(const n of a)n&&n(...e)};var a}kye.bind({g:1}),kye.bind({k:1});var Cye=e=>e instanceof Element;function Mye(e,a){if(a(e))return e;if("function"==typeof e&&!e.length)return Mye(e(),a);if(Array.isArray(e)){const n=[];for(const t of e){const e=Mye(t,a);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function Tye(e,a=Cye,n=Cye){const t=wa(e),i=wa((()=>Mye(t(),a)));return i.toArray=()=>{const e=i();return Array.isArray(e)?e:e?[e]:[]},i}function Nye(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function xye(e,a,n,t){const{onBeforeEnter:i,onEnter:r,onAfterEnter:o}=a;function s(a){a&&a.target!==n||(n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.enterActive),n.classList.remove(...e.enterTo),o?.(n))}i?.(n),n.classList.add(...e.enter),n.classList.add(...e.enterActive),queueMicrotask((()=>{if(!n.parentNode)return t?.();r?.(n,(()=>s()))})),Nye((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!r||r.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function Eye(e,a,n,t){const{onBeforeExit:i,onExit:r,onAfterExit:o}=a;if(!n.parentNode)return t?.();function s(a){a&&a.target!==n||(t?.(),n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.exitActive),n.classList.remove(...e.exitTo),o?.(n))}i?.(n),n.classList.add(...e.exit),n.classList.add(...e.exitActive),r?.(n,(()=>s())),Nye((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!r||r.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var Pye=e=>{const a=function(e){return wa((()=>{const a=e.name||"s";return{enterActive:(e.enterActiveClass||a+"-enter-active").split(" "),enter:(e.enterClass||a+"-enter").split(" "),enterTo:(e.enterToClass||a+"-enter-to").split(" "),exitActive:(e.exitActiveClass||a+"-exit-active").split(" "),exit:(e.exitClass||a+"-exit").split(" "),exitTo:(e.exitToClass||a+"-exit-to").split(" "),move:(e.moveClass||a+"-move").split(" ")}}))}(e);return Aye(Tye((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:t,finishRemoved:i,list:r}){const o=a();for(const a of n)xye(o,e,a);const s=[];for(const e of r)e.isConnected&&(e instanceof HTMLElement||e instanceof SVGElement)&&s.push({el:e,rect:e.getBoundingClientRect()});queueMicrotask((()=>{const e=[];for(const{el:a,rect:n}of s)if(a.isConnected){const t=a.getBoundingClientRect(),i=n.left-t.left,r=n.top-t.top;(i||r)&&(a.style.transform=`translate(${i}px, ${r}px)`,a.style.transitionDuration="0s",e.push(a))}document;for(const a of e){let e=function(n){(n.target===a||/transform$/.test(n.propertyName))&&(a.removeEventListener("transitionend",e),a.classList.remove(...o.move))};a.classList.add(...o.move),a.style.transform=a.style.transitionDuration="",a.addEventListener("transitionend",e)}}));for(const a of t)Eye(o,e,a,(()=>i([a])))}})},jye=Symbol("fallback");function Lye(e){for(const a of e)a.dispose()}function Bye(e){const{by:a}=e;return wa(function(e,a,n,t={}){const i=new Map;return xa((()=>Lye(i.values()))),()=>{const n=e()||[];return Ma((()=>{if(!n.length)return Lye(i.values()),i.clear(),t.fallback?[ya((e=>(i.set(jye,{dispose:e}),t.fallback())))]:[];const e=new Array(n.length),o=i.get(jye);if(!i.size||o){o?.dispose(),i.delete(jye);for(let t=0;t<n.length;t++){const i=n[t];r(e,i,t,a(i,t))}return e}const s=new Set(i.keys());for(let t=0;t<n.length;t++){const o=n[t],l=a(o,t);s.delete(l);const u=i.get(l);u?(e[t]=u.mapped,u.setIndex?.(t),u.setItem((()=>o))):r(e,o,t,l)}for(const a of s)i.get(a)?.dispose(),i.delete(a);return e}))};function r(e,a,t,r){ya((o=>{const[s,l]=ka(a),u={setItem:l,dispose:o};if(n.length>1){const[e,a]=ka(t);u.setIndex=a,u.mapped=n(s,e)}else u.mapped=n(s);i.set(r,u),e[t]=u.mapped}))}}((()=>e.each),"function"==typeof a?a:e=>e[a],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function zye(e,a,n,t){const i=()=>{jfe(Pfe(e)).forEach((e=>{e&&jfe(Pfe(a)).forEach((a=>function(e,a,n,t){return e.addEventListener(a,n,t),Lfe(e.removeEventListener.bind(e,a,n,t))}(e,a,n,t)))}))};"function"==typeof e?Aa(i):Sa(i)}function Rye(e,a,n){const t=new WeakMap,{observe:i,unobserve:r}=function(e,a){const n=new ResizeObserver(e);return xa(n.disconnect.bind(n)),{observe:e=>n.observe(e,a),unobserve:n.unobserve.bind(n)}}((e=>{for(const n of e){const{contentRect:e,target:i}=n,r=Math.round(e.width),o=Math.round(e.height),s=t.get(i);s&&s.width===r&&s.height===o||(a(e,i,n),t.set(i,{width:r,height:o}))}}),n);Aa((a=>{const n=jfe(Pfe(e)).filter(Efe);return function(e,a,n,t){const i=e.length,r=a.length;let o,s,l=0;if(r)if(i){for(;l<r&&a[l]===e[l];l++);for(o of(a=a.slice(l),e=e.slice(l),a))e.includes(o)||t(o);for(s of e)a.includes(s)||n(s)}else for(;l<r;l++)t(a[l]);else for(;l<i;l++)n(e[l])}(n,a,i,r),n}),[])}var _ye=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function Dye(e){const a={};let n;for(;n=_ye.exec(e);)a[n[1]]=n[2];return a}function Kye(e,a){if("string"==typeof e){if("string"==typeof a)return`${e};${a}`;e=Dye(e)}else"string"==typeof a&&(a=Dye(a));return{...e,...a}}function Hye(e,a){const n=[...e],t=n.indexOf(a);return-1!==t&&n.splice(t,1),n}function Oye(e){return"[object String]"===Object.prototype.toString.call(e)}function Iye(e){return a=>`${e()}-${a}`}function Gye(e,a){return!!e&&(e===a||e.contains(a))}function Vye(e,a=!1){const{activeElement:n}=Fye(e);if(!n?.nodeName)return null;if(Jye(n)&&n.contentDocument)return Vye(n.contentDocument.body,a);if(a){const e=n.getAttribute("aria-activedescendant");if(e){const a=Fye(n).getElementById(e);if(a)return a}}return n}function Fye(e){return e?e.ownerDocument||e:document}function Jye(e){return"IFRAME"===e.tagName}var Uye=(e=>(e.Escape="Escape",e.Enter="Enter",e.Tab="Tab",e.Space=" ",e.ArrowDown="ArrowDown",e.ArrowLeft="ArrowLeft",e.ArrowRight="ArrowRight",e.ArrowUp="ArrowUp",e.End="End",e.Home="Home",e.PageDown="PageDown",e.PageUp="PageUp",e))(Uye||{});function Wye(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function qye(){return Wye(/^Mac/i)}function Zye(){return Wye(/^iPhone/i)||Wye(/^iPad/i)||qye()&&navigator.maxTouchPoints>1}function $ye(e,a){return a&&("function"==typeof a?a(e):a[0](a[1],e)),e?.defaultPrevented}function Yye(e){return a=>{for(const n of e)$ye(a,n)}}function Qye(e){return qye()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function Xye(e){if(e)if(function(){if(null==eke){eke=!1;try{document.createElement("div").focus({get preventScroll(){return eke=!0,!0}})}catch(uBe){}}return eke}())e.focus({preventScroll:!0});else{const a=function(e){let a=e.parentNode;const n=[],t=document.scrollingElement||document.documentElement;for(;a instanceof HTMLElement&&a!==t;)(a.offsetHeight<a.scrollHeight||a.offsetWidth<a.scrollWidth)&&n.push({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}),a=a.parentNode;t instanceof HTMLElement&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft});return n}(e);e.focus(),function(e){for(const{element:a,scrollTop:n,scrollLeft:t}of e)a.scrollTop=n,a.scrollLeft=t}(a)}}var eke=null;var ake=["input:not([type='hidden']):not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","[tabindex]","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])"],nke=[...ake,'[tabindex]:not([tabindex="-1"]):not([disabled])'],tke=ake.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",ike=nke.join(':not([hidden]):not([tabindex="-1"]),');function rke(e,a){const n=Array.from(e.querySelectorAll(tke)).filter(oke);return a&&oke(e)&&n.unshift(e),n.forEach(((e,a)=>{if(Jye(e)&&e.contentDocument){const t=rke(e.contentDocument.body,!1);n.splice(a,1,...t)}})),n}function oke(e){return ske(e)&&!function(e){const a=parseInt(e.getAttribute("tabindex")||"0",10);return a<0}(e)}function ske(e){return e.matches(tke)&&lke(e)}function lke(e,a){return"#comment"!==e.nodeName&&function(e){if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const{display:a,visibility:n}=e.style;let t="none"!==a&&"hidden"!==n&&"collapse"!==n;if(t){if(!e.ownerDocument.defaultView)return t;const{getComputedStyle:a}=e.ownerDocument.defaultView,{display:n,visibility:i}=a(e);t="none"!==n&&"hidden"!==i&&"collapse"!==i}return t}(e)&&function(e,a){return!e.hasAttribute("hidden")&&("DETAILS"!==e.nodeName||!a||"SUMMARY"===a.nodeName||e.hasAttribute("open"))}(e,a)&&(!e.parentElement||lke(e.parentElement,e))}function uke(e){for(;e&&!cke(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function cke(e){const a=window.getComputedStyle(e);return/(auto|scroll)/.test(a.overflow+a.overflowX+a.overflowY)}function dke(){}function mke(e,a){return rn(e,a)}var hke=new Map,pke=new Set;function gke(){if("undefined"==typeof window)return;const e=a=>{if(!a.target)return;const n=hke.get(a.target);if(n&&(n.delete(a.propertyName),0===n.size&&(a.target.removeEventListener("transitioncancel",e),hke.delete(a.target)),0===hke.size)){for(const e of pke)e();pke.clear()}};document.body.addEventListener("transitionrun",(a=>{if(!a.target)return;let n=hke.get(a.target);n||(n=new Set,hke.set(a.target,n),a.target.addEventListener("transitioncancel",e)),n.add(a.propertyName)})),document.body.addEventListener("transitionend",e)}function vke(e,a){const n=fke(e,a,"left"),t=fke(e,a,"top"),i=a.offsetWidth,r=a.offsetHeight;let o=e.scrollLeft,s=e.scrollTop;const l=o+e.offsetWidth,u=s+e.offsetHeight;n<=o?o=n:n+i>l&&(o+=n+i-l),t<=s?s=t:t+r>u&&(s+=t+r-u),e.scrollLeft=o,e.scrollTop=s}function fke(e,a,n){const t="left"===n?"offsetLeft":"offsetTop";let i=0;for(;a.offsetParent&&(i+=a[t],a.offsetParent!==e);){if(a.offsetParent.contains(e)){i-=e[t];break}a=a.offsetParent}return i}"undefined"!=typeof document&&("loading"!==document.readyState?gke():document.addEventListener("DOMContentLoaded",gke));var yke={border:"0",clip:"rect(0 0 0 0)","clip-path":"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:"0",position:"absolute",width:"1px","white-space":"nowrap"};function kke(e){return a=>(e(a),()=>e(void 0))}function bke(e,a){const[n,t]=ka(Ske(a?.()));return Aa((()=>{t(e()?.tagName.toLowerCase()||Ske(a?.()))})),n}function Ske(e){return Oye(e)?e:void 0}function Ake(e){const[a,n]=on(e,["as"]);if(!a.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return Xa(Fn,rn(n,{get component(){return a.as}}))}var wke=["id","name","validationState","required","disabled","readOnly"];var Cke=Ba();function Mke(){const e=za(Cke);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function Tke(e){const a=Mke(),n=mke({id:a.generateId("description")},e);return Aa((()=>xa(a.registerDescription(n.id)))),Xa(Ake,rn({as:"div"},(()=>a.dataset()),n))}function Nke(e){const a=Mke(),n=mke({id:a.generateId("error-message")},e),[t,i]=on(n,["forceMount"]),r=()=>"invalid"===a.validationState();return Aa((()=>{r()&&xa(a.registerErrorMessage(i.id))})),Xa(hn,{get when(){return t.forceMount||r()},get children(){return Xa(Ake,rn({as:"div"},(()=>a.dataset()),i))}})}function xke(e){let a;const n=Mke(),t=mke({id:n.generateId("label")},e),[i,r]=on(t,["ref"]),o=bke((()=>a),(()=>"label"));return Aa((()=>xa(n.registerLabel(r.id)))),Xa(Ake,rn({as:"label",ref(e){const n=wye((e=>a=e),i.ref);"function"==typeof n&&n(e)},get for(){return wa((()=>"label"===o()))()?n.fieldId():void 0}},(()=>n.dataset()),r))}function Eke(e,a){Aa(Ta(e,(e=>{if(null==e)return;const n=function(e){return function(e){return e.matches("textarea, input, select, button")}(e)?e.form:e.closest("form")}(e);null!=n&&(n.addEventListener("reset",a,{passive:!0}),xa((()=>{n.removeEventListener("reset",a)})))})))}function Pke(e){const[a,n]=ka(e.defaultValue?.()),t=wa((()=>void 0!==e.value?.())),i=wa((()=>t()?e.value?.():a()));return[i,a=>{Ma((()=>{const r=function(e,...a){return"function"==typeof e?e(...a):e}(a,i());return Object.is(r,i())||(t()||n(r),e.onChange?.(r)),r}))}]}function jke(e){const[a,n]=Pke(e);return[()=>a()??!1,n]}var Lke=Object.defineProperty,Bke=(e,a)=>{for(var n in a)Lke(e,n,{get:a[n],enumerable:!0})},zke=Ba();function Rke(){return za(zke)}function _ke(e,a){return Boolean(a.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Dke(e,a){const n=function(e){const a=e.map(((e,a)=>[a,e]));let n=!1;return a.sort((([e,a],[t,i])=>{const r=a.ref(),o=i.ref();return r===o?0:r&&o?_ke(r,o)?(e>t&&(n=!0),-1):(e<t&&(n=!0),1):0})),n?a.map((([e,a])=>a)):e}(e);e!==n&&a(n)}function Kke(e,a){if("function"!=typeof IntersectionObserver)return void function(e,a){Aa((()=>{const n=setTimeout((()=>{Dke(e(),a)}));xa((()=>clearTimeout(n)))}))}(e,a);let n=[];Aa((()=>{const t=function(e){const a=e[0],n=e[e.length-1]?.ref();let t=a?.ref()?.parentElement;for(;t;){if(n&&t.contains(n))return t;t=t.parentElement}return Fye(t).body}(e()),i=new IntersectionObserver((()=>{const t=!!n.length;n=e(),t&&Dke(e(),a)}),{root:t});for(const a of e()){const e=a.ref();e&&i.observe(e)}xa((()=>i.disconnect()))}))}function Hke(e={}){const[a,n]=function(e){const[a,n]=Pke(e);return[()=>a()??[],n]}({value:()=>Pfe(e.items),onChange:a=>e.onItemsChange?.(a)});Kke(a,n);const t=e=>(n((a=>{const n=function(e,a){const n=a.ref();if(!n)return-1;let t=e.length;if(!t)return-1;for(;t--;){const a=e[t]?.ref();if(a&&_ke(a,n))return t+1}return 0}(a,e);return function(e,a,n=-1){return n in e?[...e.slice(0,n),a,...e.slice(n)]:[...e,a]}(a,e,n)})),()=>{n((a=>{const n=a.filter((a=>a.ref()!==e.ref()));return a.length===n.length?a:n}))});return{DomCollectionProvider:e=>Xa(zke.Provider,{value:{registerItem:t},get children(){return e.children}})}}function Oke(e){const a=function(){const e=Rke();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=mke({shouldRegisterItem:!0},e);Aa((()=>{if(!n.shouldRegisterItem)return;xa(a.registerItem(n.getItem()))}))}function Ike(e){let a=e.startIndex??0;const n=e.startLevel??0,t=[],i=a=>{if(null==a)return"";const n=e.getKey??"key",t=Oye(n)?a[n]:n(a);return null!=t?String(t):""},r=a=>{if(null==a)return"";const n=e.getTextValue??"textValue",t=Oye(n)?a[n]:n(a);return null!=t?String(t):""},o=a=>{if(null==a)return!1;const n=e.getDisabled??"disabled";return(Oye(n)?a[n]:n(a))??!1},s=a=>{if(null!=a)return Oye(e.getSectionChildren)?a[e.getSectionChildren]:e.getSectionChildren?.(a)};for(const l of e.dataSource)if(Oye(l)||"number"==typeof l)t.push({type:"item",rawValue:l,key:String(l),textValue:String(l),disabled:o(l),level:n,index:a}),a++;else if(null!=s(l)){t.push({type:"section",rawValue:l,key:"",textValue:"",disabled:!1,level:n,index:a}),a++;const i=s(l)??[];if(i.length>0){const r=Ike({dataSource:i,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:a,startLevel:n+1});t.push(...r),a+=r.length}}else t.push({type:"item",rawValue:l,key:i(l),textValue:r(l),disabled:o(l),level:n,index:a}),a++;return t}function Gke(e,a=[]){return wa((()=>{const n=Ike({dataSource:Pfe(e.dataSource),getKey:Pfe(e.getKey),getTextValue:Pfe(e.getTextValue),getDisabled:Pfe(e.getDisabled),getSectionChildren:Pfe(e.getSectionChildren)});for(let e=0;e<a.length;e++)a[e]();return e.factory(n)}))}var Vke=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Fke=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Jke(e){return function(e){if(Intl.Locale){const a=new Intl.Locale(e).maximize().script??"";return Vke.has(a)}const a=e.split("-")[0];return Fke.has(a)}(e)?"rtl":"ltr"}function Uke(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Jke(e)}}var Wke=Uke(),qke=new Set;function Zke(){Wke=Uke();for(const e of qke)e(Wke)}var $ke=Ba();function Yke(){const e=function(){const[e,a]=ka(Wke),n=wa((()=>e()));return Na((()=>{0===qke.size&&window.addEventListener("languagechange",Zke),qke.add(a),xa((()=>{qke.delete(a),0===qke.size&&window.removeEventListener("languagechange",Zke)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return za($ke)||e}var Qke=new Map;var Xke=class e extends Set{anchorKey;currentKey;constructor(a,n,t){super(a),a instanceof e?(this.anchorKey=n||a.anchorKey,this.currentKey=t||a.currentKey):(this.anchorKey=n,this.currentKey=t)}};function ebe(e){return qye()||Zye()?e.altKey:e.ctrlKey}function abe(e){return qye()?e.metaKey:e.ctrlKey}function nbe(e){return new Xke(e)}function tbe(e){const a=mke({selectionMode:"none",selectionBehavior:"toggle"},e),[n,t]=ka(!1),[i,r]=ka(),o=wa((()=>{const e=Pfe(a.selectedKeys);return null!=e?nbe(e):e})),s=wa((()=>{const e=Pfe(a.defaultSelectedKeys);return null!=e?nbe(e):new Xke})),[l,u]=function(e){const[a,n]=Pke(e);return[()=>a()??new Xke,n]}({value:o,defaultValue:s,onChange:e=>a.onSelectionChange?.(e)}),[c,d]=ka(Pfe(a.selectionBehavior));return Aa((()=>{const e=l();"replace"===Pfe(a.selectionBehavior)&&"toggle"===c()&&"object"==typeof e&&0===e.size&&d("replace")})),Aa((()=>{d(Pfe(a.selectionBehavior)??"toggle")})),{selectionMode:()=>Pfe(a.selectionMode),disallowEmptySelection:()=>Pfe(a.disallowEmptySelection)??!1,selectionBehavior:c,setSelectionBehavior:d,isFocused:n,setFocused:t,focusedKey:i,setFocusedKey:r,selectedKeys:l,setSelectedKeys:e=>{!Pfe(a.allowDuplicateSelectionEvents)&&function(e,a){if(e.size!==a.size)return!1;for(const n of e)if(!a.has(n))return!1;return!0}(e,l())||u(e)}}}function ibe(e,a,n){const t=rn({selectOnFocus:()=>"replace"===Pfe(e.selectionManager).selectionBehavior()},e),i=()=>a(),{direction:r}=Yke();let o={top:0,left:0};zye((()=>Pfe(t.isVirtualized)?void 0:i()),"scroll",(()=>{const e=i();e&&(o={top:e.scrollTop,left:e.scrollLeft})}));const{typeSelectHandlers:s}=function(e){const[a,n]=ka(""),[t,i]=ka(-1);return{typeSelectHandlers:{onKeyDown:r=>{if(Pfe(e.isDisabled))return;const o=Pfe(e.keyboardDelegate),s=Pfe(e.selectionManager);if(!o.getKeyForSearch)return;const l=function(e){return 1!==e.length&&/^[A-Z]/i.test(e)?"":e}(r.key);if(!l||r.ctrlKey||r.metaKey)return;" "===l&&a().trim().length>0&&(r.preventDefault(),r.stopPropagation());let u=n((e=>e+l)),c=o.getKeyForSearch(u,s.focusedKey())??o.getKeyForSearch(u);null==c&&function(e){return e.split("").every((a=>a===e[0]))}(u)&&(u=u[0],c=o.getKeyForSearch(u,s.focusedKey())??o.getKeyForSearch(u)),null!=c&&(s.setFocusedKey(c),e.onTypeSelect?.(c)),clearTimeout(t()),i(window.setTimeout((()=>n("")),500))}}}}({isDisabled:()=>Pfe(t.disallowTypeAhead),keyboardDelegate:()=>Pfe(t.keyboardDelegate),selectionManager:()=>Pfe(t.selectionManager)}),l=()=>Pfe(t.orientation)??"vertical",u=()=>{const e=Pfe(t.autoFocus);if(!e)return;const n=Pfe(t.selectionManager),i=Pfe(t.keyboardDelegate);let r;"first"===e&&(r=i.getFirstKey?.()),"last"===e&&(r=i.getLastKey?.());const o=n.selectedKeys();o.size&&(r=o.values().next().value),n.setFocused(!0),n.setFocusedKey(r);const s=a();s&&null==r&&!Pfe(t.shouldUseVirtualFocus)&&Xye(s)};Na((()=>{t.deferAutoFocus?setTimeout(u,0):u()})),Aa(Ta([i,()=>Pfe(t.isVirtualized),()=>Pfe(t.selectionManager).focusedKey()],(e=>{const[a,n,i]=e;if(n)i&&t.scrollToKey?.(i);else if(i&&a){const e=a.querySelector(`[data-key="${i}"]`);e&&vke(a,e)}})));return{tabIndex:wa((()=>{if(!Pfe(t.shouldUseVirtualFocus))return null==Pfe(t.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{$ye(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=a();if(!n?.contains(e.target))return;const i=Pfe(t.selectionManager),o=Pfe(t.selectOnFocus),u=a=>{null!=a&&(i.setFocusedKey(a),e.shiftKey&&"multiple"===i.selectionMode()?i.extendSelection(a):o&&!ebe(e)&&i.replaceSelection(a))},c=Pfe(t.keyboardDelegate),d=Pfe(t.shouldFocusWrap),m=i.focusedKey();switch(e.key){case"vertical"===l()?"ArrowDown":"ArrowRight":if(c.getKeyBelow){let a;e.preventDefault(),a=null!=m?c.getKeyBelow(m):c.getFirstKey?.(),null==a&&d&&(a=c.getFirstKey?.(m)),u(a)}break;case"vertical"===l()?"ArrowUp":"ArrowLeft":if(c.getKeyAbove){let a;e.preventDefault(),a=null!=m?c.getKeyAbove(m):c.getLastKey?.(),null==a&&d&&(a=c.getLastKey?.(m)),u(a)}break;case"vertical"===l()?"ArrowLeft":"ArrowUp":if(c.getKeyLeftOf){e.preventDefault();const a="rtl"===r();let n;n=null!=m?c.getKeyLeftOf(m):a?c.getFirstKey?.():c.getLastKey?.(),u(n)}break;case"vertical"===l()?"ArrowRight":"ArrowDown":if(c.getKeyRightOf){e.preventDefault();const a="rtl"===r();let n;n=null!=m?c.getKeyRightOf(m):a?c.getLastKey?.():c.getFirstKey?.(),u(n)}break;case"Home":if(c.getFirstKey){e.preventDefault();const a=c.getFirstKey(m,abe(e));null!=a&&(i.setFocusedKey(a),abe(e)&&e.shiftKey&&"multiple"===i.selectionMode()?i.extendSelection(a):o&&i.replaceSelection(a))}break;case"End":if(c.getLastKey){e.preventDefault();const a=c.getLastKey(m,abe(e));null!=a&&(i.setFocusedKey(a),abe(e)&&e.shiftKey&&"multiple"===i.selectionMode()?i.extendSelection(a):o&&i.replaceSelection(a))}break;case"PageDown":if(c.getKeyPageBelow&&null!=m){e.preventDefault();u(c.getKeyPageBelow(m))}break;case"PageUp":if(c.getKeyPageAbove&&null!=m){e.preventDefault();u(c.getKeyPageAbove(m))}break;case"a":abe(e)&&"multiple"===i.selectionMode()&&!0!==Pfe(t.disallowSelectAll)&&(e.preventDefault(),i.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),Pfe(t.disallowEmptySelection)||i.clearSelection());break;case"Tab":if(!Pfe(t.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,a){const n=a?.tabbable?ike:tke,t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>a?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&lke(e)&&(!a?.accept||a.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});return a?.from&&(t.currentNode=a.from),t}(n,{tabbable:!0});let a,t;do{t=e.lastChild(),t&&(a=t)}while(t);a&&!a.contains(document.activeElement)&&Xye(a)}break}}},onMouseDown:e=>{i()===e.target&&e.preventDefault()},onFocusIn:e=>{const a=Pfe(t.selectionManager),n=Pfe(t.keyboardDelegate),r=Pfe(t.selectOnFocus);if(a.isFocused())e.currentTarget.contains(e.target)||a.setFocused(!1);else if(e.currentTarget.contains(e.target))if(a.setFocused(!0),null==a.focusedKey()){const t=e=>{null!=e&&(a.setFocusedKey(e),r&&a.replaceSelection(e))},i=e.relatedTarget;i&&e.currentTarget.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING?t(a.lastSelectedKey()??n.getLastKey?.()):t(a.firstSelectedKey()??n.getFirstKey?.())}else if(!Pfe(t.isVirtualized)){const e=i();if(e){e.scrollTop=o.top,e.scrollLeft=o.left;const n=e.querySelector(`[data-key="${a.focusedKey()}"]`);n&&(Xye(n),vke(e,n))}}},onFocusOut:e=>{const a=Pfe(t.selectionManager);e.currentTarget.contains(e.relatedTarget)||a.setFocused(!1)}}}function rbe(e,a){const n=()=>Pfe(e.selectionManager),t=()=>Pfe(e.key),i=()=>Pfe(e.shouldUseVirtualFocus),r=e=>{"none"!==n().selectionMode()&&("single"===n().selectionMode()?n().isSelected(t())&&!n().disallowEmptySelection()?n().toggleSelection(t()):n().replaceSelection(t()):e?.shiftKey?n().extendSelection(t()):"toggle"===n().selectionBehavior()||abe(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(t()):n().replaceSelection(t()))},o=()=>Pfe(e.disabled)||n().isDisabled(t()),s=()=>!o()&&n().canSelectItem(t());let l=null;const u=wa((()=>{if(!i()&&!o())return t()===n().focusedKey()?0:-1})),c=wa((()=>Pfe(e.virtualized)?void 0:t()));return Aa(Ta([a,t,i,()=>n().focusedKey(),()=>n().isFocused()],(([a,n,t,i,r])=>{a&&n===i&&r&&!t&&document.activeElement!==a&&(e.focus?e.focus():Xye(a))}))),{isSelected:()=>n().isSelected(t()),isDisabled:o,allowsSelection:s,tabIndex:u,dataKey:c,onPointerDown:a=>{s()&&(l=a.pointerType,"mouse"!==a.pointerType||0!==a.button||Pfe(e.shouldSelectOnPressUp)||r(a))},onPointerUp:a=>{s()&&"mouse"===a.pointerType&&0===a.button&&Pfe(e.shouldSelectOnPressUp)&&Pfe(e.allowsDifferentPressOrigin)&&r(a)},onClick:a=>{s()&&(Pfe(e.shouldSelectOnPressUp)&&!Pfe(e.allowsDifferentPressOrigin)||"mouse"!==l)&&r(a)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(ebe(e)?n().toggleSelection(t()):r(e))},onMouseDown:e=>{o()&&e.preventDefault()},onFocus:e=>{const r=a();i()||o()||!r||e.target===r&&n().setFocusedKey(t())}}}var obe=class{collection;state;constructor(e,a){this.collection=e,this.state=a}selectionMode(){return this.state.selectionMode()}disallowEmptySelection(){return this.state.disallowEmptySelection()}selectionBehavior(){return this.state.selectionBehavior()}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}isFocused(){return this.state.isFocused()}setFocused(e){this.state.setFocused(e)}focusedKey(){return this.state.focusedKey()}setFocusedKey(e){(null==e||this.collection().getItem(e))&&this.state.setFocusedKey(e)}selectedKeys(){return this.state.selectedKeys()}isSelected(e){if("none"===this.state.selectionMode())return!1;const a=this.getKey(e);return null!=a&&this.state.selectedKeys().has(a)}isEmpty(){return 0===this.state.selectedKeys().size}isSelectAll(){if(this.isEmpty())return!1;const e=this.state.selectedKeys();return this.getAllSelectableKeys().every((a=>e.has(a)))}firstSelectedKey(){let e;for(const a of this.state.selectedKeys()){const n=this.collection().getItem(a);e&&!(null!=n?.index&&null!=e?.index&&n.index<e.index)||(e=n)}return e?.key}lastSelectedKey(){let e;for(const a of this.state.selectedKeys()){const n=this.collection().getItem(a);e&&!(null!=n?.index&&null!=e?.index&&n.index>e.index)||(e=n)}return e?.key}extendSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode())return void this.replaceSelection(e);const a=this.getKey(e);if(null==a)return;const n=this.state.selectedKeys(),t=n.anchorKey||a,i=new Xke(n,t,a);for(const r of this.getKeyRange(t,n.currentKey||a))i.delete(r);for(const r of this.getKeyRange(a,t))this.canSelectItem(r)&&i.add(r);this.state.setSelectedKeys(i)}getKeyRange(e,a){const n=this.collection().getItem(e),t=this.collection().getItem(a);return n&&t?null!=n.index&&null!=t.index&&n.index<=t.index?this.getKeyRangeInternal(e,a):this.getKeyRangeInternal(a,e):[]}getKeyRangeInternal(e,a){const n=[];let t=e;for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&n.push(t),t===a)return n;t=this.collection().getKeyAfter(t)}return[]}getKey(e){const a=this.collection().getItem(e);return a?a&&"item"===a.type?a.key:null:e}toggleSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode()&&!this.isSelected(e))return void this.replaceSelection(e);const a=this.getKey(e);if(null==a)return;const n=new Xke(this.state.selectedKeys());n.has(a)?n.delete(a):this.canSelectItem(a)&&(n.add(a),n.anchorKey=a,n.currentKey=a),this.disallowEmptySelection()&&0===n.size||this.state.setSelectedKeys(n)}replaceSelection(e){if("none"===this.selectionMode())return;const a=this.getKey(e);if(null==a)return;const n=this.canSelectItem(a)?new Xke([a],a,a):new Xke;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const a=new Xke;for(const n of e){const e=this.getKey(n);if(null!=e&&(a.add(e),"single"===this.selectionMode()))break}this.state.setSelectedKeys(a)}selectAll(){"multiple"===this.selectionMode()&&this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()))}clearSelection(){const e=this.state.selectedKeys();!this.disallowEmptySelection()&&e.size>0&&this.state.setSelectedKeys(new Xke)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,a){"none"!==this.selectionMode()&&("single"===this.selectionMode()?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):"toggle"===this.selectionBehavior()||a&&"touch"===a.pointerType?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;const a=this.selectedKeys();if(e.size!==a.size)return!1;for(const n of e)if(!a.has(n))return!1;for(const n of a)if(!e.has(n))return!1;return!0}canSelectItem(e){if("none"===this.state.selectionMode())return!1;const a=this.collection().getItem(e);return null!=a&&!a.disabled}isDisabled(e){const a=this.collection().getItem(e);return!a||a.disabled}getAllSelectableKeys(){const e=[];return(a=>{for(;null!=a;){if(this.canSelectItem(a)){const n=this.collection().getItem(a);if(!n)continue;"item"===n.type&&e.push(a)}a=this.collection().getKeyAfter(a)}})(this.collection().getFirstKey()),e}},sbe=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(const t of e)this.keyMap.set(t.key,t);if(0===this.keyMap.size)return;let a,n=0;for(const[t,i]of this.keyMap)a?(a.nextKey=t,i.prevKey=a.key):(this.firstKey=t,i.prevKey=void 0),"item"===i.type&&(i.index=n++),a=i,a.nextKey=void 0;this.lastKey=a.key}*[Symbol.iterator](){yield*this.iterable}getSize(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey}getKeyAfter(e){return this.keyMap.get(e)?.nextKey}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const a=[...this.getKeys()];return this.getItem(a[e])}};var lbe,ube=e=>"function"==typeof e?e():e,cbe=e=>{const a=wa((()=>{const a=ube(e.element);if(a)return getComputedStyle(a)})),n=()=>a()?.animationName??"none",[t,i]=ka(ube(e.show)?"present":"hidden");let r="none";return Aa((t=>{const o=ube(e.show);return Ma((()=>{if(t===o)return o;const e=r,s=n();if(o)i("present");else if("none"===s||"none"===a()?.display)i("hidden");else{i(!0===t&&e!==s?"hiding":"hidden")}})),o})),Aa((()=>{const a=ube(e.element);if(!a)return;const o=e=>{e.target===a&&(r=n())},s=e=>{const r=n().includes(e.animationName);e.target===a&&r&&"hiding"===t()&&i("hidden")};a.addEventListener("animationstart",o),a.addEventListener("animationcancel",s),a.addEventListener("animationend",s),xa((()=>{a.removeEventListener("animationstart",o),a.removeEventListener("animationcancel",s),a.removeEventListener("animationend",s)}))})),{present:()=>"present"===t()||"hiding"===t(),state:t}},dbe="data-kb-top-layer",mbe=!1,hbe=[];function pbe(e){return hbe.findIndex((a=>a.node===e))}function gbe(){return hbe.filter((e=>e.isPointerBlocking))}function vbe(){return gbe().length>0}function fbe(e){const a=pbe([...gbe()].slice(-1)[0]?.node);return pbe(e)<a}var ybe={layers:hbe,isTopMostLayer:function(e){return hbe[hbe.length-1].node===e},hasPointerBlockingLayer:vbe,isBelowPointerBlockingLayer:fbe,addLayer:function(e){hbe.push(e)},removeLayer:function(e){const a=pbe(e);a<0||hbe.splice(a,1)},indexOf:pbe,find:function(e){return hbe[pbe(e)]},assignPointerEventToLayers:function(){for(const{node:e}of hbe)e.style.pointerEvents=fbe(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(vbe()&&!mbe){const a=Fye(e);lbe=document.body.style.pointerEvents,a.body.style.pointerEvents="none",mbe=!0}},restoreBodyPointerEvents:function(e){if(vbe())return;const a=Fye(e);a.body.style.pointerEvents=lbe,0===a.body.style.length&&a.body.removeAttribute("style"),mbe=!1}};Bke({},{Button:()=>Sbe,Root:()=>bbe});var kbe=["button","color","file","image","reset","submit"];function bbe(e){let a;const n=mke({type:"button"},e),[t,i]=on(n,["ref","type","disabled"]),r=bke((()=>a),(()=>"button")),o=wa((()=>{const e=r();return null!=e&&function(e){const a=e.tagName.toLowerCase();return"button"===a||!("input"!==a||!e.type)&&-1!==kbe.indexOf(e.type)}({tagName:e,type:t.type})})),s=wa((()=>"input"===r())),l=wa((()=>"a"===r()&&null!=a?.getAttribute("href")));return Xa(Ake,rn({as:"button",ref(e){const n=wye((e=>a=e),t.ref);"function"==typeof n&&n(e)},get type(){return o()||s()?t.type:void 0},get role(){return o()||l()?void 0:"button"},get tabIndex(){return o()||l()||t.disabled?void 0:0},get disabled(){return o()||s()?t.disabled:void 0},get"aria-disabled"(){return!(o()||s()||!t.disabled)||void 0},get"data-disabled"(){return t.disabled?"":void 0}},i))}var Sbe=bbe,Abe=["top","right","bottom","left"],wbe=Math.min,Cbe=Math.max,Mbe=Math.round,Tbe=Math.floor,Nbe=e=>({x:e,y:e}),xbe={left:"right",right:"left",bottom:"top",top:"bottom"},Ebe={start:"end",end:"start"};function Pbe(e,a,n){return Cbe(e,wbe(a,n))}function jbe(e,a){return"function"==typeof e?e(a):e}function Lbe(e){return e.split("-")[0]}function Bbe(e){return e.split("-")[1]}function zbe(e){return"x"===e?"y":"x"}function Rbe(e){return"y"===e?"height":"width"}function _be(e){return["top","bottom"].includes(Lbe(e))?"y":"x"}function Dbe(e){return zbe(_be(e))}function Kbe(e){return e.replace(/start|end/g,(e=>Ebe[e]))}function Hbe(e){return e.replace(/left|right|bottom|top/g,(e=>xbe[e]))}function Obe(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Ibe(e){const{x:a,y:n,width:t,height:i}=e;return{width:t,height:i,top:n,left:a,right:a+t,bottom:n+i,x:a,y:n}}function Gbe(e,a,n){let{reference:t,floating:i}=e;const r=_be(a),o=Dbe(a),s=Rbe(o),l=Lbe(a),u="y"===r,c=t.x+t.width/2-i.width/2,d=t.y+t.height/2-i.height/2,m=t[s]/2-i[s]/2;let h;switch(l){case"top":h={x:c,y:t.y-i.height};break;case"bottom":h={x:c,y:t.y+t.height};break;case"right":h={x:t.x+t.width,y:d};break;case"left":h={x:t.x-i.width,y:d};break;default:h={x:t.x,y:t.y}}switch(Bbe(a)){case"start":h[o]-=m*(n&&u?-1:1);break;case"end":h[o]+=m*(n&&u?-1:1)}return h}async function Vbe(e,a){var n;void 0===a&&(a={});const{x:t,y:i,platform:r,rects:o,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:m=!1,padding:h=0}=jbe(a,e),p=Obe(h),g=s[m?"floating"===d?"reference":"floating":d],v=Ibe(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(g)))||n?g:g.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),f="floating"===d?{x:t,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),k=await(null==r.isElement?void 0:r.isElement(y))&&await(null==r.getScale?void 0:r.getScale(y))||{x:1,y:1},b=Ibe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:f,offsetParent:y,strategy:l}):f);return{top:(v.top-b.top+p.top)/k.y,bottom:(b.bottom-v.bottom+p.bottom)/k.y,left:(v.left-b.left+p.left)/k.x,right:(b.right-v.right+p.right)/k.x}}function Fbe(e,a){return{top:e.top-a.height,right:e.right-a.width,bottom:e.bottom-a.height,left:e.left-a.width}}function Jbe(e){return Abe.some((a=>e[a]>=0))}function Ube(e){return Zbe(e)?(e.nodeName||"").toLowerCase():"#document"}function Wbe(e){var a;return(null==e||null==(a=e.ownerDocument)?void 0:a.defaultView)||window}function qbe(e){var a;return null==(a=(Zbe(e)?e.ownerDocument:e.document)||window.document)?void 0:a.documentElement}function Zbe(e){return e instanceof Node||e instanceof Wbe(e).Node}function $be(e){return e instanceof Element||e instanceof Wbe(e).Element}function Ybe(e){return e instanceof HTMLElement||e instanceof Wbe(e).HTMLElement}function Qbe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Wbe(e).ShadowRoot)}function Xbe(e){const{overflow:a,overflowX:n,overflowY:t,display:i}=rSe(e);return/auto|scroll|overlay|hidden|clip/.test(a+t+n)&&!["inline","contents"].includes(i)}function eSe(e){return["table","td","th"].includes(Ube(e))}function aSe(e){return[":popover-open",":modal"].some((a=>{try{return e.matches(a)}catch(uBe){return!1}}))}function nSe(e){const a=tSe(),n=$be(e)?rSe(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!a&&!!n.backdropFilter&&"none"!==n.backdropFilter||!a&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function tSe(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function iSe(e){return["html","body","#document"].includes(Ube(e))}function rSe(e){return Wbe(e).getComputedStyle(e)}function oSe(e){return $be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sSe(e){if("html"===Ube(e))return e;const a=e.assignedSlot||e.parentNode||Qbe(e)&&e.host||qbe(e);return Qbe(a)?a.host:a}function lSe(e){const a=sSe(e);return iSe(a)?e.ownerDocument?e.ownerDocument.body:e.body:Ybe(a)&&Xbe(a)?a:lSe(a)}function uSe(e,a,n){var t;void 0===a&&(a=[]),void 0===n&&(n=!0);const i=lSe(e),r=i===(null==(t=e.ownerDocument)?void 0:t.body),o=Wbe(i);return r?a.concat(o,o.visualViewport||[],Xbe(i)?i:[],o.frameElement&&n?uSe(o.frameElement):[]):a.concat(i,uSe(i,[],n))}function cSe(e){const a=rSe(e);let n=parseFloat(a.width)||0,t=parseFloat(a.height)||0;const i=Ybe(e),r=i?e.offsetWidth:n,o=i?e.offsetHeight:t,s=Mbe(n)!==r||Mbe(t)!==o;return s&&(n=r,t=o),{width:n,height:t,$:s}}function dSe(e){return $be(e)?e:e.contextElement}function mSe(e){const a=dSe(e);if(!Ybe(a))return Nbe(1);const n=a.getBoundingClientRect(),{width:t,height:i,$:r}=cSe(a);let o=(r?Mbe(n.width):n.width)/t,s=(r?Mbe(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var hSe=Nbe(0);function pSe(e){const a=Wbe(e);return tSe()&&a.visualViewport?{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}:hSe}function gSe(e,a,n,t){void 0===a&&(a=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=dSe(e);let o=Nbe(1);a&&(t?$be(t)&&(o=mSe(t)):o=mSe(e));const s=function(e,a,n){return void 0===a&&(a=!1),!(!n||a&&n!==Wbe(e))&&a}(r,n,t)?pSe(r):Nbe(0);let l=(i.left+s.x)/o.x,u=(i.top+s.y)/o.y,c=i.width/o.x,d=i.height/o.y;if(r){const e=Wbe(r),a=t&&$be(t)?Wbe(t):t;let n=e,i=n.frameElement;for(;i&&t&&a!==n;){const e=mSe(i),a=i.getBoundingClientRect(),t=rSe(i),r=a.left+(i.clientLeft+parseFloat(t.paddingLeft))*e.x,o=a.top+(i.clientTop+parseFloat(t.paddingTop))*e.y;l*=e.x,u*=e.y,c*=e.x,d*=e.y,l+=r,u+=o,n=Wbe(i),i=n.frameElement}}return Ibe({width:c,height:d,x:l,y:u})}function vSe(e){return gSe(qbe(e)).left+oSe(e).scrollLeft}function fSe(e,a,n){let t;if("viewport"===a)t=function(e,a){const n=Wbe(e),t=qbe(e),i=n.visualViewport;let r=t.clientWidth,o=t.clientHeight,s=0,l=0;if(i){r=i.width,o=i.height;const e=tSe();(!e||e&&"fixed"===a)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:r,height:o,x:s,y:l}}(e,n);else if("document"===a)t=function(e){const a=qbe(e),n=oSe(e),t=e.ownerDocument.body,i=Cbe(a.scrollWidth,a.clientWidth,t.scrollWidth,t.clientWidth),r=Cbe(a.scrollHeight,a.clientHeight,t.scrollHeight,t.clientHeight);let o=-n.scrollLeft+vSe(e);const s=-n.scrollTop;return"rtl"===rSe(t).direction&&(o+=Cbe(a.clientWidth,t.clientWidth)-i),{width:i,height:r,x:o,y:s}}(qbe(e));else if($be(a))t=function(e,a){const n=gSe(e,!0,"fixed"===a),t=n.top+e.clientTop,i=n.left+e.clientLeft,r=Ybe(e)?mSe(e):Nbe(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:i*r.x,y:t*r.y}}(a,n);else{const n=pSe(e);t={...a,x:a.x-n.x,y:a.y-n.y}}return Ibe(t)}function ySe(e,a){const n=sSe(e);return!(n===a||!$be(n)||iSe(n))&&("fixed"===rSe(n).position||ySe(n,a))}function kSe(e,a,n){const t=Ybe(a),i=qbe(a),r="fixed"===n,o=gSe(e,!0,r,a);let s={scrollLeft:0,scrollTop:0};const l=Nbe(0);if(t||!t&&!r)if(("body"!==Ube(a)||Xbe(i))&&(s=oSe(a)),t){const e=gSe(a,!0,r,a);l.x=e.x+a.clientLeft,l.y=e.y+a.clientTop}else i&&(l.x=vSe(i));return{x:o.left+s.scrollLeft-l.x,y:o.top+s.scrollTop-l.y,width:o.width,height:o.height}}function bSe(e){return"static"===rSe(e).position}function SSe(e,a){return Ybe(e)&&"fixed"!==rSe(e).position?a?a(e):e.offsetParent:null}function ASe(e,a){const n=Wbe(e);if(aSe(e))return n;if(!Ybe(e)){let a=sSe(e);for(;a&&!iSe(a);){if($be(a)&&!bSe(a))return a;a=sSe(a)}return n}let t=SSe(e,a);for(;t&&eSe(t)&&bSe(t);)t=SSe(t,a);return t&&iSe(t)&&bSe(t)&&!nSe(t)?n:t||function(e){let a=sSe(e);for(;Ybe(a)&&!iSe(a);){if(nSe(a))return a;if(aSe(a))return null;a=sSe(a)}return null}(e)||n}var wSe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:a,rect:n,offsetParent:t,strategy:i}=e;const r="fixed"===i,o=qbe(t),s=!!a&&aSe(a.floating);if(t===o||s&&r)return n;let l={scrollLeft:0,scrollTop:0},u=Nbe(1);const c=Nbe(0),d=Ybe(t);if((d||!d&&!r)&&(("body"!==Ube(t)||Xbe(o))&&(l=oSe(t)),Ybe(t))){const e=gSe(t);u=mSe(t),c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x,y:n.y*u.y-l.scrollTop*u.y+c.y}},getDocumentElement:qbe,getClippingRect:function(e){let{element:a,boundary:n,rootBoundary:t,strategy:i}=e;const r=[..."clippingAncestors"===n?aSe(a)?[]:function(e,a){const n=a.get(e);if(n)return n;let t=uSe(e,[],!1).filter((e=>$be(e)&&"body"!==Ube(e))),i=null;const r="fixed"===rSe(e).position;let o=r?sSe(e):e;for(;$be(o)&&!iSe(o);){const a=rSe(o),n=nSe(o);n||"fixed"!==a.position||(i=null),(r?!n&&!i:!n&&"static"===a.position&&i&&["absolute","fixed"].includes(i.position)||Xbe(o)&&!n&&ySe(e,o))?t=t.filter((e=>e!==o)):i=a,o=sSe(o)}return a.set(e,t),t}(a,this._c):[].concat(n),t],o=r.reduce(((e,n)=>{const t=fSe(a,n,i);return e.top=Cbe(t.top,e.top),e.right=wbe(t.right,e.right),e.bottom=wbe(t.bottom,e.bottom),e.left=Cbe(t.left,e.left),e}),fSe(a,r[0],i));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}},getOffsetParent:ASe,getElementRects:async function(e){const a=this.getOffsetParent||ASe,n=this.getDimensions,t=await n(e.floating);return{reference:kSe(e.reference,await a(e.floating),e.strategy),floating:{x:0,y:0,width:t.width,height:t.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:a,height:n}=cSe(e);return{width:a,height:n}},getScale:mSe,isElement:$be,isRTL:function(e){return"rtl"===rSe(e).direction}};function CSe(e,a,n,t){void 0===t&&(t={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=t,u=dSe(e),c=i||r?[...u?uSe(u):[],...uSe(a)]:[];c.forEach((e=>{i&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)}));const d=u&&s?function(e,a){let n,t=null;const i=qbe(e);function r(){var e;clearTimeout(n),null==(e=t)||e.disconnect(),t=null}return function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),r();const{left:u,top:c,width:d,height:m}=e.getBoundingClientRect();if(s||a(),!d||!m)return;const h={rootMargin:-Tbe(c)+"px "+-Tbe(i.clientWidth-(u+d))+"px "+-Tbe(i.clientHeight-(c+m))+"px "+-Tbe(u)+"px",threshold:Cbe(0,wbe(1,l))||1};let p=!0;function g(e){const a=e[0].intersectionRatio;if(a!==l){if(!p)return o();a?o(!1,a):n=setTimeout((()=>{o(!1,1e-7)}),1e3)}p=!1}try{t=new IntersectionObserver(g,{...h,root:i.ownerDocument})}catch(uBe){t=new IntersectionObserver(g,h)}t.observe(e)}(!0),r}(u,n):null;let m,h=-1,p=null;o&&(p=new ResizeObserver((e=>{let[t]=e;t&&t.target===u&&p&&(p.unobserve(a),cancelAnimationFrame(h),h=requestAnimationFrame((()=>{var e;null==(e=p)||e.observe(a)}))),n()})),u&&!l&&p.observe(u),p.observe(a));let g=l?gSe(e):null;return l&&function a(){const t=gSe(e);!g||t.x===g.x&&t.y===g.y&&t.width===g.width&&t.height===g.height||n();g=t,m=requestAnimationFrame(a)}(),n(),()=>{var e;c.forEach((e=>{i&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(m)}}var MSe=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(a){var n,t;const{x:i,y:r,placement:o,middlewareData:s}=a,l=await async function(e,a){const{placement:n,platform:t,elements:i}=e,r=await(null==t.isRTL?void 0:t.isRTL(i.floating)),o=Lbe(n),s=Bbe(n),l="y"===_be(n),u=["left","top"].includes(o)?-1:1,c=r&&l?-1:1,d=jbe(a,e);let{mainAxis:m,crossAxis:h,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof p&&(h="end"===s?-1*p:p),l?{x:h*c,y:m*u}:{x:m*u,y:h*c}}(a,e);return o===(null==(n=s.offset)?void 0:n.placement)&&null!=(t=s.arrow)&&t.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:o}}}}},TSe=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(a){const{x:n,y:t,placement:i}=a,{mainAxis:r=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:a,y:n}=e;return{x:a,y:n}}},...l}=jbe(e,a),u={x:n,y:t},c=await Vbe(a,l),d=_be(Lbe(i)),m=zbe(d);let h=u[m],p=u[d];if(r){h=Pbe(h+c["y"===m?"top":"left"],h,h-c["y"===m?"bottom":"right"])}if(o){p=Pbe(p+c["y"===d?"top":"left"],p,p-c["y"===d?"bottom":"right"])}const g=s.fn({...a,[m]:h,[d]:p});return{...g,data:{x:g.x-n,y:g.y-t}}}}},NSe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(a){var n,t;const{placement:i,middlewareData:r,rects:o,initialPlacement:s,platform:l,elements:u}=a,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=jbe(e,a);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const f=Lbe(i),y=_be(s),k=Lbe(s)===s,b=await(null==l.isRTL?void 0:l.isRTL(u.floating)),S=m||(k||!g?[Hbe(s)]:function(e){const a=Hbe(e);return[Kbe(e),a,Kbe(a)]}(s)),A="none"!==p;!m&&A&&S.push(...function(e,a,n,t){const i=Bbe(e);let r=function(e,a,n){const t=["left","right"],i=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?a?i:t:a?t:i;case"left":case"right":return a?r:o;default:return[]}}(Lbe(e),"start"===n,t);return i&&(r=r.map((e=>e+"-"+i)),a&&(r=r.concat(r.map(Kbe)))),r}(s,g,p,b));const w=[s,...S],C=await Vbe(a,v),M=[];let T=(null==(t=r.flip)?void 0:t.overflows)||[];if(c&&M.push(C[f]),d){const e=function(e,a,n){void 0===n&&(n=!1);const t=Bbe(e),i=Dbe(e),r=Rbe(i);let o="x"===i?t===(n?"end":"start")?"right":"left":"start"===t?"bottom":"top";return a.reference[r]>a.floating[r]&&(o=Hbe(o)),[o,Hbe(o)]}(i,o,b);M.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:i,overflows:M}],!M.every((e=>e<=0))){var N,x;const e=((null==(N=r.flip)?void 0:N.index)||0)+1,a=w[e];if(a)return{data:{index:e,overflows:T},reset:{placement:a}};let n=null==(x=T.filter((e=>e.overflows[0]<=0)).sort(((e,a)=>e.overflows[1]-a.overflows[1]))[0])?void 0:x.placement;if(!n)switch(h){case"bestFit":{var E;const e=null==(E=T.filter((e=>{if(A){const a=_be(e.placement);return a===y||"y"===a}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,a)=>e+a),0)])).sort(((e,a)=>e[1]-a[1]))[0])?void 0:E[0];e&&(n=e);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},xSe=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(a){const{placement:n,rects:t,platform:i,elements:r}=a,{apply:o=()=>{},...s}=jbe(e,a),l=await Vbe(a,s),u=Lbe(n),c=Bbe(n),d="y"===_be(n),{width:m,height:h}=t.floating;let p,g;"top"===u||"bottom"===u?(p=u,g=c===(await(null==i.isRTL?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(g=u,p="end"===c?"top":"bottom");const v=h-l.top-l.bottom,f=m-l.left-l.right,y=wbe(h-l[p],v),k=wbe(m-l[g],f),b=!a.middlewareData.shift;let S=y,A=k;if(d?A=c||b?wbe(k,f):f:S=c||b?wbe(y,v):v,b&&!c){const e=Cbe(l.left,0),a=Cbe(l.right,0),n=Cbe(l.top,0),t=Cbe(l.bottom,0);d?A=m-2*(0!==e||0!==a?e+a:Cbe(l.left,l.right)):S=h-2*(0!==n||0!==t?n+t:Cbe(l.top,l.bottom))}await o({...a,availableWidth:A,availableHeight:S});const w=await i.getDimensions(r.floating);return m!==w.width||h!==w.height?{reset:{rects:!0}}:{}}}},ESe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(a){const{rects:n}=a,{strategy:t="referenceHidden",...i}=jbe(e,a);switch(t){case"referenceHidden":{const e=Fbe(await Vbe(a,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Jbe(e)}}}case"escaped":{const e=Fbe(await Vbe(a,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Jbe(e)}}}default:return{}}}}},PSe=e=>({name:"arrow",options:e,async fn(a){const{x:n,y:t,placement:i,rects:r,platform:o,elements:s,middlewareData:l}=a,{element:u,padding:c=0}=jbe(e,a)||{};if(null==u)return{};const d=Obe(c),m={x:n,y:t},h=Dbe(i),p=Rbe(h),g=await o.getDimensions(u),v="y"===h,f=v?"top":"left",y=v?"bottom":"right",k=v?"clientHeight":"clientWidth",b=r.reference[p]+r.reference[h]-m[h]-r.floating[p],S=m[h]-r.reference[h],A=await(null==o.getOffsetParent?void 0:o.getOffsetParent(u));let w=A?A[k]:0;w&&await(null==o.isElement?void 0:o.isElement(A))||(w=s.floating[k]||r.floating[p]);const C=b/2-S/2,M=w/2-g[p]/2-1,T=wbe(d[f],M),N=wbe(d[y],M),x=T,E=w-g[p]-N,P=w/2-g[p]/2+C,j=Pbe(x,P,E),L=!l.arrow&&null!=Bbe(i)&&P!==j&&r.reference[p]/2-(P<x?T:N)-g[p]/2<0,B=L?P<x?P-x:P-E:0;return{[h]:m[h]+B,data:{[h]:j,centerOffset:P-j-B,...L&&{alignmentOffset:B}},reset:L}}}),jSe=(e,a,n)=>{const t={platform:wSe,...n},i={...t.platform,_c:new Map};return(async(e,a,n)=>{const{placement:t="bottom",strategy:i="absolute",middleware:r=[],platform:o}=n,s=r.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(a));let u=await o.getElementRects({reference:e,floating:a,strategy:i}),{x:c,y:d}=Gbe(u,t,l),m=t,h={},p=0;for(let g=0;g<s.length;g++){const{name:n,fn:r}=s[g],{x:v,y:f,data:y,reset:k}=await r({x:c,y:d,initialPlacement:t,placement:m,strategy:i,middlewareData:h,rects:u,platform:o,elements:{reference:e,floating:a}});c=null!=v?v:c,d=null!=f?f:d,h={...h,[n]:{...h[n],...y}},k&&p<=50&&(p++,"object"==typeof k&&(k.placement&&(m=k.placement),k.rects&&(u=!0===k.rects?await o.getElementRects({reference:e,floating:a,strategy:i}):k.rects),({x:c,y:d}=Gbe(u,m,l))),g=-1)}return{x:c,y:d,placement:m,strategy:i,middlewareData:h}})(e,a,{...t,platform:i})},LSe=Ba();function BSe(){const e=za(LSe);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var zSe=Mn('<svg display="block" viewBox="0 0 30 30" style="transform:scale(1.02)"><g><path fill="none" d="M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"></path><path stroke="none" d="M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z">'),RSe={top:180,right:-90,bottom:0,left:90};function _Se(e){const a=BSe(),n=mke({size:30},e),[t,i]=on(n,["ref","style","size"]),r=()=>a.currentPlacement().split("-")[0],o=function(e){const[a,n]=ka();return Aa((()=>{const a=e();var t;a&&n((t=a,Fye(t).defaultView||window).getComputedStyle(a))})),a}(a.contentRef),s=()=>2*Number.parseInt(o()?.getPropertyValue(`border-${r()}-width`)||"0px")*(30/t.size);return Xa(Ake,rn({as:"div",ref(e){const n=wye(a.setArrowRef,t.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Kye({position:"absolute","font-size":`${t.size}px`,width:"1em",height:"1em","pointer-events":"none",fill:o()?.getPropertyValue("background-color")||"none",stroke:o()?.getPropertyValue(`border-${r()}-color`)||"none","stroke-width":s()},t.style)}},i,{get children(){const e=zSe(),a=e.firstChild;return Sa((()=>Nn(a,"transform",`rotate(${RSe[r()]} 15 15) translate(0 2)`))),e}}))}function DSe(e){const{x:a=0,y:n=0,width:t=0,height:i=0}=e??{};if("function"==typeof DOMRect)return new DOMRect(a,n,t,i);const r={x:a,y:n,width:t,height:i,top:n,right:a+t,bottom:n+i,left:a};return{...r,toJSON:()=>r}}function KSe(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var HSe={top:"bottom",right:"left",bottom:"top",left:"right"};var OSe=Object.assign((function(e){const a=mke({getAnchorRect:e=>e?.getBoundingClientRect(),placement:"bottom",gutter:0,shift:0,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,hideWhenDetached:!1,detachedPadding:0,arrowPadding:4,overflowPadding:8},e),[n,t]=ka(),[i,r]=ka(),[o,s]=ka(a.placement),l=()=>{return e=a.anchorRef?.(),n=a.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const a=n(e);return a?DSe(a):e?e.getBoundingClientRect():DSe()}};var e,n},{direction:u}=Yke();async function c(){const e=l(),t=n(),r=i();if(!e||!t)return;const o=(r?.clientHeight||0)/2,c="number"==typeof a.gutter?a.gutter+o:a.gutter??o;t.style.setProperty("--kb-popper-content-overflow-padding",`${a.overflowPadding}px`),e.getBoundingClientRect();const d=[MSe((({placement:e})=>{const n=!!e.split("-")[1];return{mainAxis:c,crossAxis:n?void 0:a.shift,alignmentAxis:a.shift}}))];if(!1!==a.flip){const e="string"==typeof a.flip?a.flip.split(" "):void 0;if(void 0!==e&&!e.every(KSe))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(NSe({padding:a.overflowPadding,fallbackPlacements:e}))}(a.slide||a.overlap)&&d.push(TSe({mainAxis:a.slide,crossAxis:a.overlap,padding:a.overflowPadding})),d.push(xSe({padding:a.overflowPadding,apply({availableWidth:e,availableHeight:n,rects:i}){const r=Math.round(i.reference.width);e=Math.floor(e),n=Math.floor(n),t.style.setProperty("--kb-popper-anchor-width",`${r}px`),t.style.setProperty("--kb-popper-content-available-width",`${e}px`),t.style.setProperty("--kb-popper-content-available-height",`${n}px`),a.sameWidth&&(t.style.width=`${r}px`),a.fitViewport&&(t.style.maxWidth=`${e}px`,t.style.maxHeight=`${n}px`)}})),a.hideWhenDetached&&d.push(ESe({padding:a.detachedPadding})),r&&d.push(PSe({element:r,padding:a.arrowPadding}));const m=await jSe(e,t,{placement:a.placement,strategy:"absolute",middleware:d,platform:{...wSe,isRTL:()=>"rtl"===u()}});if(s(m.placement),a.onCurrentPlacementChange?.(m.placement),!t)return;t.style.setProperty("--kb-popper-content-transform-origin",function(e,a){const[n,t]=e.split("-"),i=HSe[n];return t?"left"===n||"right"===n?`${i} ${"start"===t?"top":"bottom"}`:"start"===t?`${i} ${"rtl"===a?"right":"left"}`:`${i} ${"rtl"===a?"left":"right"}`:`${i} center`}(m.placement,u()));const h=Math.round(m.x),p=Math.round(m.y);let g;if(a.hideWhenDetached&&(g=m.middlewareData.hide?.referenceHidden?"hidden":"visible"),Object.assign(t.style,{top:"0",left:"0",transform:`translate3d(${h}px, ${p}px, 0)`,visibility:g}),r&&m.middlewareData.arrow){const{x:e,y:a}=m.middlewareData.arrow,n=m.placement.split("-")[0];Object.assign(r.style,{left:null!=e?`${e}px`:"",top:null!=a?`${a}px`:"",[n]:"100%"})}}return Aa((()=>{const e=l(),a=n();if(!e||!a)return;xa(CSe(e,a,c,{elementResize:"function"==typeof ResizeObserver}))})),Aa((()=>{const e=n(),t=a.contentRef?.();e&&t&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(t).zIndex}))})),Xa(LSe.Provider,{value:{currentPlacement:o,contentRef:()=>a.contentRef?.(),setPositionerRef:t,setArrowRef:r},get children(){return a.children}})}),{Arrow:_Se,Context:LSe,usePopperContext:BSe,Positioner:function(e){const a=BSe(),[n,t]=on(e,["ref","style"]);return Xa(Ake,rn({as:"div",ref(e){const t=wye(a.setPositionerRef,n.ref);"function"==typeof t&&t(e)},"data-popper-positioner":"",get style(){return Kye({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},t))}});var ISe="interactOutside.pointerDownOutside",GSe="interactOutside.focusOutside";var VSe=Ba();function FSe(e){let a;const n=za(VSe),[t,i]=on(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),r=new Set([]);!function(e,a){let n,t=dke;const i=()=>Fye(a()),r=a=>e.onPointerDownOutside?.(a),o=a=>e.onFocusOutside?.(a),s=a=>e.onInteractOutside?.(a),l=n=>{const t=n.target;return t instanceof HTMLElement&&!t.closest(`[${dbe}]`)&&!!Gye(i(),t)&&!Gye(a(),t)&&!e.shouldExcludeElement?.(t)},u=e=>{function n(){const n=a(),t=e.target;if(!n||!t||!l(e))return;const i=Yye([r,s]);t.addEventListener(ISe,i,{once:!0});const o=new CustomEvent(ISe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||Qye(e)&&0===e.button}});t.dispatchEvent(o)}"touch"===e.pointerType?(i().removeEventListener("click",n),t=n,i().addEventListener("click",n,{once:!0})):n()},c=e=>{const n=a(),t=e.target;if(!n||!t||!l(e))return;const i=Yye([o,s]);t.addEventListener(GSe,i,{once:!0});const r=new CustomEvent(GSe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});t.dispatchEvent(r)};Aa((()=>{Pfe(e.isDisabled)||(n=window.setTimeout((()=>{i().addEventListener("pointerdown",u,!0)}),0),i().addEventListener("focusin",c,!0),xa((()=>{window.clearTimeout(n),i().removeEventListener("click",t),i().removeEventListener("pointerdown",u,!0),i().removeEventListener("focusin",c,!0)})))}))}({shouldExcludeElement:e=>!!a&&(t.excludedElements?.some((a=>Gye(a(),e)))||[...r].some((a=>Gye(a,e)))),onPointerDownOutside:e=>{a&&!ybe.isBelowPointerBlockingLayer(a)&&(t.bypassTopMostLayerCheck||ybe.isTopMostLayer(a))&&(t.onPointerDownOutside?.(e),t.onInteractOutside?.(e),e.defaultPrevented||t.onDismiss?.())},onFocusOutside:e=>{t.onFocusOutside?.(e),t.onInteractOutside?.(e),e.defaultPrevented||t.onDismiss?.()}},(()=>a)),function(e){const a=a=>{a.key===Uye.Escape&&e.onEscapeKeyDown?.(a)};Aa((()=>{if(Pfe(e.isDisabled))return;const n=e.ownerDocument?.()??Fye();n.addEventListener("keydown",a),xa((()=>{n.removeEventListener("keydown",a)}))}))}({ownerDocument:()=>Fye(a),onEscapeKeyDown:e=>{a&&ybe.isTopMostLayer(a)&&(t.onEscapeKeyDown?.(e),!e.defaultPrevented&&t.onDismiss&&(e.preventDefault(),t.onDismiss()))}}),Na((()=>{if(!a)return;ybe.addLayer({node:a,isPointerBlocking:t.disableOutsidePointerEvents,dismiss:t.onDismiss});const e=n?.registerNestedLayer(a);ybe.assignPointerEventToLayers(),ybe.disableBodyPointerEvents(a),xa((()=>{a&&(ybe.removeLayer(a),e?.(),ybe.assignPointerEventToLayers(),ybe.restoreBodyPointerEvents(a))}))})),Aa(Ta([()=>a,()=>t.disableOutsidePointerEvents],(([e,a])=>{if(!e)return;const n=ybe.find(e);n&&n.isPointerBlocking!==a&&(n.isPointerBlocking=a,ybe.assignPointerEventToLayers()),a&&ybe.disableBodyPointerEvents(e),xa((()=>{ybe.restoreBodyPointerEvents(e)}))}),{defer:!0}));return Xa(VSe.Provider,{value:{registerNestedLayer:e=>{r.add(e);const a=n?.registerNestedLayer(e);return()=>{r.delete(e),a?.()}}},get children(){return Xa(Ake,rn({as:"div",ref(e){const n=wye((e=>a=e),t.ref);"function"==typeof n&&n(e)}},i))}})}function JSe(e={}){const[a,n]=jke({value:()=>Pfe(e.open),defaultValue:()=>!!Pfe(e.defaultOpen),onChange:a=>e.onOpenChange?.(a)}),t=()=>{n(!0)},i=()=>{n(!1)};return{isOpen:a,setIsOpen:n,open:t,close:i,toggle:()=>{a()?i():t()}}}var USe={};Bke(USe,{Description:()=>Tke,ErrorMessage:()=>Nke,Item:()=>YSe,ItemControl:()=>QSe,ItemDescription:()=>XSe,ItemIndicator:()=>eAe,ItemInput:()=>aAe,ItemLabel:()=>nAe,Label:()=>tAe,RadioGroup:()=>rAe,Root:()=>iAe});var WSe=Ba();function qSe(){const e=za(WSe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var ZSe=Ba();function $Se(){const e=za(ZSe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function YSe(e){const a=Mke(),n=qSe(),t=mke({id:`${a.generateId("item")}-${un()}`},e),[i,r]=on(t,["value","disabled","onPointerDown"]),[o,s]=ka(),[l,u]=ka(),[c,d]=ka(),[m,h]=ka(),[p,g]=ka(!1),v=wa((()=>n.isSelectedValue(i.value))),f=wa((()=>i.disabled||a.isDisabled()||!1)),y=e=>{$ye(e,i.onPointerDown),p()&&e.preventDefault()},k=wa((()=>({...a.dataset(),"data-disabled":f()?"":void 0,"data-checked":v()?"":void 0}))),b={value:()=>i.value,dataset:k,isSelected:v,isDisabled:f,inputId:o,labelId:l,descriptionId:c,inputRef:m,select:()=>n.setSelectedValue(i.value),generateId:Iye((()=>r.id)),registerInput:kke(s),registerLabel:kke(u),registerDescription:kke(d),setIsFocused:g,setInputRef:h};return Xa(ZSe.Provider,{value:b,get children(){return Xa(Ake,rn({as:"div",role:"group",onPointerDown:y},k,r))}})}function QSe(e){const a=$Se(),n=mke({id:a.generateId("control")},e),[t,i]=on(n,["onClick","onKeyDown"]);return Xa(Ake,rn({as:"div",onClick:e=>{$ye(e,t.onClick),a.select(),a.inputRef()?.focus()},onKeyDown:e=>{$ye(e,t.onKeyDown),e.key===Uye.Space&&(a.select(),a.inputRef()?.focus())}},(()=>a.dataset()),i))}function XSe(e){const a=$Se(),n=mke({id:a.generateId("description")},e);return Aa((()=>xa(a.registerDescription(n.id)))),Xa(Ake,rn({as:"div"},(()=>a.dataset()),n))}function eAe(e){const a=$Se(),n=mke({id:a.generateId("indicator")},e),[t,i]=on(n,["ref","forceMount"]),[r,o]=ka(),{present:s}=cbe({show:()=>t.forceMount||a.isSelected(),element:()=>r()??null});return Xa(hn,{get when(){return s()},get children(){return Xa(Ake,rn({as:"div",ref(e){const a=wye(o,t.ref);"function"==typeof a&&a(e)}},(()=>a.dataset()),i))}})}function aAe(e){const a=Mke(),n=qSe(),t=$Se(),i=mke({id:t.generateId("input")},e),[r,o]=on(i,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=ka(!1);return Aa(Ta([()=>t.isSelected(),()=>t.value()],(e=>{if(!e[0]&&e[1]===t.value())return;l(!0);const a=t.inputRef();a?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),a?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),{defer:!0})),Aa((()=>xa(t.registerInput(o.id)))),Xa(Ake,rn({as:"input",ref(e){const a=wye(t.setInputRef,r.ref);"function"==typeof a&&a(e)},type:"radio",get name(){return a.name()},get value(){return t.value()},get checked(){return t.isSelected()},get required(){return a.isRequired()},get disabled(){return t.isDisabled()},get readonly(){return a.isReadOnly()},get style(){return Kye({...yke},r.style)},get"aria-labelledby"(){return[r["aria-labelledby"],t.labelId(),null!=r["aria-labelledby"]&&null!=o["aria-label"]?o.id:void 0].filter(Boolean).join(" ")||void 0},get"aria-describedby"(){return[r["aria-describedby"],t.descriptionId(),n.ariaDescribedBy()].filter(Boolean).join(" ")||void 0},onChange:e=>{if($ye(e,r.onChange),e.stopPropagation(),!s()){n.setSelectedValue(t.value());e.target.checked=t.isSelected()}l(!1)},onFocus:e=>{$ye(e,r.onFocus),t.setIsFocused(!0)},onBlur:e=>{$ye(e,r.onBlur),t.setIsFocused(!1)}},(()=>t.dataset()),o))}function nAe(e){const a=$Se(),n=mke({id:a.generateId("label")},e);return Aa((()=>xa(a.registerLabel(n.id)))),Xa(Ake,rn({as:"label",get for(){return a.inputId()}},(()=>a.dataset()),n))}function tAe(e){return Xa(xke,rn({as:"span"},e))}function iAe(e){let a;const n=mke({id:`radiogroup-${un()}`,orientation:"vertical"},e),[t,i,r]=on(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],wke),[o,s]=Pke({value:()=>t.value,defaultValue:()=>t.defaultValue,onChange:e=>t.onChange?.(e)}),{formControlContext:l}=function(e){const a=mke({id:`form-control-${un()}`},e),[n,t]=ka(),[i,r]=ka(),[o,s]=ka(),[l,u]=ka();return{formControlContext:{name:()=>Pfe(a.name)??Pfe(a.id),dataset:wa((()=>({"data-valid":"valid"===Pfe(a.validationState)?"":void 0,"data-invalid":"invalid"===Pfe(a.validationState)?"":void 0,"data-required":Pfe(a.required)?"":void 0,"data-disabled":Pfe(a.disabled)?"":void 0,"data-readonly":Pfe(a.readOnly)?"":void 0}))),validationState:()=>Pfe(a.validationState),isRequired:()=>Pfe(a.required),isDisabled:()=>Pfe(a.disabled),isReadOnly:()=>Pfe(a.readOnly),labelId:n,fieldId:i,descriptionId:o,errorMessageId:l,getAriaLabelledBy:(e,a,t)=>{const i=null!=t||null!=n();return[t,n(),i&&null!=a?e:void 0].filter(Boolean).join(" ")||void 0},getAriaDescribedBy:e=>[o(),l(),e].filter(Boolean).join(" ")||void 0,generateId:Iye((()=>Pfe(a.id))),registerLabel:kke(t),registerField:kke(r),registerDescription:kke(s),registerErrorMessage:kke(u)}}}(i);Eke((()=>a),(()=>s(t.defaultValue??"")));const u=()=>l.getAriaDescribedBy(t["aria-describedby"]),c=e=>e===o(),d={ariaDescribedBy:u,isSelectedValue:c,setSelectedValue:e=>{if(!l.isReadOnly()&&!l.isDisabled()&&(s(e),a))for(const n of a.querySelectorAll("[type='radio']")){n.checked=c(n.value)}}};return Xa(Cke.Provider,{value:l,get children(){return Xa(WSe.Provider,{value:d,get children(){return Xa(Ake,rn({as:"div",ref(e){const n=wye((e=>a=e),t.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return Pfe(i.id)},get"aria-invalid"(){return"invalid"===l.validationState()||void 0},get"aria-required"(){return l.isRequired()||void 0},get"aria-disabled"(){return l.isDisabled()||void 0},get"aria-readonly"(){return l.isReadOnly()||void 0},get"aria-orientation"(){return t.orientation},get"aria-labelledby"(){return l.getAriaLabelledBy(Pfe(i.id),r["aria-label"],t["aria-labelledby"])},get"aria-describedby"(){return u()}},(()=>l.dataset()),r))}})}})}var rAe=Object.assign(iAe,{Description:Tke,ErrorMessage:Nke,Item:YSe,ItemControl:QSe,ItemDescription:XSe,ItemIndicator:eAe,ItemInput:aAe,ItemLabel:nAe,Label:tAe}),oAe=class{collection;ref;collator;constructor(e,a,n){this.collection=e,this.ref=a,this.collator=n}getKeyBelow(e){let a=this.collection().getKeyAfter(e);for(;null!=a;){const e=this.collection().getItem(a);if(e&&"item"===e.type&&!e.disabled)return a;a=this.collection().getKeyAfter(a)}}getKeyAbove(e){let a=this.collection().getKeyBefore(e);for(;null!=a;){const e=this.collection().getItem(a);if(e&&"item"===e.type&&!e.disabled)return a;a=this.collection().getKeyBefore(a)}}getFirstKey(){let e=this.collection().getFirstKey();for(;null!=e;){const a=this.collection().getItem(e);if(a&&"item"===a.type&&!a.disabled)return e;e=this.collection().getKeyAfter(e)}}getLastKey(){let e=this.collection().getLastKey();for(;null!=e;){const a=this.collection().getItem(e);if(a&&"item"===a.type&&!a.disabled)return e;e=this.collection().getKeyBefore(e)}}getItem(e){return this.ref?.()?.querySelector(`[data-key="${e}"]`)??null}getKeyPageAbove(e){const a=this.ref?.();let n=this.getItem(e);if(!a||!n)return;const t=Math.max(0,n.offsetTop+n.offsetHeight-a.offsetHeight);let i=e;for(;i&&n&&n.offsetTop>t;)i=this.getKeyAbove(i),n=null!=i?this.getItem(i):null;return i}getKeyPageBelow(e){const a=this.ref?.();let n=this.getItem(e);if(!a||!n)return;const t=Math.min(a.scrollHeight,n.offsetTop-n.offsetHeight+a.offsetHeight);let i=e;for(;i&&n&&n.offsetTop<t;)i=this.getKeyBelow(i),n=null!=i?this.getItem(i):null;return i}getKeyForSearch(e,a){const n=this.collator?.();if(!n)return;let t=null!=a?this.getKeyBelow(a):this.getFirstKey();for(;null!=t;){const a=this.collection().getItem(t);if(a){const i=a.textValue.slice(0,e.length);if(a.textValue&&0===n.compare(i,e))return t}t=this.getKeyBelow(t)}}};function sAe(e,a,n){const t=function(e){const{locale:a}=Yke(),n=wa((()=>a()+(e?Object.entries(e).sort(((e,a)=>e[0]<a[0]?-1:1)).join():"")));return wa((()=>{const t=n();let i;return Qke.has(t)&&(i=Qke.get(t)),i||(i=new Intl.Collator(a(),e),Qke.set(t,i)),i}))}({usage:"search",sensitivity:"base"});return ibe({selectionManager:()=>Pfe(e.selectionManager),keyboardDelegate:wa((()=>{const n=Pfe(e.keyboardDelegate);return n||new oAe(e.collection,a,t)})),autoFocus:()=>Pfe(e.autoFocus),deferAutoFocus:()=>Pfe(e.deferAutoFocus),shouldFocusWrap:()=>Pfe(e.shouldFocusWrap),disallowEmptySelection:()=>Pfe(e.disallowEmptySelection),selectOnFocus:()=>Pfe(e.selectOnFocus),disallowTypeAhead:()=>Pfe(e.disallowTypeAhead),shouldUseVirtualFocus:()=>Pfe(e.shouldUseVirtualFocus),allowsTabNavigation:()=>Pfe(e.allowsTabNavigation),isVirtualized:()=>Pfe(e.isVirtualized),scrollToKey:a=>Pfe(e.scrollToKey)?.(a),orientation:()=>Pfe(e.orientation)},a)}var lAe="focusScope.autoFocusOnMount",uAe="focusScope.autoFocusOnUnmount",cAe={bubbles:!1,cancelable:!0},dAe={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=Hye(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=Hye(this.stack,e),this.active()?.resume()}};function mAe(e,a){const[n,t]=ka(!1),i={pause(){t(!0)},resume(){t(!1)}};let r=null;const o=a=>e.onMountAutoFocus?.(a),s=a=>e.onUnmountAutoFocus?.(a),l=()=>Fye(a()),u=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,yke),e},c=()=>{const e=a();return e?rke(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=c();return e.length>0?e[0]:null};Aa((()=>{const e=a();if(!e)return;dAe.add(i);const n=Vye(e);if(!Gye(e,n)){const a=new CustomEvent(lAe,cAe);e.addEventListener(lAe,o),e.dispatchEvent(a),a.defaultPrevented||setTimeout((()=>{Xye(d()),Vye(e)===n&&Xye(e)}),0)}xa((()=>{e.removeEventListener(lAe,o),setTimeout((()=>{const t=new CustomEvent(uAe,cAe);(()=>{const e=a();if(!e)return!1;const n=Vye(e);return!!n&&!Gye(e,n)&&ske(n)})()&&t.preventDefault(),e.addEventListener(uAe,s),e.dispatchEvent(t),t.defaultPrevented||Xye(n??l().body),e.removeEventListener(uAe,s),dAe.remove(i)}),0)}))})),Aa((()=>{const t=a();if(!t||!Pfe(e.trapFocus)||n())return;const i=e=>{const a=e.target;a?.closest(`[${dbe}]`)||(Gye(t,a)?r=a:Xye(r))},o=e=>{const a=e.relatedTarget??Vye(t);a?.closest(`[${dbe}]`)||Gye(t,a)||Xye(r)};l().addEventListener("focusin",i),l().addEventListener("focusout",o),xa((()=>{l().removeEventListener("focusin",i),l().removeEventListener("focusout",o)}))})),Aa((()=>{const t=a();if(!t||!Pfe(e.trapFocus)||n())return;const i=u();t.insertAdjacentElement("afterbegin",i);const r=u();function o(e){const a=d(),n=(()=>{const e=c();return e.length>0?e[e.length-1]:null})();Xye(e.relatedTarget===a?n:a)}t.insertAdjacentElement("beforeend",r),i.addEventListener("focusin",o),r.addEventListener("focusin",o);const s=new MutationObserver((e=>{for(const a of e)a.previousSibling===r&&(r.remove(),t.insertAdjacentElement("beforeend",r)),a.nextSibling===i&&(i.remove(),t.insertAdjacentElement("afterbegin",i))}));s.observe(t,{childList:!0,subtree:!1}),xa((()=>{i.removeEventListener("focusin",o),r.removeEventListener("focusin",o),i.remove(),r.remove(),s.disconnect()}))}))}var hAe="data-live-announcer";function pAe(e){Aa((()=>{Pfe(e.isDisabled)||xa(function(e,a=document.body){const n=new Set(e),t=new Set,i=e=>{for(const t of e.querySelectorAll(`[${hAe}], [${dbe}]`))n.add(t);const a=e=>{if(n.has(e)||e.parentElement&&t.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(const a of n)if(e.contains(a))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a}),o=a(e);if(o===NodeFilter.FILTER_ACCEPT&&r(e),o!==NodeFilter.FILTER_REJECT){let e=i.nextNode();for(;null!=e;)r(e),e=i.nextNode()}},r=e=>{const a=gAe.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===a||(0===a&&e.setAttribute("aria-hidden","true"),t.add(e),gAe.set(e,a+1))};vAe.length&&vAe[vAe.length-1].disconnect();i(a);const o=new MutationObserver((e=>{for(const a of e)if("childList"===a.type&&0!==a.addedNodes.length&&![...n,...t].some((e=>e.contains(a.target)))){for(const e of a.removedNodes)e instanceof Element&&(n.delete(e),t.delete(e));for(const e of a.addedNodes)!(e instanceof HTMLElement||e instanceof SVGElement)||"true"!==e.dataset.liveAnnouncer&&"true"!==e.dataset.reactAriaTopLayer?e instanceof Element&&i(e):n.add(e)}}));o.observe(a,{childList:!0,subtree:!0});const s={observe(){o.observe(a,{childList:!0,subtree:!0})},disconnect(){o.disconnect()}};return vAe.push(s),()=>{o.disconnect();for(const e of t){const a=gAe.get(e);if(null==a)return;1===a?(e.removeAttribute("aria-hidden"),gAe.delete(e)):gAe.set(e,a-1)}s===vAe[vAe.length-1]?(vAe.pop(),vAe.length&&vAe[vAe.length-1].observe()):vAe.splice(vAe.indexOf(s),1)}}(Pfe(e.targets),Pfe(e.root)))}))}var gAe=new WeakMap,vAe=[];var fAe=new Map,yAe=e=>{Aa((()=>{const a=ube(e.style)??{},n=ube(e.properties)??[],t={};for(const r in a)t[r]=e.element.style[r];const i=fAe.get(e.key);i?i.activeCount++:fAe.set(e.key,{activeCount:1,originalStyles:t,properties:n.map((e=>e.key))}),Object.assign(e.element.style,e.style);for(const r of n)e.element.style.setProperty(r.key,r.value);xa((()=>{const a=fAe.get(e.key);if(a)if(1===a.activeCount){fAe.delete(e.key);for(const[n,t]of Object.entries(a.originalStyles))e.element.style[n]=t;for(const n of a.properties)e.element.style.removeProperty(n);0===e.element.style.length&&e.element.removeAttribute("style"),e.cleanup?.()}else a.activeCount--}))}))},kAe=(e,a)=>{switch(a){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},bAe=(e,a)=>{const n=getComputedStyle(e),t="x"===a?n.overflowX:n.overflowY;return"auto"===t||"scroll"===t||"HTML"===e.tagName&&"visible"===t},[SAe,AAe]=ka([]),wAe=e=>[e.deltaX,e.deltaY],CAe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],MAe=(e,a,n,t)=>{const i=null!==t&&TAe(t,e),[r,o]=((e,a,n)=>{const t="x"===a&&"rtl"===window.getComputedStyle(e).direction?-1:1;let i=e,r=0,o=0,s=!1;do{const[e,l,u]=kAe(i,a),c=u-e-t*l;0===l&&0===c||!bAe(i,a)||(r+=c,o+=l),i===(n??document.documentElement)?s=!0:i=i._$host??i.parentElement}while(i&&!s);return[r,o]})(e,a,i?t:void 0);return!(n>0&&Math.abs(r)<=1)&&!(n<0&&Math.abs(o)<1)},TAe=(e,a)=>{if(e.contains(a))return!0;let n=a;for(;n;){if(n===e)return!0;n=n._$host??n.parentElement}return!1},NAe=e=>{const a=rn({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=un();let t=[0,0],i=null,r=null;Aa((()=>{ube(a.enabled)&&(AAe((e=>[...e,n])),xa((()=>{AAe((e=>e.filter((e=>e!==n))))})))})),Aa((()=>{if(!ube(a.enabled)||!ube(a.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(ube(a.preventScrollbarShift)){const t={overflow:"hidden"},i=[];n>0&&("padding"===ube(a.preventScrollbarShiftMode)?t.paddingRight=`calc(${window.getComputedStyle(e).paddingRight} + ${n}px)`:t.marginRight=`calc(${window.getComputedStyle(e).marginRight} + ${n}px)`,i.push({key:"--scrollbar-width",value:`${n}px`}));const r=window.scrollY,o=window.scrollX;yAe({key:"prevent-scroll",element:e,style:t,properties:i,cleanup:()=>{ube(a.restoreScrollPosition)&&n>0&&window.scrollTo(o,r)}})}else yAe({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),Aa((()=>{var e;(e=n,SAe().indexOf(e)===SAe().length-1&&ube(a.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",o,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),xa((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",o),document.removeEventListener("touchmove",l)})))}));const o=e=>{t=CAe(e),i=null,r=null},s=e=>{const n=e.target,t=ube(a.element),i=wAe(e),r=Math.abs(i[0])>Math.abs(i[1])?"x":"y",o=MAe(n,r,"x"===r?i[0]:i[1],t);let s;s=!t||!TAe(t,n)||!o,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=ube(a.element),o=e.target;let s;if(2===e.touches.length)s=!ube(a.allowPinchZoom);else{if(null==i||null===r){const a=CAe(e).map(((e,a)=>t[a]-e)),n=Math.abs(a[0])>Math.abs(a[1])?"x":"y";i=n,r="x"===n?a[0]:a[1]}if("range"===o.type)s=!1;else{const e=MAe(o,i,r,n);s=!n||!TAe(n,o)||!e}}s&&e.cancelable&&e.preventDefault()}},xAe=NAe,EAe=Ba();function PAe(){return za(EAe)}function jAe(){const e=PAe();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var LAe=Ba();function BAe(){const e=za(LAe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var zAe=Ba();function RAe(){const e=za(zAe);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function _Ae(e){let a;const n=RAe(),t=jAe(),i=mke({id:n.generateId(`item-${un()}`)},e),[r,o]=on(i,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=ka(),[u,c]=ka(),[d,m]=ka(),h=()=>t.listState().selectionManager(),p=()=>o.id,g=()=>{r.onSelect?.(),r.closeOnSelect&&setTimeout((()=>{t.close(!0)}))};Oke({getItem:()=>({ref:()=>a,type:"item",key:p(),textValue:r.textValue??d()?.textContent??a?.textContent??"",disabled:r.disabled??!1})});const v=rbe({key:p,selectionManager:h,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>r.disabled},(()=>a)),f=e=>{$ye(e,r.onPointerMove),"mouse"===e.pointerType&&(r.disabled?t.onItemLeave(e):(t.onItemEnter(e),e.defaultPrevented||(Xye(e.currentTarget),t.listState().selectionManager().setFocused(!0),t.listState().selectionManager().setFocusedKey(p()))))},y=e=>{$ye(e,r.onPointerLeave),"mouse"===e.pointerType&&t.onItemLeave(e)},k=e=>{$ye(e,r.onPointerUp),r.disabled||0!==e.button||g()},b=e=>{if($ye(e,r.onKeyDown),!e.repeat&&!r.disabled)switch(e.key){case"Enter":case" ":g()}},S=wa((()=>r.indeterminate?"mixed":null!=r.checked?r.checked:void 0)),A=wa((()=>({"data-indeterminate":r.indeterminate?"":void 0,"data-checked":r.checked&&!r.indeterminate?"":void 0,"data-disabled":r.disabled?"":void 0,"data-highlighted":h().focusedKey()===p()?"":void 0}))),w={isChecked:()=>r.checked,dataset:A,setLabelRef:m,generateId:Iye((()=>o.id)),registerLabel:kke(l),registerDescription:kke(c)};return Xa(LAe.Provider,{value:w,get children(){return Xa(Ake,rn({as:"div",ref(e){const n=wye((e=>a=e),r.ref);"function"==typeof n&&n(e)},get tabIndex(){return v.tabIndex()},get"aria-checked"(){return S()},get"aria-disabled"(){return r.disabled},get"aria-labelledby"(){return s()},get"aria-describedby"(){return u()},get"data-key"(){return v.dataKey()},get onPointerDown(){return Yye([r.onPointerDown,v.onPointerDown])},get onPointerUp(){return Yye([k,v.onPointerUp])},get onClick(){return Yye([r.onClick,v.onClick])},get onKeyDown(){return Yye([b,v.onKeyDown])},get onMouseDown(){return Yye([r.onMouseDown,v.onMouseDown])},get onFocus(){return Yye([r.onFocus,v.onFocus])},onPointerMove:f,onPointerLeave:y},A,o))}})}function DAe(e){const a=mke({closeOnSelect:!1},e),[n,t]=on(a,["checked","defaultChecked","onChange","onSelect"]),i=function(e={}){const[a,n]=jke({value:()=>Pfe(e.isSelected),defaultValue:()=>!!Pfe(e.defaultIsSelected),onChange:a=>e.onSelectedChange?.(a)});return{isSelected:a,setIsSelected:a=>{Pfe(e.isReadOnly)||Pfe(e.isDisabled)||n(a)},toggle:()=>{Pfe(e.isReadOnly)||Pfe(e.isDisabled)||n(!a())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>t.disabled});return Xa(_Ae,rn({role:"menuitemcheckbox",get checked(){return i.isSelected()},onSelect:()=>{n.onSelect?.(),i.toggle()}},t))}var KAe=Ba();function HAe(){return za(KAe)}var OAe={next:(e,a)=>"ltr"===e?"horizontal"===a?"ArrowRight":"ArrowDown":"horizontal"===a?"ArrowLeft":"ArrowUp",previous:(e,a)=>OAe.next("ltr"===e?"rtl":"ltr",a)},IAe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",GAe=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function VAe(e){const a=RAe(),n=jAe(),t=HAe(),{direction:i}=Yke(),r=mke({id:a.generateId("trigger")},e),[o,s]=on(r,["ref","id","disabled","onPointerDown","onClick","onKeyDown","onMouseOver","onFocus"]);let l=()=>a.value();void 0!==t&&(l=()=>a.value()??o.id,void 0===t.lastValue()&&t.setLastValue(l));const u=bke((()=>n.triggerRef()),(()=>"button")),c=wa((()=>"a"===u()&&null!=n.triggerRef()?.getAttribute("href")));Aa(Ta((()=>t?.value()),(e=>{c()&&e===l()&&n.triggerRef()?.focus()})));const d=()=>{void 0!==t?n.isOpen()?t.value()===l()&&t.closeMenu():(t.autoFocusMenu()||t.setAutoFocusMenu(!0),n.open(!1)):n.toggle(!0)};return Aa((()=>xa(n.registerTriggerId(o.id)))),Xa(bbe,rn({ref(e){const a=wye(n.setTriggerRef,o.ref);"function"==typeof a&&a(e)},get"data-kb-menu-value-trigger"(){return a.value()},get id(){return o.id},get disabled(){return o.disabled},"aria-haspopup":"true",get"aria-expanded"(){return n.isOpen()},get"aria-controls"(){return wa((()=>!!n.isOpen()))()?n.contentId():void 0},get"data-highlighted"(){return void 0!==l()&&t?.value()===l()||void 0},get tabIndex(){return void 0!==t?t.value()===l()||t.lastValue()===l()?0:-1:void 0},onPointerDown:e=>{$ye(e,o.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,o.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{$ye(e,o.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(o.disabled||void 0===t||void 0===t.value()||t.setValue(l))},onClick:e=>{$ye(e,o.onClick),o.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if($ye(e,o.onKeyDown),!o.disabled){if(c())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case IAe(a.orientation()):e.stopPropagation(),e.preventDefault(),function(e){if(document.contains(e)){const a=document.scrollingElement||document.documentElement;if("hidden"===window.getComputedStyle(a).overflow){let n=uke(e);for(;e&&n&&e!==a&&n!==a;)vke(n,e),n=uke(e=n)}else{const{left:a,top:n}=e.getBoundingClientRect();e?.scrollIntoView?.({block:"nearest"});const{left:t,top:i}=e.getBoundingClientRect();(Math.abs(a-t)>1||Math.abs(n-i)>1)&&e.scrollIntoView?.({block:"nearest"})}}}(e.currentTarget),n.open("first"),t?.setAutoFocusMenu(!0),t?.setValue(l);break;case GAe(a.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case OAe.next(i(),a.orientation()):if(void 0===t)break;e.stopPropagation(),e.preventDefault(),t.nextMenu();break;case OAe.previous(i(),a.orientation()):if(void 0===t)break;e.stopPropagation(),e.preventDefault(),t.previousMenu()}}},onFocus:e=>{$ye(e,o.onFocus),void 0!==t&&"touch"!==e.currentTarget.dataset.pointerType&&t.setValue(l)},role:void 0!==t?"menuitem":void 0},(()=>n.dataset()),s))}var FAe=Ba();function JAe(){return za(FAe)}function UAe(e){let a;const n=RAe(),t=jAe(),i=HAe(),r=JAe(),{direction:o}=Yke(),s=mke({id:n.generateId(`content-${un()}`)},e),[l,u]=on(s,["ref","id","style","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onPointerEnter","onPointerMove","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]);let c=0;const d=()=>null==t.parentMenuContext()&&void 0===i&&n.isModal(),m=sAe({selectionManager:t.listState().selectionManager,collection:t.listState().collection,autoFocus:t.autoFocus,deferAutoFocus:!0,shouldFocusWrap:!0,disallowTypeAhead:()=>!t.listState().selectionManager().isFocused(),orientation:()=>"horizontal"===n.orientation()?"vertical":"horizontal"},(()=>a));mAe({trapFocus:()=>d()&&t.isOpen(),onMountAutoFocus:e=>{void 0===i&&l.onOpenAutoFocus?.(e)},onUnmountAutoFocus:l.onCloseAutoFocus},(()=>a));const h=e=>{l.onEscapeKeyDown?.(e),i?.setAutoFocusMenu(!1),t.close(!0)},p=e=>{l.onFocusOutside?.(e),n.isModal()&&e.preventDefault()};Aa((()=>xa(t.registerContentId(l.id))));const g={ref:wye((e=>{t.setContentRef(e),a=e}),l.ref),role:"menu",get id(){return l.id},get tabIndex(){return m.tabIndex()},get"aria-labelledby"(){return t.triggerId()},onKeyDown:Yye([l.onKeyDown,m.onKeyDown,e=>{if(Gye(e.currentTarget,e.target)&&("Tab"===e.key&&t.isOpen()&&e.preventDefault(),void 0!==i&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case OAe.next(o(),n.orientation()):e.stopPropagation(),e.preventDefault(),t.close(!0),i.setAutoFocusMenu(!0),i.nextMenu();break;case OAe.previous(o(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),t.close(!0),i.setAutoFocusMenu(!0),i.previousMenu()}}]),onMouseDown:Yye([l.onMouseDown,m.onMouseDown]),onFocusIn:Yye([l.onFocusIn,m.onFocusIn]),onFocusOut:Yye([l.onFocusOut,m.onFocusOut]),onPointerEnter:e=>{$ye(e,l.onPointerEnter),t.isOpen()&&(t.parentMenuContext()?.listState().selectionManager().setFocused(!1),t.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if($ye(e,l.onPointerMove),"mouse"!==e.pointerType)return;const a=c!==e.clientX;Gye(e.currentTarget,e.target)&&a&&(t.setPointerDir(e.clientX>c?"right":"left"),c=e.clientX)},get"data-orientation"(){return n.orientation()}};return Xa(hn,{get when(){return t.contentPresent()},get children(){return Xa(hn,{get when(){return void 0===r||null!=t.parentMenuContext()},get fallback(){return Xa(Ake,rn({as:"div"},(()=>t.dataset()),g,u))},get children(){return Xa(OSe.Positioner,{get children(){return Xa(FSe,rn({get disableOutsidePointerEvents(){return wa((()=>!!d()))()&&t.isOpen()},get excludedElements(){return[t.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Kye({"--kb-menu-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onEscapeKeyDown:h,onFocusOutside:p,get onDismiss(){return t.close}},(()=>t.dataset()),g,u))}})}})}})}function WAe(e){let a;const n=RAe(),t=jAe(),[i,r]=on(e,["ref"]);return xAe({element:()=>a??null,enabled:()=>t.contentPresent()&&n.preventScroll()}),Xa(UAe,rn({ref(e){const n=wye((e=>{a=e}),i.ref);"function"==typeof n&&n(e)}},r))}var qAe=Ba();function ZAe(e){const a=mke({id:RAe().generateId(`group-${un()}`)},e),[n,t]=ka(),i={generateId:Iye((()=>a.id)),registerLabelId:kke(t)};return Xa(qAe.Provider,{value:i,get children(){return Xa(Ake,rn({as:"div",role:"group",get"aria-labelledby"(){return n()}},a))}})}function $Ae(e){const a=function(){const e=za(qAe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=mke({id:a.generateId("label")},e),[t,i]=on(n,["id"]);return Aa((()=>xa(a.registerLabelId(t.id)))),Xa(Ake,rn({as:"span",get id(){return t.id},"aria-hidden":"true"},i))}function YAe(e){const a=jAe();return Xa(Ake,rn({as:"span","aria-hidden":"true"},(()=>a.dataset()),mke({children:"▼"},e)))}function QAe(e){return Xa(_Ae,rn({role:"menuitem",closeOnSelect:!0},e))}function XAe(e){const a=BAe(),n=mke({id:a.generateId("description")},e),[t,i]=on(n,["id"]);return Aa((()=>xa(a.registerDescription(t.id)))),Xa(Ake,rn({as:"div",get id(){return t.id}},(()=>a.dataset()),i))}function ewe(e){const a=BAe(),n=mke({id:a.generateId("indicator")},e),[t,i]=on(n,["forceMount"]);return Xa(hn,{get when(){return t.forceMount||a.isChecked()},get children(){return Xa(Ake,rn({as:"div"},(()=>a.dataset()),i))}})}function awe(e){const a=BAe(),n=mke({id:a.generateId("label")},e),[t,i]=on(n,["ref","id"]);return Aa((()=>xa(a.registerLabel(t.id)))),Xa(Ake,rn({as:"div",ref(e){const n=wye(a.setLabelRef,t.ref);"function"==typeof n&&n(e)},get id(){return t.id}},(()=>a.dataset()),i))}function nwe(e){const a=jAe();return Xa(hn,{get when(){return a.contentPresent()},get children(){return Xa(Vn,e)}})}var twe=Ba();function iwe(e){const a=mke({id:RAe().generateId(`radiogroup-${un()}`)},e),[n,t]=on(a,["value","defaultValue","onChange","disabled"]),[i,r]=Pke({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return Xa(twe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===i(),setSelectedValue:r},get children(){return Xa(ZAe,t)}})}function rwe(e){const a=function(){const e=za(twe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=mke({closeOnSelect:!1},e),[t,i]=on(n,["value","onSelect"]);return Xa(_Ae,rn({role:"menuitemradio",get checked(){return a.isSelectedValue(t.value)},onSelect:()=>{t.onSelect?.(),a.setSelectedValue(t.value)}},i))}function owe(e,a,n){const t=e.split("-")[0],i=n.getBoundingClientRect(),r=[],o=a.clientX,s=a.clientY;switch(t){case"top":r.push([o,s+5]),r.push([i.left,i.bottom]),r.push([i.left,i.top]),r.push([i.right,i.top]),r.push([i.right,i.bottom]);break;case"right":r.push([o-5,s]),r.push([i.left,i.top]),r.push([i.right,i.top]),r.push([i.right,i.bottom]),r.push([i.left,i.bottom]);break;case"bottom":r.push([o,s-5]),r.push([i.right,i.top]),r.push([i.right,i.bottom]),r.push([i.left,i.bottom]),r.push([i.left,i.top]);break;case"left":r.push([o+5,s]),r.push([i.right,i.bottom]),r.push([i.left,i.bottom]),r.push([i.left,i.top]),r.push([i.right,i.top])}return r}function swe(e){const a=RAe(),n=Rke(),t=PAe(),i=HAe(),r=JAe(),o=mke({placement:"horizontal"===a.orientation()?"bottom-start":"right-start"},e),[s,l]=on(o,["open","defaultOpen","onOpenChange"]);let u=0,c=null,d="right";const[m,h]=ka(),[p,g]=ka(),[v,f]=ka(),[y,k]=ka(),[b,S]=ka(!0),[A,w]=ka(l.placement),[C,M]=ka([]),[T,N]=ka([]),{DomCollectionProvider:x}=Hke({items:T,onItemsChange:N}),E=JSe({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:P}=cbe({show:()=>a.forceMount()||E.isOpen(),element:()=>y()??null}),j=function(e){const a=tbe(e),n=Gke({dataSource:()=>Pfe(e.dataSource),getKey:()=>Pfe(e.getKey),getTextValue:()=>Pfe(e.getTextValue),getDisabled:()=>Pfe(e.getDisabled),getSectionChildren:()=>Pfe(e.getSectionChildren),factory:a=>new sbe(e.filter?e.filter(a):a)},[()=>e.filter]),t=new obe(n,a);return ba((()=>{const e=a.focusedKey();null==e||n().getItem(e)||a.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>t}}({selectionMode:"none",dataSource:T}),L=e=>{S(e),E.open()},B=(e=!1)=>{E.close(),e&&t&&t.close(!0)},z=()=>{const e=y();e&&(Xye(e),j.selectionManager().setFocused(!0),j.selectionManager().setFocusedKey(void 0))},R=()=>{null!=r?setTimeout((()=>z())):z()},_=e=>{return d===c?.side&&(a=e,n=c?.area,!!n&&function(e,a){const[n,t]=e;let i=!1;for(let r=a.length,o=0,s=r-1;o<r;s=o++){const[e,l]=a[o],[u,c]=a[s],[,d]=a[0===s?r-1:s-1]||[0,0],m=(l-c)*(n-e)-(e-u)*(t-l);if(c<l){if(t>=c&&t<l){if(0===m)return!0;m>0&&(t===c?t>d&&(i=!i):i=!i)}}else if(l<c){if(t>l&&t<=c){if(0===m)return!0;m<0&&(t===c?t<d&&(i=!i):i=!i)}}else if(t==l&&(n>=u&&n<=e||n>=e&&n<=u))return!0}return i}([a.clientX,a.clientY],n));var a,n};pAe({isDisabled:()=>!(null==t&&E.isOpen()&&a.isModal()),targets:()=>[y(),...C()].filter(Boolean)}),Aa((()=>{const e=y();if(!e||!t)return;const a=t.registerNestedMenu(e);xa((()=>{a()}))})),Aa((()=>{void 0===t&&i?.registerMenu(a.value(),[y(),...C()])})),Aa((()=>{void 0===t&&void 0!==i&&(i.value()===a.value()?(v()?.focus(),i.autoFocusMenu()&&L(!0)):B())})),Aa((()=>{void 0===t&&void 0!==i&&E.isOpen()&&i.setValue(a.value())})),xa((()=>{void 0===t&&i?.unregisterMenu(a.value())}));const D={dataset:wa((()=>({"data-expanded":E.isOpen()?"":void 0,"data-closed":E.isOpen()?void 0:""}))),isOpen:E.isOpen,contentPresent:P,nestedMenus:C,currentPlacement:A,pointerGraceTimeoutId:()=>u,autoFocus:b,listState:()=>j,parentMenuContext:()=>t,triggerRef:v,contentRef:y,triggerId:m,contentId:p,setTriggerRef:f,setContentRef:k,open:L,close:B,toggle:e=>{S(e),E.toggle()},focusContent:R,onItemEnter:e=>{_(e)&&e.preventDefault()},onItemLeave:e=>{_(e)||R()},onTriggerLeave:e=>{_(e)&&e.preventDefault()},setPointerDir:e=>d=e,setPointerGraceTimeoutId:e=>u=e,setPointerGraceIntent:e=>c=e,registerNestedMenu:e=>{M((a=>[...a,e]));const a=t?.registerNestedMenu(e);return()=>{M((a=>Hye(a,e))),a?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:kke(h),registerContentId:kke(g)};return Xa(x,{get children(){return Xa(EAe.Provider,{value:D,get children(){return Xa(hn,{when:void 0===r,get fallback(){return l.children},get children(){return Xa(OSe,rn({anchorRef:v,contentRef:y,onCurrentPlacementChange:w},l))}})}})}})}function lwe(e){const{direction:a}=Yke();return Xa(swe,rn({get placement(){return"rtl"===a()?"left-start":"right-start"},flip:!0},e))}var uwe=(e,a)=>"ltr"===e?["horizontal"===a?"ArrowLeft":"ArrowUp"]:["horizontal"===a?"ArrowRight":"ArrowDown"];function cwe(e){const a=jAe(),n=RAe(),[t,i]=on(e,["onFocusOutside","onKeyDown"]),{direction:r}=Yke();return Xa(UAe,rn({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{t.onFocusOutside?.(e);const n=e.target;Gye(a.triggerRef(),n)||a.close()},onKeyDown:e=>{$ye(e,t.onKeyDown);const i=Gye(e.currentTarget,e.target),o=uwe(r(),n.orientation()).includes(e.key),s=null!=a.parentMenuContext();i&&o&&s&&(a.close(),Xye(a.triggerRef()))}},i))}var dwe=["Enter"," "],mwe=(e,a)=>"ltr"===e?[...dwe,"horizontal"===a?"ArrowRight":"ArrowDown"]:[...dwe,"horizontal"===a?"ArrowLeft":"ArrowUp"];function hwe(e){let a;const n=RAe(),t=jAe(),i=mke({id:n.generateId(`sub-trigger-${un()}`)},e),[r,o]=on(i,["ref","id","textValue","disabled","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);let s=null;const l=()=>{s&&window.clearTimeout(s),s=null},{direction:u}=Yke(),c=()=>r.id,d=()=>{const e=t.parentMenuContext();if(null==e)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");return e.listState().selectionManager()},m=rbe({key:c,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>r.disabled},(()=>a)),h=e=>{$ye(e,r.onClick),t.isOpen()||r.disabled||t.open(!0)},p=e=>{$ye(e,r.onKeyDown),e.repeat||r.disabled||mwe(u(),n.orientation()).includes(e.key)&&(e.stopPropagation(),e.preventDefault(),d().setFocused(!1),d().setFocusedKey(void 0),t.isOpen()||t.open("first"),t.focusContent(),t.listState().selectionManager().setFocused(!0),t.listState().selectionManager().setFocusedKey(t.listState().collection().getFirstKey()))};return Aa((()=>{if(null==t.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");xa(t.registerItemToParentDomCollection({ref:()=>a,type:"item",key:c(),textValue:r.textValue??a?.textContent??"",disabled:r.disabled??!1}))})),Aa(Ta((()=>t.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{xa((()=>{window.clearTimeout(e),t.parentMenuContext()?.setPointerGraceIntent(null)}))}))),Aa((()=>xa(t.registerTriggerId(r.id)))),xa((()=>{l()})),Xa(Ake,rn({as:"div",ref(e){const n=wye((e=>{t.setTriggerRef(e),a=e}),r.ref);"function"==typeof n&&n(e)},get id(){return r.id},role:"menuitem",get tabIndex(){return m.tabIndex()},"aria-haspopup":"true",get"aria-expanded"(){return t.isOpen()},get"aria-controls"(){return wa((()=>!!t.isOpen()))()?t.contentId():void 0},get"aria-disabled"(){return r.disabled},get"data-key"(){return m.dataKey()},get"data-highlighted"(){return d().focusedKey()===c()?"":void 0},get"data-disabled"(){return r.disabled?"":void 0},get onPointerDown(){return Yye([r.onPointerDown,m.onPointerDown])},get onPointerUp(){return Yye([r.onPointerUp,m.onPointerUp])},get onClick(){return Yye([h,m.onClick])},get onKeyDown(){return Yye([p,m.onKeyDown])},get onMouseDown(){return Yye([r.onMouseDown,m.onMouseDown])},get onFocus(){return Yye([r.onFocus,m.onFocus])},onPointerMove:e=>{if($ye(e,r.onPointerMove),"mouse"!==e.pointerType)return;const a=t.parentMenuContext();a?.onItemEnter(e),e.defaultPrevented||(r.disabled?a?.onItemLeave(e):(t.isOpen()||s||(t.parentMenuContext()?.setPointerGraceIntent(null),s=window.setTimeout((()=>{t.open(!1),l()}),100)),a?.onItemEnter(e),e.defaultPrevented||(t.listState().selectionManager().isFocused()&&(t.listState().selectionManager().setFocused(!1),t.listState().selectionManager().setFocusedKey(void 0)),Xye(e.currentTarget),a?.listState().selectionManager().setFocused(!0),a?.listState().selectionManager().setFocusedKey(c()))))},onPointerLeave:e=>{if($ye(e,r.onPointerLeave),"mouse"!==e.pointerType)return;l();const a=t.parentMenuContext(),n=t.contentRef();if(n){a?.setPointerGraceIntent({area:owe(t.currentPlacement(),e,n),side:t.currentPlacement().split("-")[0]}),window.clearTimeout(a?.pointerGraceTimeoutId());const i=window.setTimeout((()=>{a?.setPointerGraceIntent(null)}),300);a?.setPointerGraceTimeoutId(i)}else{if(a?.onTriggerLeave(e),e.defaultPrevented)return;a?.setPointerGraceIntent(null)}a?.onItemLeave(e)}},(()=>t.dataset()),o))}function pwe(e){const a=HAe(),n=mke({id:`menu-${un()}`,modal:!0},e),[t,i]=on(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),r=JSe({open:()=>t.open,defaultOpen:()=>t.defaultOpen,onOpenChange:e=>t.onOpenChange?.(e)}),o={isModal:()=>t.modal??!0,preventScroll:()=>t.preventScroll??o.isModal(),forceMount:()=>t.forceMount??!1,generateId:Iye((()=>t.id)),value:()=>t.value,orientation:()=>t.orientation??a?.orientation()??"horizontal"};return Xa(zAe.Provider,{value:o,get children(){return Xa(swe,rn({get open(){return r.isOpen()},get onOpenChange(){return r.setIsOpen}},i))}})}function gwe(e){let a;const n=mke({orientation:"horizontal"},e),[t,i]=on(n,["ref","orientation"]),r=bke((()=>a),(()=>"hr"));return Xa(Ake,rn({as:"hr",ref(e){const n=wye((e=>a=e),t.ref);"function"==typeof n&&n(e)},get role(){return"hr"!==r()?"separator":void 0},get"aria-orientation"(){return"vertical"===t.orientation?"vertical":void 0},get"data-orientation"(){return t.orientation}},i))}Bke({},{Root:()=>gwe,Separator:()=>vwe});var vwe=gwe,fwe={};function ywe(e){const a=RAe(),n=jAe(),[t,i]=on(e,["onCloseAutoFocus","onInteractOutside"]);let r=!1;return Xa(WAe,rn({onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),r||Xye(n.triggerRef()),r=!1,e.preventDefault()},onInteractOutside:e=>{t.onInteractOutside?.(e),a.isModal()&&!e.detail.isContextMenu||(r=!0)}},i))}function kwe(e){return Xa(pwe,mke({id:`dropdownmenu-${un()}`},e))}Bke(fwe,{Arrow:()=>_Se,CheckboxItem:()=>DAe,Content:()=>ywe,DropdownMenu:()=>bwe,Group:()=>ZAe,GroupLabel:()=>$Ae,Icon:()=>YAe,Item:()=>QAe,ItemDescription:()=>XAe,ItemIndicator:()=>ewe,ItemLabel:()=>awe,Portal:()=>nwe,RadioGroup:()=>iwe,RadioItem:()=>rwe,Root:()=>kwe,Separator:()=>gwe,Sub:()=>lwe,SubContent:()=>cwe,SubTrigger:()=>hwe,Trigger:()=>VAe});var bwe=Object.assign(kwe,{Arrow:_Se,CheckboxItem:DAe,Content:ywe,Group:ZAe,GroupLabel:$Ae,Icon:YAe,Item:QAe,ItemDescription:XAe,ItemIndicator:ewe,ItemLabel:awe,Portal:nwe,RadioGroup:iwe,RadioItem:rwe,Separator:gwe,Sub:lwe,SubContent:cwe,SubTrigger:hwe,Trigger:VAe}),Swe={colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000000",white:"#ffffff",neutral:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},darkGray:{50:"#525c7a",100:"#49536e",200:"#414962",300:"#394056",400:"#313749",500:"#292e3d",600:"#212530",700:"#191c24",800:"#111318",900:"#0b0d10"},gray:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},blue:{25:"#F5FAFF",50:"#EFF8FF",100:"#D1E9FF",200:"#B2DDFF",300:"#84CAFF",400:"#53B1FD",500:"#2E90FA",600:"#1570EF",700:"#175CD3",800:"#1849A9",900:"#194185"},green:{25:"#F6FEF9",50:"#ECFDF3",100:"#D1FADF",200:"#A6F4C5",300:"#6CE9A6",400:"#32D583",500:"#12B76A",600:"#039855",700:"#027A48",800:"#05603A",900:"#054F31"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},yellow:{25:"#FFFCF5",50:"#FFFAEB",100:"#FEF0C7",200:"#FEDF89",300:"#FEC84B",400:"#FDB022",500:"#F79009",600:"#DC6803",700:"#B54708",800:"#93370D",900:"#7A2E0E"},purple:{25:"#FAFAFF",50:"#F4F3FF",100:"#EBE9FE",200:"#D9D6FE",300:"#BDB4FE",400:"#9B8AFB",500:"#7A5AF8",600:"#6938EF",700:"#5925DC",800:"#4A1FB8",900:"#3E1C96"},teal:{25:"#F6FEFC",50:"#F0FDF9",100:"#CCFBEF",200:"#99F6E0",300:"#5FE9D0",400:"#2ED3B7",500:"#15B79E",600:"#0E9384",700:"#107569",800:"#125D56",900:"#134E48"},pink:{25:"#fdf2f8",50:"#fce7f3",100:"#fbcfe8",200:"#f9a8d4",300:"#f472b6",400:"#ec4899",500:"#db2777",600:"#be185d",700:"#9d174d",800:"#831843",900:"#500724"},cyan:{25:"#ecfeff",50:"#cffafe",100:"#a5f3fc",200:"#67e8f9",300:"#22d3ee",400:"#06b6d4",500:"#0891b2",600:"#0e7490",700:"#155e75",800:"#164e63",900:"#083344"}},alpha:{90:"e5",80:"cc"},font:{size:{xs:"calc(var(--tsqd-font-size) * 0.75)",sm:"calc(var(--tsqd-font-size) * 0.875)",md:"var(--tsqd-font-size)"},lineHeight:{xs:"calc(var(--tsqd-font-size) * 1)",sm:"calc(var(--tsqd-font-size) * 1.25)",md:"calc(var(--tsqd-font-size) * 1.5)"},weight:{medium:"500",semibold:"600",bold:"700"}},border:{radius:{xs:"calc(var(--tsqd-font-size) * 0.125)",sm:"calc(var(--tsqd-font-size) * 0.25)",full:"9999px"}},size:{.25:"calc(var(--tsqd-font-size) * 0.0625)",.5:"calc(var(--tsqd-font-size) * 0.125)",1:"calc(var(--tsqd-font-size) * 0.25)",1.5:"calc(var(--tsqd-font-size) * 0.375)",2:"calc(var(--tsqd-font-size) * 0.5)",2.5:"calc(var(--tsqd-font-size) * 0.625)",3:"calc(var(--tsqd-font-size) * 0.75)",3.5:"calc(var(--tsqd-font-size) * 0.875)",4:"calc(var(--tsqd-font-size) * 1)",4.5:"calc(var(--tsqd-font-size) * 1.125)",5:"calc(var(--tsqd-font-size) * 1.25)",6:"calc(var(--tsqd-font-size) * 1.5)",6.5:"calc(var(--tsqd-font-size) * 1.625)",14:"calc(var(--tsqd-font-size) * 3.5)"},shadow:{xs:(e="rgb(0 0 0 / 0.1)")=>"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:(e="rgb(0 0 0 / 0.1)")=>`0 1px 3px 0 ${e}, 0 1px 2px -1px ${e}`,md:(e="rgb(0 0 0 / 0.1)")=>`0 4px 6px -1px ${e}, 0 2px 4px -2px ${e}`,lg:(e="rgb(0 0 0 / 0.1)")=>`0 10px 15px -3px ${e}, 0 4px 6px -4px ${e}`,xl:(e="rgb(0 0 0 / 0.1)")=>`0 20px 25px -5px ${e}, 0 8px 10px -6px ${e}`,"2xl":(e="rgb(0 0 0 / 0.25)")=>`0 25px 50px -12px ${e}`,inner:(e="rgb(0 0 0 / 0.05)")=>`inset 0 2px 4px 0 ${e}`,none:()=>"none"}},Awe=Mn('<svg width=14 height=14 viewBox="0 0 14 14"fill=none xmlns=http://www.w3.org/2000/svg><path d="M13 13L9.00007 9M10.3333 5.66667C10.3333 8.244 8.244 10.3333 5.66667 10.3333C3.08934 10.3333 1 8.244 1 5.66667C1 3.08934 3.08934 1 5.66667 1C8.244 1 10.3333 3.08934 10.3333 5.66667Z"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),wwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9 3H15M3 6H21M19 6L18.2987 16.5193C18.1935 18.0975 18.1409 18.8867 17.8 19.485C17.4999 20.0118 17.0472 20.4353 16.5017 20.6997C15.882 21 15.0911 21 13.5093 21H10.4907C8.90891 21 8.11803 21 7.49834 20.6997C6.95276 20.4353 6.50009 20.0118 6.19998 19.485C5.85911 18.8867 5.8065 18.0975 5.70129 16.5193L5 6M10 10.5V15.5M14 10.5V15.5"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Cwe=Mn('<svg width=10 height=6 viewBox="0 0 10 6"fill=none xmlns=http://www.w3.org/2000/svg><path d="M1 1L5 5L9 1"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Mwe=Mn('<svg width=12 height=12 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 13.3333V2.66667M8 2.66667L4 6.66667M8 2.66667L12 6.66667"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Twe=Mn('<svg width=12 height=12 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 2.66667V13.3333M8 13.3333L4 9.33333M8 13.3333L12 9.33333"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Nwe=Mn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M12 2v2m0 16v2M4 12H2m4.314-5.686L4.9 4.9m12.786 1.414L19.1 4.9M6.314 17.69 4.9 19.104m12.786-1.414 1.414 1.414M22 12h-2m-3 0a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),xwe=Mn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M22 15.844a10.424 10.424 0 0 1-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 0 0 2 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Ewe=Mn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 21h8m-4-4v4m-5.2-4h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 14.72 22 13.88 22 12.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 3 18.88 3 17.2 3H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 5.28 2 6.12 2 7.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 17 5.12 17 6.8 17Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Pwe=Mn('<svg stroke=currentColor fill=currentColor stroke-width=0 viewBox="0 0 24 24"height=1em width=1em xmlns=http://www.w3.org/2000/svg><path fill=none d="M0 0h24v24H0z"></path><path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3a4.237 4.237 0 00-6 0zm-4-4l2 2a7.074 7.074 0 0110 0l2-2C15.14 9.14 8.87 9.14 5 13z">'),jwe=Mn('<svg stroke-width=0 viewBox="0 0 24 24"height=1em width=1em xmlns=http://www.w3.org/2000/svg><path fill=none d="M24 .01c0-.01 0-.01 0 0L0 0v24h24V.01zM0 0h24v24H0V0zm0 0h24v24H0V0z"></path><path d="M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7l2-2zm-4 4a9.793 9.793 0 00-4.49-2.56l3.53 3.53.96-.97zM2 3.05L5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24A9.684 9.684 0 005 13v.01L6.99 15a7.042 7.042 0 014.92-2.06L18.98 20l1.27-1.26L3.29 1.79 2 3.05zM9 17l3 3 3-3a4.237 4.237 0 00-6 0z">'),Lwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9.3951 19.3711L9.97955 20.6856C10.1533 21.0768 10.4368 21.4093 10.7958 21.6426C11.1547 21.8759 11.5737 22.0001 12.0018 22C12.4299 22.0001 12.8488 21.8759 13.2078 21.6426C13.5667 21.4093 13.8503 21.0768 14.024 20.6856L14.6084 19.3711C14.8165 18.9047 15.1664 18.5159 15.6084 18.26C16.0532 18.0034 16.5678 17.8941 17.0784 17.9478L18.5084 18.1C18.9341 18.145 19.3637 18.0656 19.7451 17.8713C20.1265 17.6771 20.4434 17.3763 20.6573 17.0056C20.8715 16.635 20.9735 16.2103 20.9511 15.7829C20.9286 15.3555 20.7825 14.9438 20.5307 14.5978L19.684 13.4344C19.3825 13.0171 19.2214 12.5148 19.224 12C19.2239 11.4866 19.3865 10.9864 19.6884 10.5711L20.5351 9.40778C20.787 9.06175 20.933 8.65007 20.9555 8.22267C20.978 7.79528 20.8759 7.37054 20.6618 7C20.4479 6.62923 20.131 6.32849 19.7496 6.13423C19.3681 5.93997 18.9386 5.86053 18.5129 5.90556L17.0829 6.05778C16.5722 6.11141 16.0577 6.00212 15.6129 5.74556C15.17 5.48825 14.82 5.09736 14.6129 4.62889L14.024 3.31444C13.8503 2.92317 13.5667 2.59072 13.2078 2.3574C12.8488 2.12408 12.4299 1.99993 12.0018 2C11.5737 1.99993 11.1547 2.12408 10.7958 2.3574C10.4368 2.59072 10.1533 2.92317 9.97955 3.31444L9.3951 4.62889C9.18803 5.09736 8.83798 5.48825 8.3951 5.74556C7.95032 6.00212 7.43577 6.11141 6.9251 6.05778L5.49066 5.90556C5.06499 5.86053 4.6354 5.93997 4.25397 6.13423C3.87255 6.32849 3.55567 6.62923 3.34177 7C3.12759 7.37054 3.02555 7.79528 3.04804 8.22267C3.07052 8.65007 3.21656 9.06175 3.46844 9.40778L4.3151 10.5711C4.61704 10.9864 4.77964 11.4866 4.77955 12C4.77964 12.5134 4.61704 13.0137 4.3151 13.4289L3.46844 14.5922C3.21656 14.9382 3.07052 15.3499 3.04804 15.7773C3.02555 16.2047 3.12759 16.6295 3.34177 17C3.55589 17.3706 3.8728 17.6712 4.25417 17.8654C4.63554 18.0596 5.06502 18.1392 5.49066 18.0944L6.92066 17.9422C7.43133 17.8886 7.94587 17.9979 8.39066 18.2544C8.83519 18.511 9.18687 18.902 9.3951 19.3711Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path><path d="M12 15C13.6568 15 15 13.6569 15 12C15 10.3431 13.6568 9 12 9C10.3431 9 8.99998 10.3431 8.99998 12C8.99998 13.6569 10.3431 15 12 15Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Bwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M16 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V8M11.5 12.5L17 7M17 7H12M17 7V12M6.2 21H8.8C9.9201 21 10.4802 21 10.908 20.782C11.2843 20.5903 11.5903 20.2843 11.782 19.908C12 19.4802 12 18.9201 12 17.8V15.2C12 14.0799 12 13.5198 11.782 13.092C11.5903 12.7157 11.2843 12.4097 10.908 12.218C10.4802 12 9.92011 12 8.8 12H6.2C5.0799 12 4.51984 12 4.09202 12.218C3.71569 12.4097 3.40973 12.7157 3.21799 13.092C3 13.5198 3 14.0799 3 15.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),zwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path class=copier d="M8 8V5.2C8 4.0799 8 3.51984 8.21799 3.09202C8.40973 2.71569 8.71569 2.40973 9.09202 2.21799C9.51984 2 10.0799 2 11.2 2H18.8C19.9201 2 20.4802 2 20.908 2.21799C21.2843 2.40973 21.5903 2.71569 21.782 3.09202C22 3.51984 22 4.0799 22 5.2V12.8C22 13.9201 22 14.4802 21.782 14.908C21.5903 15.2843 21.2843 15.5903 20.908 15.782C20.4802 16 19.9201 16 18.8 16H16M5.2 22H12.8C13.9201 22 14.4802 22 14.908 21.782C15.2843 21.5903 15.5903 21.2843 15.782 20.908C16 20.4802 16 19.9201 16 18.8V11.2C16 10.0799 16 9.51984 15.782 9.09202C15.5903 8.71569 15.2843 8.40973 14.908 8.21799C14.4802 8 13.9201 8 12.8 8H5.2C4.0799 8 3.51984 8 3.09202 8.21799C2.71569 8.40973 2.40973 8.71569 2.21799 9.09202C2 9.51984 2 10.0799 2 11.2V18.8C2 19.9201 2 20.4802 2.21799 20.908C2.40973 21.2843 2.71569 21.5903 3.09202 21.782C3.51984 22 4.07989 22 5.2 22Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round stroke=currentColor>'),Rwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M2.5 21.4998L8.04927 19.3655C8.40421 19.229 8.58168 19.1607 8.74772 19.0716C8.8952 18.9924 9.0358 18.901 9.16804 18.7984C9.31692 18.6829 9.45137 18.5484 9.72028 18.2795L21 6.99982C22.1046 5.89525 22.1046 4.10438 21 2.99981C19.8955 1.89525 18.1046 1.89524 17 2.99981L5.72028 14.2795C5.45138 14.5484 5.31692 14.6829 5.20139 14.8318C5.09877 14.964 5.0074 15.1046 4.92823 15.2521C4.83911 15.4181 4.77085 15.5956 4.63433 15.9506L2.5 21.4998ZM2.5 21.4998L4.55812 16.1488C4.7054 15.7659 4.77903 15.5744 4.90534 15.4867C5.01572 15.4101 5.1523 15.3811 5.2843 15.4063C5.43533 15.4351 5.58038 15.5802 5.87048 15.8703L8.12957 18.1294C8.41967 18.4195 8.56472 18.5645 8.59356 18.7155C8.61877 18.8475 8.58979 18.9841 8.51314 19.0945C8.42545 19.2208 8.23399 19.2944 7.85107 19.4417L2.5 21.4998Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),_we=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M7.5 12L10.5 15L16.5 9M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Dwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9 9L15 15M15 9L9 15M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"stroke=#F04438 stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Kwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 xmlns=http://www.w3.org/2000/svg><rect class=list width=20 height=20 y=2 x=2 rx=2></rect><line class=list-item y1=7 y2=7 x1=6 x2=18></line><line class=list-item y2=12 y1=12 x1=6 x2=18></line><line class=list-item y1=17 y2=17 x1=6 x2=18>'),Hwe=Mn('<svg viewBox="0 0 24 24"height=20 width=20 fill=none xmlns=http://www.w3.org/2000/svg><path d="M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Owe=Mn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Iwe=Mn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M12 2V6M12 18V22M6 12H2M22 12H18M19.0784 19.0784L16.25 16.25M19.0784 4.99994L16.25 7.82837M4.92157 19.0784L7.75 16.25M4.92157 4.99994L7.75 7.82837"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path><animateTransform attributeName=transform attributeType=XML type=rotate from=0 to=360 dur=2s repeatCount=indefinite>'),Gwe=Mn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M15 9L9 15M9 9L15 15M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Vwe=Mn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9.5 15V9M14.5 15V9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Fwe=Mn('<svg version=1.0 viewBox="0 0 633 633"><linearGradient x1=-666.45 x2=-666.45 y1=163.28 y2=163.99 gradientTransform="matrix(633 0 0 633 422177 -103358)"gradientUnits=userSpaceOnUse><stop stop-color=#6BDAFF offset=0></stop><stop stop-color=#F9FFB5 offset=.32></stop><stop stop-color=#FFA770 offset=.71></stop><stop stop-color=#FF7373 offset=1></stop></linearGradient><circle cx=316.5 cy=316.5 r=316.5></circle><defs><filter x=-137.5 y=412 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=412 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=610.5 rx=214.5 ry=186 fill=#015064 stroke=#00CFE2 stroke-width=25></ellipse></g><defs><filter x=316.5 y=412 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=412 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=610.5 rx=214.5 ry=186 fill=#015064 stroke=#00CFE2 stroke-width=25></ellipse></g><defs><filter x=-137.5 y=450 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=450 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=648.5 rx=214.5 ry=186 fill=#015064 stroke=#00A8B8 stroke-width=25></ellipse></g><defs><filter x=316.5 y=450 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=450 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=648.5 rx=214.5 ry=186 fill=#015064 stroke=#00A8B8 stroke-width=25></ellipse></g><defs><filter x=-137.5 y=486 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=486 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=684.5 rx=214.5 ry=186 fill=#015064 stroke=#007782 stroke-width=25></ellipse></g><defs><filter x=316.5 y=486 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=486 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=684.5 rx=214.5 ry=186 fill=#015064 stroke=#007782 stroke-width=25></ellipse></g><defs><filter x=272.2 y=308 width=176.9 height=129.3 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=272.2 y=308 width=176.9 height=129.3 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><line x1=436 x2=431 y1=403.2 y2=431.8 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><line x1=291 x2=280 y1=341.5 y2=403.5 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><line x1=332.9 x2=328.6 y1=384.1 y2=411.2 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><linearGradient x1=-670.75 x2=-671.59 y1=164.4 y2=164.49 gradientTransform="matrix(-184.16 -32.472 -11.461 64.997 -121359 -32126)"gradientUnits=userSpaceOnUse><stop stop-color=#EE2700 offset=0></stop><stop stop-color=#FF008E offset=1></stop></linearGradient><path d="m344.1 363 97.7 17.2c5.8 2.1 8.2 6.1 7.1 12.1s-4.7 9.2-11 9.9l-106-18.7-57.5-59.2c-3.2-4.8-2.9-9.1 0.8-12.8s8.3-4.4 13.7-2.1l55.2 53.6z"clip-rule=evenodd fill-rule=evenodd></path><line x1=428.2 x2=429.1 y1=384.5 y2=378 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=395.2 x2=396.1 y1=379.5 y2=373 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=362.2 x2=363.1 y1=373.5 y2=367.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=324.2 x2=328.4 y1=351.3 y2=347.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=303.2 x2=307.4 y1=331.3 y2=327.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line></g><defs><filter x=73.2 y=113.8 width=280.6 height=317.4 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=73.2 y=113.8 width=280.6 height=317.4 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-672.16 x2=-672.16 y1=165.03 y2=166.03 gradientTransform="matrix(-100.18 48.861 97.976 200.88 -83342 -93.059)"gradientUnits=userSpaceOnUse><stop stop-color=#A17500 offset=0></stop><stop stop-color=#5D2100 offset=1></stop></linearGradient><path d="m192.3 203c8.1 37.3 14 73.6 17.8 109.1 3.8 35.4 2.8 75.1-3 119.2l61.2-16.7c-15.6-59-25.2-97.9-28.6-116.6s-10.8-51.9-22.1-99.6l-25.3 4.6"clip-rule=evenodd fill-rule=evenodd></path><g stroke=#2F8A00><linearGradient x1=-660.23 x2=-660.23 y1=166.72 y2=167.72 gradientTransform="matrix(92.683 4.8573 -2.0259 38.657 61680 -3088.6)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m195 183.9s-12.6-22.1-36.5-29.9c-15.9-5.2-34.4-1.5-55.5 11.1 15.9 14.3 29.5 22.6 40.7 24.9 16.8 3.6 51.3-6.1 51.3-6.1z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-661.36 x2=-661.36 y1=164.18 y2=165.18 gradientTransform="matrix(110 5.7648 -6.3599 121.35 73933 -15933)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5s-47.5-8.5-83.2 15.7c-23.8 16.2-34.3 49.3-31.6 99.4 30.3-27.8 52.1-48.5 65.2-61.9 19.8-20.2 49.6-53.2 49.6-53.2z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-656.79 x2=-656.79 y1=165.15 y2=166.15 gradientTransform="matrix(62.954 3.2993 -3.5023 66.828 42156 -8754.1)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m195 183.9c-0.8-21.9 6-38 20.6-48.2s29.8-15.4 45.5-15.3c-6.1 21.4-14.5 35.8-25.2 43.4s-24.4 14.2-40.9 20.1z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-663.07 x2=-663.07 y1=165.44 y2=166.44 gradientTransform="matrix(152.47 7.9907 -3.0936 59.029 101884 -4318.7)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c31.9-30 64.1-39.7 96.7-29s50.8 30.4 54.6 59.1c-35.2-5.5-60.4-9.6-75.8-12.1-15.3-2.6-40.5-8.6-75.5-18z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-662.57 x2=-662.57 y1=164.44 y2=165.44 gradientTransform="matrix(136.46 7.1517 -5.2163 99.533 91536 -11442)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c35.8-7.6 65.6-0.2 89.2 22s37.7 49 42.3 80.3c-39.8-9.7-68.3-23.8-85.5-42.4s-32.5-38.5-46-59.9z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-656.43 x2=-656.43 y1=163.86 y2=164.86 gradientTransform="matrix(60.866 3.1899 -8.7773 167.48 41560 -25168)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c-33.6 13.8-53.6 35.7-60.1 65.6s-3.6 63.1 8.7 99.6c27.4-40.3 43.2-69.6 47.4-88s5.6-44.1 4-77.2z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><path d="m196.5 182.3c-14.8 21.6-25.1 41.4-30.8 59.4s-9.5 33-11.1 45.1"fill=none stroke-linecap=round stroke-width=8></path><path d="m194.9 185.7c-24.4 1.7-43.8 9-58.1 21.8s-24.7 25.4-31.3 37.8"fill=none stroke-linecap=round stroke-width=8></path><path d="m204.5 176.4c29.7-6.7 52-8.4 67-5.1s26.9 8.6 35.8 15.9"fill=none stroke-linecap=round stroke-width=8></path><path d="m196.5 181.4c20.3 9.9 38.2 20.5 53.9 31.9s27.4 22.1 35.1 32"fill=none stroke-linecap=round stroke-width=8></path></g></g><defs><filter x=50.5 y=399 width=532 height=633 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=50.5 y=399 width=532 height=633 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-666.06 x2=-666.23 y1=163.36 y2=163.75 gradientTransform="matrix(532 0 0 633 354760 -102959)"gradientUnits=userSpaceOnUse><stop stop-color=#FFF400 offset=0></stop><stop stop-color=#3C8700 offset=1></stop></linearGradient><ellipse cx=316.5 cy=715.5 rx=266 ry=316.5></ellipse></g><defs><filter x=391 y=-24 width=288 height=283 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=391 y=-24 width=288 height=283 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-664.56 x2=-664.56 y1=163.79 y2=164.79 gradientTransform="matrix(227 0 0 227 151421 -37204)"gradientUnits=userSpaceOnUse><stop stop-color=#FFDF00 offset=0></stop><stop stop-color=#FF9D00 offset=1></stop></linearGradient><circle cx=565.5 cy=89.5 r=113.5></circle><linearGradient x1=-644.5 x2=-645.77 y1=342 y2=342 gradientTransform="matrix(30 0 0 1 19770 -253)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=427 x2=397 y1=89 y2=89 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-641.56 x2=-642.83 y1=196.02 y2=196.07 gradientTransform="matrix(26.5 0 0 5.5 17439 -1025.5)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=430.5 x2=404 y1=55.5 y2=50 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-643.73 x2=-645 y1=185.83 y2=185.9 gradientTransform="matrix(29 0 0 8 19107 -1361)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=431 x2=402 y1=122 y2=130 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-638.94 x2=-640.22 y1=177.09 y2=177.39 gradientTransform="matrix(24 0 0 13 15783 -2145)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=442 x2=418 y1=153 y2=166 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-633.42 x2=-634.7 y1=172.41 y2=173.31 gradientTransform="matrix(20 0 0 19 13137 -3096)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=464 x2=444 y1=180 y2=199 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-619.05 x2=-619.52 y1=170.82 y2=171.82 gradientTransform="matrix(13.83 0 0 22.85 9050 -3703.4)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=491.4 x2=477.5 y1=203 y2=225.9 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-578.5 x2=-578.63 y1=170.31 y2=171.31 gradientTransform="matrix(7.5 0 0 24.5 4860 -3953)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=524.5 x2=517 y1=219.5 y2=244 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=666.5 x2=666.5 y1=170.31 y2=171.31 gradientTransform="matrix(.5 0 0 24.5 231.5 -3944)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=564.5 x2=565 y1=228.5 y2=253 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12>');function Jwe(){return Awe()}function Uwe(){return wwe()}function Wwe(){return Cwe()}function qwe(){return Mwe()}function Zwe(){return Twe()}function $we(){return(e=Twe()).style.setProperty("transform","rotate(90deg)"),e;var e}function Ywe(){return(e=Twe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function Qwe(){return Nwe()}function Xwe(){return xwe()}function eCe(){return Ewe()}function aCe(){return Pwe()}function nCe(){return jwe()}function tCe(){return Lwe()}function iCe(){return Bwe()}function rCe(){return zwe()}function oCe(){return Rwe()}function sCe(e){return a=_we(),n=a.firstChild,Sa((()=>Nn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),a;var a,n}function lCe(){return Dwe()}function uCe(){return Kwe()}function cCe(e){return[Xa(hn,{get when(){return e.checked},get children(){var a=_we(),n=a.firstChild;return Sa((()=>Nn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),a}}),Xa(hn,{get when(){return!e.checked},get children(){var a=Hwe(),n=a.firstChild;return Sa((()=>Nn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),a}})]}function dCe(){return Owe()}function mCe(){return Iwe()}function hCe(){return Gwe()}function pCe(){return Vwe()}function gCe(){const e=un();return a=Fwe(),r=(i=(t=(n=a.firstChild).nextSibling).nextSibling).firstChild,s=(o=i.nextSibling).firstChild,c=(u=(l=o.nextSibling).nextSibling).firstChild,m=(d=u.nextSibling).firstChild,g=(p=(h=d.nextSibling).nextSibling).firstChild,f=(v=p.nextSibling).firstChild,b=(k=(y=v.nextSibling).nextSibling).firstChild,A=(S=k.nextSibling).firstChild,M=(C=(w=S.nextSibling).nextSibling).firstChild,N=(T=C.nextSibling).firstChild,P=(E=(x=T.nextSibling).nextSibling).firstChild,L=(j=E.nextSibling).firstChild,R=(z=(B=j.nextSibling).nextSibling).firstChild,D=(_=z.nextSibling).firstChild,O=(H=(K=_.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,G=(I=K.nextSibling).firstChild,F=(V=I.nextSibling).firstChild,re=(ie=(te=(ne=(ae=(ee=(X=(Q=(Y=($=(Z=(q=(W=(U=(J=V.nextSibling).firstChild).nextSibling).nextSibling.firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,se=(oe=J.nextSibling).firstChild,ue=(le=oe.nextSibling).firstChild,me=(de=(ce=le.nextSibling).firstChild).nextSibling,pe=(he=ce.nextSibling).firstChild,ve=(ge=he.nextSibling).firstChild,Re=(ze=(Be=(Le=(je=(Pe=(Ee=(xe=(Ne=(Te=(Me=(Ce=(we=(Ae=(Se=(be=(ke=(ye=(fe=ge.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,Nn(n,"id",`a-${e}`),Nn(t,"fill",`url(#a-${e})`),Nn(r,"id",`am-${e}`),Nn(o,"id",`b-${e}`),Nn(s,"filter",`url(#am-${e})`),Nn(l,"mask",`url(#b-${e})`),Nn(c,"id",`ah-${e}`),Nn(d,"id",`k-${e}`),Nn(m,"filter",`url(#ah-${e})`),Nn(h,"mask",`url(#k-${e})`),Nn(g,"id",`ae-${e}`),Nn(v,"id",`j-${e}`),Nn(f,"filter",`url(#ae-${e})`),Nn(y,"mask",`url(#j-${e})`),Nn(b,"id",`ai-${e}`),Nn(S,"id",`i-${e}`),Nn(A,"filter",`url(#ai-${e})`),Nn(w,"mask",`url(#i-${e})`),Nn(M,"id",`aj-${e}`),Nn(T,"id",`h-${e}`),Nn(N,"filter",`url(#aj-${e})`),Nn(x,"mask",`url(#h-${e})`),Nn(P,"id",`ag-${e}`),Nn(j,"id",`g-${e}`),Nn(L,"filter",`url(#ag-${e})`),Nn(B,"mask",`url(#g-${e})`),Nn(R,"id",`af-${e}`),Nn(_,"id",`f-${e}`),Nn(D,"filter",`url(#af-${e})`),Nn(K,"mask",`url(#f-${e})`),Nn(H,"id",`m-${e}`),Nn(O,"fill",`url(#m-${e})`),Nn(G,"id",`ak-${e}`),Nn(V,"id",`e-${e}`),Nn(F,"filter",`url(#ak-${e})`),Nn(J,"mask",`url(#e-${e})`),Nn(U,"id",`n-${e}`),Nn(W,"fill",`url(#n-${e})`),Nn(q,"id",`r-${e}`),Nn(Z,"fill",`url(#r-${e})`),Nn($,"id",`s-${e}`),Nn(Y,"fill",`url(#s-${e})`),Nn(Q,"id",`q-${e}`),Nn(X,"fill",`url(#q-${e})`),Nn(ee,"id",`p-${e}`),Nn(ae,"fill",`url(#p-${e})`),Nn(ne,"id",`o-${e}`),Nn(te,"fill",`url(#o-${e})`),Nn(ie,"id",`l-${e}`),Nn(re,"fill",`url(#l-${e})`),Nn(se,"id",`al-${e}`),Nn(le,"id",`d-${e}`),Nn(ue,"filter",`url(#al-${e})`),Nn(ce,"mask",`url(#d-${e})`),Nn(de,"id",`u-${e}`),Nn(me,"fill",`url(#u-${e})`),Nn(pe,"id",`ad-${e}`),Nn(ge,"id",`c-${e}`),Nn(ve,"filter",`url(#ad-${e})`),Nn(fe,"mask",`url(#c-${e})`),Nn(ye,"id",`t-${e}`),Nn(ke,"fill",`url(#t-${e})`),Nn(be,"id",`v-${e}`),Nn(Se,"stroke",`url(#v-${e})`),Nn(Ae,"id",`aa-${e}`),Nn(we,"stroke",`url(#aa-${e})`),Nn(Ce,"id",`w-${e}`),Nn(Me,"stroke",`url(#w-${e})`),Nn(Te,"id",`ac-${e}`),Nn(Ne,"stroke",`url(#ac-${e})`),Nn(xe,"id",`ab-${e}`),Nn(Ee,"stroke",`url(#ab-${e})`),Nn(Pe,"id",`y-${e}`),Nn(je,"stroke",`url(#y-${e})`),Nn(Le,"id",`x-${e}`),Nn(Be,"stroke",`url(#x-${e})`),Nn(ze,"id",`z-${e}`),Nn(Re,"stroke",`url(#z-${e})`),a;var a,n,t,i,r,o,s,l,u,c,d,m,h,p,g,v,f,y,k,b,S,A,w,C,M,T,N,x,E,P,j,L,B,z,R,_,D,K,H,O,I,G,V,F,J,U,W,q,Z,$,Y,Q,X,ee,ae,ne,te,ie,re,oe,se,le,ue,ce,de,me,he,pe,ge,ve,fe,ye,ke,be,Se,Ae,we,Ce,Me,Te,Ne,xe,Ee,Pe,je,Le,Be,ze,Re}var vCe=Mn('<span><svg width=16 height=16 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M6 12L10 8L6 4"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),fCe=Mn('<button title="Copy object to clipboard">'),yCe=Mn('<button title="Remove all items"aria-label="Remove all items">'),kCe=Mn('<button title="Delete item"aria-label="Delete item">'),bCe=Mn('<button title="Toggle value"aria-label="Toggle value">'),SCe=Mn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),ACe=Mn("<div>"),wCe=Mn("<div><button> <span></span> <span> "),CCe=Mn("<input>"),MCe=Mn("<span>"),TCe=Mn("<div><span>:"),NCe=Mn("<div><div><button> [<!>...<!>]");var xCe=e=>{const a=qfe(),n=Vfe().shadowDOMTarget?kye.bind({target:Vfe().shadowDOMTarget}):kye,t=wa((()=>"dark"===a()?DCe(n):_Ce(n)));return i=vCe(),Sa((()=>xn(i,Sye(t().expander,n`
94
+ */Ioe.exports="production"===process.env.NODE_ENV?function(){if(Ooe)return Goe;Ooe=1;var e="function"==typeof Object.is?Object.is:function(e,a){return e===a&&(0!==e||1/e==1/a)||e!=e&&a!=a},n=a.useState,t=a.useEffect,i=a.useLayoutEffect,r=a.useDebugValue;function o(a){var n=a.getSnapshot;a=a.value;try{var t=n();return!e(a,t)}catch(i){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,a){return a()}:function(e,a){var s=a(),l=n({inst:{value:s,getSnapshot:a}}),u=l[0].inst,c=l[1];return i((function(){u.value=s,u.getSnapshot=a,o(u)&&c({inst:u})}),[e,s,a]),t((function(){return o(u)&&c({inst:u}),e((function(){o(u)&&c({inst:u})}))}),[e]),r(s),s};return Goe.useSyncExternalStore=void 0!==a.useSyncExternalStore?a.useSyncExternalStore:s,Goe}():(Voe||(Voe=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var a=e.getSnapshot;e=e.value;try{var n=a();return!t(e,n)}catch(i){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=a,t="function"==typeof Object.is?Object.is:function(e,a){return e===a&&(0!==e||1/e==1/a)||e!=e&&a!=a},i=n.useState,r=n.useEffect,o=n.useLayoutEffect,s=n.useDebugValue,l=!1,u=!1,c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,a){return a()}:function(a,c){l||void 0===n.startTransition||(l=!0);var d=c();if(!u){var m=c();t(d,m)||(u=!0)}var h=(m=i({inst:{value:d,getSnapshot:c}}))[0].inst,p=m[1];return o((function(){h.value=d,h.getSnapshot=c,e(h)&&p({inst:h})}),[a,d,c]),r((function(){return e(h)&&p({inst:h}),a((function(){e(h)&&p({inst:h})}))}),[a]),s(d),d};Foe.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Foe);var Joe=Ioe.exports,Uoe='[cmdk-group=""]',Woe='[cmdk-group-items=""]',qoe='[cmdk-item=""]',Zoe=`${qoe}:not([aria-disabled="true"])`,$oe="cmdk-item-select",Yoe="data-value",Qoe=(e,a,n)=>Hoe(e,a,n),Xoe=r.createContext(void 0),ese=()=>r.useContext(Xoe),ase=r.createContext(void 0),nse=()=>r.useContext(ase),tse=r.createContext(void 0),ise=r.forwardRef(((e,a)=>{let n=yse((()=>{var a,n;return{search:"",value:null!=(n=null!=(a=e.value)?a:e.defaultValue)?n:"",filtered:{count:0,items:new Map,groups:new Set}}})),t=yse((()=>new Set)),i=yse((()=>new Map)),o=yse((()=>new Map)),s=yse((()=>new Set)),l=vse(e),{label:u,children:c,value:d,onValueChange:m,filter:h,shouldFilter:p,loop:g,disablePointerSelection:v=!1,vimBindings:f=!0,...y}=e,k=HX(),b=HX(),S=HX(),A=r.useRef(null),w=Ase();fse((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,C.emit()}}),[d]),fse((()=>{w(6,P)}),[]);let C=r.useMemo((()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,a,t)=>{var i,r,o;if(!Object.is(n.current[e],a)){if(n.current[e]=a,"search"===e)E(),N(),w(1,x);else if("value"===e&&(t||w(5,P),void 0!==(null==(i=l.current)?void 0:i.value))){return void(null==(o=(r=l.current).onValueChange)||o.call(r,null!=a?a:""))}C.emit()}},emit:()=>{s.current.forEach((e=>e()))}})),[]),M=r.useMemo((()=>({value:(e,a,t)=>{var i;a!==(null==(i=o.current.get(e))?void 0:i.value)&&(o.current.set(e,{value:a,keywords:t}),n.current.filtered.items.set(e,T(a,t)),w(2,(()=>{N(),C.emit()})))},item:(e,a)=>(t.current.add(e),a&&(i.current.has(a)?i.current.get(a).add(e):i.current.set(a,new Set([e]))),w(3,(()=>{E(),N(),n.current.value||x(),C.emit()})),()=>{o.current.delete(e),t.current.delete(e),n.current.filtered.items.delete(e);let a=j();w(4,(()=>{E(),(null==a?void 0:a.getAttribute("id"))===e&&x(),C.emit()}))}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{o.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:k,inputId:S,labelId:b,listInnerRef:A})),[]);function T(e,a){var t,i;let r=null!=(i=null==(t=l.current)?void 0:t.filter)?i:Qoe;return e?r(e,n.current.search,a):0}function N(){if(!n.current.search||!1===l.current.shouldFilter)return;let e=n.current.filtered.items,a=[];n.current.filtered.groups.forEach((n=>{let t=i.current.get(n),r=0;t.forEach((a=>{let n=e.get(a);r=Math.max(n,r)})),a.push([n,r])}));let t=A.current;L().sort(((a,n)=>{var t,i;let r=a.getAttribute("id"),o=n.getAttribute("id");return(null!=(t=e.get(o))?t:0)-(null!=(i=e.get(r))?i:0)})).forEach((e=>{let a=e.closest(Woe);a?a.appendChild(e.parentElement===a?e:e.closest(`${Woe} > *`)):t.appendChild(e.parentElement===t?e:e.closest(`${Woe} > *`))})),a.sort(((e,a)=>a[1]-e[1])).forEach((e=>{var a;let n=null==(a=A.current)?void 0:a.querySelector(`${Uoe}[${Yoe}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function x(){let e=L().find((e=>"true"!==e.getAttribute("aria-disabled"))),a=null==e?void 0:e.getAttribute(Yoe);C.setState("value",a||void 0)}function E(){var e,a,r,s;if(!n.current.search||!1===l.current.shouldFilter)return void(n.current.filtered.count=t.current.size);n.current.filtered.groups=new Set;let u=0;for(let i of t.current){let t=T(null!=(a=null==(e=o.current.get(i))?void 0:e.value)?a:"",null!=(s=null==(r=o.current.get(i))?void 0:r.keywords)?s:[]);n.current.filtered.items.set(i,t),t>0&&u++}for(let[t,o]of i.current)for(let e of o)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(t);break}n.current.filtered.count=u}function P(){var e,a,n;let t=j();t&&((null==(e=t.parentElement)?void 0:e.firstChild)===t&&(null==(n=null==(a=t.closest(Uoe))?void 0:a.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),t.scrollIntoView({block:"nearest"}))}function j(){var e;return null==(e=A.current)?void 0:e.querySelector(`${qoe}[aria-selected="true"]`)}function L(){var e;return Array.from((null==(e=A.current)?void 0:e.querySelectorAll(Zoe))||[])}function B(e){let a=L()[e];a&&C.setState("value",a.getAttribute(Yoe))}function z(e){var a;let n=j(),t=L(),i=t.findIndex((e=>e===n)),r=t[i+e];null!=(a=l.current)&&a.loop&&(r=i+e<0?t[t.length-1]:i+e===t.length?t[0]:t[i+e]),r&&C.setState("value",r.getAttribute(Yoe))}function R(e){let a,n=j(),t=null==n?void 0:n.closest(Uoe);for(;t&&!a;)t=e>0?pse(t,Uoe):gse(t,Uoe),a=null==t?void 0:t.querySelector(Zoe);a?C.setState("value",a.getAttribute(Yoe)):z(e)}let _=()=>B(L().length-1),D=e=>{e.preventDefault(),e.metaKey?_():e.altKey?R(1):z(1)},K=e=>{e.preventDefault(),e.metaKey?B(0):e.altKey?R(-1):z(-1)};return r.createElement(uX.div,{ref:a,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var a;if(null==(a=y.onKeyDown)||a.call(y,e),!e.defaultPrevented)switch(e.key){case"n":case"j":f&&e.ctrlKey&&D(e);break;case"ArrowDown":D(e);break;case"p":case"k":f&&e.ctrlKey&&K(e);break;case"ArrowUp":K(e);break;case"Home":e.preventDefault(),B(0);break;case"End":e.preventDefault(),_();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let a=j();if(a){let e=new Event($oe);a.dispatchEvent(e)}}}}},r.createElement("label",{"cmdk-label":"",htmlFor:M.inputId,id:M.labelId,style:Cse},u),wse(e,(e=>r.createElement(ase.Provider,{value:C},r.createElement(Xoe.Provider,{value:M},e)))))})),rse=r.forwardRef(((e,a)=>{var n,t;let i=HX(),o=r.useRef(null),s=r.useContext(tse),l=ese(),u=vse(e),c=null!=(t=null==(n=u.current)?void 0:n.forceMount)?t:null==s?void 0:s.forceMount;fse((()=>{if(!c)return l.item(i,null==s?void 0:s.id)}),[c]);let d=Sse(i,o,[e.value,e.children,o],e.keywords),m=nse(),h=bse((e=>e.value&&e.value===d.current)),p=bse((e=>!(!c&&!1!==l.filter())||(!e.search||e.filtered.items.get(i)>0)));function g(){var e,a;v(),null==(a=(e=u.current).onSelect)||a.call(e,d.current)}function v(){m.setState("value",d.current,!0)}if(r.useEffect((()=>{let a=o.current;if(a&&!e.disabled)return a.addEventListener($oe,g),()=>a.removeEventListener($oe,g)}),[p,e.onSelect,e.disabled]),!p)return null;let{disabled:f,value:y,onSelect:k,forceMount:b,keywords:S,...A}=e;return r.createElement(uX.div,{ref:kse([o,a]),...A,id:i,"cmdk-item":"",role:"option","aria-disabled":!!f,"aria-selected":!!h,"data-disabled":!!f,"data-selected":!!h,onPointerMove:f||l.getDisablePointerSelection()?void 0:v,onClick:f?void 0:g},e.children)})),ose=r.forwardRef(((e,a)=>{let{heading:n,children:t,forceMount:i,...o}=e,s=HX(),l=r.useRef(null),u=r.useRef(null),c=HX(),d=ese(),m=bse((e=>!(!i&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));fse((()=>d.group(s)),[]),Sse(s,l,[e.value,e.heading,u]);let h=r.useMemo((()=>({id:s,forceMount:i})),[i]);return r.createElement(uX.div,{ref:kse([l,a]),...o,"cmdk-group":"",role:"presentation",hidden:!m||void 0},n&&r.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),wse(e,(e=>r.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},r.createElement(tse.Provider,{value:h},e)))))})),sse=r.forwardRef(((e,a)=>{let{alwaysRender:n,...t}=e,i=r.useRef(null),o=bse((e=>!e.search));return n||o?r.createElement(uX.div,{ref:kse([i,a]),...t,"cmdk-separator":"",role:"separator"}):null})),lse=r.forwardRef(((e,a)=>{let{onValueChange:n,...t}=e,i=null!=e.value,o=nse(),s=bse((e=>e.search)),l=bse((e=>e.value)),u=ese(),c=r.useMemo((()=>{var e;let a=null==(e=u.listInnerRef.current)?void 0:e.querySelector(`${qoe}[${Yoe}="${encodeURIComponent(l)}"]`);return null==a?void 0:a.getAttribute("id")}),[]);return r.useEffect((()=>{null!=e.value&&o.setState("search",e.value)}),[e.value]),r.createElement(uX.input,{ref:a,...t,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":c,id:u.inputId,type:"text",value:i?e.value:s,onChange:e=>{i||o.setState("search",e.target.value),null==n||n(e.target.value)}})})),use=r.forwardRef(((e,a)=>{let{children:n,label:t="Suggestions",...i}=e,o=r.useRef(null),s=r.useRef(null),l=ese();return r.useEffect((()=>{if(s.current&&o.current){let e,a=s.current,n=o.current,t=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{n.style.setProperty("--cmdk-list-height",a.offsetHeight.toFixed(1)+"px")}))}));return t.observe(a),()=>{cancelAnimationFrame(e),t.unobserve(a)}}}),[]),r.createElement(uX.div,{ref:kse([o,a]),...i,"cmdk-list":"",role:"listbox","aria-label":t,id:l.listId},wse(e,(e=>r.createElement("div",{ref:kse([s,l.listInnerRef]),"cmdk-list-sizer":""},e))))})),cse=r.forwardRef(((e,a)=>{let{open:n,onOpenChange:t,overlayClassName:i,contentClassName:o,container:s,...l}=e;return r.createElement(MG,{open:n,onOpenChange:t},r.createElement(TG,{container:s},r.createElement(NG,{"cmdk-overlay":"",className:i}),r.createElement(xG,{"aria-label":e.label,"cmdk-dialog":"",className:o},r.createElement(ise,{ref:a,...l}))))})),dse=r.forwardRef(((e,a)=>bse((e=>0===e.filtered.count))?r.createElement(uX.div,{ref:a,...e,"cmdk-empty":"",role:"presentation"}):null)),mse=r.forwardRef(((e,a)=>{let{progress:n,children:t,label:i="Loading...",...o}=e;return r.createElement(uX.div,{ref:a,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},wse(e,(e=>r.createElement("div",{"aria-hidden":!0},e))))})),hse=Object.assign(ise,{List:use,Item:rse,Input:lse,Group:ose,Separator:sse,Dialog:cse,Empty:dse,Loading:mse});function pse(e,a){let n=e.nextElementSibling;for(;n;){if(n.matches(a))return n;n=n.nextElementSibling}}function gse(e,a){let n=e.previousElementSibling;for(;n;){if(n.matches(a))return n;n=n.previousElementSibling}}function vse(e){let a=r.useRef(e);return fse((()=>{a.current=e})),a}var fse="undefined"==typeof window?r.useEffect:r.useLayoutEffect;function yse(e){let a=r.useRef();return void 0===a.current&&(a.current=e()),a}function kse(e){return a=>{e.forEach((e=>{"function"==typeof e?e(a):null!=e&&(e.current=a)}))}}function bse(e){let a=nse(),n=()=>e(a.snapshot());return Joe.useSyncExternalStore(a.subscribe,n,n)}function Sse(e,a,n,t=[]){let i=r.useRef(),o=ese();return fse((()=>{var r;let s=(()=>{var e;for(let a of n){if("string"==typeof a)return a.trim();if("object"==typeof a&&"current"in a)return a.current?null==(e=a.current.textContent)?void 0:e.trim():i.current}})(),l=t.map((e=>e.trim()));o.value(e,s,l),null==(r=a.current)||r.setAttribute(Yoe,s),i.current=s})),i}var Ase=()=>{let[e,a]=r.useState(),n=yse((()=>new Map));return fse((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,t)=>{n.current.set(e,t),a({})}};function wse({asChild:e,children:a},n){return e&&r.isValidElement(a)?r.cloneElement(function(e){let a=e.type;return"function"==typeof a?a(e.props):"render"in a?a.render(e.props):e}(a),{ref:a.ref},n(a.props.children)):n(a)}var Cse={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Mse=r.forwardRef((({className:e,...a},t)=>n.jsx(hse,{ref:t,className:im("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...a})));Mse.displayName=hse.displayName;const Tse=r.forwardRef((({className:e,searchIcon:a,...t},i)=>n.jsxs("div",{className:"flex items-center border-b px-3",children:[a||n.jsx($c,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),n.jsx(hse.Input,{ref:i,className:im("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})));Tse.displayName=hse.Input.displayName;const Nse=r.forwardRef((({className:e,...a},t)=>n.jsx(hse.List,{ref:t,className:im("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...a})));Nse.displayName=hse.List.displayName;const xse=r.forwardRef(((e,a)=>n.jsx(hse.Empty,{ref:a,className:"py-6 text-center text-sm",...e})));xse.displayName=hse.Empty.displayName;const Ese=r.forwardRef((({className:e,...a},t)=>n.jsx(hse.Group,{ref:t,className:im("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...a})));Ese.displayName=hse.Group.displayName;r.forwardRef((({className:e,...a},t)=>n.jsx(hse.Separator,{ref:t,className:im("-mx-1 h-px bg-border",e),...a}))).displayName=hse.Separator.displayName;const Pse=r.forwardRef((({className:e,...a},t)=>n.jsx(hse.Item,{ref:t,className:im("relative flex cursor-pointer gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...a})));Pse.displayName=hse.Item.displayName;const jse=r.forwardRef((({className:e,...a},t)=>n.jsx("textarea",{className:im("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:t,...a})));jse.displayName="Textarea";const Lse=e=>{const{companyName:a,smsBody:n}=e;return a&&n?`${a}:\n${n}`:n??""},Bse=({body:e,imageUrls:a})=>n.jsx("div",{className:"sms-preview-outer @container",children:n.jsxs("div",{className:"sms-phone-mockup",children:[n.jsx("div",{className:"sms-phone-notch"}),n.jsxs("div",{className:"sms-phone-inner",children:[a&&a.length>0&&a.map(((e,a)=>n.jsx("div",{className:"sms-message-row",children:n.jsx("div",{className:"sms-message-bubble",children:n.jsx("img",{src:e,alt:"MMS attachment",className:"sms-message-image",loading:"lazy"})})},e+a))),n.jsx("div",{className:"sms-message-row",children:n.jsx("div",{className:"sms-message-bubble",children:e})})]}),n.jsx("div",{className:"sms-phone-home-indicator"})]})}),zse=({mergeFieldsResponse:e})=>{const t=1500,i=wY(),r=CY(),{data:o}=L9(),s=a.useCallback((()=>{const e=i?.actionData?.find((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId===r?.id));return e?.actionMetadata.communicationGroupId}),[i?.actionData,r?.id]),{channelSenders:l}=x9(),{data:u,isLoading:c}=Eoe(),{channelAccounts:d}=M9(),{toast:m}=Ie(),{updateCommunicationGroup:h,isUpdating:p}=lY(),[g,v]=a.useState(null),[f,y]=a.useState(!1),[k,b]=a.useState(null),[S,A]=a.useState(null),[w,C]=a.useState([]),[M,T]=a.useState(null),[N,x]=a.useState(!1),[E,P]=a.useState(!1),j=a.useRef(null),L=a.useRef(null),[B,z]=a.useState(null),[R,_]=a.useState(null),[D,K]=a.useState(!1),H=a.useMemo((()=>mee({channelSenders:l?.results??[],channelAccounts:d?.results??[],smsApplication:o})),[l,d,o]);a.useEffect((()=>{N&&(T(S),w.length>0&&!B&&!D&&z(w[0]))}),[N,S,w,B,D]),a.useEffect((()=>{N||(z(w.length>0?w[0]:null),_(null),K(!1))}),[N,w]);a.useEffect((()=>{r&&(v(r.smsChannelSenderId),A(r.smsMessageBody),r.textMessageCompanyName&&b(r.textMessageCompanyName),r.textMessageMediaUrls&&C(r.textMessageMediaUrls))}),[r]);a.useEffect((()=>{void 0!==l&&(g||H?.[0]&&(v(H[0].channelSender.id),r?.id&&h({groupId:r.id,params:{smsChannelSenderId:H[0].channelSender.id}})))}),[l,g,r?.id,h,o,d?.results,r?.emailChannelSenderId,H]),a.useEffect((()=>{k||!u?.name||f||(y(!0),b(u.name))}),[k,u?.name,f]);return d&&l&&!c&&void 0!==H&&void 0!==o?0===H?.length&&o?.status!==dee.PENDING?n.jsx(Toe,{}):n.jsxs("div",{children:[n.jsx(BG,{open:N,onOpenChange:x,children:n.jsxs(DG,{hideCloseButton:!0,className:"max-w-[50vw]",children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"SMS Editor"}),n.jsx(IG,{children:"Learn more about the SMS editor and how to use it to create your SMS."})]}),n.jsxs("div",{className:"",children:[B&&n.jsx("div",{className:"flex justify-center mb-6",children:n.jsxs("div",{className:"relative group w-fit",children:[n.jsx("img",{src:B,alt:"SMS attachment preview",className:"max-h-48 max-w-xs rounded-xl shadow-lg border border-gray-200 object-contain bg-white transition-transform duration-200 group-hover:scale-105",style:{boxShadow:"0 4px 24px 0 rgba(0,0,0,0.08)"}}),n.jsx(jY,{variant:"ghost",size:"icon",className:"absolute -top-3 -right-3 bg-white/80 hover:bg-red-100 text-gray-500 hover:text-red-500 shadow-md border border-gray-200 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{z(null),_(null),K(!0)},style:{boxShadow:"0 2px 8px 0 rgba(0,0,0,0.10)"},children:n.jsx(cd,{className:"h-4 w-4"})})]})}),n.jsx(jse,{ref:j,className:"min-h-[300px]",placeholder:"Text message content...",value:M??"",onChange:e=>{T(e.target.value)},maxLength:t-(k?.length||0)}),n.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(h9,{modal:!0,open:E,onOpenChange:P,children:[n.jsx(p9,{asChild:!0,children:n.jsx(jY,{variant:"outline",role:"combobox",className:"w-[50px] justify-center",children:n.jsx(RY.MergeField,{className:"w-4 h-4 text-primary"})})}),n.jsx(g9,{className:"w-[300px] p-0",align:"start",children:n.jsxs(Mse,{children:[n.jsx(Tse,{placeholder:"Search merge fields..."}),n.jsxs(Nse,{children:[n.jsx(xse,{children:"No merge fields found."}),e?.mergeFields?.map((e=>n.jsx(Ese,{heading:e.category,children:e.entries.map((e=>n.jsx(Pse,{onSelect:()=>{const a=j.current,n=M||"",t=a?.selectionStart??n.length,i=a?.selectionEnd??n.length,r=n.slice(0,t)+e.value+n.slice(i);T(r),P(!1),setTimeout((()=>{const n=t+e.value.length;a?.focus(),a?.setSelectionRange(n,n)}),0)},children:e.label},e.value)))},e.category)))]})]})})]}),n.jsx("span",{className:"text-sm text-muted-foreground",children:"Merge Fields"}),n.jsx(Mae,{title:"Dynamic content is a way to insert dynamic content into your messages such as the customer's name, email, or other details."})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"file",ref:L,onChange:async e=>{const a=e.target.files?.[0];if(a){const e=new FileReader;e.onloadend=async()=>{try{const a=await async function(e){if(!joe)throw new Error("Image conversion is only supported in browser environments");return new Promise(((a,n)=>{try{const t=new window.Image;t.crossOrigin="anonymous",t.onload=()=>{try{const e=document.createElement("canvas");e.width=t.naturalWidth,e.height=t.naturalHeight;const i=e.getContext("2d");if(!i)return void n(new Error("Failed to get canvas context"));i.drawImage(t,0,0);const r=e.toDataURL("image/png",1);a(r)}catch(e){n(e)}},t.onerror=()=>{n(new Error("Failed to load image"))},t.src=e}catch(t){n(t)}}))}(e.result),n=function(e){if(!e.startsWith("data:"))throw new Error('Invalid data URL: must start with "data:"');const a=e.split(",");if(2!==a.length)throw new Error("Invalid data URL format: missing base64 data");if(!a[0].includes(";base64"))throw new Error("Invalid data URL format: missing base64 encoding");return a[1]}(a);_(n),z(a),K(!1)}catch(a){m({title:"Error converting image",description:"Failed to convert image to PNG format",variant:"destructive"})}},e.readAsDataURL(a)}},accept:"image/*",className:"hidden"}),n.jsx(jY,{variant:"outline",onClick:()=>{L.current?.click()},className:"px-4",disabled:w.length>=1||D||null!==R,children:"Add Image"}),n.jsx(jY,{variant:"outline",onClick:()=>{T(S),x(!1),z(w.length>0?w[0]:null),_(null),K(!1)},className:"px-4",children:"Cancel"}),n.jsx(jY,{onClick:()=>{if(M&&M.length>t)return void m({title:"SMS is too long",description:"Please shorten your message"});A(M);const e=s();e&&h({groupId:e,params:{smsChannelSenderId:g,smsMessageBody:M,textMessageCompanyName:k,textMessageMedia:R?[R]:D?[]:void 0}},{onSuccess:()=>{x(!1),z(null),_(null),K(!1)},onError:()=>{m({title:"Error updating SMS",description:"Please contact your administrator"})}})},className:"px-4",disabled:p,children:"Save Changes"})]})]}),n.jsxs("div",{className:"flex justify-end mt-2 text-sm transition-colors duration-300 items-center gap-2 "+(M&&M.length>320?M.length>=t?"text-red-500":"text-amber-500":"text-gray-500"),children:[M?M.length:0,"/",t-(k?.length||0)," characters",M&&M.length>320&&n.jsx(Mae,{title:"The best delivery rates are achieved when the message is 320 characters or less.",onClick:()=>{window.open("https://help.twilio.com/articles/360033806753-Maximum-Message-Length-with-Twilio-Programmable-Messaging","_blank")},link:{url:"https://help.twilio.com/articles/360033806753-Maximum-Message-Length-with-Twilio-Programmable-Messaging",text:"The maximum number of characters for an SMS is 1500. This includes the company name, if you have one, and the merge fields. The recommended limit is 320 characters for best delivery rates. Click to learn more"}})]})]})]})}),n.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx(Kae,{className:"text-foreground",children:"From Number"}),n.jsxs(hie,{onValueChange:e=>{v(e)},value:g??void 0,children:[n.jsx(vie,{children:n.jsx(gie,{placeholder:"Select number",children:g?(O=g,H?.find((e=>e.channelSender.id===O))?.channelSender.channelSenderMetadata.friendlyName??H?.find((e=>e.channelSender.id===O))?.channelSender.channelSenderMetadata.from??O):"Select number"})}),n.jsx(kie,{children:H?.map((e=>n.jsx(bie,{value:e.channelSender.id,children:e.channelSender.channelSenderMetadata.friendlyName??e.channelSender.channelSenderMetadata.from??"Select number"},e.channelSender.id)))})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 py-1",children:[n.jsx(Kae,{className:"text-foreground",children:"Company Name"}),n.jsx(Mae,{title:"Adding your company name can help customers identify who they are talking to"})]}),n.jsx(o4,{placeholder:"Enter company name",value:k??"",className:"text-muted-foreground",onChange:e=>{b(e.target.value??null)},disabled:!g&&!o})]})]}),n.jsxs("div",{className:"border rounded-lg p-4",children:[n.jsxs("div",{className:"flex justify-between items-center mb-4",children:[n.jsx("h3",{className:"font-medium",children:"Preview"}),n.jsx("div",{children:n.jsx(jY,{onClick:()=>x(!0),className:"text-sm px-3 py-1 rounded ",disabled:0===(H?.length??0)&&void 0===o,children:"Edit"})})]}),n.jsx("div",{children:o?g||o?n.jsx(n.Fragment,{children:S?n.jsx(Bse,{body:Lse({companyName:k??void 0,smsBody:S}),imageUrls:w}):n.jsx(Sie,{type:"sms"})}):n.jsx(Cie,{type:"sms"}):n.jsx("div",{children:"Submit an application"})})]})]})]}):n.jsx("div",{children:n.jsx(xY,{text:["Loading..."]})});var O},Rse=()=>{const e=CY(),{getMergeFields:a,isGetting:t}=uY(e?.id??void 0);return t||!a?n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Content..."]})}):n.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:[n.jsx(Bie,{title:"SMS Campaign",type:"sms"}),n.jsx(zse,{mergeFieldsResponse:a})]})},_se=e=>e.friendlyName||e.from||e.messageServiceSid||"Unknown Sender";function Dse(e,a){throw new Error(`Unreachable case statement: ${JSON.stringify(e)}. Valid values are: ${Object.values(a).join(", ")}`)}function Kse(e,a,{checkForDefaultPrevented:n=!0}={}){return function(t){if(e?.(t),!1===n||!t.defaultPrevented)return a?.(t)}}function Hse(e,a=[]){let t=[];const i=()=>{const a=t.map((e=>r.createContext(e)));return function(n){const t=n?.[e]||a;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:t}})),[n,t])}};return i.scopeName=e,[function(a,i){const o=r.createContext(i),s=t.length;t=[...t,i];const l=a=>{const{scope:t,children:i,...l}=a,u=t?.[e]?.[s]||o,c=r.useMemo((()=>l),Object.values(l));return n.jsx(u.Provider,{value:c,children:i})};return l.displayName=a+"Provider",[l,function(n,t){const l=r.useContext(t?.[e]?.[s]||o);if(l)return l;if(void 0!==i)return i;throw new Error(`\`${n}\` must be used within \`${a}\``)}]},Ose(i,...a)]}function Ose(...e){const a=e[0];if(1===e.length)return a;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const t=n.reduce(((a,{useScope:n,scopeName:t})=>({...a,...n(e)[`__scope${t}`]})),{});return r.useMemo((()=>({[`__scope${a.scopeName}`]:t})),[t])}};return n.scopeName=a.scopeName,n}function Ise(e,a){if("function"==typeof e)return e(a);null!=e&&(e.current=a)}function Gse(...e){return a=>{let n=!1;const t=e.map((e=>{const t=Ise(e,a);return n||"function"!=typeof t||(n=!0),t}));if(n)return()=>{for(let a=0;a<t.length;a++){const n=t[a];"function"==typeof n?n():Ise(e[a],null)}}}}function Vse(...e){return r.useCallback(Gse(...e),e)}function Fse(e){const a=Jse(e),t=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),l=s.find(Wse);if(l){const e=l.props.children,i=s.map((a=>a===l?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(a,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n.jsx(a,{...o,ref:t,children:i})}));return t.displayName=`${e}.Slot`,t}function Jse(e){const a=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{r(...e),i(...e)}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?Gse(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));return a.displayName=`${e}.SlotClone`,a}var Use=Symbol("radix.slottable");function Wse(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Use}var qse=globalThis?.document?r.useLayoutEffect:()=>{},Zse=r[" useId ".trim().toString()]||(()=>{}),$se=0;function Yse(e){const[a,n]=r.useState(Zse());return qse((()=>{n((e=>e??String($se++)))}),[e]),e||(a?`radix-${a}`:"")}var Qse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,a)=>{const t=Fse(`Primitive.${a}`),i=r.forwardRef(((e,i)=>{const{asChild:r,...o}=e,s=r?t:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(s,{...o,ref:i})}));return i.displayName=`Primitive.${a}`,{...e,[a]:i}}),{});var Xse=r[" useInsertionEffect ".trim().toString()]||qse;function ele({prop:e,defaultProp:a,onChange:n=()=>{},caller:t}){const[i,o,s]=function({defaultProp:e,onChange:a}){const[n,t]=r.useState(e),i=r.useRef(n),o=r.useRef(a);return Xse((()=>{o.current=a}),[a]),r.useEffect((()=>{i.current!==n&&(o.current?.(n),i.current=n)}),[n,i]),[n,t,o]}({defaultProp:a,onChange:n}),l=void 0!==e,u=l?e:i;{const a=r.useRef(void 0!==e);r.useEffect((()=>{const e=a.current;if(e!==l){}a.current=l}),[l,t])}const c=r.useCallback((a=>{if(l){const n=function(e){return"function"==typeof e}(a)?a(e):a;n!==e&&s.current?.(n)}else o(a)}),[l,e,o,s]);return[u,c]}var ale=r.createContext(void 0);function nle(e){const a=r.useContext(ale);return e||a||"ltr"}var tle="rovingFocusGroup.onEntryFocus",ile={bubbles:!1,cancelable:!0},rle="RovingFocusGroup",[ole,sle,lle]=function(e){const t=e+"CollectionProvider",[i,r]=Hse(t),[o,s]=i(t,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:t,children:i}=e,r=a.useRef(null),s=a.useRef(new Map).current;return n.jsx(o,{scope:t,itemMap:s,collectionRef:r,children:i})};l.displayName=t;const u=e+"CollectionSlot",c=Fse(u),d=a.forwardRef(((e,a)=>{const{scope:t,children:i}=e,r=Vse(a,s(u,t).collectionRef);return n.jsx(c,{ref:r,children:i})}));d.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",p=Fse(m),g=a.forwardRef(((e,t)=>{const{scope:i,children:r,...o}=e,l=a.useRef(null),u=Vse(t,l),c=s(m,i);return a.useEffect((()=>(c.itemMap.set(l,{ref:l,...o}),()=>{c.itemMap.delete(l)}))),n.jsx(p,{[h]:"",ref:u,children:r})}));return g.displayName=m,[{Provider:l,Slot:d,ItemSlot:g},function(n){const t=s(e+"CollectionConsumer",n);return a.useCallback((()=>{const e=t.collectionRef.current;if(!e)return[];const a=Array.from(e.querySelectorAll(`[${h}]`));return Array.from(t.itemMap.values()).sort(((e,n)=>a.indexOf(e.ref.current)-a.indexOf(n.ref.current)))}),[t.collectionRef,t.itemMap])},r]}(rle),[ule,cle]=Hse(rle,[lle]),[dle,mle]=ule(rle),hle=r.forwardRef(((e,a)=>n.jsx(ole.Provider,{scope:e.__scopeRovingFocusGroup,children:n.jsx(ole.Slot,{scope:e.__scopeRovingFocusGroup,children:n.jsx(ple,{...e,ref:a})})})));hle.displayName=rle;var ple=r.forwardRef(((e,a)=>{const{__scopeRovingFocusGroup:t,orientation:i,loop:o=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:m=!1,...h}=e,p=r.useRef(null),g=Vse(a,p),v=nle(s),[f,y]=ele({prop:l,defaultProp:u??null,onChange:c,caller:rle}),[k,b]=r.useState(!1),S=function(e){const a=r.useRef(e);return r.useEffect((()=>{a.current=e})),r.useMemo((()=>(...e)=>a.current?.(...e)),[])}(d),A=sle(t),w=r.useRef(!1),[C,M]=r.useState(0);return r.useEffect((()=>{const e=p.current;if(e)return e.addEventListener(tle,S),()=>e.removeEventListener(tle,S)}),[S]),n.jsx(dle,{scope:t,orientation:i,dir:v,loop:o,currentTabStopId:f,onItemFocus:r.useCallback((e=>y(e)),[y]),onItemShiftTab:r.useCallback((()=>b(!0)),[]),onFocusableItemAdd:r.useCallback((()=>M((e=>e+1))),[]),onFocusableItemRemove:r.useCallback((()=>M((e=>e-1))),[]),children:n.jsx(Qse.div,{tabIndex:k||0===C?-1:0,"data-orientation":i,...h,ref:g,style:{outline:"none",...e.style},onMouseDown:Kse(e.onMouseDown,(()=>{w.current=!0})),onFocus:Kse(e.onFocus,(e=>{if(e.target===e.currentTarget&&!w.current&&!k){const a=new CustomEvent(tle,ile);if(e.currentTarget.dispatchEvent(a),!a.defaultPrevented){const e=A().filter((e=>e.focusable));yle([e.find((e=>e.active)),e.find((e=>e.id===f)),...e].filter(Boolean).map((e=>e.ref.current)),m)}}w.current=!1})),onBlur:Kse(e.onBlur,(()=>b(!1)))})})})),gle="RovingFocusGroupItem",vle=r.forwardRef(((e,a)=>{const{__scopeRovingFocusGroup:t,focusable:i=!0,active:o=!1,tabStopId:s,children:l,...u}=e,c=Yse(),d=s||c,m=mle(gle,t),h=m.currentTabStopId===d,p=sle(t),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:f}=m;return r.useEffect((()=>{if(i)return g(),()=>v()}),[i,g,v]),n.jsx(ole.ItemSlot,{scope:t,id:d,focusable:i,active:o,children:n.jsx(Qse.span,{tabIndex:h?0:-1,"data-orientation":m.orientation,...u,ref:a,onMouseDown:Kse(e.onMouseDown,(e=>{i?m.onItemFocus(d):e.preventDefault()})),onFocus:Kse(e.onFocus,(()=>m.onItemFocus(d))),onKeyDown:Kse(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void m.onItemShiftTab();if(e.target!==e.currentTarget)return;const a=function(e,a,n){const t=function(e,a){return"rtl"!==a?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===a&&["ArrowLeft","ArrowRight"].includes(t)||"horizontal"===a&&["ArrowUp","ArrowDown"].includes(t)?void 0:fle[t]}(e,m.orientation,m.dir);if(void 0!==a){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=p().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===a)i.reverse();else if("prev"===a||"next"===a){"prev"===a&&i.reverse();const r=i.indexOf(e.currentTarget);i=m.loop?(t=r+1,(n=i).map(((e,a)=>n[(t+a)%n.length]))):i.slice(r+1)}setTimeout((()=>yle(i)))}var n,t})),children:"function"==typeof l?l({isCurrentTabStop:h,hasTabStop:null!=f}):l})})}));vle.displayName=gle;var fle={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function yle(e,a=!1){const n=document.activeElement;for(const t of e){if(t===n)return;if(t.focus({preventScroll:a}),document.activeElement!==n)return}}var kle=hle,ble=vle;var Sle=e=>{const{present:a,children:n}=e,t=function(e){const[a,n]=r.useState(),t=r.useRef(null),i=r.useRef(e),o=r.useRef("none"),s=e?"mounted":"unmounted",[l,u]=function(e,a){return r.useReducer(((e,n)=>a[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect((()=>{const e=Ale(t.current);o.current="mounted"===l?e:"none"}),[l]),qse((()=>{const a=t.current,n=i.current;if(n!==e){const t=o.current,r=Ale(a);if(e)u("MOUNT");else if("none"===r||"none"===a?.display)u("UNMOUNT");else{u(n&&t!==r?"ANIMATION_OUT":"UNMOUNT")}i.current=e}}),[e,u]),qse((()=>{if(a){let e;const n=a.ownerDocument.defaultView??window,r=r=>{const o=Ale(t.current).includes(r.animationName);if(r.target===a&&o&&(u("ANIMATION_END"),!i.current)){const t=a.style.animationFillMode;a.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===a.style.animationFillMode&&(a.style.animationFillMode=t)}))}},s=e=>{e.target===a&&(o.current=Ale(t.current))};return a.addEventListener("animationstart",s),a.addEventListener("animationcancel",r),a.addEventListener("animationend",r),()=>{n.clearTimeout(e),a.removeEventListener("animationstart",s),a.removeEventListener("animationcancel",r),a.removeEventListener("animationend",r)}}u("ANIMATION_END")}),[a,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:r.useCallback((e=>{t.current=e?getComputedStyle(e):null,n(e)}),[])}}(a),i="function"==typeof n?n({present:t.isPresent}):r.Children.only(n),o=Vse(t.ref,function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof n||t.isPresent?r.cloneElement(i,{ref:o}):null};function Ale(e){return e?.animationName||"none"}Sle.displayName="Presence";var wle="Tabs",[Cle,Mle]=Hse(wle,[cle]),Tle=cle(),[Nle,xle]=Cle(wle),Ele=r.forwardRef(((e,a)=>{const{__scopeTabs:t,value:i,onValueChange:r,defaultValue:o,orientation:s="horizontal",dir:l,activationMode:u="automatic",...c}=e,d=nle(l),[m,h]=ele({prop:i,onChange:r,defaultProp:o??"",caller:wle});return n.jsx(Nle,{scope:t,baseId:Yse(),value:m,onValueChange:h,orientation:s,dir:d,activationMode:u,children:n.jsx(Qse.div,{dir:d,"data-orientation":s,...c,ref:a})})}));Ele.displayName=wle;var Ple="TabsList",jle=r.forwardRef(((e,a)=>{const{__scopeTabs:t,loop:i=!0,...r}=e,o=xle(Ple,t),s=Tle(t);return n.jsx(kle,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:n.jsx(Qse.div,{role:"tablist","aria-orientation":o.orientation,...r,ref:a})})}));jle.displayName=Ple;var Lle="TabsTrigger",Ble=r.forwardRef(((e,a)=>{const{__scopeTabs:t,value:i,disabled:r=!1,...o}=e,s=xle(Lle,t),l=Tle(t),u=_le(s.baseId,i),c=Dle(s.baseId,i),d=i===s.value;return n.jsx(ble,{asChild:!0,...l,focusable:!r,active:d,children:n.jsx(Qse.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:u,...o,ref:a,onMouseDown:Kse(e.onMouseDown,(e=>{r||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(i)})),onKeyDown:Kse(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(i)})),onFocus:Kse(e.onFocus,(()=>{d||r||!("manual"!==s.activationMode)||s.onValueChange(i)}))})})}));Ble.displayName=Lle;var zle="TabsContent",Rle=r.forwardRef(((e,a)=>{const{__scopeTabs:t,value:i,forceMount:o,children:s,...l}=e,u=xle(zle,t),c=_le(u.baseId,i),d=Dle(u.baseId,i),m=i===u.value,h=r.useRef(m);return r.useEffect((()=>{const e=requestAnimationFrame((()=>h.current=!1));return()=>cancelAnimationFrame(e)}),[]),n.jsx(Sle,{present:o||m,children:({present:t})=>n.jsx(Qse.div,{"data-state":m?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":c,hidden:!t,id:d,tabIndex:0,...l,ref:a,style:{...e.style,animationDuration:h.current?"0s":void 0},children:t&&s})})}));function _le(e,a){return`${e}-trigger-${a}`}function Dle(e,a){return`${e}-content-${a}`}Rle.displayName=zle;var Kle=jle,Hle=Ble,Ole=Rle;const Ile=Ele,Gle=r.forwardRef((({className:e,...a},t)=>n.jsx(Kle,{ref:t,className:im("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...a})));Gle.displayName=Kle.displayName;const Vle=r.forwardRef((({className:e,...a},t)=>n.jsx(Hle,{ref:t,className:im("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...a})));Vle.displayName=Hle.displayName;const Fle=r.forwardRef((({className:e,...a},t)=>n.jsx(Ole,{ref:t,className:im("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...a})));Fle.displayName=Ole.displayName;const Jle=({onOpenChange:e})=>n.jsx("div",{role:"button",tabIndex:0,"aria-label":"Close dialog",onClick:()=>e(!1),onKeyDown:a=>{"Enter"!==a.key&&" "!==a.key||e(!1)},className:"absolute top-3 right-3 z-20 rounded-full p-2 bg-white/80 shadow-lg border border-gray-200 hover:bg-primary/90 hover:text-white active:bg-primary/95 transition-all duration-200 focus:outline-none focus:ring-4 focus:ring-primary/30 focus:ring-offset-2 group cursor-pointer",style:{boxShadow:"0 4px 24px 0 rgba(0,0,0,0.10)"},children:n.jsx(RY.CloseButton,{className:"w-5 h-5 text-primary group-hover:text-primary-foreground group-active:text-primary-foreground transition-colors duration-200"})});function Ule(e){const a=r.useRef({value:e,previous:e});return r.useMemo((()=>(a.current.value!==e&&(a.current.previous=a.current.value,a.current.value=e),a.current.previous)),[e])}var Wle="Checkbox",[qle,Zle]=eX(Wle),[$le,Yle]=qle(Wle),Qle=r.forwardRef(((e,a)=>{const{__scopeCheckbox:t,name:i,checked:o,defaultChecked:s,required:l,disabled:u,value:c="on",onCheckedChange:d,form:m,...h}=e,[p,g]=r.useState(null),v=tO(a,(e=>g(e))),f=r.useRef(!1),y=!p||(m||!!p.closest("form")),[k=!1,b]=tX({prop:o,defaultProp:s,onChange:d}),S=r.useRef(k);return r.useEffect((()=>{const e=p?.form;if(e){const a=()=>b(S.current);return e.addEventListener("reset",a),()=>e.removeEventListener("reset",a)}}),[p,b]),n.jsxs($le,{scope:t,state:k,disabled:u,children:[n.jsx(uX.button,{type:"button",role:"checkbox","aria-checked":nue(k)?"mixed":k,"aria-required":l,"data-state":tue(k),"data-disabled":u?"":void 0,disabled:u,value:c,...h,ref:v,onKeyDown:XQ(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:XQ(e.onClick,(e=>{b((e=>!!nue(e)||!e)),y&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())}))}),y&&n.jsx(aue,{control:p,bubbles:!f.current,name:i,value:c,checked:k,required:l,disabled:u,form:m,style:{transform:"translateX(-100%)"},defaultChecked:!nue(s)&&s})]})}));Qle.displayName=Wle;var Xle="CheckboxIndicator",eue=r.forwardRef(((e,a)=>{const{__scopeCheckbox:t,forceMount:i,...r}=e,o=Yle(Xle,t);return n.jsx(O1,{present:i||nue(o.state)||!0===o.state,children:n.jsx(uX.span,{"data-state":tue(o.state),"data-disabled":o.disabled?"":void 0,...r,ref:a,style:{pointerEvents:"none",...e.style}})})}));eue.displayName=Xle;var aue=e=>{const{control:a,checked:t,bubbles:i=!0,defaultChecked:o,...s}=e,l=r.useRef(null),u=Ule(t),c=v1(a);r.useEffect((()=>{const e=l.current,a=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(a,"checked").set;if(u!==t&&n){const a=new Event("click",{bubbles:i});e.indeterminate=nue(t),n.call(e,!nue(t)&&t),e.dispatchEvent(a)}}),[u,t,i]);const d=r.useRef(!nue(t)&&t);return n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??d.current,...s,tabIndex:-1,ref:l,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function nue(e){return"indeterminate"===e}function tue(e){return nue(e)?"indeterminate":e?"checked":"unchecked"}var iue=Qle,rue=eue;const oue=({selectedChannels:e,setSelectedChannels:a,hasEmailChannelSenders:t,hasSmsChannelSenders:i,automationType:r})=>{const{toast:o}=Ie(),s=[...t?[{label:"Email",value:"email",icon:RY.EmailIcon,checked:e.includes("email")}]:[],...i?[{label:"SMS",value:"sms",icon:RY.SmsIcon,checked:e.includes("sms")}]:[]];return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-xl font-medium text-foreground",children:"Message Types"}),n.jsxs("p",{className:"text-muted-foreground mb-2 text-sm",children:["Select the channels you want to use in this"," ",r===Ze.ONE_TIME?yh("engage:broadcast").toLowerCase():yh("engage:automation").toLowerCase()]})]}),n.jsx("div",{className:"w-full grid grid-cols-2 gap-3",children:s.map((t=>n.jsxs(iue,{checked:t.checked,onCheckedChange:()=>{"email"===t.value?e.includes("email")?e.includes("sms")?a(["sms"]):o({title:"Cant Remove Email",description:`At least one channel is required for an ${r===Ze.ONE_TIME?yh("engage:broadcast").toLowerCase():yh("engage:automation").toLowerCase()}`,variant:"destructive"}):a([...e,"email"]):e.includes("sms")?e.includes("email")?a(["email"]):o({title:"Cant Remove SMS",description:`At least one channel is required for an ${r===Ze.ONE_TIME?yh("engage:broadcast").toLowerCase():yh("engage:automation").toLowerCase()}`,variant:"destructive"}):a([...e,"sms"])},className:"relative ring-[1px] ring-border rounded-lg px-4 py-3 text-start text-muted-foreground data-[state=checked]:ring-2 data-[state=checked]:ring-primary data-[state=checked]:font-medium",children:[n.jsx(t.icon,{className:"mb-3",size:20}),n.jsx("span",{className:"font-medium tracking-tight",children:t.label}),n.jsx(rue,{className:"absolute top-2 right-2",children:n.jsx(Mc,{className:"fill-primary text-primary-foreground"})})]},t.value)))})]})},sue=({getExtraMergeFields:e})=>{const[t,i]=a.useState(null),r=a.useRef(null),{toast:o}=Ie(),s=CY(),{channelSenders:l}=x9(),{channelAccounts:u}=M9(),{updateCommunicationGroup:c}=lY(),d=wY(),{data:m}=L9(),{setSelectedSubStepType:h}=a.useContext(X$),{getMergeFields:p,isGetting:g}=uY(s?.id??void 0),[v,f]=a.useState(void 0);a.useEffect((()=>{const e=s?.id;e&&t&&(t.includes("email")||null===s?.emailChannelSenderId||c({groupId:e,params:{emailChannelSenderId:null}}),t.includes("sms")||null===s?.smsChannelSenderId||c({groupId:e,params:{smsChannelSenderId:null}}),1===t.length&&("email"===t[0]&&h(Lie.EMAIL),"sms"===t[0]&&h(Lie.SMS)))}),[t,c,s,m,h]),a.useEffect((()=>{const e=s?.id;e||0!==t?.length||i(["email"])}),[d,s,t]);const y=a.useCallback((e=>{const a=[];e.emailChannelSenderId&&a.push("email"),e.smsChannelSenderId&&a.push("sms"),0===a.length&&a.push("email"),i(a)}),[]);a.useEffect((()=>{s&&!t&&y(s)}),[s,y,t]),a.useEffect((()=>{g||void 0===v&&(e?e().then((e=>{s?.id&&(y(s),c({groupId:s?.id,params:{extraMergeFields:e}},{onSuccess:async()=>{try{const e=await nY(s?.id);f(e)}catch{o({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}},onError:e=>{o({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}}))})):f(p))}),[e,c,s,o,g,p,v,y]);const k=a.useMemo((()=>zie({channelSenders:l?.results??[],channelAccounts:u?.results??[]})),[l?.results,u?.results]),b=a.useMemo((()=>mee({channelSenders:l?.results??[],channelAccounts:u?.results??[],smsApplication:m})),[l?.results,u?.results,m]);if(!t||g||!v||!k||!b)return n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Content..."]})});const S=k.length>0,A=b.length>0;return n.jsxs("div",{className:"flex flex-col gap-4 flex-shrink-0",children:[n.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(oue,{automationType:d?.triggerMetadata?.triggerType,selectedChannels:t,setSelectedChannels:i,hasEmailChannelSenders:S,hasSmsChannelSenders:A})}),t.includes("email")&&n.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",ref:r,children:[n.jsx(Bie,{title:"Email Campaign",type:"email"}),n.jsx(Eie,{mergeFieldsResponse:v,emailChannelSendersWithChannelAccounts:k})]}),t.includes("sms")&&n.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:[n.jsx(Bie,{title:"SMS Campaign",type:"sms"}),n.jsx(zse,{mergeFieldsResponse:v})]})]})},lue=({open:e,onOpenChange:a})=>n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{className:"max-w-[75vw] min-h-[75vh] overflow-y-auto max-h-[90vh] po",hideCloseButton:!0,children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Edit Campaign Content"}),n.jsx(IG,{children:"Edit the content of the campaign"})]}),n.jsx(Jle,{onOpenChange:a}),n.jsx(sue,{})]})}),uue=()=>n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),n.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),n.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"})]}),cue=({children:e,actionButtons:a})=>n.jsxs("div",{className:"flex-1 w-full relative overflow-hidden max-w-screen-lg mx-auto",children:[n.jsxs("div",{className:"h-full relative w-full rounded-2xl bg-white border border-zinc-200 overflow-hidden min-h-[500px] flex flex-col",style:{containerType:"inline-size"},children:[n.jsxs("div",{className:"flex items-center space-x-3 pt-3 px-4 z-10 w-full justify-between",children:[n.jsx(uue,{}),a&&n.jsx("div",{className:"flex items-center space-x-2",children:a})]}),e]}),n.jsx("div",{className:"text-center text-sm text-muted-foreground mt-4",children:n.jsx("p",{children:"These previews show exactly how your messages will appear to your customers"})})]}),due=()=>{const e=wY(),t=CY(),{channelSenders:i}=x9(),{channelAccounts:r}=M9(),o=a.useMemo((()=>i?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const a=r?.results?.find((a=>a.id===e.channelAccountId));return a&&a.channelAccountMetadata.type===T9.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSenderMetadata:e.channelSenderMetadata}]:[]}))||[]),[i?.results,r?.results]),s=t?.emailChannelSenderId;if(!(e&&t&&o&&s))return null;const l=o.find((e=>e.channelSenderId===s)),u=l?.fullDomain,c=l?.channelSenderMetadata.emailReplyTo,d=t.emailSubject,m=t.emailPreviewText,h=l?.channelSenderMetadata.emailFromName;return n.jsxs("div",{className:"space-y-1 overflow-hidden",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),n.jsxs("div",{className:"text-base font-medium",children:[u,h&&n.jsxs("span",{className:"text-muted-foreground",children:["<",h,">"]})]})]}),c&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Reply-To"}),n.jsx("div",{className:"text-base font-medium",children:c})]}),d&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Subject"}),n.jsx("div",{className:"text-base font-medium",children:d})]}),m&&n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Preview Text"}),n.jsx("div",{className:"text-sm font-medium line-clamp-2",children:m})]})]})},mue=({emailBody:e})=>{const[t,i]=a.useState({width:0,height:0}),r=a.useRef(null);return a.useEffect((()=>{const e=()=>{r.current&&requestAnimationFrame((()=>{i({width:r.current?r.current.offsetWidth-75:0,height:r.current?r.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[r]),n.jsxs(cue,{children:[n.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:n.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:n.jsx(due,{})})}),n.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",ref:r,children:n.jsx(Aie,{html:e,height:t.height,width:t.width})})]})},hue=({expandDialogContent:e})=>{const[t,i]=a.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsx(BG,{open:t,onOpenChange:i,children:n.jsxs(DG,{hideCloseButton:!0,className:"w-[80vw] h-[80vh] max-h-none bg-transparent border-none max-w-screen-lg ",children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Expanded Preview"}),n.jsx(IG,{children:"Expanded view of communication content"})]}),n.jsxs("div",{className:"h-full flex flex-col overflow-hidden rounded-xl",children:[n.jsx(Jle,{onOpenChange:i}),e]})]})}),n.jsx(jY,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>i(!0),children:n.jsx(RY.ExpandIcon,{className:"w-4 h-4 text-muted-foreground"})})]})},pue=({type:e,disablePreviewSubtext:a=!1})=>{const t="sms"===e?"SMS":"Email";return n.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center",children:n.jsxs("div",{className:"flex flex-col items-center justify-center bg-zinc-50/80 border border-zinc-100 rounded-2xl shadow-md px-6 py-12 max-w-[90vw] w-full sm:max-w-md mx-auto text-center",style:{containerType:"inline-size"},children:[n.jsx("sms"===e?RY.SmsIcon:RY.EmailIcon,{className:"w-12 h-12 text-zinc-500 mb-4"}),n.jsxs("h2",{className:"text-xl font-semibold text-zinc-800 mb-2",children:["No ",t," Content Yet"]}),!a&&n.jsxs("p",{className:"text-zinc-500 text-base mb-1",children:["Click"," ",n.jsx("span",{className:"font-medium text-zinc-700",children:"Edit content"})," to start crafting your ",t," message."]})]})})},gue=({onClick:e})=>n.jsxs(jY,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:e,children:[n.jsx(RY.PreviewButton,{className:"w-4 h-4"}),n.jsx("span",{className:"font-medium text-sm",children:"Test"})]}),vue=e=>/^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/.test(e),fue=e=>{if(!/^[0-9\s()+.-]+$/.test(e))return!1;const a=e.replace(/\D/g,"");return e.startsWith("+")?a.length>=10&&a.length<=15:10===a.length||!(11!==a.length||!a.startsWith("1"))},yue=e=>{const a=e.replace(/\D/g,"");if(10===a.length)return`(${a.slice(0,3)}) ${a.slice(3,6)}-${a.slice(6)}`;if(11===a.length&&a.startsWith("1"))return`+1 (${a.slice(1,4)}) ${a.slice(4,7)}-${a.slice(7)}`;if(a.length>0){const n=e.startsWith("+")?"+":"",t=a.slice((e.startsWith("+"),0));return`${n}${t.match(/.{1,4}/g)?.join("-")||t}`}return e},kue=({automation:e,type:t,setOpenSendPreviewPopup:i,open:r})=>{const[o,s]=a.useState(""),[l,u]=a.useState(""),[c,d]=a.useState(null),[m,h]=a.useState(!1),[p,g]=a.useState(""),{sendTestCommunication:v,sendError:f,isSendSuccess:y}=cY(),{toast:k}=Ie(),b=e.actionData?.find((e=>"send_communication"===e.actionType)),S=b?.actionMetadata.communicationGroupId,{communicationGroup:A,isGetting:w}=sY(S??void 0),{data:C}=vY({includeSegments:e.includeSegmentIds,excludeSegments:e.excludeSegmentIds,automationId:e.id}),M=a.useCallback((()=>{if(!S)return Promise.resolve(null);if(!A)return Promise.reject(new Error("Communication group not loaded"));switch(t){case"email":return Promise.resolve(A.emailChannelSenderId);case"sms":return Promise.resolve(A.smsChannelSenderId);default:return Promise.reject(new Error(`Unsupported type: ${t}`))}}),[A,t,S]);a.useEffect((()=>{(async()=>{try{const e=await M();d(e)}catch(e){d(null)}finally{h(!0)}})()}),[M]),a.useEffect((()=>{y&&(k({title:"Success",description:`Preview ${"email"===t?"email":"SMS"} sent successfully!`}),i(!1))}),[y,t,i,k]),a.useEffect((()=>{f&&(k({title:"Error",description:`Failed to send preview: ${f.message}`,variant:"destructive"}),i(!1))}),[f,k,i]),a.useEffect((()=>{r&&(s(""),u(""),g(""))}),[r]);return m&&!w&&C?c?n.jsxs("div",{className:"",children:[n.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:["Send Test ","email"===t?"Email":"Text"]}),n.jsx(o4,{type:"email"===t?"email":"tel",placeholder:"email"===t?"Enter email address":"Enter phone number",value:o,onChange:e=>{s(e.target.value),u("")},className:"w-full px-3 py-3 border border-gray-300 rounded-lg text-base \n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent\n placeholder-gray-400"}),n.jsxs("p",{className:"text-sm text-muted-foreground mt-1.5",children:["Enter a valid ","email"===t?"email address":"phone number"," to send a test to that recipient."]}),n.jsx("div",{className:"my-4 border-t border-gray-200"}),n.jsxs("div",{className:"mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(hie,{value:p,onValueChange:e=>{g(e)},children:[n.jsx(vie,{className:"w-full bg-white border border-gray-300 rounded-lg text-base\n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:n.jsx(gie,{children:p?C?.recipients.find((e=>e.id===p))?.firstName+" "+C?.recipients.find((e=>e.id===p))?.lastName:"Preview as"})}),n.jsx(kie,{children:n.jsx(pie,{children:(C?.recipients??[]).map((e=>n.jsx(bie,{value:e.id,className:"cursor-pointer hover:bg-gray-50",children:n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("span",{className:"font-medium",children:[e.firstName," ",e.lastName]}),n.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.email&&`Email: ${e.email}`,e.email&&e.phone&&" • ",e.phone&&`Phone: ${e.phone}`]})]})},`${e.firstName}-${e.lastName}`)))})})]}),p&&n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>g(""),className:"h-10 w-10 rounded-lg hover:bg-gray-100",title:"Clear selection",children:n.jsx(RY.CloseButton,{className:"h-4 w-4 text-gray-500"})})]}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1.5",children:"Optional: Test as a specific recipient to see how the message will appear with their data. If not selected, raw merge tags will be used."})]}),l&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"my-4 border-t border-gray-200"}),n.jsx("p",{className:"text-red-500 text-sm mb-4 -mt-2",children:l})]}),n.jsx(jY,{onClick:()=>{if(!("email"===t?vue(o):fue(o)))return void u("Please enter a valid "+("email"===t?"email address":"phone number"));if(!c)return void u("No sender found, please update the automation first!");const a=e.actionData?.find((e=>"send_communication"===e.actionType)),n=a?.actionMetadata.communicationGroupId;if(!n)return Promise.resolve(null);v({id:n,params:"email"===t?{emailAddress:o,previewAsRecipientId:p}:{phoneNumber:o,previewAsRecipientId:p}})},disabled:!o,className:"w-full bg-blue-600 text-white py-3 px-6 rounded-lg font-medium\n hover:bg-blue-700 transition-colors duration-200\n disabled:bg-gray-400 disabled:cursor-not-allowed",children:"Send Test"})]}):n.jsx("div",{className:"flex justify-center items-center h-full",children:n.jsxs("div",{className:"text-center flex flex-col justify-center items-center gap-2",children:[n.jsx(RY.AlertCircleIcon,{className:"h-12 w-12 text-gray-400 mb-4"}),n.jsx("h3",{className:"text-lg font-semibold text-gray-700 mb-2",children:"No sender found"}),n.jsx("p",{className:"text-gray-500",children:"Please update the automation to include a sender for this type"})]})}):n.jsx("div",{className:"flex justify-center items-center h-full",children:n.jsx(xY,{text:["Fetching sender data","Fetching recipients"]})})},bue=({open:e,onOpenChange:a,automation:t})=>n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Send Preview Email"}),n.jsx(IG,{children:"Send a preview email to the automation."})]}),n.jsx(kue,{automation:t,type:"email",setOpenSendPreviewPopup:a,open:e})]})}),Sue=({disablePreview:e=!1,disableEditContent:t=!1,disablePreviewSubtext:i=!1})=>{const r=wY(),o=CY(),{channelSenders:s}=x9(),{channelAccounts:l}=M9(),[u,c]=a.useState({width:0,height:0}),[d,m]=a.useState(!1),[h,p]=a.useState(!1),g=a.useRef(null);if(a.useEffect((()=>{const e=()=>{g.current&&requestAnimationFrame((()=>{c({width:g.current?g.current.offsetWidth-75:0,height:g.current?g.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[g]),!r||!o||void 0===s||void 0===l)return null;const v=o?.emailHtmlBody||"",f=o?.emailChannelSenderId&&v.length>0,y=zie({channelSenders:s?.results??[],channelAccounts:l?.results??[]});return n.jsxs("div",{className:"flex-1 flex flex-col items-center w-full",children:[n.jsx(lue,{open:h,onOpenChange:p}),y.length>0&&n.jsx(bue,{open:d,onOpenChange:m,automation:r}),n.jsx(cue,{actionButtons:n.jsx(n.Fragment,{children:n.jsxs("div",{className:"flex items-center space-x-2",children:[!e&&f&&n.jsx(gue,{onClick:()=>m(!0)}),!t&&r.status===Xe.DRAFT&&n.jsx(jY,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>p(!0),children:"Edit content"}),f&&n.jsx(hue,{expandDialogContent:n.jsx(mue,{emailBody:v})})]})}),children:f?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:n.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:n.jsx(due,{})})}),n.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),n.jsx("div",{className:"flex-1 w-full overflow-auto h-full min-h-[500px]",ref:g,children:n.jsx(Aie,{html:v,height:u.height,width:u.width})})]}):n.jsx(pue,{type:"email",disablePreviewSubtext:i})})]})},Aue=()=>{const e=wY(),t=CY(),{channelSenders:i}=x9(),{channelAccounts:r}=M9(),{data:o}=L9(),s=a.useMemo((()=>mee({channelSenders:i?.results??[],channelAccounts:r?.results??[],smsApplication:o})),[i?.results,r?.results,o]),l=s?.find((e=>e.channelSender.id===t?.smsChannelSenderId));if(!l&&!o)return null;if(!(e&&t&&i&&r&&s&&(void 0!==o||l)))return null;const u=l?.channelSender.channelSenderMetadata.from&&null!==l.channelSender.channelSenderMetadata.from?l.channelSender.channelSenderMetadata.from:null,c=l?.channelSender.channelSenderMetadata.friendlyName??(u&&null!==u?yue(u??""):l?.channelSender.channelSenderMetadata.messageServiceSid);return n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),n.jsx("div",{className:"text-base font-medium font-mono text-zinc-800",children:c})]})})},wue=({smsBody:e,imageUrls:a})=>n.jsxs(cue,{children:[n.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:n.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:n.jsx(Aue,{})})}),n.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",children:n.jsx(Bse,{body:e,imageUrls:a})})]}),Cue=({open:e,onOpenChange:a,automation:t})=>n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Send Preview SMS"}),n.jsx(IG,{children:"Send a preview SMS to the automation."})]}),n.jsx(kue,{automation:t,type:"sms",setOpenSendPreviewPopup:a,open:e})]})}),Mue=({disablePreview:e=!1,disableEditContent:t=!1,disablePreviewSubtext:i=!1,setupRequired:r=!1})=>{const[o,s]=a.useState(!1),{channelSenders:l}=x9(),u=wY(),c=CY(),[d,m]=a.useState(!1),{data:h}=L9(),[p,g]=a.useState(r);if(a.useEffect((()=>{h&&h.status===dee.PENDING&&g(!1)}),[h]),!u||void 0===l)return null;const v=c?.smsMessageBody||"",f=(h||c?.smsChannelSenderId)&&v.length>0,y=Lse({companyName:c?.textMessageCompanyName??void 0,smsBody:v}),k=c?.textMessageMediaUrls??[];return n.jsx(aV,{children:p?n.jsx("div",{className:"w-full pt-8 mx-auto",children:n.jsx(Toe,{})}):n.jsxs(H$.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.3,ease:[.16,1,.3,1]},className:"flex flex-col items-center w-full h-full",children:[n.jsx(lue,{open:d,onOpenChange:m}),n.jsx(Cue,{open:o,onOpenChange:s,automation:u}),n.jsx(cue,{actionButtons:n.jsxs(n.Fragment,{children:[!e&&f&&n.jsx(gue,{onClick:()=>s(!0)}),(u.status===Xe.DRAFT||!t)&&n.jsx(jY,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>m(!0),children:"Edit content"}),f&&n.jsx(hue,{expandDialogContent:n.jsx(wue,{smsBody:y,imageUrls:k})})]}),children:f?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:n.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:n.jsx(Aue,{})})}),n.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),n.jsx("div",{className:"flex-1 w-full overflow-auto h-full flex items-center justify-center",children:n.jsx(Bse,{body:y,imageUrls:k})})]}):n.jsx(pue,{type:"sms",disablePreviewSubtext:i})})]})})},Tue=({disablePreview:e=!1,disableEditContent:t=!1,disablePreviewSubtext:i=!1})=>{const[r,o]=a.useState(null),s=CY(),{channelAccounts:l}=M9(),{state:{hideSms:u}}=a.useContext(cO),{channelSenders:c}=x9(),{data:d}=L9(),m=a.useMemo((()=>mee({channelSenders:c?.results??[],channelAccounts:l?.results??[],smsApplication:d})),[c?.results,l?.results,d]);if(a.useEffect((()=>{r||o(s?.emailChannelSenderId?"email":"sms")}),[s?.emailChannelSenderId,r]),!s||!c||!r)return n.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:n.jsx(xY,{text:["Loading..."]})});const h=0===m.length&&!d;return n.jsxs(Ile,{defaultValue:"email",value:r,onValueChange:e=>o("email"===e?"email":"sms"),className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md pb-4",children:[n.jsx("div",{className:"max-w-[640px] mx-auto w-full",children:n.jsxs(Gle,{className:"grid w-full "+(u?"grid-cols-1":"grid-cols-2"),children:[n.jsx(Vle,{value:"email",className:"group data-[state=active]:bg-white",children:n.jsxs("div",{className:"flex items-center",children:[n.jsx(RY.EmailIcon,{className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block text-primary"}),n.jsx(RY.EmailIcon,{className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden text-gray-400"}),n.jsx("span",{children:"Email"})]})}),!u&&n.jsx(Vle,{value:"sms",className:"group data-[state=active]:bg-white",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(RY.SmsIcon,{className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block text-primary"}),n.jsx(RY.SmsIcon,{className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden text-gray-400"}),n.jsx("span",{children:"SMS"}),h&&n.jsx(Mae,{title:"To enable SMS, please complete your business information and request approval from Twilio"})]})})]})}),n.jsx(Fle,{value:"email",children:n.jsx(Sue,{disablePreview:e,disableEditContent:t,disablePreviewSubtext:i})}),n.jsx(Fle,{value:"sms",children:n.jsx(Mue,{disablePreview:e,disableEditContent:t,disablePreviewSubtext:i,setupRequired:h})})]})},Nue="reach-styles-module__h2___J-48W",xue="reach-styles-module__h3___QiFj-",Eue="reach-styles-module__minorText___1TEN6",Pue=({children:e,className:a})=>n.jsx("h2",{className:im(Nue,a),children:e}),jue=({children:e,className:a})=>n.jsx("h3",{className:im(xue,a),children:e}),Lue=({children:e,className:a})=>n.jsx("p",{className:im(Eue,a),children:e}),Bue=({title:e,children:a,headerActions:t})=>n.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1 flex flex-col gap-4 pt-4",children:[n.jsxs("div",{className:"px-4 flex",children:[n.jsx(Pue,{className:"text-primary",children:e}),t&&n.jsx("div",{className:"ml-auto",children:t})]}),a]}),zue=()=>n.jsx(Bue,{title:"Preview & Schedule",children:n.jsx(Tue,{disablePreview:!0,disableEditContent:!0,disablePreviewSubtext:!0})}),Rue=()=>{const e=wY(),t=CY(),{channelSenders:i}=x9(),{channelAccounts:r}=M9(),{data:o}=L9(),[s,l]=a.useState(null),[u,c]=a.useState(null),[d,m]=a.useState(null),[h,p]=a.useState(null);return a.useEffect((()=>{i&&m(i),r&&p(r)}),[i,r]),a.useEffect((()=>{if(t&&d&&h){const e=t.emailChannelSenderId,a=t.smsChannelSenderId,n=d.results.find((a=>a.id===e)),i=d.results.find((e=>e.id===a));if(n&&t.emailSubject&&t.emailHtmlBody){const e=n.channelSenderMetadata?.userPart,a=h.results.find((e=>e.id===n.channelAccountId));if(a)switch(a.channelAccountMetadata.type){case T9.REACH_MANAGED:l({fromEmail:`${e}@${a.channelAccountMetadata.baseDomain}.embedreach.com`,fromName:n.channelSenderMetadata?.emailFromName,subject:t.emailSubject,previewText:t.emailPreviewText,body:t.emailHtmlBody});break;case T9.TWILLIO:break;default:throw Dse(a.channelAccountMetadata.type,T9)}}(o||i)&&t.smsMessageBody&&c({fromPhone:i?_se(i.channelSenderMetadata):"",body:t.smsMessageBody,companyName:t.textMessageCompanyName})}}),[t,d,h,o]),e?n.jsx("div",s||u?{className:"w-full",children:n.jsx("div",{className:"flex flex-col gap-4 w-full",children:n.jsx(zue,{})})}:{className:"flex justify-center items-center h-full",children:n.jsx("div",{children:"No preview data Please complete previous steps"})}):n.jsx(xY,{text:["Loading..."]})};function _ue(e){return(_ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Due(e){if(null===e||!0===e||!1===e)return NaN;var a=Number(e);return isNaN(a)?a:a<0?Math.ceil(a):Math.floor(a)}function Kue(e,a){if(a.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+a.length+" present")}function Hue(e){Kue(1,arguments);var a=Object.prototype.toString.call(e);return e instanceof Date||"object"===_ue(e)&&"[object Date]"===a?new Date(e.getTime()):"number"==typeof e||"[object Number]"===a?new Date(e):new Date(NaN)}function Oue(e,a){Kue(2,arguments);var n=Hue(e),t=Due(a);return isNaN(t)?new Date(NaN):t?(n.setDate(n.getDate()+t),n):n}function Iue(e,a){Kue(2,arguments);var n=Hue(e),t=Due(a);if(isNaN(t))return new Date(NaN);if(!t)return n;var i=n.getDate(),r=new Date(n.getTime());return r.setMonth(n.getMonth()+t+1,0),i>=r.getDate()?r:(n.setFullYear(r.getFullYear(),r.getMonth(),i),n)}var Gue={};function Vue(){return Gue}function Fue(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.weekStartsOn)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==i?i:c.weekStartsOn)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var m=Hue(e),h=m.getDay(),p=(h<d?7:0)+h-d;return m.setDate(m.getDate()-p),m.setHours(0,0,0,0),m}function Jue(e){return Kue(1,arguments),Fue(e,{weekStartsOn:1})}function Uue(e){Kue(1,arguments);var a=function(e){Kue(1,arguments);var a=Hue(e),n=a.getFullYear(),t=new Date(0);t.setFullYear(n+1,0,4),t.setHours(0,0,0,0);var i=Jue(t),r=new Date(0);r.setFullYear(n,0,4),r.setHours(0,0,0,0);var o=Jue(r);return a.getTime()>=i.getTime()?n+1:a.getTime()>=o.getTime()?n:n-1}(e),n=new Date(0);return n.setFullYear(a,0,4),n.setHours(0,0,0,0),Jue(n)}function Wue(e){var a=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return a.setUTCFullYear(e.getFullYear()),e.getTime()-a.getTime()}function que(e){Kue(1,arguments);var a=Hue(e);return a.setHours(0,0,0,0),a}function Zue(e,a){Kue(2,arguments);var n=que(e),t=que(a),i=n.getTime()-Wue(n),r=t.getTime()-Wue(t);return Math.round((i-r)/864e5)}function $ue(e,a){return Kue(2,arguments),Oue(e,7*Due(a))}function Yue(e,a){return Kue(2,arguments),Iue(e,12*Due(a))}function Que(e,a){Kue(2,arguments);var n=que(e),t=que(a);return n.getTime()===t.getTime()}function Xue(e){return Kue(1,arguments),e instanceof Date||"object"===_ue(e)&&"[object Date]"===Object.prototype.toString.call(e)}function ece(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return 12*(n.getFullYear()-t.getFullYear())+(n.getMonth()-t.getMonth())}function ace(e){Kue(1,arguments);var a=Hue(e),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(23,59,59,999),a}function nce(e){Kue(1,arguments);var a=Hue(e);return a.setDate(1),a.setHours(0,0,0,0),a}function tce(e){Kue(1,arguments);var a=Hue(e),n=new Date(0);return n.setFullYear(a.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ice(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.weekStartsOn)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==i?i:c.weekStartsOn)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var m=Hue(e),h=m.getDay(),p=6+(h<d?-7:0)-(h-d);return m.setDate(m.getDate()+p),m.setHours(23,59,59,999),m}function rce(e){return Kue(1,arguments),ice(e,{weekStartsOn:1})}function oce(e,a){return Kue(2,arguments),function(e,a){Kue(2,arguments);var n=Hue(e).getTime(),t=Due(a);return new Date(n+t)}(e,-Due(a))}function sce(e){Kue(1,arguments);var a=Hue(e),n=a.getUTCDay(),t=(n<1?7:0)+n-1;return a.setUTCDate(a.getUTCDate()-t),a.setUTCHours(0,0,0,0),a}function lce(e){Kue(1,arguments);var a=Hue(e),n=a.getUTCFullYear(),t=new Date(0);t.setUTCFullYear(n+1,0,4),t.setUTCHours(0,0,0,0);var i=sce(t),r=new Date(0);r.setUTCFullYear(n,0,4),r.setUTCHours(0,0,0,0);var o=sce(r);return a.getTime()>=i.getTime()?n+1:a.getTime()>=o.getTime()?n:n-1}function uce(e){Kue(1,arguments);var a=Hue(e),n=sce(a).getTime()-function(e){Kue(1,arguments);var a=lce(e),n=new Date(0);return n.setUTCFullYear(a,0,4),n.setUTCHours(0,0,0,0),sce(n)}(a).getTime();return Math.round(n/6048e5)+1}function cce(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.weekStartsOn)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==i?i:c.weekStartsOn)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var m=Hue(e),h=m.getUTCDay(),p=(h<d?7:0)+h-d;return m.setUTCDate(m.getUTCDate()-p),m.setUTCHours(0,0,0,0),m}function dce(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Hue(e),d=c.getUTCFullYear(),m=Vue(),h=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.firstWeekContainsDate)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:m.firstWeekContainsDate)&&void 0!==t?t:null===(l=m.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==n?n:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(d+1,0,h),p.setUTCHours(0,0,0,0);var g=cce(p,a),v=new Date(0);v.setUTCFullYear(d,0,h),v.setUTCHours(0,0,0,0);var f=cce(v,a);return c.getTime()>=g.getTime()?d+1:c.getTime()>=f.getTime()?d:d-1}function mce(e,a){Kue(1,arguments);var n=Hue(e),t=cce(n,a).getTime()-function(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.firstWeekContainsDate)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:c.firstWeekContainsDate)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==n?n:1),m=dce(e,a),h=new Date(0);return h.setUTCFullYear(m,0,d),h.setUTCHours(0,0,0,0),cce(h,a)}(n,a).getTime();return Math.round(t/6048e5)+1}function hce(e,a){for(var n=e<0?"-":"",t=Math.abs(e).toString();t.length<a;)t="0"+t;return n+t}var pce=function(e,a){var n=e.getUTCFullYear(),t=n>0?n:1-n;return hce("yy"===a?t%100:t,a.length)},gce=function(e,a){var n=e.getUTCMonth();return"M"===a?String(n+1):hce(n+1,2)},vce=function(e,a){return hce(e.getUTCDate(),a.length)},fce=function(e,a){return hce(e.getUTCHours()%12||12,a.length)},yce=function(e,a){return hce(e.getUTCHours(),a.length)},kce=function(e,a){return hce(e.getUTCMinutes(),a.length)},bce=function(e,a){return hce(e.getUTCSeconds(),a.length)},Sce=function(e,a){var n=a.length,t=e.getUTCMilliseconds();return hce(Math.floor(t*Math.pow(10,n-3)),a.length)},Ace="midnight",wce="noon",Cce="morning",Mce="afternoon",Tce="evening",Nce="night",xce={G:function(e,a,n){var t=e.getUTCFullYear()>0?1:0;switch(a){case"G":case"GG":case"GGG":return n.era(t,{width:"abbreviated"});case"GGGGG":return n.era(t,{width:"narrow"});default:return n.era(t,{width:"wide"})}},y:function(e,a,n){if("yo"===a){var t=e.getUTCFullYear();return n.ordinalNumber(t>0?t:1-t,{unit:"year"})}return pce(e,a)},Y:function(e,a,n,t){var i=dce(e,t),r=i>0?i:1-i;return"YY"===a?hce(r%100,2):"Yo"===a?n.ordinalNumber(r,{unit:"year"}):hce(r,a.length)},R:function(e,a){return hce(lce(e),a.length)},u:function(e,a){return hce(e.getUTCFullYear(),a.length)},Q:function(e,a,n){var t=Math.ceil((e.getUTCMonth()+1)/3);switch(a){case"Q":return String(t);case"QQ":return hce(t,2);case"Qo":return n.ordinalNumber(t,{unit:"quarter"});case"QQQ":return n.quarter(t,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(t,{width:"narrow",context:"formatting"});default:return n.quarter(t,{width:"wide",context:"formatting"})}},q:function(e,a,n){var t=Math.ceil((e.getUTCMonth()+1)/3);switch(a){case"q":return String(t);case"qq":return hce(t,2);case"qo":return n.ordinalNumber(t,{unit:"quarter"});case"qqq":return n.quarter(t,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(t,{width:"narrow",context:"standalone"});default:return n.quarter(t,{width:"wide",context:"standalone"})}},M:function(e,a,n){var t=e.getUTCMonth();switch(a){case"M":case"MM":return gce(e,a);case"Mo":return n.ordinalNumber(t+1,{unit:"month"});case"MMM":return n.month(t,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(t,{width:"narrow",context:"formatting"});default:return n.month(t,{width:"wide",context:"formatting"})}},L:function(e,a,n){var t=e.getUTCMonth();switch(a){case"L":return String(t+1);case"LL":return hce(t+1,2);case"Lo":return n.ordinalNumber(t+1,{unit:"month"});case"LLL":return n.month(t,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(t,{width:"narrow",context:"standalone"});default:return n.month(t,{width:"wide",context:"standalone"})}},w:function(e,a,n,t){var i=mce(e,t);return"wo"===a?n.ordinalNumber(i,{unit:"week"}):hce(i,a.length)},I:function(e,a,n){var t=uce(e);return"Io"===a?n.ordinalNumber(t,{unit:"week"}):hce(t,a.length)},d:function(e,a,n){return"do"===a?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):vce(e,a)},D:function(e,a,n){var t=function(e){Kue(1,arguments);var a=Hue(e),n=a.getTime();a.setUTCMonth(0,1),a.setUTCHours(0,0,0,0);var t=a.getTime();return Math.floor((n-t)/864e5)+1}(e);return"Do"===a?n.ordinalNumber(t,{unit:"dayOfYear"}):hce(t,a.length)},E:function(e,a,n){var t=e.getUTCDay();switch(a){case"E":case"EE":case"EEE":return n.day(t,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(t,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(t,{width:"short",context:"formatting"});default:return n.day(t,{width:"wide",context:"formatting"})}},e:function(e,a,n,t){var i=e.getUTCDay(),r=(i-t.weekStartsOn+8)%7||7;switch(a){case"e":return String(r);case"ee":return hce(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,a,n,t){var i=e.getUTCDay(),r=(i-t.weekStartsOn+8)%7||7;switch(a){case"c":return String(r);case"cc":return hce(r,a.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,a,n){var t=e.getUTCDay(),i=0===t?7:t;switch(a){case"i":return String(i);case"ii":return hce(i,a.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(t,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(t,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(t,{width:"short",context:"formatting"});default:return n.day(t,{width:"wide",context:"formatting"})}},a:function(e,a,n){var t=e.getUTCHours()/12>=1?"pm":"am";switch(a){case"a":case"aa":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(t,{width:"narrow",context:"formatting"});default:return n.dayPeriod(t,{width:"wide",context:"formatting"})}},b:function(e,a,n){var t,i=e.getUTCHours();switch(t=12===i?wce:0===i?Ace:i/12>=1?"pm":"am",a){case"b":case"bb":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(t,{width:"narrow",context:"formatting"});default:return n.dayPeriod(t,{width:"wide",context:"formatting"})}},B:function(e,a,n){var t,i=e.getUTCHours();switch(t=i>=17?Tce:i>=12?Mce:i>=4?Cce:Nce,a){case"B":case"BB":case"BBB":return n.dayPeriod(t,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(t,{width:"narrow",context:"formatting"});default:return n.dayPeriod(t,{width:"wide",context:"formatting"})}},h:function(e,a,n){if("ho"===a){var t=e.getUTCHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return fce(e,a)},H:function(e,a,n){return"Ho"===a?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):yce(e,a)},K:function(e,a,n){var t=e.getUTCHours()%12;return"Ko"===a?n.ordinalNumber(t,{unit:"hour"}):hce(t,a.length)},k:function(e,a,n){var t=e.getUTCHours();return 0===t&&(t=24),"ko"===a?n.ordinalNumber(t,{unit:"hour"}):hce(t,a.length)},m:function(e,a,n){return"mo"===a?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):kce(e,a)},s:function(e,a,n){return"so"===a?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):bce(e,a)},S:function(e,a){return Sce(e,a)},X:function(e,a,n,t){var i=(t._originalDate||e).getTimezoneOffset();if(0===i)return"Z";switch(a){case"X":return Pce(i);case"XXXX":case"XX":return jce(i);default:return jce(i,":")}},x:function(e,a,n,t){var i=(t._originalDate||e).getTimezoneOffset();switch(a){case"x":return Pce(i);case"xxxx":case"xx":return jce(i);default:return jce(i,":")}},O:function(e,a,n,t){var i=(t._originalDate||e).getTimezoneOffset();switch(a){case"O":case"OO":case"OOO":return"GMT"+Ece(i,":");default:return"GMT"+jce(i,":")}},z:function(e,a,n,t){var i=(t._originalDate||e).getTimezoneOffset();switch(a){case"z":case"zz":case"zzz":return"GMT"+Ece(i,":");default:return"GMT"+jce(i,":")}},t:function(e,a,n,t){return hce(Math.floor((t._originalDate||e).getTime()/1e3),a.length)},T:function(e,a,n,t){return hce((t._originalDate||e).getTime(),a.length)}};function Ece(e,a){var n=e>0?"-":"+",t=Math.abs(e),i=Math.floor(t/60),r=t%60;if(0===r)return n+String(i);var o=a;return n+String(i)+o+hce(r,2)}function Pce(e,a){return e%60==0?(e>0?"-":"+")+hce(Math.abs(e)/60,2):jce(e,a)}function jce(e,a){var n=a||"",t=e>0?"-":"+",i=Math.abs(e);return t+hce(Math.floor(i/60),2)+n+hce(i%60,2)}var Lce=function(e,a){switch(e){case"P":return a.date({width:"short"});case"PP":return a.date({width:"medium"});case"PPP":return a.date({width:"long"});default:return a.date({width:"full"})}},Bce=function(e,a){switch(e){case"p":return a.time({width:"short"});case"pp":return a.time({width:"medium"});case"ppp":return a.time({width:"long"});default:return a.time({width:"full"})}},zce={p:Bce,P:function(e,a){var n,t=e.match(/(P+)(p+)?/)||[],i=t[1],r=t[2];if(!r)return Lce(e,a);switch(i){case"P":n=a.dateTime({width:"short"});break;case"PP":n=a.dateTime({width:"medium"});break;case"PPP":n=a.dateTime({width:"long"});break;default:n=a.dateTime({width:"full"})}return n.replace("{{date}}",Lce(i,a)).replace("{{time}}",Bce(r,a))}},Rce=["D","DD"],_ce=["YY","YYYY"];function Dce(e,a,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(a,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(a,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(a,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(a,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var Kce={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function Hce(e){return function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=a.width?String(a.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Oce={date:Hce({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Hce({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:Hce({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ice={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Gce(e){return function(a,n){var t;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&e.formattingValues){var i=e.defaultFormattingWidth||e.defaultWidth,r=null!=n&&n.width?String(n.width):i;t=e.formattingValues[r]||e.formattingValues[i]}else{var o=e.defaultWidth,s=null!=n&&n.width?String(n.width):e.defaultWidth;t=e.values[s]||e.values[o]}return t[e.argumentCallback?e.argumentCallback(a):a]}}var Vce={ordinalNumber:function(e,a){var n=Number(e),t=n%100;if(t>20||t<10)switch(t%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:Gce({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Gce({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Gce({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:Gce({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:Gce({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function Fce(e){return function(a){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.width,i=a.match(t&&e.matchPatterns[t]||e.matchPatterns[e.defaultMatchWidth]);if(!i)return null;var r,o=i[0],s=t&&e.parsePatterns[t]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,a){for(var n=0;n<e.length;n++)if(a(e[n]))return n;return}(s,(function(e){return e.test(o)})):function(e,a){for(var n in e)if(e.hasOwnProperty(n)&&a(e[n]))return n;return}(s,(function(e){return e.test(o)}));return r=e.valueCallback?e.valueCallback(l):l,{value:r=n.valueCallback?n.valueCallback(r):r,rest:a.slice(o.length)}}}var Jce={ordinalNumber:function(e){return function(a){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=a.match(e.matchPattern);if(!t)return null;var i=t[0],r=a.match(e.parsePattern);if(!r)return null;var o=e.valueCallback?e.valueCallback(r[0]):r[0];return{value:o=n.valueCallback?n.valueCallback(o):o,rest:a.slice(i.length)}}}({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:Fce({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Fce({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:Fce({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Fce({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Fce({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},Uce={code:"en-US",formatDistance:function(e,a,n){var t,i=Kce[e];return t="string"==typeof i?i:1===a?i.one:i.other.replace("{{count}}",a.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+t:t+" ago":t},formatLong:Oce,formatRelative:function(e,a,n,t){return Ice[e]},localize:Vce,match:Jce,options:{weekStartsOn:0,firstWeekContainsDate:1}},Wce=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,qce=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Zce=/^'([^]*?)'?$/,$ce=/''/g,Yce=/[a-zA-Z]/;function Qce(e,a,n){var t,i,r,o,s,l,u,c,d,m,h,p,g,v,f,y,k,b;Kue(2,arguments);var S=String(a),A=Vue(),w=null!==(t=null!==(i=null==n?void 0:n.locale)&&void 0!==i?i:A.locale)&&void 0!==t?t:Uce,C=Due(null!==(r=null!==(o=null!==(s=null!==(l=null==n?void 0:n.firstWeekContainsDate)&&void 0!==l?l:null==n||null===(u=n.locale)||void 0===u||null===(c=u.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==s?s:A.firstWeekContainsDate)&&void 0!==o?o:null===(d=A.locale)||void 0===d||null===(m=d.options)||void 0===m?void 0:m.firstWeekContainsDate)&&void 0!==r?r:1);if(!(C>=1&&C<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var M=Due(null!==(h=null!==(p=null!==(g=null!==(v=null==n?void 0:n.weekStartsOn)&&void 0!==v?v:null==n||null===(f=n.locale)||void 0===f||null===(y=f.options)||void 0===y?void 0:y.weekStartsOn)&&void 0!==g?g:A.weekStartsOn)&&void 0!==p?p:null===(k=A.locale)||void 0===k||null===(b=k.options)||void 0===b?void 0:b.weekStartsOn)&&void 0!==h?h:0);if(!(M>=0&&M<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!w.localize)throw new RangeError("locale must contain localize property");if(!w.formatLong)throw new RangeError("locale must contain formatLong property");var T=Hue(e);if(!function(e){if(Kue(1,arguments),!Xue(e)&&"number"!=typeof e)return!1;var a=Hue(e);return!isNaN(Number(a))}(T))throw new RangeError("Invalid time value");var N=oce(T,Wue(T)),x={firstWeekContainsDate:C,weekStartsOn:M,locale:w,_originalDate:T};return S.match(qce).map((function(e){var a=e[0];return"p"===a||"P"===a?(0,zce[a])(e,w.formatLong):e})).join("").match(Wce).map((function(t){if("''"===t)return"'";var i=t[0];if("'"===i)return function(e){var a=e.match(Zce);if(!a)return e;return a[1].replace($ce,"'")}(t);var r=xce[i];if(r)return null!=n&&n.useAdditionalWeekYearTokens||-1===_ce.indexOf(t)||Dce(t,a,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==Rce.indexOf(e)}(t)||Dce(t,a,String(e)),r(N,t,w.localize,x);if(i.match(Yce))throw new RangeError("Format string contains an unescaped latin alphabet character `"+i+"`");return t})).join("")}function Xce(e){return Kue(1,arguments),Math.floor(function(e){return Kue(1,arguments),Hue(e).getTime()}(e)/1e3)}function ede(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Vue(),d=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.firstWeekContainsDate)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:c.firstWeekContainsDate)&&void 0!==t?t:null===(l=c.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==n?n:1),m=function(e,a){var n,t,i,r,o,s,l,u;Kue(1,arguments);var c=Hue(e),d=c.getFullYear(),m=Vue(),h=Due(null!==(n=null!==(t=null!==(i=null!==(r=null==a?void 0:a.firstWeekContainsDate)&&void 0!==r?r:null==a||null===(o=a.locale)||void 0===o||null===(s=o.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==i?i:m.firstWeekContainsDate)&&void 0!==t?t:null===(l=m.locale)||void 0===l||null===(u=l.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==n?n:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setFullYear(d+1,0,h),p.setHours(0,0,0,0);var g=Fue(p,a),v=new Date(0);v.setFullYear(d,0,h),v.setHours(0,0,0,0);var f=Fue(v,a);return c.getTime()>=g.getTime()?d+1:c.getTime()>=f.getTime()?d:d-1}(e,a),h=new Date(0);return h.setFullYear(m,0,d),h.setHours(0,0,0,0),Fue(h,a)}function ade(e,a){return Kue(1,arguments),function(e,a,n){Kue(2,arguments);var t=Fue(e,n),i=Fue(a,n),r=t.getTime()-Wue(t),o=i.getTime()-Wue(i);return Math.round((r-o)/6048e5)}(function(e){Kue(1,arguments);var a=Hue(e),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(0,0,0,0),a}(e),nce(e),a)+1}function nde(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return n.getTime()>t.getTime()}function tde(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return n.getTime()<t.getTime()}function ide(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()}function rde(e,a){return Kue(2,arguments),Oue(e,-Due(a))}function ode(e,a){Kue(2,arguments);var n=Hue(e),t=Due(a),i=n.getFullYear(),r=n.getDate(),o=new Date(0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);var s=function(e){Kue(1,arguments);var a=Hue(e),n=a.getFullYear(),t=a.getMonth(),i=new Date(0);return i.setFullYear(n,t+1,0),i.setHours(0,0,0,0),i.getDate()}(o);return n.setMonth(t,Math.min(r,s)),n}function sde(e,a){Kue(2,arguments);var n=Hue(e),t=Due(a);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(t),n)}var lde=function(){return lde=Object.assign||function(e){for(var a,n=1,t=arguments.length;n<t;n++)for(var i in a=arguments[n])Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i]);return e},lde.apply(this,arguments)};function ude(e,a,n){for(var t,i=0,r=a.length;i<r;i++)!t&&i in a||(t||(t=Array.prototype.slice.call(a,0,i)),t[i]=a[i]);return e.concat(t||Array.prototype.slice.call(a))}function cde(e){return"multiple"===e.mode}function dde(e){return"range"===e.mode}function mde(e){return"single"===e.mode}"function"==typeof SuppressedError&&SuppressedError;var hde={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};var pde=Object.freeze({__proto__:null,formatCaption:function(e,a){return Qce(e,"LLLL y",a)},formatDay:function(e,a){return Qce(e,"d",a)},formatMonthCaption:function(e,a){return Qce(e,"LLLL",a)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,a){return Qce(e,"cccccc",a)},formatYearCaption:function(e,a){return Qce(e,"yyyy",a)}}),gde=Object.freeze({__proto__:null,labelDay:function(e,a,n){return Qce(e,"do MMMM (EEEE)",n)},labelMonthDropdown:function(){return"Month: "},labelNext:function(){return"Go to next month"},labelPrevious:function(){return"Go to previous month"},labelWeekNumber:function(e){return"Week n. ".concat(e)},labelWeekday:function(e,a){return Qce(e,"cccc",a)},labelYearDropdown:function(){return"Year: "}});var vde=a.createContext(void 0);function fde(e){var a,t,i=e.initialProps,r={captionLayout:"buttons",classNames:hde,formatters:pde,labels:gde,locale:Uce,modifiersClassNames:{},modifiers:{},numberOfMonths:1,styles:{},today:new Date,mode:"default"},o=function(e){var a=e.fromYear,n=e.toYear,t=e.fromMonth,i=e.toMonth,r=e.fromDate,o=e.toDate;return t?r=nce(t):a&&(r=new Date(a,0,1)),i?o=ace(i):n&&(o=new Date(n,11,31)),{fromDate:r?que(r):void 0,toDate:o?que(o):void 0}}(i),s=o.fromDate,l=o.toDate,u=null!==(a=i.captionLayout)&&void 0!==a?a:r.captionLayout;"buttons"===u||s&&l||(u="buttons"),(mde(i)||cde(i)||dde(i))&&(t=i.onSelect);var c=lde(lde(lde({},r),i),{captionLayout:u,classNames:lde(lde({},r.classNames),i.classNames),components:lde({},i.components),formatters:lde(lde({},r.formatters),i.formatters),fromDate:s,labels:lde(lde({},r.labels),i.labels),mode:i.mode||r.mode,modifiers:lde(lde({},r.modifiers),i.modifiers),modifiersClassNames:lde(lde({},r.modifiersClassNames),i.modifiersClassNames),onSelect:t,styles:lde(lde({},r.styles),i.styles),toDate:l});return n.jsx(vde.Provider,{value:c,children:e.children})}function yde(){var e=a.useContext(vde);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function kde(e){var a=yde();return n.jsx("div",{className:a.classNames.caption_label,style:a.styles.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:(0,a.formatters.formatCaption)(e.displayMonth,{locale:a.locale})})}function bde(e){return n.jsx("svg",lde({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:n.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Sde(e){var a,t,i=e.onChange,r=e.value,o=e.children,s=e.caption,l=e.className,u=e.style,c=yde(),d=null!==(t=null===(a=c.components)||void 0===a?void 0:a.IconDropdown)&&void 0!==t?t:bde;return n.jsxs("div",{className:l,style:u,children:[n.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),n.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:r,onChange:i,children:o}),n.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[s,n.jsx(d,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function Ade(e){var a,t=yde(),i=t.fromDate,r=t.toDate,o=t.styles,s=t.locale,l=t.formatters.formatMonthCaption,u=t.classNames,c=t.components,d=t.labels.labelMonthDropdown;if(!i)return n.jsx(n.Fragment,{});if(!r)return n.jsx(n.Fragment,{});var m=[];if(function(e,a){Kue(2,arguments);var n=Hue(e),t=Hue(a);return n.getFullYear()===t.getFullYear()}(i,r))for(var h=nce(i),p=i.getMonth();p<=r.getMonth();p++)m.push(ode(h,p));else for(h=nce(new Date),p=0;p<=11;p++)m.push(ode(h,p));var g=null!==(a=null==c?void 0:c.Dropdown)&&void 0!==a?a:Sde;return n.jsx(g,{name:"months","aria-label":d(),className:u.dropdown_month,style:o.dropdown_month,onChange:function(a){var n=Number(a.target.value),t=ode(nce(e.displayMonth),n);e.onChange(t)},value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:s}),children:m.map((function(e){return n.jsx("option",{value:e.getMonth(),children:l(e,{locale:s})},e.getMonth())}))})}function wde(e){var a,t=e.displayMonth,i=yde(),r=i.fromDate,o=i.toDate,s=i.locale,l=i.styles,u=i.classNames,c=i.components,d=i.formatters.formatYearCaption,m=i.labels.labelYearDropdown,h=[];if(!r)return n.jsx(n.Fragment,{});if(!o)return n.jsx(n.Fragment,{});for(var p=r.getFullYear(),g=o.getFullYear(),v=p;v<=g;v++)h.push(sde(tce(new Date),v));var f=null!==(a=null==c?void 0:c.Dropdown)&&void 0!==a?a:Sde;return n.jsx(f,{name:"years","aria-label":m(),className:u.dropdown_year,style:l.dropdown_year,onChange:function(a){var n=sde(nce(t),Number(a.target.value));e.onChange(n)},value:t.getFullYear(),caption:d(t,{locale:s}),children:h.map((function(e){return n.jsx("option",{value:e.getFullYear(),children:d(e,{locale:s})},e.getFullYear())}))})}function Cde(){var e=yde(),n=function(e){var a=e.month||e.defaultMonth||e.today||new Date,n=e.toDate,t=e.fromDate,i=e.numberOfMonths,r=void 0===i?1:i;return n&&ece(n,a)<0&&(a=Iue(n,-1*(r-1))),t&&ece(a,t)<0&&(a=t),nce(a)}(e),t=function(e,n){var t=a.useState(e);return[void 0===n?t[0]:n,t[1]]}(n,e.month),i=t[1];return[t[0],function(a){var n;if(!e.disableNavigation){var t=nce(a);i(t),null===(n=e.onMonthChange)||void 0===n||n.call(e,t)}}]}var Mde=a.createContext(void 0);function Tde(e){var a=yde(),t=Cde(),i=t[0],r=t[1],o=function(e,a){for(var n=a.reverseMonths,t=a.numberOfMonths,i=nce(e),r=ece(nce(Iue(i,t)),i),o=[],s=0;s<r;s++){var l=Iue(i,s);o.push(l)}return n&&(o=o.reverse()),o}(i,a),s=function(e,a){if(!a.disableNavigation){var n=a.toDate,t=a.numberOfMonths,i=void 0===t?1:t,r=a.pagedNavigation?i:1,o=nce(e);if(!n)return Iue(o,r);if(!(ece(n,e)<i))return Iue(o,r)}}(i,a),l=function(e,a){if(!a.disableNavigation){var n=a.fromDate,t=a.numberOfMonths,i=a.pagedNavigation?void 0===t?1:t:1,r=nce(e);if(!n)return Iue(r,-i);if(!(ece(r,n)<=0))return Iue(r,-i)}}(i,a),u=function(e){return o.some((function(a){return ide(e,a)}))};return n.jsx(Mde.Provider,{value:{currentMonth:i,displayMonths:o,goToMonth:r,goToDate:function(e,n){u(e)||(n&&tde(e,n)?r(Iue(e,1+-1*a.numberOfMonths)):r(e))},previousMonth:l,nextMonth:s,isDateDisplayed:u},children:e.children})}function Nde(){var e=a.useContext(Mde);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function xde(e){var a,t=yde(),i=t.classNames,r=t.styles,o=t.components,s=Nde().goToMonth,l=function(a){s(Iue(a,e.displayIndex?-e.displayIndex:0))},u=null!==(a=null==o?void 0:o.CaptionLabel)&&void 0!==a?a:kde,c=n.jsx(u,{id:e.id,displayMonth:e.displayMonth});return n.jsxs("div",{className:i.caption_dropdowns,style:r.caption_dropdowns,children:[n.jsx("div",{className:i.vhidden,children:c}),n.jsx(Ade,{onChange:l,displayMonth:e.displayMonth}),n.jsx(wde,{onChange:l,displayMonth:e.displayMonth})]})}function Ede(e){return n.jsx("svg",lde({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:n.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Pde(e){return n.jsx("svg",lde({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:n.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var jde=a.forwardRef((function(e,a){var t=yde(),i=t.classNames,r=t.styles,o=[i.button_reset,i.button];e.className&&o.push(e.className);var s=o.join(" "),l=lde(lde({},r.button_reset),r.button);return e.style&&Object.assign(l,e.style),n.jsx("button",lde({},e,{ref:a,type:"button",className:s,style:l}))}));function Lde(e){var a,t,i=yde(),r=i.dir,o=i.locale,s=i.classNames,l=i.styles,u=i.labels,c=u.labelPrevious,d=u.labelNext,m=i.components;if(!e.nextMonth&&!e.previousMonth)return n.jsx(n.Fragment,{});var h=c(e.previousMonth,{locale:o}),p=[s.nav_button,s.nav_button_previous].join(" "),g=d(e.nextMonth,{locale:o}),v=[s.nav_button,s.nav_button_next].join(" "),f=null!==(a=null==m?void 0:m.IconRight)&&void 0!==a?a:Pde,y=null!==(t=null==m?void 0:m.IconLeft)&&void 0!==t?t:Ede;return n.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&n.jsx(jde,{name:"previous-month","aria-label":h,className:p,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:n.jsx("rtl"===r?f:y,{className:s.nav_icon,style:l.nav_icon})}),!e.hideNext&&n.jsx(jde,{name:"next-month","aria-label":g,className:v,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:n.jsx("rtl"===r?y:f,{className:s.nav_icon,style:l.nav_icon})})]})}function Bde(e){var a=yde().numberOfMonths,t=Nde(),i=t.previousMonth,r=t.nextMonth,o=t.goToMonth,s=t.displayMonths,l=s.findIndex((function(a){return ide(e.displayMonth,a)})),u=0===l,c=l===s.length-1;return n.jsx(Lde,{displayMonth:e.displayMonth,hideNext:a>1&&(u||!c),hidePrevious:a>1&&(c||!u),nextMonth:r,previousMonth:i,onPreviousClick:function(){i&&o(i)},onNextClick:function(){r&&o(r)}})}function zde(e){var a,t,i=yde(),r=i.classNames,o=i.styles,s=i.captionLayout,l=i.components,u=null!==(a=null==l?void 0:l.CaptionLabel)&&void 0!==a?a:kde;return t=i.disableNavigation?n.jsx(u,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===s?n.jsx(xde,{displayMonth:e.displayMonth,id:e.id}):n.jsxs(n.Fragment,"dropdown-buttons"===s?{children:[n.jsx(xde,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),n.jsx(Bde,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}:{children:[n.jsx(u,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),n.jsx(Bde,{displayMonth:e.displayMonth,id:e.id})]}),n.jsx("div",{className:r.caption,style:o.caption,children:t})}function Rde(e){var a=yde(),t=a.footer;return t?n.jsx("tfoot",{className:a.classNames.tfoot,style:a.styles.tfoot,children:n.jsx("tr",{children:n.jsx("td",{colSpan:8,children:t})})}):n.jsx(n.Fragment,{})}function _de(){var e=yde(),a=e.classNames,t=e.styles,i=e.showWeekNumber,r=e.locale,o=e.formatters.formatWeekdayName,s=e.labels.labelWeekday,l=function(e,a,n){for(var t=n?Jue(new Date):Fue(new Date,{locale:e,weekStartsOn:a}),i=[],r=0;r<7;r++){var o=Oue(t,r);i.push(o)}return i}(r,e.weekStartsOn,e.ISOWeek);return n.jsxs("tr",{style:t.head_row,className:a.head_row,children:[i&&n.jsx("td",{style:t.head_cell,className:a.head_cell}),l.map((function(e,i){return n.jsx("th",{scope:"col",className:a.head_cell,style:t.head_cell,"aria-label":s(e,{locale:r}),children:o(e,{locale:r})},i)}))]})}function Dde(){var e,a=yde(),t=a.components,i=null!==(e=null==t?void 0:t.HeadRow)&&void 0!==e?e:_de;return n.jsx("thead",{style:a.styles.head,className:a.classNames.head,children:n.jsx(i,{})})}function Kde(e){var a=yde();return n.jsx(n.Fragment,{children:(0,a.formatters.formatDay)(e.date,{locale:a.locale})})}var Hde=a.createContext(void 0);function Ode(e){if(!cde(e.initialProps)){return n.jsx(Hde.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}return n.jsx(Ide,{initialProps:e.initialProps,children:e.children})}function Ide(e){var a=e.initialProps,t=e.children,i=a.selected,r=a.min,o=a.max,s={disabled:[]};return i&&s.disabled.push((function(e){var a=o&&i.length>o-1,n=i.some((function(a){return Que(a,e)}));return Boolean(a&&!n)})),n.jsx(Hde.Provider,{value:{selected:i,onDayClick:function(e,n,t){var s,l;if((null===(s=a.onDayClick)||void 0===s||s.call(a,e,n,t),!Boolean(n.selected&&r&&(null==i?void 0:i.length)===r))&&!Boolean(!n.selected&&o&&(null==i?void 0:i.length)===o)){var u=i?ude([],i):[];if(n.selected){var c=u.findIndex((function(a){return Que(e,a)}));u.splice(c,1)}else u.push(e);null===(l=a.onSelect)||void 0===l||l.call(a,u,e,n,t)}},modifiers:s},children:t})}function Gde(){var e=a.useContext(Hde);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var Vde,Fde,Jde=a.createContext(void 0);function Ude(e){if(!dde(e.initialProps)){return n.jsx(Jde.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}return n.jsx(Wde,{initialProps:e.initialProps,children:e.children})}function Wde(e){var a=e.initialProps,t=e.children,i=a.selected,r=i||{},o=r.from,s=r.to,l=a.min,u=a.max,c={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(c.range_start=[o],s?(c.range_end=[s],Que(o,s)||(c.range_middle=[{after:o,before:s}])):c.range_end=[o]):s&&(c.range_start=[s],c.range_end=[s]),l&&(o&&!s&&c.disabled.push({after:rde(o,l-1),before:Oue(o,l-1)}),o&&s&&c.disabled.push({after:o,before:Oue(o,l-1)}),!o&&s&&c.disabled.push({after:rde(s,l-1),before:Oue(s,l-1)})),u){if(o&&!s&&(c.disabled.push({before:Oue(o,1-u)}),c.disabled.push({after:Oue(o,u-1)})),o&&s){var d=u-(Zue(s,o)+1);c.disabled.push({before:rde(o,d)}),c.disabled.push({after:Oue(s,d)})}!o&&s&&(c.disabled.push({before:Oue(s,1-u)}),c.disabled.push({after:Oue(s,u-1)}))}return n.jsx(Jde.Provider,{value:{selected:i,onDayClick:function(e,n,t){var r,o;null===(r=a.onDayClick)||void 0===r||r.call(a,e,n,t);var s=function(e,a){var n=a||{},t=n.from,i=n.to;if(t&&i){if(Que(i,e)&&Que(t,e))return;if(Que(i,e))return{from:i,to:void 0};if(Que(t,e))return;return nde(t,e)?{from:e,to:i}:{from:t,to:e}}return i?nde(e,i)?{from:i,to:e}:{from:e,to:i}:t?tde(e,t)?{from:e,to:t}:{from:t,to:e}:{from:e,to:void 0}}(e,i);null===(o=a.onSelect)||void 0===o||o.call(a,s,e,n,t)},modifiers:c},children:t})}function qde(){var e=a.useContext(Jde);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Zde(e){return Array.isArray(e)?ude([],e):void 0!==e?[e]:[]}(Fde=Vde||(Vde={})).Outside="outside",Fde.Disabled="disabled",Fde.Selected="selected",Fde.Hidden="hidden",Fde.Today="today",Fde.RangeStart="range_start",Fde.RangeEnd="range_end",Fde.RangeMiddle="range_middle";var $de=Vde.Selected,Yde=Vde.Disabled,Qde=Vde.Hidden,Xde=Vde.Today,eme=Vde.RangeEnd,ame=Vde.RangeMiddle,nme=Vde.RangeStart,tme=Vde.Outside;var ime=a.createContext(void 0);function rme(e){var a=yde(),t=function(e,a,n){var t,i=((t={})[$de]=Zde(e.selected),t[Yde]=Zde(e.disabled),t[Qde]=Zde(e.hidden),t[Xde]=[e.today],t[eme]=[],t[ame]=[],t[nme]=[],t[tme]=[],t);return e.fromDate&&i[Yde].push({before:e.fromDate}),e.toDate&&i[Yde].push({after:e.toDate}),cde(e)?i[Yde]=i[Yde].concat(a.modifiers[Yde]):dde(e)&&(i[Yde]=i[Yde].concat(n.modifiers[Yde]),i[nme]=n.modifiers[nme],i[ame]=n.modifiers[ame],i[eme]=n.modifiers[eme]),i}(a,Gde(),qde()),i=function(e){var a={};return Object.entries(e).forEach((function(e){a[e[0]]=Zde(e[1])})),a}(a.modifiers),r=lde(lde({},t),i);return n.jsx(ime.Provider,{value:r,children:e.children})}function ome(){var e=a.useContext(ime);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function sme(e,a){return a.some((function(a){if("boolean"==typeof a)return a;if(Xue(a))return Que(e,a);var n,t,i,r,o;if(function(e){return Array.isArray(e)&&e.every(Xue)}(a))return a.includes(e);if(function(e){return Boolean(e&&"object"==typeof e&&"from"in e)}(a))return n=e,o=(t=a).to,(r=t.from)&&o?(Zue(o,r)<0&&(r=(i=[o,r])[0],o=i[1]),Zue(n,r)>=0&&Zue(o,n)>=0):o?Que(o,n):!!r&&Que(r,n);if(function(e){return Boolean(e&&"object"==typeof e&&"dayOfWeek"in e)}(a))return a.dayOfWeek.includes(e.getDay());if(function(e){return Boolean(e&&"object"==typeof e&&"before"in e&&"after"in e)}(a)){var s=Zue(a.before,e)>0,l=Zue(a.after,e)<0;return nde(a.before,a.after)?l&&s:s||l}return function(e){return Boolean(e&&"object"==typeof e&&"after"in e)}(a)?Zue(e,a.after)>0:function(e){return Boolean(e&&"object"==typeof e&&"before"in e)}(a)?Zue(a.before,e)>0:"function"==typeof a&&a(e)}))}function lme(e,a,n){var t=Object.keys(a).reduce((function(n,t){return sme(e,a[t])&&n.push(t),n}),[]),i={};return t.forEach((function(e){return i[e]=!0})),n&&!ide(e,n)&&(i.outside=!0),i}function ume(e,a){var n=a.moveBy,t=a.direction,i=a.context,r=a.modifiers,o=a.retry,s=void 0===o?{count:0,lastFocused:e}:o,l=i.weekStartsOn,u=i.fromDate,c=i.toDate,d=i.locale,m={day:Oue,week:$ue,month:Iue,year:Yue,startOfWeek:function(e){return i.ISOWeek?Jue(e):Fue(e,{locale:d,weekStartsOn:l})},endOfWeek:function(e){return i.ISOWeek?rce(e):ice(e,{locale:d,weekStartsOn:l})}}[n](e,"after"===t?1:-1);"before"===t&&u?m=function(e){var a,n;if(Kue(1,arguments),e&&"function"==typeof e.forEach)a=e;else{if("object"!==_ue(e)||null===e)return new Date(NaN);a=Array.prototype.slice.call(e)}return a.forEach((function(e){var a=Hue(e);(void 0===n||n<a||isNaN(Number(a)))&&(n=a)})),n||new Date(NaN)}([u,m]):"after"===t&&c&&(m=function(e){var a,n;if(Kue(1,arguments),e&&"function"==typeof e.forEach)a=e;else{if("object"!==_ue(e)||null===e)return new Date(NaN);a=Array.prototype.slice.call(e)}return a.forEach((function(e){var a=Hue(e);(void 0===n||n>a||isNaN(a.getDate()))&&(n=a)})),n||new Date(NaN)}([c,m]));var h=!0;if(r){var p=lme(m,r);h=!p.disabled&&!p.hidden}return h?m:s.count>365?s.lastFocused:ume(m,{moveBy:n,direction:t,context:i,modifiers:r,retry:lde(lde({},s),{count:s.count+1})})}var cme=a.createContext(void 0);function dme(e){var t=Nde(),i=ome(),r=a.useState(),o=r[0],s=r[1],l=a.useState(),u=l[0],c=l[1],d=function(e,a){for(var n,t,i=nce(e[0]),r=ace(e[e.length-1]),o=i;o<=r;){var s=lme(o,a);if(s.disabled||s.hidden)o=Oue(o,1);else{if(s.selected)return o;s.today&&!t&&(t=o),n||(n=o),o=Oue(o,1)}}return t||n}(t.displayMonths,i),m=(null!=o?o:u&&t.isDateDisplayed(u))?u:d,h=function(e){s(e)},p=yde(),g=function(e,a){if(o){var n=ume(o,{moveBy:e,direction:a,context:p,modifiers:i});Que(o,n)||(t.goToDate(n,o),h(n))}};return n.jsx(cme.Provider,{value:{focusedDay:o,focusTarget:m,blur:function(){c(o),s(void 0)},focus:h,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}},children:e.children})}function mme(){var e=a.useContext(cme);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}var hme=a.createContext(void 0);function pme(e){if(!mde(e.initialProps)){return n.jsx(hme.Provider,{value:{selected:void 0},children:e.children})}return n.jsx(gme,{initialProps:e.initialProps,children:e.children})}function gme(e){var a=e.initialProps;return n.jsx(hme.Provider,{value:{selected:a.selected,onDayClick:function(e,n,t){var i,r,o;null===(i=a.onDayClick)||void 0===i||i.call(a,e,n,t),!n.selected||a.required?null===(o=a.onSelect)||void 0===o||o.call(a,e,e,n,t):null===(r=a.onSelect)||void 0===r||r.call(a,void 0,e,n,t)}},children:e.children})}function vme(){var e=a.useContext(hme);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function fme(e,a){var n=[e.classNames.day];return Object.keys(a).forEach((function(a){var t=e.modifiersClassNames[a];if(t)n.push(t);else if(function(e){return Object.values(Vde).includes(e)}(a)){var i=e.classNames["day_".concat(a)];i&&n.push(i)}})),n}function yme(e,t,i){var r,o,s,l=yde(),u=mme(),c=function(e,a){return lme(e,ome(),a)}(e,t),d=function(e,a){var n=yde(),t=vme(),i=Gde(),r=qde(),o=mme(),s=o.focusDayAfter,l=o.focusDayBefore,u=o.focusWeekAfter,c=o.focusWeekBefore,d=o.blur,m=o.focus,h=o.focusMonthBefore,p=o.focusMonthAfter,g=o.focusYearBefore,v=o.focusYearAfter,f=o.focusStartOfWeek,y=o.focusEndOfWeek;return{onClick:function(o){var s,l,u,c;mde(n)?null===(s=t.onDayClick)||void 0===s||s.call(t,e,a,o):cde(n)?null===(l=i.onDayClick)||void 0===l||l.call(i,e,a,o):dde(n)?null===(u=r.onDayClick)||void 0===u||u.call(r,e,a,o):null===(c=n.onDayClick)||void 0===c||c.call(n,e,a,o)},onFocus:function(t){var i;m(e),null===(i=n.onDayFocus)||void 0===i||i.call(n,e,a,t)},onBlur:function(t){var i;d(),null===(i=n.onDayBlur)||void 0===i||i.call(n,e,a,t)},onKeyDown:function(t){var i;switch(t.key){case"ArrowLeft":t.preventDefault(),t.stopPropagation(),"rtl"===n.dir?s():l();break;case"ArrowRight":t.preventDefault(),t.stopPropagation(),"rtl"===n.dir?l():s();break;case"ArrowDown":t.preventDefault(),t.stopPropagation(),u();break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),c();break;case"PageUp":t.preventDefault(),t.stopPropagation(),t.shiftKey?g():h();break;case"PageDown":t.preventDefault(),t.stopPropagation(),t.shiftKey?v():p();break;case"Home":t.preventDefault(),t.stopPropagation(),f();break;case"End":t.preventDefault(),t.stopPropagation(),y()}null===(i=n.onDayKeyDown)||void 0===i||i.call(n,e,a,t)},onKeyUp:function(t){var i;null===(i=n.onDayKeyUp)||void 0===i||i.call(n,e,a,t)},onMouseEnter:function(t){var i;null===(i=n.onDayMouseEnter)||void 0===i||i.call(n,e,a,t)},onMouseLeave:function(t){var i;null===(i=n.onDayMouseLeave)||void 0===i||i.call(n,e,a,t)},onPointerEnter:function(t){var i;null===(i=n.onDayPointerEnter)||void 0===i||i.call(n,e,a,t)},onPointerLeave:function(t){var i;null===(i=n.onDayPointerLeave)||void 0===i||i.call(n,e,a,t)},onTouchCancel:function(t){var i;null===(i=n.onDayTouchCancel)||void 0===i||i.call(n,e,a,t)},onTouchEnd:function(t){var i;null===(i=n.onDayTouchEnd)||void 0===i||i.call(n,e,a,t)},onTouchMove:function(t){var i;null===(i=n.onDayTouchMove)||void 0===i||i.call(n,e,a,t)},onTouchStart:function(t){var i;null===(i=n.onDayTouchStart)||void 0===i||i.call(n,e,a,t)}}}(e,c),m=function(){var e=yde(),a=vme(),n=Gde(),t=qde();return mde(e)?a.selected:cde(e)?n.selected:dde(e)?t.selected:void 0}(),h=Boolean(l.onDayClick||"default"!==l.mode);a.useEffect((function(){var a;c.outside||u.focusedDay&&h&&Que(u.focusedDay,e)&&(null===(a=i.current)||void 0===a||a.focus())}),[u.focusedDay,e,i,h,c.outside]);var p=fme(l,c).join(" "),g=function(e,a){var n=lde({},e.styles.day);return Object.keys(a).forEach((function(a){var t;n=lde(lde({},n),null===(t=e.modifiersStyles)||void 0===t?void 0:t[a])})),n}(l,c),v=Boolean(c.outside&&!l.showOutsideDays||c.hidden),f=null!==(s=null===(o=l.components)||void 0===o?void 0:o.DayContent)&&void 0!==s?s:Kde,y={style:g,className:p,children:n.jsx(f,{date:e,displayMonth:t,activeModifiers:c}),role:"gridcell"},k=u.focusTarget&&Que(u.focusTarget,e)&&!c.outside,b=u.focusedDay&&Que(u.focusedDay,e),S=lde(lde(lde({},y),((r={disabled:c.disabled,role:"gridcell"})["aria-selected"]=c.selected,r.tabIndex=b||k?0:-1,r)),d);return{isButton:h,isHidden:v,activeModifiers:c,selectedDays:m,buttonProps:S,divProps:y}}function kme(e){var t=a.useRef(null),i=yme(e.date,e.displayMonth,t);return i.isHidden?n.jsx("div",{role:"gridcell"}):i.isButton?n.jsx(jde,lde({name:"day",ref:t},i.buttonProps)):n.jsx("div",lde({},i.divProps))}function bme(e){var a=e.number,t=e.dates,i=yde(),r=i.onWeekNumberClick,o=i.styles,s=i.classNames,l=i.locale,u=i.labels.labelWeekNumber,c=(0,i.formatters.formatWeekNumber)(Number(a),{locale:l});if(!r)return n.jsx("span",{className:s.weeknumber,style:o.weeknumber,children:c});var d=u(Number(a),{locale:l});return n.jsx(jde,{name:"week-number","aria-label":d,className:s.weeknumber,style:o.weeknumber,onClick:function(e){r(a,t,e)},children:c})}function Sme(e){var a,t,i,r=yde(),o=r.styles,s=r.classNames,l=r.components,u=null!==(a=null==l?void 0:l.Day)&&void 0!==a?a:kme,c=null!==(t=null==l?void 0:l.WeekNumber)&&void 0!==t?t:bme;return r.showWeekNumber&&(i=n.jsx("td",{className:s.cell,style:o.cell,children:n.jsx(c,{number:e.weekNumber,dates:e.dates})})),n.jsxs("tr",{className:s.row,style:o.row,children:[i,e.dates.map((function(a){return n.jsx("td",{className:s.cell,style:o.cell,role:"presentation",children:n.jsx(u,{displayMonth:e.displayMonth,date:a})},Xce(a))}))]})}function Ame(e,a,n){for(var t=(null==n?void 0:n.ISOWeek)?rce(a):ice(a,n),i=(null==n?void 0:n.ISOWeek)?Jue(e):Fue(e,n),r=Zue(t,i),o=[],s=0;s<=r;s++)o.push(Oue(i,s));var l=o.reduce((function(e,a){var t=(null==n?void 0:n.ISOWeek)?function(e){Kue(1,arguments);var a=Hue(e),n=Jue(a).getTime()-Uue(a).getTime();return Math.round(n/6048e5)+1}(a):function(e,a){Kue(1,arguments);var n=Hue(e),t=Fue(n,a).getTime()-ede(n,a).getTime();return Math.round(t/6048e5)+1}(a,n),i=e.find((function(e){return e.weekNumber===t}));return i?(i.dates.push(a),e):(e.push({weekNumber:t,dates:[a]}),e)}),[]);return l}function wme(e){var a,t,i,r=yde(),o=r.locale,s=r.classNames,l=r.styles,u=r.hideHead,c=r.components,d=r.weekStartsOn,m=r.firstWeekContainsDate,h=r.ISOWeek,p=function(e,a){var n=Ame(nce(e),ace(e),a);if(null==a?void 0:a.useFixedWeeks){var t=ade(e,a);if(t<6){var i=n[n.length-1],r=i.dates[i.dates.length-1],o=$ue(r,6-t),s=Ame($ue(r,1),o,a);n.push.apply(n,s)}}return n}(e.displayMonth,{useFixedWeeks:Boolean(r.fixedWeeks),ISOWeek:h,locale:o,weekStartsOn:d,firstWeekContainsDate:m}),g=null!==(a=null==c?void 0:c.Head)&&void 0!==a?a:Dde,v=null!==(t=null==c?void 0:c.Row)&&void 0!==t?t:Sme,f=null!==(i=null==c?void 0:c.Footer)&&void 0!==i?i:Rde;return n.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!u&&n.jsx(g,{}),n.jsx("tbody",{className:s.tbody,style:l.tbody,children:p.map((function(a){return n.jsx(v,{displayMonth:e.displayMonth,dates:a.dates,weekNumber:a.weekNumber},a.weekNumber)}))}),n.jsx(f,{displayMonth:e.displayMonth})]})}var Cme="undefined"!=typeof window&&window.document&&window.document.createElement?a.useLayoutEffect:a.useEffect,Mme=!1,Tme=0;function Nme(){return"react-day-picker-".concat(++Tme)}function xme(e){var t,i,r=yde(),o=r.dir,s=r.classNames,l=r.styles,u=r.components,c=Nde().displayMonths,d=function(e){var n,t=null!=e?e:Mme?Nme():null,i=a.useState(t),r=i[0],o=i[1];return Cme((function(){null===r&&o(Nme())}),[]),a.useEffect((function(){!1===Mme&&(Mme=!0)}),[]),null!==(n=null!=e?e:r)&&void 0!==n?n:void 0}(r.id?"".concat(r.id,"-").concat(e.displayIndex):void 0),m=r.id?"".concat(r.id,"-grid-").concat(e.displayIndex):void 0,h=[s.month],p=l.month,g=0===e.displayIndex,v=e.displayIndex===c.length-1,f=!g&&!v;"rtl"===o&&(v=(t=[g,v])[0],g=t[1]),g&&(h.push(s.caption_start),p=lde(lde({},p),l.caption_start)),v&&(h.push(s.caption_end),p=lde(lde({},p),l.caption_end)),f&&(h.push(s.caption_between),p=lde(lde({},p),l.caption_between));var y=null!==(i=null==u?void 0:u.Caption)&&void 0!==i?i:zde;return n.jsxs("div",{className:h.join(" "),style:p,children:[n.jsx(y,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),n.jsx(wme,{id:m,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function Eme(e){var a=yde();return n.jsx("div",{className:a.classNames.months,style:a.styles.months,children:e.children})}function Pme(e){var t,i,r=e.initialProps,o=yde(),s=mme(),l=Nde(),u=a.useState(!1),c=u[0],d=u[1];a.useEffect((function(){o.initialFocus&&s.focusTarget&&(c||(s.focus(s.focusTarget),d(!0)))}),[o.initialFocus,c,s.focus,s.focusTarget,s]);var m=[o.classNames.root,o.className];o.numberOfMonths>1&&m.push(o.classNames.multiple_months),o.showWeekNumber&&m.push(o.classNames.with_weeknumber);var h=lde(lde({},o.styles.root),o.style),p=Object.keys(r).filter((function(e){return e.startsWith("data-")})).reduce((function(e,a){var n;return lde(lde({},e),((n={})[a]=r[a],n))}),{}),g=null!==(i=null===(t=r.components)||void 0===t?void 0:t.Months)&&void 0!==i?i:Eme;return n.jsx("div",lde({className:m.join(" "),style:h,dir:o.dir,id:o.id,nonce:r.nonce,title:r.title,lang:r.lang},p,{children:n.jsx(g,{children:l.displayMonths.map((function(e,a){return n.jsx(xme,{displayIndex:a,displayMonth:e},a)}))})}))}function jme(e){var a=e.children,t=function(e,a){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);i<t.length;i++)a.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(n[t[i]]=e[t[i]])}return n}(e,["children"]);return n.jsx(fde,{initialProps:t,children:n.jsx(Tde,{children:n.jsx(pme,{initialProps:t,children:n.jsx(Ode,{initialProps:t,children:n.jsx(Ude,{initialProps:t,children:n.jsx(rme,{children:n.jsx(dme,{children:a})})})})})})})}function Lme(e){return n.jsx(jme,lde({},e,{children:n.jsx(Pme,{initialProps:e})}))}function Bme({className:e,classNames:a,showOutsideDays:t=!0,...i}){return n.jsx(Lme,{showOutsideDays:t,className:im("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:im(PY({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground! rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:im("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent! [&:has([aria-selected].day-outside)]:bg-accent/50! [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===i.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:im(PY({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary! text-primary-foreground! hover:bg-primary! hover:text-primary-foreground! focus:bg-primary! focus:text-primary-foreground!",day_today:"bg-accent! text-accent-foreground!",day_outside:"day-outside text-muted-foreground! aria-selected:bg-accent/50! aria-selected:text-muted-foreground!",day_disabled:"text-muted-foreground! opacity-50",day_range_middle:"aria-selected:bg-accent! aria-selected:text-accent-foreground!",day_hidden:"invisible",...a},components:{IconLeft:()=>n.jsx(kc,{className:"h-4 w-4"}),IconRight:()=>n.jsx(bc,{className:"h-4 w-4"})},...i})}Bme.displayName="Calendar";const zme=({data:e,placeholder:a,searchPlaceholder:t,noResultsMessage:i,value:o,setValue:s})=>{const[l,u]=r.useState(!1);return n.jsxs(h9,{open:l,onOpenChange:u,modal:!0,children:[n.jsx(p9,{asChild:!0,children:n.jsxs(jY,{variant:"outline",role:"combobox","aria-expanded":l,className:"w-full max-w-[200px] justify-between bg-background",children:[o?e.find((e=>e.value===o))?.label:a,n.jsx(Ac,{className:"opacity-50"})]})}),n.jsx(g9,{className:"w-[200px] p-0",children:n.jsxs(Mse,{children:[n.jsx(Tse,{placeholder:t,className:"h-9"}),n.jsxs(Nse,{children:[n.jsx(xse,{children:i}),n.jsx(Ese,{children:e.map((e=>n.jsxs(Pse,{value:e.value,onSelect:e=>{s(e===o?"":e),u(!1)},children:[e.label,n.jsx(fc,{className:im("ml-auto",o===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},Rme=({setScheduleTime:e,setTimezone:a,timezone:t,scheduleTime:i,setIsDirty:o})=>{const[s,l]=r.useState(i&&i<(new Date).toISOString()?"Please select a time in the future":null),[u,c]=r.useState(i&&"now"!==i?dae(new Date(i),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),m=a=>{const n=Cee(new Date,15);new Date(a.toLocaleString("en-US",{timeZone:t}))<new Date(n.toLocaleString("en-US",{timeZone:t}))?l("Please select a time at least 15 minutes in the future"):(l(null),e(a.toISOString()),o(!0))};return n.jsx("div",{className:"w-full @container/schedule-time",children:n.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[n.jsxs("div",{className:"flex gap-2 w-full @xl/schedule-time:flex-row flex-col items-center justify-center",children:[n.jsxs(h9,{children:[n.jsx(p9,{asChild:!0,children:n.jsxs(jY,{variant:"outline",className:im("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!i&&"text-muted-foreground"),children:[n.jsx(vc,{className:"mr-2 h-4 w-4"}),i?"now"===i?"Send immediately":dae(new Date(i),"PPP"):n.jsx("span",{children:"Pick a date"})]})}),n.jsx(g9,{className:"w-auto p-0 z-[60] pointer-events-auto",children:n.jsx(Bme,{mode:"single",selected:i?new Date(i):void 0,onSelect:e=>{if(!e)return;const[a,n]=u.split(":").map(Number);e.setHours(a,n),m(e)},disabled:e=>{const a=new Date;return a.setHours(0,0,0,0),e<a},initialFocus:!0})})]}),n.jsx("input",{type:"time",value:u,onChange:e=>{if(c(e.target.value),i&&e.target.value){const[a,n]=e.target.value.split(":").map(Number),t=new Date(i);t.setHours(a,n),m(t)}},className:im("flex h-9 w-full sm:w-[150px] rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s&&"border-red-500")}),n.jsx(zme,{data:d,placeholder:"Select timezone...",searchPlaceholder:"Search timezone...",noResultsMessage:"No timezone found",value:t,setValue:e=>{const n=new Date(i||(new Date).toISOString()),t=Cee(new Date,15);n<new Date(t.toLocaleString("en-US",{timeZone:e}))?l("Please select a time at least 15 minutes in the future"):(l(null),a(e),o(!0))}})]}),s&&n.jsxs("p",{className:"text-destructive text-sm mt-2 flex items-center",children:[n.jsx("span",{className:"mr-2",children:"⚠️"}),s]})]})})},_me=({title:e="Edit Schedule Time",autoSave:t=!1})=>{const i=wY(),{updateAutomation:r}=Je(i?.id||""),{toast:o}=Ie(),[s,l]=a.useState(null),[u,c]=a.useState(i?.triggerMetadata?.triggerType===Ze.ONE_TIME?i?.triggerMetadata?.scheduledAt:null),[d,m]=a.useState(i?.triggerMetadata?.triggerType===Ze.ONE_TIME&&i?.triggerMetadata?.timezone||"America/New_York"),[h,p]=a.useState(!1),g=a.useCallback((()=>{if("sendNow"===s)r({trigger:{triggerType:Ze.ONE_TIME,scheduledAt:"now"}}),o({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),p(!1);else{if(!u||!d)return;r({trigger:{triggerType:Ze.ONE_TIME,scheduledAt:u,timezone:d}}),o({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(u).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),p(!1)}}),[s,u,d,r,o]);if(a.useEffect((()=>{}),[i]),a.useEffect((()=>{t&&h&&(g(),p(!1))}),[t,h,g]),!i)return null;const v=i.status===Xe.DRAFT,f=!(h&&v);return n.jsx(Bue,{title:e,headerActions:t?void 0:n.jsxs("div",{className:LG(f?"cursor-not-allowed opacity-50":"cursor-pointer","gap-2 flex items-center"),children:[n.jsx(jY,{onClick:g,disabled:f,children:"Save"}),!v&&n.jsx(Mae,{title:"You can only edit the schedule time if the automation is in draft mode"})]}),children:n.jsx("div",{className:"@container flex-1 mx-4",children:n.jsxs("div",{className:"flex @[1000px]:flex-row flex-col gap-8 items-center",children:[n.jsxs("div",{className:"flex-1 w-full",children:[n.jsxs("div",{className:"grid grid-cols-1 @[480px]:grid-cols-2 gap-4",children:[n.jsx(zY,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:n.jsx(RY.SendButton,{className:"text-primary"}),onClick:()=>{v&&(l("sendNow"),c("now"),m("America/New_York"),p(!0))}}),n.jsx(zY,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:n.jsx(RY.ScheduleButton,{className:"text-primary"}),onClick:()=>{v&&l("schedule")}})]}),n.jsx(aV,{children:"schedule"===s&&n.jsx(EY,{className:"overflow-hidden mt-8",children:n.jsx("div",{className:"bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center",children:n.jsx(Rme,{setScheduleTime:c,setTimezone:m,timezone:d,scheduleTime:u,setIsDirty:p})})})})]}),u&&n.jsx(H$.div,{initial:{opacity:0,y:10,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.6,ease:[.23,1,.32,1],delay:.1},className:"@[1000px]:w-80 max-w-md w-full shrink-0 h-fit p-4 bg-blue-50 rounded-xl border border-blue-100 backdrop-blur-sm",children:n.jsxs(n.Fragment,"now"===u?{children:[n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:.3,duration:.4},className:"text-sm font-medium text-gray-700",children:"Ready to send immediately"}),n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:"Once you mark this automation as active, we'll send it 5 minutes from that moment"})]}:{children:[n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:.3,duration:.4},className:"text-sm font-medium text-gray-700",children:"Currently scheduled for:"}),n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(u).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:d||void 0})})]})})]})})})},Dme=()=>n.jsx("div",{children:n.jsx(_me,{title:"Set Schedule Time",autoSave:!0})});var Kme=(e=>(e.DAYS="days",e))(Kme||{});const Hme={[SY.EQUALS]:"Equals",[SY.NOT_EQUALS]:"Not Equals",[SY.GREATER_THAN]:"Greater Than",[SY.LESS_THAN]:"Less Than",[SY.EXISTS]:"Exists",[SY.EQUALS_MONTH_DAY]:"Month and Day Matches",[SY.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[SY.BETWEEN_MONTH_DAY]:"Between Month Day",[SY.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[SY.ARRAY_CONTAINS]:"Is One Of"},Ome={email:"Email Address",phone:"Phone Number",firstName:"First Name",lastName:"Last Name"},Ime=({options:e,value:a,onChange:t,placeholder:i,className:o="",disableInput:s=!1})=>{const[l,u]=r.useState(!1);return n.jsxs(h9,{modal:!0,open:l,onOpenChange:u,children:[n.jsx(p9,{asChild:!0,children:n.jsxs(jY,{"aria-expanded":l,className:im("w-full overflow-hidden justify-between",o),variant:"outline",children:[a?e.find((e=>e.value===a))?.label:i,n.jsx(Ac,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsx(g9,{className:im("w-full min-w-[120px] max-w-[600px] p-0",o),children:n.jsxs(Mse,{children:[!s&&n.jsx(Tse,{placeholder:`${i}...`}),n.jsxs(Nse,{children:[n.jsxs(xse,{children:["No ",i.toLowerCase()," found."]}),n.jsx(Ese,{children:e.map((e=>n.jsxs(Pse,{value:e.value,onSelect:e=>{t(e===a?"":e),u(!1)},children:[n.jsx(fc,{className:im("mr-2 h-4 w-4",a===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})},Gme=r.forwardRef((({className:e,...a},t)=>n.jsx(iue,{ref:t,className:im("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:n.jsx(rue,{className:im("flex items-center justify-center text-current"),children:n.jsx(fc,{className:"h-4 w-4"})})})));function Vme(e,a){if("function"==typeof e)return e(a);null!=e&&(e.current=a)}function Fme(...e){return a=>{let n=!1;const t=e.map((e=>{const t=Vme(e,a);return n||"function"!=typeof t||(n=!0),t}));if(n)return()=>{for(let a=0;a<t.length;a++){const n=t[a];"function"==typeof n?n():Vme(e[a],null)}}}}function Jme(...e){return r.useCallback(Fme(...e),e)}function Ume(e){const a=Wme(e),t=r.forwardRef(((e,t)=>{const{children:i,...o}=e,s=r.Children.toArray(i),l=s.find(Zme);if(l){const e=l.props.children,i=s.map((a=>a===l?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(a,{...o,ref:t,children:r.isValidElement(e)?r.cloneElement(e,void 0,i):null})}return n.jsx(a,{...o,ref:t,children:i})}));return t.displayName=`${e}.Slot`,t}function Wme(e){const a=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{const a=r(...e);return i(...e),a}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?Fme(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));return a.displayName=`${e}.SlotClone`,a}Gme.displayName=iue.displayName;var qme=Symbol("radix.slottable");function Zme(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===qme}var $me=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,a)=>{const t=Ume(`Primitive.${a}`),i=r.forwardRef(((e,i)=>{const{asChild:r,...o}=e,s=r?t:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(s,{...o,ref:i})}));return i.displayName=`Primitive.${a}`,{...e,[a]:i}}),{}),Yme=globalThis?.document?r.useLayoutEffect:()=>{};var Qme=e=>{const{present:a,children:n}=e,t=function(e){const[a,n]=r.useState(),t=r.useRef(null),i=r.useRef(e),o=r.useRef("none"),s=e?"mounted":"unmounted",[l,u]=function(e,a){return r.useReducer(((e,n)=>a[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect((()=>{const e=Xme(t.current);o.current="mounted"===l?e:"none"}),[l]),Yme((()=>{const a=t.current,n=i.current;if(n!==e){const t=o.current,r=Xme(a);if(e)u("MOUNT");else if("none"===r||"none"===a?.display)u("UNMOUNT");else{u(n&&t!==r?"ANIMATION_OUT":"UNMOUNT")}i.current=e}}),[e,u]),Yme((()=>{if(a){let e;const n=a.ownerDocument.defaultView??window,r=r=>{const o=Xme(t.current).includes(r.animationName);if(r.target===a&&o&&(u("ANIMATION_END"),!i.current)){const t=a.style.animationFillMode;a.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===a.style.animationFillMode&&(a.style.animationFillMode=t)}))}},s=e=>{e.target===a&&(o.current=Xme(t.current))};return a.addEventListener("animationstart",s),a.addEventListener("animationcancel",r),a.addEventListener("animationend",r),()=>{n.clearTimeout(e),a.removeEventListener("animationstart",s),a.removeEventListener("animationcancel",r),a.removeEventListener("animationend",r)}}u("ANIMATION_END")}),[a,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:r.useCallback((e=>{t.current=e?getComputedStyle(e):null,n(e)}),[])}}(a),i="function"==typeof n?n({present:t.isPresent}):r.Children.only(n),o=Jme(t.ref,function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(i));return"function"==typeof n||t.isPresent?r.cloneElement(i,{ref:o}):null};function Xme(e){return e?.animationName||"none"}function ehe(...e){const a=e[0];if(1===e.length)return a;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const t=n.reduce(((a,{useScope:n,scopeName:t})=>({...a,...n(e)[`__scope${t}`]})),{});return r.useMemo((()=>({[`__scope${a.scopeName}`]:t})),[t])}};return n.scopeName=a.scopeName,n}function ahe(e){const a=r.useRef(e);return r.useEffect((()=>{a.current=e})),r.useMemo((()=>(...e)=>a.current?.(...e)),[])}Qme.displayName="Presence";var nhe=r.createContext(void 0);function the(e,a,{checkForDefaultPrevented:n=!0}={}){return function(t){if(e?.(t),!1===n||!t.defaultPrevented)return a?.(t)}}var ihe="ScrollArea",[rhe,ohe]=function(e,a=[]){let t=[];const i=()=>{const a=t.map((e=>r.createContext(e)));return function(n){const t=n?.[e]||a;return r.useMemo((()=>({[`__scope${e}`]:{...n,[e]:t}})),[n,t])}};return i.scopeName=e,[function(a,i){const o=r.createContext(i),s=t.length;t=[...t,i];const l=a=>{const{scope:t,children:i,...l}=a,u=t?.[e]?.[s]||o,c=r.useMemo((()=>l),Object.values(l));return n.jsx(u.Provider,{value:c,children:i})};return l.displayName=a+"Provider",[l,function(n,t){const l=r.useContext(t?.[e]?.[s]||o);if(l)return l;if(void 0!==i)return i;throw new Error(`\`${n}\` must be used within \`${a}\``)}]},ehe(i,...a)]}(ihe),[she,lhe]=rhe(ihe),uhe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,type:i="hover",dir:o,scrollHideDelay:s=600,...l}=e,[u,c]=r.useState(null),[d,m]=r.useState(null),[h,p]=r.useState(null),[g,v]=r.useState(null),[f,y]=r.useState(null),[k,b]=r.useState(0),[S,A]=r.useState(0),[w,C]=r.useState(!1),[M,T]=r.useState(!1),N=Jme(a,(e=>c(e))),x=function(e){const a=r.useContext(nhe);return e||a||"ltr"}(o);return n.jsx(she,{scope:t,type:i,dir:x,scrollHideDelay:s,scrollArea:u,viewport:d,onViewportChange:m,content:h,onContentChange:p,scrollbarX:g,onScrollbarXChange:v,scrollbarXEnabled:w,onScrollbarXEnabledChange:C,scrollbarY:f,onScrollbarYChange:y,scrollbarYEnabled:M,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:A,children:n.jsx($me.div,{dir:x,...l,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})})}));uhe.displayName=ihe;var che="ScrollAreaViewport",dhe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,children:i,nonce:o,...s}=e,l=lhe(che,t),u=Jme(a,r.useRef(null),l.onViewportChange);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),n.jsx($me.div,{"data-radix-scroll-area-viewport":"",...s,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:n.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})}));dhe.displayName=che;var mhe="ScrollAreaScrollbar",hhe=r.forwardRef(((e,a)=>{const{forceMount:t,...i}=e,o=lhe(mhe,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:l}=o,u="horizontal"===e.orientation;return r.useEffect((()=>(u?s(!0):l(!0),()=>{u?s(!1):l(!1)})),[u,s,l]),"hover"===o.type?n.jsx(phe,{...i,ref:a,forceMount:t}):"scroll"===o.type?n.jsx(ghe,{...i,ref:a,forceMount:t}):"auto"===o.type?n.jsx(vhe,{...i,ref:a,forceMount:t}):"always"===o.type?n.jsx(fhe,{...i,ref:a}):null}));hhe.displayName=mhe;var phe=r.forwardRef(((e,a)=>{const{forceMount:t,...i}=e,o=lhe(mhe,e.__scopeScrollArea),[s,l]=r.useState(!1);return r.useEffect((()=>{const e=o.scrollArea;let a=0;if(e){const n=()=>{window.clearTimeout(a),l(!0)},t=()=>{a=window.setTimeout((()=>l(!1)),o.scrollHideDelay)};return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",t),()=>{window.clearTimeout(a),e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",t)}}}),[o.scrollArea,o.scrollHideDelay]),n.jsx(Qme,{present:t||s,children:n.jsx(vhe,{"data-state":s?"visible":"hidden",...i,ref:a})})})),ghe=r.forwardRef(((e,a)=>{const{forceMount:t,...i}=e,o=lhe(mhe,e.__scopeScrollArea),s="horizontal"===e.orientation,l=_he((()=>c("SCROLL_END")),100),[u,c]=(d={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},r.useReducer(((e,a)=>d[e][a]??e),"hidden"));var d;return r.useEffect((()=>{if("idle"===u){const e=window.setTimeout((()=>c("HIDE")),o.scrollHideDelay);return()=>window.clearTimeout(e)}}),[u,o.scrollHideDelay,c]),r.useEffect((()=>{const e=o.viewport,a=s?"scrollLeft":"scrollTop";if(e){let n=e[a];const t=()=>{const t=e[a];n!==t&&(c("SCROLL"),l()),n=t};return e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}}),[o.viewport,s,c,l]),n.jsx(Qme,{present:t||"hidden"!==u,children:n.jsx(fhe,{"data-state":"hidden"===u?"hidden":"visible",...i,ref:a,onPointerEnter:the(e.onPointerEnter,(()=>c("POINTER_ENTER"))),onPointerLeave:the(e.onPointerLeave,(()=>c("POINTER_LEAVE")))})})})),vhe=r.forwardRef(((e,a)=>{const t=lhe(mhe,e.__scopeScrollArea),{forceMount:i,...o}=e,[s,l]=r.useState(!1),u="horizontal"===e.orientation,c=_he((()=>{if(t.viewport){l(u?t.viewport.offsetWidth<t.viewport.scrollWidth:t.viewport.offsetHeight<t.viewport.scrollHeight)}}),10);return Dhe(t.viewport,c),Dhe(t.content,c),n.jsx(Qme,{present:i||s,children:n.jsx(fhe,{"data-state":s?"visible":"hidden",...o,ref:a})})})),fhe=r.forwardRef(((e,a)=>{const{orientation:t="vertical",...i}=e,o=lhe(mhe,e.__scopeScrollArea),s=r.useRef(null),l=r.useRef(0),[u,c]=r.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Phe(u.viewport,u.content),m={...i,sizes:u,onSizesChange:c,hasThumb:Boolean(d>0&&d<1),onThumbChange:e=>s.current=e,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:e=>l.current=e};function h(e,a){return function(e,a,n,t="ltr"){const i=jhe(n),r=i/2,o=a||r,s=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-(i-o),u=n.content-n.viewport,c="ltr"===t?[0,u]:[-1*u,0];return Bhe([s,l],c)(e)}(e,l.current,u,a)}return"horizontal"===t?n.jsx(yhe,{...m,ref:a,onThumbPositionChange:()=>{if(o.viewport&&s.current){const e=Lhe(o.viewport.scrollLeft,u,o.dir);s.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=h(e,o.dir))}}):"vertical"===t?n.jsx(khe,{...m,ref:a,onThumbPositionChange:()=>{if(o.viewport&&s.current){const e=Lhe(o.viewport.scrollTop,u);s.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=h(e))}}):null})),yhe=r.forwardRef(((e,a)=>{const{sizes:t,onSizesChange:i,...o}=e,s=lhe(mhe,e.__scopeScrollArea),[l,u]=r.useState(),c=r.useRef(null),d=Jme(a,c,s.onScrollbarXChange);return r.useEffect((()=>{c.current&&u(getComputedStyle(c.current))}),[c]),n.jsx(Ahe,{"data-orientation":"horizontal",...o,ref:d,sizes:t,style:{bottom:0,left:"rtl"===s.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===s.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":jhe(t)+"px",...e.style},onThumbPointerDown:a=>e.onThumbPointerDown(a.x),onDragScroll:a=>e.onDragScroll(a.x),onWheelScroll:(a,n)=>{if(s.viewport){const t=s.viewport.scrollLeft+a.deltaX;e.onWheelScroll(t),zhe(t,n)&&a.preventDefault()}},onResize:()=>{c.current&&s.viewport&&l&&i({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Ehe(l.paddingLeft),paddingEnd:Ehe(l.paddingRight)}})}})})),khe=r.forwardRef(((e,a)=>{const{sizes:t,onSizesChange:i,...o}=e,s=lhe(mhe,e.__scopeScrollArea),[l,u]=r.useState(),c=r.useRef(null),d=Jme(a,c,s.onScrollbarYChange);return r.useEffect((()=>{c.current&&u(getComputedStyle(c.current))}),[c]),n.jsx(Ahe,{"data-orientation":"vertical",...o,ref:d,sizes:t,style:{top:0,right:"ltr"===s.dir?0:void 0,left:"rtl"===s.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":jhe(t)+"px",...e.style},onThumbPointerDown:a=>e.onThumbPointerDown(a.y),onDragScroll:a=>e.onDragScroll(a.y),onWheelScroll:(a,n)=>{if(s.viewport){const t=s.viewport.scrollTop+a.deltaY;e.onWheelScroll(t),zhe(t,n)&&a.preventDefault()}},onResize:()=>{c.current&&s.viewport&&l&&i({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Ehe(l.paddingTop),paddingEnd:Ehe(l.paddingBottom)}})}})})),[bhe,She]=rhe(mhe),Ahe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,sizes:i,hasThumb:o,onThumbChange:s,onThumbPointerUp:l,onThumbPointerDown:u,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:m,onResize:h,...p}=e,g=lhe(mhe,t),[v,f]=r.useState(null),y=Jme(a,(e=>f(e))),k=r.useRef(null),b=r.useRef(""),S=g.viewport,A=i.content-i.viewport,w=ahe(m),C=ahe(c),M=_he(h,10);function T(e){if(k.current){d({x:e.clientX-k.current.left,y:e.clientY-k.current.top})}}return r.useEffect((()=>{const e=e=>{const a=e.target,n=v?.contains(a);n&&w(e,A)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})}),[S,v,A,w]),r.useEffect(C,[i,C]),Dhe(v,M),Dhe(g.content,M),n.jsx(bhe,{scope:t,scrollbar:v,hasThumb:o,onThumbChange:ahe(s),onThumbPointerUp:ahe(l),onThumbPositionChange:C,onThumbPointerDown:ahe(u),children:n.jsx($me.div,{...p,ref:y,style:{position:"absolute",...p.style},onPointerDown:the(e.onPointerDown,(e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),k.current=v.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),T(e)}})),onPointerMove:the(e.onPointerMove,T),onPointerUp:the(e.onPointerUp,(e=>{const a=e.target;a.hasPointerCapture(e.pointerId)&&a.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,g.viewport&&(g.viewport.style.scrollBehavior=""),k.current=null}))})})})),whe="ScrollAreaThumb",Che=r.forwardRef(((e,a)=>{const{forceMount:t,...i}=e,r=She(whe,e.__scopeScrollArea);return n.jsx(Qme,{present:t||r.hasThumb,children:n.jsx(Mhe,{ref:a,...i})})})),Mhe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,style:i,...o}=e,s=lhe(whe,t),l=She(whe,t),{onThumbPositionChange:u}=l,c=Jme(a,(e=>l.onThumbChange(e))),d=r.useRef(void 0),m=_he((()=>{d.current&&(d.current(),d.current=void 0)}),100);return r.useEffect((()=>{const e=s.viewport;if(e){const a=()=>{if(m(),!d.current){const a=Rhe(e,u);d.current=a,u()}};return u(),e.addEventListener("scroll",a),()=>e.removeEventListener("scroll",a)}}),[s.viewport,m,u]),n.jsx($me.div,{"data-state":l.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:the(e.onPointerDownCapture,(e=>{const a=e.target.getBoundingClientRect();l.onThumbPointerDown({x:e.clientX-a.left,y:e.clientY-a.top})})),onPointerUp:the(e.onPointerUp,l.onThumbPointerUp)})}));Che.displayName=whe;var The="ScrollAreaCorner",Nhe=r.forwardRef(((e,a)=>{const t=lhe(The,e.__scopeScrollArea),i=Boolean(t.scrollbarX&&t.scrollbarY);return"scroll"!==t.type&&i?n.jsx(xhe,{...e,ref:a}):null}));Nhe.displayName=The;var xhe=r.forwardRef(((e,a)=>{const{__scopeScrollArea:t,...i}=e,o=lhe(The,t),[s,l]=r.useState(0),[u,c]=r.useState(0),d=Boolean(s&&u);return Dhe(o.scrollbarX,(()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),c(e)})),Dhe(o.scrollbarY,(()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),l(e)})),d?n.jsx($me.div,{...i,ref:a,style:{width:s,height:u,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...e.style}}):null}));function Ehe(e){return e?parseInt(e,10):0}function Phe(e,a){const n=e/a;return isNaN(n)?0:n}function jhe(e){const a=Phe(e.viewport,e.content);return Math.max((e.scrollbar.size-(e.scrollbar.paddingStart+e.scrollbar.paddingEnd))*a,18)}function Lhe(e,a,n="ltr"){const t=jhe(a),i=a.content-a.viewport,r=a.scrollbar.size-(a.scrollbar.paddingStart+a.scrollbar.paddingEnd)-t,o=function(e,[a,n]){return Math.min(n,Math.max(a,e))}(e,"ltr"===n?[0,i]:[-1*i,0]);return Bhe([0,i],[0,r])(o)}function Bhe(e,a){return n=>{if(e[0]===e[1]||a[0]===a[1])return a[0];return a[0]+(a[1]-a[0])/(e[1]-e[0])*(n-e[0])}}function zhe(e,a){return e>0&&e<a}var Rhe=(e,a=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},t=0;return function i(){const r={left:e.scrollLeft,top:e.scrollTop};(n.left!==r.left||n.top!==r.top)&&a(),n=r,t=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(t)};function _he(e,a){const n=ahe(e),t=r.useRef(0);return r.useEffect((()=>()=>window.clearTimeout(t.current)),[]),r.useCallback((()=>{window.clearTimeout(t.current),t.current=window.setTimeout(n,a)}),[n,a])}function Dhe(e,a){const n=ahe(a);Yme((()=>{let a=0;if(e){const t=new ResizeObserver((()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(n)}));return t.observe(e),()=>{window.cancelAnimationFrame(a),t.unobserve(e)}}}),[e,n])}var Khe=uhe,Hhe=dhe,Ohe=Nhe;const Ihe=r.forwardRef((({className:e,children:a,...t},i)=>n.jsxs(Khe,{ref:i,className:LG("relative overflow-hidden",e),...t,children:[n.jsx(Hhe,{className:"h-full w-full rounded-[inherit]",children:a}),n.jsx(Ghe,{}),n.jsx(Ohe,{})]})));Ihe.displayName=Khe.displayName;const Ghe=r.forwardRef((({className:e,orientation:a="vertical",...t},i)=>n.jsx(hhe,{ref:i,orientation:a,className:LG("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...t,children:n.jsx(Che,{className:"relative flex-1 rounded-full bg-border"})})));Ghe.displayName=hhe.displayName;var Vhe=r.forwardRef(((e,a)=>{const{children:t,...i}=e,o=r.Children.toArray(t),s=o.find(Uhe);if(s){const e=s.props.children,t=o.map((a=>a===s?r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null:a));return n.jsx(Fhe,{...i,ref:a,children:r.isValidElement(e)?r.cloneElement(e,void 0,t):null})}return n.jsx(Fhe,{...i,ref:a,children:t})}));Vhe.displayName="Slot";var Fhe=r.forwardRef(((e,a)=>{const{children:n,...t}=e;if(r.isValidElement(n)){const e=function(e){let a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),i=function(e,a){const n={...a};for(const t in a){const i=e[t],r=a[t];/^on[A-Z]/.test(t)?i&&r?n[t]=(...e)=>{r(...e),i(...e)}:i&&(n[t]=i):"style"===t?n[t]={...i,...r}:"className"===t&&(n[t]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}(t,n.props);return n.type!==r.Fragment&&(i.ref=a?nO(a,e):e),r.cloneElement(n,i)}return r.Children.count(n)>1?r.Children.only(null):null}));Fhe.displayName="SlotClone";var Jhe=({children:e})=>n.jsx(n.Fragment,{children:e});function Uhe(e){return r.isValidElement(e)&&e.type===Jhe}var Whe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,a)=>{const t=r.forwardRef(((e,t)=>{const{asChild:i,...r}=e,o=i?Vhe:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),n.jsx(o,{...r,ref:t})}));return t.displayName=`Primitive.${a}`,{...e,[a]:t}}),{}),qhe="horizontal",Zhe=["horizontal","vertical"],$he=r.forwardRef(((e,a)=>{const{decorative:t,orientation:i=qhe,...r}=e,o=function(e){return Zhe.includes(e)}(i)?i:qhe;return n.jsx(Whe.div,{"data-orientation":o,...t?{role:"none"}:{"aria-orientation":"vertical"===o?o:void 0,role:"separator"},...r,ref:a})}));$he.displayName="Separator";var Yhe=$he;const Qhe=r.forwardRef((({className:e,orientation:a="horizontal",decorative:t=!0,...i},r)=>n.jsx(Yhe,{ref:r,decorative:t,orientation:a,className:im("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",e),...i})));function Xhe({options:e,onValueChange:a,selectedValues:t,setSelectedValues:i,maxCount:o,placeholder:s="Select options",title:l="Select Items",searchPlaceholder:u="Search items...",emptyMessage:c="No items found",handleSearchInput:d,extraCommandItems:m=[]}){const[h,p]=r.useState(!1),[g,v]=r.useState(""),[f,y]=r.useState(t),k=r.useMemo((()=>g?e.filter((e=>e.label.toLowerCase().includes(g.toLowerCase()))):e),[e,g]),b=r.useCallback((()=>t.map((a=>{const n=e.find((e=>e.value===a));return{value:a,label:n?.label||a}}))),[t,e]),S=e=>{y((a=>a.includes(e)?a.filter((a=>a!==e)):o&&a.length>=o?a:[...a,e]))};r.useEffect((()=>{h&&(y(t),v(""))}),[h,t]);const A=f.length,w=k.filter((e=>f.includes(e.value))).length,C=b(),M=!o||f.length<o;return n.jsxs(BG,{open:h,onOpenChange:p,children:[n.jsx(zG,{asChild:!0,children:n.jsxs(jY,{variant:"outline",className:"w-full justify-between text-left font-normal h-9 p-3",children:[n.jsx("div",{className:"flex flex-nowrap items-center gap-1 max-w-[70%]",children:0===C.length?n.jsx("span",{className:"text-muted-foreground",children:s}):C.length<=2?C.map((e=>n.jsx(UY,{variant:"secondary",className:"text-xs whitespace-nowrap",children:e.label},e.value))):n.jsxs(n.Fragment,{children:[n.jsx(UY,{variant:"secondary",className:"text-xs whitespace-nowrap",children:C[0].label},C[0].value),n.jsxs(UY,{variant:"secondary",className:"text-xs whitespace-nowrap",children:["+",C.length-1," more"]})]})}),n.jsx(RY.DropdownMenuTrigger,{className:"h-4 w-4 opacity-50 ml-2 flex-shrink-0"})]})}),n.jsxs(DG,{className:"max-w-md w-full max-h-[80vh] p-0",children:[n.jsx(KG,{className:"p-6 pb-4",children:n.jsxs(OG,{className:"flex items-center gap-2 text-xl",children:[n.jsx(RY.UsersIcon,{className:"h-5 w-5 text-primary"}),l]})}),n.jsx("div",{className:"px-6 pb-4",children:n.jsxs("div",{className:"relative",children:[n.jsx(RY.SearchIcon,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx(o4,{placeholder:u,value:g,onChange:e=>v(e.target.value),onKeyDown:e=>{"Enter"===e.key&&g.trim()&&d&&(e.preventDefault(),d(g.trim()),v(""))},className:"pl-10 h-11"}),d&&g.trim()&&n.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:n.jsx(jY,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>{d(g.trim()),v("")},children:n.jsx(RY.PlusIcon,{className:"h-3 w-3"})})})]})}),n.jsx("div",{className:"px-6 pb-4",children:n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("span",{className:"text-muted-foreground",children:[A," of ",e.length," selected",o&&` (max ${o})`]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(jY,{variant:"ghost",size:"sm",onClick:()=>{const e=k.filter((e=>!f.includes(e.value))),a=o?e.slice(0,o-f.length):e;y((e=>[...e,...a.map((e=>e.value))]))},disabled:!M||w===k.length,className:"h-8 text-xs",children:"Select All"}),n.jsx(jY,{variant:"ghost",size:"sm",onClick:()=>{const e=new Set(k.map((e=>e.value)));y((a=>a.filter((a=>!e.has(a)))))},disabled:0===w,className:"h-8 text-xs",children:"Clear All"})]})]})}),n.jsx(Qhe,{}),n.jsx(Ihe,{className:"flex-1 max-h-[300px]",children:n.jsx(Mse,{className:"rounded-none border-none",children:n.jsxs(Ese,{children:[m.length>0&&n.jsxs(n.Fragment,{children:[m.map(((e,a)=>n.jsx("div",{className:"px-3 py-2",children:e(p)},`extra-command-${a}`))),n.jsx(Qhe,{className:"my-2"})]}),0===k.length?n.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[n.jsx(RY.SearchIcon,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),n.jsx("p",{children:c}),d&&g.trim()&&n.jsxs(jY,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>{d(g.trim()),v("")},children:[n.jsx(RY.PlusIcon,{className:"h-3 w-3 mr-1"}),'Add "',g,'"']})]}):k.map((e=>{const a=f.includes(e.value),t=!a&&!M;return n.jsxs(Pse,{onSelect:()=>!t&&S(e.value),className:"flex items-center space-x-3 p-3 rounded-lg transition-colors "+(t?"opacity-50 cursor-not-allowed":"hover:bg-muted/50 cursor-pointer"),children:[n.jsx(Gme,{checked:a,disabled:t,onChange:()=>!t&&S(e.value),className:"flex-shrink-0"}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx("div",{className:"font-medium text-sm truncate",children:e.label})}),a&&n.jsx(RY.CheckIcon,{className:"h-4 w-4 text-primary flex-shrink-0"})]},e.value)}))]})})}),n.jsx(Qhe,{}),n.jsx("div",{className:"p-6 pt-4",children:n.jsxs("div",{className:"flex gap-3",children:[n.jsx(jY,{variant:"outline",onClick:()=>{y(t),v(""),p(!1)},className:"flex-1",children:"Cancel"}),n.jsxs(jY,{onClick:()=>{a(f),i(f),p(!1)},className:"flex-1 bg-primary hover:bg-primary/90",children:["Apply (",A,")"]})]})})]})]})}Qhe.displayName=Yhe.displayName;var epe="Switch",[ape,npe]=eX(epe),[tpe,ipe]=ape(epe),rpe=r.forwardRef(((e,a)=>{const{__scopeSwitch:t,name:i,checked:o,defaultChecked:s,required:l,disabled:u,value:c="on",onCheckedChange:d,form:m,...h}=e,[p,g]=r.useState(null),v=tO(a,(e=>g(e))),f=r.useRef(!1),y=!p||(m||!!p.closest("form")),[k=!1,b]=tX({prop:o,defaultProp:s,onChange:d});return n.jsxs(tpe,{scope:t,checked:k,disabled:u,children:[n.jsx(uX.button,{type:"button",role:"switch","aria-checked":k,"aria-required":l,"data-state":upe(k),"data-disabled":u?"":void 0,disabled:u,value:c,...h,ref:v,onClick:XQ(e.onClick,(e=>{b((e=>!e)),y&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())}))}),y&&n.jsx(lpe,{control:p,bubbles:!f.current,name:i,value:c,checked:k,required:l,disabled:u,form:m,style:{transform:"translateX(-100%)"}})]})}));rpe.displayName=epe;var ope="SwitchThumb",spe=r.forwardRef(((e,a)=>{const{__scopeSwitch:t,...i}=e,r=ipe(ope,t);return n.jsx(uX.span,{"data-state":upe(r.checked),"data-disabled":r.disabled?"":void 0,...i,ref:a})}));spe.displayName=ope;var lpe=e=>{const{control:a,checked:t,bubbles:i=!0,...o}=e,s=r.useRef(null),l=Ule(t),u=v1(a);return r.useEffect((()=>{const e=s.current,a=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(a,"checked").set;if(l!==t&&n){const a=new Event("click",{bubbles:i});n.call(e,t),e.dispatchEvent(a)}}),[l,t,i]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...o,tabIndex:-1,ref:s,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function upe(e){return e?"checked":"unchecked"}var cpe=rpe,dpe=spe;const mpe=r.forwardRef((({className:e,...a},t)=>n.jsx(cpe,{className:im("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input/50",e),...a,ref:t,children:n.jsx(dpe,{className:im("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})));mpe.displayName=cpe.displayName;const hpe=({onSelect:e,date:a,placeholder:t="Pick a date",monthDayOnly:i=!1})=>n.jsxs(h9,{modal:!0,children:[n.jsx(p9,{asChild:!0,children:n.jsxs(jY,{variant:"outline",className:im("w-[200px] justify-start text-left font-normal h-9",!a&&"text-muted-foreground"),children:[n.jsx(vc,{className:"mr-2 h-4 w-4"}),a?dae(a,i?"MMMM d":"PPP"):n.jsx("span",{children:t})]})}),n.jsx(g9,{className:"w-auto p-0",align:"start",children:n.jsx(Bme,{mode:"single",selected:a,onSelect:e,initialFocus:!0})})]}),ppe=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===Kme.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),gpe=({fieldType:e,operator:a,value:t,onChange:i,options:o,toast:s,metadata:l})=>{const u=t.length>0&&"object"==typeof t[0]&&"type"in t[0]&&"relative"===t[0].type,c=t.length>0&&"object"==typeof t[0]&&"startDate"in t[0]&&"endDate"in t[0],[d,m]=r.useState((e===kY.Date||e===kY.DateTime)&&t.length>0&&t[0]instanceof Date?t[0]:void 0),[h,p]=r.useState(u),[g,v]=r.useState(u?t[0]:{type:"relative",value:0,unit:Kme.DAYS,direction:"before"}),[f,y]=r.useState(c?t[0]:void 0),[k,b]=r.useState(!1);if(r.useEffect((()=>{a!==SY.EQUALS_MONTH_DAY&&a!==SY.EQUALS_MONTH_DAY_YEAR&&h&&(p(!1),i(d?[d]:[]))}),[a,h,d,i]),r.useEffect((()=>{if(c&&f?.startDate){b("object"==typeof f.startDate&&"type"in f.startDate)}}),[c,f]),e===kY.String||e===kY.ReachResource||e===kY.Array)return a===SY.EXISTS?null:n.jsx(Xhe,{options:(o||[]).map((e=>({label:e.displayName,value:e.id}))),onValueChange:e=>{i(e)},selectedValues:t.map((e=>{const a=(o||[]).find((a=>a.id===String(e)||a.displayName===String(e)||a.id===a.displayName&&a.id===String(e)));return a?.id||String(e)})),setSelectedValues:e=>{i(e)},searchPlaceholder:"Enter new value",emptyMessage:"Press enter to add new value",handleSearchInput:e=>{if(e.length>0){const a=(e=>{const{value:a,type:n}=e;switch(n){case kY.ReachResource:case kY.Array:case kY.String:return a.length>0;case kY.Number:return!isNaN(Number(a));case kY.Integer:return!isNaN(Number(a))&&Number(a)%1==0;case kY.Boolean:return"true"===a||"false"===a;case kY.Date:case kY.DateTime:return!isNaN(new Date(a).getTime());default:throw Dse(n,kY)}})({value:e,type:l.type});a?i([...new Set([...t,e])]):s({title:"Invalid value",description:`Please enter a valid value for this field. The value must be a ${l.type} type`,variant:"destructive"})}}});if(e===kY.Date||e===kY.DateTime){const e=a===SY.EQUALS_MONTH_DAY||a===SY.EQUALS_MONTH_DAY_YEAR,t=a===SY.BETWEEN_MONTH_DAY||a===SY.BETWEEN_MONTH_DAY_YEAR,r=e=>{ppe(e)?(v(e),h&&i([e])):s({title:"Invalid relative date",description:"Please enter a valid non-negative number of days.",variant:"destructive"})},o=e=>{const a=e.startDate??f?.startDate,n=e.endDate??f?.endDate,t=a&&"object"==typeof a&&"type"in a,r=n&&"object"==typeof n&&"type"in n;if(a&&n){if(t!==r)return void s({title:"Invalid date range",description:"Both start and end dates must be of the same type (either both absolute or both relative).",variant:"destructive"});if(!t&&!r&&!(e=>!e.finalStartDate||!e.finalEndDate||e.finalStartDate<e.finalEndDate)({finalStartDate:a,finalEndDate:n}))return void s({title:"Invalid date range",description:"Start date must be before end date.",variant:"destructive"});if(t&&(!ppe(a)||!ppe(n)))return void s({title:"Invalid relative date",description:"Please enter valid relative dates.",variant:"destructive"})}y(e),a&&n&&i([{startDate:a,endDate:n}])},l=e=>{e&&(e=>e instanceof Date?!isNaN(e.getTime()):"object"==typeof e&&"type"in e&&"relative"===e.type&&ppe(e))(e)?(m(e),i([e]),p(!1)):e||(m(void 0),i([]),p(!1))},u=e=>{p(e),i(e?[g]:d?[d]:[])};return n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsxs("div",{className:"min-h-[36px] flex items-center",children:[(!h||!e)&&!t&&n.jsx(hpe,{date:d,onSelect:l,monthDayOnly:a===SY.EQUALS_MONTH_DAY}),e&&h&&n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(o4,{type:"number",value:void 0===g.value?"":g.value,onChange:e=>{const a=""===e.target.value?void 0:parseInt(e.target.value,10);r({...g,value:a})},className:"w-20 h-9",min:"0","aria-label":"Relative days value"}),n.jsxs(hie,{value:g.direction,onValueChange:e=>{r({...g,direction:e})},children:[n.jsx(vie,{className:"w-[180px] h-9","aria-label":"Relative direction",children:n.jsx(gie,{placeholder:"Select direction..."})}),n.jsxs(kie,{children:[n.jsx(bie,{value:"before",children:"days before today"}),n.jsx(bie,{value:"after",children:"days after today"})]})]})]}),t&&n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsxs("div",{className:"flex flex-col space-y-2",children:[n.jsx("div",{className:"flex items-center space-x-2",children:k?n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(o4,{type:"number",value:f?.startDate&&"object"==typeof f.startDate&&"type"in f.startDate?f.startDate.value:"",onChange:e=>{const a={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Kme.DAYS,direction:f?.startDate?.direction||"before"};ppe(a)&&(y({...f,startDate:a}),o({...f,startDate:a}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),n.jsxs(hie,{value:f?.startDate&&"object"==typeof f.startDate&&"type"in f.startDate?f.startDate.direction:"before",onValueChange:e=>{const a={type:"relative",value:f?.startDate?.value,unit:Kme.DAYS,direction:e};ppe(a)&&(y({...f,startDate:a}),o({...f,startDate:a}))},children:[n.jsx(vie,{className:"w-[180px] h-9",children:n.jsx(gie,{placeholder:"Select direction..."})}),n.jsxs(kie,{children:[n.jsx(bie,{value:"before",children:"days before today"}),n.jsx(bie,{value:"after",children:"days after today"})]})]}),n.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"Start"})]}):n.jsx(hpe,{placeholder:"Start date",date:f?.startDate instanceof Date||"string"==typeof f?.startDate?f.startDate instanceof Date?f.startDate:new Date(f.startDate):void 0,monthDayOnly:a===SY.BETWEEN_MONTH_DAY,onSelect:e=>{const a=e;a&&(y({...f,startDate:a}),o({...f,startDate:a}))}})}),n.jsx("div",{className:"flex items-center space-x-2",children:k?n.jsxs("div",{className:"flex items-center space-x-2",children:[n.jsx(o4,{type:"number",value:f?.endDate&&"object"==typeof f.endDate&&"type"in f.endDate?f.endDate.value:"",onChange:e=>{const a={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Kme.DAYS,direction:f?.endDate?.direction||"before"};ppe(a)&&(y({...f,endDate:a}),o({...f,endDate:a}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),n.jsxs(hie,{value:f?.endDate&&"object"==typeof f.endDate&&"type"in f.endDate?f.endDate.direction:"before",onValueChange:e=>{const a={type:"relative",value:f?.endDate?.value,unit:Kme.DAYS,direction:e};ppe(a)&&(y({...f,endDate:a}),o({...f,endDate:a}))},children:[n.jsx(vie,{className:"w-[180px] h-9",children:n.jsx(gie,{placeholder:"Select direction..."})}),n.jsxs(kie,{children:[n.jsx(bie,{value:"before",children:"days before today"}),n.jsx(bie,{value:"after",children:"days after today"})]})]}),n.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"End"})]}):n.jsx(hpe,{placeholder:"End date",date:f?.endDate instanceof Date||"string"==typeof f?.endDate?f.endDate instanceof Date?f.endDate:new Date(f.endDate):void 0,monthDayOnly:a===SY.BETWEEN_MONTH_DAY,onSelect:e=>{const a=e;a&&(y({...f,endDate:a}),o({...f,endDate:a}))}})})]}),n.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[n.jsx(mpe,{id:"between-relative-date-switch",checked:k,onCheckedChange:e=>{if(b(e),e){const e={type:"relative",value:0,unit:Kme.DAYS,direction:"before"},a={type:"relative",value:0,unit:Kme.DAYS,direction:"before"};y({startDate:e,endDate:a}),o({startDate:e,endDate:a})}else{const e=new Date,a=new Date(e);a.setDate(a.getDate()+1),y({startDate:e,endDate:a}),o({startDate:e,endDate:a})}},"aria-label":"Toggle relative date input for between dates"}),n.jsx(Kae,{htmlFor:"between-relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})]}),e&&n.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[n.jsx(mpe,{id:"relative-date-switch",checked:h,onCheckedChange:u,"aria-label":"Toggle relative date input"}),n.jsx(Kae,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===kY.Number||e===kY.Integer)return a===SY.EXISTS?null:n.jsx(o4,{type:"number",value:t.length>0?String(t[0]):"",onChange:e=>i([Number(e.target.value)]),className:"w-[200px]"});if(e===kY.Boolean){if(a===SY.EXISTS)return null;const e=t.length>0&&Boolean(t[0]);return n.jsx(mpe,{checked:e,onCheckedChange:e=>i([e])})}return n.jsx(o4,{value:t.length>0?String(t[0]):"",onChange:e=>i([e.target.value]),className:"w-[200px]",disabled:!0})},vpe=({condition:e,onUpdate:a,onDuplicate:t,onDelete:i,segmentsConditions:r})=>{const{toast:o}=Ie(),s=(e=>{const a=r.conditions.find((a=>a.field===e));return a||null})(e.field)||{operators:[],type:kY.String,options:void 0,itemType:void 0},l=s.operators,u=s.type,c=r.conditions.map((e=>e.field)).map((e=>({value:e,label:Ome[e]||e})));return n.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch gap-2 min-w-0 w-full",children:[n.jsxs("div",{className:"flex flex-col sm:flex-row flex-1 items-stretch gap-2 min-w-0 w-full",children:[n.jsx("div",{className:"flex-1 min-w-0 items-center flex",children:n.jsx(Ime,{options:c,value:e.field,onChange:n=>{const t=n,i=r.conditions.find((e=>e.field===t));if(!i)return;const o=i.operators.map((e=>({value:e,label:Hme[e]||e,fieldType:i.type}))),s=o[0]?.value;let l=[];switch(i.type){case kY.Boolean:l=[!1];break;case kY.Number:l=[0];break;case kY.Date:case kY.DateTime:l=[new Date];break;case kY.String:l=i.options?.length?i.options.map((e=>e.displayName)):[];break;default:l=[]}a({...e,field:t,operator:s,value:l})},placeholder:"Select field",className:"w-full",disableInput:!0})}),n.jsxs("div",{className:"flex-1 min-w-0 max-w-xs flex gap-2 items-center",children:[(e.operator===SY.EQUALS_MONTH_DAY||e.operator===SY.EQUALS_MONTH_DAY_YEAR||e.operator===SY.BETWEEN_MONTH_DAY||e.operator===SY.BETWEEN_MONTH_DAY_YEAR)&&n.jsx("div",{className:"flex items-center",children:(e=>{let a;switch(e){case SY.EQUALS_MONTH_DAY:a="This operator will check if only the month and day are equal. This is useful for things like birthday, where year does not matter";break;case SY.EQUALS_MONTH_DAY_YEAR:a="This operator will check if only the month and day are equal. This is useful for things like appointment dates, where specific day and month is important but year does not matter";break;case SY.BETWEEN_MONTH_DAY:a="This operator will check if the date is between the two dates, but only checking the month and the day, not the year. This is helpful for things like birthday, where year does not matter";break;case SY.BETWEEN_MONTH_DAY_YEAR:a="This operator will check if the date is between the two dates, checking the month, day and year. This is helpful for things like appointment dates, where specific day, month and year is important";break;default:return null}return n.jsx(Mae,{title:a})})(e.operator)}),n.jsx(Ime,{options:l.map((e=>({value:e,label:Hme[e]||e}))),value:e.operator,onChange:n=>a({...e,operator:n}),placeholder:"Select operator",className:"w-full",disableInput:!0})]}),n.jsx("div",{className:"flex-1 min-w-0",children:n.jsx(gpe,{fieldType:u,operator:e.operator,options:"string"==typeof e.value[0]&&e.value[0]&&Array.isArray(s.options)?[...(s.options||[]).map((e=>({displayName:e.displayName,id:e.id}))),...e.value.filter((e=>!s.options?.some((a=>a.id===e||a.displayName===e)))).map((e=>({displayName:e,id:e})))]:s.options?.map((e=>({displayName:e.displayName,id:e.id}))),value:e.value,onChange:n=>a({...e,value:n}),toast:o,metadata:{field:e.field,type:u,itemType:s.itemType}})})]}),n.jsxs("div",{className:"flex items-center flex-shrink-0 pl-2",children:[n.jsx(jY,{size:"icon",variant:"ghost",onClick:t,children:n.jsx(xc,{className:"h-4 w-4"})}),n.jsx(jY,{size:"icon",variant:"ghost",onClick:i,children:n.jsx(td,{className:"h-4 w-4"})})]})]})},fpe=({onSelectStyle:e})=>{const[t,i]=a.useState(null);return n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 max-w-4xl mx-auto",children:[n.jsx(zY,{onClick:()=>{i("ai"),e("ai")},title:"Build with AI",subtitle:"Describe your audience in plain language and let AI create the conditions",icon:n.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:n.jsx(ad,{className:"w-full h-full"})})}),selected:"ai"===t}),n.jsx(zY,{onClick:()=>{i("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${yh("engage:segment")} by configuring conditions directly`,icon:n.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:n.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:n.jsx(Qc,{className:"w-full h-full"})})}),selected:"manual"===t})]})},ype=({segmentId:e,setOpen:a,setTextToSegment:t,promptBuilderStyle:i,textToSegment:r})=>n.jsx("div",{children:n.jsx(KG,{className:"",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(OG,{className:"text-3xl font-normal",children:e?`Edit ${yh("engage:segment")}`:`Create ${yh("engage:segment")}`}),n.jsxs("div",{className:"flex items-center gap-2",children:[!1===i&&!1===r&&n.jsx(j6,{children:n.jsxs(L6,{children:[n.jsx(B6,{asChild:!0,children:n.jsx(jY,{variant:"outline",size:"sm",onClick:()=>t(!0),children:n.jsx(ad,{className:"h-4 w-3"})})}),n.jsx(z6,{children:n.jsxs("p",{children:["Use AI to create ",yh("engage:segment")," by describing them in natural language"]})})]})}),n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>{a(!1)},className:"h-8 w-8",children:n.jsx(cd,{className:"h-4 w-4"})})]})]})})}),kpe=({setTextToSegment:e,setSegment:t})=>{const[i,r]=a.useState(""),[o,s]=a.useState(!1),{toast:u}=Ie();return n.jsxs("div",{className:"flex flex-col gap-6 p-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Describe your audience"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Describe the audience you want to target in plain language, and our AI will create the conditions for you."})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs(aV,{children:[o&&n.jsx(EY,{children:n.jsx(xY,{})}),!o&&n.jsx(EY,{children:n.jsx(jse,{placeholder:"Describe your target audience...",className:"min-h-[120px] resize-none",value:i,onChange:e=>r(e.target.value)})})]}),n.jsx("div",{className:"flex justify-end gap-2",children:n.jsxs(jY,{onClick:async()=>{if(!i)return void u({title:"Please enter a description",description:"Please enter a description of your target audience",variant:"destructive"});s(!0);const a=await(async e=>(await Pe(`${l}/text-to-segment`,{method:"POST",body:JSON.stringify({text:e})})).data)(i);a.success&&a.conditions?(u({title:`${yh("engage:segment")} conditions built successfully 🚀`,description:`Your ${yh("engage:segment")} conditions have been built successfully`}),t(a.conditions)):u({title:`${yh("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[n.jsx(ad,{className:"h-4 w-4"}),"Generate ",yh("engage:segment")]})})]})]})};function bpe({segmentId:e,setOpen:a,onSegmentUpdated:t}){const{toast:i}=Ie(),o=void 0===e,[s,l]=r.useState(!1),[u,c]=r.useState({version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[]}),{segment:d,isLoading:m}=fY(e||""),{updateSegment:h}=yY(e),{createSegment:p,isCreating:g,segmentsConditions:v}=pY(),[f,y]=r.useState(!1),[k,b]=r.useState(!!o);r.useEffect((()=>{v&&c(d?{version:"1.0",id:d.id,name:d.name,description:d.description,logic:"AND",conditions:d.conditions}:{version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[{field:v.conditions[0].field,operator:v.conditions[0].operators[0],value:[]}]})}),[d,v]);const S=e=>e.value.some((e=>"object"==typeof e&&"type"in e&&"relative"===e.type)),A=e=>e.value.some((e=>"object"==typeof e&&"startDate"in e&&"endDate"in e));if(!v||m)return n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(xY,{})});return n.jsxs(n.Fragment,{children:[n.jsx(ype,{segmentId:e,setOpen:a,setTextToSegment:y,promptBuilderStyle:k,textToSegment:f},"segment-builder-header"),k?n.jsx(EY,{children:n.jsx(fpe,{onSelectStyle:e=>{"ai"===e&&y(!0),b(!1)}})},"prompt-builder-style"):n.jsx(EY,{children:n.jsxs("div",{className:"flex flex-1 flex-col",children:[n.jsx("div",{className:"flex flex-1 flex-col px-8 py-2",children:n.jsx("div",{className:"flex flex-1 flex-col gap-4 overflow-visible",children:n.jsx(aV,{children:f?n.jsx(EY,{children:n.jsx(kpe,{setTextToSegment:y,setSegment:e=>c({...u,conditions:e})})}):n.jsxs(EY,{children:[n.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[n.jsxs("div",{className:"grid gap-2",children:[n.jsxs("div",{className:"flex items-center gap-0",children:[n.jsx(Kae,{className:"text-muted-foreground text-xs",children:"Name"}),n.jsx("span",{className:"text-xs text-red-500 ml-1 align-super",children:"*"})]}),n.jsx(o4,{placeholder:`${yh("engage:segment")} name`,value:u.name,onChange:e=>c({...u,name:e.target.value})})]}),n.jsxs("div",{className:"grid gap-2",children:[n.jsx(Kae,{className:"text-muted-foreground text-xs",children:"Description"}),n.jsx(o4,{placeholder:`${yh("engage:segment")} description`,value:u.description,onChange:e=>c({...u,description:e.target.value})})]})]}),u.conditions.length>0&&n.jsx("div",{className:"flex-1 overflow-y-auto pb-8",children:n.jsx("div",{className:"grid",children:n.jsx(aV,{mode:"popLayout",children:u.conditions.map(((e,a)=>n.jsxs(H$.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{type:"spring",stiffness:300,damping:30,mass:.5},children:[a>0&&n.jsxs(H$.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[n.jsx(H$.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}}),n.jsx(H$.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),n.jsx(H$.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}})]}),n.jsx(vpe,{condition:e,onUpdate:e=>((e,a)=>{const n=[...u.conditions];n[e]=a,c({...u,conditions:n})})(a,e),segmentsConditions:v,onDuplicate:()=>(e=>{const a=[...u.conditions];a.splice(e+1,0,{...u.conditions[e]}),c({...u,conditions:a})})(a),onDelete:()=>(e=>{const a=u.conditions.filter(((a,n)=>n!==e));c({...u,conditions:a})})(a)})]},`${e.field}-${e.operator}-${a}`)))})})})]})})})}),n.jsx("div",{className:"border-t px-8 py-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs(jY,f?{variant:"secondary",onClick:()=>y(!1),children:[n.jsx(Qc,{className:"h-4 w-4"}),"Manual Builder"]}:{variant:"secondary",onClick:()=>{c({...u,conditions:[...u.conditions,{field:v.conditions[0].field,operator:v.conditions[0].operators[0],value:[]}]})},children:[n.jsx(qc,{className:"h-4 w-4"}),"Add Condition"]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(jY,{variant:"destructive",onClick:()=>a(!1),children:"Cancel"}),n.jsx(jY,{variant:"default",onClick:async()=>{if(!u.name)return void i({title:"Name is required",description:"Please ensure all fields are filled out",variant:"destructive"});const{valid:n,error:r}=(e=>{for(const a of e){if(!a.field||!a.operator)return{valid:!1,error:"Please ensure all fields are filled out for condition"};if(a.operator!==SY.EXISTS&&0===a.value.length)return{valid:!1,error:`Please ensure a value is selected for ${a.field}`};if(a.operator===SY.EXISTS&&a.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${a.field}`};if(S(a)&&a.operator!==SY.EQUALS_MONTH_DAY&&a.operator!==SY.EQUALS_MONTH_DAY_YEAR)return{valid:!1,error:`Relative dates can only be used with the month and day or month, day, and year operator for ${a.field}`};if(S(a)&&void 0===a.value[0].value)return{valid:!1,error:`Please select a value for the relative date for ${a.field}`};if(A(a)&&a.operator!==SY.BETWEEN_MONTH_DAY&&a.operator!==SY.BETWEEN_MONTH_DAY_YEAR)return{valid:!1,error:`Between dates can only be used with the between month day or between month day year operator for ${a.field}`};if(A(a)&&a.value.length>1)return{valid:!1,error:`Between dates can only have a single value for ${a.field}`};if(A(a)){const e=a.value[0];if(!e.startDate||!e.endDate)return{valid:!1,error:`Please ensure both a start and end date are selected for ${a.field}`};if(e.startDate instanceof Date&&e.endDate instanceof Date&&e.startDate>e.endDate)return{valid:!1,error:`Start date must be before end date for ${a.field}`};if("type"in e.startDate&&"relative"===e.startDate.type&&"type"in e.endDate&&"relative"===e.endDate.type){if(!e.startDate.value||!e.endDate.value)return{valid:!1,error:`Please ensure both a start and end date are selected for ${a.field}`};if(e.startDate.direction!==e.endDate.direction)return{valid:!1,error:`Start and end date must be of the same direction for ${a.field}`};const n=e=>{if(e.unit===Kme.DAYS)return e.value??0;throw W$(e.unit,Kme)};if("before"===e.startDate.direction&&n(e.startDate)>n(e.endDate))return{valid:!1,error:`Start date must be before end date for ${a.field}`};if("after"===e.startDate.direction&&n(e.startDate)<n(e.endDate))return{valid:!1,error:`Start date must be after end date for ${a.field}`}}}}return{valid:!0,error:void 0}})(u.conditions);if(!n)return void i({title:"Conditions are invalid",description:r??"Please ensure all fields are filled out",variant:"destructive"});const o=u.conditions.map((e=>{const a=v?.conditions.find((a=>a.field===e.field));return a?.type===kY.Date&&(e.value=e.value.map((e=>e instanceof Date?e.toISOString().split("T")[0]:e))),e}));l(!0);try{e&&d?h({name:u.name,description:u.description,conditions:o},{onSuccess:()=>{i({title:`${yh("engage:segment")} updated successfully`}),a(!1),t?.(e)},onError:()=>{i({title:`Error updating ${yh("engage:segment")}`,description:"Please try again",variant:"destructive"}),t?.("error")}}):p({name:u.name,description:u.description,conditions:u.conditions},{onSuccess:e=>{i({title:`${yh("engage:segment")} created successfully`}),t?.(e?.id??!1),a(!1)},onError:()=>{i({title:`Error creating ${yh("engage:segment")}`,description:"Please try again",variant:"destructive"}),t?.("error")}})}catch(s){i({title:`Error saving ${yh("engage:segment")}`,description:"Please try again",variant:"destructive"}),t?.("error")}finally{l(!1)}},disabled:s||g,children:s||g?n.jsxs(n.Fragment,{children:[n.jsx(_c,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})}function Spe({open:e,setOpen:a,segmentId:t,onSegmentUpdated:i}){return n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-6xl w-full",hideCloseButton:!0,children:[n.jsxs(uO,{children:[n.jsxs(OG,{children:[yh("engage:segment")," Builder"]}),n.jsxs(IG,{children:["Build a ",yh("engage:segment")," to target your audience"]})]}),n.jsx(bpe,{segmentId:t,setOpen:a,onSegmentUpdated:e=>{i?.(e),a(!1)}})]})})}const Ape=()=>n.jsx(Mae,{title:`These are estimated numbers of ${yh("engage:user",{count:2}).toLocaleLowerCase()} that are matched. The actual count may change at the time of sending. You can see the breakdown of who have opted into email or sms.`}),wpe=({value:e,label:a,percentage:t,variant:i,isLoading:r,selected:o})=>n.jsxs("div",{className:"rounded-md border-2 border-muted-foreground/20 px-2 pt-2 pb-3 duration-300 ease-in-out overflow-x-auto max-w-full min-w-0 "+(o?"scale-[1.02] [border-color:hsl(var(--reach-primary))] shadow-lg":""),style:{containerType:"inline-size"},"data-card-container":!0,children:[n.jsxs("div",{className:"flex flex-col gap-1 items-start w-full min-w-0",children:[n.jsx("div",{className:"flex items-baseline gap-2 w-full min-w-0 @container/num",children:r?n.jsx("span",{className:"animate-pulse",children:"..."}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-semibold pl-2 break-words max-w-full min-w-0 truncate\n text-xl @[250px]/card:text-2xl @[350px]/card:text-3xl @[500px]/card:text-4xl text-primary",children:e.toLocaleString()}),void 0!==t&&e.toLocaleString().replace(/,/g,"").length<5&&n.jsxs("span",{className:"text-muted-foreground/50 text-sm hidden @[120px]/num:inline",children:["(",t,"%)"]})]})}),n.jsx("span",{className:`px-2 sm:px-2.5 py-1 text-xs font-medium rounded-lg ${{default:"bg-gray-100/50 text-gray-700",blue:"bg-blue-100/50 text-blue-700",green:"bg-green-100/50 text-green-700"}[i]}`,children:a})]}),n.jsx("p",{className:"text-sm text-muted-fore hidden @[250px]/card:inline mt-1",children:1===e?"contact":"contacts"})]}),Cpe=({countResponse:e})=>{const t=a.useMemo((()=>e?.recipients?e.recipients.reduce(((a,n)=>({total:e.count,emails:a.emails+(n.email?1:0),phones:a.phones+(n.phone?1:0)})),{total:0,emails:0,phones:0}):{total:0,emails:0,phones:0}),[e]),i=e=>Math.round(e/(t.total||1)*100);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Lue,{children:"Estimated Matches"}),n.jsx(Ape,{})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 md:mb-6 w-full gap-4 mt-3 px-1",children:[n.jsx(wpe,{value:t.total,label:"Total",variant:"default",isLoading:void 0===e}),n.jsx(wpe,{value:t.emails,label:"Subscribed to Email",percentage:i(t.emails),variant:"blue",isLoading:void 0===e}),n.jsx(wpe,{value:t.phones,label:"Subscribed to SMS",percentage:i(t.phones),variant:"green",isLoading:void 0===e})]})]})},Mpe=({recipients:e})=>e?.length?n.jsx("div",{className:"bg-foreground/5 rounded-lg h-full relative overflow-hidden",children:n.jsx("div",{className:"absolute inset-0 w-full h-full overflow-y-auto",children:n.jsxs("table",{className:"w-full",children:[n.jsx("thead",{className:"sticky top-0 bg-foreground/5 backdrop-blur-sm",children:n.jsxs("tr",{children:[n.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Name"}),n.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Contact"})]})}),n.jsx("tbody",{className:"divide-y divide-gray-200/50",children:e.map(((e,a)=>n.jsxs("tr",{className:"hover:bg-white/50 transition-colors",children:[n.jsx("td",{className:"px-3 sm:px-4 py-3 text-sm text-gray-900",children:e.firstName||e.lastName?`${e.firstName||""} ${e.lastName||""}`.trim():"Not Provided"}),n.jsx("td",{className:"px-3 sm:px-4 py-3",children:n.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[e.email&&n.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-blue-100/50 text-blue-700 rounded-lg",children:"Email"}),e.phone&&n.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-green-100/50 text-green-700 rounded-lg",children:"Phone"})]})})]},a)))})]})})}):null,Tpe=({onSelectionChange:e,defaultValue:t="all"})=>{const[i,r]=a.useState(t),o=a=>{r(a),e?.(a)};return n.jsxs(n.Fragment,{children:[n.jsx(Lue,{children:"Filter"}),n.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[n.jsx(zY,{onClick:()=>o("all"),title:`All ${yh("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:n.jsx(RY.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===i}),n.jsx(zY,{onClick:()=>o("segments"),title:`Select ${yh("engage:user",{count:2})}`,subtitle:`Choose from ${yh("engage:segment",{count:2})}`,icon:n.jsx(RY.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===i})]})]})},Npe=({segments:e,allSegments:t,onAddSegment:i,onRemoveSegment:r,setOpenCreateSegmentDialog:o})=>{const[s,l]=a.useState([]),u=t.map((e=>({label:e.name,value:e.id})));return a.useEffect((()=>{l(e)}),[e]),n.jsx("div",{children:n.jsx(Xhe,{selectedValues:s,setSelectedValues:l,options:u,onValueChange:a=>{const n=a.filter((a=>!e.includes(a))),t=e.filter((e=>!a.includes(e)));n.forEach(i),t.forEach(r)},placeholder:"Select segments",maxCount:5,extraCommandItems:[e=>n.jsxs(Pse,{onSelect:()=>{e(!0),o(!0)},className:"cursor-pointer",children:[n.jsx(RY.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},xpe=({includedSegments:e,excludedSegments:t,handleAddSegment:i,handleRemoveSegment:r,setOpenCreateSegmentDialog:o,segments:s,defaultIsExcludeOpen:l=!1})=>{const[u,c]=a.useState(l);return n.jsxs("div",{children:[n.jsx(Npe,{segments:e,allSegments:s||[],onAddSegment:e=>i(e,"include"),onRemoveSegment:e=>r(e,"include"),setOpenCreateSegmentDialog:o}),n.jsx("div",{className:"border-t border-gray-200 my-8"}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs(jY,{onClick:()=>c(!u),className:"flex items-center gap-1 transition-colors",size:"sm",children:[n.jsx(H$.div,{animate:{rotate:u?180:0},transition:{duration:.2},children:n.jsx(RY.DropdownMenuTrigger,{className:"w-5 h-5"})}),n.jsx("span",{children:"Don't send to"})]}),n.jsx(aV,{children:u&&n.jsx(H$.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:n.jsx(Npe,{segments:t,allSegments:s||[],onAddSegment:e=>i(e,"exclude"),onRemoveSegment:e=>r(e,"exclude"),setOpenCreateSegmentDialog:o})})})]})]})},Epe=({title:e="Preview Audience"})=>{const t=wY(),[i,r]=a.useState("all"),[o,s]=a.useState(t?.includeSegmentIds||[]),[l,u]=a.useState(t?.excludeSegmentIds||[]),[c,d]=a.useState(!1),[m,h]=a.useState(!1),{segments:p,isLoading:g}=gY(),{updateAutomation:v}=Je(t?.id??""),[f,y]=a.useState(void 0),k=1===o.length&&0===l.length&&void 0!==p?.find((e=>e.type===bY.ALL_USERS&&e.id===o[0]));a.useEffect((()=>{t&&!m&&(r(k||o.length>0&&0===l.length?"all":"segments"),mY({includeSegments:o,excludeSegments:l}).then((e=>{y(e)})),h(!0))}),[t,k,m,o,l]);a.useEffect((()=>{t&&m&&(JSON.stringify(o)===JSON.stringify(t.includeSegmentIds)&&JSON.stringify(l)===JSON.stringify(t.excludeSegmentIds)||(v({includeSegments:o,excludeSegments:l}),mY({includeSegments:o,excludeSegments:l}).then((e=>{y(e)}))))}),[o,l,t,m,v]);return n.jsxs(Bue,{title:e,children:[!g&&p&&m?n.jsxs("div",{className:"flex gap-8 w-full pb-4 px-4",children:[n.jsxs("div",{className:"flex flex-col flex-1 relative overflow-y-auto pb-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:[n.jsx(Cpe,{countResponse:f}),n.jsx(Tpe,{onSelectionChange:e=>{if(r(e),"all"===e){const e=p?.find((e=>e.type===bY.ALL_USERS));if(!e)return;s([e.id]),u([])}},defaultValue:i}),n.jsx(aV,{children:"segments"===i&&n.jsx(H$.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:"easeInOut"},className:"w-full pt-4",children:n.jsx(xpe,{includedSegments:o,excludedSegments:l,handleAddSegment:(e,a)=>{"include"===a?s((a=>[...a,e])):u((a=>[...a,e]))},handleRemoveSegment:(e,a)=>{"include"===a?s((a=>a.filter((a=>a!==e)))):u((a=>a.filter((a=>a!==e))))},setOpenCreateSegmentDialog:d,segments:p,defaultIsExcludeOpen:l.length>0})})})]}),n.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:f?.recipients&&n.jsx(Mpe,{recipients:f.recipients})})]}):n.jsx("div",{children:n.jsx(xY,{text:["Fetching segments","Finishing up"]})}),n.jsx(Spe,{open:c,setOpen:d,onSegmentUpdated:e=>{e&&s((a=>[...a,e]))}})]})},Ppe=()=>n.jsx(Epe,{title:"Select Audience"}),jpe=()=>{const{channelSenders:e}=x9(),{channelAccounts:t}=M9(),i=CY(),{updateCommunicationGroup:r}=lY(),{state:{selectedChannels:o},setSelectedChannels:s}=a.useContext(A9),l=wY(),{data:u}=L9(),c=a.useCallback((async e=>{s(e),e.includes("email")||i?.id&&r({groupId:i?.id,params:{emailChannelSenderId:null}}),e.includes("sms")||i?.id&&r({groupId:i?.id,params:{smsChannelSenderId:null}})}),[s,r,i?.id]),d=a.useMemo((()=>zie({channelSenders:e?.results??[],channelAccounts:t?.results??[]})),[e?.results,t?.results]),m=a.useMemo((()=>mee({channelSenders:e?.results??[],channelAccounts:t?.results??[],smsApplication:u})),[e?.results,t?.results,u]);if(!o||!d||!m)return n.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(xY,{text:["Fetching Content..."]})});const h=d.length>0,p=m.length>0;return n.jsx("div",{className:"flex flex-col gap-4 flex-shrink-0",children:n.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:n.jsx(oue,{automationType:l?.triggerMetadata?.triggerType,selectedChannels:o,setSelectedChannels:c,hasEmailChannelSenders:h,hasSmsChannelSenders:p})})})};var Lpe=(e=>(e[e.SelectAudience=1]="SelectAudience",e[e.SelectSenders=2]="SelectSenders",e[e.EditEmailContent=3]="EditEmailContent",e[e.EditSmsContent=4]="EditSmsContent",e[e.Schedule=5]="Schedule",e[e.PreviewAndSend=6]="PreviewAndSend",e))(Lpe||{});const Bpe="https://assets.embedreach.com/defaults/logo-placeholder-128.png",zpe="You have not uploaded a custom logo. Please make sure to double check your email before sending!",Rpe=()=>{const e=wY(),n=CY(),{state:{selectedChannels:t}}=a.useContext(A9),{data:i}=L9(),{channelSenders:r}=x9(),{channelAccounts:o}=M9(),s=mee({channelSenders:r?.results??[],channelAccounts:o?.results??[],smsApplication:i}),l=a.useCallback((async a=>e?await(async e=>{const{currentStep:a,automation:n,communicationGroup:t,selectedChannels:i,smsChannelSenders:r}=e;switch(a){case Lpe.SelectAudience:return{canMove:n.includeSegmentIds.length>0,errorMessage:"Please ensure you have selected at least one segment"};case Lpe.SelectSenders:return{canMove:i.length>0,errorMessage:"Please ensure you have selected at least one channel"};case Lpe.EditSmsContent:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));if(!e)return{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"};if(!t)return{canMove:!1,errorMessage:"Please ensure you have selected a communication group"};const a=r.find((e=>e.channelSender.id===t.smsChannelSenderId));return a?t.smsMessageBody?a.smsApplication&&a.smsApplication.status!==dee.APPROVED?{canMove:!0,errorMessage:null,warningMessage:"You will only be able to send this message once your SMS application is approved"}:{canMove:!0,errorMessage:null}:{canMove:!1,errorMessage:"Please ensure you have a text body"}:{canMove:!1,errorMessage:"Please ensure you have selected a text sender"}}case Lpe.EditEmailContent:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));if(!e)return{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"};if(!t)return{canMove:!1,errorMessage:"Please ensure you have selected a communication group"};if(!t.emailChannelSenderId)return{canMove:!1,errorMessage:"Please ensure you have selected a email sender"};if(!t.emailHtmlBody||!t.emailSubject)return{canMove:!1,errorMessage:"Please ensure you have a email body and subject"};let a=null;return t.emailHtmlBody?.includes(Bpe)&&(a=zpe),{canMove:!0,errorMessage:null,warningMessage:a}}case Lpe.Schedule:{if(!n.triggerMetadata)return{canMove:!1,errorMessage:"Please make sure to select a time to send before starting!"};if(n.triggerMetadata.triggerType!==Ze.ONE_TIME)return{canMove:Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:null};if(!n.triggerMetadata?.scheduledAt)return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${yh("engage:broadcast")}`};if(!Boolean(n.triggerMetadata?.scheduledAt&&("now"===n.triggerMetadata.scheduledAt||"now"!==n.triggerMetadata.scheduledAt&&new Date(n.triggerMetadata.scheduledAt)>new Date)))return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${yh("engage:broadcast")}`};if(!Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))))return{canMove:!1,errorMessage:"Please ensure you have set a valid email or sms communication"};const e=n.triggerMetadata;return{canMove:Boolean(e.scheduledAt&&("now"===e.scheduledAt||new Date(e.scheduledAt)>new Date)&&n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:`Please ensure you have set a valid future date for your ${yh("engage:broadcast")}`}}case Lpe.PreviewAndSend:return{canMove:!0,errorMessage:null};default:Dse(a,Lpe)}})({currentStep:a,automation:e,communicationGroup:n,selectedChannels:t,smsChannelSenders:s}):{canMove:!1,errorMessage:`${yh("engage:broadcast")} not loaded`}),[e,n,t,s]);return{validateStep:l}},_pe=({onFinish:e,getExtraMergeFields:t,onBeforeSchedule:i})=>{const r=wY(),o=CY(),{updateAutomation:s}=Je(r?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:n}=vY({automationId:e?.id??"",includeSegments:e?.includeSegmentIds??[],excludeSegments:e?.excludeSegmentIds??[]}),t=a.useMemo((()=>n?.recipients?n.recipients.reduce(((e,a)=>({emails:e.emails+(a.email?1:0),phones:e.phones+(a.phone?1:0)})),{emails:0,phones:0}):{emails:0,phones:0}),[n?.recipients]);return{estimatedMatches:n,estimatedMatchesStats:t}})(r??void 0),{state:{selectedChannels:u}}=a.useContext(A9),{validateStep:c}=Rpe(),[d,m]=a.useState([]),{data:h}=L9(),[p,g]=a.useState(!1),{channelSenders:v}=x9(),{channelAccounts:f}=M9(),[y,k]=a.useState(Lpe.SelectAudience);if(a.useEffect((()=>{if(null!==r&&null!==o){const e=mee({channelSenders:v?.results??[],channelAccounts:f?.results??[],smsApplication:h});m((({automation:e,communicationGroup:a,selectedChannels:t,smsChannelSenders:i})=>e?[{id:"audience",title:"Audience",step:1,isValid:()=>e.includeSegmentIds.length>0,content:n.jsx(Nae,{content:n.jsx(Ppe,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Ze.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},{id:"senders",title:"Channel Senders",step:2,isValid:()=>0!==t.length,content:n.jsx(Nae,{content:n.jsx(jpe,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Ze.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},...t.includes("email")?[{id:"edit-email-content",title:"Edit Email Content",step:3,isValid:()=>{const n=e.actionData?.find((e=>"send_communication"===e.actionType));return!!n&&!!a.emailChannelSenderId&&!(!a.emailHtmlBody||!a.emailSubject)},content:n.jsx(Nae,{content:n.jsx(Rie,{})},"audience"),footerConfig:{backText:"",nextText:"",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[],...t.includes("sms")?[{id:"edit-sms-content",title:"Edit SMS Content",step:4,isValid:()=>{const n=e.actionData?.find((e=>"send_communication"===e.actionType));return!!(n&&n.actionMetadata.communicationGroupId&&a.smsChannelSenderId&&a.smsMessageBody)},content:n.jsx(Nae,{content:n.jsx(Rse,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[],{id:"schedule",title:"Schedule",step:5,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Ze.ONE_TIME&&e.triggerMetadata?.scheduledAt&&("now"===e.triggerMetadata.scheduledAt||"now"!==e.triggerMetadata.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date)&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:n.jsx(Nae,{className:"flex-1",content:n.jsx(Dme,{})},"schedule"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"send",title:"Send",step:6,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Ze.ONE_TIME&&e.triggerMetadata?.scheduledAt&&("now"===e.triggerMetadata.scheduledAt||"now"!==e.triggerMetadata.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date(Date.now()+18e4))&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:n.jsx(Nae,{className:"flex-1",content:n.jsx(Rue,{})},"send"),footerConfig:{backText:"Back",nextText:"Schedule",hideBack:!1,backDisabled:!1,getInfoTooltipTitle:()=>{const e=i.find((e=>e.channelSender.id===a.smsChannelSenderId));if(!e||null!==e.smsApplication&&e.smsApplication?.status!==dee.APPROVED)return"You cannot send this yet if you have selected a text channel and don't have an approved SMS application. Please save as draft and try again later."},nextDisabled:()=>{const e=i.find((e=>e.channelSender.id===a.smsChannelSenderId));return!(!a.smsChannelSenderId||e&&(null===e.smsApplication||e.smsApplication?.status===dee.APPROVED))||null===a.smsChannelSenderId&&null===a.emailChannelSenderId}}}]:[])({automation:r,communicationGroup:o,selectedChannels:u,smsChannelSenders:e}))}}),[r,o,t,u,v?.results,f?.results,h]),!(r&&y&&o&&d.length))return n.jsx("div",{className:"flex-1 flex flex-col @container justify-center items-center h-[500px]",children:n.jsx(xY,{text:[`Fetching ${yh("engage:broadcast")} data`,"Finishing up"]})});const b=async()=>{const{canMove:a,errorMessage:n,warningMessage:t}=await c(y);a?(t&&Oe({title:t,variant:"warning"}),y===Lpe.PreviewAndSend?await(async()=>{if(null===o.emailChannelSenderId&&null===o.smsChannelSenderId)return void Oe({title:"Oops!",description:"Please select an email sender or sms sender",variant:"destructive"});const a=mee({channelSenders:v?.results??[],channelAccounts:f?.results??[],smsApplication:h});if(o.smsChannelSenderId){const e=a.find((e=>e.channelSender.id===o.smsChannelSenderId));if(e?.smsApplication?.application&&e?.smsApplication.status!==dee.APPROVED)return void Oe({title:"Oops!",description:"You cant schedule a communication with a pending sms application. Please save as a draft and re-try once the application is approved."})}if(i)try{const a=await i({estimatedEmailRecipients:l?.emails||0,estimatedSmsRecipients:l?.phones||0});!0===a?(s({status:Xe.ACTIVE}),Oe({title:`${yh("engage:broadcast")} scheduled!`}),e()):Oe({title:"Oops!",description:a,variant:"destructive"})}catch(n){Oe({title:"Oops!",description:"An error occurred while checking scheduling conditions",variant:"destructive"})}else s({status:Xe.ACTIVE}),Oe({title:`${yh("engage:broadcast")} scheduled!`}),e()})():k(y===Lpe.SelectSenders&&1===u.length&&"sms"===u[0]?y+2:y+1)):Oe({title:"Oops!",description:n,variant:"destructive"})},S=()=>{y>Lpe.SelectAudience&&k(y===Lpe.EditSmsContent&&1===u.length&&"sms"===u[0]?y-2:y-1)},A=()=>{e()};return n.jsxs("div",{className:"flex-1 flex flex-col @container h-full min-h-0",children:[n.jsxs("header",{className:"w-full flex items-center gap-4 h-16 px-6",children:[n.jsx("h1",{className:"text-xl font-bold leading-none",children:r.name}),n.jsx("div",{className:"flex items-center gap-4",children:n.jsx(UY,{variant:vae(r.status),children:v9[r.status]})})]}),n.jsxs("main",{className:"flex gap-4 flex-1 min-h-0",children:[n.jsx("div",{className:"hidden @[1000px]:block",children:n.jsx("nav",{className:"space-y-0 w-50 self-start pr-6 pl-8 pt-4 ",children:d.map((e=>n.jsx("div",{className:`\n rounded-md transition-colors\n ${e.step===y?"bg-[var(--reach-secondary)] text-[var(--reach-primary-foreground)] font-medium":e.step<y?"text-muted-foreground hover:bg-muted":"text-muted-foreground/60"}\n `,children:n.jsx(nQ,{label:e.title,isActive:e.step===y,isCompleted:e.isValid(),onClick:async()=>{if(!p)if(e.step>y){const{canMove:a,errorMessage:n,warningMessages:t}=await(async e=>{if(e<=y)return{canMove:!0,errorMessage:null};g(!0);try{const a=[];for(let n=y;n<e;n++){const{canMove:e,errorMessage:t,warningMessage:i}=await c(n);if(!e)return{canMove:e,errorMessage:t};i&&a.push(i)}return{canMove:!0,errorMessage:null,warningMessages:a}}finally{g(!1)}})(e.step);if(a){if(t&&t.length>0)for(const e of t)Oe({title:e,variant:"warning"});k(e.step)}else n&&Oe({title:"Cannot navigate to this step",description:n,variant:"destructive"})}else k(e.step)}})},e.step)))})}),n.jsx("section",{className:"flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0",children:n.jsx("div",{className:" overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex",children:n.jsx(aV,{children:n.jsx(EY,{className:"pt-0 h-full",children:d.find((e=>e.step===y))?.content},y)})})})]}),n.jsx("footer",{className:"w-full flex justify-end shadow-md z-10 items-center h-16 px-6",children:n.jsx(Tae,{handleSkipAndSaveAsDraft:A,handleBack:S,handleNext:b,hideBack:d.find((e=>e.step===y))?.footerConfig.hideBack??!1,backText:d.find((e=>e.step===y))?.footerConfig.backText??"Back",nextText:d.find((e=>e.step===y))?.footerConfig.nextText??"Next",backDisabled:d.find((e=>e.step===y))?.footerConfig.backDisabled??!1,nextDisabled:d.find((e=>e.step===y))?.footerConfig.nextDisabled()??!1,getInfoTooltipTitle:d.find((e=>e.step===y))?.footerConfig.getInfoTooltipTitle??void 0})})]})},Dpe=({children:e,actionId:t})=>{const{setActionId:i}=a.useContext(X$);return a.useEffect((()=>{i(t)}),[t,i]),n.jsx("div",{children:n.jsx(w9,{children:e})})},Kpe=()=>n.jsxs("div",{children:[n.jsx("div",{className:HY,children:n.jsx(RY.OneTimeBroadcast,{})}),n.jsx("h3",{className:OY,children:yh("engage:broadcast")}),n.jsx("p",{className:IY,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),Hpe=()=>n.jsxs("div",{children:[n.jsx("div",{className:GY,children:"Coming Soon"}),n.jsx("div",{className:HY,children:n.jsx(RY.RealtimeActivity,{})}),n.jsx("h3",{className:OY,children:"Realtime Activity"}),n.jsx("p",{className:IY,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),Ope=({selectedType:e,setAutomationName:a,automationName:t,setAutomationDescription:i,automationDescription:r})=>n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 max-w-lg mx-auto",children:[n.jsxs("h2",{className:"text-2xl font-semibold mb-8 text-center",children:["Name Your"," ",yh(e===Ze.ONE_TIME?"engage:broadcast":"engage:trigger_based")]}),n.jsxs("div",{className:"w-full space-y-6",children:[n.jsx("div",{className:"bg-gray-50 p-6 rounded-xl items-center justify-center text-center",children:(()=>{switch(e){case Ze.ONE_TIME:return n.jsx(Kpe,{});case Ze.TRIGGER_BASED:return n.jsx(Hpe,{});default:throw Dse(e,Ze)}})()}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[n.jsx("label",{htmlFor:"automationName",className:"block text-sm font-medium text-gray-900",children:"Name"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"Only visible to your team"})]}),n.jsx(o4,{id:"automationName",type:"text",value:t,onChange:e=>a(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500 shadow-sm",placeholder:"e.g. April Newsletter Campaign",autoFocus:!0})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[n.jsx("label",{htmlFor:"automationDescription",className:"block text-sm font-medium text-gray-900",children:"Description"}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"Optional"})]}),n.jsx(jse,{id:"automationDescription",value:r,onChange:e=>i(e.target.value),className:"w-full min-h-[80px] resize-none",placeholder:`Add any helpful context for your team. If left blank, we'll generate one for you when you start the ${yh("engage:broadcast").toLowerCase()}`})]})]})]})]}),Ipe=({onClose:e,automationType:t,currentStep:i,setCurrentStep:r,getExtraMergeFields:o,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:u}=Fe(),[c,m]=a.useState(!1),[h,p]=a.useState(void 0),[g,v]=a.useState(void 0),[f,y]=a.useState(!1),[k,b]=a.useState(t?{name:void 0,description:void 0,type:t}:{name:void 0,description:void 0,type:void 0}),S=void 0!==k.name&&void 0!==k.type&&""!==k.name;a.useEffect((()=>{if(k.type&&!k.name&&!f){const e=new Date,a=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=e.toLocaleDateString([],{month:"long",day:"numeric"}),t=`${yh("engage:broadcast")} ${n} ${a}`,i="";b((e=>({...e,name:t,description:i}))),y(!0)}}),[k,f]);if(u||c)return n.jsx("div",{className:KY,children:n.jsx(xY,{text:[`Creating ${yh("engage:broadcast")}`,"Finishing up"]})});return n.jsxs("div",{className:LG("relative overflow-y-auto h-full p-8",i===LY.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[n.jsx(aV,{mode:"wait",children:n.jsx(EY,{className:"h-full",children:(()=>{switch(i){case LY.ChooseAutomationType:return n.jsx(VY,{onNext:e=>{b({...k,type:e}),r(LY.SetAutomationName)}});case LY.SetAutomationName:return k.type?n.jsx(Ope,{selectedType:k.type,setAutomationName:e=>{b({...k,name:e})},automationName:k.name??"",setAutomationDescription:e=>{b({...k,description:e})},automationDescription:k.description??""}):null;case LY.OneTimeWizard:return h&&g?n.jsx(TY,{automationId:h,children:n.jsx(Dpe,{actionId:g,children:n.jsx(_pe,{onFinish:()=>{e?.(h)},getExtraMergeFields:o,onBeforeSchedule:s})})}):null;default:throw W$(i,LY)}})()},i)}),i!==LY.OneTimeWizard&&n.jsx("div",{className:"pt-2",children:n.jsx(BY,{onClose:e,currentStep:i,setCurrentStep:r,isDisabled:!S,createAutomation:async()=>{if(!S||!k.name||!k.type)return;m(!0);l({name:k.name,type:k.type,description:k.description},{onSuccess:async a=>{if(a.id){const n=await(async e=>(await Pe(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),i=U$().toString();await Le(a.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:i}}]}),p(a.id),await rY({automationId:a.id,actionId:i}),t===Ze.ONE_TIME?(r(LY.OneTimeWizard),v(i),m(!1)):e?.(a.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{b({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==t})})]})};function Gpe({open:e,setOpen:t,onClose:i,automationType:r,getExtraMergeFields:o,replyToSettingsText:s,replyToSettingsLink:l,fromNameSettingsText:u,fromNameSettingsLink:c}){const[d,m]=a.useState(r?LY.SetAutomationName:LY.ChooseAutomationType);return a.useEffect((()=>{e&&m(r?LY.SetAutomationName:LY.ChooseAutomationType)}),[e,r]),n.jsx(dO,{children:n.jsx(mO,{replyToSettingsText:s,replyToSettingsLink:l,fromNameSettingsText:u,fromNameSettingsLink:c,children:n.jsx(BG,{open:e,onOpenChange:t,children:n.jsxs(DG,{hideCloseButton:d===LY.OneTimeWizard,className:`flex max-h-[86vh] ${d===LY.OneTimeWizard?"max-w-[90vw]":"max-w-4xl"} flex-col gap-0 overflow-visible p-0`,children:[n.jsx(KG,{children:n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs(uO,{children:[n.jsx(OG,{className:"text-3xl font-normal",children:"Create Automation"}),n.jsx(IG,{children:"Create a new automation to send messages to your customers."})]})})}),n.jsx(Ipe,{onClose:e=>{i?.(e),t(!1)},automationType:r,currentStep:d,setCurrentStep:m,getExtraMergeFields:o})]})})})})}const Vpe=({tabs:e,activeTab:t,onTabChange:i,tabsLocation:r="left",secondaryTabs:o=!1})=>{const s=a.useRef([]),[l,u]=a.useState({width:0,left:0});a.useEffect((()=>{const a=s.current[e.findIndex((e=>e.id===t))];a&&u({width:a.offsetWidth,left:a.offsetLeft})}),[t,e]);const c=e.find((e=>e.id===t));return n.jsxs("div",{className:"flex flex-col gap-4 w-full overflow-x-hidden h-full",children:[n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("div",{className:"relative flex items-center gap-8 "+("left"===r?"w-full justify-start":"w-full justify-center"),children:[n.jsx("div",{className:"absolute bottom-0 h-[1px] rounded-full transition-all duration-300 ease-out\n bg-gradient-to-r from-primary to-primary/90\n shadow-[0_0_8px_rgba(var(--primary-rgb),0.3)]",style:{width:`${l.width}px`,left:`${l.left}px`}}),e.map(((e,a)=>n.jsx("button",{ref:e=>s.current[a]=e,onClick:()=>i(e.id),className:LG("relative px-7 py-3 transition-all duration-200 text-lg",t!==e.id&&"text-muted-foreground",o&&"text-sm"),children:e.label},e.id)))]})}),n.jsx("div",{className:"relative overflow-hidden flex-grow min-h-0",children:n.jsx("div",{className:"relative h-full",children:c?c.content:null})})]})},Fpe=e=>{if(!e)return"$0.00";const a="string"==typeof e?e.replace(/,/g,""):e,n=Number(a);return Number.isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(n)},Jpe="reach-styles-module__header___-izE2",Upe="reach-styles-module__title___n1hA9",Wpe="reach-styles-module__description___EvXM-",qpe="reach-styles-module__content___okv68",Zpe="reach-styles-module__footer___YA4U4",$pe=lc("reach-styles-module__base___zJcoE",{variants:{variant:{default:"reach-styles-module__default___88Q0d",destructive:"reach-styles-module__destructive___5EWhN",outline:"reach-styles-module__outline___gj9sC",secondary:"reach-styles-module__secondary___cN5Wj"}},defaultVariants:{variant:"default"}}),Ype=r.forwardRef((({className:e,variant:a,...t},i)=>n.jsx("div",{ref:i,className:im($pe({variant:a}),e),...t})));Ype.displayName="Card";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(Jpe,e),...a}))).displayName="CardHeader";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(Upe,e),...a}))).displayName="CardTitle";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(Wpe,e),...a}))).displayName="CardDescription";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(qpe,e),...a}))).displayName="CardContent";r.forwardRef((({className:e,...a},t)=>n.jsx("div",{ref:t,className:im(Zpe,e),...a}))).displayName="CardFooter";const Qpe=({Icon:e,title:a,value:t,tooltipText:i,change:r})=>n.jsxs(Ype,{className:"relative flex flex-col justify-between min-h-[130px] transition-all duration-300 hover:shadow-md p-4",children:[n.jsxs("div",{className:"flex justify-between items-start",children:[n.jsx("div",{className:"rounded-lg p-2 bg-primary/10 flex items-center justify-center",children:n.jsx(e,{className:"w-5 h-5 text-primary"})}),n.jsx("div",{className:"absolute top-3 right-3",children:n.jsx(Mae,{title:i})})]}),n.jsxs("div",{className:"mt-4",children:[n.jsx("div",{className:"text-2xl font-bold leading-tight text-primary",children:t}),n.jsx(Lue,{children:a})]}),r&&n.jsx("div",{className:"absolute bottom-3 right-3",children:n.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-green-100 text-green-600 text-xs font-semibold",children:r})})]}),Xpe=({activeTab:e,automation:a})=>{if(!a)return null;const t={sales:[{Icon:RY.SalesAmount,title:"Order Amount",value:Fpe(a.derivedRevenue),tooltipText:"Total derived revenue from this campaign"}]};return n.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:t[e].map(((e,a)=>n.jsx(Qpe,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},a)))})},ege=({activeTab:e,statistics:a})=>{const t={email:[{Icon:RY.MessagesSent,title:"Emails Sent",value:a.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:RY.OpenRate,title:"Open Rate",value:`${(100*a.email.openPercentage).toFixed(2)}%`,tooltipText:"Percentage of recipients who opened the email out of total emails delivered"},{Icon:RY.TotalBounceRate,title:"Total Bounce Rate",value:`${(100*(a.email.softBounceRate+a.email.hardBounceRate)).toFixed(2)}%`,tooltipText:"Percentage of emails that were not delivered due to permanent (hard) or temporary (soft) delivery failures"},{Icon:RY.LinksClicked,title:"Links Clicked",value:a.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:RY.SpamComplies,title:"Spam Complaints",value:`${(100*a.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:RY.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*a.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:RY.MessagesSent,title:"SMS Sent",value:a.sms.numberSent,tooltipText:"Total number of SMS messages that were successfully sent in this campaign"}]};return n.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:t[e].map(((e,a)=>n.jsx(Qpe,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},a)))})},age=({automationId:e,includeSales:t=!1,includeSms:i=!1,automation:r})=>{const[o,s]=a.useState("email"),{statistics:l,isLoading:u}=Ue(e);if(u||!l)return n.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:n.jsx(xY,{text:[`Fetching ${yh("engage:insight",{count:2})}`,"Finishing up"]})});const c=[{id:"email",label:`Email ${yh("engage:insight",{count:2})}`,content:n.jsx(ege,{activeTab:"email",statistics:l})},...i?[{id:"sms",label:`SMS ${yh("engage:insight",{count:2})}`,content:n.jsx(ege,{activeTab:"sms",statistics:l})}]:[],...t?[{id:"sales",label:`Sales ${yh("engage:insight",{count:2})}`,content:n.jsx(Xpe,{activeTab:"sales",automation:r})}]:[]];return n.jsx(Vpe,{tabs:c,activeTab:o,onTabChange:e=>s(e),tabsLocation:"left"})},nge={all:["website"],content:()=>[...nge.all,"content"],analyze:()=>[...nge.all,"analyze"],brandSettings:()=>[...nge.all,"brand-settings"]},tge=async()=>(await Pe("/web-presence/brand-settings",{method:"POST"})).data,ige=({isLoading:e,brandSettings:t,onComplete:i})=>{const[r,o]=a.useState(0),s=[{text:"Analyzing your brand palette",icon:Vc},{text:"Extracting your visual identity",icon:Pc},{text:"Discovering your brand personality",icon:Lc},{text:"Crafting your email style",icon:Kc},{text:"Finalizing your brand profile",icon:Cc}];a.useEffect((()=>{if(!e)return;const a=setInterval((()=>{o((e=>{const n=e+1;return n>=s.length?(clearInterval(a),setTimeout((()=>{i()}),1500),e):n}))}),2500);return()=>clearInterval(a)}),[e,i,s.length]);return n.jsx(H$.div,{className:"flex flex-col items-center justify-center h-full w-full bg-background p-6",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},children:n.jsxs("div",{className:"flex flex-col items-center gap-8 max-w-2xl w-full",children:[n.jsx(H$.div,t?.logoUrl?{className:"w-24 h-24 sm:w-32 sm:h-32 flex items-center justify-center rounded-xl overflow-hidden bg-card shadow-md border",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:n.jsx("img",{src:t.logoUrl,alt:"Brand Logo",className:"max-w-full max-h-full object-contain"})}:{className:"w-24 h-24 sm:w-32 sm:h-32 rounded-xl flex items-center justify-center shadow-md border bg-primary",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:t?.brandName?n.jsx("span",{className:"text-4xl sm:text-5xl font-bold text-white",children:t.brandName.charAt(0)}):n.jsx(ad,{className:"w-12 h-12 sm:w-16 sm:h-16 text-white"})}),n.jsx(H$.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-xl font-medium text-center text-foreground",children:s[r].text},`loading-${r}`),n.jsx("div",{className:"flex items-center justify-center space-x-8 sm:space-x-12",children:s.map(((e,a)=>{const t=a<=r,i=a===r;return n.jsxs(H$.div,{className:"relative flex items-center justify-center w-12 h-12 rounded-full border-2 "+(t?"bg-card shadow-md border-primary":"bg-muted border-muted-foreground/30"),initial:{scale:.8,opacity:.5},animate:{scale:i?1.1:1,opacity:t?1:.5},transition:{duration:.3},children:[n.jsx(e.icon,{className:"w-5 h-5 "+(t?"text-primary":"text-muted-foreground")}),i&&n.jsx(H$.div,{className:"absolute inset-0 rounded-full border-2 border-primary",initial:{scale:1,opacity:.8},animate:{scale:2.5,opacity:0},transition:{duration:3,repeat:1/0,ease:"easeOut"}})]},`step-${a}`)}))}),n.jsx(H$.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.8,duration:.6},className:"w-full",children:n.jsx("div",{className:"h-[140px] w-full max-w-lg mx-auto p-5 bg-gradient-to-br from-card/70 to-card/40 backdrop-blur-md rounded-2xl border border-border/60 shadow-lg",children:n.jsxs("div",{className:"h-full flex flex-col justify-center",children:[0===r&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80 text-center",children:"Extracted Color Palette"}),n.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[t?.primaryColor,...t?.secondaryColors||[]]?.slice(0,4).map(((e,a)=>n.jsx("div",{className:"flex flex-col items-center gap-1",children:n.jsx("div",{className:"w-10 h-10 rounded-xl border-2 border-white/50 shadow-md",style:{backgroundColor:e}})},a)))}),n.jsx("div",{className:"text-center text-xs text-muted-foreground",children:"Brand colors identified"})]}),1===r&&n.jsxs("div",{className:"text-center space-y-2",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Identity"}),t?.brandName?n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xl font-bold",children:t.brandName}),t.brandTagline&&n.jsxs("div",{className:"text-sm text-muted-foreground italic px-4",children:['"',t.brandTagline,'"']}),n.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Visual identity extracted"})]}):n.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Extracting brand elements..."})]}),2===r&&n.jsxs("div",{className:"text-center space-y-3",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Personality"}),t?.brandPersonality?n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex justify-center gap-4",children:[t.brandPersonality.tone&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Tone"}),n.jsx("div",{className:"text-sm font-medium text-foreground capitalize px-2 py-1 bg-background/50 rounded-md",children:t.brandPersonality.tone})]}),t.brandPersonality.voice&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Voice"}),n.jsx("div",{className:"text-sm font-medium text-foreground capitalize px-2 py-1 bg-background/50 rounded-md",children:t.brandPersonality.voice})]})]}),t.brandPersonality.values&&t.brandPersonality.values.length>0&&n.jsx("div",{className:"flex justify-center gap-1 flex-wrap",children:t.brandPersonality.values.slice(0,3).map(((e,a)=>n.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded-full",children:e},a)))})]}):n.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Analyzing brand tone and voice..."})]}),3===r&&n.jsxs("div",{className:"text-center space-y-3",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Email Template Preview"}),n.jsxs("div",{className:"bg-background/60 rounded-lg p-3 border border-border/30",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-4 h-4 rounded"}),n.jsx("div",{className:"text-xs font-medium text-foreground",children:t?.brandName||"Your Brand"})]}),n.jsxs("div",{className:"text-xs text-muted-foreground text-left",children:["Email styling applied with your brand colors",t?.brandPersonality?.tone&&`, ${t.brandPersonality.tone} tone`,", and visual identity"]})]})]}),4===r&&n.jsxs("div",{className:"text-center space-y-2",children:[n.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Kit Complete"}),n.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[n.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Identity"}),n.jsx("div",{className:"text-sm font-medium text-foreground",children:t?.brandName?"✓":"—"})]}),n.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Colors"}),n.jsx("div",{className:"text-sm font-medium text-foreground",children:t?.primaryColor?"✓":"—"})]}),n.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:"Personality"}),n.jsx("div",{className:"text-sm font-medium text-foreground",children:t?.brandPersonality?.tone?"✓":"—"})]})]})]}),(0===r&&!t?.primaryColor&&!t?.colorPalette||1===r&&!t?.brandName||2===r&&!t?.brandPersonality)&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Analyzing brand data..."}),n.jsx("div",{className:"flex justify-center gap-1 mt-2",children:[...Array(3)].map(((e,a)=>n.jsx(H$.div,{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/50",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:1,repeat:1/0,delay:.2*a}},a)))})]})]})})},`content-${r}`)]})})},rge=({setAutoParse:e,onBrandSettingsGenerated:t,onForceRefresh:i})=>{const{data:r,updateWebsite:o,isUpdatingWebsite:s,updateBrandSettings:l}=Poe(),u=ke({mutationFn:tge,mutationKey:nge.brandSettings()}),[c,d]=a.useState(r?.website||""),[m,h]=a.useState(!1),[p,g]=a.useState(null),[v,f]=a.useState(!1),[y,k]=a.useState(!1),b=()=>{e(!1)};return y&&p?n.jsx(H$.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:n.jsx(sge,{initialBrandSettings:p,onSave:()=>{p&&(l({logoBase64:p.logo_base64,primaryColor:p.primaryColor,secondaryColors:p.secondaryColors,brandTagline:p.brandTagline,brandName:p.brandName,brandPersonality:p.brandPersonality,colorPalette:p.colorPalette}),i&&i(),Oe({title:"Brand settings saved successfully 🚀",description:"Your brand identity has been updated."}),e(!1))},onBack:b,showAutoParseButton:!1})},"results"):n.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[n.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:n.jsxs(aV,{mode:"wait",children:[!v&&!y&&n.jsx(H$.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col h-full",children:n.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 space-y-8",children:[n.jsxs("div",{className:"space-y-2 w-full max-w-md",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block text-center",children:"Your Website URL"}),n.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-center",children:[n.jsx(o4,{type:"url",value:c,onChange:e=>d(e.target.value),placeholder:"https://example.com",className:"flex-1",disabled:!m}),n.jsx(aV,{mode:"wait",children:m?n.jsxs(H$.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex gap-2",children:[n.jsx(jY,{variant:"outline",size:"sm",onClick:()=>{h(!1),d(r?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),n.jsx(jY,{size:"sm",onClick:async()=>{try{o(c),h(!1),Oe({title:"Website URL updated successfully 🎉",description:"Your website URL has been saved."})}catch(e){Oe({title:"Error updating website URL",description:"Please try again.",variant:"destructive"})}},disabled:s||!c,className:"w-full sm:w-auto",children:s?n.jsx(xY,{}):"Save Changes"})]},"save"):n.jsx(H$.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:n.jsx(jY,{variant:"outline",size:"sm",onClick:()=>h(!0),className:"w-full sm:w-auto",children:"Edit URL"})},"edit")})]})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl",children:[n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[n.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"What we'll analyze"}),n.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[n.jsx("li",{children:"• Your brand colors and color palette"}),n.jsx("li",{children:"• Your logo (if detectable)"}),n.jsx("li",{children:"• Your brand name and tagline"}),n.jsx("li",{children:"• Your brand's tone and personality"})]})]}),n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[n.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"How it helps you"}),n.jsx("p",{className:"text-sm text-gray-600",children:"Our AI will automatically extract your brand assets to create consistently styled emails that match your website. This helps maintain brand recognition and professionalism in all your communications."})]})]}),n.jsx(H$.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"text-sm text-muted-foreground text-center max-w-md",children:"We'll use AI to analyze your website and extract your brand elements to create perfectly matched email templates."})]})},"url-confirmation"),v&&p&&n.jsx(H$.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:n.jsx(ige,{isLoading:v,brandSettings:p,onComplete:()=>{f(!1),k(!0),Oe({title:"Brand settings generated successfully!",description:"Your brand identity has been analyzed."})}})},"analyzing"),v&&!p&&n.jsx(H$.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 flex flex-col items-center justify-center h-full",children:n.jsxs(H$.div,{className:"flex flex-col items-center gap-8",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:5,repeat:1/0,repeatType:"reverse"},children:[n.jsxs(H$.div,{className:"relative w-24 h-24 flex items-center justify-center",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:[n.jsx($c,{className:"w-12 h-12 text-primary drop-shadow-md"}),n.jsx(H$.div,{className:"absolute inset-0 rounded-full border-2",style:{borderColor:"var(--primary)"},initial:{scale:1,opacity:.8},animate:{scale:2.5,opacity:0},transition:{duration:3,repeat:1/0,ease:"easeOut"}})]}),n.jsxs("div",{className:"text-center space-y-2",children:[n.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:"Analyzing your website"}),n.jsx(aV,{mode:"wait",children:n.jsx(H$.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-gray-600 max-w-md text-center px-4",children:"Generating your brand's unique visual identity and personality"},"loading-message")})]})]})},"pre-analyzing")]})}),!v&&!y&&n.jsxs(HG,{className:"p-4",children:[n.jsx(jY,{variant:"outline",onClick:b,className:"gap-1",children:"Go Back"}),n.jsxs(jY,{onClick:async()=>{try{f(!0);const e=await u.mutateAsync();g(e),t&&t(e)}catch(e){f(!1),g(null),Oe({title:"Error generating brand settings",description:"Please try again.",variant:"destructive"})}},disabled:!c||u.isPending,className:"gap-1",children:[n.jsx(ad,{className:"h-4 w-4 text-amber-500"}),u.isPending?n.jsx(xY,{}):"Analyze Website"]})]})]})},oge=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],sge=({initialBrandSettings:e,onSave:t,onBack:i,showAutoParseButton:r=!0})=>{const{data:o,isLoading:s,updateBrandSettings:l,isUpdatingBrandSettings:u}=Poe(),[c,d]=a.useState({}),[m,h]=a.useState(!1),[p,g]=a.useState({}),[v,f]=a.useState(""),[y,k]=a.useState(""),[b,S]=a.useState("#000000"),[A,w]=a.useState(Date.now()),[C,M]=a.useState(!1),[T,N]=a.useState(null),[x,E]=a.useState({identity:!0,colors:!0,personality:!0}),P=a.useRef(null),{toast:j}=Ie();a.useEffect((()=>{if(e)return d({brandName:e.brandName,brandTagline:e.brandTagline,logoUrl:e.logoUrl,primaryColor:e.primaryColor||"#000000",secondaryColors:e.secondaryColors||[],brandPersonality:{tone:e.brandPersonality?.tone,voice:e.brandPersonality?.voice,values:e.brandPersonality?.values||[]}}),void w(Date.now());o?.branding&&(d({brandName:o.branding.brandName||o.name,brandTagline:o.branding.brandTagline||"",logoUrl:o.branding.logoUrl||"",primaryColor:o.branding.primaryColor||"#000000",secondaryColors:o.branding.secondaryColors||[],brandPersonality:{tone:o.branding.brandPersonality?.tone,voice:o.branding.brandPersonality?.voice,values:o.branding.brandPersonality?.values||[]}}),w(Date.now()))}),[o,e]);const L=e=>{E((a=>({...a,[e]:!a[e]})))},B=e=>{g((a=>{const n={...a,[e]:!a[e]};return n[e]&&("brandName"===e?f(c.brandName||""):"brandTagline"===e?f(c.brandTagline||""):"primaryColor"===e?f(c.primaryColor||"#000000"):"tone"===e?f(c.brandPersonality?.tone||""):"voice"===e&&f(c.brandPersonality?.voice||"")),n}))},z=e=>{"brandName"===e?d((e=>({...e,brandName:v}))):"brandTagline"===e?d((e=>({...e,brandTagline:v}))):"primaryColor"===e?d((e=>({...e,primaryColor:v}))):"tone"===e?d((e=>({...e,brandPersonality:{...e.brandPersonality,tone:v||void 0}}))):"voice"===e&&d((e=>({...e,brandPersonality:{...e.brandPersonality,voice:v||void 0}}))),B(e)},R=e=>{B(e)},_=e=>{d((a=>({...a,primaryColor:e})))},D=()=>{y.trim()&&(d((e=>{const a=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:[...a,y.trim()]}}})),k(""))};return s?n.jsx("div",{className:"flex justify-center items-center h-full min-h-[500px] w-full bg-white rounded-lg shadow-sm",children:n.jsx(xY,{})}):m?n.jsx(rge,{setAutoParse:h,onForceRefresh:()=>w(Date.now())}):n.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16",children:[n.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 px-6 pt-2",children:[n.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>L("identity"),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:c.primaryColor||"#000000"}}),n.jsx("h3",{className:"text-base font-medium",children:"Brand Identity"})]}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:n.jsx(x.identity?Sc:yc,{className:"h-4 w-4"})})]}),x.identity&&n.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Name"}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("brandName"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),p.brandName?n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{value:v,onChange:e=>f(e.target.value),className:"flex-1",autoFocus:!0}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>R("brandName"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>z("brandName"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}):n.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm font-medium",children:c.brandName})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Tagline"}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("brandTagline"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),p.brandTagline?n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{value:v,onChange:e=>f(e.target.value),className:"flex-1",autoFocus:!0,placeholder:"Your brand's tagline"}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>R("brandTagline"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>z("brandTagline"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}):n.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm italic",children:c.brandTagline||"No tagline set"})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center justify-between mb-3",children:n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Logo"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Square image, 128x128px, PNG recommended"})]})}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs("div",{className:"relative group",children:[n.jsx("div",{className:"w-24 h-24 rounded-lg border-2 border-dashed border-gray-200 flex items-center justify-center bg-gray-50 overflow-hidden",children:c.logoUrl?n.jsx("img",{src:c?.logoUrl,alt:c.brandName||"Brand logo",className:"w-full h-full object-contain"},A):n.jsx(Bc,{className:"h-10 w-10 text-gray-300"})}),n.jsxs("div",{className:"absolute inset-0 bg-black bg-opacity-40 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:[n.jsx("input",{type:"file",ref:P,onChange:e=>{const a=e.target.files?.[0];if(a){const e=new FileReader;e.onloadend=async()=>{const n=e.result.split(",")[1];N(n);const t=URL.createObjectURL(a);d((e=>({...e,logoUrl:t}))),w(Date.now()),l({logoBase64:n})},e.readAsDataURL(a)}},accept:"image/*",className:"hidden"}),n.jsxs(jY,{variant:"ghost",size:"sm",onClick:()=>{P.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[n.jsx(rd,{className:"h-4 w-4 mr-1"}),"Update"]})]})]}),c.logoUrl&&n.jsxs("div",{className:"flex-1 flex items-center gap-2 max-w-md bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[n.jsx("div",{className:"flex-1 truncate text-sm text-gray-600 font-mono",children:c.logoUrl}),n.jsxs(jY,{variant:"ghost",size:"sm",onClick:async()=>{if(c.logoUrl)try{await navigator.clipboard.writeText(c.logoUrl),M(!0),setTimeout((()=>M(!1)),1500),j({title:"Logo URL copied to clipboard"})}catch(cBe){try{const e=document.createElement("textarea");e.value=c.logoUrl,e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.focus(),e.select();const a=document.execCommand("copy");if(document.body.removeChild(e),!a)throw new Error("Fallback copy command failed");M(!0),setTimeout((()=>M(!1)),1500),j({title:"Logo URL copied to clipboard"})}catch(e){j({title:"Failed to copy URL",description:"Could not copy the URL to clipboard. Please try again or copy manually.",variant:"destructive"})}}},className:"h-7 px-2 text-xs shrink-0",children:[C?n.jsx(fc,{className:"h-3.5 w-3.5 mr-1 text-green-500"}):n.jsx(xc,{className:"h-3.5 w-3.5 mr-1"}),C?"Copied":"Copy"]})]})]})]})]})]}),n.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>L("colors"),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:c.primaryColor||"#000000"}}),n.jsx("h3",{className:"text-base font-medium",children:"Brand Colors"})]}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:n.jsx(x.colors?Sc:yc,{className:"h-4 w-4"})})]}),x.colors&&n.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Primary Color"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Your main brand color used throughout the interface"})]}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("primaryColor"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("div",{className:"w-14 h-14 rounded-lg shadow-md",style:{backgroundColor:c.primaryColor||"#000000"}}),n.jsxs("div",p.primaryColor?{className:"flex flex-1 gap-2 max-w-sm",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Vc,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),n.jsx(o4,{type:"text",value:v,onChange:e=>f(e.target.value),className:"pl-10 h-10 font-mono text-sm flex-1",placeholder:"#000000",maxLength:7,autoFocus:!0})]}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>R("primaryColor"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>z("primaryColor"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}:{className:"flex-1 max-w-sm",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[n.jsx(Vc,{className:"h-4 w-4 text-gray-400"}),n.jsx("div",{className:"text-sm font-mono",children:c.primaryColor||"#000000"})]}),n.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[n.jsx(o4,{type:"color",value:c.primaryColor||"#000000",onChange:e=>_(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),n.jsx("div",{className:"flex gap-1 flex-wrap",children:oge.map(((e,a)=>n.jsx(jY,{variant:"ghost",size:"icon",className:"w-6 h-6 rounded-full border border-gray-200 "+(c.primaryColor===e?"ring-2 ring-gray-400 ring-offset-1":""),style:{backgroundColor:e},onClick:()=>_(e)},a)))})]})]})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center justify-between mb-2",children:n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Secondary Colors"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Additional colors that complement your primary brand color"})]})}),n.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[n.jsx("div",{className:"flex flex-wrap gap-3 mb-4",children:c.secondaryColors?.length?c.secondaryColors.map(((e,a)=>n.jsxs("div",{className:"group relative flex flex-col items-center",children:[n.jsx("div",{className:"w-12 h-12 rounded-lg shadow-sm border border-gray-200 mb-1 group-hover:ring-2 ring-gray-200",style:{backgroundColor:e}}),n.jsx("div",{className:"text-xs font-mono text-gray-600",children:e}),n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>{return a=e,void d((e=>{const n=e.secondaryColors||[];return{...e,secondaryColors:n.filter((e=>e!==a))}}));var a},className:"absolute -top-1 -right-1 w-5 h-5 bg-white rounded-full shadow border border-gray-200 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:n.jsx(cd,{className:"w-3 h-3 text-gray-500"})})]},a))):n.jsx("div",{className:"text-sm text-gray-500 italic my-2",children:"No secondary colors set"})}),n.jsxs("div",{className:"flex items-end gap-3",children:[n.jsxs("div",{className:"flex-1 max-w-xs",children:[n.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Add color"}),n.jsxs("div",{className:"flex gap-2 items-center",children:[n.jsx(o4,{type:"color",value:b,onChange:e=>S(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded-md"}),n.jsx(o4,{type:"text",value:b,onChange:e=>S(e.target.value),className:"h-10 font-mono text-sm",placeholder:"#000000",maxLength:7})]})]}),n.jsxs(jY,{variant:"outline",onClick:()=>{b&&(d((e=>{const a=e.secondaryColors||[];return{...e,secondaryColors:[...a,b]}})),S("#000000"))},className:"h-10",children:[n.jsx(qc,{className:"h-4 w-4 mr-1"}),"Add Color"]})]})]})]})]})]}),n.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>L("personality"),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:c.primaryColor||"#000000"}}),n.jsx("h3",{className:"text-base font-medium",children:"Brand Personality"})]}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:n.jsx(x.personality?Sc:yc,{className:"h-4 w-4"})})]}),x.personality&&n.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Tone"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"The overall feeling and attitude your brand conveys"})]}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("tone"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),p.tone?n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{type:"text",value:v,onChange:e=>f(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>R("tone"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>z("tone"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}):n.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:c.brandPersonality?.tone||"No tone set"})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Voice"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"How your brand expresses itself in communication"})]}),n.jsx(jY,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>B("voice"),children:n.jsx(Fc,{className:"h-3.5 w-3.5 text-gray-500"})})]}),p.voice?n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{type:"text",value:v,onChange:e=>f(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>R("voice"),children:n.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),n.jsx(jY,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>z("voice"),children:n.jsx(fc,{className:"h-4 w-4 text-green-500"})})]})]}):n.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:c.brandPersonality?.voice||"No voice set"})]})]}),n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center justify-between mb-2",children:n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Values"}),n.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Core principles and beliefs that drive your brand"})]})}),n.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[n.jsx("div",{className:"mb-4",children:n.jsx("div",c.brandPersonality?.values&&c.brandPersonality.values.length>0?{className:"flex flex-wrap gap-2",children:c.brandPersonality.values.map(((e,a)=>n.jsxs(UY,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",style:{borderColor:`${c.primaryColor}30`||"#f3f4f6",backgroundColor:`${c.primaryColor}08`||"#f9fafb"},children:[e,n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>{return a=e,void d((e=>{const n=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:n.filter((e=>e!==a))}}}));var a},className:"ml-1.5 w-4 h-4 flex items-center justify-center rounded-full bg-gray-200 hover:bg-red-100 hover:text-red-500 transition-colors",children:n.jsx(cd,{className:"w-2.5 h-2.5"})})]},a)))}:{className:"text-sm text-gray-500 italic py-2",children:"No brand values set"})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(o4,{placeholder:"Add a brand value",value:y,onChange:e=>k(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&D()}),n.jsxs(jY,{variant:"outline",onClick:D,disabled:!y.trim(),children:[n.jsx(qc,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),n.jsxs(HG,{className:"pb-4 px-6",children:[i?n.jsx(jY,{variant:"outline",className:"gap-1.5",onClick:i,children:"Go Back"}):r&&n.jsxs(jY,{variant:"outline",className:"gap-1.5",onClick:()=>{h(!0)},children:[n.jsx(ad,{className:"h-4 w-4 text-amber-500"}),"Auto Parse"]}),n.jsx(jY,{className:"px-4",onClick:async()=>{let e;T?e=T:c.logoUrl?.startsWith("data:image/png;base64,")?e=c.logoUrl.split(",")[1]:c.logoUrl?.startsWith("blob:")&&(e=void 0),l({brandName:c.brandName,brandTagline:c.brandTagline,logoBase64:e,primaryColor:c.primaryColor,secondaryColors:c.secondaryColors,brandPersonality:c.brandPersonality}),j({title:"Brand settings saved 🚀"}),t&&t(),N(null)},disabled:u,children:u?"Saving":"Save Changes"})]})]})},lge=oee.object({channelSenderId:oee.string().min(1,"Please select a channel sender"),replyTo:oee.string().trim().min(1).email("Please enter a valid email address").or(oee.literal("").transform((()=>null))).or(oee.null()).optional(),fromName:oee.string().trim().min(1).or(oee.literal("").transform((()=>null))).or(oee.null()).optional()}),uge=()=>{const{channelSenders:e,isLoading:t}=x9(),{channelAccounts:i,isLoading:r}=M9(),{updateChannelSender:o,isUpdating:s}=E9(),{toast:l}=Ie(),u=ooe({resolver:moe(lge),defaultValues:{channelSenderId:"",replyTo:"",fromName:""}}),c=a.useMemo((()=>zie({channelSenders:e?.results??[],channelAccounts:i?.results??[]})),[e?.results,i?.results]);if(a.useEffect((()=>{if(c&&c.length>0&&!u.getValues("channelSenderId")){const e=c[0];u.setValue("channelSenderId",e.channelSenderId),u.setValue("replyTo",e.channelSender.channelSenderMetadata.emailReplyTo??""),u.setValue("fromName",e.channelSender.channelSenderMetadata.emailFromName??"")}}),[c,u]),t||void 0===e||r||void 0===i)return n.jsx("div",{className:"flex justify-center items-center h-full py-10",children:n.jsx(xY,{})});return n.jsxs("div",{className:"w-full max-w-4xl mx-auto mt-8",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-gray-900 mb-1",children:"Set up Your Email Channel"}),n.jsx("p",{className:"text-muted-foreground text-base",children:"Define your default sender name, email address, and reply-to to start sending emails with confidence."})]}),n.jsx(hoe,{...u,children:n.jsxs("form",{onSubmit:u.handleSubmit((async e=>{const a=c.find((a=>a.channelSenderId===e.channelSenderId));a&&o({toUpdate:{channelSenderMetadata:{...a.channelSender.channelSenderMetadata,emailReplyTo:e.replyTo?e.replyTo:null,emailFromName:e.fromName?e.fromName:null}},id:a.channelSender.id},{onSuccess:()=>{l({title:"Email channel sender updated successfully!"})},onError:()=>{l({title:"Failed to update email channel sender",description:"Please contact your administrator",variant:"destructive"})}})})),className:"bg-white border border-gray-200 rounded-2xl shadow-sm p-8 space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[n.jsx(koe,{className:"flex items-center gap-1 text-base font-medium mb-2",children:"Email Channel Sender"}),n.jsxs(hie,{value:u.watch("channelSenderId"),onValueChange:e=>{u.setValue("channelSenderId",e);const a=c.find((a=>a.channelSenderId===e));a&&u.setValue("replyTo",a.channelSender.channelSenderMetadata.emailReplyTo??"")},children:[n.jsx(vie,{className:"w-full bg-gray-50 border-gray-200 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 rounded-lg min-h-[48px] text-base",children:n.jsx(gie,{placeholder:"Select a sender"})}),n.jsx(kie,{children:c.map((e=>n.jsx(bie,{value:e.channelSenderId,children:n.jsxs("div",{className:"flex flex-col text-left",children:[n.jsx("span",{className:"font-medium",children:e.fullDomain}),n.jsx("span",{className:"text-xs text-muted-foreground",children:e.channelSender.channelSenderMetadata.emailReplyTo||"No reply-to set"})]})},e.channelSenderId)))})]})]}),n.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[n.jsxs(koe,{className:"flex items-center gap-1 text-base font-medium mb-0.5",children:["Reply-to Email",n.jsx(Mae,{title:"Reply to email to use when the reply button is clicked"})]}),n.jsxs("span",{className:"text-xs text-muted-foreground font-normal mb-1",children:["Optional – will use"," ",n.jsx("span",{className:"font-mono",children:u.watch("channelSenderId")?c.find((e=>e.channelSenderId===u.watch("channelSenderId")))?.fullDomain:"sender domain"})," ","if empty"]}),n.jsx(Coe,{control:u.control,name:"replyTo",type:"email",placeholder:"Replies from recipients will go to this email (optional)"})]}),n.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[n.jsxs(koe,{className:"flex items-center gap-1 text-base font-medium mb-0.5",children:["From Name",n.jsx(Mae,{title:"From name to use when the email is sent"})]}),n.jsx(Coe,{control:u.control,name:"fromName",placeholder:"From name to use when the email is sent"})]}),n.jsx("div",{className:"flex gap-3 pt-4 justify-end border-t border-gray-100",children:n.jsx(jY,{type:"submit",disabled:s,className:"min-w-[120px]",children:s?"Saving...":"Save"})})]})})]})},cge=()=>n.jsx("div",{className:"w-full max-w-4xl mx-auto mt-8",children:n.jsx(Toe,{})});function dge({tabs:e,activeTab:a,onTabChange:t,title:i}){return n.jsxs("div",{className:"flex h-full",children:[n.jsxs("div",{className:"w-48 py-2 pl-4",children:[i&&n.jsx("h2",{className:"px-4 pt-4 pb-5 text-lg font-medium",children:i}),e.map((e=>n.jsx(jY,{variant:"ghost",className:im("w-full justify-start mb-1",a===e.id&&"bg-accent"),onClick:()=>t(e.id),children:e.label},e.id)))]}),n.jsx("div",{className:"flex-1 overflow-y-auto pl-6 pr-4 pb-4",children:e.find((e=>e.id===a))?.content})]})}function mge({open:e,setOpen:t}){const[i,r]=a.useState("brand");a.useEffect((()=>{e&&r("brand")}),[e]);const o=[{id:"brand",label:"Brand",content:n.jsx(sge,{})},{id:"email-channel",label:"Email Channel",content:n.jsx(uge,{})},{id:"sms-channel",label:"SMS Channel",content:n.jsx(cge,{})}];return n.jsx(BG,{open:e,onOpenChange:t,children:n.jsxs(DG,{className:"flex w-[90vw] h-[90vh] flex-col gap-0 overflow-hidden sm:max-w-xl md:max-w-3xl lg:max-w-4xl xl:max-w-5xl p-0",children:[n.jsxs(uO,{children:[n.jsx(OG,{children:"Settings"}),n.jsx(IG,{children:"Edit your business and brand settings"})]}),n.jsx("div",{className:"flex-1 overflow-hidden",children:n.jsx(dge,{tabs:o,activeTab:i,onTabChange:r,title:"Settings"})})]})})}const hge=e=>{const{updateAutomation:n,updateError:t,isUpdateSuccess:i}=Je(e),{toast:r}=Ie();return a.useEffect((()=>{i?r({title:"Status updated",description:"The status has been updated successfully"}):t&&r({title:"Error updating status",description:"Please try again",variant:"destructive"})}),[i,t,r]),{toggleStatus:async e=>{try{return await n({status:e?Xe.ACTIVE:Xe.DRAFT}),!0}catch(a){return r({title:"Error updating status",description:"Please try again",variant:"destructive"}),!1}}}};function pge(){const{toast:e}=Ie(),[t,i]=a.useState(null),{toggleStatus:r}=hge(t||""),o=o5(),[s,l]=a.useState(10),[u,c]=a.useState(void 0),[d,m]=a.useState(""),{automations:h,nextCursor:p,isLoading:g,error:v,isFetching:f,isPlaceholderData:y}=We({cursor:u,limit:s,triggerType:Ze.TRIGGER_BASED,search:d||void 0});a.useEffect((()=>{v&&e({title:`Error Fetching ${yh("engage:automation")}`,description:v?.message||"Please try again.",variant:"destructive"})}),[v,e]);const k=a.useMemo((()=>(h||[]).map((e=>({...e,emailsSent:0,smsSent:0,updated_at:e.updatedAt||e.createdAt})))),[h]),b=a.useCallback((async(e,a)=>{try{i(e);const n=a===Xe.ACTIVE;await r(n)}finally{i(null)}}),[r,i]),S=a.useCallback((e=>{c(e.cursor),l(e.pageSize)}),[]),A=a.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),w=a.useMemo((()=>Cae({automationName:yh("engage:automation"),setUrl:A,onToggle:b,vsaasManaged:!0})),[b,A]);return n.jsx("div",{className:"w-full h-[75vh] flex flex-col",children:n.jsx("div",{className:"flex-grow min-h-0 p-2",children:n.jsx(l4,{data:k,columns:w,paginationMode:"cursor",initialPageSize:s,isLoading:g&&!y,onRowClick:e=>{o(`/automations/view-modal/${e.id}?showBackButton=true`)},cursorPaginationQueryResult:{nextCursor:p,isLoading:g,isFetching:f,isPlaceholderData:y},onQueryParametersChange:S,searchValue:d,onSearchChange:m})})})}function gge(){const{toast:e}=Ie(),[t,i]=a.useState(!1),[r,o]=a.useState(null),{toggleStatus:s}=hge(r||""),l=o5(),[u,c]=a.useState(10),[d,m]=a.useState(void 0),[h,p]=a.useState(""),{automations:g,nextCursor:v,isLoading:f,error:y,isFetching:k,isPlaceholderData:b}=We({cursor:d,limit:u,triggerType:Ze.ONE_TIME,search:h||void 0});a.useEffect((()=>{y&&e({title:`Error Fetching ${yh("engage:broadcast")}`,description:y?.message||"Please try again.",variant:"destructive"})}),[y,e]);const S=a.useMemo((()=>(g||[]).map((e=>({...e,updated_at:e.updatedAt})))),[g]),A=a.useCallback((async(e,a)=>{try{o(e);const n=a===Xe.ACTIVE;await s(n)}finally{o(null)}}),[s,o]),w=a.useCallback((e=>{m(e.cursor),c(e.pageSize)}),[]),C=a.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),M=a.useMemo((()=>Cae({automationName:yh("engage:broadcast"),setUrl:C,onToggle:A})),[A,C]);return n.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[n.jsx("div",{className:"flex-grow min-h-0 p-2",children:n.jsx(l4,{data:S,columns:M,paginationMode:"cursor",initialPageSize:u,headerActions:n.jsxs(jY,{className:"bg-primary",onClick:()=>i(!0),children:[n.jsx(qc,{className:"h-4 w-4 mr-1"}),"New"]}),isLoading:f&&!b,cursorPaginationQueryResult:{nextCursor:v,isLoading:f,isFetching:k,isPlaceholderData:b},onRowClick:e=>{l(`/automations/view-modal/${e.id}?showBackButton=true`)},onQueryParametersChange:w,searchValue:h,onSearchChange:p})}),n.jsx(Gpe,{open:t,setOpen:i,onClose:a=>{gae(i,e,a,`Error creating ${yh("engage:broadcast")}`,"Please try again"),m(void 0),c(10),p(""),!1!==a&&l(`/automations/view-modal/${a}?showBackButton=true`)},automationType:Ze.ONE_TIME})]})}function vge(){const{toast:e}=Ie(),[t,i]=a.useState(!1),[r,o]=a.useState(null),[s,l]=a.useState(10),[u,c]=a.useState(void 0),[d,m]=a.useState(""),{segments:h,isLoading:p,nextCursor:g,isFetching:v,isPlaceholderData:f}=gY({search:d||void 0,cursor:u,limit:s}),y=a.useCallback((e=>{o(e),i(!0)}),[o]),k=a.useMemo((()=>function(e){return[yae("name",`${yh("engage:segment")} Name`,!0),kae(),pae({accessorKey:"user_count",header:yh("engage:user_other"),meta:{align:"right",displayName:yh("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const a=e.getValue()??0;return`${a.toLocaleString()} ${1===a?yh("engage:user").toLowerCase():yh("engage:user_other").toLowerCase()}`}}),bae("user_count_updated_at"),wae(e||(()=>{}))]}(y)),[y]),b=a.useMemo((()=>h?h.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[h]),S=a.useMemo((()=>n.jsxs(jY,{onClick:()=>{o(null),i(!0)},children:[n.jsx(qc,{className:"h-4 w-4"}),"New List"]})),[]),A=a.useCallback((e=>{c(e.cursor),l(e.pageSize)}),[]);return n.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[n.jsx("div",{className:"flex-grow min-h-0 p-2",children:n.jsx(l4,{data:b,columns:k,paginationMode:"cursor",initialPageSize:s,headerActions:S,isLoading:p&&!f,cursorPaginationQueryResult:{nextCursor:g,isLoading:p,isFetching:v,isPlaceholderData:f},onQueryParametersChange:A,onRowClick:a=>{a.type!==bY.MANAGED?(o(a.id),i(!0)):e({title:`Managed ${yh("engage:segment")} cannot be edited!`,variant:"destructive"})},searchValue:d,onSearchChange:m})}),n.jsx(Spe,{open:t,setOpen:i,segmentId:r??void 0,onSegmentUpdated:a=>{gae(i,e,a,`Error creating ${yh("engage:segment")}`,"Please try again"),c(void 0),l(10),m("")}})]})}const fge=()=>{const e=ce(),[t,i]=a.useState(!1),[r,o]=a.useState(null),{automations:s,isLoading:l}=We({triggerType:Ze.TRIGGER_BASED}),[u,c]=a.useState();return a.useEffect((()=>{e.prefetchQuery({queryKey:je.list()}),e.prefetchQuery({queryKey:hY.lists()})}),[e]),a.useEffect((()=>{if(l||void 0===s)return;const e=[{id:"broadcasts",label:yh("engage:broadcast",{count:2}),content:n.jsx(gge,{})},{id:"segments",label:yh("engage:segment",{count:2}),content:n.jsx(vge,{})},{id:"statistics",label:yh("engage:insight",{count:2}),content:n.jsx(age,{})}];s.length>0?(o("automations"),c([{id:"automations",label:yh("engage:automation",{count:2}),content:n.jsx(pge,{})},...e])):(o("broadcasts"),c(e))}),[s,l]),null===r||null==u?n.jsx("div",{className:"w-full h-full flex justify-center items-center",children:n.jsx(xY,{})}):n.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[n.jsx(mge,{open:t,setOpen:i}),n.jsx("div",{className:"flex justify-end",children:n.jsx(jY,{variant:"outline",onClick:()=>i(!0),children:n.jsx(Xc,{className:"w-4 h-4"})})}),n.jsx("div",{className:"flex-1 w-full h-full flex flex-col gap-4",children:n.jsx(Vpe,{activeTab:r,tabs:u,onTabChange:o})})]})};function yge({value:e,schema:t,onSubmit:i,fieldName:r,className:o,successMessage:s="Updated successfully",errorMessage:l="Failed to update",placeholderText:u}){const[c,d]=a.useState(!1),[m,h]=a.useState(!1),[p,g]=a.useState(0),[v,f]=a.useState(0),[y,k]=a.useState(e),[b,S]=a.useState(e),A=a.useRef(null),w=a.useRef(null),C=a.useRef(null),M=a.useRef(null),{toast:T}=Ie(),N=ooe({resolver:moe(t),defaultValues:{[r]:e}});a.useEffect((()=>{N.reset({[r]:e}),k(e),S(e)}),[e,r,N]),a.useEffect((()=>{w.current&&g(w.current.offsetWidth),M.current&&!c&&f(M.current.offsetWidth)}),[c]),a.useEffect((()=>{C.current&&y&&g(C.current.offsetWidth)}),[y]),a.useEffect((()=>{c&&A.current&&(A.current.focus(),A.current.select())}),[c]);const x=async e=>{h(!0);const a=e[r];try{await i(e),S(a),T({variant:"success",title:s}),d(!1)}catch(n){T({variant:"destructive",title:l})}finally{h(!1)}},E=()=>{N.reset(),d(!1),k(b)},P=e=>{"Escape"===e.key&&E()};return c?n.jsx(hoe,{...N,children:n.jsxs("form",{onSubmit:N.handleSubmit(x),className:LG("inline-flex items-center gap-2 min-h-[20px]",o),style:{minWidth:v?`${v}px`:"auto"},children:[n.jsx("span",{ref:C,className:"absolute invisible whitespace-pre leading-none select-none pointer-events-none",style:{font:"inherit"},children:y||b}),n.jsx(goe,{control:N.control,name:r,render:({field:e})=>n.jsx(yoe,{className:"flex-1 min-w-0",children:n.jsx(boe,{children:n.jsx("input",{...e,ref:A,style:{width:`${Math.max(p+40,120)}px`,minWidth:`${Math.max(p,100)}px`,font:"inherit"},className:"bg-transparent outline-none leading-none h-[20px] border-none p-0 m-0",onChange:a=>{e.onChange(a),k(a.target.value)},onKeyDown:P,disabled:m,onBlur:a=>{e.onBlur(),setTimeout((()=>{a.currentTarget.form?.contains(document.activeElement)||E()}),0)}})})})}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n.jsx(jY,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 p-0",onClick:E,disabled:m,children:n.jsx(cd,{className:"h-3 w-3"})}),n.jsx(jY,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 p-0",disabled:m,onClick:()=>{N.handleSubmit(x)()},children:m?n.jsx(_c,{className:"h-3 w-3 animate-spin"}):n.jsx(fc,{className:"h-3 w-3"})})]})]})}):n.jsxs("button",{ref:M,type:"button",className:LG("group relative inline-flex items-center gap-2 cursor-pointer min-h-[20px] bg-transparent border-none p-0 text-left",o),onClick:()=>d(!0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),d(!0))},"aria-label":"Edit field",children:[n.jsx("span",{ref:w,className:LG("leading-none select-none",o,{italic:!b}),children:b||u}),n.jsx(Jc,{className:"h-3 w-3 transition-opacity duration-200 flex-shrink-0 opacity-0 group-hover:opacity-100"})]})}const kge=K7({name:C7().min(2,"Title must be at least 2 characters"),description:C7()});function bge({open:e,onOpenChange:a,onDuplicationCreated:t}){const i=wY(),{toast:r}=Ie(),o=ooe({resolver:moe(kge),defaultValues:{name:`${i?.name} (copy)`,description:i?.description??""}}),{duplicateAutomation:s}=qe();return n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{className:"sm:max-w-[425px]",children:[n.jsx(KG,{children:n.jsx(OG,{children:"Duplicate Automation"})}),n.jsx(hoe,{...o,children:n.jsxs("form",{onSubmit:o.handleSubmit((async function(e){i&&e.name?s({automationId:i.id,name:e.name,description:e.description},{onSuccess:e=>{e.id&&(t?.(e.id),a(!1))}}):r({title:"Error duplicating automation",description:"Please try again. Please make sure to fill in the name of the automation."})})),className:"space-y-4",children:[n.jsxs("div",{children:["Create a copy of the",n.jsx("span",{className:"font-bold px-1 text-primary",children:i?.name}),"automation with a new title and description."]}),n.jsx(goe,{control:o.control,name:"name",render:({field:e})=>n.jsxs(yoe,{children:[n.jsx(koe,{children:"Title"}),n.jsx(boe,{children:n.jsx(o4,{...e})}),n.jsx(Soe,{})]})}),n.jsx(goe,{control:o.control,name:"description",render:({field:e})=>n.jsxs(yoe,{children:[n.jsx(koe,{children:"Description"}),n.jsx(boe,{children:n.jsx(jse,{...e})}),n.jsx(Soe,{})]})}),n.jsx(HG,{children:n.jsx(jY,{type:"submit",children:"Duplicate"})})]})})]})})}function Sge({open:e,onOpenChange:a,setIsActive:t}){const i=wY(),{updateAutomation:r}=Je(i?.id||""),{toast:o}=Ie();return n.jsx(BG,{open:e,onOpenChange:a,children:n.jsxs(DG,{className:"sm:max-w-[425px]",children:[n.jsx(KG,{children:n.jsxs(OG,{children:["Deactivate ",yh("engage:automation")]})}),n.jsxs("div",{children:["Are you sure you want to deactivate the",n.jsx("span",{className:"font-bold px-1 text-primary",children:i?.name}),yh("engage:automation"),"?"]}),n.jsxs(HG,{className:"gap-2 sm:gap-0",children:[n.jsx(jY,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),n.jsx(jY,{variant:"destructive",onClick:()=>{r({status:Xe.DRAFT}),a(!1),t(!1),o({title:`Updated ${yh("engage:automation")}`,description:`${yh("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const Age=K7({name:C7().min(2,"Title must be at least 2 characters")}),wge=K7({description:C7().max(300,"Description must be less than 300 characters")}),Cge=({showBackButton:e,onDuplicationCreated:t,onBeforeSchedule:i})=>{const r=wY(),o=o5(),{updateAutomation:s}=Je(r?.id||""),{toast:l}=Ie(),u=(()=>{const{state:e}=AY();return e.recipientStats})(),c=CY(),{data:d}=L9(),{channelSenders:m}=x9(),{channelAccounts:h}=M9(),[p,g]=a.useState(void 0),[v,f]=a.useState(!1),[y,k]=a.useState(!1),[b,S]=a.useState(!1),[A,w]=a.useState(0),C=mee({channelSenders:m?.results??[],channelAccounts:h?.results??[],smsApplication:d});a.useEffect((()=>{if(r&&void 0===p)switch(r.status){case Xe.ACTIVE:g(!0);break;case Xe.DRAFT:g(!1);break;case Xe.RUNNING:case Xe.COMPLETED:g(!0);break;case Xe.FAILED:case Xe.DEACTIVATED:g(!1);break;default:throw Dse(r.status,Xe)}}),[r,p]);const M=a.useCallback((()=>{if(!r)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});const e=async e=>{if(p&&!e)k(!0);else{if(S(!0),i&&!0===e){let e=0;for(;!u&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!u)return l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),void S(!1);const a=await i({estimatedEmailRecipients:u?.emails??0,estimatedSmsRecipients:u?.phones??0});if(!0!==a)return l({title:"Error while updating the status",description:a,variant:"destructive"}),void S(!1)}if(c?.emailHtmlBody?.includes(Bpe)){if(0===A)return l({title:zpe,variant:"warning"}),w(A+1),void S(!1);w(A+1)}switch(r.triggerType){case Ze.ONE_TIME:if(!r.triggerMetadata||!("scheduledAt"in r.triggerMetadata)||!r.triggerMetadata?.scheduledAt)return l({title:"Ensure you have selected a scheduled time",variant:"destructive"}),void S(!1);if(!c||!c.emailChannelSenderId&&!c.smsChannelSenderId)return l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"}),void S(!1);break;case Ze.TRIGGER_BASED:break;default:throw Dse(r.triggerType,Ze)}s({status:e?Xe.ACTIVE:Xe.DEACTIVATED},{onSuccess:()=>{g(e),l({title:`${yh("engage:automation")}`,description:`${yh("engage:automation")} status updated to ${e?"active":"inactive"}`}),S(!1)},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),S(!1)}})}};if(!r)return null;let a=!1,t=!0;switch(r.status){case Xe.ACTIVE:case Xe.DRAFT:a=!1;break;case Xe.DEACTIVATED:a=!0,t=!1;break;case Xe.RUNNING:a=!0,t=r.triggerType===Ze.TRIGGER_BASED;break;case Xe.COMPLETED:case Xe.FAILED:a=!0,t=!1;break;default:throw Dse(r.status,Xe)}if(!t)return n.jsx(UY,{variant:vae(r.status),children:v9[r.status]});switch(r.triggerType){case Ze.TRIGGER_BASED:return n.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[n.jsx(p?fc:Tc,{className:"w-4 h-4"}),n.jsx("div",{className:"text-[13px] font-medium",children:p?"Active":"Inactive"}),n.jsx(mpe,{checked:p,onCheckedChange:e,disabled:a})]});case Ze.ONE_TIME:{const t=C.find((e=>e.channelSender.id===c?.smsChannelSenderId));if(!r.triggerMetadata||r.triggerMetadata?.triggerType===Ze.ONE_TIME&&!r.triggerMetadata?.scheduledAt||!c?.emailChannelSenderId&&!c?.smsChannelSenderId||t&&t?.smsApplication?.application&&t?.smsApplication?.status!==dee.APPROVED){const e=()=>t?.smsApplication?.application&&t.smsApplication?.status!==dee.APPROVED?n.jsx(Mae,{title:"Please wait for your SMS application to be approved",alertText:"Before sending, we need to approve your SMS application"}):!r.triggerMetadata||!("scheduledAt"in r.triggerMetadata)||"scheduledAt"in r.triggerMetadata&&!r.triggerMetadata?.scheduledAt?n.jsx(Mae,{title:"Cannot send without a schedule time",alertText:"Before sending, please select a schedule time on the left sidebar"}):null;return n.jsxs("div",{className:"flex items-center gap-2 cursor-not-allowed",children:[n.jsx(jY,{variant:"outline",className:"flex items-center gap-2",disabled:!0,children:"Send Now"}),e()]})}if(!p){let t="Schedule Send";return r.triggerMetadata.triggerType===Ze.ONE_TIME&&r.triggerMetadata.scheduledAt&&("now"===r.triggerMetadata.scheduledAt||"now"!==r.triggerMetadata.scheduledAt&&new Date(r.triggerMetadata.scheduledAt)<new Date(Date.now()+3e5))&&(t="Send Now"),n.jsx(jY,{variant:"default",className:"flex items-center gap-2",onClick:()=>e(!p),disabled:a,children:t})}return n.jsx(jY,{variant:"outline",className:"flex items-center gap-2",onClick:()=>e(!p),disabled:a,children:"Convert to Draft"})}default:throw Dse(r.triggerType,Ze)}}),[r,l,p,i,c,s,u,A,C]);return r&&void 0!==p?n.jsxs("header",{className:"flex px-1 pt-1",children:[n.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e&&n.jsx(jY,{variant:"ghost",size:"icon",onClick:()=>o(-1),children:n.jsx(hc,{})}),n.jsxs("div",{className:"flex flex-col gap-0 items-start",children:[n.jsx(yge,{value:r.name,schema:Age,onSubmit:e=>s({name:e.name}),fieldName:"name",className:"text-lg",successMessage:"Automation name updated",errorMessage:"Failed to update automation name"}),r.automationType!==Ye.MANAGED?n.jsx(yge,{value:r.description||"",schema:wge,onSubmit:e=>s({description:e.description}),fieldName:"description",className:"text-sm "+(r.description?"text-current":"text-muted-foreground"),successMessage:"Description updated",errorMessage:"Failed to update description",placeholderText:"Describe the goal of the automation"}):r.description&&n.jsx("div",{className:"text-sm text-current",children:r.description})]})]}),n.jsxs("div",{className:"ml-auto flex gap-4 items-center",children:[n.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:r.triggerType===Ze.ONE_TIME&&n.jsx("div",{role:"button",tabIndex:0,className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",onClick:()=>f(!0),children:n.jsx(Mae,{title:"Duplicate",Icon:RY.DuplicateIcon,asChild:!1,onClick:()=>f(!0)})})}),b?n.jsx("div",{className:"flex items-center text-muted-foreground pr-2",children:n.jsx(xY,{size:"sm"})}):M()]}),n.jsx(bge,{open:v,onOpenChange:f,onDuplicationCreated:t}),n.jsx(Sge,{open:y,onOpenChange:k,setIsActive:g})]}):null},Mge=()=>{const e=wY(),{isLoading:t}=Ue(e?.id),{state:{hideSales:i,hideSms:r}}=a.useContext(cO);return!e||t?n.jsx(xY,{text:[`Fetching ${yh("engage:insight",{count:2})}`,"Finishing up"]}):n.jsx("div",{className:"h-full p-4",children:n.jsx(age,{automationId:e.id,automation:e,includeSales:!i,includeSms:!r})})},Tge=()=>{const e=wY(),[t,i]=a.useState(10),[r,o]=a.useState(void 0),[s,l]=a.useState(""),{sentCommunications:u,isLoading:c,isFetching:d,isPlaceholderData:m,fetchError:h}=Ve({automationId:e?.id??"",cursor:r,limit:t,search:s||void 0}),p=a.useCallback((e=>{o(e.cursor),i(e.pageSize)}),[]),g=[{accessorKey:"communicationsSent",id:"lastCommunication",header:"Updated At",cell:({row:e})=>{const a=e.original.communicationsSent||[];if(0===a.length)return n.jsx("span",{className:"text-gray-400",children:"None"});const t=a.reduce(((e,a)=>e&&e.updatedAt?a.updatedAt&&new Date(a.updatedAt)>new Date(e.updatedAt)?a:e:a));return t?.updatedAt?n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("span",{className:"text-sm text-gray-600",children:dae(new Date(t.updatedAt),"MMM d, yyyy h:mm a")})}):n.jsx("span",{className:"text-gray-400",children:"Not available"})}},{accessorFn:e=>`${e.firstName||""} ${e.lastName||""}`.trim(),id:"name",header:"Name",cell:({row:e})=>{const a=`${e.original.firstName||""} ${e.original.lastName||""}`.trim();return a||n.jsx("span",{className:"text-gray-400",children:"Not provided"})}},{accessorKey:"email",header:"Email",cell:({row:e})=>e.original.email||n.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"phone",header:"Phone",cell:({row:e})=>e.original.phone?yue(e.original.phone):n.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"communicationsSent",id:"communicationsSent",header:"Communications Sent",cell:({row:e})=>{const a=e.original.communicationsSent||[],t=a.filter((e=>e.type===ea.EMAIL)),i=a.filter((e=>e.type===ea.SMS)),r=t.length>0,o=i.length>0,s=t.some((e=>e.delivered)),l=i.some((e=>e.delivered));return n.jsxs("div",{className:"flex items-center gap-3",children:[r&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsxs("div",{className:"relative",children:[n.jsx(RY.EmailIcon,{className:"h-4 w-4 "+(s?"text-green-500":"text-gray-400")}),s&&n.jsx("div",{className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white"})]}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm font-medium",children:"Email"}),n.jsx("span",{className:"text-xs "+(s?"text-green-600":"text-gray-500"),children:s?"Delivered":"Pending"})]})]}),r&&o&&n.jsx("div",{className:"h-8 w-px bg-gray-200"}),o&&n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsxs("div",{className:"relative",children:[n.jsx(RY.SmsIcon,{className:"h-4 w-4 "+(l?"text-green-500":"text-gray-400")}),l&&n.jsx("div",{className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white"})]}),n.jsxs("div",{className:"flex flex-col",children:[n.jsx("span",{className:"text-sm font-medium",children:"SMS"}),n.jsx("span",{className:"text-xs "+(l?"text-green-600":"text-gray-500"),children:l?"Delivered":"Pending"})]})]}),!r&&!o&&n.jsx("span",{className:"text-sm text-gray-400",children:"None"})]})}}];return e&&!c&&u?h?n.jsxs("div",{children:["Error: ",h.message]}):!u||!s&&0===u.results.length?n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[n.jsx("div",{className:"mb-4",children:n.jsx(RY.UserIcon,{className:"h-12 w-12 text-gray-400"})}),n.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Communications Sent Yet"}),n.jsxs("p",{className:"text-gray-500",children:["This"," ",yh(e.triggerType===Ze.ONE_TIME?"engage:broadcast":"engage:automation")," ","hasn't sent any communications yet. Please check back later to see recipient details once communications have been sent."]})]}):n.jsx("div",{className:"h-full p-4",children:n.jsx(l4,{data:u.results,columns:g,paginationMode:"cursor",initialPageSize:t,isLoading:c&&!m,cursorPaginationQueryResult:{nextCursor:u.pagination.cursor,isLoading:c,isFetching:d,isPlaceholderData:m},onQueryParametersChange:p,searchValue:s,onSearchChange:l})}):n.jsx(xY,{text:["Fetching Recipients","Finishing up"]})},Nge=()=>{const e=wY();return e?e?.triggerType===Ze.ONE_TIME&&e?.status===Xe.DRAFT?n.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[n.jsx("div",{className:"mb-4",children:n.jsx(RY.UserIcon,{className:"h-12 w-12 text-gray-400"})}),n.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Recipients Available Yet"}),n.jsxs("p",{className:"text-gray-500",children:["Recipients will be available once this"," ",yh(e.triggerType===Ze.ONE_TIME?"engage:broadcast":"engage:automation")," ","has completed running. Please check back after the automation has finished."]})]}):n.jsx(Tge,{}):n.jsx(xY,{text:["Fetching Recipients","Finishing up"]})},xge=a.createContext(null);xge.displayName="PanelGroupContext";const Ege="data-panel-group",Pge="data-panel-group-direction",jge="data-panel-group-id",Lge="data-panel",Bge="data-panel-collapsible",zge="data-panel-id",Rge="data-panel-size",_ge="data-resize-handle",Dge="data-resize-handle-active",Kge="data-panel-resize-handle-enabled",Hge="data-panel-resize-handle-id",Oge="data-resize-handle-state",Ige=a.useLayoutEffect,Gge=r["useId".toString()],Vge="function"==typeof Gge?Gge:()=>null;let Fge=0;function Jge(e=null){const n=Vge(),t=a.useRef(e||n||null);return null===t.current&&(t.current=""+Fge++),null!=e?e:t.current}function Uge({children:e,className:n="",collapsedSize:t,collapsible:i,defaultSize:r,forwardedRef:o,id:s,maxSize:l,minSize:u,onCollapse:c,onExpand:d,onResize:m,order:h,style:p,tagName:g="div",...v}){const f=a.useContext(xge);if(null===f)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:k,getPanelSize:b,getPanelStyle:S,groupId:A,isPanelCollapsed:w,reevaluatePanelConstraints:C,registerPanel:M,resizePanel:T,unregisterPanel:N}=f,x=Jge(s),E=a.useRef({callbacks:{onCollapse:c,onExpand:d,onResize:m},constraints:{collapsedSize:t,collapsible:i,defaultSize:r,maxSize:l,minSize:u},id:x,idIsFromProps:void 0!==s,order:h});a.useRef({didLogMissingDefaultSizeWarning:!1}),Ige((()=>{const{callbacks:e,constraints:a}=E.current,n={...a};E.current.id=x,E.current.idIsFromProps=void 0!==s,E.current.order=h,e.onCollapse=c,e.onExpand=d,e.onResize=m,a.collapsedSize=t,a.collapsible=i,a.defaultSize=r,a.maxSize=l,a.minSize=u,n.collapsedSize===a.collapsedSize&&n.collapsible===a.collapsible&&n.maxSize===a.maxSize&&n.minSize===a.minSize||C(E.current,n)})),Ige((()=>{const e=E.current;return M(e),()=>{N(e)}}),[h,x,M,N]),a.useImperativeHandle(o,(()=>({collapse:()=>{y(E.current)},expand:e=>{k(E.current,e)},getId:()=>x,getSize:()=>b(E.current),isCollapsed:()=>w(E.current),isExpanded:()=>!w(E.current),resize:e=>{T(E.current,e)}})),[y,k,b,w,x,T]);const P=S(E.current,r);return a.createElement(g,{...v,children:e,className:n,id:x,style:{...P,...p},[jge]:A,[Lge]:"",[Bge]:i||void 0,[zge]:x,[Rge]:parseFloat(""+P.flexGrow).toFixed(1)})}const Wge=a.forwardRef(((e,n)=>a.createElement(Uge,{...e,forwardedRef:n})));Uge.displayName="Panel",Wge.displayName="forwardRef(Panel)";let qge=null,Zge=-1,$ge=null;function Yge(e,a){var n,t;const i=function(e,a){if(a){const e=!!(a&cve),n=!!(a&dve);if(a&lve)return e?"se-resize":n?"ne-resize":"e-resize";if(a&uve)return e?"sw-resize":n?"nw-resize":"w-resize";if(e)return"s-resize";if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,a);if(qge!==i){var r;if(qge=i,null===$ge&&($ge=document.createElement("style"),document.head.appendChild($ge)),Zge>=0)null===(r=$ge.sheet)||void 0===r||r.removeRule(Zge);Zge=null!==(n=null===(t=$ge.sheet)||void 0===t?void 0:t.insertRule(`*{cursor: ${i} !important;}`))&&void 0!==n?n:-1}}function Qge(e){return"keydown"===e.type}function Xge(e){return e.type.startsWith("pointer")}function eve(e){return e.type.startsWith("mouse")}function ave(e){if(Xge(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(eve(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const nve=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function tve(e){const a=getComputedStyle(e);return"fixed"===a.position||(!("auto"===a.zIndex||"static"===a.position&&!function(e){var a;const n=getComputedStyle(null!==(a=sve(e))&&void 0!==a?a:e).display;return"flex"===n||"inline-flex"===n}(e))||(+a.opacity<1||("transform"in a&&"none"!==a.transform||("webkitTransform"in a&&"none"!==a.webkitTransform||("mixBlendMode"in a&&"normal"!==a.mixBlendMode||("filter"in a&&"none"!==a.filter||("webkitFilter"in a&&"none"!==a.webkitFilter||("isolation"in a&&"isolate"===a.isolation||(!!nve.test(a.willChange)||"touch"===a.webkitOverflowScrolling)))))))))}function ive(e){let a=e.length;for(;a--;){const n=e[a];if(xve(n,"Missing node"),tve(n))return n}return null}function rve(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ove(e){const a=[];for(;e;)a.push(e),e=sve(e);return a}function sve(e){const{parentNode:a}=e;return a&&a instanceof ShadowRoot?a.host:a}const lve=1,uve=2,cve=4,dve=8,mve="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let hve=[],pve=!1,gve=new Map,vve=new Map;const fve=new Set;function yve(e){const{target:a}=e,{x:n,y:t}=ave(e);pve=!0,Ave({target:a,x:n,y:t}),Tve(),hve.length>0&&(Nve("down",e),e.preventDefault(),Sve(a)||e.stopImmediatePropagation())}function kve(e){const{x:a,y:n}=ave(e);if(pve&&0===e.buttons&&(pve=!1,Nve("up",e)),!pve){const{target:t}=e;Ave({target:t,x:a,y:n})}Nve("move",e),Cve(),hve.length>0&&e.preventDefault()}function bve(e){const{target:a}=e,{x:n,y:t}=ave(e);vve.clear(),pve=!1,hve.length>0&&(e.preventDefault(),Sve(a)||e.stopImmediatePropagation()),Nve("up",e),Ave({target:a,x:n,y:t}),Cve(),Tve()}function Sve(e){let a=e;for(;a;){if(a.hasAttribute(_ge))return!0;a=a.parentElement}return!1}function Ave({target:e,x:a,y:n}){hve.splice(0);let t=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(t=e),fve.forEach((e=>{const{element:i,hitAreaMargins:r}=e,o=i.getBoundingClientRect(),{bottom:s,left:l,right:u,top:c}=o,d=mve?r.coarse:r.fine;if(a>=l-d&&a<=u+d&&n>=c-d&&n<=s+d){if(null!==t&&document.contains(t)&&i!==t&&!i.contains(t)&&!t.contains(i)&&function(e,a){if(e===a)throw new Error("Cannot compare node with itself");const n={a:ove(e),b:ove(a)};let t;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),a=n.b.pop(),t=e;xve(t,"Stacking order can only be calculated for elements with a common ancestor");const i=rve(ive(n.a)),r=rve(ive(n.b));if(i===r){const e=t.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let i=e.length;for(;i--;){const n=e[i];if(n===a.a)return 1;if(n===a.b)return-1}}return Math.sign(i-r)}(t,i)>0){let e=t,a=!1;for(;e&&!e.contains(i);){if((m=e.getBoundingClientRect()).x<(h=o).x+h.width&&m.x+m.width>h.x&&m.y<h.y+h.height&&m.y+m.height>h.y){a=!0;break}e=e.parentElement}if(a)return}hve.push(e)}var m,h}))}function wve(e,a){vve.set(e,a)}function Cve(){let e=!1,a=!1;hve.forEach((n=>{const{direction:t}=n;"horizontal"===t?e=!0:a=!0}));let n=0;vve.forEach((e=>{n|=e})),e&&a?Yge("intersection",n):e?Yge("horizontal",n):a?Yge("vertical",n):null!==$ge&&(document.head.removeChild($ge),qge=null,$ge=null,Zge=-1)}let Mve=new AbortController;function Tve(){Mve.abort(),Mve=new AbortController;const e={capture:!0,signal:Mve.signal};fve.size&&(pve?(hve.length>0&&gve.forEach(((a,n)=>{const{body:t}=n;a>0&&(t.addEventListener("contextmenu",bve,e),t.addEventListener("pointerleave",kve,e),t.addEventListener("pointermove",kve,e))})),gve.forEach(((a,n)=>{const{body:t}=n;t.addEventListener("pointerup",bve,e),t.addEventListener("pointercancel",bve,e)}))):gve.forEach(((a,n)=>{const{body:t}=n;a>0&&(t.addEventListener("pointerdown",yve,e),t.addEventListener("pointermove",kve,e))})))}function Nve(e,a){fve.forEach((n=>{const{setResizeHandlerState:t}=n,i=hve.includes(n);t(e,i,a)}))}function xve(e,a){if(!e)throw Error(a)}function Eve(e,a,n=10){return e.toFixed(n)===a.toFixed(n)?0:e>a?1:-1}function Pve(e,a,n=10){return 0===Eve(e,a,n)}function jve(e,a,n){return 0===Eve(e,a,n)}function Lve({panelConstraints:e,panelIndex:a,size:n}){const t=e[a];xve(null!=t,`Panel constraints not found for index ${a}`);let{collapsedSize:i=0,collapsible:r,maxSize:o=100,minSize:s=0}=t;if(Eve(n,s)<0)if(r){n=Eve(n,(i+s)/2)<0?i:s}else n=s;return n=Math.min(o,n),n=parseFloat(n.toFixed(10))}function Bve({delta:e,initialLayout:a,panelConstraints:n,pivotIndices:t,prevLayout:i,trigger:r}){if(jve(e,0))return a;const o=[...a],[s,l]=t;xve(null!=s,"Invalid first pivot index"),xve(null!=l,"Invalid second pivot index");let u=0;if("keyboard"===r){{const t=e<0?l:s,i=n[t];xve(i,`Panel constraints not found for index ${t}`);const{collapsedSize:r=0,collapsible:o,minSize:u=0}=i;if(o){const n=a[t];if(xve(null!=n,`Previous layout not found for panel index ${t}`),jve(n,r)){const a=u-n;Eve(a,Math.abs(e))>0&&(e=e<0?0-a:a)}}}{const t=e<0?s:l,i=n[t];xve(i,`No panel constraints found for index ${t}`);const{collapsedSize:r=0,collapsible:o,minSize:u=0}=i;if(o){const n=a[t];if(xve(null!=n,`Previous layout not found for panel index ${t}`),jve(n,u)){const a=n-r;Eve(a,Math.abs(e))>0&&(e=e<0?0-a:a)}}}}{const t=e<0?1:-1;let i=e<0?l:s,r=0;for(;;){const e=a[i];xve(null!=e,`Previous layout not found for panel index ${i}`);if(r+=Lve({panelConstraints:n,panelIndex:i,size:100})-e,i+=t,i<0||i>=n.length)break}const o=Math.min(Math.abs(e),Math.abs(r));e=e<0?0-o:o}{let t=e<0?s:l;for(;t>=0&&t<n.length;){const i=Math.abs(e)-Math.abs(u),r=a[t];xve(null!=r,`Previous layout not found for panel index ${t}`);const s=Lve({panelConstraints:n,panelIndex:t,size:r-i});if(!jve(r,s)&&(u+=r-s,o[t]=s,u.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,a,n){if(e.length!==a.length)return!1;for(let t=0;t<e.length;t++)if(!jve(e[t],a[t],n))return!1;return!0}(i,o))return i;{const t=e<0?l:s,i=a[t];xve(null!=i,`Previous layout not found for panel index ${t}`);const r=i+u,c=Lve({panelConstraints:n,panelIndex:t,size:r});if(o[t]=c,!jve(c,r)){let a=r-c;let t=e<0?l:s;for(;t>=0&&t<n.length;){const i=o[t];xve(null!=i,`Previous layout not found for panel index ${t}`);const r=Lve({panelConstraints:n,panelIndex:t,size:i+a});if(jve(i,r)||(a-=r-i,o[t]=r),jve(a,0))break;e>0?t--:t++}}}return jve(o.reduce(((e,a)=>a+e),0),100)?o:i}function zve({layout:e,panelsArray:a,pivotIndices:n}){let t=0,i=100,r=0,o=0;const s=n[0];xve(null!=s,"No pivot index found"),a.forEach(((e,a)=>{const{constraints:n}=e,{maxSize:l=100,minSize:u=0}=n;a===s?(t=u,i=l):(r+=u,o+=l)}));return{valueMax:Math.min(i,100-r),valueMin:Math.max(t,100-o),valueNow:e[s]}}function Rve(e,a=document){return Array.from(a.querySelectorAll(`[${Hge}][data-panel-group-id="${e}"]`))}function _ve(e,a,n=document){const t=Rve(e,n).findIndex((e=>e.getAttribute(Hge)===a));return null!=t?t:null}function Dve(e,a,n){const t=_ve(e,a,n);return null!=t?[t,t+1]:[-1,-1]}function Kve(e,a=document){var n;if(a instanceof HTMLElement&&(null==a||null===(n=a.dataset)||void 0===n?void 0:n.panelGroupId)==e)return a;const t=a.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return t||null}function Hve(e,a=document){const n=a.querySelector(`[${Hge}="${e}"]`);return n||null}function Ove({committedValuesRef:e,eagerValuesRef:n,groupId:t,layout:i,panelDataArray:r,panelGroupElement:o,setLayout:s}){a.useRef({didWarnAboutMissingResizeHandle:!1}),Ige((()=>{if(!o)return;const e=Rve(t,o);for(let a=0;a<r.length-1;a++){const{valueMax:n,valueMin:t,valueNow:o}=zve({layout:i,panelsArray:r,pivotIndices:[a,a+1]}),s=e[a];if(null==s);else{const e=r[a];xve(e,`No panel data found for index "${a}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(n)),s.setAttribute("aria-valuemin",""+Math.round(t)),s.setAttribute("aria-valuenow",null!=o?""+Math.round(o):"")}}return()=>{e.forEach(((e,a)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[t,i,r,o]),a.useEffect((()=>{if(!o)return;const e=n.current;xve(e,"Eager values not found");const{panelDataArray:a}=e;xve(null!=Kve(t,o),`No group found for id "${t}"`);const r=Rve(t,o);xve(r,`No resize handles found for group id "${t}"`);const l=r.map((e=>{const n=e.getAttribute(Hge);xve(n,"Resize handle element has no handle id attribute");const[r,l]=function(e,a,n,t=document){var i,r,o,s;const l=Hve(a,t),u=Rve(e,t),c=l?u.indexOf(l):-1;return[null!==(i=null===(r=n[c])||void 0===r?void 0:r.id)&&void 0!==i?i:null,null!==(o=null===(s=n[c+1])||void 0===s?void 0:s.id)&&void 0!==o?o:null]}(t,n,a,o);if(null==r||null==l)return()=>{};const u=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=a.findIndex((e=>e.id===r));if(l>=0){const e=a[l];xve(e,`No panel data found for index ${l}`);const r=i[l],{collapsedSize:u=0,collapsible:c,minSize:d=0}=e.constraints;if(null!=r&&c){const e=Bve({delta:jve(r,u)?d-u:u-r,initialLayout:i,panelConstraints:a.map((e=>e.constraints)),pivotIndices:Dve(t,n,o),prevLayout:i,trigger:"keyboard"});i!==e&&s(e)}}break}}};return e.addEventListener("keydown",u),()=>{e.removeEventListener("keydown",u)}}));return()=>{l.forEach((e=>e()))}}),[o,e,n,t,i,r,s])}function Ive(e,a){if(e.length!==a.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==a[n])return!1;return!0}function Gve(e,a){const n="horizontal"===e,{x:t,y:i}=ave(a);return n?t:i}function Vve(e,a,n,t,i,r){if(Qge(e)){const a="horizontal"===n;let t=0;t=e.shiftKey?100:null!=i?i:10;let r=0;switch(e.key){case"ArrowDown":r=a?0:t;break;case"ArrowLeft":r=a?-t:0;break;case"ArrowRight":r=a?t:0;break;case"ArrowUp":r=a?0:-t;break;case"End":r=100;break;case"Home":r=-100}return r}return null==t?0:function(e,a,n,t,i){const r="horizontal"===n,o=Hve(a,i);xve(o,`No resize handle element found for id "${a}"`);const s=o.getAttribute(jge);xve(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=t;const u=Gve(n,e),c=Kve(s,i);xve(c,`No group element found for id "${s}"`);const d=c.getBoundingClientRect();return(u-l)/(r?d.width:d.height)*100}(e,a,n,t,r)}function Fve(e,a,n){a.forEach(((a,t)=>{const i=e[t];xve(i,`Panel data not found for index ${t}`);const{callbacks:r,constraints:o,id:s}=i,{collapsedSize:l=0,collapsible:u}=o,c=n[s];if(null==c||a!==c){n[s]=a;const{onCollapse:e,onExpand:t,onResize:i}=r;i&&i(a,c),u&&(e||t)&&(!t||null!=c&&!Pve(c,l)||Pve(a,l)||t(),!e||null!=c&&Pve(c,l)||!Pve(a,l)||e())}}))}function Jve(e,a){if(e.length!==a.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=a[n])return!1;return!0}function Uve(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,a)=>{localStorage.setItem(e,a)}}catch(a){e.getItem=()=>null,e.setItem=()=>{}}}function Wve(e){return`react-resizable-panels:${e}`}function qve(e){return e.map((e=>{const{constraints:a,id:n,idIsFromProps:t,order:i}=e;return t?n:i?`${i}:${JSON.stringify(a)}`:JSON.stringify(a)})).sort(((e,a)=>e.localeCompare(a))).join(",")}function Zve(e,a){try{const n=Wve(e),t=a.getItem(n);if(t){const e=JSON.parse(t);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function $ve(e,a,n,t,i){var r;const o=Wve(e),s=qve(a),l=null!==(r=Zve(e,i))&&void 0!==r?r:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:t};try{i.setItem(o,JSON.stringify(l))}catch(u){}}function Yve({layout:e,panelConstraints:a}){const n=[...e],t=n.reduce(((e,a)=>e+a),0);if(n.length!==a.length)throw Error(`Invalid ${a.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!jve(t,100)&&n.length>0)for(let r=0;r<a.length;r++){const e=n[r];xve(null!=e,`No layout data found for index ${r}`);n[r]=100/t*e}let i=0;for(let r=0;r<a.length;r++){const e=n[r];xve(null!=e,`No layout data found for index ${r}`);const t=Lve({panelConstraints:a,panelIndex:r,size:e});e!=t&&(i+=e-t,n[r]=t)}if(!jve(i,0))for(let r=0;r<a.length;r++){const e=n[r];xve(null!=e,`No layout data found for index ${r}`);const t=Lve({panelConstraints:a,panelIndex:r,size:e+i});if(e!==t&&(i-=t-e,n[r]=t,jve(i,0)))break}return n}const Qve={getItem:e=>(Uve(Qve),Qve.getItem(e)),setItem:(e,a)=>{Uve(Qve),Qve.setItem(e,a)}},Xve={};function efe({autoSaveId:e=null,children:n,className:t="",direction:i,forwardedRef:r,id:o=null,onLayout:s=null,keyboardResizeBy:l=null,storage:u=Qve,style:c,tagName:d="div",...m}){const h=Jge(o),p=a.useRef(null),[g,v]=a.useState(null),[f,y]=a.useState([]),k=function(){const[e,n]=a.useState(0);return a.useCallback((()=>n((e=>e+1))),[])}(),b=a.useRef({}),S=a.useRef(new Map),A=a.useRef(0),w=a.useRef({autoSaveId:e,direction:i,dragState:g,id:h,keyboardResizeBy:l,onLayout:s,storage:u}),C=a.useRef({layout:f,panelDataArray:[],panelDataArrayChanged:!1});a.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),a.useImperativeHandle(r,(()=>({getId:()=>w.current.id,getLayout:()=>{const{layout:e}=C.current;return e},setLayout:e=>{const{onLayout:a}=w.current,{layout:n,panelDataArray:t}=C.current,i=Yve({layout:e,panelConstraints:t.map((e=>e.constraints))});Ive(n,i)||(y(i),C.current.layout=i,a&&a(i),Fve(t,i,b.current))}})),[]),Ige((()=>{w.current.autoSaveId=e,w.current.direction=i,w.current.dragState=g,w.current.id=h,w.current.onLayout=s,w.current.storage=u})),Ove({committedValuesRef:w,eagerValuesRef:C,groupId:h,layout:f,panelDataArray:C.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),a.useEffect((()=>{const{panelDataArray:a}=C.current;if(e){if(0===f.length||f.length!==a.length)return;let n=Xve[e];null==n&&(n=function(e,a=10){let n=null;return(...t)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...t)}),a)}}($ve,100),Xve[e]=n);const t=[...a],i=new Map(S.current);n(e,t,i,f,u)}}),[e,f,u]),a.useEffect((()=>{}));const M=a.useCallback((e=>{const{onLayout:a}=w.current,{layout:n,panelDataArray:t}=C.current;if(e.constraints.collapsible){const i=t.map((e=>e.constraints)),{collapsedSize:r=0,panelSize:o,pivotIndices:s}=tfe(t,e,n);if(xve(null!=o,`Panel size not found for panel "${e.id}"`),!Pve(o,r)){S.current.set(e.id,o);const l=Bve({delta:nfe(t,e)===t.length-1?o-r:r-o,initialLayout:n,panelConstraints:i,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Jve(n,l)||(y(l),C.current.layout=l,a&&a(l),Fve(t,l,b.current))}}}),[]),T=a.useCallback(((e,a)=>{const{onLayout:n}=w.current,{layout:t,panelDataArray:i}=C.current;if(e.constraints.collapsible){const r=i.map((e=>e.constraints)),{collapsedSize:o=0,panelSize:s=0,minSize:l=0,pivotIndices:u}=tfe(i,e,t),c=null!=a?a:l;if(Pve(s,o)){const a=S.current.get(e.id),o=null!=a&&a>=c?a:c,l=Bve({delta:nfe(i,e)===i.length-1?s-o:o-s,initialLayout:t,panelConstraints:r,pivotIndices:u,prevLayout:t,trigger:"imperative-api"});Jve(t,l)||(y(l),C.current.layout=l,n&&n(l),Fve(i,l,b.current))}}}),[]),N=a.useCallback((e=>{const{layout:a,panelDataArray:n}=C.current,{panelSize:t}=tfe(n,e,a);return xve(null!=t,`Panel size not found for panel "${e.id}"`),t}),[]),x=a.useCallback(((e,a)=>{const{panelDataArray:n}=C.current,t=nfe(n,e);return function({defaultSize:e,dragState:a,layout:n,panelData:t,panelIndex:i,precision:r=3}){const o=n[i];let s;return s=null==o?null!=e?e.toPrecision(r):"1":1===t.length?"1":o.toPrecision(r),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==a?"none":void 0}}({defaultSize:a,dragState:g,layout:f,panelData:n,panelIndex:t})}),[g,f]),E=a.useCallback((e=>{const{layout:a,panelDataArray:n}=C.current,{collapsedSize:t=0,collapsible:i,panelSize:r}=tfe(n,e,a);return xve(null!=r,`Panel size not found for panel "${e.id}"`),!0===i&&Pve(r,t)}),[]),P=a.useCallback((e=>{const{layout:a,panelDataArray:n}=C.current,{collapsedSize:t=0,collapsible:i,panelSize:r}=tfe(n,e,a);return xve(null!=r,`Panel size not found for panel "${e.id}"`),!i||Eve(r,t)>0}),[]),j=a.useCallback((e=>{const{panelDataArray:a}=C.current;a.push(e),a.sort(((e,a)=>{const n=e.order,t=a.order;return null==n&&null==t?0:null==n?-1:null==t?1:n-t})),C.current.panelDataArrayChanged=!0,k()}),[k]);Ige((()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:a,storage:n}=w.current,{layout:t,panelDataArray:i}=C.current;let r=null;if(e){const a=function(e,a,n){var t,i;return null!==(i=(null!==(t=Zve(e,n))&&void 0!==t?t:{})[qve(a)])&&void 0!==i?i:null}(e,i,n);a&&(S.current=new Map(Object.entries(a.expandToSizes)),r=a.layout)}null==r&&(r=function({panelDataArray:e}){const a=Array(e.length),n=e.map((e=>e.constraints));let t=0,i=100;for(let r=0;r<e.length;r++){const e=n[r];xve(e,`Panel constraints not found for index ${r}`);const{defaultSize:o}=e;null!=o&&(t++,a[r]=o,i-=o)}for(let r=0;r<e.length;r++){const o=n[r];xve(o,`Panel constraints not found for index ${r}`);const{defaultSize:s}=o;if(null!=s)continue;const l=i/(e.length-t);t++,a[r]=l,i-=l}return a}({panelDataArray:i}));const o=Yve({layout:r,panelConstraints:i.map((e=>e.constraints))});Ive(t,o)||(y(o),C.current.layout=o,a&&a(o),Fve(i,o,b.current))}})),Ige((()=>{const e=C.current;return()=>{e.layout=[]}}),[]);const L=a.useCallback((e=>{let a=!1;const n=p.current;if(n){"rtl"===window.getComputedStyle(n,null).getPropertyValue("direction")&&(a=!0)}return function(n){n.preventDefault();const t=p.current;if(!t)return()=>null;const{direction:i,dragState:r,id:o,keyboardResizeBy:s,onLayout:l}=w.current,{layout:u,panelDataArray:c}=C.current,{initialLayout:d}=null!=r?r:{},m=Dve(o,e,t);let h=Vve(n,e,i,r,s,t);const g="horizontal"===i;g&&a&&(h=-h);const v=Bve({delta:h,initialLayout:null!=d?d:u,panelConstraints:c.map((e=>e.constraints)),pivotIndices:m,prevLayout:u,trigger:Qge(n)?"keyboard":"mouse-or-touch"}),f=!Jve(u,v);(Xge(n)||eve(n))&&A.current!=h&&(A.current=h,wve(e,f||0===h?0:g?h<0?lve:uve:h<0?cve:dve)),f&&(y(v),C.current.layout=v,l&&l(v),Fve(c,v,b.current))}}),[]),B=a.useCallback(((e,a)=>{const{onLayout:n}=w.current,{layout:t,panelDataArray:i}=C.current,r=i.map((e=>e.constraints)),{panelSize:o,pivotIndices:s}=tfe(i,e,t);xve(null!=o,`Panel size not found for panel "${e.id}"`);const l=Bve({delta:nfe(i,e)===i.length-1?o-a:a-o,initialLayout:t,panelConstraints:r,pivotIndices:s,prevLayout:t,trigger:"imperative-api"});Jve(t,l)||(y(l),C.current.layout=l,n&&n(l),Fve(i,l,b.current))}),[]),z=a.useCallback(((e,a)=>{const{layout:n,panelDataArray:t}=C.current,{collapsedSize:i=0,collapsible:r}=a,{collapsedSize:o=0,collapsible:s,maxSize:l=100,minSize:u=0}=e.constraints,{panelSize:c}=tfe(t,e,n);null!=c&&(r&&s&&Pve(c,i)?Pve(i,o)||B(e,o):c<u?B(e,u):c>l&&B(e,l))}),[B]),R=a.useCallback(((e,a)=>{const{direction:n}=w.current,{layout:t}=C.current;if(!p.current)return;const i=Hve(e,p.current);xve(i,`Drag handle element not found for id "${e}"`);const r=Gve(n,a);v({dragHandleId:e,dragHandleRect:i.getBoundingClientRect(),initialCursorPosition:r,initialLayout:t})}),[]),_=a.useCallback((()=>{v(null)}),[]),D=a.useCallback((e=>{const{panelDataArray:a}=C.current,n=nfe(a,e);n>=0&&(a.splice(n,1),delete b.current[e.id],C.current.panelDataArrayChanged=!0,k())}),[k]),K=a.useMemo((()=>({collapsePanel:M,direction:i,dragState:g,expandPanel:T,getPanelSize:N,getPanelStyle:x,groupId:h,isPanelCollapsed:E,isPanelExpanded:P,reevaluatePanelConstraints:z,registerPanel:j,registerResizeHandle:L,resizePanel:B,startDragging:R,stopDragging:_,unregisterPanel:D,panelGroupElement:p.current})),[M,g,i,T,N,x,h,E,P,z,j,L,B,R,_,D]);return a.createElement(xge.Provider,{value:K},a.createElement(d,{...m,children:n,className:t,id:o,ref:p,style:{...{display:"flex",flexDirection:"horizontal"===i?"row":"column",height:"100%",overflow:"hidden",width:"100%"},...c},[Ege]:"",[Pge]:i,[jge]:h}))}const afe=a.forwardRef(((e,n)=>a.createElement(efe,{...e,forwardedRef:n})));function nfe(e,a){return e.findIndex((e=>e===a||e.id===a.id))}function tfe(e,a,n){const t=nfe(e,a);return{...a.constraints,panelSize:n[t],pivotIndices:t===e.length-1?[t-1,t]:[t,t+1]}}function ife({children:e=null,className:n="",disabled:t=!1,hitAreaMargins:i,id:r,onBlur:o,onClick:s,onDragging:l,onFocus:u,onPointerDown:c,onPointerUp:d,style:m={},tabIndex:h=0,tagName:p="div",...g}){var v,f;const y=a.useRef(null),k=a.useRef({onClick:s,onDragging:l,onPointerDown:c,onPointerUp:d});a.useEffect((()=>{k.current.onClick=s,k.current.onDragging=l,k.current.onPointerDown=c,k.current.onPointerUp=d}));const b=a.useContext(xge);if(null===b)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:S,groupId:A,registerResizeHandle:w,startDragging:C,stopDragging:M,panelGroupElement:T}=b,N=Jge(r),[x,E]=a.useState("inactive"),[P,j]=a.useState(!1),[L,B]=a.useState(null),z=a.useRef({state:x});Ige((()=>{z.current.state=x})),a.useEffect((()=>{if(t)B(null);else{const e=w(N);B((()=>e))}}),[t,N,w]);const R=null!==(v=null==i?void 0:i.coarse)&&void 0!==v?v:15,_=null!==(f=null==i?void 0:i.fine)&&void 0!==f?f:5;a.useEffect((()=>{if(t||null==L)return;const e=y.current;xve(e,"Element ref not attached");let a=!1;return function(e,a,n,t,i){var r;const{ownerDocument:o}=a,s={direction:n,element:a,hitAreaMargins:t,setResizeHandlerState:i},l=null!==(r=gve.get(o))&&void 0!==r?r:0;return gve.set(o,l+1),fve.add(s),Tve(),function(){var a;vve.delete(e),fve.delete(s);const n=null!==(a=gve.get(o))&&void 0!==a?a:1;if(gve.set(o,n-1),Tve(),1===n&&gve.delete(o),hve.includes(s)){const e=hve.indexOf(s);e>=0&&hve.splice(e,1),Cve(),i("up",!0,null)}}}(N,e,S,{coarse:R,fine:_},((e,n,t)=>{if(n)switch(e){case"down":{E("drag"),a=!1,xve(t,'Expected event to be defined for "down" action'),C(N,t);const{onDragging:e,onPointerDown:n}=k.current;null==e||e(!0),null==n||n();break}case"move":{const{state:e}=z.current;a=!0,"drag"!==e&&E("hover"),xve(t,'Expected event to be defined for "move" action'),L(t);break}case"up":{E("hover"),M();const{onClick:e,onDragging:n,onPointerUp:t}=k.current;null==n||n(!1),null==t||t(),a||null==e||e();break}}else E("inactive")}))}),[R,S,t,_,w,N,L,C,M]),function({disabled:e,handleId:n,resizeHandler:t,panelGroupElement:i}){a.useEffect((()=>{if(e||null==t||null==i)return;const a=Hve(n,i);if(null==a)return;const r=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),t(e);break;case"F6":{e.preventDefault();const t=a.getAttribute(jge);xve(t,`No group element found for id "${t}"`);const r=Rve(t,i),o=_ve(t,n,i);xve(null!==o,`No resize element found for id "${n}"`),r[e.shiftKey?o>0?o-1:r.length-1:o+1<r.length?o+1:0].focus();break}}};return a.addEventListener("keydown",r),()=>{a.removeEventListener("keydown",r)}}),[i,e,n,t])}({disabled:t,handleId:N,resizeHandler:L,panelGroupElement:T});return a.createElement(p,{...g,children:e,className:n,id:r,onBlur:()=>{j(!1),null==o||o()},onFocus:()=>{j(!0),null==u||u()},ref:y,role:"separator",style:{touchAction:"none",userSelect:"none",...m},tabIndex:h,[Pge]:S,[jge]:A,[_ge]:"",[Dge]:"drag"===x?"pointer":P?"keyboard":void 0,[Kge]:!t,[Hge]:N,[Oge]:x})}efe.displayName="PanelGroup",afe.displayName="forwardRef(PanelGroup)",ife.displayName="PanelResizeHandle";const rfe=({className:e,...a})=>n.jsx(afe,{className:LG("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...a}),ofe=Wge,sfe=({withHandle:e,className:a,...t})=>n.jsx(ife,{className:LG("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...t,children:e&&n.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:n.jsx(jc,{className:"h-2.5 w-2.5"})})}),lfe=({copyText:e})=>n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),ufe="rgba(245, 246, 247, 1)",cfe={[Qe.SEND_COMMUNICATION]:{color:{bg:ufe},clickable:!0},[Qe.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:ufe},clickable:!1}},dfe={[Qe.SEND_COMMUNICATION]:"Send Email & SMS",[Qe.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},mfe=({children:e,onClick:a,iconBgColor:t,iconStrokeColor:i,Icon:r,disabled:o=!1,selected:s=!1})=>{const l=r;return n.jsxs(H$.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},style:{backgroundColor:s?t:ufe},onClick:a,className:im("flex gap-2 items-center rounded-md transition-colors group","p-2 border-2 border-transparent overflow-hidden",!o&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:[n.jsx("div",{className:im("bg-purple-50 rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 transition-colors",!o&&"group-hover/trigger-audience:bg-background",t),children:n.jsx(l,{className:im("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",i)})}),e]})},hfe=({segmentName:e})=>n.jsx("span",{className:"inline-flex items-center bg-white border border-gray-200 rounded-md px-2 py-0.5 text-sm font-medium shadow-sm",children:e}),pfe=()=>{const e=wY(),{setActionId:t,state:{selectedActionId:i}}=a.useContext(X$),[r,o]=a.useState(e?.includeSegmentIds||null),[s,l]=a.useState(e?.excludeSegmentIds||null),{segments:u}=gY(),c=a.useCallback((()=>u?.find((e=>e.type===bY.ALL_USERS))),[u]);return a.useEffect((()=>{e&&u&&(null===r&&null===s?(o(e?.includeSegmentIds||null),l(e?.excludeSegmentIds||null),0===e.includeSegmentIds.length&&0===e.excludeSegmentIds.length&&(o([c()?.id||""]),l([]))):(JSON.stringify(e.includeSegmentIds)!==JSON.stringify(r)&&o(e.includeSegmentIds),JSON.stringify(e.excludeSegmentIds)!==JSON.stringify(s)&&l(e.excludeSegmentIds)))}),[e,s,r,u,c]),e&&r&&s?n.jsx(n.Fragment,{children:n.jsx(mfe,{selected:i===jie.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{t(jie.EditAudience)},Icon:RY.AudienceIcon,children:n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[n.jsx(Lue,{children:"Audience"}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx(lfe,{copyText:`Send to all ${yh("engage:user",{count:2})} in ${1===r.length?"this":"these"} ${yh("engage:segment",{count:r.length}).toLowerCase()}`}),n.jsx("div",{className:"flex gap-1 flex-wrap",children:r.map((e=>{const a=u?.find((a=>a.id===e));return a?n.jsx(hfe,{segmentName:a.name},e):null}))})]})]})})}):null},gfe=()=>{const e=wY(),{setActionId:t,state:{selectedActionId:i}}=a.useContext(X$),{segments:r}=gY(),o=yh(e?.triggerType===Ze.TRIGGER_BASED?"engage:automation":"engage:broadcast"),s=`Start this ${o?.toLowerCase()}`;if(!e||!r)return null;return n.jsx(n.Fragment,{children:(()=>{switch(e.triggerType){case Ze.TRIGGER_BASED:{if(e.triggerMetadata.triggerType!==Ze.TRIGGER_BASED||e.triggerMetadata.eventName!==$e.USER_ENTERS_SEGMENT||!e.triggerMetadata.eventFilter.segment_id)return null;const a=e.triggerMetadata.eventFilter.segment_id,t=r.find((e=>e.id===a))?.name;return t?n.jsx(mfe,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:RY.TriggerIcon,children:n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[n.jsx(Lue,{children:s}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx(lfe,{copyText:`When ${yh("engage:user").toLowerCase()} joins the`}),n.jsx(hfe,{segmentName:t})]})]})}):null}case Ze.ONE_TIME:{const a=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return n.jsxs(mfe,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{t(jie.EditTime)},selected:i===jie.EditTime,Icon:RY.TriggerIcon,children:[n.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[n.jsx(Lue,{children:s}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx(lfe,a?{copyText:`Click to set the date and time for this ${yh("engage:broadcast")}`}:{copyText:"Bulk send at"}),!1===a&&"scheduledAt"in e.triggerMetadata&&e.triggerMetadata.scheduledAt&&n.jsx("div",{className:"text-xs font-medium",children:n.jsx(hfe,{segmentName:"now"===e.triggerMetadata.scheduledAt?"5 minutes after send":dae(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),n.jsx("div",{className:"",children:a&&n.jsx(Mae,{title:"Please select a time before sending this ${t('engage:broadcast')}.",alertText:`A scheduled time is needed before sending this ${yh("engage:broadcast")}.`,Icon:RY.AlertTriangleIcon,iconColor:"text-red-500",size:"large"})})]})}default:throw Dse(e.triggerType,Ze)}})()})},vfe=({type:e,disabled:t=!1,actionId:i})=>{const{state:{selectedSubStepType:r},setSelectedSubStepType:o,setActionId:s}=a.useContext(X$),l=CY(),u=r===e,c=a.useCallback((()=>{if(!l)return"Need to select a channel";switch(e){case Lie.EMAIL:return l.emailChannelSenderId?l.emailHtmlBody?!!l.emailSubject||"Please add a subject to the email":"Please add content to the email":"Please select a email sender";case Lie.SMS:return l.smsChannelSenderId?!!l.smsMessageBody||"Please add content to the sms":"Please select a sms sender"}}),[l,e]);if(t)return null;const d=c();return n.jsx(H$.div,{layout:!0,initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.15,ease:"easeInOut"},className:im("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group","border-2 border-transparent",u&&"border-primary",!t&&"hover:border-muted-foreground/30",t&&"opacity-50 cursor-not-allowed"),style:{backgroundColor:u?"#f5f6f7":ufe},onClick:()=>{t||(s(i),o(e))},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"rounded-md p-1.5 flex items-center justify-center w-6 h-6 flex-shrink-0 bg-white border",children:((e,a)=>{switch(e){case Lie.EMAIL:return n.jsx(RY.EmailIcon,{className:im("w-6 h-6",a?"text-primary":"text-gray-400")});case Lie.SMS:return n.jsx(RY.SmsIcon,{className:im("w-6 h-6",a?"text-primary":"text-gray-400")})}})(e,u)}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("div",{style:{color:u?"#3b82f6":"#64748b"},children:n.jsx(Lue,{className:"text-xs",children:(()=>{switch(e){case Lie.EMAIL:return"Email";case Lie.SMS:return"SMS"}})()})}),n.jsx("div",{className:"text-[10px] font-medium text-muted-foreground",children:(()=>{if(!l)return"";switch(e){case Lie.EMAIL:return l.emailSubject||"No subject set";case Lie.SMS:return l.smsMessageBody?`${l.smsMessageBody.substring(0,40)}${l.smsMessageBody.length>40?"...":""}`:"No message set"}})()}),!0!==d&&n.jsx("div",{className:"text-[10px] text-amber-600 font-medium",children:d})]})]})})},ffe=e=>{switch(e){case Qe.SEND_COMMUNICATION:return"Send Communication";case Qe.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw W$(e,Qe)}},yfe=e=>{switch(e){case Qe.SEND_COMMUNICATION:return n.jsx(RY.CommunicationIcon,{className:"w-4 h-4"});case Qe.WAIT_UNTIL_NEXT_FIXED_TIME:return n.jsx(RY.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw Dse(e,Qe)}},kfe=e=>{if(!(e&&e.actionType===Qe.WAIT_UNTIL_NEXT_FIXED_TIME&&"hour"in e&&"minute"in e&&"timezone"in e))return null;const{hour:a,minute:n,timezone:t}=e;return`Wait until next ${`${a?.toString().padStart(2,"0")}:${n?.toString().padStart(2,"0")}`} ${t}`},bfe=({actionDataWithMetadata:e})=>{const{actionData:t,communicationGroup:i}=e,{state:{selectedActionId:r},setActionId:o,setSelectedCommunicationGroupId:s}=a.useContext(X$),l=a.useMemo((()=>r===t.actionMetadata.currentActionId),[r,t.actionMetadata.currentActionId]),u=cfe[t.actionType],c=u.color,d=u.clickable;return n.jsxs(H$.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:im("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",l&&"border-primary",t.actionType!==Qe.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:l?c.bg:c.bgUnselected??ufe},onClick:()=>{d&&(o(t.actionMetadata.currentActionId),t.actionType===Qe.SEND_COMMUNICATION&&s(t.actionMetadata.communicationGroupId))},children:[n.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[n.jsx("div",{className:"rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white",children:yfe(t.actionType)}),n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("div",{style:{color:l?c.text:c.textUnselected},children:n.jsx(Lue,{children:dfe[t.actionType]})}),n.jsx("div",t.actionType===Qe.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:kfe(t.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:t.actionType===Qe.SEND_COMMUNICATION&&i?.emailSubject?i?.emailSubject:ffe(t.actionType)})]})]}),t.actionType===Qe.SEND_COMMUNICATION&&n.jsx("div",{className:"flex items-center pr-2",children:n.jsx(RY.NextButton,l?{className:"w-4 h-4 text-muted-foreground rotate-90 transition-transform duration-200"}:{className:"w-4 h-4 text-muted-foreground transition-transform duration-200"})})]})},Sfe=()=>{const e=CY(),[t,i]=a.useState(!1),[r,o]=a.useState(void 0),s=wY(),{setActionId:l,setSelectedSubStepType:u,state:{selectedActionId:c,selectedSubStepType:d}}=a.useContext(X$);if(Je(s?.id||""),a.useEffect((()=>{if(!s)return;if(c)return;const e=s.actionData?.find((e=>"send_communication"===e.actionType));e&&l(e.actionMetadata.currentActionId)}),[s,l,c]),a.useEffect((()=>{if(!s)return;(async()=>{const e=[];for(const a of s.actionData??[])switch(a.actionType){case Qe.SEND_COMMUNICATION:{const n=await aY(a.actionMetadata.communicationGroupId);e.push({actionData:a,communicationGroup:n});break}case Qe.WAIT_UNTIL_NEXT_FIXED_TIME:e.push({actionData:a});break;default:throw W$(a.actionType,Qe)}o(e)})()}),[s]),a.useEffect((()=>{if(c&&r&&e&&null===d){const a=r.find((e=>e.actionData.actionMetadata.currentActionId===c));"send_communication"===a?.actionData.actionType&&u(e?.emailChannelSenderId?Lie.EMAIL:Lie.SMS)}}),[c,r,u,e,d]),!s||!r)return null;const m=(e=>{const{steps:a,rootActionId:n}=e;if(!a||!n)return a??[];const t=new Map(a.map((e=>[e.actionData.actionMetadata.currentActionId,e]))),i=t.get(n);if(!i)return a;const r=[];let o=i;for(;o;){r.push(o);const e=o.actionData.actionMetadata.nextActionId;if(!e)break;o=t.get(e)}return r})({steps:r,rootActionId:s.triggerMetadata?.triggerType===Ze.TRIGGER_BASED?s.triggerMetadata.rootActionId:void 0}).filter((e=>!!t||"send_communication"===e.actionData.actionType));let h=()=>n.jsx("div",{},"empty-trigger-audience");return(t||s.triggerType===Ze.ONE_TIME)&&(h=()=>n.jsxs("div",{className:"flex flex-col gap-3",children:[s.triggerType===Ze.ONE_TIME&&n.jsx(pfe,{}),s.triggerType!==Ze.ONE_TIME&&n.jsx(gfe,{})]})),n.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[s.triggerType===Ze.TRIGGER_BASED&&n.jsxs("div",{className:"flex gap-2 items-center justify-between",children:[n.jsx("div",{className:"text-[13px] text-muted-foreground",children:"Messages sent in listed order"}),n.jsxs("div",{className:"flex gap-2 items-center",children:[n.jsx("div",{className:"text-[13px] font-medium",children:"Show all details"}),n.jsx(mpe,{defaultChecked:t,onCheckedChange:()=>{i(!t)}})]})]}),n.jsx("div",{className:"flex-1 flex flex-col gap-3",children:n.jsxs(aV,{mode:"popLayout",children:[h(),m.map(((a,t)=>n.jsx(H$.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,delay:.05*t,ease:"easeInOut"},children:n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsx(bfe,{actionDataWithMetadata:a}),"send_communication"===a.actionData.actionType&&c===a.actionData.actionMetadata.currentActionId&&a.actionData.actionMetadata.currentActionId&&n.jsxs("div",{className:"flex gap-3",children:[n.jsx(H$.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,delay:.25*m.length,ease:"easeInOut"},className:"w-12 flex justify-end items-center",children:n.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full rounded-full"})}),n.jsxs("div",{className:"flex flex-col gap-3 flex-1",children:[e?.emailChannelSenderId&&n.jsx(vfe,{type:Lie.EMAIL,actionId:a.actionData.actionMetadata.currentActionId}),e?.smsChannelSenderId&&n.jsx(vfe,{type:Lie.SMS,actionId:a.actionData.actionMetadata.currentActionId})]})]})]})},a.actionData.actionMetadata?.currentActionId??t))),s.triggerType===Ze.ONE_TIME&&n.jsx("div",{className:"flex flex-col gap-3",children:n.jsx(gfe,{})},"one-time-trigger")]})})]})},Afe=()=>{const e=wY(),{segments:a}=gY();return n.jsx("div",e&&a?{className:"h-full pt-4 relative",children:n.jsx("div",{className:"absolute inset-0 overflow-y-auto flex flex-col gap-3",children:n.jsx(Sfe,{})})}:{className:"flex h-full items-center justify-center",children:n.jsx(xY,{text:[`Getting details on your ${yh("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},wfe=({disablePreview:e=!1,disableEditContent:t=!1,disablePreviewSubtext:i=!1,hideSms:r=!1})=>{const{state:{selectedSubStepType:o}}=a.useContext(X$);if(!CY())return n.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:n.jsx(xY,{text:["Loading..."]})});if(!o)return n.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsxs("div",{className:"text-center",children:[n.jsx("h3",{className:"text-lg font-medium text-muted-foreground mb-2",children:"Select Communication Type"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose Email or SMS from the steps on the left to preview and edit content"})]})})});const s={disablePreview:e,disableEditContent:t,disablePreviewSubtext:i};return n.jsxs("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:[o===Lie.EMAIL&&n.jsx(Sue,{...s}),o===Lie.SMS&&!r&&n.jsx(Mue,{...s})]})},Cfe=()=>{const{state:{selectedActionId:e}}=a.useContext(X$),{state:{hideSms:t}}=a.useContext(cO);return n.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:n.jsx(aV,{mode:"wait",children:e===jie.EditTime?n.jsx(_me,{}):e===jie.EditAudience?n.jsx(Epe,{}):n.jsx(wfe,{hideSms:t})})})},Mfe=()=>n.jsxs(rfe,{direction:"horizontal",className:"flex-1",children:[n.jsx(ofe,{defaultSize:30,minSize:16,maxSize:48,children:n.jsx("aside",{className:"h-full",children:n.jsx(Afe,{})})}),n.jsx(sfe,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),n.jsx(ofe,{defaultSize:70,children:n.jsx("main",{className:"h-full",children:n.jsx(Cfe,{})})})]}),Tfe=()=>{const[e,t]=a.useState("workflow"),i=[{id:"workflow",label:"Workflow",content:n.jsx(Mfe,{})},{id:"recipients",label:"Recipients",content:n.jsx(Nge,{})},{id:"insights",label:yh("engage:insight",{count:2}),content:n.jsx(Mge,{})}];return n.jsx(Vpe,{tabs:i,activeTab:e,onTabChange:t,tabsLocation:"left"})},Nfe=({showBackButton:e=!1,onDuplicationCreated:t,onBeforeSchedule:i,getExtraMergeFields:r,hideSms:o,hideSales:s,replyToSettingsText:l,replyToSettingsLink:u,fromNameSettingsText:c,fromNameSettingsLink:d})=>{const m=wY(),h=CY(),{updateCommunicationGroup:p}=lY(),{toast:g}=Ie(),{channelSenders:v}=x9();return a.useEffect((()=>{if(h&&r){(async()=>{const e=await r();JSON.stringify(e)!==JSON.stringify(h.extraMergeFields)&&p({groupId:h?.id,params:{extraMergeFields:e}},{onError:e=>{g({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[h,r,p,g]),a.useEffect((()=>{if(m&&h&&v&&m.automationType===Ye.MANAGED&&null===h.emailChannelSenderId&&null===h.smsChannelSenderId){if(!h.emailChannelSenderId){const e=v.results.filter((e=>e.channelSenderMetadata.userPart));e.length>0&&p({groupId:h.id,params:{emailChannelSenderId:e[0].id}})}if(!h.smsChannelSenderId){const e=v.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid));e.length>0&&p({groupId:h.id,params:{smsChannelSenderId:e[0].id}})}}}),[m,h,v,p]),m&&h?n.jsx(dO,{children:n.jsx(mO,{replyToSettingsText:l,replyToSettingsLink:u,fromNameSettingsText:c,fromNameSettingsLink:d,hideSms:o,hideSales:s,children:n.jsxs("div",{className:"h-full flex flex-col gap-4",children:[n.jsx(Cge,{showBackButton:e,onDuplicationCreated:t,onBeforeSchedule:i}),n.jsx("div",{className:"flex-1 border-t",children:n.jsx(Tfe,{})})]})})}):n.jsx("div",{className:"flex h-screen items-center justify-center",children:n.jsx(xY,{text:[`Fetching ${yh("engage:automation").toLowerCase()} data`,"Finishing up"]})})},xfe=({...e})=>{const a=function(){let{matches:e}=r.useContext(e5),a=e[e.length-1];return a?a.params:{}}(),[t]=F5(),i=e.automationId||a?.automationId||t.get("automationId")||"",o="true"===t.get("showBackButton")||e.showBackButton;return n.jsx(TY,{automationId:i,children:n.jsx("div",{className:"bg-background h-full",children:n.jsx(Nfe,{...e,showBackButton:o})})})};Object.values(Object.assign({}));var Efe=e=>null!=e;var Pfe=e=>"function"!=typeof e||e.length?e:e(),jfe=e=>Array.isArray(e)?e:e?[e]:[];var Lfe=xa;var Bfe,zfe=function(e){const[a,n]=ka(),t=e?.throw?(e,a)=>{throw n(e instanceof Error?e:new Error(a)),e}:(e,a)=>{n(e instanceof Error?e:new Error(a))},i=e?.api?Array.isArray(e.api)?e.api:[e.api]:[globalThis.localStorage].filter(Boolean),r=e?.prefix?`${e.prefix}.`:"",o=new Map,s=new Proxy({},{get(a,n){let s=o.get(n);s||(s=ka(void 0,{equals:!1}),o.set(n,s)),s[0]();const l=i.reduce(((e,a)=>{if(null!==e||!a)return e;try{return a.getItem(`${r}${n}`)}catch(cBe){return t(cBe,`Error reading ${r}${n} from ${a.name}`),null}}),null);return null!==l&&e?.deserializer?e.deserializer(l,n,e.options):l}});return!1!==e?.sync&&Na((()=>{const e=e=>{let a=!1;i.forEach((n=>{try{n!==e.storageArea&&e.key&&e.newValue!==n.getItem(e.key)&&(e.newValue?n.setItem(e.key,e.newValue):n.removeItem(e.key),a=!0)}catch(cBe){t(cBe,`Error synching api ${n.name} from storage event (${e.key}=${e.newValue})`)}})),a&&e.key&&o.get(e.key)?.[1]()};"addEventListener"in globalThis?(globalThis.addEventListener("storage",e),xa((()=>globalThis.removeEventListener("storage",e)))):(i.forEach((a=>a.addEventListener?.("storage",e))),xa((()=>i.forEach((a=>a.removeEventListener?.("storage",e))))))})),[s,(a,n,s)=>{const l=e?.serializer?e.serializer(n,a,s??e.options):n,u=`${r}${a}`;i.forEach((e=>{try{e.getItem(u)!==l&&e.setItem(u,l)}catch(cBe){t(cBe,`Error setting ${r}${a} to ${l} in ${e.name}`)}}));const c=o.get(a);c&&c[1]()},{clear:()=>i.forEach((e=>{try{e.clear()}catch(cBe){t(cBe,`Error clearing ${e.name}`)}})),error:a,remove:e=>i.forEach((a=>{try{a.removeItem(`${r}${e}`)}catch(cBe){t(cBe,`Error removing ${r}${e} from ${a.name}`)}})),toJSON:()=>{const a={},n=(n,t)=>{if(!a.hasOwnProperty(n)){const i=t&&e?.deserializer?e.deserializer(t,n,e.options):t;i&&(a[n]=i)}};return i.forEach((e=>{if("function"==typeof e.getAll){let a;try{a=e.getAll()}catch(cBe){t(cBe,`Error getting all values from in ${e.name}`)}for(const e of a)n(e,a[e])}else{let i,r=0;try{for(;i=e.key(r++);)a.hasOwnProperty(i)||n(i,e.getItem(i))}catch(cBe){t(cBe,`Error getting all values from ${e.name}`)}}})),a}}]},Rfe=e=>{if(!e)return"";let a="";for(const n in e){if(!e.hasOwnProperty(n))continue;const t=e[n];a+=t instanceof Date?`; ${n}=${t.toUTCString()}`:"boolean"==typeof t?`; ${n}`:`; ${n}=${t}`}return a},_fe=("function"==typeof(Bfe={_cookies:[globalThis.document,"cookie"],getItem:e=>_fe._cookies[0][_fe._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,a,n)=>{const t=_fe.getItem(e);_fe._cookies[0][_fe._cookies[1]]=`${e}=${a}${Rfe(n)}`;const i=Object.assign(new Event("storage"),{key:e,oldValue:t,newValue:a,url:globalThis.document.URL,storageArea:_fe});window.dispatchEvent(i)},removeItem:e=>{_fe._cookies[0][_fe._cookies[1]]=`${e}=deleted${Rfe({expires:new Date(0)})}`},key:e=>{let a=null,n=0;return _fe._cookies[0][_fe._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((t,i)=>(!a&&i&&n++===e&&(a=i),""))),a},get length(){let e=0;return _fe._cookies[0][_fe._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(a=>(e+=a?1:0,""))),e}}).clear||(Bfe.clear=()=>{let e;for(;e=Bfe.key(0);)Bfe.removeItem(e)}),Bfe),Dfe=796,Kfe="bottom",Hfe="system",Ofe=Object.keys(It)[0],Ife=Object.keys(Ft)[0],Gfe=Ba({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Vfe(){return za(Gfe)}var Ffe=Ba(void 0),Jfe=e=>{const[a,n]=ka(null),t=()=>{const e=a();null!=e&&(e.close(),n(null))},i=(t,i)=>{if(null!=a())return;const r=window.open("","TSQD-Devtools-Panel",`width=${t},height=${i},popup`);if(!r)throw new Error("Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.");r.document.head.innerHTML="",r.document.body.innerHTML="",function(e=window.document){if(e[wn]){for(let a of e[wn].keys())e.removeEventListener(a,Dn);delete e[wn]}}(r.document),r.document.title="TanStack Query Devtools",r.document.body.style.margin="0",r.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(Vfe().shadowDOMTarget||document).styleSheets].forEach((e=>{try{const a=[...e.cssRules].map((e=>e.cssText)).join(""),n=document.createElement("style"),t=e.ownerNode;let i="";t&&"id"in t&&(i=t.id),i&&n.setAttribute("id",i),n.textContent=a,r.document.head.appendChild(n)}catch(uBe){const n=document.createElement("link");if(null==e.href)return;n.rel="stylesheet",n.type=e.type,n.media=e.media.toString(),n.href=e.href,r.document.head.appendChild(n)}})),Tn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],r.document),e.setLocalStore("pip_open","true"),n(r)};Aa((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||i(Number(window.innerWidth),Number(e.localStore.height||500))})),Aa((()=>{const e=(Vfe().shadowDOMTarget||document).querySelector("#_goober"),n=a();if(e&&n){const a=new MutationObserver((()=>{const a=(Vfe().shadowDOMTarget||n.document).querySelector("#_goober");a&&(a.textContent=e.textContent)}));a.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),xa((()=>{a.disconnect()}))}}));const r=wa((()=>({pipWindow:a(),requestPipWindow:i,closePipWindow:t,disabled:e.disabled??!1})));return Xa(Ffe.Provider,{value:r,get children(){return e.children}})},Ufe=()=>wa((()=>{const e=za(Ffe);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Wfe=Ba((()=>"dark"));function qfe(){return za(Wfe)}var Zfe={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Ấ":"A","Ắ":"A","Ẳ":"A","Ẵ":"A","Ặ":"A","Æ":"AE","Ầ":"A","Ằ":"A","Ȃ":"A","Ç":"C","Ḉ":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ế":"E","Ḗ":"E","Ề":"E","Ḕ":"E","Ḝ":"E","Ȇ":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ḯ":"I","Ȋ":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ố":"O","Ṍ":"O","Ṓ":"O","Ȏ":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ấ":"a","ắ":"a","ẳ":"a","ẵ":"a","ặ":"a","æ":"ae","ầ":"a","ằ":"a","ȃ":"a","ç":"c","ḉ":"c","è":"e","é":"e","ê":"e","ë":"e","ế":"e","ḗ":"e","ề":"e","ḕ":"e","ḝ":"e","ȇ":"e","ì":"i","í":"i","î":"i","ï":"i","ḯ":"i","ȋ":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ố":"o","ṍ":"o","ṓ":"o","ȏ":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","C̆":"C","c̆":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","Ǵ":"G","ĝ":"g","ǵ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ḫ":"H","ḫ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","Ḱ":"K","ḱ":"k","K̆":"K","k̆":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"l","ł":"l","Ḿ":"M","ḿ":"m","M̆":"M","m̆":"m","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","N̆":"N","n̆":"n","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","P̆":"P","p̆":"p","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","R̆":"R","r̆":"r","Ȓ":"R","ȓ":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","Ș":"S","ș":"s","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","ț":"t","Ț":"T","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","T̆":"T","t̆":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ȗ":"U","ȗ":"u","V̆":"V","v̆":"v","Ŵ":"W","ŵ":"w","Ẃ":"W","ẃ":"w","X̆":"X","x̆":"x","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Y̆":"Y","y̆":"y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ſ":"s","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Ǎ":"A","ǎ":"a","Ǐ":"I","ǐ":"i","Ǒ":"O","ǒ":"o","Ǔ":"U","ǔ":"u","Ǖ":"U","ǖ":"u","Ǘ":"U","ǘ":"u","Ǚ":"U","ǚ":"u","Ǜ":"U","ǜ":"u","Ứ":"U","ứ":"u","Ṹ":"U","ṹ":"u","Ǻ":"A","ǻ":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","ǿ":"o","Þ":"TH","þ":"th","Ṕ":"P","ṕ":"p","Ṥ":"S","ṥ":"s","X́":"X","x́":"x","Ѓ":"Г","ѓ":"г","Ќ":"К","ќ":"к","A̋":"A","a̋":"a","E̋":"E","e̋":"e","I̋":"I","i̋":"i","Ǹ":"N","ǹ":"n","Ồ":"O","ồ":"o","Ṑ":"O","ṑ":"o","Ừ":"U","ừ":"u","Ẁ":"W","ẁ":"w","Ỳ":"Y","ỳ":"y","Ȁ":"A","ȁ":"a","Ȅ":"E","ȅ":"e","Ȉ":"I","ȉ":"i","Ȍ":"O","ȍ":"o","Ȑ":"R","ȑ":"r","Ȕ":"U","ȕ":"u","B̌":"B","b̌":"b","Č̣":"C","č̣":"c","Ê̌":"E","ê̌":"e","F̌":"F","f̌":"f","Ǧ":"G","ǧ":"g","Ȟ":"H","ȟ":"h","J̌":"J","ǰ":"j","Ǩ":"K","ǩ":"k","M̌":"M","m̌":"m","P̌":"P","p̌":"p","Q̌":"Q","q̌":"q","Ř̩":"R","ř̩":"r","Ṧ":"S","ṧ":"s","V̌":"V","v̌":"v","W̌":"W","w̌":"w","X̌":"X","x̌":"x","Y̌":"Y","y̌":"y","A̧":"A","a̧":"a","B̧":"B","b̧":"b","Ḑ":"D","ḑ":"d","Ȩ":"E","ȩ":"e","Ɛ̧":"E","ɛ̧":"e","Ḩ":"H","ḩ":"h","I̧":"I","i̧":"i","Ɨ̧":"I","ɨ̧":"i","M̧":"M","m̧":"m","O̧":"O","o̧":"o","Q̧":"Q","q̧":"q","U̧":"U","u̧":"u","X̧":"X","x̧":"x","Z̧":"Z","z̧":"z"},$fe=Object.keys(Zfe).join("|"),Yfe=new RegExp($fe,"g");var Qfe=7,Xfe=6,eye=5,aye=4,nye=3,tye=2,iye=1,rye=0;function oye(e,a,n){var t;if((n=n||{}).threshold=null!=(t=n.threshold)?t:iye,!n.accessors){const t=sye(e,a,n);return{rankedValue:e,rank:t,accessorIndex:-1,accessorThreshold:n.threshold,passed:t>=n.threshold}}const i=function(e,a){const n=[];for(let t=0,i=a.length;t<i;t++){const i=a[t],r=dye(i),o=uye(e,i);for(let e=0,a=o.length;e<a;e++)n.push({itemValue:o[e],attributes:r})}return n}(e,n.accessors),r={rankedValue:e,rank:rye,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let o=0;o<i.length;o++){const e=i[o];let t=sye(e.itemValue,a,n);const{minRanking:s,maxRanking:l,threshold:u=n.threshold}=e.attributes;t<s&&t>=iye?t=s:t>l&&(t=l),t=Math.min(t,l),t>=u&&t>r.rank&&(r.rank=t,r.passed=!0,r.accessorIndex=o,r.accessorThreshold=u,r.rankedValue=e.itemValue)}return r}function sye(e,a,n){return e=lye(e,n),(a=lye(a,n)).length>e.length?rye:e===a?Qfe:(e=e.toLowerCase())===(a=a.toLowerCase())?Xfe:e.startsWith(a)?eye:e.includes(` ${a}`)?aye:e.includes(a)?nye:1===a.length?rye:function(e){let a="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{a+=e.substr(0,1)}))})),a}(e).includes(a)?tye:function(e,a){let n=0,t=0;function i(e,a,t){for(let i=t,r=a.length;i<r;i++){if(a[i]===e)return n+=1,i+1}return-1}function r(e){return iye+n/a.length*(1/e)}const o=i(a[0],e,0);if(o<0)return rye;t=o;for(let s=1,l=a.length;s<l;s++){t=i(a[s],e,t);if(!(t>-1))return rye}return r(t-o)}(e,a)}function lye(e,a){let{keepDiacritics:n}=a;return e=`${e}`,n||(e=e.replace(Yfe,(e=>Zfe[e]))),e}function uye(e,a){let n=a;"object"==typeof a&&(n=a.accessor);const t=n(e);return null==t?[]:Array.isArray(t)?t:[String(t)]}var cye={maxRanking:1/0,minRanking:-1/0};function dye(e){return"function"==typeof e?cye:{...cye,...e}}var mye={data:""},hye=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,pye=/\/\*[^]*?\*\/| +/g,gye=/\n+/g,vye=(e,a)=>{let n="",t="",i="";for(let r in e){let o=e[r];"@"==r[0]?"i"==r[1]?n=r+" "+o+";":t+="f"==r[1]?vye(o,r):r+"{"+vye(o,"k"==r[1]?"":a)+"}":"object"==typeof o?t+=vye(o,a?a.replace(/([^,])+/g,(e=>r.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,(a=>/&/.test(a)?a.replace(/&/g,e):e?e+" "+a:a)))):r):null!=o&&(r=/^--/.test(r)?r:r.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=vye.p?vye.p(r,o):r+":"+o+";")}return n+(a&&i?a+"{"+i+"}":i)+t},fye={},yye=e=>{if("object"==typeof e){let a="";for(let n in e)a+=n+yye(e[n]);return a}return e};function kye(e){let a=this||{},n=e.call?e(a.p):e;return((e,a,n,t,i)=>{let r=yye(e),o=fye[r]||(fye[r]=(e=>{let a=0,n=11;for(;a<e.length;)n=101*n+e.charCodeAt(a++)>>>0;return"go"+n})(r));if(!fye[o]){let a=r!==e?e:(e=>{let a,n,t=[{}];for(;a=hye.exec(e.replace(pye,""));)a[4]?t.shift():a[3]?(n=a[3].replace(gye," ").trim(),t.unshift(t[0][n]=t[0][n]||{})):t[0][a[1]]=a[2].replace(gye," ").trim();return t[0]})(e);fye[o]=vye(i?{["@keyframes "+o]:a}:a,n?"":"."+o)}let s=n&&fye.g?fye.g:null;return n&&(fye.g=fye[o]),l=fye[o],u=a,c=t,(d=s)?u.data=u.data.replace(d,l):-1===u.data.indexOf(l)&&(u.data=c?l+u.data:u.data+l),o;var l,u,c,d})(n.unshift?n.raw?((e,a,n)=>e.reduce(((e,t,i)=>{let r=a[i];if(r&&r.call){let e=r(n),a=e&&e.props&&e.props.className||/^go/.test(e)&&e;r=a?"."+a:e&&"object"==typeof e?e.props?"":vye(e,""):!1===e?"":e}return e+t+(null==r?"":r)}),""))(n,[].slice.call(arguments,1),a.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(a.p):n)),{}):n,(t=a.target,"object"==typeof window?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||mye),a.g,a.o,a.k);var t}function bye(e){var a,n,t="";if("string"==typeof e||"number"==typeof e)t+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(a=0;a<i;a++)e[a]&&(n=bye(e[a]))&&(t&&(t+=" "),t+=n)}else for(n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function Sye(){for(var e,a,n=0,t="",i=arguments.length;n<i;n++)(e=arguments[n])&&(a=bye(e))&&(t&&(t+=" "),t+=a);return t}function Aye(e,a){const n=Ma(e),{onChange:t}=a;let i=new Set(a.appear?void 0:n);const r=new WeakSet,[o,s]=ka([],{equals:!1}),[l]=[ja,Pa],u=e=>{s((a=>(a.push.apply(a,e),a)));for(const a of e)r.delete(a)},c=(e,a,n)=>e.splice(n,0,a);return wa((a=>{const n=o(),s=e();if(Ma(l))return l(),a;if(n.length){const e=a.filter((e=>!n.includes(e)));return n.length=0,t({list:e,added:[],removed:[],unchanged:e,finishRemoved:u}),e}return Ma((()=>{const e=new Set(s),n=s.slice(),o=[],l=[],d=[];for(const a of s)(i.has(a)?d:o).push(a);let m=!o.length;for(let t=0;t<a.length;t++){const i=a[t];e.has(i)||(r.has(i)||(l.push(i),r.add(i)),c(n,i,t)),m&&i!==n[t]&&(m=!1)}return!l.length&&m?a:(t({list:n,added:o,removed:l,unchanged:d,finishRemoved:u}),i=e,n)}))}),a.appear?[]:n.slice())}function wye(...e){return a=e,(...e)=>{for(const n of a)n&&n(...e)};var a}kye.bind({g:1}),kye.bind({k:1});var Cye=e=>e instanceof Element;function Mye(e,a){if(a(e))return e;if("function"==typeof e&&!e.length)return Mye(e(),a);if(Array.isArray(e)){const n=[];for(const t of e){const e=Mye(t,a);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function Tye(e,a=Cye,n=Cye){const t=wa(e),i=wa((()=>Mye(t(),a)));return i.toArray=()=>{const e=i();return Array.isArray(e)?e:e?[e]:[]},i}function Nye(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function xye(e,a,n,t){const{onBeforeEnter:i,onEnter:r,onAfterEnter:o}=a;function s(a){a&&a.target!==n||(n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.enterActive),n.classList.remove(...e.enterTo),o?.(n))}i?.(n),n.classList.add(...e.enter),n.classList.add(...e.enterActive),queueMicrotask((()=>{if(!n.parentNode)return t?.();r?.(n,(()=>s()))})),Nye((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!r||r.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function Eye(e,a,n,t){const{onBeforeExit:i,onExit:r,onAfterExit:o}=a;if(!n.parentNode)return t?.();function s(a){a&&a.target!==n||(t?.(),n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.exitActive),n.classList.remove(...e.exitTo),o?.(n))}i?.(n),n.classList.add(...e.exit),n.classList.add(...e.exitActive),r?.(n,(()=>s())),Nye((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!r||r.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var Pye=e=>{const a=function(e){return wa((()=>{const a=e.name||"s";return{enterActive:(e.enterActiveClass||a+"-enter-active").split(" "),enter:(e.enterClass||a+"-enter").split(" "),enterTo:(e.enterToClass||a+"-enter-to").split(" "),exitActive:(e.exitActiveClass||a+"-exit-active").split(" "),exit:(e.exitClass||a+"-exit").split(" "),exitTo:(e.exitToClass||a+"-exit-to").split(" "),move:(e.moveClass||a+"-move").split(" ")}}))}(e);return Aye(Tye((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:t,finishRemoved:i,list:r}){const o=a();for(const a of n)xye(o,e,a);const s=[];for(const e of r)e.isConnected&&(e instanceof HTMLElement||e instanceof SVGElement)&&s.push({el:e,rect:e.getBoundingClientRect()});queueMicrotask((()=>{const e=[];for(const{el:a,rect:n}of s)if(a.isConnected){const t=a.getBoundingClientRect(),i=n.left-t.left,r=n.top-t.top;(i||r)&&(a.style.transform=`translate(${i}px, ${r}px)`,a.style.transitionDuration="0s",e.push(a))}document;for(const a of e){let e=function(n){(n.target===a||/transform$/.test(n.propertyName))&&(a.removeEventListener("transitionend",e),a.classList.remove(...o.move))};a.classList.add(...o.move),a.style.transform=a.style.transitionDuration="",a.addEventListener("transitionend",e)}}));for(const a of t)Eye(o,e,a,(()=>i([a])))}})},jye=Symbol("fallback");function Lye(e){for(const a of e)a.dispose()}function Bye(e){const{by:a}=e;return wa(function(e,a,n,t={}){const i=new Map;return xa((()=>Lye(i.values()))),()=>{const n=e()||[];return Ma((()=>{if(!n.length)return Lye(i.values()),i.clear(),t.fallback?[ya((e=>(i.set(jye,{dispose:e}),t.fallback())))]:[];const e=new Array(n.length),o=i.get(jye);if(!i.size||o){o?.dispose(),i.delete(jye);for(let t=0;t<n.length;t++){const i=n[t];r(e,i,t,a(i,t))}return e}const s=new Set(i.keys());for(let t=0;t<n.length;t++){const o=n[t],l=a(o,t);s.delete(l);const u=i.get(l);u?(e[t]=u.mapped,u.setIndex?.(t),u.setItem((()=>o))):r(e,o,t,l)}for(const a of s)i.get(a)?.dispose(),i.delete(a);return e}))};function r(e,a,t,r){ya((o=>{const[s,l]=ka(a),u={setItem:l,dispose:o};if(n.length>1){const[e,a]=ka(t);u.setIndex=a,u.mapped=n(s,e)}else u.mapped=n(s);i.set(r,u),e[t]=u.mapped}))}}((()=>e.each),"function"==typeof a?a:e=>e[a],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function zye(e,a,n,t){const i=()=>{jfe(Pfe(e)).forEach((e=>{e&&jfe(Pfe(a)).forEach((a=>function(e,a,n,t){return e.addEventListener(a,n,t),Lfe(e.removeEventListener.bind(e,a,n,t))}(e,a,n,t)))}))};"function"==typeof e?Aa(i):Sa(i)}function Rye(e,a,n){const t=new WeakMap,{observe:i,unobserve:r}=function(e,a){const n=new ResizeObserver(e);return xa(n.disconnect.bind(n)),{observe:e=>n.observe(e,a),unobserve:n.unobserve.bind(n)}}((e=>{for(const n of e){const{contentRect:e,target:i}=n,r=Math.round(e.width),o=Math.round(e.height),s=t.get(i);s&&s.width===r&&s.height===o||(a(e,i,n),t.set(i,{width:r,height:o}))}}),n);Aa((a=>{const n=jfe(Pfe(e)).filter(Efe);return function(e,a,n,t){const i=e.length,r=a.length;let o,s,l=0;if(r)if(i){for(;l<r&&a[l]===e[l];l++);for(o of(a=a.slice(l),e=e.slice(l),a))e.includes(o)||t(o);for(s of e)a.includes(s)||n(s)}else for(;l<r;l++)t(a[l]);else for(;l<i;l++)n(e[l])}(n,a,i,r),n}),[])}var _ye=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function Dye(e){const a={};let n;for(;n=_ye.exec(e);)a[n[1]]=n[2];return a}function Kye(e,a){if("string"==typeof e){if("string"==typeof a)return`${e};${a}`;e=Dye(e)}else"string"==typeof a&&(a=Dye(a));return{...e,...a}}function Hye(e,a){const n=[...e],t=n.indexOf(a);return-1!==t&&n.splice(t,1),n}function Oye(e){return"[object String]"===Object.prototype.toString.call(e)}function Iye(e){return a=>`${e()}-${a}`}function Gye(e,a){return!!e&&(e===a||e.contains(a))}function Vye(e,a=!1){const{activeElement:n}=Fye(e);if(!n?.nodeName)return null;if(Jye(n)&&n.contentDocument)return Vye(n.contentDocument.body,a);if(a){const e=n.getAttribute("aria-activedescendant");if(e){const a=Fye(n).getElementById(e);if(a)return a}}return n}function Fye(e){return e?e.ownerDocument||e:document}function Jye(e){return"IFRAME"===e.tagName}var Uye=(e=>(e.Escape="Escape",e.Enter="Enter",e.Tab="Tab",e.Space=" ",e.ArrowDown="ArrowDown",e.ArrowLeft="ArrowLeft",e.ArrowRight="ArrowRight",e.ArrowUp="ArrowUp",e.End="End",e.Home="Home",e.PageDown="PageDown",e.PageUp="PageUp",e))(Uye||{});function Wye(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function qye(){return Wye(/^Mac/i)}function Zye(){return Wye(/^iPhone/i)||Wye(/^iPad/i)||qye()&&navigator.maxTouchPoints>1}function $ye(e,a){return a&&("function"==typeof a?a(e):a[0](a[1],e)),e?.defaultPrevented}function Yye(e){return a=>{for(const n of e)$ye(a,n)}}function Qye(e){return qye()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function Xye(e){if(e)if(function(){if(null==eke){eke=!1;try{document.createElement("div").focus({get preventScroll(){return eke=!0,!0}})}catch(uBe){}}return eke}())e.focus({preventScroll:!0});else{const a=function(e){let a=e.parentNode;const n=[],t=document.scrollingElement||document.documentElement;for(;a instanceof HTMLElement&&a!==t;)(a.offsetHeight<a.scrollHeight||a.offsetWidth<a.scrollWidth)&&n.push({element:a,scrollTop:a.scrollTop,scrollLeft:a.scrollLeft}),a=a.parentNode;t instanceof HTMLElement&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft});return n}(e);e.focus(),function(e){for(const{element:a,scrollTop:n,scrollLeft:t}of e)a.scrollTop=n,a.scrollLeft=t}(a)}}var eke=null;var ake=["input:not([type='hidden']):not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","[tabindex]","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])"],nke=[...ake,'[tabindex]:not([tabindex="-1"]):not([disabled])'],tke=ake.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",ike=nke.join(':not([hidden]):not([tabindex="-1"]),');function rke(e,a){const n=Array.from(e.querySelectorAll(tke)).filter(oke);return a&&oke(e)&&n.unshift(e),n.forEach(((e,a)=>{if(Jye(e)&&e.contentDocument){const t=rke(e.contentDocument.body,!1);n.splice(a,1,...t)}})),n}function oke(e){return ske(e)&&!function(e){const a=parseInt(e.getAttribute("tabindex")||"0",10);return a<0}(e)}function ske(e){return e.matches(tke)&&lke(e)}function lke(e,a){return"#comment"!==e.nodeName&&function(e){if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const{display:a,visibility:n}=e.style;let t="none"!==a&&"hidden"!==n&&"collapse"!==n;if(t){if(!e.ownerDocument.defaultView)return t;const{getComputedStyle:a}=e.ownerDocument.defaultView,{display:n,visibility:i}=a(e);t="none"!==n&&"hidden"!==i&&"collapse"!==i}return t}(e)&&function(e,a){return!e.hasAttribute("hidden")&&("DETAILS"!==e.nodeName||!a||"SUMMARY"===a.nodeName||e.hasAttribute("open"))}(e,a)&&(!e.parentElement||lke(e.parentElement,e))}function uke(e){for(;e&&!cke(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function cke(e){const a=window.getComputedStyle(e);return/(auto|scroll)/.test(a.overflow+a.overflowX+a.overflowY)}function dke(){}function mke(e,a){return rn(e,a)}var hke=new Map,pke=new Set;function gke(){if("undefined"==typeof window)return;const e=a=>{if(!a.target)return;const n=hke.get(a.target);if(n&&(n.delete(a.propertyName),0===n.size&&(a.target.removeEventListener("transitioncancel",e),hke.delete(a.target)),0===hke.size)){for(const e of pke)e();pke.clear()}};document.body.addEventListener("transitionrun",(a=>{if(!a.target)return;let n=hke.get(a.target);n||(n=new Set,hke.set(a.target,n),a.target.addEventListener("transitioncancel",e)),n.add(a.propertyName)})),document.body.addEventListener("transitionend",e)}function vke(e,a){const n=fke(e,a,"left"),t=fke(e,a,"top"),i=a.offsetWidth,r=a.offsetHeight;let o=e.scrollLeft,s=e.scrollTop;const l=o+e.offsetWidth,u=s+e.offsetHeight;n<=o?o=n:n+i>l&&(o+=n+i-l),t<=s?s=t:t+r>u&&(s+=t+r-u),e.scrollLeft=o,e.scrollTop=s}function fke(e,a,n){const t="left"===n?"offsetLeft":"offsetTop";let i=0;for(;a.offsetParent&&(i+=a[t],a.offsetParent!==e);){if(a.offsetParent.contains(e)){i-=e[t];break}a=a.offsetParent}return i}"undefined"!=typeof document&&("loading"!==document.readyState?gke():document.addEventListener("DOMContentLoaded",gke));var yke={border:"0",clip:"rect(0 0 0 0)","clip-path":"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:"0",position:"absolute",width:"1px","white-space":"nowrap"};function kke(e){return a=>(e(a),()=>e(void 0))}function bke(e,a){const[n,t]=ka(Ske(a?.()));return Aa((()=>{t(e()?.tagName.toLowerCase()||Ske(a?.()))})),n}function Ske(e){return Oye(e)?e:void 0}function Ake(e){const[a,n]=on(e,["as"]);if(!a.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return Xa(Fn,rn(n,{get component(){return a.as}}))}var wke=["id","name","validationState","required","disabled","readOnly"];var Cke=Ba();function Mke(){const e=za(Cke);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function Tke(e){const a=Mke(),n=mke({id:a.generateId("description")},e);return Aa((()=>xa(a.registerDescription(n.id)))),Xa(Ake,rn({as:"div"},(()=>a.dataset()),n))}function Nke(e){const a=Mke(),n=mke({id:a.generateId("error-message")},e),[t,i]=on(n,["forceMount"]),r=()=>"invalid"===a.validationState();return Aa((()=>{r()&&xa(a.registerErrorMessage(i.id))})),Xa(hn,{get when(){return t.forceMount||r()},get children(){return Xa(Ake,rn({as:"div"},(()=>a.dataset()),i))}})}function xke(e){let a;const n=Mke(),t=mke({id:n.generateId("label")},e),[i,r]=on(t,["ref"]),o=bke((()=>a),(()=>"label"));return Aa((()=>xa(n.registerLabel(r.id)))),Xa(Ake,rn({as:"label",ref(e){const n=wye((e=>a=e),i.ref);"function"==typeof n&&n(e)},get for(){return wa((()=>"label"===o()))()?n.fieldId():void 0}},(()=>n.dataset()),r))}function Eke(e,a){Aa(Ta(e,(e=>{if(null==e)return;const n=function(e){return function(e){return e.matches("textarea, input, select, button")}(e)?e.form:e.closest("form")}(e);null!=n&&(n.addEventListener("reset",a,{passive:!0}),xa((()=>{n.removeEventListener("reset",a)})))})))}function Pke(e){const[a,n]=ka(e.defaultValue?.()),t=wa((()=>void 0!==e.value?.())),i=wa((()=>t()?e.value?.():a()));return[i,a=>{Ma((()=>{const r=function(e,...a){return"function"==typeof e?e(...a):e}(a,i());return Object.is(r,i())||(t()||n(r),e.onChange?.(r)),r}))}]}function jke(e){const[a,n]=Pke(e);return[()=>a()??!1,n]}var Lke=Object.defineProperty,Bke=(e,a)=>{for(var n in a)Lke(e,n,{get:a[n],enumerable:!0})},zke=Ba();function Rke(){return za(zke)}function _ke(e,a){return Boolean(a.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Dke(e,a){const n=function(e){const a=e.map(((e,a)=>[a,e]));let n=!1;return a.sort((([e,a],[t,i])=>{const r=a.ref(),o=i.ref();return r===o?0:r&&o?_ke(r,o)?(e>t&&(n=!0),-1):(e<t&&(n=!0),1):0})),n?a.map((([e,a])=>a)):e}(e);e!==n&&a(n)}function Kke(e,a){if("function"!=typeof IntersectionObserver)return void function(e,a){Aa((()=>{const n=setTimeout((()=>{Dke(e(),a)}));xa((()=>clearTimeout(n)))}))}(e,a);let n=[];Aa((()=>{const t=function(e){const a=e[0],n=e[e.length-1]?.ref();let t=a?.ref()?.parentElement;for(;t;){if(n&&t.contains(n))return t;t=t.parentElement}return Fye(t).body}(e()),i=new IntersectionObserver((()=>{const t=!!n.length;n=e(),t&&Dke(e(),a)}),{root:t});for(const a of e()){const e=a.ref();e&&i.observe(e)}xa((()=>i.disconnect()))}))}function Hke(e={}){const[a,n]=function(e){const[a,n]=Pke(e);return[()=>a()??[],n]}({value:()=>Pfe(e.items),onChange:a=>e.onItemsChange?.(a)});Kke(a,n);const t=e=>(n((a=>{const n=function(e,a){const n=a.ref();if(!n)return-1;let t=e.length;if(!t)return-1;for(;t--;){const a=e[t]?.ref();if(a&&_ke(a,n))return t+1}return 0}(a,e);return function(e,a,n=-1){return n in e?[...e.slice(0,n),a,...e.slice(n)]:[...e,a]}(a,e,n)})),()=>{n((a=>{const n=a.filter((a=>a.ref()!==e.ref()));return a.length===n.length?a:n}))});return{DomCollectionProvider:e=>Xa(zke.Provider,{value:{registerItem:t},get children(){return e.children}})}}function Oke(e){const a=function(){const e=Rke();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=mke({shouldRegisterItem:!0},e);Aa((()=>{if(!n.shouldRegisterItem)return;xa(a.registerItem(n.getItem()))}))}function Ike(e){let a=e.startIndex??0;const n=e.startLevel??0,t=[],i=a=>{if(null==a)return"";const n=e.getKey??"key",t=Oye(n)?a[n]:n(a);return null!=t?String(t):""},r=a=>{if(null==a)return"";const n=e.getTextValue??"textValue",t=Oye(n)?a[n]:n(a);return null!=t?String(t):""},o=a=>{if(null==a)return!1;const n=e.getDisabled??"disabled";return(Oye(n)?a[n]:n(a))??!1},s=a=>{if(null!=a)return Oye(e.getSectionChildren)?a[e.getSectionChildren]:e.getSectionChildren?.(a)};for(const l of e.dataSource)if(Oye(l)||"number"==typeof l)t.push({type:"item",rawValue:l,key:String(l),textValue:String(l),disabled:o(l),level:n,index:a}),a++;else if(null!=s(l)){t.push({type:"section",rawValue:l,key:"",textValue:"",disabled:!1,level:n,index:a}),a++;const i=s(l)??[];if(i.length>0){const r=Ike({dataSource:i,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:a,startLevel:n+1});t.push(...r),a+=r.length}}else t.push({type:"item",rawValue:l,key:i(l),textValue:r(l),disabled:o(l),level:n,index:a}),a++;return t}function Gke(e,a=[]){return wa((()=>{const n=Ike({dataSource:Pfe(e.dataSource),getKey:Pfe(e.getKey),getTextValue:Pfe(e.getTextValue),getDisabled:Pfe(e.getDisabled),getSectionChildren:Pfe(e.getSectionChildren)});for(let e=0;e<a.length;e++)a[e]();return e.factory(n)}))}var Vke=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Fke=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Jke(e){return function(e){if(Intl.Locale){const a=new Intl.Locale(e).maximize().script??"";return Vke.has(a)}const a=e.split("-")[0];return Fke.has(a)}(e)?"rtl":"ltr"}function Uke(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Jke(e)}}var Wke=Uke(),qke=new Set;function Zke(){Wke=Uke();for(const e of qke)e(Wke)}var $ke=Ba();function Yke(){const e=function(){const[e,a]=ka(Wke),n=wa((()=>e()));return Na((()=>{0===qke.size&&window.addEventListener("languagechange",Zke),qke.add(a),xa((()=>{qke.delete(a),0===qke.size&&window.removeEventListener("languagechange",Zke)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return za($ke)||e}var Qke=new Map;var Xke=class e extends Set{anchorKey;currentKey;constructor(a,n,t){super(a),a instanceof e?(this.anchorKey=n||a.anchorKey,this.currentKey=t||a.currentKey):(this.anchorKey=n,this.currentKey=t)}};function ebe(e){return qye()||Zye()?e.altKey:e.ctrlKey}function abe(e){return qye()?e.metaKey:e.ctrlKey}function nbe(e){return new Xke(e)}function tbe(e){const a=mke({selectionMode:"none",selectionBehavior:"toggle"},e),[n,t]=ka(!1),[i,r]=ka(),o=wa((()=>{const e=Pfe(a.selectedKeys);return null!=e?nbe(e):e})),s=wa((()=>{const e=Pfe(a.defaultSelectedKeys);return null!=e?nbe(e):new Xke})),[l,u]=function(e){const[a,n]=Pke(e);return[()=>a()??new Xke,n]}({value:o,defaultValue:s,onChange:e=>a.onSelectionChange?.(e)}),[c,d]=ka(Pfe(a.selectionBehavior));return Aa((()=>{const e=l();"replace"===Pfe(a.selectionBehavior)&&"toggle"===c()&&"object"==typeof e&&0===e.size&&d("replace")})),Aa((()=>{d(Pfe(a.selectionBehavior)??"toggle")})),{selectionMode:()=>Pfe(a.selectionMode),disallowEmptySelection:()=>Pfe(a.disallowEmptySelection)??!1,selectionBehavior:c,setSelectionBehavior:d,isFocused:n,setFocused:t,focusedKey:i,setFocusedKey:r,selectedKeys:l,setSelectedKeys:e=>{!Pfe(a.allowDuplicateSelectionEvents)&&function(e,a){if(e.size!==a.size)return!1;for(const n of e)if(!a.has(n))return!1;return!0}(e,l())||u(e)}}}function ibe(e,a,n){const t=rn({selectOnFocus:()=>"replace"===Pfe(e.selectionManager).selectionBehavior()},e),i=()=>a(),{direction:r}=Yke();let o={top:0,left:0};zye((()=>Pfe(t.isVirtualized)?void 0:i()),"scroll",(()=>{const e=i();e&&(o={top:e.scrollTop,left:e.scrollLeft})}));const{typeSelectHandlers:s}=function(e){const[a,n]=ka(""),[t,i]=ka(-1);return{typeSelectHandlers:{onKeyDown:r=>{if(Pfe(e.isDisabled))return;const o=Pfe(e.keyboardDelegate),s=Pfe(e.selectionManager);if(!o.getKeyForSearch)return;const l=function(e){return 1!==e.length&&/^[A-Z]/i.test(e)?"":e}(r.key);if(!l||r.ctrlKey||r.metaKey)return;" "===l&&a().trim().length>0&&(r.preventDefault(),r.stopPropagation());let u=n((e=>e+l)),c=o.getKeyForSearch(u,s.focusedKey())??o.getKeyForSearch(u);null==c&&function(e){return e.split("").every((a=>a===e[0]))}(u)&&(u=u[0],c=o.getKeyForSearch(u,s.focusedKey())??o.getKeyForSearch(u)),null!=c&&(s.setFocusedKey(c),e.onTypeSelect?.(c)),clearTimeout(t()),i(window.setTimeout((()=>n("")),500))}}}}({isDisabled:()=>Pfe(t.disallowTypeAhead),keyboardDelegate:()=>Pfe(t.keyboardDelegate),selectionManager:()=>Pfe(t.selectionManager)}),l=()=>Pfe(t.orientation)??"vertical",u=()=>{const e=Pfe(t.autoFocus);if(!e)return;const n=Pfe(t.selectionManager),i=Pfe(t.keyboardDelegate);let r;"first"===e&&(r=i.getFirstKey?.()),"last"===e&&(r=i.getLastKey?.());const o=n.selectedKeys();o.size&&(r=o.values().next().value),n.setFocused(!0),n.setFocusedKey(r);const s=a();s&&null==r&&!Pfe(t.shouldUseVirtualFocus)&&Xye(s)};Na((()=>{t.deferAutoFocus?setTimeout(u,0):u()})),Aa(Ta([i,()=>Pfe(t.isVirtualized),()=>Pfe(t.selectionManager).focusedKey()],(e=>{const[a,n,i]=e;if(n)i&&t.scrollToKey?.(i);else if(i&&a){const e=a.querySelector(`[data-key="${i}"]`);e&&vke(a,e)}})));return{tabIndex:wa((()=>{if(!Pfe(t.shouldUseVirtualFocus))return null==Pfe(t.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{$ye(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=a();if(!n?.contains(e.target))return;const i=Pfe(t.selectionManager),o=Pfe(t.selectOnFocus),u=a=>{null!=a&&(i.setFocusedKey(a),e.shiftKey&&"multiple"===i.selectionMode()?i.extendSelection(a):o&&!ebe(e)&&i.replaceSelection(a))},c=Pfe(t.keyboardDelegate),d=Pfe(t.shouldFocusWrap),m=i.focusedKey();switch(e.key){case"vertical"===l()?"ArrowDown":"ArrowRight":if(c.getKeyBelow){let a;e.preventDefault(),a=null!=m?c.getKeyBelow(m):c.getFirstKey?.(),null==a&&d&&(a=c.getFirstKey?.(m)),u(a)}break;case"vertical"===l()?"ArrowUp":"ArrowLeft":if(c.getKeyAbove){let a;e.preventDefault(),a=null!=m?c.getKeyAbove(m):c.getLastKey?.(),null==a&&d&&(a=c.getLastKey?.(m)),u(a)}break;case"vertical"===l()?"ArrowLeft":"ArrowUp":if(c.getKeyLeftOf){e.preventDefault();const a="rtl"===r();let n;n=null!=m?c.getKeyLeftOf(m):a?c.getFirstKey?.():c.getLastKey?.(),u(n)}break;case"vertical"===l()?"ArrowRight":"ArrowDown":if(c.getKeyRightOf){e.preventDefault();const a="rtl"===r();let n;n=null!=m?c.getKeyRightOf(m):a?c.getLastKey?.():c.getFirstKey?.(),u(n)}break;case"Home":if(c.getFirstKey){e.preventDefault();const a=c.getFirstKey(m,abe(e));null!=a&&(i.setFocusedKey(a),abe(e)&&e.shiftKey&&"multiple"===i.selectionMode()?i.extendSelection(a):o&&i.replaceSelection(a))}break;case"End":if(c.getLastKey){e.preventDefault();const a=c.getLastKey(m,abe(e));null!=a&&(i.setFocusedKey(a),abe(e)&&e.shiftKey&&"multiple"===i.selectionMode()?i.extendSelection(a):o&&i.replaceSelection(a))}break;case"PageDown":if(c.getKeyPageBelow&&null!=m){e.preventDefault();u(c.getKeyPageBelow(m))}break;case"PageUp":if(c.getKeyPageAbove&&null!=m){e.preventDefault();u(c.getKeyPageAbove(m))}break;case"a":abe(e)&&"multiple"===i.selectionMode()&&!0!==Pfe(t.disallowSelectAll)&&(e.preventDefault(),i.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),Pfe(t.disallowEmptySelection)||i.clearSelection());break;case"Tab":if(!Pfe(t.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,a){const n=a?.tabbable?ike:tke,t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>a?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&lke(e)&&(!a?.accept||a.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});return a?.from&&(t.currentNode=a.from),t}(n,{tabbable:!0});let a,t;do{t=e.lastChild(),t&&(a=t)}while(t);a&&!a.contains(document.activeElement)&&Xye(a)}break}}},onMouseDown:e=>{i()===e.target&&e.preventDefault()},onFocusIn:e=>{const a=Pfe(t.selectionManager),n=Pfe(t.keyboardDelegate),r=Pfe(t.selectOnFocus);if(a.isFocused())e.currentTarget.contains(e.target)||a.setFocused(!1);else if(e.currentTarget.contains(e.target))if(a.setFocused(!0),null==a.focusedKey()){const t=e=>{null!=e&&(a.setFocusedKey(e),r&&a.replaceSelection(e))},i=e.relatedTarget;i&&e.currentTarget.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING?t(a.lastSelectedKey()??n.getLastKey?.()):t(a.firstSelectedKey()??n.getFirstKey?.())}else if(!Pfe(t.isVirtualized)){const e=i();if(e){e.scrollTop=o.top,e.scrollLeft=o.left;const n=e.querySelector(`[data-key="${a.focusedKey()}"]`);n&&(Xye(n),vke(e,n))}}},onFocusOut:e=>{const a=Pfe(t.selectionManager);e.currentTarget.contains(e.relatedTarget)||a.setFocused(!1)}}}function rbe(e,a){const n=()=>Pfe(e.selectionManager),t=()=>Pfe(e.key),i=()=>Pfe(e.shouldUseVirtualFocus),r=e=>{"none"!==n().selectionMode()&&("single"===n().selectionMode()?n().isSelected(t())&&!n().disallowEmptySelection()?n().toggleSelection(t()):n().replaceSelection(t()):e?.shiftKey?n().extendSelection(t()):"toggle"===n().selectionBehavior()||abe(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(t()):n().replaceSelection(t()))},o=()=>Pfe(e.disabled)||n().isDisabled(t()),s=()=>!o()&&n().canSelectItem(t());let l=null;const u=wa((()=>{if(!i()&&!o())return t()===n().focusedKey()?0:-1})),c=wa((()=>Pfe(e.virtualized)?void 0:t()));return Aa(Ta([a,t,i,()=>n().focusedKey(),()=>n().isFocused()],(([a,n,t,i,r])=>{a&&n===i&&r&&!t&&document.activeElement!==a&&(e.focus?e.focus():Xye(a))}))),{isSelected:()=>n().isSelected(t()),isDisabled:o,allowsSelection:s,tabIndex:u,dataKey:c,onPointerDown:a=>{s()&&(l=a.pointerType,"mouse"!==a.pointerType||0!==a.button||Pfe(e.shouldSelectOnPressUp)||r(a))},onPointerUp:a=>{s()&&"mouse"===a.pointerType&&0===a.button&&Pfe(e.shouldSelectOnPressUp)&&Pfe(e.allowsDifferentPressOrigin)&&r(a)},onClick:a=>{s()&&(Pfe(e.shouldSelectOnPressUp)&&!Pfe(e.allowsDifferentPressOrigin)||"mouse"!==l)&&r(a)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(ebe(e)?n().toggleSelection(t()):r(e))},onMouseDown:e=>{o()&&e.preventDefault()},onFocus:e=>{const r=a();i()||o()||!r||e.target===r&&n().setFocusedKey(t())}}}var obe=class{collection;state;constructor(e,a){this.collection=e,this.state=a}selectionMode(){return this.state.selectionMode()}disallowEmptySelection(){return this.state.disallowEmptySelection()}selectionBehavior(){return this.state.selectionBehavior()}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}isFocused(){return this.state.isFocused()}setFocused(e){this.state.setFocused(e)}focusedKey(){return this.state.focusedKey()}setFocusedKey(e){(null==e||this.collection().getItem(e))&&this.state.setFocusedKey(e)}selectedKeys(){return this.state.selectedKeys()}isSelected(e){if("none"===this.state.selectionMode())return!1;const a=this.getKey(e);return null!=a&&this.state.selectedKeys().has(a)}isEmpty(){return 0===this.state.selectedKeys().size}isSelectAll(){if(this.isEmpty())return!1;const e=this.state.selectedKeys();return this.getAllSelectableKeys().every((a=>e.has(a)))}firstSelectedKey(){let e;for(const a of this.state.selectedKeys()){const n=this.collection().getItem(a);e&&!(null!=n?.index&&null!=e?.index&&n.index<e.index)||(e=n)}return e?.key}lastSelectedKey(){let e;for(const a of this.state.selectedKeys()){const n=this.collection().getItem(a);e&&!(null!=n?.index&&null!=e?.index&&n.index>e.index)||(e=n)}return e?.key}extendSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode())return void this.replaceSelection(e);const a=this.getKey(e);if(null==a)return;const n=this.state.selectedKeys(),t=n.anchorKey||a,i=new Xke(n,t,a);for(const r of this.getKeyRange(t,n.currentKey||a))i.delete(r);for(const r of this.getKeyRange(a,t))this.canSelectItem(r)&&i.add(r);this.state.setSelectedKeys(i)}getKeyRange(e,a){const n=this.collection().getItem(e),t=this.collection().getItem(a);return n&&t?null!=n.index&&null!=t.index&&n.index<=t.index?this.getKeyRangeInternal(e,a):this.getKeyRangeInternal(a,e):[]}getKeyRangeInternal(e,a){const n=[];let t=e;for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&n.push(t),t===a)return n;t=this.collection().getKeyAfter(t)}return[]}getKey(e){const a=this.collection().getItem(e);return a?a&&"item"===a.type?a.key:null:e}toggleSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode()&&!this.isSelected(e))return void this.replaceSelection(e);const a=this.getKey(e);if(null==a)return;const n=new Xke(this.state.selectedKeys());n.has(a)?n.delete(a):this.canSelectItem(a)&&(n.add(a),n.anchorKey=a,n.currentKey=a),this.disallowEmptySelection()&&0===n.size||this.state.setSelectedKeys(n)}replaceSelection(e){if("none"===this.selectionMode())return;const a=this.getKey(e);if(null==a)return;const n=this.canSelectItem(a)?new Xke([a],a,a):new Xke;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const a=new Xke;for(const n of e){const e=this.getKey(n);if(null!=e&&(a.add(e),"single"===this.selectionMode()))break}this.state.setSelectedKeys(a)}selectAll(){"multiple"===this.selectionMode()&&this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()))}clearSelection(){const e=this.state.selectedKeys();!this.disallowEmptySelection()&&e.size>0&&this.state.setSelectedKeys(new Xke)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,a){"none"!==this.selectionMode()&&("single"===this.selectionMode()?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):"toggle"===this.selectionBehavior()||a&&"touch"===a.pointerType?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;const a=this.selectedKeys();if(e.size!==a.size)return!1;for(const n of e)if(!a.has(n))return!1;for(const n of a)if(!e.has(n))return!1;return!0}canSelectItem(e){if("none"===this.state.selectionMode())return!1;const a=this.collection().getItem(e);return null!=a&&!a.disabled}isDisabled(e){const a=this.collection().getItem(e);return!a||a.disabled}getAllSelectableKeys(){const e=[];return(a=>{for(;null!=a;){if(this.canSelectItem(a)){const n=this.collection().getItem(a);if(!n)continue;"item"===n.type&&e.push(a)}a=this.collection().getKeyAfter(a)}})(this.collection().getFirstKey()),e}},sbe=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(const t of e)this.keyMap.set(t.key,t);if(0===this.keyMap.size)return;let a,n=0;for(const[t,i]of this.keyMap)a?(a.nextKey=t,i.prevKey=a.key):(this.firstKey=t,i.prevKey=void 0),"item"===i.type&&(i.index=n++),a=i,a.nextKey=void 0;this.lastKey=a.key}*[Symbol.iterator](){yield*this.iterable}getSize(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey}getKeyAfter(e){return this.keyMap.get(e)?.nextKey}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const a=[...this.getKeys()];return this.getItem(a[e])}};var lbe,ube=e=>"function"==typeof e?e():e,cbe=e=>{const a=wa((()=>{const a=ube(e.element);if(a)return getComputedStyle(a)})),n=()=>a()?.animationName??"none",[t,i]=ka(ube(e.show)?"present":"hidden");let r="none";return Aa((t=>{const o=ube(e.show);return Ma((()=>{if(t===o)return o;const e=r,s=n();if(o)i("present");else if("none"===s||"none"===a()?.display)i("hidden");else{i(!0===t&&e!==s?"hiding":"hidden")}})),o})),Aa((()=>{const a=ube(e.element);if(!a)return;const o=e=>{e.target===a&&(r=n())},s=e=>{const r=n().includes(e.animationName);e.target===a&&r&&"hiding"===t()&&i("hidden")};a.addEventListener("animationstart",o),a.addEventListener("animationcancel",s),a.addEventListener("animationend",s),xa((()=>{a.removeEventListener("animationstart",o),a.removeEventListener("animationcancel",s),a.removeEventListener("animationend",s)}))})),{present:()=>"present"===t()||"hiding"===t(),state:t}},dbe="data-kb-top-layer",mbe=!1,hbe=[];function pbe(e){return hbe.findIndex((a=>a.node===e))}function gbe(){return hbe.filter((e=>e.isPointerBlocking))}function vbe(){return gbe().length>0}function fbe(e){const a=pbe([...gbe()].slice(-1)[0]?.node);return pbe(e)<a}var ybe={layers:hbe,isTopMostLayer:function(e){return hbe[hbe.length-1].node===e},hasPointerBlockingLayer:vbe,isBelowPointerBlockingLayer:fbe,addLayer:function(e){hbe.push(e)},removeLayer:function(e){const a=pbe(e);a<0||hbe.splice(a,1)},indexOf:pbe,find:function(e){return hbe[pbe(e)]},assignPointerEventToLayers:function(){for(const{node:e}of hbe)e.style.pointerEvents=fbe(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(vbe()&&!mbe){const a=Fye(e);lbe=document.body.style.pointerEvents,a.body.style.pointerEvents="none",mbe=!0}},restoreBodyPointerEvents:function(e){if(vbe())return;const a=Fye(e);a.body.style.pointerEvents=lbe,0===a.body.style.length&&a.body.removeAttribute("style"),mbe=!1}};Bke({},{Button:()=>Sbe,Root:()=>bbe});var kbe=["button","color","file","image","reset","submit"];function bbe(e){let a;const n=mke({type:"button"},e),[t,i]=on(n,["ref","type","disabled"]),r=bke((()=>a),(()=>"button")),o=wa((()=>{const e=r();return null!=e&&function(e){const a=e.tagName.toLowerCase();return"button"===a||!("input"!==a||!e.type)&&-1!==kbe.indexOf(e.type)}({tagName:e,type:t.type})})),s=wa((()=>"input"===r())),l=wa((()=>"a"===r()&&null!=a?.getAttribute("href")));return Xa(Ake,rn({as:"button",ref(e){const n=wye((e=>a=e),t.ref);"function"==typeof n&&n(e)},get type(){return o()||s()?t.type:void 0},get role(){return o()||l()?void 0:"button"},get tabIndex(){return o()||l()||t.disabled?void 0:0},get disabled(){return o()||s()?t.disabled:void 0},get"aria-disabled"(){return!(o()||s()||!t.disabled)||void 0},get"data-disabled"(){return t.disabled?"":void 0}},i))}var Sbe=bbe,Abe=["top","right","bottom","left"],wbe=Math.min,Cbe=Math.max,Mbe=Math.round,Tbe=Math.floor,Nbe=e=>({x:e,y:e}),xbe={left:"right",right:"left",bottom:"top",top:"bottom"},Ebe={start:"end",end:"start"};function Pbe(e,a,n){return Cbe(e,wbe(a,n))}function jbe(e,a){return"function"==typeof e?e(a):e}function Lbe(e){return e.split("-")[0]}function Bbe(e){return e.split("-")[1]}function zbe(e){return"x"===e?"y":"x"}function Rbe(e){return"y"===e?"height":"width"}function _be(e){return["top","bottom"].includes(Lbe(e))?"y":"x"}function Dbe(e){return zbe(_be(e))}function Kbe(e){return e.replace(/start|end/g,(e=>Ebe[e]))}function Hbe(e){return e.replace(/left|right|bottom|top/g,(e=>xbe[e]))}function Obe(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Ibe(e){const{x:a,y:n,width:t,height:i}=e;return{width:t,height:i,top:n,left:a,right:a+t,bottom:n+i,x:a,y:n}}function Gbe(e,a,n){let{reference:t,floating:i}=e;const r=_be(a),o=Dbe(a),s=Rbe(o),l=Lbe(a),u="y"===r,c=t.x+t.width/2-i.width/2,d=t.y+t.height/2-i.height/2,m=t[s]/2-i[s]/2;let h;switch(l){case"top":h={x:c,y:t.y-i.height};break;case"bottom":h={x:c,y:t.y+t.height};break;case"right":h={x:t.x+t.width,y:d};break;case"left":h={x:t.x-i.width,y:d};break;default:h={x:t.x,y:t.y}}switch(Bbe(a)){case"start":h[o]-=m*(n&&u?-1:1);break;case"end":h[o]+=m*(n&&u?-1:1)}return h}async function Vbe(e,a){var n;void 0===a&&(a={});const{x:t,y:i,platform:r,rects:o,elements:s,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:m=!1,padding:h=0}=jbe(a,e),p=Obe(h),g=s[m?"floating"===d?"reference":"floating":d],v=Ibe(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(g)))||n?g:g.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:l})),f="floating"===d?{x:t,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),k=await(null==r.isElement?void 0:r.isElement(y))&&await(null==r.getScale?void 0:r.getScale(y))||{x:1,y:1},b=Ibe(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:f,offsetParent:y,strategy:l}):f);return{top:(v.top-b.top+p.top)/k.y,bottom:(b.bottom-v.bottom+p.bottom)/k.y,left:(v.left-b.left+p.left)/k.x,right:(b.right-v.right+p.right)/k.x}}function Fbe(e,a){return{top:e.top-a.height,right:e.right-a.width,bottom:e.bottom-a.height,left:e.left-a.width}}function Jbe(e){return Abe.some((a=>e[a]>=0))}function Ube(e){return Zbe(e)?(e.nodeName||"").toLowerCase():"#document"}function Wbe(e){var a;return(null==e||null==(a=e.ownerDocument)?void 0:a.defaultView)||window}function qbe(e){var a;return null==(a=(Zbe(e)?e.ownerDocument:e.document)||window.document)?void 0:a.documentElement}function Zbe(e){return e instanceof Node||e instanceof Wbe(e).Node}function $be(e){return e instanceof Element||e instanceof Wbe(e).Element}function Ybe(e){return e instanceof HTMLElement||e instanceof Wbe(e).HTMLElement}function Qbe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Wbe(e).ShadowRoot)}function Xbe(e){const{overflow:a,overflowX:n,overflowY:t,display:i}=rSe(e);return/auto|scroll|overlay|hidden|clip/.test(a+t+n)&&!["inline","contents"].includes(i)}function eSe(e){return["table","td","th"].includes(Ube(e))}function aSe(e){return[":popover-open",":modal"].some((a=>{try{return e.matches(a)}catch(uBe){return!1}}))}function nSe(e){const a=tSe(),n=$be(e)?rSe(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!a&&!!n.backdropFilter&&"none"!==n.backdropFilter||!a&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function tSe(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function iSe(e){return["html","body","#document"].includes(Ube(e))}function rSe(e){return Wbe(e).getComputedStyle(e)}function oSe(e){return $be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sSe(e){if("html"===Ube(e))return e;const a=e.assignedSlot||e.parentNode||Qbe(e)&&e.host||qbe(e);return Qbe(a)?a.host:a}function lSe(e){const a=sSe(e);return iSe(a)?e.ownerDocument?e.ownerDocument.body:e.body:Ybe(a)&&Xbe(a)?a:lSe(a)}function uSe(e,a,n){var t;void 0===a&&(a=[]),void 0===n&&(n=!0);const i=lSe(e),r=i===(null==(t=e.ownerDocument)?void 0:t.body),o=Wbe(i);return r?a.concat(o,o.visualViewport||[],Xbe(i)?i:[],o.frameElement&&n?uSe(o.frameElement):[]):a.concat(i,uSe(i,[],n))}function cSe(e){const a=rSe(e);let n=parseFloat(a.width)||0,t=parseFloat(a.height)||0;const i=Ybe(e),r=i?e.offsetWidth:n,o=i?e.offsetHeight:t,s=Mbe(n)!==r||Mbe(t)!==o;return s&&(n=r,t=o),{width:n,height:t,$:s}}function dSe(e){return $be(e)?e:e.contextElement}function mSe(e){const a=dSe(e);if(!Ybe(a))return Nbe(1);const n=a.getBoundingClientRect(),{width:t,height:i,$:r}=cSe(a);let o=(r?Mbe(n.width):n.width)/t,s=(r?Mbe(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var hSe=Nbe(0);function pSe(e){const a=Wbe(e);return tSe()&&a.visualViewport?{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}:hSe}function gSe(e,a,n,t){void 0===a&&(a=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),r=dSe(e);let o=Nbe(1);a&&(t?$be(t)&&(o=mSe(t)):o=mSe(e));const s=function(e,a,n){return void 0===a&&(a=!1),!(!n||a&&n!==Wbe(e))&&a}(r,n,t)?pSe(r):Nbe(0);let l=(i.left+s.x)/o.x,u=(i.top+s.y)/o.y,c=i.width/o.x,d=i.height/o.y;if(r){const e=Wbe(r),a=t&&$be(t)?Wbe(t):t;let n=e,i=n.frameElement;for(;i&&t&&a!==n;){const e=mSe(i),a=i.getBoundingClientRect(),t=rSe(i),r=a.left+(i.clientLeft+parseFloat(t.paddingLeft))*e.x,o=a.top+(i.clientTop+parseFloat(t.paddingTop))*e.y;l*=e.x,u*=e.y,c*=e.x,d*=e.y,l+=r,u+=o,n=Wbe(i),i=n.frameElement}}return Ibe({width:c,height:d,x:l,y:u})}function vSe(e){return gSe(qbe(e)).left+oSe(e).scrollLeft}function fSe(e,a,n){let t;if("viewport"===a)t=function(e,a){const n=Wbe(e),t=qbe(e),i=n.visualViewport;let r=t.clientWidth,o=t.clientHeight,s=0,l=0;if(i){r=i.width,o=i.height;const e=tSe();(!e||e&&"fixed"===a)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:r,height:o,x:s,y:l}}(e,n);else if("document"===a)t=function(e){const a=qbe(e),n=oSe(e),t=e.ownerDocument.body,i=Cbe(a.scrollWidth,a.clientWidth,t.scrollWidth,t.clientWidth),r=Cbe(a.scrollHeight,a.clientHeight,t.scrollHeight,t.clientHeight);let o=-n.scrollLeft+vSe(e);const s=-n.scrollTop;return"rtl"===rSe(t).direction&&(o+=Cbe(a.clientWidth,t.clientWidth)-i),{width:i,height:r,x:o,y:s}}(qbe(e));else if($be(a))t=function(e,a){const n=gSe(e,!0,"fixed"===a),t=n.top+e.clientTop,i=n.left+e.clientLeft,r=Ybe(e)?mSe(e):Nbe(1);return{width:e.clientWidth*r.x,height:e.clientHeight*r.y,x:i*r.x,y:t*r.y}}(a,n);else{const n=pSe(e);t={...a,x:a.x-n.x,y:a.y-n.y}}return Ibe(t)}function ySe(e,a){const n=sSe(e);return!(n===a||!$be(n)||iSe(n))&&("fixed"===rSe(n).position||ySe(n,a))}function kSe(e,a,n){const t=Ybe(a),i=qbe(a),r="fixed"===n,o=gSe(e,!0,r,a);let s={scrollLeft:0,scrollTop:0};const l=Nbe(0);if(t||!t&&!r)if(("body"!==Ube(a)||Xbe(i))&&(s=oSe(a)),t){const e=gSe(a,!0,r,a);l.x=e.x+a.clientLeft,l.y=e.y+a.clientTop}else i&&(l.x=vSe(i));return{x:o.left+s.scrollLeft-l.x,y:o.top+s.scrollTop-l.y,width:o.width,height:o.height}}function bSe(e){return"static"===rSe(e).position}function SSe(e,a){return Ybe(e)&&"fixed"!==rSe(e).position?a?a(e):e.offsetParent:null}function ASe(e,a){const n=Wbe(e);if(aSe(e))return n;if(!Ybe(e)){let a=sSe(e);for(;a&&!iSe(a);){if($be(a)&&!bSe(a))return a;a=sSe(a)}return n}let t=SSe(e,a);for(;t&&eSe(t)&&bSe(t);)t=SSe(t,a);return t&&iSe(t)&&bSe(t)&&!nSe(t)?n:t||function(e){let a=sSe(e);for(;Ybe(a)&&!iSe(a);){if(nSe(a))return a;if(aSe(a))return null;a=sSe(a)}return null}(e)||n}var wSe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:a,rect:n,offsetParent:t,strategy:i}=e;const r="fixed"===i,o=qbe(t),s=!!a&&aSe(a.floating);if(t===o||s&&r)return n;let l={scrollLeft:0,scrollTop:0},u=Nbe(1);const c=Nbe(0),d=Ybe(t);if((d||!d&&!r)&&(("body"!==Ube(t)||Xbe(o))&&(l=oSe(t)),Ybe(t))){const e=gSe(t);u=mSe(t),c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x,y:n.y*u.y-l.scrollTop*u.y+c.y}},getDocumentElement:qbe,getClippingRect:function(e){let{element:a,boundary:n,rootBoundary:t,strategy:i}=e;const r=[..."clippingAncestors"===n?aSe(a)?[]:function(e,a){const n=a.get(e);if(n)return n;let t=uSe(e,[],!1).filter((e=>$be(e)&&"body"!==Ube(e))),i=null;const r="fixed"===rSe(e).position;let o=r?sSe(e):e;for(;$be(o)&&!iSe(o);){const a=rSe(o),n=nSe(o);n||"fixed"!==a.position||(i=null),(r?!n&&!i:!n&&"static"===a.position&&i&&["absolute","fixed"].includes(i.position)||Xbe(o)&&!n&&ySe(e,o))?t=t.filter((e=>e!==o)):i=a,o=sSe(o)}return a.set(e,t),t}(a,this._c):[].concat(n),t],o=r.reduce(((e,n)=>{const t=fSe(a,n,i);return e.top=Cbe(t.top,e.top),e.right=wbe(t.right,e.right),e.bottom=wbe(t.bottom,e.bottom),e.left=Cbe(t.left,e.left),e}),fSe(a,r[0],i));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}},getOffsetParent:ASe,getElementRects:async function(e){const a=this.getOffsetParent||ASe,n=this.getDimensions,t=await n(e.floating);return{reference:kSe(e.reference,await a(e.floating),e.strategy),floating:{x:0,y:0,width:t.width,height:t.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:a,height:n}=cSe(e);return{width:a,height:n}},getScale:mSe,isElement:$be,isRTL:function(e){return"rtl"===rSe(e).direction}};function CSe(e,a,n,t){void 0===t&&(t={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=t,u=dSe(e),c=i||r?[...u?uSe(u):[],...uSe(a)]:[];c.forEach((e=>{i&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)}));const d=u&&s?function(e,a){let n,t=null;const i=qbe(e);function r(){var e;clearTimeout(n),null==(e=t)||e.disconnect(),t=null}return function o(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),r();const{left:u,top:c,width:d,height:m}=e.getBoundingClientRect();if(s||a(),!d||!m)return;const h={rootMargin:-Tbe(c)+"px "+-Tbe(i.clientWidth-(u+d))+"px "+-Tbe(i.clientHeight-(c+m))+"px "+-Tbe(u)+"px",threshold:Cbe(0,wbe(1,l))||1};let p=!0;function g(e){const a=e[0].intersectionRatio;if(a!==l){if(!p)return o();a?o(!1,a):n=setTimeout((()=>{o(!1,1e-7)}),1e3)}p=!1}try{t=new IntersectionObserver(g,{...h,root:i.ownerDocument})}catch(uBe){t=new IntersectionObserver(g,h)}t.observe(e)}(!0),r}(u,n):null;let m,h=-1,p=null;o&&(p=new ResizeObserver((e=>{let[t]=e;t&&t.target===u&&p&&(p.unobserve(a),cancelAnimationFrame(h),h=requestAnimationFrame((()=>{var e;null==(e=p)||e.observe(a)}))),n()})),u&&!l&&p.observe(u),p.observe(a));let g=l?gSe(e):null;return l&&function a(){const t=gSe(e);!g||t.x===g.x&&t.y===g.y&&t.width===g.width&&t.height===g.height||n();g=t,m=requestAnimationFrame(a)}(),n(),()=>{var e;c.forEach((e=>{i&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=p)||e.disconnect(),p=null,l&&cancelAnimationFrame(m)}}var MSe=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(a){var n,t;const{x:i,y:r,placement:o,middlewareData:s}=a,l=await async function(e,a){const{placement:n,platform:t,elements:i}=e,r=await(null==t.isRTL?void 0:t.isRTL(i.floating)),o=Lbe(n),s=Bbe(n),l="y"===_be(n),u=["left","top"].includes(o)?-1:1,c=r&&l?-1:1,d=jbe(a,e);let{mainAxis:m,crossAxis:h,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof p&&(h="end"===s?-1*p:p),l?{x:h*c,y:m*u}:{x:m*u,y:h*c}}(a,e);return o===(null==(n=s.offset)?void 0:n.placement)&&null!=(t=s.arrow)&&t.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:o}}}}},TSe=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(a){const{x:n,y:t,placement:i}=a,{mainAxis:r=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:a,y:n}=e;return{x:a,y:n}}},...l}=jbe(e,a),u={x:n,y:t},c=await Vbe(a,l),d=_be(Lbe(i)),m=zbe(d);let h=u[m],p=u[d];if(r){h=Pbe(h+c["y"===m?"top":"left"],h,h-c["y"===m?"bottom":"right"])}if(o){p=Pbe(p+c["y"===d?"top":"left"],p,p-c["y"===d?"bottom":"right"])}const g=s.fn({...a,[m]:h,[d]:p});return{...g,data:{x:g.x-n,y:g.y-t}}}}},NSe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(a){var n,t;const{placement:i,middlewareData:r,rects:o,initialPlacement:s,platform:l,elements:u}=a,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=jbe(e,a);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const f=Lbe(i),y=_be(s),k=Lbe(s)===s,b=await(null==l.isRTL?void 0:l.isRTL(u.floating)),S=m||(k||!g?[Hbe(s)]:function(e){const a=Hbe(e);return[Kbe(e),a,Kbe(a)]}(s)),A="none"!==p;!m&&A&&S.push(...function(e,a,n,t){const i=Bbe(e);let r=function(e,a,n){const t=["left","right"],i=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?a?i:t:a?t:i;case"left":case"right":return a?r:o;default:return[]}}(Lbe(e),"start"===n,t);return i&&(r=r.map((e=>e+"-"+i)),a&&(r=r.concat(r.map(Kbe)))),r}(s,g,p,b));const w=[s,...S],C=await Vbe(a,v),M=[];let T=(null==(t=r.flip)?void 0:t.overflows)||[];if(c&&M.push(C[f]),d){const e=function(e,a,n){void 0===n&&(n=!1);const t=Bbe(e),i=Dbe(e),r=Rbe(i);let o="x"===i?t===(n?"end":"start")?"right":"left":"start"===t?"bottom":"top";return a.reference[r]>a.floating[r]&&(o=Hbe(o)),[o,Hbe(o)]}(i,o,b);M.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:i,overflows:M}],!M.every((e=>e<=0))){var N,x;const e=((null==(N=r.flip)?void 0:N.index)||0)+1,a=w[e];if(a)return{data:{index:e,overflows:T},reset:{placement:a}};let n=null==(x=T.filter((e=>e.overflows[0]<=0)).sort(((e,a)=>e.overflows[1]-a.overflows[1]))[0])?void 0:x.placement;if(!n)switch(h){case"bestFit":{var E;const e=null==(E=T.filter((e=>{if(A){const a=_be(e.placement);return a===y||"y"===a}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,a)=>e+a),0)])).sort(((e,a)=>e[1]-a[1]))[0])?void 0:E[0];e&&(n=e);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}}}},xSe=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(a){const{placement:n,rects:t,platform:i,elements:r}=a,{apply:o=()=>{},...s}=jbe(e,a),l=await Vbe(a,s),u=Lbe(n),c=Bbe(n),d="y"===_be(n),{width:m,height:h}=t.floating;let p,g;"top"===u||"bottom"===u?(p=u,g=c===(await(null==i.isRTL?void 0:i.isRTL(r.floating))?"start":"end")?"left":"right"):(g=u,p="end"===c?"top":"bottom");const v=h-l.top-l.bottom,f=m-l.left-l.right,y=wbe(h-l[p],v),k=wbe(m-l[g],f),b=!a.middlewareData.shift;let S=y,A=k;if(d?A=c||b?wbe(k,f):f:S=c||b?wbe(y,v):v,b&&!c){const e=Cbe(l.left,0),a=Cbe(l.right,0),n=Cbe(l.top,0),t=Cbe(l.bottom,0);d?A=m-2*(0!==e||0!==a?e+a:Cbe(l.left,l.right)):S=h-2*(0!==n||0!==t?n+t:Cbe(l.top,l.bottom))}await o({...a,availableWidth:A,availableHeight:S});const w=await i.getDimensions(r.floating);return m!==w.width||h!==w.height?{reset:{rects:!0}}:{}}}},ESe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(a){const{rects:n}=a,{strategy:t="referenceHidden",...i}=jbe(e,a);switch(t){case"referenceHidden":{const e=Fbe(await Vbe(a,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Jbe(e)}}}case"escaped":{const e=Fbe(await Vbe(a,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Jbe(e)}}}default:return{}}}}},PSe=e=>({name:"arrow",options:e,async fn(a){const{x:n,y:t,placement:i,rects:r,platform:o,elements:s,middlewareData:l}=a,{element:u,padding:c=0}=jbe(e,a)||{};if(null==u)return{};const d=Obe(c),m={x:n,y:t},h=Dbe(i),p=Rbe(h),g=await o.getDimensions(u),v="y"===h,f=v?"top":"left",y=v?"bottom":"right",k=v?"clientHeight":"clientWidth",b=r.reference[p]+r.reference[h]-m[h]-r.floating[p],S=m[h]-r.reference[h],A=await(null==o.getOffsetParent?void 0:o.getOffsetParent(u));let w=A?A[k]:0;w&&await(null==o.isElement?void 0:o.isElement(A))||(w=s.floating[k]||r.floating[p]);const C=b/2-S/2,M=w/2-g[p]/2-1,T=wbe(d[f],M),N=wbe(d[y],M),x=T,E=w-g[p]-N,P=w/2-g[p]/2+C,j=Pbe(x,P,E),L=!l.arrow&&null!=Bbe(i)&&P!==j&&r.reference[p]/2-(P<x?T:N)-g[p]/2<0,B=L?P<x?P-x:P-E:0;return{[h]:m[h]+B,data:{[h]:j,centerOffset:P-j-B,...L&&{alignmentOffset:B}},reset:L}}}),jSe=(e,a,n)=>{const t={platform:wSe,...n},i={...t.platform,_c:new Map};return(async(e,a,n)=>{const{placement:t="bottom",strategy:i="absolute",middleware:r=[],platform:o}=n,s=r.filter(Boolean),l=await(null==o.isRTL?void 0:o.isRTL(a));let u=await o.getElementRects({reference:e,floating:a,strategy:i}),{x:c,y:d}=Gbe(u,t,l),m=t,h={},p=0;for(let g=0;g<s.length;g++){const{name:n,fn:r}=s[g],{x:v,y:f,data:y,reset:k}=await r({x:c,y:d,initialPlacement:t,placement:m,strategy:i,middlewareData:h,rects:u,platform:o,elements:{reference:e,floating:a}});c=null!=v?v:c,d=null!=f?f:d,h={...h,[n]:{...h[n],...y}},k&&p<=50&&(p++,"object"==typeof k&&(k.placement&&(m=k.placement),k.rects&&(u=!0===k.rects?await o.getElementRects({reference:e,floating:a,strategy:i}):k.rects),({x:c,y:d}=Gbe(u,m,l))),g=-1)}return{x:c,y:d,placement:m,strategy:i,middlewareData:h}})(e,a,{...t,platform:i})},LSe=Ba();function BSe(){const e=za(LSe);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var zSe=Mn('<svg display="block" viewBox="0 0 30 30" style="transform:scale(1.02)"><g><path fill="none" d="M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"></path><path stroke="none" d="M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z">'),RSe={top:180,right:-90,bottom:0,left:90};function _Se(e){const a=BSe(),n=mke({size:30},e),[t,i]=on(n,["ref","style","size"]),r=()=>a.currentPlacement().split("-")[0],o=function(e){const[a,n]=ka();return Aa((()=>{const a=e();var t;a&&n((t=a,Fye(t).defaultView||window).getComputedStyle(a))})),a}(a.contentRef),s=()=>2*Number.parseInt(o()?.getPropertyValue(`border-${r()}-width`)||"0px")*(30/t.size);return Xa(Ake,rn({as:"div",ref(e){const n=wye(a.setArrowRef,t.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Kye({position:"absolute","font-size":`${t.size}px`,width:"1em",height:"1em","pointer-events":"none",fill:o()?.getPropertyValue("background-color")||"none",stroke:o()?.getPropertyValue(`border-${r()}-color`)||"none","stroke-width":s()},t.style)}},i,{get children(){const e=zSe(),a=e.firstChild;return Sa((()=>Nn(a,"transform",`rotate(${RSe[r()]} 15 15) translate(0 2)`))),e}}))}function DSe(e){const{x:a=0,y:n=0,width:t=0,height:i=0}=e??{};if("function"==typeof DOMRect)return new DOMRect(a,n,t,i);const r={x:a,y:n,width:t,height:i,top:n,right:a+t,bottom:n+i,left:a};return{...r,toJSON:()=>r}}function KSe(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var HSe={top:"bottom",right:"left",bottom:"top",left:"right"};var OSe=Object.assign((function(e){const a=mke({getAnchorRect:e=>e?.getBoundingClientRect(),placement:"bottom",gutter:0,shift:0,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,hideWhenDetached:!1,detachedPadding:0,arrowPadding:4,overflowPadding:8},e),[n,t]=ka(),[i,r]=ka(),[o,s]=ka(a.placement),l=()=>{return e=a.anchorRef?.(),n=a.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const a=n(e);return a?DSe(a):e?e.getBoundingClientRect():DSe()}};var e,n},{direction:u}=Yke();async function c(){const e=l(),t=n(),r=i();if(!e||!t)return;const o=(r?.clientHeight||0)/2,c="number"==typeof a.gutter?a.gutter+o:a.gutter??o;t.style.setProperty("--kb-popper-content-overflow-padding",`${a.overflowPadding}px`),e.getBoundingClientRect();const d=[MSe((({placement:e})=>{const n=!!e.split("-")[1];return{mainAxis:c,crossAxis:n?void 0:a.shift,alignmentAxis:a.shift}}))];if(!1!==a.flip){const e="string"==typeof a.flip?a.flip.split(" "):void 0;if(void 0!==e&&!e.every(KSe))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(NSe({padding:a.overflowPadding,fallbackPlacements:e}))}(a.slide||a.overlap)&&d.push(TSe({mainAxis:a.slide,crossAxis:a.overlap,padding:a.overflowPadding})),d.push(xSe({padding:a.overflowPadding,apply({availableWidth:e,availableHeight:n,rects:i}){const r=Math.round(i.reference.width);e=Math.floor(e),n=Math.floor(n),t.style.setProperty("--kb-popper-anchor-width",`${r}px`),t.style.setProperty("--kb-popper-content-available-width",`${e}px`),t.style.setProperty("--kb-popper-content-available-height",`${n}px`),a.sameWidth&&(t.style.width=`${r}px`),a.fitViewport&&(t.style.maxWidth=`${e}px`,t.style.maxHeight=`${n}px`)}})),a.hideWhenDetached&&d.push(ESe({padding:a.detachedPadding})),r&&d.push(PSe({element:r,padding:a.arrowPadding}));const m=await jSe(e,t,{placement:a.placement,strategy:"absolute",middleware:d,platform:{...wSe,isRTL:()=>"rtl"===u()}});if(s(m.placement),a.onCurrentPlacementChange?.(m.placement),!t)return;t.style.setProperty("--kb-popper-content-transform-origin",function(e,a){const[n,t]=e.split("-"),i=HSe[n];return t?"left"===n||"right"===n?`${i} ${"start"===t?"top":"bottom"}`:"start"===t?`${i} ${"rtl"===a?"right":"left"}`:`${i} ${"rtl"===a?"left":"right"}`:`${i} center`}(m.placement,u()));const h=Math.round(m.x),p=Math.round(m.y);let g;if(a.hideWhenDetached&&(g=m.middlewareData.hide?.referenceHidden?"hidden":"visible"),Object.assign(t.style,{top:"0",left:"0",transform:`translate3d(${h}px, ${p}px, 0)`,visibility:g}),r&&m.middlewareData.arrow){const{x:e,y:a}=m.middlewareData.arrow,n=m.placement.split("-")[0];Object.assign(r.style,{left:null!=e?`${e}px`:"",top:null!=a?`${a}px`:"",[n]:"100%"})}}return Aa((()=>{const e=l(),a=n();if(!e||!a)return;xa(CSe(e,a,c,{elementResize:"function"==typeof ResizeObserver}))})),Aa((()=>{const e=n(),t=a.contentRef?.();e&&t&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(t).zIndex}))})),Xa(LSe.Provider,{value:{currentPlacement:o,contentRef:()=>a.contentRef?.(),setPositionerRef:t,setArrowRef:r},get children(){return a.children}})}),{Arrow:_Se,Context:LSe,usePopperContext:BSe,Positioner:function(e){const a=BSe(),[n,t]=on(e,["ref","style"]);return Xa(Ake,rn({as:"div",ref(e){const t=wye(a.setPositionerRef,n.ref);"function"==typeof t&&t(e)},"data-popper-positioner":"",get style(){return Kye({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},t))}});var ISe="interactOutside.pointerDownOutside",GSe="interactOutside.focusOutside";var VSe=Ba();function FSe(e){let a;const n=za(VSe),[t,i]=on(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),r=new Set([]);!function(e,a){let n,t=dke;const i=()=>Fye(a()),r=a=>e.onPointerDownOutside?.(a),o=a=>e.onFocusOutside?.(a),s=a=>e.onInteractOutside?.(a),l=n=>{const t=n.target;return t instanceof HTMLElement&&!t.closest(`[${dbe}]`)&&!!Gye(i(),t)&&!Gye(a(),t)&&!e.shouldExcludeElement?.(t)},u=e=>{function n(){const n=a(),t=e.target;if(!n||!t||!l(e))return;const i=Yye([r,s]);t.addEventListener(ISe,i,{once:!0});const o=new CustomEvent(ISe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||Qye(e)&&0===e.button}});t.dispatchEvent(o)}"touch"===e.pointerType?(i().removeEventListener("click",n),t=n,i().addEventListener("click",n,{once:!0})):n()},c=e=>{const n=a(),t=e.target;if(!n||!t||!l(e))return;const i=Yye([o,s]);t.addEventListener(GSe,i,{once:!0});const r=new CustomEvent(GSe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});t.dispatchEvent(r)};Aa((()=>{Pfe(e.isDisabled)||(n=window.setTimeout((()=>{i().addEventListener("pointerdown",u,!0)}),0),i().addEventListener("focusin",c,!0),xa((()=>{window.clearTimeout(n),i().removeEventListener("click",t),i().removeEventListener("pointerdown",u,!0),i().removeEventListener("focusin",c,!0)})))}))}({shouldExcludeElement:e=>!!a&&(t.excludedElements?.some((a=>Gye(a(),e)))||[...r].some((a=>Gye(a,e)))),onPointerDownOutside:e=>{a&&!ybe.isBelowPointerBlockingLayer(a)&&(t.bypassTopMostLayerCheck||ybe.isTopMostLayer(a))&&(t.onPointerDownOutside?.(e),t.onInteractOutside?.(e),e.defaultPrevented||t.onDismiss?.())},onFocusOutside:e=>{t.onFocusOutside?.(e),t.onInteractOutside?.(e),e.defaultPrevented||t.onDismiss?.()}},(()=>a)),function(e){const a=a=>{a.key===Uye.Escape&&e.onEscapeKeyDown?.(a)};Aa((()=>{if(Pfe(e.isDisabled))return;const n=e.ownerDocument?.()??Fye();n.addEventListener("keydown",a),xa((()=>{n.removeEventListener("keydown",a)}))}))}({ownerDocument:()=>Fye(a),onEscapeKeyDown:e=>{a&&ybe.isTopMostLayer(a)&&(t.onEscapeKeyDown?.(e),!e.defaultPrevented&&t.onDismiss&&(e.preventDefault(),t.onDismiss()))}}),Na((()=>{if(!a)return;ybe.addLayer({node:a,isPointerBlocking:t.disableOutsidePointerEvents,dismiss:t.onDismiss});const e=n?.registerNestedLayer(a);ybe.assignPointerEventToLayers(),ybe.disableBodyPointerEvents(a),xa((()=>{a&&(ybe.removeLayer(a),e?.(),ybe.assignPointerEventToLayers(),ybe.restoreBodyPointerEvents(a))}))})),Aa(Ta([()=>a,()=>t.disableOutsidePointerEvents],(([e,a])=>{if(!e)return;const n=ybe.find(e);n&&n.isPointerBlocking!==a&&(n.isPointerBlocking=a,ybe.assignPointerEventToLayers()),a&&ybe.disableBodyPointerEvents(e),xa((()=>{ybe.restoreBodyPointerEvents(e)}))}),{defer:!0}));return Xa(VSe.Provider,{value:{registerNestedLayer:e=>{r.add(e);const a=n?.registerNestedLayer(e);return()=>{r.delete(e),a?.()}}},get children(){return Xa(Ake,rn({as:"div",ref(e){const n=wye((e=>a=e),t.ref);"function"==typeof n&&n(e)}},i))}})}function JSe(e={}){const[a,n]=jke({value:()=>Pfe(e.open),defaultValue:()=>!!Pfe(e.defaultOpen),onChange:a=>e.onOpenChange?.(a)}),t=()=>{n(!0)},i=()=>{n(!1)};return{isOpen:a,setIsOpen:n,open:t,close:i,toggle:()=>{a()?i():t()}}}var USe={};Bke(USe,{Description:()=>Tke,ErrorMessage:()=>Nke,Item:()=>YSe,ItemControl:()=>QSe,ItemDescription:()=>XSe,ItemIndicator:()=>eAe,ItemInput:()=>aAe,ItemLabel:()=>nAe,Label:()=>tAe,RadioGroup:()=>rAe,Root:()=>iAe});var WSe=Ba();function qSe(){const e=za(WSe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var ZSe=Ba();function $Se(){const e=za(ZSe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function YSe(e){const a=Mke(),n=qSe(),t=mke({id:`${a.generateId("item")}-${un()}`},e),[i,r]=on(t,["value","disabled","onPointerDown"]),[o,s]=ka(),[l,u]=ka(),[c,d]=ka(),[m,h]=ka(),[p,g]=ka(!1),v=wa((()=>n.isSelectedValue(i.value))),f=wa((()=>i.disabled||a.isDisabled()||!1)),y=e=>{$ye(e,i.onPointerDown),p()&&e.preventDefault()},k=wa((()=>({...a.dataset(),"data-disabled":f()?"":void 0,"data-checked":v()?"":void 0}))),b={value:()=>i.value,dataset:k,isSelected:v,isDisabled:f,inputId:o,labelId:l,descriptionId:c,inputRef:m,select:()=>n.setSelectedValue(i.value),generateId:Iye((()=>r.id)),registerInput:kke(s),registerLabel:kke(u),registerDescription:kke(d),setIsFocused:g,setInputRef:h};return Xa(ZSe.Provider,{value:b,get children(){return Xa(Ake,rn({as:"div",role:"group",onPointerDown:y},k,r))}})}function QSe(e){const a=$Se(),n=mke({id:a.generateId("control")},e),[t,i]=on(n,["onClick","onKeyDown"]);return Xa(Ake,rn({as:"div",onClick:e=>{$ye(e,t.onClick),a.select(),a.inputRef()?.focus()},onKeyDown:e=>{$ye(e,t.onKeyDown),e.key===Uye.Space&&(a.select(),a.inputRef()?.focus())}},(()=>a.dataset()),i))}function XSe(e){const a=$Se(),n=mke({id:a.generateId("description")},e);return Aa((()=>xa(a.registerDescription(n.id)))),Xa(Ake,rn({as:"div"},(()=>a.dataset()),n))}function eAe(e){const a=$Se(),n=mke({id:a.generateId("indicator")},e),[t,i]=on(n,["ref","forceMount"]),[r,o]=ka(),{present:s}=cbe({show:()=>t.forceMount||a.isSelected(),element:()=>r()??null});return Xa(hn,{get when(){return s()},get children(){return Xa(Ake,rn({as:"div",ref(e){const a=wye(o,t.ref);"function"==typeof a&&a(e)}},(()=>a.dataset()),i))}})}function aAe(e){const a=Mke(),n=qSe(),t=$Se(),i=mke({id:t.generateId("input")},e),[r,o]=on(i,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=ka(!1);return Aa(Ta([()=>t.isSelected(),()=>t.value()],(e=>{if(!e[0]&&e[1]===t.value())return;l(!0);const a=t.inputRef();a?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),a?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),{defer:!0})),Aa((()=>xa(t.registerInput(o.id)))),Xa(Ake,rn({as:"input",ref(e){const a=wye(t.setInputRef,r.ref);"function"==typeof a&&a(e)},type:"radio",get name(){return a.name()},get value(){return t.value()},get checked(){return t.isSelected()},get required(){return a.isRequired()},get disabled(){return t.isDisabled()},get readonly(){return a.isReadOnly()},get style(){return Kye({...yke},r.style)},get"aria-labelledby"(){return[r["aria-labelledby"],t.labelId(),null!=r["aria-labelledby"]&&null!=o["aria-label"]?o.id:void 0].filter(Boolean).join(" ")||void 0},get"aria-describedby"(){return[r["aria-describedby"],t.descriptionId(),n.ariaDescribedBy()].filter(Boolean).join(" ")||void 0},onChange:e=>{if($ye(e,r.onChange),e.stopPropagation(),!s()){n.setSelectedValue(t.value());e.target.checked=t.isSelected()}l(!1)},onFocus:e=>{$ye(e,r.onFocus),t.setIsFocused(!0)},onBlur:e=>{$ye(e,r.onBlur),t.setIsFocused(!1)}},(()=>t.dataset()),o))}function nAe(e){const a=$Se(),n=mke({id:a.generateId("label")},e);return Aa((()=>xa(a.registerLabel(n.id)))),Xa(Ake,rn({as:"label",get for(){return a.inputId()}},(()=>a.dataset()),n))}function tAe(e){return Xa(xke,rn({as:"span"},e))}function iAe(e){let a;const n=mke({id:`radiogroup-${un()}`,orientation:"vertical"},e),[t,i,r]=on(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],wke),[o,s]=Pke({value:()=>t.value,defaultValue:()=>t.defaultValue,onChange:e=>t.onChange?.(e)}),{formControlContext:l}=function(e){const a=mke({id:`form-control-${un()}`},e),[n,t]=ka(),[i,r]=ka(),[o,s]=ka(),[l,u]=ka();return{formControlContext:{name:()=>Pfe(a.name)??Pfe(a.id),dataset:wa((()=>({"data-valid":"valid"===Pfe(a.validationState)?"":void 0,"data-invalid":"invalid"===Pfe(a.validationState)?"":void 0,"data-required":Pfe(a.required)?"":void 0,"data-disabled":Pfe(a.disabled)?"":void 0,"data-readonly":Pfe(a.readOnly)?"":void 0}))),validationState:()=>Pfe(a.validationState),isRequired:()=>Pfe(a.required),isDisabled:()=>Pfe(a.disabled),isReadOnly:()=>Pfe(a.readOnly),labelId:n,fieldId:i,descriptionId:o,errorMessageId:l,getAriaLabelledBy:(e,a,t)=>{const i=null!=t||null!=n();return[t,n(),i&&null!=a?e:void 0].filter(Boolean).join(" ")||void 0},getAriaDescribedBy:e=>[o(),l(),e].filter(Boolean).join(" ")||void 0,generateId:Iye((()=>Pfe(a.id))),registerLabel:kke(t),registerField:kke(r),registerDescription:kke(s),registerErrorMessage:kke(u)}}}(i);Eke((()=>a),(()=>s(t.defaultValue??"")));const u=()=>l.getAriaDescribedBy(t["aria-describedby"]),c=e=>e===o(),d={ariaDescribedBy:u,isSelectedValue:c,setSelectedValue:e=>{if(!l.isReadOnly()&&!l.isDisabled()&&(s(e),a))for(const n of a.querySelectorAll("[type='radio']")){n.checked=c(n.value)}}};return Xa(Cke.Provider,{value:l,get children(){return Xa(WSe.Provider,{value:d,get children(){return Xa(Ake,rn({as:"div",ref(e){const n=wye((e=>a=e),t.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return Pfe(i.id)},get"aria-invalid"(){return"invalid"===l.validationState()||void 0},get"aria-required"(){return l.isRequired()||void 0},get"aria-disabled"(){return l.isDisabled()||void 0},get"aria-readonly"(){return l.isReadOnly()||void 0},get"aria-orientation"(){return t.orientation},get"aria-labelledby"(){return l.getAriaLabelledBy(Pfe(i.id),r["aria-label"],t["aria-labelledby"])},get"aria-describedby"(){return u()}},(()=>l.dataset()),r))}})}})}var rAe=Object.assign(iAe,{Description:Tke,ErrorMessage:Nke,Item:YSe,ItemControl:QSe,ItemDescription:XSe,ItemIndicator:eAe,ItemInput:aAe,ItemLabel:nAe,Label:tAe}),oAe=class{collection;ref;collator;constructor(e,a,n){this.collection=e,this.ref=a,this.collator=n}getKeyBelow(e){let a=this.collection().getKeyAfter(e);for(;null!=a;){const e=this.collection().getItem(a);if(e&&"item"===e.type&&!e.disabled)return a;a=this.collection().getKeyAfter(a)}}getKeyAbove(e){let a=this.collection().getKeyBefore(e);for(;null!=a;){const e=this.collection().getItem(a);if(e&&"item"===e.type&&!e.disabled)return a;a=this.collection().getKeyBefore(a)}}getFirstKey(){let e=this.collection().getFirstKey();for(;null!=e;){const a=this.collection().getItem(e);if(a&&"item"===a.type&&!a.disabled)return e;e=this.collection().getKeyAfter(e)}}getLastKey(){let e=this.collection().getLastKey();for(;null!=e;){const a=this.collection().getItem(e);if(a&&"item"===a.type&&!a.disabled)return e;e=this.collection().getKeyBefore(e)}}getItem(e){return this.ref?.()?.querySelector(`[data-key="${e}"]`)??null}getKeyPageAbove(e){const a=this.ref?.();let n=this.getItem(e);if(!a||!n)return;const t=Math.max(0,n.offsetTop+n.offsetHeight-a.offsetHeight);let i=e;for(;i&&n&&n.offsetTop>t;)i=this.getKeyAbove(i),n=null!=i?this.getItem(i):null;return i}getKeyPageBelow(e){const a=this.ref?.();let n=this.getItem(e);if(!a||!n)return;const t=Math.min(a.scrollHeight,n.offsetTop-n.offsetHeight+a.offsetHeight);let i=e;for(;i&&n&&n.offsetTop<t;)i=this.getKeyBelow(i),n=null!=i?this.getItem(i):null;return i}getKeyForSearch(e,a){const n=this.collator?.();if(!n)return;let t=null!=a?this.getKeyBelow(a):this.getFirstKey();for(;null!=t;){const a=this.collection().getItem(t);if(a){const i=a.textValue.slice(0,e.length);if(a.textValue&&0===n.compare(i,e))return t}t=this.getKeyBelow(t)}}};function sAe(e,a,n){const t=function(e){const{locale:a}=Yke(),n=wa((()=>a()+(e?Object.entries(e).sort(((e,a)=>e[0]<a[0]?-1:1)).join():"")));return wa((()=>{const t=n();let i;return Qke.has(t)&&(i=Qke.get(t)),i||(i=new Intl.Collator(a(),e),Qke.set(t,i)),i}))}({usage:"search",sensitivity:"base"});return ibe({selectionManager:()=>Pfe(e.selectionManager),keyboardDelegate:wa((()=>{const n=Pfe(e.keyboardDelegate);return n||new oAe(e.collection,a,t)})),autoFocus:()=>Pfe(e.autoFocus),deferAutoFocus:()=>Pfe(e.deferAutoFocus),shouldFocusWrap:()=>Pfe(e.shouldFocusWrap),disallowEmptySelection:()=>Pfe(e.disallowEmptySelection),selectOnFocus:()=>Pfe(e.selectOnFocus),disallowTypeAhead:()=>Pfe(e.disallowTypeAhead),shouldUseVirtualFocus:()=>Pfe(e.shouldUseVirtualFocus),allowsTabNavigation:()=>Pfe(e.allowsTabNavigation),isVirtualized:()=>Pfe(e.isVirtualized),scrollToKey:a=>Pfe(e.scrollToKey)?.(a),orientation:()=>Pfe(e.orientation)},a)}var lAe="focusScope.autoFocusOnMount",uAe="focusScope.autoFocusOnUnmount",cAe={bubbles:!1,cancelable:!0},dAe={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=Hye(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=Hye(this.stack,e),this.active()?.resume()}};function mAe(e,a){const[n,t]=ka(!1),i={pause(){t(!0)},resume(){t(!1)}};let r=null;const o=a=>e.onMountAutoFocus?.(a),s=a=>e.onUnmountAutoFocus?.(a),l=()=>Fye(a()),u=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,yke),e},c=()=>{const e=a();return e?rke(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=c();return e.length>0?e[0]:null};Aa((()=>{const e=a();if(!e)return;dAe.add(i);const n=Vye(e);if(!Gye(e,n)){const a=new CustomEvent(lAe,cAe);e.addEventListener(lAe,o),e.dispatchEvent(a),a.defaultPrevented||setTimeout((()=>{Xye(d()),Vye(e)===n&&Xye(e)}),0)}xa((()=>{e.removeEventListener(lAe,o),setTimeout((()=>{const t=new CustomEvent(uAe,cAe);(()=>{const e=a();if(!e)return!1;const n=Vye(e);return!!n&&!Gye(e,n)&&ske(n)})()&&t.preventDefault(),e.addEventListener(uAe,s),e.dispatchEvent(t),t.defaultPrevented||Xye(n??l().body),e.removeEventListener(uAe,s),dAe.remove(i)}),0)}))})),Aa((()=>{const t=a();if(!t||!Pfe(e.trapFocus)||n())return;const i=e=>{const a=e.target;a?.closest(`[${dbe}]`)||(Gye(t,a)?r=a:Xye(r))},o=e=>{const a=e.relatedTarget??Vye(t);a?.closest(`[${dbe}]`)||Gye(t,a)||Xye(r)};l().addEventListener("focusin",i),l().addEventListener("focusout",o),xa((()=>{l().removeEventListener("focusin",i),l().removeEventListener("focusout",o)}))})),Aa((()=>{const t=a();if(!t||!Pfe(e.trapFocus)||n())return;const i=u();t.insertAdjacentElement("afterbegin",i);const r=u();function o(e){const a=d(),n=(()=>{const e=c();return e.length>0?e[e.length-1]:null})();Xye(e.relatedTarget===a?n:a)}t.insertAdjacentElement("beforeend",r),i.addEventListener("focusin",o),r.addEventListener("focusin",o);const s=new MutationObserver((e=>{for(const a of e)a.previousSibling===r&&(r.remove(),t.insertAdjacentElement("beforeend",r)),a.nextSibling===i&&(i.remove(),t.insertAdjacentElement("afterbegin",i))}));s.observe(t,{childList:!0,subtree:!1}),xa((()=>{i.removeEventListener("focusin",o),r.removeEventListener("focusin",o),i.remove(),r.remove(),s.disconnect()}))}))}var hAe="data-live-announcer";function pAe(e){Aa((()=>{Pfe(e.isDisabled)||xa(function(e,a=document.body){const n=new Set(e),t=new Set,i=e=>{for(const t of e.querySelectorAll(`[${hAe}], [${dbe}]`))n.add(t);const a=e=>{if(n.has(e)||e.parentElement&&t.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(const a of n)if(e.contains(a))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a}),o=a(e);if(o===NodeFilter.FILTER_ACCEPT&&r(e),o!==NodeFilter.FILTER_REJECT){let e=i.nextNode();for(;null!=e;)r(e),e=i.nextNode()}},r=e=>{const a=gAe.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===a||(0===a&&e.setAttribute("aria-hidden","true"),t.add(e),gAe.set(e,a+1))};vAe.length&&vAe[vAe.length-1].disconnect();i(a);const o=new MutationObserver((e=>{for(const a of e)if("childList"===a.type&&0!==a.addedNodes.length&&![...n,...t].some((e=>e.contains(a.target)))){for(const e of a.removedNodes)e instanceof Element&&(n.delete(e),t.delete(e));for(const e of a.addedNodes)!(e instanceof HTMLElement||e instanceof SVGElement)||"true"!==e.dataset.liveAnnouncer&&"true"!==e.dataset.reactAriaTopLayer?e instanceof Element&&i(e):n.add(e)}}));o.observe(a,{childList:!0,subtree:!0});const s={observe(){o.observe(a,{childList:!0,subtree:!0})},disconnect(){o.disconnect()}};return vAe.push(s),()=>{o.disconnect();for(const e of t){const a=gAe.get(e);if(null==a)return;1===a?(e.removeAttribute("aria-hidden"),gAe.delete(e)):gAe.set(e,a-1)}s===vAe[vAe.length-1]?(vAe.pop(),vAe.length&&vAe[vAe.length-1].observe()):vAe.splice(vAe.indexOf(s),1)}}(Pfe(e.targets),Pfe(e.root)))}))}var gAe=new WeakMap,vAe=[];var fAe=new Map,yAe=e=>{Aa((()=>{const a=ube(e.style)??{},n=ube(e.properties)??[],t={};for(const r in a)t[r]=e.element.style[r];const i=fAe.get(e.key);i?i.activeCount++:fAe.set(e.key,{activeCount:1,originalStyles:t,properties:n.map((e=>e.key))}),Object.assign(e.element.style,e.style);for(const r of n)e.element.style.setProperty(r.key,r.value);xa((()=>{const a=fAe.get(e.key);if(a)if(1===a.activeCount){fAe.delete(e.key);for(const[n,t]of Object.entries(a.originalStyles))e.element.style[n]=t;for(const n of a.properties)e.element.style.removeProperty(n);0===e.element.style.length&&e.element.removeAttribute("style"),e.cleanup?.()}else a.activeCount--}))}))},kAe=(e,a)=>{switch(a){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},bAe=(e,a)=>{const n=getComputedStyle(e),t="x"===a?n.overflowX:n.overflowY;return"auto"===t||"scroll"===t||"HTML"===e.tagName&&"visible"===t},[SAe,AAe]=ka([]),wAe=e=>[e.deltaX,e.deltaY],CAe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],MAe=(e,a,n,t)=>{const i=null!==t&&TAe(t,e),[r,o]=((e,a,n)=>{const t="x"===a&&"rtl"===window.getComputedStyle(e).direction?-1:1;let i=e,r=0,o=0,s=!1;do{const[e,l,u]=kAe(i,a),c=u-e-t*l;0===l&&0===c||!bAe(i,a)||(r+=c,o+=l),i===(n??document.documentElement)?s=!0:i=i._$host??i.parentElement}while(i&&!s);return[r,o]})(e,a,i?t:void 0);return!(n>0&&Math.abs(r)<=1)&&!(n<0&&Math.abs(o)<1)},TAe=(e,a)=>{if(e.contains(a))return!0;let n=a;for(;n;){if(n===e)return!0;n=n._$host??n.parentElement}return!1},NAe=e=>{const a=rn({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=un();let t=[0,0],i=null,r=null;Aa((()=>{ube(a.enabled)&&(AAe((e=>[...e,n])),xa((()=>{AAe((e=>e.filter((e=>e!==n))))})))})),Aa((()=>{if(!ube(a.enabled)||!ube(a.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(ube(a.preventScrollbarShift)){const t={overflow:"hidden"},i=[];n>0&&("padding"===ube(a.preventScrollbarShiftMode)?t.paddingRight=`calc(${window.getComputedStyle(e).paddingRight} + ${n}px)`:t.marginRight=`calc(${window.getComputedStyle(e).marginRight} + ${n}px)`,i.push({key:"--scrollbar-width",value:`${n}px`}));const r=window.scrollY,o=window.scrollX;yAe({key:"prevent-scroll",element:e,style:t,properties:i,cleanup:()=>{ube(a.restoreScrollPosition)&&n>0&&window.scrollTo(o,r)}})}else yAe({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),Aa((()=>{var e;(e=n,SAe().indexOf(e)===SAe().length-1&&ube(a.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",o,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),xa((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",o),document.removeEventListener("touchmove",l)})))}));const o=e=>{t=CAe(e),i=null,r=null},s=e=>{const n=e.target,t=ube(a.element),i=wAe(e),r=Math.abs(i[0])>Math.abs(i[1])?"x":"y",o=MAe(n,r,"x"===r?i[0]:i[1],t);let s;s=!t||!TAe(t,n)||!o,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=ube(a.element),o=e.target;let s;if(2===e.touches.length)s=!ube(a.allowPinchZoom);else{if(null==i||null===r){const a=CAe(e).map(((e,a)=>t[a]-e)),n=Math.abs(a[0])>Math.abs(a[1])?"x":"y";i=n,r="x"===n?a[0]:a[1]}if("range"===o.type)s=!1;else{const e=MAe(o,i,r,n);s=!n||!TAe(n,o)||!e}}s&&e.cancelable&&e.preventDefault()}},xAe=NAe,EAe=Ba();function PAe(){return za(EAe)}function jAe(){const e=PAe();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var LAe=Ba();function BAe(){const e=za(LAe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var zAe=Ba();function RAe(){const e=za(zAe);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function _Ae(e){let a;const n=RAe(),t=jAe(),i=mke({id:n.generateId(`item-${un()}`)},e),[r,o]=on(i,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=ka(),[u,c]=ka(),[d,m]=ka(),h=()=>t.listState().selectionManager(),p=()=>o.id,g=()=>{r.onSelect?.(),r.closeOnSelect&&setTimeout((()=>{t.close(!0)}))};Oke({getItem:()=>({ref:()=>a,type:"item",key:p(),textValue:r.textValue??d()?.textContent??a?.textContent??"",disabled:r.disabled??!1})});const v=rbe({key:p,selectionManager:h,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>r.disabled},(()=>a)),f=e=>{$ye(e,r.onPointerMove),"mouse"===e.pointerType&&(r.disabled?t.onItemLeave(e):(t.onItemEnter(e),e.defaultPrevented||(Xye(e.currentTarget),t.listState().selectionManager().setFocused(!0),t.listState().selectionManager().setFocusedKey(p()))))},y=e=>{$ye(e,r.onPointerLeave),"mouse"===e.pointerType&&t.onItemLeave(e)},k=e=>{$ye(e,r.onPointerUp),r.disabled||0!==e.button||g()},b=e=>{if($ye(e,r.onKeyDown),!e.repeat&&!r.disabled)switch(e.key){case"Enter":case" ":g()}},S=wa((()=>r.indeterminate?"mixed":null!=r.checked?r.checked:void 0)),A=wa((()=>({"data-indeterminate":r.indeterminate?"":void 0,"data-checked":r.checked&&!r.indeterminate?"":void 0,"data-disabled":r.disabled?"":void 0,"data-highlighted":h().focusedKey()===p()?"":void 0}))),w={isChecked:()=>r.checked,dataset:A,setLabelRef:m,generateId:Iye((()=>o.id)),registerLabel:kke(l),registerDescription:kke(c)};return Xa(LAe.Provider,{value:w,get children(){return Xa(Ake,rn({as:"div",ref(e){const n=wye((e=>a=e),r.ref);"function"==typeof n&&n(e)},get tabIndex(){return v.tabIndex()},get"aria-checked"(){return S()},get"aria-disabled"(){return r.disabled},get"aria-labelledby"(){return s()},get"aria-describedby"(){return u()},get"data-key"(){return v.dataKey()},get onPointerDown(){return Yye([r.onPointerDown,v.onPointerDown])},get onPointerUp(){return Yye([k,v.onPointerUp])},get onClick(){return Yye([r.onClick,v.onClick])},get onKeyDown(){return Yye([b,v.onKeyDown])},get onMouseDown(){return Yye([r.onMouseDown,v.onMouseDown])},get onFocus(){return Yye([r.onFocus,v.onFocus])},onPointerMove:f,onPointerLeave:y},A,o))}})}function DAe(e){const a=mke({closeOnSelect:!1},e),[n,t]=on(a,["checked","defaultChecked","onChange","onSelect"]),i=function(e={}){const[a,n]=jke({value:()=>Pfe(e.isSelected),defaultValue:()=>!!Pfe(e.defaultIsSelected),onChange:a=>e.onSelectedChange?.(a)});return{isSelected:a,setIsSelected:a=>{Pfe(e.isReadOnly)||Pfe(e.isDisabled)||n(a)},toggle:()=>{Pfe(e.isReadOnly)||Pfe(e.isDisabled)||n(!a())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>t.disabled});return Xa(_Ae,rn({role:"menuitemcheckbox",get checked(){return i.isSelected()},onSelect:()=>{n.onSelect?.(),i.toggle()}},t))}var KAe=Ba();function HAe(){return za(KAe)}var OAe={next:(e,a)=>"ltr"===e?"horizontal"===a?"ArrowRight":"ArrowDown":"horizontal"===a?"ArrowLeft":"ArrowUp",previous:(e,a)=>OAe.next("ltr"===e?"rtl":"ltr",a)},IAe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",GAe=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function VAe(e){const a=RAe(),n=jAe(),t=HAe(),{direction:i}=Yke(),r=mke({id:a.generateId("trigger")},e),[o,s]=on(r,["ref","id","disabled","onPointerDown","onClick","onKeyDown","onMouseOver","onFocus"]);let l=()=>a.value();void 0!==t&&(l=()=>a.value()??o.id,void 0===t.lastValue()&&t.setLastValue(l));const u=bke((()=>n.triggerRef()),(()=>"button")),c=wa((()=>"a"===u()&&null!=n.triggerRef()?.getAttribute("href")));Aa(Ta((()=>t?.value()),(e=>{c()&&e===l()&&n.triggerRef()?.focus()})));const d=()=>{void 0!==t?n.isOpen()?t.value()===l()&&t.closeMenu():(t.autoFocusMenu()||t.setAutoFocusMenu(!0),n.open(!1)):n.toggle(!0)};return Aa((()=>xa(n.registerTriggerId(o.id)))),Xa(bbe,rn({ref(e){const a=wye(n.setTriggerRef,o.ref);"function"==typeof a&&a(e)},get"data-kb-menu-value-trigger"(){return a.value()},get id(){return o.id},get disabled(){return o.disabled},"aria-haspopup":"true",get"aria-expanded"(){return n.isOpen()},get"aria-controls"(){return wa((()=>!!n.isOpen()))()?n.contentId():void 0},get"data-highlighted"(){return void 0!==l()&&t?.value()===l()||void 0},get tabIndex(){return void 0!==t?t.value()===l()||t.lastValue()===l()?0:-1:void 0},onPointerDown:e=>{$ye(e,o.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,o.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{$ye(e,o.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(o.disabled||void 0===t||void 0===t.value()||t.setValue(l))},onClick:e=>{$ye(e,o.onClick),o.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if($ye(e,o.onKeyDown),!o.disabled){if(c())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case IAe(a.orientation()):e.stopPropagation(),e.preventDefault(),function(e){if(document.contains(e)){const a=document.scrollingElement||document.documentElement;if("hidden"===window.getComputedStyle(a).overflow){let n=uke(e);for(;e&&n&&e!==a&&n!==a;)vke(n,e),n=uke(e=n)}else{const{left:a,top:n}=e.getBoundingClientRect();e?.scrollIntoView?.({block:"nearest"});const{left:t,top:i}=e.getBoundingClientRect();(Math.abs(a-t)>1||Math.abs(n-i)>1)&&e.scrollIntoView?.({block:"nearest"})}}}(e.currentTarget),n.open("first"),t?.setAutoFocusMenu(!0),t?.setValue(l);break;case GAe(a.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case OAe.next(i(),a.orientation()):if(void 0===t)break;e.stopPropagation(),e.preventDefault(),t.nextMenu();break;case OAe.previous(i(),a.orientation()):if(void 0===t)break;e.stopPropagation(),e.preventDefault(),t.previousMenu()}}},onFocus:e=>{$ye(e,o.onFocus),void 0!==t&&"touch"!==e.currentTarget.dataset.pointerType&&t.setValue(l)},role:void 0!==t?"menuitem":void 0},(()=>n.dataset()),s))}var FAe=Ba();function JAe(){return za(FAe)}function UAe(e){let a;const n=RAe(),t=jAe(),i=HAe(),r=JAe(),{direction:o}=Yke(),s=mke({id:n.generateId(`content-${un()}`)},e),[l,u]=on(s,["ref","id","style","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onPointerEnter","onPointerMove","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]);let c=0;const d=()=>null==t.parentMenuContext()&&void 0===i&&n.isModal(),m=sAe({selectionManager:t.listState().selectionManager,collection:t.listState().collection,autoFocus:t.autoFocus,deferAutoFocus:!0,shouldFocusWrap:!0,disallowTypeAhead:()=>!t.listState().selectionManager().isFocused(),orientation:()=>"horizontal"===n.orientation()?"vertical":"horizontal"},(()=>a));mAe({trapFocus:()=>d()&&t.isOpen(),onMountAutoFocus:e=>{void 0===i&&l.onOpenAutoFocus?.(e)},onUnmountAutoFocus:l.onCloseAutoFocus},(()=>a));const h=e=>{l.onEscapeKeyDown?.(e),i?.setAutoFocusMenu(!1),t.close(!0)},p=e=>{l.onFocusOutside?.(e),n.isModal()&&e.preventDefault()};Aa((()=>xa(t.registerContentId(l.id))));const g={ref:wye((e=>{t.setContentRef(e),a=e}),l.ref),role:"menu",get id(){return l.id},get tabIndex(){return m.tabIndex()},get"aria-labelledby"(){return t.triggerId()},onKeyDown:Yye([l.onKeyDown,m.onKeyDown,e=>{if(Gye(e.currentTarget,e.target)&&("Tab"===e.key&&t.isOpen()&&e.preventDefault(),void 0!==i&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case OAe.next(o(),n.orientation()):e.stopPropagation(),e.preventDefault(),t.close(!0),i.setAutoFocusMenu(!0),i.nextMenu();break;case OAe.previous(o(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),t.close(!0),i.setAutoFocusMenu(!0),i.previousMenu()}}]),onMouseDown:Yye([l.onMouseDown,m.onMouseDown]),onFocusIn:Yye([l.onFocusIn,m.onFocusIn]),onFocusOut:Yye([l.onFocusOut,m.onFocusOut]),onPointerEnter:e=>{$ye(e,l.onPointerEnter),t.isOpen()&&(t.parentMenuContext()?.listState().selectionManager().setFocused(!1),t.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if($ye(e,l.onPointerMove),"mouse"!==e.pointerType)return;const a=c!==e.clientX;Gye(e.currentTarget,e.target)&&a&&(t.setPointerDir(e.clientX>c?"right":"left"),c=e.clientX)},get"data-orientation"(){return n.orientation()}};return Xa(hn,{get when(){return t.contentPresent()},get children(){return Xa(hn,{get when(){return void 0===r||null!=t.parentMenuContext()},get fallback(){return Xa(Ake,rn({as:"div"},(()=>t.dataset()),g,u))},get children(){return Xa(OSe.Positioner,{get children(){return Xa(FSe,rn({get disableOutsidePointerEvents(){return wa((()=>!!d()))()&&t.isOpen()},get excludedElements(){return[t.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Kye({"--kb-menu-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onEscapeKeyDown:h,onFocusOutside:p,get onDismiss(){return t.close}},(()=>t.dataset()),g,u))}})}})}})}function WAe(e){let a;const n=RAe(),t=jAe(),[i,r]=on(e,["ref"]);return xAe({element:()=>a??null,enabled:()=>t.contentPresent()&&n.preventScroll()}),Xa(UAe,rn({ref(e){const n=wye((e=>{a=e}),i.ref);"function"==typeof n&&n(e)}},r))}var qAe=Ba();function ZAe(e){const a=mke({id:RAe().generateId(`group-${un()}`)},e),[n,t]=ka(),i={generateId:Iye((()=>a.id)),registerLabelId:kke(t)};return Xa(qAe.Provider,{value:i,get children(){return Xa(Ake,rn({as:"div",role:"group",get"aria-labelledby"(){return n()}},a))}})}function $Ae(e){const a=function(){const e=za(qAe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=mke({id:a.generateId("label")},e),[t,i]=on(n,["id"]);return Aa((()=>xa(a.registerLabelId(t.id)))),Xa(Ake,rn({as:"span",get id(){return t.id},"aria-hidden":"true"},i))}function YAe(e){const a=jAe();return Xa(Ake,rn({as:"span","aria-hidden":"true"},(()=>a.dataset()),mke({children:"▼"},e)))}function QAe(e){return Xa(_Ae,rn({role:"menuitem",closeOnSelect:!0},e))}function XAe(e){const a=BAe(),n=mke({id:a.generateId("description")},e),[t,i]=on(n,["id"]);return Aa((()=>xa(a.registerDescription(t.id)))),Xa(Ake,rn({as:"div",get id(){return t.id}},(()=>a.dataset()),i))}function ewe(e){const a=BAe(),n=mke({id:a.generateId("indicator")},e),[t,i]=on(n,["forceMount"]);return Xa(hn,{get when(){return t.forceMount||a.isChecked()},get children(){return Xa(Ake,rn({as:"div"},(()=>a.dataset()),i))}})}function awe(e){const a=BAe(),n=mke({id:a.generateId("label")},e),[t,i]=on(n,["ref","id"]);return Aa((()=>xa(a.registerLabel(t.id)))),Xa(Ake,rn({as:"div",ref(e){const n=wye(a.setLabelRef,t.ref);"function"==typeof n&&n(e)},get id(){return t.id}},(()=>a.dataset()),i))}function nwe(e){const a=jAe();return Xa(hn,{get when(){return a.contentPresent()},get children(){return Xa(Vn,e)}})}var twe=Ba();function iwe(e){const a=mke({id:RAe().generateId(`radiogroup-${un()}`)},e),[n,t]=on(a,["value","defaultValue","onChange","disabled"]),[i,r]=Pke({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return Xa(twe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===i(),setSelectedValue:r},get children(){return Xa(ZAe,t)}})}function rwe(e){const a=function(){const e=za(twe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=mke({closeOnSelect:!1},e),[t,i]=on(n,["value","onSelect"]);return Xa(_Ae,rn({role:"menuitemradio",get checked(){return a.isSelectedValue(t.value)},onSelect:()=>{t.onSelect?.(),a.setSelectedValue(t.value)}},i))}function owe(e,a,n){const t=e.split("-")[0],i=n.getBoundingClientRect(),r=[],o=a.clientX,s=a.clientY;switch(t){case"top":r.push([o,s+5]),r.push([i.left,i.bottom]),r.push([i.left,i.top]),r.push([i.right,i.top]),r.push([i.right,i.bottom]);break;case"right":r.push([o-5,s]),r.push([i.left,i.top]),r.push([i.right,i.top]),r.push([i.right,i.bottom]),r.push([i.left,i.bottom]);break;case"bottom":r.push([o,s-5]),r.push([i.right,i.top]),r.push([i.right,i.bottom]),r.push([i.left,i.bottom]),r.push([i.left,i.top]);break;case"left":r.push([o+5,s]),r.push([i.right,i.bottom]),r.push([i.left,i.bottom]),r.push([i.left,i.top]),r.push([i.right,i.top])}return r}function swe(e){const a=RAe(),n=Rke(),t=PAe(),i=HAe(),r=JAe(),o=mke({placement:"horizontal"===a.orientation()?"bottom-start":"right-start"},e),[s,l]=on(o,["open","defaultOpen","onOpenChange"]);let u=0,c=null,d="right";const[m,h]=ka(),[p,g]=ka(),[v,f]=ka(),[y,k]=ka(),[b,S]=ka(!0),[A,w]=ka(l.placement),[C,M]=ka([]),[T,N]=ka([]),{DomCollectionProvider:x}=Hke({items:T,onItemsChange:N}),E=JSe({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:P}=cbe({show:()=>a.forceMount()||E.isOpen(),element:()=>y()??null}),j=function(e){const a=tbe(e),n=Gke({dataSource:()=>Pfe(e.dataSource),getKey:()=>Pfe(e.getKey),getTextValue:()=>Pfe(e.getTextValue),getDisabled:()=>Pfe(e.getDisabled),getSectionChildren:()=>Pfe(e.getSectionChildren),factory:a=>new sbe(e.filter?e.filter(a):a)},[()=>e.filter]),t=new obe(n,a);return ba((()=>{const e=a.focusedKey();null==e||n().getItem(e)||a.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>t}}({selectionMode:"none",dataSource:T}),L=e=>{S(e),E.open()},B=(e=!1)=>{E.close(),e&&t&&t.close(!0)},z=()=>{const e=y();e&&(Xye(e),j.selectionManager().setFocused(!0),j.selectionManager().setFocusedKey(void 0))},R=()=>{null!=r?setTimeout((()=>z())):z()},_=e=>{return d===c?.side&&(a=e,n=c?.area,!!n&&function(e,a){const[n,t]=e;let i=!1;for(let r=a.length,o=0,s=r-1;o<r;s=o++){const[e,l]=a[o],[u,c]=a[s],[,d]=a[0===s?r-1:s-1]||[0,0],m=(l-c)*(n-e)-(e-u)*(t-l);if(c<l){if(t>=c&&t<l){if(0===m)return!0;m>0&&(t===c?t>d&&(i=!i):i=!i)}}else if(l<c){if(t>l&&t<=c){if(0===m)return!0;m<0&&(t===c?t<d&&(i=!i):i=!i)}}else if(t==l&&(n>=u&&n<=e||n>=e&&n<=u))return!0}return i}([a.clientX,a.clientY],n));var a,n};pAe({isDisabled:()=>!(null==t&&E.isOpen()&&a.isModal()),targets:()=>[y(),...C()].filter(Boolean)}),Aa((()=>{const e=y();if(!e||!t)return;const a=t.registerNestedMenu(e);xa((()=>{a()}))})),Aa((()=>{void 0===t&&i?.registerMenu(a.value(),[y(),...C()])})),Aa((()=>{void 0===t&&void 0!==i&&(i.value()===a.value()?(v()?.focus(),i.autoFocusMenu()&&L(!0)):B())})),Aa((()=>{void 0===t&&void 0!==i&&E.isOpen()&&i.setValue(a.value())})),xa((()=>{void 0===t&&i?.unregisterMenu(a.value())}));const D={dataset:wa((()=>({"data-expanded":E.isOpen()?"":void 0,"data-closed":E.isOpen()?void 0:""}))),isOpen:E.isOpen,contentPresent:P,nestedMenus:C,currentPlacement:A,pointerGraceTimeoutId:()=>u,autoFocus:b,listState:()=>j,parentMenuContext:()=>t,triggerRef:v,contentRef:y,triggerId:m,contentId:p,setTriggerRef:f,setContentRef:k,open:L,close:B,toggle:e=>{S(e),E.toggle()},focusContent:R,onItemEnter:e=>{_(e)&&e.preventDefault()},onItemLeave:e=>{_(e)||R()},onTriggerLeave:e=>{_(e)&&e.preventDefault()},setPointerDir:e=>d=e,setPointerGraceTimeoutId:e=>u=e,setPointerGraceIntent:e=>c=e,registerNestedMenu:e=>{M((a=>[...a,e]));const a=t?.registerNestedMenu(e);return()=>{M((a=>Hye(a,e))),a?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:kke(h),registerContentId:kke(g)};return Xa(x,{get children(){return Xa(EAe.Provider,{value:D,get children(){return Xa(hn,{when:void 0===r,get fallback(){return l.children},get children(){return Xa(OSe,rn({anchorRef:v,contentRef:y,onCurrentPlacementChange:w},l))}})}})}})}function lwe(e){const{direction:a}=Yke();return Xa(swe,rn({get placement(){return"rtl"===a()?"left-start":"right-start"},flip:!0},e))}var uwe=(e,a)=>"ltr"===e?["horizontal"===a?"ArrowLeft":"ArrowUp"]:["horizontal"===a?"ArrowRight":"ArrowDown"];function cwe(e){const a=jAe(),n=RAe(),[t,i]=on(e,["onFocusOutside","onKeyDown"]),{direction:r}=Yke();return Xa(UAe,rn({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{t.onFocusOutside?.(e);const n=e.target;Gye(a.triggerRef(),n)||a.close()},onKeyDown:e=>{$ye(e,t.onKeyDown);const i=Gye(e.currentTarget,e.target),o=uwe(r(),n.orientation()).includes(e.key),s=null!=a.parentMenuContext();i&&o&&s&&(a.close(),Xye(a.triggerRef()))}},i))}var dwe=["Enter"," "],mwe=(e,a)=>"ltr"===e?[...dwe,"horizontal"===a?"ArrowRight":"ArrowDown"]:[...dwe,"horizontal"===a?"ArrowLeft":"ArrowUp"];function hwe(e){let a;const n=RAe(),t=jAe(),i=mke({id:n.generateId(`sub-trigger-${un()}`)},e),[r,o]=on(i,["ref","id","textValue","disabled","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);let s=null;const l=()=>{s&&window.clearTimeout(s),s=null},{direction:u}=Yke(),c=()=>r.id,d=()=>{const e=t.parentMenuContext();if(null==e)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");return e.listState().selectionManager()},m=rbe({key:c,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>r.disabled},(()=>a)),h=e=>{$ye(e,r.onClick),t.isOpen()||r.disabled||t.open(!0)},p=e=>{$ye(e,r.onKeyDown),e.repeat||r.disabled||mwe(u(),n.orientation()).includes(e.key)&&(e.stopPropagation(),e.preventDefault(),d().setFocused(!1),d().setFocusedKey(void 0),t.isOpen()||t.open("first"),t.focusContent(),t.listState().selectionManager().setFocused(!0),t.listState().selectionManager().setFocusedKey(t.listState().collection().getFirstKey()))};return Aa((()=>{if(null==t.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");xa(t.registerItemToParentDomCollection({ref:()=>a,type:"item",key:c(),textValue:r.textValue??a?.textContent??"",disabled:r.disabled??!1}))})),Aa(Ta((()=>t.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{xa((()=>{window.clearTimeout(e),t.parentMenuContext()?.setPointerGraceIntent(null)}))}))),Aa((()=>xa(t.registerTriggerId(r.id)))),xa((()=>{l()})),Xa(Ake,rn({as:"div",ref(e){const n=wye((e=>{t.setTriggerRef(e),a=e}),r.ref);"function"==typeof n&&n(e)},get id(){return r.id},role:"menuitem",get tabIndex(){return m.tabIndex()},"aria-haspopup":"true",get"aria-expanded"(){return t.isOpen()},get"aria-controls"(){return wa((()=>!!t.isOpen()))()?t.contentId():void 0},get"aria-disabled"(){return r.disabled},get"data-key"(){return m.dataKey()},get"data-highlighted"(){return d().focusedKey()===c()?"":void 0},get"data-disabled"(){return r.disabled?"":void 0},get onPointerDown(){return Yye([r.onPointerDown,m.onPointerDown])},get onPointerUp(){return Yye([r.onPointerUp,m.onPointerUp])},get onClick(){return Yye([h,m.onClick])},get onKeyDown(){return Yye([p,m.onKeyDown])},get onMouseDown(){return Yye([r.onMouseDown,m.onMouseDown])},get onFocus(){return Yye([r.onFocus,m.onFocus])},onPointerMove:e=>{if($ye(e,r.onPointerMove),"mouse"!==e.pointerType)return;const a=t.parentMenuContext();a?.onItemEnter(e),e.defaultPrevented||(r.disabled?a?.onItemLeave(e):(t.isOpen()||s||(t.parentMenuContext()?.setPointerGraceIntent(null),s=window.setTimeout((()=>{t.open(!1),l()}),100)),a?.onItemEnter(e),e.defaultPrevented||(t.listState().selectionManager().isFocused()&&(t.listState().selectionManager().setFocused(!1),t.listState().selectionManager().setFocusedKey(void 0)),Xye(e.currentTarget),a?.listState().selectionManager().setFocused(!0),a?.listState().selectionManager().setFocusedKey(c()))))},onPointerLeave:e=>{if($ye(e,r.onPointerLeave),"mouse"!==e.pointerType)return;l();const a=t.parentMenuContext(),n=t.contentRef();if(n){a?.setPointerGraceIntent({area:owe(t.currentPlacement(),e,n),side:t.currentPlacement().split("-")[0]}),window.clearTimeout(a?.pointerGraceTimeoutId());const i=window.setTimeout((()=>{a?.setPointerGraceIntent(null)}),300);a?.setPointerGraceTimeoutId(i)}else{if(a?.onTriggerLeave(e),e.defaultPrevented)return;a?.setPointerGraceIntent(null)}a?.onItemLeave(e)}},(()=>t.dataset()),o))}function pwe(e){const a=HAe(),n=mke({id:`menu-${un()}`,modal:!0},e),[t,i]=on(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),r=JSe({open:()=>t.open,defaultOpen:()=>t.defaultOpen,onOpenChange:e=>t.onOpenChange?.(e)}),o={isModal:()=>t.modal??!0,preventScroll:()=>t.preventScroll??o.isModal(),forceMount:()=>t.forceMount??!1,generateId:Iye((()=>t.id)),value:()=>t.value,orientation:()=>t.orientation??a?.orientation()??"horizontal"};return Xa(zAe.Provider,{value:o,get children(){return Xa(swe,rn({get open(){return r.isOpen()},get onOpenChange(){return r.setIsOpen}},i))}})}function gwe(e){let a;const n=mke({orientation:"horizontal"},e),[t,i]=on(n,["ref","orientation"]),r=bke((()=>a),(()=>"hr"));return Xa(Ake,rn({as:"hr",ref(e){const n=wye((e=>a=e),t.ref);"function"==typeof n&&n(e)},get role(){return"hr"!==r()?"separator":void 0},get"aria-orientation"(){return"vertical"===t.orientation?"vertical":void 0},get"data-orientation"(){return t.orientation}},i))}Bke({},{Root:()=>gwe,Separator:()=>vwe});var vwe=gwe,fwe={};function ywe(e){const a=RAe(),n=jAe(),[t,i]=on(e,["onCloseAutoFocus","onInteractOutside"]);let r=!1;return Xa(WAe,rn({onCloseAutoFocus:e=>{t.onCloseAutoFocus?.(e),r||Xye(n.triggerRef()),r=!1,e.preventDefault()},onInteractOutside:e=>{t.onInteractOutside?.(e),a.isModal()&&!e.detail.isContextMenu||(r=!0)}},i))}function kwe(e){return Xa(pwe,mke({id:`dropdownmenu-${un()}`},e))}Bke(fwe,{Arrow:()=>_Se,CheckboxItem:()=>DAe,Content:()=>ywe,DropdownMenu:()=>bwe,Group:()=>ZAe,GroupLabel:()=>$Ae,Icon:()=>YAe,Item:()=>QAe,ItemDescription:()=>XAe,ItemIndicator:()=>ewe,ItemLabel:()=>awe,Portal:()=>nwe,RadioGroup:()=>iwe,RadioItem:()=>rwe,Root:()=>kwe,Separator:()=>gwe,Sub:()=>lwe,SubContent:()=>cwe,SubTrigger:()=>hwe,Trigger:()=>VAe});var bwe=Object.assign(kwe,{Arrow:_Se,CheckboxItem:DAe,Content:ywe,Group:ZAe,GroupLabel:$Ae,Icon:YAe,Item:QAe,ItemDescription:XAe,ItemIndicator:ewe,ItemLabel:awe,Portal:nwe,RadioGroup:iwe,RadioItem:rwe,Separator:gwe,Sub:lwe,SubContent:cwe,SubTrigger:hwe,Trigger:VAe}),Swe={colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000000",white:"#ffffff",neutral:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},darkGray:{50:"#525c7a",100:"#49536e",200:"#414962",300:"#394056",400:"#313749",500:"#292e3d",600:"#212530",700:"#191c24",800:"#111318",900:"#0b0d10"},gray:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},blue:{25:"#F5FAFF",50:"#EFF8FF",100:"#D1E9FF",200:"#B2DDFF",300:"#84CAFF",400:"#53B1FD",500:"#2E90FA",600:"#1570EF",700:"#175CD3",800:"#1849A9",900:"#194185"},green:{25:"#F6FEF9",50:"#ECFDF3",100:"#D1FADF",200:"#A6F4C5",300:"#6CE9A6",400:"#32D583",500:"#12B76A",600:"#039855",700:"#027A48",800:"#05603A",900:"#054F31"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},yellow:{25:"#FFFCF5",50:"#FFFAEB",100:"#FEF0C7",200:"#FEDF89",300:"#FEC84B",400:"#FDB022",500:"#F79009",600:"#DC6803",700:"#B54708",800:"#93370D",900:"#7A2E0E"},purple:{25:"#FAFAFF",50:"#F4F3FF",100:"#EBE9FE",200:"#D9D6FE",300:"#BDB4FE",400:"#9B8AFB",500:"#7A5AF8",600:"#6938EF",700:"#5925DC",800:"#4A1FB8",900:"#3E1C96"},teal:{25:"#F6FEFC",50:"#F0FDF9",100:"#CCFBEF",200:"#99F6E0",300:"#5FE9D0",400:"#2ED3B7",500:"#15B79E",600:"#0E9384",700:"#107569",800:"#125D56",900:"#134E48"},pink:{25:"#fdf2f8",50:"#fce7f3",100:"#fbcfe8",200:"#f9a8d4",300:"#f472b6",400:"#ec4899",500:"#db2777",600:"#be185d",700:"#9d174d",800:"#831843",900:"#500724"},cyan:{25:"#ecfeff",50:"#cffafe",100:"#a5f3fc",200:"#67e8f9",300:"#22d3ee",400:"#06b6d4",500:"#0891b2",600:"#0e7490",700:"#155e75",800:"#164e63",900:"#083344"}},alpha:{90:"e5",80:"cc"},font:{size:{xs:"calc(var(--tsqd-font-size) * 0.75)",sm:"calc(var(--tsqd-font-size) * 0.875)",md:"var(--tsqd-font-size)"},lineHeight:{xs:"calc(var(--tsqd-font-size) * 1)",sm:"calc(var(--tsqd-font-size) * 1.25)",md:"calc(var(--tsqd-font-size) * 1.5)"},weight:{medium:"500",semibold:"600",bold:"700"}},border:{radius:{xs:"calc(var(--tsqd-font-size) * 0.125)",sm:"calc(var(--tsqd-font-size) * 0.25)",full:"9999px"}},size:{.25:"calc(var(--tsqd-font-size) * 0.0625)",.5:"calc(var(--tsqd-font-size) * 0.125)",1:"calc(var(--tsqd-font-size) * 0.25)",1.5:"calc(var(--tsqd-font-size) * 0.375)",2:"calc(var(--tsqd-font-size) * 0.5)",2.5:"calc(var(--tsqd-font-size) * 0.625)",3:"calc(var(--tsqd-font-size) * 0.75)",3.5:"calc(var(--tsqd-font-size) * 0.875)",4:"calc(var(--tsqd-font-size) * 1)",4.5:"calc(var(--tsqd-font-size) * 1.125)",5:"calc(var(--tsqd-font-size) * 1.25)",6:"calc(var(--tsqd-font-size) * 1.5)",6.5:"calc(var(--tsqd-font-size) * 1.625)",14:"calc(var(--tsqd-font-size) * 3.5)"},shadow:{xs:(e="rgb(0 0 0 / 0.1)")=>"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:(e="rgb(0 0 0 / 0.1)")=>`0 1px 3px 0 ${e}, 0 1px 2px -1px ${e}`,md:(e="rgb(0 0 0 / 0.1)")=>`0 4px 6px -1px ${e}, 0 2px 4px -2px ${e}`,lg:(e="rgb(0 0 0 / 0.1)")=>`0 10px 15px -3px ${e}, 0 4px 6px -4px ${e}`,xl:(e="rgb(0 0 0 / 0.1)")=>`0 20px 25px -5px ${e}, 0 8px 10px -6px ${e}`,"2xl":(e="rgb(0 0 0 / 0.25)")=>`0 25px 50px -12px ${e}`,inner:(e="rgb(0 0 0 / 0.05)")=>`inset 0 2px 4px 0 ${e}`,none:()=>"none"}},Awe=Mn('<svg width=14 height=14 viewBox="0 0 14 14"fill=none xmlns=http://www.w3.org/2000/svg><path d="M13 13L9.00007 9M10.3333 5.66667C10.3333 8.244 8.244 10.3333 5.66667 10.3333C3.08934 10.3333 1 8.244 1 5.66667C1 3.08934 3.08934 1 5.66667 1C8.244 1 10.3333 3.08934 10.3333 5.66667Z"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),wwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9 3H15M3 6H21M19 6L18.2987 16.5193C18.1935 18.0975 18.1409 18.8867 17.8 19.485C17.4999 20.0118 17.0472 20.4353 16.5017 20.6997C15.882 21 15.0911 21 13.5093 21H10.4907C8.90891 21 8.11803 21 7.49834 20.6997C6.95276 20.4353 6.50009 20.0118 6.19998 19.485C5.85911 18.8867 5.8065 18.0975 5.70129 16.5193L5 6M10 10.5V15.5M14 10.5V15.5"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Cwe=Mn('<svg width=10 height=6 viewBox="0 0 10 6"fill=none xmlns=http://www.w3.org/2000/svg><path d="M1 1L5 5L9 1"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Mwe=Mn('<svg width=12 height=12 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 13.3333V2.66667M8 2.66667L4 6.66667M8 2.66667L12 6.66667"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Twe=Mn('<svg width=12 height=12 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 2.66667V13.3333M8 13.3333L4 9.33333M8 13.3333L12 9.33333"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Nwe=Mn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M12 2v2m0 16v2M4 12H2m4.314-5.686L4.9 4.9m12.786 1.414L19.1 4.9M6.314 17.69 4.9 19.104m12.786-1.414 1.414 1.414M22 12h-2m-3 0a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),xwe=Mn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M22 15.844a10.424 10.424 0 0 1-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 0 0 2 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Ewe=Mn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 21h8m-4-4v4m-5.2-4h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 14.72 22 13.88 22 12.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 3 18.88 3 17.2 3H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 5.28 2 6.12 2 7.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 17 5.12 17 6.8 17Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Pwe=Mn('<svg stroke=currentColor fill=currentColor stroke-width=0 viewBox="0 0 24 24"height=1em width=1em xmlns=http://www.w3.org/2000/svg><path fill=none d="M0 0h24v24H0z"></path><path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3a4.237 4.237 0 00-6 0zm-4-4l2 2a7.074 7.074 0 0110 0l2-2C15.14 9.14 8.87 9.14 5 13z">'),jwe=Mn('<svg stroke-width=0 viewBox="0 0 24 24"height=1em width=1em xmlns=http://www.w3.org/2000/svg><path fill=none d="M24 .01c0-.01 0-.01 0 0L0 0v24h24V.01zM0 0h24v24H0V0zm0 0h24v24H0V0z"></path><path d="M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7l2-2zm-4 4a9.793 9.793 0 00-4.49-2.56l3.53 3.53.96-.97zM2 3.05L5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24A9.684 9.684 0 005 13v.01L6.99 15a7.042 7.042 0 014.92-2.06L18.98 20l1.27-1.26L3.29 1.79 2 3.05zM9 17l3 3 3-3a4.237 4.237 0 00-6 0z">'),Lwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9.3951 19.3711L9.97955 20.6856C10.1533 21.0768 10.4368 21.4093 10.7958 21.6426C11.1547 21.8759 11.5737 22.0001 12.0018 22C12.4299 22.0001 12.8488 21.8759 13.2078 21.6426C13.5667 21.4093 13.8503 21.0768 14.024 20.6856L14.6084 19.3711C14.8165 18.9047 15.1664 18.5159 15.6084 18.26C16.0532 18.0034 16.5678 17.8941 17.0784 17.9478L18.5084 18.1C18.9341 18.145 19.3637 18.0656 19.7451 17.8713C20.1265 17.6771 20.4434 17.3763 20.6573 17.0056C20.8715 16.635 20.9735 16.2103 20.9511 15.7829C20.9286 15.3555 20.7825 14.9438 20.5307 14.5978L19.684 13.4344C19.3825 13.0171 19.2214 12.5148 19.224 12C19.2239 11.4866 19.3865 10.9864 19.6884 10.5711L20.5351 9.40778C20.787 9.06175 20.933 8.65007 20.9555 8.22267C20.978 7.79528 20.8759 7.37054 20.6618 7C20.4479 6.62923 20.131 6.32849 19.7496 6.13423C19.3681 5.93997 18.9386 5.86053 18.5129 5.90556L17.0829 6.05778C16.5722 6.11141 16.0577 6.00212 15.6129 5.74556C15.17 5.48825 14.82 5.09736 14.6129 4.62889L14.024 3.31444C13.8503 2.92317 13.5667 2.59072 13.2078 2.3574C12.8488 2.12408 12.4299 1.99993 12.0018 2C11.5737 1.99993 11.1547 2.12408 10.7958 2.3574C10.4368 2.59072 10.1533 2.92317 9.97955 3.31444L9.3951 4.62889C9.18803 5.09736 8.83798 5.48825 8.3951 5.74556C7.95032 6.00212 7.43577 6.11141 6.9251 6.05778L5.49066 5.90556C5.06499 5.86053 4.6354 5.93997 4.25397 6.13423C3.87255 6.32849 3.55567 6.62923 3.34177 7C3.12759 7.37054 3.02555 7.79528 3.04804 8.22267C3.07052 8.65007 3.21656 9.06175 3.46844 9.40778L4.3151 10.5711C4.61704 10.9864 4.77964 11.4866 4.77955 12C4.77964 12.5134 4.61704 13.0137 4.3151 13.4289L3.46844 14.5922C3.21656 14.9382 3.07052 15.3499 3.04804 15.7773C3.02555 16.2047 3.12759 16.6295 3.34177 17C3.55589 17.3706 3.8728 17.6712 4.25417 17.8654C4.63554 18.0596 5.06502 18.1392 5.49066 18.0944L6.92066 17.9422C7.43133 17.8886 7.94587 17.9979 8.39066 18.2544C8.83519 18.511 9.18687 18.902 9.3951 19.3711Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path><path d="M12 15C13.6568 15 15 13.6569 15 12C15 10.3431 13.6568 9 12 9C10.3431 9 8.99998 10.3431 8.99998 12C8.99998 13.6569 10.3431 15 12 15Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Bwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M16 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V8M11.5 12.5L17 7M17 7H12M17 7V12M6.2 21H8.8C9.9201 21 10.4802 21 10.908 20.782C11.2843 20.5903 11.5903 20.2843 11.782 19.908C12 19.4802 12 18.9201 12 17.8V15.2C12 14.0799 12 13.5198 11.782 13.092C11.5903 12.7157 11.2843 12.4097 10.908 12.218C10.4802 12 9.92011 12 8.8 12H6.2C5.0799 12 4.51984 12 4.09202 12.218C3.71569 12.4097 3.40973 12.7157 3.21799 13.092C3 13.5198 3 14.0799 3 15.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),zwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path class=copier d="M8 8V5.2C8 4.0799 8 3.51984 8.21799 3.09202C8.40973 2.71569 8.71569 2.40973 9.09202 2.21799C9.51984 2 10.0799 2 11.2 2H18.8C19.9201 2 20.4802 2 20.908 2.21799C21.2843 2.40973 21.5903 2.71569 21.782 3.09202C22 3.51984 22 4.0799 22 5.2V12.8C22 13.9201 22 14.4802 21.782 14.908C21.5903 15.2843 21.2843 15.5903 20.908 15.782C20.4802 16 19.9201 16 18.8 16H16M5.2 22H12.8C13.9201 22 14.4802 22 14.908 21.782C15.2843 21.5903 15.5903 21.2843 15.782 20.908C16 20.4802 16 19.9201 16 18.8V11.2C16 10.0799 16 9.51984 15.782 9.09202C15.5903 8.71569 15.2843 8.40973 14.908 8.21799C14.4802 8 13.9201 8 12.8 8H5.2C4.0799 8 3.51984 8 3.09202 8.21799C2.71569 8.40973 2.40973 8.71569 2.21799 9.09202C2 9.51984 2 10.0799 2 11.2V18.8C2 19.9201 2 20.4802 2.21799 20.908C2.40973 21.2843 2.71569 21.5903 3.09202 21.782C3.51984 22 4.07989 22 5.2 22Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round stroke=currentColor>'),Rwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M2.5 21.4998L8.04927 19.3655C8.40421 19.229 8.58168 19.1607 8.74772 19.0716C8.8952 18.9924 9.0358 18.901 9.16804 18.7984C9.31692 18.6829 9.45137 18.5484 9.72028 18.2795L21 6.99982C22.1046 5.89525 22.1046 4.10438 21 2.99981C19.8955 1.89525 18.1046 1.89524 17 2.99981L5.72028 14.2795C5.45138 14.5484 5.31692 14.6829 5.20139 14.8318C5.09877 14.964 5.0074 15.1046 4.92823 15.2521C4.83911 15.4181 4.77085 15.5956 4.63433 15.9506L2.5 21.4998ZM2.5 21.4998L4.55812 16.1488C4.7054 15.7659 4.77903 15.5744 4.90534 15.4867C5.01572 15.4101 5.1523 15.3811 5.2843 15.4063C5.43533 15.4351 5.58038 15.5802 5.87048 15.8703L8.12957 18.1294C8.41967 18.4195 8.56472 18.5645 8.59356 18.7155C8.61877 18.8475 8.58979 18.9841 8.51314 19.0945C8.42545 19.2208 8.23399 19.2944 7.85107 19.4417L2.5 21.4998Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),_we=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M7.5 12L10.5 15L16.5 9M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Dwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9 9L15 15M15 9L9 15M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"stroke=#F04438 stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Kwe=Mn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 xmlns=http://www.w3.org/2000/svg><rect class=list width=20 height=20 y=2 x=2 rx=2></rect><line class=list-item y1=7 y2=7 x1=6 x2=18></line><line class=list-item y2=12 y1=12 x1=6 x2=18></line><line class=list-item y1=17 y2=17 x1=6 x2=18>'),Hwe=Mn('<svg viewBox="0 0 24 24"height=20 width=20 fill=none xmlns=http://www.w3.org/2000/svg><path d="M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Owe=Mn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Iwe=Mn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M12 2V6M12 18V22M6 12H2M22 12H18M19.0784 19.0784L16.25 16.25M19.0784 4.99994L16.25 7.82837M4.92157 19.0784L7.75 16.25M4.92157 4.99994L7.75 7.82837"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path><animateTransform attributeName=transform attributeType=XML type=rotate from=0 to=360 dur=2s repeatCount=indefinite>'),Gwe=Mn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M15 9L9 15M9 9L15 15M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Vwe=Mn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9.5 15V9M14.5 15V9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Fwe=Mn('<svg version=1.0 viewBox="0 0 633 633"><linearGradient x1=-666.45 x2=-666.45 y1=163.28 y2=163.99 gradientTransform="matrix(633 0 0 633 422177 -103358)"gradientUnits=userSpaceOnUse><stop stop-color=#6BDAFF offset=0></stop><stop stop-color=#F9FFB5 offset=.32></stop><stop stop-color=#FFA770 offset=.71></stop><stop stop-color=#FF7373 offset=1></stop></linearGradient><circle cx=316.5 cy=316.5 r=316.5></circle><defs><filter x=-137.5 y=412 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=412 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=610.5 rx=214.5 ry=186 fill=#015064 stroke=#00CFE2 stroke-width=25></ellipse></g><defs><filter x=316.5 y=412 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=412 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=610.5 rx=214.5 ry=186 fill=#015064 stroke=#00CFE2 stroke-width=25></ellipse></g><defs><filter x=-137.5 y=450 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=450 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=648.5 rx=214.5 ry=186 fill=#015064 stroke=#00A8B8 stroke-width=25></ellipse></g><defs><filter x=316.5 y=450 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=450 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=648.5 rx=214.5 ry=186 fill=#015064 stroke=#00A8B8 stroke-width=25></ellipse></g><defs><filter x=-137.5 y=486 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=486 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=684.5 rx=214.5 ry=186 fill=#015064 stroke=#007782 stroke-width=25></ellipse></g><defs><filter x=316.5 y=486 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=486 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=684.5 rx=214.5 ry=186 fill=#015064 stroke=#007782 stroke-width=25></ellipse></g><defs><filter x=272.2 y=308 width=176.9 height=129.3 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=272.2 y=308 width=176.9 height=129.3 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><line x1=436 x2=431 y1=403.2 y2=431.8 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><line x1=291 x2=280 y1=341.5 y2=403.5 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><line x1=332.9 x2=328.6 y1=384.1 y2=411.2 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><linearGradient x1=-670.75 x2=-671.59 y1=164.4 y2=164.49 gradientTransform="matrix(-184.16 -32.472 -11.461 64.997 -121359 -32126)"gradientUnits=userSpaceOnUse><stop stop-color=#EE2700 offset=0></stop><stop stop-color=#FF008E offset=1></stop></linearGradient><path d="m344.1 363 97.7 17.2c5.8 2.1 8.2 6.1 7.1 12.1s-4.7 9.2-11 9.9l-106-18.7-57.5-59.2c-3.2-4.8-2.9-9.1 0.8-12.8s8.3-4.4 13.7-2.1l55.2 53.6z"clip-rule=evenodd fill-rule=evenodd></path><line x1=428.2 x2=429.1 y1=384.5 y2=378 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=395.2 x2=396.1 y1=379.5 y2=373 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=362.2 x2=363.1 y1=373.5 y2=367.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=324.2 x2=328.4 y1=351.3 y2=347.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=303.2 x2=307.4 y1=331.3 y2=327.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line></g><defs><filter x=73.2 y=113.8 width=280.6 height=317.4 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=73.2 y=113.8 width=280.6 height=317.4 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-672.16 x2=-672.16 y1=165.03 y2=166.03 gradientTransform="matrix(-100.18 48.861 97.976 200.88 -83342 -93.059)"gradientUnits=userSpaceOnUse><stop stop-color=#A17500 offset=0></stop><stop stop-color=#5D2100 offset=1></stop></linearGradient><path d="m192.3 203c8.1 37.3 14 73.6 17.8 109.1 3.8 35.4 2.8 75.1-3 119.2l61.2-16.7c-15.6-59-25.2-97.9-28.6-116.6s-10.8-51.9-22.1-99.6l-25.3 4.6"clip-rule=evenodd fill-rule=evenodd></path><g stroke=#2F8A00><linearGradient x1=-660.23 x2=-660.23 y1=166.72 y2=167.72 gradientTransform="matrix(92.683 4.8573 -2.0259 38.657 61680 -3088.6)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m195 183.9s-12.6-22.1-36.5-29.9c-15.9-5.2-34.4-1.5-55.5 11.1 15.9 14.3 29.5 22.6 40.7 24.9 16.8 3.6 51.3-6.1 51.3-6.1z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-661.36 x2=-661.36 y1=164.18 y2=165.18 gradientTransform="matrix(110 5.7648 -6.3599 121.35 73933 -15933)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5s-47.5-8.5-83.2 15.7c-23.8 16.2-34.3 49.3-31.6 99.4 30.3-27.8 52.1-48.5 65.2-61.9 19.8-20.2 49.6-53.2 49.6-53.2z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-656.79 x2=-656.79 y1=165.15 y2=166.15 gradientTransform="matrix(62.954 3.2993 -3.5023 66.828 42156 -8754.1)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m195 183.9c-0.8-21.9 6-38 20.6-48.2s29.8-15.4 45.5-15.3c-6.1 21.4-14.5 35.8-25.2 43.4s-24.4 14.2-40.9 20.1z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-663.07 x2=-663.07 y1=165.44 y2=166.44 gradientTransform="matrix(152.47 7.9907 -3.0936 59.029 101884 -4318.7)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c31.9-30 64.1-39.7 96.7-29s50.8 30.4 54.6 59.1c-35.2-5.5-60.4-9.6-75.8-12.1-15.3-2.6-40.5-8.6-75.5-18z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-662.57 x2=-662.57 y1=164.44 y2=165.44 gradientTransform="matrix(136.46 7.1517 -5.2163 99.533 91536 -11442)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c35.8-7.6 65.6-0.2 89.2 22s37.7 49 42.3 80.3c-39.8-9.7-68.3-23.8-85.5-42.4s-32.5-38.5-46-59.9z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-656.43 x2=-656.43 y1=163.86 y2=164.86 gradientTransform="matrix(60.866 3.1899 -8.7773 167.48 41560 -25168)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c-33.6 13.8-53.6 35.7-60.1 65.6s-3.6 63.1 8.7 99.6c27.4-40.3 43.2-69.6 47.4-88s5.6-44.1 4-77.2z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><path d="m196.5 182.3c-14.8 21.6-25.1 41.4-30.8 59.4s-9.5 33-11.1 45.1"fill=none stroke-linecap=round stroke-width=8></path><path d="m194.9 185.7c-24.4 1.7-43.8 9-58.1 21.8s-24.7 25.4-31.3 37.8"fill=none stroke-linecap=round stroke-width=8></path><path d="m204.5 176.4c29.7-6.7 52-8.4 67-5.1s26.9 8.6 35.8 15.9"fill=none stroke-linecap=round stroke-width=8></path><path d="m196.5 181.4c20.3 9.9 38.2 20.5 53.9 31.9s27.4 22.1 35.1 32"fill=none stroke-linecap=round stroke-width=8></path></g></g><defs><filter x=50.5 y=399 width=532 height=633 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=50.5 y=399 width=532 height=633 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-666.06 x2=-666.23 y1=163.36 y2=163.75 gradientTransform="matrix(532 0 0 633 354760 -102959)"gradientUnits=userSpaceOnUse><stop stop-color=#FFF400 offset=0></stop><stop stop-color=#3C8700 offset=1></stop></linearGradient><ellipse cx=316.5 cy=715.5 rx=266 ry=316.5></ellipse></g><defs><filter x=391 y=-24 width=288 height=283 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=391 y=-24 width=288 height=283 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-664.56 x2=-664.56 y1=163.79 y2=164.79 gradientTransform="matrix(227 0 0 227 151421 -37204)"gradientUnits=userSpaceOnUse><stop stop-color=#FFDF00 offset=0></stop><stop stop-color=#FF9D00 offset=1></stop></linearGradient><circle cx=565.5 cy=89.5 r=113.5></circle><linearGradient x1=-644.5 x2=-645.77 y1=342 y2=342 gradientTransform="matrix(30 0 0 1 19770 -253)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=427 x2=397 y1=89 y2=89 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-641.56 x2=-642.83 y1=196.02 y2=196.07 gradientTransform="matrix(26.5 0 0 5.5 17439 -1025.5)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=430.5 x2=404 y1=55.5 y2=50 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-643.73 x2=-645 y1=185.83 y2=185.9 gradientTransform="matrix(29 0 0 8 19107 -1361)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=431 x2=402 y1=122 y2=130 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-638.94 x2=-640.22 y1=177.09 y2=177.39 gradientTransform="matrix(24 0 0 13 15783 -2145)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=442 x2=418 y1=153 y2=166 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-633.42 x2=-634.7 y1=172.41 y2=173.31 gradientTransform="matrix(20 0 0 19 13137 -3096)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=464 x2=444 y1=180 y2=199 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-619.05 x2=-619.52 y1=170.82 y2=171.82 gradientTransform="matrix(13.83 0 0 22.85 9050 -3703.4)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=491.4 x2=477.5 y1=203 y2=225.9 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-578.5 x2=-578.63 y1=170.31 y2=171.31 gradientTransform="matrix(7.5 0 0 24.5 4860 -3953)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=524.5 x2=517 y1=219.5 y2=244 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=666.5 x2=666.5 y1=170.31 y2=171.31 gradientTransform="matrix(.5 0 0 24.5 231.5 -3944)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=564.5 x2=565 y1=228.5 y2=253 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12>');function Jwe(){return Awe()}function Uwe(){return wwe()}function Wwe(){return Cwe()}function qwe(){return Mwe()}function Zwe(){return Twe()}function $we(){return(e=Twe()).style.setProperty("transform","rotate(90deg)"),e;var e}function Ywe(){return(e=Twe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function Qwe(){return Nwe()}function Xwe(){return xwe()}function eCe(){return Ewe()}function aCe(){return Pwe()}function nCe(){return jwe()}function tCe(){return Lwe()}function iCe(){return Bwe()}function rCe(){return zwe()}function oCe(){return Rwe()}function sCe(e){return a=_we(),n=a.firstChild,Sa((()=>Nn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),a;var a,n}function lCe(){return Dwe()}function uCe(){return Kwe()}function cCe(e){return[Xa(hn,{get when(){return e.checked},get children(){var a=_we(),n=a.firstChild;return Sa((()=>Nn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),a}}),Xa(hn,{get when(){return!e.checked},get children(){var a=Hwe(),n=a.firstChild;return Sa((()=>Nn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),a}})]}function dCe(){return Owe()}function mCe(){return Iwe()}function hCe(){return Gwe()}function pCe(){return Vwe()}function gCe(){const e=un();return a=Fwe(),r=(i=(t=(n=a.firstChild).nextSibling).nextSibling).firstChild,s=(o=i.nextSibling).firstChild,c=(u=(l=o.nextSibling).nextSibling).firstChild,m=(d=u.nextSibling).firstChild,g=(p=(h=d.nextSibling).nextSibling).firstChild,f=(v=p.nextSibling).firstChild,b=(k=(y=v.nextSibling).nextSibling).firstChild,A=(S=k.nextSibling).firstChild,M=(C=(w=S.nextSibling).nextSibling).firstChild,N=(T=C.nextSibling).firstChild,P=(E=(x=T.nextSibling).nextSibling).firstChild,L=(j=E.nextSibling).firstChild,R=(z=(B=j.nextSibling).nextSibling).firstChild,D=(_=z.nextSibling).firstChild,O=(H=(K=_.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,G=(I=K.nextSibling).firstChild,F=(V=I.nextSibling).firstChild,re=(ie=(te=(ne=(ae=(ee=(X=(Q=(Y=($=(Z=(q=(W=(U=(J=V.nextSibling).firstChild).nextSibling).nextSibling.firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,se=(oe=J.nextSibling).firstChild,ue=(le=oe.nextSibling).firstChild,me=(de=(ce=le.nextSibling).firstChild).nextSibling,pe=(he=ce.nextSibling).firstChild,ve=(ge=he.nextSibling).firstChild,Re=(ze=(Be=(Le=(je=(Pe=(Ee=(xe=(Ne=(Te=(Me=(Ce=(we=(Ae=(Se=(be=(ke=(ye=(fe=ge.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,Nn(n,"id",`a-${e}`),Nn(t,"fill",`url(#a-${e})`),Nn(r,"id",`am-${e}`),Nn(o,"id",`b-${e}`),Nn(s,"filter",`url(#am-${e})`),Nn(l,"mask",`url(#b-${e})`),Nn(c,"id",`ah-${e}`),Nn(d,"id",`k-${e}`),Nn(m,"filter",`url(#ah-${e})`),Nn(h,"mask",`url(#k-${e})`),Nn(g,"id",`ae-${e}`),Nn(v,"id",`j-${e}`),Nn(f,"filter",`url(#ae-${e})`),Nn(y,"mask",`url(#j-${e})`),Nn(b,"id",`ai-${e}`),Nn(S,"id",`i-${e}`),Nn(A,"filter",`url(#ai-${e})`),Nn(w,"mask",`url(#i-${e})`),Nn(M,"id",`aj-${e}`),Nn(T,"id",`h-${e}`),Nn(N,"filter",`url(#aj-${e})`),Nn(x,"mask",`url(#h-${e})`),Nn(P,"id",`ag-${e}`),Nn(j,"id",`g-${e}`),Nn(L,"filter",`url(#ag-${e})`),Nn(B,"mask",`url(#g-${e})`),Nn(R,"id",`af-${e}`),Nn(_,"id",`f-${e}`),Nn(D,"filter",`url(#af-${e})`),Nn(K,"mask",`url(#f-${e})`),Nn(H,"id",`m-${e}`),Nn(O,"fill",`url(#m-${e})`),Nn(G,"id",`ak-${e}`),Nn(V,"id",`e-${e}`),Nn(F,"filter",`url(#ak-${e})`),Nn(J,"mask",`url(#e-${e})`),Nn(U,"id",`n-${e}`),Nn(W,"fill",`url(#n-${e})`),Nn(q,"id",`r-${e}`),Nn(Z,"fill",`url(#r-${e})`),Nn($,"id",`s-${e}`),Nn(Y,"fill",`url(#s-${e})`),Nn(Q,"id",`q-${e}`),Nn(X,"fill",`url(#q-${e})`),Nn(ee,"id",`p-${e}`),Nn(ae,"fill",`url(#p-${e})`),Nn(ne,"id",`o-${e}`),Nn(te,"fill",`url(#o-${e})`),Nn(ie,"id",`l-${e}`),Nn(re,"fill",`url(#l-${e})`),Nn(se,"id",`al-${e}`),Nn(le,"id",`d-${e}`),Nn(ue,"filter",`url(#al-${e})`),Nn(ce,"mask",`url(#d-${e})`),Nn(de,"id",`u-${e}`),Nn(me,"fill",`url(#u-${e})`),Nn(pe,"id",`ad-${e}`),Nn(ge,"id",`c-${e}`),Nn(ve,"filter",`url(#ad-${e})`),Nn(fe,"mask",`url(#c-${e})`),Nn(ye,"id",`t-${e}`),Nn(ke,"fill",`url(#t-${e})`),Nn(be,"id",`v-${e}`),Nn(Se,"stroke",`url(#v-${e})`),Nn(Ae,"id",`aa-${e}`),Nn(we,"stroke",`url(#aa-${e})`),Nn(Ce,"id",`w-${e}`),Nn(Me,"stroke",`url(#w-${e})`),Nn(Te,"id",`ac-${e}`),Nn(Ne,"stroke",`url(#ac-${e})`),Nn(xe,"id",`ab-${e}`),Nn(Ee,"stroke",`url(#ab-${e})`),Nn(Pe,"id",`y-${e}`),Nn(je,"stroke",`url(#y-${e})`),Nn(Le,"id",`x-${e}`),Nn(Be,"stroke",`url(#x-${e})`),Nn(ze,"id",`z-${e}`),Nn(Re,"stroke",`url(#z-${e})`),a;var a,n,t,i,r,o,s,l,u,c,d,m,h,p,g,v,f,y,k,b,S,A,w,C,M,T,N,x,E,P,j,L,B,z,R,_,D,K,H,O,I,G,V,F,J,U,W,q,Z,$,Y,Q,X,ee,ae,ne,te,ie,re,oe,se,le,ue,ce,de,me,he,pe,ge,ve,fe,ye,ke,be,Se,Ae,we,Ce,Me,Te,Ne,xe,Ee,Pe,je,Le,Be,ze,Re}var vCe=Mn('<span><svg width=16 height=16 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M6 12L10 8L6 4"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),fCe=Mn('<button title="Copy object to clipboard">'),yCe=Mn('<button title="Remove all items"aria-label="Remove all items">'),kCe=Mn('<button title="Delete item"aria-label="Delete item">'),bCe=Mn('<button title="Toggle value"aria-label="Toggle value">'),SCe=Mn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),ACe=Mn("<div>"),wCe=Mn("<div><button> <span></span> <span> "),CCe=Mn("<input>"),MCe=Mn("<span>"),TCe=Mn("<div><span>:"),NCe=Mn("<div><div><button> [<!>...<!>]");var xCe=e=>{const a=qfe(),n=Vfe().shadowDOMTarget?kye.bind({target:Vfe().shadowDOMTarget}):kye,t=wa((()=>"dark"===a()?DCe(n):_Ce(n)));return i=vCe(),Sa((()=>xn(i,Sye(t().expander,n`
95
95
  transform: rotate(${e.expanded?90:0}deg);
96
96
  `,e.expanded&&n`
97
97
  & svg {