@embedreach/components 0.2.7 → 0.2.8

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
@@ -91,7 +91,7 @@ function jZ(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=
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
- */jae.exports="production"===process.env.NODE_ENV?function(){if(Dae)return Iae;Dae=1;var e="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},t=n.useState,r=n.useEffect,o=n.useLayoutEffect,i=n.useDebugValue;function a(t){var n=t.getSnapshot;t=t.value;try{var r=n();return!e(t,r)}catch(o){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,n){var s=n(),l=t({inst:{value:s,getSnapshot:n}}),c=l[0].inst,u=l[1];return o((function(){c.value=s,c.getSnapshot=n,a(c)&&u({inst:c})}),[e,s,n]),r((function(){return a(c)&&u({inst:c}),e((function(){a(c)&&u({inst:c})}))}),[e]),i(s),s};return Iae.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:s,Iae}():(Fae||(Fae=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(o){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=n,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useState,i=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue,l=!1,c=!1,u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(n,u){l||void 0===t.startTransition||(l=!0);var d=u();if(!c){var p=u();r(d,p)||(c=!0)}var f=(p=o({inst:{value:d,getSnapshot:u}}))[0].inst,h=p[1];return a((function(){f.value=d,f.getSnapshot=u,e(f)&&h({inst:f})}),[n,d,u]),i((function(){return e(f)&&h({inst:f}),n((function(){e(f)&&h({inst:f})}))}),[n]),s(d),d};Uae.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:u,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Uae);var $ae=jae.exports,Vae='[cmdk-group=""]',Bae='[cmdk-group-items=""]',zae='[cmdk-item=""]',Hae=`${zae}:not([aria-disabled="true"])`,qae="cmdk-item-select",Gae="data-value",Kae=(e,t,n)=>Lae(e,t,n),Wae=i.createContext(void 0),Yae=()=>i.useContext(Wae),Xae=i.createContext(void 0),Qae=()=>i.useContext(Xae),Zae=i.createContext(void 0),Jae=i.forwardRef(((e,t)=>{let n=fse((()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",filtered:{count:0,items:new Map,groups:new Set}}})),r=fse((()=>new Set)),o=fse((()=>new Map)),a=fse((()=>new Map)),s=fse((()=>new Set)),l=dse(e),{label:c,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=SJ(),x=SJ(),w=SJ(),_=i.useRef(null),S=vse();pse((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,E.emit()}}),[d]),pse((()=>{S(6,O)}),[]);let E=i.useMemo((()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,i,a;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)R(),A(),S(1,N);else if("value"===e&&(r||S(5,O),void 0!==(null==(o=l.current)?void 0:o.value))){return void(null==(a=(i=l.current).onValueChange)||a.call(i,null!=t?t:""))}E.emit()}},emit:()=>{s.current.forEach((e=>e()))}})),[]),T=i.useMemo((()=>({value:(e,t,r)=>{var o;t!==(null==(o=a.current.get(e))?void 0:o.value)&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),S(2,(()=>{A(),E.emit()})))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),S(3,(()=>{R(),A(),n.current.value||N(),E.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();S(4,(()=>{R(),(null==t?void 0:t.getAttribute("id"))===e&&N(),E.emit()}))}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{a.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:w,labelId:x,listInnerRef:_})),[]);function C(e,t){var r,o;let i=null!=(o=null==(r=l.current)?void 0:r.filter)?o:Kae;return e?i(e,n.current.search,t):0}function A(){if(!n.current.search||!1===l.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach((n=>{let r=o.current.get(n),i=0;r.forEach((t=>{let n=e.get(t);i=Math.max(n,i)})),t.push([n,i])}));let r=_.current;k().sort(((t,n)=>{var r,o;let i=t.getAttribute("id"),a=n.getAttribute("id");return(null!=(r=e.get(a))?r:0)-(null!=(o=e.get(i))?o:0)})).forEach((e=>{let t=e.closest(Bae);t?t.appendChild(e.parentElement===t?e:e.closest(`${Bae} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Bae} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{var t;let n=null==(t=_.current)?void 0:t.querySelector(`${Vae}[${Gae}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function N(){let e=k().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(Gae);E.setState("value",t||void 0)}function R(){var e,t,i,s;if(!n.current.search||!1===l.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let c=0;for(let o of r.current){let r=C(null!=(t=null==(e=a.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(i=a.current.get(o))?void 0:i.keywords)?s:[]);n.current.filtered.items.set(o,r),r>0&&c++}for(let[r,a]of o.current)for(let e of a)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(r);break}n.current.filtered.count=c}function O(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(Vae))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=_.current)?void 0:e.querySelector(`${zae}[aria-selected="true"]`)}function k(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(Hae))||[])}function M(e){let t=k()[e];t&&E.setState("value",t.getAttribute(Gae))}function L(e){var t;let n=P(),r=k(),o=r.findIndex((e=>e===n)),i=r[o+e];null!=(t=l.current)&&t.loop&&(i=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),i&&E.setState("value",i.getAttribute(Gae))}function D(e){let t,n=P(),r=null==n?void 0:n.closest(Vae);for(;r&&!t;)r=e>0?cse(r,Vae):use(r,Vae),t=null==r?void 0:r.querySelector(Hae);t?E.setState("value",t.getAttribute(Gae)):L(e)}let j=()=>M(k().length-1),I=e=>{e.preventDefault(),e.metaKey?j():e.altKey?D(1):L(1)},F=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?D(-1):L(-1)};return i.createElement(KZ.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=y.onKeyDown)||t.call(y,e),!e.defaultPrevented)switch(e.key){case"n":case"j":v&&e.ctrlKey&&I(e);break;case"ArrowDown":I(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),j();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=P();if(t){let e=new Event(qae);t.dispatchEvent(e)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:bse},c),yse(e,(e=>i.createElement(Xae.Provider,{value:E},i.createElement(Wae.Provider,{value:T},e)))))})),ese=i.forwardRef(((e,t)=>{var n,r;let o=SJ(),a=i.useRef(null),s=i.useContext(Zae),l=Yae(),c=dse(e),u=null!=(r=null==(n=c.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;pse((()=>{if(!u)return l.item(o,null==s?void 0:s.id)}),[u]);let d=gse(o,a,[e.value,e.children,a],e.keywords),p=Qae(),f=mse((e=>e.value&&e.value===d.current)),h=mse((e=>!(!u&&!1!==l.filter())||(!e.search||e.filtered.items.get(o)>0)));function m(){var e,t;g(),null==(t=(e=c.current).onSelect)||t.call(e,d.current)}function g(){p.setState("value",d.current,!0)}if(i.useEffect((()=>{let t=a.current;if(t&&!e.disabled)return t.addEventListener(qae,m),()=>t.removeEventListener(qae,m)}),[h,e.onSelect,e.disabled]),!h)return null;let{disabled:v,value:y,onSelect:b,forceMount:x,keywords:w,..._}=e;return i.createElement(KZ.div,{ref:hse([a,t]),..._,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)})),tse=i.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,s=SJ(),l=i.useRef(null),c=i.useRef(null),u=SJ(),d=Yae(),p=mse((e=>!(!o&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));pse((()=>d.group(s)),[]),gse(s,l,[e.value,e.heading,c]);let f=i.useMemo((()=>({id:s,forceMount:o})),[o]);return i.createElement(KZ.div,{ref:hse([l,t]),...a,"cmdk-group":"",role:"presentation",hidden:!p||void 0},n&&i.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),yse(e,(e=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},i.createElement(Zae.Provider,{value:f},e)))))})),nse=i.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=i.useRef(null),a=mse((e=>!e.search));return n||a?i.createElement(KZ.div,{ref:hse([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),rse=i.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=Qae(),s=mse((e=>e.search)),l=mse((e=>e.value)),c=Yae(),u=i.useMemo((()=>{var e;let t=null==(e=c.listInnerRef.current)?void 0:e.querySelector(`${zae}[${Gae}="${encodeURIComponent(l)}"]`);return null==t?void 0:t.getAttribute("id")}),[]);return i.useEffect((()=>{null!=e.value&&a.setState("search",e.value)}),[e.value]),i.createElement(KZ.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":u,id:c.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||a.setState("search",e.target.value),null==n||n(e.target.value)}})})),ose=i.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=i.useRef(null),s=i.useRef(null),l=Yae();return i.useEffect((()=>{if(s.current&&a.current){let e,t=s.current,n=a.current,r=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{n.style.setProperty("--cmdk-list-height",t.offsetHeight.toFixed(1)+"px")}))}));return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}}),[]),i.createElement(KZ.div,{ref:hse([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},yse(e,(e=>i.createElement("div",{ref:hse([s,l.listInnerRef]),"cmdk-list-sizer":""},e))))})),ise=i.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:s,...l}=e;return i.createElement(hB,{open:n,onOpenChange:r},i.createElement(mB,{container:s},i.createElement(gB,{"cmdk-overlay":"",className:o}),i.createElement(vB,{"aria-label":e.label,"cmdk-dialog":"",className:a},i.createElement(Jae,{ref:t,...l}))))})),ase=i.forwardRef(((e,t)=>mse((e=>0===e.filtered.count))?i.createElement(KZ.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),sse=i.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return i.createElement(KZ.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},yse(e,(e=>i.createElement("div",{"aria-hidden":!0},e))))})),lse=Object.assign(Jae,{List:ose,Item:ese,Input:rse,Group:tse,Separator:nse,Dialog:ise,Empty:ase,Loading:sse});function cse(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function use(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function dse(e){let t=i.useRef(e);return pse((()=>{t.current=e})),t}var pse="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function fse(e){let t=i.useRef();return void 0===t.current&&(t.current=e()),t}function hse(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function mse(e){let t=Qae(),n=()=>e(t.snapshot());return $ae.useSyncExternalStore(t.subscribe,n,n)}function gse(e,t,n,r=[]){let o=i.useRef(),a=Yae();return pse((()=>{var i;let s=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),l=r.map((e=>e.trim()));a.value(e,s,l),null==(i=t.current)||i.setAttribute(Gae,s),o.current=s})),o}var vse=()=>{let[e,t]=i.useState(),n=fse((()=>new Map));return pse((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function yse({asChild:e,children:t},n){return e&&i.isValidElement(t)?i.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},n(t.props.children)):n(t)}var bse={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const xse=i.forwardRef((({className:e,...n},r)=>t.jsx(lse,{ref:r,className:Qd("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})));xse.displayName=lse.displayName;const wse=i.forwardRef((({className:e,searchIcon:n,...r},o)=>t.jsxs("div",{className:"flex items-center border-b px-3",children:[n||t.jsx(Bu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),t.jsx(lse.Input,{ref:o,className:Qd("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),...r})]})));wse.displayName=lse.Input.displayName;const _se=i.forwardRef((({className:e,...n},r)=>t.jsx(lse.List,{ref:r,className:Qd("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n})));_se.displayName=lse.List.displayName;const Sse=i.forwardRef(((e,n)=>t.jsx(lse.Empty,{ref:n,className:"py-6 text-center text-sm",...e})));Sse.displayName=lse.Empty.displayName;const Ese=i.forwardRef((({className:e,...n},r)=>t.jsx(lse.Group,{ref:r,className:Qd("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),...n})));Ese.displayName=lse.Group.displayName;const Tse=i.forwardRef((({className:e,...n},r)=>t.jsx(lse.Separator,{ref:r,className:Qd("-mx-1 h-px bg-border",e),...n})));Tse.displayName=lse.Separator.displayName;const Cse=i.forwardRef((({className:e,...n},r)=>t.jsx(lse.Item,{ref:r,className:Qd("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),...n})));Cse.displayName=lse.Item.displayName;const Ase=({data:e,placeholder:n,searchPlaceholder:r,noResultsMessage:o,value:a,setValue:s})=>{const[l,c]=i.useState(!1);return t.jsxs(X6,{open:l,onOpenChange:c,modal:!0,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(gQ,{variant:"outline",role:"combobox","aria-expanded":l,className:"w-full max-w-[200px] justify-between bg-background",children:[a?e.find((e=>e.value===a))?.label:n,t.jsx(vu,{className:"opacity-50"})]})}),t.jsx(Z6,{className:"w-[200px] p-0",children:t.jsxs(xse,{children:[t.jsx(wse,{placeholder:r,className:"h-9"}),t.jsxs(_se,{children:[t.jsx(Sse,{children:o}),t.jsx(Ese,{children:e.map((e=>t.jsxs(Cse,{value:e.value,onSelect:e=>{s(e===a?"":e),c(!1)},children:[e.label,t.jsx(pu,{className:Qd("ml-auto",a===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},Nse=({setScheduleTime:e,setTimezone:n,timezone:r,scheduleTime:o,setIsDirty:a})=>{const[s,l]=i.useState(o&&o<(new Date).toISOString()?"Please select a time in the future":null),[c,u]=i.useState(o?r9(new Date(o),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),p=t=>{const n=g8(new Date,15);new Date(t.toLocaleString("en-US",{timeZone:r}))<new Date(n.toLocaleString("en-US",{timeZone:r}))?l("Please select a time at least 15 minutes in the future"):(l(null),e(t.toISOString()),a(!0))};return t.jsx("div",{className:"w-full @container/schedule-time",children:t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsxs("div",{className:"flex gap-2 w-full @xl/schedule-time:flex-row flex-col items-center justify-center",children:[t.jsxs(X6,{children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(gQ,{variant:"outline",className:Qd("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[t.jsx(du,{className:"mr-2 h-4 w-4"}),o?r9(new Date(o),"PPP"):t.jsx("span",{children:"Pick a date"})]})}),t.jsx(Z6,{className:"w-auto p-0 z-[60] pointer-events-auto",children:t.jsx(Cae,{mode:"single",selected:o?new Date(o):void 0,onSelect:e=>{if(!e)return;const[t,n]=c.split(":").map(Number);e.setHours(t,n),p(e)},disabled:e=>{const t=new Date;return t.setHours(0,0,0,0),e<t},initialFocus:!0})})]}),t.jsx("input",{type:"time",value:c,onChange:e=>{if(u(e.target.value),o&&e.target.value){const[t,n]=e.target.value.split(":").map(Number),r=new Date(o);r.setHours(t,n),p(r)}},className:Qd("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")}),t.jsx(Ase,{data:d,placeholder:"Select timezone...",searchPlaceholder:"Search timezone...",noResultsMessage:"No timezone found",value:r,setValue:e=>{const t=new Date(o||(new Date).toISOString()),r=g8(new Date,15);t<new Date(r.toLocaleString("en-US",{timeZone:e}))?l("Please select a time at least 15 minutes in the future"):(l(null),n(e),a(!0))}})]}),s&&t.jsxs("p",{className:"text-destructive text-sm mt-2 flex items-center",children:[t.jsx("span",{className:"mr-2",children:"⚠️"}),s]})]})})},Rse=({title:e="Edit Schedule Time",autoSave:r=!1})=>{const o=iQ(),{updateAutomation:i}=De(o?.id||""),{toast:a}=Ll(),[s,l]=n.useState(null),[c,u]=n.useState(o?.triggerMetadata?.triggerType===Fe.ONE_TIME?o?.triggerMetadata?.scheduledAt:null),[d,p]=n.useState(o?.triggerMetadata?.triggerType===Fe.ONE_TIME&&o?.triggerMetadata?.timezone||"America/New_York"),[f,h]=n.useState(!1),m=n.useCallback((()=>{if("sendNow"===s)i({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:new Date(Date.now()+3e5).toISOString()}}),a({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),h(!1);else{if(!c||!d)return;i({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:c,timezone:d}}),a({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),h(!1)}}),[s,c,d,i,a]);return n.useEffect((()=>{}),[o]),n.useEffect((()=>{r&&f&&(m(),h(!1))}),[r,f,m]),o?t.jsx(Cre,{title:e,headerActions:r?void 0:t.jsx(gQ,{onClick:m,disabled:!f,children:"Save"}),children:t.jsx("div",{className:"@container flex-1 mx-4",children:t.jsxs("div",{className:"flex @[1000px]:flex-row flex-col gap-8 items-center",children:[t.jsxs("div",{className:"flex-1 w-full",children:[t.jsxs("div",{className:"grid grid-cols-1 @[480px]:grid-cols-2 gap-4",children:[t.jsx(bQ,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(xQ.SendButton,{className:"text-primary"}),onClick:()=>{l("sendNow"),u(new Date(Date.now()+3e5).toISOString()),p("America/New_York"),h(!0)}}),t.jsx(bQ,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(xQ.ScheduleButton,{className:"text-primary"}),onClick:()=>l("schedule")})]}),t.jsx(zB,{children:"schedule"===s&&t.jsx(hQ,{className:"overflow-hidden mt-8",children:t.jsx("div",{className:"bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center",children:t.jsx(Nse,{setScheduleTime:u,setTimezone:p,timezone:d,scheduleTime:c,setIsDirty:h})})})})]}),c&&t.jsxs(AX.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:[t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:.3,duration:.4},className:"text-sm font-medium text-gray-700",children:"Currently scheduled for:"}),t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:d||void 0})})]})]})})}):null},Ose=()=>t.jsx("div",{children:t.jsx(Rse,{title:"Set Schedule Time",autoSave:!0})});var Pse=(e=>(e.DAYS="days",e))(Pse||{});const kse={[rQ.EQUALS]:"Equals",[rQ.NOT_EQUALS]:"Not Equals",[rQ.GREATER_THAN]:"Greater Than",[rQ.LESS_THAN]:"Less Than",[rQ.EXISTS]:"Exists",[rQ.EQUALS_MONTH_DAY]:"Month and Day Matches",[rQ.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[rQ.BETWEEN_MONTH_DAY]:"Between Month Day",[rQ.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[rQ.ARRAY_CONTAINS]:"List Contains"},Mse={email:"Email",phone:"Phone",firstName:"First Name",lastName:"Last Name"},Lse=({options:e,value:n,onChange:r,placeholder:o})=>{const[a,s]=i.useState(!1);return t.jsxs(X6,{modal:!0,open:a,onOpenChange:s,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(gQ,{"aria-expanded":a,className:"w-[200px] overflow-hidden justify-between",variant:"outline",children:[n?e.find((e=>e.value===n))?.label:o,t.jsx(vu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(Z6,{className:"w-[200px] p-0",children:t.jsxs(xse,{children:[t.jsx(wse,{placeholder:`${o}...`}),t.jsxs(_se,{children:[t.jsxs(Sse,{children:["No ",o.toLowerCase()," found."]}),t.jsx(Ese,{children:e.map((e=>t.jsxs(Cse,{value:e.value,onSelect:e=>{r(e===n?"":e),s(!1)},children:[t.jsx(pu,{className:Qd("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var Dse=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find(Fse);if(s){const e=s.props.children,r=a.map((t=>t===s?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(jse,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(jse,{...o,ref:n,children:r})}));Dse.displayName="Slot";var jse=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?YU(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));jse.displayName="SlotClone";var Ise=({children:e})=>t.jsx(t.Fragment,{children:e});function Fse(e){return i.isValidElement(e)&&e.type===Ise}var Use=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,n)=>{const r=i.forwardRef(((e,r)=>{const{asChild:o,...i}=e,a=o?Dse:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...i,ref:r})}));return r.displayName=`Primitive.${n}`,{...e,[n]:r}}),{}),$se="horizontal",Vse=["horizontal","vertical"],Bse=i.forwardRef(((e,n)=>{const{decorative:r,orientation:o=$se,...i}=e,a=function(e){return Vse.includes(e)}(o)?o:$se;return t.jsx(Use.div,{"data-orientation":a,...r?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...i,ref:n})}));Bse.displayName="Separator";var zse=Bse;const Hse=i.forwardRef((({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>t.jsx(zse,{ref:i,decorative:r,orientation:n,className:Qd("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",e),...o})));Hse.displayName=zse.displayName;const qse=ru("m-1 transition ease-in-out delay-150 duration-300",{variants:{variant:{default:"border-foreground/10 text-foreground bg-card hover:bg-card/80",secondary:"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",inverted:"inverted"}},defaultVariants:{variant:"default"}}),Gse=i.forwardRef((({options:e,onValueChange:n,variant:r,placeholder:o="Select options",animation:a=0,maxCount:s=3,modalPopover:l=!0,className:c,extraCommandItems:u,searchPlaceholder:d="Search...",handleSearchInput:p,emptyMessage:f="No results found.",searchIcon:h=t.jsx(Bu,{className:"h-4 w-4 mr-2"}),selectedValues:m,setSelectedValues:g,...v},y)=>{const[b,x]=i.useState(!1),[w,_]=i.useState(!1),S=e=>{const t=m.includes(e)?m.filter((t=>t!==e)):[...m,e];g(t),n(t)},E=()=>{g([]),n([])};return t.jsxs(X6,{open:b,onOpenChange:x,modal:l,children:[t.jsx(Q6,{asChild:!0,children:t.jsx("button",{type:"button",ref:y,...v,onClick:()=>{x((e=>!e))},className:Qd("flex w-full p-1 rounded-md border min-h-9 h-auto items-center justify-between bg-white hover:bg-gray-50 [&_svg]:pointer-events-auto data-[state=open]:bg-gray-50",c),children:t.jsxs("div",m.length>0?{className:"flex justify-between items-center w-full",children:[t.jsxs("div",{className:"flex flex-wrap items-center",children:[m.slice(0,s).map((n=>{const o=e.find((e=>e.value===n)),i=o?.icon;return t.jsxs(PQ,{className:Qd(w?"animate-bounce":"",qse({variant:r})),style:{animationDuration:`${a}s`},children:[i&&t.jsx(i,{className:"h-4 w-4 mr-2"}),o?.label,t.jsx(xu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),S(n)}})]},n)})),m.length>s&&t.jsxs(PQ,{className:Qd("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",w?"animate-bounce":"",qse({variant:r})),style:{animationDuration:`${a}s`},children:[`+ ${m.length-s} more`,t.jsx(xu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),(()=>{const e=m.slice(0,s);g(e),n(e)})()}})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(rd,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:e=>{e.stopPropagation(),E()}}),t.jsx(Hse,{orientation:"vertical",className:"flex min-h-6 h-full"}),t.jsx(fu,{className:"h-4 mx-2 cursor-pointer text-muted-foreground"})]})]}:{className:"flex items-center justify-between w-full mx-auto",children:[t.jsx("span",{className:"text-sm text-muted-foreground mx-3",children:o}),t.jsx(fu,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),t.jsx(Z6,{className:"w-auto p-0 z-[1000]",align:"start",onEscapeKeyDown:()=>x(!1),children:t.jsxs(xse,{children:[t.jsx(wse,{searchIcon:h,placeholder:d,onKeyDown:e=>{if("Enter"===e.key)x(!0),p&&(p(e.currentTarget.value),x(!1));else if("Backspace"===e.key&&!e.currentTarget.value){const e=[...m];e.pop(),g(e),n(e)}}}),t.jsxs(_se,{children:[t.jsx(Sse,{children:f}),t.jsxs(Ese,{children:[t.jsxs(Cse,{onSelect:()=>{if(m.length===e.length)E();else{const t=e.map((e=>e.value));g(t),n(t)}},className:"cursor-pointer",children:[t.jsx("div",{className:Qd("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",m.length===e.length?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(pu,{className:"h-4 w-4"})}),t.jsx("span",{children:"(Select All)"})]},"all"),e.map((e=>{const n=m.includes(e.value);return t.jsxs(Cse,{onSelect:()=>S(e.value),className:"cursor-pointer",children:[t.jsx("div",{className:Qd("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",n?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(pu,{className:"h-4 w-4"})}),e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:e.label})]},e.value)}))]}),t.jsx(Tse,{}),t.jsx(Ese,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[m.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Cse,{onSelect:E,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),t.jsx(Hse,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),t.jsx(Cse,{onSelect:()=>x(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"}),u&&u.map((e=>e(x)))]})})]})]})}),a>0&&m.length>0&&t.jsx(nd,{className:Qd("cursor-pointer my-2 text-foreground bg-background w-3 h-3",w?"":"text-muted-foreground"),onClick:()=>_(!w)})]})}));Gse.displayName="MultiSelect";var Kse="Switch",[Wse,Yse]=FZ(Kse),[Xse,Qse]=Wse(Kse),Zse=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,name:o,checked:a,defaultChecked:s,required:l,disabled:c,value:u="on",onCheckedChange:d,form:p,...f}=e,[h,m]=i.useState(null),g=XU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=VZ({prop:a,defaultProp:s,onChange:d});return t.jsxs(Xse,{scope:r,checked:b,disabled:c,children:[t.jsx(KZ.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":nle(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onClick:IZ(e.onClick,(e=>{x((e=>!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(tle,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})}));Zse.displayName=Kse;var Jse="SwitchThumb",ele=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=Qse(Jse,r);return t.jsx(KZ.span,{"data-state":nle(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})}));ele.displayName=Jse;var tle=e=>{const{control:n,checked:r,bubbles:o=!0,...a}=e,s=i.useRef(null),l=Ete(r),c=e1(n);return i.useEffect((()=>{const e=s.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==r&&n){const t=new Event("click",{bubbles:o});n.call(e,r),e.dispatchEvent(t)}}),[l,r,o]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function nle(e){return e?"checked":"unchecked"}var rle=Zse,ole=ele;const ile=i.forwardRef((({className:e,...n},r)=>t.jsx(rle,{className:Qd("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),...n,ref:r,children:t.jsx(ole,{className:Qd("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")})})));ile.displayName=rle.displayName;const ale=({onSelect:e,date:n,placeholder:r="Pick a date"})=>t.jsxs(X6,{modal:!0,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(gQ,{variant:"outline",className:Qd("w-[200px] justify-start text-left font-normal h-9",!n&&"text-muted-foreground"),children:[t.jsx(du,{className:"mr-2 h-4 w-4"}),n?r9(n,"PPP"):t.jsx("span",{children:r})]})}),t.jsx(Z6,{className:"w-auto p-0",align:"start",children:t.jsx(Cae,{mode:"single",selected:n,onSelect:e,initialFocus:!0})})]}),sle=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===Pse.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),lle=({fieldType:e,operator:n,value:r,onChange:o,options:a,toast:s,metadata:l})=>{const c=r.length>0&&"object"==typeof r[0]&&"type"in r[0]&&"relative"===r[0].type,u=r.length>0&&"object"==typeof r[0]&&"startDate"in r[0]&&"endDate"in r[0],[d,p]=i.useState((e===tQ.Date||e===tQ.DateTime)&&r.length>0&&r[0]instanceof Date?r[0]:void 0),[f,h]=i.useState(c),[m,g]=i.useState(c?r[0]:{type:"relative",value:0,unit:Pse.DAYS,direction:"before"}),[v,y]=i.useState(u?r[0]:void 0),[b,x]=i.useState(!1);if(i.useEffect((()=>{n!==rQ.EQUALS_MONTH_DAY&&n!==rQ.EQUALS_MONTH_DAY_YEAR&&f&&(h(!1),o(d?[d]:[]))}),[n,f,d,o]),i.useEffect((()=>{if(u&&v?.startDate){x("object"==typeof v.startDate&&"type"in v.startDate)}}),[u,v]),e===tQ.String||e===tQ.ReachResource||e===tQ.Array)return n===rQ.EXISTS?null:t.jsx(Gse,{maxCount:2,options:(a||[]).map((e=>({label:e.displayName,value:e.id}))),value:r.map((e=>{const t=(a||[]).find((t=>t.id===String(e)||t.displayName===String(e)||t.id===t.displayName&&t.id===String(e)));return t?.id||String(e)})),onValueChange:e=>{o(e)},selectedValues:r.map((e=>{const t=(a||[]).find((t=>t.id===String(e)||t.displayName===String(e)||t.id===t.displayName&&t.id===String(e)));return t?.id||String(e)})),setSelectedValues:e=>{o(e)},searchPlaceholder:"Enter new value",emptyMessage:"Press enter to add new value",handleSearchInput:e=>{if(e.length>0){const t=(e=>{const{value:t,type:n}=e;switch(n){case tQ.ReachResource:case tQ.Array:case tQ.String:return t.length>0;case tQ.Number:return!isNaN(Number(t));case tQ.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case tQ.Boolean:return"true"===t||"false"===t;case tQ.Date:case tQ.DateTime:return!isNaN(new Date(t).getTime());default:throw Xte(n,tQ)}})({value:e,type:l.type});t?o([...new Set([...r,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===tQ.Date||e===tQ.DateTime){const e=n===rQ.EQUALS_MONTH_DAY||n===rQ.EQUALS_MONTH_DAY_YEAR,r=n===rQ.BETWEEN_MONTH_DAY||n===rQ.BETWEEN_MONTH_DAY_YEAR,i=e=>{sle(e)?(g(e),f&&o([e])):s({title:"Invalid relative date",description:"Please enter a valid non-negative number of days.",variant:"destructive"})},a=e=>{const t=e.startDate??v?.startDate,n=e.endDate??v?.endDate,r=t&&"object"==typeof t&&"type"in t,i=n&&"object"==typeof n&&"type"in n;if(t&&n){if(r!==i)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(!r&&!i&&!(e=>!e.finalStartDate||!e.finalEndDate||e.finalStartDate<e.finalEndDate)({finalStartDate:t,finalEndDate:n}))return void s({title:"Invalid date range",description:"Start date must be before end date.",variant:"destructive"});if(r&&(!sle(t)||!sle(n)))return void s({title:"Invalid relative date",description:"Please enter valid relative dates.",variant:"destructive"})}y(e),t&&n&&o([{startDate:t,endDate:n}])},l=e=>{e&&(e=>e instanceof Date?!isNaN(e.getTime()):"object"==typeof e&&"type"in e&&"relative"===e.type&&sle(e))(e)?(p(e),o([e]),h(!1)):e||(p(void 0),o([]),h(!1))},c=e=>{h(e),o(e?[m]:d?[d]:[])};return t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"min-h-[36px] flex items-center",children:[(!f||!e)&&!r&&t.jsx(ale,{date:d,onSelect:l}),e&&f&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(H3,{type:"number",value:void 0===m.value?"":m.value,onChange:e=>{const t=""===e.target.value?void 0:parseInt(e.target.value,10);i({...m,value:t})},className:"w-20 h-9",min:"0","aria-label":"Relative days value"}),t.jsxs(lte,{value:m.direction,onValueChange:e=>{i({...m,direction:e})},children:[t.jsx(ute,{className:"w-[180px] h-9","aria-label":"Relative direction",children:t.jsx(cte,{placeholder:"Select direction..."})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"before",children:"days before today"}),t.jsx(hte,{value:"after",children:"days after today"})]})]})]}),r&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"flex flex-col space-y-2",children:[t.jsx("div",{className:"flex items-center space-x-2",children:b?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(H3,{type:"number",value:v?.startDate&&"object"==typeof v.startDate&&"type"in v.startDate?v.startDate.value:"",onChange:e=>{const t={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Pse.DAYS,direction:v?.startDate?.direction||"before"};sle(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),t.jsxs(lte,{value:v?.startDate&&"object"==typeof v.startDate&&"type"in v.startDate?v.startDate.direction:"before",onValueChange:e=>{const t={type:"relative",value:v?.startDate?.value,unit:Pse.DAYS,direction:e};sle(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},children:[t.jsx(ute,{className:"w-[180px] h-9",children:t.jsx(cte,{placeholder:"Select direction..."})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"before",children:"days before today"}),t.jsx(hte,{value:"after",children:"days after today"})]})]}),t.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"Start"})]}):t.jsx(ale,{placeholder:"Start date",date:v?.startDate instanceof Date||"string"==typeof v?.startDate?v.startDate instanceof Date?v.startDate:new Date(v.startDate):void 0,onSelect:e=>{const t=e;t&&(y({...v,startDate:t}),a({...v,startDate:t}))}})}),t.jsx("div",{className:"flex items-center space-x-2",children:b?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(H3,{type:"number",value:v?.endDate&&"object"==typeof v.endDate&&"type"in v.endDate?v.endDate.value:"",onChange:e=>{const t={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Pse.DAYS,direction:v?.endDate?.direction||"before"};sle(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),t.jsxs(lte,{value:v?.endDate&&"object"==typeof v.endDate&&"type"in v.endDate?v.endDate.direction:"before",onValueChange:e=>{const t={type:"relative",value:v?.endDate?.value,unit:Pse.DAYS,direction:e};sle(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},children:[t.jsx(ute,{className:"w-[180px] h-9",children:t.jsx(cte,{placeholder:"Select direction..."})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"before",children:"days before today"}),t.jsx(hte,{value:"after",children:"days after today"})]})]}),t.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"End"})]}):t.jsx(ale,{placeholder:"End date",date:v?.endDate instanceof Date||"string"==typeof v?.endDate?v.endDate instanceof Date?v.endDate:new Date(v.endDate):void 0,onSelect:e=>{const t=e;t&&(y({...v,endDate:t}),a({...v,endDate:t}))}})})]}),t.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[t.jsx(ile,{id:"between-relative-date-switch",checked:b,onCheckedChange:e=>{if(x(e),e){const e={type:"relative",value:0,unit:Pse.DAYS,direction:"before"},t={type:"relative",value:0,unit:Pse.DAYS,direction:"before"};y({startDate:e,endDate:t}),a({startDate:e,endDate:t})}else{const e=new Date,t=new Date(e);t.setDate(t.getDate()+1),y({startDate:e,endDate:t}),a({startDate:e,endDate:t})}},"aria-label":"Toggle relative date input for between dates"}),t.jsx(L9,{htmlFor:"between-relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})]}),e&&t.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[t.jsx(ile,{id:"relative-date-switch",checked:f,onCheckedChange:c,"aria-label":"Toggle relative date input"}),t.jsx(L9,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===tQ.Number||e===tQ.Integer)return n===rQ.EXISTS?null:t.jsx(H3,{type:"number",value:r.length>0?String(r[0]):"",onChange:e=>o([Number(e.target.value)]),className:"w-[200px]"});if(e===tQ.Boolean){if(n===rQ.EXISTS)return null;const e=r.length>0&&Boolean(r[0]);return t.jsx(ile,{checked:e,onCheckedChange:e=>o([e])})}return t.jsx(H3,{value:r.length>0?String(r[0]):"",onChange:e=>o([e.target.value]),className:"w-[200px]",disabled:!0})},cle=({condition:e,onUpdate:n,onDuplicate:r,onDelete:o,segmentsConditions:i})=>{const{toast:a}=Ll(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:tQ.String,options:void 0,itemType:void 0},l=s.operators,c=s.type,u=i.conditions.map((e=>e.field)).map((e=>({value:e,label:Mse[e]||e})));return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[t.jsx(Lse,{options:u,value:e.field,onChange:t=>{const r=t,o=i.conditions.find((e=>e.field===r));if(!o)return;const a=o.operators.map((e=>({value:e,label:kse[e]||e,fieldType:o.type}))),s=a[0]?.value;let l=[];switch(o.type){case tQ.Boolean:l=[!1];break;case tQ.Number:l=[0];break;case tQ.Date:case tQ.DateTime:l=[new Date];break;case tQ.String:l=o.options?.length?o.options.map((e=>e.displayName)):[];break;default:l=[]}n({...e,field:r,operator:s,value:l})},placeholder:"Select field"}),t.jsx(Lse,{options:l.map((e=>({value:e,label:kse[e]||e}))),value:e.operator,onChange:t=>n({...e,operator:t}),placeholder:"Select operator"}),t.jsx("div",{className:"max-w-2xl w-full overflow-hidden",children:t.jsx(lle,{fieldType:c,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((t=>t.id===e||t.displayName===e)))).map((e=>({displayName:e,id:e})))]:s.options?.map((e=>({displayName:e.displayName,id:e.id}))),value:e.value,onChange:t=>n({...e,value:t}),toast:a,metadata:{field:e.field,type:c,itemType:s.itemType}})})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsx(gQ,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(_u,{className:"h-4 w-4"})}),t.jsx(gQ,{size:"icon",variant:"ghost",onClick:o,children:t.jsx(Yu,{className:"h-4 w-4"})})]})]})},ule=({onSelectStyle:e})=>{const[r,o]=n.useState(null);return t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 max-w-4xl mx-auto",children:[t.jsx(bQ,{onClick:()=>{o("ai"),e("ai")},title:"Build with AI",subtitle:"Describe your audience in plain language and let AI create the conditions",icon:t.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:t.jsx(Ku,{className:"w-full h-full"})})}),selected:"ai"===r}),t.jsx(bQ,{onClick:()=>{o("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${ff("engage:segment")} by configuring conditions directly`,icon:t.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:t.jsx(Hu,{className:"w-full h-full"})})}),selected:"manual"===r})]})},dle=({segmentId:e,setOpen:n,setTextToSegment:r,promptBuilderStyle:o,textToSegment:i})=>t.jsx("div",{children:t.jsx(CB,{className:"",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(NB,{className:"text-3xl font-normal",children:e?`Edit ${ff("engage:segment")}`:`Create ${ff("engage:segment")}`}),t.jsxs("div",{className:"flex items-center gap-2",children:[!1===o&&!1===i&&t.jsx(h6,{children:t.jsxs(m6,{children:[t.jsx(g6,{asChild:!0,children:t.jsx(gQ,{variant:"outline",size:"sm",onClick:()=>r(!0),children:t.jsx(Ku,{className:"h-4 w-3"})})}),t.jsx(v6,{children:t.jsxs("p",{children:["Use AI to create ",ff("engage:segment")," by describing them in natural language"]})})]})}),t.jsx(gQ,{variant:"ghost",size:"icon",onClick:()=>{n(!1)},className:"h-8 w-8",children:t.jsx(rd,{className:"h-4 w-4"})})]})]})})}),ple=({setTextToSegment:e,setSegment:r})=>{const[o,i]=n.useState(""),[a,s]=n.useState(!1),{toast:c}=Ll();return t.jsxs("div",{className:"flex flex-col gap-6 p-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Describe your audience"}),t.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."})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(zB,{children:[a&&t.jsx(hQ,{children:t.jsx(fQ,{})}),!a&&t.jsx(hQ,{children:t.jsx(zte,{placeholder:"Describe your target audience...",className:"min-h-[120px] resize-none",value:o,onChange:e=>i(e.target.value)})})]}),t.jsx("div",{className:"flex justify-end gap-2",children:t.jsxs(gQ,{onClick:async()=>{if(!o)return void c({title:"Please enter a description",description:"Please enter a description of your target audience",variant:"destructive"});s(!0);const t=await(async e=>(await Re(`${l}/text-to-segment`,{method:"POST",body:JSON.stringify({text:e})})).data)(o);t.success&&t.conditions?(c({title:`${ff("engage:segment")} conditions built successfully 🚀`,description:`Your ${ff("engage:segment")} conditions have been built successfully`}),r(t.conditions)):c({title:`${ff("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[t.jsx(Ku,{className:"h-4 w-4"}),"Generate ",ff("engage:segment")]})})]})]})};function fle({segmentId:e,setOpen:n,onSegmentUpdated:r}){const{toast:o}=Ll(),a=void 0===e,[s,l]=i.useState(!1),[c,u]=i.useState({version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[]}),{segment:d,isLoading:p}=JX(e||""),{updateSegment:f}=eQ(e),{createSegment:h,isCreating:m,segmentsConditions:g}=XX(),[v,y]=i.useState(!1),[b,x]=i.useState(!!a);i.useEffect((()=>{g&&u(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:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})}),[d,g]);const w=e=>e.value.some((e=>"object"==typeof e&&"type"in e&&"relative"===e.type)),_=e=>e.value.some((e=>"object"==typeof e&&"startDate"in e&&"endDate"in e));if(!g||p)return t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(fQ,{})});return t.jsx(t.Fragment,{children:t.jsxs(zB,{mode:"wait",children:[t.jsx(dle,{segmentId:e,setOpen:n,setTextToSegment:y,promptBuilderStyle:b,textToSegment:v},"segment-builder-header"),b?t.jsx(hQ,{children:t.jsx(ule,{onSelectStyle:e=>{"ai"===e&&y(!0),x(!1)}})},"prompt-builder-style"):t.jsx(hQ,{children:t.jsxs("div",{className:"flex flex-1 flex-col",children:[t.jsx("div",{className:"flex flex-1 flex-col px-8 py-2",children:t.jsx("div",{className:"flex flex-1 flex-col gap-4 overflow-visible",children:t.jsx(zB,{children:v?t.jsx(hQ,{children:t.jsx(ple,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(hQ,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(L9,{className:"text-muted-foreground text-xs",children:"Name"}),t.jsx(H3,{placeholder:`${ff("engage:segment")} name`,value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(L9,{className:"text-muted-foreground text-xs",children:"Description"}),t.jsx(H3,{placeholder:`${ff("engage:segment")} description`,value:c.description,onChange:e=>u({...c,description:e.target.value})})]})]}),c.conditions.length>0&&t.jsx("div",{className:"flex-1 overflow-y-auto pb-8",children:t.jsx("div",{className:"grid",children:t.jsx(zB,{mode:"popLayout",children:c.conditions.map(((e,n)=>t.jsxs(AX.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:[n>0&&t.jsxs(AX.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[t.jsx(AX.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}}),t.jsx(AX.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),t.jsx(AX.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}})]}),t.jsx(cle,{condition:e,onUpdate:e=>((e,t)=>{const n=[...c.conditions];n[e]=t,u({...c,conditions:n})})(n,e),segmentsConditions:g,onDuplicate:()=>(e=>{const t=[...c.conditions];t.splice(e+1,0,{...c.conditions[e]}),u({...c,conditions:t})})(n),onDelete:()=>(e=>{const t=c.conditions.filter(((t,n)=>n!==e));u({...c,conditions:t})})(n)})]},`${e.field}-${e.operator}-${n}`)))})})})]})})})}),t.jsx("div",{className:"border-t px-8 py-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs(gQ,v?{variant:"secondary",onClick:()=>y(!1),children:[t.jsx(Hu,{className:"h-4 w-4"}),"Manual Builder"]}:{variant:"secondary",onClick:()=>{u({...c,conditions:[...c.conditions,{field:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})},children:[t.jsx(Vu,{className:"h-4 w-4"}),"Add Condition"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(gQ,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(gQ,{variant:"default",onClick:async()=>{if(!c.name||!c.description)return void o({title:"Name and description are required",description:"Please ensure all fields are filled out",variant:"destructive"});const{valid:t,error:i}=(e=>{for(const t of e){if(!t.field||!t.operator)return{valid:!1,error:"Please ensure all fields are filled out for condition"};if(t.operator!==rQ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===rQ.EXISTS&&t.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${t.field}`};if(w(t)&&t.operator!==rQ.EQUALS_MONTH_DAY&&t.operator!==rQ.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 ${t.field}`};if(w(t)&&void 0===t.value[0].value)return{valid:!1,error:`Please select a value for the relative date for ${t.field}`};if(_(t)&&t.operator!==rQ.BETWEEN_MONTH_DAY&&t.operator!==rQ.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 ${t.field}`};if(_(t)&&t.value.length>1)return{valid:!1,error:`Between dates can only have a single value for ${t.field}`};if(_(t)){const e=t.value[0];if(!e.startDate||!e.endDate)return{valid:!1,error:`Please ensure both a start and end date are selected for ${t.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 ${t.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 ${t.field}`};if(e.startDate.direction!==e.endDate.direction)return{valid:!1,error:`Start and end date must be of the same direction for ${t.field}`};const n=e=>{if(e.unit===Pse.DAYS)return e.value??0;throw DX(e.unit,Pse)};if("before"===e.startDate.direction&&n(e.startDate)>n(e.endDate))return{valid:!1,error:`Start date must be before end date for ${t.field}`};if("after"===e.startDate.direction&&n(e.startDate)<n(e.endDate))return{valid:!1,error:`Start date must be after end date for ${t.field}`}}}}return{valid:!0,error:void 0}})(c.conditions);if(!t)return void o({title:"Conditions are invalid",description:i??"Please ensure all fields are filled out",variant:"destructive"});const a=c.conditions.map((e=>{const t=g?.conditions.find((t=>t.field===e.field));return t?.type===tQ.Date&&(e.value=e.value.map((e=>e instanceof Date?e.toISOString().split("T")[0]:e))),e}));l(!0);try{e&&d?f({name:c.name,description:c.description,conditions:a},{onSuccess:()=>{o({title:`${ff("engage:segment")} updated successfully`}),n(!1),r?.(e)},onError:()=>{o({title:`Error updating ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}}):h({name:c.name,description:c.description,conditions:c.conditions},{onSuccess:e=>{o({title:`${ff("engage:segment")} created successfully`}),r?.(e?.id??!1),n(!1)},onError:()=>{o({title:`Error creating ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}})}catch(s){o({title:`Error saving ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}finally{l(!1)}},disabled:s||m,children:s||m?t.jsxs(t.Fragment,{children:[t.jsx(Nu,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})})}function hle({open:e,setOpen:n,segmentId:r,onSegmentUpdated:o}){return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-4xl w-full",hideCloseButton:!0,children:[t.jsxs(n$,{children:[t.jsxs(NB,{children:[ff("engage:segment")," Builder"]}),t.jsxs(RB,{children:["Build a ",ff("engage:segment")," to target your audience"]})]}),t.jsx(fle,{segmentId:r,setOpen:n,onSegmentUpdated:e=>{o?.(e),n(!1)}})]})})}const mle=({value:e,label:n,percentage:r,variant:o,isLoading:i,selected:a})=>t.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 "+(a?"scale-[1.02] [border-color:hsl(var(--reach-primary))] shadow-lg":""),style:{containerType:"inline-size"},"data-card-container":!0,children:[t.jsxs("div",{className:"flex flex-col gap-1 items-start w-full min-w-0",children:[t.jsx("div",{className:"flex items-baseline gap-2 w-full min-w-0 @container/num",children:i?t.jsx("span",{className:"animate-pulse",children:"..."}):t.jsxs(t.Fragment,{children:[t.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!==r&&e.toLocaleString().replace(/,/g,"").length<5&&t.jsxs("span",{className:"text-muted-foreground/50 text-sm hidden @[120px]/num:inline",children:["(",r,"%)"]})]})}),t.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"}[o]}`,children:n})]}),t.jsx("p",{className:"text-sm text-muted-fore hidden @[250px]/card:inline mt-1",children:1===e?"contact":"contacts"})]}),gle=({countResponse:e})=>{const r=n.useMemo((()=>e?.recipients?e.recipients.reduce(((t,n)=>({total:e.count,emails:t.emails+(n.email?1:0),phones:t.phones+(n.phone?1:0)})),{total:0,emails:0,phones:0}):{total:0,emails:0,phones:0}),[e]),o=e=>Math.round(e/(r.total||1)*100);return t.jsxs(t.Fragment,{children:[t.jsx(Tre,{children:"Estimated Matches"}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 md:mb-6 w-full gap-4 mt-3 px-1",children:[t.jsx(mle,{value:r.total,label:"Total",variant:"default",isLoading:void 0===e}),t.jsx(mle,{value:r.emails,label:"Email",percentage:o(r.emails),variant:"blue",isLoading:void 0===e}),t.jsx(mle,{value:r.phones,label:"Phone",percentage:o(r.phones),variant:"green",isLoading:void 0===e})]})]})},vle=({recipients:e})=>e?.length?t.jsx("div",{className:"bg-foreground/5 rounded-lg h-full relative overflow-hidden",children:t.jsx("div",{className:"absolute inset-0 w-full h-full overflow-y-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"sticky top-0 bg-foreground/5 backdrop-blur-sm",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Name"}),t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Contact"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-200/50",children:e.map(((e,n)=>t.jsxs("tr",{className:"hover:bg-white/50 transition-colors",children:[t.jsxs("td",{className:"px-3 sm:px-4 py-3 text-sm text-gray-900",children:[e.firstName," ",e.lastName]}),t.jsx("td",{className:"px-3 sm:px-4 py-3",children:t.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[e.email&&t.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&&t.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"})]})})]},n)))})]})})}):null,yle=({onSelectionChange:e,defaultValue:r="all"})=>{const[o,i]=n.useState(r),a=t=>{i(t),e?.(t)};return t.jsxs(t.Fragment,{children:[t.jsx(Tre,{children:"Filter"}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[t.jsx(bQ,{onClick:()=>a("all"),title:`All ${ff("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(xQ.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(bQ,{onClick:()=>a("segments"),title:`Select ${ff("engage:user",{count:2})}`,subtitle:`Choose from ${ff("engage:segment",{count:2})}`,icon:t.jsx(xQ.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===o})]})]})},ble=({segments:e,allSegments:r,onAddSegment:o,onRemoveSegment:i,setOpenCreateSegmentDialog:a})=>{const[s,l]=n.useState([]),c=r.map((e=>({label:e.name,value:e.id})));return n.useEffect((()=>{l(e)}),[e]),t.jsx("div",{children:t.jsx(Gse,{selectedValues:s,setSelectedValues:l,options:c,defaultValue:e,onValueChange:t=>{const n=t.filter((t=>!e.includes(t))),r=e.filter((e=>!t.includes(e)));n.forEach(o),r.forEach(i)},placeholder:"Select segments",maxCount:5,extraCommandItems:[e=>t.jsxs(Cse,{onSelect:()=>{e(!1),a(!0)},className:"cursor-pointer",children:[t.jsx(xQ.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},xle=({includedSegments:e,excludedSegments:r,handleAddSegment:o,handleRemoveSegment:i,setOpenCreateSegmentDialog:a,segments:s,defaultIsExcludeOpen:l=!1})=>{const[c,u]=n.useState(l);return t.jsxs("div",{children:[t.jsx(ble,{segments:e,allSegments:s||[],onAddSegment:e=>o(e,"include"),onRemoveSegment:e=>i(e,"include"),setOpenCreateSegmentDialog:a}),t.jsx("div",{className:"border-t border-gray-200 my-8"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(gQ,{onClick:()=>u(!c),className:"flex items-center gap-1 transition-colors",size:"sm",children:[t.jsx(AX.div,{animate:{rotate:c?180:0},transition:{duration:.2},children:t.jsx(xQ.DropdownMenuTrigger,{className:"w-5 h-5"})}),t.jsx("span",{children:"Don't send to"})]}),t.jsx(zB,{children:c&&t.jsx(AX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:t.jsx(ble,{segments:r,allSegments:s||[],onAddSegment:e=>o(e,"exclude"),onRemoveSegment:e=>i(e,"exclude"),setOpenCreateSegmentDialog:a})})})]})]})},wle=({title:e="Preview Audience"})=>{const r=iQ(),[o,i]=n.useState("all"),[a,s]=n.useState(r?.includeSegmentIds||[]),[l,c]=n.useState(r?.excludeSegmentIds||[]),[u,d]=n.useState(!1),[p,f]=n.useState(!1),{segments:h,isLoading:m}=QX(),{updateAutomation:g}=De(r?.id??""),[v,y]=n.useState(void 0),b=1===a.length&&0===l.length&&void 0!==h?.find((e=>e.type===nQ.ALL_USERS&&e.id===a[0]));n.useEffect((()=>{r&&!p&&(i(b||a.length>0&&0===l.length?"all":"segments"),WX({includeSegments:a,excludeSegments:l}).then((e=>{y(e)})),f(!0))}),[r,b,p,a,l]);return n.useEffect((()=>{r&&p&&(JSON.stringify(a)===JSON.stringify(r.includeSegmentIds)&&JSON.stringify(l)===JSON.stringify(r.excludeSegmentIds)||(g({includeSegments:a,excludeSegments:l}),WX({includeSegments:a,excludeSegments:l}).then((e=>{y(e)}))))}),[a,l,r,p,g]),t.jsxs(Cre,{title:e,children:[!m&&h&&p?t.jsxs("div",{className:"flex gap-8 w-full pb-4 px-4",children:[t.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:[t.jsx(gle,{countResponse:v}),t.jsx(yle,{onSelectionChange:e=>{if(i(e),"all"===e){const e=h?.find((e=>e.type===nQ.ALL_USERS));if(!e)return;s([e.id]),c([])}},defaultValue:o}),t.jsx(zB,{children:"segments"===o&&t.jsx(AX.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:t.jsx(xle,{includedSegments:a,excludedSegments:l,handleAddSegment:(e,t)=>{"include"===t?s((t=>[...t,e])):c((t=>[...t,e]))},handleRemoveSegment:(e,t)=>{"include"===t?s((t=>t.filter((t=>t!==e)))):c((t=>t.filter((t=>t!==e))))},setOpenCreateSegmentDialog:d,segments:h,defaultIsExcludeOpen:l.length>0})})})]}),t.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:v?.recipients&&t.jsx(vle,{recipients:v.recipients})})]}):t.jsx("div",{children:t.jsx(fQ,{text:["Fetching segments","Finishing up"]})}),t.jsx(hle,{open:u,setOpen:d})]})},_le=()=>t.jsx(wle,{title:"Select Audience"});var Sle=(e=>(e[e.SelectAudience=1]="SelectAudience",e[e.SelectCommunication=2]="SelectCommunication",e[e.Schedule=3]="Schedule",e[e.PreviewAndSend=4]="PreviewAndSend",e))(Sle||{});const Ele=()=>{const e=iQ(),t=aQ(),r=n.useCallback((async n=>e?await(async e=>{const{currentStep:t,automation:n,communicationGroup:r}=e;switch(t){case Sle.SelectAudience:return{canMove:n.includeSegmentIds.length>0,errorMessage:"Please ensure you have selected at least one segment"};case Sle.SelectCommunication:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));return e&&r&&(r.smsChannelSenderId||r.emailChannelSenderId)?!r.emailChannelSenderId||r.emailHtmlBody&&r.emailSubject?r.smsChannelSenderId&&!r.smsMessageBody?{canMove:!1,errorMessage:"Please ensure you have a sms message body"}:{canMove:!0,errorMessage:null}:{canMove:!1,errorMessage:"Please ensure you have a email body and subject"}:{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"}}case Sle.Schedule:{if(!n.triggerMetadata)return{canMove:!1,errorMessage:"Please make sure to select a time to send before starting!"};if(n.triggerMetadata.triggerType!==Fe.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 ${ff("engage:one_time")}`};if(!Boolean(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 ${ff("engage:one_time")}`};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&&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 ${ff("engage:one_time")} automation`}}case Sle.PreviewAndSend:return{canMove:!0,errorMessage:null};default:Xte(t,Sle)}})({currentStep:n,automation:e,communicationGroup:t}):{canMove:!1,errorMessage:`${ff("engage:one_time")} not loaded`}),[e,t]);return{validateStep:r}},Tle=({onFinish:e,getExtraMergeFields:r,onBeforeSchedule:o})=>{const i=iQ(),a=aQ(),{updateAutomation:s}=De(i?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:t}=ZX({includeSegments:e?.includeSegmentIds??[],excludeSegments:e?.excludeSegmentIds??[]}),r=n.useMemo((()=>t?.recipients?t.recipients.reduce(((e,t)=>({emails:e.emails+(t.email?1:0),phones:e.phones+(t.phone?1:0)})),{emails:0,phones:0}):{emails:0,phones:0}),[t?.recipients]);return{estimatedMatches:t,estimatedMatchesStats:r}})(i??void 0),{validateStep:c}=Ele(),[u,d]=n.useState(!1),[p,f]=n.useState(Sle.SelectAudience);if(!i||!p||!a)return t.jsx("div",{className:"flex-1 flex flex-col @container justify-center items-center h-[500px]",children:t.jsx(fQ,{text:[`Fetching ${ff("engage:one_time")} data`,"Finishing up"]})});const h=(({automation:e,communicationGroup:n,getExtraMergeFields:r})=>e?[{id:"audience",title:"Audience",step:1,isValid:()=>e.includeSegmentIds.length>0,content:t.jsx(Wte,{content:t.jsx(_le,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Fe.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},{id:"content",title:"Content",step:2,isValid:()=>{const t=e.actionData?.find((e=>"send_communication"===e.actionType));return!(!t||!t.actionMetadata.communicationGroupId||!n||!n.smsChannelSenderId&&!n.emailChannelSenderId||!(!n.emailChannelSenderId||n.emailHtmlBody&&n.emailSubject)||n.smsChannelSenderId&&!n.smsMessageBody)},content:t.jsxs("div",{className:"flex flex-col gap-4 w-full p-6 rounded-xl bg-gray-100 flex-1 h-full",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:"Edit Content"}),t.jsx(Kte,{getExtraMergeFields:r})]},"content"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"schedule",title:"Schedule",step:3,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Fe.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(Wte,{className:"flex-1",content:t.jsx(Ose,{})},"schedule"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"send",title:"Send",step:4,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Fe.ONE_TIME&&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:t.jsx(Wte,{className:"flex-1",content:t.jsx(Nre,{})},"send"),footerConfig:{backText:"Back",nextText:"Schedule",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[])({automation:i,communicationGroup:a,getExtraMergeFields:r}),m=async()=>{const{canMove:t,errorMessage:n}=await c(p);t?p===Sle.PreviewAndSend?await(async()=>{if(o)try{const t=await o({estimatedEmailRecipients:l?.emails||0,estimatedSmsRecipients:l?.phones||0});!0===t?(s({status:Ve.ACTIVE}),Ml({title:`${ff("engage:one_time")} scheduled!`}),e()):Ml({title:"Oops!",description:t,variant:"destructive"})}catch(t){Ml({title:"Oops!",description:"An error occurred while checking scheduling conditions",variant:"destructive"})}else s({status:Ve.ACTIVE}),Ml({title:`${ff("engage:one_time")} scheduled!`}),e()})():f(p+1):Ml({title:"Oops!",description:n,variant:"destructive"})},g=()=>{p>Sle.SelectAudience&&f(p-1)},v=()=>{e()};return t.jsxs("div",{className:"flex-1 flex flex-col @container h-full min-h-0",children:[t.jsxs("header",{className:"w-full flex items-center gap-4 h-16 px-6",children:[t.jsx("h1",{className:"text-xl font-bold leading-none",children:i.name}),t.jsx("div",{className:"flex items-center gap-4",children:t.jsx(PQ,{variant:l9(i.status),children:J6[i.status]})})]}),t.jsxs("main",{className:"flex gap-4 flex-1 min-h-0",children:[t.jsx("div",{className:"hidden @[1000px]:block",children:t.jsx("nav",{className:"space-y-0 w-50 self-start pr-6 pl-8 pt-4 ",children:h.map((e=>t.jsx("div",{className:`\n rounded-md transition-colors\n ${e.step===p?"bg-[var(--reach-secondary)] text-[var(--reach-primary-foreground)] font-medium":e.step<p?"text-muted-foreground hover:bg-muted":"text-muted-foreground/60"}\n `,children:t.jsx(VQ,{label:e.title,isActive:e.step===p,isCompleted:e.isValid(),onClick:async()=>{if(!u)if(e.step>p){const{canMove:t,errorMessage:n}=await(async e=>{if(e<=p)return{canMove:!0,errorMessage:null};d(!0);try{for(let t=p;t<e;t++){const{canMove:e,errorMessage:n}=await c(t);if(!e)return{canMove:e,errorMessage:n}}return{canMove:!0,errorMessage:null}}finally{d(!1)}})(e.step);t?f(e.step):n&&Ml({title:"Cannot navigate to this step",description:n,variant:"destructive"})}else f(e.step)}})},e.step)))})}),t.jsx("section",{className:"flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0",children:t.jsx("div",{className:" overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex",children:t.jsx(zB,{children:t.jsx(hQ,{className:"pt-0 h-full",children:h.find((e=>e.step===p))?.content},p)})})})]}),t.jsx("footer",{className:"w-full flex justify-end shadow-md z-10 items-center h-16 px-6",children:t.jsx(v9,{handleSkipAndSaveAsDraft:v,handleBack:g,handleNext:m,hideBack:h.find((e=>e.step===p))?.footerConfig.hideBack??!1,backText:h.find((e=>e.step===p))?.footerConfig.backText??"Back",nextText:h.find((e=>e.step===p))?.footerConfig.nextText??"Next",backDisabled:h.find((e=>e.step===p))?.footerConfig.backDisabled??!1,nextDisabled:h.find((e=>e.step===p))?.footerConfig.nextDisabled()??!1})})]})},Cle=()=>t.jsxs("div",{children:[t.jsx("div",{className:EQ,children:t.jsx(xQ.OneTimeBroadcast,{})}),t.jsxs("h3",{className:TQ,children:[ff("engage:one_time")," Broadcast"]}),t.jsx("p",{className:CQ,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),Ale=()=>t.jsxs("div",{children:[t.jsx("div",{className:AQ,children:"Coming Soon"}),t.jsx("div",{className:EQ,children:t.jsx(xQ.RealtimeActivity,{})}),t.jsx("h3",{className:TQ,children:"Realtime Activity"}),t.jsx("p",{className:CQ,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),Nle=({selectedType:e,setAutomationName:n,automationName:r,setAutomationDescription:o,automationDescription:i})=>t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 max-w-lg mx-auto",children:[t.jsxs("h2",{className:"text-2xl font-semibold mb-8 text-center",children:["Name Your"," ",ff(e===Fe.ONE_TIME?"engage:one_time":"engage:trigger_based")]}),t.jsxs("div",{className:"w-full space-y-6",children:[t.jsx("div",{className:"bg-gray-50 p-6 rounded-xl items-center justify-center text-center",children:(()=>{switch(e){case Fe.ONE_TIME:return t.jsx(Cle,{});case Fe.TRIGGER_BASED:return t.jsx(Ale,{});default:throw Xte(e,Fe)}})()}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationName",className:"block text-sm font-medium text-gray-900",children:"Name"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Only visible to your team"})]}),t.jsx(H3,{id:"automationName",type:"text",value:r,onChange:e=>n(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})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationDescription",className:"block text-sm font-medium text-gray-900",children:"Description"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Optional"})]}),t.jsx(zte,{id:"automationDescription",value:i,onChange:e=>o(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 ${ff("engage:one_time").toLowerCase()}`})]})]})]})]}),Rle=({onClose:e,automationType:r,currentStep:o,setCurrentStep:i,getExtraMergeFields:a,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:c}=Le(),[u,p]=n.useState(!1),[f,h]=n.useState(void 0),[m,g]=n.useState(!1),[v,y]=n.useState(r?{name:void 0,description:void 0,type:r}:{name:void 0,description:void 0,type:void 0}),b=void 0!==v.name&&void 0!==v.type&&""!==v.name;n.useEffect((()=>{if(v.type&&!v.name&&!m){const e=new Date,t=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=e.toLocaleDateString([],{month:"long",day:"numeric"}),r=`${ff("engage:one_time")} ${n} ${t}`,o="";y((e=>({...e,name:r,description:o}))),g(!0)}}),[v,m]);if(c||u)return t.jsx("div",{className:SQ,children:t.jsx(fQ,{text:[`Creating ${ff("engage:one_time")}`,"Finishing up"]})});return t.jsxs("div",{className:wB("relative overflow-y-auto h-full p-8",o===vQ.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[t.jsx(zB,{mode:"wait",children:t.jsx(hQ,{className:"h-full",children:(()=>{switch(o){case vQ.ChooseAutomationType:return t.jsx(NQ,{onNext:e=>{y({...v,type:e}),i(vQ.SetAutomationName)}});case vQ.SetAutomationName:return v.type?t.jsx(Nle,{selectedType:v.type,setAutomationName:e=>{y({...v,name:e})},automationName:v.name??"",setAutomationDescription:e=>{y({...v,description:e})},automationDescription:v.description??""}):null;case vQ.OneTimeWizard:return f?t.jsx(lQ,{automationId:f,children:t.jsx(Tle,{onFinish:()=>{e?.(f)},getExtraMergeFields:a,onBeforeSchedule:s})}):null;default:throw DX(o,vQ)}})()},o)}),o!==vQ.OneTimeWizard&&t.jsx("div",{className:"pt-2",children:t.jsx(yQ,{onClose:e,currentStep:o,setCurrentStep:i,isDisabled:!b,createAutomation:async()=>{if(!b||!v.name||!v.type)return;p(!0);l({name:v.name,type:v.type,description:v.description},{onSuccess:async t=>{if(t.id){const n=await(async e=>(await Re(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),o=LX().toString();await Pe(t.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:o}}]}),h(t.id),await pQ({automationId:t.id,actionId:o}),r===Fe.ONE_TIME?(i(vQ.OneTimeWizard),p(!1)):e?.(t.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{y({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==r})})]})};function Ole({open:e,setOpen:r,onClose:o,automationType:i,getExtraMergeFields:a}){const[s,l]=n.useState(i?vQ.SetAutomationName:vQ.ChooseAutomationType);return n.useEffect((()=>{e&&l(i?vQ.SetAutomationName:vQ.ChooseAutomationType)}),[e,i]),t.jsx(_B,{open:e,onOpenChange:r,children:t.jsxs(TB,{hideCloseButton:s===vQ.OneTimeWizard,className:`flex max-h-[86vh] ${s===vQ.OneTimeWizard?"max-w-[90vw]":"max-w-4xl"} flex-col gap-0 overflow-visible p-0`,children:[t.jsx(CB,{children:t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs(n$,{children:[t.jsx(NB,{className:"text-3xl font-normal",children:"Create Automation"}),t.jsx(RB,{children:"Create a new automation to send messages to your customers."})]})})}),t.jsx(Rle,{onClose:e=>{o?.(e),r(!1)},automationType:i,currentStep:s,setCurrentStep:l,getExtraMergeFields:a})]})})}const Ple=({tabs:e,activeTab:r,onTabChange:o,tabsLocation:i="left",secondaryTabs:a=!1})=>{const s=n.useRef([]),[l,c]=n.useState({width:0,left:0});n.useEffect((()=>{const t=s.current[e.findIndex((e=>e.id===r))];t&&c({width:t.offsetWidth,left:t.offsetLeft})}),[r,e]);const u=e.find((e=>e.id===r));return t.jsxs("div",{className:"flex flex-col gap-4 w-full overflow-x-hidden h-full",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{className:"relative flex items-center gap-8 "+("left"===i?"w-full justify-start":"w-full justify-center"),children:[t.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,n)=>t.jsx("button",{ref:e=>s.current[n]=e,onClick:()=>o(e.id),className:wB("relative px-7 py-3 transition-all duration-200 text-lg",r!==e.id&&"text-muted-foreground",a&&"text-sm"),children:e.label},e.id)))]})}),t.jsx("div",{className:"relative overflow-hidden flex-grow min-h-0",children:t.jsx("div",{className:"relative h-full",children:u?u.content:null})})]})},kle=e=>{if(!e)return"$0.00";const t="string"==typeof e?e.replace(/,/g,""):e,n=Number(t);return Number.isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(n)},Mle="reach-styles-module__header___-izE2",Lle="reach-styles-module__title___n1hA9",Dle="reach-styles-module__description___EvXM-",jle="reach-styles-module__content___okv68",Ile="reach-styles-module__footer___YA4U4",Fle=ru("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"}}),Ule=i.forwardRef((({className:e,variant:n,...r},o)=>t.jsx("div",{ref:o,className:Qd(Fle({variant:n}),e),...r})));Ule.displayName="Card";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(Mle,e),...n}))).displayName="CardHeader";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(Lle,e),...n}))).displayName="CardTitle";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(Dle,e),...n}))).displayName="CardDescription";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(jle,e),...n}))).displayName="CardContent";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(Ile,e),...n}))).displayName="CardFooter";const $le=({Icon:e,title:n,value:r,tooltipText:o,change:i})=>t.jsxs(Ule,{className:"relative flex flex-col justify-between min-h-[130px] transition-all duration-300 hover:shadow-md p-4",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsx("div",{className:"rounded-lg p-2 bg-primary/10 flex items-center justify-center",children:t.jsx(e,{className:"w-5 h-5 text-primary"})}),t.jsx("div",{className:"absolute top-3 right-3",children:t.jsx(E9,{title:o})})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx("div",{className:"text-2xl font-bold leading-tight text-primary",children:r}),t.jsx(Tre,{children:n})]}),i&&t.jsx("div",{className:"absolute bottom-3 right-3",children:t.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:i})})]}),Vle=({activeTab:e,automation:n})=>{if(!n)return null;const r={sales:[{Icon:xQ.SalesAmount,title:"Order Amount",value:kle(n.derivedRevenue),tooltipText:"Total derived revenue from this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx($le,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Ble=({activeTab:e,statistics:n})=>{const r={email:[{Icon:xQ.MessagesSent,title:"Emails Sent",value:n.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:xQ.OpenRate,title:"Open Rate",value:`${(100*n.email.openPercentage).toFixed(2)}%`,tooltipText:"Percentage of recipients who opened the email out of total emails delivered"},{Icon:xQ.TotalBounceRate,title:"Total Bounce Rate",value:`${(100*(n.email.softBounceRate+n.email.hardBounceRate)).toFixed(2)}%`,tooltipText:"Percentage of emails that were not delivered due to permanent (hard) or temporary (soft) delivery failures"},{Icon:xQ.LinksClicked,title:"Links Clicked",value:n.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:xQ.SpamComplies,title:"Spam Complaints",value:`${(100*n.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:xQ.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*n.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:xQ.MessagesSent,title:"SMS Sent",value:n.sms.numberSent,tooltipText:"Total number of SMS messages that were successfully sent in this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx($le,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},zle=({automationId:e,includeSales:r=!1,automation:o})=>{const[i,a]=n.useState("email"),{statistics:s,isLoading:l}=je(e);if(l||!s)return t.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:t.jsx(fQ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]})});const c=[{id:"email",label:`Email ${ff("engage:insight",{count:2})}`,content:t.jsx(Ble,{activeTab:"email",statistics:s})},{id:"sms",label:`SMS ${ff("engage:insight",{count:2})}`,content:t.jsx(Ble,{activeTab:"sms",statistics:s})},...r?[{id:"sales",label:`Sales ${ff("engage:insight",{count:2})}`,content:t.jsx(Vle,{activeTab:"sales",automation:o})}]:[]];return t.jsx(Ple,{tabs:c,activeTab:i,onTabChange:e=>a(e),tabsLocation:"left"})},Hle={all:["website"],content:()=>[...Hle.all,"content"],analyze:()=>[...Hle.all,"analyze"],brandSettings:()=>[...Hle.all,"brand-settings"]},qle=async()=>(await Re("/web-presence/brand-settings",{method:"POST"})).data,Gle=({isLoading:e,brandSettings:r,onComplete:o})=>{const[i,a]=n.useState(0),[s,l]=n.useState(!1),c=["Analyzing your brand palette","Extracting your visual identity","Discovering your brand personality","Crafting your email style","Finalizing your brand profile"],u=r?.primaryColor||"#4285F4",d=(()=>{const e=e=>e.startsWith("#")?`${e}80`:e;return r?.secondaryColors?.length&&r.secondaryColors.length>0?{start:e(r.primaryColor||"#4285F4"),middle:e(r.secondaryColors[0]||"#FBBC05"),end:e(r.secondaryColors[1]||"#34A853")}:{start:"#F5F5F580",middle:e(u),end:"#C2E7FF80"}})();n.useEffect((()=>{if(!e)return;const t=setInterval((()=>{a((e=>{const n=e+1;return n>=c.length?(clearInterval(t),setTimeout((()=>{l(!0),setTimeout(o,1e3)}),1500),e):n}))}),2500);return()=>clearInterval(t)}),[e,o,c.length]);return s?t.jsx(AX.div,{className:"flex flex-col items-center justify-center h-full w-full",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},children:t.jsxs(AX.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.8,ease:"easeOut"},className:"text-center",children:[t.jsx("h2",{className:"text-2xl font-bold mb-4",style:{color:u},children:"Analysis Complete!"}),t.jsx("p",{className:"text-gray-700",children:"Your brand profile has been successfully created"})]})}):t.jsxs(AX.div,{className:"flex flex-col items-center justify-center h-full w-full relative",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:8,repeat:1/0,repeatType:"reverse"},style:{backgroundImage:`linear-gradient(135deg, ${d.start} 0%, ${d.middle} 50%, ${d.end} 100%)`,backgroundSize:"200% 200%"},children:[t.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-15 backdrop-blur-[2px]"}),t.jsxs("div",{className:"flex flex-col items-center gap-10 p-6 relative z-10",children:[t.jsx(AX.div,r?.logoUrl?{className:"w-32 h-32 sm:w-40 sm:h-40 flex items-center justify-center rounded-lg overflow-hidden bg-white shadow-lg",initial:{scale:.9,rotate:0},animate:{scale:1.05,rotate:0},transition:{scale:{duration:3,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:t.jsx("img",{src:r.logoUrl,alt:"Brand Logo",className:"max-w-full max-h-full object-contain"})}:{className:"w-32 h-32 sm:w-40 sm:h-40 rounded-full flex items-center justify-center",style:{backgroundColor:u},initial:{scale:.9,rotate:0},animate:{scale:[1,1.1,1],rotate:0},transition:{scale:{duration:3,repeat:1/0,ease:"easeInOut"}},children:r?.brandName?t.jsx("span",{className:"text-6xl font-bold text-primary",children:r.brandName.charAt(0)}):t.jsx(Ku,{className:"w-16 h-16 text-primary"})}),t.jsx(AX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"text-xl text-primary font-medium text-center max-w-md drop-shadow-lg",children:c[i]},i),t.jsx("div",{className:"flex space-x-2 mt-4",children:c.map(((e,n)=>t.jsx(AX.div,{className:"h-2 w-2 rounded-full bg-muted-foreground",initial:{opacity:.3},animate:{opacity:n<=i?1:.3,scale:n===i?1.5:1},transition:{duration:.3}},n)))}),r?.brandName&&t.jsxs(AX.div,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:1,duration:1},className:"mt-6 text-primary text-opacity-90 font-medium",children:[r.brandName,r.brandTagline&&t.jsx("span",{className:"block text-sm mt-1 opacity-80",children:r.brandTagline})]})]})]})},Kle=({setAutoParse:e,onBrandSettingsGenerated:r,onForceRefresh:o})=>{const{data:i,updateWebsite:a,isUpdatingWebsite:s,updateBrandSettings:l}=Bte(),c=ye({mutationFn:qle,mutationKey:Hle.brandSettings()}),[u,d]=n.useState(i?.website||""),[p,f]=n.useState(!1),[h,m]=n.useState(null),[g,v]=n.useState(!1),[y,b]=n.useState(!1),x=()=>{e(!1)};return y&&h?t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(Yle,{initialBrandSettings:h,onSave:()=>{h&&(l({logoBase64:h.logo_base64,primaryColor:h.primaryColor,secondaryColors:h.secondaryColors,brandTagline:h.brandTagline,brandName:h.brandName,brandPersonality:h.brandPersonality,colorPalette:h.colorPalette}),o&&o(),Ml({title:"Brand settings saved successfully 🚀",description:"Your brand identity has been updated."}),e(!1))},onBack:x,showAutoParseButton:!1})},"results"):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[t.jsx("div",{className:"relative",children:t.jsxs("div",{className:"pb-6",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:y&&h?h.brandName||"Brand Analysis":"Website Analysis"}),t.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:y?h?.brandTagline||"Automatically generated from your website":"Customize your email branding with our AI analysis"})]})}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.jsxs(zB,{mode:"wait",children:[!g&&!y&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col h-full",children:t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-start px-6 space-y-8",children:[t.jsxs("div",{className:"space-y-2 w-full max-w-md",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block text-center",children:"Your Website URL"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-center",children:[t.jsx(H3,{type:"url",value:u,onChange:e=>d(e.target.value),placeholder:"https://example.com",className:"flex-1",disabled:!p}),t.jsx(zB,{mode:"wait",children:p?t.jsxs(AX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex gap-2",children:[t.jsx(gQ,{variant:"outline",size:"sm",onClick:()=>{f(!1),d(i?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),t.jsx(gQ,{size:"sm",onClick:async()=>{try{a(u),f(!1),Ml({title:"Website URL updated successfully 🎉",description:"Your website URL has been saved."})}catch(e){Ml({title:"Error updating website URL",description:"Please try again.",variant:"destructive"})}},disabled:s||!u,className:"w-full sm:w-auto",children:s?t.jsx(fQ,{}):"Save Changes"})]},"save"):t.jsx(AX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:t.jsx(gQ,{variant:"outline",size:"sm",onClick:()=>f(!0),className:"w-full sm:w-auto",children:"Edit URL"})},"edit")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl",children:[t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"What we'll analyze"}),t.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[t.jsx("li",{children:"• Your brand colors and color palette"}),t.jsx("li",{children:"• Your logo (if detectable)"}),t.jsx("li",{children:"• Your brand name and tagline"}),t.jsx("li",{children:"• Your brand's tone and personality"})]})]}),t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"How it helps you"}),t.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."})]})]}),t.jsx(AX.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"),g&&h&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(Gle,{isLoading:g,brandSettings:h,onComplete:()=>{v(!1),b(!0),Ml({title:"Brand settings generated successfully!",description:"Your brand identity has been analyzed."})}})},"analyzing"),g&&!h&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 flex flex-col items-center justify-center h-full",style:{background:"linear-gradient(135deg, #F5F5F5 0%, #E1E6FC 50%, #C2E7FF 100%)",backgroundSize:"200% 200%"},children:t.jsxs(AX.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:[t.jsxs(AX.div,{className:"relative w-24 h-24 flex items-center justify-center",initial:{scale:.9},animate:{scale:[1,1.1,1],rotate:[0,5,0,-5,0]},transition:{scale:{duration:3,repeat:1/0,repeatType:"reverse"},rotate:{duration:5,repeat:1/0,repeatType:"reverse"}},children:[t.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/10 animate-pulse"}),t.jsx(Bu,{className:"w-12 h-12 text-primary drop-shadow-md"})]}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:"Analyzing your website"}),t.jsx(zB,{mode:"wait",children:t.jsx(AX.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")]})}),!g&&!y&&t.jsxs(AB,{className:"p-4 pb-0",children:[t.jsx(gQ,{variant:"outline",onClick:x,className:"gap-1",children:"Go Back"}),t.jsxs(gQ,{onClick:async()=>{try{v(!0);const e=await c.mutateAsync();m(e),r&&r(e)}catch(e){v(!1),m(null),Ml({title:"Error generating brand settings",description:"Please try again.",variant:"destructive"})}},disabled:!u||c.isPending,className:"gap-1",children:[t.jsx(Ku,{className:"h-4 w-4 text-amber-500"}),c.isPending?t.jsx(fQ,{}):"Analyze Website"]})]})]})},Wle=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],Yle=({initialBrandSettings:e,onSave:r,onBack:o,showAutoParseButton:i=!0})=>{const{data:a,isLoading:s,updateBrandSettings:l,isUpdatingBrandSettings:c}=Bte(),[u,d]=n.useState({}),[p,f]=n.useState(!1),[h,m]=n.useState({}),[g,v]=n.useState(""),[y,b]=n.useState(""),[x,w]=n.useState("#000000"),[_,S]=n.useState(Date.now()),[E,T]=n.useState(!1),[C,A]=n.useState({identity:!0,colors:!0,personality:!0}),N=n.useRef(null),{toast:R}=Ll();n.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 S(Date.now());a?.branding&&(d({brandName:a.branding.brandName||a.name,brandTagline:a.branding.brandTagline||"",logoUrl:a.branding.logoUrl||"",primaryColor:a.branding.primaryColor||"#000000",secondaryColors:a.branding.secondaryColors||[],brandPersonality:{tone:a.branding.brandPersonality?.tone,voice:a.branding.brandPersonality?.voice,values:a.branding.brandPersonality?.values||[]}}),S(Date.now()))}),[a,e]);const O=e=>{A((t=>({...t,[e]:!t[e]})))},P=e=>{m((t=>{const n={...t,[e]:!t[e]};return n[e]&&("brandName"===e?v(u.brandName||""):"brandTagline"===e?v(u.brandTagline||""):"primaryColor"===e?v(u.primaryColor||"#000000"):"tone"===e?v(u.brandPersonality?.tone||""):"voice"===e&&v(u.brandPersonality?.voice||"")),n}))},k=e=>{"brandName"===e?d((e=>({...e,brandName:g}))):"brandTagline"===e?d((e=>({...e,brandTagline:g}))):"primaryColor"===e?d((e=>({...e,primaryColor:g}))):"tone"===e?d((e=>({...e,brandPersonality:{...e.brandPersonality,tone:g||void 0}}))):"voice"===e&&d((e=>({...e,brandPersonality:{...e.brandPersonality,voice:g||void 0}}))),P(e)},M=e=>{P(e)},L=e=>{d((t=>({...t,primaryColor:e})))},D=()=>{y.trim()&&(d((e=>{const t=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:[...t,y.trim()]}}})),b(""))};return s?t.jsx("div",{className:"flex justify-center items-center h-full min-h-[500px] w-full bg-white rounded-lg shadow-sm",children:t.jsx(fQ,{})}):p?t.jsx(Kle,{setAutoParse:f,onForceRefresh:()=>S(Date.now())}):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[t.jsx("div",{className:"w-full h-16 px-6 flex items-center justify-between",children:t.jsxs("div",{children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-800",children:"Brand Settings"}),t.jsx("p",{className:"text-gray-500 text-sm",children:e?"Review and confirm your extracted brand identity":"Craft your brand's visual identity"})]})}),t.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("identity"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Identity"})]}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.identity?gu:fu,{className:"h-4 w-4"})})]}),C.identity&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Name"}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("brandName"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandName?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandName"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>k("brandName"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm font-medium",children:u.brandName})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Tagline"}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("brandTagline"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandTagline?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0,placeholder:"Your brand's tagline"}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandTagline"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>k("brandTagline"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm italic",children:u.brandTagline||"No tagline set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Logo"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Square image, 128x128px, PNG recommended"})]})}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"relative group",children:[t.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:u.logoUrl?t.jsx("img",{src:`${u.logoUrl}?${_}`,alt:u.brandName||"Brand logo",className:"w-full h-full object-contain"},_):t.jsx(Tu,{className:"h-10 w-10 text-gray-300"})}),t.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:[t.jsx("input",{type:"file",ref:N,onChange:e=>{const t=e.target.files?.[0];if(t){const e=new FileReader;e.onloadend=async()=>{const n=e.result.split(",")[1],r=URL.createObjectURL(t);d((e=>({...e,logoUrl:r}))),S(Date.now()),l({logoBase64:n})},e.readAsDataURL(t)}},accept:"image/*",className:"hidden"}),t.jsxs(gQ,{variant:"ghost",size:"sm",onClick:()=>{N.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[t.jsx(Qu,{className:"h-4 w-4 mr-1"}),"Update"]})]})]}),u.logoUrl&&t.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:[t.jsx("div",{className:"flex-1 truncate text-sm text-gray-600 font-mono",children:u.logoUrl}),t.jsxs(gQ,{variant:"ghost",size:"sm",onClick:()=>{u.logoUrl&&(navigator.clipboard.writeText(u.logoUrl),T(!0),setTimeout((()=>T(!1)),1500),R({title:"Logo URL copied to clipboard"}))},className:"h-7 px-2 text-xs shrink-0",children:[E?t.jsx(pu,{className:"h-3.5 w-3.5 mr-1 text-green-500"}):t.jsx(_u,{className:"h-3.5 w-3.5 mr-1"}),E?"Copied":"Copy"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("colors"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Colors"})]}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.colors?gu:fu,{className:"h-4 w-4"})})]}),C.colors&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Primary Color"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Your main brand color used throughout the interface"})]}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("primaryColor"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-14 h-14 rounded-lg shadow-md",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsxs("div",h.primaryColor?{className:"flex flex-1 gap-2 max-w-sm",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Iu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx(H3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"pl-10 h-10 font-mono text-sm flex-1",placeholder:"#000000",maxLength:7,autoFocus:!0})]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("primaryColor"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("primaryColor"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}:{className:"flex-1 max-w-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx(Iu,{className:"h-4 w-4 text-gray-400"}),t.jsx("div",{className:"text-sm font-mono",children:u.primaryColor||"#000000"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(H3,{type:"color",value:u.primaryColor||"#000000",onChange:e=>L(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:Wle.map(((e,n)=>t.jsx(gQ,{variant:"ghost",size:"icon",className:"w-6 h-6 rounded-full border border-gray-200 "+(u.primaryColor===e?"ring-2 ring-gray-400 ring-offset-1":""),style:{backgroundColor:e},onClick:()=>L(e)},n)))})]})]})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Secondary Colors"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Additional colors that complement your primary brand color"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"flex flex-wrap gap-3 mb-4",children:u.secondaryColors?.length?u.secondaryColors.map(((e,n)=>t.jsxs("div",{className:"group relative flex flex-col items-center",children:[t.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}}),t.jsx("div",{className:"text-xs font-mono text-gray-600",children:e}),t.jsx(gQ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.secondaryColors||[];return{...e,secondaryColors:n.filter((e=>e!==t))}}));var t},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:t.jsx(rd,{className:"w-3 h-3 text-gray-500"})})]},n))):t.jsx("div",{className:"text-sm text-gray-500 italic my-2",children:"No secondary colors set"})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex-1 max-w-xs",children:[t.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Add color"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(H3,{type:"color",value:x,onChange:e=>w(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded-md"}),t.jsx(H3,{type:"text",value:x,onChange:e=>w(e.target.value),className:"h-10 font-mono text-sm",placeholder:"#000000",maxLength:7})]})]}),t.jsxs(gQ,{variant:"outline",onClick:()=>{x&&(d((e=>{const t=e.secondaryColors||[];return{...e,secondaryColors:[...t,x]}})),w("#000000"))},className:"h-10",children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add Color"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("personality"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Personality"})]}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.personality?gu:fu,{className:"h-4 w-4"})})]}),C.personality&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Tone"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"The overall feeling and attitude your brand conveys"})]}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("tone"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.tone?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("tone"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("tone"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.tone||"No tone set"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Voice"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"How your brand expresses itself in communication"})]}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("voice"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.voice?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("voice"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("voice"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.voice||"No voice set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Values"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Core principles and beliefs that drive your brand"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"mb-4",children:t.jsx("div",u.brandPersonality?.values&&u.brandPersonality.values.length>0?{className:"flex flex-wrap gap-2",children:u.brandPersonality.values.map(((e,n)=>t.jsxs(PQ,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors",style:{borderColor:`${u.primaryColor}30`||"#f3f4f6",backgroundColor:`${u.primaryColor}08`||"#f9fafb"},children:[e,t.jsx(gQ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:n.filter((e=>e!==t))}}}));var t},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:t.jsx(rd,{className:"w-2.5 h-2.5"})})]},n)))}:{className:"text-sm text-gray-500 italic py-2",children:"No brand values set"})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{placeholder:"Add a brand value",value:y,onChange:e=>b(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&D()}),t.jsxs(gQ,{variant:"outline",onClick:D,disabled:!y.trim(),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),t.jsxs(AB,{className:"p-4 pb-0",children:[o?t.jsx(gQ,{variant:"outline",className:"gap-1.5",onClick:o,children:"Go Back"}):i&&t.jsxs(gQ,{variant:"outline",className:"gap-1.5",onClick:()=>{f(!0)},children:[t.jsx(Ku,{className:"h-4 w-4 text-amber-500"}),"Auto Parse"]}),t.jsx(gQ,{className:"px-4",style:{backgroundColor:u.primaryColor||void 0},onClick:async()=>{l({brandName:u.brandName,brandTagline:u.brandTagline,logoBase64:u.logoUrl,primaryColor:u.primaryColor,secondaryColors:u.secondaryColors,brandPersonality:u.brandPersonality}),R({title:"Brand settings saved 🚀"}),r&&r()},disabled:c,children:c?"Saving":"Save Changes"})]})]})};function Xle({open:e,setOpen:n}){return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{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",hideCloseButton:!0,children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Brand Settings"}),t.jsx(RB,{children:"Edit your business brand settings"})]}),t.jsx(Yle,{})]})})}const Qle=e=>{const{updateAutomation:t,updateError:r,isUpdateSuccess:o}=De(e),{toast:i}=Ll();return n.useEffect((()=>{o?i({title:"Status updated",description:"The status has been updated successfully"}):r&&i({title:"Error updating status",description:"Please try again",variant:"destructive"})}),[o,r,i]),{toggleStatus:async e=>{try{return await t({status:e?Ve.ACTIVE:Ve.DRAFT}),!0}catch(n){return i({title:"Error updating status",description:"Please try again",variant:"destructive"}),!1}}}};function Zle(){const{toast:e}=Ll(),[r,o]=n.useState(null),{toggleStatus:i}=Qle(r||""),a=H5(),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{automations:f,nextCursor:h,isLoading:m,error:g,isFetching:v,isPlaceholderData:y}=Ie({cursor:c,limit:s,triggerType:Fe.TRIGGER_BASED,search:d||void 0});n.useEffect((()=>{g&&e({title:`Error Fetching ${ff("engage:automation")}`,description:g?.message||"Please try again.",variant:"destructive"})}),[g,e]);const b=n.useMemo((()=>(f||[]).map((e=>({...e,emailsSent:0,smsSent:0,updated_at:e.updatedAt||e.createdAt})))),[f]),x=n.useCallback((async(e,t)=>{try{o(e);const n=t===Ve.ACTIVE;await i(n)}finally{o(null)}}),[i,o]),w=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]),_=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),S=n.useMemo((()=>g9({automationName:ff("engage:automation"),setUrl:_,onToggle:x,vsaasManaged:!0})),[x,_]);return t.jsx("div",{className:"w-full h-[75vh] flex flex-col",children:t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(G3,{data:b,columns:S,paginationMode:"cursor",initialPageSize:s,isLoading:m&&!y,onRowClick:e=>{a(`/automations/view-modal/${e.id}?showBackButton=true`)},cursorPaginationQueryResult:{nextCursor:h,isLoading:m,isFetching:v,isPlaceholderData:y},onQueryParametersChange:w,searchValue:d,onSearchChange:p})})})}function Jle(){const{toast:e}=Ll(),[r,o]=n.useState(!1),[i,a]=n.useState(null),{toggleStatus:s}=Qle(i||""),l=H5(),[c,u]=n.useState(10),[d,p]=n.useState(void 0),[f,h]=n.useState(""),{automations:m,nextCursor:g,isLoading:v,error:y,isFetching:b,isPlaceholderData:x}=Ie({cursor:d,limit:c,triggerType:Fe.ONE_TIME,search:f||void 0});n.useEffect((()=>{y&&e({title:`Error Fetching ${ff("engage:one_time")}`,description:y?.message||"Please try again.",variant:"destructive"})}),[y,e]);const w=n.useMemo((()=>(m||[]).map((e=>({...e,updated_at:e.updatedAt})))),[m]),_=n.useCallback((async(e,t)=>{try{a(e);const n=t===Ve.ACTIVE;await s(n)}finally{a(null)}}),[s,a]),S=n.useCallback((e=>{p(e.cursor),u(e.pageSize)}),[]),E=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),T=n.useMemo((()=>g9({automationName:ff("engage:one_time"),setUrl:E,onToggle:_})),[_,E]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(G3,{data:w,columns:T,paginationMode:"cursor",initialPageSize:c,headerActions:t.jsxs(gQ,{className:"bg-primary",onClick:()=>o(!0),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"New"]}),isLoading:v&&!x,cursorPaginationQueryResult:{nextCursor:g,isLoading:v,isFetching:b,isPlaceholderData:x},onRowClick:e=>{l(`/automations/view-modal/${e.id}?showBackButton=true`)},onQueryParametersChange:S,searchValue:f,onSearchChange:h})}),t.jsx(Ole,{open:r,setOpen:o,onClose:t=>{s9(o,e,t,`Error creating ${ff("engage:one_time")}`,"Please try again"),p(void 0),u(10),h(""),!1!==t&&l(`/automations/view-modal/${t}?showBackButton=true`)},automationType:Fe.ONE_TIME})]})}function ece(){const{toast:e}=Ll(),[r,o]=n.useState(!1),[i,a]=n.useState(null),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{segments:f,isLoading:h,nextCursor:m,isFetching:g,isPlaceholderData:v}=QX({search:d||void 0,cursor:c,limit:s}),y=n.useCallback((e=>{a(e),o(!0)}),[a]),b=n.useMemo((()=>function(e){return[u9("name",`${ff("engage:segment")} Name`,!0),d9(),a9({accessorKey:"user_count",header:ff("engage:user_other"),meta:{align:"right",displayName:ff("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const t=e.getValue()??0;return`${t.toLocaleString()} ${1===t?ff("engage:user").toLowerCase():ff("engage:user_other").toLowerCase()}`}}),p9("user_count_updated_at"),m9(e||(()=>{}))]}(y)),[y]),x=n.useMemo((()=>f?f.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[f]),w=n.useMemo((()=>t.jsxs(gQ,{onClick:()=>{a(null),o(!0)},children:[t.jsx(Vu,{className:"h-4 w-4"}),"New List"]})),[]),_=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(G3,{data:x,columns:b,paginationMode:"cursor",initialPageSize:s,headerActions:w,isLoading:h&&!v,cursorPaginationQueryResult:{nextCursor:m,isLoading:h,isFetching:g,isPlaceholderData:v},onQueryParametersChange:_,onRowClick:e=>{a(e.id),o(!0)},searchValue:d,onSearchChange:p})}),t.jsx(hle,{open:r,setOpen:o,segmentId:i??void 0,onSegmentUpdated:t=>{s9(o,e,t,`Error creating ${ff("engage:segment")}`,"Please try again"),u(void 0),l(10),p("")}})]})}const tce=()=>{const e=[{id:"broadcasts",label:ff("engage:one_time",{count:2}),content:t.jsx(Jle,{})},{id:"automations",label:ff("engage:automation",{count:2}),content:t.jsx(Zle,{})},{id:"segments",label:ff("engage:segment",{count:2}),content:t.jsx(ece,{})},{id:"statistics",label:ff("engage:insight",{count:2}),content:t.jsx(zle,{})}],r=ce(),[o,i]=n.useState(!1),[a,s]=n.useState(e[0].id);return n.useEffect((()=>{r.prefetchQuery({queryKey:Oe.list()}),r.prefetchQuery({queryKey:YX.lists()})}),[r]),t.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[t.jsx(Xle,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(gQ,{variant:"outline",onClick:()=>i(!0),children:t.jsx(qu,{className:"w-4 h-4"})})}),t.jsx("div",{className:"flex-1 w-full h-full flex flex-col gap-4",children:t.jsx(Ple,{activeTab:a,tabs:e,onTabChange:s})})]})};var nce=e=>"checkbox"===e.type,rce=e=>e instanceof Date,oce=e=>null==e;const ice=e=>"object"==typeof e;var ace=e=>!oce(e)&&!Array.isArray(e)&&ice(e)&&!rce(e),sce=e=>ace(e)&&e.target?nce(e.target)?e.target.checked:e.target.value:e,lce=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),cce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function uce(e){let t;const n=Array.isArray(e),r="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(cce&&(e instanceof Blob||r)||!n&&!ace(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return ace(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=uce(e[n]));else t=e}return t}var dce=e=>Array.isArray(e)?e.filter(Boolean):[],pce=e=>void 0===e,fce=(e,t,n)=>{if(!t||!ace(e))return n;const r=dce(t.split(/[,[\].]+?/)).reduce(((e,t)=>oce(e)?e:e[t]),e);return pce(r)||r===e?pce(e[t])?n:e[t]:r},hce=e=>"boolean"==typeof e,mce=e=>/^\w*$/.test(e),gce=e=>dce(e.replace(/["|']|\]/g,"").split(/\.|\[/)),vce=(e,t,n)=>{let r=-1;const o=mce(t)?[t]:gce(t),i=o.length,a=i-1;for(;++r<i;){const t=o[r];let i=n;if(r!==a){const n=e[t];i=ace(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const yce="blur",bce="focusout",xce="change",wce="onBlur",_ce="onChange",Sce="onSubmit",Ece="onTouched",Tce="all",Cce="max",Ace="min",Nce="maxLength",Rce="minLength",Oce="pattern",Pce="required",kce="validate",Mce=n.createContext(null),Lce=()=>n.useContext(Mce);var Dce=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Tce&&(t._proxyFormState[o]=!r||Tce),n&&(n[o]=!0),e[o]}});return o},jce=e=>oce(e)||!ice(e);function Ice(e,t){if(jce(e)||jce(t))return e===t;if(rce(e)&&rce(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const n=e[o];if(!r.includes(o))return!1;if("ref"!==o){const e=t[o];if(rce(n)&&rce(e)||ace(n)&&ace(e)||Array.isArray(n)&&Array.isArray(e)?!Ice(n,e):n!==e)return!1}}return!0}const Fce=(e,t)=>{const r=n.useRef(t);Ice(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var Uce=e=>"string"==typeof e,$ce=(e,t,n,r,o)=>Uce(e)?(r&&t.watch.add(e),fce(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),fce(n,e)))):(r&&(t.watchAll=!0),n);function Vce(e){const t=Lce(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=lce(i._names.array,r),l=function(e){const t=Lce(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return Fce((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c($ce(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:fce(i._formValues,r,fce(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=Lce(),{control:r=t.control,disabled:o,name:i,exact:a}=e||{},[s,l]=n.useState(r._formState),c=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Fce((()=>r._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!o&&l({...r._formState,...e})}})),[i,o,a]),n.useEffect((()=>{c.current.isValid&&r._setValid(!0)}),[r]),n.useMemo((()=>Dce(s,r,c.current,!1)),[s,r])}({control:i,name:r,exact:!0}),u=n.useRef(e),d=n.useRef(i.register(r,{...e.rules,value:l,...hce(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!fce(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!fce(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!fce(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!fce(c.validatingFields,r)},error:{enumerable:!0,get:()=>fce(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:sce(e),name:r},type:xce})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:fce(i._formValues,r),name:r},type:yce})),[r,i._formValues]),m=n.useCallback((e=>{const t=fce(i._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}),[i._fields,r]),g=n.useMemo((()=>({name:r,value:l,...hce(o)||c.disabled?{disabled:c.disabled||o}:{},onChange:f,onBlur:h,ref:m})),[r,o,c.disabled,f,h,m,l]);return n.useEffect((()=>{const e=i._options.shouldUnregister||a;i.register(r,{...u.current.rules,...hce(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=fce(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=uce(fce(i._options.defaultValues,r));vce(i._defaultValues,r,e),pce(fce(i._formValues,r))&&vce(i._formValues,r,e)}return!s&&i.register(r),()=>{(s?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}}),[r,i,s,a]),n.useEffect((()=>{i._setDisabledField({disabled:o,name:r})}),[o,r,i]),n.useMemo((()=>({field:g,formState:c,fieldState:p})),[g,c,p])}const Bce=e=>e.render(Vce(e));var zce=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Hce=e=>Array.isArray(e)?e:[e],qce=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},Gce=e=>ace(e)&&!Object.keys(e).length,Kce=e=>"file"===e.type,Wce=e=>"function"==typeof e,Yce=e=>{if(!cce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Xce=e=>"select-multiple"===e.type,Qce=e=>"radio"===e.type,Zce=e=>Yce(e)&&e.isConnected;function Jce(e,t){const n=Array.isArray(t)?t:mce(t)?[t]:gce(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=pce(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(ace(r)&&Gce(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!pce(e[t]))return!1;return!0}(r))&&Jce(e,n.slice(0,-1)),e}var eue=e=>{for(const t in e)if(Wce(e[t]))return!0;return!1};function tue(e,t={}){const n=Array.isArray(e);if(ace(e)||n)for(const r in e)Array.isArray(e[r])||ace(e[r])&&!eue(e[r])?(t[r]=Array.isArray(e[r])?[]:{},tue(e[r],t[r])):oce(e[r])||(t[r]=!0);return t}function nue(e,t,n){const r=Array.isArray(e);if(ace(e)||r)for(const o in e)Array.isArray(e[o])||ace(e[o])&&!eue(e[o])?pce(t)||jce(n[o])?n[o]=Array.isArray(e[o])?tue(e[o],[]):{...tue(e[o])}:nue(e[o],oce(t)?{}:t[o],n[o]):n[o]=!Ice(e[o],t[o]);return n}var rue=(e,t)=>nue(e,t,tue(t));const oue={value:!1,isValid:!1},iue={value:!0,isValid:!0};var aue=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!pce(e[0].attributes.value)?pce(e[0].value)||""===e[0].value?iue:{value:e[0].value,isValid:!0}:iue:oue}return oue},sue=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>pce(e)?e:t?""===e?NaN:e?+e:e:n&&Uce(e)?new Date(e):r?r(e):e;const lue={isValid:!1,value:null};var cue=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),lue):lue;function uue(e){const t=e.ref;return Kce(t)?t.files:Qce(t)?cue(e.refs).value:Xce(t)?[...t.selectedOptions].map((({value:e})=>e)):nce(t)?aue(e.refs).value:sue(pce(t.value)?e.ref.value:t.value,e)}var due=e=>e instanceof RegExp,pue=e=>pce(e)?e:due(e)?e.source:ace(e)?due(e.value)?e.value.source:e.value:e,fue=e=>({isOnSubmit:!e||e===Sce,isOnBlur:e===wce,isOnChange:e===_ce,isOnAll:e===Tce,isOnTouch:e===Ece});const hue="AsyncFunction";var mue=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const gue=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=fce(e,o);if(n){const{_f:e,...i}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],o)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(gue(i,t))break}else if(ace(i)&&gue(i,t))break}}};function vue(e,t,n){const r=fce(e,n);if(r||mce(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=fce(t,r),a=fce(e,r);if(i&&!Array.isArray(i)&&n!==r)return{name:n};if(a&&a.type)return{name:r,error:a};o.pop()}return{name:n}}var yue=(e,t,n)=>{const r=Hce(fce(e,n));return vce(r,"root",t[n]),vce(e,n,r),e},bue=e=>Uce(e);function xue(e,t,n="validate"){if(bue(e)||Array.isArray(e)&&e.every(bue)||hce(e)&&!e)return{type:n,message:bue(e)?e:"",ref:t}}var wue=e=>ace(e)&&!due(e)?e:{value:e,message:""},_ue=async(e,t,n,r,o,i)=>{const{ref:a,refs:s,required:l,maxLength:c,minLength:u,min:d,max:p,pattern:f,validate:h,name:m,valueAsNumber:g,mount:v}=e._f,y=fce(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,x=e=>{o&&b.reportValidity&&(b.setCustomValidity(hce(e)?"":e||""),b.reportValidity())},w={},_=Qce(a),S=nce(a),E=_||S,T=(g||Kce(a))&&pce(a.value)&&pce(y)||Yce(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=zce.bind(null,m,r,w),A=(e,t,n,r=Nce,o=Rce)=>{const i=e?t:n;w[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(i?!Array.isArray(y)||!y.length:l&&(!E&&(T||oce(y))||hce(y)&&!y||S&&!aue(s).isValid||_&&!cue(s).isValid)){const{value:e,message:t}=bue(l)?{value:!!l,message:l}:wue(l);if(e&&(w[m]={type:Pce,message:t,ref:b,...C(Pce,t)},!r))return x(t),w}if(!(T||oce(d)&&oce(p))){let e,t;const n=wue(p),o=wue(d);if(oce(y)||isNaN(y)){const r=a.valueAsDate||new Date(y),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==a.type,l="week"==a.type;Uce(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),Uce(o.value)&&y&&(t=s?i(y)<i(o.value):l?y<o.value:r<new Date(o.value))}else{const r=a.valueAsNumber||(y?+y:y);oce(n.value)||(e=r>n.value),oce(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,Cce,Ace),!r))return x(w[m].message),w}if((c||u)&&!T&&(Uce(y)||i&&Array.isArray(y))){const e=wue(c),t=wue(u),n=!oce(e.value)&&y.length>+e.value,o=!oce(t.value)&&y.length<+t.value;if((n||o)&&(A(n,e.message,t.message),!r))return x(w[m].message),w}if(f&&!T&&Uce(y)){const{value:e,message:t}=wue(f);if(due(e)&&!y.match(e)&&(w[m]={type:Oce,message:t,ref:a,...C(Oce,t)},!r))return x(t),w}if(h)if(Wce(h)){const e=xue(await h(y,n),b);if(e&&(w[m]={...e,...C(kce,e.message)},!r))return x(e.message),w}else if(ace(h)){let e={};for(const t in h){if(!Gce(e)&&!r)break;const o=xue(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},x(o.message),r&&(w[m]=e))}if(!Gce(e)&&(w[m]={ref:b,...e},!r))return w}return x(!0),w};const Sue={mode:Sce,reValidateMode:_ce,shouldFocusError:!0};function Eue(e={}){let t={...Sue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Wce(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const r={};let o,i=(ace(t.defaultValues)||ace(t.values))&&uce(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:uce(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let d={...u};const p={array:qce(),state:qce()},f=fue(t.mode),h=fue(t.reValidateMode),m=t.criteriaMode===Tce,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?Gce((await w()).errors):await _(r,!0);e!==n.isValid&&p.state.next({isValid:e})}},v=(e,r)=>{!t.disabled&&(u.isValidating||u.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(r?vce(n.validatingFields,e,r):Jce(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!Gce(n.validatingFields)}))},y=(e,t,n,o)=>{const l=fce(r,e);if(l){const r=fce(a,e,pce(n)?fce(i,e):n);pce(r)||o&&o.defaultChecked||t?vce(a,e,t?r:uue(l._f)):T(e,r),s.mount&&g()}},b=(e,r,o,a,s)=>{let l=!1,c=!1;const f={name:e};if(!t.disabled){if(!o||a){(u.isDirty||d.isDirty)&&(c=n.isDirty,n.isDirty=f.isDirty=S(),l=c!==f.isDirty);const t=Ice(fce(i,e),r);c=!!fce(n.dirtyFields,e),t?Jce(n.dirtyFields,e):vce(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=fce(n.touchedFields,e);t||(vce(n.touchedFields,e,o),f.touchedFields=n.touchedFields,l=l||(u.touchedFields||d.touchedFields)&&t!==o)}l&&s&&p.state.next(f)}return l?f:{}},x=(e,r,i,a)=>{const s=fce(n.errors,e),l=(u.isValid||d.isValid)&&hce(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{vce(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?vce(n.errors,e,i):Jce(n.errors,e)),(i?!Ice(s,i):s)||!Gce(a)||l){const t={...a,...l&&hce(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{v(e,!0);const n=await t.resolver(a,t.context,((e,t,n,r)=>{const o={};for(const i of e){const e=fce(t,i);e&&vce(o,i,e._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}})(e||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return v(e),n},_=async(e,r,o={valid:!0})=>{for(const s in e){const c=e[s];if(c){const{_f:e,...d}=c;if(e){const d=l.array.has(e.name),p=c._f&&(!!(i=c._f)&&!!i.validate&&!!(Wce(i.validate)&&i.validate.constructor.name===hue||ace(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===hue))));p&&u.validatingFields&&v([s],!0);const f=await _ue(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(fce(f,e.name)?d?yue(n.errors,f,e.name):vce(n.errors,e.name,f[e.name]):Jce(n.errors,e.name))}!Gce(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&vce(a,e,n),!Ice(P(),i)),E=(e,t,n)=>$ce(e,l,{...s.mount?a:pce(t)?i:Uce(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=fce(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&vce(a,e,sue(t,n)),i=Yce(n.ref)&&oce(t)?"":t,Xce(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?nce(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):n.refs[0]&&(n.refs[0].checked=!!i):n.refs.forEach((e=>e.checked=e.value===i)):Kce(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:uce(a)})))}(n.shouldDirty||n.shouldTouch)&&b(e,i,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&O(e)},C=(e,t,n)=>{for(const o in t){const i=t[o],a=`${e}.${o}`,s=fce(r,a);(l.array.has(e)||ace(i)||s&&!s._f)&&!rce(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=fce(r,e),f=l.array.has(e),h=uce(t);vce(a,e,h),f?(p.array.next({name:e,values:uce(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:rue(i,a),isDirty:S(e,h)})):!c||c._f||oce(h)?T(e,h,o):C(e,h,o),mue(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:uce(a)})},N=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=fce(r,c),E=e=>{y=Number.isNaN(e)||rce(e)&&isNaN(e.getTime())||Ice(e,fce(a,c,e))};if(S){let s,C;const A=i.type?uue(S._f):sce(e),N=e.type===yce||e.type===bce,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||fce(n.errors,c)||S._f.deps)||((e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e))(N,fce(n.touchedFields,c),n.isSubmitted,h,f),P=mue(c,l,N);vce(a,c,A),N?(S._f.onBlur&&S._f.onBlur(e),o&&o(0)):S._f.onChange&&S._f.onChange(e);const k=b(c,A,N),M=!Gce(k)||P;if(!N&&p.state.next({name:c,type:e.type,values:uce(a)}),R)return(u.isValid||d.isValid)&&("onBlur"===t.mode?N&&g():N||g()),M&&p.state.next({name:c,...P?{}:k});if(!N&&P&&p.state.next({...n}),t.resolver){const{errors:e}=await w([c]);if(E(A),y){const t=vue(n.errors,r,c),o=vue(e,r,t.name||c);s=o.error,c=o.name,C=Gce(e)}}else v([c],!0),s=(await _ue(S,l.disabled,a,m,t.shouldUseNativeValidation))[c],v([c]),E(A),y&&(s?C=!1:(u.isValid||d.isValid)&&(C=await _(r,!0)));y&&(S._f.deps&&O(S._f.deps),x(c,C,s,k))}var T},R=(e,t)=>{if(fce(n.errors,t)&&e.focus)return e.focus(),1},O=async(e,o={})=>{let i,a;const s=Hce(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=fce(t,r);e?vce(n.errors,r,e):Jce(n.errors,r)}else n.errors=t;return t})(pce(e)?e:s);i=Gce(t),a=e?!s.some((e=>fce(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=fce(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!Uce(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&gue(r,R,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return pce(e)?t:Uce(e)?fce(t,e):e.map((e=>fce(t,e)))},k=(e,t)=>({invalid:!!fce((t||n).errors,e),isDirty:!!fce((t||n).dirtyFields,e),error:fce((t||n).errors,e),isValidating:!!fce(n.validatingFields,e),isTouched:!!fce((t||n).touchedFields,e)}),M=(e,t,o)=>{const i=(fce(r,e,{_f:{}})._f||{}).ref,a=fce(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;vce(n.errors,e,{...u,...t,ref:i}),p.state.next({name:e,errors:n.errors,isValid:!1}),o&&o.shouldFocus&&i&&i.focus&&i.focus()},L=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!Hce(r).some((e=>e&&(i?e===o:e.startsWith(o)||o.startsWith(e))))||!((e,t,n,r)=>{n(e);const{name:o,...i}=e;return Gce(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||Tce)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,D=(e,o={})=>{for(const s of e?Hce(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(Jce(r,s),Jce(a,s)),!o.keepError&&Jce(n.errors,s),!o.keepDirty&&Jce(n.dirtyFields,s),!o.keepTouched&&Jce(n.touchedFields,s),!o.keepIsValidating&&Jce(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&Jce(i,s);p.state.next({values:uce(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},j=({disabled:e,name:t})=>{(hce(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=fce(r,e);const a=hce(n.disabled)||hce(t.disabled);return vce(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?j({disabled:hce(n.disabled)?n.disabled:t.disabled,name:e}):y(e,!0,n.value),{...a?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:pue(n.min),max:pue(n.max),minLength:pue(n.minLength),maxLength:pue(n.maxLength),pattern:pue(n.pattern)}:{},name:e,onChange:N,onBlur:N,ref:a=>{if(a){I(e,n),o=fce(r,e);const t=pce(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>Qce(e)||nce(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;vce(r,e,{_f:{...o._f,...s?{refs:[...l.filter(Zce),t,...Array.isArray(fce(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=fce(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!lce(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&gue(r,R,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=uce(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await w();n.errors=e,c=t}else await _(r);if(l.disabled.size)for(const e of l.disabled)vce(c,e,void 0);if(Jce(n.errors,"root"),Gce(n.errors)){p.state.next({errors:{}});try{await e(c,i)}catch(u){s=u}}else o&&await o({...n.errors},i),F(),setTimeout(F);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gce(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?uce(e):i,d=uce(c),f=Gce(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(rue(i,a))]);for(const t of Array.from(e))fce(n.dirtyFields,t)?vce(h,t,fce(a,t)):A(t,fce(h,t))}else{if(cce&&pce(e))for(const e of l.mount){const t=fce(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Yce(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,fce(h,e))}a=uce(h),p.array.next({values:{...h}}),p.state.next({values:{...h}})}l={mount:o.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!o.keepIsValid||!!o.keepDirtyValues,s.watch=!!t.shouldUnregister,p.state.next({submitCount:o.keepSubmitCount?n.submitCount:0,isDirty:!f&&(o.keepDirty?n.isDirty:!(!o.keepDefaultValues||Ice(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?rue(i,a):n.dirtyFields:o.keepDefaultValues&&e?rue(i,e):o.keepDirty?n.dirtyFields:{},touchedFields:o.keepTouched?n.touchedFields:{},errors:o.keepErrors?n.errors:{},isSubmitSuccessful:!!o.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},V=(e,t)=>$(Wce(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:D,getFieldState:k,handleSubmit:U,setError:M,_subscribe:L,_runSchema:w,_getWatch:E,_getDirty:S,_setValid:g,_setFieldArray:(e,o=[],l,c,f=!0,h=!0)=>{if(c&&l&&!t.disabled){if(s.action=!0,h&&Array.isArray(fce(r,e))){const t=l(fce(r,e),c.argA,c.argB);f&&vce(r,e,t)}if(h&&Array.isArray(fce(n.errors,e))){const t=l(fce(n.errors,e),c.argA,c.argB);f&&vce(n.errors,e,t),((e,t)=>{!dce(fce(e,t)).length&&Jce(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(fce(n.touchedFields,e))){const t=l(fce(n.touchedFields,e),c.argA,c.argB);f&&vce(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=rue(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else vce(a,e,o)},_setDisabledField:j,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>dce(fce(s.mount?a:i,e,t.shouldUnregister?fce(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>Wce(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=fce(r,e);t&&(t._f.refs?t._f.refs.every((e=>!Zce(e))):!Zce(t._f.ref))&&D(e)}l.unMount=new Set},_disableForm:e=>{hce(e)&&(p.state.next({disabled:e}),gue(r,((t,n)=>{const o=fce(r,n);o&&(t.disabled=o._f.disabled||e,Array.isArray(o._f.refs)&&o._f.refs.forEach((t=>{t.disabled=o._f.disabled||e})))}),0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return r},get _formValues(){return a},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:e=>(s.mount=!0,d={...d,...e.formState},L({...e,formState:d})),trigger:O,register:I,handleSubmit:U,watch:(e,t)=>Wce(e)?p.state.subscribe({next:n=>e(E(void 0,t),n)}):E(e,t,!0),setValue:A,getValues:P,reset:V,resetField:(e,t={})=>{fce(r,e)&&(pce(t.defaultValue)?A(e,uce(fce(i,e))):(A(e,t.defaultValue),vce(i,e,uce(t.defaultValue))),t.keepTouched||Jce(n.touchedFields,e),t.keepDirty||(Jce(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,uce(fce(i,e))):S()),t.keepError||(Jce(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&Hce(e).forEach((e=>Jce(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:D,setError:M,setFocus:(e,t={})=>{const n=fce(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&Wce(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const Tue="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Cue(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:Wce(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:Wce(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:Eue(e),formState:o},e.formControl&&e.defaultValues&&!Wce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Tue((()=>{const e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i((e=>({...e,isReady:!0}))),e}),[a]),n.useEffect((()=>a._disableForm(e.disabled)),[a,e.disabled]),n.useEffect((()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode),e.errors&&!Gce(e.errors)&&a._setErrors(e.errors)}),[a,e.errors,e.mode,e.reValidateMode]),n.useEffect((()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})}),[a,e.shouldUnregister]),n.useEffect((()=>{if(a._proxyFormState.isDirty){const e=a._getDirty();e!==o.isDirty&&a._subjects.state.next({isDirty:e})}}),[a,o.isDirty]),n.useEffect((()=>{e.values&&!Ice(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,i((e=>({...e})))):a._resetDefaultValues()}),[a,e.values]),n.useEffect((()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()})),t.current.formState=Dce(o,a),t.current}const Aue=(e,t,n)=>{if(e&&"reportValidity"in e){const r=fce(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Nue=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Aue(r.ref,n,e):r.refs&&r.refs.forEach((t=>Aue(t,n,e)))}},Rue=(e,t)=>{t.shouldUseNativeValidation&&Nue(e,t);const n={};for(const r in e){const o=fce(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Oue(t.names||Object.keys(e),r)){const e=Object.assign({},fce(n,r));vce(e,"root",i),vce(n,r,e)}else vce(n,r,i)}return n},Oue=(e,t)=>e.some((e=>e.startsWith(t+".")));var Pue,kue,Mue,Lue=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,i=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[a]={message:s.message,type:s.code}}else n[a]={message:i,type:o};if("unionErrors"in r&&r.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var l=n[a].types,c=l&&l[r.code];n[a]=zce(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},Due=function(e,t,n){return void 0===n&&(n={}),function(r,o,i){try{return Promise.resolve(function(o,a){try{var s=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then((function(e){return i.shouldUseNativeValidation&&Nue({},i),{errors:{},values:n.raw?r:e}}))}catch(l){return a(l)}return s&&s.then?s.then(void 0,a):s}(0,(function(e){if(t=e,Array.isArray(null==t?void 0:t.errors))return{values:{},errors:Rue(Lue(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};(kue=Pue||(Pue={})).assertEqual=e=>e,kue.assertIs=function(e){},kue.assertNever=function(e){throw new Error},kue.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},kue.getValidEnumValues=e=>{const t=kue.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return kue.objectValues(n)},kue.objectValues=e=>kue.objectKeys(e).map((function(t){return e[t]})),kue.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},kue.find=(e,t)=>{for(const n of e)if(t(n))return n},kue.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,kue.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},kue.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Mue||(Mue={})).mergeShapes=(e,t)=>({...e,...t});const jue=Pue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Iue=e=>{switch(typeof e){case"undefined":return jue.undefined;case"string":return jue.string;case"number":return isNaN(e)?jue.nan:jue.number;case"boolean":return jue.boolean;case"function":return jue.function;case"bigint":return jue.bigint;case"symbol":return jue.symbol;case"object":return Array.isArray(e)?jue.array:null===e?jue.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?jue.promise:"undefined"!=typeof Map&&e instanceof Map?jue.map:"undefined"!=typeof Set&&e instanceof Set?jue.set:"undefined"!=typeof Date&&e instanceof Date?jue.date:jue.object;default:return jue.unknown}},Fue=Pue.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 Uue 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 t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const o of e.issues)if("invalid_union"===o.code)o.unionErrors.map(r);else if("invalid_return_type"===o.code)r(o.returnTypeError);else if("invalid_arguments"===o.code)r(o.argumentsError);else if(0===o.path.length)n._errors.push(t(o));else{let e=n,r=0;for(;r<o.path.length;){const n=o.path[r];r===o.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Uue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pue.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Uue.create=e=>new Uue(e);const $ue=(e,t)=>{let n;switch(e.code){case Fue.invalid_type:n=e.received===jue.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Fue.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Pue.jsonStringifyReplacer)}`;break;case Fue.unrecognized_keys:n=`Unrecognized key(s) in object: ${Pue.joinValues(e.keys,", ")}`;break;case Fue.invalid_union:n="Invalid input";break;case Fue.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Pue.joinValues(e.options)}`;break;case Fue.invalid_enum_value:n=`Invalid enum value. Expected ${Pue.joinValues(e.options)}, received '${e.received}'`;break;case Fue.invalid_arguments:n="Invalid function arguments";break;case Fue.invalid_return_type:n="Invalid function return type";break;case Fue.invalid_date:n="Invalid date";break;case Fue.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}"`:Pue.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Fue.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 Fue.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 Fue.custom:n="Invalid input";break;case Fue.invalid_intersection_types:n="Intersection results could not be merged";break;case Fue.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Fue.not_finite:n="Number must be finite";break;default:n=t.defaultError,Pue.assertNever(e)}return{message:n}};let Vue=$ue;function Bue(){return Vue}const zue=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],a={...o,path:i};if(void 0!==o.message)return{...o,path:i,message:o.message};let s="";const l=r.filter((e=>!!e)).slice().reverse();for(const c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function Hue(e,t){const n=Bue(),r=zue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===$ue?void 0:$ue].filter((e=>!!e))});e.common.issues.push(r)}class que{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return Gue;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return que.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:o}=r;if("aborted"===t.status)return Gue;if("aborted"===o.status)return Gue;"dirty"===t.status&&e.dirty(),"dirty"===o.status&&e.dirty(),"__proto__"===t.value||void 0===o.value&&!r.alwaysSet||(n[t.value]=o.value)}return{status:e.value,value:n}}}const Gue=Object.freeze({status:"aborted"}),Kue=e=>({status:"dirty",value:e}),Wue=e=>({status:"valid",value:e}),Yue=e=>"aborted"===e.status,Xue=e=>"dirty"===e.status,Que=e=>"valid"===e.status,Zue=e=>"undefined"!=typeof Promise&&e instanceof Promise;function Jue(e,t,n,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function ede(e,t,n,r,o){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var tde,nde,rde,ode;"function"==typeof SuppressedError&&SuppressedError,(nde=tde||(tde={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},nde.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ide{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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 ade=(e,t)=>{if(Que(t))return{success:!0,data:t.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 t=new Uue(e.common.issues);return this._error=t,this._error}}};function sde(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:o};return{errorMap:(t,o)=>{var i,a;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:o.defaultError}:void 0===o.data?{message:null!==(i=null!=s?s:r)&&void 0!==i?i:o.defaultError}:"invalid_type"!==t.code?{message:o.defaultError}:{message:null!==(a=null!=s?s:n)&&void 0!==a?a:o.defaultError}},description:o}}class lde{get description(){return this._def.description}_getType(e){return Iue(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Iue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new que,ctx:{common:e.parent.common,data:e.data,parsedType:Iue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Zue(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Iue(e)},o=this._parseSync({data:e,path:r.path,parent:r});return ade(r,o)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Iue(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return Que(t)?{value:t.value}:{issues:r.common.issues}}catch(eSe){(null===(n=null===(t=null==eSe?void 0:eSe.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then((e=>Que(e)?{value:e.value}:{issues:r.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Iue(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(Zue(r)?r:Promise.resolve(r));return ade(n,o)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const o=e(t),i=()=>r.addIssue({code:Fue.custom,...n(t)});return"undefined"!=typeof Promise&&o instanceof Promise?o.then((e=>!!e||(i(),!1))):!!o||(i(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new ipe({schema:this,typeName:hpe.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 ape.create(this,this._def)}nullable(){return spe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Hde.create(this)}promise(){return ope.create(this,this._def)}or(e){return Kde.create([this,e],this._def)}and(e){return Yde.create(this,e,this._def)}transform(e){return new ipe({...sde(this._def),schema:this,typeName:hpe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new lpe({...sde(this._def),innerType:this,defaultValue:t,typeName:hpe.ZodDefault})}brand(){return new dpe({typeName:hpe.ZodBranded,type:this,...sde(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new cpe({...sde(this._def),innerType:this,catchValue:t,typeName:hpe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ppe.create(this,e)}readonly(){return fpe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cde=/^c[^\s-]{8,}$/i,ude=/^[0-9a-z]+$/,dde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pde=/^[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,fde=/^[a-z0-9_-]{21}$/i,hde=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mde=/^[-+]?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)?)??$/,gde=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let vde;const yde=/^(?:(?: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])$/,bde=/^(?:(?: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])$/,xde=/^(([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]))$/,wde=/^(([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])$/,_de=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ede="((\\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])))",Tde=new RegExp(`^${Ede}$`);function Cde(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function Ade(e){return new RegExp(`^${Cde(e)}$`)}function Nde(e){let t=`${Ede}T${Cde(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Rde(e,t){if(!hde.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return"object"==typeof o&&null!==o&&(!(!o.typ||!o.alg)&&(!t||o.alg===t))}catch(tSe){return!1}}function Ode(e,t){return!("v4"!==t&&t||!bde.test(e))||!("v6"!==t&&t||!wde.test(e))}class Pde extends lde{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==jue.string){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.string,received:t.parsedType}),Gue}const t=new que;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const r=e.data.length>i.value,o=e.data.length<i.value;(r||o)&&(n=this._getOrReturnCtx(e,n),r?Hue(n,{code:Fue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Hue(n,{code:Fue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)gde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"email",code:Fue.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)vde||(vde=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),vde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"emoji",code:Fue.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)pde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"uuid",code:Fue.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)fde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"nanoid",code:Fue.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)cde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"cuid",code:Fue.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)ude.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"cuid2",code:Fue.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)dde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"ulid",code:Fue.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(tSe){n=this._getOrReturnCtx(e,n),Hue(n,{validation:"url",code:Fue.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"regex",code:Fue.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){Nde(i).test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Tde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){Ade(i).test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?mde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"duration",code:Fue.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!yde.test(r))&&("v6"!==o&&o||!xde.test(r))&&(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"ip",code:Fue.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?Rde(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"jwt",code:Fue.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Ode(e.data,i.version)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"cidr",code:Fue.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?_de.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"base64",code:Fue.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Sde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"base64url",code:Fue.invalid_string,message:i.message}),t.dirty()):Pue.assertNever(i);var r,o;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:Fue.invalid_string,...tde.errToObj(n)})}_addCheck(e){return new Pde({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tde.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tde.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tde.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tde.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tde.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tde.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tde.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tde.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tde.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tde.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tde.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tde.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tde.errToObj(e)})}datetime(e){var t,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!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...tde.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,...tde.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tde.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tde.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tde.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tde.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tde.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tde.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tde.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tde.errToObj(t)})}nonempty(e){return this.min(1,tde.errToObj(e))}trim(){return new Pde({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Pde({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Pde({...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 t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function kde(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r;return parseInt(e.toFixed(o).replace(".",""))%parseInt(t.toFixed(o).replace(".",""))/Math.pow(10,o)}Pde.create=e=>{var t;return new Pde({checks:[],typeName:hpe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...sde(e)})};class Mde extends lde{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)!==jue.number){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.number,received:t.parsedType}),Gue}let t;const n=new que;for(const r of this._def.checks)if("int"===r.kind)Pue.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==kde(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.not_finite,message:r.message}),n.dirty()):Pue.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tde.toString(t))}setLimit(e,t,n,r){return new Mde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:tde.toString(r)}]})}_addCheck(e){return new Mde({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tde.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tde.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tde.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tde.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tde.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Pue.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Mde.create=e=>new Mde({checks:[],typeName:hpe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...sde(e)});class Lde extends lde{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(tSe){return this._getInvalidInput(e)}if(this._getType(e)!==jue.bigint)return this._getInvalidInput(e);let t;const n=new que;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Pue.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.bigint,received:t.parsedType}),Gue}gte(e,t){return this.setLimit("min",e,!0,tde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tde.toString(t))}setLimit(e,t,n,r){return new Lde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:tde.toString(r)}]})}_addCheck(e){return new Lde({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tde.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Lde.create=e=>{var t;return new Lde({checks:[],typeName:hpe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...sde(e)})};class Dde extends lde{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==jue.boolean){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.boolean,received:t.parsedType}),Gue}return Wue(e.data)}}Dde.create=e=>new Dde({typeName:hpe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...sde(e)});class jde extends lde{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==jue.date){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.date,received:t.parsedType}),Gue}if(isNaN(e.data.getTime())){return Hue(this._getOrReturnCtx(e),{code:Fue.invalid_date}),Gue}const t=new que;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Pue.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jde({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tde.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tde.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}jde.create=e=>new jde({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:hpe.ZodDate,...sde(e)});class Ide extends lde{_parse(e){if(this._getType(e)!==jue.symbol){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.symbol,received:t.parsedType}),Gue}return Wue(e.data)}}Ide.create=e=>new Ide({typeName:hpe.ZodSymbol,...sde(e)});class Fde extends lde{_parse(e){if(this._getType(e)!==jue.undefined){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.undefined,received:t.parsedType}),Gue}return Wue(e.data)}}Fde.create=e=>new Fde({typeName:hpe.ZodUndefined,...sde(e)});class Ude extends lde{_parse(e){if(this._getType(e)!==jue.null){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.null,received:t.parsedType}),Gue}return Wue(e.data)}}Ude.create=e=>new Ude({typeName:hpe.ZodNull,...sde(e)});class $de extends lde{constructor(){super(...arguments),this._any=!0}_parse(e){return Wue(e.data)}}$de.create=e=>new $de({typeName:hpe.ZodAny,...sde(e)});class Vde extends lde{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Wue(e.data)}}Vde.create=e=>new Vde({typeName:hpe.ZodUnknown,...sde(e)});class Bde extends lde{_parse(e){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.never,received:t.parsedType}),Gue}}Bde.create=e=>new Bde({typeName:hpe.ZodNever,...sde(e)});class zde extends lde{_parse(e){if(this._getType(e)!==jue.undefined){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.void,received:t.parsedType}),Gue}return Wue(e.data)}}zde.create=e=>new zde({typeName:hpe.ZodVoid,...sde(e)});class Hde extends lde{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==jue.array)return Hue(t,{code:Fue.invalid_type,expected:jue.array,received:t.parsedType}),Gue;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(Hue(t,{code:e?Fue.too_big:Fue.too_small,minimum:o?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Hue(t,{code:Fue.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Hue(t,{code:Fue.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new ide(t,e,t.path,n))))).then((e=>que.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new ide(t,e,t.path,n))));return que.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new Hde({...this._def,minLength:{value:e,message:tde.toString(t)}})}max(e,t){return new Hde({...this._def,maxLength:{value:e,message:tde.toString(t)}})}length(e,t){return new Hde({...this._def,exactLength:{value:e,message:tde.toString(t)}})}nonempty(e){return this.min(1,e)}}function qde(e){if(e instanceof Gde){const t={};for(const n in e.shape){t[n]=ape.create(qde(e.shape[n]))}return new Gde({...e._def,shape:()=>t})}return e instanceof Hde?new Hde({...e._def,type:qde(e.element)}):e instanceof ape?ape.create(qde(e.unwrap())):e instanceof spe?spe.create(qde(e.unwrap())):e instanceof Xde?Xde.create(e.items.map((e=>qde(e)))):e}Hde.create=(e,t)=>new Hde({type:e,minLength:null,maxLength:null,exactLength:null,typeName:hpe.ZodArray,...sde(t)});class Gde extends lde{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(),t=Pue.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==jue.object){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.object,received:t.parsedType}),Gue}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Bde&&"strip"===this._def.unknownKeys))for(const s in n.data)o.includes(s)||i.push(s);const a=[];for(const s of o){a.push({key:{status:"valid",value:s},value:r[s]._parse(new ide(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof Bde){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of i)a.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)i.length>0&&(Hue(n,{code:Fue.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){a.push({key:{status:"valid",value:t},value:e._parse(new ide(n,n.data[t],n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>que.mergeObjectSync(t,e))):que.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new Gde({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,o,i,a;const s=null!==(i=null===(o=(r=this._def).errorMap)||void 0===o?void 0:o.call(r,t,n).message)&&void 0!==i?i:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=tde.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new Gde({...this._def,unknownKeys:"strip"})}passthrough(){return new Gde({...this._def,unknownKeys:"passthrough"})}extend(e){return new Gde({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Gde({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:hpe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Gde({...this._def,catchall:e})}pick(e){const t={};return Pue.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new Gde({...this._def,shape:()=>t})}omit(e){const t={};return Pue.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new Gde({...this._def,shape:()=>t})}deepPartial(){return qde(this)}partial(e){const t={};return Pue.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new Gde({...this._def,shape:()=>t})}required(e){const t={};return Pue.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ape;)e=e._def.innerType;t[n]=e}})),new Gde({...this._def,shape:()=>t})}keyof(){return tpe(Pue.objectKeys(this.shape))}}Gde.create=(e,t)=>new Gde({shape:()=>e,unknownKeys:"strip",catchall:Bde.create(),typeName:hpe.ZodObject,...sde(t)}),Gde.strictCreate=(e,t)=>new Gde({shape:()=>e,unknownKeys:"strict",catchall:Bde.create(),typeName:hpe.ZodObject,...sde(t)}),Gde.lazycreate=(e,t)=>new Gde({shape:e,unknownKeys:"strip",catchall:Bde.create(),typeName:hpe.ZodObject,...sde(t)});class Kde extends lde{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map((e=>new Uue(e.ctx.common.issues)));return Hue(t,{code:Fue.invalid_union,unionErrors:n}),Gue}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},o=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const o=r.map((e=>new Uue(e)));return Hue(t,{code:Fue.invalid_union,unionErrors:o}),Gue}}get options(){return this._def.options}}Kde.create=(e,t)=>new Kde({options:e,typeName:hpe.ZodUnion,...sde(t)});function Wde(e,t){const n=Iue(e),r=Iue(t);if(e===t)return{valid:!0,data:e};if(n===jue.object&&r===jue.object){const n=Pue.objectKeys(t),r=Pue.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=Wde(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===jue.array&&r===jue.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=Wde(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===jue.date&&r===jue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Yde extends lde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Yue(e)||Yue(r))return Gue;const o=Wde(e.value,r.value);return o.valid?((Xue(e)||Xue(r))&&t.dirty(),{status:t.value,value:o.data}):(Hue(n,{code:Fue.invalid_intersection_types}),Gue)};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,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Yde.create=(e,t,n)=>new Yde({left:e,right:t,typeName:hpe.ZodIntersection,...sde(n)});class Xde extends lde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==jue.array)return Hue(n,{code:Fue.invalid_type,expected:jue.array,received:n.parsedType}),Gue;if(n.data.length<this._def.items.length)return Hue(n,{code:Fue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Gue;!this._def.rest&&n.data.length>this._def.items.length&&(Hue(n,{code:Fue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new ide(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>que.mergeArray(t,e))):que.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Xde({...this._def,rest:e})}}Xde.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xde({items:e,typeName:hpe.ZodTuple,rest:null,...sde(t)})};class Qde extends lde{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==jue.map)return Hue(n,{code:Fue.invalid_type,expected:jue.map,received:n.parsedType}),Gue;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new ide(n,e,n.path,[i,"key"])),value:o._parse(new ide(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of i){const r=await n.key,o=await n.value;if("aborted"===r.status||"aborted"===o.status)return Gue;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of i){const r=n.key,o=n.value;if("aborted"===r.status||"aborted"===o.status)return Gue;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}Qde.create=(e,t,n)=>new Qde({valueType:t,keyType:e,typeName:hpe.ZodMap,...sde(n)});class Zde extends lde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==jue.set)return Hue(n,{code:Fue.invalid_type,expected:jue.set,received:n.parsedType}),Gue;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Hue(n,{code:Fue.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(Hue(n,{code:Fue.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const o=this._def.valueType;function i(e){const n=new Set;for(const r of e){if("aborted"===r.status)return Gue;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>o._parse(new ide(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new Zde({...this._def,minSize:{value:e,message:tde.toString(t)}})}max(e,t){return new Zde({...this._def,maxSize:{value:e,message:tde.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Zde.create=(e,t)=>new Zde({valueType:e,minSize:null,maxSize:null,typeName:hpe.ZodSet,...sde(t)});class Jde extends lde{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Jde.create=(e,t)=>new Jde({getter:e,typeName:hpe.ZodLazy,...sde(t)});class epe extends lde{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Hue(t,{received:t.data,code:Fue.invalid_literal,expected:this._def.value}),Gue}return{status:"valid",value:e.data}}get value(){return this._def.value}}function tpe(e,t){return new npe({values:e,typeName:hpe.ZodEnum,...sde(t)})}epe.create=(e,t)=>new epe({value:e,typeName:hpe.ZodLiteral,...sde(t)});class npe extends lde{constructor(){super(...arguments),rde.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return Hue(t,{expected:Pue.joinValues(this._def.values),received:t.parsedType,code:Fue.invalid_type}),Gue}if(Jue(this,rde)||ede(this,rde,new Set(this._def.values)),!Jue(this,rde).has(e.data)){const t=this._getOrReturnCtx(e);return Hue(t,{received:t.data,code:Fue.invalid_enum_value,options:this._def.values}),Gue}return Wue(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return npe.create(e,{...this._def,...t})}exclude(e,t=this._def){return npe.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}rde=new WeakMap,npe.create=tpe;class rpe extends lde{constructor(){super(...arguments),ode.set(this,void 0)}_parse(e){const t=Pue.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==jue.string&&n.parsedType!==jue.number){const e=Pue.objectValues(t);return Hue(n,{expected:Pue.joinValues(e),received:n.parsedType,code:Fue.invalid_type}),Gue}if(Jue(this,ode)||ede(this,ode,new Set(Pue.getValidEnumValues(this._def.values))),!Jue(this,ode).has(e.data)){const e=Pue.objectValues(t);return Hue(n,{received:n.data,code:Fue.invalid_enum_value,options:e}),Gue}return Wue(e.data)}get enum(){return this._def.values}}ode=new WeakMap,rpe.create=(e,t)=>new rpe({values:e,typeName:hpe.ZodNativeEnum,...sde(t)});class ope extends lde{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==jue.promise&&!1===t.common.async)return Hue(t,{code:Fue.invalid_type,expected:jue.promise,received:t.parsedType}),Gue;const n=t.parsedType===jue.promise?t.data:Promise.resolve(t.data);return Wue(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ope.create=(e,t)=>new ope({type:e,typeName:hpe.ZodPromise,...sde(t)});class ipe extends lde{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===hpe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:e=>{Hue(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),"preprocess"===r.type){const e=r.transform(n.data,o);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Gue;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?Gue:"dirty"===r.status||"dirty"===t.value?Kue(r.value):r}));{if("aborted"===t.value)return Gue;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?Gue:"dirty"===r.status||"dirty"===t.value?Kue(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,o);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?Gue:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?Gue:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Que(e))return e;const i=r.transform(e.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Que(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}Pue.assertNever(r)}}ipe.create=(e,t,n)=>new ipe({schema:e,typeName:hpe.ZodEffects,effect:t,...sde(n)}),ipe.createWithPreprocess=(e,t,n)=>new ipe({schema:t,effect:{type:"preprocess",transform:e},typeName:hpe.ZodEffects,...sde(n)});class ape extends lde{_parse(e){return this._getType(e)===jue.undefined?Wue(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ape.create=(e,t)=>new ape({innerType:e,typeName:hpe.ZodOptional,...sde(t)});class spe extends lde{_parse(e){return this._getType(e)===jue.null?Wue(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}spe.create=(e,t)=>new spe({innerType:e,typeName:hpe.ZodNullable,...sde(t)});class lpe extends lde{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===jue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}lpe.create=(e,t)=>new lpe({innerType:e,typeName:hpe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...sde(t)});class cpe extends lde{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Zue(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Uue(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Uue(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}cpe.create=(e,t)=>new cpe({innerType:e,typeName:hpe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...sde(t)});class upe extends lde{_parse(e){if(this._getType(e)!==jue.nan){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.nan,received:t.parsedType}),Gue}return{status:"valid",value:e.data}}}upe.create=e=>new upe({typeName:hpe.ZodNaN,...sde(e)});class dpe extends lde{_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.type._parse({data:t.data,path:t.path,parent:t})}unwrap(){return this._def.type}}class ppe extends lde{_parse(e){const{status:t,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?Gue:"dirty"===e.status?(t.dirty(),Kue(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?Gue:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ppe({in:e,out:t,typeName:hpe.ZodPipeline})}}class fpe extends lde{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Que(e)&&(e.value=Object.freeze(e.value)),e);return Zue(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}var hpe,mpe;fpe.create=(e,t)=>new fpe({innerType:e,typeName:hpe.ZodReadonly,...sde(t)}),(mpe=hpe||(hpe={})).ZodString="ZodString",mpe.ZodNumber="ZodNumber",mpe.ZodNaN="ZodNaN",mpe.ZodBigInt="ZodBigInt",mpe.ZodBoolean="ZodBoolean",mpe.ZodDate="ZodDate",mpe.ZodSymbol="ZodSymbol",mpe.ZodUndefined="ZodUndefined",mpe.ZodNull="ZodNull",mpe.ZodAny="ZodAny",mpe.ZodUnknown="ZodUnknown",mpe.ZodNever="ZodNever",mpe.ZodVoid="ZodVoid",mpe.ZodArray="ZodArray",mpe.ZodObject="ZodObject",mpe.ZodUnion="ZodUnion",mpe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",mpe.ZodIntersection="ZodIntersection",mpe.ZodTuple="ZodTuple",mpe.ZodRecord="ZodRecord",mpe.ZodMap="ZodMap",mpe.ZodSet="ZodSet",mpe.ZodFunction="ZodFunction",mpe.ZodLazy="ZodLazy",mpe.ZodLiteral="ZodLiteral",mpe.ZodEnum="ZodEnum",mpe.ZodEffects="ZodEffects",mpe.ZodNativeEnum="ZodNativeEnum",mpe.ZodOptional="ZodOptional",mpe.ZodNullable="ZodNullable",mpe.ZodDefault="ZodDefault",mpe.ZodCatch="ZodCatch",mpe.ZodPromise="ZodPromise",mpe.ZodBranded="ZodBranded",mpe.ZodPipeline="ZodPipeline",mpe.ZodReadonly="ZodReadonly";const gpe=Pde.create,vpe=Gde.create,ype=e=>{const{children:t,...r}=e;return n.createElement(Mce.Provider,{value:r},t)},bpe=i.createContext({}),xpe=({...e})=>t.jsx(bpe.Provider,{value:{name:e.name},children:t.jsx(Bce,{...e})}),wpe=()=>{const e=i.useContext(bpe),t=i.useContext(_pe),{getFieldState:n,formState:r}=Lce(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...o}},_pe=i.createContext({}),Spe=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(_pe.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:Qd("space-y-2",e),...n})})}));Spe.displayName="FormItem";const Epe=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=wpe();return t.jsx(L9,{ref:r,className:Qd(o&&"text-destructive",e),htmlFor:i,...n})}));Epe.displayName="FormLabel";const Tpe=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=wpe();return t.jsx(QU,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));Tpe.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=wpe();return t.jsx("p",{ref:r,id:o,className:Qd("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const Cpe=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=wpe(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:Qd("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));Cpe.displayName="FormMessage";const Ape=vpe({name:gpe().min(2,"Title must be at least 2 characters"),description:gpe()});function Npe({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=iQ(),{toast:i}=Ll(),a=Cue({resolver:Due(Ape),defaultValues:{name:`${o?.name} (copy)`,description:o?.description??""}});return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsx(CB,{children:t.jsx(NB,{children:"Duplicate Automation"})}),t.jsx(ype,{...a,children:t.jsxs("form",{onSubmit:a.handleSubmit((async function(){if(!o)return void i({title:"Error duplicating automation",description:"Please try again"});const{id:e}=await(async e=>(await Re(`${c}`,{method:"POST",body:JSON.stringify({duplicate:!0,source_id:e})})).data)(o.id);e?(r?.(e),i({title:"Automation duplicated!",description:"The automation has been duplicated"}),n(!1)):i({title:"Error duplicating automation",description:"Please try again"})})),className:"space-y-4",children:[t.jsxs("div",{children:["Create a copy of the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),"automation with a new title and description."]}),t.jsx(xpe,{control:a.control,name:"name",disabled:!0,render:({field:e})=>t.jsxs(Spe,{children:[t.jsx(Epe,{children:"Title"}),t.jsx(Tpe,{children:t.jsx(H3,{...e})}),t.jsx(Cpe,{})]})}),t.jsx(xpe,{control:a.control,name:"description",disabled:!0,render:({field:e})=>t.jsxs(Spe,{children:[t.jsx(Epe,{children:"Description"}),t.jsx(Tpe,{children:t.jsx(zte,{...e})}),t.jsx(Cpe,{})]})}),t.jsx(AB,{children:t.jsx(gQ,{type:"submit",children:"Duplicate"})})]})})]})})}const Rpe=vpe({name:gpe().min(2,"Title must be at least 2 characters"),description:gpe()});function Ope({open:e,onOpenChange:n}){const r=iQ(),{updateAutomation:o}=De(r?.id||""),i=Cue({resolver:Due(Rpe),defaultValues:{name:r?.name??"",description:r?.description??""}});return r?t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsxs(CB,{children:[t.jsx(NB,{children:"Edit Automation"}),t.jsx(RB,{children:"Update the title and description of your automation."})]}),t.jsx(ype,{...i,children:t.jsxs("form",{onSubmit:i.handleSubmit((function(e){o({name:e.name,description:e.description}),n(!1)})),className:"space-y-4",children:[t.jsx(xpe,{control:i.control,name:"name",render:({field:e})=>t.jsxs(Spe,{children:[t.jsx(Epe,{children:"Title"}),t.jsx(Tpe,{children:t.jsx(H3,{...e})}),t.jsx(Cpe,{})]})}),t.jsx(xpe,{control:i.control,name:"description",render:({field:e})=>t.jsxs(Spe,{children:[t.jsx(Epe,{children:"Description"}),t.jsx(Tpe,{children:t.jsx(zte,{...e})}),t.jsx(Cpe,{})]})}),t.jsx(AB,{children:t.jsx(gQ,{type:"submit",children:"Save changes"})})]})})]})}):null}function Ppe({open:e,onOpenChange:n,setIsActive:r}){const o=iQ(),{updateAutomation:i}=De(o?.id||""),{toast:a}=Ll();return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsx(CB,{children:t.jsxs(NB,{children:["Deactivate ",ff("engage:automation")]})}),t.jsxs("div",{children:["Are you sure you want to deactivate the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),ff("engage:automation"),"?"]}),t.jsxs(AB,{className:"gap-2 sm:gap-0",children:[t.jsx(gQ,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(gQ,{variant:"destructive",onClick:()=>{i({status:Ve.DRAFT}),n(!1),r(!1),a({title:`Updated ${ff("engage:automation")}`,description:`${ff("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const kpe=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=iQ(),a=H5(),{updateAutomation:s}=De(i?.id||""),{toast:l}=Ll(),c=(()=>{const{state:e}=oQ();return e.recipientStats})(),u=aQ(),[d,p]=n.useState(void 0),[f,h]=n.useState(!1),[m,g]=n.useState(!1),[v,y]=n.useState(!1),[b,x]=n.useState(!1);n.useEffect((()=>{if(i&&void 0===d)switch(i.status){case Ve.ACTIVE:p(!0);break;case Ve.DRAFT:p(!1);break;case Ve.RUNNING:case Ve.COMPLETED:p(!0);break;case Ve.FAILED:case Ve.DEACTIVATED:p(!1);break;default:throw Xte(i.status,Ve)}}),[i,d]);const w=n.useCallback((()=>{if(!i)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});const e=async e=>{if(d&&!e)y(!0);else{if(x(!0),o&&!0===e){let e=0;for(;!c&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!c)return l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),void x(!1);const t=await o({estimatedEmailRecipients:c?.emails??0,estimatedSmsRecipients:c?.phones??0});if(!0!==t)return l({title:"Error while updating the status",description:t,variant:"destructive"}),void x(!1)}switch(i.triggerType){case Fe.ONE_TIME:if(!i.triggerMetadata||!("scheduledAt"in i.triggerMetadata)||!i.triggerMetadata?.scheduledAt)return l({title:"Ensure you have selected a scheduled time",variant:"destructive"}),void x(!1);if(!u||!u.emailChannelSenderId&&!u.smsChannelSenderId)return l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"}),void x(!1);break;case Fe.TRIGGER_BASED:break;default:throw Xte(i.triggerType,Fe)}s({status:e?Ve.ACTIVE:Ve.DEACTIVATED},{onSuccess:()=>{p(e),l({title:`${ff("engage:automation")} 🚀`,description:`${ff("engage:automation")} status updated to ${e?"active":"inactive"} 🚀`}),x(!1)},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),x(!1)}})}};if(!i)return null;let n=!1,r=!0;switch(i.status){case Ve.ACTIVE:case Ve.DRAFT:n=!1;break;case Ve.DEACTIVATED:n=!0,r=!1;break;case Ve.RUNNING:n=!0,r=i.triggerType===Fe.TRIGGER_BASED;break;case Ve.COMPLETED:case Ve.FAILED:n=!0,r=!1;break;default:throw Xte(i.status,Ve)}return r?t.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[t.jsx(d?pu:xu,{className:"w-4 h-4"}),t.jsx("div",{className:"text-[13px] font-medium",children:d?"Active":"Inactive"}),t.jsx(ile,{checked:d,onCheckedChange:e,disabled:n})]}):t.jsx(PQ,{variant:l9(i.status),children:J6[i.status]})}),[i,d,l,o,s,c,u]);return i&&void 0!==d?t.jsxs("header",{className:"flex px-1 pt-1",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[e&&t.jsx(gQ,{variant:"ghost",size:"icon",onClick:()=>a(-1),children:t.jsx(lu,{})}),t.jsx("div",{className:"flex flex-col gap-1",children:t.jsx("h1",{className:"text-lg leading-none",children:i.name})})]}),t.jsxs("div",{className:"ml-auto flex gap-4 items-center",children:[t.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:i.triggerType===Fe.ONE_TIME&&t.jsxs(t.Fragment,{children:[t.jsx("div",{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:()=>h(!0),children:t.jsx(E9,{title:"Edit",Icon:xQ.EditIcon,asChild:!1})}),t.jsx("div",{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:()=>g(!0),children:t.jsx(E9,{title:"Duplicate",Icon:xQ.DuplicateIcon,asChild:!1})})]})}),b?t.jsx("div",{className:"flex items-center text-muted-foreground pr-8",children:t.jsx(fQ,{})}):w()]}),t.jsx(Ope,{open:f,onOpenChange:h}),t.jsx(Npe,{open:m,onOpenChange:g,onDuplicationCreated:r}),t.jsx(Ppe,{open:v,onOpenChange:y,setIsActive:p})]}):null},Mpe=()=>{const e=iQ(),{isLoading:n}=je(e?.id);return!e||n?t.jsx(fQ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(zle,{automationId:e.id,automation:e,includeSales:!0})})},Lpe=()=>{const e=iQ(),{recipients:n,isLoading:r,fetchError:o}=Me(e?.id??""),i=[{accessorFn:e=>`${e.firstName||""} ${e.lastName||""}`.trim(),id:"name",header:"Name",cell:({row:e})=>{const n=`${e.original.firstName||""} ${e.original.lastName||""}`.trim();return n||t.jsx("span",{className:"text-gray-400",children:"Not provided"})}},{accessorKey:"email",header:"Email",cell:({row:e})=>e.original.email||t.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"phone",header:"Phone",cell:({row:e})=>e.original.phone||t.jsx("span",{className:"text-gray-400",children:"Not provided"})}];return e&&!r&&n?o?t.jsxs("div",{children:["Error: ",o.message]}):n&&0!==n.recipients.length?t.jsx("div",{className:"h-full p-4",children:t.jsx(G3,{data:n.recipients,columns:i,paginationMode:"standard",initialPageSize:10,isLoading:r})}):t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[t.jsx("div",{className:"mb-4",children:t.jsx(xQ.UserIcon,{className:"h-12 w-12 text-gray-400"})}),t.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Recipients Found"}),t.jsxs("p",{className:"text-gray-500",children:["This ",ff("engage:automation")," currently has no assigned recipients. Please update the include or exclude"," ",ff("engage:segment",{count:2})," to add recipients."]})]}):t.jsx(fQ,{text:["Fetching Recipients","Finishing up"]})},Dpe=n.createContext(null);Dpe.displayName="PanelGroupContext";const jpe="data-panel-group",Ipe="data-panel-group-direction",Fpe="data-panel-group-id",Upe="data-panel",$pe="data-panel-collapsible",Vpe="data-panel-id",Bpe="data-panel-size",zpe="data-resize-handle",Hpe="data-resize-handle-active",qpe="data-panel-resize-handle-enabled",Gpe="data-panel-resize-handle-id",Kpe="data-resize-handle-state",Wpe=n.useLayoutEffect,Ype=i["useId".toString()],Xpe="function"==typeof Ype?Ype:()=>null;let Qpe=0;function Zpe(e=null){const t=Xpe(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+Qpe++),null!=e?e:r.current}function Jpe({children:e,className:t="",collapsedSize:r,collapsible:o,defaultSize:i,forwardedRef:a,id:s,maxSize:l,minSize:c,onCollapse:u,onExpand:d,onResize:p,order:f,style:h,tagName:m="div",...g}){const v=n.useContext(Dpe);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:b,getPanelSize:x,getPanelStyle:w,groupId:_,isPanelCollapsed:S,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:C,unregisterPanel:A}=v,N=Zpe(s),R=n.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:r,collapsible:o,defaultSize:i,maxSize:l,minSize:c},id:N,idIsFromProps:void 0!==s,order:f});n.useRef({didLogMissingDefaultSizeWarning:!1}),Wpe((()=>{const{callbacks:e,constraints:t}=R.current,n={...t};R.current.id=N,R.current.idIsFromProps=void 0!==s,R.current.order=f,e.onCollapse=u,e.onExpand=d,e.onResize=p,t.collapsedSize=r,t.collapsible=o,t.defaultSize=i,t.maxSize=l,t.minSize=c,n.collapsedSize===t.collapsedSize&&n.collapsible===t.collapsible&&n.maxSize===t.maxSize&&n.minSize===t.minSize||E(R.current,n)})),Wpe((()=>{const e=R.current;return T(e),()=>{A(e)}}),[f,N,T,A]),n.useImperativeHandle(a,(()=>({collapse:()=>{y(R.current)},expand:e=>{b(R.current,e)},getId:()=>N,getSize:()=>x(R.current),isCollapsed:()=>S(R.current),isExpanded:()=>!S(R.current),resize:e=>{C(R.current,e)}})),[y,b,x,S,N,C]);const O=w(R.current,i);return n.createElement(m,{...g,children:e,className:t,id:N,style:{...O,...h},[Fpe]:_,[Upe]:"",[$pe]:o||void 0,[Vpe]:N,[Bpe]:parseFloat(""+O.flexGrow).toFixed(1)})}const efe=n.forwardRef(((e,t)=>n.createElement(Jpe,{...e,forwardedRef:t})));Jpe.displayName="Panel",efe.displayName="forwardRef(Panel)";let tfe=null,nfe=-1,rfe=null;function ofe(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&vfe),n=!!(t&yfe);if(t&mfe)return e?"se-resize":n?"ne-resize":"e-resize";if(t&gfe)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,t);if(tfe!==o){var i;if(tfe=o,null===rfe&&(rfe=document.createElement("style"),document.head.appendChild(rfe)),nfe>=0)null===(i=rfe.sheet)||void 0===i||i.removeRule(nfe);nfe=null!==(n=null===(r=rfe.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function ife(e){return"keydown"===e.type}function afe(e){return e.type.startsWith("pointer")}function sfe(e){return e.type.startsWith("mouse")}function lfe(e){if(afe(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(sfe(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const cfe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ufe(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=hfe(e))&&void 0!==t?t:e).display;return"flex"===n||"inline-flex"===n}(e))||(+t.opacity<1||("transform"in t&&"none"!==t.transform||("webkitTransform"in t&&"none"!==t.webkitTransform||("mixBlendMode"in t&&"normal"!==t.mixBlendMode||("filter"in t&&"none"!==t.filter||("webkitFilter"in t&&"none"!==t.webkitFilter||("isolation"in t&&"isolate"===t.isolation||(!!cfe.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function dfe(e){let t=e.length;for(;t--;){const n=e[t];if(Dfe(n,"Missing node"),ufe(n))return n}return null}function pfe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ffe(e){const t=[];for(;e;)t.push(e),e=hfe(e);return t}function hfe(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const mfe=1,gfe=2,vfe=4,yfe=8,bfe="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let xfe=[],wfe=!1,_fe=new Map,Sfe=new Map;const Efe=new Set;function Tfe(e){const{target:t}=e,{x:n,y:r}=lfe(e);wfe=!0,Rfe({target:t,x:n,y:r}),Mfe(),xfe.length>0&&(Lfe("down",e),e.preventDefault(),Nfe(t)||e.stopImmediatePropagation())}function Cfe(e){const{x:t,y:n}=lfe(e);if(wfe&&0===e.buttons&&(wfe=!1,Lfe("up",e)),!wfe){const{target:r}=e;Rfe({target:r,x:t,y:n})}Lfe("move",e),Pfe(),xfe.length>0&&e.preventDefault()}function Afe(e){const{target:t}=e,{x:n,y:r}=lfe(e);Sfe.clear(),wfe=!1,xfe.length>0&&(e.preventDefault(),Nfe(t)||e.stopImmediatePropagation()),Lfe("up",e),Rfe({target:t,x:n,y:r}),Pfe(),Mfe()}function Nfe(e){let t=e;for(;t;){if(t.hasAttribute(zpe))return!0;t=t.parentElement}return!1}function Rfe({target:e,x:t,y:n}){xfe.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Efe.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=bfe?i.coarse:i.fine;if(t>=l-d&&t<=c+d&&n>=u-d&&n<=s+d){if(null!==r&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&function(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:ffe(e),b:ffe(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Dfe(r,"Stacking order can only be calculated for elements with a common ancestor");const o=pfe(dfe(n.a)),i=pfe(dfe(n.b));if(o===i){const e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)};let o=e.length;for(;o--;){const n=e[o];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(o-i)}(r,o)>0){let e=r,t=!1;for(;e&&!e.contains(o);){if((p=e.getBoundingClientRect()).x<(f=a).x+f.width&&p.x+p.width>f.x&&p.y<f.y+f.height&&p.y+p.height>f.y){t=!0;break}e=e.parentElement}if(t)return}xfe.push(e)}var p,f}))}function Ofe(e,t){Sfe.set(e,t)}function Pfe(){let e=!1,t=!1;xfe.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;Sfe.forEach((e=>{n|=e})),e&&t?ofe("intersection",n):e?ofe("horizontal",n):t?ofe("vertical",n):null!==rfe&&(document.head.removeChild(rfe),tfe=null,rfe=null,nfe=-1)}let kfe=new AbortController;function Mfe(){kfe.abort(),kfe=new AbortController;const e={capture:!0,signal:kfe.signal};Efe.size&&(wfe?(xfe.length>0&&_fe.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",Afe,e),r.addEventListener("pointerleave",Cfe,e),r.addEventListener("pointermove",Cfe,e))})),_fe.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",Afe,e),r.addEventListener("pointercancel",Afe,e)}))):_fe.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",Tfe,e),r.addEventListener("pointermove",Cfe,e))})))}function Lfe(e,t){Efe.forEach((n=>{const{setResizeHandlerState:r}=n,o=xfe.includes(n);r(e,o,t)}))}function Dfe(e,t){if(!e)throw Error(t)}function jfe(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Ife(e,t,n=10){return 0===jfe(e,t,n)}function Ffe(e,t,n){return 0===jfe(e,t,n)}function Ufe({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Dfe(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(jfe(n,s)<0)if(i){n=jfe(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function $fe({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Ffe(e,0))return t;const a=[...t],[s,l]=r;Dfe(null!=s,"Invalid first pivot index"),Dfe(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];Dfe(o,`Panel constraints not found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:c=0}=o;if(a){const n=t[r];if(Dfe(null!=n,`Previous layout not found for panel index ${r}`),Ffe(n,i)){const t=c-n;jfe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];Dfe(o,`No panel constraints found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:c=0}=o;if(a){const n=t[r];if(Dfe(null!=n,`Previous layout not found for panel index ${r}`),Ffe(n,c)){const t=n-i;jfe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{const r=e<0?1:-1;let o=e<0?l:s,i=0;for(;;){const e=t[o];Dfe(null!=e,`Previous layout not found for panel index ${o}`);if(i+=Ufe({panelConstraints:n,panelIndex:o,size:100})-e,o+=r,o<0||o>=n.length)break}const a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let r=e<0?s:l;for(;r>=0&&r<n.length;){const o=Math.abs(e)-Math.abs(c),i=t[r];Dfe(null!=i,`Previous layout not found for panel index ${r}`);const s=Ufe({panelConstraints:n,panelIndex:r,size:i-o});if(!Ffe(i,s)&&(c+=i-s,a[r]=s,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(function(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Ffe(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];Dfe(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=Ufe({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!Ffe(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];Dfe(null!=o,`Previous layout not found for panel index ${r}`);const i=Ufe({panelConstraints:n,panelIndex:r,size:o+t});if(Ffe(o,i)||(t-=i-o,a[r]=i),Ffe(t,0))break;e>0?r--:r++}}}return Ffe(a.reduce(((e,t)=>t+e),0),100)?a:o}function Vfe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];Dfe(null!=s,"No pivot index found"),t.forEach(((e,t)=>{const{constraints:n}=e,{maxSize:l=100,minSize:c=0}=n;t===s?(r=c,o=l):(i+=c,a+=l)}));return{valueMax:Math.min(o,100-i),valueMin:Math.max(r,100-a),valueNow:e[s]}}function Bfe(e,t=document){return Array.from(t.querySelectorAll(`[${Gpe}][data-panel-group-id="${e}"]`))}function zfe(e,t,n=document){const r=Bfe(e,n).findIndex((e=>e.getAttribute(Gpe)===t));return null!=r?r:null}function Hfe(e,t,n){const r=zfe(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function qfe(e,t=document){var n;if(t instanceof HTMLElement&&(null==t||null===(n=t.dataset)||void 0===n?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function Gfe(e,t=document){const n=t.querySelector(`[${Gpe}="${e}"]`);return n||null}function Kfe({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),Wpe((()=>{if(!a)return;const e=Bfe(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=Vfe({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];Dfe(e,`No panel data found for index "${t}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(n)),s.setAttribute("aria-valuemin",""+Math.round(r)),s.setAttribute("aria-valuenow",null!=a?""+Math.round(a):"")}}return()=>{e.forEach(((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[r,o,i,a]),n.useEffect((()=>{if(!a)return;const e=t.current;Dfe(e,"Eager values not found");const{panelDataArray:n}=e;Dfe(null!=qfe(r,a),`No group found for id "${r}"`);const i=Bfe(r,a);Dfe(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(Gpe);Dfe(t,"Resize handle element has no handle id attribute");const[i,l]=function(e,t,n,r=document){var o,i,a,s;const l=Gfe(t,r),c=Bfe(e,r),u=l?c.indexOf(l):-1;return[null!==(o=null===(i=n[u])||void 0===i?void 0:i.id)&&void 0!==o?o:null,null!==(a=null===(s=n[u+1])||void 0===s?void 0:s.id)&&void 0!==a?a:null]}(r,t,n,a);if(null==i||null==l)return()=>{};const c=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=n.findIndex((e=>e.id===i));if(l>=0){const e=n[l];Dfe(e,`No panel data found for index ${l}`);const i=o[l],{collapsedSize:c=0,collapsible:u,minSize:d=0}=e.constraints;if(null!=i&&u){const e=$fe({delta:Ffe(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:Hfe(r,t,a),prevLayout:o,trigger:"keyboard"});o!==e&&s(e)}}break}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}));return()=>{l.forEach((e=>e()))}}),[a,e,t,r,o,i,s])}function Wfe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Yfe(e,t){const n="horizontal"===e,{x:r,y:o}=lfe(t);return n?r:o}function Xfe(e,t,n,r,o,i){if(ife(e)){const t="horizontal"===n;let r=0;r=e.shiftKey?100:null!=o?o:10;let i=0;switch(e.key){case"ArrowDown":i=t?0:r;break;case"ArrowLeft":i=t?-r:0;break;case"ArrowRight":i=t?r:0;break;case"ArrowUp":i=t?0:-r;break;case"End":i=100;break;case"Home":i=-100}return i}return null==r?0:function(e,t,n,r,o){const i="horizontal"===n,a=Gfe(t,o);Dfe(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(Fpe);Dfe(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Yfe(n,e),u=qfe(s,o);Dfe(u,`No group element found for id "${s}"`);const d=u.getBoundingClientRect();return(c-l)/(i?d.width:d.height)*100}(e,t,n,r,i)}function Qfe(e,t,n){t.forEach(((t,r)=>{const o=e[r];Dfe(o,`Panel data not found for index ${r}`);const{callbacks:i,constraints:a,id:s}=o,{collapsedSize:l=0,collapsible:c}=a,u=n[s];if(null==u||t!==u){n[s]=t;const{onCollapse:e,onExpand:r,onResize:o}=i;o&&o(t,u),c&&(e||r)&&(!r||null!=u&&!Ife(u,l)||Ife(t,l)||r(),!e||null!=u&&Ife(u,l)||!Ife(t,l)||e())}}))}function Zfe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Jfe(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)}}catch(t){e.getItem=()=>null,e.setItem=()=>{}}}function ehe(e){return`react-resizable-panels:${e}`}function the(e){return e.map((e=>{const{constraints:t,id:n,idIsFromProps:r,order:o}=e;return r?n:o?`${o}:${JSON.stringify(t)}`:JSON.stringify(t)})).sort(((e,t)=>e.localeCompare(t))).join(",")}function nhe(e,t){try{const n=ehe(e),r=t.getItem(n);if(r){const e=JSON.parse(r);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function rhe(e,t,n,r,o){var i;const a=ehe(e),s=the(t),l=null!==(i=nhe(e,o))&&void 0!==i?i:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(a,JSON.stringify(l))}catch(c){}}function ohe({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce(((e,t)=>e+t),0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!Ffe(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];Dfe(null!=e,`No layout data found for index ${i}`);n[i]=100/r*e}let o=0;for(let i=0;i<t.length;i++){const e=n[i];Dfe(null!=e,`No layout data found for index ${i}`);const r=Ufe({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!Ffe(o,0))for(let i=0;i<t.length;i++){const e=n[i];Dfe(null!=e,`No layout data found for index ${i}`);const r=Ufe({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,Ffe(o,0)))break}return n}const ihe={getItem:e=>(Jfe(ihe),ihe.getItem(e)),setItem:(e,t)=>{Jfe(ihe),ihe.setItem(e,t)}},ahe={};function she({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=ihe,style:u,tagName:d="div",...p}){const f=Zpe(a),h=n.useRef(null),[m,g]=n.useState(null),[v,y]=n.useState([]),b=function(){const[e,t]=n.useState(0);return n.useCallback((()=>t((e=>e+1))),[])}(),x=n.useRef({}),w=n.useRef(new Map),_=n.useRef(0),S=n.useRef({autoSaveId:e,direction:o,dragState:m,id:f,keyboardResizeBy:l,onLayout:s,storage:c}),E=n.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});n.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),n.useImperativeHandle(i,(()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:e}=E.current;return e},setLayout:e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current,o=ohe({layout:e,panelConstraints:r.map((e=>e.constraints))});Wfe(n,o)||(y(o),E.current.layout=o,t&&t(o),Qfe(r,o,x.current))}})),[]),Wpe((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),Kfe({committedValuesRef:S,eagerValuesRef:E,groupId:f,layout:v,panelDataArray:E.current.panelDataArray,setLayout:y,panelGroupElement:h.current}),n.useEffect((()=>{const{panelDataArray:t}=E.current;if(e){if(0===v.length||v.length!==t.length)return;let n=ahe[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(rhe,100),ahe[e]=n);const r=[...t],o=new Map(w.current);n(e,r,o,v,c)}}),[e,v,c]),n.useEffect((()=>{}));const T=n.useCallback((e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current;if(e.constraints.collapsible){const o=r.map((e=>e.constraints)),{collapsedSize:i=0,panelSize:a,pivotIndices:s}=uhe(r,e,n);if(Dfe(null!=a,`Panel size not found for panel "${e.id}"`),!Ife(a,i)){w.current.set(e.id,a);const l=$fe({delta:che(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Zfe(n,l)||(y(l),E.current.layout=l,t&&t(l),Qfe(r,l,x.current))}}}),[]),C=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current;if(e.constraints.collapsible){const i=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s=0,minSize:l=0,pivotIndices:c}=uhe(o,e,r),u=null!=t?t:l;if(Ife(s,a)){const t=w.current.get(e.id),a=null!=t&&t>=u?t:u,l=$fe({delta:che(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});Zfe(r,l)||(y(l),E.current.layout=l,n&&n(l),Qfe(o,l,x.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=uhe(n,e,t);return Dfe(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),N=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=che(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const a=n[o];let s;return s=null==a?null!=e?e.toPrecision(i):"1":1===r.length?"1":a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:v,panelData:n,panelIndex:r})}),[m,v]),R=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=uhe(n,e,t);return Dfe(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&Ife(i,r)}),[]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=uhe(n,e,t);return Dfe(null!=i,`Panel size not found for panel "${e.id}"`),!o||jfe(i,r)>0}),[]),P=n.useCallback((e=>{const{panelDataArray:t}=E.current;t.push(e),t.sort(((e,t)=>{const n=e.order,r=t.order;return null==n&&null==r?0:null==n?-1:null==r?1:n-r})),E.current.panelDataArrayChanged=!0,b()}),[b]);Wpe((()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:t,storage:n}=S.current,{layout:r,panelDataArray:o}=E.current;let i=null;if(e){const t=function(e,t,n){var r,o;return null!==(o=(null!==(r=nhe(e,n))&&void 0!==r?r:{})[the(t)])&&void 0!==o?o:null}(e,o,n);t&&(w.current=new Map(Object.entries(t.expandToSizes)),i=t.layout)}null==i&&(i=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let r=0,o=100;for(let i=0;i<e.length;i++){const e=n[i];Dfe(e,`Panel constraints not found for index ${i}`);const{defaultSize:a}=e;null!=a&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const a=n[i];Dfe(a,`Panel constraints not found for index ${i}`);const{defaultSize:s}=a;if(null!=s)continue;const l=o/(e.length-r);r++,t[i]=l,o-=l}return t}({panelDataArray:o}));const a=ohe({layout:i,panelConstraints:o.map((e=>e.constraints))});Wfe(r,a)||(y(a),E.current.layout=a,t&&t(a),Qfe(o,a,x.current))}})),Wpe((()=>{const e=E.current;return()=>{e.layout=[]}}),[]);const k=n.useCallback((e=>{let t=!1;const n=h.current;if(n){"rtl"===window.getComputedStyle(n,null).getPropertyValue("direction")&&(t=!0)}return function(n){n.preventDefault();const r=h.current;if(!r)return()=>null;const{direction:o,dragState:i,id:a,keyboardResizeBy:s,onLayout:l}=S.current,{layout:c,panelDataArray:u}=E.current,{initialLayout:d}=null!=i?i:{},p=Hfe(a,e,r);let f=Xfe(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=$fe({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:ife(n)?"keyboard":"mouse-or-touch"}),v=!Zfe(c,g);(afe(n)||sfe(n))&&_.current!=f&&(_.current=f,Ofe(e,v||0===f?0:m?f<0?mfe:gfe:f<0?vfe:yfe)),v&&(y(g),E.current.layout=g,l&&l(g),Qfe(u,g,x.current))}}),[]),M=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current,i=o.map((e=>e.constraints)),{panelSize:a,pivotIndices:s}=uhe(o,e,r);Dfe(null!=a,`Panel size not found for panel "${e.id}"`);const l=$fe({delta:che(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});Zfe(r,l)||(y(l),E.current.layout=l,n&&n(l),Qfe(o,l,x.current))}),[]),L=n.useCallback(((e,t)=>{const{layout:n,panelDataArray:r}=E.current,{collapsedSize:o=0,collapsible:i}=t,{collapsedSize:a=0,collapsible:s,maxSize:l=100,minSize:c=0}=e.constraints,{panelSize:u}=uhe(r,e,n);null!=u&&(i&&s&&Ife(u,o)?Ife(o,a)||M(e,a):u<c?M(e,c):u>l&&M(e,l))}),[M]),D=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=Gfe(e,h.current);Dfe(o,`Drag handle element not found for id "${e}"`);const i=Yfe(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),j=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=che(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],E.current.panelDataArrayChanged=!0,b())}),[b]),F=n.useMemo((()=>({collapsePanel:T,direction:o,dragState:m,expandPanel:C,getPanelSize:A,getPanelStyle:N,groupId:f,isPanelCollapsed:R,isPanelExpanded:O,reevaluatePanelConstraints:L,registerPanel:P,registerResizeHandle:k,resizePanel:M,startDragging:D,stopDragging:j,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,N,f,R,O,L,P,k,M,D,j,I]);return n.createElement(Dpe.Provider,{value:F},n.createElement(d,{...p,children:t,className:r,id:a,ref:h,style:{...{display:"flex",flexDirection:"horizontal"===o?"row":"column",height:"100%",overflow:"hidden",width:"100%"},...u},[jpe]:"",[Ipe]:o,[Fpe]:f}))}const lhe=n.forwardRef(((e,t)=>n.createElement(she,{...e,forwardedRef:t})));function che(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function uhe(e,t,n){const r=che(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function dhe({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:o,id:i,onBlur:a,onClick:s,onDragging:l,onFocus:c,onPointerDown:u,onPointerUp:d,style:p={},tabIndex:f=0,tagName:h="div",...m}){var g,v;const y=n.useRef(null),b=n.useRef({onClick:s,onDragging:l,onPointerDown:u,onPointerUp:d});n.useEffect((()=>{b.current.onClick=s,b.current.onDragging=l,b.current.onPointerDown=u,b.current.onPointerUp=d}));const x=n.useContext(Dpe);if(null===x)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:w,groupId:_,registerResizeHandle:S,startDragging:E,stopDragging:T,panelGroupElement:C}=x,A=Zpe(i),[N,R]=n.useState("inactive"),[O,P]=n.useState(!1),[k,M]=n.useState(null),L=n.useRef({state:N});Wpe((()=>{L.current.state=N})),n.useEffect((()=>{if(r)M(null);else{const e=S(A);M((()=>e))}}),[r,A,S]);const D=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,j=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;Dfe(e,"Element ref not attached");let t=!1;return function(e,t,n,r,o){var i;const{ownerDocument:a}=t,s={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=null!==(i=_fe.get(a))&&void 0!==i?i:0;return _fe.set(a,l+1),Efe.add(s),Mfe(),function(){var t;Sfe.delete(e),Efe.delete(s);const n=null!==(t=_fe.get(a))&&void 0!==t?t:1;if(_fe.set(a,n-1),Mfe(),1===n&&_fe.delete(a),xfe.includes(s)){const e=xfe.indexOf(s);e>=0&&xfe.splice(e,1),Pfe(),o("up",!0,null)}}}(A,e,w,{coarse:D,fine:j},((e,n,r)=>{if(n)switch(e){case"down":{R("drag"),t=!1,Dfe(r,'Expected event to be defined for "down" action'),E(A,r);const{onDragging:e,onPointerDown:n}=b.current;null==e||e(!0),null==n||n();break}case"move":{const{state:e}=L.current;t=!0,"drag"!==e&&R("hover"),Dfe(r,'Expected event to be defined for "move" action'),k(r);break}case"up":{R("hover"),T();const{onClick:e,onDragging:n,onPointerUp:r}=b.current;null==n||n(!1),null==r||r(),t||null==e||e();break}}else R("inactive")}))}),[D,w,r,j,S,A,k,E,T]),function({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:o}){n.useEffect((()=>{if(e||null==r||null==o)return;const n=Gfe(t,o);if(null==n)return;const i=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),r(e);break;case"F6":{e.preventDefault();const r=n.getAttribute(Fpe);Dfe(r,`No group element found for id "${r}"`);const i=Bfe(r,o),a=zfe(r,t,o);Dfe(null!==a,`No resize element found for id "${t}"`),i[e.shiftKey?a>0?a-1:i.length-1:a+1<i.length?a+1:0].focus();break}}};return n.addEventListener("keydown",i),()=>{n.removeEventListener("keydown",i)}}),[o,e,t,r])}({disabled:r,handleId:A,resizeHandler:k,panelGroupElement:C});return n.createElement(h,{...m,children:e,className:t,id:i,onBlur:()=>{P(!1),null==a||a()},onFocus:()=>{P(!0),null==c||c()},ref:y,role:"separator",style:{touchAction:"none",userSelect:"none",...p},tabIndex:f,[Ipe]:w,[Fpe]:_,[zpe]:"",[Hpe]:"drag"===N?"pointer":O?"keyboard":void 0,[qpe]:!r,[Gpe]:A,[Kpe]:N})}she.displayName="PanelGroup",lhe.displayName="forwardRef(PanelGroup)",dhe.displayName="PanelResizeHandle";const phe=({className:e,...n})=>t.jsx(lhe,{className:wB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),fhe=efe,hhe=({withHandle:e,className:n,...r})=>t.jsx(dhe,{className:wB("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",n),...r,children:e&&t.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsx(Eu,{className:"h-2.5 w-2.5"})})});var mhe=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(mhe||{});const ghe=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),vhe="rgba(245, 246, 247, 1)",yhe={[$e.SEND_COMMUNICATION]:{color:{bg:"rgba(205, 241, 225, 1)",text:"rgba(30, 108, 74, 1)",bgUnselected:vhe},clickable:!0},[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:vhe},clickable:!1}},bhe={[$e.SEND_COMMUNICATION]:"Send Email & SMS",[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},xhe=({children:e,onClick:n,iconBgColor:r,iconStrokeColor:o,Icon:i,disabled:a=!1,selected:s=!1})=>{const l=i;return t.jsxs(AX.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?r:vhe},onClick:n,className:Qd("flex gap-2 items-center rounded-md transition-colors group","p-2 border-2 border-transparent overflow-hidden",!a&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:[t.jsx("div",{className:Qd("bg-purple-50 rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 transition-colors",!a&&"group-hover/trigger-audience:bg-background",r),children:t.jsx(l,{className:Qd("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})},whe=({segmentName:e})=>t.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}),_he=()=>{const e=iQ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=QX(),u=n.useCallback((()=>c?.find((e=>e.type===nQ.ALL_USERS))),[c]);return n.useEffect((()=>{e&&c&&(null===i&&null===s?(a(e?.includeSegmentIds||null),l(e?.excludeSegmentIds||null),0===e.includeSegmentIds.length&&0===e.excludeSegmentIds.length&&(a([u()?.id||""]),l([]))):(JSON.stringify(e.includeSegmentIds)!==JSON.stringify(i)&&a(e.includeSegmentIds),JSON.stringify(e.excludeSegmentIds)!==JSON.stringify(s)&&l(e.excludeSegmentIds)))}),[e,s,i,c,u]),e&&i&&s?t.jsx(t.Fragment,{children:t.jsx(xhe,{selected:o===mhe.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(mhe.EditAudience)},Icon:xQ.AudienceIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Tre,{children:"Audience"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(ghe,{copyText:`Send to all ${ff("engage:user",{count:2})} in ${1===i.length?"this":"these"} ${ff("engage:segment",{count:i.length}).toLowerCase()}`}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:i.map((e=>{const n=c?.find((t=>t.id===e));return n?t.jsx(whe,{segmentName:n.name},e):null}))})]})]})})}):null},She=()=>{const e=iQ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),{segments:i}=QX(),a=ff(e?.triggerType===Fe.TRIGGER_BASED?"engage:automation":"engage:one_time"),s=`Start this ${a?.toLowerCase()}`;if(!e||!i)return null;return t.jsx(t.Fragment,{children:(()=>{switch(e.triggerType){case Fe.TRIGGER_BASED:{if(e.triggerMetadata.triggerType!==Fe.TRIGGER_BASED||e.triggerMetadata.eventName!==Ue.USER_ENTERS_SEGMENT||!e.triggerMetadata.eventFilter.segment_id)return null;const n=e.triggerMetadata.eventFilter.segment_id,r=i.find((e=>e.id===n))?.name;return r?t.jsx(xhe,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:xQ.TriggerIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Tre,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(ghe,{copyText:`When ${ff("engage:user").toLowerCase()} joins the`}),t.jsx(whe,{segmentName:r})]})]})}):null}case Fe.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(xhe,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(mhe.EditTime)},selected:o===mhe.EditTime,Icon:xQ.TriggerIcon,children:[t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Tre,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(ghe,n?{copyText:`Click to set the date and time for this ${ff("engage:one_time")}`}:{copyText:"Bulk send at"}),!1===n&&"scheduledAt"in e.triggerMetadata&&e.triggerMetadata.scheduledAt&&t.jsx("div",{className:"text-xs font-medium",children:t.jsx(whe,{segmentName:r9(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),t.jsx("div",{className:"",children:n&&t.jsx(S9,{className:"group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors"})})]})}default:throw Xte(e.triggerType,Fe)}})()})},Ehe=e=>{switch(e){case $e.SEND_COMMUNICATION:return"Send Communication";case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw DX(e,$e)}},The=e=>{switch(e){case $e.SEND_COMMUNICATION:return t.jsx(xQ.CommunicationIcon,{className:"w-4 h-4"});case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(xQ.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw Xte(e,$e)}},Che=e=>{if(!(e&&e.actionType===$e.WAIT_UNTIL_NEXT_FIXED_TIME&&"hour"in e&&"minute"in e&&"timezone"in e))return null;const{hour:t,minute:n,timezone:r}=e;return`Wait until next ${`${t?.toString().padStart(2,"0")}:${n?.toString().padStart(2,"0")}`} ${r}`},Ahe=({actionDataWithMetadata:e})=>{const{actionData:r,communicationGroup:o}=e,{state:{selectedActionId:i},setActionId:a,setSelectedCommunicationGroupId:s}=n.useContext(VX),l=n.useMemo((()=>i===r.actionMetadata.currentActionId),[i,r.actionMetadata.currentActionId]),c=yhe[r.actionType],u=c.color,d=c.clickable;return t.jsx(AX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:Qd("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",l&&"border-primary",r.actionType!==$e.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:l?u.bg:u.bgUnselected??vhe},onClick:()=>{d&&(a(r.actionMetadata.currentActionId),r.actionType===$e.SEND_COMMUNICATION&&s(r.actionMetadata.communicationGroupId))},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white",children:The(r.actionType)}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{style:{color:l?u.text:u.textUnselected},children:t.jsx(Tre,{children:bhe[r.actionType]})}),t.jsx("div",r.actionType===$e.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:Che(r.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:r.actionType===$e.SEND_COMMUNICATION&&o?.emailSubject?o?.emailSubject:Ehe(r.actionType)})]})]})})},Nhe=()=>{const[e,r]=n.useState(!1),[o,i]=n.useState(void 0),a=iQ(),{setActionId:s,state:{selectedActionId:l}}=n.useContext(VX);if(n.useEffect((()=>{if(!a)return;if(l)return;const e=a.actionData?.find((e=>"send_communication"===e.actionType));e&&s(e.actionMetadata.currentActionId)}),[a,s,l]),n.useEffect((()=>{if(!a)return;(async()=>{const e=[];for(const t of a.actionData??[])switch(t.actionType){case $e.SEND_COMMUNICATION:{const n=await zX(t.actionMetadata.communicationGroupId);e.push({actionData:t,communicationGroup:n});break}case $e.WAIT_UNTIL_NEXT_FIXED_TIME:e.push({actionData:t});break;default:throw DX(t.actionType,$e)}i(e)})()}),[a]),!a||!o)return null;const c=(e=>{const{steps:t,rootActionId:n}=e;if(!t||!n)return t??[];const r=new Map(t.map((e=>[e.actionData.actionMetadata.currentActionId,e]))),o=r.get(n);if(!o)return t;const i=[];let a=o;for(;a;){i.push(a);const e=a.actionData.actionMetadata.nextActionId;if(!e)break;a=r.get(e)}return i})({steps:o,rootActionId:a.triggerMetadata?.triggerType===Fe.TRIGGER_BASED?a.triggerMetadata.rootActionId:void 0}).filter((t=>!!e||"send_communication"===t.actionData.actionType));let u=()=>t.jsx("div",{});(e||a.triggerType===Fe.ONE_TIME)&&(u=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[a.triggerType===Fe.ONE_TIME&&t.jsx(_he,{}),t.jsx(She,{})]}));return t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[a.description?t.jsx("div",{className:"w-full mx-auto rounded-xl bg-neutral-50 dark:bg-neutral-900 shadow-sm px-4 py-3 my-2 border border-neutral-200 dark:border-neutral-800 text-neutral-800 dark:text-neutral-100 text-[15px] font-medium leading-snug tracking-tight justify-start",style:{containerType:"inline-size"},children:a.description}):null,a.triggerType===Fe.TRIGGER_BASED&&t.jsxs("div",{className:"flex gap-2 items-center justify-between",children:[t.jsx("div",{className:"text-[13px] text-muted-foreground",children:"Messages sent in listed order"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("div",{className:"text-[13px] font-medium",children:"Show all details"}),t.jsx(ile,{defaultChecked:e,onCheckedChange:()=>{r(!e)}})]})]}),t.jsx("div",{className:"flex-1 flex flex-col gap-3",children:t.jsxs(zB,{mode:"popLayout",children:[u(),c.map(((e,n)=>t.jsx(AX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,delay:.05*n,ease:"easeInOut"},children:t.jsx(Ahe,{actionDataWithMetadata:e})},e.actionData.actionMetadata?.currentActionId??n)))]})})]})},Rhe=()=>{const e=iQ(),{segments:n}=QX();return t.jsx("div",e&&n?{className:"h-full pt-4 relative",children:t.jsx("div",{className:"absolute inset-0 overflow-y-auto flex flex-col gap-3",children:t.jsx(Nhe,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(fQ,{text:[`Getting details on your ${ff("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},Ohe=()=>{const{state:{selectedActionId:e}}=n.useContext(VX);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(zB,{mode:"wait",children:t.jsx(e===mhe.EditTime?Rse:e===mhe.EditAudience?wle:wre,{})})})},Phe=()=>t.jsxs(phe,{direction:"horizontal",className:"flex-1",children:[t.jsx(fhe,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(Rhe,{})})}),t.jsx(hhe,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(fhe,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(Ohe,{})})})]}),khe=()=>{const[e,r]=n.useState("workflow"),o=[{id:"workflow",label:"Workflow",content:t.jsx(Phe,{})},{id:"recipients",label:"Recipients",content:t.jsx(Lpe,{})},{id:"insights",label:ff("engage:insight",{count:2}),content:t.jsx(Mpe,{})}];return t.jsx("div",{className:"h-full w-full",children:t.jsx(Ple,{tabs:o,activeTab:e,onTabChange:r,tabsLocation:"left"})})},Mhe=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i})=>{const a=iQ(),s=aQ(),{updateCommunicationGroup:l}=GX(),{toast:c}=Ll();return n.useEffect((()=>{if(s&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(s.extraMergeFields)&&l({groupId:s?.id,params:{extraMergeFields:e}},{onError:e=>{c({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[s,i,l,c]),a&&s?t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(kpe,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(khe,{})})]}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(fQ,{text:[`Fetching ${ff("engage:automation").toLowerCase()} data`,"Finishing up"]})})},Lhe=({...e})=>{const n=function(){let{matches:e}=i.useContext(F5),t=e[e.length-1];return t?t.params:{}}(),[r]=A4(),o=e.automationId||n?.automationId||r.get("automationId")||"",a="true"===r.get("showBackButton")||e.showBackButton;return t.jsx(lQ,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(Mhe,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var Dhe=e=>null!=e;var jhe=e=>"function"!=typeof e||e.length?e:e(),Ihe=e=>Array.isArray(e)?e:e?[e]:[];var Fhe=mt;var Uhe,$he=function(e){const[t,n]=at(),r=e?.throw?(e,t)=>{throw n(e instanceof Error?e:new Error(t)),e}:(e,t)=>{n(e instanceof Error?e:new Error(t))},o=e?.api?Array.isArray(e.api)?e.api:[e.api]:[globalThis.localStorage].filter(Boolean),i=e?.prefix?`${e.prefix}.`:"",a=new Map,s=new Proxy({},{get(t,n){let s=a.get(n);s||(s=at(void 0,{equals:!1}),a.set(n,s)),s[0]();const l=o.reduce(((e,t)=>{if(null!==e||!t)return e;try{return t.getItem(`${i}${n}`)}catch(eSe){return r(eSe,`Error reading ${i}${n} from ${t.name}`),null}}),null);return null!==l&&e?.deserializer?e.deserializer(l,n,e.options):l}});return!1!==e?.sync&&ht((()=>{const e=e=>{let t=!1;o.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),t=!0)}catch(eSe){r(eSe,`Error synching api ${n.name} from storage event (${e.key}=${e.newValue})`)}})),t&&e.key&&a.get(e.key)?.[1]()};"addEventListener"in globalThis?(globalThis.addEventListener("storage",e),mt((()=>globalThis.removeEventListener("storage",e)))):(o.forEach((t=>t.addEventListener?.("storage",e))),mt((()=>o.forEach((t=>t.removeEventListener?.("storage",e))))))})),[s,(t,n,s)=>{const l=e?.serializer?e.serializer(n,t,s??e.options):n,c=`${i}${t}`;o.forEach((e=>{try{e.getItem(c)!==l&&e.setItem(c,l)}catch(eSe){r(eSe,`Error setting ${i}${t} to ${l} in ${e.name}`)}}));const u=a.get(t);u&&u[1]()},{clear:()=>o.forEach((e=>{try{e.clear()}catch(eSe){r(eSe,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(eSe){r(eSe,`Error removing ${i}${e} from ${t.name}`)}})),toJSON:()=>{const t={},n=(n,r)=>{if(!t.hasOwnProperty(n)){const o=r&&e?.deserializer?e.deserializer(r,n,e.options):r;o&&(t[n]=o)}};return o.forEach((e=>{if("function"==typeof e.getAll){let t;try{t=e.getAll()}catch(eSe){r(eSe,`Error getting all values from in ${e.name}`)}for(const e of t)n(e,t[e])}else{let o,i=0;try{for(;o=e.key(i++);)t.hasOwnProperty(o)||n(o,e.getItem(o))}catch(eSe){r(eSe,`Error getting all values from ${e.name}`)}}})),t}}]},Vhe=e=>{if(!e)return"";let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const r=e[n];t+=r instanceof Date?`; ${n}=${r.toUTCString()}`:"boolean"==typeof r?`; ${n}`:`; ${n}=${r}`}return t},Bhe=("function"==typeof(Uhe={_cookies:[globalThis.document,"cookie"],getItem:e=>Bhe._cookies[0][Bhe._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=Bhe.getItem(e);Bhe._cookies[0][Bhe._cookies[1]]=`${e}=${t}${Vhe(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:Bhe});window.dispatchEvent(o)},removeItem:e=>{Bhe._cookies[0][Bhe._cookies[1]]=`${e}=deleted${Vhe({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return Bhe._cookies[0][Bhe._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return Bhe._cookies[0][Bhe._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(Uhe.clear=()=>{let e;for(;e=Uhe.key(0);)Uhe.removeItem(e)}),Uhe),zhe=796,Hhe="bottom",qhe="system",Ghe=Object.keys(Nr)[0],Khe=Object.keys(Pr)[0],Whe=xt({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Yhe(){return wt(Whe)}var Xhe=xt(void 0),Qhe=e=>{const[t,n]=at(null),r=()=>{const e=t();null!=e&&(e.close(),n(null))},o=(r,o)=>{if(null!=t())return;const i=window.open("","TSQD-Devtools-Panel",`width=${r},height=${o},popup`);if(!i)throw new Error("Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.");i.document.head.innerHTML="",i.document.body.innerHTML="",function(e=window.document){if(e[un]){for(let t of e[un].keys())e.removeEventListener(t,En);delete e[un]}}(i.document),i.document.title="TanStack Query Devtools",i.document.body.style.margin="0",i.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(Yhe().shadowDOMTarget||document).styleSheets].forEach((e=>{try{const t=[...e.cssRules].map((e=>e.cssText)).join(""),n=document.createElement("style"),r=e.ownerNode;let o="";r&&"id"in r&&(o=r.id),o&&n.setAttribute("id",o),n.textContent=t,i.document.head.appendChild(n)}catch(J_e){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,i.document.head.appendChild(n)}})),fn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],i.document),e.setLocalStore("pip_open","true"),n(i)};ct((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||o(Number(window.innerWidth),Number(e.localStore.height||500))})),ct((()=>{const e=(Yhe().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(Yhe().shadowDOMTarget||n.document).querySelector("#_goober");t&&(t.textContent=e.textContent)}));t.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),mt((()=>{t.disconnect()}))}}));const i=ut((()=>({pipWindow:t(),requestPipWindow:o,closePipWindow:r,disabled:e.disabled??!1})));return $t(Xhe.Provider,{value:i,get children(){return e.children}})},Zhe=()=>ut((()=>{const e=wt(Xhe);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Jhe=xt((()=>"dark"));function eme(){return wt(Jhe)}var tme={"À":"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"},nme=Object.keys(tme).join("|"),rme=new RegExp(nme,"g");var ome=7,ime=6,ame=5,sme=4,lme=3,cme=2,ume=1,dme=0;function pme(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:ume,!n.accessors){const r=fme(e,t,n);return{rankedValue:e,rank:r,accessorIndex:-1,accessorThreshold:n.threshold,passed:r>=n.threshold}}const o=function(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r],i=vme(o),a=mme(e,o);for(let e=0,t=a.length;e<t;e++)n.push({itemValue:a[e],attributes:i})}return n}(e,n.accessors),i={rankedValue:e,rank:dme,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=fme(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=ume?r=s:r>l&&(r=l),r=Math.min(r,l),r>=c&&r>i.rank&&(i.rank=r,i.passed=!0,i.accessorIndex=a,i.accessorThreshold=c,i.rankedValue=e.itemValue)}return i}function fme(e,t,n){return e=hme(e,n),(t=hme(t,n)).length>e.length?dme:e===t?ome:(e=e.toLowerCase())===(t=t.toLowerCase())?ime:e.startsWith(t)?ame:e.includes(` ${t}`)?sme:e.includes(t)?lme:1===t.length?dme:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?cme:function(e,t){let n=0,r=0;function o(e,t,r){for(let o=r,i=t.length;o<i;o++){if(t[o]===e)return n+=1,o+1}return-1}function i(e){return ume+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return dme;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return dme}return i(r-a)}(e,t)}function hme(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(rme,(e=>tme[e]))),e}function mme(e,t){let n=t;"object"==typeof t&&(n=t.accessor);const r=n(e);return null==r?[]:Array.isArray(r)?r:[String(r)]}var gme={maxRanking:1/0,minRanking:-1/0};function vme(e){return"function"==typeof e?gme:{...gme,...e}}var yme={data:""},bme=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,xme=/\/\*[^]*?\*\/| +/g,wme=/\n+/g,_me=(e,t)=>{let n="",r="",o="";for(let i in e){let a=e[i];"@"==i[0]?"i"==i[1]?n=i+" "+a+";":r+="f"==i[1]?_me(a,i):i+"{"+_me(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=_me(a,t?t.replace(/([^,])+/g,(e=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)))):i):null!=a&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=_me.p?_me.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},Sme={},Eme=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+Eme(e[n]);return t}return e};function Tme(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=Eme(e),a=Sme[i]||(Sme[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!Sme[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=bme.exec(e.replace(xme,""));)t[4]?r.shift():t[3]?(n=t[3].replace(wme," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(wme," ").trim();return r[0]})(e);Sme[a]=_me(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&Sme.g?Sme.g:null;return n&&(Sme.g=Sme[a]),l=Sme[a],c=t,u=r,(d=s)?c.data=c.data.replace(d,l):-1===c.data.indexOf(l)&&(c.data=u?l+c.data:c.data+l),a;var l,c,u,d})(n.unshift?n.raw?((e,t,n)=>e.reduce(((e,r,o)=>{let i=t[o];if(i&&i.call){let e=i(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;i=t?"."+t:e&&"object"==typeof e?e.props?"":_me(e,""):!1===e?"":e}return e+r+(null==i?"":i)}),""))(n,[].slice.call(arguments,1),t.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(t.p):n)),{}):n,(r=t.target,"object"==typeof window?((r?r.querySelector("#_goober"):window._goober)||Object.assign((r||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:r||yme),t.g,t.o,t.k);var r}function Cme(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Cme(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ame(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Cme(e))&&(r&&(r+=" "),r+=t);return r}function Nme(e,t){const n=pt(e),{onChange:r}=t;let o=new Set(t.appear?void 0:n);const i=new WeakSet,[a,s]=at([],{equals:!1}),[l]=[yt,vt],c=e=>{s((t=>(t.push.apply(t,e),t)));for(const t of e)i.delete(t)},u=(e,t,n)=>e.splice(n,0,t);return ut((t=>{const n=a(),s=e();if(pt(l))return l(),t;if(n.length){const e=t.filter((e=>!n.includes(e)));return n.length=0,r({list:e,added:[],removed:[],unchanged:e,finishRemoved:c}),e}return pt((()=>{const e=new Set(s),n=s.slice(),a=[],l=[],d=[];for(const t of s)(o.has(t)?d:a).push(t);let p=!a.length;for(let r=0;r<t.length;r++){const o=t[r];e.has(o)||(i.has(o)||(l.push(o),i.add(o)),u(n,o,r)),p&&o!==n[r]&&(p=!1)}return!l.length&&p?t:(r({list:n,added:a,removed:l,unchanged:d,finishRemoved:c}),o=e,n)}))}),t.appear?[]:n.slice())}function Rme(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}Tme.bind({g:1}),Tme.bind({k:1});var Ome=e=>e instanceof Element;function Pme(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return Pme(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=Pme(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function kme(e,t=Ome,n=Ome){const r=ut(e),o=ut((()=>Pme(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function Mme(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function Lme(e,t,n,r){const{onBeforeEnter:o,onEnter:i,onAfterEnter:a}=t;function s(t){t&&t.target!==n||(n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.enterActive),n.classList.remove(...e.enterTo),a?.(n))}o?.(n),n.classList.add(...e.enter),n.classList.add(...e.enterActive),queueMicrotask((()=>{if(!n.parentNode)return r?.();i?.(n,(()=>s()))})),Mme((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function Dme(e,t,n,r){const{onBeforeExit:o,onExit:i,onAfterExit:a}=t;if(!n.parentNode)return r?.();function s(t){t&&t.target!==n||(r?.(),n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.exitActive),n.classList.remove(...e.exitTo),a?.(n))}o?.(n),n.classList.add(...e.exit),n.classList.add(...e.exitActive),i?.(n,(()=>s())),Mme((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var jme=e=>{const t=function(e){return ut((()=>{const t=e.name||"s";return{enterActive:(e.enterActiveClass||t+"-enter-active").split(" "),enter:(e.enterClass||t+"-enter").split(" "),enterTo:(e.enterToClass||t+"-enter-to").split(" "),exitActive:(e.exitActiveClass||t+"-exit-active").split(" "),exit:(e.exitClass||t+"-exit").split(" "),exitTo:(e.exitToClass||t+"-exit-to").split(" "),move:(e.moveClass||t+"-move").split(" ")}}))}(e);return Nme(kme((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)Lme(a,e,t);const s=[];for(const e of i)e.isConnected&&(e instanceof HTMLElement||e instanceof SVGElement)&&s.push({el:e,rect:e.getBoundingClientRect()});queueMicrotask((()=>{const e=[];for(const{el:t,rect:n}of s)if(t.isConnected){const r=t.getBoundingClientRect(),o=n.left-r.left,i=n.top-r.top;(o||i)&&(t.style.transform=`translate(${o}px, ${i}px)`,t.style.transitionDuration="0s",e.push(t))}document;for(const t of e){let e=function(n){(n.target===t||/transform$/.test(n.propertyName))&&(t.removeEventListener("transitionend",e),t.classList.remove(...a.move))};t.classList.add(...a.move),t.style.transform=t.style.transitionDuration="",t.addEventListener("transitionend",e)}}));for(const t of r)Dme(a,e,t,(()=>o([t])))}})},Ime=Symbol("fallback");function Fme(e){for(const t of e)t.dispose()}function Ume(e){const{by:t}=e;return ut(function(e,t,n,r={}){const o=new Map;return mt((()=>Fme(o.values()))),()=>{const n=e()||[];return pt((()=>{if(!n.length)return Fme(o.values()),o.clear(),r.fallback?[it((e=>(o.set(Ime,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(Ime);if(!o.size||a){a?.dispose(),o.delete(Ime);for(let r=0;r<n.length;r++){const o=n[r];i(e,o,r,t(o,r))}return e}const s=new Set(o.keys());for(let r=0;r<n.length;r++){const a=n[r],l=t(a,r);s.delete(l);const c=o.get(l);c?(e[r]=c.mapped,c.setIndex?.(r),c.setItem((()=>a))):i(e,a,r,l)}for(const t of s)o.get(t)?.dispose(),o.delete(t);return e}))};function i(e,t,r,i){it((a=>{const[s,l]=at(t),c={setItem:l,dispose:a};if(n.length>1){const[e,t]=at(r);c.setIndex=t,c.mapped=n(s,e)}else c.mapped=n(s);o.set(i,c),e[r]=c.mapped}))}}((()=>e.each),"function"==typeof t?t:e=>e[t],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function $me(e,t,n,r){const o=()=>{Ihe(jhe(e)).forEach((e=>{e&&Ihe(jhe(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),Fhe(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?ct(o):lt(o)}function Vme(e,t,n){const r=new WeakMap,{observe:o,unobserve:i}=function(e,t){const n=new ResizeObserver(e);return mt(n.disconnect.bind(n)),{observe:e=>n.observe(e,t),unobserve:n.unobserve.bind(n)}}((e=>{for(const n of e){const{contentRect:e,target:o}=n,i=Math.round(e.width),a=Math.round(e.height),s=r.get(o);s&&s.width===i&&s.height===a||(t(e,o,n),r.set(o,{width:i,height:a}))}}),n);ct((t=>{const n=Ihe(jhe(e)).filter(Dhe);return function(e,t,n,r){const o=e.length,i=t.length;let a,s,l=0;if(i)if(o){for(;l<i&&t[l]===e[l];l++);for(a of(t=t.slice(l),e=e.slice(l),t))e.includes(a)||r(a);for(s of e)t.includes(s)||n(s)}else for(;l<i;l++)r(t[l]);else for(;l<o;l++)n(e[l])}(n,t,o,i),n}),[])}var Bme=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function zme(e){const t={};let n;for(;n=Bme.exec(e);)t[n[1]]=n[2];return t}function Hme(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=zme(e)}else"string"==typeof t&&(t=zme(t));return{...e,...t}}function qme(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function Gme(e){return"[object String]"===Object.prototype.toString.call(e)}function Kme(e){return t=>`${e()}-${t}`}function Wme(e,t){return!!e&&(e===t||e.contains(t))}function Yme(e,t=!1){const{activeElement:n}=Xme(e);if(!n?.nodeName)return null;if(Qme(n)&&n.contentDocument)return Yme(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Xme(n).getElementById(e);if(t)return t}}return n}function Xme(e){return e?e.ownerDocument||e:document}function Qme(e){return"IFRAME"===e.tagName}var Zme=(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))(Zme||{});function Jme(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function ege(){return Jme(/^Mac/i)}function tge(){return Jme(/^iPhone/i)||Jme(/^iPad/i)||ege()&&navigator.maxTouchPoints>1}function nge(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function rge(e){return t=>{for(const n of e)nge(t,n)}}function oge(e){return ege()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function ige(e){if(e)if(function(){if(null==age){age=!1;try{document.createElement("div").focus({get preventScroll(){return age=!0,!0}})}catch(J_e){}}return age}())e.focus({preventScroll:!0});else{const t=function(e){let t=e.parentNode;const n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft});return n}(e);e.focus(),function(e){for(const{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}var age=null;var sge=["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'])"],lge=[...sge,'[tabindex]:not([tabindex="-1"]):not([disabled])'],cge=sge.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",uge=lge.join(':not([hidden]):not([tabindex="-1"]),');function dge(e,t){const n=Array.from(e.querySelectorAll(cge)).filter(pge);return t&&pge(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Qme(e)&&e.contentDocument){const r=dge(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function pge(e){return fge(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function fge(e){return e.matches(cge)&&hge(e)}function hge(e,t){return"#comment"!==e.nodeName&&function(e){if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const{display:t,visibility:n}=e.style;let r="none"!==t&&"hidden"!==n&&"collapse"!==n;if(r){if(!e.ownerDocument.defaultView)return r;const{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:o}=t(e);r="none"!==n&&"hidden"!==o&&"collapse"!==o}return r}(e)&&function(e,t){return!e.hasAttribute("hidden")&&("DETAILS"!==e.nodeName||!t||"SUMMARY"===t.nodeName||e.hasAttribute("open"))}(e,t)&&(!e.parentElement||hge(e.parentElement,e))}function mge(e){for(;e&&!gge(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function gge(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function vge(){}function yge(e,t){return qt(e,t)}var bge=new Map,xge=new Set;function wge(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=bge.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),bge.delete(t.target)),0===bge.size)){for(const e of xge)e();xge.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=bge.get(t.target);n||(n=new Set,bge.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function _ge(e,t){const n=Sge(e,t,"left"),r=Sge(e,t,"top"),o=t.offsetWidth,i=t.offsetHeight;let a=e.scrollLeft,s=e.scrollTop;const l=a+e.offsetWidth,c=s+e.offsetHeight;n<=a?a=n:n+o>l&&(a+=n+o-l),r<=s?s=r:r+i>c&&(s+=r+i-c),e.scrollLeft=a,e.scrollTop=s}function Sge(e,t,n){const r="left"===n?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);){if(t.offsetParent.contains(e)){o-=e[r];break}t=t.offsetParent}return o}"undefined"!=typeof document&&("loading"!==document.readyState?wge():document.addEventListener("DOMContentLoaded",wge));var Ege={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 Tge(e){return t=>(e(t),()=>e(void 0))}function Cge(e,t){const[n,r]=at(Age(t?.()));return ct((()=>{r(e()?.tagName.toLowerCase()||Age(t?.()))})),n}function Age(e){return Gme(e)?e:void 0}function Nge(e){const[t,n]=Gt(e,["as"]);if(!t.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return $t(Pn,qt(n,{get component(){return t.as}}))}var Rge=["id","name","validationState","required","disabled","readOnly"];var Oge=xt();function Pge(){const e=wt(Oge);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function kge(e){const t=Pge(),n=yge({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Nge,qt({as:"div"},(()=>t.dataset()),n))}function Mge(e){const t=Pge(),n=yge({id:t.generateId("error-message")},e),[r,o]=Gt(n,["forceMount"]),i=()=>"invalid"===t.validationState();return ct((()=>{i()&&mt(t.registerErrorMessage(o.id))})),$t(Jt,{get when(){return r.forceMount||i()},get children(){return $t(Nge,qt({as:"div"},(()=>t.dataset()),o))}})}function Lge(e){let t;const n=Pge(),r=yge({id:n.generateId("label")},e),[o,i]=Gt(r,["ref"]),a=Cge((()=>t),(()=>"label"));return ct((()=>mt(n.registerLabel(i.id)))),$t(Nge,qt({as:"label",ref(e){const n=Rme((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ut((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function Dge(e,t){ct(ft(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",t,{passive:!0}),mt((()=>{n.removeEventListener("reset",t)})))})))}function jge(e){const[t,n]=at(e.defaultValue?.()),r=ut((()=>void 0!==e.value?.())),o=ut((()=>r()?e.value?.():t()));return[o,t=>{pt((()=>{const i=function(e,...t){return"function"==typeof e?e(...t):e}(t,o());return Object.is(i,o())||(r()||n(i),e.onChange?.(i)),i}))}]}function Ige(e){const[t,n]=jge(e);return[()=>t()??!1,n]}var Fge=Object.defineProperty,Uge=(e,t)=>{for(var n in t)Fge(e,n,{get:t[n],enumerable:!0})},$ge=xt();function Vge(){return wt($ge)}function Bge(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function zge(e,t){const n=function(e){const t=e.map(((e,t)=>[t,e]));let n=!1;return t.sort((([e,t],[r,o])=>{const i=t.ref(),a=o.ref();return i===a?0:i&&a?Bge(i,a)?(e>r&&(n=!0),-1):(e<r&&(n=!0),1):0})),n?t.map((([e,t])=>t)):e}(e);e!==n&&t(n)}function Hge(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){ct((()=>{const n=setTimeout((()=>{zge(e(),t)}));mt((()=>clearTimeout(n)))}))}(e,t);let n=[];ct((()=>{const r=function(e){const t=e[0],n=e[e.length-1]?.ref();let r=t?.ref()?.parentElement;for(;r;){if(n&&r.contains(n))return r;r=r.parentElement}return Xme(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&zge(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}mt((()=>o.disconnect()))}))}function qge(e={}){const[t,n]=function(e){const[t,n]=jge(e);return[()=>t()??[],n]}({value:()=>jhe(e.items),onChange:t=>e.onItemsChange?.(t)});Hge(t,n);const r=e=>(n((t=>{const n=function(e,t){const n=t.ref();if(!n)return-1;let r=e.length;if(!r)return-1;for(;r--;){const t=e[r]?.ref();if(t&&Bge(t,n))return r+1}return 0}(t,e);return function(e,t,n=-1){return n in e?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}(t,e,n)})),()=>{n((t=>{const n=t.filter((t=>t.ref()!==e.ref()));return t.length===n.length?t:n}))});return{DomCollectionProvider:e=>$t($ge.Provider,{value:{registerItem:r},get children(){return e.children}})}}function Gge(e){const t=function(){const e=Vge();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=yge({shouldRegisterItem:!0},e);ct((()=>{if(!n.shouldRegisterItem)return;mt(t.registerItem(n.getItem()))}))}function Kge(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=Gme(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=Gme(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(Gme(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return Gme(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(Gme(l)||"number"==typeof l)r.push({type:"item",rawValue:l,key:String(l),textValue:String(l),disabled:a(l),level:n,index:t}),t++;else if(null!=s(l)){r.push({type:"section",rawValue:l,key:"",textValue:"",disabled:!1,level:n,index:t}),t++;const o=s(l)??[];if(o.length>0){const i=Kge({dataSource:o,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:t,startLevel:n+1});r.push(...i),t+=i.length}}else r.push({type:"item",rawValue:l,key:o(l),textValue:i(l),disabled:a(l),level:n,index:t}),t++;return r}function Wge(e,t=[]){return ut((()=>{const n=Kge({dataSource:jhe(e.dataSource),getKey:jhe(e.getKey),getTextValue:jhe(e.getTextValue),getDisabled:jhe(e.getDisabled),getSectionChildren:jhe(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var Yge=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Xge=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Qge(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return Yge.has(t)}const t=e.split("-")[0];return Xge.has(t)}(e)?"rtl":"ltr"}function Zge(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Qge(e)}}var Jge=Zge(),eve=new Set;function tve(){Jge=Zge();for(const e of eve)e(Jge)}var nve=xt();function rve(){const e=function(){const[e,t]=at(Jge),n=ut((()=>e()));return ht((()=>{0===eve.size&&window.addEventListener("languagechange",tve),eve.add(t),mt((()=>{eve.delete(t),0===eve.size&&window.removeEventListener("languagechange",tve)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return wt(nve)||e}var ove=new Map;var ive=class e extends Set{anchorKey;currentKey;constructor(t,n,r){super(t),t instanceof e?(this.anchorKey=n||t.anchorKey,this.currentKey=r||t.currentKey):(this.anchorKey=n,this.currentKey=r)}};function ave(e){return ege()||tge()?e.altKey:e.ctrlKey}function sve(e){return ege()?e.metaKey:e.ctrlKey}function lve(e){return new ive(e)}function cve(e){const t=yge({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=at(!1),[o,i]=at(),a=ut((()=>{const e=jhe(t.selectedKeys);return null!=e?lve(e):e})),s=ut((()=>{const e=jhe(t.defaultSelectedKeys);return null!=e?lve(e):new ive})),[l,c]=function(e){const[t,n]=jge(e);return[()=>t()??new ive,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=at(jhe(t.selectionBehavior));return ct((()=>{const e=l();"replace"===jhe(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),ct((()=>{d(jhe(t.selectionBehavior)??"toggle")})),{selectionMode:()=>jhe(t.selectionMode),disallowEmptySelection:()=>jhe(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!jhe(t.allowDuplicateSelectionEvents)&&function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(e,l())||c(e)}}}function uve(e,t,n){const r=qt({selectOnFocus:()=>"replace"===jhe(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=rve();let a={top:0,left:0};$me((()=>jhe(r.isVirtualized)?void 0:o()),"scroll",(()=>{const e=o();e&&(a={top:e.scrollTop,left:e.scrollLeft})}));const{typeSelectHandlers:s}=function(e){const[t,n]=at(""),[r,o]=at(-1);return{typeSelectHandlers:{onKeyDown:i=>{if(jhe(e.isDisabled))return;const a=jhe(e.keyboardDelegate),s=jhe(e.selectionManager);if(!a.getKeyForSearch)return;const l=function(e){return 1!==e.length&&/^[A-Z]/i.test(e)?"":e}(i.key);if(!l||i.ctrlKey||i.metaKey)return;" "===l&&t().trim().length>0&&(i.preventDefault(),i.stopPropagation());let c=n((e=>e+l)),u=a.getKeyForSearch(c,s.focusedKey())??a.getKeyForSearch(c);null==u&&function(e){return e.split("").every((t=>t===e[0]))}(c)&&(c=c[0],u=a.getKeyForSearch(c,s.focusedKey())??a.getKeyForSearch(c)),null!=u&&(s.setFocusedKey(u),e.onTypeSelect?.(u)),clearTimeout(r()),o(window.setTimeout((()=>n("")),500))}}}}({isDisabled:()=>jhe(r.disallowTypeAhead),keyboardDelegate:()=>jhe(r.keyboardDelegate),selectionManager:()=>jhe(r.selectionManager)}),l=()=>jhe(r.orientation)??"vertical",c=()=>{const e=jhe(r.autoFocus);if(!e)return;const n=jhe(r.selectionManager),o=jhe(r.keyboardDelegate);let i;"first"===e&&(i=o.getFirstKey?.()),"last"===e&&(i=o.getLastKey?.());const a=n.selectedKeys();a.size&&(i=a.values().next().value),n.setFocused(!0),n.setFocusedKey(i);const s=t();s&&null==i&&!jhe(r.shouldUseVirtualFocus)&&ige(s)};ht((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),ct(ft([o,()=>jhe(r.isVirtualized),()=>jhe(r.selectionManager).focusedKey()],(e=>{const[t,n,o]=e;if(n)o&&r.scrollToKey?.(o);else if(o&&t){const e=t.querySelector(`[data-key="${o}"]`);e&&_ge(t,e)}})));return{tabIndex:ut((()=>{if(!jhe(r.shouldUseVirtualFocus))return null==jhe(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{nge(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=jhe(r.selectionManager),a=jhe(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!ave(e)&&o.replaceSelection(t))},u=jhe(r.keyboardDelegate),d=jhe(r.shouldFocusWrap),p=o.focusedKey();switch(e.key){case"vertical"===l()?"ArrowDown":"ArrowRight":if(u.getKeyBelow){let t;e.preventDefault(),t=null!=p?u.getKeyBelow(p):u.getFirstKey?.(),null==t&&d&&(t=u.getFirstKey?.(p)),c(t)}break;case"vertical"===l()?"ArrowUp":"ArrowLeft":if(u.getKeyAbove){let t;e.preventDefault(),t=null!=p?u.getKeyAbove(p):u.getLastKey?.(),null==t&&d&&(t=u.getLastKey?.(p)),c(t)}break;case"vertical"===l()?"ArrowLeft":"ArrowUp":if(u.getKeyLeftOf){e.preventDefault();const t="rtl"===i();let n;n=null!=p?u.getKeyLeftOf(p):t?u.getFirstKey?.():u.getLastKey?.(),c(n)}break;case"vertical"===l()?"ArrowRight":"ArrowDown":if(u.getKeyRightOf){e.preventDefault();const t="rtl"===i();let n;n=null!=p?u.getKeyRightOf(p):t?u.getLastKey?.():u.getFirstKey?.(),c(n)}break;case"Home":if(u.getFirstKey){e.preventDefault();const t=u.getFirstKey(p,sve(e));null!=t&&(o.setFocusedKey(t),sve(e)&&e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&o.replaceSelection(t))}break;case"End":if(u.getLastKey){e.preventDefault();const t=u.getLastKey(p,sve(e));null!=t&&(o.setFocusedKey(t),sve(e)&&e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&o.replaceSelection(t))}break;case"PageDown":if(u.getKeyPageBelow&&null!=p){e.preventDefault();c(u.getKeyPageBelow(p))}break;case"PageUp":if(u.getKeyPageAbove&&null!=p){e.preventDefault();c(u.getKeyPageAbove(p))}break;case"a":sve(e)&&"multiple"===o.selectionMode()&&!0!==jhe(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),jhe(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!jhe(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?uge:cge,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&hge(e)&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});return t?.from&&(r.currentNode=t.from),r}(n,{tabbable:!0});let t,r;do{r=e.lastChild(),r&&(t=r)}while(r);t&&!t.contains(document.activeElement)&&ige(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=jhe(r.selectionManager),n=jhe(r.keyboardDelegate),i=jhe(r.selectOnFocus);if(t.isFocused())e.currentTarget.contains(e.target)||t.setFocused(!1);else if(e.currentTarget.contains(e.target))if(t.setFocused(!0),null==t.focusedKey()){const r=e=>{null!=e&&(t.setFocusedKey(e),i&&t.replaceSelection(e))},o=e.relatedTarget;o&&e.currentTarget.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?r(t.lastSelectedKey()??n.getLastKey?.()):r(t.firstSelectedKey()??n.getFirstKey?.())}else if(!jhe(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(ige(n),_ge(e,n))}}},onFocusOut:e=>{const t=jhe(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function dve(e,t){const n=()=>jhe(e.selectionManager),r=()=>jhe(e.key),o=()=>jhe(e.shouldUseVirtualFocus),i=e=>{"none"!==n().selectionMode()&&("single"===n().selectionMode()?n().isSelected(r())&&!n().disallowEmptySelection()?n().toggleSelection(r()):n().replaceSelection(r()):e?.shiftKey?n().extendSelection(r()):"toggle"===n().selectionBehavior()||sve(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>jhe(e.disabled)||n().isDisabled(r()),s=()=>!a()&&n().canSelectItem(r());let l=null;const c=ut((()=>{if(!o()&&!a())return r()===n().focusedKey()?0:-1})),u=ut((()=>jhe(e.virtualized)?void 0:r()));return ct(ft([t,r,o,()=>n().focusedKey(),()=>n().isFocused()],(([t,n,r,o,i])=>{t&&n===o&&i&&!r&&document.activeElement!==t&&(e.focus?e.focus():ige(t))}))),{isSelected:()=>n().isSelected(r()),isDisabled:a,allowsSelection:s,tabIndex:c,dataKey:u,onPointerDown:t=>{s()&&(l=t.pointerType,"mouse"!==t.pointerType||0!==t.button||jhe(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&jhe(e.shouldSelectOnPressUp)&&jhe(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(jhe(e.shouldSelectOnPressUp)&&!jhe(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(ave(e)?n().toggleSelection(r()):i(e))},onMouseDown:e=>{a()&&e.preventDefault()},onFocus:e=>{const i=t();o()||a()||!i||e.target===i&&n().setFocusedKey(r())}}}var pve=class{collection;state;constructor(e,t){this.collection=e,this.state=t}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 t=this.getKey(e);return null!=t&&this.state.selectedKeys().has(t)}isEmpty(){return 0===this.state.selectedKeys().size}isSelectAll(){if(this.isEmpty())return!1;const e=this.state.selectedKeys();return this.getAllSelectableKeys().every((t=>e.has(t)))}firstSelectedKey(){let e;for(const t of this.state.selectedKeys()){const n=this.collection().getItem(t);e&&!(null!=n?.index&&null!=e?.index&&n.index<e.index)||(e=n)}return e?.key}lastSelectedKey(){let e;for(const t of this.state.selectedKeys()){const n=this.collection().getItem(t);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 t=this.getKey(e);if(null==t)return;const n=this.state.selectedKeys(),r=n.anchorKey||t,o=new ive(n,r,t);for(const i of this.getKeyRange(r,n.currentKey||t))o.delete(i);for(const i of this.getKeyRange(t,r))this.canSelectItem(i)&&o.add(i);this.state.setSelectedKeys(o)}getKeyRange(e,t){const n=this.collection().getItem(e),r=this.collection().getItem(t);return n&&r?null!=n.index&&null!=r.index&&n.index<=r.index?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){const n=[];let r=e;for(;null!=r;){const e=this.collection().getItem(r);if(e&&"item"===e.type&&n.push(r),r===t)return n;r=this.collection().getKeyAfter(r)}return[]}getKey(e){const t=this.collection().getItem(e);return t?t&&"item"===t.type?t.key:null:e}toggleSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode()&&!this.isSelected(e))return void this.replaceSelection(e);const t=this.getKey(e);if(null==t)return;const n=new ive(this.state.selectedKeys());n.has(t)?n.delete(t):this.canSelectItem(t)&&(n.add(t),n.anchorKey=t,n.currentKey=t),this.disallowEmptySelection()&&0===n.size||this.state.setSelectedKeys(n)}replaceSelection(e){if("none"===this.selectionMode())return;const t=this.getKey(e);if(null==t)return;const n=this.canSelectItem(t)?new ive([t],t,t):new ive;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new ive;for(const n of e){const e=this.getKey(n);if(null!=e&&(t.add(e),"single"===this.selectionMode()))break}this.state.setSelectedKeys(t)}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 ive)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,t){"none"!==this.selectionMode()&&("single"===this.selectionMode()?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):"toggle"===this.selectionBehavior()||t&&"touch"===t.pointerType?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;const t=this.selectedKeys();if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;for(const n of t)if(!e.has(n))return!1;return!0}canSelectItem(e){if("none"===this.state.selectionMode())return!1;const t=this.collection().getItem(e);return null!=t&&!t.disabled}isDisabled(e){const t=this.collection().getItem(e);return!t||t.disabled}getAllSelectableKeys(){const e=[];return(t=>{for(;null!=t;){if(this.canSelectItem(t)){const n=this.collection().getItem(t);if(!n)continue;"item"===n.type&&e.push(t)}t=this.collection().getKeyAfter(t)}})(this.collection().getFirstKey()),e}},fve=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(const r of e)this.keyMap.set(r.key,r);if(0===this.keyMap.size)return;let t,n=0;for(const[r,o]of this.keyMap)t?(t.nextKey=r,o.prevKey=t.key):(this.firstKey=r,o.prevKey=void 0),"item"===o.type&&(o.index=n++),t=o,t.nextKey=void 0;this.lastKey=t.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 t=[...this.getKeys()];return this.getItem(t[e])}};var hve,mve=e=>"function"==typeof e?e():e,gve=e=>{const t=ut((()=>{const t=mve(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=at(mve(e.show)?"present":"hidden");let i="none";return ct((r=>{const a=mve(e.show);return pt((()=>{if(r===a)return a;const e=i,s=n();if(a)o("present");else if("none"===s||"none"===t()?.display)o("hidden");else{o(!0===r&&e!==s?"hiding":"hidden")}})),a})),ct((()=>{const t=mve(e.element);if(!t)return;const a=e=>{e.target===t&&(i=n())},s=e=>{const i=n().includes(e.animationName);e.target===t&&i&&"hiding"===r()&&o("hidden")};t.addEventListener("animationstart",a),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),mt((()=>{t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}))})),{present:()=>"present"===r()||"hiding"===r(),state:r}},vve="data-kb-top-layer",yve=!1,bve=[];function xve(e){return bve.findIndex((t=>t.node===e))}function wve(){return bve.filter((e=>e.isPointerBlocking))}function _ve(){return wve().length>0}function Sve(e){const t=xve([...wve()].slice(-1)[0]?.node);return xve(e)<t}var Eve={layers:bve,isTopMostLayer:function(e){return bve[bve.length-1].node===e},hasPointerBlockingLayer:_ve,isBelowPointerBlockingLayer:Sve,addLayer:function(e){bve.push(e)},removeLayer:function(e){const t=xve(e);t<0||bve.splice(t,1)},indexOf:xve,find:function(e){return bve[xve(e)]},assignPointerEventToLayers:function(){for(const{node:e}of bve)e.style.pointerEvents=Sve(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(_ve()&&!yve){const t=Xme(e);hve=document.body.style.pointerEvents,t.body.style.pointerEvents="none",yve=!0}},restoreBodyPointerEvents:function(e){if(_ve())return;const t=Xme(e);t.body.style.pointerEvents=hve,0===t.body.style.length&&t.body.removeAttribute("style"),yve=!1}};Uge({},{Button:()=>Ave,Root:()=>Cve});var Tve=["button","color","file","image","reset","submit"];function Cve(e){let t;const n=yge({type:"button"},e),[r,o]=Gt(n,["ref","type","disabled"]),i=Cge((()=>t),(()=>"button")),a=ut((()=>{const e=i();return null!=e&&function(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==Tve.indexOf(e.type)}({tagName:e,type:r.type})})),s=ut((()=>"input"===i())),l=ut((()=>"a"===i()&&null!=t?.getAttribute("href")));return $t(Nge,qt({as:"button",ref(e){const n=Rme((e=>t=e),r.ref);"function"==typeof n&&n(e)},get type(){return a()||s()?r.type:void 0},get role(){return a()||l()?void 0:"button"},get tabIndex(){return a()||l()||r.disabled?void 0:0},get disabled(){return a()||s()?r.disabled:void 0},get"aria-disabled"(){return!(a()||s()||!r.disabled)||void 0},get"data-disabled"(){return r.disabled?"":void 0}},o))}var Ave=Cve,Nve=["top","right","bottom","left"],Rve=Math.min,Ove=Math.max,Pve=Math.round,kve=Math.floor,Mve=e=>({x:e,y:e}),Lve={left:"right",right:"left",bottom:"top",top:"bottom"},Dve={start:"end",end:"start"};function jve(e,t,n){return Ove(e,Rve(t,n))}function Ive(e,t){return"function"==typeof e?e(t):e}function Fve(e){return e.split("-")[0]}function Uve(e){return e.split("-")[1]}function $ve(e){return"x"===e?"y":"x"}function Vve(e){return"y"===e?"height":"width"}function Bve(e){return["top","bottom"].includes(Fve(e))?"y":"x"}function zve(e){return $ve(Bve(e))}function Hve(e){return e.replace(/start|end/g,(e=>Dve[e]))}function qve(e){return e.replace(/left|right|bottom|top/g,(e=>Lve[e]))}function Gve(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 Kve(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Wve(e,t,n){let{reference:r,floating:o}=e;const i=Bve(t),a=zve(t),s=Vve(a),l=Fve(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[s]/2-o[s]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Uve(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function Yve(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Ive(t,e),h=Gve(f),m=s[p?"floating"===d?"reference":"floating":d],g=Kve(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Kve(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function Xve(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Qve(e){return Nve.some((t=>e[t]>=0))}function Zve(e){return tye(e)?(e.nodeName||"").toLowerCase():"#document"}function Jve(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function eye(e){var t;return null==(t=(tye(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function tye(e){return e instanceof Node||e instanceof Jve(e).Node}function nye(e){return e instanceof Element||e instanceof Jve(e).Element}function rye(e){return e instanceof HTMLElement||e instanceof Jve(e).HTMLElement}function oye(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Jve(e).ShadowRoot)}function iye(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=dye(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function aye(e){return["table","td","th"].includes(Zve(e))}function sye(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(J_e){return!1}}))}function lye(e){const t=cye(),n=nye(e)?dye(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!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 cye(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function uye(e){return["html","body","#document"].includes(Zve(e))}function dye(e){return Jve(e).getComputedStyle(e)}function pye(e){return nye(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fye(e){if("html"===Zve(e))return e;const t=e.assignedSlot||e.parentNode||oye(e)&&e.host||eye(e);return oye(t)?t.host:t}function hye(e){const t=fye(e);return uye(t)?e.ownerDocument?e.ownerDocument.body:e.body:rye(t)&&iye(t)?t:hye(t)}function mye(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=hye(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Jve(o);return i?t.concat(a,a.visualViewport||[],iye(o)?o:[],a.frameElement&&n?mye(a.frameElement):[]):t.concat(o,mye(o,[],n))}function gye(e){const t=dye(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rye(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Pve(n)!==i||Pve(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function vye(e){return nye(e)?e:e.contextElement}function yye(e){const t=vye(e);if(!rye(t))return Mve(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=gye(t);let a=(i?Pve(n.width):n.width)/r,s=(i?Pve(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var bye=Mve(0);function xye(e){const t=Jve(e);return cye()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:bye}function wye(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=vye(e);let a=Mve(1);t&&(r?nye(r)&&(a=yye(r)):a=yye(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Jve(e))&&t}(i,n,r)?xye(i):Mve(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=Jve(i),t=r&&nye(r)?Jve(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=yye(o),t=o.getBoundingClientRect(),r=dye(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=Jve(o),o=n.frameElement}}return Kve({width:u,height:d,x:l,y:c})}function _ye(e){return wye(eye(e)).left+pye(e).scrollLeft}function Sye(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Jve(e),r=eye(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=cye();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=eye(e),n=pye(e),r=e.ownerDocument.body,o=Ove(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ove(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+_ye(e);const s=-n.scrollTop;return"rtl"===dye(r).direction&&(a+=Ove(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(eye(e));else if(nye(t))r=function(e,t){const n=wye(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=rye(e)?yye(e):Mve(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=xye(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Kve(r)}function Eye(e,t){const n=fye(e);return!(n===t||!nye(n)||uye(n))&&("fixed"===dye(n).position||Eye(n,t))}function Tye(e,t,n){const r=rye(t),o=eye(t),i="fixed"===n,a=wye(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Mve(0);if(r||!r&&!i)if(("body"!==Zve(t)||iye(o))&&(s=pye(t)),r){const e=wye(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=_ye(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Cye(e){return"static"===dye(e).position}function Aye(e,t){return rye(e)&&"fixed"!==dye(e).position?t?t(e):e.offsetParent:null}function Nye(e,t){const n=Jve(e);if(sye(e))return n;if(!rye(e)){let t=fye(e);for(;t&&!uye(t);){if(nye(t)&&!Cye(t))return t;t=fye(t)}return n}let r=Aye(e,t);for(;r&&aye(r)&&Cye(r);)r=Aye(r,t);return r&&uye(r)&&Cye(r)&&!lye(r)?n:r||function(e){let t=fye(e);for(;rye(t)&&!uye(t);){if(lye(t))return t;if(sye(t))return null;t=fye(t)}return null}(e)||n}var Rye={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=eye(r),s=!!t&&sye(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Mve(1);const u=Mve(0),d=rye(r);if((d||!d&&!i)&&(("body"!==Zve(r)||iye(a))&&(l=pye(r)),rye(r))){const e=wye(r);c=yye(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:eye,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?sye(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=mye(e,[],!1).filter((e=>nye(e)&&"body"!==Zve(e))),o=null;const i="fixed"===dye(e).position;let a=i?fye(e):e;for(;nye(a)&&!uye(a);){const t=dye(a),n=lye(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||iye(a)&&!n&&Eye(e,a))?r=r.filter((e=>e!==a)):o=t,a=fye(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=Sye(t,n,o);return e.top=Ove(r.top,e.top),e.right=Rve(r.right,e.right),e.bottom=Rve(r.bottom,e.bottom),e.left=Ove(r.left,e.left),e}),Sye(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Nye,getElementRects:async function(e){const t=this.getOffsetParent||Nye,n=this.getDimensions,r=await n(e.floating);return{reference:Tye(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=gye(e);return{width:t,height:n}},getScale:yye,isElement:nye,isRTL:function(e){return"rtl"===dye(e).direction}};function Oye(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=vye(e),u=o||i?[...c?mye(c):[],...mye(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=eye(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(s||t(),!d||!p)return;const f={rootMargin:-kve(u)+"px "+-kve(o.clientWidth-(c+d))+"px "+-kve(o.clientHeight-(u+p))+"px "+-kve(c)+"px",threshold:Ove(0,Rve(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),1e3)}h=!1}try{r=new IntersectionObserver(m,{...f,root:o.ownerDocument})}catch(J_e){r=new IntersectionObserver(m,f)}r.observe(e)}(!0),i}(c,n):null;let p,f=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?wye(e):null;return l&&function t(){const r=wye(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}var Pye=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Fve(n),s=Uve(n),l="y"===Bve(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=Ive(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof h&&(f="end"===s?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},kye=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ive(e,t),c={x:n,y:r},u=await Yve(t,l),d=Bve(Fve(o)),p=$ve(d);let f=c[p],h=c[d];if(i){f=jve(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=jve(h+u["y"===d?"top":"left"],h,h-u["y"===d?"bottom":"right"])}const m=s.fn({...t,[p]:f,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Mye=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=Ive(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Fve(o),y=Bve(s),b=Fve(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[qve(s)]:function(e){const t=qve(e);return[Hve(e),t,Hve(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=Uve(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(Fve(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Hve)))),i}(s,m,h,x));const S=[s,...w],E=await Yve(t,g),T=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&T.push(E[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Uve(e),o=zve(e),i=Vve(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=qve(a)),[a,qve(a)]}(o,a,x);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,N;const e=((null==(A=i.flip)?void 0:A.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(N=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(f){case"bestFit":{var R;const e=null==(R=C.filter((e=>{if(_){const t=Bve(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},Lye=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:a=()=>{},...s}=Ive(e,t),l=await Yve(t,s),c=Fve(n),u=Uve(n),d="y"===Bve(n),{width:p,height:f}=r.floating;let h,m;"top"===c||"bottom"===c?(h=c,m=u===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,h="end"===u?"top":"bottom");const g=f-l.top-l.bottom,v=p-l.left-l.right,y=Rve(f-l[h],g),b=Rve(p-l[m],v),x=!t.middlewareData.shift;let w=y,_=b;if(d?_=u||x?Rve(b,v):v:w=u||x?Rve(y,g):g,x&&!u){const e=Ove(l.left,0),t=Ove(l.right,0),n=Ove(l.top,0),r=Ove(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:Ove(l.left,l.right)):w=f-2*(0!==n||0!==r?n+r:Ove(l.top,l.bottom))}await a({...t,availableWidth:_,availableHeight:w});const S=await o.getDimensions(i.floating);return p!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},Dye=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ive(e,t);switch(r){case"referenceHidden":{const e=Xve(await Yve(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Qve(e)}}}case"escaped":{const e=Xve(await Yve(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Qve(e)}}}default:return{}}}}},jye=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Ive(e,t)||{};if(null==c)return{};const d=Gve(u),p={x:n,y:r},f=zve(o),h=Vve(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],w=p[f]-i.reference[f],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=_?_[b]:0;S&&await(null==a.isElement?void 0:a.isElement(_))||(S=s.floating[b]||i.floating[h]);const E=x/2-w/2,T=S/2-m[h]/2-1,C=Rve(d[v],T),A=Rve(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=jve(N,O,R),k=!l.arrow&&null!=Uve(o)&&O!==P&&i.reference[h]/2-(O<N?C:A)-m[h]/2<0,M=k?O<N?O-N:O-R:0;return{[f]:p[f]+M,data:{[f]:P,centerOffset:O-P-M,...k&&{alignmentOffset:M}},reset:k}}}),Iye=(e,t,n)=>{const r={platform:Rye,...n},o={...r.platform,_c:new Map};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Wve(c,r,l),p=r,f={},h=0;for(let m=0;m<s.length;m++){const{name:n,fn:i}=s[m],{x:g,y:v,data:y,reset:b}=await i({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,f={...f,[n]:{...f[n],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=Wve(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},Fye=xt();function Uye(){const e=wt(Fye);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var $ye=pn('<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">'),Vye={top:180,right:-90,bottom:0,left:90};function Bye(e){const t=Uye(),n=yge({size:30},e),[r,o]=Gt(n,["ref","style","size"]),i=()=>t.currentPlacement().split("-")[0],a=function(e){const[t,n]=at();return ct((()=>{const t=e();var r;t&&n((r=t,Xme(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return $t(Nge,qt({as:"div",ref(e){const n=Rme(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Hme({position:"absolute","font-size":`${r.size}px`,width:"1em",height:"1em","pointer-events":"none",fill:a()?.getPropertyValue("background-color")||"none",stroke:a()?.getPropertyValue(`border-${i()}-color`)||"none","stroke-width":s()},r.style)}},o,{get children(){const e=$ye(),t=e.firstChild;return lt((()=>hn(t,"transform",`rotate(${Vye[i()]} 15 15) translate(0 2)`))),e}}))}function zye(e){const{x:t=0,y:n=0,width:r=0,height:o=0}=e??{};if("function"==typeof DOMRect)return new DOMRect(t,n,r,o);const i={x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:n+o,left:t};return{...i,toJSON:()=>i}}function Hye(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var qye={top:"bottom",right:"left",bottom:"top",left:"right"};var Gye=Object.assign((function(e){const t=yge({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,r]=at(),[o,i]=at(),[a,s]=at(t.placement),l=()=>{return e=t.anchorRef?.(),n=t.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const t=n(e);return t?zye(t):e?e.getBoundingClientRect():zye()}};var e,n},{direction:c}=rve();async function u(){const e=l(),r=n(),i=o();if(!e||!r)return;const a=(i?.clientHeight||0)/2,u="number"==typeof t.gutter?t.gutter+a:t.gutter??a;r.style.setProperty("--kb-popper-content-overflow-padding",`${t.overflowPadding}px`),e.getBoundingClientRect();const d=[Pye((({placement:e})=>{const n=!!e.split("-")[1];return{mainAxis:u,crossAxis:n?void 0:t.shift,alignmentAxis:t.shift}}))];if(!1!==t.flip){const e="string"==typeof t.flip?t.flip.split(" "):void 0;if(void 0!==e&&!e.every(Hye))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(Mye({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(kye({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(Lye({padding:t.overflowPadding,apply({availableWidth:e,availableHeight:n,rects:o}){const i=Math.round(o.reference.width);e=Math.floor(e),n=Math.floor(n),r.style.setProperty("--kb-popper-anchor-width",`${i}px`),r.style.setProperty("--kb-popper-content-available-width",`${e}px`),r.style.setProperty("--kb-popper-content-available-height",`${n}px`),t.sameWidth&&(r.style.width=`${i}px`),t.fitViewport&&(r.style.maxWidth=`${e}px`,r.style.maxHeight=`${n}px`)}})),t.hideWhenDetached&&d.push(Dye({padding:t.detachedPadding})),i&&d.push(jye({element:i,padding:t.arrowPadding}));const p=await Iye(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...Rye,isRTL:()=>"rtl"===c()}});if(s(p.placement),t.onCurrentPlacementChange?.(p.placement),!r)return;r.style.setProperty("--kb-popper-content-transform-origin",function(e,t){const[n,r]=e.split("-"),o=qye[n];return r?"left"===n||"right"===n?`${o} ${"start"===r?"top":"bottom"}`:"start"===r?`${o} ${"rtl"===t?"right":"left"}`:`${o} ${"rtl"===t?"left":"right"}`:`${o} center`}(p.placement,c()));const f=Math.round(p.x),h=Math.round(p.y);let m;if(t.hideWhenDetached&&(m=p.middlewareData.hide?.referenceHidden?"hidden":"visible"),Object.assign(r.style,{top:"0",left:"0",transform:`translate3d(${f}px, ${h}px, 0)`,visibility:m}),i&&p.middlewareData.arrow){const{x:e,y:t}=p.middlewareData.arrow,n=p.placement.split("-")[0];Object.assign(i.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[n]:"100%"})}}return ct((()=>{const e=l(),t=n();if(!e||!t)return;mt(Oye(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),ct((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),$t(Fye.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:Bye,Context:Fye,usePopperContext:Uye,Positioner:function(e){const t=Uye(),[n,r]=Gt(e,["ref","style"]);return $t(Nge,qt({as:"div",ref(e){const r=Rme(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return Hme({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var Kye="interactOutside.pointerDownOutside",Wye="interactOutside.focusOutside";var Yye=xt();function Xye(e){let t;const n=wt(Yye),[r,o]=Gt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=vge;const o=()=>Xme(t()),i=t=>e.onPointerDownOutside?.(t),a=t=>e.onFocusOutside?.(t),s=t=>e.onInteractOutside?.(t),l=n=>{const r=n.target;return r instanceof HTMLElement&&!r.closest(`[${vve}]`)&&!!Wme(o(),r)&&!Wme(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=rge([i,s]);r.addEventListener(Kye,o,{once:!0});const a=new CustomEvent(Kye,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||oge(e)&&0===e.button}});r.dispatchEvent(a)}"touch"===e.pointerType?(o().removeEventListener("click",n),r=n,o().addEventListener("click",n,{once:!0})):n()},u=e=>{const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=rge([a,s]);r.addEventListener(Wye,o,{once:!0});const i=new CustomEvent(Wye,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};ct((()=>{jhe(e.isDisabled)||(n=window.setTimeout((()=>{o().addEventListener("pointerdown",c,!0)}),0),o().addEventListener("focusin",u,!0),mt((()=>{window.clearTimeout(n),o().removeEventListener("click",r),o().removeEventListener("pointerdown",c,!0),o().removeEventListener("focusin",u,!0)})))}))}({shouldExcludeElement:e=>!!t&&(r.excludedElements?.some((t=>Wme(t(),e)))||[...i].some((t=>Wme(t,e)))),onPointerDownOutside:e=>{t&&!Eve.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||Eve.isTopMostLayer(t))&&(r.onPointerDownOutside?.(e),r.onInteractOutside?.(e),e.defaultPrevented||r.onDismiss?.())},onFocusOutside:e=>{r.onFocusOutside?.(e),r.onInteractOutside?.(e),e.defaultPrevented||r.onDismiss?.()}},(()=>t)),function(e){const t=t=>{t.key===Zme.Escape&&e.onEscapeKeyDown?.(t)};ct((()=>{if(jhe(e.isDisabled))return;const n=e.ownerDocument?.()??Xme();n.addEventListener("keydown",t),mt((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Xme(t),onEscapeKeyDown:e=>{t&&Eve.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),ht((()=>{if(!t)return;Eve.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);Eve.assignPointerEventToLayers(),Eve.disableBodyPointerEvents(t),mt((()=>{t&&(Eve.removeLayer(t),e?.(),Eve.assignPointerEventToLayers(),Eve.restoreBodyPointerEvents(t))}))})),ct(ft([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=Eve.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,Eve.assignPointerEventToLayers()),t&&Eve.disableBodyPointerEvents(e),mt((()=>{Eve.restoreBodyPointerEvents(e)}))}),{defer:!0}));return $t(Yye.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return $t(Nge,qt({as:"div",ref(e){const n=Rme((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Qye(e={}){const[t,n]=Ige({value:()=>jhe(e.open),defaultValue:()=>!!jhe(e.defaultOpen),onChange:t=>e.onOpenChange?.(t)}),r=()=>{n(!0)},o=()=>{n(!1)};return{isOpen:t,setIsOpen:n,open:r,close:o,toggle:()=>{t()?o():r()}}}var Zye={};Uge(Zye,{Description:()=>kge,ErrorMessage:()=>Mge,Item:()=>rbe,ItemControl:()=>obe,ItemDescription:()=>ibe,ItemIndicator:()=>abe,ItemInput:()=>sbe,ItemLabel:()=>lbe,Label:()=>cbe,RadioGroup:()=>dbe,Root:()=>ube});var Jye=xt();function ebe(){const e=wt(Jye);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var tbe=xt();function nbe(){const e=wt(tbe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function rbe(e){const t=Pge(),n=ebe(),r=yge({id:`${t.generateId("item")}-${Yt()}`},e),[o,i]=Gt(r,["value","disabled","onPointerDown"]),[a,s]=at(),[l,c]=at(),[u,d]=at(),[p,f]=at(),[h,m]=at(!1),g=ut((()=>n.isSelectedValue(o.value))),v=ut((()=>o.disabled||t.isDisabled()||!1)),y=e=>{nge(e,o.onPointerDown),h()&&e.preventDefault()},b=ut((()=>({...t.dataset(),"data-disabled":v()?"":void 0,"data-checked":g()?"":void 0}))),x={value:()=>o.value,dataset:b,isSelected:g,isDisabled:v,inputId:a,labelId:l,descriptionId:u,inputRef:p,select:()=>n.setSelectedValue(o.value),generateId:Kme((()=>i.id)),registerInput:Tge(s),registerLabel:Tge(c),registerDescription:Tge(d),setIsFocused:m,setInputRef:f};return $t(tbe.Provider,{value:x,get children(){return $t(Nge,qt({as:"div",role:"group",onPointerDown:y},b,i))}})}function obe(e){const t=nbe(),n=yge({id:t.generateId("control")},e),[r,o]=Gt(n,["onClick","onKeyDown"]);return $t(Nge,qt({as:"div",onClick:e=>{nge(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{nge(e,r.onKeyDown),e.key===Zme.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function ibe(e){const t=nbe(),n=yge({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Nge,qt({as:"div"},(()=>t.dataset()),n))}function abe(e){const t=nbe(),n=yge({id:t.generateId("indicator")},e),[r,o]=Gt(n,["ref","forceMount"]),[i,a]=at(),{present:s}=gve({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return $t(Jt,{get when(){return s()},get children(){return $t(Nge,qt({as:"div",ref(e){const t=Rme(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function sbe(e){const t=Pge(),n=ebe(),r=nbe(),o=yge({id:r.generateId("input")},e),[i,a]=Gt(o,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=at(!1);return ct(ft([()=>r.isSelected(),()=>r.value()],(e=>{if(!e[0]&&e[1]===r.value())return;l(!0);const t=r.inputRef();t?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),{defer:!0})),ct((()=>mt(r.registerInput(a.id)))),$t(Nge,qt({as:"input",ref(e){const t=Rme(r.setInputRef,i.ref);"function"==typeof t&&t(e)},type:"radio",get name(){return t.name()},get value(){return r.value()},get checked(){return r.isSelected()},get required(){return t.isRequired()},get disabled(){return r.isDisabled()},get readonly(){return t.isReadOnly()},get style(){return Hme({...Ege},i.style)},get"aria-labelledby"(){return[i["aria-labelledby"],r.labelId(),null!=i["aria-labelledby"]&&null!=a["aria-label"]?a.id:void 0].filter(Boolean).join(" ")||void 0},get"aria-describedby"(){return[i["aria-describedby"],r.descriptionId(),n.ariaDescribedBy()].filter(Boolean).join(" ")||void 0},onChange:e=>{if(nge(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{nge(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{nge(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function lbe(e){const t=nbe(),n=yge({id:t.generateId("label")},e);return ct((()=>mt(t.registerLabel(n.id)))),$t(Nge,qt({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function cbe(e){return $t(Lge,qt({as:"span"},e))}function ube(e){let t;const n=yge({id:`radiogroup-${Yt()}`,orientation:"vertical"},e),[r,o,i]=Gt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],Rge),[a,s]=jge({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=yge({id:`form-control-${Yt()}`},e),[n,r]=at(),[o,i]=at(),[a,s]=at(),[l,c]=at();return{formControlContext:{name:()=>jhe(t.name)??jhe(t.id),dataset:ut((()=>({"data-valid":"valid"===jhe(t.validationState)?"":void 0,"data-invalid":"invalid"===jhe(t.validationState)?"":void 0,"data-required":jhe(t.required)?"":void 0,"data-disabled":jhe(t.disabled)?"":void 0,"data-readonly":jhe(t.readOnly)?"":void 0}))),validationState:()=>jhe(t.validationState),isRequired:()=>jhe(t.required),isDisabled:()=>jhe(t.disabled),isReadOnly:()=>jhe(t.readOnly),labelId:n,fieldId:o,descriptionId:a,errorMessageId:l,getAriaLabelledBy:(e,t,r)=>{const o=null!=r||null!=n();return[r,n(),o&&null!=t?e:void 0].filter(Boolean).join(" ")||void 0},getAriaDescribedBy:e=>[a(),l(),e].filter(Boolean).join(" ")||void 0,generateId:Kme((()=>jhe(t.id))),registerLabel:Tge(r),registerField:Tge(i),registerDescription:Tge(s),registerErrorMessage:Tge(c)}}}(o);Dge((()=>t),(()=>s(r.defaultValue??"")));const c=()=>l.getAriaDescribedBy(r["aria-describedby"]),u=e=>e===a(),d={ariaDescribedBy:c,isSelectedValue:u,setSelectedValue:e=>{if(!l.isReadOnly()&&!l.isDisabled()&&(s(e),t))for(const n of t.querySelectorAll("[type='radio']")){n.checked=u(n.value)}}};return $t(Oge.Provider,{value:l,get children(){return $t(Jye.Provider,{value:d,get children(){return $t(Nge,qt({as:"div",ref(e){const n=Rme((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return jhe(o.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 r.orientation},get"aria-labelledby"(){return l.getAriaLabelledBy(jhe(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var dbe=Object.assign(ube,{Description:kge,ErrorMessage:Mge,Item:rbe,ItemControl:obe,ItemDescription:ibe,ItemIndicator:abe,ItemInput:sbe,ItemLabel:lbe,Label:cbe}),pbe=class{collection;ref;collator;constructor(e,t,n){this.collection=e,this.ref=t,this.collator=n}getKeyBelow(e){let t=this.collection().getKeyAfter(e);for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&!e.disabled)return t;t=this.collection().getKeyAfter(t)}}getKeyAbove(e){let t=this.collection().getKeyBefore(e);for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&!e.disabled)return t;t=this.collection().getKeyBefore(t)}}getFirstKey(){let e=this.collection().getFirstKey();for(;null!=e;){const t=this.collection().getItem(e);if(t&&"item"===t.type&&!t.disabled)return e;e=this.collection().getKeyAfter(e)}}getLastKey(){let e=this.collection().getLastKey();for(;null!=e;){const t=this.collection().getItem(e);if(t&&"item"===t.type&&!t.disabled)return e;e=this.collection().getKeyBefore(e)}}getItem(e){return this.ref?.()?.querySelector(`[data-key="${e}"]`)??null}getKeyPageAbove(e){const t=this.ref?.();let n=this.getItem(e);if(!t||!n)return;const r=Math.max(0,n.offsetTop+n.offsetHeight-t.offsetHeight);let o=e;for(;o&&n&&n.offsetTop>r;)o=this.getKeyAbove(o),n=null!=o?this.getItem(o):null;return o}getKeyPageBelow(e){const t=this.ref?.();let n=this.getItem(e);if(!t||!n)return;const r=Math.min(t.scrollHeight,n.offsetTop-n.offsetHeight+t.offsetHeight);let o=e;for(;o&&n&&n.offsetTop<r;)o=this.getKeyBelow(o),n=null!=o?this.getItem(o):null;return o}getKeyForSearch(e,t){const n=this.collator?.();if(!n)return;let r=null!=t?this.getKeyBelow(t):this.getFirstKey();for(;null!=r;){const t=this.collection().getItem(r);if(t){const o=t.textValue.slice(0,e.length);if(t.textValue&&0===n.compare(o,e))return r}r=this.getKeyBelow(r)}}};function fbe(e,t,n){const r=function(e){const{locale:t}=rve(),n=ut((()=>t()+(e?Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1)).join():"")));return ut((()=>{const r=n();let o;return ove.has(r)&&(o=ove.get(r)),o||(o=new Intl.Collator(t(),e),ove.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return uve({selectionManager:()=>jhe(e.selectionManager),keyboardDelegate:ut((()=>{const n=jhe(e.keyboardDelegate);return n||new pbe(e.collection,t,r)})),autoFocus:()=>jhe(e.autoFocus),deferAutoFocus:()=>jhe(e.deferAutoFocus),shouldFocusWrap:()=>jhe(e.shouldFocusWrap),disallowEmptySelection:()=>jhe(e.disallowEmptySelection),selectOnFocus:()=>jhe(e.selectOnFocus),disallowTypeAhead:()=>jhe(e.disallowTypeAhead),shouldUseVirtualFocus:()=>jhe(e.shouldUseVirtualFocus),allowsTabNavigation:()=>jhe(e.allowsTabNavigation),isVirtualized:()=>jhe(e.isVirtualized),scrollToKey:t=>jhe(e.scrollToKey)?.(t),orientation:()=>jhe(e.orientation)},t)}var hbe="focusScope.autoFocusOnMount",mbe="focusScope.autoFocusOnUnmount",gbe={bubbles:!1,cancelable:!0},vbe={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=qme(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=qme(this.stack,e),this.active()?.resume()}};function ybe(e,t){const[n,r]=at(!1),o={pause(){r(!0)},resume(){r(!1)}};let i=null;const a=t=>e.onMountAutoFocus?.(t),s=t=>e.onUnmountAutoFocus?.(t),l=()=>Xme(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,Ege),e},u=()=>{const e=t();return e?dge(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=u();return e.length>0?e[0]:null};ct((()=>{const e=t();if(!e)return;vbe.add(o);const n=Yme(e);if(!Wme(e,n)){const t=new CustomEvent(hbe,gbe);e.addEventListener(hbe,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{ige(d()),Yme(e)===n&&ige(e)}),0)}mt((()=>{e.removeEventListener(hbe,a),setTimeout((()=>{const r=new CustomEvent(mbe,gbe);(()=>{const e=t();if(!e)return!1;const n=Yme(e);return!!n&&!Wme(e,n)&&fge(n)})()&&r.preventDefault(),e.addEventListener(mbe,s),e.dispatchEvent(r),r.defaultPrevented||ige(n??l().body),e.removeEventListener(mbe,s),vbe.remove(o)}),0)}))})),ct((()=>{const r=t();if(!r||!jhe(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${vve}]`)||(Wme(r,t)?i=t:ige(i))},a=e=>{const t=e.relatedTarget??Yme(r);t?.closest(`[${vve}]`)||Wme(r,t)||ige(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),mt((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),ct((()=>{const r=t();if(!r||!jhe(e.trapFocus)||n())return;const o=c();r.insertAdjacentElement("afterbegin",o);const i=c();function a(e){const t=d(),n=(()=>{const e=u();return e.length>0?e[e.length-1]:null})();ige(e.relatedTarget===t?n:t)}r.insertAdjacentElement("beforeend",i),o.addEventListener("focusin",a),i.addEventListener("focusin",a);const s=new MutationObserver((e=>{for(const t of e)t.previousSibling===i&&(i.remove(),r.insertAdjacentElement("beforeend",i)),t.nextSibling===o&&(o.remove(),r.insertAdjacentElement("afterbegin",o))}));s.observe(r,{childList:!0,subtree:!1}),mt((()=>{o.removeEventListener("focusin",a),i.removeEventListener("focusin",a),o.remove(),i.remove(),s.disconnect()}))}))}var bbe="data-live-announcer";function xbe(e){ct((()=>{jhe(e.isDisabled)||mt(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${bbe}], [${vve}]`))n.add(r);const t=e=>{if(n.has(e)||e.parentElement&&r.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(const t of n)if(e.contains(t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),a=t(e);if(a===NodeFilter.FILTER_ACCEPT&&i(e),a!==NodeFilter.FILTER_REJECT){let e=o.nextNode();for(;null!=e;)i(e),e=o.nextNode()}},i=e=>{const t=wbe.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),wbe.set(e,t+1))};_be.length&&_be[_be.length-1].disconnect();o(t);const a=new MutationObserver((e=>{for(const t of e)if("childList"===t.type&&0!==t.addedNodes.length&&![...n,...r].some((e=>e.contains(t.target)))){for(const e of t.removedNodes)e instanceof Element&&(n.delete(e),r.delete(e));for(const e of t.addedNodes)!(e instanceof HTMLElement||e instanceof SVGElement)||"true"!==e.dataset.liveAnnouncer&&"true"!==e.dataset.reactAriaTopLayer?e instanceof Element&&o(e):n.add(e)}}));a.observe(t,{childList:!0,subtree:!0});const s={observe(){a.observe(t,{childList:!0,subtree:!0})},disconnect(){a.disconnect()}};return _be.push(s),()=>{a.disconnect();for(const e of r){const t=wbe.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),wbe.delete(e)):wbe.set(e,t-1)}s===_be[_be.length-1]?(_be.pop(),_be.length&&_be[_be.length-1].observe()):_be.splice(_be.indexOf(s),1)}}(jhe(e.targets),jhe(e.root)))}))}var wbe=new WeakMap,_be=[];var Sbe=new Map,Ebe=e=>{ct((()=>{const t=mve(e.style)??{},n=mve(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=Sbe.get(e.key);o?o.activeCount++:Sbe.set(e.key,{activeCount:1,originalStyles:r,properties:n.map((e=>e.key))}),Object.assign(e.element.style,e.style);for(const i of n)e.element.style.setProperty(i.key,i.value);mt((()=>{const t=Sbe.get(e.key);if(t)if(1===t.activeCount){Sbe.delete(e.key);for(const[n,r]of Object.entries(t.originalStyles))e.element.style[n]=r;for(const n of t.properties)e.element.style.removeProperty(n);0===e.element.style.length&&e.element.removeAttribute("style"),e.cleanup?.()}else t.activeCount--}))}))},Tbe=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},Cbe=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[Abe,Nbe]=at([]),Rbe=e=>[e.deltaX,e.deltaY],Obe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],Pbe=(e,t,n,r)=>{const o=null!==r&&kbe(r,e),[i,a]=((e,t,n)=>{const r="x"===t&&"rtl"===window.getComputedStyle(e).direction?-1:1;let o=e,i=0,a=0,s=!1;do{const[e,l,c]=Tbe(o,t),u=c-e-r*l;0===l&&0===u||!Cbe(o,t)||(i+=u,a+=l),o===(n??document.documentElement)?s=!0:o=o._$host??o.parentElement}while(o&&!s);return[i,a]})(e,t,o?r:void 0);return!(n>0&&Math.abs(i)<=1)&&!(n<0&&Math.abs(a)<1)},kbe=(e,t)=>{if(e.contains(t))return!0;let n=t;for(;n;){if(n===e)return!0;n=n._$host??n.parentElement}return!1},Mbe=e=>{const t=qt({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=Yt();let r=[0,0],o=null,i=null;ct((()=>{mve(t.enabled)&&(Nbe((e=>[...e,n])),mt((()=>{Nbe((e=>e.filter((e=>e!==n))))})))})),ct((()=>{if(!mve(t.enabled)||!mve(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(mve(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===mve(t.preventScrollbarShiftMode)?r.paddingRight=`calc(${window.getComputedStyle(e).paddingRight} + ${n}px)`:r.marginRight=`calc(${window.getComputedStyle(e).marginRight} + ${n}px)`,o.push({key:"--scrollbar-width",value:`${n}px`}));const i=window.scrollY,a=window.scrollX;Ebe({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{mve(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else Ebe({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),ct((()=>{var e;(e=n,Abe().indexOf(e)===Abe().length-1&&mve(t.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",a,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),mt((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",a),document.removeEventListener("touchmove",l)})))}));const a=e=>{r=Obe(e),o=null,i=null},s=e=>{const n=e.target,r=mve(t.element),o=Rbe(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=Pbe(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!kbe(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=mve(t.element),a=e.target;let s;if(2===e.touches.length)s=!mve(t.allowPinchZoom);else{if(null==o||null===i){const t=Obe(e).map(((e,t)=>r[t]-e)),n=Math.abs(t[0])>Math.abs(t[1])?"x":"y";o=n,i="x"===n?t[0]:t[1]}if("range"===a.type)s=!1;else{const e=Pbe(a,o,i,n);s=!n||!kbe(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},Lbe=xt();function Dbe(){return wt(Lbe)}function jbe(){const e=Dbe();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var Ibe=xt();function Fbe(){const e=wt(Ibe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var Ube=xt();function $be(){const e=wt(Ube);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function Vbe(e){let t;const n=$be(),r=jbe(),o=yge({id:n.generateId(`item-${Yt()}`)},e),[i,a]=Gt(o,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=at(),[c,u]=at(),[d,p]=at(),f=()=>r.listState().selectionManager(),h=()=>a.id,m=()=>{i.onSelect?.(),i.closeOnSelect&&setTimeout((()=>{r.close(!0)}))};Gge({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=dve({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{nge(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(ige(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{nge(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{nge(e,i.onPointerUp),i.disabled||0!==e.button||m()},x=e=>{if(nge(e,i.onKeyDown),!e.repeat&&!i.disabled)switch(e.key){case"Enter":case" ":m()}},w=ut((()=>i.indeterminate?"mixed":null!=i.checked?i.checked:void 0)),_=ut((()=>({"data-indeterminate":i.indeterminate?"":void 0,"data-checked":i.checked&&!i.indeterminate?"":void 0,"data-disabled":i.disabled?"":void 0,"data-highlighted":f().focusedKey()===h()?"":void 0}))),S={isChecked:()=>i.checked,dataset:_,setLabelRef:p,generateId:Kme((()=>a.id)),registerLabel:Tge(l),registerDescription:Tge(u)};return $t(Ibe.Provider,{value:S,get children(){return $t(Nge,qt({as:"div",ref(e){const n=Rme((e=>t=e),i.ref);"function"==typeof n&&n(e)},get tabIndex(){return g.tabIndex()},get"aria-checked"(){return w()},get"aria-disabled"(){return i.disabled},get"aria-labelledby"(){return s()},get"aria-describedby"(){return c()},get"data-key"(){return g.dataKey()},get onPointerDown(){return rge([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return rge([b,g.onPointerUp])},get onClick(){return rge([i.onClick,g.onClick])},get onKeyDown(){return rge([x,g.onKeyDown])},get onMouseDown(){return rge([i.onMouseDown,g.onMouseDown])},get onFocus(){return rge([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function Bbe(e){const t=yge({closeOnSelect:!1},e),[n,r]=Gt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=Ige({value:()=>jhe(e.isSelected),defaultValue:()=>!!jhe(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{jhe(e.isReadOnly)||jhe(e.isDisabled)||n(t)},toggle:()=>{jhe(e.isReadOnly)||jhe(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return $t(Vbe,qt({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var zbe=xt();function Hbe(){return wt(zbe)}var qbe={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>qbe.next("ltr"===e?"rtl":"ltr",t)},Gbe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",Kbe=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function Wbe(e){const t=$be(),n=jbe(),r=Hbe(),{direction:o}=rve(),i=yge({id:t.generateId("trigger")},e),[a,s]=Gt(i,["ref","id","disabled","onPointerDown","onClick","onKeyDown","onMouseOver","onFocus"]);let l=()=>t.value();void 0!==r&&(l=()=>t.value()??a.id,void 0===r.lastValue()&&r.setLastValue(l));const c=Cge((()=>n.triggerRef()),(()=>"button")),u=ut((()=>"a"===c()&&null!=n.triggerRef()?.getAttribute("href")));ct(ft((()=>r?.value()),(e=>{u()&&e===l()&&n.triggerRef()?.focus()})));const d=()=>{void 0!==r?n.isOpen()?r.value()===l()&&r.closeMenu():(r.autoFocusMenu()||r.setAutoFocusMenu(!0),n.open(!1)):n.toggle(!0)};return ct((()=>mt(n.registerTriggerId(a.id)))),$t(Cve,qt({ref(e){const t=Rme(n.setTriggerRef,a.ref);"function"==typeof t&&t(e)},get"data-kb-menu-value-trigger"(){return t.value()},get id(){return a.id},get disabled(){return a.disabled},"aria-haspopup":"true",get"aria-expanded"(){return n.isOpen()},get"aria-controls"(){return ut((()=>!!n.isOpen()))()?n.contentId():void 0},get"data-highlighted"(){return void 0!==l()&&r?.value()===l()||void 0},get tabIndex(){return void 0!==r?r.value()===l()||r.lastValue()===l()?0:-1:void 0},onPointerDown:e=>{nge(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{nge(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{nge(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if(nge(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case Gbe(t.orientation()):e.stopPropagation(),e.preventDefault(),function(e){if(document.contains(e)){const t=document.scrollingElement||document.documentElement;if("hidden"===window.getComputedStyle(t).overflow){let n=mge(e);for(;e&&n&&e!==t&&n!==t;)_ge(n,e),n=mge(e=n)}else{const{left:t,top:n}=e.getBoundingClientRect();e?.scrollIntoView?.({block:"nearest"});const{left:r,top:o}=e.getBoundingClientRect();(Math.abs(t-r)>1||Math.abs(n-o)>1)&&e.scrollIntoView?.({block:"nearest"})}}}(e.currentTarget),n.open("first"),r?.setAutoFocusMenu(!0),r?.setValue(l);break;case Kbe(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case qbe.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case qbe.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{nge(e,a.onFocus),void 0!==r&&"touch"!==e.currentTarget.dataset.pointerType&&r.setValue(l)},role:void 0!==r?"menuitem":void 0},(()=>n.dataset()),s))}var Ybe=xt();function Xbe(){return wt(Ybe)}function Qbe(e){let t;const n=$be(),r=jbe(),o=Hbe(),i=Xbe(),{direction:a}=rve(),s=yge({id:n.generateId(`content-${Yt()}`)},e),[l,c]=Gt(s,["ref","id","style","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onPointerEnter","onPointerMove","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]);let u=0;const d=()=>null==r.parentMenuContext()&&void 0===o&&n.isModal(),p=fbe({selectionManager:r.listState().selectionManager,collection:r.listState().collection,autoFocus:r.autoFocus,deferAutoFocus:!0,shouldFocusWrap:!0,disallowTypeAhead:()=>!r.listState().selectionManager().isFocused(),orientation:()=>"horizontal"===n.orientation()?"vertical":"horizontal"},(()=>t));ybe({trapFocus:()=>d()&&r.isOpen(),onMountAutoFocus:e=>{void 0===o&&l.onOpenAutoFocus?.(e)},onUnmountAutoFocus:l.onCloseAutoFocus},(()=>t));const f=e=>{l.onEscapeKeyDown?.(e),o?.setAutoFocusMenu(!1),r.close(!0)},h=e=>{l.onFocusOutside?.(e),n.isModal()&&e.preventDefault()};ct((()=>mt(r.registerContentId(l.id))));const m={ref:Rme((e=>{r.setContentRef(e),t=e}),l.ref),role:"menu",get id(){return l.id},get tabIndex(){return p.tabIndex()},get"aria-labelledby"(){return r.triggerId()},onKeyDown:rge([l.onKeyDown,p.onKeyDown,e=>{if(Wme(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case qbe.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case qbe.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:rge([l.onMouseDown,p.onMouseDown]),onFocusIn:rge([l.onFocusIn,p.onFocusIn]),onFocusOut:rge([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{nge(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if(nge(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;Wme(e.currentTarget,e.target)&&t&&(r.setPointerDir(e.clientX>u?"right":"left"),u=e.clientX)},get"data-orientation"(){return n.orientation()}};return $t(Jt,{get when(){return r.contentPresent()},get children(){return $t(Jt,{get when(){return void 0===i||null!=r.parentMenuContext()},get fallback(){return $t(Nge,qt({as:"div"},(()=>r.dataset()),m,c))},get children(){return $t(Gye.Positioner,{get children(){return $t(Xye,qt({get disableOutsidePointerEvents(){return ut((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Hme({"--kb-menu-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onEscapeKeyDown:f,onFocusOutside:h,get onDismiss(){return r.close}},(()=>r.dataset()),m,c))}})}})}})}function Zbe(e){let t;const n=$be(),r=jbe(),[o,i]=Gt(e,["ref"]);return Mbe({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),$t(Qbe,qt({ref(e){const n=Rme((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var Jbe=xt();function exe(e){const t=yge({id:$be().generateId(`group-${Yt()}`)},e),[n,r]=at(),o={generateId:Kme((()=>t.id)),registerLabelId:Tge(r)};return $t(Jbe.Provider,{value:o,get children(){return $t(Nge,qt({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function txe(e){const t=function(){const e=wt(Jbe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=yge({id:t.generateId("label")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerLabelId(r.id)))),$t(Nge,qt({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function nxe(e){const t=jbe();return $t(Nge,qt({as:"span","aria-hidden":"true"},(()=>t.dataset()),yge({children:"▼"},e)))}function rxe(e){return $t(Vbe,qt({role:"menuitem",closeOnSelect:!0},e))}function oxe(e){const t=Fbe(),n=yge({id:t.generateId("description")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerDescription(r.id)))),$t(Nge,qt({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function ixe(e){const t=Fbe(),n=yge({id:t.generateId("indicator")},e),[r,o]=Gt(n,["forceMount"]);return $t(Jt,{get when(){return r.forceMount||t.isChecked()},get children(){return $t(Nge,qt({as:"div"},(()=>t.dataset()),o))}})}function axe(e){const t=Fbe(),n=yge({id:t.generateId("label")},e),[r,o]=Gt(n,["ref","id"]);return ct((()=>mt(t.registerLabel(r.id)))),$t(Nge,qt({as:"div",ref(e){const n=Rme(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function sxe(e){const t=jbe();return $t(Jt,{get when(){return t.contentPresent()},get children(){return $t(On,e)}})}var lxe=xt();function cxe(e){const t=yge({id:$be().generateId(`radiogroup-${Yt()}`)},e),[n,r]=Gt(t,["value","defaultValue","onChange","disabled"]),[o,i]=jge({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return $t(lxe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return $t(exe,r)}})}function uxe(e){const t=function(){const e=wt(lxe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=yge({closeOnSelect:!1},e),[r,o]=Gt(n,["value","onSelect"]);return $t(Vbe,qt({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function dxe(e,t,n){const r=e.split("-")[0],o=n.getBoundingClientRect(),i=[],a=t.clientX,s=t.clientY;switch(r){case"top":i.push([a,s+5]),i.push([o.left,o.bottom]),i.push([o.left,o.top]),i.push([o.right,o.top]),i.push([o.right,o.bottom]);break;case"right":i.push([a-5,s]),i.push([o.left,o.top]),i.push([o.right,o.top]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]);break;case"bottom":i.push([a,s-5]),i.push([o.right,o.top]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]),i.push([o.left,o.top]);break;case"left":i.push([a+5,s]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]),i.push([o.left,o.top]),i.push([o.right,o.top])}return i}function pxe(e){const t=$be(),n=Vge(),r=Dbe(),o=Hbe(),i=Xbe(),a=yge({placement:"horizontal"===t.orientation()?"bottom-start":"right-start"},e),[s,l]=Gt(a,["open","defaultOpen","onOpenChange"]);let c=0,u=null,d="right";const[p,f]=at(),[h,m]=at(),[g,v]=at(),[y,b]=at(),[x,w]=at(!0),[_,S]=at(l.placement),[E,T]=at([]),[C,A]=at([]),{DomCollectionProvider:N}=qge({items:C,onItemsChange:A}),R=Qye({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:O}=gve({show:()=>t.forceMount()||R.isOpen(),element:()=>y()??null}),P=function(e){const t=cve(e),n=Wge({dataSource:()=>jhe(e.dataSource),getKey:()=>jhe(e.getKey),getTextValue:()=>jhe(e.getTextValue),getDisabled:()=>jhe(e.getDisabled),getSectionChildren:()=>jhe(e.getSectionChildren),factory:t=>new fve(e.filter?e.filter(t):t)},[()=>e.filter]),r=new pve(n,t);return st((()=>{const e=t.focusedKey();null==e||n().getItem(e)||t.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>r}}({selectionMode:"none",dataSource:C}),k=e=>{w(e),R.open()},M=(e=!1)=>{R.close(),e&&r&&r.close(!0)},L=()=>{const e=y();e&&(ige(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},D=()=>{null!=i?setTimeout((()=>L())):L()},j=e=>{return d===u?.side&&(t=e,n=u?.area,!!n&&function(e,t){const[n,r]=e;let o=!1;for(let i=t.length,a=0,s=i-1;a<i;s=a++){const[e,l]=t[a],[c,u]=t[s],[,d]=t[0===s?i-1:s-1]||[0,0],p=(l-u)*(n-e)-(e-c)*(r-l);if(u<l){if(r>=u&&r<l){if(0===p)return!0;p>0&&(r===u?r>d&&(o=!o):o=!o)}}else if(l<u){if(r>l&&r<=u){if(0===p)return!0;p<0&&(r===u?r<d&&(o=!o):o=!o)}}else if(r==l&&(n>=c&&n<=e||n>=e&&n<=c))return!0}return o}([t.clientX,t.clientY],n));var t,n};xbe({isDisabled:()=>!(null==r&&R.isOpen()&&t.isModal()),targets:()=>[y(),...E()].filter(Boolean)}),ct((()=>{const e=y();if(!e||!r)return;const t=r.registerNestedMenu(e);mt((()=>{t()}))})),ct((()=>{void 0===r&&o?.registerMenu(t.value(),[y(),...E()])})),ct((()=>{void 0===r&&void 0!==o&&(o.value()===t.value()?(g()?.focus(),o.autoFocusMenu()&&k(!0)):M())})),ct((()=>{void 0===r&&void 0!==o&&R.isOpen()&&o.setValue(t.value())})),mt((()=>{void 0===r&&o?.unregisterMenu(t.value())}));const I={dataset:ut((()=>({"data-expanded":R.isOpen()?"":void 0,"data-closed":R.isOpen()?void 0:""}))),isOpen:R.isOpen,contentPresent:O,nestedMenus:E,currentPlacement:_,pointerGraceTimeoutId:()=>c,autoFocus:x,listState:()=>P,parentMenuContext:()=>r,triggerRef:g,contentRef:y,triggerId:p,contentId:h,setTriggerRef:v,setContentRef:b,open:k,close:M,toggle:e=>{w(e),R.toggle()},focusContent:D,onItemEnter:e=>{j(e)&&e.preventDefault()},onItemLeave:e=>{j(e)||D()},onTriggerLeave:e=>{j(e)&&e.preventDefault()},setPointerDir:e=>d=e,setPointerGraceTimeoutId:e=>c=e,setPointerGraceIntent:e=>u=e,registerNestedMenu:e=>{T((t=>[...t,e]));const t=r?.registerNestedMenu(e);return()=>{T((t=>qme(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:Tge(f),registerContentId:Tge(m)};return $t(N,{get children(){return $t(Lbe.Provider,{value:I,get children(){return $t(Jt,{when:void 0===i,get fallback(){return l.children},get children(){return $t(Gye,qt({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function fxe(e){const{direction:t}=rve();return $t(pxe,qt({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var hxe=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function mxe(e){const t=jbe(),n=$be(),[r,o]=Gt(e,["onFocusOutside","onKeyDown"]),{direction:i}=rve();return $t(Qbe,qt({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;Wme(t.triggerRef(),n)||t.close()},onKeyDown:e=>{nge(e,r.onKeyDown);const o=Wme(e.currentTarget,e.target),a=hxe(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),ige(t.triggerRef()))}},o))}var gxe=["Enter"," "],vxe=(e,t)=>"ltr"===e?[...gxe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...gxe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function yxe(e){let t;const n=$be(),r=jbe(),o=yge({id:n.generateId(`sub-trigger-${Yt()}`)},e),[i,a]=Gt(o,["ref","id","textValue","disabled","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);let s=null;const l=()=>{s&&window.clearTimeout(s),s=null},{direction:c}=rve(),u=()=>i.id,d=()=>{const e=r.parentMenuContext();if(null==e)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");return e.listState().selectionManager()},p=dve({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{nge(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{nge(e,i.onKeyDown),e.repeat||i.disabled||vxe(c(),n.orientation()).includes(e.key)&&(e.stopPropagation(),e.preventDefault(),d().setFocused(!1),d().setFocusedKey(void 0),r.isOpen()||r.open("first"),r.focusContent(),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(r.listState().collection().getFirstKey()))};return ct((()=>{if(null==r.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");mt(r.registerItemToParentDomCollection({ref:()=>t,type:"item",key:u(),textValue:i.textValue??t?.textContent??"",disabled:i.disabled??!1}))})),ct(ft((()=>r.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{mt((()=>{window.clearTimeout(e),r.parentMenuContext()?.setPointerGraceIntent(null)}))}))),ct((()=>mt(r.registerTriggerId(i.id)))),mt((()=>{l()})),$t(Nge,qt({as:"div",ref(e){const n=Rme((e=>{r.setTriggerRef(e),t=e}),i.ref);"function"==typeof n&&n(e)},get id(){return i.id},role:"menuitem",get tabIndex(){return p.tabIndex()},"aria-haspopup":"true",get"aria-expanded"(){return r.isOpen()},get"aria-controls"(){return ut((()=>!!r.isOpen()))()?r.contentId():void 0},get"aria-disabled"(){return i.disabled},get"data-key"(){return p.dataKey()},get"data-highlighted"(){return d().focusedKey()===u()?"":void 0},get"data-disabled"(){return i.disabled?"":void 0},get onPointerDown(){return rge([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return rge([i.onPointerUp,p.onPointerUp])},get onClick(){return rge([f,p.onClick])},get onKeyDown(){return rge([h,p.onKeyDown])},get onMouseDown(){return rge([i.onMouseDown,p.onMouseDown])},get onFocus(){return rge([i.onFocus,p.onFocus])},onPointerMove:e=>{if(nge(e,i.onPointerMove),"mouse"!==e.pointerType)return;const t=r.parentMenuContext();t?.onItemEnter(e),e.defaultPrevented||(i.disabled?t?.onItemLeave(e):(r.isOpen()||s||(r.parentMenuContext()?.setPointerGraceIntent(null),s=window.setTimeout((()=>{r.open(!1),l()}),100)),t?.onItemEnter(e),e.defaultPrevented||(r.listState().selectionManager().isFocused()&&(r.listState().selectionManager().setFocused(!1),r.listState().selectionManager().setFocusedKey(void 0)),ige(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if(nge(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:dxe(r.currentPlacement(),e,n),side:r.currentPlacement().split("-")[0]}),window.clearTimeout(t?.pointerGraceTimeoutId());const o=window.setTimeout((()=>{t?.setPointerGraceIntent(null)}),300);t?.setPointerGraceTimeoutId(o)}else{if(t?.onTriggerLeave(e),e.defaultPrevented)return;t?.setPointerGraceIntent(null)}t?.onItemLeave(e)}},(()=>r.dataset()),a))}function bxe(e){const t=Hbe(),n=yge({id:`menu-${Yt()}`,modal:!0},e),[r,o]=Gt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Qye({open:()=>r.open,defaultOpen:()=>r.defaultOpen,onOpenChange:e=>r.onOpenChange?.(e)}),a={isModal:()=>r.modal??!0,preventScroll:()=>r.preventScroll??a.isModal(),forceMount:()=>r.forceMount??!1,generateId:Kme((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return $t(Ube.Provider,{value:a,get children(){return $t(pxe,qt({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function xxe(e){let t;const n=yge({orientation:"horizontal"},e),[r,o]=Gt(n,["ref","orientation"]),i=Cge((()=>t),(()=>"hr"));return $t(Nge,qt({as:"hr",ref(e){const n=Rme((e=>t=e),r.ref);"function"==typeof n&&n(e)},get role(){return"hr"!==i()?"separator":void 0},get"aria-orientation"(){return"vertical"===r.orientation?"vertical":void 0},get"data-orientation"(){return r.orientation}},o))}Uge({},{Root:()=>xxe,Separator:()=>wxe});var wxe=xxe,_xe={};function Sxe(e){const t=$be(),n=jbe(),[r,o]=Gt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return $t(Zbe,qt({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||ige(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function Exe(e){return $t(bxe,yge({id:`dropdownmenu-${Yt()}`},e))}Uge(_xe,{Arrow:()=>Bye,CheckboxItem:()=>Bbe,Content:()=>Sxe,DropdownMenu:()=>Txe,Group:()=>exe,GroupLabel:()=>txe,Icon:()=>nxe,Item:()=>rxe,ItemDescription:()=>oxe,ItemIndicator:()=>ixe,ItemLabel:()=>axe,Portal:()=>sxe,RadioGroup:()=>cxe,RadioItem:()=>uxe,Root:()=>Exe,Separator:()=>xxe,Sub:()=>fxe,SubContent:()=>mxe,SubTrigger:()=>yxe,Trigger:()=>Wbe});var Txe=Object.assign(Exe,{Arrow:Bye,CheckboxItem:Bbe,Content:Sxe,Group:exe,GroupLabel:txe,Icon:nxe,Item:rxe,ItemDescription:oxe,ItemIndicator:ixe,ItemLabel:axe,Portal:sxe,RadioGroup:cxe,RadioItem:uxe,Separator:xxe,Sub:fxe,SubContent:mxe,SubTrigger:yxe,Trigger:Wbe}),Cxe={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"}},Axe=pn('<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>'),Nxe=pn('<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>'),Rxe=pn('<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>'),Oxe=pn('<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>'),Pxe=pn('<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>'),kxe=pn('<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>'),Mxe=pn('<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>'),Lxe=pn('<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>'),Dxe=pn('<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">'),jxe=pn('<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">'),Ixe=pn('<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>'),Fxe=pn('<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>'),Uxe=pn('<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>'),$xe=pn('<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>'),Vxe=pn('<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>'),Bxe=pn('<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>'),zxe=pn('<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>'),Hxe=pn('<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>'),qxe=pn('<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>'),Gxe=pn('<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>'),Kxe=pn('<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>'),Wxe=pn('<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>'),Yxe=pn('<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 Xxe(){return Axe()}function Qxe(){return Nxe()}function Zxe(){return Rxe()}function Jxe(){return Oxe()}function ewe(){return Pxe()}function twe(){return(e=Pxe()).style.setProperty("transform","rotate(90deg)"),e;var e}function nwe(){return(e=Pxe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function rwe(){return kxe()}function owe(){return Mxe()}function iwe(){return Lxe()}function awe(){return Dxe()}function swe(){return jxe()}function lwe(){return Ixe()}function cwe(){return Fxe()}function uwe(){return Uxe()}function dwe(){return $xe()}function pwe(e){return t=Vxe(),n=t.firstChild,lt((()=>hn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function fwe(){return Bxe()}function hwe(){return zxe()}function mwe(e){return[$t(Jt,{get when(){return e.checked},get children(){var t=Vxe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}}),$t(Jt,{get when(){return!e.checked},get children(){var t=Hxe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function gwe(){return qxe()}function vwe(){return Gxe()}function ywe(){return Kxe()}function bwe(){return Wxe()}function xwe(){const e=Yt();return t=Yxe(),i=(o=(r=(n=t.firstChild).nextSibling).nextSibling).firstChild,s=(a=o.nextSibling).firstChild,u=(c=(l=a.nextSibling).nextSibling).firstChild,p=(d=c.nextSibling).firstChild,m=(h=(f=d.nextSibling).nextSibling).firstChild,v=(g=h.nextSibling).firstChild,x=(b=(y=g.nextSibling).nextSibling).firstChild,_=(w=b.nextSibling).firstChild,T=(E=(S=w.nextSibling).nextSibling).firstChild,A=(C=E.nextSibling).firstChild,O=(R=(N=C.nextSibling).nextSibling).firstChild,k=(P=R.nextSibling).firstChild,D=(L=(M=P.nextSibling).nextSibling).firstChild,I=(j=L.nextSibling).firstChild,$=(U=(F=j.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Z=(Q=(X=(Y=(W=(K=(G=(q=z.nextSibling).firstChild).nextSibling).nextSibling.firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,se=(ae=q.nextSibling).firstChild,ce=(le=ae.nextSibling).firstChild,pe=(de=(ue=le.nextSibling).firstChild).nextSibling,he=(fe=ue.nextSibling).firstChild,ge=(me=fe.nextSibling).firstChild,De=(Le=(Me=(ke=(Pe=(Oe=(Re=(Ne=(Ae=(Ce=(Te=(Ee=(Se=(_e=(we=(xe=(be=(ye=(ve=me.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,hn(n,"id",`a-${e}`),hn(r,"fill",`url(#a-${e})`),hn(i,"id",`am-${e}`),hn(a,"id",`b-${e}`),hn(s,"filter",`url(#am-${e})`),hn(l,"mask",`url(#b-${e})`),hn(u,"id",`ah-${e}`),hn(d,"id",`k-${e}`),hn(p,"filter",`url(#ah-${e})`),hn(f,"mask",`url(#k-${e})`),hn(m,"id",`ae-${e}`),hn(g,"id",`j-${e}`),hn(v,"filter",`url(#ae-${e})`),hn(y,"mask",`url(#j-${e})`),hn(x,"id",`ai-${e}`),hn(w,"id",`i-${e}`),hn(_,"filter",`url(#ai-${e})`),hn(S,"mask",`url(#i-${e})`),hn(T,"id",`aj-${e}`),hn(C,"id",`h-${e}`),hn(A,"filter",`url(#aj-${e})`),hn(N,"mask",`url(#h-${e})`),hn(O,"id",`ag-${e}`),hn(P,"id",`g-${e}`),hn(k,"filter",`url(#ag-${e})`),hn(M,"mask",`url(#g-${e})`),hn(D,"id",`af-${e}`),hn(j,"id",`f-${e}`),hn(I,"filter",`url(#af-${e})`),hn(F,"mask",`url(#f-${e})`),hn(U,"id",`m-${e}`),hn($,"fill",`url(#m-${e})`),hn(B,"id",`ak-${e}`),hn(z,"id",`e-${e}`),hn(H,"filter",`url(#ak-${e})`),hn(q,"mask",`url(#e-${e})`),hn(G,"id",`n-${e}`),hn(K,"fill",`url(#n-${e})`),hn(W,"id",`r-${e}`),hn(Y,"fill",`url(#r-${e})`),hn(X,"id",`s-${e}`),hn(Q,"fill",`url(#s-${e})`),hn(Z,"id",`q-${e}`),hn(J,"fill",`url(#q-${e})`),hn(ee,"id",`p-${e}`),hn(te,"fill",`url(#p-${e})`),hn(ne,"id",`o-${e}`),hn(re,"fill",`url(#o-${e})`),hn(oe,"id",`l-${e}`),hn(ie,"fill",`url(#l-${e})`),hn(se,"id",`al-${e}`),hn(le,"id",`d-${e}`),hn(ce,"filter",`url(#al-${e})`),hn(ue,"mask",`url(#d-${e})`),hn(de,"id",`u-${e}`),hn(pe,"fill",`url(#u-${e})`),hn(he,"id",`ad-${e}`),hn(me,"id",`c-${e}`),hn(ge,"filter",`url(#ad-${e})`),hn(ve,"mask",`url(#c-${e})`),hn(ye,"id",`t-${e}`),hn(be,"fill",`url(#t-${e})`),hn(xe,"id",`v-${e}`),hn(we,"stroke",`url(#v-${e})`),hn(_e,"id",`aa-${e}`),hn(Se,"stroke",`url(#aa-${e})`),hn(Ee,"id",`w-${e}`),hn(Te,"stroke",`url(#w-${e})`),hn(Ce,"id",`ac-${e}`),hn(Ae,"stroke",`url(#ac-${e})`),hn(Ne,"id",`ab-${e}`),hn(Re,"stroke",`url(#ab-${e})`),hn(Oe,"id",`y-${e}`),hn(Pe,"stroke",`url(#y-${e})`),hn(ke,"id",`x-${e}`),hn(Me,"stroke",`url(#x-${e})`),hn(Le,"id",`z-${e}`),hn(De,"stroke",`url(#z-${e})`),t;var t,n,r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x,w,_,S,E,T,C,A,N,R,O,P,k,M,L,D,j,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Q,Z,J,ee,te,ne,re,oe,ie,ae,se,le,ce,ue,de,pe,fe,he,me,ge,ve,ye,be,xe,we,_e,Se,Ee,Te,Ce,Ae,Ne,Re,Oe,Pe,ke,Me,Le,De}var wwe=pn('<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>'),_we=pn('<button title="Copy object to clipboard">'),Swe=pn('<button title="Remove all items"aria-label="Remove all items">'),Ewe=pn('<button title="Delete item"aria-label="Delete item">'),Twe=pn('<button title="Toggle value"aria-label="Toggle value">'),Cwe=pn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),Awe=pn("<div>"),Nwe=pn("<div><button> <span></span> <span> "),Rwe=pn("<input>"),Owe=pn("<span>"),Pwe=pn("<div><span>:"),kwe=pn("<div><div><button> [<!>...<!>]");var Mwe=e=>{const t=eme(),n=Yhe().shadowDOMTarget?Tme.bind({target:Yhe().shadowDOMTarget}):Tme,r=ut((()=>"dark"===t()?Bwe(n):Vwe(n)));return o=wwe(),lt((()=>mn(o,Ame(r().expander,n`
94
+ */jae.exports="production"===process.env.NODE_ENV?function(){if(Dae)return Iae;Dae=1;var e="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},t=n.useState,r=n.useEffect,o=n.useLayoutEffect,i=n.useDebugValue;function a(t){var n=t.getSnapshot;t=t.value;try{var r=n();return!e(t,r)}catch(o){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,n){var s=n(),l=t({inst:{value:s,getSnapshot:n}}),c=l[0].inst,u=l[1];return o((function(){c.value=s,c.getSnapshot=n,a(c)&&u({inst:c})}),[e,s,n]),r((function(){return a(c)&&u({inst:c}),e((function(){a(c)&&u({inst:c})}))}),[e]),i(s),s};return Iae.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:s,Iae}():(Fae||(Fae=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(o){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=n,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useState,i=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue,l=!1,c=!1,u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(n,u){l||void 0===t.startTransition||(l=!0);var d=u();if(!c){var p=u();r(d,p)||(c=!0)}var f=(p=o({inst:{value:d,getSnapshot:u}}))[0].inst,h=p[1];return a((function(){f.value=d,f.getSnapshot=u,e(f)&&h({inst:f})}),[n,d,u]),i((function(){return e(f)&&h({inst:f}),n((function(){e(f)&&h({inst:f})}))}),[n]),s(d),d};Uae.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:u,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Uae);var $ae=jae.exports,Vae='[cmdk-group=""]',Bae='[cmdk-group-items=""]',zae='[cmdk-item=""]',Hae=`${zae}:not([aria-disabled="true"])`,qae="cmdk-item-select",Gae="data-value",Kae=(e,t,n)=>Lae(e,t,n),Wae=i.createContext(void 0),Yae=()=>i.useContext(Wae),Xae=i.createContext(void 0),Qae=()=>i.useContext(Xae),Zae=i.createContext(void 0),Jae=i.forwardRef(((e,t)=>{let n=fse((()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",filtered:{count:0,items:new Map,groups:new Set}}})),r=fse((()=>new Set)),o=fse((()=>new Map)),a=fse((()=>new Map)),s=fse((()=>new Set)),l=dse(e),{label:c,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=SJ(),x=SJ(),w=SJ(),_=i.useRef(null),S=vse();pse((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,E.emit()}}),[d]),pse((()=>{S(6,O)}),[]);let E=i.useMemo((()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,i,a;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)R(),A(),S(1,N);else if("value"===e&&(r||S(5,O),void 0!==(null==(o=l.current)?void 0:o.value))){return void(null==(a=(i=l.current).onValueChange)||a.call(i,null!=t?t:""))}E.emit()}},emit:()=>{s.current.forEach((e=>e()))}})),[]),T=i.useMemo((()=>({value:(e,t,r)=>{var o;t!==(null==(o=a.current.get(e))?void 0:o.value)&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),S(2,(()=>{A(),E.emit()})))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),S(3,(()=>{R(),A(),n.current.value||N(),E.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();S(4,(()=>{R(),(null==t?void 0:t.getAttribute("id"))===e&&N(),E.emit()}))}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{a.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:w,labelId:x,listInnerRef:_})),[]);function C(e,t){var r,o;let i=null!=(o=null==(r=l.current)?void 0:r.filter)?o:Kae;return e?i(e,n.current.search,t):0}function A(){if(!n.current.search||!1===l.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach((n=>{let r=o.current.get(n),i=0;r.forEach((t=>{let n=e.get(t);i=Math.max(n,i)})),t.push([n,i])}));let r=_.current;k().sort(((t,n)=>{var r,o;let i=t.getAttribute("id"),a=n.getAttribute("id");return(null!=(r=e.get(a))?r:0)-(null!=(o=e.get(i))?o:0)})).forEach((e=>{let t=e.closest(Bae);t?t.appendChild(e.parentElement===t?e:e.closest(`${Bae} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Bae} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{var t;let n=null==(t=_.current)?void 0:t.querySelector(`${Vae}[${Gae}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function N(){let e=k().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(Gae);E.setState("value",t||void 0)}function R(){var e,t,i,s;if(!n.current.search||!1===l.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let c=0;for(let o of r.current){let r=C(null!=(t=null==(e=a.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(i=a.current.get(o))?void 0:i.keywords)?s:[]);n.current.filtered.items.set(o,r),r>0&&c++}for(let[r,a]of o.current)for(let e of a)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(r);break}n.current.filtered.count=c}function O(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(Vae))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=_.current)?void 0:e.querySelector(`${zae}[aria-selected="true"]`)}function k(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(Hae))||[])}function M(e){let t=k()[e];t&&E.setState("value",t.getAttribute(Gae))}function L(e){var t;let n=P(),r=k(),o=r.findIndex((e=>e===n)),i=r[o+e];null!=(t=l.current)&&t.loop&&(i=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),i&&E.setState("value",i.getAttribute(Gae))}function D(e){let t,n=P(),r=null==n?void 0:n.closest(Vae);for(;r&&!t;)r=e>0?cse(r,Vae):use(r,Vae),t=null==r?void 0:r.querySelector(Hae);t?E.setState("value",t.getAttribute(Gae)):L(e)}let j=()=>M(k().length-1),I=e=>{e.preventDefault(),e.metaKey?j():e.altKey?D(1):L(1)},F=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?D(-1):L(-1)};return i.createElement(KZ.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=y.onKeyDown)||t.call(y,e),!e.defaultPrevented)switch(e.key){case"n":case"j":v&&e.ctrlKey&&I(e);break;case"ArrowDown":I(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),j();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=P();if(t){let e=new Event(qae);t.dispatchEvent(e)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:bse},c),yse(e,(e=>i.createElement(Xae.Provider,{value:E},i.createElement(Wae.Provider,{value:T},e)))))})),ese=i.forwardRef(((e,t)=>{var n,r;let o=SJ(),a=i.useRef(null),s=i.useContext(Zae),l=Yae(),c=dse(e),u=null!=(r=null==(n=c.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;pse((()=>{if(!u)return l.item(o,null==s?void 0:s.id)}),[u]);let d=gse(o,a,[e.value,e.children,a],e.keywords),p=Qae(),f=mse((e=>e.value&&e.value===d.current)),h=mse((e=>!(!u&&!1!==l.filter())||(!e.search||e.filtered.items.get(o)>0)));function m(){var e,t;g(),null==(t=(e=c.current).onSelect)||t.call(e,d.current)}function g(){p.setState("value",d.current,!0)}if(i.useEffect((()=>{let t=a.current;if(t&&!e.disabled)return t.addEventListener(qae,m),()=>t.removeEventListener(qae,m)}),[h,e.onSelect,e.disabled]),!h)return null;let{disabled:v,value:y,onSelect:b,forceMount:x,keywords:w,..._}=e;return i.createElement(KZ.div,{ref:hse([a,t]),..._,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)})),tse=i.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,s=SJ(),l=i.useRef(null),c=i.useRef(null),u=SJ(),d=Yae(),p=mse((e=>!(!o&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));pse((()=>d.group(s)),[]),gse(s,l,[e.value,e.heading,c]);let f=i.useMemo((()=>({id:s,forceMount:o})),[o]);return i.createElement(KZ.div,{ref:hse([l,t]),...a,"cmdk-group":"",role:"presentation",hidden:!p||void 0},n&&i.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),yse(e,(e=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},i.createElement(Zae.Provider,{value:f},e)))))})),nse=i.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=i.useRef(null),a=mse((e=>!e.search));return n||a?i.createElement(KZ.div,{ref:hse([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),rse=i.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=Qae(),s=mse((e=>e.search)),l=mse((e=>e.value)),c=Yae(),u=i.useMemo((()=>{var e;let t=null==(e=c.listInnerRef.current)?void 0:e.querySelector(`${zae}[${Gae}="${encodeURIComponent(l)}"]`);return null==t?void 0:t.getAttribute("id")}),[]);return i.useEffect((()=>{null!=e.value&&a.setState("search",e.value)}),[e.value]),i.createElement(KZ.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":u,id:c.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||a.setState("search",e.target.value),null==n||n(e.target.value)}})})),ose=i.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=i.useRef(null),s=i.useRef(null),l=Yae();return i.useEffect((()=>{if(s.current&&a.current){let e,t=s.current,n=a.current,r=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{n.style.setProperty("--cmdk-list-height",t.offsetHeight.toFixed(1)+"px")}))}));return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}}),[]),i.createElement(KZ.div,{ref:hse([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},yse(e,(e=>i.createElement("div",{ref:hse([s,l.listInnerRef]),"cmdk-list-sizer":""},e))))})),ise=i.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:s,...l}=e;return i.createElement(hB,{open:n,onOpenChange:r},i.createElement(mB,{container:s},i.createElement(gB,{"cmdk-overlay":"",className:o}),i.createElement(vB,{"aria-label":e.label,"cmdk-dialog":"",className:a},i.createElement(Jae,{ref:t,...l}))))})),ase=i.forwardRef(((e,t)=>mse((e=>0===e.filtered.count))?i.createElement(KZ.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),sse=i.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return i.createElement(KZ.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},yse(e,(e=>i.createElement("div",{"aria-hidden":!0},e))))})),lse=Object.assign(Jae,{List:ose,Item:ese,Input:rse,Group:tse,Separator:nse,Dialog:ise,Empty:ase,Loading:sse});function cse(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function use(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function dse(e){let t=i.useRef(e);return pse((()=>{t.current=e})),t}var pse="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function fse(e){let t=i.useRef();return void 0===t.current&&(t.current=e()),t}function hse(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function mse(e){let t=Qae(),n=()=>e(t.snapshot());return $ae.useSyncExternalStore(t.subscribe,n,n)}function gse(e,t,n,r=[]){let o=i.useRef(),a=Yae();return pse((()=>{var i;let s=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),l=r.map((e=>e.trim()));a.value(e,s,l),null==(i=t.current)||i.setAttribute(Gae,s),o.current=s})),o}var vse=()=>{let[e,t]=i.useState(),n=fse((()=>new Map));return pse((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function yse({asChild:e,children:t},n){return e&&i.isValidElement(t)?i.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},n(t.props.children)):n(t)}var bse={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const xse=i.forwardRef((({className:e,...n},r)=>t.jsx(lse,{ref:r,className:Qd("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})));xse.displayName=lse.displayName;const wse=i.forwardRef((({className:e,searchIcon:n,...r},o)=>t.jsxs("div",{className:"flex items-center border-b px-3",children:[n||t.jsx(Bu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),t.jsx(lse.Input,{ref:o,className:Qd("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),...r})]})));wse.displayName=lse.Input.displayName;const _se=i.forwardRef((({className:e,...n},r)=>t.jsx(lse.List,{ref:r,className:Qd("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n})));_se.displayName=lse.List.displayName;const Sse=i.forwardRef(((e,n)=>t.jsx(lse.Empty,{ref:n,className:"py-6 text-center text-sm",...e})));Sse.displayName=lse.Empty.displayName;const Ese=i.forwardRef((({className:e,...n},r)=>t.jsx(lse.Group,{ref:r,className:Qd("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),...n})));Ese.displayName=lse.Group.displayName;const Tse=i.forwardRef((({className:e,...n},r)=>t.jsx(lse.Separator,{ref:r,className:Qd("-mx-1 h-px bg-border",e),...n})));Tse.displayName=lse.Separator.displayName;const Cse=i.forwardRef((({className:e,...n},r)=>t.jsx(lse.Item,{ref:r,className:Qd("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),...n})));Cse.displayName=lse.Item.displayName;const Ase=({data:e,placeholder:n,searchPlaceholder:r,noResultsMessage:o,value:a,setValue:s})=>{const[l,c]=i.useState(!1);return t.jsxs(X6,{open:l,onOpenChange:c,modal:!0,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(gQ,{variant:"outline",role:"combobox","aria-expanded":l,className:"w-full max-w-[200px] justify-between bg-background",children:[a?e.find((e=>e.value===a))?.label:n,t.jsx(vu,{className:"opacity-50"})]})}),t.jsx(Z6,{className:"w-[200px] p-0",children:t.jsxs(xse,{children:[t.jsx(wse,{placeholder:r,className:"h-9"}),t.jsxs(_se,{children:[t.jsx(Sse,{children:o}),t.jsx(Ese,{children:e.map((e=>t.jsxs(Cse,{value:e.value,onSelect:e=>{s(e===a?"":e),c(!1)},children:[e.label,t.jsx(pu,{className:Qd("ml-auto",a===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},Nse=({setScheduleTime:e,setTimezone:n,timezone:r,scheduleTime:o,setIsDirty:a})=>{const[s,l]=i.useState(o&&o<(new Date).toISOString()?"Please select a time in the future":null),[c,u]=i.useState(o?r9(new Date(o),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),p=t=>{const n=g8(new Date,15);new Date(t.toLocaleString("en-US",{timeZone:r}))<new Date(n.toLocaleString("en-US",{timeZone:r}))?l("Please select a time at least 15 minutes in the future"):(l(null),e(t.toISOString()),a(!0))};return t.jsx("div",{className:"w-full @container/schedule-time",children:t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsxs("div",{className:"flex gap-2 w-full @xl/schedule-time:flex-row flex-col items-center justify-center",children:[t.jsxs(X6,{children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(gQ,{variant:"outline",className:Qd("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[t.jsx(du,{className:"mr-2 h-4 w-4"}),o?r9(new Date(o),"PPP"):t.jsx("span",{children:"Pick a date"})]})}),t.jsx(Z6,{className:"w-auto p-0 z-[60] pointer-events-auto",children:t.jsx(Cae,{mode:"single",selected:o?new Date(o):void 0,onSelect:e=>{if(!e)return;const[t,n]=c.split(":").map(Number);e.setHours(t,n),p(e)},disabled:e=>{const t=new Date;return t.setHours(0,0,0,0),e<t},initialFocus:!0})})]}),t.jsx("input",{type:"time",value:c,onChange:e=>{if(u(e.target.value),o&&e.target.value){const[t,n]=e.target.value.split(":").map(Number),r=new Date(o);r.setHours(t,n),p(r)}},className:Qd("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")}),t.jsx(Ase,{data:d,placeholder:"Select timezone...",searchPlaceholder:"Search timezone...",noResultsMessage:"No timezone found",value:r,setValue:e=>{const t=new Date(o||(new Date).toISOString()),r=g8(new Date,15);t<new Date(r.toLocaleString("en-US",{timeZone:e}))?l("Please select a time at least 15 minutes in the future"):(l(null),n(e),a(!0))}})]}),s&&t.jsxs("p",{className:"text-destructive text-sm mt-2 flex items-center",children:[t.jsx("span",{className:"mr-2",children:"⚠️"}),s]})]})})},Rse=({title:e="Edit Schedule Time",autoSave:r=!1})=>{const o=iQ(),{updateAutomation:i}=De(o?.id||""),{toast:a}=Ll(),[s,l]=n.useState(null),[c,u]=n.useState(o?.triggerMetadata?.triggerType===Fe.ONE_TIME?o?.triggerMetadata?.scheduledAt:null),[d,p]=n.useState(o?.triggerMetadata?.triggerType===Fe.ONE_TIME&&o?.triggerMetadata?.timezone||"America/New_York"),[f,h]=n.useState(!1),m=n.useCallback((()=>{if("sendNow"===s)i({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:new Date(Date.now()+3e5).toISOString()}}),a({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),h(!1);else{if(!c||!d)return;i({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:c,timezone:d}}),a({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),h(!1)}}),[s,c,d,i,a]);return n.useEffect((()=>{}),[o]),n.useEffect((()=>{r&&f&&(m(),h(!1))}),[r,f,m]),o?t.jsx(Cre,{title:e,headerActions:r?void 0:t.jsx(gQ,{onClick:m,disabled:!f,children:"Save"}),children:t.jsx("div",{className:"@container flex-1 mx-4",children:t.jsxs("div",{className:"flex @[1000px]:flex-row flex-col gap-8 items-center",children:[t.jsxs("div",{className:"flex-1 w-full",children:[t.jsxs("div",{className:"grid grid-cols-1 @[480px]:grid-cols-2 gap-4",children:[t.jsx(bQ,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(xQ.SendButton,{className:"text-primary"}),onClick:()=>{l("sendNow"),u(new Date(Date.now()+3e5).toISOString()),p("America/New_York"),h(!0)}}),t.jsx(bQ,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(xQ.ScheduleButton,{className:"text-primary"}),onClick:()=>l("schedule")})]}),t.jsx(zB,{children:"schedule"===s&&t.jsx(hQ,{className:"overflow-hidden mt-8",children:t.jsx("div",{className:"bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center",children:t.jsx(Nse,{setScheduleTime:u,setTimezone:p,timezone:d,scheduleTime:c,setIsDirty:h})})})})]}),c&&t.jsxs(AX.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:[t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:.3,duration:.4},className:"text-sm font-medium text-gray-700",children:"Currently scheduled for:"}),t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:d||void 0})})]})]})})}):null},Ose=()=>t.jsx("div",{children:t.jsx(Rse,{title:"Set Schedule Time",autoSave:!0})});var Pse=(e=>(e.DAYS="days",e))(Pse||{});const kse={[rQ.EQUALS]:"Equals",[rQ.NOT_EQUALS]:"Not Equals",[rQ.GREATER_THAN]:"Greater Than",[rQ.LESS_THAN]:"Less Than",[rQ.EXISTS]:"Exists",[rQ.EQUALS_MONTH_DAY]:"Month and Day Matches",[rQ.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[rQ.BETWEEN_MONTH_DAY]:"Between Month Day",[rQ.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[rQ.ARRAY_CONTAINS]:"List Contains"},Mse={email:"Email",phone:"Phone",firstName:"First Name",lastName:"Last Name"},Lse=({options:e,value:n,onChange:r,placeholder:o})=>{const[a,s]=i.useState(!1);return t.jsxs(X6,{modal:!0,open:a,onOpenChange:s,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(gQ,{"aria-expanded":a,className:"w-[200px] overflow-hidden justify-between",variant:"outline",children:[n?e.find((e=>e.value===n))?.label:o,t.jsx(vu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(Z6,{className:"w-[200px] p-0",children:t.jsxs(xse,{children:[t.jsx(wse,{placeholder:`${o}...`}),t.jsxs(_se,{children:[t.jsxs(Sse,{children:["No ",o.toLowerCase()," found."]}),t.jsx(Ese,{children:e.map((e=>t.jsxs(Cse,{value:e.value,onSelect:e=>{r(e===n?"":e),s(!1)},children:[t.jsx(pu,{className:Qd("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var Dse=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find(Fse);if(s){const e=s.props.children,r=a.map((t=>t===s?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(jse,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(jse,{...o,ref:n,children:r})}));Dse.displayName="Slot";var jse=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?YU(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));jse.displayName="SlotClone";var Ise=({children:e})=>t.jsx(t.Fragment,{children:e});function Fse(e){return i.isValidElement(e)&&e.type===Ise}var Use=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,n)=>{const r=i.forwardRef(((e,r)=>{const{asChild:o,...i}=e,a=o?Dse:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...i,ref:r})}));return r.displayName=`Primitive.${n}`,{...e,[n]:r}}),{}),$se="horizontal",Vse=["horizontal","vertical"],Bse=i.forwardRef(((e,n)=>{const{decorative:r,orientation:o=$se,...i}=e,a=function(e){return Vse.includes(e)}(o)?o:$se;return t.jsx(Use.div,{"data-orientation":a,...r?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...i,ref:n})}));Bse.displayName="Separator";var zse=Bse;const Hse=i.forwardRef((({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>t.jsx(zse,{ref:i,decorative:r,orientation:n,className:Qd("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",e),...o})));Hse.displayName=zse.displayName;const qse=ru("m-1 transition ease-in-out delay-150 duration-300",{variants:{variant:{default:"border-foreground/10 text-foreground bg-card hover:bg-card/80",secondary:"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",inverted:"inverted"}},defaultVariants:{variant:"default"}}),Gse=i.forwardRef((({options:e,onValueChange:n,variant:r,placeholder:o="Select options",animation:a=0,maxCount:s=3,modalPopover:l=!0,className:c,extraCommandItems:u,searchPlaceholder:d="Search...",handleSearchInput:p,emptyMessage:f="No results found.",searchIcon:h=t.jsx(Bu,{className:"h-4 w-4 mr-2"}),selectedValues:m,setSelectedValues:g,...v},y)=>{const[b,x]=i.useState(!1),[w,_]=i.useState(!1),S=e=>{const t=m.includes(e)?m.filter((t=>t!==e)):[...m,e];g(t),n(t)},E=()=>{g([]),n([])};return t.jsxs(X6,{open:b,onOpenChange:x,modal:l,children:[t.jsx(Q6,{asChild:!0,children:t.jsx("button",{type:"button",ref:y,...v,onClick:()=>{x((e=>!e))},className:Qd("flex w-full p-1 rounded-md border min-h-9 h-auto items-center justify-between bg-white hover:bg-gray-50 [&_svg]:pointer-events-auto data-[state=open]:bg-gray-50",c),children:t.jsxs("div",m.length>0?{className:"flex justify-between items-center w-full",children:[t.jsxs("div",{className:"flex flex-wrap items-center",children:[m.slice(0,s).map((n=>{const o=e.find((e=>e.value===n)),i=o?.icon;return t.jsxs(PQ,{className:Qd(w?"animate-bounce":"",qse({variant:r})),style:{animationDuration:`${a}s`},children:[i&&t.jsx(i,{className:"h-4 w-4 mr-2"}),o?.label,t.jsx(xu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),S(n)}})]},n)})),m.length>s&&t.jsxs(PQ,{className:Qd("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",w?"animate-bounce":"",qse({variant:r})),style:{animationDuration:`${a}s`},children:[`+ ${m.length-s} more`,t.jsx(xu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),(()=>{const e=m.slice(0,s);g(e),n(e)})()}})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(rd,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:e=>{e.stopPropagation(),E()}}),t.jsx(Hse,{orientation:"vertical",className:"flex min-h-6 h-full"}),t.jsx(fu,{className:"h-4 mx-2 cursor-pointer text-muted-foreground"})]})]}:{className:"flex items-center justify-between w-full mx-auto",children:[t.jsx("span",{className:"text-sm text-muted-foreground mx-3",children:o}),t.jsx(fu,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),t.jsx(Z6,{className:"w-auto p-0 z-[1000]",align:"start",onEscapeKeyDown:()=>x(!1),children:t.jsxs(xse,{children:[t.jsx(wse,{searchIcon:h,placeholder:d,onKeyDown:e=>{if("Enter"===e.key)x(!0),p&&(p(e.currentTarget.value),x(!1));else if("Backspace"===e.key&&!e.currentTarget.value){const e=[...m];e.pop(),g(e),n(e)}}}),t.jsxs(_se,{children:[t.jsx(Sse,{children:f}),t.jsxs(Ese,{children:[t.jsxs(Cse,{onSelect:()=>{if(m.length===e.length)E();else{const t=e.map((e=>e.value));g(t),n(t)}},className:"cursor-pointer",children:[t.jsx("div",{className:Qd("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",m.length===e.length?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(pu,{className:"h-4 w-4"})}),t.jsx("span",{children:"(Select All)"})]},"all"),e.map((e=>{const n=m.includes(e.value);return t.jsxs(Cse,{onSelect:()=>S(e.value),className:"cursor-pointer",children:[t.jsx("div",{className:Qd("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",n?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(pu,{className:"h-4 w-4"})}),e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:e.label})]},e.value)}))]}),t.jsx(Tse,{}),t.jsx(Ese,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[m.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Cse,{onSelect:E,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),t.jsx(Hse,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),t.jsx(Cse,{onSelect:()=>x(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"}),u&&u.map((e=>e(x)))]})})]})]})}),a>0&&m.length>0&&t.jsx(nd,{className:Qd("cursor-pointer my-2 text-foreground bg-background w-3 h-3",w?"":"text-muted-foreground"),onClick:()=>_(!w)})]})}));Gse.displayName="MultiSelect";var Kse="Switch",[Wse,Yse]=FZ(Kse),[Xse,Qse]=Wse(Kse),Zse=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,name:o,checked:a,defaultChecked:s,required:l,disabled:c,value:u="on",onCheckedChange:d,form:p,...f}=e,[h,m]=i.useState(null),g=XU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=VZ({prop:a,defaultProp:s,onChange:d});return t.jsxs(Xse,{scope:r,checked:b,disabled:c,children:[t.jsx(KZ.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":nle(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onClick:IZ(e.onClick,(e=>{x((e=>!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(tle,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})}));Zse.displayName=Kse;var Jse="SwitchThumb",ele=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=Qse(Jse,r);return t.jsx(KZ.span,{"data-state":nle(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})}));ele.displayName=Jse;var tle=e=>{const{control:n,checked:r,bubbles:o=!0,...a}=e,s=i.useRef(null),l=Ete(r),c=e1(n);return i.useEffect((()=>{const e=s.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==r&&n){const t=new Event("click",{bubbles:o});n.call(e,r),e.dispatchEvent(t)}}),[l,r,o]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function nle(e){return e?"checked":"unchecked"}var rle=Zse,ole=ele;const ile=i.forwardRef((({className:e,...n},r)=>t.jsx(rle,{className:Qd("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),...n,ref:r,children:t.jsx(ole,{className:Qd("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")})})));ile.displayName=rle.displayName;const ale=({onSelect:e,date:n,placeholder:r="Pick a date"})=>t.jsxs(X6,{modal:!0,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(gQ,{variant:"outline",className:Qd("w-[200px] justify-start text-left font-normal h-9",!n&&"text-muted-foreground"),children:[t.jsx(du,{className:"mr-2 h-4 w-4"}),n?r9(n,"PPP"):t.jsx("span",{children:r})]})}),t.jsx(Z6,{className:"w-auto p-0",align:"start",children:t.jsx(Cae,{mode:"single",selected:n,onSelect:e,initialFocus:!0})})]}),sle=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===Pse.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),lle=({fieldType:e,operator:n,value:r,onChange:o,options:a,toast:s,metadata:l})=>{const c=r.length>0&&"object"==typeof r[0]&&"type"in r[0]&&"relative"===r[0].type,u=r.length>0&&"object"==typeof r[0]&&"startDate"in r[0]&&"endDate"in r[0],[d,p]=i.useState((e===tQ.Date||e===tQ.DateTime)&&r.length>0&&r[0]instanceof Date?r[0]:void 0),[f,h]=i.useState(c),[m,g]=i.useState(c?r[0]:{type:"relative",value:0,unit:Pse.DAYS,direction:"before"}),[v,y]=i.useState(u?r[0]:void 0),[b,x]=i.useState(!1);if(i.useEffect((()=>{n!==rQ.EQUALS_MONTH_DAY&&n!==rQ.EQUALS_MONTH_DAY_YEAR&&f&&(h(!1),o(d?[d]:[]))}),[n,f,d,o]),i.useEffect((()=>{if(u&&v?.startDate){x("object"==typeof v.startDate&&"type"in v.startDate)}}),[u,v]),e===tQ.String||e===tQ.ReachResource||e===tQ.Array)return n===rQ.EXISTS?null:t.jsx(Gse,{maxCount:2,options:(a||[]).map((e=>({label:e.displayName,value:e.id}))),value:r.map((e=>{const t=(a||[]).find((t=>t.id===String(e)||t.displayName===String(e)||t.id===t.displayName&&t.id===String(e)));return t?.id||String(e)})),onValueChange:e=>{o(e)},selectedValues:r.map((e=>{const t=(a||[]).find((t=>t.id===String(e)||t.displayName===String(e)||t.id===t.displayName&&t.id===String(e)));return t?.id||String(e)})),setSelectedValues:e=>{o(e)},searchPlaceholder:"Enter new value",emptyMessage:"Press enter to add new value",handleSearchInput:e=>{if(e.length>0){const t=(e=>{const{value:t,type:n}=e;switch(n){case tQ.ReachResource:case tQ.Array:case tQ.String:return t.length>0;case tQ.Number:return!isNaN(Number(t));case tQ.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case tQ.Boolean:return"true"===t||"false"===t;case tQ.Date:case tQ.DateTime:return!isNaN(new Date(t).getTime());default:throw Xte(n,tQ)}})({value:e,type:l.type});t?o([...new Set([...r,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===tQ.Date||e===tQ.DateTime){const e=n===rQ.EQUALS_MONTH_DAY||n===rQ.EQUALS_MONTH_DAY_YEAR,r=n===rQ.BETWEEN_MONTH_DAY||n===rQ.BETWEEN_MONTH_DAY_YEAR,i=e=>{sle(e)?(g(e),f&&o([e])):s({title:"Invalid relative date",description:"Please enter a valid non-negative number of days.",variant:"destructive"})},a=e=>{const t=e.startDate??v?.startDate,n=e.endDate??v?.endDate,r=t&&"object"==typeof t&&"type"in t,i=n&&"object"==typeof n&&"type"in n;if(t&&n){if(r!==i)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(!r&&!i&&!(e=>!e.finalStartDate||!e.finalEndDate||e.finalStartDate<e.finalEndDate)({finalStartDate:t,finalEndDate:n}))return void s({title:"Invalid date range",description:"Start date must be before end date.",variant:"destructive"});if(r&&(!sle(t)||!sle(n)))return void s({title:"Invalid relative date",description:"Please enter valid relative dates.",variant:"destructive"})}y(e),t&&n&&o([{startDate:t,endDate:n}])},l=e=>{e&&(e=>e instanceof Date?!isNaN(e.getTime()):"object"==typeof e&&"type"in e&&"relative"===e.type&&sle(e))(e)?(p(e),o([e]),h(!1)):e||(p(void 0),o([]),h(!1))},c=e=>{h(e),o(e?[m]:d?[d]:[])};return t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"min-h-[36px] flex items-center",children:[(!f||!e)&&!r&&t.jsx(ale,{date:d,onSelect:l}),e&&f&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(H3,{type:"number",value:void 0===m.value?"":m.value,onChange:e=>{const t=""===e.target.value?void 0:parseInt(e.target.value,10);i({...m,value:t})},className:"w-20 h-9",min:"0","aria-label":"Relative days value"}),t.jsxs(lte,{value:m.direction,onValueChange:e=>{i({...m,direction:e})},children:[t.jsx(ute,{className:"w-[180px] h-9","aria-label":"Relative direction",children:t.jsx(cte,{placeholder:"Select direction..."})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"before",children:"days before today"}),t.jsx(hte,{value:"after",children:"days after today"})]})]})]}),r&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"flex flex-col space-y-2",children:[t.jsx("div",{className:"flex items-center space-x-2",children:b?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(H3,{type:"number",value:v?.startDate&&"object"==typeof v.startDate&&"type"in v.startDate?v.startDate.value:"",onChange:e=>{const t={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Pse.DAYS,direction:v?.startDate?.direction||"before"};sle(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),t.jsxs(lte,{value:v?.startDate&&"object"==typeof v.startDate&&"type"in v.startDate?v.startDate.direction:"before",onValueChange:e=>{const t={type:"relative",value:v?.startDate?.value,unit:Pse.DAYS,direction:e};sle(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},children:[t.jsx(ute,{className:"w-[180px] h-9",children:t.jsx(cte,{placeholder:"Select direction..."})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"before",children:"days before today"}),t.jsx(hte,{value:"after",children:"days after today"})]})]}),t.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"Start"})]}):t.jsx(ale,{placeholder:"Start date",date:v?.startDate instanceof Date||"string"==typeof v?.startDate?v.startDate instanceof Date?v.startDate:new Date(v.startDate):void 0,onSelect:e=>{const t=e;t&&(y({...v,startDate:t}),a({...v,startDate:t}))}})}),t.jsx("div",{className:"flex items-center space-x-2",children:b?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(H3,{type:"number",value:v?.endDate&&"object"==typeof v.endDate&&"type"in v.endDate?v.endDate.value:"",onChange:e=>{const t={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Pse.DAYS,direction:v?.endDate?.direction||"before"};sle(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),t.jsxs(lte,{value:v?.endDate&&"object"==typeof v.endDate&&"type"in v.endDate?v.endDate.direction:"before",onValueChange:e=>{const t={type:"relative",value:v?.endDate?.value,unit:Pse.DAYS,direction:e};sle(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},children:[t.jsx(ute,{className:"w-[180px] h-9",children:t.jsx(cte,{placeholder:"Select direction..."})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"before",children:"days before today"}),t.jsx(hte,{value:"after",children:"days after today"})]})]}),t.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"End"})]}):t.jsx(ale,{placeholder:"End date",date:v?.endDate instanceof Date||"string"==typeof v?.endDate?v.endDate instanceof Date?v.endDate:new Date(v.endDate):void 0,onSelect:e=>{const t=e;t&&(y({...v,endDate:t}),a({...v,endDate:t}))}})})]}),t.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[t.jsx(ile,{id:"between-relative-date-switch",checked:b,onCheckedChange:e=>{if(x(e),e){const e={type:"relative",value:0,unit:Pse.DAYS,direction:"before"},t={type:"relative",value:0,unit:Pse.DAYS,direction:"before"};y({startDate:e,endDate:t}),a({startDate:e,endDate:t})}else{const e=new Date,t=new Date(e);t.setDate(t.getDate()+1),y({startDate:e,endDate:t}),a({startDate:e,endDate:t})}},"aria-label":"Toggle relative date input for between dates"}),t.jsx(L9,{htmlFor:"between-relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})]}),e&&t.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[t.jsx(ile,{id:"relative-date-switch",checked:f,onCheckedChange:c,"aria-label":"Toggle relative date input"}),t.jsx(L9,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===tQ.Number||e===tQ.Integer)return n===rQ.EXISTS?null:t.jsx(H3,{type:"number",value:r.length>0?String(r[0]):"",onChange:e=>o([Number(e.target.value)]),className:"w-[200px]"});if(e===tQ.Boolean){if(n===rQ.EXISTS)return null;const e=r.length>0&&Boolean(r[0]);return t.jsx(ile,{checked:e,onCheckedChange:e=>o([e])})}return t.jsx(H3,{value:r.length>0?String(r[0]):"",onChange:e=>o([e.target.value]),className:"w-[200px]",disabled:!0})},cle=({condition:e,onUpdate:n,onDuplicate:r,onDelete:o,segmentsConditions:i})=>{const{toast:a}=Ll(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:tQ.String,options:void 0,itemType:void 0},l=s.operators,c=s.type,u=i.conditions.map((e=>e.field)).map((e=>({value:e,label:Mse[e]||e})));return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[t.jsx(Lse,{options:u,value:e.field,onChange:t=>{const r=t,o=i.conditions.find((e=>e.field===r));if(!o)return;const a=o.operators.map((e=>({value:e,label:kse[e]||e,fieldType:o.type}))),s=a[0]?.value;let l=[];switch(o.type){case tQ.Boolean:l=[!1];break;case tQ.Number:l=[0];break;case tQ.Date:case tQ.DateTime:l=[new Date];break;case tQ.String:l=o.options?.length?o.options.map((e=>e.displayName)):[];break;default:l=[]}n({...e,field:r,operator:s,value:l})},placeholder:"Select field"}),t.jsx(Lse,{options:l.map((e=>({value:e,label:kse[e]||e}))),value:e.operator,onChange:t=>n({...e,operator:t}),placeholder:"Select operator"}),t.jsx("div",{className:"max-w-2xl w-full overflow-hidden",children:t.jsx(lle,{fieldType:c,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((t=>t.id===e||t.displayName===e)))).map((e=>({displayName:e,id:e})))]:s.options?.map((e=>({displayName:e.displayName,id:e.id}))),value:e.value,onChange:t=>n({...e,value:t}),toast:a,metadata:{field:e.field,type:c,itemType:s.itemType}})})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsx(gQ,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(_u,{className:"h-4 w-4"})}),t.jsx(gQ,{size:"icon",variant:"ghost",onClick:o,children:t.jsx(Yu,{className:"h-4 w-4"})})]})]})},ule=({onSelectStyle:e})=>{const[r,o]=n.useState(null);return t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 max-w-4xl mx-auto",children:[t.jsx(bQ,{onClick:()=>{o("ai"),e("ai")},title:"Build with AI",subtitle:"Describe your audience in plain language and let AI create the conditions",icon:t.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:t.jsx(Ku,{className:"w-full h-full"})})}),selected:"ai"===r}),t.jsx(bQ,{onClick:()=>{o("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${ff("engage:segment")} by configuring conditions directly`,icon:t.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:t.jsx(Hu,{className:"w-full h-full"})})}),selected:"manual"===r})]})},dle=({segmentId:e,setOpen:n,setTextToSegment:r,promptBuilderStyle:o,textToSegment:i})=>t.jsx("div",{children:t.jsx(CB,{className:"",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(NB,{className:"text-3xl font-normal",children:e?`Edit ${ff("engage:segment")}`:`Create ${ff("engage:segment")}`}),t.jsxs("div",{className:"flex items-center gap-2",children:[!1===o&&!1===i&&t.jsx(h6,{children:t.jsxs(m6,{children:[t.jsx(g6,{asChild:!0,children:t.jsx(gQ,{variant:"outline",size:"sm",onClick:()=>r(!0),children:t.jsx(Ku,{className:"h-4 w-3"})})}),t.jsx(v6,{children:t.jsxs("p",{children:["Use AI to create ",ff("engage:segment")," by describing them in natural language"]})})]})}),t.jsx(gQ,{variant:"ghost",size:"icon",onClick:()=>{n(!1)},className:"h-8 w-8",children:t.jsx(rd,{className:"h-4 w-4"})})]})]})})}),ple=({setTextToSegment:e,setSegment:r})=>{const[o,i]=n.useState(""),[a,s]=n.useState(!1),{toast:c}=Ll();return t.jsxs("div",{className:"flex flex-col gap-6 p-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Describe your audience"}),t.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."})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(zB,{children:[a&&t.jsx(hQ,{children:t.jsx(fQ,{})}),!a&&t.jsx(hQ,{children:t.jsx(zte,{placeholder:"Describe your target audience...",className:"min-h-[120px] resize-none",value:o,onChange:e=>i(e.target.value)})})]}),t.jsx("div",{className:"flex justify-end gap-2",children:t.jsxs(gQ,{onClick:async()=>{if(!o)return void c({title:"Please enter a description",description:"Please enter a description of your target audience",variant:"destructive"});s(!0);const t=await(async e=>(await Re(`${l}/text-to-segment`,{method:"POST",body:JSON.stringify({text:e})})).data)(o);t.success&&t.conditions?(c({title:`${ff("engage:segment")} conditions built successfully 🚀`,description:`Your ${ff("engage:segment")} conditions have been built successfully`}),r(t.conditions)):c({title:`${ff("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[t.jsx(Ku,{className:"h-4 w-4"}),"Generate ",ff("engage:segment")]})})]})]})};function fle({segmentId:e,setOpen:n,onSegmentUpdated:r}){const{toast:o}=Ll(),a=void 0===e,[s,l]=i.useState(!1),[c,u]=i.useState({version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[]}),{segment:d,isLoading:p}=JX(e||""),{updateSegment:f}=eQ(e),{createSegment:h,isCreating:m,segmentsConditions:g}=XX(),[v,y]=i.useState(!1),[b,x]=i.useState(!!a);i.useEffect((()=>{g&&u(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:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})}),[d,g]);const w=e=>e.value.some((e=>"object"==typeof e&&"type"in e&&"relative"===e.type)),_=e=>e.value.some((e=>"object"==typeof e&&"startDate"in e&&"endDate"in e));if(!g||p)return t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(fQ,{})});return t.jsx(t.Fragment,{children:t.jsxs(zB,{mode:"wait",children:[t.jsx(dle,{segmentId:e,setOpen:n,setTextToSegment:y,promptBuilderStyle:b,textToSegment:v},"segment-builder-header"),b?t.jsx(hQ,{children:t.jsx(ule,{onSelectStyle:e=>{"ai"===e&&y(!0),x(!1)}})},"prompt-builder-style"):t.jsx(hQ,{children:t.jsxs("div",{className:"flex flex-1 flex-col",children:[t.jsx("div",{className:"flex flex-1 flex-col px-8 py-2",children:t.jsx("div",{className:"flex flex-1 flex-col gap-4 overflow-visible",children:t.jsx(zB,{children:v?t.jsx(hQ,{children:t.jsx(ple,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(hQ,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(L9,{className:"text-muted-foreground text-xs",children:"Name"}),t.jsx(H3,{placeholder:`${ff("engage:segment")} name`,value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(L9,{className:"text-muted-foreground text-xs",children:"Description"}),t.jsx(H3,{placeholder:`${ff("engage:segment")} description`,value:c.description,onChange:e=>u({...c,description:e.target.value})})]})]}),c.conditions.length>0&&t.jsx("div",{className:"flex-1 overflow-y-auto pb-8",children:t.jsx("div",{className:"grid",children:t.jsx(zB,{mode:"popLayout",children:c.conditions.map(((e,n)=>t.jsxs(AX.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:[n>0&&t.jsxs(AX.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[t.jsx(AX.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}}),t.jsx(AX.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),t.jsx(AX.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}})]}),t.jsx(cle,{condition:e,onUpdate:e=>((e,t)=>{const n=[...c.conditions];n[e]=t,u({...c,conditions:n})})(n,e),segmentsConditions:g,onDuplicate:()=>(e=>{const t=[...c.conditions];t.splice(e+1,0,{...c.conditions[e]}),u({...c,conditions:t})})(n),onDelete:()=>(e=>{const t=c.conditions.filter(((t,n)=>n!==e));u({...c,conditions:t})})(n)})]},`${e.field}-${e.operator}-${n}`)))})})})]})})})}),t.jsx("div",{className:"border-t px-8 py-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs(gQ,v?{variant:"secondary",onClick:()=>y(!1),children:[t.jsx(Hu,{className:"h-4 w-4"}),"Manual Builder"]}:{variant:"secondary",onClick:()=>{u({...c,conditions:[...c.conditions,{field:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})},children:[t.jsx(Vu,{className:"h-4 w-4"}),"Add Condition"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(gQ,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(gQ,{variant:"default",onClick:async()=>{if(!c.name||!c.description)return void o({title:"Name and description are required",description:"Please ensure all fields are filled out",variant:"destructive"});const{valid:t,error:i}=(e=>{for(const t of e){if(!t.field||!t.operator)return{valid:!1,error:"Please ensure all fields are filled out for condition"};if(t.operator!==rQ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===rQ.EXISTS&&t.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${t.field}`};if(w(t)&&t.operator!==rQ.EQUALS_MONTH_DAY&&t.operator!==rQ.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 ${t.field}`};if(w(t)&&void 0===t.value[0].value)return{valid:!1,error:`Please select a value for the relative date for ${t.field}`};if(_(t)&&t.operator!==rQ.BETWEEN_MONTH_DAY&&t.operator!==rQ.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 ${t.field}`};if(_(t)&&t.value.length>1)return{valid:!1,error:`Between dates can only have a single value for ${t.field}`};if(_(t)){const e=t.value[0];if(!e.startDate||!e.endDate)return{valid:!1,error:`Please ensure both a start and end date are selected for ${t.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 ${t.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 ${t.field}`};if(e.startDate.direction!==e.endDate.direction)return{valid:!1,error:`Start and end date must be of the same direction for ${t.field}`};const n=e=>{if(e.unit===Pse.DAYS)return e.value??0;throw DX(e.unit,Pse)};if("before"===e.startDate.direction&&n(e.startDate)>n(e.endDate))return{valid:!1,error:`Start date must be before end date for ${t.field}`};if("after"===e.startDate.direction&&n(e.startDate)<n(e.endDate))return{valid:!1,error:`Start date must be after end date for ${t.field}`}}}}return{valid:!0,error:void 0}})(c.conditions);if(!t)return void o({title:"Conditions are invalid",description:i??"Please ensure all fields are filled out",variant:"destructive"});const a=c.conditions.map((e=>{const t=g?.conditions.find((t=>t.field===e.field));return t?.type===tQ.Date&&(e.value=e.value.map((e=>e instanceof Date?e.toISOString().split("T")[0]:e))),e}));l(!0);try{e&&d?f({name:c.name,description:c.description,conditions:a},{onSuccess:()=>{o({title:`${ff("engage:segment")} updated successfully`}),n(!1),r?.(e)},onError:()=>{o({title:`Error updating ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}}):h({name:c.name,description:c.description,conditions:c.conditions},{onSuccess:e=>{o({title:`${ff("engage:segment")} created successfully`}),r?.(e?.id??!1),n(!1)},onError:()=>{o({title:`Error creating ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}})}catch(s){o({title:`Error saving ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}finally{l(!1)}},disabled:s||m,children:s||m?t.jsxs(t.Fragment,{children:[t.jsx(Nu,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})})}function hle({open:e,setOpen:n,segmentId:r,onSegmentUpdated:o}){return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-4xl w-full",hideCloseButton:!0,children:[t.jsxs(n$,{children:[t.jsxs(NB,{children:[ff("engage:segment")," Builder"]}),t.jsxs(RB,{children:["Build a ",ff("engage:segment")," to target your audience"]})]}),t.jsx(fle,{segmentId:r,setOpen:n,onSegmentUpdated:e=>{o?.(e),n(!1)}})]})})}const mle=({value:e,label:n,percentage:r,variant:o,isLoading:i,selected:a})=>t.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 "+(a?"scale-[1.02] [border-color:hsl(var(--reach-primary))] shadow-lg":""),style:{containerType:"inline-size"},"data-card-container":!0,children:[t.jsxs("div",{className:"flex flex-col gap-1 items-start w-full min-w-0",children:[t.jsx("div",{className:"flex items-baseline gap-2 w-full min-w-0 @container/num",children:i?t.jsx("span",{className:"animate-pulse",children:"..."}):t.jsxs(t.Fragment,{children:[t.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!==r&&e.toLocaleString().replace(/,/g,"").length<5&&t.jsxs("span",{className:"text-muted-foreground/50 text-sm hidden @[120px]/num:inline",children:["(",r,"%)"]})]})}),t.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"}[o]}`,children:n})]}),t.jsx("p",{className:"text-sm text-muted-fore hidden @[250px]/card:inline mt-1",children:1===e?"contact":"contacts"})]}),gle=({countResponse:e})=>{const r=n.useMemo((()=>e?.recipients?e.recipients.reduce(((t,n)=>({total:e.count,emails:t.emails+(n.email?1:0),phones:t.phones+(n.phone?1:0)})),{total:0,emails:0,phones:0}):{total:0,emails:0,phones:0}),[e]),o=e=>Math.round(e/(r.total||1)*100);return t.jsxs(t.Fragment,{children:[t.jsx(Tre,{children:"Estimated Matches"}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 md:mb-6 w-full gap-4 mt-3 px-1",children:[t.jsx(mle,{value:r.total,label:"Total",variant:"default",isLoading:void 0===e}),t.jsx(mle,{value:r.emails,label:"Email",percentage:o(r.emails),variant:"blue",isLoading:void 0===e}),t.jsx(mle,{value:r.phones,label:"Phone",percentage:o(r.phones),variant:"green",isLoading:void 0===e})]})]})},vle=({recipients:e})=>e?.length?t.jsx("div",{className:"bg-foreground/5 rounded-lg h-full relative overflow-hidden",children:t.jsx("div",{className:"absolute inset-0 w-full h-full overflow-y-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"sticky top-0 bg-foreground/5 backdrop-blur-sm",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Name"}),t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Contact"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-200/50",children:e.map(((e,n)=>t.jsxs("tr",{className:"hover:bg-white/50 transition-colors",children:[t.jsxs("td",{className:"px-3 sm:px-4 py-3 text-sm text-gray-900",children:[e.firstName," ",e.lastName]}),t.jsx("td",{className:"px-3 sm:px-4 py-3",children:t.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[e.email&&t.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&&t.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"})]})})]},n)))})]})})}):null,yle=({onSelectionChange:e,defaultValue:r="all"})=>{const[o,i]=n.useState(r),a=t=>{i(t),e?.(t)};return t.jsxs(t.Fragment,{children:[t.jsx(Tre,{children:"Filter"}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[t.jsx(bQ,{onClick:()=>a("all"),title:`All ${ff("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(xQ.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(bQ,{onClick:()=>a("segments"),title:`Select ${ff("engage:user",{count:2})}`,subtitle:`Choose from ${ff("engage:segment",{count:2})}`,icon:t.jsx(xQ.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===o})]})]})},ble=({segments:e,allSegments:r,onAddSegment:o,onRemoveSegment:i,setOpenCreateSegmentDialog:a})=>{const[s,l]=n.useState([]),c=r.map((e=>({label:e.name,value:e.id})));return n.useEffect((()=>{l(e)}),[e]),t.jsx("div",{children:t.jsx(Gse,{selectedValues:s,setSelectedValues:l,options:c,defaultValue:e,onValueChange:t=>{const n=t.filter((t=>!e.includes(t))),r=e.filter((e=>!t.includes(e)));n.forEach(o),r.forEach(i)},placeholder:"Select segments",maxCount:5,extraCommandItems:[e=>t.jsxs(Cse,{onSelect:()=>{e(!1),a(!0)},className:"cursor-pointer",children:[t.jsx(xQ.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},xle=({includedSegments:e,excludedSegments:r,handleAddSegment:o,handleRemoveSegment:i,setOpenCreateSegmentDialog:a,segments:s,defaultIsExcludeOpen:l=!1})=>{const[c,u]=n.useState(l);return t.jsxs("div",{children:[t.jsx(ble,{segments:e,allSegments:s||[],onAddSegment:e=>o(e,"include"),onRemoveSegment:e=>i(e,"include"),setOpenCreateSegmentDialog:a}),t.jsx("div",{className:"border-t border-gray-200 my-8"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(gQ,{onClick:()=>u(!c),className:"flex items-center gap-1 transition-colors",size:"sm",children:[t.jsx(AX.div,{animate:{rotate:c?180:0},transition:{duration:.2},children:t.jsx(xQ.DropdownMenuTrigger,{className:"w-5 h-5"})}),t.jsx("span",{children:"Don't send to"})]}),t.jsx(zB,{children:c&&t.jsx(AX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:t.jsx(ble,{segments:r,allSegments:s||[],onAddSegment:e=>o(e,"exclude"),onRemoveSegment:e=>i(e,"exclude"),setOpenCreateSegmentDialog:a})})})]})]})},wle=({title:e="Preview Audience"})=>{const r=iQ(),[o,i]=n.useState("all"),[a,s]=n.useState(r?.includeSegmentIds||[]),[l,c]=n.useState(r?.excludeSegmentIds||[]),[u,d]=n.useState(!1),[p,f]=n.useState(!1),{segments:h,isLoading:m}=QX(),{updateAutomation:g}=De(r?.id??""),[v,y]=n.useState(void 0),b=1===a.length&&0===l.length&&void 0!==h?.find((e=>e.type===nQ.ALL_USERS&&e.id===a[0]));n.useEffect((()=>{r&&!p&&(i(b||a.length>0&&0===l.length?"all":"segments"),WX({includeSegments:a,excludeSegments:l}).then((e=>{y(e)})),f(!0))}),[r,b,p,a,l]);return n.useEffect((()=>{r&&p&&(JSON.stringify(a)===JSON.stringify(r.includeSegmentIds)&&JSON.stringify(l)===JSON.stringify(r.excludeSegmentIds)||(g({includeSegments:a,excludeSegments:l}),WX({includeSegments:a,excludeSegments:l}).then((e=>{y(e)}))))}),[a,l,r,p,g]),t.jsxs(Cre,{title:e,children:[!m&&h&&p?t.jsxs("div",{className:"flex gap-8 w-full pb-4 px-4",children:[t.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:[t.jsx(gle,{countResponse:v}),t.jsx(yle,{onSelectionChange:e=>{if(i(e),"all"===e){const e=h?.find((e=>e.type===nQ.ALL_USERS));if(!e)return;s([e.id]),c([])}},defaultValue:o}),t.jsx(zB,{children:"segments"===o&&t.jsx(AX.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:t.jsx(xle,{includedSegments:a,excludedSegments:l,handleAddSegment:(e,t)=>{"include"===t?s((t=>[...t,e])):c((t=>[...t,e]))},handleRemoveSegment:(e,t)=>{"include"===t?s((t=>t.filter((t=>t!==e)))):c((t=>t.filter((t=>t!==e))))},setOpenCreateSegmentDialog:d,segments:h,defaultIsExcludeOpen:l.length>0})})})]}),t.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:v?.recipients&&t.jsx(vle,{recipients:v.recipients})})]}):t.jsx("div",{children:t.jsx(fQ,{text:["Fetching segments","Finishing up"]})}),t.jsx(hle,{open:u,setOpen:d})]})},_le=()=>t.jsx(wle,{title:"Select Audience"});var Sle=(e=>(e[e.SelectAudience=1]="SelectAudience",e[e.SelectCommunication=2]="SelectCommunication",e[e.Schedule=3]="Schedule",e[e.PreviewAndSend=4]="PreviewAndSend",e))(Sle||{});const Ele=()=>{const e=iQ(),t=aQ(),r=n.useCallback((async n=>e?await(async e=>{const{currentStep:t,automation:n,communicationGroup:r}=e;switch(t){case Sle.SelectAudience:return{canMove:n.includeSegmentIds.length>0,errorMessage:"Please ensure you have selected at least one segment"};case Sle.SelectCommunication:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));return e&&r&&(r.smsChannelSenderId||r.emailChannelSenderId)?!r.emailChannelSenderId||r.emailHtmlBody&&r.emailSubject?r.smsChannelSenderId&&!r.smsMessageBody?{canMove:!1,errorMessage:"Please ensure you have a sms message body"}:{canMove:!0,errorMessage:null}:{canMove:!1,errorMessage:"Please ensure you have a email body and subject"}:{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"}}case Sle.Schedule:{if(!n.triggerMetadata)return{canMove:!1,errorMessage:"Please make sure to select a time to send before starting!"};if(n.triggerMetadata.triggerType!==Fe.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 ${ff("engage:one_time")}`};if(!Boolean(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 ${ff("engage:one_time")}`};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&&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 ${ff("engage:one_time")} automation`}}case Sle.PreviewAndSend:return{canMove:!0,errorMessage:null};default:Xte(t,Sle)}})({currentStep:n,automation:e,communicationGroup:t}):{canMove:!1,errorMessage:`${ff("engage:one_time")} not loaded`}),[e,t]);return{validateStep:r}},Tle=({onFinish:e,getExtraMergeFields:r,onBeforeSchedule:o})=>{const i=iQ(),a=aQ(),{updateAutomation:s}=De(i?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:t}=ZX({includeSegments:e?.includeSegmentIds??[],excludeSegments:e?.excludeSegmentIds??[]}),r=n.useMemo((()=>t?.recipients?t.recipients.reduce(((e,t)=>({emails:e.emails+(t.email?1:0),phones:e.phones+(t.phone?1:0)})),{emails:0,phones:0}):{emails:0,phones:0}),[t?.recipients]);return{estimatedMatches:t,estimatedMatchesStats:r}})(i??void 0),{validateStep:c}=Ele(),[u,d]=n.useState(!1),[p,f]=n.useState(Sle.SelectAudience);if(!i||!p||!a)return t.jsx("div",{className:"flex-1 flex flex-col @container justify-center items-center h-[500px]",children:t.jsx(fQ,{text:[`Fetching ${ff("engage:one_time")} data`,"Finishing up"]})});const h=(({automation:e,communicationGroup:n,getExtraMergeFields:r})=>e?[{id:"audience",title:"Audience",step:1,isValid:()=>e.includeSegmentIds.length>0,content:t.jsx(Wte,{content:t.jsx(_le,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Fe.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},{id:"content",title:"Content",step:2,isValid:()=>{const t=e.actionData?.find((e=>"send_communication"===e.actionType));return!(!t||!t.actionMetadata.communicationGroupId||!n||!n.smsChannelSenderId&&!n.emailChannelSenderId||!(!n.emailChannelSenderId||n.emailHtmlBody&&n.emailSubject)||n.smsChannelSenderId&&!n.smsMessageBody)},content:t.jsxs("div",{className:"flex flex-col gap-4 w-full p-6 rounded-xl bg-gray-100 flex-1 h-full",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:"Edit Content"}),t.jsx(Kte,{getExtraMergeFields:r})]},"content"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"schedule",title:"Schedule",step:3,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Fe.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(Wte,{className:"flex-1",content:t.jsx(Ose,{})},"schedule"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"send",title:"Send",step:4,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Fe.ONE_TIME&&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:t.jsx(Wte,{className:"flex-1",content:t.jsx(Nre,{})},"send"),footerConfig:{backText:"Back",nextText:"Schedule",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[])({automation:i,communicationGroup:a,getExtraMergeFields:r}),m=async()=>{const{canMove:t,errorMessage:n}=await c(p);t?p===Sle.PreviewAndSend?await(async()=>{if(o)try{const t=await o({estimatedEmailRecipients:l?.emails||0,estimatedSmsRecipients:l?.phones||0});!0===t?(s({status:Ve.ACTIVE}),Ml({title:`${ff("engage:one_time")} scheduled!`}),e()):Ml({title:"Oops!",description:t,variant:"destructive"})}catch(t){Ml({title:"Oops!",description:"An error occurred while checking scheduling conditions",variant:"destructive"})}else s({status:Ve.ACTIVE}),Ml({title:`${ff("engage:one_time")} scheduled!`}),e()})():f(p+1):Ml({title:"Oops!",description:n,variant:"destructive"})},g=()=>{p>Sle.SelectAudience&&f(p-1)},v=()=>{e()};return t.jsxs("div",{className:"flex-1 flex flex-col @container h-full min-h-0",children:[t.jsxs("header",{className:"w-full flex items-center gap-4 h-16 px-6",children:[t.jsx("h1",{className:"text-xl font-bold leading-none",children:i.name}),t.jsx("div",{className:"flex items-center gap-4",children:t.jsx(PQ,{variant:l9(i.status),children:J6[i.status]})})]}),t.jsxs("main",{className:"flex gap-4 flex-1 min-h-0",children:[t.jsx("div",{className:"hidden @[1000px]:block",children:t.jsx("nav",{className:"space-y-0 w-50 self-start pr-6 pl-8 pt-4 ",children:h.map((e=>t.jsx("div",{className:`\n rounded-md transition-colors\n ${e.step===p?"bg-[var(--reach-secondary)] text-[var(--reach-primary-foreground)] font-medium":e.step<p?"text-muted-foreground hover:bg-muted":"text-muted-foreground/60"}\n `,children:t.jsx(VQ,{label:e.title,isActive:e.step===p,isCompleted:e.isValid(),onClick:async()=>{if(!u)if(e.step>p){const{canMove:t,errorMessage:n}=await(async e=>{if(e<=p)return{canMove:!0,errorMessage:null};d(!0);try{for(let t=p;t<e;t++){const{canMove:e,errorMessage:n}=await c(t);if(!e)return{canMove:e,errorMessage:n}}return{canMove:!0,errorMessage:null}}finally{d(!1)}})(e.step);t?f(e.step):n&&Ml({title:"Cannot navigate to this step",description:n,variant:"destructive"})}else f(e.step)}})},e.step)))})}),t.jsx("section",{className:"flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0",children:t.jsx("div",{className:" overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex",children:t.jsx(zB,{children:t.jsx(hQ,{className:"pt-0 h-full",children:h.find((e=>e.step===p))?.content},p)})})})]}),t.jsx("footer",{className:"w-full flex justify-end shadow-md z-10 items-center h-16 px-6",children:t.jsx(v9,{handleSkipAndSaveAsDraft:v,handleBack:g,handleNext:m,hideBack:h.find((e=>e.step===p))?.footerConfig.hideBack??!1,backText:h.find((e=>e.step===p))?.footerConfig.backText??"Back",nextText:h.find((e=>e.step===p))?.footerConfig.nextText??"Next",backDisabled:h.find((e=>e.step===p))?.footerConfig.backDisabled??!1,nextDisabled:h.find((e=>e.step===p))?.footerConfig.nextDisabled()??!1})})]})},Cle=()=>t.jsxs("div",{children:[t.jsx("div",{className:EQ,children:t.jsx(xQ.OneTimeBroadcast,{})}),t.jsxs("h3",{className:TQ,children:[ff("engage:one_time")," Broadcast"]}),t.jsx("p",{className:CQ,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),Ale=()=>t.jsxs("div",{children:[t.jsx("div",{className:AQ,children:"Coming Soon"}),t.jsx("div",{className:EQ,children:t.jsx(xQ.RealtimeActivity,{})}),t.jsx("h3",{className:TQ,children:"Realtime Activity"}),t.jsx("p",{className:CQ,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),Nle=({selectedType:e,setAutomationName:n,automationName:r,setAutomationDescription:o,automationDescription:i})=>t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 max-w-lg mx-auto",children:[t.jsxs("h2",{className:"text-2xl font-semibold mb-8 text-center",children:["Name Your"," ",ff(e===Fe.ONE_TIME?"engage:one_time":"engage:trigger_based")]}),t.jsxs("div",{className:"w-full space-y-6",children:[t.jsx("div",{className:"bg-gray-50 p-6 rounded-xl items-center justify-center text-center",children:(()=>{switch(e){case Fe.ONE_TIME:return t.jsx(Cle,{});case Fe.TRIGGER_BASED:return t.jsx(Ale,{});default:throw Xte(e,Fe)}})()}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationName",className:"block text-sm font-medium text-gray-900",children:"Name"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Only visible to your team"})]}),t.jsx(H3,{id:"automationName",type:"text",value:r,onChange:e=>n(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})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationDescription",className:"block text-sm font-medium text-gray-900",children:"Description"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Optional"})]}),t.jsx(zte,{id:"automationDescription",value:i,onChange:e=>o(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 ${ff("engage:one_time").toLowerCase()}`})]})]})]})]}),Rle=({onClose:e,automationType:r,currentStep:o,setCurrentStep:i,getExtraMergeFields:a,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:c}=Le(),[u,p]=n.useState(!1),[f,h]=n.useState(void 0),[m,g]=n.useState(!1),[v,y]=n.useState(r?{name:void 0,description:void 0,type:r}:{name:void 0,description:void 0,type:void 0}),b=void 0!==v.name&&void 0!==v.type&&""!==v.name;n.useEffect((()=>{if(v.type&&!v.name&&!m){const e=new Date,t=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=e.toLocaleDateString([],{month:"long",day:"numeric"}),r=`${ff("engage:one_time")} ${n} ${t}`,o="";y((e=>({...e,name:r,description:o}))),g(!0)}}),[v,m]);if(c||u)return t.jsx("div",{className:SQ,children:t.jsx(fQ,{text:[`Creating ${ff("engage:one_time")}`,"Finishing up"]})});return t.jsxs("div",{className:wB("relative overflow-y-auto h-full p-8",o===vQ.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[t.jsx(zB,{mode:"wait",children:t.jsx(hQ,{className:"h-full",children:(()=>{switch(o){case vQ.ChooseAutomationType:return t.jsx(NQ,{onNext:e=>{y({...v,type:e}),i(vQ.SetAutomationName)}});case vQ.SetAutomationName:return v.type?t.jsx(Nle,{selectedType:v.type,setAutomationName:e=>{y({...v,name:e})},automationName:v.name??"",setAutomationDescription:e=>{y({...v,description:e})},automationDescription:v.description??""}):null;case vQ.OneTimeWizard:return f?t.jsx(lQ,{automationId:f,children:t.jsx(Tle,{onFinish:()=>{e?.(f)},getExtraMergeFields:a,onBeforeSchedule:s})}):null;default:throw DX(o,vQ)}})()},o)}),o!==vQ.OneTimeWizard&&t.jsx("div",{className:"pt-2",children:t.jsx(yQ,{onClose:e,currentStep:o,setCurrentStep:i,isDisabled:!b,createAutomation:async()=>{if(!b||!v.name||!v.type)return;p(!0);l({name:v.name,type:v.type,description:v.description},{onSuccess:async t=>{if(t.id){const n=await(async e=>(await Re(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),o=LX().toString();await Pe(t.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:o}}]}),h(t.id),await pQ({automationId:t.id,actionId:o}),r===Fe.ONE_TIME?(i(vQ.OneTimeWizard),p(!1)):e?.(t.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{y({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==r})})]})};function Ole({open:e,setOpen:r,onClose:o,automationType:i,getExtraMergeFields:a}){const[s,l]=n.useState(i?vQ.SetAutomationName:vQ.ChooseAutomationType);return n.useEffect((()=>{e&&l(i?vQ.SetAutomationName:vQ.ChooseAutomationType)}),[e,i]),t.jsx(_B,{open:e,onOpenChange:r,children:t.jsxs(TB,{hideCloseButton:s===vQ.OneTimeWizard,className:`flex max-h-[86vh] ${s===vQ.OneTimeWizard?"max-w-[90vw]":"max-w-4xl"} flex-col gap-0 overflow-visible p-0`,children:[t.jsx(CB,{children:t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs(n$,{children:[t.jsx(NB,{className:"text-3xl font-normal",children:"Create Automation"}),t.jsx(RB,{children:"Create a new automation to send messages to your customers."})]})})}),t.jsx(Rle,{onClose:e=>{o?.(e),r(!1)},automationType:i,currentStep:s,setCurrentStep:l,getExtraMergeFields:a})]})})}const Ple=({tabs:e,activeTab:r,onTabChange:o,tabsLocation:i="left",secondaryTabs:a=!1})=>{const s=n.useRef([]),[l,c]=n.useState({width:0,left:0});n.useEffect((()=>{const t=s.current[e.findIndex((e=>e.id===r))];t&&c({width:t.offsetWidth,left:t.offsetLeft})}),[r,e]);const u=e.find((e=>e.id===r));return t.jsxs("div",{className:"flex flex-col gap-4 w-full overflow-x-hidden h-full",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{className:"relative flex items-center gap-8 "+("left"===i?"w-full justify-start":"w-full justify-center"),children:[t.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,n)=>t.jsx("button",{ref:e=>s.current[n]=e,onClick:()=>o(e.id),className:wB("relative px-7 py-3 transition-all duration-200 text-lg",r!==e.id&&"text-muted-foreground",a&&"text-sm"),children:e.label},e.id)))]})}),t.jsx("div",{className:"relative overflow-hidden flex-grow min-h-0",children:t.jsx("div",{className:"relative h-full",children:u?u.content:null})})]})},kle=e=>{if(!e)return"$0.00";const t="string"==typeof e?e.replace(/,/g,""):e,n=Number(t);return Number.isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(n)},Mle="reach-styles-module__header___-izE2",Lle="reach-styles-module__title___n1hA9",Dle="reach-styles-module__description___EvXM-",jle="reach-styles-module__content___okv68",Ile="reach-styles-module__footer___YA4U4",Fle=ru("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"}}),Ule=i.forwardRef((({className:e,variant:n,...r},o)=>t.jsx("div",{ref:o,className:Qd(Fle({variant:n}),e),...r})));Ule.displayName="Card";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(Mle,e),...n}))).displayName="CardHeader";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(Lle,e),...n}))).displayName="CardTitle";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(Dle,e),...n}))).displayName="CardDescription";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(jle,e),...n}))).displayName="CardContent";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Qd(Ile,e),...n}))).displayName="CardFooter";const $le=({Icon:e,title:n,value:r,tooltipText:o,change:i})=>t.jsxs(Ule,{className:"relative flex flex-col justify-between min-h-[130px] transition-all duration-300 hover:shadow-md p-4",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsx("div",{className:"rounded-lg p-2 bg-primary/10 flex items-center justify-center",children:t.jsx(e,{className:"w-5 h-5 text-primary"})}),t.jsx("div",{className:"absolute top-3 right-3",children:t.jsx(E9,{title:o})})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx("div",{className:"text-2xl font-bold leading-tight text-primary",children:r}),t.jsx(Tre,{children:n})]}),i&&t.jsx("div",{className:"absolute bottom-3 right-3",children:t.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:i})})]}),Vle=({activeTab:e,automation:n})=>{if(!n)return null;const r={sales:[{Icon:xQ.SalesAmount,title:"Order Amount",value:kle(n.derivedRevenue),tooltipText:"Total derived revenue from this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx($le,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Ble=({activeTab:e,statistics:n})=>{const r={email:[{Icon:xQ.MessagesSent,title:"Emails Sent",value:n.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:xQ.OpenRate,title:"Open Rate",value:`${(100*n.email.openPercentage).toFixed(2)}%`,tooltipText:"Percentage of recipients who opened the email out of total emails delivered"},{Icon:xQ.TotalBounceRate,title:"Total Bounce Rate",value:`${(100*(n.email.softBounceRate+n.email.hardBounceRate)).toFixed(2)}%`,tooltipText:"Percentage of emails that were not delivered due to permanent (hard) or temporary (soft) delivery failures"},{Icon:xQ.LinksClicked,title:"Links Clicked",value:n.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:xQ.SpamComplies,title:"Spam Complaints",value:`${(100*n.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:xQ.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*n.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:xQ.MessagesSent,title:"SMS Sent",value:n.sms.numberSent,tooltipText:"Total number of SMS messages that were successfully sent in this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx($le,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},zle=({automationId:e,includeSales:r=!1,automation:o})=>{const[i,a]=n.useState("email"),{statistics:s,isLoading:l}=je(e);if(l||!s)return t.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:t.jsx(fQ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]})});const c=[{id:"email",label:`Email ${ff("engage:insight",{count:2})}`,content:t.jsx(Ble,{activeTab:"email",statistics:s})},{id:"sms",label:`SMS ${ff("engage:insight",{count:2})}`,content:t.jsx(Ble,{activeTab:"sms",statistics:s})},...r?[{id:"sales",label:`Sales ${ff("engage:insight",{count:2})}`,content:t.jsx(Vle,{activeTab:"sales",automation:o})}]:[]];return t.jsx(Ple,{tabs:c,activeTab:i,onTabChange:e=>a(e),tabsLocation:"left"})},Hle={all:["website"],content:()=>[...Hle.all,"content"],analyze:()=>[...Hle.all,"analyze"],brandSettings:()=>[...Hle.all,"brand-settings"]},qle=async()=>(await Re("/web-presence/brand-settings",{method:"POST"})).data,Gle=({isLoading:e,brandSettings:r,onComplete:o})=>{const[i,a]=n.useState(0),[s,l]=n.useState(!1),c=["Analyzing your brand palette","Extracting your visual identity","Discovering your brand personality","Crafting your email style","Finalizing your brand profile"],u=r?.primaryColor||"#4285F4",d=(()=>{const e=e=>e.startsWith("#")?`${e}80`:e;return r?.secondaryColors?.length&&r.secondaryColors.length>0?{start:e(r.primaryColor||"#4285F4"),middle:e(r.secondaryColors[0]||"#FBBC05"),end:e(r.secondaryColors[1]||"#34A853")}:{start:"#F5F5F580",middle:e(u),end:"#C2E7FF80"}})();n.useEffect((()=>{if(!e)return;const t=setInterval((()=>{a((e=>{const n=e+1;return n>=c.length?(clearInterval(t),setTimeout((()=>{l(!0),setTimeout(o,1e3)}),1500),e):n}))}),2500);return()=>clearInterval(t)}),[e,o,c.length]);return s?t.jsx(AX.div,{className:"flex flex-col items-center justify-center h-full w-full",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},children:t.jsxs(AX.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.8,ease:"easeOut"},className:"text-center",children:[t.jsx("h2",{className:"text-2xl font-bold mb-4",style:{color:u},children:"Analysis Complete!"}),t.jsx("p",{className:"text-gray-700",children:"Your brand profile has been successfully created"})]})}):t.jsxs(AX.div,{className:"flex flex-col items-center justify-center h-full w-full relative",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:8,repeat:1/0,repeatType:"reverse"},style:{backgroundImage:`linear-gradient(135deg, ${d.start} 0%, ${d.middle} 50%, ${d.end} 100%)`,backgroundSize:"200% 200%"},children:[t.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-15 backdrop-blur-[2px]"}),t.jsxs("div",{className:"flex flex-col items-center gap-10 p-6 relative z-10",children:[t.jsx(AX.div,r?.logoUrl?{className:"w-32 h-32 sm:w-40 sm:h-40 flex items-center justify-center rounded-lg overflow-hidden bg-white shadow-lg",initial:{scale:.9,rotate:0},animate:{scale:1.05,rotate:0},transition:{scale:{duration:3,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:t.jsx("img",{src:r.logoUrl,alt:"Brand Logo",className:"max-w-full max-h-full object-contain"})}:{className:"w-32 h-32 sm:w-40 sm:h-40 rounded-full flex items-center justify-center",style:{backgroundColor:u},initial:{scale:.9,rotate:0},animate:{scale:[1,1.1,1],rotate:0},transition:{scale:{duration:3,repeat:1/0,ease:"easeInOut"}},children:r?.brandName?t.jsx("span",{className:"text-6xl font-bold text-primary",children:r.brandName.charAt(0)}):t.jsx(Ku,{className:"w-16 h-16 text-primary"})}),t.jsx(AX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"text-xl text-primary font-medium text-center max-w-md drop-shadow-lg",children:c[i]},i),t.jsx("div",{className:"flex space-x-2 mt-4",children:c.map(((e,n)=>t.jsx(AX.div,{className:"h-2 w-2 rounded-full bg-muted-foreground",initial:{opacity:.3},animate:{opacity:n<=i?1:.3,scale:n===i?1.5:1},transition:{duration:.3}},n)))}),r?.brandName&&t.jsxs(AX.div,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:1,duration:1},className:"mt-6 text-primary text-opacity-90 font-medium",children:[r.brandName,r.brandTagline&&t.jsx("span",{className:"block text-sm mt-1 opacity-80",children:r.brandTagline})]})]})]})},Kle=({setAutoParse:e,onBrandSettingsGenerated:r,onForceRefresh:o})=>{const{data:i,updateWebsite:a,isUpdatingWebsite:s,updateBrandSettings:l}=Bte(),c=ye({mutationFn:qle,mutationKey:Hle.brandSettings()}),[u,d]=n.useState(i?.website||""),[p,f]=n.useState(!1),[h,m]=n.useState(null),[g,v]=n.useState(!1),[y,b]=n.useState(!1),x=()=>{e(!1)};return y&&h?t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(Yle,{initialBrandSettings:h,onSave:()=>{h&&(l({logoBase64:h.logo_base64,primaryColor:h.primaryColor,secondaryColors:h.secondaryColors,brandTagline:h.brandTagline,brandName:h.brandName,brandPersonality:h.brandPersonality,colorPalette:h.colorPalette}),o&&o(),Ml({title:"Brand settings saved successfully 🚀",description:"Your brand identity has been updated."}),e(!1))},onBack:x,showAutoParseButton:!1})},"results"):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[t.jsx("div",{className:"relative",children:t.jsxs("div",{className:"pb-6",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:y&&h?h.brandName||"Brand Analysis":"Website Analysis"}),t.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:y?h?.brandTagline||"Automatically generated from your website":"Customize your email branding with our AI analysis"})]})}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.jsxs(zB,{mode:"wait",children:[!g&&!y&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col h-full",children:t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-start px-6 space-y-8",children:[t.jsxs("div",{className:"space-y-2 w-full max-w-md",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block text-center",children:"Your Website URL"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-center",children:[t.jsx(H3,{type:"url",value:u,onChange:e=>d(e.target.value),placeholder:"https://example.com",className:"flex-1",disabled:!p}),t.jsx(zB,{mode:"wait",children:p?t.jsxs(AX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex gap-2",children:[t.jsx(gQ,{variant:"outline",size:"sm",onClick:()=>{f(!1),d(i?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),t.jsx(gQ,{size:"sm",onClick:async()=>{try{a(u),f(!1),Ml({title:"Website URL updated successfully 🎉",description:"Your website URL has been saved."})}catch(e){Ml({title:"Error updating website URL",description:"Please try again.",variant:"destructive"})}},disabled:s||!u,className:"w-full sm:w-auto",children:s?t.jsx(fQ,{}):"Save Changes"})]},"save"):t.jsx(AX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:t.jsx(gQ,{variant:"outline",size:"sm",onClick:()=>f(!0),className:"w-full sm:w-auto",children:"Edit URL"})},"edit")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl",children:[t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"What we'll analyze"}),t.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[t.jsx("li",{children:"• Your brand colors and color palette"}),t.jsx("li",{children:"• Your logo (if detectable)"}),t.jsx("li",{children:"• Your brand name and tagline"}),t.jsx("li",{children:"• Your brand's tone and personality"})]})]}),t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"How it helps you"}),t.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."})]})]}),t.jsx(AX.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"),g&&h&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(Gle,{isLoading:g,brandSettings:h,onComplete:()=>{v(!1),b(!0),Ml({title:"Brand settings generated successfully!",description:"Your brand identity has been analyzed."})}})},"analyzing"),g&&!h&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 flex flex-col items-center justify-center h-full",style:{background:"linear-gradient(135deg, #F5F5F5 0%, #E1E6FC 50%, #C2E7FF 100%)",backgroundSize:"200% 200%"},children:t.jsxs(AX.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:[t.jsxs(AX.div,{className:"relative w-24 h-24 flex items-center justify-center",initial:{scale:.9},animate:{scale:[1,1.1,1],rotate:[0,5,0,-5,0]},transition:{scale:{duration:3,repeat:1/0,repeatType:"reverse"},rotate:{duration:5,repeat:1/0,repeatType:"reverse"}},children:[t.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/10 animate-pulse"}),t.jsx(Bu,{className:"w-12 h-12 text-primary drop-shadow-md"})]}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:"Analyzing your website"}),t.jsx(zB,{mode:"wait",children:t.jsx(AX.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")]})}),!g&&!y&&t.jsxs(AB,{className:"p-4 pb-0",children:[t.jsx(gQ,{variant:"outline",onClick:x,className:"gap-1",children:"Go Back"}),t.jsxs(gQ,{onClick:async()=>{try{v(!0);const e=await c.mutateAsync();m(e),r&&r(e)}catch(e){v(!1),m(null),Ml({title:"Error generating brand settings",description:"Please try again.",variant:"destructive"})}},disabled:!u||c.isPending,className:"gap-1",children:[t.jsx(Ku,{className:"h-4 w-4 text-amber-500"}),c.isPending?t.jsx(fQ,{}):"Analyze Website"]})]})]})},Wle=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],Yle=({initialBrandSettings:e,onSave:r,onBack:o,showAutoParseButton:i=!0})=>{const{data:a,isLoading:s,updateBrandSettings:l,isUpdatingBrandSettings:c}=Bte(),[u,d]=n.useState({}),[p,f]=n.useState(!1),[h,m]=n.useState({}),[g,v]=n.useState(""),[y,b]=n.useState(""),[x,w]=n.useState("#000000"),[_,S]=n.useState(Date.now()),[E,T]=n.useState(!1),[C,A]=n.useState({identity:!0,colors:!0,personality:!0}),N=n.useRef(null),{toast:R}=Ll();n.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 S(Date.now());a?.branding&&(d({brandName:a.branding.brandName||a.name,brandTagline:a.branding.brandTagline||"",logoUrl:a.branding.logoUrl||"",primaryColor:a.branding.primaryColor||"#000000",secondaryColors:a.branding.secondaryColors||[],brandPersonality:{tone:a.branding.brandPersonality?.tone,voice:a.branding.brandPersonality?.voice,values:a.branding.brandPersonality?.values||[]}}),S(Date.now()))}),[a,e]);const O=e=>{A((t=>({...t,[e]:!t[e]})))},P=e=>{m((t=>{const n={...t,[e]:!t[e]};return n[e]&&("brandName"===e?v(u.brandName||""):"brandTagline"===e?v(u.brandTagline||""):"primaryColor"===e?v(u.primaryColor||"#000000"):"tone"===e?v(u.brandPersonality?.tone||""):"voice"===e&&v(u.brandPersonality?.voice||"")),n}))},k=e=>{"brandName"===e?d((e=>({...e,brandName:g}))):"brandTagline"===e?d((e=>({...e,brandTagline:g}))):"primaryColor"===e?d((e=>({...e,primaryColor:g}))):"tone"===e?d((e=>({...e,brandPersonality:{...e.brandPersonality,tone:g||void 0}}))):"voice"===e&&d((e=>({...e,brandPersonality:{...e.brandPersonality,voice:g||void 0}}))),P(e)},M=e=>{P(e)},L=e=>{d((t=>({...t,primaryColor:e})))},D=()=>{y.trim()&&(d((e=>{const t=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:[...t,y.trim()]}}})),b(""))};return s?t.jsx("div",{className:"flex justify-center items-center h-full min-h-[500px] w-full bg-white rounded-lg shadow-sm",children:t.jsx(fQ,{})}):p?t.jsx(Kle,{setAutoParse:f,onForceRefresh:()=>S(Date.now())}):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[t.jsx("div",{className:"w-full h-16 px-6 flex items-center justify-between",children:t.jsxs("div",{children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-800",children:"Brand Settings"}),t.jsx("p",{className:"text-gray-500 text-sm",children:e?"Review and confirm your extracted brand identity":"Craft your brand's visual identity"})]})}),t.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("identity"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Identity"})]}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.identity?gu:fu,{className:"h-4 w-4"})})]}),C.identity&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Name"}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("brandName"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandName?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandName"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>k("brandName"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm font-medium",children:u.brandName})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Tagline"}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("brandTagline"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandTagline?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0,placeholder:"Your brand's tagline"}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandTagline"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>k("brandTagline"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm italic",children:u.brandTagline||"No tagline set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Logo"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Square image, 128x128px, PNG recommended"})]})}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"relative group",children:[t.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:u.logoUrl?t.jsx("img",{src:`${u.logoUrl}?${_}`,alt:u.brandName||"Brand logo",className:"w-full h-full object-contain"},_):t.jsx(Tu,{className:"h-10 w-10 text-gray-300"})}),t.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:[t.jsx("input",{type:"file",ref:N,onChange:e=>{const t=e.target.files?.[0];if(t){const e=new FileReader;e.onloadend=async()=>{const n=e.result.split(",")[1],r=URL.createObjectURL(t);d((e=>({...e,logoUrl:r}))),S(Date.now()),l({logoBase64:n})},e.readAsDataURL(t)}},accept:"image/*",className:"hidden"}),t.jsxs(gQ,{variant:"ghost",size:"sm",onClick:()=>{N.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[t.jsx(Qu,{className:"h-4 w-4 mr-1"}),"Update"]})]})]}),u.logoUrl&&t.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:[t.jsx("div",{className:"flex-1 truncate text-sm text-gray-600 font-mono",children:u.logoUrl}),t.jsxs(gQ,{variant:"ghost",size:"sm",onClick:()=>{u.logoUrl&&(navigator.clipboard.writeText(u.logoUrl),T(!0),setTimeout((()=>T(!1)),1500),R({title:"Logo URL copied to clipboard"}))},className:"h-7 px-2 text-xs shrink-0",children:[E?t.jsx(pu,{className:"h-3.5 w-3.5 mr-1 text-green-500"}):t.jsx(_u,{className:"h-3.5 w-3.5 mr-1"}),E?"Copied":"Copy"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("colors"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Colors"})]}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.colors?gu:fu,{className:"h-4 w-4"})})]}),C.colors&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Primary Color"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Your main brand color used throughout the interface"})]}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("primaryColor"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-14 h-14 rounded-lg shadow-md",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsxs("div",h.primaryColor?{className:"flex flex-1 gap-2 max-w-sm",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Iu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx(H3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"pl-10 h-10 font-mono text-sm flex-1",placeholder:"#000000",maxLength:7,autoFocus:!0})]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("primaryColor"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("primaryColor"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}:{className:"flex-1 max-w-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx(Iu,{className:"h-4 w-4 text-gray-400"}),t.jsx("div",{className:"text-sm font-mono",children:u.primaryColor||"#000000"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(H3,{type:"color",value:u.primaryColor||"#000000",onChange:e=>L(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:Wle.map(((e,n)=>t.jsx(gQ,{variant:"ghost",size:"icon",className:"w-6 h-6 rounded-full border border-gray-200 "+(u.primaryColor===e?"ring-2 ring-gray-400 ring-offset-1":""),style:{backgroundColor:e},onClick:()=>L(e)},n)))})]})]})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Secondary Colors"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Additional colors that complement your primary brand color"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"flex flex-wrap gap-3 mb-4",children:u.secondaryColors?.length?u.secondaryColors.map(((e,n)=>t.jsxs("div",{className:"group relative flex flex-col items-center",children:[t.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}}),t.jsx("div",{className:"text-xs font-mono text-gray-600",children:e}),t.jsx(gQ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.secondaryColors||[];return{...e,secondaryColors:n.filter((e=>e!==t))}}));var t},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:t.jsx(rd,{className:"w-3 h-3 text-gray-500"})})]},n))):t.jsx("div",{className:"text-sm text-gray-500 italic my-2",children:"No secondary colors set"})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex-1 max-w-xs",children:[t.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Add color"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(H3,{type:"color",value:x,onChange:e=>w(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded-md"}),t.jsx(H3,{type:"text",value:x,onChange:e=>w(e.target.value),className:"h-10 font-mono text-sm",placeholder:"#000000",maxLength:7})]})]}),t.jsxs(gQ,{variant:"outline",onClick:()=>{x&&(d((e=>{const t=e.secondaryColors||[];return{...e,secondaryColors:[...t,x]}})),w("#000000"))},className:"h-10",children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add Color"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("personality"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Personality"})]}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.personality?gu:fu,{className:"h-4 w-4"})})]}),C.personality&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Tone"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"The overall feeling and attitude your brand conveys"})]}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("tone"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.tone?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("tone"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("tone"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.tone||"No tone set"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Voice"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"How your brand expresses itself in communication"})]}),t.jsx(gQ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("voice"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.voice?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("voice"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(gQ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("voice"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.voice||"No voice set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Values"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Core principles and beliefs that drive your brand"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"mb-4",children:t.jsx("div",u.brandPersonality?.values&&u.brandPersonality.values.length>0?{className:"flex flex-wrap gap-2",children:u.brandPersonality.values.map(((e,n)=>t.jsxs(PQ,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors",style:{borderColor:`${u.primaryColor}30`||"#f3f4f6",backgroundColor:`${u.primaryColor}08`||"#f9fafb"},children:[e,t.jsx(gQ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:n.filter((e=>e!==t))}}}));var t},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:t.jsx(rd,{className:"w-2.5 h-2.5"})})]},n)))}:{className:"text-sm text-gray-500 italic py-2",children:"No brand values set"})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H3,{placeholder:"Add a brand value",value:y,onChange:e=>b(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&D()}),t.jsxs(gQ,{variant:"outline",onClick:D,disabled:!y.trim(),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),t.jsxs(AB,{className:"p-4 pb-0",children:[o?t.jsx(gQ,{variant:"outline",className:"gap-1.5",onClick:o,children:"Go Back"}):i&&t.jsxs(gQ,{variant:"outline",className:"gap-1.5",onClick:()=>{f(!0)},children:[t.jsx(Ku,{className:"h-4 w-4 text-amber-500"}),"Auto Parse"]}),t.jsx(gQ,{className:"px-4",style:{backgroundColor:u.primaryColor||void 0},onClick:async()=>{l({brandName:u.brandName,brandTagline:u.brandTagline,logoBase64:u.logoUrl,primaryColor:u.primaryColor,secondaryColors:u.secondaryColors,brandPersonality:u.brandPersonality}),R({title:"Brand settings saved 🚀"}),r&&r()},disabled:c,children:c?"Saving":"Save Changes"})]})]})};function Xle({open:e,setOpen:n}){return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{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",hideCloseButton:!0,children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Brand Settings"}),t.jsx(RB,{children:"Edit your business brand settings"})]}),t.jsx(Yle,{})]})})}const Qle=e=>{const{updateAutomation:t,updateError:r,isUpdateSuccess:o}=De(e),{toast:i}=Ll();return n.useEffect((()=>{o?i({title:"Status updated",description:"The status has been updated successfully"}):r&&i({title:"Error updating status",description:"Please try again",variant:"destructive"})}),[o,r,i]),{toggleStatus:async e=>{try{return await t({status:e?Ve.ACTIVE:Ve.DRAFT}),!0}catch(n){return i({title:"Error updating status",description:"Please try again",variant:"destructive"}),!1}}}};function Zle(){const{toast:e}=Ll(),[r,o]=n.useState(null),{toggleStatus:i}=Qle(r||""),a=H5(),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{automations:f,nextCursor:h,isLoading:m,error:g,isFetching:v,isPlaceholderData:y}=Ie({cursor:c,limit:s,triggerType:Fe.TRIGGER_BASED,search:d||void 0});n.useEffect((()=>{g&&e({title:`Error Fetching ${ff("engage:automation")}`,description:g?.message||"Please try again.",variant:"destructive"})}),[g,e]);const b=n.useMemo((()=>(f||[]).map((e=>({...e,emailsSent:0,smsSent:0,updated_at:e.updatedAt||e.createdAt})))),[f]),x=n.useCallback((async(e,t)=>{try{o(e);const n=t===Ve.ACTIVE;await i(n)}finally{o(null)}}),[i,o]),w=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]),_=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),S=n.useMemo((()=>g9({automationName:ff("engage:automation"),setUrl:_,onToggle:x,vsaasManaged:!0})),[x,_]);return t.jsx("div",{className:"w-full h-[75vh] flex flex-col",children:t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(G3,{data:b,columns:S,paginationMode:"cursor",initialPageSize:s,isLoading:m&&!y,onRowClick:e=>{a(`/automations/view-modal/${e.id}?showBackButton=true`)},cursorPaginationQueryResult:{nextCursor:h,isLoading:m,isFetching:v,isPlaceholderData:y},onQueryParametersChange:w,searchValue:d,onSearchChange:p})})})}function Jle(){const{toast:e}=Ll(),[r,o]=n.useState(!1),[i,a]=n.useState(null),{toggleStatus:s}=Qle(i||""),l=H5(),[c,u]=n.useState(10),[d,p]=n.useState(void 0),[f,h]=n.useState(""),{automations:m,nextCursor:g,isLoading:v,error:y,isFetching:b,isPlaceholderData:x}=Ie({cursor:d,limit:c,triggerType:Fe.ONE_TIME,search:f||void 0});n.useEffect((()=>{y&&e({title:`Error Fetching ${ff("engage:one_time")}`,description:y?.message||"Please try again.",variant:"destructive"})}),[y,e]);const w=n.useMemo((()=>(m||[]).map((e=>({...e,updated_at:e.updatedAt})))),[m]),_=n.useCallback((async(e,t)=>{try{a(e);const n=t===Ve.ACTIVE;await s(n)}finally{a(null)}}),[s,a]),S=n.useCallback((e=>{p(e.cursor),u(e.pageSize)}),[]),E=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),T=n.useMemo((()=>g9({automationName:ff("engage:one_time"),setUrl:E,onToggle:_})),[_,E]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(G3,{data:w,columns:T,paginationMode:"cursor",initialPageSize:c,headerActions:t.jsxs(gQ,{className:"bg-primary",onClick:()=>o(!0),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"New"]}),isLoading:v&&!x,cursorPaginationQueryResult:{nextCursor:g,isLoading:v,isFetching:b,isPlaceholderData:x},onRowClick:e=>{l(`/automations/view-modal/${e.id}?showBackButton=true`)},onQueryParametersChange:S,searchValue:f,onSearchChange:h})}),t.jsx(Ole,{open:r,setOpen:o,onClose:t=>{s9(o,e,t,`Error creating ${ff("engage:one_time")}`,"Please try again"),p(void 0),u(10),h(""),!1!==t&&l(`/automations/view-modal/${t}?showBackButton=true`)},automationType:Fe.ONE_TIME})]})}function ece(){const{toast:e}=Ll(),[r,o]=n.useState(!1),[i,a]=n.useState(null),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{segments:f,isLoading:h,nextCursor:m,isFetching:g,isPlaceholderData:v}=QX({search:d||void 0,cursor:c,limit:s}),y=n.useCallback((e=>{a(e),o(!0)}),[a]),b=n.useMemo((()=>function(e){return[u9("name",`${ff("engage:segment")} Name`,!0),d9(),a9({accessorKey:"user_count",header:ff("engage:user_other"),meta:{align:"right",displayName:ff("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const t=e.getValue()??0;return`${t.toLocaleString()} ${1===t?ff("engage:user").toLowerCase():ff("engage:user_other").toLowerCase()}`}}),p9("user_count_updated_at"),m9(e||(()=>{}))]}(y)),[y]),x=n.useMemo((()=>f?f.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[f]),w=n.useMemo((()=>t.jsxs(gQ,{onClick:()=>{a(null),o(!0)},children:[t.jsx(Vu,{className:"h-4 w-4"}),"New List"]})),[]),_=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(G3,{data:x,columns:b,paginationMode:"cursor",initialPageSize:s,headerActions:w,isLoading:h&&!v,cursorPaginationQueryResult:{nextCursor:m,isLoading:h,isFetching:g,isPlaceholderData:v},onQueryParametersChange:_,onRowClick:e=>{a(e.id),o(!0)},searchValue:d,onSearchChange:p})}),t.jsx(hle,{open:r,setOpen:o,segmentId:i??void 0,onSegmentUpdated:t=>{s9(o,e,t,`Error creating ${ff("engage:segment")}`,"Please try again"),u(void 0),l(10),p("")}})]})}const tce=()=>{const e=[{id:"broadcasts",label:ff("engage:one_time",{count:2}),content:t.jsx(Jle,{})},{id:"automations",label:ff("engage:automation",{count:2}),content:t.jsx(Zle,{})},{id:"segments",label:ff("engage:segment",{count:2}),content:t.jsx(ece,{})},{id:"statistics",label:ff("engage:insight",{count:2}),content:t.jsx(zle,{})}],r=ce(),[o,i]=n.useState(!1),[a,s]=n.useState(e[0].id);return n.useEffect((()=>{r.prefetchQuery({queryKey:Oe.list()}),r.prefetchQuery({queryKey:YX.lists()})}),[r]),t.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[t.jsx(Xle,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(gQ,{variant:"outline",onClick:()=>i(!0),children:t.jsx(qu,{className:"w-4 h-4"})})}),t.jsx("div",{className:"flex-1 w-full h-full flex flex-col gap-4",children:t.jsx(Ple,{activeTab:a,tabs:e,onTabChange:s})})]})};var nce=e=>"checkbox"===e.type,rce=e=>e instanceof Date,oce=e=>null==e;const ice=e=>"object"==typeof e;var ace=e=>!oce(e)&&!Array.isArray(e)&&ice(e)&&!rce(e),sce=e=>ace(e)&&e.target?nce(e.target)?e.target.checked:e.target.value:e,lce=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),cce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function uce(e){let t;const n=Array.isArray(e),r="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(cce&&(e instanceof Blob||r)||!n&&!ace(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return ace(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=uce(e[n]));else t=e}return t}var dce=e=>Array.isArray(e)?e.filter(Boolean):[],pce=e=>void 0===e,fce=(e,t,n)=>{if(!t||!ace(e))return n;const r=dce(t.split(/[,[\].]+?/)).reduce(((e,t)=>oce(e)?e:e[t]),e);return pce(r)||r===e?pce(e[t])?n:e[t]:r},hce=e=>"boolean"==typeof e,mce=e=>/^\w*$/.test(e),gce=e=>dce(e.replace(/["|']|\]/g,"").split(/\.|\[/)),vce=(e,t,n)=>{let r=-1;const o=mce(t)?[t]:gce(t),i=o.length,a=i-1;for(;++r<i;){const t=o[r];let i=n;if(r!==a){const n=e[t];i=ace(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const yce="blur",bce="focusout",xce="change",wce="onBlur",_ce="onChange",Sce="onSubmit",Ece="onTouched",Tce="all",Cce="max",Ace="min",Nce="maxLength",Rce="minLength",Oce="pattern",Pce="required",kce="validate",Mce=n.createContext(null),Lce=()=>n.useContext(Mce);var Dce=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Tce&&(t._proxyFormState[o]=!r||Tce),n&&(n[o]=!0),e[o]}});return o},jce=e=>oce(e)||!ice(e);function Ice(e,t){if(jce(e)||jce(t))return e===t;if(rce(e)&&rce(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const n=e[o];if(!r.includes(o))return!1;if("ref"!==o){const e=t[o];if(rce(n)&&rce(e)||ace(n)&&ace(e)||Array.isArray(n)&&Array.isArray(e)?!Ice(n,e):n!==e)return!1}}return!0}const Fce=(e,t)=>{const r=n.useRef(t);Ice(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var Uce=e=>"string"==typeof e,$ce=(e,t,n,r,o)=>Uce(e)?(r&&t.watch.add(e),fce(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),fce(n,e)))):(r&&(t.watchAll=!0),n);function Vce(e){const t=Lce(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=lce(i._names.array,r),l=function(e){const t=Lce(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return Fce((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c($ce(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:fce(i._formValues,r,fce(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=Lce(),{control:r=t.control,disabled:o,name:i,exact:a}=e||{},[s,l]=n.useState(r._formState),c=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Fce((()=>r._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!o&&l({...r._formState,...e})}})),[i,o,a]),n.useEffect((()=>{c.current.isValid&&r._setValid(!0)}),[r]),n.useMemo((()=>Dce(s,r,c.current,!1)),[s,r])}({control:i,name:r,exact:!0}),u=n.useRef(e),d=n.useRef(i.register(r,{...e.rules,value:l,...hce(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!fce(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!fce(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!fce(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!fce(c.validatingFields,r)},error:{enumerable:!0,get:()=>fce(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:sce(e),name:r},type:xce})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:fce(i._formValues,r),name:r},type:yce})),[r,i._formValues]),m=n.useCallback((e=>{const t=fce(i._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}),[i._fields,r]),g=n.useMemo((()=>({name:r,value:l,...hce(o)||c.disabled?{disabled:c.disabled||o}:{},onChange:f,onBlur:h,ref:m})),[r,o,c.disabled,f,h,m,l]);return n.useEffect((()=>{const e=i._options.shouldUnregister||a;i.register(r,{...u.current.rules,...hce(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=fce(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=uce(fce(i._options.defaultValues,r));vce(i._defaultValues,r,e),pce(fce(i._formValues,r))&&vce(i._formValues,r,e)}return!s&&i.register(r),()=>{(s?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}}),[r,i,s,a]),n.useEffect((()=>{i._setDisabledField({disabled:o,name:r})}),[o,r,i]),n.useMemo((()=>({field:g,formState:c,fieldState:p})),[g,c,p])}const Bce=e=>e.render(Vce(e));var zce=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Hce=e=>Array.isArray(e)?e:[e],qce=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},Gce=e=>ace(e)&&!Object.keys(e).length,Kce=e=>"file"===e.type,Wce=e=>"function"==typeof e,Yce=e=>{if(!cce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Xce=e=>"select-multiple"===e.type,Qce=e=>"radio"===e.type,Zce=e=>Yce(e)&&e.isConnected;function Jce(e,t){const n=Array.isArray(t)?t:mce(t)?[t]:gce(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=pce(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(ace(r)&&Gce(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!pce(e[t]))return!1;return!0}(r))&&Jce(e,n.slice(0,-1)),e}var eue=e=>{for(const t in e)if(Wce(e[t]))return!0;return!1};function tue(e,t={}){const n=Array.isArray(e);if(ace(e)||n)for(const r in e)Array.isArray(e[r])||ace(e[r])&&!eue(e[r])?(t[r]=Array.isArray(e[r])?[]:{},tue(e[r],t[r])):oce(e[r])||(t[r]=!0);return t}function nue(e,t,n){const r=Array.isArray(e);if(ace(e)||r)for(const o in e)Array.isArray(e[o])||ace(e[o])&&!eue(e[o])?pce(t)||jce(n[o])?n[o]=Array.isArray(e[o])?tue(e[o],[]):{...tue(e[o])}:nue(e[o],oce(t)?{}:t[o],n[o]):n[o]=!Ice(e[o],t[o]);return n}var rue=(e,t)=>nue(e,t,tue(t));const oue={value:!1,isValid:!1},iue={value:!0,isValid:!0};var aue=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!pce(e[0].attributes.value)?pce(e[0].value)||""===e[0].value?iue:{value:e[0].value,isValid:!0}:iue:oue}return oue},sue=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>pce(e)?e:t?""===e?NaN:e?+e:e:n&&Uce(e)?new Date(e):r?r(e):e;const lue={isValid:!1,value:null};var cue=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),lue):lue;function uue(e){const t=e.ref;return Kce(t)?t.files:Qce(t)?cue(e.refs).value:Xce(t)?[...t.selectedOptions].map((({value:e})=>e)):nce(t)?aue(e.refs).value:sue(pce(t.value)?e.ref.value:t.value,e)}var due=e=>e instanceof RegExp,pue=e=>pce(e)?e:due(e)?e.source:ace(e)?due(e.value)?e.value.source:e.value:e,fue=e=>({isOnSubmit:!e||e===Sce,isOnBlur:e===wce,isOnChange:e===_ce,isOnAll:e===Tce,isOnTouch:e===Ece});const hue="AsyncFunction";var mue=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const gue=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=fce(e,o);if(n){const{_f:e,...i}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],o)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(gue(i,t))break}else if(ace(i)&&gue(i,t))break}}};function vue(e,t,n){const r=fce(e,n);if(r||mce(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=fce(t,r),a=fce(e,r);if(i&&!Array.isArray(i)&&n!==r)return{name:n};if(a&&a.type)return{name:r,error:a};o.pop()}return{name:n}}var yue=(e,t,n)=>{const r=Hce(fce(e,n));return vce(r,"root",t[n]),vce(e,n,r),e},bue=e=>Uce(e);function xue(e,t,n="validate"){if(bue(e)||Array.isArray(e)&&e.every(bue)||hce(e)&&!e)return{type:n,message:bue(e)?e:"",ref:t}}var wue=e=>ace(e)&&!due(e)?e:{value:e,message:""},_ue=async(e,t,n,r,o,i)=>{const{ref:a,refs:s,required:l,maxLength:c,minLength:u,min:d,max:p,pattern:f,validate:h,name:m,valueAsNumber:g,mount:v}=e._f,y=fce(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,x=e=>{o&&b.reportValidity&&(b.setCustomValidity(hce(e)?"":e||""),b.reportValidity())},w={},_=Qce(a),S=nce(a),E=_||S,T=(g||Kce(a))&&pce(a.value)&&pce(y)||Yce(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=zce.bind(null,m,r,w),A=(e,t,n,r=Nce,o=Rce)=>{const i=e?t:n;w[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(i?!Array.isArray(y)||!y.length:l&&(!E&&(T||oce(y))||hce(y)&&!y||S&&!aue(s).isValid||_&&!cue(s).isValid)){const{value:e,message:t}=bue(l)?{value:!!l,message:l}:wue(l);if(e&&(w[m]={type:Pce,message:t,ref:b,...C(Pce,t)},!r))return x(t),w}if(!(T||oce(d)&&oce(p))){let e,t;const n=wue(p),o=wue(d);if(oce(y)||isNaN(y)){const r=a.valueAsDate||new Date(y),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==a.type,l="week"==a.type;Uce(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),Uce(o.value)&&y&&(t=s?i(y)<i(o.value):l?y<o.value:r<new Date(o.value))}else{const r=a.valueAsNumber||(y?+y:y);oce(n.value)||(e=r>n.value),oce(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,Cce,Ace),!r))return x(w[m].message),w}if((c||u)&&!T&&(Uce(y)||i&&Array.isArray(y))){const e=wue(c),t=wue(u),n=!oce(e.value)&&y.length>+e.value,o=!oce(t.value)&&y.length<+t.value;if((n||o)&&(A(n,e.message,t.message),!r))return x(w[m].message),w}if(f&&!T&&Uce(y)){const{value:e,message:t}=wue(f);if(due(e)&&!y.match(e)&&(w[m]={type:Oce,message:t,ref:a,...C(Oce,t)},!r))return x(t),w}if(h)if(Wce(h)){const e=xue(await h(y,n),b);if(e&&(w[m]={...e,...C(kce,e.message)},!r))return x(e.message),w}else if(ace(h)){let e={};for(const t in h){if(!Gce(e)&&!r)break;const o=xue(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},x(o.message),r&&(w[m]=e))}if(!Gce(e)&&(w[m]={ref:b,...e},!r))return w}return x(!0),w};const Sue={mode:Sce,reValidateMode:_ce,shouldFocusError:!0};function Eue(e={}){let t={...Sue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Wce(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const r={};let o,i=(ace(t.defaultValues)||ace(t.values))&&uce(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:uce(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let d={...u};const p={array:qce(),state:qce()},f=fue(t.mode),h=fue(t.reValidateMode),m=t.criteriaMode===Tce,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?Gce((await w()).errors):await _(r,!0);e!==n.isValid&&p.state.next({isValid:e})}},v=(e,r)=>{!t.disabled&&(u.isValidating||u.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(r?vce(n.validatingFields,e,r):Jce(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!Gce(n.validatingFields)}))},y=(e,t,n,o)=>{const l=fce(r,e);if(l){const r=fce(a,e,pce(n)?fce(i,e):n);pce(r)||o&&o.defaultChecked||t?vce(a,e,t?r:uue(l._f)):T(e,r),s.mount&&g()}},b=(e,r,o,a,s)=>{let l=!1,c=!1;const f={name:e};if(!t.disabled){if(!o||a){(u.isDirty||d.isDirty)&&(c=n.isDirty,n.isDirty=f.isDirty=S(),l=c!==f.isDirty);const t=Ice(fce(i,e),r);c=!!fce(n.dirtyFields,e),t?Jce(n.dirtyFields,e):vce(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=fce(n.touchedFields,e);t||(vce(n.touchedFields,e,o),f.touchedFields=n.touchedFields,l=l||(u.touchedFields||d.touchedFields)&&t!==o)}l&&s&&p.state.next(f)}return l?f:{}},x=(e,r,i,a)=>{const s=fce(n.errors,e),l=(u.isValid||d.isValid)&&hce(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{vce(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?vce(n.errors,e,i):Jce(n.errors,e)),(i?!Ice(s,i):s)||!Gce(a)||l){const t={...a,...l&&hce(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{v(e,!0);const n=await t.resolver(a,t.context,((e,t,n,r)=>{const o={};for(const i of e){const e=fce(t,i);e&&vce(o,i,e._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}})(e||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return v(e),n},_=async(e,r,o={valid:!0})=>{for(const s in e){const c=e[s];if(c){const{_f:e,...d}=c;if(e){const d=l.array.has(e.name),p=c._f&&(!!(i=c._f)&&!!i.validate&&!!(Wce(i.validate)&&i.validate.constructor.name===hue||ace(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===hue))));p&&u.validatingFields&&v([s],!0);const f=await _ue(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(fce(f,e.name)?d?yue(n.errors,f,e.name):vce(n.errors,e.name,f[e.name]):Jce(n.errors,e.name))}!Gce(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&vce(a,e,n),!Ice(P(),i)),E=(e,t,n)=>$ce(e,l,{...s.mount?a:pce(t)?i:Uce(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=fce(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&vce(a,e,sue(t,n)),i=Yce(n.ref)&&oce(t)?"":t,Xce(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?nce(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):n.refs[0]&&(n.refs[0].checked=!!i):n.refs.forEach((e=>e.checked=e.value===i)):Kce(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:uce(a)})))}(n.shouldDirty||n.shouldTouch)&&b(e,i,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&O(e)},C=(e,t,n)=>{for(const o in t){const i=t[o],a=`${e}.${o}`,s=fce(r,a);(l.array.has(e)||ace(i)||s&&!s._f)&&!rce(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=fce(r,e),f=l.array.has(e),h=uce(t);vce(a,e,h),f?(p.array.next({name:e,values:uce(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:rue(i,a),isDirty:S(e,h)})):!c||c._f||oce(h)?T(e,h,o):C(e,h,o),mue(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:uce(a)})},N=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=fce(r,c),E=e=>{y=Number.isNaN(e)||rce(e)&&isNaN(e.getTime())||Ice(e,fce(a,c,e))};if(S){let s,C;const A=i.type?uue(S._f):sce(e),N=e.type===yce||e.type===bce,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||fce(n.errors,c)||S._f.deps)||((e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e))(N,fce(n.touchedFields,c),n.isSubmitted,h,f),P=mue(c,l,N);vce(a,c,A),N?(S._f.onBlur&&S._f.onBlur(e),o&&o(0)):S._f.onChange&&S._f.onChange(e);const k=b(c,A,N),M=!Gce(k)||P;if(!N&&p.state.next({name:c,type:e.type,values:uce(a)}),R)return(u.isValid||d.isValid)&&("onBlur"===t.mode?N&&g():N||g()),M&&p.state.next({name:c,...P?{}:k});if(!N&&P&&p.state.next({...n}),t.resolver){const{errors:e}=await w([c]);if(E(A),y){const t=vue(n.errors,r,c),o=vue(e,r,t.name||c);s=o.error,c=o.name,C=Gce(e)}}else v([c],!0),s=(await _ue(S,l.disabled,a,m,t.shouldUseNativeValidation))[c],v([c]),E(A),y&&(s?C=!1:(u.isValid||d.isValid)&&(C=await _(r,!0)));y&&(S._f.deps&&O(S._f.deps),x(c,C,s,k))}var T},R=(e,t)=>{if(fce(n.errors,t)&&e.focus)return e.focus(),1},O=async(e,o={})=>{let i,a;const s=Hce(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=fce(t,r);e?vce(n.errors,r,e):Jce(n.errors,r)}else n.errors=t;return t})(pce(e)?e:s);i=Gce(t),a=e?!s.some((e=>fce(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=fce(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!Uce(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&gue(r,R,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return pce(e)?t:Uce(e)?fce(t,e):e.map((e=>fce(t,e)))},k=(e,t)=>({invalid:!!fce((t||n).errors,e),isDirty:!!fce((t||n).dirtyFields,e),error:fce((t||n).errors,e),isValidating:!!fce(n.validatingFields,e),isTouched:!!fce((t||n).touchedFields,e)}),M=(e,t,o)=>{const i=(fce(r,e,{_f:{}})._f||{}).ref,a=fce(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;vce(n.errors,e,{...u,...t,ref:i}),p.state.next({name:e,errors:n.errors,isValid:!1}),o&&o.shouldFocus&&i&&i.focus&&i.focus()},L=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!Hce(r).some((e=>e&&(i?e===o:e.startsWith(o)||o.startsWith(e))))||!((e,t,n,r)=>{n(e);const{name:o,...i}=e;return Gce(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||Tce)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,D=(e,o={})=>{for(const s of e?Hce(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(Jce(r,s),Jce(a,s)),!o.keepError&&Jce(n.errors,s),!o.keepDirty&&Jce(n.dirtyFields,s),!o.keepTouched&&Jce(n.touchedFields,s),!o.keepIsValidating&&Jce(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&Jce(i,s);p.state.next({values:uce(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},j=({disabled:e,name:t})=>{(hce(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=fce(r,e);const a=hce(n.disabled)||hce(t.disabled);return vce(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?j({disabled:hce(n.disabled)?n.disabled:t.disabled,name:e}):y(e,!0,n.value),{...a?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:pue(n.min),max:pue(n.max),minLength:pue(n.minLength),maxLength:pue(n.maxLength),pattern:pue(n.pattern)}:{},name:e,onChange:N,onBlur:N,ref:a=>{if(a){I(e,n),o=fce(r,e);const t=pce(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>Qce(e)||nce(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;vce(r,e,{_f:{...o._f,...s?{refs:[...l.filter(Zce),t,...Array.isArray(fce(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=fce(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!lce(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&gue(r,R,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=uce(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await w();n.errors=e,c=t}else await _(r);if(l.disabled.size)for(const e of l.disabled)vce(c,e,void 0);if(Jce(n.errors,"root"),Gce(n.errors)){p.state.next({errors:{}});try{await e(c,i)}catch(u){s=u}}else o&&await o({...n.errors},i),F(),setTimeout(F);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gce(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?uce(e):i,d=uce(c),f=Gce(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(rue(i,a))]);for(const t of Array.from(e))fce(n.dirtyFields,t)?vce(h,t,fce(a,t)):A(t,fce(h,t))}else{if(cce&&pce(e))for(const e of l.mount){const t=fce(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Yce(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,fce(h,e))}a=uce(h),p.array.next({values:{...h}}),p.state.next({values:{...h}})}l={mount:o.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!o.keepIsValid||!!o.keepDirtyValues,s.watch=!!t.shouldUnregister,p.state.next({submitCount:o.keepSubmitCount?n.submitCount:0,isDirty:!f&&(o.keepDirty?n.isDirty:!(!o.keepDefaultValues||Ice(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?rue(i,a):n.dirtyFields:o.keepDefaultValues&&e?rue(i,e):o.keepDirty?n.dirtyFields:{},touchedFields:o.keepTouched?n.touchedFields:{},errors:o.keepErrors?n.errors:{},isSubmitSuccessful:!!o.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},V=(e,t)=>$(Wce(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:D,getFieldState:k,handleSubmit:U,setError:M,_subscribe:L,_runSchema:w,_getWatch:E,_getDirty:S,_setValid:g,_setFieldArray:(e,o=[],l,c,f=!0,h=!0)=>{if(c&&l&&!t.disabled){if(s.action=!0,h&&Array.isArray(fce(r,e))){const t=l(fce(r,e),c.argA,c.argB);f&&vce(r,e,t)}if(h&&Array.isArray(fce(n.errors,e))){const t=l(fce(n.errors,e),c.argA,c.argB);f&&vce(n.errors,e,t),((e,t)=>{!dce(fce(e,t)).length&&Jce(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(fce(n.touchedFields,e))){const t=l(fce(n.touchedFields,e),c.argA,c.argB);f&&vce(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=rue(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else vce(a,e,o)},_setDisabledField:j,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>dce(fce(s.mount?a:i,e,t.shouldUnregister?fce(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>Wce(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=fce(r,e);t&&(t._f.refs?t._f.refs.every((e=>!Zce(e))):!Zce(t._f.ref))&&D(e)}l.unMount=new Set},_disableForm:e=>{hce(e)&&(p.state.next({disabled:e}),gue(r,((t,n)=>{const o=fce(r,n);o&&(t.disabled=o._f.disabled||e,Array.isArray(o._f.refs)&&o._f.refs.forEach((t=>{t.disabled=o._f.disabled||e})))}),0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return r},get _formValues(){return a},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:e=>(s.mount=!0,d={...d,...e.formState},L({...e,formState:d})),trigger:O,register:I,handleSubmit:U,watch:(e,t)=>Wce(e)?p.state.subscribe({next:n=>e(E(void 0,t),n)}):E(e,t,!0),setValue:A,getValues:P,reset:V,resetField:(e,t={})=>{fce(r,e)&&(pce(t.defaultValue)?A(e,uce(fce(i,e))):(A(e,t.defaultValue),vce(i,e,uce(t.defaultValue))),t.keepTouched||Jce(n.touchedFields,e),t.keepDirty||(Jce(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,uce(fce(i,e))):S()),t.keepError||(Jce(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&Hce(e).forEach((e=>Jce(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:D,setError:M,setFocus:(e,t={})=>{const n=fce(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&Wce(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const Tue="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Cue(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:Wce(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:Wce(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:Eue(e),formState:o},e.formControl&&e.defaultValues&&!Wce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Tue((()=>{const e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i((e=>({...e,isReady:!0}))),e}),[a]),n.useEffect((()=>a._disableForm(e.disabled)),[a,e.disabled]),n.useEffect((()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode),e.errors&&!Gce(e.errors)&&a._setErrors(e.errors)}),[a,e.errors,e.mode,e.reValidateMode]),n.useEffect((()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})}),[a,e.shouldUnregister]),n.useEffect((()=>{if(a._proxyFormState.isDirty){const e=a._getDirty();e!==o.isDirty&&a._subjects.state.next({isDirty:e})}}),[a,o.isDirty]),n.useEffect((()=>{e.values&&!Ice(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,i((e=>({...e})))):a._resetDefaultValues()}),[a,e.values]),n.useEffect((()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()})),t.current.formState=Dce(o,a),t.current}const Aue=(e,t,n)=>{if(e&&"reportValidity"in e){const r=fce(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Nue=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Aue(r.ref,n,e):r.refs&&r.refs.forEach((t=>Aue(t,n,e)))}},Rue=(e,t)=>{t.shouldUseNativeValidation&&Nue(e,t);const n={};for(const r in e){const o=fce(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Oue(t.names||Object.keys(e),r)){const e=Object.assign({},fce(n,r));vce(e,"root",i),vce(n,r,e)}else vce(n,r,i)}return n},Oue=(e,t)=>e.some((e=>e.startsWith(t+".")));var Pue,kue,Mue,Lue=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,i=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[a]={message:s.message,type:s.code}}else n[a]={message:i,type:o};if("unionErrors"in r&&r.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var l=n[a].types,c=l&&l[r.code];n[a]=zce(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},Due=function(e,t,n){return void 0===n&&(n={}),function(r,o,i){try{return Promise.resolve(function(o,a){try{var s=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then((function(e){return i.shouldUseNativeValidation&&Nue({},i),{errors:{},values:n.raw?r:e}}))}catch(l){return a(l)}return s&&s.then?s.then(void 0,a):s}(0,(function(e){if(t=e,Array.isArray(null==t?void 0:t.errors))return{values:{},errors:Rue(Lue(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};(kue=Pue||(Pue={})).assertEqual=e=>e,kue.assertIs=function(e){},kue.assertNever=function(e){throw new Error},kue.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},kue.getValidEnumValues=e=>{const t=kue.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return kue.objectValues(n)},kue.objectValues=e=>kue.objectKeys(e).map((function(t){return e[t]})),kue.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},kue.find=(e,t)=>{for(const n of e)if(t(n))return n},kue.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,kue.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},kue.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Mue||(Mue={})).mergeShapes=(e,t)=>({...e,...t});const jue=Pue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Iue=e=>{switch(typeof e){case"undefined":return jue.undefined;case"string":return jue.string;case"number":return isNaN(e)?jue.nan:jue.number;case"boolean":return jue.boolean;case"function":return jue.function;case"bigint":return jue.bigint;case"symbol":return jue.symbol;case"object":return Array.isArray(e)?jue.array:null===e?jue.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?jue.promise:"undefined"!=typeof Map&&e instanceof Map?jue.map:"undefined"!=typeof Set&&e instanceof Set?jue.set:"undefined"!=typeof Date&&e instanceof Date?jue.date:jue.object;default:return jue.unknown}},Fue=Pue.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 Uue 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 t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const o of e.issues)if("invalid_union"===o.code)o.unionErrors.map(r);else if("invalid_return_type"===o.code)r(o.returnTypeError);else if("invalid_arguments"===o.code)r(o.argumentsError);else if(0===o.path.length)n._errors.push(t(o));else{let e=n,r=0;for(;r<o.path.length;){const n=o.path[r];r===o.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Uue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pue.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Uue.create=e=>new Uue(e);const $ue=(e,t)=>{let n;switch(e.code){case Fue.invalid_type:n=e.received===jue.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Fue.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Pue.jsonStringifyReplacer)}`;break;case Fue.unrecognized_keys:n=`Unrecognized key(s) in object: ${Pue.joinValues(e.keys,", ")}`;break;case Fue.invalid_union:n="Invalid input";break;case Fue.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Pue.joinValues(e.options)}`;break;case Fue.invalid_enum_value:n=`Invalid enum value. Expected ${Pue.joinValues(e.options)}, received '${e.received}'`;break;case Fue.invalid_arguments:n="Invalid function arguments";break;case Fue.invalid_return_type:n="Invalid function return type";break;case Fue.invalid_date:n="Invalid date";break;case Fue.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}"`:Pue.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Fue.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 Fue.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 Fue.custom:n="Invalid input";break;case Fue.invalid_intersection_types:n="Intersection results could not be merged";break;case Fue.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Fue.not_finite:n="Number must be finite";break;default:n=t.defaultError,Pue.assertNever(e)}return{message:n}};let Vue=$ue;function Bue(){return Vue}const zue=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],a={...o,path:i};if(void 0!==o.message)return{...o,path:i,message:o.message};let s="";const l=r.filter((e=>!!e)).slice().reverse();for(const c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function Hue(e,t){const n=Bue(),r=zue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===$ue?void 0:$ue].filter((e=>!!e))});e.common.issues.push(r)}class que{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return Gue;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return que.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:o}=r;if("aborted"===t.status)return Gue;if("aborted"===o.status)return Gue;"dirty"===t.status&&e.dirty(),"dirty"===o.status&&e.dirty(),"__proto__"===t.value||void 0===o.value&&!r.alwaysSet||(n[t.value]=o.value)}return{status:e.value,value:n}}}const Gue=Object.freeze({status:"aborted"}),Kue=e=>({status:"dirty",value:e}),Wue=e=>({status:"valid",value:e}),Yue=e=>"aborted"===e.status,Xue=e=>"dirty"===e.status,Que=e=>"valid"===e.status,Zue=e=>"undefined"!=typeof Promise&&e instanceof Promise;function Jue(e,t,n,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function ede(e,t,n,r,o){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var tde,nde,rde,ode;"function"==typeof SuppressedError&&SuppressedError,(nde=tde||(tde={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},nde.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ide{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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 ade=(e,t)=>{if(Que(t))return{success:!0,data:t.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 t=new Uue(e.common.issues);return this._error=t,this._error}}};function sde(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:o};return{errorMap:(t,o)=>{var i,a;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:o.defaultError}:void 0===o.data?{message:null!==(i=null!=s?s:r)&&void 0!==i?i:o.defaultError}:"invalid_type"!==t.code?{message:o.defaultError}:{message:null!==(a=null!=s?s:n)&&void 0!==a?a:o.defaultError}},description:o}}class lde{get description(){return this._def.description}_getType(e){return Iue(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Iue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new que,ctx:{common:e.parent.common,data:e.data,parsedType:Iue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Zue(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Iue(e)},o=this._parseSync({data:e,path:r.path,parent:r});return ade(r,o)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Iue(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return Que(t)?{value:t.value}:{issues:r.common.issues}}catch(eSe){(null===(n=null===(t=null==eSe?void 0:eSe.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then((e=>Que(e)?{value:e.value}:{issues:r.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Iue(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(Zue(r)?r:Promise.resolve(r));return ade(n,o)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const o=e(t),i=()=>r.addIssue({code:Fue.custom,...n(t)});return"undefined"!=typeof Promise&&o instanceof Promise?o.then((e=>!!e||(i(),!1))):!!o||(i(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new ipe({schema:this,typeName:hpe.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 ape.create(this,this._def)}nullable(){return spe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Hde.create(this)}promise(){return ope.create(this,this._def)}or(e){return Kde.create([this,e],this._def)}and(e){return Yde.create(this,e,this._def)}transform(e){return new ipe({...sde(this._def),schema:this,typeName:hpe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new lpe({...sde(this._def),innerType:this,defaultValue:t,typeName:hpe.ZodDefault})}brand(){return new dpe({typeName:hpe.ZodBranded,type:this,...sde(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new cpe({...sde(this._def),innerType:this,catchValue:t,typeName:hpe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ppe.create(this,e)}readonly(){return fpe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cde=/^c[^\s-]{8,}$/i,ude=/^[0-9a-z]+$/,dde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pde=/^[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,fde=/^[a-z0-9_-]{21}$/i,hde=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mde=/^[-+]?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)?)??$/,gde=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let vde;const yde=/^(?:(?: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])$/,bde=/^(?:(?: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])$/,xde=/^(([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]))$/,wde=/^(([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])$/,_de=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ede="((\\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])))",Tde=new RegExp(`^${Ede}$`);function Cde(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function Ade(e){return new RegExp(`^${Cde(e)}$`)}function Nde(e){let t=`${Ede}T${Cde(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Rde(e,t){if(!hde.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return"object"==typeof o&&null!==o&&(!(!o.typ||!o.alg)&&(!t||o.alg===t))}catch(tSe){return!1}}function Ode(e,t){return!("v4"!==t&&t||!bde.test(e))||!("v6"!==t&&t||!wde.test(e))}class Pde extends lde{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==jue.string){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.string,received:t.parsedType}),Gue}const t=new que;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const r=e.data.length>i.value,o=e.data.length<i.value;(r||o)&&(n=this._getOrReturnCtx(e,n),r?Hue(n,{code:Fue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Hue(n,{code:Fue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)gde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"email",code:Fue.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)vde||(vde=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),vde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"emoji",code:Fue.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)pde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"uuid",code:Fue.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)fde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"nanoid",code:Fue.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)cde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"cuid",code:Fue.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)ude.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"cuid2",code:Fue.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)dde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"ulid",code:Fue.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(tSe){n=this._getOrReturnCtx(e,n),Hue(n,{validation:"url",code:Fue.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"regex",code:Fue.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){Nde(i).test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Tde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){Ade(i).test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?mde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"duration",code:Fue.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!yde.test(r))&&("v6"!==o&&o||!xde.test(r))&&(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"ip",code:Fue.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?Rde(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"jwt",code:Fue.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Ode(e.data,i.version)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"cidr",code:Fue.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?_de.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"base64",code:Fue.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Sde.test(e.data)||(n=this._getOrReturnCtx(e,n),Hue(n,{validation:"base64url",code:Fue.invalid_string,message:i.message}),t.dirty()):Pue.assertNever(i);var r,o;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:Fue.invalid_string,...tde.errToObj(n)})}_addCheck(e){return new Pde({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tde.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tde.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tde.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tde.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tde.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tde.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tde.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tde.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tde.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tde.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tde.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tde.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tde.errToObj(e)})}datetime(e){var t,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!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...tde.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,...tde.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tde.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tde.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tde.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tde.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tde.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tde.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tde.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tde.errToObj(t)})}nonempty(e){return this.min(1,tde.errToObj(e))}trim(){return new Pde({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Pde({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Pde({...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 t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function kde(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r;return parseInt(e.toFixed(o).replace(".",""))%parseInt(t.toFixed(o).replace(".",""))/Math.pow(10,o)}Pde.create=e=>{var t;return new Pde({checks:[],typeName:hpe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...sde(e)})};class Mde extends lde{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)!==jue.number){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.number,received:t.parsedType}),Gue}let t;const n=new que;for(const r of this._def.checks)if("int"===r.kind)Pue.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==kde(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.not_finite,message:r.message}),n.dirty()):Pue.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tde.toString(t))}setLimit(e,t,n,r){return new Mde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:tde.toString(r)}]})}_addCheck(e){return new Mde({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tde.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tde.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tde.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tde.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tde.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Pue.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Mde.create=e=>new Mde({checks:[],typeName:hpe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...sde(e)});class Lde extends lde{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(tSe){return this._getInvalidInput(e)}if(this._getType(e)!==jue.bigint)return this._getInvalidInput(e);let t;const n=new que;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Hue(t,{code:Fue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Pue.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.bigint,received:t.parsedType}),Gue}gte(e,t){return this.setLimit("min",e,!0,tde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tde.toString(t))}setLimit(e,t,n,r){return new Lde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:tde.toString(r)}]})}_addCheck(e){return new Lde({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tde.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Lde.create=e=>{var t;return new Lde({checks:[],typeName:hpe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...sde(e)})};class Dde extends lde{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==jue.boolean){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.boolean,received:t.parsedType}),Gue}return Wue(e.data)}}Dde.create=e=>new Dde({typeName:hpe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...sde(e)});class jde extends lde{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==jue.date){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.date,received:t.parsedType}),Gue}if(isNaN(e.data.getTime())){return Hue(this._getOrReturnCtx(e),{code:Fue.invalid_date}),Gue}const t=new que;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Hue(n,{code:Fue.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Pue.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jde({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tde.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tde.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}jde.create=e=>new jde({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:hpe.ZodDate,...sde(e)});class Ide extends lde{_parse(e){if(this._getType(e)!==jue.symbol){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.symbol,received:t.parsedType}),Gue}return Wue(e.data)}}Ide.create=e=>new Ide({typeName:hpe.ZodSymbol,...sde(e)});class Fde extends lde{_parse(e){if(this._getType(e)!==jue.undefined){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.undefined,received:t.parsedType}),Gue}return Wue(e.data)}}Fde.create=e=>new Fde({typeName:hpe.ZodUndefined,...sde(e)});class Ude extends lde{_parse(e){if(this._getType(e)!==jue.null){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.null,received:t.parsedType}),Gue}return Wue(e.data)}}Ude.create=e=>new Ude({typeName:hpe.ZodNull,...sde(e)});class $de extends lde{constructor(){super(...arguments),this._any=!0}_parse(e){return Wue(e.data)}}$de.create=e=>new $de({typeName:hpe.ZodAny,...sde(e)});class Vde extends lde{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Wue(e.data)}}Vde.create=e=>new Vde({typeName:hpe.ZodUnknown,...sde(e)});class Bde extends lde{_parse(e){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.never,received:t.parsedType}),Gue}}Bde.create=e=>new Bde({typeName:hpe.ZodNever,...sde(e)});class zde extends lde{_parse(e){if(this._getType(e)!==jue.undefined){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.void,received:t.parsedType}),Gue}return Wue(e.data)}}zde.create=e=>new zde({typeName:hpe.ZodVoid,...sde(e)});class Hde extends lde{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==jue.array)return Hue(t,{code:Fue.invalid_type,expected:jue.array,received:t.parsedType}),Gue;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(Hue(t,{code:e?Fue.too_big:Fue.too_small,minimum:o?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Hue(t,{code:Fue.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Hue(t,{code:Fue.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new ide(t,e,t.path,n))))).then((e=>que.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new ide(t,e,t.path,n))));return que.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new Hde({...this._def,minLength:{value:e,message:tde.toString(t)}})}max(e,t){return new Hde({...this._def,maxLength:{value:e,message:tde.toString(t)}})}length(e,t){return new Hde({...this._def,exactLength:{value:e,message:tde.toString(t)}})}nonempty(e){return this.min(1,e)}}function qde(e){if(e instanceof Gde){const t={};for(const n in e.shape){t[n]=ape.create(qde(e.shape[n]))}return new Gde({...e._def,shape:()=>t})}return e instanceof Hde?new Hde({...e._def,type:qde(e.element)}):e instanceof ape?ape.create(qde(e.unwrap())):e instanceof spe?spe.create(qde(e.unwrap())):e instanceof Xde?Xde.create(e.items.map((e=>qde(e)))):e}Hde.create=(e,t)=>new Hde({type:e,minLength:null,maxLength:null,exactLength:null,typeName:hpe.ZodArray,...sde(t)});class Gde extends lde{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(),t=Pue.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==jue.object){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.object,received:t.parsedType}),Gue}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Bde&&"strip"===this._def.unknownKeys))for(const s in n.data)o.includes(s)||i.push(s);const a=[];for(const s of o){a.push({key:{status:"valid",value:s},value:r[s]._parse(new ide(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof Bde){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of i)a.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)i.length>0&&(Hue(n,{code:Fue.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){a.push({key:{status:"valid",value:t},value:e._parse(new ide(n,n.data[t],n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>que.mergeObjectSync(t,e))):que.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new Gde({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,o,i,a;const s=null!==(i=null===(o=(r=this._def).errorMap)||void 0===o?void 0:o.call(r,t,n).message)&&void 0!==i?i:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=tde.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new Gde({...this._def,unknownKeys:"strip"})}passthrough(){return new Gde({...this._def,unknownKeys:"passthrough"})}extend(e){return new Gde({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Gde({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:hpe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Gde({...this._def,catchall:e})}pick(e){const t={};return Pue.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new Gde({...this._def,shape:()=>t})}omit(e){const t={};return Pue.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new Gde({...this._def,shape:()=>t})}deepPartial(){return qde(this)}partial(e){const t={};return Pue.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new Gde({...this._def,shape:()=>t})}required(e){const t={};return Pue.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ape;)e=e._def.innerType;t[n]=e}})),new Gde({...this._def,shape:()=>t})}keyof(){return tpe(Pue.objectKeys(this.shape))}}Gde.create=(e,t)=>new Gde({shape:()=>e,unknownKeys:"strip",catchall:Bde.create(),typeName:hpe.ZodObject,...sde(t)}),Gde.strictCreate=(e,t)=>new Gde({shape:()=>e,unknownKeys:"strict",catchall:Bde.create(),typeName:hpe.ZodObject,...sde(t)}),Gde.lazycreate=(e,t)=>new Gde({shape:e,unknownKeys:"strip",catchall:Bde.create(),typeName:hpe.ZodObject,...sde(t)});class Kde extends lde{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map((e=>new Uue(e.ctx.common.issues)));return Hue(t,{code:Fue.invalid_union,unionErrors:n}),Gue}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},o=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const o=r.map((e=>new Uue(e)));return Hue(t,{code:Fue.invalid_union,unionErrors:o}),Gue}}get options(){return this._def.options}}Kde.create=(e,t)=>new Kde({options:e,typeName:hpe.ZodUnion,...sde(t)});function Wde(e,t){const n=Iue(e),r=Iue(t);if(e===t)return{valid:!0,data:e};if(n===jue.object&&r===jue.object){const n=Pue.objectKeys(t),r=Pue.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=Wde(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===jue.array&&r===jue.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=Wde(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===jue.date&&r===jue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Yde extends lde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Yue(e)||Yue(r))return Gue;const o=Wde(e.value,r.value);return o.valid?((Xue(e)||Xue(r))&&t.dirty(),{status:t.value,value:o.data}):(Hue(n,{code:Fue.invalid_intersection_types}),Gue)};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,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Yde.create=(e,t,n)=>new Yde({left:e,right:t,typeName:hpe.ZodIntersection,...sde(n)});class Xde extends lde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==jue.array)return Hue(n,{code:Fue.invalid_type,expected:jue.array,received:n.parsedType}),Gue;if(n.data.length<this._def.items.length)return Hue(n,{code:Fue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Gue;!this._def.rest&&n.data.length>this._def.items.length&&(Hue(n,{code:Fue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new ide(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>que.mergeArray(t,e))):que.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Xde({...this._def,rest:e})}}Xde.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xde({items:e,typeName:hpe.ZodTuple,rest:null,...sde(t)})};class Qde extends lde{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==jue.map)return Hue(n,{code:Fue.invalid_type,expected:jue.map,received:n.parsedType}),Gue;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new ide(n,e,n.path,[i,"key"])),value:o._parse(new ide(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of i){const r=await n.key,o=await n.value;if("aborted"===r.status||"aborted"===o.status)return Gue;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of i){const r=n.key,o=n.value;if("aborted"===r.status||"aborted"===o.status)return Gue;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}Qde.create=(e,t,n)=>new Qde({valueType:t,keyType:e,typeName:hpe.ZodMap,...sde(n)});class Zde extends lde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==jue.set)return Hue(n,{code:Fue.invalid_type,expected:jue.set,received:n.parsedType}),Gue;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Hue(n,{code:Fue.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(Hue(n,{code:Fue.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const o=this._def.valueType;function i(e){const n=new Set;for(const r of e){if("aborted"===r.status)return Gue;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>o._parse(new ide(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new Zde({...this._def,minSize:{value:e,message:tde.toString(t)}})}max(e,t){return new Zde({...this._def,maxSize:{value:e,message:tde.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Zde.create=(e,t)=>new Zde({valueType:e,minSize:null,maxSize:null,typeName:hpe.ZodSet,...sde(t)});class Jde extends lde{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Jde.create=(e,t)=>new Jde({getter:e,typeName:hpe.ZodLazy,...sde(t)});class epe extends lde{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Hue(t,{received:t.data,code:Fue.invalid_literal,expected:this._def.value}),Gue}return{status:"valid",value:e.data}}get value(){return this._def.value}}function tpe(e,t){return new npe({values:e,typeName:hpe.ZodEnum,...sde(t)})}epe.create=(e,t)=>new epe({value:e,typeName:hpe.ZodLiteral,...sde(t)});class npe extends lde{constructor(){super(...arguments),rde.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return Hue(t,{expected:Pue.joinValues(this._def.values),received:t.parsedType,code:Fue.invalid_type}),Gue}if(Jue(this,rde)||ede(this,rde,new Set(this._def.values)),!Jue(this,rde).has(e.data)){const t=this._getOrReturnCtx(e);return Hue(t,{received:t.data,code:Fue.invalid_enum_value,options:this._def.values}),Gue}return Wue(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return npe.create(e,{...this._def,...t})}exclude(e,t=this._def){return npe.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}rde=new WeakMap,npe.create=tpe;class rpe extends lde{constructor(){super(...arguments),ode.set(this,void 0)}_parse(e){const t=Pue.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==jue.string&&n.parsedType!==jue.number){const e=Pue.objectValues(t);return Hue(n,{expected:Pue.joinValues(e),received:n.parsedType,code:Fue.invalid_type}),Gue}if(Jue(this,ode)||ede(this,ode,new Set(Pue.getValidEnumValues(this._def.values))),!Jue(this,ode).has(e.data)){const e=Pue.objectValues(t);return Hue(n,{received:n.data,code:Fue.invalid_enum_value,options:e}),Gue}return Wue(e.data)}get enum(){return this._def.values}}ode=new WeakMap,rpe.create=(e,t)=>new rpe({values:e,typeName:hpe.ZodNativeEnum,...sde(t)});class ope extends lde{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==jue.promise&&!1===t.common.async)return Hue(t,{code:Fue.invalid_type,expected:jue.promise,received:t.parsedType}),Gue;const n=t.parsedType===jue.promise?t.data:Promise.resolve(t.data);return Wue(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ope.create=(e,t)=>new ope({type:e,typeName:hpe.ZodPromise,...sde(t)});class ipe extends lde{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===hpe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:e=>{Hue(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),"preprocess"===r.type){const e=r.transform(n.data,o);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Gue;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?Gue:"dirty"===r.status||"dirty"===t.value?Kue(r.value):r}));{if("aborted"===t.value)return Gue;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?Gue:"dirty"===r.status||"dirty"===t.value?Kue(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,o);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?Gue:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?Gue:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Que(e))return e;const i=r.transform(e.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Que(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}Pue.assertNever(r)}}ipe.create=(e,t,n)=>new ipe({schema:e,typeName:hpe.ZodEffects,effect:t,...sde(n)}),ipe.createWithPreprocess=(e,t,n)=>new ipe({schema:t,effect:{type:"preprocess",transform:e},typeName:hpe.ZodEffects,...sde(n)});class ape extends lde{_parse(e){return this._getType(e)===jue.undefined?Wue(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ape.create=(e,t)=>new ape({innerType:e,typeName:hpe.ZodOptional,...sde(t)});class spe extends lde{_parse(e){return this._getType(e)===jue.null?Wue(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}spe.create=(e,t)=>new spe({innerType:e,typeName:hpe.ZodNullable,...sde(t)});class lpe extends lde{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===jue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}lpe.create=(e,t)=>new lpe({innerType:e,typeName:hpe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...sde(t)});class cpe extends lde{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Zue(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Uue(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Uue(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}cpe.create=(e,t)=>new cpe({innerType:e,typeName:hpe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...sde(t)});class upe extends lde{_parse(e){if(this._getType(e)!==jue.nan){const t=this._getOrReturnCtx(e);return Hue(t,{code:Fue.invalid_type,expected:jue.nan,received:t.parsedType}),Gue}return{status:"valid",value:e.data}}}upe.create=e=>new upe({typeName:hpe.ZodNaN,...sde(e)});class dpe extends lde{_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.type._parse({data:t.data,path:t.path,parent:t})}unwrap(){return this._def.type}}class ppe extends lde{_parse(e){const{status:t,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?Gue:"dirty"===e.status?(t.dirty(),Kue(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?Gue:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ppe({in:e,out:t,typeName:hpe.ZodPipeline})}}class fpe extends lde{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Que(e)&&(e.value=Object.freeze(e.value)),e);return Zue(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}var hpe,mpe;fpe.create=(e,t)=>new fpe({innerType:e,typeName:hpe.ZodReadonly,...sde(t)}),(mpe=hpe||(hpe={})).ZodString="ZodString",mpe.ZodNumber="ZodNumber",mpe.ZodNaN="ZodNaN",mpe.ZodBigInt="ZodBigInt",mpe.ZodBoolean="ZodBoolean",mpe.ZodDate="ZodDate",mpe.ZodSymbol="ZodSymbol",mpe.ZodUndefined="ZodUndefined",mpe.ZodNull="ZodNull",mpe.ZodAny="ZodAny",mpe.ZodUnknown="ZodUnknown",mpe.ZodNever="ZodNever",mpe.ZodVoid="ZodVoid",mpe.ZodArray="ZodArray",mpe.ZodObject="ZodObject",mpe.ZodUnion="ZodUnion",mpe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",mpe.ZodIntersection="ZodIntersection",mpe.ZodTuple="ZodTuple",mpe.ZodRecord="ZodRecord",mpe.ZodMap="ZodMap",mpe.ZodSet="ZodSet",mpe.ZodFunction="ZodFunction",mpe.ZodLazy="ZodLazy",mpe.ZodLiteral="ZodLiteral",mpe.ZodEnum="ZodEnum",mpe.ZodEffects="ZodEffects",mpe.ZodNativeEnum="ZodNativeEnum",mpe.ZodOptional="ZodOptional",mpe.ZodNullable="ZodNullable",mpe.ZodDefault="ZodDefault",mpe.ZodCatch="ZodCatch",mpe.ZodPromise="ZodPromise",mpe.ZodBranded="ZodBranded",mpe.ZodPipeline="ZodPipeline",mpe.ZodReadonly="ZodReadonly";const gpe=Pde.create,vpe=Gde.create,ype=e=>{const{children:t,...r}=e;return n.createElement(Mce.Provider,{value:r},t)},bpe=i.createContext({}),xpe=({...e})=>t.jsx(bpe.Provider,{value:{name:e.name},children:t.jsx(Bce,{...e})}),wpe=()=>{const e=i.useContext(bpe),t=i.useContext(_pe),{getFieldState:n,formState:r}=Lce(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...o}},_pe=i.createContext({}),Spe=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(_pe.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:Qd("space-y-2",e),...n})})}));Spe.displayName="FormItem";const Epe=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=wpe();return t.jsx(L9,{ref:r,className:Qd(o&&"text-destructive",e),htmlFor:i,...n})}));Epe.displayName="FormLabel";const Tpe=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=wpe();return t.jsx(QU,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));Tpe.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=wpe();return t.jsx("p",{ref:r,id:o,className:Qd("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const Cpe=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=wpe(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:Qd("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));Cpe.displayName="FormMessage";const Ape=vpe({name:gpe().min(2,"Title must be at least 2 characters"),description:gpe()});function Npe({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=iQ(),{toast:i}=Ll(),a=Cue({resolver:Due(Ape),defaultValues:{name:`${o?.name} (copy)`,description:o?.description??""}});return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsx(CB,{children:t.jsx(NB,{children:"Duplicate Automation"})}),t.jsx(ype,{...a,children:t.jsxs("form",{onSubmit:a.handleSubmit((async function(){if(!o)return void i({title:"Error duplicating automation",description:"Please try again"});const{id:e}=await(async e=>(await Re(`${c}`,{method:"POST",body:JSON.stringify({duplicate:!0,source_id:e})})).data)(o.id);e?(r?.(e),i({title:"Automation duplicated!",description:"The automation has been duplicated"}),n(!1)):i({title:"Error duplicating automation",description:"Please try again"})})),className:"space-y-4",children:[t.jsxs("div",{children:["Create a copy of the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),"automation with a new title and description."]}),t.jsx(xpe,{control:a.control,name:"name",disabled:!0,render:({field:e})=>t.jsxs(Spe,{children:[t.jsx(Epe,{children:"Title"}),t.jsx(Tpe,{children:t.jsx(H3,{...e})}),t.jsx(Cpe,{})]})}),t.jsx(xpe,{control:a.control,name:"description",disabled:!0,render:({field:e})=>t.jsxs(Spe,{children:[t.jsx(Epe,{children:"Description"}),t.jsx(Tpe,{children:t.jsx(zte,{...e})}),t.jsx(Cpe,{})]})}),t.jsx(AB,{children:t.jsx(gQ,{type:"submit",children:"Duplicate"})})]})})]})})}const Rpe=vpe({name:gpe().min(2,"Title must be at least 2 characters"),description:gpe()});function Ope({open:e,onOpenChange:n}){const r=iQ(),{updateAutomation:o}=De(r?.id||""),i=Cue({resolver:Due(Rpe),defaultValues:{name:r?.name??"",description:r?.description??""}});return r?t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsxs(CB,{children:[t.jsx(NB,{children:"Edit Automation"}),t.jsx(RB,{children:"Update the title and description of your automation."})]}),t.jsx(ype,{...i,children:t.jsxs("form",{onSubmit:i.handleSubmit((function(e){o({name:e.name,description:e.description}),n(!1)})),className:"space-y-4",children:[t.jsx(xpe,{control:i.control,name:"name",render:({field:e})=>t.jsxs(Spe,{children:[t.jsx(Epe,{children:"Title"}),t.jsx(Tpe,{children:t.jsx(H3,{...e})}),t.jsx(Cpe,{})]})}),t.jsx(xpe,{control:i.control,name:"description",render:({field:e})=>t.jsxs(Spe,{children:[t.jsx(Epe,{children:"Description"}),t.jsx(Tpe,{children:t.jsx(zte,{...e})}),t.jsx(Cpe,{})]})}),t.jsx(AB,{children:t.jsx(gQ,{type:"submit",children:"Save changes"})})]})})]})}):null}function Ppe({open:e,onOpenChange:n,setIsActive:r}){const o=iQ(),{updateAutomation:i}=De(o?.id||""),{toast:a}=Ll();return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsx(CB,{children:t.jsxs(NB,{children:["Deactivate ",ff("engage:automation")]})}),t.jsxs("div",{children:["Are you sure you want to deactivate the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),ff("engage:automation"),"?"]}),t.jsxs(AB,{className:"gap-2 sm:gap-0",children:[t.jsx(gQ,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(gQ,{variant:"destructive",onClick:()=>{i({status:Ve.DRAFT}),n(!1),r(!1),a({title:`Updated ${ff("engage:automation")}`,description:`${ff("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const kpe=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=iQ(),a=H5(),{updateAutomation:s}=De(i?.id||""),{toast:l}=Ll(),c=(()=>{const{state:e}=oQ();return e.recipientStats})(),u=aQ(),[d,p]=n.useState(void 0),[f,h]=n.useState(!1),[m,g]=n.useState(!1),[v,y]=n.useState(!1),[b,x]=n.useState(!1);n.useEffect((()=>{if(i&&void 0===d)switch(i.status){case Ve.ACTIVE:p(!0);break;case Ve.DRAFT:p(!1);break;case Ve.RUNNING:case Ve.COMPLETED:p(!0);break;case Ve.FAILED:case Ve.DEACTIVATED:p(!1);break;default:throw Xte(i.status,Ve)}}),[i,d]);const w=n.useCallback((()=>{if(!i)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});const e=async e=>{if(d&&!e)y(!0);else{if(x(!0),o&&!0===e){let e=0;for(;!c&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!c)return l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),void x(!1);const t=await o({estimatedEmailRecipients:c?.emails??0,estimatedSmsRecipients:c?.phones??0});if(!0!==t)return l({title:"Error while updating the status",description:t,variant:"destructive"}),void x(!1)}switch(i.triggerType){case Fe.ONE_TIME:if(!i.triggerMetadata||!("scheduledAt"in i.triggerMetadata)||!i.triggerMetadata?.scheduledAt)return l({title:"Ensure you have selected a scheduled time",variant:"destructive"}),void x(!1);if(!u||!u.emailChannelSenderId&&!u.smsChannelSenderId)return l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"}),void x(!1);break;case Fe.TRIGGER_BASED:break;default:throw Xte(i.triggerType,Fe)}s({status:e?Ve.ACTIVE:Ve.DEACTIVATED},{onSuccess:()=>{p(e),l({title:`${ff("engage:automation")} 🚀`,description:`${ff("engage:automation")} status updated to ${e?"active":"inactive"} 🚀`}),x(!1)},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),x(!1)}})}};if(!i)return null;let n=!1,r=!0;switch(i.status){case Ve.ACTIVE:case Ve.DRAFT:n=!1;break;case Ve.DEACTIVATED:n=!0,r=!1;break;case Ve.RUNNING:n=!0,r=i.triggerType===Fe.TRIGGER_BASED;break;case Ve.COMPLETED:case Ve.FAILED:n=!0,r=!1;break;default:throw Xte(i.status,Ve)}return r?t.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[t.jsx(d?pu:xu,{className:"w-4 h-4"}),t.jsx("div",{className:"text-[13px] font-medium",children:d?"Active":"Inactive"}),t.jsx(ile,{checked:d,onCheckedChange:e,disabled:n})]}):t.jsx(PQ,{variant:l9(i.status),children:J6[i.status]})}),[i,d,l,o,s,c,u]);return i&&void 0!==d?t.jsxs("header",{className:"flex px-1 pt-1",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[e&&t.jsx(gQ,{variant:"ghost",size:"icon",onClick:()=>a(-1),children:t.jsx(lu,{})}),t.jsx("div",{className:"flex flex-col gap-1",children:t.jsx("h1",{className:"text-lg leading-none",children:i.name})})]}),t.jsxs("div",{className:"ml-auto flex gap-4 items-center",children:[t.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:i.triggerType===Fe.ONE_TIME&&t.jsxs(t.Fragment,{children:[t.jsx("div",{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",children:t.jsx(E9,{title:"Edit",Icon:xQ.EditIcon,asChild:!1,onClick:()=>h(!0)})}),t.jsx("div",{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",children:t.jsx(E9,{title:"Duplicate",Icon:xQ.DuplicateIcon,asChild:!1,onClick:()=>g(!0)})})]})}),b?t.jsx("div",{className:"flex items-center text-muted-foreground pr-8",children:t.jsx(fQ,{})}):w()]}),t.jsx(Ope,{open:f,onOpenChange:h}),t.jsx(Npe,{open:m,onOpenChange:g,onDuplicationCreated:r}),t.jsx(Ppe,{open:v,onOpenChange:y,setIsActive:p})]}):null},Mpe=()=>{const e=iQ(),{isLoading:n}=je(e?.id);return!e||n?t.jsx(fQ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(zle,{automationId:e.id,automation:e,includeSales:!0})})},Lpe=()=>{const e=iQ(),{recipients:n,isLoading:r,fetchError:o}=Me(e?.id??""),i=[{accessorFn:e=>`${e.firstName||""} ${e.lastName||""}`.trim(),id:"name",header:"Name",cell:({row:e})=>{const n=`${e.original.firstName||""} ${e.original.lastName||""}`.trim();return n||t.jsx("span",{className:"text-gray-400",children:"Not provided"})}},{accessorKey:"email",header:"Email",cell:({row:e})=>e.original.email||t.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"phone",header:"Phone",cell:({row:e})=>e.original.phone||t.jsx("span",{className:"text-gray-400",children:"Not provided"})}];return e&&!r&&n?o?t.jsxs("div",{children:["Error: ",o.message]}):n&&0!==n.recipients.length?t.jsx("div",{className:"h-full p-4",children:t.jsx(G3,{data:n.recipients,columns:i,paginationMode:"standard",initialPageSize:10,isLoading:r})}):t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[t.jsx("div",{className:"mb-4",children:t.jsx(xQ.UserIcon,{className:"h-12 w-12 text-gray-400"})}),t.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Recipients Found"}),t.jsxs("p",{className:"text-gray-500",children:["This ",ff("engage:automation")," currently has no assigned recipients. Please update the include or exclude"," ",ff("engage:segment",{count:2})," to add recipients."]})]}):t.jsx(fQ,{text:["Fetching Recipients","Finishing up"]})},Dpe=n.createContext(null);Dpe.displayName="PanelGroupContext";const jpe="data-panel-group",Ipe="data-panel-group-direction",Fpe="data-panel-group-id",Upe="data-panel",$pe="data-panel-collapsible",Vpe="data-panel-id",Bpe="data-panel-size",zpe="data-resize-handle",Hpe="data-resize-handle-active",qpe="data-panel-resize-handle-enabled",Gpe="data-panel-resize-handle-id",Kpe="data-resize-handle-state",Wpe=n.useLayoutEffect,Ype=i["useId".toString()],Xpe="function"==typeof Ype?Ype:()=>null;let Qpe=0;function Zpe(e=null){const t=Xpe(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+Qpe++),null!=e?e:r.current}function Jpe({children:e,className:t="",collapsedSize:r,collapsible:o,defaultSize:i,forwardedRef:a,id:s,maxSize:l,minSize:c,onCollapse:u,onExpand:d,onResize:p,order:f,style:h,tagName:m="div",...g}){const v=n.useContext(Dpe);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:b,getPanelSize:x,getPanelStyle:w,groupId:_,isPanelCollapsed:S,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:C,unregisterPanel:A}=v,N=Zpe(s),R=n.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:r,collapsible:o,defaultSize:i,maxSize:l,minSize:c},id:N,idIsFromProps:void 0!==s,order:f});n.useRef({didLogMissingDefaultSizeWarning:!1}),Wpe((()=>{const{callbacks:e,constraints:t}=R.current,n={...t};R.current.id=N,R.current.idIsFromProps=void 0!==s,R.current.order=f,e.onCollapse=u,e.onExpand=d,e.onResize=p,t.collapsedSize=r,t.collapsible=o,t.defaultSize=i,t.maxSize=l,t.minSize=c,n.collapsedSize===t.collapsedSize&&n.collapsible===t.collapsible&&n.maxSize===t.maxSize&&n.minSize===t.minSize||E(R.current,n)})),Wpe((()=>{const e=R.current;return T(e),()=>{A(e)}}),[f,N,T,A]),n.useImperativeHandle(a,(()=>({collapse:()=>{y(R.current)},expand:e=>{b(R.current,e)},getId:()=>N,getSize:()=>x(R.current),isCollapsed:()=>S(R.current),isExpanded:()=>!S(R.current),resize:e=>{C(R.current,e)}})),[y,b,x,S,N,C]);const O=w(R.current,i);return n.createElement(m,{...g,children:e,className:t,id:N,style:{...O,...h},[Fpe]:_,[Upe]:"",[$pe]:o||void 0,[Vpe]:N,[Bpe]:parseFloat(""+O.flexGrow).toFixed(1)})}const efe=n.forwardRef(((e,t)=>n.createElement(Jpe,{...e,forwardedRef:t})));Jpe.displayName="Panel",efe.displayName="forwardRef(Panel)";let tfe=null,nfe=-1,rfe=null;function ofe(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&vfe),n=!!(t&yfe);if(t&mfe)return e?"se-resize":n?"ne-resize":"e-resize";if(t&gfe)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,t);if(tfe!==o){var i;if(tfe=o,null===rfe&&(rfe=document.createElement("style"),document.head.appendChild(rfe)),nfe>=0)null===(i=rfe.sheet)||void 0===i||i.removeRule(nfe);nfe=null!==(n=null===(r=rfe.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function ife(e){return"keydown"===e.type}function afe(e){return e.type.startsWith("pointer")}function sfe(e){return e.type.startsWith("mouse")}function lfe(e){if(afe(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(sfe(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const cfe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function ufe(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=hfe(e))&&void 0!==t?t:e).display;return"flex"===n||"inline-flex"===n}(e))||(+t.opacity<1||("transform"in t&&"none"!==t.transform||("webkitTransform"in t&&"none"!==t.webkitTransform||("mixBlendMode"in t&&"normal"!==t.mixBlendMode||("filter"in t&&"none"!==t.filter||("webkitFilter"in t&&"none"!==t.webkitFilter||("isolation"in t&&"isolate"===t.isolation||(!!cfe.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function dfe(e){let t=e.length;for(;t--;){const n=e[t];if(Dfe(n,"Missing node"),ufe(n))return n}return null}function pfe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ffe(e){const t=[];for(;e;)t.push(e),e=hfe(e);return t}function hfe(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const mfe=1,gfe=2,vfe=4,yfe=8,bfe="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let xfe=[],wfe=!1,_fe=new Map,Sfe=new Map;const Efe=new Set;function Tfe(e){const{target:t}=e,{x:n,y:r}=lfe(e);wfe=!0,Rfe({target:t,x:n,y:r}),Mfe(),xfe.length>0&&(Lfe("down",e),e.preventDefault(),Nfe(t)||e.stopImmediatePropagation())}function Cfe(e){const{x:t,y:n}=lfe(e);if(wfe&&0===e.buttons&&(wfe=!1,Lfe("up",e)),!wfe){const{target:r}=e;Rfe({target:r,x:t,y:n})}Lfe("move",e),Pfe(),xfe.length>0&&e.preventDefault()}function Afe(e){const{target:t}=e,{x:n,y:r}=lfe(e);Sfe.clear(),wfe=!1,xfe.length>0&&(e.preventDefault(),Nfe(t)||e.stopImmediatePropagation()),Lfe("up",e),Rfe({target:t,x:n,y:r}),Pfe(),Mfe()}function Nfe(e){let t=e;for(;t;){if(t.hasAttribute(zpe))return!0;t=t.parentElement}return!1}function Rfe({target:e,x:t,y:n}){xfe.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Efe.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=bfe?i.coarse:i.fine;if(t>=l-d&&t<=c+d&&n>=u-d&&n<=s+d){if(null!==r&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&function(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:ffe(e),b:ffe(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Dfe(r,"Stacking order can only be calculated for elements with a common ancestor");const o=pfe(dfe(n.a)),i=pfe(dfe(n.b));if(o===i){const e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)};let o=e.length;for(;o--;){const n=e[o];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(o-i)}(r,o)>0){let e=r,t=!1;for(;e&&!e.contains(o);){if((p=e.getBoundingClientRect()).x<(f=a).x+f.width&&p.x+p.width>f.x&&p.y<f.y+f.height&&p.y+p.height>f.y){t=!0;break}e=e.parentElement}if(t)return}xfe.push(e)}var p,f}))}function Ofe(e,t){Sfe.set(e,t)}function Pfe(){let e=!1,t=!1;xfe.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;Sfe.forEach((e=>{n|=e})),e&&t?ofe("intersection",n):e?ofe("horizontal",n):t?ofe("vertical",n):null!==rfe&&(document.head.removeChild(rfe),tfe=null,rfe=null,nfe=-1)}let kfe=new AbortController;function Mfe(){kfe.abort(),kfe=new AbortController;const e={capture:!0,signal:kfe.signal};Efe.size&&(wfe?(xfe.length>0&&_fe.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",Afe,e),r.addEventListener("pointerleave",Cfe,e),r.addEventListener("pointermove",Cfe,e))})),_fe.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",Afe,e),r.addEventListener("pointercancel",Afe,e)}))):_fe.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",Tfe,e),r.addEventListener("pointermove",Cfe,e))})))}function Lfe(e,t){Efe.forEach((n=>{const{setResizeHandlerState:r}=n,o=xfe.includes(n);r(e,o,t)}))}function Dfe(e,t){if(!e)throw Error(t)}function jfe(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Ife(e,t,n=10){return 0===jfe(e,t,n)}function Ffe(e,t,n){return 0===jfe(e,t,n)}function Ufe({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Dfe(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(jfe(n,s)<0)if(i){n=jfe(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function $fe({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Ffe(e,0))return t;const a=[...t],[s,l]=r;Dfe(null!=s,"Invalid first pivot index"),Dfe(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];Dfe(o,`Panel constraints not found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:c=0}=o;if(a){const n=t[r];if(Dfe(null!=n,`Previous layout not found for panel index ${r}`),Ffe(n,i)){const t=c-n;jfe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];Dfe(o,`No panel constraints found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:c=0}=o;if(a){const n=t[r];if(Dfe(null!=n,`Previous layout not found for panel index ${r}`),Ffe(n,c)){const t=n-i;jfe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{const r=e<0?1:-1;let o=e<0?l:s,i=0;for(;;){const e=t[o];Dfe(null!=e,`Previous layout not found for panel index ${o}`);if(i+=Ufe({panelConstraints:n,panelIndex:o,size:100})-e,o+=r,o<0||o>=n.length)break}const a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let r=e<0?s:l;for(;r>=0&&r<n.length;){const o=Math.abs(e)-Math.abs(c),i=t[r];Dfe(null!=i,`Previous layout not found for panel index ${r}`);const s=Ufe({panelConstraints:n,panelIndex:r,size:i-o});if(!Ffe(i,s)&&(c+=i-s,a[r]=s,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(function(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Ffe(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];Dfe(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=Ufe({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!Ffe(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];Dfe(null!=o,`Previous layout not found for panel index ${r}`);const i=Ufe({panelConstraints:n,panelIndex:r,size:o+t});if(Ffe(o,i)||(t-=i-o,a[r]=i),Ffe(t,0))break;e>0?r--:r++}}}return Ffe(a.reduce(((e,t)=>t+e),0),100)?a:o}function Vfe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];Dfe(null!=s,"No pivot index found"),t.forEach(((e,t)=>{const{constraints:n}=e,{maxSize:l=100,minSize:c=0}=n;t===s?(r=c,o=l):(i+=c,a+=l)}));return{valueMax:Math.min(o,100-i),valueMin:Math.max(r,100-a),valueNow:e[s]}}function Bfe(e,t=document){return Array.from(t.querySelectorAll(`[${Gpe}][data-panel-group-id="${e}"]`))}function zfe(e,t,n=document){const r=Bfe(e,n).findIndex((e=>e.getAttribute(Gpe)===t));return null!=r?r:null}function Hfe(e,t,n){const r=zfe(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function qfe(e,t=document){var n;if(t instanceof HTMLElement&&(null==t||null===(n=t.dataset)||void 0===n?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function Gfe(e,t=document){const n=t.querySelector(`[${Gpe}="${e}"]`);return n||null}function Kfe({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),Wpe((()=>{if(!a)return;const e=Bfe(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=Vfe({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];Dfe(e,`No panel data found for index "${t}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(n)),s.setAttribute("aria-valuemin",""+Math.round(r)),s.setAttribute("aria-valuenow",null!=a?""+Math.round(a):"")}}return()=>{e.forEach(((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[r,o,i,a]),n.useEffect((()=>{if(!a)return;const e=t.current;Dfe(e,"Eager values not found");const{panelDataArray:n}=e;Dfe(null!=qfe(r,a),`No group found for id "${r}"`);const i=Bfe(r,a);Dfe(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(Gpe);Dfe(t,"Resize handle element has no handle id attribute");const[i,l]=function(e,t,n,r=document){var o,i,a,s;const l=Gfe(t,r),c=Bfe(e,r),u=l?c.indexOf(l):-1;return[null!==(o=null===(i=n[u])||void 0===i?void 0:i.id)&&void 0!==o?o:null,null!==(a=null===(s=n[u+1])||void 0===s?void 0:s.id)&&void 0!==a?a:null]}(r,t,n,a);if(null==i||null==l)return()=>{};const c=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=n.findIndex((e=>e.id===i));if(l>=0){const e=n[l];Dfe(e,`No panel data found for index ${l}`);const i=o[l],{collapsedSize:c=0,collapsible:u,minSize:d=0}=e.constraints;if(null!=i&&u){const e=$fe({delta:Ffe(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:Hfe(r,t,a),prevLayout:o,trigger:"keyboard"});o!==e&&s(e)}}break}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}));return()=>{l.forEach((e=>e()))}}),[a,e,t,r,o,i,s])}function Wfe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Yfe(e,t){const n="horizontal"===e,{x:r,y:o}=lfe(t);return n?r:o}function Xfe(e,t,n,r,o,i){if(ife(e)){const t="horizontal"===n;let r=0;r=e.shiftKey?100:null!=o?o:10;let i=0;switch(e.key){case"ArrowDown":i=t?0:r;break;case"ArrowLeft":i=t?-r:0;break;case"ArrowRight":i=t?r:0;break;case"ArrowUp":i=t?0:-r;break;case"End":i=100;break;case"Home":i=-100}return i}return null==r?0:function(e,t,n,r,o){const i="horizontal"===n,a=Gfe(t,o);Dfe(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(Fpe);Dfe(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Yfe(n,e),u=qfe(s,o);Dfe(u,`No group element found for id "${s}"`);const d=u.getBoundingClientRect();return(c-l)/(i?d.width:d.height)*100}(e,t,n,r,i)}function Qfe(e,t,n){t.forEach(((t,r)=>{const o=e[r];Dfe(o,`Panel data not found for index ${r}`);const{callbacks:i,constraints:a,id:s}=o,{collapsedSize:l=0,collapsible:c}=a,u=n[s];if(null==u||t!==u){n[s]=t;const{onCollapse:e,onExpand:r,onResize:o}=i;o&&o(t,u),c&&(e||r)&&(!r||null!=u&&!Ife(u,l)||Ife(t,l)||r(),!e||null!=u&&Ife(u,l)||!Ife(t,l)||e())}}))}function Zfe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Jfe(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)}}catch(t){e.getItem=()=>null,e.setItem=()=>{}}}function ehe(e){return`react-resizable-panels:${e}`}function the(e){return e.map((e=>{const{constraints:t,id:n,idIsFromProps:r,order:o}=e;return r?n:o?`${o}:${JSON.stringify(t)}`:JSON.stringify(t)})).sort(((e,t)=>e.localeCompare(t))).join(",")}function nhe(e,t){try{const n=ehe(e),r=t.getItem(n);if(r){const e=JSON.parse(r);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function rhe(e,t,n,r,o){var i;const a=ehe(e),s=the(t),l=null!==(i=nhe(e,o))&&void 0!==i?i:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(a,JSON.stringify(l))}catch(c){}}function ohe({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce(((e,t)=>e+t),0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!Ffe(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];Dfe(null!=e,`No layout data found for index ${i}`);n[i]=100/r*e}let o=0;for(let i=0;i<t.length;i++){const e=n[i];Dfe(null!=e,`No layout data found for index ${i}`);const r=Ufe({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!Ffe(o,0))for(let i=0;i<t.length;i++){const e=n[i];Dfe(null!=e,`No layout data found for index ${i}`);const r=Ufe({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,Ffe(o,0)))break}return n}const ihe={getItem:e=>(Jfe(ihe),ihe.getItem(e)),setItem:(e,t)=>{Jfe(ihe),ihe.setItem(e,t)}},ahe={};function she({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=ihe,style:u,tagName:d="div",...p}){const f=Zpe(a),h=n.useRef(null),[m,g]=n.useState(null),[v,y]=n.useState([]),b=function(){const[e,t]=n.useState(0);return n.useCallback((()=>t((e=>e+1))),[])}(),x=n.useRef({}),w=n.useRef(new Map),_=n.useRef(0),S=n.useRef({autoSaveId:e,direction:o,dragState:m,id:f,keyboardResizeBy:l,onLayout:s,storage:c}),E=n.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});n.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),n.useImperativeHandle(i,(()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:e}=E.current;return e},setLayout:e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current,o=ohe({layout:e,panelConstraints:r.map((e=>e.constraints))});Wfe(n,o)||(y(o),E.current.layout=o,t&&t(o),Qfe(r,o,x.current))}})),[]),Wpe((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),Kfe({committedValuesRef:S,eagerValuesRef:E,groupId:f,layout:v,panelDataArray:E.current.panelDataArray,setLayout:y,panelGroupElement:h.current}),n.useEffect((()=>{const{panelDataArray:t}=E.current;if(e){if(0===v.length||v.length!==t.length)return;let n=ahe[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(rhe,100),ahe[e]=n);const r=[...t],o=new Map(w.current);n(e,r,o,v,c)}}),[e,v,c]),n.useEffect((()=>{}));const T=n.useCallback((e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current;if(e.constraints.collapsible){const o=r.map((e=>e.constraints)),{collapsedSize:i=0,panelSize:a,pivotIndices:s}=uhe(r,e,n);if(Dfe(null!=a,`Panel size not found for panel "${e.id}"`),!Ife(a,i)){w.current.set(e.id,a);const l=$fe({delta:che(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Zfe(n,l)||(y(l),E.current.layout=l,t&&t(l),Qfe(r,l,x.current))}}}),[]),C=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current;if(e.constraints.collapsible){const i=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s=0,minSize:l=0,pivotIndices:c}=uhe(o,e,r),u=null!=t?t:l;if(Ife(s,a)){const t=w.current.get(e.id),a=null!=t&&t>=u?t:u,l=$fe({delta:che(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});Zfe(r,l)||(y(l),E.current.layout=l,n&&n(l),Qfe(o,l,x.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=uhe(n,e,t);return Dfe(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),N=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=che(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const a=n[o];let s;return s=null==a?null!=e?e.toPrecision(i):"1":1===r.length?"1":a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:v,panelData:n,panelIndex:r})}),[m,v]),R=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=uhe(n,e,t);return Dfe(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&Ife(i,r)}),[]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=uhe(n,e,t);return Dfe(null!=i,`Panel size not found for panel "${e.id}"`),!o||jfe(i,r)>0}),[]),P=n.useCallback((e=>{const{panelDataArray:t}=E.current;t.push(e),t.sort(((e,t)=>{const n=e.order,r=t.order;return null==n&&null==r?0:null==n?-1:null==r?1:n-r})),E.current.panelDataArrayChanged=!0,b()}),[b]);Wpe((()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:t,storage:n}=S.current,{layout:r,panelDataArray:o}=E.current;let i=null;if(e){const t=function(e,t,n){var r,o;return null!==(o=(null!==(r=nhe(e,n))&&void 0!==r?r:{})[the(t)])&&void 0!==o?o:null}(e,o,n);t&&(w.current=new Map(Object.entries(t.expandToSizes)),i=t.layout)}null==i&&(i=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let r=0,o=100;for(let i=0;i<e.length;i++){const e=n[i];Dfe(e,`Panel constraints not found for index ${i}`);const{defaultSize:a}=e;null!=a&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const a=n[i];Dfe(a,`Panel constraints not found for index ${i}`);const{defaultSize:s}=a;if(null!=s)continue;const l=o/(e.length-r);r++,t[i]=l,o-=l}return t}({panelDataArray:o}));const a=ohe({layout:i,panelConstraints:o.map((e=>e.constraints))});Wfe(r,a)||(y(a),E.current.layout=a,t&&t(a),Qfe(o,a,x.current))}})),Wpe((()=>{const e=E.current;return()=>{e.layout=[]}}),[]);const k=n.useCallback((e=>{let t=!1;const n=h.current;if(n){"rtl"===window.getComputedStyle(n,null).getPropertyValue("direction")&&(t=!0)}return function(n){n.preventDefault();const r=h.current;if(!r)return()=>null;const{direction:o,dragState:i,id:a,keyboardResizeBy:s,onLayout:l}=S.current,{layout:c,panelDataArray:u}=E.current,{initialLayout:d}=null!=i?i:{},p=Hfe(a,e,r);let f=Xfe(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=$fe({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:ife(n)?"keyboard":"mouse-or-touch"}),v=!Zfe(c,g);(afe(n)||sfe(n))&&_.current!=f&&(_.current=f,Ofe(e,v||0===f?0:m?f<0?mfe:gfe:f<0?vfe:yfe)),v&&(y(g),E.current.layout=g,l&&l(g),Qfe(u,g,x.current))}}),[]),M=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current,i=o.map((e=>e.constraints)),{panelSize:a,pivotIndices:s}=uhe(o,e,r);Dfe(null!=a,`Panel size not found for panel "${e.id}"`);const l=$fe({delta:che(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});Zfe(r,l)||(y(l),E.current.layout=l,n&&n(l),Qfe(o,l,x.current))}),[]),L=n.useCallback(((e,t)=>{const{layout:n,panelDataArray:r}=E.current,{collapsedSize:o=0,collapsible:i}=t,{collapsedSize:a=0,collapsible:s,maxSize:l=100,minSize:c=0}=e.constraints,{panelSize:u}=uhe(r,e,n);null!=u&&(i&&s&&Ife(u,o)?Ife(o,a)||M(e,a):u<c?M(e,c):u>l&&M(e,l))}),[M]),D=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=Gfe(e,h.current);Dfe(o,`Drag handle element not found for id "${e}"`);const i=Yfe(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),j=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=che(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],E.current.panelDataArrayChanged=!0,b())}),[b]),F=n.useMemo((()=>({collapsePanel:T,direction:o,dragState:m,expandPanel:C,getPanelSize:A,getPanelStyle:N,groupId:f,isPanelCollapsed:R,isPanelExpanded:O,reevaluatePanelConstraints:L,registerPanel:P,registerResizeHandle:k,resizePanel:M,startDragging:D,stopDragging:j,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,N,f,R,O,L,P,k,M,D,j,I]);return n.createElement(Dpe.Provider,{value:F},n.createElement(d,{...p,children:t,className:r,id:a,ref:h,style:{...{display:"flex",flexDirection:"horizontal"===o?"row":"column",height:"100%",overflow:"hidden",width:"100%"},...u},[jpe]:"",[Ipe]:o,[Fpe]:f}))}const lhe=n.forwardRef(((e,t)=>n.createElement(she,{...e,forwardedRef:t})));function che(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function uhe(e,t,n){const r=che(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function dhe({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:o,id:i,onBlur:a,onClick:s,onDragging:l,onFocus:c,onPointerDown:u,onPointerUp:d,style:p={},tabIndex:f=0,tagName:h="div",...m}){var g,v;const y=n.useRef(null),b=n.useRef({onClick:s,onDragging:l,onPointerDown:u,onPointerUp:d});n.useEffect((()=>{b.current.onClick=s,b.current.onDragging=l,b.current.onPointerDown=u,b.current.onPointerUp=d}));const x=n.useContext(Dpe);if(null===x)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:w,groupId:_,registerResizeHandle:S,startDragging:E,stopDragging:T,panelGroupElement:C}=x,A=Zpe(i),[N,R]=n.useState("inactive"),[O,P]=n.useState(!1),[k,M]=n.useState(null),L=n.useRef({state:N});Wpe((()=>{L.current.state=N})),n.useEffect((()=>{if(r)M(null);else{const e=S(A);M((()=>e))}}),[r,A,S]);const D=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,j=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;Dfe(e,"Element ref not attached");let t=!1;return function(e,t,n,r,o){var i;const{ownerDocument:a}=t,s={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=null!==(i=_fe.get(a))&&void 0!==i?i:0;return _fe.set(a,l+1),Efe.add(s),Mfe(),function(){var t;Sfe.delete(e),Efe.delete(s);const n=null!==(t=_fe.get(a))&&void 0!==t?t:1;if(_fe.set(a,n-1),Mfe(),1===n&&_fe.delete(a),xfe.includes(s)){const e=xfe.indexOf(s);e>=0&&xfe.splice(e,1),Pfe(),o("up",!0,null)}}}(A,e,w,{coarse:D,fine:j},((e,n,r)=>{if(n)switch(e){case"down":{R("drag"),t=!1,Dfe(r,'Expected event to be defined for "down" action'),E(A,r);const{onDragging:e,onPointerDown:n}=b.current;null==e||e(!0),null==n||n();break}case"move":{const{state:e}=L.current;t=!0,"drag"!==e&&R("hover"),Dfe(r,'Expected event to be defined for "move" action'),k(r);break}case"up":{R("hover"),T();const{onClick:e,onDragging:n,onPointerUp:r}=b.current;null==n||n(!1),null==r||r(),t||null==e||e();break}}else R("inactive")}))}),[D,w,r,j,S,A,k,E,T]),function({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:o}){n.useEffect((()=>{if(e||null==r||null==o)return;const n=Gfe(t,o);if(null==n)return;const i=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),r(e);break;case"F6":{e.preventDefault();const r=n.getAttribute(Fpe);Dfe(r,`No group element found for id "${r}"`);const i=Bfe(r,o),a=zfe(r,t,o);Dfe(null!==a,`No resize element found for id "${t}"`),i[e.shiftKey?a>0?a-1:i.length-1:a+1<i.length?a+1:0].focus();break}}};return n.addEventListener("keydown",i),()=>{n.removeEventListener("keydown",i)}}),[o,e,t,r])}({disabled:r,handleId:A,resizeHandler:k,panelGroupElement:C});return n.createElement(h,{...m,children:e,className:t,id:i,onBlur:()=>{P(!1),null==a||a()},onFocus:()=>{P(!0),null==c||c()},ref:y,role:"separator",style:{touchAction:"none",userSelect:"none",...p},tabIndex:f,[Ipe]:w,[Fpe]:_,[zpe]:"",[Hpe]:"drag"===N?"pointer":O?"keyboard":void 0,[qpe]:!r,[Gpe]:A,[Kpe]:N})}she.displayName="PanelGroup",lhe.displayName="forwardRef(PanelGroup)",dhe.displayName="PanelResizeHandle";const phe=({className:e,...n})=>t.jsx(lhe,{className:wB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),fhe=efe,hhe=({withHandle:e,className:n,...r})=>t.jsx(dhe,{className:wB("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",n),...r,children:e&&t.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsx(Eu,{className:"h-2.5 w-2.5"})})});var mhe=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(mhe||{});const ghe=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),vhe="rgba(245, 246, 247, 1)",yhe={[$e.SEND_COMMUNICATION]:{color:{bg:"rgba(205, 241, 225, 1)",text:"rgba(30, 108, 74, 1)",bgUnselected:vhe},clickable:!0},[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:vhe},clickable:!1}},bhe={[$e.SEND_COMMUNICATION]:"Send Email & SMS",[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},xhe=({children:e,onClick:n,iconBgColor:r,iconStrokeColor:o,Icon:i,disabled:a=!1,selected:s=!1})=>{const l=i;return t.jsxs(AX.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?r:vhe},onClick:n,className:Qd("flex gap-2 items-center rounded-md transition-colors group","p-2 border-2 border-transparent overflow-hidden",!a&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:[t.jsx("div",{className:Qd("bg-purple-50 rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 transition-colors",!a&&"group-hover/trigger-audience:bg-background",r),children:t.jsx(l,{className:Qd("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})},whe=({segmentName:e})=>t.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}),_he=()=>{const e=iQ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=QX(),u=n.useCallback((()=>c?.find((e=>e.type===nQ.ALL_USERS))),[c]);return n.useEffect((()=>{e&&c&&(null===i&&null===s?(a(e?.includeSegmentIds||null),l(e?.excludeSegmentIds||null),0===e.includeSegmentIds.length&&0===e.excludeSegmentIds.length&&(a([u()?.id||""]),l([]))):(JSON.stringify(e.includeSegmentIds)!==JSON.stringify(i)&&a(e.includeSegmentIds),JSON.stringify(e.excludeSegmentIds)!==JSON.stringify(s)&&l(e.excludeSegmentIds)))}),[e,s,i,c,u]),e&&i&&s?t.jsx(t.Fragment,{children:t.jsx(xhe,{selected:o===mhe.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(mhe.EditAudience)},Icon:xQ.AudienceIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Tre,{children:"Audience"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(ghe,{copyText:`Send to all ${ff("engage:user",{count:2})} in ${1===i.length?"this":"these"} ${ff("engage:segment",{count:i.length}).toLowerCase()}`}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:i.map((e=>{const n=c?.find((t=>t.id===e));return n?t.jsx(whe,{segmentName:n.name},e):null}))})]})]})})}):null},She=()=>{const e=iQ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),{segments:i}=QX(),a=ff(e?.triggerType===Fe.TRIGGER_BASED?"engage:automation":"engage:one_time"),s=`Start this ${a?.toLowerCase()}`;if(!e||!i)return null;return t.jsx(t.Fragment,{children:(()=>{switch(e.triggerType){case Fe.TRIGGER_BASED:{if(e.triggerMetadata.triggerType!==Fe.TRIGGER_BASED||e.triggerMetadata.eventName!==Ue.USER_ENTERS_SEGMENT||!e.triggerMetadata.eventFilter.segment_id)return null;const n=e.triggerMetadata.eventFilter.segment_id,r=i.find((e=>e.id===n))?.name;return r?t.jsx(xhe,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:xQ.TriggerIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Tre,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(ghe,{copyText:`When ${ff("engage:user").toLowerCase()} joins the`}),t.jsx(whe,{segmentName:r})]})]})}):null}case Fe.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(xhe,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(mhe.EditTime)},selected:o===mhe.EditTime,Icon:xQ.TriggerIcon,children:[t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Tre,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(ghe,n?{copyText:`Click to set the date and time for this ${ff("engage:one_time")}`}:{copyText:"Bulk send at"}),!1===n&&"scheduledAt"in e.triggerMetadata&&e.triggerMetadata.scheduledAt&&t.jsx("div",{className:"text-xs font-medium",children:t.jsx(whe,{segmentName:r9(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),t.jsx("div",{className:"",children:n&&t.jsx(S9,{className:"group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors"})})]})}default:throw Xte(e.triggerType,Fe)}})()})},Ehe=e=>{switch(e){case $e.SEND_COMMUNICATION:return"Send Communication";case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw DX(e,$e)}},The=e=>{switch(e){case $e.SEND_COMMUNICATION:return t.jsx(xQ.CommunicationIcon,{className:"w-4 h-4"});case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(xQ.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw Xte(e,$e)}},Che=e=>{if(!(e&&e.actionType===$e.WAIT_UNTIL_NEXT_FIXED_TIME&&"hour"in e&&"minute"in e&&"timezone"in e))return null;const{hour:t,minute:n,timezone:r}=e;return`Wait until next ${`${t?.toString().padStart(2,"0")}:${n?.toString().padStart(2,"0")}`} ${r}`},Ahe=({actionDataWithMetadata:e})=>{const{actionData:r,communicationGroup:o}=e,{state:{selectedActionId:i},setActionId:a,setSelectedCommunicationGroupId:s}=n.useContext(VX),l=n.useMemo((()=>i===r.actionMetadata.currentActionId),[i,r.actionMetadata.currentActionId]),c=yhe[r.actionType],u=c.color,d=c.clickable;return t.jsx(AX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:Qd("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",l&&"border-primary",r.actionType!==$e.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:l?u.bg:u.bgUnselected??vhe},onClick:()=>{d&&(a(r.actionMetadata.currentActionId),r.actionType===$e.SEND_COMMUNICATION&&s(r.actionMetadata.communicationGroupId))},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white",children:The(r.actionType)}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{style:{color:l?u.text:u.textUnselected},children:t.jsx(Tre,{children:bhe[r.actionType]})}),t.jsx("div",r.actionType===$e.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:Che(r.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:r.actionType===$e.SEND_COMMUNICATION&&o?.emailSubject?o?.emailSubject:Ehe(r.actionType)})]})]})})},Nhe=()=>{const[e,r]=n.useState(!1),[o,i]=n.useState(void 0),a=iQ(),{setActionId:s,state:{selectedActionId:l}}=n.useContext(VX);if(n.useEffect((()=>{if(!a)return;if(l)return;const e=a.actionData?.find((e=>"send_communication"===e.actionType));e&&s(e.actionMetadata.currentActionId)}),[a,s,l]),n.useEffect((()=>{if(!a)return;(async()=>{const e=[];for(const t of a.actionData??[])switch(t.actionType){case $e.SEND_COMMUNICATION:{const n=await zX(t.actionMetadata.communicationGroupId);e.push({actionData:t,communicationGroup:n});break}case $e.WAIT_UNTIL_NEXT_FIXED_TIME:e.push({actionData:t});break;default:throw DX(t.actionType,$e)}i(e)})()}),[a]),!a||!o)return null;const c=(e=>{const{steps:t,rootActionId:n}=e;if(!t||!n)return t??[];const r=new Map(t.map((e=>[e.actionData.actionMetadata.currentActionId,e]))),o=r.get(n);if(!o)return t;const i=[];let a=o;for(;a;){i.push(a);const e=a.actionData.actionMetadata.nextActionId;if(!e)break;a=r.get(e)}return i})({steps:o,rootActionId:a.triggerMetadata?.triggerType===Fe.TRIGGER_BASED?a.triggerMetadata.rootActionId:void 0}).filter((t=>!!e||"send_communication"===t.actionData.actionType));let u=()=>t.jsx("div",{});(e||a.triggerType===Fe.ONE_TIME)&&(u=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[a.triggerType===Fe.ONE_TIME&&t.jsx(_he,{}),t.jsx(She,{})]}));return t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[a.description?t.jsx("div",{className:"w-full mx-auto rounded-xl bg-neutral-50 dark:bg-neutral-900 shadow-sm px-4 py-3 my-2 border border-neutral-200 dark:border-neutral-800 text-neutral-800 dark:text-neutral-100 text-[15px] font-medium leading-snug tracking-tight justify-start",style:{containerType:"inline-size"},children:a.description}):null,a.triggerType===Fe.TRIGGER_BASED&&t.jsxs("div",{className:"flex gap-2 items-center justify-between",children:[t.jsx("div",{className:"text-[13px] text-muted-foreground",children:"Messages sent in listed order"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("div",{className:"text-[13px] font-medium",children:"Show all details"}),t.jsx(ile,{defaultChecked:e,onCheckedChange:()=>{r(!e)}})]})]}),t.jsx("div",{className:"flex-1 flex flex-col gap-3",children:t.jsxs(zB,{mode:"popLayout",children:[u(),c.map(((e,n)=>t.jsx(AX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,delay:.05*n,ease:"easeInOut"},children:t.jsx(Ahe,{actionDataWithMetadata:e})},e.actionData.actionMetadata?.currentActionId??n)))]})})]})},Rhe=()=>{const e=iQ(),{segments:n}=QX();return t.jsx("div",e&&n?{className:"h-full pt-4 relative",children:t.jsx("div",{className:"absolute inset-0 overflow-y-auto flex flex-col gap-3",children:t.jsx(Nhe,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(fQ,{text:[`Getting details on your ${ff("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},Ohe=()=>{const{state:{selectedActionId:e}}=n.useContext(VX);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(zB,{mode:"wait",children:t.jsx(e===mhe.EditTime?Rse:e===mhe.EditAudience?wle:wre,{})})})},Phe=()=>t.jsxs(phe,{direction:"horizontal",className:"flex-1",children:[t.jsx(fhe,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(Rhe,{})})}),t.jsx(hhe,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(fhe,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(Ohe,{})})})]}),khe=()=>{const[e,r]=n.useState("workflow"),o=[{id:"workflow",label:"Workflow",content:t.jsx(Phe,{})},{id:"recipients",label:"Recipients",content:t.jsx(Lpe,{})},{id:"insights",label:ff("engage:insight",{count:2}),content:t.jsx(Mpe,{})}];return t.jsx("div",{className:"h-full w-full",children:t.jsx(Ple,{tabs:o,activeTab:e,onTabChange:r,tabsLocation:"left"})})},Mhe=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i})=>{const a=iQ(),s=aQ(),{updateCommunicationGroup:l}=GX(),{toast:c}=Ll();return n.useEffect((()=>{if(s&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(s.extraMergeFields)&&l({groupId:s?.id,params:{extraMergeFields:e}},{onError:e=>{c({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[s,i,l,c]),a&&s?t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(kpe,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(khe,{})})]}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(fQ,{text:[`Fetching ${ff("engage:automation").toLowerCase()} data`,"Finishing up"]})})},Lhe=({...e})=>{const n=function(){let{matches:e}=i.useContext(F5),t=e[e.length-1];return t?t.params:{}}(),[r]=A4(),o=e.automationId||n?.automationId||r.get("automationId")||"",a="true"===r.get("showBackButton")||e.showBackButton;return t.jsx(lQ,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(Mhe,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var Dhe=e=>null!=e;var jhe=e=>"function"!=typeof e||e.length?e:e(),Ihe=e=>Array.isArray(e)?e:e?[e]:[];var Fhe=mt;var Uhe,$he=function(e){const[t,n]=at(),r=e?.throw?(e,t)=>{throw n(e instanceof Error?e:new Error(t)),e}:(e,t)=>{n(e instanceof Error?e:new Error(t))},o=e?.api?Array.isArray(e.api)?e.api:[e.api]:[globalThis.localStorage].filter(Boolean),i=e?.prefix?`${e.prefix}.`:"",a=new Map,s=new Proxy({},{get(t,n){let s=a.get(n);s||(s=at(void 0,{equals:!1}),a.set(n,s)),s[0]();const l=o.reduce(((e,t)=>{if(null!==e||!t)return e;try{return t.getItem(`${i}${n}`)}catch(eSe){return r(eSe,`Error reading ${i}${n} from ${t.name}`),null}}),null);return null!==l&&e?.deserializer?e.deserializer(l,n,e.options):l}});return!1!==e?.sync&&ht((()=>{const e=e=>{let t=!1;o.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),t=!0)}catch(eSe){r(eSe,`Error synching api ${n.name} from storage event (${e.key}=${e.newValue})`)}})),t&&e.key&&a.get(e.key)?.[1]()};"addEventListener"in globalThis?(globalThis.addEventListener("storage",e),mt((()=>globalThis.removeEventListener("storage",e)))):(o.forEach((t=>t.addEventListener?.("storage",e))),mt((()=>o.forEach((t=>t.removeEventListener?.("storage",e))))))})),[s,(t,n,s)=>{const l=e?.serializer?e.serializer(n,t,s??e.options):n,c=`${i}${t}`;o.forEach((e=>{try{e.getItem(c)!==l&&e.setItem(c,l)}catch(eSe){r(eSe,`Error setting ${i}${t} to ${l} in ${e.name}`)}}));const u=a.get(t);u&&u[1]()},{clear:()=>o.forEach((e=>{try{e.clear()}catch(eSe){r(eSe,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(eSe){r(eSe,`Error removing ${i}${e} from ${t.name}`)}})),toJSON:()=>{const t={},n=(n,r)=>{if(!t.hasOwnProperty(n)){const o=r&&e?.deserializer?e.deserializer(r,n,e.options):r;o&&(t[n]=o)}};return o.forEach((e=>{if("function"==typeof e.getAll){let t;try{t=e.getAll()}catch(eSe){r(eSe,`Error getting all values from in ${e.name}`)}for(const e of t)n(e,t[e])}else{let o,i=0;try{for(;o=e.key(i++);)t.hasOwnProperty(o)||n(o,e.getItem(o))}catch(eSe){r(eSe,`Error getting all values from ${e.name}`)}}})),t}}]},Vhe=e=>{if(!e)return"";let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const r=e[n];t+=r instanceof Date?`; ${n}=${r.toUTCString()}`:"boolean"==typeof r?`; ${n}`:`; ${n}=${r}`}return t},Bhe=("function"==typeof(Uhe={_cookies:[globalThis.document,"cookie"],getItem:e=>Bhe._cookies[0][Bhe._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=Bhe.getItem(e);Bhe._cookies[0][Bhe._cookies[1]]=`${e}=${t}${Vhe(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:Bhe});window.dispatchEvent(o)},removeItem:e=>{Bhe._cookies[0][Bhe._cookies[1]]=`${e}=deleted${Vhe({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return Bhe._cookies[0][Bhe._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return Bhe._cookies[0][Bhe._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(Uhe.clear=()=>{let e;for(;e=Uhe.key(0);)Uhe.removeItem(e)}),Uhe),zhe=796,Hhe="bottom",qhe="system",Ghe=Object.keys(Nr)[0],Khe=Object.keys(Pr)[0],Whe=xt({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Yhe(){return wt(Whe)}var Xhe=xt(void 0),Qhe=e=>{const[t,n]=at(null),r=()=>{const e=t();null!=e&&(e.close(),n(null))},o=(r,o)=>{if(null!=t())return;const i=window.open("","TSQD-Devtools-Panel",`width=${r},height=${o},popup`);if(!i)throw new Error("Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.");i.document.head.innerHTML="",i.document.body.innerHTML="",function(e=window.document){if(e[un]){for(let t of e[un].keys())e.removeEventListener(t,En);delete e[un]}}(i.document),i.document.title="TanStack Query Devtools",i.document.body.style.margin="0",i.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(Yhe().shadowDOMTarget||document).styleSheets].forEach((e=>{try{const t=[...e.cssRules].map((e=>e.cssText)).join(""),n=document.createElement("style"),r=e.ownerNode;let o="";r&&"id"in r&&(o=r.id),o&&n.setAttribute("id",o),n.textContent=t,i.document.head.appendChild(n)}catch(J_e){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,i.document.head.appendChild(n)}})),fn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],i.document),e.setLocalStore("pip_open","true"),n(i)};ct((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||o(Number(window.innerWidth),Number(e.localStore.height||500))})),ct((()=>{const e=(Yhe().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(Yhe().shadowDOMTarget||n.document).querySelector("#_goober");t&&(t.textContent=e.textContent)}));t.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),mt((()=>{t.disconnect()}))}}));const i=ut((()=>({pipWindow:t(),requestPipWindow:o,closePipWindow:r,disabled:e.disabled??!1})));return $t(Xhe.Provider,{value:i,get children(){return e.children}})},Zhe=()=>ut((()=>{const e=wt(Xhe);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Jhe=xt((()=>"dark"));function eme(){return wt(Jhe)}var tme={"À":"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"},nme=Object.keys(tme).join("|"),rme=new RegExp(nme,"g");var ome=7,ime=6,ame=5,sme=4,lme=3,cme=2,ume=1,dme=0;function pme(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:ume,!n.accessors){const r=fme(e,t,n);return{rankedValue:e,rank:r,accessorIndex:-1,accessorThreshold:n.threshold,passed:r>=n.threshold}}const o=function(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r],i=vme(o),a=mme(e,o);for(let e=0,t=a.length;e<t;e++)n.push({itemValue:a[e],attributes:i})}return n}(e,n.accessors),i={rankedValue:e,rank:dme,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=fme(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=ume?r=s:r>l&&(r=l),r=Math.min(r,l),r>=c&&r>i.rank&&(i.rank=r,i.passed=!0,i.accessorIndex=a,i.accessorThreshold=c,i.rankedValue=e.itemValue)}return i}function fme(e,t,n){return e=hme(e,n),(t=hme(t,n)).length>e.length?dme:e===t?ome:(e=e.toLowerCase())===(t=t.toLowerCase())?ime:e.startsWith(t)?ame:e.includes(` ${t}`)?sme:e.includes(t)?lme:1===t.length?dme:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?cme:function(e,t){let n=0,r=0;function o(e,t,r){for(let o=r,i=t.length;o<i;o++){if(t[o]===e)return n+=1,o+1}return-1}function i(e){return ume+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return dme;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return dme}return i(r-a)}(e,t)}function hme(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(rme,(e=>tme[e]))),e}function mme(e,t){let n=t;"object"==typeof t&&(n=t.accessor);const r=n(e);return null==r?[]:Array.isArray(r)?r:[String(r)]}var gme={maxRanking:1/0,minRanking:-1/0};function vme(e){return"function"==typeof e?gme:{...gme,...e}}var yme={data:""},bme=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,xme=/\/\*[^]*?\*\/| +/g,wme=/\n+/g,_me=(e,t)=>{let n="",r="",o="";for(let i in e){let a=e[i];"@"==i[0]?"i"==i[1]?n=i+" "+a+";":r+="f"==i[1]?_me(a,i):i+"{"+_me(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=_me(a,t?t.replace(/([^,])+/g,(e=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)))):i):null!=a&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=_me.p?_me.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},Sme={},Eme=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+Eme(e[n]);return t}return e};function Tme(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=Eme(e),a=Sme[i]||(Sme[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!Sme[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=bme.exec(e.replace(xme,""));)t[4]?r.shift():t[3]?(n=t[3].replace(wme," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(wme," ").trim();return r[0]})(e);Sme[a]=_me(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&Sme.g?Sme.g:null;return n&&(Sme.g=Sme[a]),l=Sme[a],c=t,u=r,(d=s)?c.data=c.data.replace(d,l):-1===c.data.indexOf(l)&&(c.data=u?l+c.data:c.data+l),a;var l,c,u,d})(n.unshift?n.raw?((e,t,n)=>e.reduce(((e,r,o)=>{let i=t[o];if(i&&i.call){let e=i(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;i=t?"."+t:e&&"object"==typeof e?e.props?"":_me(e,""):!1===e?"":e}return e+r+(null==i?"":i)}),""))(n,[].slice.call(arguments,1),t.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(t.p):n)),{}):n,(r=t.target,"object"==typeof window?((r?r.querySelector("#_goober"):window._goober)||Object.assign((r||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:r||yme),t.g,t.o,t.k);var r}function Cme(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Cme(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ame(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Cme(e))&&(r&&(r+=" "),r+=t);return r}function Nme(e,t){const n=pt(e),{onChange:r}=t;let o=new Set(t.appear?void 0:n);const i=new WeakSet,[a,s]=at([],{equals:!1}),[l]=[yt,vt],c=e=>{s((t=>(t.push.apply(t,e),t)));for(const t of e)i.delete(t)},u=(e,t,n)=>e.splice(n,0,t);return ut((t=>{const n=a(),s=e();if(pt(l))return l(),t;if(n.length){const e=t.filter((e=>!n.includes(e)));return n.length=0,r({list:e,added:[],removed:[],unchanged:e,finishRemoved:c}),e}return pt((()=>{const e=new Set(s),n=s.slice(),a=[],l=[],d=[];for(const t of s)(o.has(t)?d:a).push(t);let p=!a.length;for(let r=0;r<t.length;r++){const o=t[r];e.has(o)||(i.has(o)||(l.push(o),i.add(o)),u(n,o,r)),p&&o!==n[r]&&(p=!1)}return!l.length&&p?t:(r({list:n,added:a,removed:l,unchanged:d,finishRemoved:c}),o=e,n)}))}),t.appear?[]:n.slice())}function Rme(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}Tme.bind({g:1}),Tme.bind({k:1});var Ome=e=>e instanceof Element;function Pme(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return Pme(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=Pme(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function kme(e,t=Ome,n=Ome){const r=ut(e),o=ut((()=>Pme(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function Mme(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function Lme(e,t,n,r){const{onBeforeEnter:o,onEnter:i,onAfterEnter:a}=t;function s(t){t&&t.target!==n||(n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.enterActive),n.classList.remove(...e.enterTo),a?.(n))}o?.(n),n.classList.add(...e.enter),n.classList.add(...e.enterActive),queueMicrotask((()=>{if(!n.parentNode)return r?.();i?.(n,(()=>s()))})),Mme((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function Dme(e,t,n,r){const{onBeforeExit:o,onExit:i,onAfterExit:a}=t;if(!n.parentNode)return r?.();function s(t){t&&t.target!==n||(r?.(),n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.exitActive),n.classList.remove(...e.exitTo),a?.(n))}o?.(n),n.classList.add(...e.exit),n.classList.add(...e.exitActive),i?.(n,(()=>s())),Mme((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var jme=e=>{const t=function(e){return ut((()=>{const t=e.name||"s";return{enterActive:(e.enterActiveClass||t+"-enter-active").split(" "),enter:(e.enterClass||t+"-enter").split(" "),enterTo:(e.enterToClass||t+"-enter-to").split(" "),exitActive:(e.exitActiveClass||t+"-exit-active").split(" "),exit:(e.exitClass||t+"-exit").split(" "),exitTo:(e.exitToClass||t+"-exit-to").split(" "),move:(e.moveClass||t+"-move").split(" ")}}))}(e);return Nme(kme((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)Lme(a,e,t);const s=[];for(const e of i)e.isConnected&&(e instanceof HTMLElement||e instanceof SVGElement)&&s.push({el:e,rect:e.getBoundingClientRect()});queueMicrotask((()=>{const e=[];for(const{el:t,rect:n}of s)if(t.isConnected){const r=t.getBoundingClientRect(),o=n.left-r.left,i=n.top-r.top;(o||i)&&(t.style.transform=`translate(${o}px, ${i}px)`,t.style.transitionDuration="0s",e.push(t))}document;for(const t of e){let e=function(n){(n.target===t||/transform$/.test(n.propertyName))&&(t.removeEventListener("transitionend",e),t.classList.remove(...a.move))};t.classList.add(...a.move),t.style.transform=t.style.transitionDuration="",t.addEventListener("transitionend",e)}}));for(const t of r)Dme(a,e,t,(()=>o([t])))}})},Ime=Symbol("fallback");function Fme(e){for(const t of e)t.dispose()}function Ume(e){const{by:t}=e;return ut(function(e,t,n,r={}){const o=new Map;return mt((()=>Fme(o.values()))),()=>{const n=e()||[];return pt((()=>{if(!n.length)return Fme(o.values()),o.clear(),r.fallback?[it((e=>(o.set(Ime,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(Ime);if(!o.size||a){a?.dispose(),o.delete(Ime);for(let r=0;r<n.length;r++){const o=n[r];i(e,o,r,t(o,r))}return e}const s=new Set(o.keys());for(let r=0;r<n.length;r++){const a=n[r],l=t(a,r);s.delete(l);const c=o.get(l);c?(e[r]=c.mapped,c.setIndex?.(r),c.setItem((()=>a))):i(e,a,r,l)}for(const t of s)o.get(t)?.dispose(),o.delete(t);return e}))};function i(e,t,r,i){it((a=>{const[s,l]=at(t),c={setItem:l,dispose:a};if(n.length>1){const[e,t]=at(r);c.setIndex=t,c.mapped=n(s,e)}else c.mapped=n(s);o.set(i,c),e[r]=c.mapped}))}}((()=>e.each),"function"==typeof t?t:e=>e[t],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function $me(e,t,n,r){const o=()=>{Ihe(jhe(e)).forEach((e=>{e&&Ihe(jhe(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),Fhe(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?ct(o):lt(o)}function Vme(e,t,n){const r=new WeakMap,{observe:o,unobserve:i}=function(e,t){const n=new ResizeObserver(e);return mt(n.disconnect.bind(n)),{observe:e=>n.observe(e,t),unobserve:n.unobserve.bind(n)}}((e=>{for(const n of e){const{contentRect:e,target:o}=n,i=Math.round(e.width),a=Math.round(e.height),s=r.get(o);s&&s.width===i&&s.height===a||(t(e,o,n),r.set(o,{width:i,height:a}))}}),n);ct((t=>{const n=Ihe(jhe(e)).filter(Dhe);return function(e,t,n,r){const o=e.length,i=t.length;let a,s,l=0;if(i)if(o){for(;l<i&&t[l]===e[l];l++);for(a of(t=t.slice(l),e=e.slice(l),t))e.includes(a)||r(a);for(s of e)t.includes(s)||n(s)}else for(;l<i;l++)r(t[l]);else for(;l<o;l++)n(e[l])}(n,t,o,i),n}),[])}var Bme=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function zme(e){const t={};let n;for(;n=Bme.exec(e);)t[n[1]]=n[2];return t}function Hme(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=zme(e)}else"string"==typeof t&&(t=zme(t));return{...e,...t}}function qme(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function Gme(e){return"[object String]"===Object.prototype.toString.call(e)}function Kme(e){return t=>`${e()}-${t}`}function Wme(e,t){return!!e&&(e===t||e.contains(t))}function Yme(e,t=!1){const{activeElement:n}=Xme(e);if(!n?.nodeName)return null;if(Qme(n)&&n.contentDocument)return Yme(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Xme(n).getElementById(e);if(t)return t}}return n}function Xme(e){return e?e.ownerDocument||e:document}function Qme(e){return"IFRAME"===e.tagName}var Zme=(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))(Zme||{});function Jme(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function ege(){return Jme(/^Mac/i)}function tge(){return Jme(/^iPhone/i)||Jme(/^iPad/i)||ege()&&navigator.maxTouchPoints>1}function nge(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function rge(e){return t=>{for(const n of e)nge(t,n)}}function oge(e){return ege()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function ige(e){if(e)if(function(){if(null==age){age=!1;try{document.createElement("div").focus({get preventScroll(){return age=!0,!0}})}catch(J_e){}}return age}())e.focus({preventScroll:!0});else{const t=function(e){let t=e.parentNode;const n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft});return n}(e);e.focus(),function(e){for(const{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}var age=null;var sge=["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'])"],lge=[...sge,'[tabindex]:not([tabindex="-1"]):not([disabled])'],cge=sge.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",uge=lge.join(':not([hidden]):not([tabindex="-1"]),');function dge(e,t){const n=Array.from(e.querySelectorAll(cge)).filter(pge);return t&&pge(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Qme(e)&&e.contentDocument){const r=dge(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function pge(e){return fge(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function fge(e){return e.matches(cge)&&hge(e)}function hge(e,t){return"#comment"!==e.nodeName&&function(e){if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const{display:t,visibility:n}=e.style;let r="none"!==t&&"hidden"!==n&&"collapse"!==n;if(r){if(!e.ownerDocument.defaultView)return r;const{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:o}=t(e);r="none"!==n&&"hidden"!==o&&"collapse"!==o}return r}(e)&&function(e,t){return!e.hasAttribute("hidden")&&("DETAILS"!==e.nodeName||!t||"SUMMARY"===t.nodeName||e.hasAttribute("open"))}(e,t)&&(!e.parentElement||hge(e.parentElement,e))}function mge(e){for(;e&&!gge(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function gge(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function vge(){}function yge(e,t){return qt(e,t)}var bge=new Map,xge=new Set;function wge(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=bge.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),bge.delete(t.target)),0===bge.size)){for(const e of xge)e();xge.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=bge.get(t.target);n||(n=new Set,bge.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function _ge(e,t){const n=Sge(e,t,"left"),r=Sge(e,t,"top"),o=t.offsetWidth,i=t.offsetHeight;let a=e.scrollLeft,s=e.scrollTop;const l=a+e.offsetWidth,c=s+e.offsetHeight;n<=a?a=n:n+o>l&&(a+=n+o-l),r<=s?s=r:r+i>c&&(s+=r+i-c),e.scrollLeft=a,e.scrollTop=s}function Sge(e,t,n){const r="left"===n?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);){if(t.offsetParent.contains(e)){o-=e[r];break}t=t.offsetParent}return o}"undefined"!=typeof document&&("loading"!==document.readyState?wge():document.addEventListener("DOMContentLoaded",wge));var Ege={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 Tge(e){return t=>(e(t),()=>e(void 0))}function Cge(e,t){const[n,r]=at(Age(t?.()));return ct((()=>{r(e()?.tagName.toLowerCase()||Age(t?.()))})),n}function Age(e){return Gme(e)?e:void 0}function Nge(e){const[t,n]=Gt(e,["as"]);if(!t.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return $t(Pn,qt(n,{get component(){return t.as}}))}var Rge=["id","name","validationState","required","disabled","readOnly"];var Oge=xt();function Pge(){const e=wt(Oge);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function kge(e){const t=Pge(),n=yge({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Nge,qt({as:"div"},(()=>t.dataset()),n))}function Mge(e){const t=Pge(),n=yge({id:t.generateId("error-message")},e),[r,o]=Gt(n,["forceMount"]),i=()=>"invalid"===t.validationState();return ct((()=>{i()&&mt(t.registerErrorMessage(o.id))})),$t(Jt,{get when(){return r.forceMount||i()},get children(){return $t(Nge,qt({as:"div"},(()=>t.dataset()),o))}})}function Lge(e){let t;const n=Pge(),r=yge({id:n.generateId("label")},e),[o,i]=Gt(r,["ref"]),a=Cge((()=>t),(()=>"label"));return ct((()=>mt(n.registerLabel(i.id)))),$t(Nge,qt({as:"label",ref(e){const n=Rme((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ut((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function Dge(e,t){ct(ft(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",t,{passive:!0}),mt((()=>{n.removeEventListener("reset",t)})))})))}function jge(e){const[t,n]=at(e.defaultValue?.()),r=ut((()=>void 0!==e.value?.())),o=ut((()=>r()?e.value?.():t()));return[o,t=>{pt((()=>{const i=function(e,...t){return"function"==typeof e?e(...t):e}(t,o());return Object.is(i,o())||(r()||n(i),e.onChange?.(i)),i}))}]}function Ige(e){const[t,n]=jge(e);return[()=>t()??!1,n]}var Fge=Object.defineProperty,Uge=(e,t)=>{for(var n in t)Fge(e,n,{get:t[n],enumerable:!0})},$ge=xt();function Vge(){return wt($ge)}function Bge(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function zge(e,t){const n=function(e){const t=e.map(((e,t)=>[t,e]));let n=!1;return t.sort((([e,t],[r,o])=>{const i=t.ref(),a=o.ref();return i===a?0:i&&a?Bge(i,a)?(e>r&&(n=!0),-1):(e<r&&(n=!0),1):0})),n?t.map((([e,t])=>t)):e}(e);e!==n&&t(n)}function Hge(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){ct((()=>{const n=setTimeout((()=>{zge(e(),t)}));mt((()=>clearTimeout(n)))}))}(e,t);let n=[];ct((()=>{const r=function(e){const t=e[0],n=e[e.length-1]?.ref();let r=t?.ref()?.parentElement;for(;r;){if(n&&r.contains(n))return r;r=r.parentElement}return Xme(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&zge(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}mt((()=>o.disconnect()))}))}function qge(e={}){const[t,n]=function(e){const[t,n]=jge(e);return[()=>t()??[],n]}({value:()=>jhe(e.items),onChange:t=>e.onItemsChange?.(t)});Hge(t,n);const r=e=>(n((t=>{const n=function(e,t){const n=t.ref();if(!n)return-1;let r=e.length;if(!r)return-1;for(;r--;){const t=e[r]?.ref();if(t&&Bge(t,n))return r+1}return 0}(t,e);return function(e,t,n=-1){return n in e?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}(t,e,n)})),()=>{n((t=>{const n=t.filter((t=>t.ref()!==e.ref()));return t.length===n.length?t:n}))});return{DomCollectionProvider:e=>$t($ge.Provider,{value:{registerItem:r},get children(){return e.children}})}}function Gge(e){const t=function(){const e=Vge();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=yge({shouldRegisterItem:!0},e);ct((()=>{if(!n.shouldRegisterItem)return;mt(t.registerItem(n.getItem()))}))}function Kge(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=Gme(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=Gme(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(Gme(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return Gme(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(Gme(l)||"number"==typeof l)r.push({type:"item",rawValue:l,key:String(l),textValue:String(l),disabled:a(l),level:n,index:t}),t++;else if(null!=s(l)){r.push({type:"section",rawValue:l,key:"",textValue:"",disabled:!1,level:n,index:t}),t++;const o=s(l)??[];if(o.length>0){const i=Kge({dataSource:o,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:t,startLevel:n+1});r.push(...i),t+=i.length}}else r.push({type:"item",rawValue:l,key:o(l),textValue:i(l),disabled:a(l),level:n,index:t}),t++;return r}function Wge(e,t=[]){return ut((()=>{const n=Kge({dataSource:jhe(e.dataSource),getKey:jhe(e.getKey),getTextValue:jhe(e.getTextValue),getDisabled:jhe(e.getDisabled),getSectionChildren:jhe(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var Yge=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Xge=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Qge(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return Yge.has(t)}const t=e.split("-")[0];return Xge.has(t)}(e)?"rtl":"ltr"}function Zge(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Qge(e)}}var Jge=Zge(),eve=new Set;function tve(){Jge=Zge();for(const e of eve)e(Jge)}var nve=xt();function rve(){const e=function(){const[e,t]=at(Jge),n=ut((()=>e()));return ht((()=>{0===eve.size&&window.addEventListener("languagechange",tve),eve.add(t),mt((()=>{eve.delete(t),0===eve.size&&window.removeEventListener("languagechange",tve)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return wt(nve)||e}var ove=new Map;var ive=class e extends Set{anchorKey;currentKey;constructor(t,n,r){super(t),t instanceof e?(this.anchorKey=n||t.anchorKey,this.currentKey=r||t.currentKey):(this.anchorKey=n,this.currentKey=r)}};function ave(e){return ege()||tge()?e.altKey:e.ctrlKey}function sve(e){return ege()?e.metaKey:e.ctrlKey}function lve(e){return new ive(e)}function cve(e){const t=yge({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=at(!1),[o,i]=at(),a=ut((()=>{const e=jhe(t.selectedKeys);return null!=e?lve(e):e})),s=ut((()=>{const e=jhe(t.defaultSelectedKeys);return null!=e?lve(e):new ive})),[l,c]=function(e){const[t,n]=jge(e);return[()=>t()??new ive,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=at(jhe(t.selectionBehavior));return ct((()=>{const e=l();"replace"===jhe(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),ct((()=>{d(jhe(t.selectionBehavior)??"toggle")})),{selectionMode:()=>jhe(t.selectionMode),disallowEmptySelection:()=>jhe(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!jhe(t.allowDuplicateSelectionEvents)&&function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(e,l())||c(e)}}}function uve(e,t,n){const r=qt({selectOnFocus:()=>"replace"===jhe(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=rve();let a={top:0,left:0};$me((()=>jhe(r.isVirtualized)?void 0:o()),"scroll",(()=>{const e=o();e&&(a={top:e.scrollTop,left:e.scrollLeft})}));const{typeSelectHandlers:s}=function(e){const[t,n]=at(""),[r,o]=at(-1);return{typeSelectHandlers:{onKeyDown:i=>{if(jhe(e.isDisabled))return;const a=jhe(e.keyboardDelegate),s=jhe(e.selectionManager);if(!a.getKeyForSearch)return;const l=function(e){return 1!==e.length&&/^[A-Z]/i.test(e)?"":e}(i.key);if(!l||i.ctrlKey||i.metaKey)return;" "===l&&t().trim().length>0&&(i.preventDefault(),i.stopPropagation());let c=n((e=>e+l)),u=a.getKeyForSearch(c,s.focusedKey())??a.getKeyForSearch(c);null==u&&function(e){return e.split("").every((t=>t===e[0]))}(c)&&(c=c[0],u=a.getKeyForSearch(c,s.focusedKey())??a.getKeyForSearch(c)),null!=u&&(s.setFocusedKey(u),e.onTypeSelect?.(u)),clearTimeout(r()),o(window.setTimeout((()=>n("")),500))}}}}({isDisabled:()=>jhe(r.disallowTypeAhead),keyboardDelegate:()=>jhe(r.keyboardDelegate),selectionManager:()=>jhe(r.selectionManager)}),l=()=>jhe(r.orientation)??"vertical",c=()=>{const e=jhe(r.autoFocus);if(!e)return;const n=jhe(r.selectionManager),o=jhe(r.keyboardDelegate);let i;"first"===e&&(i=o.getFirstKey?.()),"last"===e&&(i=o.getLastKey?.());const a=n.selectedKeys();a.size&&(i=a.values().next().value),n.setFocused(!0),n.setFocusedKey(i);const s=t();s&&null==i&&!jhe(r.shouldUseVirtualFocus)&&ige(s)};ht((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),ct(ft([o,()=>jhe(r.isVirtualized),()=>jhe(r.selectionManager).focusedKey()],(e=>{const[t,n,o]=e;if(n)o&&r.scrollToKey?.(o);else if(o&&t){const e=t.querySelector(`[data-key="${o}"]`);e&&_ge(t,e)}})));return{tabIndex:ut((()=>{if(!jhe(r.shouldUseVirtualFocus))return null==jhe(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{nge(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=jhe(r.selectionManager),a=jhe(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!ave(e)&&o.replaceSelection(t))},u=jhe(r.keyboardDelegate),d=jhe(r.shouldFocusWrap),p=o.focusedKey();switch(e.key){case"vertical"===l()?"ArrowDown":"ArrowRight":if(u.getKeyBelow){let t;e.preventDefault(),t=null!=p?u.getKeyBelow(p):u.getFirstKey?.(),null==t&&d&&(t=u.getFirstKey?.(p)),c(t)}break;case"vertical"===l()?"ArrowUp":"ArrowLeft":if(u.getKeyAbove){let t;e.preventDefault(),t=null!=p?u.getKeyAbove(p):u.getLastKey?.(),null==t&&d&&(t=u.getLastKey?.(p)),c(t)}break;case"vertical"===l()?"ArrowLeft":"ArrowUp":if(u.getKeyLeftOf){e.preventDefault();const t="rtl"===i();let n;n=null!=p?u.getKeyLeftOf(p):t?u.getFirstKey?.():u.getLastKey?.(),c(n)}break;case"vertical"===l()?"ArrowRight":"ArrowDown":if(u.getKeyRightOf){e.preventDefault();const t="rtl"===i();let n;n=null!=p?u.getKeyRightOf(p):t?u.getLastKey?.():u.getFirstKey?.(),c(n)}break;case"Home":if(u.getFirstKey){e.preventDefault();const t=u.getFirstKey(p,sve(e));null!=t&&(o.setFocusedKey(t),sve(e)&&e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&o.replaceSelection(t))}break;case"End":if(u.getLastKey){e.preventDefault();const t=u.getLastKey(p,sve(e));null!=t&&(o.setFocusedKey(t),sve(e)&&e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&o.replaceSelection(t))}break;case"PageDown":if(u.getKeyPageBelow&&null!=p){e.preventDefault();c(u.getKeyPageBelow(p))}break;case"PageUp":if(u.getKeyPageAbove&&null!=p){e.preventDefault();c(u.getKeyPageAbove(p))}break;case"a":sve(e)&&"multiple"===o.selectionMode()&&!0!==jhe(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),jhe(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!jhe(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?uge:cge,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&hge(e)&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});return t?.from&&(r.currentNode=t.from),r}(n,{tabbable:!0});let t,r;do{r=e.lastChild(),r&&(t=r)}while(r);t&&!t.contains(document.activeElement)&&ige(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=jhe(r.selectionManager),n=jhe(r.keyboardDelegate),i=jhe(r.selectOnFocus);if(t.isFocused())e.currentTarget.contains(e.target)||t.setFocused(!1);else if(e.currentTarget.contains(e.target))if(t.setFocused(!0),null==t.focusedKey()){const r=e=>{null!=e&&(t.setFocusedKey(e),i&&t.replaceSelection(e))},o=e.relatedTarget;o&&e.currentTarget.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?r(t.lastSelectedKey()??n.getLastKey?.()):r(t.firstSelectedKey()??n.getFirstKey?.())}else if(!jhe(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(ige(n),_ge(e,n))}}},onFocusOut:e=>{const t=jhe(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function dve(e,t){const n=()=>jhe(e.selectionManager),r=()=>jhe(e.key),o=()=>jhe(e.shouldUseVirtualFocus),i=e=>{"none"!==n().selectionMode()&&("single"===n().selectionMode()?n().isSelected(r())&&!n().disallowEmptySelection()?n().toggleSelection(r()):n().replaceSelection(r()):e?.shiftKey?n().extendSelection(r()):"toggle"===n().selectionBehavior()||sve(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>jhe(e.disabled)||n().isDisabled(r()),s=()=>!a()&&n().canSelectItem(r());let l=null;const c=ut((()=>{if(!o()&&!a())return r()===n().focusedKey()?0:-1})),u=ut((()=>jhe(e.virtualized)?void 0:r()));return ct(ft([t,r,o,()=>n().focusedKey(),()=>n().isFocused()],(([t,n,r,o,i])=>{t&&n===o&&i&&!r&&document.activeElement!==t&&(e.focus?e.focus():ige(t))}))),{isSelected:()=>n().isSelected(r()),isDisabled:a,allowsSelection:s,tabIndex:c,dataKey:u,onPointerDown:t=>{s()&&(l=t.pointerType,"mouse"!==t.pointerType||0!==t.button||jhe(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&jhe(e.shouldSelectOnPressUp)&&jhe(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(jhe(e.shouldSelectOnPressUp)&&!jhe(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(ave(e)?n().toggleSelection(r()):i(e))},onMouseDown:e=>{a()&&e.preventDefault()},onFocus:e=>{const i=t();o()||a()||!i||e.target===i&&n().setFocusedKey(r())}}}var pve=class{collection;state;constructor(e,t){this.collection=e,this.state=t}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 t=this.getKey(e);return null!=t&&this.state.selectedKeys().has(t)}isEmpty(){return 0===this.state.selectedKeys().size}isSelectAll(){if(this.isEmpty())return!1;const e=this.state.selectedKeys();return this.getAllSelectableKeys().every((t=>e.has(t)))}firstSelectedKey(){let e;for(const t of this.state.selectedKeys()){const n=this.collection().getItem(t);e&&!(null!=n?.index&&null!=e?.index&&n.index<e.index)||(e=n)}return e?.key}lastSelectedKey(){let e;for(const t of this.state.selectedKeys()){const n=this.collection().getItem(t);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 t=this.getKey(e);if(null==t)return;const n=this.state.selectedKeys(),r=n.anchorKey||t,o=new ive(n,r,t);for(const i of this.getKeyRange(r,n.currentKey||t))o.delete(i);for(const i of this.getKeyRange(t,r))this.canSelectItem(i)&&o.add(i);this.state.setSelectedKeys(o)}getKeyRange(e,t){const n=this.collection().getItem(e),r=this.collection().getItem(t);return n&&r?null!=n.index&&null!=r.index&&n.index<=r.index?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){const n=[];let r=e;for(;null!=r;){const e=this.collection().getItem(r);if(e&&"item"===e.type&&n.push(r),r===t)return n;r=this.collection().getKeyAfter(r)}return[]}getKey(e){const t=this.collection().getItem(e);return t?t&&"item"===t.type?t.key:null:e}toggleSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode()&&!this.isSelected(e))return void this.replaceSelection(e);const t=this.getKey(e);if(null==t)return;const n=new ive(this.state.selectedKeys());n.has(t)?n.delete(t):this.canSelectItem(t)&&(n.add(t),n.anchorKey=t,n.currentKey=t),this.disallowEmptySelection()&&0===n.size||this.state.setSelectedKeys(n)}replaceSelection(e){if("none"===this.selectionMode())return;const t=this.getKey(e);if(null==t)return;const n=this.canSelectItem(t)?new ive([t],t,t):new ive;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new ive;for(const n of e){const e=this.getKey(n);if(null!=e&&(t.add(e),"single"===this.selectionMode()))break}this.state.setSelectedKeys(t)}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 ive)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,t){"none"!==this.selectionMode()&&("single"===this.selectionMode()?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):"toggle"===this.selectionBehavior()||t&&"touch"===t.pointerType?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;const t=this.selectedKeys();if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;for(const n of t)if(!e.has(n))return!1;return!0}canSelectItem(e){if("none"===this.state.selectionMode())return!1;const t=this.collection().getItem(e);return null!=t&&!t.disabled}isDisabled(e){const t=this.collection().getItem(e);return!t||t.disabled}getAllSelectableKeys(){const e=[];return(t=>{for(;null!=t;){if(this.canSelectItem(t)){const n=this.collection().getItem(t);if(!n)continue;"item"===n.type&&e.push(t)}t=this.collection().getKeyAfter(t)}})(this.collection().getFirstKey()),e}},fve=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(const r of e)this.keyMap.set(r.key,r);if(0===this.keyMap.size)return;let t,n=0;for(const[r,o]of this.keyMap)t?(t.nextKey=r,o.prevKey=t.key):(this.firstKey=r,o.prevKey=void 0),"item"===o.type&&(o.index=n++),t=o,t.nextKey=void 0;this.lastKey=t.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 t=[...this.getKeys()];return this.getItem(t[e])}};var hve,mve=e=>"function"==typeof e?e():e,gve=e=>{const t=ut((()=>{const t=mve(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=at(mve(e.show)?"present":"hidden");let i="none";return ct((r=>{const a=mve(e.show);return pt((()=>{if(r===a)return a;const e=i,s=n();if(a)o("present");else if("none"===s||"none"===t()?.display)o("hidden");else{o(!0===r&&e!==s?"hiding":"hidden")}})),a})),ct((()=>{const t=mve(e.element);if(!t)return;const a=e=>{e.target===t&&(i=n())},s=e=>{const i=n().includes(e.animationName);e.target===t&&i&&"hiding"===r()&&o("hidden")};t.addEventListener("animationstart",a),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),mt((()=>{t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}))})),{present:()=>"present"===r()||"hiding"===r(),state:r}},vve="data-kb-top-layer",yve=!1,bve=[];function xve(e){return bve.findIndex((t=>t.node===e))}function wve(){return bve.filter((e=>e.isPointerBlocking))}function _ve(){return wve().length>0}function Sve(e){const t=xve([...wve()].slice(-1)[0]?.node);return xve(e)<t}var Eve={layers:bve,isTopMostLayer:function(e){return bve[bve.length-1].node===e},hasPointerBlockingLayer:_ve,isBelowPointerBlockingLayer:Sve,addLayer:function(e){bve.push(e)},removeLayer:function(e){const t=xve(e);t<0||bve.splice(t,1)},indexOf:xve,find:function(e){return bve[xve(e)]},assignPointerEventToLayers:function(){for(const{node:e}of bve)e.style.pointerEvents=Sve(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(_ve()&&!yve){const t=Xme(e);hve=document.body.style.pointerEvents,t.body.style.pointerEvents="none",yve=!0}},restoreBodyPointerEvents:function(e){if(_ve())return;const t=Xme(e);t.body.style.pointerEvents=hve,0===t.body.style.length&&t.body.removeAttribute("style"),yve=!1}};Uge({},{Button:()=>Ave,Root:()=>Cve});var Tve=["button","color","file","image","reset","submit"];function Cve(e){let t;const n=yge({type:"button"},e),[r,o]=Gt(n,["ref","type","disabled"]),i=Cge((()=>t),(()=>"button")),a=ut((()=>{const e=i();return null!=e&&function(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==Tve.indexOf(e.type)}({tagName:e,type:r.type})})),s=ut((()=>"input"===i())),l=ut((()=>"a"===i()&&null!=t?.getAttribute("href")));return $t(Nge,qt({as:"button",ref(e){const n=Rme((e=>t=e),r.ref);"function"==typeof n&&n(e)},get type(){return a()||s()?r.type:void 0},get role(){return a()||l()?void 0:"button"},get tabIndex(){return a()||l()||r.disabled?void 0:0},get disabled(){return a()||s()?r.disabled:void 0},get"aria-disabled"(){return!(a()||s()||!r.disabled)||void 0},get"data-disabled"(){return r.disabled?"":void 0}},o))}var Ave=Cve,Nve=["top","right","bottom","left"],Rve=Math.min,Ove=Math.max,Pve=Math.round,kve=Math.floor,Mve=e=>({x:e,y:e}),Lve={left:"right",right:"left",bottom:"top",top:"bottom"},Dve={start:"end",end:"start"};function jve(e,t,n){return Ove(e,Rve(t,n))}function Ive(e,t){return"function"==typeof e?e(t):e}function Fve(e){return e.split("-")[0]}function Uve(e){return e.split("-")[1]}function $ve(e){return"x"===e?"y":"x"}function Vve(e){return"y"===e?"height":"width"}function Bve(e){return["top","bottom"].includes(Fve(e))?"y":"x"}function zve(e){return $ve(Bve(e))}function Hve(e){return e.replace(/start|end/g,(e=>Dve[e]))}function qve(e){return e.replace(/left|right|bottom|top/g,(e=>Lve[e]))}function Gve(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 Kve(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Wve(e,t,n){let{reference:r,floating:o}=e;const i=Bve(t),a=zve(t),s=Vve(a),l=Fve(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[s]/2-o[s]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Uve(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function Yve(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Ive(t,e),h=Gve(f),m=s[p?"floating"===d?"reference":"floating":d],g=Kve(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Kve(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function Xve(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Qve(e){return Nve.some((t=>e[t]>=0))}function Zve(e){return tye(e)?(e.nodeName||"").toLowerCase():"#document"}function Jve(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function eye(e){var t;return null==(t=(tye(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function tye(e){return e instanceof Node||e instanceof Jve(e).Node}function nye(e){return e instanceof Element||e instanceof Jve(e).Element}function rye(e){return e instanceof HTMLElement||e instanceof Jve(e).HTMLElement}function oye(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Jve(e).ShadowRoot)}function iye(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=dye(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function aye(e){return["table","td","th"].includes(Zve(e))}function sye(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(J_e){return!1}}))}function lye(e){const t=cye(),n=nye(e)?dye(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!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 cye(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function uye(e){return["html","body","#document"].includes(Zve(e))}function dye(e){return Jve(e).getComputedStyle(e)}function pye(e){return nye(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fye(e){if("html"===Zve(e))return e;const t=e.assignedSlot||e.parentNode||oye(e)&&e.host||eye(e);return oye(t)?t.host:t}function hye(e){const t=fye(e);return uye(t)?e.ownerDocument?e.ownerDocument.body:e.body:rye(t)&&iye(t)?t:hye(t)}function mye(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=hye(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Jve(o);return i?t.concat(a,a.visualViewport||[],iye(o)?o:[],a.frameElement&&n?mye(a.frameElement):[]):t.concat(o,mye(o,[],n))}function gye(e){const t=dye(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rye(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Pve(n)!==i||Pve(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function vye(e){return nye(e)?e:e.contextElement}function yye(e){const t=vye(e);if(!rye(t))return Mve(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=gye(t);let a=(i?Pve(n.width):n.width)/r,s=(i?Pve(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var bye=Mve(0);function xye(e){const t=Jve(e);return cye()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:bye}function wye(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=vye(e);let a=Mve(1);t&&(r?nye(r)&&(a=yye(r)):a=yye(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Jve(e))&&t}(i,n,r)?xye(i):Mve(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=Jve(i),t=r&&nye(r)?Jve(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=yye(o),t=o.getBoundingClientRect(),r=dye(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=Jve(o),o=n.frameElement}}return Kve({width:u,height:d,x:l,y:c})}function _ye(e){return wye(eye(e)).left+pye(e).scrollLeft}function Sye(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Jve(e),r=eye(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=cye();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=eye(e),n=pye(e),r=e.ownerDocument.body,o=Ove(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ove(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+_ye(e);const s=-n.scrollTop;return"rtl"===dye(r).direction&&(a+=Ove(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(eye(e));else if(nye(t))r=function(e,t){const n=wye(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=rye(e)?yye(e):Mve(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=xye(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Kve(r)}function Eye(e,t){const n=fye(e);return!(n===t||!nye(n)||uye(n))&&("fixed"===dye(n).position||Eye(n,t))}function Tye(e,t,n){const r=rye(t),o=eye(t),i="fixed"===n,a=wye(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Mve(0);if(r||!r&&!i)if(("body"!==Zve(t)||iye(o))&&(s=pye(t)),r){const e=wye(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=_ye(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Cye(e){return"static"===dye(e).position}function Aye(e,t){return rye(e)&&"fixed"!==dye(e).position?t?t(e):e.offsetParent:null}function Nye(e,t){const n=Jve(e);if(sye(e))return n;if(!rye(e)){let t=fye(e);for(;t&&!uye(t);){if(nye(t)&&!Cye(t))return t;t=fye(t)}return n}let r=Aye(e,t);for(;r&&aye(r)&&Cye(r);)r=Aye(r,t);return r&&uye(r)&&Cye(r)&&!lye(r)?n:r||function(e){let t=fye(e);for(;rye(t)&&!uye(t);){if(lye(t))return t;if(sye(t))return null;t=fye(t)}return null}(e)||n}var Rye={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=eye(r),s=!!t&&sye(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Mve(1);const u=Mve(0),d=rye(r);if((d||!d&&!i)&&(("body"!==Zve(r)||iye(a))&&(l=pye(r)),rye(r))){const e=wye(r);c=yye(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:eye,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?sye(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=mye(e,[],!1).filter((e=>nye(e)&&"body"!==Zve(e))),o=null;const i="fixed"===dye(e).position;let a=i?fye(e):e;for(;nye(a)&&!uye(a);){const t=dye(a),n=lye(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||iye(a)&&!n&&Eye(e,a))?r=r.filter((e=>e!==a)):o=t,a=fye(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=Sye(t,n,o);return e.top=Ove(r.top,e.top),e.right=Rve(r.right,e.right),e.bottom=Rve(r.bottom,e.bottom),e.left=Ove(r.left,e.left),e}),Sye(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Nye,getElementRects:async function(e){const t=this.getOffsetParent||Nye,n=this.getDimensions,r=await n(e.floating);return{reference:Tye(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=gye(e);return{width:t,height:n}},getScale:yye,isElement:nye,isRTL:function(e){return"rtl"===dye(e).direction}};function Oye(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=vye(e),u=o||i?[...c?mye(c):[],...mye(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=eye(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(s||t(),!d||!p)return;const f={rootMargin:-kve(u)+"px "+-kve(o.clientWidth-(c+d))+"px "+-kve(o.clientHeight-(u+p))+"px "+-kve(c)+"px",threshold:Ove(0,Rve(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),1e3)}h=!1}try{r=new IntersectionObserver(m,{...f,root:o.ownerDocument})}catch(J_e){r=new IntersectionObserver(m,f)}r.observe(e)}(!0),i}(c,n):null;let p,f=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?wye(e):null;return l&&function t(){const r=wye(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}var Pye=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Fve(n),s=Uve(n),l="y"===Bve(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=Ive(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof h&&(f="end"===s?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},kye=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Ive(e,t),c={x:n,y:r},u=await Yve(t,l),d=Bve(Fve(o)),p=$ve(d);let f=c[p],h=c[d];if(i){f=jve(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=jve(h+u["y"===d?"top":"left"],h,h-u["y"===d?"bottom":"right"])}const m=s.fn({...t,[p]:f,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Mye=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=Ive(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Fve(o),y=Bve(s),b=Fve(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[qve(s)]:function(e){const t=qve(e);return[Hve(e),t,Hve(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=Uve(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(Fve(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Hve)))),i}(s,m,h,x));const S=[s,...w],E=await Yve(t,g),T=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&T.push(E[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Uve(e),o=zve(e),i=Vve(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=qve(a)),[a,qve(a)]}(o,a,x);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,N;const e=((null==(A=i.flip)?void 0:A.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(N=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(f){case"bestFit":{var R;const e=null==(R=C.filter((e=>{if(_){const t=Bve(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},Lye=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:a=()=>{},...s}=Ive(e,t),l=await Yve(t,s),c=Fve(n),u=Uve(n),d="y"===Bve(n),{width:p,height:f}=r.floating;let h,m;"top"===c||"bottom"===c?(h=c,m=u===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,h="end"===u?"top":"bottom");const g=f-l.top-l.bottom,v=p-l.left-l.right,y=Rve(f-l[h],g),b=Rve(p-l[m],v),x=!t.middlewareData.shift;let w=y,_=b;if(d?_=u||x?Rve(b,v):v:w=u||x?Rve(y,g):g,x&&!u){const e=Ove(l.left,0),t=Ove(l.right,0),n=Ove(l.top,0),r=Ove(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:Ove(l.left,l.right)):w=f-2*(0!==n||0!==r?n+r:Ove(l.top,l.bottom))}await a({...t,availableWidth:_,availableHeight:w});const S=await o.getDimensions(i.floating);return p!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},Dye=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ive(e,t);switch(r){case"referenceHidden":{const e=Xve(await Yve(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Qve(e)}}}case"escaped":{const e=Xve(await Yve(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Qve(e)}}}default:return{}}}}},jye=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Ive(e,t)||{};if(null==c)return{};const d=Gve(u),p={x:n,y:r},f=zve(o),h=Vve(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],w=p[f]-i.reference[f],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=_?_[b]:0;S&&await(null==a.isElement?void 0:a.isElement(_))||(S=s.floating[b]||i.floating[h]);const E=x/2-w/2,T=S/2-m[h]/2-1,C=Rve(d[v],T),A=Rve(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=jve(N,O,R),k=!l.arrow&&null!=Uve(o)&&O!==P&&i.reference[h]/2-(O<N?C:A)-m[h]/2<0,M=k?O<N?O-N:O-R:0;return{[f]:p[f]+M,data:{[f]:P,centerOffset:O-P-M,...k&&{alignmentOffset:M}},reset:k}}}),Iye=(e,t,n)=>{const r={platform:Rye,...n},o={...r.platform,_c:new Map};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Wve(c,r,l),p=r,f={},h=0;for(let m=0;m<s.length;m++){const{name:n,fn:i}=s[m],{x:g,y:v,data:y,reset:b}=await i({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,f={...f,[n]:{...f[n],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=Wve(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},Fye=xt();function Uye(){const e=wt(Fye);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var $ye=pn('<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">'),Vye={top:180,right:-90,bottom:0,left:90};function Bye(e){const t=Uye(),n=yge({size:30},e),[r,o]=Gt(n,["ref","style","size"]),i=()=>t.currentPlacement().split("-")[0],a=function(e){const[t,n]=at();return ct((()=>{const t=e();var r;t&&n((r=t,Xme(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return $t(Nge,qt({as:"div",ref(e){const n=Rme(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Hme({position:"absolute","font-size":`${r.size}px`,width:"1em",height:"1em","pointer-events":"none",fill:a()?.getPropertyValue("background-color")||"none",stroke:a()?.getPropertyValue(`border-${i()}-color`)||"none","stroke-width":s()},r.style)}},o,{get children(){const e=$ye(),t=e.firstChild;return lt((()=>hn(t,"transform",`rotate(${Vye[i()]} 15 15) translate(0 2)`))),e}}))}function zye(e){const{x:t=0,y:n=0,width:r=0,height:o=0}=e??{};if("function"==typeof DOMRect)return new DOMRect(t,n,r,o);const i={x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:n+o,left:t};return{...i,toJSON:()=>i}}function Hye(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var qye={top:"bottom",right:"left",bottom:"top",left:"right"};var Gye=Object.assign((function(e){const t=yge({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,r]=at(),[o,i]=at(),[a,s]=at(t.placement),l=()=>{return e=t.anchorRef?.(),n=t.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const t=n(e);return t?zye(t):e?e.getBoundingClientRect():zye()}};var e,n},{direction:c}=rve();async function u(){const e=l(),r=n(),i=o();if(!e||!r)return;const a=(i?.clientHeight||0)/2,u="number"==typeof t.gutter?t.gutter+a:t.gutter??a;r.style.setProperty("--kb-popper-content-overflow-padding",`${t.overflowPadding}px`),e.getBoundingClientRect();const d=[Pye((({placement:e})=>{const n=!!e.split("-")[1];return{mainAxis:u,crossAxis:n?void 0:t.shift,alignmentAxis:t.shift}}))];if(!1!==t.flip){const e="string"==typeof t.flip?t.flip.split(" "):void 0;if(void 0!==e&&!e.every(Hye))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(Mye({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(kye({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(Lye({padding:t.overflowPadding,apply({availableWidth:e,availableHeight:n,rects:o}){const i=Math.round(o.reference.width);e=Math.floor(e),n=Math.floor(n),r.style.setProperty("--kb-popper-anchor-width",`${i}px`),r.style.setProperty("--kb-popper-content-available-width",`${e}px`),r.style.setProperty("--kb-popper-content-available-height",`${n}px`),t.sameWidth&&(r.style.width=`${i}px`),t.fitViewport&&(r.style.maxWidth=`${e}px`,r.style.maxHeight=`${n}px`)}})),t.hideWhenDetached&&d.push(Dye({padding:t.detachedPadding})),i&&d.push(jye({element:i,padding:t.arrowPadding}));const p=await Iye(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...Rye,isRTL:()=>"rtl"===c()}});if(s(p.placement),t.onCurrentPlacementChange?.(p.placement),!r)return;r.style.setProperty("--kb-popper-content-transform-origin",function(e,t){const[n,r]=e.split("-"),o=qye[n];return r?"left"===n||"right"===n?`${o} ${"start"===r?"top":"bottom"}`:"start"===r?`${o} ${"rtl"===t?"right":"left"}`:`${o} ${"rtl"===t?"left":"right"}`:`${o} center`}(p.placement,c()));const f=Math.round(p.x),h=Math.round(p.y);let m;if(t.hideWhenDetached&&(m=p.middlewareData.hide?.referenceHidden?"hidden":"visible"),Object.assign(r.style,{top:"0",left:"0",transform:`translate3d(${f}px, ${h}px, 0)`,visibility:m}),i&&p.middlewareData.arrow){const{x:e,y:t}=p.middlewareData.arrow,n=p.placement.split("-")[0];Object.assign(i.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[n]:"100%"})}}return ct((()=>{const e=l(),t=n();if(!e||!t)return;mt(Oye(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),ct((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),$t(Fye.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:Bye,Context:Fye,usePopperContext:Uye,Positioner:function(e){const t=Uye(),[n,r]=Gt(e,["ref","style"]);return $t(Nge,qt({as:"div",ref(e){const r=Rme(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return Hme({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var Kye="interactOutside.pointerDownOutside",Wye="interactOutside.focusOutside";var Yye=xt();function Xye(e){let t;const n=wt(Yye),[r,o]=Gt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=vge;const o=()=>Xme(t()),i=t=>e.onPointerDownOutside?.(t),a=t=>e.onFocusOutside?.(t),s=t=>e.onInteractOutside?.(t),l=n=>{const r=n.target;return r instanceof HTMLElement&&!r.closest(`[${vve}]`)&&!!Wme(o(),r)&&!Wme(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=rge([i,s]);r.addEventListener(Kye,o,{once:!0});const a=new CustomEvent(Kye,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||oge(e)&&0===e.button}});r.dispatchEvent(a)}"touch"===e.pointerType?(o().removeEventListener("click",n),r=n,o().addEventListener("click",n,{once:!0})):n()},u=e=>{const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=rge([a,s]);r.addEventListener(Wye,o,{once:!0});const i=new CustomEvent(Wye,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};ct((()=>{jhe(e.isDisabled)||(n=window.setTimeout((()=>{o().addEventListener("pointerdown",c,!0)}),0),o().addEventListener("focusin",u,!0),mt((()=>{window.clearTimeout(n),o().removeEventListener("click",r),o().removeEventListener("pointerdown",c,!0),o().removeEventListener("focusin",u,!0)})))}))}({shouldExcludeElement:e=>!!t&&(r.excludedElements?.some((t=>Wme(t(),e)))||[...i].some((t=>Wme(t,e)))),onPointerDownOutside:e=>{t&&!Eve.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||Eve.isTopMostLayer(t))&&(r.onPointerDownOutside?.(e),r.onInteractOutside?.(e),e.defaultPrevented||r.onDismiss?.())},onFocusOutside:e=>{r.onFocusOutside?.(e),r.onInteractOutside?.(e),e.defaultPrevented||r.onDismiss?.()}},(()=>t)),function(e){const t=t=>{t.key===Zme.Escape&&e.onEscapeKeyDown?.(t)};ct((()=>{if(jhe(e.isDisabled))return;const n=e.ownerDocument?.()??Xme();n.addEventListener("keydown",t),mt((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Xme(t),onEscapeKeyDown:e=>{t&&Eve.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),ht((()=>{if(!t)return;Eve.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);Eve.assignPointerEventToLayers(),Eve.disableBodyPointerEvents(t),mt((()=>{t&&(Eve.removeLayer(t),e?.(),Eve.assignPointerEventToLayers(),Eve.restoreBodyPointerEvents(t))}))})),ct(ft([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=Eve.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,Eve.assignPointerEventToLayers()),t&&Eve.disableBodyPointerEvents(e),mt((()=>{Eve.restoreBodyPointerEvents(e)}))}),{defer:!0}));return $t(Yye.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return $t(Nge,qt({as:"div",ref(e){const n=Rme((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Qye(e={}){const[t,n]=Ige({value:()=>jhe(e.open),defaultValue:()=>!!jhe(e.defaultOpen),onChange:t=>e.onOpenChange?.(t)}),r=()=>{n(!0)},o=()=>{n(!1)};return{isOpen:t,setIsOpen:n,open:r,close:o,toggle:()=>{t()?o():r()}}}var Zye={};Uge(Zye,{Description:()=>kge,ErrorMessage:()=>Mge,Item:()=>rbe,ItemControl:()=>obe,ItemDescription:()=>ibe,ItemIndicator:()=>abe,ItemInput:()=>sbe,ItemLabel:()=>lbe,Label:()=>cbe,RadioGroup:()=>dbe,Root:()=>ube});var Jye=xt();function ebe(){const e=wt(Jye);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var tbe=xt();function nbe(){const e=wt(tbe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function rbe(e){const t=Pge(),n=ebe(),r=yge({id:`${t.generateId("item")}-${Yt()}`},e),[o,i]=Gt(r,["value","disabled","onPointerDown"]),[a,s]=at(),[l,c]=at(),[u,d]=at(),[p,f]=at(),[h,m]=at(!1),g=ut((()=>n.isSelectedValue(o.value))),v=ut((()=>o.disabled||t.isDisabled()||!1)),y=e=>{nge(e,o.onPointerDown),h()&&e.preventDefault()},b=ut((()=>({...t.dataset(),"data-disabled":v()?"":void 0,"data-checked":g()?"":void 0}))),x={value:()=>o.value,dataset:b,isSelected:g,isDisabled:v,inputId:a,labelId:l,descriptionId:u,inputRef:p,select:()=>n.setSelectedValue(o.value),generateId:Kme((()=>i.id)),registerInput:Tge(s),registerLabel:Tge(c),registerDescription:Tge(d),setIsFocused:m,setInputRef:f};return $t(tbe.Provider,{value:x,get children(){return $t(Nge,qt({as:"div",role:"group",onPointerDown:y},b,i))}})}function obe(e){const t=nbe(),n=yge({id:t.generateId("control")},e),[r,o]=Gt(n,["onClick","onKeyDown"]);return $t(Nge,qt({as:"div",onClick:e=>{nge(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{nge(e,r.onKeyDown),e.key===Zme.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function ibe(e){const t=nbe(),n=yge({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Nge,qt({as:"div"},(()=>t.dataset()),n))}function abe(e){const t=nbe(),n=yge({id:t.generateId("indicator")},e),[r,o]=Gt(n,["ref","forceMount"]),[i,a]=at(),{present:s}=gve({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return $t(Jt,{get when(){return s()},get children(){return $t(Nge,qt({as:"div",ref(e){const t=Rme(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function sbe(e){const t=Pge(),n=ebe(),r=nbe(),o=yge({id:r.generateId("input")},e),[i,a]=Gt(o,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=at(!1);return ct(ft([()=>r.isSelected(),()=>r.value()],(e=>{if(!e[0]&&e[1]===r.value())return;l(!0);const t=r.inputRef();t?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),{defer:!0})),ct((()=>mt(r.registerInput(a.id)))),$t(Nge,qt({as:"input",ref(e){const t=Rme(r.setInputRef,i.ref);"function"==typeof t&&t(e)},type:"radio",get name(){return t.name()},get value(){return r.value()},get checked(){return r.isSelected()},get required(){return t.isRequired()},get disabled(){return r.isDisabled()},get readonly(){return t.isReadOnly()},get style(){return Hme({...Ege},i.style)},get"aria-labelledby"(){return[i["aria-labelledby"],r.labelId(),null!=i["aria-labelledby"]&&null!=a["aria-label"]?a.id:void 0].filter(Boolean).join(" ")||void 0},get"aria-describedby"(){return[i["aria-describedby"],r.descriptionId(),n.ariaDescribedBy()].filter(Boolean).join(" ")||void 0},onChange:e=>{if(nge(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{nge(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{nge(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function lbe(e){const t=nbe(),n=yge({id:t.generateId("label")},e);return ct((()=>mt(t.registerLabel(n.id)))),$t(Nge,qt({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function cbe(e){return $t(Lge,qt({as:"span"},e))}function ube(e){let t;const n=yge({id:`radiogroup-${Yt()}`,orientation:"vertical"},e),[r,o,i]=Gt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],Rge),[a,s]=jge({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=yge({id:`form-control-${Yt()}`},e),[n,r]=at(),[o,i]=at(),[a,s]=at(),[l,c]=at();return{formControlContext:{name:()=>jhe(t.name)??jhe(t.id),dataset:ut((()=>({"data-valid":"valid"===jhe(t.validationState)?"":void 0,"data-invalid":"invalid"===jhe(t.validationState)?"":void 0,"data-required":jhe(t.required)?"":void 0,"data-disabled":jhe(t.disabled)?"":void 0,"data-readonly":jhe(t.readOnly)?"":void 0}))),validationState:()=>jhe(t.validationState),isRequired:()=>jhe(t.required),isDisabled:()=>jhe(t.disabled),isReadOnly:()=>jhe(t.readOnly),labelId:n,fieldId:o,descriptionId:a,errorMessageId:l,getAriaLabelledBy:(e,t,r)=>{const o=null!=r||null!=n();return[r,n(),o&&null!=t?e:void 0].filter(Boolean).join(" ")||void 0},getAriaDescribedBy:e=>[a(),l(),e].filter(Boolean).join(" ")||void 0,generateId:Kme((()=>jhe(t.id))),registerLabel:Tge(r),registerField:Tge(i),registerDescription:Tge(s),registerErrorMessage:Tge(c)}}}(o);Dge((()=>t),(()=>s(r.defaultValue??"")));const c=()=>l.getAriaDescribedBy(r["aria-describedby"]),u=e=>e===a(),d={ariaDescribedBy:c,isSelectedValue:u,setSelectedValue:e=>{if(!l.isReadOnly()&&!l.isDisabled()&&(s(e),t))for(const n of t.querySelectorAll("[type='radio']")){n.checked=u(n.value)}}};return $t(Oge.Provider,{value:l,get children(){return $t(Jye.Provider,{value:d,get children(){return $t(Nge,qt({as:"div",ref(e){const n=Rme((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return jhe(o.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 r.orientation},get"aria-labelledby"(){return l.getAriaLabelledBy(jhe(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var dbe=Object.assign(ube,{Description:kge,ErrorMessage:Mge,Item:rbe,ItemControl:obe,ItemDescription:ibe,ItemIndicator:abe,ItemInput:sbe,ItemLabel:lbe,Label:cbe}),pbe=class{collection;ref;collator;constructor(e,t,n){this.collection=e,this.ref=t,this.collator=n}getKeyBelow(e){let t=this.collection().getKeyAfter(e);for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&!e.disabled)return t;t=this.collection().getKeyAfter(t)}}getKeyAbove(e){let t=this.collection().getKeyBefore(e);for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&!e.disabled)return t;t=this.collection().getKeyBefore(t)}}getFirstKey(){let e=this.collection().getFirstKey();for(;null!=e;){const t=this.collection().getItem(e);if(t&&"item"===t.type&&!t.disabled)return e;e=this.collection().getKeyAfter(e)}}getLastKey(){let e=this.collection().getLastKey();for(;null!=e;){const t=this.collection().getItem(e);if(t&&"item"===t.type&&!t.disabled)return e;e=this.collection().getKeyBefore(e)}}getItem(e){return this.ref?.()?.querySelector(`[data-key="${e}"]`)??null}getKeyPageAbove(e){const t=this.ref?.();let n=this.getItem(e);if(!t||!n)return;const r=Math.max(0,n.offsetTop+n.offsetHeight-t.offsetHeight);let o=e;for(;o&&n&&n.offsetTop>r;)o=this.getKeyAbove(o),n=null!=o?this.getItem(o):null;return o}getKeyPageBelow(e){const t=this.ref?.();let n=this.getItem(e);if(!t||!n)return;const r=Math.min(t.scrollHeight,n.offsetTop-n.offsetHeight+t.offsetHeight);let o=e;for(;o&&n&&n.offsetTop<r;)o=this.getKeyBelow(o),n=null!=o?this.getItem(o):null;return o}getKeyForSearch(e,t){const n=this.collator?.();if(!n)return;let r=null!=t?this.getKeyBelow(t):this.getFirstKey();for(;null!=r;){const t=this.collection().getItem(r);if(t){const o=t.textValue.slice(0,e.length);if(t.textValue&&0===n.compare(o,e))return r}r=this.getKeyBelow(r)}}};function fbe(e,t,n){const r=function(e){const{locale:t}=rve(),n=ut((()=>t()+(e?Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1)).join():"")));return ut((()=>{const r=n();let o;return ove.has(r)&&(o=ove.get(r)),o||(o=new Intl.Collator(t(),e),ove.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return uve({selectionManager:()=>jhe(e.selectionManager),keyboardDelegate:ut((()=>{const n=jhe(e.keyboardDelegate);return n||new pbe(e.collection,t,r)})),autoFocus:()=>jhe(e.autoFocus),deferAutoFocus:()=>jhe(e.deferAutoFocus),shouldFocusWrap:()=>jhe(e.shouldFocusWrap),disallowEmptySelection:()=>jhe(e.disallowEmptySelection),selectOnFocus:()=>jhe(e.selectOnFocus),disallowTypeAhead:()=>jhe(e.disallowTypeAhead),shouldUseVirtualFocus:()=>jhe(e.shouldUseVirtualFocus),allowsTabNavigation:()=>jhe(e.allowsTabNavigation),isVirtualized:()=>jhe(e.isVirtualized),scrollToKey:t=>jhe(e.scrollToKey)?.(t),orientation:()=>jhe(e.orientation)},t)}var hbe="focusScope.autoFocusOnMount",mbe="focusScope.autoFocusOnUnmount",gbe={bubbles:!1,cancelable:!0},vbe={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=qme(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=qme(this.stack,e),this.active()?.resume()}};function ybe(e,t){const[n,r]=at(!1),o={pause(){r(!0)},resume(){r(!1)}};let i=null;const a=t=>e.onMountAutoFocus?.(t),s=t=>e.onUnmountAutoFocus?.(t),l=()=>Xme(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,Ege),e},u=()=>{const e=t();return e?dge(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=u();return e.length>0?e[0]:null};ct((()=>{const e=t();if(!e)return;vbe.add(o);const n=Yme(e);if(!Wme(e,n)){const t=new CustomEvent(hbe,gbe);e.addEventListener(hbe,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{ige(d()),Yme(e)===n&&ige(e)}),0)}mt((()=>{e.removeEventListener(hbe,a),setTimeout((()=>{const r=new CustomEvent(mbe,gbe);(()=>{const e=t();if(!e)return!1;const n=Yme(e);return!!n&&!Wme(e,n)&&fge(n)})()&&r.preventDefault(),e.addEventListener(mbe,s),e.dispatchEvent(r),r.defaultPrevented||ige(n??l().body),e.removeEventListener(mbe,s),vbe.remove(o)}),0)}))})),ct((()=>{const r=t();if(!r||!jhe(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${vve}]`)||(Wme(r,t)?i=t:ige(i))},a=e=>{const t=e.relatedTarget??Yme(r);t?.closest(`[${vve}]`)||Wme(r,t)||ige(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),mt((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),ct((()=>{const r=t();if(!r||!jhe(e.trapFocus)||n())return;const o=c();r.insertAdjacentElement("afterbegin",o);const i=c();function a(e){const t=d(),n=(()=>{const e=u();return e.length>0?e[e.length-1]:null})();ige(e.relatedTarget===t?n:t)}r.insertAdjacentElement("beforeend",i),o.addEventListener("focusin",a),i.addEventListener("focusin",a);const s=new MutationObserver((e=>{for(const t of e)t.previousSibling===i&&(i.remove(),r.insertAdjacentElement("beforeend",i)),t.nextSibling===o&&(o.remove(),r.insertAdjacentElement("afterbegin",o))}));s.observe(r,{childList:!0,subtree:!1}),mt((()=>{o.removeEventListener("focusin",a),i.removeEventListener("focusin",a),o.remove(),i.remove(),s.disconnect()}))}))}var bbe="data-live-announcer";function xbe(e){ct((()=>{jhe(e.isDisabled)||mt(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${bbe}], [${vve}]`))n.add(r);const t=e=>{if(n.has(e)||e.parentElement&&r.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(const t of n)if(e.contains(t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),a=t(e);if(a===NodeFilter.FILTER_ACCEPT&&i(e),a!==NodeFilter.FILTER_REJECT){let e=o.nextNode();for(;null!=e;)i(e),e=o.nextNode()}},i=e=>{const t=wbe.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),wbe.set(e,t+1))};_be.length&&_be[_be.length-1].disconnect();o(t);const a=new MutationObserver((e=>{for(const t of e)if("childList"===t.type&&0!==t.addedNodes.length&&![...n,...r].some((e=>e.contains(t.target)))){for(const e of t.removedNodes)e instanceof Element&&(n.delete(e),r.delete(e));for(const e of t.addedNodes)!(e instanceof HTMLElement||e instanceof SVGElement)||"true"!==e.dataset.liveAnnouncer&&"true"!==e.dataset.reactAriaTopLayer?e instanceof Element&&o(e):n.add(e)}}));a.observe(t,{childList:!0,subtree:!0});const s={observe(){a.observe(t,{childList:!0,subtree:!0})},disconnect(){a.disconnect()}};return _be.push(s),()=>{a.disconnect();for(const e of r){const t=wbe.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),wbe.delete(e)):wbe.set(e,t-1)}s===_be[_be.length-1]?(_be.pop(),_be.length&&_be[_be.length-1].observe()):_be.splice(_be.indexOf(s),1)}}(jhe(e.targets),jhe(e.root)))}))}var wbe=new WeakMap,_be=[];var Sbe=new Map,Ebe=e=>{ct((()=>{const t=mve(e.style)??{},n=mve(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=Sbe.get(e.key);o?o.activeCount++:Sbe.set(e.key,{activeCount:1,originalStyles:r,properties:n.map((e=>e.key))}),Object.assign(e.element.style,e.style);for(const i of n)e.element.style.setProperty(i.key,i.value);mt((()=>{const t=Sbe.get(e.key);if(t)if(1===t.activeCount){Sbe.delete(e.key);for(const[n,r]of Object.entries(t.originalStyles))e.element.style[n]=r;for(const n of t.properties)e.element.style.removeProperty(n);0===e.element.style.length&&e.element.removeAttribute("style"),e.cleanup?.()}else t.activeCount--}))}))},Tbe=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},Cbe=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[Abe,Nbe]=at([]),Rbe=e=>[e.deltaX,e.deltaY],Obe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],Pbe=(e,t,n,r)=>{const o=null!==r&&kbe(r,e),[i,a]=((e,t,n)=>{const r="x"===t&&"rtl"===window.getComputedStyle(e).direction?-1:1;let o=e,i=0,a=0,s=!1;do{const[e,l,c]=Tbe(o,t),u=c-e-r*l;0===l&&0===u||!Cbe(o,t)||(i+=u,a+=l),o===(n??document.documentElement)?s=!0:o=o._$host??o.parentElement}while(o&&!s);return[i,a]})(e,t,o?r:void 0);return!(n>0&&Math.abs(i)<=1)&&!(n<0&&Math.abs(a)<1)},kbe=(e,t)=>{if(e.contains(t))return!0;let n=t;for(;n;){if(n===e)return!0;n=n._$host??n.parentElement}return!1},Mbe=e=>{const t=qt({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=Yt();let r=[0,0],o=null,i=null;ct((()=>{mve(t.enabled)&&(Nbe((e=>[...e,n])),mt((()=>{Nbe((e=>e.filter((e=>e!==n))))})))})),ct((()=>{if(!mve(t.enabled)||!mve(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(mve(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===mve(t.preventScrollbarShiftMode)?r.paddingRight=`calc(${window.getComputedStyle(e).paddingRight} + ${n}px)`:r.marginRight=`calc(${window.getComputedStyle(e).marginRight} + ${n}px)`,o.push({key:"--scrollbar-width",value:`${n}px`}));const i=window.scrollY,a=window.scrollX;Ebe({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{mve(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else Ebe({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),ct((()=>{var e;(e=n,Abe().indexOf(e)===Abe().length-1&&mve(t.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",a,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),mt((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",a),document.removeEventListener("touchmove",l)})))}));const a=e=>{r=Obe(e),o=null,i=null},s=e=>{const n=e.target,r=mve(t.element),o=Rbe(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=Pbe(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!kbe(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=mve(t.element),a=e.target;let s;if(2===e.touches.length)s=!mve(t.allowPinchZoom);else{if(null==o||null===i){const t=Obe(e).map(((e,t)=>r[t]-e)),n=Math.abs(t[0])>Math.abs(t[1])?"x":"y";o=n,i="x"===n?t[0]:t[1]}if("range"===a.type)s=!1;else{const e=Pbe(a,o,i,n);s=!n||!kbe(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},Lbe=xt();function Dbe(){return wt(Lbe)}function jbe(){const e=Dbe();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var Ibe=xt();function Fbe(){const e=wt(Ibe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var Ube=xt();function $be(){const e=wt(Ube);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function Vbe(e){let t;const n=$be(),r=jbe(),o=yge({id:n.generateId(`item-${Yt()}`)},e),[i,a]=Gt(o,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=at(),[c,u]=at(),[d,p]=at(),f=()=>r.listState().selectionManager(),h=()=>a.id,m=()=>{i.onSelect?.(),i.closeOnSelect&&setTimeout((()=>{r.close(!0)}))};Gge({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=dve({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{nge(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(ige(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{nge(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{nge(e,i.onPointerUp),i.disabled||0!==e.button||m()},x=e=>{if(nge(e,i.onKeyDown),!e.repeat&&!i.disabled)switch(e.key){case"Enter":case" ":m()}},w=ut((()=>i.indeterminate?"mixed":null!=i.checked?i.checked:void 0)),_=ut((()=>({"data-indeterminate":i.indeterminate?"":void 0,"data-checked":i.checked&&!i.indeterminate?"":void 0,"data-disabled":i.disabled?"":void 0,"data-highlighted":f().focusedKey()===h()?"":void 0}))),S={isChecked:()=>i.checked,dataset:_,setLabelRef:p,generateId:Kme((()=>a.id)),registerLabel:Tge(l),registerDescription:Tge(u)};return $t(Ibe.Provider,{value:S,get children(){return $t(Nge,qt({as:"div",ref(e){const n=Rme((e=>t=e),i.ref);"function"==typeof n&&n(e)},get tabIndex(){return g.tabIndex()},get"aria-checked"(){return w()},get"aria-disabled"(){return i.disabled},get"aria-labelledby"(){return s()},get"aria-describedby"(){return c()},get"data-key"(){return g.dataKey()},get onPointerDown(){return rge([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return rge([b,g.onPointerUp])},get onClick(){return rge([i.onClick,g.onClick])},get onKeyDown(){return rge([x,g.onKeyDown])},get onMouseDown(){return rge([i.onMouseDown,g.onMouseDown])},get onFocus(){return rge([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function Bbe(e){const t=yge({closeOnSelect:!1},e),[n,r]=Gt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=Ige({value:()=>jhe(e.isSelected),defaultValue:()=>!!jhe(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{jhe(e.isReadOnly)||jhe(e.isDisabled)||n(t)},toggle:()=>{jhe(e.isReadOnly)||jhe(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return $t(Vbe,qt({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var zbe=xt();function Hbe(){return wt(zbe)}var qbe={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>qbe.next("ltr"===e?"rtl":"ltr",t)},Gbe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",Kbe=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function Wbe(e){const t=$be(),n=jbe(),r=Hbe(),{direction:o}=rve(),i=yge({id:t.generateId("trigger")},e),[a,s]=Gt(i,["ref","id","disabled","onPointerDown","onClick","onKeyDown","onMouseOver","onFocus"]);let l=()=>t.value();void 0!==r&&(l=()=>t.value()??a.id,void 0===r.lastValue()&&r.setLastValue(l));const c=Cge((()=>n.triggerRef()),(()=>"button")),u=ut((()=>"a"===c()&&null!=n.triggerRef()?.getAttribute("href")));ct(ft((()=>r?.value()),(e=>{u()&&e===l()&&n.triggerRef()?.focus()})));const d=()=>{void 0!==r?n.isOpen()?r.value()===l()&&r.closeMenu():(r.autoFocusMenu()||r.setAutoFocusMenu(!0),n.open(!1)):n.toggle(!0)};return ct((()=>mt(n.registerTriggerId(a.id)))),$t(Cve,qt({ref(e){const t=Rme(n.setTriggerRef,a.ref);"function"==typeof t&&t(e)},get"data-kb-menu-value-trigger"(){return t.value()},get id(){return a.id},get disabled(){return a.disabled},"aria-haspopup":"true",get"aria-expanded"(){return n.isOpen()},get"aria-controls"(){return ut((()=>!!n.isOpen()))()?n.contentId():void 0},get"data-highlighted"(){return void 0!==l()&&r?.value()===l()||void 0},get tabIndex(){return void 0!==r?r.value()===l()||r.lastValue()===l()?0:-1:void 0},onPointerDown:e=>{nge(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{nge(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{nge(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if(nge(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case Gbe(t.orientation()):e.stopPropagation(),e.preventDefault(),function(e){if(document.contains(e)){const t=document.scrollingElement||document.documentElement;if("hidden"===window.getComputedStyle(t).overflow){let n=mge(e);for(;e&&n&&e!==t&&n!==t;)_ge(n,e),n=mge(e=n)}else{const{left:t,top:n}=e.getBoundingClientRect();e?.scrollIntoView?.({block:"nearest"});const{left:r,top:o}=e.getBoundingClientRect();(Math.abs(t-r)>1||Math.abs(n-o)>1)&&e.scrollIntoView?.({block:"nearest"})}}}(e.currentTarget),n.open("first"),r?.setAutoFocusMenu(!0),r?.setValue(l);break;case Kbe(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case qbe.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case qbe.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{nge(e,a.onFocus),void 0!==r&&"touch"!==e.currentTarget.dataset.pointerType&&r.setValue(l)},role:void 0!==r?"menuitem":void 0},(()=>n.dataset()),s))}var Ybe=xt();function Xbe(){return wt(Ybe)}function Qbe(e){let t;const n=$be(),r=jbe(),o=Hbe(),i=Xbe(),{direction:a}=rve(),s=yge({id:n.generateId(`content-${Yt()}`)},e),[l,c]=Gt(s,["ref","id","style","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onPointerEnter","onPointerMove","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]);let u=0;const d=()=>null==r.parentMenuContext()&&void 0===o&&n.isModal(),p=fbe({selectionManager:r.listState().selectionManager,collection:r.listState().collection,autoFocus:r.autoFocus,deferAutoFocus:!0,shouldFocusWrap:!0,disallowTypeAhead:()=>!r.listState().selectionManager().isFocused(),orientation:()=>"horizontal"===n.orientation()?"vertical":"horizontal"},(()=>t));ybe({trapFocus:()=>d()&&r.isOpen(),onMountAutoFocus:e=>{void 0===o&&l.onOpenAutoFocus?.(e)},onUnmountAutoFocus:l.onCloseAutoFocus},(()=>t));const f=e=>{l.onEscapeKeyDown?.(e),o?.setAutoFocusMenu(!1),r.close(!0)},h=e=>{l.onFocusOutside?.(e),n.isModal()&&e.preventDefault()};ct((()=>mt(r.registerContentId(l.id))));const m={ref:Rme((e=>{r.setContentRef(e),t=e}),l.ref),role:"menu",get id(){return l.id},get tabIndex(){return p.tabIndex()},get"aria-labelledby"(){return r.triggerId()},onKeyDown:rge([l.onKeyDown,p.onKeyDown,e=>{if(Wme(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case qbe.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case qbe.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:rge([l.onMouseDown,p.onMouseDown]),onFocusIn:rge([l.onFocusIn,p.onFocusIn]),onFocusOut:rge([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{nge(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if(nge(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;Wme(e.currentTarget,e.target)&&t&&(r.setPointerDir(e.clientX>u?"right":"left"),u=e.clientX)},get"data-orientation"(){return n.orientation()}};return $t(Jt,{get when(){return r.contentPresent()},get children(){return $t(Jt,{get when(){return void 0===i||null!=r.parentMenuContext()},get fallback(){return $t(Nge,qt({as:"div"},(()=>r.dataset()),m,c))},get children(){return $t(Gye.Positioner,{get children(){return $t(Xye,qt({get disableOutsidePointerEvents(){return ut((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Hme({"--kb-menu-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onEscapeKeyDown:f,onFocusOutside:h,get onDismiss(){return r.close}},(()=>r.dataset()),m,c))}})}})}})}function Zbe(e){let t;const n=$be(),r=jbe(),[o,i]=Gt(e,["ref"]);return Mbe({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),$t(Qbe,qt({ref(e){const n=Rme((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var Jbe=xt();function exe(e){const t=yge({id:$be().generateId(`group-${Yt()}`)},e),[n,r]=at(),o={generateId:Kme((()=>t.id)),registerLabelId:Tge(r)};return $t(Jbe.Provider,{value:o,get children(){return $t(Nge,qt({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function txe(e){const t=function(){const e=wt(Jbe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=yge({id:t.generateId("label")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerLabelId(r.id)))),$t(Nge,qt({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function nxe(e){const t=jbe();return $t(Nge,qt({as:"span","aria-hidden":"true"},(()=>t.dataset()),yge({children:"▼"},e)))}function rxe(e){return $t(Vbe,qt({role:"menuitem",closeOnSelect:!0},e))}function oxe(e){const t=Fbe(),n=yge({id:t.generateId("description")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerDescription(r.id)))),$t(Nge,qt({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function ixe(e){const t=Fbe(),n=yge({id:t.generateId("indicator")},e),[r,o]=Gt(n,["forceMount"]);return $t(Jt,{get when(){return r.forceMount||t.isChecked()},get children(){return $t(Nge,qt({as:"div"},(()=>t.dataset()),o))}})}function axe(e){const t=Fbe(),n=yge({id:t.generateId("label")},e),[r,o]=Gt(n,["ref","id"]);return ct((()=>mt(t.registerLabel(r.id)))),$t(Nge,qt({as:"div",ref(e){const n=Rme(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function sxe(e){const t=jbe();return $t(Jt,{get when(){return t.contentPresent()},get children(){return $t(On,e)}})}var lxe=xt();function cxe(e){const t=yge({id:$be().generateId(`radiogroup-${Yt()}`)},e),[n,r]=Gt(t,["value","defaultValue","onChange","disabled"]),[o,i]=jge({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return $t(lxe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return $t(exe,r)}})}function uxe(e){const t=function(){const e=wt(lxe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=yge({closeOnSelect:!1},e),[r,o]=Gt(n,["value","onSelect"]);return $t(Vbe,qt({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function dxe(e,t,n){const r=e.split("-")[0],o=n.getBoundingClientRect(),i=[],a=t.clientX,s=t.clientY;switch(r){case"top":i.push([a,s+5]),i.push([o.left,o.bottom]),i.push([o.left,o.top]),i.push([o.right,o.top]),i.push([o.right,o.bottom]);break;case"right":i.push([a-5,s]),i.push([o.left,o.top]),i.push([o.right,o.top]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]);break;case"bottom":i.push([a,s-5]),i.push([o.right,o.top]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]),i.push([o.left,o.top]);break;case"left":i.push([a+5,s]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]),i.push([o.left,o.top]),i.push([o.right,o.top])}return i}function pxe(e){const t=$be(),n=Vge(),r=Dbe(),o=Hbe(),i=Xbe(),a=yge({placement:"horizontal"===t.orientation()?"bottom-start":"right-start"},e),[s,l]=Gt(a,["open","defaultOpen","onOpenChange"]);let c=0,u=null,d="right";const[p,f]=at(),[h,m]=at(),[g,v]=at(),[y,b]=at(),[x,w]=at(!0),[_,S]=at(l.placement),[E,T]=at([]),[C,A]=at([]),{DomCollectionProvider:N}=qge({items:C,onItemsChange:A}),R=Qye({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:O}=gve({show:()=>t.forceMount()||R.isOpen(),element:()=>y()??null}),P=function(e){const t=cve(e),n=Wge({dataSource:()=>jhe(e.dataSource),getKey:()=>jhe(e.getKey),getTextValue:()=>jhe(e.getTextValue),getDisabled:()=>jhe(e.getDisabled),getSectionChildren:()=>jhe(e.getSectionChildren),factory:t=>new fve(e.filter?e.filter(t):t)},[()=>e.filter]),r=new pve(n,t);return st((()=>{const e=t.focusedKey();null==e||n().getItem(e)||t.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>r}}({selectionMode:"none",dataSource:C}),k=e=>{w(e),R.open()},M=(e=!1)=>{R.close(),e&&r&&r.close(!0)},L=()=>{const e=y();e&&(ige(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},D=()=>{null!=i?setTimeout((()=>L())):L()},j=e=>{return d===u?.side&&(t=e,n=u?.area,!!n&&function(e,t){const[n,r]=e;let o=!1;for(let i=t.length,a=0,s=i-1;a<i;s=a++){const[e,l]=t[a],[c,u]=t[s],[,d]=t[0===s?i-1:s-1]||[0,0],p=(l-u)*(n-e)-(e-c)*(r-l);if(u<l){if(r>=u&&r<l){if(0===p)return!0;p>0&&(r===u?r>d&&(o=!o):o=!o)}}else if(l<u){if(r>l&&r<=u){if(0===p)return!0;p<0&&(r===u?r<d&&(o=!o):o=!o)}}else if(r==l&&(n>=c&&n<=e||n>=e&&n<=c))return!0}return o}([t.clientX,t.clientY],n));var t,n};xbe({isDisabled:()=>!(null==r&&R.isOpen()&&t.isModal()),targets:()=>[y(),...E()].filter(Boolean)}),ct((()=>{const e=y();if(!e||!r)return;const t=r.registerNestedMenu(e);mt((()=>{t()}))})),ct((()=>{void 0===r&&o?.registerMenu(t.value(),[y(),...E()])})),ct((()=>{void 0===r&&void 0!==o&&(o.value()===t.value()?(g()?.focus(),o.autoFocusMenu()&&k(!0)):M())})),ct((()=>{void 0===r&&void 0!==o&&R.isOpen()&&o.setValue(t.value())})),mt((()=>{void 0===r&&o?.unregisterMenu(t.value())}));const I={dataset:ut((()=>({"data-expanded":R.isOpen()?"":void 0,"data-closed":R.isOpen()?void 0:""}))),isOpen:R.isOpen,contentPresent:O,nestedMenus:E,currentPlacement:_,pointerGraceTimeoutId:()=>c,autoFocus:x,listState:()=>P,parentMenuContext:()=>r,triggerRef:g,contentRef:y,triggerId:p,contentId:h,setTriggerRef:v,setContentRef:b,open:k,close:M,toggle:e=>{w(e),R.toggle()},focusContent:D,onItemEnter:e=>{j(e)&&e.preventDefault()},onItemLeave:e=>{j(e)||D()},onTriggerLeave:e=>{j(e)&&e.preventDefault()},setPointerDir:e=>d=e,setPointerGraceTimeoutId:e=>c=e,setPointerGraceIntent:e=>u=e,registerNestedMenu:e=>{T((t=>[...t,e]));const t=r?.registerNestedMenu(e);return()=>{T((t=>qme(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:Tge(f),registerContentId:Tge(m)};return $t(N,{get children(){return $t(Lbe.Provider,{value:I,get children(){return $t(Jt,{when:void 0===i,get fallback(){return l.children},get children(){return $t(Gye,qt({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function fxe(e){const{direction:t}=rve();return $t(pxe,qt({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var hxe=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function mxe(e){const t=jbe(),n=$be(),[r,o]=Gt(e,["onFocusOutside","onKeyDown"]),{direction:i}=rve();return $t(Qbe,qt({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;Wme(t.triggerRef(),n)||t.close()},onKeyDown:e=>{nge(e,r.onKeyDown);const o=Wme(e.currentTarget,e.target),a=hxe(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),ige(t.triggerRef()))}},o))}var gxe=["Enter"," "],vxe=(e,t)=>"ltr"===e?[...gxe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...gxe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function yxe(e){let t;const n=$be(),r=jbe(),o=yge({id:n.generateId(`sub-trigger-${Yt()}`)},e),[i,a]=Gt(o,["ref","id","textValue","disabled","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);let s=null;const l=()=>{s&&window.clearTimeout(s),s=null},{direction:c}=rve(),u=()=>i.id,d=()=>{const e=r.parentMenuContext();if(null==e)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");return e.listState().selectionManager()},p=dve({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{nge(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{nge(e,i.onKeyDown),e.repeat||i.disabled||vxe(c(),n.orientation()).includes(e.key)&&(e.stopPropagation(),e.preventDefault(),d().setFocused(!1),d().setFocusedKey(void 0),r.isOpen()||r.open("first"),r.focusContent(),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(r.listState().collection().getFirstKey()))};return ct((()=>{if(null==r.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");mt(r.registerItemToParentDomCollection({ref:()=>t,type:"item",key:u(),textValue:i.textValue??t?.textContent??"",disabled:i.disabled??!1}))})),ct(ft((()=>r.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{mt((()=>{window.clearTimeout(e),r.parentMenuContext()?.setPointerGraceIntent(null)}))}))),ct((()=>mt(r.registerTriggerId(i.id)))),mt((()=>{l()})),$t(Nge,qt({as:"div",ref(e){const n=Rme((e=>{r.setTriggerRef(e),t=e}),i.ref);"function"==typeof n&&n(e)},get id(){return i.id},role:"menuitem",get tabIndex(){return p.tabIndex()},"aria-haspopup":"true",get"aria-expanded"(){return r.isOpen()},get"aria-controls"(){return ut((()=>!!r.isOpen()))()?r.contentId():void 0},get"aria-disabled"(){return i.disabled},get"data-key"(){return p.dataKey()},get"data-highlighted"(){return d().focusedKey()===u()?"":void 0},get"data-disabled"(){return i.disabled?"":void 0},get onPointerDown(){return rge([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return rge([i.onPointerUp,p.onPointerUp])},get onClick(){return rge([f,p.onClick])},get onKeyDown(){return rge([h,p.onKeyDown])},get onMouseDown(){return rge([i.onMouseDown,p.onMouseDown])},get onFocus(){return rge([i.onFocus,p.onFocus])},onPointerMove:e=>{if(nge(e,i.onPointerMove),"mouse"!==e.pointerType)return;const t=r.parentMenuContext();t?.onItemEnter(e),e.defaultPrevented||(i.disabled?t?.onItemLeave(e):(r.isOpen()||s||(r.parentMenuContext()?.setPointerGraceIntent(null),s=window.setTimeout((()=>{r.open(!1),l()}),100)),t?.onItemEnter(e),e.defaultPrevented||(r.listState().selectionManager().isFocused()&&(r.listState().selectionManager().setFocused(!1),r.listState().selectionManager().setFocusedKey(void 0)),ige(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if(nge(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:dxe(r.currentPlacement(),e,n),side:r.currentPlacement().split("-")[0]}),window.clearTimeout(t?.pointerGraceTimeoutId());const o=window.setTimeout((()=>{t?.setPointerGraceIntent(null)}),300);t?.setPointerGraceTimeoutId(o)}else{if(t?.onTriggerLeave(e),e.defaultPrevented)return;t?.setPointerGraceIntent(null)}t?.onItemLeave(e)}},(()=>r.dataset()),a))}function bxe(e){const t=Hbe(),n=yge({id:`menu-${Yt()}`,modal:!0},e),[r,o]=Gt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Qye({open:()=>r.open,defaultOpen:()=>r.defaultOpen,onOpenChange:e=>r.onOpenChange?.(e)}),a={isModal:()=>r.modal??!0,preventScroll:()=>r.preventScroll??a.isModal(),forceMount:()=>r.forceMount??!1,generateId:Kme((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return $t(Ube.Provider,{value:a,get children(){return $t(pxe,qt({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function xxe(e){let t;const n=yge({orientation:"horizontal"},e),[r,o]=Gt(n,["ref","orientation"]),i=Cge((()=>t),(()=>"hr"));return $t(Nge,qt({as:"hr",ref(e){const n=Rme((e=>t=e),r.ref);"function"==typeof n&&n(e)},get role(){return"hr"!==i()?"separator":void 0},get"aria-orientation"(){return"vertical"===r.orientation?"vertical":void 0},get"data-orientation"(){return r.orientation}},o))}Uge({},{Root:()=>xxe,Separator:()=>wxe});var wxe=xxe,_xe={};function Sxe(e){const t=$be(),n=jbe(),[r,o]=Gt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return $t(Zbe,qt({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||ige(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function Exe(e){return $t(bxe,yge({id:`dropdownmenu-${Yt()}`},e))}Uge(_xe,{Arrow:()=>Bye,CheckboxItem:()=>Bbe,Content:()=>Sxe,DropdownMenu:()=>Txe,Group:()=>exe,GroupLabel:()=>txe,Icon:()=>nxe,Item:()=>rxe,ItemDescription:()=>oxe,ItemIndicator:()=>ixe,ItemLabel:()=>axe,Portal:()=>sxe,RadioGroup:()=>cxe,RadioItem:()=>uxe,Root:()=>Exe,Separator:()=>xxe,Sub:()=>fxe,SubContent:()=>mxe,SubTrigger:()=>yxe,Trigger:()=>Wbe});var Txe=Object.assign(Exe,{Arrow:Bye,CheckboxItem:Bbe,Content:Sxe,Group:exe,GroupLabel:txe,Icon:nxe,Item:rxe,ItemDescription:oxe,ItemIndicator:ixe,ItemLabel:axe,Portal:sxe,RadioGroup:cxe,RadioItem:uxe,Separator:xxe,Sub:fxe,SubContent:mxe,SubTrigger:yxe,Trigger:Wbe}),Cxe={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"}},Axe=pn('<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>'),Nxe=pn('<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>'),Rxe=pn('<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>'),Oxe=pn('<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>'),Pxe=pn('<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>'),kxe=pn('<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>'),Mxe=pn('<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>'),Lxe=pn('<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>'),Dxe=pn('<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">'),jxe=pn('<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">'),Ixe=pn('<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>'),Fxe=pn('<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>'),Uxe=pn('<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>'),$xe=pn('<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>'),Vxe=pn('<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>'),Bxe=pn('<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>'),zxe=pn('<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>'),Hxe=pn('<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>'),qxe=pn('<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>'),Gxe=pn('<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>'),Kxe=pn('<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>'),Wxe=pn('<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>'),Yxe=pn('<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 Xxe(){return Axe()}function Qxe(){return Nxe()}function Zxe(){return Rxe()}function Jxe(){return Oxe()}function ewe(){return Pxe()}function twe(){return(e=Pxe()).style.setProperty("transform","rotate(90deg)"),e;var e}function nwe(){return(e=Pxe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function rwe(){return kxe()}function owe(){return Mxe()}function iwe(){return Lxe()}function awe(){return Dxe()}function swe(){return jxe()}function lwe(){return Ixe()}function cwe(){return Fxe()}function uwe(){return Uxe()}function dwe(){return $xe()}function pwe(e){return t=Vxe(),n=t.firstChild,lt((()=>hn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function fwe(){return Bxe()}function hwe(){return zxe()}function mwe(e){return[$t(Jt,{get when(){return e.checked},get children(){var t=Vxe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}}),$t(Jt,{get when(){return!e.checked},get children(){var t=Hxe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function gwe(){return qxe()}function vwe(){return Gxe()}function ywe(){return Kxe()}function bwe(){return Wxe()}function xwe(){const e=Yt();return t=Yxe(),i=(o=(r=(n=t.firstChild).nextSibling).nextSibling).firstChild,s=(a=o.nextSibling).firstChild,u=(c=(l=a.nextSibling).nextSibling).firstChild,p=(d=c.nextSibling).firstChild,m=(h=(f=d.nextSibling).nextSibling).firstChild,v=(g=h.nextSibling).firstChild,x=(b=(y=g.nextSibling).nextSibling).firstChild,_=(w=b.nextSibling).firstChild,T=(E=(S=w.nextSibling).nextSibling).firstChild,A=(C=E.nextSibling).firstChild,O=(R=(N=C.nextSibling).nextSibling).firstChild,k=(P=R.nextSibling).firstChild,D=(L=(M=P.nextSibling).nextSibling).firstChild,I=(j=L.nextSibling).firstChild,$=(U=(F=j.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Z=(Q=(X=(Y=(W=(K=(G=(q=z.nextSibling).firstChild).nextSibling).nextSibling.firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,se=(ae=q.nextSibling).firstChild,ce=(le=ae.nextSibling).firstChild,pe=(de=(ue=le.nextSibling).firstChild).nextSibling,he=(fe=ue.nextSibling).firstChild,ge=(me=fe.nextSibling).firstChild,De=(Le=(Me=(ke=(Pe=(Oe=(Re=(Ne=(Ae=(Ce=(Te=(Ee=(Se=(_e=(we=(xe=(be=(ye=(ve=me.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,hn(n,"id",`a-${e}`),hn(r,"fill",`url(#a-${e})`),hn(i,"id",`am-${e}`),hn(a,"id",`b-${e}`),hn(s,"filter",`url(#am-${e})`),hn(l,"mask",`url(#b-${e})`),hn(u,"id",`ah-${e}`),hn(d,"id",`k-${e}`),hn(p,"filter",`url(#ah-${e})`),hn(f,"mask",`url(#k-${e})`),hn(m,"id",`ae-${e}`),hn(g,"id",`j-${e}`),hn(v,"filter",`url(#ae-${e})`),hn(y,"mask",`url(#j-${e})`),hn(x,"id",`ai-${e}`),hn(w,"id",`i-${e}`),hn(_,"filter",`url(#ai-${e})`),hn(S,"mask",`url(#i-${e})`),hn(T,"id",`aj-${e}`),hn(C,"id",`h-${e}`),hn(A,"filter",`url(#aj-${e})`),hn(N,"mask",`url(#h-${e})`),hn(O,"id",`ag-${e}`),hn(P,"id",`g-${e}`),hn(k,"filter",`url(#ag-${e})`),hn(M,"mask",`url(#g-${e})`),hn(D,"id",`af-${e}`),hn(j,"id",`f-${e}`),hn(I,"filter",`url(#af-${e})`),hn(F,"mask",`url(#f-${e})`),hn(U,"id",`m-${e}`),hn($,"fill",`url(#m-${e})`),hn(B,"id",`ak-${e}`),hn(z,"id",`e-${e}`),hn(H,"filter",`url(#ak-${e})`),hn(q,"mask",`url(#e-${e})`),hn(G,"id",`n-${e}`),hn(K,"fill",`url(#n-${e})`),hn(W,"id",`r-${e}`),hn(Y,"fill",`url(#r-${e})`),hn(X,"id",`s-${e}`),hn(Q,"fill",`url(#s-${e})`),hn(Z,"id",`q-${e}`),hn(J,"fill",`url(#q-${e})`),hn(ee,"id",`p-${e}`),hn(te,"fill",`url(#p-${e})`),hn(ne,"id",`o-${e}`),hn(re,"fill",`url(#o-${e})`),hn(oe,"id",`l-${e}`),hn(ie,"fill",`url(#l-${e})`),hn(se,"id",`al-${e}`),hn(le,"id",`d-${e}`),hn(ce,"filter",`url(#al-${e})`),hn(ue,"mask",`url(#d-${e})`),hn(de,"id",`u-${e}`),hn(pe,"fill",`url(#u-${e})`),hn(he,"id",`ad-${e}`),hn(me,"id",`c-${e}`),hn(ge,"filter",`url(#ad-${e})`),hn(ve,"mask",`url(#c-${e})`),hn(ye,"id",`t-${e}`),hn(be,"fill",`url(#t-${e})`),hn(xe,"id",`v-${e}`),hn(we,"stroke",`url(#v-${e})`),hn(_e,"id",`aa-${e}`),hn(Se,"stroke",`url(#aa-${e})`),hn(Ee,"id",`w-${e}`),hn(Te,"stroke",`url(#w-${e})`),hn(Ce,"id",`ac-${e}`),hn(Ae,"stroke",`url(#ac-${e})`),hn(Ne,"id",`ab-${e}`),hn(Re,"stroke",`url(#ab-${e})`),hn(Oe,"id",`y-${e}`),hn(Pe,"stroke",`url(#y-${e})`),hn(ke,"id",`x-${e}`),hn(Me,"stroke",`url(#x-${e})`),hn(Le,"id",`z-${e}`),hn(De,"stroke",`url(#z-${e})`),t;var t,n,r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x,w,_,S,E,T,C,A,N,R,O,P,k,M,L,D,j,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Q,Z,J,ee,te,ne,re,oe,ie,ae,se,le,ce,ue,de,pe,fe,he,me,ge,ve,ye,be,xe,we,_e,Se,Ee,Te,Ce,Ae,Ne,Re,Oe,Pe,ke,Me,Le,De}var wwe=pn('<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>'),_we=pn('<button title="Copy object to clipboard">'),Swe=pn('<button title="Remove all items"aria-label="Remove all items">'),Ewe=pn('<button title="Delete item"aria-label="Delete item">'),Twe=pn('<button title="Toggle value"aria-label="Toggle value">'),Cwe=pn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),Awe=pn("<div>"),Nwe=pn("<div><button> <span></span> <span> "),Rwe=pn("<input>"),Owe=pn("<span>"),Pwe=pn("<div><span>:"),kwe=pn("<div><div><button> [<!>...<!>]");var Mwe=e=>{const t=eme(),n=Yhe().shadowDOMTarget?Tme.bind({target:Yhe().shadowDOMTarget}):Tme,r=ut((()=>"dark"===t()?Bwe(n):Vwe(n)));return o=wwe(),lt((()=>mn(o,Ame(r().expander,n`
95
95
  transform: rotate(${e.expanded?90:0}deg);
96
96
  `,e.expanded&&n`
97
97
  & svg {