@embedreach/components 0.2.10 → 0.2.11

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 DQ(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
- */Dae.exports="production"===process.env.NODE_ENV?function(){if(Lae)return Iae;Lae=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=Dae.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)=>jae(e,t,n),Wae=i.createContext(void 0),Yae=()=>i.useContext(Wae),Xae=i.createContext(void 0),Zae=()=>i.useContext(Xae),Qae=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 j(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 L(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)):j(e)}let D=()=>M(k().length-1),I=e=>{e.preventDefault(),e.metaKey?D():e.altKey?L(1):j(1)},F=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?L(-1):j(-1)};return i.createElement(KQ.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(),D();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(Qae),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=Zae(),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(KQ.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(KQ.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(Qae.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(KQ.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=Zae(),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(KQ.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(KQ.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(KQ.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(KQ.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=Zae(),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:Zd("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:Zd("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:Zd("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:Zd("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:Zd("-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:Zd("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(Z6,{asChild:!0,children:t.jsxs(gZ,{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(Q6,{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:Zd("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(Z6,{asChild:!0,children:t.jsxs(gZ,{variant:"outline",className:Zd("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(Q6,{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:Zd("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=iZ(),{updateAutomation:i}=Le(o?.id||""),{toast:a}=jl(),[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(gZ,{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(bZ,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(xZ.SendButton,{className:"text-primary"}),onClick:()=>{l("sendNow"),u(new Date(Date.now()+3e5).toISOString()),p("America/New_York"),h(!0)}}),t.jsx(bZ,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(xZ.ScheduleButton,{className:"text-primary"}),onClick:()=>l("schedule")})]}),t.jsx(zB,{children:"schedule"===s&&t.jsx(hZ,{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={[rZ.EQUALS]:"Equals",[rZ.NOT_EQUALS]:"Not Equals",[rZ.GREATER_THAN]:"Greater Than",[rZ.LESS_THAN]:"Less Than",[rZ.EXISTS]:"Exists",[rZ.EQUALS_MONTH_DAY]:"Month and Day Matches",[rZ.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[rZ.BETWEEN_MONTH_DAY]:"Between Month Day",[rZ.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[rZ.ARRAY_CONTAINS]:"List Contains"},Mse={email:"Email",phone:"Phone",firstName:"First Name",lastName:"Last Name"},jse=({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(Z6,{asChild:!0,children:t.jsxs(gZ,{"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(Q6,{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:Zd("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var Lse=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(Dse,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(Dse,{...o,ref:n,children:r})}));Lse.displayName="Slot";var Dse=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}));Dse.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?Lse: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:Zd("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(Z6,{asChild:!0,children:t.jsx("button",{type:"button",ref:y,...v,onClick:()=>{x((e=>!e))},className:Zd("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(PZ,{className:Zd(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(PZ,{className:Zd("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(Q6,{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:Zd("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:Zd("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:Zd("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]=FQ(Kse),[Xse,Zse]=Wse(Kse),Qse=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]=VQ({prop:a,defaultProp:s,onChange:d});return t.jsxs(Xse,{scope:r,checked:b,disabled:c,children:[t.jsx(KQ.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:IQ(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%)"}})]})}));Qse.displayName=Kse;var Jse="SwitchThumb",ele=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=Zse(Jse,r);return t.jsx(KQ.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=Qse,ole=ele;const ile=i.forwardRef((({className:e,...n},r)=>t.jsx(rle,{className:Zd("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:Zd("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(Z6,{asChild:!0,children:t.jsxs(gZ,{variant:"outline",className:Zd("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(Q6,{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===tZ.Date||e===tZ.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!==rZ.EQUALS_MONTH_DAY&&n!==rZ.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===tZ.String||e===tZ.ReachResource||e===tZ.Array)return n===rZ.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 tZ.ReachResource:case tZ.Array:case tZ.String:return t.length>0;case tZ.Number:return!isNaN(Number(t));case tZ.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case tZ.Boolean:return"true"===t||"false"===t;case tZ.Date:case tZ.DateTime:return!isNaN(new Date(t).getTime());default:throw Xte(n,tZ)}})({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===tZ.Date||e===tZ.DateTime){const e=n===rZ.EQUALS_MONTH_DAY||n===rZ.EQUALS_MONTH_DAY_YEAR,r=n===rZ.BETWEEN_MONTH_DAY||n===rZ.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(j9,{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(j9,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===tZ.Number||e===tZ.Integer)return n===rZ.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===tZ.Boolean){if(n===rZ.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}=jl(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:tZ.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(jse,{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 tZ.Boolean:l=[!1];break;case tZ.Number:l=[0];break;case tZ.Date:case tZ.DateTime:l=[new Date];break;case tZ.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(jse,{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(gZ,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(_u,{className:"h-4 w-4"})}),t.jsx(gZ,{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(bZ,{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(bZ,{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(gZ,{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(gZ,{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}=jl();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(hZ,{children:t.jsx(fZ,{})}),!a&&t.jsx(hZ,{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(gZ,{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}=jl(),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}=eZ(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(fZ,{})});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(hZ,{children:t.jsx(ule,{onSelectStyle:e=>{"ai"===e&&y(!0),x(!1)}})},"prompt-builder-style"):t.jsx(hZ,{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(hZ,{children:t.jsx(ple,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(hZ,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(j9,{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(j9,{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(gZ,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(gZ,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(gZ,{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!==rZ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===rZ.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!==rZ.EQUALS_MONTH_DAY&&t.operator!==rZ.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!==rZ.BETWEEN_MONTH_DAY&&t.operator!==rZ.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 LX(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===tZ.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(bZ,{onClick:()=>a("all"),title:`All ${ff("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(xZ.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(bZ,{onClick:()=>a("segments"),title:`Select ${ff("engage:user",{count:2})}`,subtitle:`Choose from ${ff("engage:segment",{count:2})}`,icon:t.jsx(xZ.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(xZ.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(gZ,{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(xZ.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=iZ(),[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}=ZX(),{updateAutomation:g}=Le(r?.id??""),[v,y]=n.useState(void 0),b=1===a.length&&0===l.length&&void 0!==h?.find((e=>e.type===nZ.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===nZ.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(fZ,{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=iZ(),t=aZ(),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=iZ(),a=aZ(),{updateAutomation:s}=Le(i?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:t}=QX({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(fZ,{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(PZ,{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(VZ,{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(hZ,{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=({children:e,actionId:r})=>{const{setActionId:o}=n.useContext(VX);return n.useEffect((()=>{o(r)}),[r,o]),t.jsx("div",{children:e})},Ale=()=>t.jsxs("div",{children:[t.jsx("div",{className:EZ,children:t.jsx(xZ.OneTimeBroadcast,{})}),t.jsxs("h3",{className:TZ,children:[ff("engage:one_time")," Broadcast"]}),t.jsx("p",{className:CZ,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),Nle=()=>t.jsxs("div",{children:[t.jsx("div",{className:AZ,children:"Coming Soon"}),t.jsx("div",{className:EZ,children:t.jsx(xZ.RealtimeActivity,{})}),t.jsx("h3",{className:TZ,children:"Realtime Activity"}),t.jsx("p",{className:CZ,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),Rle=({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(Ale,{});case Fe.TRIGGER_BASED:return t.jsx(Nle,{});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()}`})]})]})]})]}),Ole=({onClose:e,automationType:r,currentStep:o,setCurrentStep:i,getExtraMergeFields:a,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:c}=je(),[u,p]=n.useState(!1),[f,h]=n.useState(void 0),[m,g]=n.useState(void 0),[v,y]=n.useState(!1),[b,x]=n.useState(r?{name:void 0,description:void 0,type:r}:{name:void 0,description:void 0,type:void 0}),w=void 0!==b.name&&void 0!==b.type&&""!==b.name;n.useEffect((()=>{if(b.type&&!b.name&&!v){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="";x((e=>({...e,name:r,description:o}))),y(!0)}}),[b,v]);if(c||u)return t.jsx("div",{className:SZ,children:t.jsx(fZ,{text:[`Creating ${ff("engage:one_time")}`,"Finishing up"]})});return t.jsxs("div",{className:wB("relative overflow-y-auto h-full p-8",o===vZ.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[t.jsx(zB,{mode:"wait",children:t.jsx(hZ,{className:"h-full",children:(()=>{switch(o){case vZ.ChooseAutomationType:return t.jsx(NZ,{onNext:e=>{x({...b,type:e}),i(vZ.SetAutomationName)}});case vZ.SetAutomationName:return b.type?t.jsx(Rle,{selectedType:b.type,setAutomationName:e=>{x({...b,name:e})},automationName:b.name??"",setAutomationDescription:e=>{x({...b,description:e})},automationDescription:b.description??""}):null;case vZ.OneTimeWizard:return f&&m?t.jsx(lZ,{automationId:f,children:t.jsx(Cle,{actionId:m,children:t.jsx(Tle,{onFinish:()=>{e?.(f)},getExtraMergeFields:a,onBeforeSchedule:s})})}):null;default:throw LX(o,vZ)}})()},o)}),o!==vZ.OneTimeWizard&&t.jsx("div",{className:"pt-2",children:t.jsx(yZ,{onClose:e,currentStep:o,setCurrentStep:i,isDisabled:!w,createAutomation:async()=>{if(!w||!b.name||!b.type)return;p(!0);l({name:b.name,type:b.type,description:b.description},{onSuccess:async t=>{if(t.id){const n=await(async e=>(await Re(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),o=jX().toString();await Pe(t.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:o}}]}),h(t.id),await pZ({automationId:t.id,actionId:o}),r===Fe.ONE_TIME?(i(vZ.OneTimeWizard),g(o),p(!1)):e?.(t.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{x({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==r})})]})};function Ple({open:e,setOpen:r,onClose:o,automationType:i,getExtraMergeFields:a}){const[s,l]=n.useState(i?vZ.SetAutomationName:vZ.ChooseAutomationType);return n.useEffect((()=>{e&&l(i?vZ.SetAutomationName:vZ.ChooseAutomationType)}),[e,i]),t.jsx(_B,{open:e,onOpenChange:r,children:t.jsxs(TB,{hideCloseButton:s===vZ.OneTimeWizard,className:`flex max-h-[86vh] ${s===vZ.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(Ole,{onClose:e=>{o?.(e),r(!1)},automationType:i,currentStep:s,setCurrentStep:l,getExtraMergeFields:a})]})})}const kle=({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})})]})},Mle=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)},jle="reach-styles-module__header___-izE2",Lle="reach-styles-module__title___n1hA9",Dle="reach-styles-module__description___EvXM-",Ile="reach-styles-module__content___okv68",Fle="reach-styles-module__footer___YA4U4",Ule=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"}}),$le=i.forwardRef((({className:e,variant:n,...r},o)=>t.jsx("div",{ref:o,className:Zd(Ule({variant:n}),e),...r})));$le.displayName="Card";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(jle,e),...n}))).displayName="CardHeader";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Lle,e),...n}))).displayName="CardTitle";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Dle,e),...n}))).displayName="CardDescription";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Ile,e),...n}))).displayName="CardContent";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Fle,e),...n}))).displayName="CardFooter";const Vle=({Icon:e,title:n,value:r,tooltipText:o,change:i})=>t.jsxs($le,{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})})]}),Ble=({activeTab:e,automation:n})=>{if(!n)return null;const r={sales:[{Icon:xZ.SalesAmount,title:"Order Amount",value:Mle(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(Vle,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},zle=({activeTab:e,statistics:n})=>{const r={email:[{Icon:xZ.MessagesSent,title:"Emails Sent",value:n.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:xZ.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:xZ.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:xZ.LinksClicked,title:"Links Clicked",value:n.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:xZ.SpamComplies,title:"Spam Complaints",value:`${(100*n.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:xZ.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*n.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:xZ.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(Vle,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Hle=({automationId:e,includeSales:r=!1,includeSms:o=!1,automation:i})=>{const[a,s]=n.useState("email"),{statistics:l,isLoading:c}=De(e);if(c||!l)return t.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:t.jsx(fZ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]})});const u=[{id:"email",label:`Email ${ff("engage:insight",{count:2})}`,content:t.jsx(zle,{activeTab:"email",statistics:l})},...o?[{id:"sms",label:`SMS ${ff("engage:insight",{count:2})}`,content:t.jsx(zle,{activeTab:"sms",statistics:l})}]:[],...r?[{id:"sales",label:`Sales ${ff("engage:insight",{count:2})}`,content:t.jsx(Ble,{activeTab:"sales",automation:i})}]:[]];return t.jsx(kle,{tabs:u,activeTab:a,onTabChange:e=>s(e),tabsLocation:"left"})},qle={all:["website"],content:()=>[...qle.all,"content"],analyze:()=>[...qle.all,"analyze"],brandSettings:()=>[...qle.all,"brand-settings"]},Gle=async()=>(await Re("/web-presence/brand-settings",{method:"POST"})).data,Kle=({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})]})]})]})},Wle=({setAutoParse:e,onBrandSettingsGenerated:r,onForceRefresh:o})=>{const{data:i,updateWebsite:a,isUpdatingWebsite:s,updateBrandSettings:l}=Bte(),c=ye({mutationFn:Gle,mutationKey:qle.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(Xle,{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(gZ,{variant:"outline",size:"sm",onClick:()=>{f(!1),d(i?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),t.jsx(gZ,{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(fZ,{}):"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(gZ,{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(Kle,{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(gZ,{variant:"outline",onClick:x,className:"gap-1",children:"Go Back"}),t.jsxs(gZ,{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(fZ,{}):"Analyze Website"]})]})]})},Yle=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],Xle=({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}=jl();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)},j=e=>{d((t=>({...t,primaryColor:e})))},L=()=>{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(fZ,{})}):p?t.jsx(Wle,{setAutoParse:f,onForceRefresh:()=>S(Date.now())}):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16",children:[t.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 px-6 pt-2",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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{variant:"ghost",size:"sm",onClick:()=>{N.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[t.jsx(Zu,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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=>j(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:Yle.map(((e,n)=>t.jsx(gZ,{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:()=>j(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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(PZ,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",style:{borderColor:`${u.primaryColor}30`||"#f3f4f6",backgroundColor:`${u.primaryColor}08`||"#f9fafb"},children:[e,t.jsx(gZ,{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&&L()}),t.jsxs(gZ,{variant:"outline",onClick:L,disabled:!y.trim(),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),t.jsxs(AB,{className:"pb-4 px-6",children:[o?t.jsx(gZ,{variant:"outline",className:"gap-1.5",onClick:o,children:"Go Back"}):i&&t.jsxs(gZ,{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(gZ,{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"})]})]})};var Zle=e=>"checkbox"===e.type,Qle=e=>e instanceof Date,Jle=e=>null==e;const ece=e=>"object"==typeof e;var tce=e=>!Jle(e)&&!Array.isArray(e)&&ece(e)&&!Qle(e),nce=e=>tce(e)&&e.target?Zle(e.target)?e.target.checked:e.target.value:e,rce=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),oce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function ice(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(oce&&(e instanceof Blob||r)||!n&&!tce(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return tce(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=ice(e[n]));else t=e}return t}var ace=e=>Array.isArray(e)?e.filter(Boolean):[],sce=e=>void 0===e,lce=(e,t,n)=>{if(!t||!tce(e))return n;const r=ace(t.split(/[,[\].]+?/)).reduce(((e,t)=>Jle(e)?e:e[t]),e);return sce(r)||r===e?sce(e[t])?n:e[t]:r},cce=e=>"boolean"==typeof e,uce=e=>/^\w*$/.test(e),dce=e=>ace(e.replace(/["|']|\]/g,"").split(/\.|\[/)),pce=(e,t,n)=>{let r=-1;const o=uce(t)?[t]:dce(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=tce(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const fce="blur",hce="focusout",mce="change",gce="onBlur",vce="onChange",yce="onSubmit",bce="onTouched",xce="all",wce="max",_ce="min",Sce="maxLength",Ece="minLength",Tce="pattern",Cce="required",Ace="validate",Nce=n.createContext(null),Rce=()=>n.useContext(Nce);var Oce=(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]!==xce&&(t._proxyFormState[o]=!r||xce),n&&(n[o]=!0),e[o]}});return o},Pce=e=>Jle(e)||!ece(e);function kce(e,t){if(Pce(e)||Pce(t))return e===t;if(Qle(e)&&Qle(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(Qle(n)&&Qle(e)||tce(n)&&tce(e)||Array.isArray(n)&&Array.isArray(e)?!kce(n,e):n!==e)return!1}}return!0}const Mce=(e,t)=>{const r=n.useRef(t);kce(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var jce=e=>"string"==typeof e,Lce=(e,t,n,r,o)=>jce(e)?(r&&t.watch.add(e),lce(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),lce(n,e)))):(r&&(t.watchAll=!0),n);function Dce(e){const t=Rce(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=rce(i._names.array,r),l=function(e){const t=Rce(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return Mce((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c(Lce(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:lce(i._formValues,r,lce(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=Rce(),{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 Mce((()=>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((()=>Oce(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,...cce(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!lce(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!lce(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!lce(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!lce(c.validatingFields,r)},error:{enumerable:!0,get:()=>lce(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:nce(e),name:r},type:mce})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:lce(i._formValues,r),name:r},type:fce})),[r,i._formValues]),m=n.useCallback((e=>{const t=lce(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,...cce(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,...cce(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=lce(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=ice(lce(i._options.defaultValues,r));pce(i._defaultValues,r,e),sce(lce(i._formValues,r))&&pce(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 Ice=e=>e.render(Dce(e));var Fce=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Uce=e=>Array.isArray(e)?e:[e],$ce=()=>{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=[]}}},Vce=e=>tce(e)&&!Object.keys(e).length,Bce=e=>"file"===e.type,zce=e=>"function"==typeof e,Hce=e=>{if(!oce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},qce=e=>"select-multiple"===e.type,Gce=e=>"radio"===e.type,Kce=e=>Hce(e)&&e.isConnected;function Wce(e,t){const n=Array.isArray(t)?t:uce(t)?[t]:dce(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=sce(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(tce(r)&&Vce(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!sce(e[t]))return!1;return!0}(r))&&Wce(e,n.slice(0,-1)),e}var Yce=e=>{for(const t in e)if(zce(e[t]))return!0;return!1};function Xce(e,t={}){const n=Array.isArray(e);if(tce(e)||n)for(const r in e)Array.isArray(e[r])||tce(e[r])&&!Yce(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Xce(e[r],t[r])):Jle(e[r])||(t[r]=!0);return t}function Zce(e,t,n){const r=Array.isArray(e);if(tce(e)||r)for(const o in e)Array.isArray(e[o])||tce(e[o])&&!Yce(e[o])?sce(t)||Pce(n[o])?n[o]=Array.isArray(e[o])?Xce(e[o],[]):{...Xce(e[o])}:Zce(e[o],Jle(t)?{}:t[o],n[o]):n[o]=!kce(e[o],t[o]);return n}var Qce=(e,t)=>Zce(e,t,Xce(t));const Jce={value:!1,isValid:!1},eue={value:!0,isValid:!0};var tue=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&&!sce(e[0].attributes.value)?sce(e[0].value)||""===e[0].value?eue:{value:e[0].value,isValid:!0}:eue:Jce}return Jce},nue=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>sce(e)?e:t?""===e?NaN:e?+e:e:n&&jce(e)?new Date(e):r?r(e):e;const rue={isValid:!1,value:null};var oue=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),rue):rue;function iue(e){const t=e.ref;return Bce(t)?t.files:Gce(t)?oue(e.refs).value:qce(t)?[...t.selectedOptions].map((({value:e})=>e)):Zle(t)?tue(e.refs).value:nue(sce(t.value)?e.ref.value:t.value,e)}var aue=e=>e instanceof RegExp,sue=e=>sce(e)?e:aue(e)?e.source:tce(e)?aue(e.value)?e.value.source:e.value:e,lue=e=>({isOnSubmit:!e||e===yce,isOnBlur:e===gce,isOnChange:e===vce,isOnAll:e===xce,isOnTouch:e===bce});const cue="AsyncFunction";var uue=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const due=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=lce(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(due(i,t))break}else if(tce(i)&&due(i,t))break}}};function pue(e,t,n){const r=lce(e,n);if(r||uce(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=lce(t,r),a=lce(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 fue=(e,t,n)=>{const r=Uce(lce(e,n));return pce(r,"root",t[n]),pce(e,n,r),e},hue=e=>jce(e);function mue(e,t,n="validate"){if(hue(e)||Array.isArray(e)&&e.every(hue)||cce(e)&&!e)return{type:n,message:hue(e)?e:"",ref:t}}var gue=e=>tce(e)&&!aue(e)?e:{value:e,message:""},vue=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=lce(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,x=e=>{o&&b.reportValidity&&(b.setCustomValidity(cce(e)?"":e||""),b.reportValidity())},w={},_=Gce(a),S=Zle(a),E=_||S,T=(g||Bce(a))&&sce(a.value)&&sce(y)||Hce(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=Fce.bind(null,m,r,w),A=(e,t,n,r=Sce,o=Ece)=>{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||Jle(y))||cce(y)&&!y||S&&!tue(s).isValid||_&&!oue(s).isValid)){const{value:e,message:t}=hue(l)?{value:!!l,message:l}:gue(l);if(e&&(w[m]={type:Cce,message:t,ref:b,...C(Cce,t)},!r))return x(t),w}if(!(T||Jle(d)&&Jle(p))){let e,t;const n=gue(p),o=gue(d);if(Jle(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;jce(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),jce(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);Jle(n.value)||(e=r>n.value),Jle(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,wce,_ce),!r))return x(w[m].message),w}if((c||u)&&!T&&(jce(y)||i&&Array.isArray(y))){const e=gue(c),t=gue(u),n=!Jle(e.value)&&y.length>+e.value,o=!Jle(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&&jce(y)){const{value:e,message:t}=gue(f);if(aue(e)&&!y.match(e)&&(w[m]={type:Tce,message:t,ref:a,...C(Tce,t)},!r))return x(t),w}if(h)if(zce(h)){const e=mue(await h(y,n),b);if(e&&(w[m]={...e,...C(Ace,e.message)},!r))return x(e.message),w}else if(tce(h)){let e={};for(const t in h){if(!Vce(e)&&!r)break;const o=mue(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},x(o.message),r&&(w[m]=e))}if(!Vce(e)&&(w[m]={ref:b,...e},!r))return w}return x(!0),w};const yue={mode:yce,reValidateMode:vce,shouldFocusError:!0};function bue(e={}){let t={...yue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:zce(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=(tce(t.defaultValues)||tce(t.values))&&ice(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:ice(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:$ce(),state:$ce()},f=lue(t.mode),h=lue(t.reValidateMode),m=t.criteriaMode===xce,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?Vce((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?pce(n.validatingFields,e,r):Wce(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!Vce(n.validatingFields)}))},y=(e,t,n,o)=>{const l=lce(r,e);if(l){const r=lce(a,e,sce(n)?lce(i,e):n);sce(r)||o&&o.defaultChecked||t?pce(a,e,t?r:iue(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=kce(lce(i,e),r);c=!!lce(n.dirtyFields,e),t?Wce(n.dirtyFields,e):pce(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=lce(n.touchedFields,e);t||(pce(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=lce(n.errors,e),l=(u.isValid||d.isValid)&&cce(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{pce(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?pce(n.errors,e,i):Wce(n.errors,e)),(i?!kce(s,i):s)||!Vce(a)||l){const t={...a,...l&&cce(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=lce(t,i);e&&pce(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&&!!(zce(i.validate)&&i.validate.constructor.name===cue||tce(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===cue))));p&&u.validatingFields&&v([s],!0);const f=await vue(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(lce(f,e.name)?d?fue(n.errors,f,e.name):pce(n.errors,e.name,f[e.name]):Wce(n.errors,e.name))}!Vce(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&pce(a,e,n),!kce(P(),i)),E=(e,t,n)=>Lce(e,l,{...s.mount?a:sce(t)?i:jce(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=lce(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&pce(a,e,nue(t,n)),i=Hce(n.ref)&&Jle(t)?"":t,qce(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?Zle(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)):Bce(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:ice(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=lce(r,a);(l.array.has(e)||tce(i)||s&&!s._f)&&!Qle(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=lce(r,e),f=l.array.has(e),h=ice(t);pce(a,e,h),f?(p.array.next({name:e,values:ice(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:Qce(i,a),isDirty:S(e,h)})):!c||c._f||Jle(h)?T(e,h,o):C(e,h,o),uue(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:ice(a)})},N=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=lce(r,c),E=e=>{y=Number.isNaN(e)||Qle(e)&&isNaN(e.getTime())||kce(e,lce(a,c,e))};if(S){let s,C;const A=i.type?iue(S._f):nce(e),N=e.type===fce||e.type===hce,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||lce(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,lce(n.touchedFields,c),n.isSubmitted,h,f),P=uue(c,l,N);pce(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=!Vce(k)||P;if(!N&&p.state.next({name:c,type:e.type,values:ice(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=pue(n.errors,r,c),o=pue(e,r,t.name||c);s=o.error,c=o.name,C=Vce(e)}}else v([c],!0),s=(await vue(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(lce(n.errors,t)&&e.focus)return e.focus(),1},O=async(e,o={})=>{let i,a;const s=Uce(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=lce(t,r);e?pce(n.errors,r,e):Wce(n.errors,r)}else n.errors=t;return t})(sce(e)?e:s);i=Vce(t),a=e?!s.some((e=>lce(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=lce(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!jce(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&due(r,R,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return sce(e)?t:jce(e)?lce(t,e):e.map((e=>lce(t,e)))},k=(e,t)=>({invalid:!!lce((t||n).errors,e),isDirty:!!lce((t||n).dirtyFields,e),error:lce((t||n).errors,e),isValidating:!!lce(n.validatingFields,e),isTouched:!!lce((t||n).touchedFields,e)}),M=(e,t,o)=>{const i=(lce(r,e,{_f:{}})._f||{}).ref,a=lce(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;pce(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()},j=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!Uce(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 Vce(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||xce)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,L=(e,o={})=>{for(const s of e?Uce(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(Wce(r,s),Wce(a,s)),!o.keepError&&Wce(n.errors,s),!o.keepDirty&&Wce(n.dirtyFields,s),!o.keepTouched&&Wce(n.touchedFields,s),!o.keepIsValidating&&Wce(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&Wce(i,s);p.state.next({values:ice(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},D=({disabled:e,name:t})=>{(cce(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=lce(r,e);const a=cce(n.disabled)||cce(t.disabled);return pce(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?D({disabled:cce(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:sue(n.min),max:sue(n.max),minLength:sue(n.minLength),maxLength:sue(n.maxLength),pattern:sue(n.pattern)}:{},name:e,onChange:N,onBlur:N,ref:a=>{if(a){I(e,n),o=lce(r,e);const t=sce(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>Gce(e)||Zle(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;pce(r,e,{_f:{...o._f,...s?{refs:[...l.filter(Kce),t,...Array.isArray(lce(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=lce(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!rce(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&due(r,R,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=ice(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)pce(c,e,void 0);if(Wce(n.errors,"root"),Vce(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:Vce(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?ice(e):i,d=ice(c),f=Vce(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Qce(i,a))]);for(const t of Array.from(e))lce(n.dirtyFields,t)?pce(h,t,lce(a,t)):A(t,lce(h,t))}else{if(oce&&sce(e))for(const e of l.mount){const t=lce(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Hce(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,lce(h,e))}a=ice(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||kce(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?Qce(i,a):n.dirtyFields:o.keepDefaultValues&&e?Qce(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)=>$(zce(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:L,getFieldState:k,handleSubmit:U,setError:M,_subscribe:j,_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(lce(r,e))){const t=l(lce(r,e),c.argA,c.argB);f&&pce(r,e,t)}if(h&&Array.isArray(lce(n.errors,e))){const t=l(lce(n.errors,e),c.argA,c.argB);f&&pce(n.errors,e,t),((e,t)=>{!ace(lce(e,t)).length&&Wce(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(lce(n.touchedFields,e))){const t=l(lce(n.touchedFields,e),c.argA,c.argB);f&&pce(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=Qce(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else pce(a,e,o)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>ace(lce(s.mount?a:i,e,t.shouldUnregister?lce(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>zce(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=lce(r,e);t&&(t._f.refs?t._f.refs.every((e=>!Kce(e))):!Kce(t._f.ref))&&L(e)}l.unMount=new Set},_disableForm:e=>{cce(e)&&(p.state.next({disabled:e}),due(r,((t,n)=>{const o=lce(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},j({...e,formState:d})),trigger:O,register:I,handleSubmit:U,watch:(e,t)=>zce(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={})=>{lce(r,e)&&(sce(t.defaultValue)?A(e,ice(lce(i,e))):(A(e,t.defaultValue),pce(i,e,ice(t.defaultValue))),t.keepTouched||Wce(n.touchedFields,e),t.keepDirty||(Wce(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,ice(lce(i,e))):S()),t.keepError||(Wce(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&Uce(e).forEach((e=>Wce(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:L,setError:M,setFocus:(e,t={})=>{const n=lce(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&zce(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const xue="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function wue(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:zce(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:zce(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:bue(e),formState:o},e.formControl&&e.defaultValues&&!zce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,xue((()=>{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&&!Vce(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&&!kce(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=Oce(o,a),t.current}const _ue=(e,t,n)=>{if(e&&"reportValidity"in e){const r=lce(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Sue=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?_ue(r.ref,n,e):r.refs&&r.refs.forEach((t=>_ue(t,n,e)))}},Eue=(e,t)=>{t.shouldUseNativeValidation&&Sue(e,t);const n={};for(const r in e){const o=lce(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Tue(t.names||Object.keys(e),r)){const e=Object.assign({},lce(n,r));pce(e,"root",i),pce(n,r,e)}else pce(n,r,i)}return n},Tue=(e,t)=>e.some((e=>e.startsWith(t+".")));var Cue=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]=Fce(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},Aue=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&&Sue({},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:Eue(Cue(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};const Nue="reach-styles-module__base___r-a1U",Rue=ru([Nue],{variants:{variant:{default:"reach-styles-module__default___vu2Rt",primary:"reach-styles-module__primary___mGKjo",success:"reach-styles-module__success___xn1Y1",warning:"reach-styles-module__warning___jdyU9",error:"reach-styles-module__error___Z-3IS"},size:{default:"reach-styles-module__sizeDefault___oS6W2",sm:"reach-styles-module__sizeSm___GI826",lg:"reach-styles-module__sizeLg___J--WF"},position:{default:"reach-styles-module__positionDefault___visr6",top:"reach-styles-module__positionTop___y6h-n",bottom:"reach-styles-module__positionBottom___vYLkd",inline:"reach-styles-module__positionInline___NjZsw"}},defaultVariants:{variant:"default",size:"default",position:"default"}}),Oue=e=>{const{children:t,...r}=e;return n.createElement(Nce.Provider,{value:r},t)},Pue=i.createContext({}),kue=({...e})=>t.jsx(Pue.Provider,{value:{name:e.name},children:t.jsx(Ice,{...e})}),Mue=()=>{const e=i.useContext(Pue),t=i.useContext(jue),{getFieldState:n,formState:r}=Rce(),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}},jue=i.createContext({}),Lue=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(jue.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:Zd("space-y-2",e),...n})})}));Lue.displayName="FormItem";const Due=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=Mue();return t.jsx(j9,{ref:r,className:Zd(o&&"text-destructive",e),htmlFor:i,...n})}));Due.displayName="FormLabel";const Iue=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=Mue();return t.jsx(ZU,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));Iue.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=Mue();return t.jsx("p",{ref:r,id:o,className:Zd("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const Fue=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=Mue(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:Zd("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));Fue.displayName="FormMessage";const Uue=({control:e,disabled:n,legalNameRef:r})=>t.jsxs(t.Fragment,{children:[t.jsx(kue,{control:e,name:"company.legalName",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Legal Company Name"}),t.jsx(Iue,{children:t.jsx(H3,{...e,ref:r,disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"company.type",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Company Type"}),t.jsxs(lte,{onValueChange:e.onChange,defaultValue:e.value,disabled:n,children:[t.jsx(Iue,{children:t.jsx(ute,{className:"h-8",children:t.jsx(cte,{placeholder:"Select company type"})})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"corporation",children:"Corporation"}),t.jsx(hte,{value:"llc",children:"LLC"})]})]}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"company.ein",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"EIN (Employer Identification Number)"}),t.jsx(Iue,{children:t.jsx(H3,{...e,type:"text",disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})})]}),$ue=({control:e,disabled:n})=>t.jsxs(t.Fragment,{children:[t.jsx(kue,{control:e,name:"representative.title",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Title"}),t.jsx(Iue,{children:t.jsx(H3,{...e,disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"representative.firstName",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"First Name"}),t.jsx(Iue,{children:t.jsx(H3,{...e,disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"representative.email",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Email"}),t.jsx(Iue,{children:t.jsx(H3,{...e,type:"email",disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"representative.phone",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Contact Phone Number"}),t.jsx(Iue,{children:t.jsx(H3,{...e,type:"tel",disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"representative.position",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Position"}),t.jsxs(lte,{onValueChange:e.onChange,defaultValue:e.value,disabled:n,children:[t.jsx(Iue,{children:t.jsx(ute,{className:"h-8",children:t.jsx(cte,{placeholder:"Select position"})})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"owner",children:"Owner"}),t.jsx(hte,{value:"manager",children:"Manager"}),t.jsx(hte,{value:"director",children:"Director"})]})]}),t.jsx(Fue,{className:"text-xs"})]})})]});var Vue,Bue,zue;(Bue=Vue||(Vue={})).assertEqual=e=>e,Bue.assertIs=function(e){},Bue.assertNever=function(e){throw new Error},Bue.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Bue.getValidEnumValues=e=>{const t=Bue.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return Bue.objectValues(n)},Bue.objectValues=e=>Bue.objectKeys(e).map((function(t){return e[t]})),Bue.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},Bue.find=(e,t)=>{for(const n of e)if(t(n))return n},Bue.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,Bue.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},Bue.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(zue||(zue={})).mergeShapes=(e,t)=>({...e,...t});const Hue=Vue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),que=e=>{switch(typeof e){case"undefined":return Hue.undefined;case"string":return Hue.string;case"number":return isNaN(e)?Hue.nan:Hue.number;case"boolean":return Hue.boolean;case"function":return Hue.function;case"bigint":return Hue.bigint;case"symbol":return Hue.symbol;case"object":return Array.isArray(e)?Hue.array:null===e?Hue.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Hue.promise:"undefined"!=typeof Map&&e instanceof Map?Hue.map:"undefined"!=typeof Set&&e instanceof Set?Hue.set:"undefined"!=typeof Date&&e instanceof Date?Hue.date:Hue.object;default:return Hue.unknown}},Gue=Vue.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 Kue 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 Kue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vue.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()}}Kue.create=e=>new Kue(e);const Wue=(e,t)=>{let n;switch(e.code){case Gue.invalid_type:n=e.received===Hue.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Gue.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Vue.jsonStringifyReplacer)}`;break;case Gue.unrecognized_keys:n=`Unrecognized key(s) in object: ${Vue.joinValues(e.keys,", ")}`;break;case Gue.invalid_union:n="Invalid input";break;case Gue.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Vue.joinValues(e.options)}`;break;case Gue.invalid_enum_value:n=`Invalid enum value. Expected ${Vue.joinValues(e.options)}, received '${e.received}'`;break;case Gue.invalid_arguments:n="Invalid function arguments";break;case Gue.invalid_return_type:n="Invalid function return type";break;case Gue.invalid_date:n="Invalid date";break;case Gue.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}"`:Vue.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Gue.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 Gue.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 Gue.custom:n="Invalid input";break;case Gue.invalid_intersection_types:n="Intersection results could not be merged";break;case Gue.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Gue.not_finite:n="Number must be finite";break;default:n=t.defaultError,Vue.assertNever(e)}return{message:n}};let Yue=Wue;function Xue(){return Yue}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 Que(e,t){const n=Xue(),r=Zue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Wue?void 0:Wue].filter((e=>!!e))});e.common.issues.push(r)}class Jue{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 ede;"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 Jue.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 ede;if("aborted"===o.status)return ede;"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 ede=Object.freeze({status:"aborted"}),tde=e=>({status:"dirty",value:e}),nde=e=>({status:"valid",value:e}),rde=e=>"aborted"===e.status,ode=e=>"dirty"===e.status,ide=e=>"valid"===e.status,ade=e=>"undefined"!=typeof Promise&&e instanceof Promise;function sde(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 lde(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 cde,ude,dde,pde;"function"==typeof SuppressedError&&SuppressedError,(ude=cde||(cde={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},ude.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class fde{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 hde=(e,t)=>{if(ide(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 Kue(e.common.issues);return this._error=t,this._error}}};function mde(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 gde{get description(){return this._def.description}_getType(e){return que(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:que(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jue,ctx:{common:e.parent.common,data:e.data,parsedType:que(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ade(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:que(e)},o=this._parseSync({data:e,path:r.path,parent:r});return hde(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:que(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return ide(t)?{value:t.value}:{issues:r.common.issues}}catch(ZSe){(null===(n=null===(t=null==ZSe?void 0:ZSe.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=>ide(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:que(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(ade(r)?r:Promise.resolve(r));return hde(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:Gue.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 vpe({schema:this,typeName:Ope.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 ype.create(this,this._def)}nullable(){return bpe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qde.create(this)}promise(){return gpe.create(this,this._def)}or(e){return tpe.create([this,e],this._def)}and(e){return ipe.create(this,e,this._def)}transform(e){return new vpe({...mde(this._def),schema:this,typeName:Ope.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new xpe({...mde(this._def),innerType:this,defaultValue:t,typeName:Ope.ZodDefault})}brand(){return new Epe({typeName:Ope.ZodBranded,type:this,...mde(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new wpe({...mde(this._def),innerType:this,catchValue:t,typeName:Ope.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Tpe.create(this,e)}readonly(){return Cpe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vde=/^c[^\s-]{8,}$/i,yde=/^[0-9a-z]+$/,bde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xde=/^[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,wde=/^[a-z0-9_-]{21}$/i,_de=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sde=/^[-+]?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)?)??$/,Ede=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Tde;const Cde=/^(?:(?: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])$/,Ade=/^(?:(?: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])$/,Nde=/^(([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]))$/,Rde=/^(([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])$/,Ode=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kde="((\\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])))",Mde=new RegExp(`^${kde}$`);function jde(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 Lde(e){return new RegExp(`^${jde(e)}$`)}function Dde(e){let t=`${kde}T${jde(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 Ide(e,t){if(!_de.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(QSe){return!1}}function Fde(e,t){return!("v4"!==t&&t||!Ade.test(e))||!("v6"!==t&&t||!Rde.test(e))}class Ude extends gde{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Hue.string){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.string,received:t.parsedType}),ede}const t=new Jue;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.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),Que(n,{code:Gue.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?Que(n,{code:Gue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Que(n,{code:Gue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)Ede.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"email",code:Gue.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Tde||(Tde=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Tde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"emoji",code:Gue.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)xde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"uuid",code:Gue.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)wde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"nanoid",code:Gue.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)vde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"cuid",code:Gue.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)yde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"cuid2",code:Gue.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)bde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"ulid",code:Gue.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(QSe){n=this._getOrReturnCtx(e,n),Que(n,{validation:"url",code:Gue.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),Que(n,{validation:"regex",code:Gue.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),Que(n,{code:Gue.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),Que(n,{code:Gue.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),Que(n,{code:Gue.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){Dde(i).test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Mde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){Lde(i).test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?Sde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"duration",code:Gue.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!Cde.test(r))&&("v6"!==o&&o||!Nde.test(r))&&(n=this._getOrReturnCtx(e,n),Que(n,{validation:"ip",code:Gue.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?Ide(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"jwt",code:Gue.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Fde(e.data,i.version)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"cidr",code:Gue.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?Ode.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"base64",code:Gue.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Pde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"base64url",code:Gue.invalid_string,message:i.message}),t.dirty()):Vue.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:Gue.invalid_string,...cde.errToObj(n)})}_addCheck(e){return new Ude({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...cde.errToObj(e)})}url(e){return this._addCheck({kind:"url",...cde.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...cde.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...cde.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...cde.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...cde.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...cde.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...cde.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...cde.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...cde.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...cde.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...cde.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...cde.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,...cde.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,...cde.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...cde.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...cde.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...cde.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...cde.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...cde.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...cde.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...cde.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...cde.errToObj(t)})}nonempty(e){return this.min(1,cde.errToObj(e))}trim(){return new Ude({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ude({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ude({...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 $de(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)}Ude.create=e=>{var t;return new Ude({checks:[],typeName:Ope.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...mde(e)})};class Vde extends gde{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)!==Hue.number){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.number,received:t.parsedType}),ede}let t;const n=new Jue;for(const r of this._def.checks)if("int"===r.kind)Vue.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Que(t,{code:Gue.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),Que(t,{code:Gue.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),Que(t,{code:Gue.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==$de(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Que(t,{code:Gue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Que(t,{code:Gue.not_finite,message:r.message}),n.dirty()):Vue.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,cde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,cde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,cde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,cde.toString(t))}setLimit(e,t,n,r){return new Vde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:cde.toString(r)}]})}_addCheck(e){return new Vde({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:cde.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:cde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:cde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:cde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:cde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:cde.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:cde.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:cde.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:cde.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&&Vue.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)}}Vde.create=e=>new Vde({checks:[],typeName:Ope.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...mde(e)});class Bde extends gde{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(QSe){return this._getInvalidInput(e)}if(this._getType(e)!==Hue.bigint)return this._getInvalidInput(e);let t;const n=new Jue;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),Que(t,{code:Gue.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),Que(t,{code:Gue.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),Que(t,{code:Gue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Vue.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.bigint,received:t.parsedType}),ede}gte(e,t){return this.setLimit("min",e,!0,cde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,cde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,cde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,cde.toString(t))}setLimit(e,t,n,r){return new Bde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:cde.toString(r)}]})}_addCheck(e){return new Bde({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:cde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:cde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:cde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:cde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:cde.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}}Bde.create=e=>{var t;return new Bde({checks:[],typeName:Ope.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...mde(e)})};class zde extends gde{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Hue.boolean){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.boolean,received:t.parsedType}),ede}return nde(e.data)}}zde.create=e=>new zde({typeName:Ope.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...mde(e)});class Hde extends gde{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Hue.date){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.date,received:t.parsedType}),ede}if(isNaN(e.data.getTime())){return Que(this._getOrReturnCtx(e),{code:Gue.invalid_date}),ede}const t=new Jue;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.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),Que(n,{code:Gue.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Vue.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Hde({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:cde.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:cde.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}}Hde.create=e=>new Hde({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ope.ZodDate,...mde(e)});class qde extends gde{_parse(e){if(this._getType(e)!==Hue.symbol){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.symbol,received:t.parsedType}),ede}return nde(e.data)}}qde.create=e=>new qde({typeName:Ope.ZodSymbol,...mde(e)});class Gde extends gde{_parse(e){if(this._getType(e)!==Hue.undefined){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.undefined,received:t.parsedType}),ede}return nde(e.data)}}Gde.create=e=>new Gde({typeName:Ope.ZodUndefined,...mde(e)});class Kde extends gde{_parse(e){if(this._getType(e)!==Hue.null){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.null,received:t.parsedType}),ede}return nde(e.data)}}Kde.create=e=>new Kde({typeName:Ope.ZodNull,...mde(e)});class Wde extends gde{constructor(){super(...arguments),this._any=!0}_parse(e){return nde(e.data)}}Wde.create=e=>new Wde({typeName:Ope.ZodAny,...mde(e)});class Yde extends gde{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nde(e.data)}}Yde.create=e=>new Yde({typeName:Ope.ZodUnknown,...mde(e)});class Xde extends gde{_parse(e){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.never,received:t.parsedType}),ede}}Xde.create=e=>new Xde({typeName:Ope.ZodNever,...mde(e)});class Zde extends gde{_parse(e){if(this._getType(e)!==Hue.undefined){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.void,received:t.parsedType}),ede}return nde(e.data)}}Zde.create=e=>new Zde({typeName:Ope.ZodVoid,...mde(e)});class Qde extends gde{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Hue.array)return Que(t,{code:Gue.invalid_type,expected:Hue.array,received:t.parsedType}),ede;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(Que(t,{code:e?Gue.too_big:Gue.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&&(Que(t,{code:Gue.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&&(Que(t,{code:Gue.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 fde(t,e,t.path,n))))).then((e=>Jue.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new fde(t,e,t.path,n))));return Jue.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new Qde({...this._def,minLength:{value:e,message:cde.toString(t)}})}max(e,t){return new Qde({...this._def,maxLength:{value:e,message:cde.toString(t)}})}length(e,t){return new Qde({...this._def,exactLength:{value:e,message:cde.toString(t)}})}nonempty(e){return this.min(1,e)}}function Jde(e){if(e instanceof epe){const t={};for(const n in e.shape){t[n]=ype.create(Jde(e.shape[n]))}return new epe({...e._def,shape:()=>t})}return e instanceof Qde?new Qde({...e._def,type:Jde(e.element)}):e instanceof ype?ype.create(Jde(e.unwrap())):e instanceof bpe?bpe.create(Jde(e.unwrap())):e instanceof ape?ape.create(e.items.map((e=>Jde(e)))):e}Qde.create=(e,t)=>new Qde({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ope.ZodArray,...mde(t)});class epe extends gde{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=Vue.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Hue.object){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.object,received:t.parsedType}),ede}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Xde&&"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 fde(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof Xde){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&&(Que(n,{code:Gue.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 fde(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=>Jue.mergeObjectSync(t,e))):Jue.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new epe({...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=cde.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new epe({...this._def,unknownKeys:"strip"})}passthrough(){return new epe({...this._def,unknownKeys:"passthrough"})}extend(e){return new epe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new epe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ope.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new epe({...this._def,catchall:e})}pick(e){const t={};return Vue.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new epe({...this._def,shape:()=>t})}omit(e){const t={};return Vue.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new epe({...this._def,shape:()=>t})}deepPartial(){return Jde(this)}partial(e){const t={};return Vue.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new epe({...this._def,shape:()=>t})}required(e){const t={};return Vue.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ype;)e=e._def.innerType;t[n]=e}})),new epe({...this._def,shape:()=>t})}keyof(){return fpe(Vue.objectKeys(this.shape))}}epe.create=(e,t)=>new epe({shape:()=>e,unknownKeys:"strip",catchall:Xde.create(),typeName:Ope.ZodObject,...mde(t)}),epe.strictCreate=(e,t)=>new epe({shape:()=>e,unknownKeys:"strict",catchall:Xde.create(),typeName:Ope.ZodObject,...mde(t)}),epe.lazycreate=(e,t)=>new epe({shape:e,unknownKeys:"strip",catchall:Xde.create(),typeName:Ope.ZodObject,...mde(t)});class tpe extends gde{_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 Kue(e.ctx.common.issues)));return Que(t,{code:Gue.invalid_union,unionErrors:n}),ede}));{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 Kue(e)));return Que(t,{code:Gue.invalid_union,unionErrors:o}),ede}}get options(){return this._def.options}}tpe.create=(e,t)=>new tpe({options:e,typeName:Ope.ZodUnion,...mde(t)});const npe=e=>e instanceof dpe?npe(e.schema):e instanceof vpe?npe(e.innerType()):e instanceof ppe?[e.value]:e instanceof hpe?e.options:e instanceof mpe?Vue.objectValues(e.enum):e instanceof xpe?npe(e._def.innerType):e instanceof Gde?[void 0]:e instanceof Kde?[null]:e instanceof ype?[void 0,...npe(e.unwrap())]:e instanceof bpe?[null,...npe(e.unwrap())]:e instanceof Epe||e instanceof Cpe?npe(e.unwrap()):e instanceof wpe?npe(e._def.innerType):[];class rpe extends gde{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Hue.object)return Que(t,{code:Gue.invalid_type,expected:Hue.object,received:t.parsedType}),ede;const n=this.discriminator,r=this.optionsMap.get(t.data[n]);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(Que(t,{code:Gue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ede)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const o of t){const t=npe(o.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,o)}}return new rpe({typeName:Ope.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...mde(n)})}}function ope(e,t){const n=que(e),r=que(t);if(e===t)return{valid:!0,data:e};if(n===Hue.object&&r===Hue.object){const n=Vue.objectKeys(t),r=Vue.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=ope(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===Hue.array&&r===Hue.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=ope(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===Hue.date&&r===Hue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ipe extends gde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(rde(e)||rde(r))return ede;const o=ope(e.value,r.value);return o.valid?((ode(e)||ode(r))&&t.dirty(),{status:t.value,value:o.data}):(Que(n,{code:Gue.invalid_intersection_types}),ede)};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}))}}ipe.create=(e,t,n)=>new ipe({left:e,right:t,typeName:Ope.ZodIntersection,...mde(n)});class ape extends gde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Hue.array)return Que(n,{code:Gue.invalid_type,expected:Hue.array,received:n.parsedType}),ede;if(n.data.length<this._def.items.length)return Que(n,{code:Gue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ede;!this._def.rest&&n.data.length>this._def.items.length&&(Que(n,{code:Gue.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 fde(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>Jue.mergeArray(t,e))):Jue.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new ape({...this._def,rest:e})}}ape.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ape({items:e,typeName:Ope.ZodTuple,rest:null,...mde(t)})};class spe extends gde{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!==Hue.object)return Que(n,{code:Gue.invalid_type,expected:Hue.object,received:n.parsedType}),ede;const r=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)r.push({key:o._parse(new fde(n,a,n.path,a)),value:i._parse(new fde(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Jue.mergeObjectAsync(t,r):Jue.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new spe(t instanceof gde?{keyType:e,valueType:t,typeName:Ope.ZodRecord,...mde(n)}:{keyType:Ude.create(),valueType:e,typeName:Ope.ZodRecord,...mde(t)})}}class lpe extends gde{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!==Hue.map)return Que(n,{code:Gue.invalid_type,expected:Hue.map,received:n.parsedType}),ede;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new fde(n,e,n.path,[i,"key"])),value:o._parse(new fde(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 ede;"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 ede;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}lpe.create=(e,t,n)=>new lpe({valueType:t,keyType:e,typeName:Ope.ZodMap,...mde(n)});class cpe extends gde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Hue.set)return Que(n,{code:Gue.invalid_type,expected:Hue.set,received:n.parsedType}),ede;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Que(n,{code:Gue.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&&(Que(n,{code:Gue.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 ede;"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 fde(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new cpe({...this._def,minSize:{value:e,message:cde.toString(t)}})}max(e,t){return new cpe({...this._def,maxSize:{value:e,message:cde.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}cpe.create=(e,t)=>new cpe({valueType:e,minSize:null,maxSize:null,typeName:Ope.ZodSet,...mde(t)});class upe extends gde{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Hue.function)return Que(t,{code:Gue.invalid_type,expected:Hue.function,received:t.parsedType}),ede;function n(e,n){return Zue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Xue(),Wue].filter((e=>!!e)),issueData:{code:Gue.invalid_arguments,argumentsError:n}})}function r(e,n){return Zue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Xue(),Wue].filter((e=>!!e)),issueData:{code:Gue.invalid_return_type,returnTypeError:n}})}const o={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof gpe){const e=this;return nde((async function(...t){const a=new Kue([]),s=await e._def.args.parseAsync(t,o).catch((e=>{throw a.addIssue(n(t,e)),a})),l=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(l,o).catch((e=>{throw a.addIssue(r(l,e)),a}))}))}{const e=this;return nde((function(...t){const a=e._def.args.safeParse(t,o);if(!a.success)throw new Kue([n(t,a.error)]);const s=Reflect.apply(i,this,a.data),l=e._def.returns.safeParse(s,o);if(!l.success)throw new Kue([r(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new upe({...this._def,args:ape.create(e).rest(Yde.create())})}returns(e){return new upe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new upe({args:e||ape.create([]).rest(Yde.create()),returns:t||Yde.create(),typeName:Ope.ZodFunction,...mde(n)})}}class dpe extends gde{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})}}dpe.create=(e,t)=>new dpe({getter:e,typeName:Ope.ZodLazy,...mde(t)});class ppe extends gde{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Que(t,{received:t.data,code:Gue.invalid_literal,expected:this._def.value}),ede}return{status:"valid",value:e.data}}get value(){return this._def.value}}function fpe(e,t){return new hpe({values:e,typeName:Ope.ZodEnum,...mde(t)})}ppe.create=(e,t)=>new ppe({value:e,typeName:Ope.ZodLiteral,...mde(t)});class hpe extends gde{constructor(){super(...arguments),dde.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return Que(t,{expected:Vue.joinValues(this._def.values),received:t.parsedType,code:Gue.invalid_type}),ede}if(sde(this,dde)||lde(this,dde,new Set(this._def.values)),!sde(this,dde).has(e.data)){const t=this._getOrReturnCtx(e);return Que(t,{received:t.data,code:Gue.invalid_enum_value,options:this._def.values}),ede}return nde(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 hpe.create(e,{...this._def,...t})}exclude(e,t=this._def){return hpe.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}dde=new WeakMap,hpe.create=fpe;class mpe extends gde{constructor(){super(...arguments),pde.set(this,void 0)}_parse(e){const t=Vue.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Hue.string&&n.parsedType!==Hue.number){const e=Vue.objectValues(t);return Que(n,{expected:Vue.joinValues(e),received:n.parsedType,code:Gue.invalid_type}),ede}if(sde(this,pde)||lde(this,pde,new Set(Vue.getValidEnumValues(this._def.values))),!sde(this,pde).has(e.data)){const e=Vue.objectValues(t);return Que(n,{received:n.data,code:Gue.invalid_enum_value,options:e}),ede}return nde(e.data)}get enum(){return this._def.values}}pde=new WeakMap,mpe.create=(e,t)=>new mpe({values:e,typeName:Ope.ZodNativeEnum,...mde(t)});class gpe extends gde{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Hue.promise&&!1===t.common.async)return Que(t,{code:Gue.invalid_type,expected:Hue.promise,received:t.parsedType}),ede;const n=t.parsedType===Hue.promise?t.data:Promise.resolve(t.data);return nde(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}gpe.create=(e,t)=>new gpe({type:e,typeName:Ope.ZodPromise,...mde(t)});class vpe extends gde{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ope.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=>{Que(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 ede;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?ede:"dirty"===r.status||"dirty"===t.value?tde(r.value):r}));{if("aborted"===t.value)return ede;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?ede:"dirty"===r.status||"dirty"===t.value?tde(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?ede:("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?ede:("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(!ide(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=>ide(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}Vue.assertNever(r)}}vpe.create=(e,t,n)=>new vpe({schema:e,typeName:Ope.ZodEffects,effect:t,...mde(n)}),vpe.createWithPreprocess=(e,t,n)=>new vpe({schema:t,effect:{type:"preprocess",transform:e},typeName:Ope.ZodEffects,...mde(n)});class ype extends gde{_parse(e){return this._getType(e)===Hue.undefined?nde(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ype.create=(e,t)=>new ype({innerType:e,typeName:Ope.ZodOptional,...mde(t)});class bpe extends gde{_parse(e){return this._getType(e)===Hue.null?nde(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}bpe.create=(e,t)=>new bpe({innerType:e,typeName:Ope.ZodNullable,...mde(t)});class xpe extends gde{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Hue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}xpe.create=(e,t)=>new xpe({innerType:e,typeName:Ope.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...mde(t)});class wpe extends gde{_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 ade(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Kue(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Kue(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}wpe.create=(e,t)=>new wpe({innerType:e,typeName:Ope.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...mde(t)});class _pe extends gde{_parse(e){if(this._getType(e)!==Hue.nan){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.nan,received:t.parsedType}),ede}return{status:"valid",value:e.data}}}_pe.create=e=>new _pe({typeName:Ope.ZodNaN,...mde(e)});const Spe=Symbol("zod_brand");class Epe extends gde{_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 Tpe extends gde{_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?ede:"dirty"===e.status?(t.dirty(),tde(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?ede:"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 Tpe({in:e,out:t,typeName:Ope.ZodPipeline})}}class Cpe extends gde{_parse(e){const t=this._def.innerType._parse(e),n=e=>(ide(e)&&(e.value=Object.freeze(e.value)),e);return ade(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Ape(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Npe(e,t={},n){return e?Wde.create().superRefine(((r,o)=>{var i,a;const s=e(r);if(s instanceof Promise)return s.then((e=>{var i,a;if(!e){const e=Ape(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=Ape(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}})):Wde.create()}Cpe.create=(e,t)=>new Cpe({innerType:e,typeName:Ope.ZodReadonly,...mde(t)});const Rpe={object:epe.lazycreate};var Ope,Ppe;(Ppe=Ope||(Ope={})).ZodString="ZodString",Ppe.ZodNumber="ZodNumber",Ppe.ZodNaN="ZodNaN",Ppe.ZodBigInt="ZodBigInt",Ppe.ZodBoolean="ZodBoolean",Ppe.ZodDate="ZodDate",Ppe.ZodSymbol="ZodSymbol",Ppe.ZodUndefined="ZodUndefined",Ppe.ZodNull="ZodNull",Ppe.ZodAny="ZodAny",Ppe.ZodUnknown="ZodUnknown",Ppe.ZodNever="ZodNever",Ppe.ZodVoid="ZodVoid",Ppe.ZodArray="ZodArray",Ppe.ZodObject="ZodObject",Ppe.ZodUnion="ZodUnion",Ppe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ppe.ZodIntersection="ZodIntersection",Ppe.ZodTuple="ZodTuple",Ppe.ZodRecord="ZodRecord",Ppe.ZodMap="ZodMap",Ppe.ZodSet="ZodSet",Ppe.ZodFunction="ZodFunction",Ppe.ZodLazy="ZodLazy",Ppe.ZodLiteral="ZodLiteral",Ppe.ZodEnum="ZodEnum",Ppe.ZodEffects="ZodEffects",Ppe.ZodNativeEnum="ZodNativeEnum",Ppe.ZodOptional="ZodOptional",Ppe.ZodNullable="ZodNullable",Ppe.ZodDefault="ZodDefault",Ppe.ZodCatch="ZodCatch",Ppe.ZodPromise="ZodPromise",Ppe.ZodBranded="ZodBranded",Ppe.ZodPipeline="ZodPipeline",Ppe.ZodReadonly="ZodReadonly";const kpe=Ude.create,Mpe=Vde.create,jpe=_pe.create,Lpe=Bde.create,Dpe=zde.create,Ipe=Hde.create,Fpe=qde.create,Upe=Gde.create,$pe=Kde.create,Vpe=Wde.create,Bpe=Yde.create,zpe=Xde.create,Hpe=Zde.create,qpe=Qde.create,Gpe=epe.create,Kpe=epe.strictCreate,Wpe=tpe.create,Ype=rpe.create,Xpe=ipe.create,Zpe=ape.create,Qpe=spe.create,Jpe=lpe.create,efe=cpe.create,tfe=upe.create,nfe=dpe.create,rfe=ppe.create,ofe=hpe.create,ife=mpe.create,afe=gpe.create,sfe=vpe.create,lfe=ype.create,cfe=bpe.create,ufe=vpe.createWithPreprocess,dfe=Tpe.create,pfe={string:e=>Ude.create({...e,coerce:!0}),number:e=>Vde.create({...e,coerce:!0}),boolean:e=>zde.create({...e,coerce:!0}),bigint:e=>Bde.create({...e,coerce:!0}),date:e=>Hde.create({...e,coerce:!0})},ffe=ede;var hfe=Object.freeze({__proto__:null,defaultErrorMap:Wue,setErrorMap:function(e){Yue=e},getErrorMap:Xue,makeIssue:Zue,EMPTY_PATH:[],addIssueToContext:Que,ParseStatus:Jue,INVALID:ede,DIRTY:tde,OK:nde,isAborted:rde,isDirty:ode,isValid:ide,isAsync:ade,get util(){return Vue},get objectUtil(){return zue},ZodParsedType:Hue,getParsedType:que,ZodType:gde,datetimeRegex:Dde,ZodString:Ude,ZodNumber:Vde,ZodBigInt:Bde,ZodBoolean:zde,ZodDate:Hde,ZodSymbol:qde,ZodUndefined:Gde,ZodNull:Kde,ZodAny:Wde,ZodUnknown:Yde,ZodNever:Xde,ZodVoid:Zde,ZodArray:Qde,ZodObject:epe,ZodUnion:tpe,ZodDiscriminatedUnion:rpe,ZodIntersection:ipe,ZodTuple:ape,ZodRecord:spe,ZodMap:lpe,ZodSet:cpe,ZodFunction:upe,ZodLazy:dpe,ZodLiteral:ppe,ZodEnum:hpe,ZodNativeEnum:mpe,ZodPromise:gpe,ZodEffects:vpe,ZodTransformer:vpe,ZodOptional:ype,ZodNullable:bpe,ZodDefault:xpe,ZodCatch:wpe,ZodNaN:_pe,BRAND:Spe,ZodBranded:Epe,ZodPipeline:Tpe,ZodReadonly:Cpe,custom:Npe,Schema:gde,ZodSchema:gde,late:Rpe,get ZodFirstPartyTypeKind(){return Ope},coerce:pfe,any:Vpe,array:qpe,bigint:Lpe,boolean:Dpe,date:Ipe,discriminatedUnion:Ype,effect:sfe,enum:ofe,function:tfe,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Npe((t=>t instanceof e),t),intersection:Xpe,lazy:nfe,literal:rfe,map:Jpe,nan:jpe,nativeEnum:ife,never:zpe,null:$pe,nullable:cfe,number:Mpe,object:Gpe,oboolean:()=>Dpe().optional(),onumber:()=>Mpe().optional(),optional:lfe,ostring:()=>kpe().optional(),pipeline:dfe,preprocess:ufe,promise:afe,record:Qpe,set:efe,strictObject:Kpe,string:kpe,symbol:Fpe,transformer:sfe,tuple:Zpe,undefined:Upe,union:Wpe,unknown:Bpe,void:Hpe,NEVER:ffe,ZodIssueCode:Gue,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Kue});const mfe=hfe.object({company:hfe.object({legalName:hfe.string().min(1,"Legal company name is required"),type:hfe.enum(["corporation","llc"]).optional(),ein:hfe.string().min(1,"EIN is required")}),representative:hfe.object({title:hfe.string().min(1,"Title is required"),firstName:hfe.string().min(1,"First name is required"),email:hfe.string().email("Invalid email address"),phone:hfe.string().min(1,"Phone number is required"),position:hfe.enum(["owner","manager","director"]).optional()})}),gfe=({onSave:e,onBack:r})=>{const o=n.useRef(null),{isUpdatingBrandSettings:i,data:a}=Bte(),{toast:s}=jl(),[l,c]=n.useState(Boolean(null));n.useEffect((()=>{o.current?.focus()}),[]);const u=wue({resolver:Aue(mfe),defaultValues:{company:{legalName:"",type:void 0,ein:""},representative:{title:"",firstName:"",email:"",phone:"",position:void 0}}}),d=a?.branding?.primaryColor||"#000000",p=Object.entries(u.formState.errors).reduce(((e,[t,n])=>"company"===t||"representative"===t?e+Object.keys(n).length:e+1),0);return t.jsx(Oue,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit((async t=>{try{s({title:"Settings saved 🚀"}),e?.()}catch(n){s({title:"Error saving settings",variant:"destructive"})}})),className:"w-full h-full flex flex-col bg-white rounded-lg",children:[t.jsx("div",{className:"flex-1 flex flex-col min-h-0 px-6 pt-16 overflow-y-auto relative",children:t.jsxs("div",{className:"flex-1 w-full min-h-[400px] @container flex flex-col gap-2",children:[!l&&t.jsx("div",{className:Zd(Rue({variant:"warning",size:"default",position:"inline"}),Nue,"p-4 relative"),role:"alert",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"mr-3 shrink-0 pt-0.5",children:t.jsx(Xu,{className:"h-6 w-6"})}),t.jsxs("div",{className:"flex-grow",children:[t.jsx("h5",{className:"text-sm font-medium mb-1",children:"Complete Required Information"}),t.jsx("div",{className:"text-sm",children:"Please complete the required information to get your Twilio phone number."})]})]})}),t.jsxs("div",{className:"bg-card rounded-lg border shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between p-6",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Twilio Application"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Status:"}),t.jsx("span",{className:"inline-flex items-center rounded-full bg-yellow-100 px-2 py-1 text-xs font-medium text-yellow-800",children:"Pending"})]})]}),t.jsxs("div",{className:"py-4 @md:grid @md:grid-cols-2 @md:gap-8 px-6",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-medium pb-2 border-b border-border",children:"Company"}),t.jsx("div",{className:"space-y-4 py-4",children:t.jsx(Uue,{control:u.control,disabled:i,legalNameRef:o})})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-medium pb-2 border-b border-border",children:"Authorized Representative"}),t.jsx("div",{className:"space-y-4 py-4",children:t.jsx($ue,{control:u.control,disabled:i})})]})]})]}),t.jsx("div",{className:"h-4",children:" "})]})}),t.jsxs(AB,{className:"py-4 px-6",children:[r&&t.jsx(gZ,{variant:"outline",className:"gap-1.5",onClick:r,disabled:i,children:"Go Back"}),t.jsxs("div",{className:"flex items-center gap-4",children:[p>0&&t.jsxs("span",{className:"text-sm text-destructive flex items-center gap-1.5",children:["Please fix the ",t.jsx("span",{className:"font-bold",children:p})," ","fields that need attention"]}),t.jsx(gZ,{type:"submit",className:"px-4",style:{backgroundColor:d},disabled:i||!u.formState.isDirty,children:i?t.jsxs(t.Fragment,{children:[t.jsx(Nu,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving"]}):"Save Changes"})]})]})]})})};function vfe({tabs:e,activeTab:n,onTabChange:r,title:o}){return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:"w-48 py-2 pl-4",children:[o&&t.jsx("h2",{className:"px-4 pt-4 pb-5 text-lg font-medium",children:o}),e.map((e=>t.jsx(gZ,{variant:"ghost",className:Zd("w-full justify-start mb-1",n===e.id&&"bg-accent"),onClick:()=>r(e.id),children:e.label},e.id)))]}),t.jsx("div",{className:"flex-1",children:e.find((e=>e.id===n))?.content})]})}function yfe({open:e,setOpen:r}){const[o,i]=n.useState("brand"),a=(()=>{const{flags:e}=n.useContext(al.reactContext);return e})()["show-settings-modal"]??!1;n.useEffect((()=>{e&&i("brand")}),[e]);const s=a?[{id:"brand",label:"Brand",content:t.jsx(Xle,{})},{id:"phone-number",label:"Phone Number",content:t.jsx(gfe,{})}]:[{id:"brand",label:"Brand",content:t.jsx(Xle,{})}];return t.jsx(_B,{open:e,onOpenChange:r,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 p-0",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Settings"}),t.jsx(RB,{children:"Edit your business and brand settings"})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(vfe,{tabs:s,activeTab:o,onTabChange:i,title:"Settings"})})]})})}const bfe=e=>{const{updateAutomation:t,updateError:r,isUpdateSuccess:o}=Le(e),{toast:i}=jl();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 xfe(){const{toast:e}=jl(),[r,o]=n.useState(null),{toggleStatus:i}=bfe(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 wfe(){const{toast:e}=jl(),[r,o]=n.useState(!1),[i,a]=n.useState(null),{toggleStatus:s}=bfe(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(gZ,{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(Ple,{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 _fe(){const{toast:e}=jl(),[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}=ZX({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(gZ,{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 Sfe=()=>{const e=[{id:"broadcasts",label:ff("engage:one_time",{count:2}),content:t.jsx(wfe,{})},{id:"automations",label:ff("engage:automation",{count:2}),content:t.jsx(xfe,{})},{id:"segments",label:ff("engage:segment",{count:2}),content:t.jsx(_fe,{})},{id:"statistics",label:ff("engage:insight",{count:2}),content:t.jsx(Hle,{})}],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(yfe,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(gZ,{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(kle,{activeTab:a,tabs:e,onTabChange:s})})]})},Efe=Gpe({name:kpe().min(2,"Title must be at least 2 characters"),description:kpe()});function Tfe({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=iZ(),{toast:i}=jl(),a=wue({resolver:Aue(Efe),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(Oue,{...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(kue,{control:a.control,name:"name",disabled:!0,render:({field:e})=>t.jsxs(Lue,{children:[t.jsx(Due,{children:"Title"}),t.jsx(Iue,{children:t.jsx(H3,{...e})}),t.jsx(Fue,{})]})}),t.jsx(kue,{control:a.control,name:"description",disabled:!0,render:({field:e})=>t.jsxs(Lue,{children:[t.jsx(Due,{children:"Description"}),t.jsx(Iue,{children:t.jsx(zte,{...e})}),t.jsx(Fue,{})]})}),t.jsx(AB,{children:t.jsx(gZ,{type:"submit",children:"Duplicate"})})]})})]})})}const Cfe=Gpe({name:kpe().min(2,"Title must be at least 2 characters"),description:kpe()});function Afe({open:e,onOpenChange:n}){const r=iZ(),{updateAutomation:o}=Le(r?.id||""),i=wue({resolver:Aue(Cfe),defaultValues:{name:r?.name??"",description:r?.description??""},values:{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.jsxs(NB,{children:["Edit"," ",ff(r.triggerType===Fe.ONE_TIME?"engage:one_time":"engage:automation")]}),t.jsxs(RB,{children:["Update the title and description of your"," ",ff(r.triggerType===Fe.ONE_TIME?"engage:one_time":"engage:automation"),"."]})]}),t.jsx(Oue,{...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(kue,{control:i.control,name:"name",render:({field:e})=>t.jsxs(Lue,{children:[t.jsx(Due,{children:"Title"}),t.jsx(Iue,{children:t.jsx(H3,{...e})}),t.jsx(Fue,{})]})}),t.jsx(kue,{control:i.control,name:"description",render:({field:e})=>t.jsxs(Lue,{children:[t.jsx(Due,{children:"Description"}),t.jsx(Iue,{children:t.jsx(zte,{...e})}),t.jsx(Fue,{})]})}),t.jsx(AB,{children:t.jsx(gZ,{type:"submit",children:"Save changes"})})]})})]})}):null}function Nfe({open:e,onOpenChange:n,setIsActive:r}){const o=iZ(),{updateAutomation:i}=Le(o?.id||""),{toast:a}=jl();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(gZ,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(gZ,{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 Rfe=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=iZ(),a=H5(),{updateAutomation:s}=Le(i?.id||""),{toast:l}=jl(),c=(()=>{const{state:e}=oZ();return e.recipientStats})(),u=aZ(),[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)}if(!r)return t.jsx(PZ,{variant:l9(i.status),children:J6[i.status]});switch(i.triggerType){case Fe.TRIGGER_BASED:return 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})]});case Fe.ONE_TIME:if(!i.triggerMetadata||i.triggerMetadata?.triggerType===Fe.ONE_TIME&&!i.triggerMetadata?.scheduledAt)return t.jsx(gZ,{variant:"outline",className:"flex items-center gap-2",disabled:!0,children:"Set Scheduled Time"});if(d)return t.jsx(gZ,{variant:"outline",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:"Convert to Draft"});{let r="Schedule Send";return i.triggerMetadata.triggerType===Fe.ONE_TIME&&i.triggerMetadata.scheduledAt&&new Date(i.triggerMetadata.scheduledAt)<new Date(Date.now()+3e5)&&(r="Send Now"),t.jsx(gZ,{variant:"default",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:r})}default:throw Xte(i.triggerType,Fe)}}),[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(gZ,{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:xZ.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",onClick:()=>g(!0),children:t.jsx(E9,{title:"Duplicate",Icon:xZ.DuplicateIcon,asChild:!1,onClick:()=>g(!0)})})]})}),b?t.jsx("div",{className:"flex items-center text-muted-foreground pr-8",children:t.jsx(fZ,{})}):w()]}),t.jsx(Afe,{open:f,onOpenChange:h}),t.jsx(Tfe,{open:m,onOpenChange:g,onDuplicationCreated:r}),t.jsx(Nfe,{open:v,onOpenChange:y,setIsActive:p})]}):null},Ofe=({hideSms:e,hideSales:n})=>{const r=iZ(),{isLoading:o}=De(r?.id);return!r||o?t.jsx(fZ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(Hle,{automationId:r.id,automation:r,includeSales:!n,includeSms:!e})})},Pfe=()=>{const e=iZ(),{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(xZ.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(fZ,{text:["Fetching Recipients","Finishing up"]})},kfe=n.createContext(null);kfe.displayName="PanelGroupContext";const Mfe="data-panel-group",jfe="data-panel-group-direction",Lfe="data-panel-group-id",Dfe="data-panel",Ife="data-panel-collapsible",Ffe="data-panel-id",Ufe="data-panel-size",$fe="data-resize-handle",Vfe="data-resize-handle-active",Bfe="data-panel-resize-handle-enabled",zfe="data-panel-resize-handle-id",Hfe="data-resize-handle-state",qfe=n.useLayoutEffect,Gfe=i["useId".toString()],Kfe="function"==typeof Gfe?Gfe:()=>null;let Wfe=0;function Yfe(e=null){const t=Kfe(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+Wfe++),null!=e?e:r.current}function Xfe({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(kfe);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=Yfe(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}),qfe((()=>{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)})),qfe((()=>{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},[Lfe]:_,[Dfe]:"",[Ife]:o||void 0,[Ffe]:N,[Ufe]:parseFloat(""+O.flexGrow).toFixed(1)})}const Zfe=n.forwardRef(((e,t)=>n.createElement(Xfe,{...e,forwardedRef:t})));Xfe.displayName="Panel",Zfe.displayName="forwardRef(Panel)";let Qfe=null,Jfe=-1,ehe=null;function the(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&hhe),n=!!(t&mhe);if(t&phe)return e?"se-resize":n?"ne-resize":"e-resize";if(t&fhe)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(Qfe!==o){var i;if(Qfe=o,null===ehe&&(ehe=document.createElement("style"),document.head.appendChild(ehe)),Jfe>=0)null===(i=ehe.sheet)||void 0===i||i.removeRule(Jfe);Jfe=null!==(n=null===(r=ehe.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function nhe(e){return"keydown"===e.type}function rhe(e){return e.type.startsWith("pointer")}function ohe(e){return e.type.startsWith("mouse")}function ihe(e){if(rhe(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(ohe(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const ahe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function she(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=dhe(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||(!!ahe.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function lhe(e){let t=e.length;for(;t--;){const n=e[t];if(khe(n,"Missing node"),she(n))return n}return null}function che(e){return e&&Number(getComputedStyle(e).zIndex)||0}function uhe(e){const t=[];for(;e;)t.push(e),e=dhe(e);return t}function dhe(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const phe=1,fhe=2,hhe=4,mhe=8,ghe="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let vhe=[],yhe=!1,bhe=new Map,xhe=new Map;const whe=new Set;function _he(e){const{target:t}=e,{x:n,y:r}=ihe(e);yhe=!0,Che({target:t,x:n,y:r}),Ohe(),vhe.length>0&&(Phe("down",e),e.preventDefault(),The(t)||e.stopImmediatePropagation())}function She(e){const{x:t,y:n}=ihe(e);if(yhe&&0===e.buttons&&(yhe=!1,Phe("up",e)),!yhe){const{target:r}=e;Che({target:r,x:t,y:n})}Phe("move",e),Nhe(),vhe.length>0&&e.preventDefault()}function Ehe(e){const{target:t}=e,{x:n,y:r}=ihe(e);xhe.clear(),yhe=!1,vhe.length>0&&(e.preventDefault(),The(t)||e.stopImmediatePropagation()),Phe("up",e),Che({target:t,x:n,y:r}),Nhe(),Ohe()}function The(e){let t=e;for(;t;){if(t.hasAttribute($fe))return!0;t=t.parentElement}return!1}function Che({target:e,x:t,y:n}){vhe.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),whe.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=ghe?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:uhe(e),b:uhe(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;khe(r,"Stacking order can only be calculated for elements with a common ancestor");const o=che(lhe(n.a)),i=che(lhe(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}vhe.push(e)}var p,f}))}function Ahe(e,t){xhe.set(e,t)}function Nhe(){let e=!1,t=!1;vhe.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;xhe.forEach((e=>{n|=e})),e&&t?the("intersection",n):e?the("horizontal",n):t?the("vertical",n):null!==ehe&&(document.head.removeChild(ehe),Qfe=null,ehe=null,Jfe=-1)}let Rhe=new AbortController;function Ohe(){Rhe.abort(),Rhe=new AbortController;const e={capture:!0,signal:Rhe.signal};whe.size&&(yhe?(vhe.length>0&&bhe.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",Ehe,e),r.addEventListener("pointerleave",She,e),r.addEventListener("pointermove",She,e))})),bhe.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",Ehe,e),r.addEventListener("pointercancel",Ehe,e)}))):bhe.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",_he,e),r.addEventListener("pointermove",She,e))})))}function Phe(e,t){whe.forEach((n=>{const{setResizeHandlerState:r}=n,o=vhe.includes(n);r(e,o,t)}))}function khe(e,t){if(!e)throw Error(t)}function Mhe(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function jhe(e,t,n=10){return 0===Mhe(e,t,n)}function Lhe(e,t,n){return 0===Mhe(e,t,n)}function Dhe({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];khe(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(Mhe(n,s)<0)if(i){n=Mhe(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function Ihe({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Lhe(e,0))return t;const a=[...t],[s,l]=r;khe(null!=s,"Invalid first pivot index"),khe(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];khe(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(khe(null!=n,`Previous layout not found for panel index ${r}`),Lhe(n,i)){const t=c-n;Mhe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];khe(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(khe(null!=n,`Previous layout not found for panel index ${r}`),Lhe(n,c)){const t=n-i;Mhe(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];khe(null!=e,`Previous layout not found for panel index ${o}`);if(i+=Dhe({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];khe(null!=i,`Previous layout not found for panel index ${r}`);const s=Dhe({panelConstraints:n,panelIndex:r,size:i-o});if(!Lhe(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(!Lhe(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];khe(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=Dhe({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!Lhe(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];khe(null!=o,`Previous layout not found for panel index ${r}`);const i=Dhe({panelConstraints:n,panelIndex:r,size:o+t});if(Lhe(o,i)||(t-=i-o,a[r]=i),Lhe(t,0))break;e>0?r--:r++}}}return Lhe(a.reduce(((e,t)=>t+e),0),100)?a:o}function Fhe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];khe(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 Uhe(e,t=document){return Array.from(t.querySelectorAll(`[${zfe}][data-panel-group-id="${e}"]`))}function $he(e,t,n=document){const r=Uhe(e,n).findIndex((e=>e.getAttribute(zfe)===t));return null!=r?r:null}function Vhe(e,t,n){const r=$he(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function Bhe(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 zhe(e,t=document){const n=t.querySelector(`[${zfe}="${e}"]`);return n||null}function Hhe({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),qfe((()=>{if(!a)return;const e=Uhe(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=Fhe({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];khe(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;khe(e,"Eager values not found");const{panelDataArray:n}=e;khe(null!=Bhe(r,a),`No group found for id "${r}"`);const i=Uhe(r,a);khe(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(zfe);khe(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=zhe(t,r),c=Uhe(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];khe(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=Ihe({delta:Lhe(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:Vhe(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 qhe(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 Ghe(e,t){const n="horizontal"===e,{x:r,y:o}=ihe(t);return n?r:o}function Khe(e,t,n,r,o,i){if(nhe(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=zhe(t,o);khe(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(Lfe);khe(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Ghe(n,e),u=Bhe(s,o);khe(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 Whe(e,t,n){t.forEach(((t,r)=>{const o=e[r];khe(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&&!jhe(u,l)||jhe(t,l)||r(),!e||null!=u&&jhe(u,l)||!jhe(t,l)||e())}}))}function Yhe(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 Xhe(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 Zhe(e){return`react-resizable-panels:${e}`}function Qhe(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 Jhe(e,t){try{const n=Zhe(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 eme(e,t,n,r,o){var i;const a=Zhe(e),s=Qhe(t),l=null!==(i=Jhe(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 tme({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(!Lhe(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];khe(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];khe(null!=e,`No layout data found for index ${i}`);const r=Dhe({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!Lhe(o,0))for(let i=0;i<t.length;i++){const e=n[i];khe(null!=e,`No layout data found for index ${i}`);const r=Dhe({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,Lhe(o,0)))break}return n}const nme={getItem:e=>(Xhe(nme),nme.getItem(e)),setItem:(e,t)=>{Xhe(nme),nme.setItem(e,t)}},rme={};function ome({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=nme,style:u,tagName:d="div",...p}){const f=Yfe(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=tme({layout:e,panelConstraints:r.map((e=>e.constraints))});qhe(n,o)||(y(o),E.current.layout=o,t&&t(o),Whe(r,o,x.current))}})),[]),qfe((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),Hhe({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=rme[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(eme,100),rme[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}=sme(r,e,n);if(khe(null!=a,`Panel size not found for panel "${e.id}"`),!jhe(a,i)){w.current.set(e.id,a);const l=Ihe({delta:ame(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Yhe(n,l)||(y(l),E.current.layout=l,t&&t(l),Whe(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}=sme(o,e,r),u=null!=t?t:l;if(jhe(s,a)){const t=w.current.get(e.id),a=null!=t&&t>=u?t:u,l=Ihe({delta:ame(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});Yhe(r,l)||(y(l),E.current.layout=l,n&&n(l),Whe(o,l,x.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=sme(n,e,t);return khe(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),N=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=ame(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}=sme(n,e,t);return khe(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&jhe(i,r)}),[]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=sme(n,e,t);return khe(null!=i,`Panel size not found for panel "${e.id}"`),!o||Mhe(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]);qfe((()=>{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=Jhe(e,n))&&void 0!==r?r:{})[Qhe(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];khe(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];khe(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=tme({layout:i,panelConstraints:o.map((e=>e.constraints))});qhe(r,a)||(y(a),E.current.layout=a,t&&t(a),Whe(o,a,x.current))}})),qfe((()=>{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=Vhe(a,e,r);let f=Khe(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=Ihe({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:nhe(n)?"keyboard":"mouse-or-touch"}),v=!Yhe(c,g);(rhe(n)||ohe(n))&&_.current!=f&&(_.current=f,Ahe(e,v||0===f?0:m?f<0?phe:fhe:f<0?hhe:mhe)),v&&(y(g),E.current.layout=g,l&&l(g),Whe(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}=sme(o,e,r);khe(null!=a,`Panel size not found for panel "${e.id}"`);const l=Ihe({delta:ame(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});Yhe(r,l)||(y(l),E.current.layout=l,n&&n(l),Whe(o,l,x.current))}),[]),j=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}=sme(r,e,n);null!=u&&(i&&s&&jhe(u,o)?jhe(o,a)||M(e,a):u<c?M(e,c):u>l&&M(e,l))}),[M]),L=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=zhe(e,h.current);khe(o,`Drag handle element not found for id "${e}"`);const i=Ghe(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),D=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=ame(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:j,registerPanel:P,registerResizeHandle:k,resizePanel:M,startDragging:L,stopDragging:D,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,N,f,R,O,j,P,k,M,L,D,I]);return n.createElement(kfe.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},[Mfe]:"",[jfe]:o,[Lfe]:f}))}const ime=n.forwardRef(((e,t)=>n.createElement(ome,{...e,forwardedRef:t})));function ame(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function sme(e,t,n){const r=ame(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function lme({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(kfe);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=Yfe(i),[N,R]=n.useState("inactive"),[O,P]=n.useState(!1),[k,M]=n.useState(null),j=n.useRef({state:N});qfe((()=>{j.current.state=N})),n.useEffect((()=>{if(r)M(null);else{const e=S(A);M((()=>e))}}),[r,A,S]);const L=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,D=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;khe(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=bhe.get(a))&&void 0!==i?i:0;return bhe.set(a,l+1),whe.add(s),Ohe(),function(){var t;xhe.delete(e),whe.delete(s);const n=null!==(t=bhe.get(a))&&void 0!==t?t:1;if(bhe.set(a,n-1),Ohe(),1===n&&bhe.delete(a),vhe.includes(s)){const e=vhe.indexOf(s);e>=0&&vhe.splice(e,1),Nhe(),o("up",!0,null)}}}(A,e,w,{coarse:L,fine:D},((e,n,r)=>{if(n)switch(e){case"down":{R("drag"),t=!1,khe(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}=j.current;t=!0,"drag"!==e&&R("hover"),khe(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")}))}),[L,w,r,D,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=zhe(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(Lfe);khe(r,`No group element found for id "${r}"`);const i=Uhe(r,o),a=$he(r,t,o);khe(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,[jfe]:w,[Lfe]:_,[$fe]:"",[Vfe]:"drag"===N?"pointer":O?"keyboard":void 0,[Bfe]:!r,[zfe]:A,[Hfe]:N})}ome.displayName="PanelGroup",ime.displayName="forwardRef(PanelGroup)",lme.displayName="PanelResizeHandle";const cme=({className:e,...n})=>t.jsx(ime,{className:wB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),ume=Zfe,dme=({withHandle:e,className:n,...r})=>t.jsx(lme,{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 pme=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(pme||{});const fme=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),hme="rgba(245, 246, 247, 1)",mme={[$e.SEND_COMMUNICATION]:{color:{bg:hme},clickable:!0},[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:hme},clickable:!1}},gme={[$e.SEND_COMMUNICATION]:"Send Email & SMS",[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},vme=({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:hme},onClick:n,className:Zd("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:Zd("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:Zd("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})},yme=({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}),bme=()=>{const e=iZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=ZX(),u=n.useCallback((()=>c?.find((e=>e.type===nZ.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(vme,{selected:o===pme.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(pme.EditAudience)},Icon:xZ.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(fme,{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(yme,{segmentName:n.name},e):null}))})]})]})})}):null},xme=()=>{const e=iZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),{segments:i}=ZX(),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(vme,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:xZ.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(fme,{copyText:`When ${ff("engage:user").toLowerCase()} joins the`}),t.jsx(yme,{segmentName:r})]})]})}):null}case Fe.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(vme,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(pme.EditTime)},selected:o===pme.EditTime,Icon:xZ.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(fme,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(yme,{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)}})()})},wme=e=>{switch(e){case $e.SEND_COMMUNICATION:return"Send Communication";case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw LX(e,$e)}},_me=e=>{switch(e){case $e.SEND_COMMUNICATION:return t.jsx(xZ.CommunicationIcon,{className:"w-4 h-4"});case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(xZ.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw Xte(e,$e)}},Sme=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}`},Eme=({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=mme[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:Zd("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??hme},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:_me(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:gme[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:Sme(r.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:r.actionType===$e.SEND_COMMUNICATION&&o?.emailSubject?o?.emailSubject:wme(r.actionType)})]})]})})},Tme=()=>{const[e,r]=n.useState(!1),[o,i]=n.useState(void 0),[a,s]=n.useState(!1),[l,c]=n.useState(""),[u,d]=n.useState(null),p=iZ(),{setActionId:f,state:{selectedActionId:h}}=n.useContext(VX),{updateAutomation:m}=Le(p?.id||""),{toast:g}=jl();if(n.useEffect((()=>{if(!p)return;if(h)return;const e=p.actionData?.find((e=>"send_communication"===e.actionType));e&&f(e.actionMetadata.currentActionId)}),[p,f,h]),n.useEffect((()=>{if(!p)return;(async()=>{const e=[];for(const t of p.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 LX(t.actionType,$e)}i(e)})()}),[p]),n.useEffect((()=>{d(null),c(p?.description??"")}),[p?.description]),!p||!o)return null;const v=(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:p.triggerMetadata?.triggerType===Fe.TRIGGER_BASED?p.triggerMetadata.rootActionId:void 0}).filter((t=>!!e||"send_communication"===t.actionData.actionType));let y=()=>t.jsx("div",{});(e||p.triggerType===Fe.ONE_TIME)&&(y=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[p.triggerType===Fe.ONE_TIME&&t.jsx(bme,{}),p.triggerType!==Fe.ONE_TIME&&t.jsx(xme,{})]}));const b=async()=>{d(l),m({description:l},{onSuccess:()=>{g({title:"Description updated 🚀"}),s(!1)}})};return t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[p.description||a?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 group relative transition-colors duration-150",style:{containerType:"inline-size"},tabIndex:0,onClick:()=>{s(!0)},role:"button","aria-label":"Edit automation description",children:a?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("textarea",{className:"w-full bg-transparent outline-none resize-none text-[15px] font-medium leading-snug tracking-tight text-neutral-800 dark:text-neutral-100 rounded-xl border border-primary-500 focus:ring-2 focus:ring-primary-400 transition-all min-h-[48px] p-2",style:{containerType:"inline-size"},value:l,autoFocus:!0,rows:2,maxLength:300,onChange:e=>c(e.target.value),onBlur:()=>{s(!1)},"aria-label":"Edit automation description textarea"}),t.jsx(gZ,{variant:"secondary",onClick:b,onMouseDown:e=>e.preventDefault(),className:"z-20",children:"Update Description"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"pr-8 select-text cursor-pointer",children:null!==u?u:p.description}),t.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity duration-150 pointer-events-none",children:t.jsx(xZ.EditIcon,{className:"w-4 h-4"})})]})}):null,p.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:[y(),v.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(Eme,{actionDataWithMetadata:e})},e.actionData.actionMetadata?.currentActionId??n))),p.triggerType===Fe.ONE_TIME&&t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx(xme,{})})]})})]})},Cme=()=>{const e=iZ(),{segments:n}=ZX();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(Tme,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(fZ,{text:[`Getting details on your ${ff("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},Ame=({hideSms:e})=>{const{state:{selectedActionId:r}}=n.useContext(VX);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(zB,{mode:"wait",children:r===pme.EditTime?t.jsx(Rse,{}):r===pme.EditAudience?t.jsx(wle,{}):t.jsx(wre,{hideSms:e})})})},Nme=({hideSms:e})=>t.jsxs(cme,{direction:"horizontal",className:"flex-1",children:[t.jsx(ume,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(Cme,{})})}),t.jsx(dme,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(ume,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(Ame,{hideSms:e})})})]}),Rme=({hideSms:e,hideSales:r})=>{const[o,i]=n.useState("workflow"),a=[{id:"workflow",label:"Workflow",content:t.jsx(Nme,{hideSms:e})},{id:"recipients",label:"Recipients",content:t.jsx(Pfe,{})},{id:"insights",label:ff("engage:insight",{count:2}),content:t.jsx(Ofe,{hideSms:e,hideSales:r})}];return t.jsx("div",{className:"h-full w-full",children:t.jsx(kle,{tabs:a,activeTab:o,onTabChange:i,tabsLocation:"left"})})},Ome=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i,hideSms:a,hideSales:s})=>{const l=iZ(),c=aZ(),{updateCommunicationGroup:u}=GX(),{toast:d}=jl();return n.useEffect((()=>{if(c&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(c.extraMergeFields)&&u({groupId:c?.id,params:{extraMergeFields:e}},{onError:e=>{d({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[c,i,u,d]),l&&c?t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(Rfe,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(Rme,{hideSms:a,hideSales:s})})]}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(fZ,{text:[`Fetching ${ff("engage:automation").toLowerCase()} data`,"Finishing up"]})})},Pme=({...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(lZ,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(Ome,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var kme=e=>null!=e;var Mme=e=>"function"!=typeof e||e.length?e:e(),jme=e=>Array.isArray(e)?e:e?[e]:[];var Lme=mt;var Dme,Ime=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(ZSe){return r(ZSe,`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(ZSe){r(ZSe,`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(ZSe){r(ZSe,`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(ZSe){r(ZSe,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(ZSe){r(ZSe,`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(ZSe){r(ZSe,`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(ZSe){r(ZSe,`Error getting all values from ${e.name}`)}}})),t}}]},Fme=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},Ume=("function"==typeof(Dme={_cookies:[globalThis.document,"cookie"],getItem:e=>Ume._cookies[0][Ume._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=Ume.getItem(e);Ume._cookies[0][Ume._cookies[1]]=`${e}=${t}${Fme(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:Ume});window.dispatchEvent(o)},removeItem:e=>{Ume._cookies[0][Ume._cookies[1]]=`${e}=deleted${Fme({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return Ume._cookies[0][Ume._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return Ume._cookies[0][Ume._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(Dme.clear=()=>{let e;for(;e=Dme.key(0);)Dme.removeItem(e)}),Dme),$me=796,Vme="bottom",Bme="system",zme=Object.keys(Nr)[0],Hme=Object.keys(Pr)[0],qme=xt({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Gme(){return wt(qme)}var Kme=xt(void 0),Wme=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)})),[...(Gme().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(XSe){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=(Gme().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(Gme().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(Kme.Provider,{value:i,get children(){return e.children}})},Yme=()=>ut((()=>{const e=wt(Kme);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Xme=xt((()=>"dark"));function Zme(){return wt(Xme)}var Qme={"À":"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"},Jme=Object.keys(Qme).join("|"),ege=new RegExp(Jme,"g");var tge=7,nge=6,rge=5,oge=4,ige=3,age=2,sge=1,lge=0;function cge(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:sge,!n.accessors){const r=uge(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=hge(o),a=pge(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:lge,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=uge(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=sge?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 uge(e,t,n){return e=dge(e,n),(t=dge(t,n)).length>e.length?lge:e===t?tge:(e=e.toLowerCase())===(t=t.toLowerCase())?nge:e.startsWith(t)?rge:e.includes(` ${t}`)?oge:e.includes(t)?ige:1===t.length?lge:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?age: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 sge+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return lge;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return lge}return i(r-a)}(e,t)}function dge(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(ege,(e=>Qme[e]))),e}function pge(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 fge={maxRanking:1/0,minRanking:-1/0};function hge(e){return"function"==typeof e?fge:{...fge,...e}}var mge={data:""},gge=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,vge=/\/\*[^]*?\*\/| +/g,yge=/\n+/g,bge=(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]?bge(a,i):i+"{"+bge(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=bge(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+=bge.p?bge.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},xge={},wge=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+wge(e[n]);return t}return e};function _ge(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=wge(e),a=xge[i]||(xge[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!xge[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=gge.exec(e.replace(vge,""));)t[4]?r.shift():t[3]?(n=t[3].replace(yge," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(yge," ").trim();return r[0]})(e);xge[a]=bge(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&xge.g?xge.g:null;return n&&(xge.g=xge[a]),l=xge[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?"":bge(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||mge),t.g,t.o,t.k);var r}function Sge(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=Sge(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ege(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Sge(e))&&(r&&(r+=" "),r+=t);return r}function Tge(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 Cge(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}_ge.bind({g:1}),_ge.bind({k:1});var Age=e=>e instanceof Element;function Nge(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return Nge(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=Nge(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function Rge(e,t=Age,n=Age){const r=ut(e),o=ut((()=>Nge(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function Oge(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function Pge(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()))})),Oge((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function kge(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())),Oge((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var Mge=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 Tge(Rge((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)Pge(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)kge(a,e,t,(()=>o([t])))}})},jge=Symbol("fallback");function Lge(e){for(const t of e)t.dispose()}function Dge(e){const{by:t}=e;return ut(function(e,t,n,r={}){const o=new Map;return mt((()=>Lge(o.values()))),()=>{const n=e()||[];return pt((()=>{if(!n.length)return Lge(o.values()),o.clear(),r.fallback?[it((e=>(o.set(jge,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(jge);if(!o.size||a){a?.dispose(),o.delete(jge);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 Ige(e,t,n,r){const o=()=>{jme(Mme(e)).forEach((e=>{e&&jme(Mme(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),Lme(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?ct(o):lt(o)}function Fge(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=jme(Mme(e)).filter(kme);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 Uge=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function $ge(e){const t={};let n;for(;n=Uge.exec(e);)t[n[1]]=n[2];return t}function Vge(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=$ge(e)}else"string"==typeof t&&(t=$ge(t));return{...e,...t}}function Bge(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function zge(e){return"[object String]"===Object.prototype.toString.call(e)}function Hge(e){return t=>`${e()}-${t}`}function qge(e,t){return!!e&&(e===t||e.contains(t))}function Gge(e,t=!1){const{activeElement:n}=Kge(e);if(!n?.nodeName)return null;if(Wge(n)&&n.contentDocument)return Gge(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Kge(n).getElementById(e);if(t)return t}}return n}function Kge(e){return e?e.ownerDocument||e:document}function Wge(e){return"IFRAME"===e.tagName}var Yge=(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))(Yge||{});function Xge(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function Zge(){return Xge(/^Mac/i)}function Qge(){return Xge(/^iPhone/i)||Xge(/^iPad/i)||Zge()&&navigator.maxTouchPoints>1}function Jge(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function eve(e){return t=>{for(const n of e)Jge(t,n)}}function tve(e){return Zge()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function nve(e){if(e)if(function(){if(null==rve){rve=!1;try{document.createElement("div").focus({get preventScroll(){return rve=!0,!0}})}catch(XSe){}}return rve}())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 rve=null;var ove=["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'])"],ive=[...ove,'[tabindex]:not([tabindex="-1"]):not([disabled])'],ave=ove.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",sve=ive.join(':not([hidden]):not([tabindex="-1"]),');function lve(e,t){const n=Array.from(e.querySelectorAll(ave)).filter(cve);return t&&cve(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Wge(e)&&e.contentDocument){const r=lve(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function cve(e){return uve(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function uve(e){return e.matches(ave)&&dve(e)}function dve(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||dve(e.parentElement,e))}function pve(e){for(;e&&!fve(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function fve(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function hve(){}function mve(e,t){return qt(e,t)}var gve=new Map,vve=new Set;function yve(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=gve.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),gve.delete(t.target)),0===gve.size)){for(const e of vve)e();vve.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=gve.get(t.target);n||(n=new Set,gve.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function bve(e,t){const n=xve(e,t,"left"),r=xve(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 xve(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?yve():document.addEventListener("DOMContentLoaded",yve));var wve={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 _ve(e){return t=>(e(t),()=>e(void 0))}function Sve(e,t){const[n,r]=at(Eve(t?.()));return ct((()=>{r(e()?.tagName.toLowerCase()||Eve(t?.()))})),n}function Eve(e){return zge(e)?e:void 0}function Tve(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 Cve=["id","name","validationState","required","disabled","readOnly"];var Ave=xt();function Nve(){const e=wt(Ave);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function Rve(e){const t=Nve(),n=mve({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Tve,qt({as:"div"},(()=>t.dataset()),n))}function Ove(e){const t=Nve(),n=mve({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(Tve,qt({as:"div"},(()=>t.dataset()),o))}})}function Pve(e){let t;const n=Nve(),r=mve({id:n.generateId("label")},e),[o,i]=Gt(r,["ref"]),a=Sve((()=>t),(()=>"label"));return ct((()=>mt(n.registerLabel(i.id)))),$t(Tve,qt({as:"label",ref(e){const n=Cge((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ut((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function kve(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 Mve(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 jve(e){const[t,n]=Mve(e);return[()=>t()??!1,n]}var Lve=Object.defineProperty,Dve=(e,t)=>{for(var n in t)Lve(e,n,{get:t[n],enumerable:!0})},Ive=xt();function Fve(){return wt(Ive)}function Uve(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function $ve(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?Uve(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 Vve(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){ct((()=>{const n=setTimeout((()=>{$ve(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 Kge(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&$ve(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}mt((()=>o.disconnect()))}))}function Bve(e={}){const[t,n]=function(e){const[t,n]=Mve(e);return[()=>t()??[],n]}({value:()=>Mme(e.items),onChange:t=>e.onItemsChange?.(t)});Vve(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&&Uve(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(Ive.Provider,{value:{registerItem:r},get children(){return e.children}})}}function zve(e){const t=function(){const e=Fve();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=mve({shouldRegisterItem:!0},e);ct((()=>{if(!n.shouldRegisterItem)return;mt(t.registerItem(n.getItem()))}))}function Hve(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=zge(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=zge(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(zge(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return zge(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(zge(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=Hve({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 qve(e,t=[]){return ut((()=>{const n=Hve({dataSource:Mme(e.dataSource),getKey:Mme(e.getKey),getTextValue:Mme(e.getTextValue),getDisabled:Mme(e.getDisabled),getSectionChildren:Mme(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var Gve=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Kve=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Wve(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return Gve.has(t)}const t=e.split("-")[0];return Kve.has(t)}(e)?"rtl":"ltr"}function Yve(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Wve(e)}}var Xve=Yve(),Zve=new Set;function Qve(){Xve=Yve();for(const e of Zve)e(Xve)}var Jve=xt();function eye(){const e=function(){const[e,t]=at(Xve),n=ut((()=>e()));return ht((()=>{0===Zve.size&&window.addEventListener("languagechange",Qve),Zve.add(t),mt((()=>{Zve.delete(t),0===Zve.size&&window.removeEventListener("languagechange",Qve)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return wt(Jve)||e}var tye=new Map;var nye=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 rye(e){return Zge()||Qge()?e.altKey:e.ctrlKey}function oye(e){return Zge()?e.metaKey:e.ctrlKey}function iye(e){return new nye(e)}function aye(e){const t=mve({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=at(!1),[o,i]=at(),a=ut((()=>{const e=Mme(t.selectedKeys);return null!=e?iye(e):e})),s=ut((()=>{const e=Mme(t.defaultSelectedKeys);return null!=e?iye(e):new nye})),[l,c]=function(e){const[t,n]=Mve(e);return[()=>t()??new nye,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=at(Mme(t.selectionBehavior));return ct((()=>{const e=l();"replace"===Mme(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),ct((()=>{d(Mme(t.selectionBehavior)??"toggle")})),{selectionMode:()=>Mme(t.selectionMode),disallowEmptySelection:()=>Mme(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!Mme(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 sye(e,t,n){const r=qt({selectOnFocus:()=>"replace"===Mme(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=eye();let a={top:0,left:0};Ige((()=>Mme(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(Mme(e.isDisabled))return;const a=Mme(e.keyboardDelegate),s=Mme(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:()=>Mme(r.disallowTypeAhead),keyboardDelegate:()=>Mme(r.keyboardDelegate),selectionManager:()=>Mme(r.selectionManager)}),l=()=>Mme(r.orientation)??"vertical",c=()=>{const e=Mme(r.autoFocus);if(!e)return;const n=Mme(r.selectionManager),o=Mme(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&&!Mme(r.shouldUseVirtualFocus)&&nve(s)};ht((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),ct(ft([o,()=>Mme(r.isVirtualized),()=>Mme(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&&bve(t,e)}})));return{tabIndex:ut((()=>{if(!Mme(r.shouldUseVirtualFocus))return null==Mme(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{Jge(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=Mme(r.selectionManager),a=Mme(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!rye(e)&&o.replaceSelection(t))},u=Mme(r.keyboardDelegate),d=Mme(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,oye(e));null!=t&&(o.setFocusedKey(t),oye(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,oye(e));null!=t&&(o.setFocusedKey(t),oye(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":oye(e)&&"multiple"===o.selectionMode()&&!0!==Mme(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),Mme(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!Mme(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?sve:ave,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&dve(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)&&nve(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=Mme(r.selectionManager),n=Mme(r.keyboardDelegate),i=Mme(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(!Mme(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(nve(n),bve(e,n))}}},onFocusOut:e=>{const t=Mme(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function lye(e,t){const n=()=>Mme(e.selectionManager),r=()=>Mme(e.key),o=()=>Mme(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()||oye(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>Mme(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((()=>Mme(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():nve(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||Mme(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&Mme(e.shouldSelectOnPressUp)&&Mme(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(Mme(e.shouldSelectOnPressUp)&&!Mme(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(rye(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 cye=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 nye(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 nye(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 nye([t],t,t):new nye;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new nye;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 nye)}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}},uye=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 dye,pye=e=>"function"==typeof e?e():e,fye=e=>{const t=ut((()=>{const t=pye(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=at(pye(e.show)?"present":"hidden");let i="none";return ct((r=>{const a=pye(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=pye(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}},hye="data-kb-top-layer",mye=!1,gye=[];function vye(e){return gye.findIndex((t=>t.node===e))}function yye(){return gye.filter((e=>e.isPointerBlocking))}function bye(){return yye().length>0}function xye(e){const t=vye([...yye()].slice(-1)[0]?.node);return vye(e)<t}var wye={layers:gye,isTopMostLayer:function(e){return gye[gye.length-1].node===e},hasPointerBlockingLayer:bye,isBelowPointerBlockingLayer:xye,addLayer:function(e){gye.push(e)},removeLayer:function(e){const t=vye(e);t<0||gye.splice(t,1)},indexOf:vye,find:function(e){return gye[vye(e)]},assignPointerEventToLayers:function(){for(const{node:e}of gye)e.style.pointerEvents=xye(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(bye()&&!mye){const t=Kge(e);dye=document.body.style.pointerEvents,t.body.style.pointerEvents="none",mye=!0}},restoreBodyPointerEvents:function(e){if(bye())return;const t=Kge(e);t.body.style.pointerEvents=dye,0===t.body.style.length&&t.body.removeAttribute("style"),mye=!1}};Dve({},{Button:()=>Eye,Root:()=>Sye});var _ye=["button","color","file","image","reset","submit"];function Sye(e){let t;const n=mve({type:"button"},e),[r,o]=Gt(n,["ref","type","disabled"]),i=Sve((()=>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!==_ye.indexOf(e.type)}({tagName:e,type:r.type})})),s=ut((()=>"input"===i())),l=ut((()=>"a"===i()&&null!=t?.getAttribute("href")));return $t(Tve,qt({as:"button",ref(e){const n=Cge((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 Eye=Sye,Tye=["top","right","bottom","left"],Cye=Math.min,Aye=Math.max,Nye=Math.round,Rye=Math.floor,Oye=e=>({x:e,y:e}),Pye={left:"right",right:"left",bottom:"top",top:"bottom"},kye={start:"end",end:"start"};function Mye(e,t,n){return Aye(e,Cye(t,n))}function jye(e,t){return"function"==typeof e?e(t):e}function Lye(e){return e.split("-")[0]}function Dye(e){return e.split("-")[1]}function Iye(e){return"x"===e?"y":"x"}function Fye(e){return"y"===e?"height":"width"}function Uye(e){return["top","bottom"].includes(Lye(e))?"y":"x"}function $ye(e){return Iye(Uye(e))}function Vye(e){return e.replace(/start|end/g,(e=>kye[e]))}function Bye(e){return e.replace(/left|right|bottom|top/g,(e=>Pye[e]))}function zye(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 Hye(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 qye(e,t,n){let{reference:r,floating:o}=e;const i=Uye(t),a=$ye(t),s=Fye(a),l=Lye(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(Dye(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function Gye(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}=jye(t,e),h=zye(f),m=s[p?"floating"===d?"reference":"floating":d],g=Hye(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=Hye(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 Kye(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wye(e){return Tye.some((t=>e[t]>=0))}function Yye(e){return Qye(e)?(e.nodeName||"").toLowerCase():"#document"}function Xye(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Zye(e){var t;return null==(t=(Qye(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Qye(e){return e instanceof Node||e instanceof Xye(e).Node}function Jye(e){return e instanceof Element||e instanceof Xye(e).Element}function ebe(e){return e instanceof HTMLElement||e instanceof Xye(e).HTMLElement}function tbe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Xye(e).ShadowRoot)}function nbe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=lbe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function rbe(e){return["table","td","th"].includes(Yye(e))}function obe(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(XSe){return!1}}))}function ibe(e){const t=abe(),n=Jye(e)?lbe(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 abe(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function sbe(e){return["html","body","#document"].includes(Yye(e))}function lbe(e){return Xye(e).getComputedStyle(e)}function cbe(e){return Jye(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ube(e){if("html"===Yye(e))return e;const t=e.assignedSlot||e.parentNode||tbe(e)&&e.host||Zye(e);return tbe(t)?t.host:t}function dbe(e){const t=ube(e);return sbe(t)?e.ownerDocument?e.ownerDocument.body:e.body:ebe(t)&&nbe(t)?t:dbe(t)}function pbe(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=dbe(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Xye(o);return i?t.concat(a,a.visualViewport||[],nbe(o)?o:[],a.frameElement&&n?pbe(a.frameElement):[]):t.concat(o,pbe(o,[],n))}function fbe(e){const t=lbe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ebe(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Nye(n)!==i||Nye(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function hbe(e){return Jye(e)?e:e.contextElement}function mbe(e){const t=hbe(e);if(!ebe(t))return Oye(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=fbe(t);let a=(i?Nye(n.width):n.width)/r,s=(i?Nye(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var gbe=Oye(0);function vbe(e){const t=Xye(e);return abe()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gbe}function ybe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=hbe(e);let a=Oye(1);t&&(r?Jye(r)&&(a=mbe(r)):a=mbe(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Xye(e))&&t}(i,n,r)?vbe(i):Oye(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=Xye(i),t=r&&Jye(r)?Xye(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=mbe(o),t=o.getBoundingClientRect(),r=lbe(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=Xye(o),o=n.frameElement}}return Hye({width:u,height:d,x:l,y:c})}function bbe(e){return ybe(Zye(e)).left+cbe(e).scrollLeft}function xbe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Xye(e),r=Zye(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=abe();(!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=Zye(e),n=cbe(e),r=e.ownerDocument.body,o=Aye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Aye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+bbe(e);const s=-n.scrollTop;return"rtl"===lbe(r).direction&&(a+=Aye(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Zye(e));else if(Jye(t))r=function(e,t){const n=ybe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=ebe(e)?mbe(e):Oye(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=vbe(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Hye(r)}function wbe(e,t){const n=ube(e);return!(n===t||!Jye(n)||sbe(n))&&("fixed"===lbe(n).position||wbe(n,t))}function _be(e,t,n){const r=ebe(t),o=Zye(t),i="fixed"===n,a=ybe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Oye(0);if(r||!r&&!i)if(("body"!==Yye(t)||nbe(o))&&(s=cbe(t)),r){const e=ybe(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=bbe(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Sbe(e){return"static"===lbe(e).position}function Ebe(e,t){return ebe(e)&&"fixed"!==lbe(e).position?t?t(e):e.offsetParent:null}function Tbe(e,t){const n=Xye(e);if(obe(e))return n;if(!ebe(e)){let t=ube(e);for(;t&&!sbe(t);){if(Jye(t)&&!Sbe(t))return t;t=ube(t)}return n}let r=Ebe(e,t);for(;r&&rbe(r)&&Sbe(r);)r=Ebe(r,t);return r&&sbe(r)&&Sbe(r)&&!ibe(r)?n:r||function(e){let t=ube(e);for(;ebe(t)&&!sbe(t);){if(ibe(t))return t;if(obe(t))return null;t=ube(t)}return null}(e)||n}var Cbe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Zye(r),s=!!t&&obe(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Oye(1);const u=Oye(0),d=ebe(r);if((d||!d&&!i)&&(("body"!==Yye(r)||nbe(a))&&(l=cbe(r)),ebe(r))){const e=ybe(r);c=mbe(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:Zye,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?obe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=pbe(e,[],!1).filter((e=>Jye(e)&&"body"!==Yye(e))),o=null;const i="fixed"===lbe(e).position;let a=i?ube(e):e;for(;Jye(a)&&!sbe(a);){const t=lbe(a),n=ibe(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||nbe(a)&&!n&&wbe(e,a))?r=r.filter((e=>e!==a)):o=t,a=ube(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=xbe(t,n,o);return e.top=Aye(r.top,e.top),e.right=Cye(r.right,e.right),e.bottom=Cye(r.bottom,e.bottom),e.left=Aye(r.left,e.left),e}),xbe(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Tbe,getElementRects:async function(e){const t=this.getOffsetParent||Tbe,n=this.getDimensions,r=await n(e.floating);return{reference:_be(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}=fbe(e);return{width:t,height:n}},getScale:mbe,isElement:Jye,isRTL:function(e){return"rtl"===lbe(e).direction}};function Abe(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=hbe(e),u=o||i?[...c?pbe(c):[],...pbe(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=Zye(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:-Rye(u)+"px "+-Rye(o.clientWidth-(c+d))+"px "+-Rye(o.clientHeight-(u+p))+"px "+-Rye(c)+"px",threshold:Aye(0,Cye(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(XSe){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?ybe(e):null;return l&&function t(){const r=ybe(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 Nbe=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=Lye(n),s=Dye(n),l="y"===Uye(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=jye(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}}}}},Rbe=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}=jye(e,t),c={x:n,y:r},u=await Gye(t,l),d=Uye(Lye(o)),p=Iye(d);let f=c[p],h=c[d];if(i){f=Mye(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=Mye(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}}}}},Obe=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}=jye(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Lye(o),y=Uye(s),b=Lye(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[Bye(s)]:function(e){const t=Bye(e);return[Vye(e),t,Vye(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=Dye(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[]}}(Lye(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Vye)))),i}(s,m,h,x));const S=[s,...w],E=await Gye(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=Dye(e),o=$ye(e),i=Fye(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Bye(a)),[a,Bye(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=Uye(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{}}}},Pbe=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}=jye(e,t),l=await Gye(t,s),c=Lye(n),u=Dye(n),d="y"===Uye(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=Cye(f-l[h],g),b=Cye(p-l[m],v),x=!t.middlewareData.shift;let w=y,_=b;if(d?_=u||x?Cye(b,v):v:w=u||x?Cye(y,g):g,x&&!u){const e=Aye(l.left,0),t=Aye(l.right,0),n=Aye(l.top,0),r=Aye(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:Aye(l.left,l.right)):w=f-2*(0!==n||0!==r?n+r:Aye(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}}:{}}}},kbe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=jye(e,t);switch(r){case"referenceHidden":{const e=Kye(await Gye(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Wye(e)}}}case"escaped":{const e=Kye(await Gye(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Wye(e)}}}default:return{}}}}},Mbe=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}=jye(e,t)||{};if(null==c)return{};const d=zye(u),p={x:n,y:r},f=$ye(o),h=Fye(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=Cye(d[v],T),A=Cye(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=Mye(N,O,R),k=!l.arrow&&null!=Dye(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}}}),jbe=(e,t,n)=>{const r={platform:Cbe,...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}=qye(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}=qye(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},Lbe=xt();function Dbe(){const e=wt(Lbe);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var Ibe=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">'),Fbe={top:180,right:-90,bottom:0,left:90};function Ube(e){const t=Dbe(),n=mve({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,Kge(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return $t(Tve,qt({as:"div",ref(e){const n=Cge(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Vge({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=Ibe(),t=e.firstChild;return lt((()=>hn(t,"transform",`rotate(${Fbe[i()]} 15 15) translate(0 2)`))),e}}))}function $be(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 Vbe(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var Bbe={top:"bottom",right:"left",bottom:"top",left:"right"};var zbe=Object.assign((function(e){const t=mve({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?$be(t):e?e.getBoundingClientRect():$be()}};var e,n},{direction:c}=eye();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=[Nbe((({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(Vbe))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(Obe({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(Rbe({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(Pbe({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(kbe({padding:t.detachedPadding})),i&&d.push(Mbe({element:i,padding:t.arrowPadding}));const p=await jbe(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...Cbe,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=Bbe[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(Abe(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),ct((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),$t(Lbe.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:Ube,Context:Lbe,usePopperContext:Dbe,Positioner:function(e){const t=Dbe(),[n,r]=Gt(e,["ref","style"]);return $t(Tve,qt({as:"div",ref(e){const r=Cge(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return Vge({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var Hbe="interactOutside.pointerDownOutside",qbe="interactOutside.focusOutside";var Gbe=xt();function Kbe(e){let t;const n=wt(Gbe),[r,o]=Gt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=hve;const o=()=>Kge(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(`[${hye}]`)&&!!qge(o(),r)&&!qge(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=eve([i,s]);r.addEventListener(Hbe,o,{once:!0});const a=new CustomEvent(Hbe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||tve(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=eve([a,s]);r.addEventListener(qbe,o,{once:!0});const i=new CustomEvent(qbe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};ct((()=>{Mme(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=>qge(t(),e)))||[...i].some((t=>qge(t,e)))),onPointerDownOutside:e=>{t&&!wye.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||wye.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===Yge.Escape&&e.onEscapeKeyDown?.(t)};ct((()=>{if(Mme(e.isDisabled))return;const n=e.ownerDocument?.()??Kge();n.addEventListener("keydown",t),mt((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Kge(t),onEscapeKeyDown:e=>{t&&wye.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),ht((()=>{if(!t)return;wye.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);wye.assignPointerEventToLayers(),wye.disableBodyPointerEvents(t),mt((()=>{t&&(wye.removeLayer(t),e?.(),wye.assignPointerEventToLayers(),wye.restoreBodyPointerEvents(t))}))})),ct(ft([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=wye.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,wye.assignPointerEventToLayers()),t&&wye.disableBodyPointerEvents(e),mt((()=>{wye.restoreBodyPointerEvents(e)}))}),{defer:!0}));return $t(Gbe.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return $t(Tve,qt({as:"div",ref(e){const n=Cge((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Wbe(e={}){const[t,n]=jve({value:()=>Mme(e.open),defaultValue:()=>!!Mme(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 Ybe={};Dve(Ybe,{Description:()=>Rve,ErrorMessage:()=>Ove,Item:()=>exe,ItemControl:()=>txe,ItemDescription:()=>nxe,ItemIndicator:()=>rxe,ItemInput:()=>oxe,ItemLabel:()=>ixe,Label:()=>axe,RadioGroup:()=>lxe,Root:()=>sxe});var Xbe=xt();function Zbe(){const e=wt(Xbe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var Qbe=xt();function Jbe(){const e=wt(Qbe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function exe(e){const t=Nve(),n=Zbe(),r=mve({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=>{Jge(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:Hge((()=>i.id)),registerInput:_ve(s),registerLabel:_ve(c),registerDescription:_ve(d),setIsFocused:m,setInputRef:f};return $t(Qbe.Provider,{value:x,get children(){return $t(Tve,qt({as:"div",role:"group",onPointerDown:y},b,i))}})}function txe(e){const t=Jbe(),n=mve({id:t.generateId("control")},e),[r,o]=Gt(n,["onClick","onKeyDown"]);return $t(Tve,qt({as:"div",onClick:e=>{Jge(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{Jge(e,r.onKeyDown),e.key===Yge.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function nxe(e){const t=Jbe(),n=mve({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Tve,qt({as:"div"},(()=>t.dataset()),n))}function rxe(e){const t=Jbe(),n=mve({id:t.generateId("indicator")},e),[r,o]=Gt(n,["ref","forceMount"]),[i,a]=at(),{present:s}=fye({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return $t(Jt,{get when(){return s()},get children(){return $t(Tve,qt({as:"div",ref(e){const t=Cge(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function oxe(e){const t=Nve(),n=Zbe(),r=Jbe(),o=mve({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(Tve,qt({as:"input",ref(e){const t=Cge(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 Vge({...wve},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(Jge(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{Jge(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{Jge(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function ixe(e){const t=Jbe(),n=mve({id:t.generateId("label")},e);return ct((()=>mt(t.registerLabel(n.id)))),$t(Tve,qt({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function axe(e){return $t(Pve,qt({as:"span"},e))}function sxe(e){let t;const n=mve({id:`radiogroup-${Yt()}`,orientation:"vertical"},e),[r,o,i]=Gt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],Cve),[a,s]=Mve({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=mve({id:`form-control-${Yt()}`},e),[n,r]=at(),[o,i]=at(),[a,s]=at(),[l,c]=at();return{formControlContext:{name:()=>Mme(t.name)??Mme(t.id),dataset:ut((()=>({"data-valid":"valid"===Mme(t.validationState)?"":void 0,"data-invalid":"invalid"===Mme(t.validationState)?"":void 0,"data-required":Mme(t.required)?"":void 0,"data-disabled":Mme(t.disabled)?"":void 0,"data-readonly":Mme(t.readOnly)?"":void 0}))),validationState:()=>Mme(t.validationState),isRequired:()=>Mme(t.required),isDisabled:()=>Mme(t.disabled),isReadOnly:()=>Mme(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:Hge((()=>Mme(t.id))),registerLabel:_ve(r),registerField:_ve(i),registerDescription:_ve(s),registerErrorMessage:_ve(c)}}}(o);kve((()=>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(Ave.Provider,{value:l,get children(){return $t(Xbe.Provider,{value:d,get children(){return $t(Tve,qt({as:"div",ref(e){const n=Cge((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return Mme(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(Mme(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var lxe=Object.assign(sxe,{Description:Rve,ErrorMessage:Ove,Item:exe,ItemControl:txe,ItemDescription:nxe,ItemIndicator:rxe,ItemInput:oxe,ItemLabel:ixe,Label:axe}),cxe=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 uxe(e,t,n){const r=function(e){const{locale:t}=eye(),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 tye.has(r)&&(o=tye.get(r)),o||(o=new Intl.Collator(t(),e),tye.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return sye({selectionManager:()=>Mme(e.selectionManager),keyboardDelegate:ut((()=>{const n=Mme(e.keyboardDelegate);return n||new cxe(e.collection,t,r)})),autoFocus:()=>Mme(e.autoFocus),deferAutoFocus:()=>Mme(e.deferAutoFocus),shouldFocusWrap:()=>Mme(e.shouldFocusWrap),disallowEmptySelection:()=>Mme(e.disallowEmptySelection),selectOnFocus:()=>Mme(e.selectOnFocus),disallowTypeAhead:()=>Mme(e.disallowTypeAhead),shouldUseVirtualFocus:()=>Mme(e.shouldUseVirtualFocus),allowsTabNavigation:()=>Mme(e.allowsTabNavigation),isVirtualized:()=>Mme(e.isVirtualized),scrollToKey:t=>Mme(e.scrollToKey)?.(t),orientation:()=>Mme(e.orientation)},t)}var dxe="focusScope.autoFocusOnMount",pxe="focusScope.autoFocusOnUnmount",fxe={bubbles:!1,cancelable:!0},hxe={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=Bge(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=Bge(this.stack,e),this.active()?.resume()}};function mxe(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=()=>Kge(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,wve),e},u=()=>{const e=t();return e?lve(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;hxe.add(o);const n=Gge(e);if(!qge(e,n)){const t=new CustomEvent(dxe,fxe);e.addEventListener(dxe,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{nve(d()),Gge(e)===n&&nve(e)}),0)}mt((()=>{e.removeEventListener(dxe,a),setTimeout((()=>{const r=new CustomEvent(pxe,fxe);(()=>{const e=t();if(!e)return!1;const n=Gge(e);return!!n&&!qge(e,n)&&uve(n)})()&&r.preventDefault(),e.addEventListener(pxe,s),e.dispatchEvent(r),r.defaultPrevented||nve(n??l().body),e.removeEventListener(pxe,s),hxe.remove(o)}),0)}))})),ct((()=>{const r=t();if(!r||!Mme(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${hye}]`)||(qge(r,t)?i=t:nve(i))},a=e=>{const t=e.relatedTarget??Gge(r);t?.closest(`[${hye}]`)||qge(r,t)||nve(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),mt((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),ct((()=>{const r=t();if(!r||!Mme(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})();nve(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 gxe="data-live-announcer";function vxe(e){ct((()=>{Mme(e.isDisabled)||mt(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${gxe}], [${hye}]`))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=yxe.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),yxe.set(e,t+1))};bxe.length&&bxe[bxe.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 bxe.push(s),()=>{a.disconnect();for(const e of r){const t=yxe.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),yxe.delete(e)):yxe.set(e,t-1)}s===bxe[bxe.length-1]?(bxe.pop(),bxe.length&&bxe[bxe.length-1].observe()):bxe.splice(bxe.indexOf(s),1)}}(Mme(e.targets),Mme(e.root)))}))}var yxe=new WeakMap,bxe=[];var xxe=new Map,wxe=e=>{ct((()=>{const t=pye(e.style)??{},n=pye(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=xxe.get(e.key);o?o.activeCount++:xxe.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=xxe.get(e.key);if(t)if(1===t.activeCount){xxe.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--}))}))},_xe=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},Sxe=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[Exe,Txe]=at([]),Cxe=e=>[e.deltaX,e.deltaY],Axe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],Nxe=(e,t,n,r)=>{const o=null!==r&&Rxe(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]=_xe(o,t),u=c-e-r*l;0===l&&0===u||!Sxe(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)},Rxe=(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},Oxe=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((()=>{pye(t.enabled)&&(Txe((e=>[...e,n])),mt((()=>{Txe((e=>e.filter((e=>e!==n))))})))})),ct((()=>{if(!pye(t.enabled)||!pye(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(pye(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===pye(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;wxe({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{pye(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else wxe({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),ct((()=>{var e;(e=n,Exe().indexOf(e)===Exe().length-1&&pye(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=Axe(e),o=null,i=null},s=e=>{const n=e.target,r=pye(t.element),o=Cxe(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=Nxe(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!Rxe(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=pye(t.element),a=e.target;let s;if(2===e.touches.length)s=!pye(t.allowPinchZoom);else{if(null==o||null===i){const t=Axe(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=Nxe(a,o,i,n);s=!n||!Rxe(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},Pxe=xt();function kxe(){return wt(Pxe)}function Mxe(){const e=kxe();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var jxe=xt();function Lxe(){const e=wt(jxe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var Dxe=xt();function Ixe(){const e=wt(Dxe);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function Fxe(e){let t;const n=Ixe(),r=Mxe(),o=mve({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)}))};zve({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=lye({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{Jge(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(nve(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{Jge(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{Jge(e,i.onPointerUp),i.disabled||0!==e.button||m()},x=e=>{if(Jge(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:Hge((()=>a.id)),registerLabel:_ve(l),registerDescription:_ve(u)};return $t(jxe.Provider,{value:S,get children(){return $t(Tve,qt({as:"div",ref(e){const n=Cge((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 eve([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return eve([b,g.onPointerUp])},get onClick(){return eve([i.onClick,g.onClick])},get onKeyDown(){return eve([x,g.onKeyDown])},get onMouseDown(){return eve([i.onMouseDown,g.onMouseDown])},get onFocus(){return eve([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function Uxe(e){const t=mve({closeOnSelect:!1},e),[n,r]=Gt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=jve({value:()=>Mme(e.isSelected),defaultValue:()=>!!Mme(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{Mme(e.isReadOnly)||Mme(e.isDisabled)||n(t)},toggle:()=>{Mme(e.isReadOnly)||Mme(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return $t(Fxe,qt({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var $xe=xt();function Vxe(){return wt($xe)}var Bxe={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>Bxe.next("ltr"===e?"rtl":"ltr",t)},zxe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",Hxe=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function qxe(e){const t=Ixe(),n=Mxe(),r=Vxe(),{direction:o}=eye(),i=mve({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=Sve((()=>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(Sye,qt({ref(e){const t=Cge(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=>{Jge(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{Jge(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{Jge(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if(Jge(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case zxe(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=pve(e);for(;e&&n&&e!==t&&n!==t;)bve(n,e),n=pve(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 Hxe(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case Bxe.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case Bxe.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{Jge(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 Gxe=xt();function Kxe(){return wt(Gxe)}function Wxe(e){let t;const n=Ixe(),r=Mxe(),o=Vxe(),i=Kxe(),{direction:a}=eye(),s=mve({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=uxe({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));mxe({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:Cge((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:eve([l.onKeyDown,p.onKeyDown,e=>{if(qge(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case Bxe.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case Bxe.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:eve([l.onMouseDown,p.onMouseDown]),onFocusIn:eve([l.onFocusIn,p.onFocusIn]),onFocusOut:eve([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{Jge(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if(Jge(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;qge(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(Tve,qt({as:"div"},(()=>r.dataset()),m,c))},get children(){return $t(zbe.Positioner,{get children(){return $t(Kbe,qt({get disableOutsidePointerEvents(){return ut((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Vge({"--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 Yxe(e){let t;const n=Ixe(),r=Mxe(),[o,i]=Gt(e,["ref"]);return Oxe({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),$t(Wxe,qt({ref(e){const n=Cge((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var Xxe=xt();function Zxe(e){const t=mve({id:Ixe().generateId(`group-${Yt()}`)},e),[n,r]=at(),o={generateId:Hge((()=>t.id)),registerLabelId:_ve(r)};return $t(Xxe.Provider,{value:o,get children(){return $t(Tve,qt({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function Qxe(e){const t=function(){const e=wt(Xxe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=mve({id:t.generateId("label")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerLabelId(r.id)))),$t(Tve,qt({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function Jxe(e){const t=Mxe();return $t(Tve,qt({as:"span","aria-hidden":"true"},(()=>t.dataset()),mve({children:"▼"},e)))}function ewe(e){return $t(Fxe,qt({role:"menuitem",closeOnSelect:!0},e))}function twe(e){const t=Lxe(),n=mve({id:t.generateId("description")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerDescription(r.id)))),$t(Tve,qt({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function nwe(e){const t=Lxe(),n=mve({id:t.generateId("indicator")},e),[r,o]=Gt(n,["forceMount"]);return $t(Jt,{get when(){return r.forceMount||t.isChecked()},get children(){return $t(Tve,qt({as:"div"},(()=>t.dataset()),o))}})}function rwe(e){const t=Lxe(),n=mve({id:t.generateId("label")},e),[r,o]=Gt(n,["ref","id"]);return ct((()=>mt(t.registerLabel(r.id)))),$t(Tve,qt({as:"div",ref(e){const n=Cge(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function owe(e){const t=Mxe();return $t(Jt,{get when(){return t.contentPresent()},get children(){return $t(On,e)}})}var iwe=xt();function awe(e){const t=mve({id:Ixe().generateId(`radiogroup-${Yt()}`)},e),[n,r]=Gt(t,["value","defaultValue","onChange","disabled"]),[o,i]=Mve({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return $t(iwe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return $t(Zxe,r)}})}function swe(e){const t=function(){const e=wt(iwe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=mve({closeOnSelect:!1},e),[r,o]=Gt(n,["value","onSelect"]);return $t(Fxe,qt({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function lwe(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 cwe(e){const t=Ixe(),n=Fve(),r=kxe(),o=Vxe(),i=Kxe(),a=mve({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}=Bve({items:C,onItemsChange:A}),R=Wbe({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:O}=fye({show:()=>t.forceMount()||R.isOpen(),element:()=>y()??null}),P=function(e){const t=aye(e),n=qve({dataSource:()=>Mme(e.dataSource),getKey:()=>Mme(e.getKey),getTextValue:()=>Mme(e.getTextValue),getDisabled:()=>Mme(e.getDisabled),getSectionChildren:()=>Mme(e.getSectionChildren),factory:t=>new uye(e.filter?e.filter(t):t)},[()=>e.filter]),r=new cye(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)},j=()=>{const e=y();e&&(nve(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},L=()=>{null!=i?setTimeout((()=>j())):j()},D=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};vxe({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:L,onItemEnter:e=>{D(e)&&e.preventDefault()},onItemLeave:e=>{D(e)||L()},onTriggerLeave:e=>{D(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=>Bge(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:_ve(f),registerContentId:_ve(m)};return $t(N,{get children(){return $t(Pxe.Provider,{value:I,get children(){return $t(Jt,{when:void 0===i,get fallback(){return l.children},get children(){return $t(zbe,qt({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function uwe(e){const{direction:t}=eye();return $t(cwe,qt({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var dwe=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function pwe(e){const t=Mxe(),n=Ixe(),[r,o]=Gt(e,["onFocusOutside","onKeyDown"]),{direction:i}=eye();return $t(Wxe,qt({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;qge(t.triggerRef(),n)||t.close()},onKeyDown:e=>{Jge(e,r.onKeyDown);const o=qge(e.currentTarget,e.target),a=dwe(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),nve(t.triggerRef()))}},o))}var fwe=["Enter"," "],hwe=(e,t)=>"ltr"===e?[...fwe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...fwe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function mwe(e){let t;const n=Ixe(),r=Mxe(),o=mve({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}=eye(),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=lye({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{Jge(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{Jge(e,i.onKeyDown),e.repeat||i.disabled||hwe(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(Tve,qt({as:"div",ref(e){const n=Cge((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 eve([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return eve([i.onPointerUp,p.onPointerUp])},get onClick(){return eve([f,p.onClick])},get onKeyDown(){return eve([h,p.onKeyDown])},get onMouseDown(){return eve([i.onMouseDown,p.onMouseDown])},get onFocus(){return eve([i.onFocus,p.onFocus])},onPointerMove:e=>{if(Jge(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)),nve(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if(Jge(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:lwe(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 gwe(e){const t=Vxe(),n=mve({id:`menu-${Yt()}`,modal:!0},e),[r,o]=Gt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Wbe({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:Hge((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return $t(Dxe.Provider,{value:a,get children(){return $t(cwe,qt({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function vwe(e){let t;const n=mve({orientation:"horizontal"},e),[r,o]=Gt(n,["ref","orientation"]),i=Sve((()=>t),(()=>"hr"));return $t(Tve,qt({as:"hr",ref(e){const n=Cge((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))}Dve({},{Root:()=>vwe,Separator:()=>ywe});var ywe=vwe,bwe={};function xwe(e){const t=Ixe(),n=Mxe(),[r,o]=Gt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return $t(Yxe,qt({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||nve(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function wwe(e){return $t(gwe,mve({id:`dropdownmenu-${Yt()}`},e))}Dve(bwe,{Arrow:()=>Ube,CheckboxItem:()=>Uxe,Content:()=>xwe,DropdownMenu:()=>_we,Group:()=>Zxe,GroupLabel:()=>Qxe,Icon:()=>Jxe,Item:()=>ewe,ItemDescription:()=>twe,ItemIndicator:()=>nwe,ItemLabel:()=>rwe,Portal:()=>owe,RadioGroup:()=>awe,RadioItem:()=>swe,Root:()=>wwe,Separator:()=>vwe,Sub:()=>uwe,SubContent:()=>pwe,SubTrigger:()=>mwe,Trigger:()=>qxe});var _we=Object.assign(wwe,{Arrow:Ube,CheckboxItem:Uxe,Content:xwe,Group:Zxe,GroupLabel:Qxe,Icon:Jxe,Item:ewe,ItemDescription:twe,ItemIndicator:nwe,ItemLabel:rwe,Portal:owe,RadioGroup:awe,RadioItem:swe,Separator:vwe,Sub:uwe,SubContent:pwe,SubTrigger:mwe,Trigger:qxe}),Swe={colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000000",white:"#ffffff",neutral:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},darkGray:{50:"#525c7a",100:"#49536e",200:"#414962",300:"#394056",400:"#313749",500:"#292e3d",600:"#212530",700:"#191c24",800:"#111318",900:"#0b0d10"},gray:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},blue:{25:"#F5FAFF",50:"#EFF8FF",100:"#D1E9FF",200:"#B2DDFF",300:"#84CAFF",400:"#53B1FD",500:"#2E90FA",600:"#1570EF",700:"#175CD3",800:"#1849A9",900:"#194185"},green:{25:"#F6FEF9",50:"#ECFDF3",100:"#D1FADF",200:"#A6F4C5",300:"#6CE9A6",400:"#32D583",500:"#12B76A",600:"#039855",700:"#027A48",800:"#05603A",900:"#054F31"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},yellow:{25:"#FFFCF5",50:"#FFFAEB",100:"#FEF0C7",200:"#FEDF89",300:"#FEC84B",400:"#FDB022",500:"#F79009",600:"#DC6803",700:"#B54708",800:"#93370D",900:"#7A2E0E"},purple:{25:"#FAFAFF",50:"#F4F3FF",100:"#EBE9FE",200:"#D9D6FE",300:"#BDB4FE",400:"#9B8AFB",500:"#7A5AF8",600:"#6938EF",700:"#5925DC",800:"#4A1FB8",900:"#3E1C96"},teal:{25:"#F6FEFC",50:"#F0FDF9",100:"#CCFBEF",200:"#99F6E0",300:"#5FE9D0",400:"#2ED3B7",500:"#15B79E",600:"#0E9384",700:"#107569",800:"#125D56",900:"#134E48"},pink:{25:"#fdf2f8",50:"#fce7f3",100:"#fbcfe8",200:"#f9a8d4",300:"#f472b6",400:"#ec4899",500:"#db2777",600:"#be185d",700:"#9d174d",800:"#831843",900:"#500724"},cyan:{25:"#ecfeff",50:"#cffafe",100:"#a5f3fc",200:"#67e8f9",300:"#22d3ee",400:"#06b6d4",500:"#0891b2",600:"#0e7490",700:"#155e75",800:"#164e63",900:"#083344"}},alpha:{90:"e5",80:"cc"},font:{size:{xs:"calc(var(--tsqd-font-size) * 0.75)",sm:"calc(var(--tsqd-font-size) * 0.875)",md:"var(--tsqd-font-size)"},lineHeight:{xs:"calc(var(--tsqd-font-size) * 1)",sm:"calc(var(--tsqd-font-size) * 1.25)",md:"calc(var(--tsqd-font-size) * 1.5)"},weight:{medium:"500",semibold:"600",bold:"700"}},border:{radius:{xs:"calc(var(--tsqd-font-size) * 0.125)",sm:"calc(var(--tsqd-font-size) * 0.25)",full:"9999px"}},size:{.25:"calc(var(--tsqd-font-size) * 0.0625)",.5:"calc(var(--tsqd-font-size) * 0.125)",1:"calc(var(--tsqd-font-size) * 0.25)",1.5:"calc(var(--tsqd-font-size) * 0.375)",2:"calc(var(--tsqd-font-size) * 0.5)",2.5:"calc(var(--tsqd-font-size) * 0.625)",3:"calc(var(--tsqd-font-size) * 0.75)",3.5:"calc(var(--tsqd-font-size) * 0.875)",4:"calc(var(--tsqd-font-size) * 1)",4.5:"calc(var(--tsqd-font-size) * 1.125)",5:"calc(var(--tsqd-font-size) * 1.25)",6:"calc(var(--tsqd-font-size) * 1.5)",6.5:"calc(var(--tsqd-font-size) * 1.625)",14:"calc(var(--tsqd-font-size) * 3.5)"},shadow:{xs:(e="rgb(0 0 0 / 0.1)")=>"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:(e="rgb(0 0 0 / 0.1)")=>`0 1px 3px 0 ${e}, 0 1px 2px -1px ${e}`,md:(e="rgb(0 0 0 / 0.1)")=>`0 4px 6px -1px ${e}, 0 2px 4px -2px ${e}`,lg:(e="rgb(0 0 0 / 0.1)")=>`0 10px 15px -3px ${e}, 0 4px 6px -4px ${e}`,xl:(e="rgb(0 0 0 / 0.1)")=>`0 20px 25px -5px ${e}, 0 8px 10px -6px ${e}`,"2xl":(e="rgb(0 0 0 / 0.25)")=>`0 25px 50px -12px ${e}`,inner:(e="rgb(0 0 0 / 0.05)")=>`inset 0 2px 4px 0 ${e}`,none:()=>"none"}},Ewe=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>'),Twe=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>'),Cwe=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>'),Awe=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>'),Nwe=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>'),Rwe=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>'),Owe=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>'),Pwe=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>'),kwe=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">'),Mwe=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">'),jwe=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>'),Lwe=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>'),Dwe=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>'),Iwe=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>'),Fwe=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>'),Uwe=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>'),$we=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>'),Vwe=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>'),Bwe=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>'),zwe=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>'),Hwe=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>'),qwe=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>'),Gwe=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 Kwe(){return Ewe()}function Wwe(){return Twe()}function Ywe(){return Cwe()}function Xwe(){return Awe()}function Zwe(){return Nwe()}function Qwe(){return(e=Nwe()).style.setProperty("transform","rotate(90deg)"),e;var e}function Jwe(){return(e=Nwe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function e_e(){return Rwe()}function t_e(){return Owe()}function n_e(){return Pwe()}function r_e(){return kwe()}function o_e(){return Mwe()}function i_e(){return jwe()}function a_e(){return Lwe()}function s_e(){return Dwe()}function l_e(){return Iwe()}function c_e(e){return t=Fwe(),n=t.firstChild,lt((()=>hn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function u_e(){return Uwe()}function d_e(){return $we()}function p_e(e){return[$t(Jt,{get when(){return e.checked},get children(){var t=Fwe(),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=Vwe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function f_e(){return Bwe()}function h_e(){return zwe()}function m_e(){return Hwe()}function g_e(){return qwe()}function v_e(){const e=Yt();return t=Gwe(),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,L=(j=(M=P.nextSibling).nextSibling).firstChild,I=(D=j.nextSibling).firstChild,$=(U=(F=D.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Q=(Z=(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,Le=(je=(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(L,"id",`af-${e}`),hn(D,"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(Z,"fill",`url(#s-${e})`),hn(Q,"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(je,"id",`z-${e}`),hn(Le,"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,j,L,D,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Z,Q,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,je,Le}var y_e=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>'),b_e=pn('<button title="Copy object to clipboard">'),x_e=pn('<button title="Remove all items"aria-label="Remove all items">'),w_e=pn('<button title="Delete item"aria-label="Delete item">'),__e=pn('<button title="Toggle value"aria-label="Toggle value">'),S_e=pn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),E_e=pn("<div>"),T_e=pn("<div><button> <span></span> <span> "),C_e=pn("<input>"),A_e=pn("<span>"),N_e=pn("<div><span>:"),R_e=pn("<div><div><button> [<!>...<!>]");var O_e=e=>{const t=Zme(),n=Gme().shadowDOMTarget?_ge.bind({target:Gme().shadowDOMTarget}):_ge,r=ut((()=>"dark"===t()?U_e(n):F_e(n)));return o=y_e(),lt((()=>mn(o,Ege(r().expander,n`
94
+ */Dae.exports="production"===process.env.NODE_ENV?function(){if(Lae)return Iae;Lae=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=Dae.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)=>jae(e,t,n),Wae=i.createContext(void 0),Yae=()=>i.useContext(Wae),Xae=i.createContext(void 0),Zae=()=>i.useContext(Xae),Qae=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 j(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 L(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)):j(e)}let D=()=>M(k().length-1),I=e=>{e.preventDefault(),e.metaKey?D():e.altKey?L(1):j(1)},F=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?L(-1):j(-1)};return i.createElement(KQ.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(),D();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(Qae),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=Zae(),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(KQ.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(KQ.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(Qae.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(KQ.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=Zae(),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(KQ.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(KQ.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(KQ.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(KQ.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=Zae(),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:Zd("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:Zd("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:Zd("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:Zd("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:Zd("-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:Zd("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(Z6,{asChild:!0,children:t.jsxs(gZ,{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(Q6,{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:Zd("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(Z6,{asChild:!0,children:t.jsxs(gZ,{variant:"outline",className:Zd("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(Q6,{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:Zd("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=iZ(),{updateAutomation:i}=Le(o?.id||""),{toast:a}=jl(),[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(gZ,{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(bZ,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(xZ.SendButton,{className:"text-primary"}),onClick:()=>{l("sendNow"),u(new Date(Date.now()+3e5).toISOString()),p("America/New_York"),h(!0)}}),t.jsx(bZ,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(xZ.ScheduleButton,{className:"text-primary"}),onClick:()=>l("schedule")})]}),t.jsx(zB,{children:"schedule"===s&&t.jsx(hZ,{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={[rZ.EQUALS]:"Equals",[rZ.NOT_EQUALS]:"Not Equals",[rZ.GREATER_THAN]:"Greater Than",[rZ.LESS_THAN]:"Less Than",[rZ.EXISTS]:"Exists",[rZ.EQUALS_MONTH_DAY]:"Month and Day Matches",[rZ.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[rZ.BETWEEN_MONTH_DAY]:"Between Month Day",[rZ.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[rZ.ARRAY_CONTAINS]:"List Contains"},Mse={email:"Email",phone:"Phone",firstName:"First Name",lastName:"Last Name"},jse=({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(Z6,{asChild:!0,children:t.jsxs(gZ,{"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(Q6,{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:Zd("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var Lse=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(Dse,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(Dse,{...o,ref:n,children:r})}));Lse.displayName="Slot";var Dse=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}));Dse.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?Lse: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:Zd("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(Z6,{asChild:!0,children:t.jsx("button",{type:"button",ref:y,...v,onClick:()=>{x((e=>!e))},className:Zd("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(PZ,{className:Zd(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(PZ,{className:Zd("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(Q6,{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:Zd("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:Zd("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:Zd("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]=FQ(Kse),[Xse,Zse]=Wse(Kse),Qse=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]=VQ({prop:a,defaultProp:s,onChange:d});return t.jsxs(Xse,{scope:r,checked:b,disabled:c,children:[t.jsx(KQ.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:IQ(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%)"}})]})}));Qse.displayName=Kse;var Jse="SwitchThumb",ele=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=Zse(Jse,r);return t.jsx(KQ.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=Qse,ole=ele;const ile=i.forwardRef((({className:e,...n},r)=>t.jsx(rle,{className:Zd("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:Zd("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(Z6,{asChild:!0,children:t.jsxs(gZ,{variant:"outline",className:Zd("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(Q6,{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===tZ.Date||e===tZ.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!==rZ.EQUALS_MONTH_DAY&&n!==rZ.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===tZ.String||e===tZ.ReachResource||e===tZ.Array)return n===rZ.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 tZ.ReachResource:case tZ.Array:case tZ.String:return t.length>0;case tZ.Number:return!isNaN(Number(t));case tZ.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case tZ.Boolean:return"true"===t||"false"===t;case tZ.Date:case tZ.DateTime:return!isNaN(new Date(t).getTime());default:throw Xte(n,tZ)}})({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===tZ.Date||e===tZ.DateTime){const e=n===rZ.EQUALS_MONTH_DAY||n===rZ.EQUALS_MONTH_DAY_YEAR,r=n===rZ.BETWEEN_MONTH_DAY||n===rZ.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(j9,{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(j9,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===tZ.Number||e===tZ.Integer)return n===rZ.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===tZ.Boolean){if(n===rZ.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}=jl(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:tZ.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(jse,{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 tZ.Boolean:l=[!1];break;case tZ.Number:l=[0];break;case tZ.Date:case tZ.DateTime:l=[new Date];break;case tZ.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(jse,{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(gZ,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(_u,{className:"h-4 w-4"})}),t.jsx(gZ,{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(bZ,{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(bZ,{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(gZ,{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(gZ,{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}=jl();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(hZ,{children:t.jsx(fZ,{})}),!a&&t.jsx(hZ,{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(gZ,{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}=jl(),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}=eZ(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(fZ,{})});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(hZ,{children:t.jsx(ule,{onSelectStyle:e=>{"ai"===e&&y(!0),x(!1)}})},"prompt-builder-style"):t.jsx(hZ,{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(hZ,{children:t.jsx(ple,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(hZ,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(j9,{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(j9,{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(gZ,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(gZ,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(gZ,{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!==rZ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===rZ.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!==rZ.EQUALS_MONTH_DAY&&t.operator!==rZ.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!==rZ.BETWEEN_MONTH_DAY&&t.operator!==rZ.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 LX(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===tZ.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(bZ,{onClick:()=>a("all"),title:`All ${ff("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(xZ.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(bZ,{onClick:()=>a("segments"),title:`Select ${ff("engage:user",{count:2})}`,subtitle:`Choose from ${ff("engage:segment",{count:2})}`,icon:t.jsx(xZ.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(xZ.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(gZ,{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(xZ.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=iZ(),[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}=ZX(),{updateAutomation:g}=Le(r?.id??""),[v,y]=n.useState(void 0),b=1===a.length&&0===l.length&&void 0!==h?.find((e=>e.type===nZ.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===nZ.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(fZ,{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=iZ(),t=aZ(),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=iZ(),a=aZ(),{updateAutomation:s}=Le(i?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:t}=QX({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(fZ,{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(PZ,{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(VZ,{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(hZ,{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=({children:e,actionId:r})=>{const{setActionId:o}=n.useContext(VX);return n.useEffect((()=>{o(r)}),[r,o]),t.jsx("div",{children:e})},Ale=()=>t.jsxs("div",{children:[t.jsx("div",{className:EZ,children:t.jsx(xZ.OneTimeBroadcast,{})}),t.jsxs("h3",{className:TZ,children:[ff("engage:one_time")," Broadcast"]}),t.jsx("p",{className:CZ,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),Nle=()=>t.jsxs("div",{children:[t.jsx("div",{className:AZ,children:"Coming Soon"}),t.jsx("div",{className:EZ,children:t.jsx(xZ.RealtimeActivity,{})}),t.jsx("h3",{className:TZ,children:"Realtime Activity"}),t.jsx("p",{className:CZ,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),Rle=({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(Ale,{});case Fe.TRIGGER_BASED:return t.jsx(Nle,{});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()}`})]})]})]})]}),Ole=({onClose:e,automationType:r,currentStep:o,setCurrentStep:i,getExtraMergeFields:a,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:c}=je(),[u,p]=n.useState(!1),[f,h]=n.useState(void 0),[m,g]=n.useState(void 0),[v,y]=n.useState(!1),[b,x]=n.useState(r?{name:void 0,description:void 0,type:r}:{name:void 0,description:void 0,type:void 0}),w=void 0!==b.name&&void 0!==b.type&&""!==b.name;n.useEffect((()=>{if(b.type&&!b.name&&!v){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="";x((e=>({...e,name:r,description:o}))),y(!0)}}),[b,v]);if(c||u)return t.jsx("div",{className:SZ,children:t.jsx(fZ,{text:[`Creating ${ff("engage:one_time")}`,"Finishing up"]})});return t.jsxs("div",{className:wB("relative overflow-y-auto h-full p-8",o===vZ.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[t.jsx(zB,{mode:"wait",children:t.jsx(hZ,{className:"h-full",children:(()=>{switch(o){case vZ.ChooseAutomationType:return t.jsx(NZ,{onNext:e=>{x({...b,type:e}),i(vZ.SetAutomationName)}});case vZ.SetAutomationName:return b.type?t.jsx(Rle,{selectedType:b.type,setAutomationName:e=>{x({...b,name:e})},automationName:b.name??"",setAutomationDescription:e=>{x({...b,description:e})},automationDescription:b.description??""}):null;case vZ.OneTimeWizard:return f&&m?t.jsx(lZ,{automationId:f,children:t.jsx(Cle,{actionId:m,children:t.jsx(Tle,{onFinish:()=>{e?.(f)},getExtraMergeFields:a,onBeforeSchedule:s})})}):null;default:throw LX(o,vZ)}})()},o)}),o!==vZ.OneTimeWizard&&t.jsx("div",{className:"pt-2",children:t.jsx(yZ,{onClose:e,currentStep:o,setCurrentStep:i,isDisabled:!w,createAutomation:async()=>{if(!w||!b.name||!b.type)return;p(!0);l({name:b.name,type:b.type,description:b.description},{onSuccess:async t=>{if(t.id){const n=await(async e=>(await Re(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),o=jX().toString();await Pe(t.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:o}}]}),h(t.id),await pZ({automationId:t.id,actionId:o}),r===Fe.ONE_TIME?(i(vZ.OneTimeWizard),g(o),p(!1)):e?.(t.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{x({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==r})})]})};function Ple({open:e,setOpen:r,onClose:o,automationType:i,getExtraMergeFields:a}){const[s,l]=n.useState(i?vZ.SetAutomationName:vZ.ChooseAutomationType);return n.useEffect((()=>{e&&l(i?vZ.SetAutomationName:vZ.ChooseAutomationType)}),[e,i]),t.jsx(_B,{open:e,onOpenChange:r,children:t.jsxs(TB,{hideCloseButton:s===vZ.OneTimeWizard,className:`flex max-h-[86vh] ${s===vZ.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(Ole,{onClose:e=>{o?.(e),r(!1)},automationType:i,currentStep:s,setCurrentStep:l,getExtraMergeFields:a})]})})}const kle=({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})})]})},Mle=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)},jle="reach-styles-module__header___-izE2",Lle="reach-styles-module__title___n1hA9",Dle="reach-styles-module__description___EvXM-",Ile="reach-styles-module__content___okv68",Fle="reach-styles-module__footer___YA4U4",Ule=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"}}),$le=i.forwardRef((({className:e,variant:n,...r},o)=>t.jsx("div",{ref:o,className:Zd(Ule({variant:n}),e),...r})));$le.displayName="Card";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(jle,e),...n}))).displayName="CardHeader";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Lle,e),...n}))).displayName="CardTitle";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Dle,e),...n}))).displayName="CardDescription";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Ile,e),...n}))).displayName="CardContent";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Fle,e),...n}))).displayName="CardFooter";const Vle=({Icon:e,title:n,value:r,tooltipText:o,change:i})=>t.jsxs($le,{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})})]}),Ble=({activeTab:e,automation:n})=>{if(!n)return null;const r={sales:[{Icon:xZ.SalesAmount,title:"Order Amount",value:Mle(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(Vle,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},zle=({activeTab:e,statistics:n})=>{const r={email:[{Icon:xZ.MessagesSent,title:"Emails Sent",value:n.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:xZ.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:xZ.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:xZ.LinksClicked,title:"Links Clicked",value:n.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:xZ.SpamComplies,title:"Spam Complaints",value:`${(100*n.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:xZ.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*n.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:xZ.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(Vle,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Hle=({automationId:e,includeSales:r=!1,includeSms:o=!1,automation:i})=>{const[a,s]=n.useState("email"),{statistics:l,isLoading:c}=De(e);if(c||!l)return t.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:t.jsx(fZ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]})});const u=[{id:"email",label:`Email ${ff("engage:insight",{count:2})}`,content:t.jsx(zle,{activeTab:"email",statistics:l})},...o?[{id:"sms",label:`SMS ${ff("engage:insight",{count:2})}`,content:t.jsx(zle,{activeTab:"sms",statistics:l})}]:[],...r?[{id:"sales",label:`Sales ${ff("engage:insight",{count:2})}`,content:t.jsx(Ble,{activeTab:"sales",automation:i})}]:[]];return t.jsx(kle,{tabs:u,activeTab:a,onTabChange:e=>s(e),tabsLocation:"left"})},qle={all:["website"],content:()=>[...qle.all,"content"],analyze:()=>[...qle.all,"analyze"],brandSettings:()=>[...qle.all,"brand-settings"]},Gle=async()=>(await Re("/web-presence/brand-settings",{method:"POST"})).data,Kle=({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})]})]})]})},Wle=({setAutoParse:e,onBrandSettingsGenerated:r,onForceRefresh:o})=>{const{data:i,updateWebsite:a,isUpdatingWebsite:s,updateBrandSettings:l}=Bte(),c=ye({mutationFn:Gle,mutationKey:qle.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(Xle,{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(gZ,{variant:"outline",size:"sm",onClick:()=>{f(!1),d(i?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),t.jsx(gZ,{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(fZ,{}):"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(gZ,{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(Kle,{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(gZ,{variant:"outline",onClick:x,className:"gap-1",children:"Go Back"}),t.jsxs(gZ,{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(fZ,{}):"Analyze Website"]})]})]})},Yle=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],Xle=({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}=jl();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)},j=e=>{d((t=>({...t,primaryColor:e})))},L=()=>{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(fZ,{})}):p?t.jsx(Wle,{setAutoParse:f,onForceRefresh:()=>S(Date.now())}):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16",children:[t.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 px-6 pt-2",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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{variant:"ghost",size:"sm",onClick:()=>{N.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[t.jsx(Zu,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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=>j(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:Yle.map(((e,n)=>t.jsx(gZ,{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:()=>j(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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(gZ,{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(PZ,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",style:{borderColor:`${u.primaryColor}30`||"#f3f4f6",backgroundColor:`${u.primaryColor}08`||"#f9fafb"},children:[e,t.jsx(gZ,{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&&L()}),t.jsxs(gZ,{variant:"outline",onClick:L,disabled:!y.trim(),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),t.jsxs(AB,{className:"pb-4 px-6",children:[o?t.jsx(gZ,{variant:"outline",className:"gap-1.5",onClick:o,children:"Go Back"}):i&&t.jsxs(gZ,{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(gZ,{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"})]})]})};var Zle=e=>"checkbox"===e.type,Qle=e=>e instanceof Date,Jle=e=>null==e;const ece=e=>"object"==typeof e;var tce=e=>!Jle(e)&&!Array.isArray(e)&&ece(e)&&!Qle(e),nce=e=>tce(e)&&e.target?Zle(e.target)?e.target.checked:e.target.value:e,rce=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),oce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function ice(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(oce&&(e instanceof Blob||r)||!n&&!tce(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return tce(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=ice(e[n]));else t=e}return t}var ace=e=>Array.isArray(e)?e.filter(Boolean):[],sce=e=>void 0===e,lce=(e,t,n)=>{if(!t||!tce(e))return n;const r=ace(t.split(/[,[\].]+?/)).reduce(((e,t)=>Jle(e)?e:e[t]),e);return sce(r)||r===e?sce(e[t])?n:e[t]:r},cce=e=>"boolean"==typeof e,uce=e=>/^\w*$/.test(e),dce=e=>ace(e.replace(/["|']|\]/g,"").split(/\.|\[/)),pce=(e,t,n)=>{let r=-1;const o=uce(t)?[t]:dce(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=tce(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const fce="blur",hce="focusout",mce="change",gce="onBlur",vce="onChange",yce="onSubmit",bce="onTouched",xce="all",wce="max",_ce="min",Sce="maxLength",Ece="minLength",Tce="pattern",Cce="required",Ace="validate",Nce=n.createContext(null),Rce=()=>n.useContext(Nce);var Oce=(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]!==xce&&(t._proxyFormState[o]=!r||xce),n&&(n[o]=!0),e[o]}});return o},Pce=e=>Jle(e)||!ece(e);function kce(e,t){if(Pce(e)||Pce(t))return e===t;if(Qle(e)&&Qle(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(Qle(n)&&Qle(e)||tce(n)&&tce(e)||Array.isArray(n)&&Array.isArray(e)?!kce(n,e):n!==e)return!1}}return!0}const Mce=(e,t)=>{const r=n.useRef(t);kce(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var jce=e=>"string"==typeof e,Lce=(e,t,n,r,o)=>jce(e)?(r&&t.watch.add(e),lce(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),lce(n,e)))):(r&&(t.watchAll=!0),n);function Dce(e){const t=Rce(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=rce(i._names.array,r),l=function(e){const t=Rce(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return Mce((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c(Lce(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:lce(i._formValues,r,lce(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=Rce(),{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 Mce((()=>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((()=>Oce(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,...cce(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!lce(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!lce(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!lce(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!lce(c.validatingFields,r)},error:{enumerable:!0,get:()=>lce(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:nce(e),name:r},type:mce})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:lce(i._formValues,r),name:r},type:fce})),[r,i._formValues]),m=n.useCallback((e=>{const t=lce(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,...cce(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,...cce(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=lce(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=ice(lce(i._options.defaultValues,r));pce(i._defaultValues,r,e),sce(lce(i._formValues,r))&&pce(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 Ice=e=>e.render(Dce(e));var Fce=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Uce=e=>Array.isArray(e)?e:[e],$ce=()=>{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=[]}}},Vce=e=>tce(e)&&!Object.keys(e).length,Bce=e=>"file"===e.type,zce=e=>"function"==typeof e,Hce=e=>{if(!oce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},qce=e=>"select-multiple"===e.type,Gce=e=>"radio"===e.type,Kce=e=>Hce(e)&&e.isConnected;function Wce(e,t){const n=Array.isArray(t)?t:uce(t)?[t]:dce(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=sce(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(tce(r)&&Vce(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!sce(e[t]))return!1;return!0}(r))&&Wce(e,n.slice(0,-1)),e}var Yce=e=>{for(const t in e)if(zce(e[t]))return!0;return!1};function Xce(e,t={}){const n=Array.isArray(e);if(tce(e)||n)for(const r in e)Array.isArray(e[r])||tce(e[r])&&!Yce(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Xce(e[r],t[r])):Jle(e[r])||(t[r]=!0);return t}function Zce(e,t,n){const r=Array.isArray(e);if(tce(e)||r)for(const o in e)Array.isArray(e[o])||tce(e[o])&&!Yce(e[o])?sce(t)||Pce(n[o])?n[o]=Array.isArray(e[o])?Xce(e[o],[]):{...Xce(e[o])}:Zce(e[o],Jle(t)?{}:t[o],n[o]):n[o]=!kce(e[o],t[o]);return n}var Qce=(e,t)=>Zce(e,t,Xce(t));const Jce={value:!1,isValid:!1},eue={value:!0,isValid:!0};var tue=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&&!sce(e[0].attributes.value)?sce(e[0].value)||""===e[0].value?eue:{value:e[0].value,isValid:!0}:eue:Jce}return Jce},nue=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>sce(e)?e:t?""===e?NaN:e?+e:e:n&&jce(e)?new Date(e):r?r(e):e;const rue={isValid:!1,value:null};var oue=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),rue):rue;function iue(e){const t=e.ref;return Bce(t)?t.files:Gce(t)?oue(e.refs).value:qce(t)?[...t.selectedOptions].map((({value:e})=>e)):Zle(t)?tue(e.refs).value:nue(sce(t.value)?e.ref.value:t.value,e)}var aue=e=>e instanceof RegExp,sue=e=>sce(e)?e:aue(e)?e.source:tce(e)?aue(e.value)?e.value.source:e.value:e,lue=e=>({isOnSubmit:!e||e===yce,isOnBlur:e===gce,isOnChange:e===vce,isOnAll:e===xce,isOnTouch:e===bce});const cue="AsyncFunction";var uue=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const due=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=lce(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(due(i,t))break}else if(tce(i)&&due(i,t))break}}};function pue(e,t,n){const r=lce(e,n);if(r||uce(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=lce(t,r),a=lce(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 fue=(e,t,n)=>{const r=Uce(lce(e,n));return pce(r,"root",t[n]),pce(e,n,r),e},hue=e=>jce(e);function mue(e,t,n="validate"){if(hue(e)||Array.isArray(e)&&e.every(hue)||cce(e)&&!e)return{type:n,message:hue(e)?e:"",ref:t}}var gue=e=>tce(e)&&!aue(e)?e:{value:e,message:""},vue=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=lce(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,x=e=>{o&&b.reportValidity&&(b.setCustomValidity(cce(e)?"":e||""),b.reportValidity())},w={},_=Gce(a),S=Zle(a),E=_||S,T=(g||Bce(a))&&sce(a.value)&&sce(y)||Hce(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=Fce.bind(null,m,r,w),A=(e,t,n,r=Sce,o=Ece)=>{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||Jle(y))||cce(y)&&!y||S&&!tue(s).isValid||_&&!oue(s).isValid)){const{value:e,message:t}=hue(l)?{value:!!l,message:l}:gue(l);if(e&&(w[m]={type:Cce,message:t,ref:b,...C(Cce,t)},!r))return x(t),w}if(!(T||Jle(d)&&Jle(p))){let e,t;const n=gue(p),o=gue(d);if(Jle(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;jce(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),jce(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);Jle(n.value)||(e=r>n.value),Jle(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,wce,_ce),!r))return x(w[m].message),w}if((c||u)&&!T&&(jce(y)||i&&Array.isArray(y))){const e=gue(c),t=gue(u),n=!Jle(e.value)&&y.length>+e.value,o=!Jle(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&&jce(y)){const{value:e,message:t}=gue(f);if(aue(e)&&!y.match(e)&&(w[m]={type:Tce,message:t,ref:a,...C(Tce,t)},!r))return x(t),w}if(h)if(zce(h)){const e=mue(await h(y,n),b);if(e&&(w[m]={...e,...C(Ace,e.message)},!r))return x(e.message),w}else if(tce(h)){let e={};for(const t in h){if(!Vce(e)&&!r)break;const o=mue(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},x(o.message),r&&(w[m]=e))}if(!Vce(e)&&(w[m]={ref:b,...e},!r))return w}return x(!0),w};const yue={mode:yce,reValidateMode:vce,shouldFocusError:!0};function bue(e={}){let t={...yue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:zce(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=(tce(t.defaultValues)||tce(t.values))&&ice(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:ice(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:$ce(),state:$ce()},f=lue(t.mode),h=lue(t.reValidateMode),m=t.criteriaMode===xce,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?Vce((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?pce(n.validatingFields,e,r):Wce(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!Vce(n.validatingFields)}))},y=(e,t,n,o)=>{const l=lce(r,e);if(l){const r=lce(a,e,sce(n)?lce(i,e):n);sce(r)||o&&o.defaultChecked||t?pce(a,e,t?r:iue(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=kce(lce(i,e),r);c=!!lce(n.dirtyFields,e),t?Wce(n.dirtyFields,e):pce(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=lce(n.touchedFields,e);t||(pce(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=lce(n.errors,e),l=(u.isValid||d.isValid)&&cce(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{pce(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?pce(n.errors,e,i):Wce(n.errors,e)),(i?!kce(s,i):s)||!Vce(a)||l){const t={...a,...l&&cce(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=lce(t,i);e&&pce(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&&!!(zce(i.validate)&&i.validate.constructor.name===cue||tce(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===cue))));p&&u.validatingFields&&v([s],!0);const f=await vue(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(lce(f,e.name)?d?fue(n.errors,f,e.name):pce(n.errors,e.name,f[e.name]):Wce(n.errors,e.name))}!Vce(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&pce(a,e,n),!kce(P(),i)),E=(e,t,n)=>Lce(e,l,{...s.mount?a:sce(t)?i:jce(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=lce(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&pce(a,e,nue(t,n)),i=Hce(n.ref)&&Jle(t)?"":t,qce(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?Zle(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)):Bce(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:ice(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=lce(r,a);(l.array.has(e)||tce(i)||s&&!s._f)&&!Qle(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=lce(r,e),f=l.array.has(e),h=ice(t);pce(a,e,h),f?(p.array.next({name:e,values:ice(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:Qce(i,a),isDirty:S(e,h)})):!c||c._f||Jle(h)?T(e,h,o):C(e,h,o),uue(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:ice(a)})},N=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=lce(r,c),E=e=>{y=Number.isNaN(e)||Qle(e)&&isNaN(e.getTime())||kce(e,lce(a,c,e))};if(S){let s,C;const A=i.type?iue(S._f):nce(e),N=e.type===fce||e.type===hce,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||lce(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,lce(n.touchedFields,c),n.isSubmitted,h,f),P=uue(c,l,N);pce(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=!Vce(k)||P;if(!N&&p.state.next({name:c,type:e.type,values:ice(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=pue(n.errors,r,c),o=pue(e,r,t.name||c);s=o.error,c=o.name,C=Vce(e)}}else v([c],!0),s=(await vue(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(lce(n.errors,t)&&e.focus)return e.focus(),1},O=async(e,o={})=>{let i,a;const s=Uce(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=lce(t,r);e?pce(n.errors,r,e):Wce(n.errors,r)}else n.errors=t;return t})(sce(e)?e:s);i=Vce(t),a=e?!s.some((e=>lce(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=lce(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!jce(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&due(r,R,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return sce(e)?t:jce(e)?lce(t,e):e.map((e=>lce(t,e)))},k=(e,t)=>({invalid:!!lce((t||n).errors,e),isDirty:!!lce((t||n).dirtyFields,e),error:lce((t||n).errors,e),isValidating:!!lce(n.validatingFields,e),isTouched:!!lce((t||n).touchedFields,e)}),M=(e,t,o)=>{const i=(lce(r,e,{_f:{}})._f||{}).ref,a=lce(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;pce(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()},j=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!Uce(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 Vce(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||xce)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,L=(e,o={})=>{for(const s of e?Uce(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(Wce(r,s),Wce(a,s)),!o.keepError&&Wce(n.errors,s),!o.keepDirty&&Wce(n.dirtyFields,s),!o.keepTouched&&Wce(n.touchedFields,s),!o.keepIsValidating&&Wce(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&Wce(i,s);p.state.next({values:ice(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},D=({disabled:e,name:t})=>{(cce(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=lce(r,e);const a=cce(n.disabled)||cce(t.disabled);return pce(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?D({disabled:cce(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:sue(n.min),max:sue(n.max),minLength:sue(n.minLength),maxLength:sue(n.maxLength),pattern:sue(n.pattern)}:{},name:e,onChange:N,onBlur:N,ref:a=>{if(a){I(e,n),o=lce(r,e);const t=sce(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>Gce(e)||Zle(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;pce(r,e,{_f:{...o._f,...s?{refs:[...l.filter(Kce),t,...Array.isArray(lce(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=lce(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!rce(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&due(r,R,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=ice(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)pce(c,e,void 0);if(Wce(n.errors,"root"),Vce(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:Vce(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?ice(e):i,d=ice(c),f=Vce(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Qce(i,a))]);for(const t of Array.from(e))lce(n.dirtyFields,t)?pce(h,t,lce(a,t)):A(t,lce(h,t))}else{if(oce&&sce(e))for(const e of l.mount){const t=lce(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Hce(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,lce(h,e))}a=ice(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||kce(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?Qce(i,a):n.dirtyFields:o.keepDefaultValues&&e?Qce(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)=>$(zce(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:L,getFieldState:k,handleSubmit:U,setError:M,_subscribe:j,_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(lce(r,e))){const t=l(lce(r,e),c.argA,c.argB);f&&pce(r,e,t)}if(h&&Array.isArray(lce(n.errors,e))){const t=l(lce(n.errors,e),c.argA,c.argB);f&&pce(n.errors,e,t),((e,t)=>{!ace(lce(e,t)).length&&Wce(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(lce(n.touchedFields,e))){const t=l(lce(n.touchedFields,e),c.argA,c.argB);f&&pce(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=Qce(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else pce(a,e,o)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>ace(lce(s.mount?a:i,e,t.shouldUnregister?lce(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>zce(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=lce(r,e);t&&(t._f.refs?t._f.refs.every((e=>!Kce(e))):!Kce(t._f.ref))&&L(e)}l.unMount=new Set},_disableForm:e=>{cce(e)&&(p.state.next({disabled:e}),due(r,((t,n)=>{const o=lce(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},j({...e,formState:d})),trigger:O,register:I,handleSubmit:U,watch:(e,t)=>zce(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={})=>{lce(r,e)&&(sce(t.defaultValue)?A(e,ice(lce(i,e))):(A(e,t.defaultValue),pce(i,e,ice(t.defaultValue))),t.keepTouched||Wce(n.touchedFields,e),t.keepDirty||(Wce(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,ice(lce(i,e))):S()),t.keepError||(Wce(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&Uce(e).forEach((e=>Wce(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:L,setError:M,setFocus:(e,t={})=>{const n=lce(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&zce(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const xue="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function wue(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:zce(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:zce(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:bue(e),formState:o},e.formControl&&e.defaultValues&&!zce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,xue((()=>{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&&!Vce(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&&!kce(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=Oce(o,a),t.current}const _ue=(e,t,n)=>{if(e&&"reportValidity"in e){const r=lce(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Sue=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?_ue(r.ref,n,e):r.refs&&r.refs.forEach((t=>_ue(t,n,e)))}},Eue=(e,t)=>{t.shouldUseNativeValidation&&Sue(e,t);const n={};for(const r in e){const o=lce(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Tue(t.names||Object.keys(e),r)){const e=Object.assign({},lce(n,r));pce(e,"root",i),pce(n,r,e)}else pce(n,r,i)}return n},Tue=(e,t)=>e.some((e=>e.startsWith(t+".")));var Cue=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]=Fce(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},Aue=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&&Sue({},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:Eue(Cue(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};const Nue="reach-styles-module__base___r-a1U",Rue=ru([Nue],{variants:{variant:{default:"reach-styles-module__default___vu2Rt",primary:"reach-styles-module__primary___mGKjo",success:"reach-styles-module__success___xn1Y1",warning:"reach-styles-module__warning___jdyU9",error:"reach-styles-module__error___Z-3IS"},size:{default:"reach-styles-module__sizeDefault___oS6W2",sm:"reach-styles-module__sizeSm___GI826",lg:"reach-styles-module__sizeLg___J--WF"},position:{default:"reach-styles-module__positionDefault___visr6",top:"reach-styles-module__positionTop___y6h-n",bottom:"reach-styles-module__positionBottom___vYLkd",inline:"reach-styles-module__positionInline___NjZsw"}},defaultVariants:{variant:"default",size:"default",position:"default"}}),Oue=e=>{const{children:t,...r}=e;return n.createElement(Nce.Provider,{value:r},t)},Pue=i.createContext({}),kue=({...e})=>t.jsx(Pue.Provider,{value:{name:e.name},children:t.jsx(Ice,{...e})}),Mue=()=>{const e=i.useContext(Pue),t=i.useContext(jue),{getFieldState:n,formState:r}=Rce(),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}},jue=i.createContext({}),Lue=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(jue.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:Zd("space-y-2",e),...n})})}));Lue.displayName="FormItem";const Due=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=Mue();return t.jsx(j9,{ref:r,className:Zd(o&&"text-destructive",e),htmlFor:i,...n})}));Due.displayName="FormLabel";const Iue=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=Mue();return t.jsx(ZU,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));Iue.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=Mue();return t.jsx("p",{ref:r,id:o,className:Zd("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const Fue=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=Mue(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:Zd("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));Fue.displayName="FormMessage";const Uue=({control:e,disabled:n,legalNameRef:r})=>t.jsxs(t.Fragment,{children:[t.jsx(kue,{control:e,name:"company.legalName",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Legal Company Name"}),t.jsx(Iue,{children:t.jsx(H3,{...e,ref:r,disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"company.type",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Company Type"}),t.jsxs(lte,{onValueChange:e.onChange,defaultValue:e.value,disabled:n,children:[t.jsx(Iue,{children:t.jsx(ute,{className:"h-8",children:t.jsx(cte,{placeholder:"Select company type"})})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"corporation",children:"Corporation"}),t.jsx(hte,{value:"llc",children:"LLC"})]})]}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"company.ein",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"EIN (Employer Identification Number)"}),t.jsx(Iue,{children:t.jsx(H3,{...e,type:"text",disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})})]}),$ue=({control:e,disabled:n})=>t.jsxs(t.Fragment,{children:[t.jsx(kue,{control:e,name:"representative.title",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Title"}),t.jsx(Iue,{children:t.jsx(H3,{...e,disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"representative.firstName",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"First Name"}),t.jsx(Iue,{children:t.jsx(H3,{...e,disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"representative.email",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Email"}),t.jsx(Iue,{children:t.jsx(H3,{...e,type:"email",disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"representative.phone",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Contact Phone Number"}),t.jsx(Iue,{children:t.jsx(H3,{...e,type:"tel",disabled:n,className:"h-8"})}),t.jsx(Fue,{className:"text-xs"})]})}),t.jsx(kue,{control:e,name:"representative.position",render:({field:e})=>t.jsxs(Lue,{className:"space-y-1",children:[t.jsx(Due,{className:"text-sm",children:"Position"}),t.jsxs(lte,{onValueChange:e.onChange,defaultValue:e.value,disabled:n,children:[t.jsx(Iue,{children:t.jsx(ute,{className:"h-8",children:t.jsx(cte,{placeholder:"Select position"})})}),t.jsxs(fte,{children:[t.jsx(hte,{value:"owner",children:"Owner"}),t.jsx(hte,{value:"manager",children:"Manager"}),t.jsx(hte,{value:"director",children:"Director"})]})]}),t.jsx(Fue,{className:"text-xs"})]})})]});var Vue,Bue,zue;(Bue=Vue||(Vue={})).assertEqual=e=>e,Bue.assertIs=function(e){},Bue.assertNever=function(e){throw new Error},Bue.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Bue.getValidEnumValues=e=>{const t=Bue.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return Bue.objectValues(n)},Bue.objectValues=e=>Bue.objectKeys(e).map((function(t){return e[t]})),Bue.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},Bue.find=(e,t)=>{for(const n of e)if(t(n))return n},Bue.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,Bue.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},Bue.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(zue||(zue={})).mergeShapes=(e,t)=>({...e,...t});const Hue=Vue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),que=e=>{switch(typeof e){case"undefined":return Hue.undefined;case"string":return Hue.string;case"number":return isNaN(e)?Hue.nan:Hue.number;case"boolean":return Hue.boolean;case"function":return Hue.function;case"bigint":return Hue.bigint;case"symbol":return Hue.symbol;case"object":return Array.isArray(e)?Hue.array:null===e?Hue.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Hue.promise:"undefined"!=typeof Map&&e instanceof Map?Hue.map:"undefined"!=typeof Set&&e instanceof Set?Hue.set:"undefined"!=typeof Date&&e instanceof Date?Hue.date:Hue.object;default:return Hue.unknown}},Gue=Vue.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 Kue 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 Kue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vue.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()}}Kue.create=e=>new Kue(e);const Wue=(e,t)=>{let n;switch(e.code){case Gue.invalid_type:n=e.received===Hue.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Gue.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Vue.jsonStringifyReplacer)}`;break;case Gue.unrecognized_keys:n=`Unrecognized key(s) in object: ${Vue.joinValues(e.keys,", ")}`;break;case Gue.invalid_union:n="Invalid input";break;case Gue.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Vue.joinValues(e.options)}`;break;case Gue.invalid_enum_value:n=`Invalid enum value. Expected ${Vue.joinValues(e.options)}, received '${e.received}'`;break;case Gue.invalid_arguments:n="Invalid function arguments";break;case Gue.invalid_return_type:n="Invalid function return type";break;case Gue.invalid_date:n="Invalid date";break;case Gue.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}"`:Vue.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Gue.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 Gue.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 Gue.custom:n="Invalid input";break;case Gue.invalid_intersection_types:n="Intersection results could not be merged";break;case Gue.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Gue.not_finite:n="Number must be finite";break;default:n=t.defaultError,Vue.assertNever(e)}return{message:n}};let Yue=Wue;function Xue(){return Yue}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 Que(e,t){const n=Xue(),r=Zue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Wue?void 0:Wue].filter((e=>!!e))});e.common.issues.push(r)}class Jue{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 ede;"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 Jue.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 ede;if("aborted"===o.status)return ede;"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 ede=Object.freeze({status:"aborted"}),tde=e=>({status:"dirty",value:e}),nde=e=>({status:"valid",value:e}),rde=e=>"aborted"===e.status,ode=e=>"dirty"===e.status,ide=e=>"valid"===e.status,ade=e=>"undefined"!=typeof Promise&&e instanceof Promise;function sde(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 lde(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 cde,ude,dde,pde;"function"==typeof SuppressedError&&SuppressedError,(ude=cde||(cde={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},ude.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class fde{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 hde=(e,t)=>{if(ide(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 Kue(e.common.issues);return this._error=t,this._error}}};function mde(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 gde{get description(){return this._def.description}_getType(e){return que(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:que(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Jue,ctx:{common:e.parent.common,data:e.data,parsedType:que(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ade(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:que(e)},o=this._parseSync({data:e,path:r.path,parent:r});return hde(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:que(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return ide(t)?{value:t.value}:{issues:r.common.issues}}catch(ZSe){(null===(n=null===(t=null==ZSe?void 0:ZSe.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=>ide(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:que(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(ade(r)?r:Promise.resolve(r));return hde(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:Gue.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 vpe({schema:this,typeName:Ope.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 ype.create(this,this._def)}nullable(){return bpe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qde.create(this)}promise(){return gpe.create(this,this._def)}or(e){return tpe.create([this,e],this._def)}and(e){return ipe.create(this,e,this._def)}transform(e){return new vpe({...mde(this._def),schema:this,typeName:Ope.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new xpe({...mde(this._def),innerType:this,defaultValue:t,typeName:Ope.ZodDefault})}brand(){return new Epe({typeName:Ope.ZodBranded,type:this,...mde(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new wpe({...mde(this._def),innerType:this,catchValue:t,typeName:Ope.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Tpe.create(this,e)}readonly(){return Cpe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vde=/^c[^\s-]{8,}$/i,yde=/^[0-9a-z]+$/,bde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xde=/^[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,wde=/^[a-z0-9_-]{21}$/i,_de=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sde=/^[-+]?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)?)??$/,Ede=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Tde;const Cde=/^(?:(?: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])$/,Ade=/^(?:(?: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])$/,Nde=/^(([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]))$/,Rde=/^(([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])$/,Ode=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kde="((\\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])))",Mde=new RegExp(`^${kde}$`);function jde(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 Lde(e){return new RegExp(`^${jde(e)}$`)}function Dde(e){let t=`${kde}T${jde(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 Ide(e,t){if(!_de.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(QSe){return!1}}function Fde(e,t){return!("v4"!==t&&t||!Ade.test(e))||!("v6"!==t&&t||!Rde.test(e))}class Ude extends gde{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Hue.string){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.string,received:t.parsedType}),ede}const t=new Jue;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.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),Que(n,{code:Gue.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?Que(n,{code:Gue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&Que(n,{code:Gue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)Ede.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"email",code:Gue.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Tde||(Tde=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Tde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"emoji",code:Gue.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)xde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"uuid",code:Gue.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)wde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"nanoid",code:Gue.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)vde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"cuid",code:Gue.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)yde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"cuid2",code:Gue.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)bde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"ulid",code:Gue.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(QSe){n=this._getOrReturnCtx(e,n),Que(n,{validation:"url",code:Gue.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),Que(n,{validation:"regex",code:Gue.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),Que(n,{code:Gue.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),Que(n,{code:Gue.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),Que(n,{code:Gue.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){Dde(i).test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Mde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){Lde(i).test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?Sde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"duration",code:Gue.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!Cde.test(r))&&("v6"!==o&&o||!Nde.test(r))&&(n=this._getOrReturnCtx(e,n),Que(n,{validation:"ip",code:Gue.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?Ide(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"jwt",code:Gue.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Fde(e.data,i.version)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"cidr",code:Gue.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?Ode.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"base64",code:Gue.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Pde.test(e.data)||(n=this._getOrReturnCtx(e,n),Que(n,{validation:"base64url",code:Gue.invalid_string,message:i.message}),t.dirty()):Vue.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:Gue.invalid_string,...cde.errToObj(n)})}_addCheck(e){return new Ude({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...cde.errToObj(e)})}url(e){return this._addCheck({kind:"url",...cde.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...cde.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...cde.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...cde.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...cde.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...cde.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...cde.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...cde.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...cde.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...cde.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...cde.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...cde.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,...cde.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,...cde.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...cde.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...cde.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...cde.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...cde.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...cde.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...cde.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...cde.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...cde.errToObj(t)})}nonempty(e){return this.min(1,cde.errToObj(e))}trim(){return new Ude({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ude({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ude({...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 $de(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)}Ude.create=e=>{var t;return new Ude({checks:[],typeName:Ope.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...mde(e)})};class Vde extends gde{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)!==Hue.number){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.number,received:t.parsedType}),ede}let t;const n=new Jue;for(const r of this._def.checks)if("int"===r.kind)Vue.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Que(t,{code:Gue.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),Que(t,{code:Gue.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),Que(t,{code:Gue.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==$de(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Que(t,{code:Gue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Que(t,{code:Gue.not_finite,message:r.message}),n.dirty()):Vue.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,cde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,cde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,cde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,cde.toString(t))}setLimit(e,t,n,r){return new Vde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:cde.toString(r)}]})}_addCheck(e){return new Vde({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:cde.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:cde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:cde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:cde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:cde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:cde.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:cde.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:cde.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:cde.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&&Vue.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)}}Vde.create=e=>new Vde({checks:[],typeName:Ope.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...mde(e)});class Bde extends gde{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(QSe){return this._getInvalidInput(e)}if(this._getType(e)!==Hue.bigint)return this._getInvalidInput(e);let t;const n=new Jue;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),Que(t,{code:Gue.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),Que(t,{code:Gue.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),Que(t,{code:Gue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Vue.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.bigint,received:t.parsedType}),ede}gte(e,t){return this.setLimit("min",e,!0,cde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,cde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,cde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,cde.toString(t))}setLimit(e,t,n,r){return new Bde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:cde.toString(r)}]})}_addCheck(e){return new Bde({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:cde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:cde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:cde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:cde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:cde.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}}Bde.create=e=>{var t;return new Bde({checks:[],typeName:Ope.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...mde(e)})};class zde extends gde{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Hue.boolean){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.boolean,received:t.parsedType}),ede}return nde(e.data)}}zde.create=e=>new zde({typeName:Ope.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...mde(e)});class Hde extends gde{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Hue.date){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.date,received:t.parsedType}),ede}if(isNaN(e.data.getTime())){return Que(this._getOrReturnCtx(e),{code:Gue.invalid_date}),ede}const t=new Jue;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Que(n,{code:Gue.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),Que(n,{code:Gue.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Vue.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Hde({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:cde.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:cde.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}}Hde.create=e=>new Hde({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ope.ZodDate,...mde(e)});class qde extends gde{_parse(e){if(this._getType(e)!==Hue.symbol){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.symbol,received:t.parsedType}),ede}return nde(e.data)}}qde.create=e=>new qde({typeName:Ope.ZodSymbol,...mde(e)});class Gde extends gde{_parse(e){if(this._getType(e)!==Hue.undefined){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.undefined,received:t.parsedType}),ede}return nde(e.data)}}Gde.create=e=>new Gde({typeName:Ope.ZodUndefined,...mde(e)});class Kde extends gde{_parse(e){if(this._getType(e)!==Hue.null){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.null,received:t.parsedType}),ede}return nde(e.data)}}Kde.create=e=>new Kde({typeName:Ope.ZodNull,...mde(e)});class Wde extends gde{constructor(){super(...arguments),this._any=!0}_parse(e){return nde(e.data)}}Wde.create=e=>new Wde({typeName:Ope.ZodAny,...mde(e)});class Yde extends gde{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nde(e.data)}}Yde.create=e=>new Yde({typeName:Ope.ZodUnknown,...mde(e)});class Xde extends gde{_parse(e){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.never,received:t.parsedType}),ede}}Xde.create=e=>new Xde({typeName:Ope.ZodNever,...mde(e)});class Zde extends gde{_parse(e){if(this._getType(e)!==Hue.undefined){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.void,received:t.parsedType}),ede}return nde(e.data)}}Zde.create=e=>new Zde({typeName:Ope.ZodVoid,...mde(e)});class Qde extends gde{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Hue.array)return Que(t,{code:Gue.invalid_type,expected:Hue.array,received:t.parsedType}),ede;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(Que(t,{code:e?Gue.too_big:Gue.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&&(Que(t,{code:Gue.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&&(Que(t,{code:Gue.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 fde(t,e,t.path,n))))).then((e=>Jue.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new fde(t,e,t.path,n))));return Jue.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new Qde({...this._def,minLength:{value:e,message:cde.toString(t)}})}max(e,t){return new Qde({...this._def,maxLength:{value:e,message:cde.toString(t)}})}length(e,t){return new Qde({...this._def,exactLength:{value:e,message:cde.toString(t)}})}nonempty(e){return this.min(1,e)}}function Jde(e){if(e instanceof epe){const t={};for(const n in e.shape){t[n]=ype.create(Jde(e.shape[n]))}return new epe({...e._def,shape:()=>t})}return e instanceof Qde?new Qde({...e._def,type:Jde(e.element)}):e instanceof ype?ype.create(Jde(e.unwrap())):e instanceof bpe?bpe.create(Jde(e.unwrap())):e instanceof ape?ape.create(e.items.map((e=>Jde(e)))):e}Qde.create=(e,t)=>new Qde({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ope.ZodArray,...mde(t)});class epe extends gde{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=Vue.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Hue.object){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.object,received:t.parsedType}),ede}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Xde&&"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 fde(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof Xde){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&&(Que(n,{code:Gue.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 fde(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=>Jue.mergeObjectSync(t,e))):Jue.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new epe({...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=cde.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new epe({...this._def,unknownKeys:"strip"})}passthrough(){return new epe({...this._def,unknownKeys:"passthrough"})}extend(e){return new epe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new epe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ope.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new epe({...this._def,catchall:e})}pick(e){const t={};return Vue.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new epe({...this._def,shape:()=>t})}omit(e){const t={};return Vue.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new epe({...this._def,shape:()=>t})}deepPartial(){return Jde(this)}partial(e){const t={};return Vue.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new epe({...this._def,shape:()=>t})}required(e){const t={};return Vue.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ype;)e=e._def.innerType;t[n]=e}})),new epe({...this._def,shape:()=>t})}keyof(){return fpe(Vue.objectKeys(this.shape))}}epe.create=(e,t)=>new epe({shape:()=>e,unknownKeys:"strip",catchall:Xde.create(),typeName:Ope.ZodObject,...mde(t)}),epe.strictCreate=(e,t)=>new epe({shape:()=>e,unknownKeys:"strict",catchall:Xde.create(),typeName:Ope.ZodObject,...mde(t)}),epe.lazycreate=(e,t)=>new epe({shape:e,unknownKeys:"strip",catchall:Xde.create(),typeName:Ope.ZodObject,...mde(t)});class tpe extends gde{_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 Kue(e.ctx.common.issues)));return Que(t,{code:Gue.invalid_union,unionErrors:n}),ede}));{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 Kue(e)));return Que(t,{code:Gue.invalid_union,unionErrors:o}),ede}}get options(){return this._def.options}}tpe.create=(e,t)=>new tpe({options:e,typeName:Ope.ZodUnion,...mde(t)});const npe=e=>e instanceof dpe?npe(e.schema):e instanceof vpe?npe(e.innerType()):e instanceof ppe?[e.value]:e instanceof hpe?e.options:e instanceof mpe?Vue.objectValues(e.enum):e instanceof xpe?npe(e._def.innerType):e instanceof Gde?[void 0]:e instanceof Kde?[null]:e instanceof ype?[void 0,...npe(e.unwrap())]:e instanceof bpe?[null,...npe(e.unwrap())]:e instanceof Epe||e instanceof Cpe?npe(e.unwrap()):e instanceof wpe?npe(e._def.innerType):[];class rpe extends gde{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Hue.object)return Que(t,{code:Gue.invalid_type,expected:Hue.object,received:t.parsedType}),ede;const n=this.discriminator,r=this.optionsMap.get(t.data[n]);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(Que(t,{code:Gue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ede)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const o of t){const t=npe(o.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,o)}}return new rpe({typeName:Ope.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...mde(n)})}}function ope(e,t){const n=que(e),r=que(t);if(e===t)return{valid:!0,data:e};if(n===Hue.object&&r===Hue.object){const n=Vue.objectKeys(t),r=Vue.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=ope(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===Hue.array&&r===Hue.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=ope(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===Hue.date&&r===Hue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ipe extends gde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(rde(e)||rde(r))return ede;const o=ope(e.value,r.value);return o.valid?((ode(e)||ode(r))&&t.dirty(),{status:t.value,value:o.data}):(Que(n,{code:Gue.invalid_intersection_types}),ede)};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}))}}ipe.create=(e,t,n)=>new ipe({left:e,right:t,typeName:Ope.ZodIntersection,...mde(n)});class ape extends gde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Hue.array)return Que(n,{code:Gue.invalid_type,expected:Hue.array,received:n.parsedType}),ede;if(n.data.length<this._def.items.length)return Que(n,{code:Gue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ede;!this._def.rest&&n.data.length>this._def.items.length&&(Que(n,{code:Gue.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 fde(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>Jue.mergeArray(t,e))):Jue.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new ape({...this._def,rest:e})}}ape.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ape({items:e,typeName:Ope.ZodTuple,rest:null,...mde(t)})};class spe extends gde{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!==Hue.object)return Que(n,{code:Gue.invalid_type,expected:Hue.object,received:n.parsedType}),ede;const r=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)r.push({key:o._parse(new fde(n,a,n.path,a)),value:i._parse(new fde(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Jue.mergeObjectAsync(t,r):Jue.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new spe(t instanceof gde?{keyType:e,valueType:t,typeName:Ope.ZodRecord,...mde(n)}:{keyType:Ude.create(),valueType:e,typeName:Ope.ZodRecord,...mde(t)})}}class lpe extends gde{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!==Hue.map)return Que(n,{code:Gue.invalid_type,expected:Hue.map,received:n.parsedType}),ede;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new fde(n,e,n.path,[i,"key"])),value:o._parse(new fde(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 ede;"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 ede;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}lpe.create=(e,t,n)=>new lpe({valueType:t,keyType:e,typeName:Ope.ZodMap,...mde(n)});class cpe extends gde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Hue.set)return Que(n,{code:Gue.invalid_type,expected:Hue.set,received:n.parsedType}),ede;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Que(n,{code:Gue.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&&(Que(n,{code:Gue.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 ede;"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 fde(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new cpe({...this._def,minSize:{value:e,message:cde.toString(t)}})}max(e,t){return new cpe({...this._def,maxSize:{value:e,message:cde.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}cpe.create=(e,t)=>new cpe({valueType:e,minSize:null,maxSize:null,typeName:Ope.ZodSet,...mde(t)});class upe extends gde{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Hue.function)return Que(t,{code:Gue.invalid_type,expected:Hue.function,received:t.parsedType}),ede;function n(e,n){return Zue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Xue(),Wue].filter((e=>!!e)),issueData:{code:Gue.invalid_arguments,argumentsError:n}})}function r(e,n){return Zue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Xue(),Wue].filter((e=>!!e)),issueData:{code:Gue.invalid_return_type,returnTypeError:n}})}const o={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof gpe){const e=this;return nde((async function(...t){const a=new Kue([]),s=await e._def.args.parseAsync(t,o).catch((e=>{throw a.addIssue(n(t,e)),a})),l=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(l,o).catch((e=>{throw a.addIssue(r(l,e)),a}))}))}{const e=this;return nde((function(...t){const a=e._def.args.safeParse(t,o);if(!a.success)throw new Kue([n(t,a.error)]);const s=Reflect.apply(i,this,a.data),l=e._def.returns.safeParse(s,o);if(!l.success)throw new Kue([r(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new upe({...this._def,args:ape.create(e).rest(Yde.create())})}returns(e){return new upe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new upe({args:e||ape.create([]).rest(Yde.create()),returns:t||Yde.create(),typeName:Ope.ZodFunction,...mde(n)})}}class dpe extends gde{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})}}dpe.create=(e,t)=>new dpe({getter:e,typeName:Ope.ZodLazy,...mde(t)});class ppe extends gde{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Que(t,{received:t.data,code:Gue.invalid_literal,expected:this._def.value}),ede}return{status:"valid",value:e.data}}get value(){return this._def.value}}function fpe(e,t){return new hpe({values:e,typeName:Ope.ZodEnum,...mde(t)})}ppe.create=(e,t)=>new ppe({value:e,typeName:Ope.ZodLiteral,...mde(t)});class hpe extends gde{constructor(){super(...arguments),dde.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return Que(t,{expected:Vue.joinValues(this._def.values),received:t.parsedType,code:Gue.invalid_type}),ede}if(sde(this,dde)||lde(this,dde,new Set(this._def.values)),!sde(this,dde).has(e.data)){const t=this._getOrReturnCtx(e);return Que(t,{received:t.data,code:Gue.invalid_enum_value,options:this._def.values}),ede}return nde(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 hpe.create(e,{...this._def,...t})}exclude(e,t=this._def){return hpe.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}dde=new WeakMap,hpe.create=fpe;class mpe extends gde{constructor(){super(...arguments),pde.set(this,void 0)}_parse(e){const t=Vue.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Hue.string&&n.parsedType!==Hue.number){const e=Vue.objectValues(t);return Que(n,{expected:Vue.joinValues(e),received:n.parsedType,code:Gue.invalid_type}),ede}if(sde(this,pde)||lde(this,pde,new Set(Vue.getValidEnumValues(this._def.values))),!sde(this,pde).has(e.data)){const e=Vue.objectValues(t);return Que(n,{received:n.data,code:Gue.invalid_enum_value,options:e}),ede}return nde(e.data)}get enum(){return this._def.values}}pde=new WeakMap,mpe.create=(e,t)=>new mpe({values:e,typeName:Ope.ZodNativeEnum,...mde(t)});class gpe extends gde{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Hue.promise&&!1===t.common.async)return Que(t,{code:Gue.invalid_type,expected:Hue.promise,received:t.parsedType}),ede;const n=t.parsedType===Hue.promise?t.data:Promise.resolve(t.data);return nde(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}gpe.create=(e,t)=>new gpe({type:e,typeName:Ope.ZodPromise,...mde(t)});class vpe extends gde{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ope.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=>{Que(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 ede;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?ede:"dirty"===r.status||"dirty"===t.value?tde(r.value):r}));{if("aborted"===t.value)return ede;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?ede:"dirty"===r.status||"dirty"===t.value?tde(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?ede:("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?ede:("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(!ide(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=>ide(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}Vue.assertNever(r)}}vpe.create=(e,t,n)=>new vpe({schema:e,typeName:Ope.ZodEffects,effect:t,...mde(n)}),vpe.createWithPreprocess=(e,t,n)=>new vpe({schema:t,effect:{type:"preprocess",transform:e},typeName:Ope.ZodEffects,...mde(n)});class ype extends gde{_parse(e){return this._getType(e)===Hue.undefined?nde(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ype.create=(e,t)=>new ype({innerType:e,typeName:Ope.ZodOptional,...mde(t)});class bpe extends gde{_parse(e){return this._getType(e)===Hue.null?nde(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}bpe.create=(e,t)=>new bpe({innerType:e,typeName:Ope.ZodNullable,...mde(t)});class xpe extends gde{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Hue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}xpe.create=(e,t)=>new xpe({innerType:e,typeName:Ope.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...mde(t)});class wpe extends gde{_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 ade(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Kue(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Kue(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}wpe.create=(e,t)=>new wpe({innerType:e,typeName:Ope.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...mde(t)});class _pe extends gde{_parse(e){if(this._getType(e)!==Hue.nan){const t=this._getOrReturnCtx(e);return Que(t,{code:Gue.invalid_type,expected:Hue.nan,received:t.parsedType}),ede}return{status:"valid",value:e.data}}}_pe.create=e=>new _pe({typeName:Ope.ZodNaN,...mde(e)});const Spe=Symbol("zod_brand");class Epe extends gde{_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 Tpe extends gde{_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?ede:"dirty"===e.status?(t.dirty(),tde(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?ede:"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 Tpe({in:e,out:t,typeName:Ope.ZodPipeline})}}class Cpe extends gde{_parse(e){const t=this._def.innerType._parse(e),n=e=>(ide(e)&&(e.value=Object.freeze(e.value)),e);return ade(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Ape(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Npe(e,t={},n){return e?Wde.create().superRefine(((r,o)=>{var i,a;const s=e(r);if(s instanceof Promise)return s.then((e=>{var i,a;if(!e){const e=Ape(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=Ape(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}})):Wde.create()}Cpe.create=(e,t)=>new Cpe({innerType:e,typeName:Ope.ZodReadonly,...mde(t)});const Rpe={object:epe.lazycreate};var Ope,Ppe;(Ppe=Ope||(Ope={})).ZodString="ZodString",Ppe.ZodNumber="ZodNumber",Ppe.ZodNaN="ZodNaN",Ppe.ZodBigInt="ZodBigInt",Ppe.ZodBoolean="ZodBoolean",Ppe.ZodDate="ZodDate",Ppe.ZodSymbol="ZodSymbol",Ppe.ZodUndefined="ZodUndefined",Ppe.ZodNull="ZodNull",Ppe.ZodAny="ZodAny",Ppe.ZodUnknown="ZodUnknown",Ppe.ZodNever="ZodNever",Ppe.ZodVoid="ZodVoid",Ppe.ZodArray="ZodArray",Ppe.ZodObject="ZodObject",Ppe.ZodUnion="ZodUnion",Ppe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Ppe.ZodIntersection="ZodIntersection",Ppe.ZodTuple="ZodTuple",Ppe.ZodRecord="ZodRecord",Ppe.ZodMap="ZodMap",Ppe.ZodSet="ZodSet",Ppe.ZodFunction="ZodFunction",Ppe.ZodLazy="ZodLazy",Ppe.ZodLiteral="ZodLiteral",Ppe.ZodEnum="ZodEnum",Ppe.ZodEffects="ZodEffects",Ppe.ZodNativeEnum="ZodNativeEnum",Ppe.ZodOptional="ZodOptional",Ppe.ZodNullable="ZodNullable",Ppe.ZodDefault="ZodDefault",Ppe.ZodCatch="ZodCatch",Ppe.ZodPromise="ZodPromise",Ppe.ZodBranded="ZodBranded",Ppe.ZodPipeline="ZodPipeline",Ppe.ZodReadonly="ZodReadonly";const kpe=Ude.create,Mpe=Vde.create,jpe=_pe.create,Lpe=Bde.create,Dpe=zde.create,Ipe=Hde.create,Fpe=qde.create,Upe=Gde.create,$pe=Kde.create,Vpe=Wde.create,Bpe=Yde.create,zpe=Xde.create,Hpe=Zde.create,qpe=Qde.create,Gpe=epe.create,Kpe=epe.strictCreate,Wpe=tpe.create,Ype=rpe.create,Xpe=ipe.create,Zpe=ape.create,Qpe=spe.create,Jpe=lpe.create,efe=cpe.create,tfe=upe.create,nfe=dpe.create,rfe=ppe.create,ofe=hpe.create,ife=mpe.create,afe=gpe.create,sfe=vpe.create,lfe=ype.create,cfe=bpe.create,ufe=vpe.createWithPreprocess,dfe=Tpe.create,pfe={string:e=>Ude.create({...e,coerce:!0}),number:e=>Vde.create({...e,coerce:!0}),boolean:e=>zde.create({...e,coerce:!0}),bigint:e=>Bde.create({...e,coerce:!0}),date:e=>Hde.create({...e,coerce:!0})},ffe=ede;var hfe=Object.freeze({__proto__:null,defaultErrorMap:Wue,setErrorMap:function(e){Yue=e},getErrorMap:Xue,makeIssue:Zue,EMPTY_PATH:[],addIssueToContext:Que,ParseStatus:Jue,INVALID:ede,DIRTY:tde,OK:nde,isAborted:rde,isDirty:ode,isValid:ide,isAsync:ade,get util(){return Vue},get objectUtil(){return zue},ZodParsedType:Hue,getParsedType:que,ZodType:gde,datetimeRegex:Dde,ZodString:Ude,ZodNumber:Vde,ZodBigInt:Bde,ZodBoolean:zde,ZodDate:Hde,ZodSymbol:qde,ZodUndefined:Gde,ZodNull:Kde,ZodAny:Wde,ZodUnknown:Yde,ZodNever:Xde,ZodVoid:Zde,ZodArray:Qde,ZodObject:epe,ZodUnion:tpe,ZodDiscriminatedUnion:rpe,ZodIntersection:ipe,ZodTuple:ape,ZodRecord:spe,ZodMap:lpe,ZodSet:cpe,ZodFunction:upe,ZodLazy:dpe,ZodLiteral:ppe,ZodEnum:hpe,ZodNativeEnum:mpe,ZodPromise:gpe,ZodEffects:vpe,ZodTransformer:vpe,ZodOptional:ype,ZodNullable:bpe,ZodDefault:xpe,ZodCatch:wpe,ZodNaN:_pe,BRAND:Spe,ZodBranded:Epe,ZodPipeline:Tpe,ZodReadonly:Cpe,custom:Npe,Schema:gde,ZodSchema:gde,late:Rpe,get ZodFirstPartyTypeKind(){return Ope},coerce:pfe,any:Vpe,array:qpe,bigint:Lpe,boolean:Dpe,date:Ipe,discriminatedUnion:Ype,effect:sfe,enum:ofe,function:tfe,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Npe((t=>t instanceof e),t),intersection:Xpe,lazy:nfe,literal:rfe,map:Jpe,nan:jpe,nativeEnum:ife,never:zpe,null:$pe,nullable:cfe,number:Mpe,object:Gpe,oboolean:()=>Dpe().optional(),onumber:()=>Mpe().optional(),optional:lfe,ostring:()=>kpe().optional(),pipeline:dfe,preprocess:ufe,promise:afe,record:Qpe,set:efe,strictObject:Kpe,string:kpe,symbol:Fpe,transformer:sfe,tuple:Zpe,undefined:Upe,union:Wpe,unknown:Bpe,void:Hpe,NEVER:ffe,ZodIssueCode:Gue,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Kue});const mfe=hfe.object({company:hfe.object({legalName:hfe.string().min(1,"Legal company name is required"),type:hfe.enum(["corporation","llc"]).optional(),ein:hfe.string().min(1,"EIN is required")}),representative:hfe.object({title:hfe.string().min(1,"Title is required"),firstName:hfe.string().min(1,"First name is required"),email:hfe.string().email("Invalid email address"),phone:hfe.string().min(1,"Phone number is required"),position:hfe.enum(["owner","manager","director"]).optional()})}),gfe=({onSave:e,onBack:r})=>{const o=n.useRef(null),{isUpdatingBrandSettings:i,data:a}=Bte(),{toast:s}=jl(),[l,c]=n.useState(Boolean(null));n.useEffect((()=>{o.current?.focus()}),[]);const u=wue({resolver:Aue(mfe),defaultValues:{company:{legalName:"",type:void 0,ein:""},representative:{title:"",firstName:"",email:"",phone:"",position:void 0}}}),d=a?.branding?.primaryColor||"#000000",p=Object.entries(u.formState.errors).reduce(((e,[t,n])=>"company"===t||"representative"===t?e+Object.keys(n).length:e+1),0);return t.jsx(Oue,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit((async t=>{try{s({title:"Settings saved 🚀"}),e?.()}catch(n){s({title:"Error saving settings",variant:"destructive"})}})),className:"w-full h-full flex flex-col bg-white rounded-lg",children:[t.jsx("div",{className:"flex-1 flex flex-col min-h-0 px-6 pt-16 overflow-y-auto relative",children:t.jsxs("div",{className:"flex-1 w-full min-h-[400px] @container flex flex-col gap-2",children:[!l&&t.jsx("div",{className:Zd(Rue({variant:"warning",size:"default",position:"inline"}),Nue,"p-4 relative"),role:"alert",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"mr-3 shrink-0 pt-0.5",children:t.jsx(Xu,{className:"h-6 w-6"})}),t.jsxs("div",{className:"flex-grow",children:[t.jsx("h5",{className:"text-sm font-medium mb-1",children:"Complete Required Information"}),t.jsx("div",{className:"text-sm",children:"Please complete the required information to get your Twilio phone number."})]})]})}),t.jsxs("div",{className:"bg-card rounded-lg border shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between p-6",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Twilio Application"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Status:"}),t.jsx("span",{className:"inline-flex items-center rounded-full bg-yellow-100 px-2 py-1 text-xs font-medium text-yellow-800",children:"Pending"})]})]}),t.jsxs("div",{className:"py-4 @md:grid @md:grid-cols-2 @md:gap-8 px-6",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-medium pb-2 border-b border-border",children:"Company"}),t.jsx("div",{className:"space-y-4 py-4",children:t.jsx(Uue,{control:u.control,disabled:i,legalNameRef:o})})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-medium pb-2 border-b border-border",children:"Authorized Representative"}),t.jsx("div",{className:"space-y-4 py-4",children:t.jsx($ue,{control:u.control,disabled:i})})]})]})]}),t.jsx("div",{className:"h-4",children:" "})]})}),t.jsxs(AB,{className:"py-4 px-6",children:[r&&t.jsx(gZ,{variant:"outline",className:"gap-1.5",onClick:r,disabled:i,children:"Go Back"}),t.jsxs("div",{className:"flex items-center gap-4",children:[p>0&&t.jsxs("span",{className:"text-sm text-destructive flex items-center gap-1.5",children:["Please fix the ",t.jsx("span",{className:"font-bold",children:p})," ","fields that need attention"]}),t.jsx(gZ,{type:"submit",className:"px-4",style:{backgroundColor:d},disabled:i||!u.formState.isDirty,children:i?t.jsxs(t.Fragment,{children:[t.jsx(Nu,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving"]}):"Save Changes"})]})]})]})})};function vfe({tabs:e,activeTab:n,onTabChange:r,title:o}){return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:"w-48 py-2 pl-4",children:[o&&t.jsx("h2",{className:"px-4 pt-4 pb-5 text-lg font-medium",children:o}),e.map((e=>t.jsx(gZ,{variant:"ghost",className:Zd("w-full justify-start mb-1",n===e.id&&"bg-accent"),onClick:()=>r(e.id),children:e.label},e.id)))]}),t.jsx("div",{className:"flex-1",children:e.find((e=>e.id===n))?.content})]})}function yfe({open:e,setOpen:r}){const[o,i]=n.useState("brand"),a=(()=>{const{flags:e}=n.useContext(al.reactContext);return e})()["show-settings-modal"]??!1;n.useEffect((()=>{e&&i("brand")}),[e]);const s=a?[{id:"brand",label:"Brand",content:t.jsx(Xle,{})},{id:"phone-number",label:"Phone Number",content:t.jsx(gfe,{})}]:[{id:"brand",label:"Brand",content:t.jsx(Xle,{})}];return t.jsx(_B,{open:e,onOpenChange:r,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 p-0",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Settings"}),t.jsx(RB,{children:"Edit your business and brand settings"})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(vfe,{tabs:s,activeTab:o,onTabChange:i,title:"Settings"})})]})})}const bfe=e=>{const{updateAutomation:t,updateError:r,isUpdateSuccess:o}=Le(e),{toast:i}=jl();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 xfe(){const{toast:e}=jl(),[r,o]=n.useState(null),{toggleStatus:i}=bfe(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 wfe(){const{toast:e}=jl(),[r,o]=n.useState(!1),[i,a]=n.useState(null),{toggleStatus:s}=bfe(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(gZ,{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(Ple,{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 _fe(){const{toast:e}=jl(),[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}=ZX({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(gZ,{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 Sfe=()=>{const e=[{id:"broadcasts",label:ff("engage:one_time",{count:2}),content:t.jsx(wfe,{})},{id:"automations",label:ff("engage:automation",{count:2}),content:t.jsx(xfe,{})},{id:"segments",label:ff("engage:segment",{count:2}),content:t.jsx(_fe,{})},{id:"statistics",label:ff("engage:insight",{count:2}),content:t.jsx(Hle,{})}],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(yfe,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(gZ,{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(kle,{activeTab:a,tabs:e,onTabChange:s})})]})},Efe=Gpe({name:kpe().min(2,"Title must be at least 2 characters"),description:kpe()});function Tfe({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=iZ(),{toast:i}=jl(),a=wue({resolver:Aue(Efe),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(Oue,{...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(kue,{control:a.control,name:"name",disabled:!0,render:({field:e})=>t.jsxs(Lue,{children:[t.jsx(Due,{children:"Title"}),t.jsx(Iue,{children:t.jsx(H3,{...e})}),t.jsx(Fue,{})]})}),t.jsx(kue,{control:a.control,name:"description",disabled:!0,render:({field:e})=>t.jsxs(Lue,{children:[t.jsx(Due,{children:"Description"}),t.jsx(Iue,{children:t.jsx(zte,{...e})}),t.jsx(Fue,{})]})}),t.jsx(AB,{children:t.jsx(gZ,{type:"submit",children:"Duplicate"})})]})})]})})}const Cfe=Gpe({name:kpe().min(2,"Title must be at least 2 characters"),description:kpe()});function Afe({open:e,onOpenChange:n}){const r=iZ(),{updateAutomation:o}=Le(r?.id||""),i=wue({resolver:Aue(Cfe),defaultValues:{name:r?.name??"",description:r?.description??""},values:{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.jsxs(NB,{children:["Edit"," ",ff(r.triggerType===Fe.ONE_TIME?"engage:one_time":"engage:automation")]}),t.jsxs(RB,{children:["Update the title and description of your"," ",ff(r.triggerType===Fe.ONE_TIME?"engage:one_time":"engage:automation"),"."]})]}),t.jsx(Oue,{...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(kue,{control:i.control,name:"name",render:({field:e})=>t.jsxs(Lue,{children:[t.jsx(Due,{children:"Title"}),t.jsx(Iue,{children:t.jsx(H3,{...e})}),t.jsx(Fue,{})]})}),t.jsx(kue,{control:i.control,name:"description",render:({field:e})=>t.jsxs(Lue,{children:[t.jsx(Due,{children:"Description"}),t.jsx(Iue,{children:t.jsx(zte,{...e})}),t.jsx(Fue,{})]})}),t.jsx(AB,{children:t.jsx(gZ,{type:"submit",children:"Save changes"})})]})})]})}):null}function Nfe({open:e,onOpenChange:n,setIsActive:r}){const o=iZ(),{updateAutomation:i}=Le(o?.id||""),{toast:a}=jl();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(gZ,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(gZ,{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 Rfe=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=iZ(),a=H5(),{updateAutomation:s}=Le(i?.id||""),{toast:l}=jl(),c=(()=>{const{state:e}=oZ();return e.recipientStats})(),u=aZ(),[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)}if(!r)return t.jsx(PZ,{variant:l9(i.status),children:J6[i.status]});switch(i.triggerType){case Fe.TRIGGER_BASED:return 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})]});case Fe.ONE_TIME:if(!i.triggerMetadata||i.triggerMetadata?.triggerType===Fe.ONE_TIME&&!i.triggerMetadata?.scheduledAt)return t.jsx(gZ,{variant:"outline",className:"flex items-center gap-2",disabled:!0,children:"Set Scheduled Time"});if(d)return t.jsx(gZ,{variant:"outline",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:"Convert to Draft"});{let r="Schedule Send";return i.triggerMetadata.triggerType===Fe.ONE_TIME&&i.triggerMetadata.scheduledAt&&new Date(i.triggerMetadata.scheduledAt)<new Date(Date.now()+3e5)&&(r="Send Now"),t.jsx(gZ,{variant:"default",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:r})}default:throw Xte(i.triggerType,Fe)}}),[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(gZ,{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:xZ.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",onClick:()=>g(!0),children:t.jsx(E9,{title:"Duplicate",Icon:xZ.DuplicateIcon,asChild:!1,onClick:()=>g(!0)})})]})}),b?t.jsx("div",{className:"flex items-center text-muted-foreground pr-8",children:t.jsx(fZ,{})}):w()]}),t.jsx(Afe,{open:f,onOpenChange:h}),t.jsx(Tfe,{open:m,onOpenChange:g,onDuplicationCreated:r}),t.jsx(Nfe,{open:v,onOpenChange:y,setIsActive:p})]}):null},Ofe=({hideSms:e,hideSales:n})=>{const r=iZ(),{isLoading:o}=De(r?.id);return!r||o?t.jsx(fZ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(Hle,{automationId:r.id,automation:r,includeSales:!n,includeSms:!e})})},Pfe=()=>{const e=iZ(),{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(xZ.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(fZ,{text:["Fetching Recipients","Finishing up"]})},kfe=n.createContext(null);kfe.displayName="PanelGroupContext";const Mfe="data-panel-group",jfe="data-panel-group-direction",Lfe="data-panel-group-id",Dfe="data-panel",Ife="data-panel-collapsible",Ffe="data-panel-id",Ufe="data-panel-size",$fe="data-resize-handle",Vfe="data-resize-handle-active",Bfe="data-panel-resize-handle-enabled",zfe="data-panel-resize-handle-id",Hfe="data-resize-handle-state",qfe=n.useLayoutEffect,Gfe=i["useId".toString()],Kfe="function"==typeof Gfe?Gfe:()=>null;let Wfe=0;function Yfe(e=null){const t=Kfe(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+Wfe++),null!=e?e:r.current}function Xfe({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(kfe);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=Yfe(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}),qfe((()=>{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)})),qfe((()=>{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},[Lfe]:_,[Dfe]:"",[Ife]:o||void 0,[Ffe]:N,[Ufe]:parseFloat(""+O.flexGrow).toFixed(1)})}const Zfe=n.forwardRef(((e,t)=>n.createElement(Xfe,{...e,forwardedRef:t})));Xfe.displayName="Panel",Zfe.displayName="forwardRef(Panel)";let Qfe=null,Jfe=-1,ehe=null;function the(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&hhe),n=!!(t&mhe);if(t&phe)return e?"se-resize":n?"ne-resize":"e-resize";if(t&fhe)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(Qfe!==o){var i;if(Qfe=o,null===ehe&&(ehe=document.createElement("style"),document.head.appendChild(ehe)),Jfe>=0)null===(i=ehe.sheet)||void 0===i||i.removeRule(Jfe);Jfe=null!==(n=null===(r=ehe.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function nhe(e){return"keydown"===e.type}function rhe(e){return e.type.startsWith("pointer")}function ohe(e){return e.type.startsWith("mouse")}function ihe(e){if(rhe(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(ohe(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const ahe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function she(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=dhe(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||(!!ahe.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function lhe(e){let t=e.length;for(;t--;){const n=e[t];if(khe(n,"Missing node"),she(n))return n}return null}function che(e){return e&&Number(getComputedStyle(e).zIndex)||0}function uhe(e){const t=[];for(;e;)t.push(e),e=dhe(e);return t}function dhe(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const phe=1,fhe=2,hhe=4,mhe=8,ghe="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let vhe=[],yhe=!1,bhe=new Map,xhe=new Map;const whe=new Set;function _he(e){const{target:t}=e,{x:n,y:r}=ihe(e);yhe=!0,Che({target:t,x:n,y:r}),Ohe(),vhe.length>0&&(Phe("down",e),e.preventDefault(),The(t)||e.stopImmediatePropagation())}function She(e){const{x:t,y:n}=ihe(e);if(yhe&&0===e.buttons&&(yhe=!1,Phe("up",e)),!yhe){const{target:r}=e;Che({target:r,x:t,y:n})}Phe("move",e),Nhe(),vhe.length>0&&e.preventDefault()}function Ehe(e){const{target:t}=e,{x:n,y:r}=ihe(e);xhe.clear(),yhe=!1,vhe.length>0&&(e.preventDefault(),The(t)||e.stopImmediatePropagation()),Phe("up",e),Che({target:t,x:n,y:r}),Nhe(),Ohe()}function The(e){let t=e;for(;t;){if(t.hasAttribute($fe))return!0;t=t.parentElement}return!1}function Che({target:e,x:t,y:n}){vhe.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),whe.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=ghe?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:uhe(e),b:uhe(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;khe(r,"Stacking order can only be calculated for elements with a common ancestor");const o=che(lhe(n.a)),i=che(lhe(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}vhe.push(e)}var p,f}))}function Ahe(e,t){xhe.set(e,t)}function Nhe(){let e=!1,t=!1;vhe.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;xhe.forEach((e=>{n|=e})),e&&t?the("intersection",n):e?the("horizontal",n):t?the("vertical",n):null!==ehe&&(document.head.removeChild(ehe),Qfe=null,ehe=null,Jfe=-1)}let Rhe=new AbortController;function Ohe(){Rhe.abort(),Rhe=new AbortController;const e={capture:!0,signal:Rhe.signal};whe.size&&(yhe?(vhe.length>0&&bhe.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",Ehe,e),r.addEventListener("pointerleave",She,e),r.addEventListener("pointermove",She,e))})),bhe.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",Ehe,e),r.addEventListener("pointercancel",Ehe,e)}))):bhe.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",_he,e),r.addEventListener("pointermove",She,e))})))}function Phe(e,t){whe.forEach((n=>{const{setResizeHandlerState:r}=n,o=vhe.includes(n);r(e,o,t)}))}function khe(e,t){if(!e)throw Error(t)}function Mhe(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function jhe(e,t,n=10){return 0===Mhe(e,t,n)}function Lhe(e,t,n){return 0===Mhe(e,t,n)}function Dhe({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];khe(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(Mhe(n,s)<0)if(i){n=Mhe(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function Ihe({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Lhe(e,0))return t;const a=[...t],[s,l]=r;khe(null!=s,"Invalid first pivot index"),khe(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];khe(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(khe(null!=n,`Previous layout not found for panel index ${r}`),Lhe(n,i)){const t=c-n;Mhe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];khe(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(khe(null!=n,`Previous layout not found for panel index ${r}`),Lhe(n,c)){const t=n-i;Mhe(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];khe(null!=e,`Previous layout not found for panel index ${o}`);if(i+=Dhe({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];khe(null!=i,`Previous layout not found for panel index ${r}`);const s=Dhe({panelConstraints:n,panelIndex:r,size:i-o});if(!Lhe(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(!Lhe(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];khe(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=Dhe({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!Lhe(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];khe(null!=o,`Previous layout not found for panel index ${r}`);const i=Dhe({panelConstraints:n,panelIndex:r,size:o+t});if(Lhe(o,i)||(t-=i-o,a[r]=i),Lhe(t,0))break;e>0?r--:r++}}}return Lhe(a.reduce(((e,t)=>t+e),0),100)?a:o}function Fhe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];khe(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 Uhe(e,t=document){return Array.from(t.querySelectorAll(`[${zfe}][data-panel-group-id="${e}"]`))}function $he(e,t,n=document){const r=Uhe(e,n).findIndex((e=>e.getAttribute(zfe)===t));return null!=r?r:null}function Vhe(e,t,n){const r=$he(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function Bhe(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 zhe(e,t=document){const n=t.querySelector(`[${zfe}="${e}"]`);return n||null}function Hhe({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),qfe((()=>{if(!a)return;const e=Uhe(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=Fhe({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];khe(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;khe(e,"Eager values not found");const{panelDataArray:n}=e;khe(null!=Bhe(r,a),`No group found for id "${r}"`);const i=Uhe(r,a);khe(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(zfe);khe(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=zhe(t,r),c=Uhe(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];khe(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=Ihe({delta:Lhe(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:Vhe(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 qhe(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 Ghe(e,t){const n="horizontal"===e,{x:r,y:o}=ihe(t);return n?r:o}function Khe(e,t,n,r,o,i){if(nhe(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=zhe(t,o);khe(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(Lfe);khe(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Ghe(n,e),u=Bhe(s,o);khe(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 Whe(e,t,n){t.forEach(((t,r)=>{const o=e[r];khe(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&&!jhe(u,l)||jhe(t,l)||r(),!e||null!=u&&jhe(u,l)||!jhe(t,l)||e())}}))}function Yhe(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 Xhe(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 Zhe(e){return`react-resizable-panels:${e}`}function Qhe(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 Jhe(e,t){try{const n=Zhe(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 eme(e,t,n,r,o){var i;const a=Zhe(e),s=Qhe(t),l=null!==(i=Jhe(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 tme({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(!Lhe(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];khe(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];khe(null!=e,`No layout data found for index ${i}`);const r=Dhe({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!Lhe(o,0))for(let i=0;i<t.length;i++){const e=n[i];khe(null!=e,`No layout data found for index ${i}`);const r=Dhe({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,Lhe(o,0)))break}return n}const nme={getItem:e=>(Xhe(nme),nme.getItem(e)),setItem:(e,t)=>{Xhe(nme),nme.setItem(e,t)}},rme={};function ome({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=nme,style:u,tagName:d="div",...p}){const f=Yfe(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=tme({layout:e,panelConstraints:r.map((e=>e.constraints))});qhe(n,o)||(y(o),E.current.layout=o,t&&t(o),Whe(r,o,x.current))}})),[]),qfe((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),Hhe({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=rme[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(eme,100),rme[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}=sme(r,e,n);if(khe(null!=a,`Panel size not found for panel "${e.id}"`),!jhe(a,i)){w.current.set(e.id,a);const l=Ihe({delta:ame(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Yhe(n,l)||(y(l),E.current.layout=l,t&&t(l),Whe(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}=sme(o,e,r),u=null!=t?t:l;if(jhe(s,a)){const t=w.current.get(e.id),a=null!=t&&t>=u?t:u,l=Ihe({delta:ame(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});Yhe(r,l)||(y(l),E.current.layout=l,n&&n(l),Whe(o,l,x.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=sme(n,e,t);return khe(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),N=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=ame(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}=sme(n,e,t);return khe(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&jhe(i,r)}),[]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=sme(n,e,t);return khe(null!=i,`Panel size not found for panel "${e.id}"`),!o||Mhe(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]);qfe((()=>{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=Jhe(e,n))&&void 0!==r?r:{})[Qhe(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];khe(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];khe(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=tme({layout:i,panelConstraints:o.map((e=>e.constraints))});qhe(r,a)||(y(a),E.current.layout=a,t&&t(a),Whe(o,a,x.current))}})),qfe((()=>{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=Vhe(a,e,r);let f=Khe(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=Ihe({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:nhe(n)?"keyboard":"mouse-or-touch"}),v=!Yhe(c,g);(rhe(n)||ohe(n))&&_.current!=f&&(_.current=f,Ahe(e,v||0===f?0:m?f<0?phe:fhe:f<0?hhe:mhe)),v&&(y(g),E.current.layout=g,l&&l(g),Whe(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}=sme(o,e,r);khe(null!=a,`Panel size not found for panel "${e.id}"`);const l=Ihe({delta:ame(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});Yhe(r,l)||(y(l),E.current.layout=l,n&&n(l),Whe(o,l,x.current))}),[]),j=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}=sme(r,e,n);null!=u&&(i&&s&&jhe(u,o)?jhe(o,a)||M(e,a):u<c?M(e,c):u>l&&M(e,l))}),[M]),L=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=zhe(e,h.current);khe(o,`Drag handle element not found for id "${e}"`);const i=Ghe(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),D=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=ame(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:j,registerPanel:P,registerResizeHandle:k,resizePanel:M,startDragging:L,stopDragging:D,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,N,f,R,O,j,P,k,M,L,D,I]);return n.createElement(kfe.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},[Mfe]:"",[jfe]:o,[Lfe]:f}))}const ime=n.forwardRef(((e,t)=>n.createElement(ome,{...e,forwardedRef:t})));function ame(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function sme(e,t,n){const r=ame(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function lme({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(kfe);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=Yfe(i),[N,R]=n.useState("inactive"),[O,P]=n.useState(!1),[k,M]=n.useState(null),j=n.useRef({state:N});qfe((()=>{j.current.state=N})),n.useEffect((()=>{if(r)M(null);else{const e=S(A);M((()=>e))}}),[r,A,S]);const L=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,D=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;khe(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=bhe.get(a))&&void 0!==i?i:0;return bhe.set(a,l+1),whe.add(s),Ohe(),function(){var t;xhe.delete(e),whe.delete(s);const n=null!==(t=bhe.get(a))&&void 0!==t?t:1;if(bhe.set(a,n-1),Ohe(),1===n&&bhe.delete(a),vhe.includes(s)){const e=vhe.indexOf(s);e>=0&&vhe.splice(e,1),Nhe(),o("up",!0,null)}}}(A,e,w,{coarse:L,fine:D},((e,n,r)=>{if(n)switch(e){case"down":{R("drag"),t=!1,khe(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}=j.current;t=!0,"drag"!==e&&R("hover"),khe(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")}))}),[L,w,r,D,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=zhe(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(Lfe);khe(r,`No group element found for id "${r}"`);const i=Uhe(r,o),a=$he(r,t,o);khe(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,[jfe]:w,[Lfe]:_,[$fe]:"",[Vfe]:"drag"===N?"pointer":O?"keyboard":void 0,[Bfe]:!r,[zfe]:A,[Hfe]:N})}ome.displayName="PanelGroup",ime.displayName="forwardRef(PanelGroup)",lme.displayName="PanelResizeHandle";const cme=({className:e,...n})=>t.jsx(ime,{className:wB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),ume=Zfe,dme=({withHandle:e,className:n,...r})=>t.jsx(lme,{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 pme=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(pme||{});const fme=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),hme="rgba(245, 246, 247, 1)",mme={[$e.SEND_COMMUNICATION]:{color:{bg:hme},clickable:!0},[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:hme},clickable:!1}},gme={[$e.SEND_COMMUNICATION]:"Send Email & SMS",[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},vme=({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:hme},onClick:n,className:Zd("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:Zd("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:Zd("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})},yme=({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}),bme=()=>{const e=iZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=ZX(),u=n.useCallback((()=>c?.find((e=>e.type===nZ.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(vme,{selected:o===pme.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(pme.EditAudience)},Icon:xZ.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(fme,{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(yme,{segmentName:n.name},e):null}))})]})]})})}):null},xme=()=>{const e=iZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),{segments:i}=ZX(),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(vme,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:xZ.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(fme,{copyText:`When ${ff("engage:user").toLowerCase()} joins the`}),t.jsx(yme,{segmentName:r})]})]})}):null}case Fe.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(vme,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(pme.EditTime)},selected:o===pme.EditTime,Icon:xZ.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(fme,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(yme,{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)}})()})},wme=e=>{switch(e){case $e.SEND_COMMUNICATION:return"Send Communication";case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw LX(e,$e)}},_me=e=>{switch(e){case $e.SEND_COMMUNICATION:return t.jsx(xZ.CommunicationIcon,{className:"w-4 h-4"});case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(xZ.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw Xte(e,$e)}},Sme=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}`},Eme=({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=mme[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:Zd("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??hme},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:_me(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:gme[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:Sme(r.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:r.actionType===$e.SEND_COMMUNICATION&&o?.emailSubject?o?.emailSubject:wme(r.actionType)})]})]})})},Tme=()=>{const[e,r]=n.useState(!1),[o,i]=n.useState(void 0),[a,s]=n.useState(!1),[l,c]=n.useState(""),[u,d]=n.useState(null),p=iZ(),{setActionId:f,state:{selectedActionId:h}}=n.useContext(VX),{updateAutomation:m}=Le(p?.id||""),{toast:g}=jl();if(n.useEffect((()=>{if(!p)return;if(h)return;const e=p.actionData?.find((e=>"send_communication"===e.actionType));e&&f(e.actionMetadata.currentActionId)}),[p,f,h]),n.useEffect((()=>{if(!p)return;(async()=>{const e=[];for(const t of p.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 LX(t.actionType,$e)}i(e)})()}),[p]),n.useEffect((()=>{d(null),c(p?.description??"")}),[p?.description]),!p||!o)return null;const v=(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:p.triggerMetadata?.triggerType===Fe.TRIGGER_BASED?p.triggerMetadata.rootActionId:void 0}).filter((t=>!!e||"send_communication"===t.actionData.actionType));let y=()=>t.jsx("div",{},"empty-trigger-audience");(e||p.triggerType===Fe.ONE_TIME)&&(y=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[p.triggerType===Fe.ONE_TIME&&t.jsx(bme,{}),p.triggerType!==Fe.ONE_TIME&&t.jsx(xme,{})]}));const b=async()=>{d(l),m({description:l},{onSuccess:()=>{g({title:"Description updated 🚀"}),s(!1)}})};return t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[p.description||a?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 group relative transition-colors duration-150",style:{containerType:"inline-size"},tabIndex:0,onClick:()=>{s(!0)},role:"button","aria-label":"Edit automation description",children:a?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("textarea",{className:"w-full bg-transparent outline-none resize-none text-[15px] font-medium leading-snug tracking-tight text-neutral-800 dark:text-neutral-100 rounded-xl border border-primary-500 focus:ring-2 focus:ring-primary-400 transition-all min-h-[48px] p-2",style:{containerType:"inline-size"},value:l,autoFocus:!0,rows:2,maxLength:300,onChange:e=>c(e.target.value),onBlur:()=>{s(!1)},"aria-label":"Edit automation description textarea"}),t.jsx(gZ,{variant:"secondary",onClick:b,onMouseDown:e=>e.preventDefault(),className:"z-20",children:"Update Description"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"pr-8 select-text cursor-pointer",children:null!==u?u:p.description}),t.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity duration-150 pointer-events-none",children:t.jsx(xZ.EditIcon,{className:"w-4 h-4"})})]})}):null,p.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:[y(),v.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(Eme,{actionDataWithMetadata:e})},e.actionData.actionMetadata?.currentActionId??n))),p.triggerType===Fe.ONE_TIME&&t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx(xme,{})})]})})]})},Cme=()=>{const e=iZ(),{segments:n}=ZX();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(Tme,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(fZ,{text:[`Getting details on your ${ff("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},Ame=({hideSms:e})=>{const{state:{selectedActionId:r}}=n.useContext(VX);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(zB,{mode:"wait",children:r===pme.EditTime?t.jsx(Rse,{}):r===pme.EditAudience?t.jsx(wle,{}):t.jsx(wre,{hideSms:e})})})},Nme=({hideSms:e})=>t.jsxs(cme,{direction:"horizontal",className:"flex-1",children:[t.jsx(ume,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(Cme,{})})}),t.jsx(dme,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(ume,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(Ame,{hideSms:e})})})]}),Rme=({hideSms:e,hideSales:r})=>{const[o,i]=n.useState("workflow"),a=[{id:"workflow",label:"Workflow",content:t.jsx(Nme,{hideSms:e})},{id:"recipients",label:"Recipients",content:t.jsx(Pfe,{})},{id:"insights",label:ff("engage:insight",{count:2}),content:t.jsx(Ofe,{hideSms:e,hideSales:r})}];return t.jsx("div",{className:"h-full w-full",children:t.jsx(kle,{tabs:a,activeTab:o,onTabChange:i,tabsLocation:"left"})})},Ome=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i,hideSms:a,hideSales:s})=>{const l=iZ(),c=aZ(),{updateCommunicationGroup:u}=GX(),{toast:d}=jl();return n.useEffect((()=>{if(c&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(c.extraMergeFields)&&u({groupId:c?.id,params:{extraMergeFields:e}},{onError:e=>{d({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[c,i,u,d]),l&&c?t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(Rfe,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(Rme,{hideSms:a,hideSales:s})})]}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(fZ,{text:[`Fetching ${ff("engage:automation").toLowerCase()} data`,"Finishing up"]})})},Pme=({...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(lZ,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(Ome,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var kme=e=>null!=e;var Mme=e=>"function"!=typeof e||e.length?e:e(),jme=e=>Array.isArray(e)?e:e?[e]:[];var Lme=mt;var Dme,Ime=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(ZSe){return r(ZSe,`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(ZSe){r(ZSe,`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(ZSe){r(ZSe,`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(ZSe){r(ZSe,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(ZSe){r(ZSe,`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(ZSe){r(ZSe,`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(ZSe){r(ZSe,`Error getting all values from ${e.name}`)}}})),t}}]},Fme=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},Ume=("function"==typeof(Dme={_cookies:[globalThis.document,"cookie"],getItem:e=>Ume._cookies[0][Ume._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=Ume.getItem(e);Ume._cookies[0][Ume._cookies[1]]=`${e}=${t}${Fme(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:Ume});window.dispatchEvent(o)},removeItem:e=>{Ume._cookies[0][Ume._cookies[1]]=`${e}=deleted${Fme({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return Ume._cookies[0][Ume._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return Ume._cookies[0][Ume._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(Dme.clear=()=>{let e;for(;e=Dme.key(0);)Dme.removeItem(e)}),Dme),$me=796,Vme="bottom",Bme="system",zme=Object.keys(Nr)[0],Hme=Object.keys(Pr)[0],qme=xt({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Gme(){return wt(qme)}var Kme=xt(void 0),Wme=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)})),[...(Gme().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(XSe){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=(Gme().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(Gme().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(Kme.Provider,{value:i,get children(){return e.children}})},Yme=()=>ut((()=>{const e=wt(Kme);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Xme=xt((()=>"dark"));function Zme(){return wt(Xme)}var Qme={"À":"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"},Jme=Object.keys(Qme).join("|"),ege=new RegExp(Jme,"g");var tge=7,nge=6,rge=5,oge=4,ige=3,age=2,sge=1,lge=0;function cge(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:sge,!n.accessors){const r=uge(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=hge(o),a=pge(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:lge,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=uge(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=sge?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 uge(e,t,n){return e=dge(e,n),(t=dge(t,n)).length>e.length?lge:e===t?tge:(e=e.toLowerCase())===(t=t.toLowerCase())?nge:e.startsWith(t)?rge:e.includes(` ${t}`)?oge:e.includes(t)?ige:1===t.length?lge:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?age: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 sge+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return lge;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return lge}return i(r-a)}(e,t)}function dge(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(ege,(e=>Qme[e]))),e}function pge(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 fge={maxRanking:1/0,minRanking:-1/0};function hge(e){return"function"==typeof e?fge:{...fge,...e}}var mge={data:""},gge=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,vge=/\/\*[^]*?\*\/| +/g,yge=/\n+/g,bge=(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]?bge(a,i):i+"{"+bge(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=bge(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+=bge.p?bge.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},xge={},wge=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+wge(e[n]);return t}return e};function _ge(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=wge(e),a=xge[i]||(xge[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!xge[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=gge.exec(e.replace(vge,""));)t[4]?r.shift():t[3]?(n=t[3].replace(yge," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(yge," ").trim();return r[0]})(e);xge[a]=bge(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&xge.g?xge.g:null;return n&&(xge.g=xge[a]),l=xge[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?"":bge(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||mge),t.g,t.o,t.k);var r}function Sge(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=Sge(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ege(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Sge(e))&&(r&&(r+=" "),r+=t);return r}function Tge(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 Cge(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}_ge.bind({g:1}),_ge.bind({k:1});var Age=e=>e instanceof Element;function Nge(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return Nge(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=Nge(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function Rge(e,t=Age,n=Age){const r=ut(e),o=ut((()=>Nge(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function Oge(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function Pge(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()))})),Oge((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function kge(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())),Oge((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var Mge=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 Tge(Rge((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)Pge(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)kge(a,e,t,(()=>o([t])))}})},jge=Symbol("fallback");function Lge(e){for(const t of e)t.dispose()}function Dge(e){const{by:t}=e;return ut(function(e,t,n,r={}){const o=new Map;return mt((()=>Lge(o.values()))),()=>{const n=e()||[];return pt((()=>{if(!n.length)return Lge(o.values()),o.clear(),r.fallback?[it((e=>(o.set(jge,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(jge);if(!o.size||a){a?.dispose(),o.delete(jge);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 Ige(e,t,n,r){const o=()=>{jme(Mme(e)).forEach((e=>{e&&jme(Mme(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),Lme(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?ct(o):lt(o)}function Fge(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=jme(Mme(e)).filter(kme);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 Uge=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function $ge(e){const t={};let n;for(;n=Uge.exec(e);)t[n[1]]=n[2];return t}function Vge(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=$ge(e)}else"string"==typeof t&&(t=$ge(t));return{...e,...t}}function Bge(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function zge(e){return"[object String]"===Object.prototype.toString.call(e)}function Hge(e){return t=>`${e()}-${t}`}function qge(e,t){return!!e&&(e===t||e.contains(t))}function Gge(e,t=!1){const{activeElement:n}=Kge(e);if(!n?.nodeName)return null;if(Wge(n)&&n.contentDocument)return Gge(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Kge(n).getElementById(e);if(t)return t}}return n}function Kge(e){return e?e.ownerDocument||e:document}function Wge(e){return"IFRAME"===e.tagName}var Yge=(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))(Yge||{});function Xge(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function Zge(){return Xge(/^Mac/i)}function Qge(){return Xge(/^iPhone/i)||Xge(/^iPad/i)||Zge()&&navigator.maxTouchPoints>1}function Jge(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function eve(e){return t=>{for(const n of e)Jge(t,n)}}function tve(e){return Zge()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function nve(e){if(e)if(function(){if(null==rve){rve=!1;try{document.createElement("div").focus({get preventScroll(){return rve=!0,!0}})}catch(XSe){}}return rve}())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 rve=null;var ove=["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'])"],ive=[...ove,'[tabindex]:not([tabindex="-1"]):not([disabled])'],ave=ove.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",sve=ive.join(':not([hidden]):not([tabindex="-1"]),');function lve(e,t){const n=Array.from(e.querySelectorAll(ave)).filter(cve);return t&&cve(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Wge(e)&&e.contentDocument){const r=lve(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function cve(e){return uve(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function uve(e){return e.matches(ave)&&dve(e)}function dve(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||dve(e.parentElement,e))}function pve(e){for(;e&&!fve(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function fve(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function hve(){}function mve(e,t){return qt(e,t)}var gve=new Map,vve=new Set;function yve(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=gve.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),gve.delete(t.target)),0===gve.size)){for(const e of vve)e();vve.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=gve.get(t.target);n||(n=new Set,gve.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function bve(e,t){const n=xve(e,t,"left"),r=xve(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 xve(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?yve():document.addEventListener("DOMContentLoaded",yve));var wve={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 _ve(e){return t=>(e(t),()=>e(void 0))}function Sve(e,t){const[n,r]=at(Eve(t?.()));return ct((()=>{r(e()?.tagName.toLowerCase()||Eve(t?.()))})),n}function Eve(e){return zge(e)?e:void 0}function Tve(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 Cve=["id","name","validationState","required","disabled","readOnly"];var Ave=xt();function Nve(){const e=wt(Ave);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function Rve(e){const t=Nve(),n=mve({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Tve,qt({as:"div"},(()=>t.dataset()),n))}function Ove(e){const t=Nve(),n=mve({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(Tve,qt({as:"div"},(()=>t.dataset()),o))}})}function Pve(e){let t;const n=Nve(),r=mve({id:n.generateId("label")},e),[o,i]=Gt(r,["ref"]),a=Sve((()=>t),(()=>"label"));return ct((()=>mt(n.registerLabel(i.id)))),$t(Tve,qt({as:"label",ref(e){const n=Cge((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ut((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function kve(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 Mve(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 jve(e){const[t,n]=Mve(e);return[()=>t()??!1,n]}var Lve=Object.defineProperty,Dve=(e,t)=>{for(var n in t)Lve(e,n,{get:t[n],enumerable:!0})},Ive=xt();function Fve(){return wt(Ive)}function Uve(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function $ve(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?Uve(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 Vve(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){ct((()=>{const n=setTimeout((()=>{$ve(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 Kge(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&$ve(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}mt((()=>o.disconnect()))}))}function Bve(e={}){const[t,n]=function(e){const[t,n]=Mve(e);return[()=>t()??[],n]}({value:()=>Mme(e.items),onChange:t=>e.onItemsChange?.(t)});Vve(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&&Uve(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(Ive.Provider,{value:{registerItem:r},get children(){return e.children}})}}function zve(e){const t=function(){const e=Fve();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=mve({shouldRegisterItem:!0},e);ct((()=>{if(!n.shouldRegisterItem)return;mt(t.registerItem(n.getItem()))}))}function Hve(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=zge(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=zge(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(zge(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return zge(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(zge(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=Hve({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 qve(e,t=[]){return ut((()=>{const n=Hve({dataSource:Mme(e.dataSource),getKey:Mme(e.getKey),getTextValue:Mme(e.getTextValue),getDisabled:Mme(e.getDisabled),getSectionChildren:Mme(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var Gve=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Kve=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Wve(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return Gve.has(t)}const t=e.split("-")[0];return Kve.has(t)}(e)?"rtl":"ltr"}function Yve(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Wve(e)}}var Xve=Yve(),Zve=new Set;function Qve(){Xve=Yve();for(const e of Zve)e(Xve)}var Jve=xt();function eye(){const e=function(){const[e,t]=at(Xve),n=ut((()=>e()));return ht((()=>{0===Zve.size&&window.addEventListener("languagechange",Qve),Zve.add(t),mt((()=>{Zve.delete(t),0===Zve.size&&window.removeEventListener("languagechange",Qve)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return wt(Jve)||e}var tye=new Map;var nye=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 rye(e){return Zge()||Qge()?e.altKey:e.ctrlKey}function oye(e){return Zge()?e.metaKey:e.ctrlKey}function iye(e){return new nye(e)}function aye(e){const t=mve({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=at(!1),[o,i]=at(),a=ut((()=>{const e=Mme(t.selectedKeys);return null!=e?iye(e):e})),s=ut((()=>{const e=Mme(t.defaultSelectedKeys);return null!=e?iye(e):new nye})),[l,c]=function(e){const[t,n]=Mve(e);return[()=>t()??new nye,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=at(Mme(t.selectionBehavior));return ct((()=>{const e=l();"replace"===Mme(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),ct((()=>{d(Mme(t.selectionBehavior)??"toggle")})),{selectionMode:()=>Mme(t.selectionMode),disallowEmptySelection:()=>Mme(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!Mme(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 sye(e,t,n){const r=qt({selectOnFocus:()=>"replace"===Mme(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=eye();let a={top:0,left:0};Ige((()=>Mme(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(Mme(e.isDisabled))return;const a=Mme(e.keyboardDelegate),s=Mme(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:()=>Mme(r.disallowTypeAhead),keyboardDelegate:()=>Mme(r.keyboardDelegate),selectionManager:()=>Mme(r.selectionManager)}),l=()=>Mme(r.orientation)??"vertical",c=()=>{const e=Mme(r.autoFocus);if(!e)return;const n=Mme(r.selectionManager),o=Mme(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&&!Mme(r.shouldUseVirtualFocus)&&nve(s)};ht((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),ct(ft([o,()=>Mme(r.isVirtualized),()=>Mme(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&&bve(t,e)}})));return{tabIndex:ut((()=>{if(!Mme(r.shouldUseVirtualFocus))return null==Mme(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{Jge(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=Mme(r.selectionManager),a=Mme(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!rye(e)&&o.replaceSelection(t))},u=Mme(r.keyboardDelegate),d=Mme(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,oye(e));null!=t&&(o.setFocusedKey(t),oye(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,oye(e));null!=t&&(o.setFocusedKey(t),oye(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":oye(e)&&"multiple"===o.selectionMode()&&!0!==Mme(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),Mme(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!Mme(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?sve:ave,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&dve(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)&&nve(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=Mme(r.selectionManager),n=Mme(r.keyboardDelegate),i=Mme(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(!Mme(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(nve(n),bve(e,n))}}},onFocusOut:e=>{const t=Mme(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function lye(e,t){const n=()=>Mme(e.selectionManager),r=()=>Mme(e.key),o=()=>Mme(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()||oye(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>Mme(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((()=>Mme(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():nve(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||Mme(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&Mme(e.shouldSelectOnPressUp)&&Mme(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(Mme(e.shouldSelectOnPressUp)&&!Mme(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(rye(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 cye=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 nye(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 nye(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 nye([t],t,t):new nye;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new nye;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 nye)}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}},uye=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 dye,pye=e=>"function"==typeof e?e():e,fye=e=>{const t=ut((()=>{const t=pye(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=at(pye(e.show)?"present":"hidden");let i="none";return ct((r=>{const a=pye(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=pye(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}},hye="data-kb-top-layer",mye=!1,gye=[];function vye(e){return gye.findIndex((t=>t.node===e))}function yye(){return gye.filter((e=>e.isPointerBlocking))}function bye(){return yye().length>0}function xye(e){const t=vye([...yye()].slice(-1)[0]?.node);return vye(e)<t}var wye={layers:gye,isTopMostLayer:function(e){return gye[gye.length-1].node===e},hasPointerBlockingLayer:bye,isBelowPointerBlockingLayer:xye,addLayer:function(e){gye.push(e)},removeLayer:function(e){const t=vye(e);t<0||gye.splice(t,1)},indexOf:vye,find:function(e){return gye[vye(e)]},assignPointerEventToLayers:function(){for(const{node:e}of gye)e.style.pointerEvents=xye(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(bye()&&!mye){const t=Kge(e);dye=document.body.style.pointerEvents,t.body.style.pointerEvents="none",mye=!0}},restoreBodyPointerEvents:function(e){if(bye())return;const t=Kge(e);t.body.style.pointerEvents=dye,0===t.body.style.length&&t.body.removeAttribute("style"),mye=!1}};Dve({},{Button:()=>Eye,Root:()=>Sye});var _ye=["button","color","file","image","reset","submit"];function Sye(e){let t;const n=mve({type:"button"},e),[r,o]=Gt(n,["ref","type","disabled"]),i=Sve((()=>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!==_ye.indexOf(e.type)}({tagName:e,type:r.type})})),s=ut((()=>"input"===i())),l=ut((()=>"a"===i()&&null!=t?.getAttribute("href")));return $t(Tve,qt({as:"button",ref(e){const n=Cge((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 Eye=Sye,Tye=["top","right","bottom","left"],Cye=Math.min,Aye=Math.max,Nye=Math.round,Rye=Math.floor,Oye=e=>({x:e,y:e}),Pye={left:"right",right:"left",bottom:"top",top:"bottom"},kye={start:"end",end:"start"};function Mye(e,t,n){return Aye(e,Cye(t,n))}function jye(e,t){return"function"==typeof e?e(t):e}function Lye(e){return e.split("-")[0]}function Dye(e){return e.split("-")[1]}function Iye(e){return"x"===e?"y":"x"}function Fye(e){return"y"===e?"height":"width"}function Uye(e){return["top","bottom"].includes(Lye(e))?"y":"x"}function $ye(e){return Iye(Uye(e))}function Vye(e){return e.replace(/start|end/g,(e=>kye[e]))}function Bye(e){return e.replace(/left|right|bottom|top/g,(e=>Pye[e]))}function zye(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 Hye(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 qye(e,t,n){let{reference:r,floating:o}=e;const i=Uye(t),a=$ye(t),s=Fye(a),l=Lye(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(Dye(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function Gye(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}=jye(t,e),h=zye(f),m=s[p?"floating"===d?"reference":"floating":d],g=Hye(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=Hye(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 Kye(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wye(e){return Tye.some((t=>e[t]>=0))}function Yye(e){return Qye(e)?(e.nodeName||"").toLowerCase():"#document"}function Xye(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Zye(e){var t;return null==(t=(Qye(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Qye(e){return e instanceof Node||e instanceof Xye(e).Node}function Jye(e){return e instanceof Element||e instanceof Xye(e).Element}function ebe(e){return e instanceof HTMLElement||e instanceof Xye(e).HTMLElement}function tbe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Xye(e).ShadowRoot)}function nbe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=lbe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function rbe(e){return["table","td","th"].includes(Yye(e))}function obe(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(XSe){return!1}}))}function ibe(e){const t=abe(),n=Jye(e)?lbe(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 abe(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function sbe(e){return["html","body","#document"].includes(Yye(e))}function lbe(e){return Xye(e).getComputedStyle(e)}function cbe(e){return Jye(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ube(e){if("html"===Yye(e))return e;const t=e.assignedSlot||e.parentNode||tbe(e)&&e.host||Zye(e);return tbe(t)?t.host:t}function dbe(e){const t=ube(e);return sbe(t)?e.ownerDocument?e.ownerDocument.body:e.body:ebe(t)&&nbe(t)?t:dbe(t)}function pbe(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=dbe(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Xye(o);return i?t.concat(a,a.visualViewport||[],nbe(o)?o:[],a.frameElement&&n?pbe(a.frameElement):[]):t.concat(o,pbe(o,[],n))}function fbe(e){const t=lbe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ebe(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Nye(n)!==i||Nye(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function hbe(e){return Jye(e)?e:e.contextElement}function mbe(e){const t=hbe(e);if(!ebe(t))return Oye(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=fbe(t);let a=(i?Nye(n.width):n.width)/r,s=(i?Nye(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var gbe=Oye(0);function vbe(e){const t=Xye(e);return abe()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gbe}function ybe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=hbe(e);let a=Oye(1);t&&(r?Jye(r)&&(a=mbe(r)):a=mbe(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Xye(e))&&t}(i,n,r)?vbe(i):Oye(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=Xye(i),t=r&&Jye(r)?Xye(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=mbe(o),t=o.getBoundingClientRect(),r=lbe(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=Xye(o),o=n.frameElement}}return Hye({width:u,height:d,x:l,y:c})}function bbe(e){return ybe(Zye(e)).left+cbe(e).scrollLeft}function xbe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Xye(e),r=Zye(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=abe();(!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=Zye(e),n=cbe(e),r=e.ownerDocument.body,o=Aye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Aye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+bbe(e);const s=-n.scrollTop;return"rtl"===lbe(r).direction&&(a+=Aye(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Zye(e));else if(Jye(t))r=function(e,t){const n=ybe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=ebe(e)?mbe(e):Oye(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=vbe(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Hye(r)}function wbe(e,t){const n=ube(e);return!(n===t||!Jye(n)||sbe(n))&&("fixed"===lbe(n).position||wbe(n,t))}function _be(e,t,n){const r=ebe(t),o=Zye(t),i="fixed"===n,a=ybe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Oye(0);if(r||!r&&!i)if(("body"!==Yye(t)||nbe(o))&&(s=cbe(t)),r){const e=ybe(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=bbe(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Sbe(e){return"static"===lbe(e).position}function Ebe(e,t){return ebe(e)&&"fixed"!==lbe(e).position?t?t(e):e.offsetParent:null}function Tbe(e,t){const n=Xye(e);if(obe(e))return n;if(!ebe(e)){let t=ube(e);for(;t&&!sbe(t);){if(Jye(t)&&!Sbe(t))return t;t=ube(t)}return n}let r=Ebe(e,t);for(;r&&rbe(r)&&Sbe(r);)r=Ebe(r,t);return r&&sbe(r)&&Sbe(r)&&!ibe(r)?n:r||function(e){let t=ube(e);for(;ebe(t)&&!sbe(t);){if(ibe(t))return t;if(obe(t))return null;t=ube(t)}return null}(e)||n}var Cbe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Zye(r),s=!!t&&obe(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Oye(1);const u=Oye(0),d=ebe(r);if((d||!d&&!i)&&(("body"!==Yye(r)||nbe(a))&&(l=cbe(r)),ebe(r))){const e=ybe(r);c=mbe(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:Zye,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?obe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=pbe(e,[],!1).filter((e=>Jye(e)&&"body"!==Yye(e))),o=null;const i="fixed"===lbe(e).position;let a=i?ube(e):e;for(;Jye(a)&&!sbe(a);){const t=lbe(a),n=ibe(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||nbe(a)&&!n&&wbe(e,a))?r=r.filter((e=>e!==a)):o=t,a=ube(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=xbe(t,n,o);return e.top=Aye(r.top,e.top),e.right=Cye(r.right,e.right),e.bottom=Cye(r.bottom,e.bottom),e.left=Aye(r.left,e.left),e}),xbe(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Tbe,getElementRects:async function(e){const t=this.getOffsetParent||Tbe,n=this.getDimensions,r=await n(e.floating);return{reference:_be(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}=fbe(e);return{width:t,height:n}},getScale:mbe,isElement:Jye,isRTL:function(e){return"rtl"===lbe(e).direction}};function Abe(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=hbe(e),u=o||i?[...c?pbe(c):[],...pbe(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=Zye(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:-Rye(u)+"px "+-Rye(o.clientWidth-(c+d))+"px "+-Rye(o.clientHeight-(u+p))+"px "+-Rye(c)+"px",threshold:Aye(0,Cye(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(XSe){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?ybe(e):null;return l&&function t(){const r=ybe(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 Nbe=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=Lye(n),s=Dye(n),l="y"===Uye(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=jye(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}}}}},Rbe=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}=jye(e,t),c={x:n,y:r},u=await Gye(t,l),d=Uye(Lye(o)),p=Iye(d);let f=c[p],h=c[d];if(i){f=Mye(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=Mye(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}}}}},Obe=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}=jye(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Lye(o),y=Uye(s),b=Lye(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[Bye(s)]:function(e){const t=Bye(e);return[Vye(e),t,Vye(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=Dye(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[]}}(Lye(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Vye)))),i}(s,m,h,x));const S=[s,...w],E=await Gye(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=Dye(e),o=$ye(e),i=Fye(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Bye(a)),[a,Bye(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=Uye(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{}}}},Pbe=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}=jye(e,t),l=await Gye(t,s),c=Lye(n),u=Dye(n),d="y"===Uye(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=Cye(f-l[h],g),b=Cye(p-l[m],v),x=!t.middlewareData.shift;let w=y,_=b;if(d?_=u||x?Cye(b,v):v:w=u||x?Cye(y,g):g,x&&!u){const e=Aye(l.left,0),t=Aye(l.right,0),n=Aye(l.top,0),r=Aye(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:Aye(l.left,l.right)):w=f-2*(0!==n||0!==r?n+r:Aye(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}}:{}}}},kbe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=jye(e,t);switch(r){case"referenceHidden":{const e=Kye(await Gye(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Wye(e)}}}case"escaped":{const e=Kye(await Gye(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Wye(e)}}}default:return{}}}}},Mbe=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}=jye(e,t)||{};if(null==c)return{};const d=zye(u),p={x:n,y:r},f=$ye(o),h=Fye(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=Cye(d[v],T),A=Cye(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=Mye(N,O,R),k=!l.arrow&&null!=Dye(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}}}),jbe=(e,t,n)=>{const r={platform:Cbe,...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}=qye(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}=qye(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},Lbe=xt();function Dbe(){const e=wt(Lbe);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var Ibe=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">'),Fbe={top:180,right:-90,bottom:0,left:90};function Ube(e){const t=Dbe(),n=mve({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,Kge(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return $t(Tve,qt({as:"div",ref(e){const n=Cge(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Vge({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=Ibe(),t=e.firstChild;return lt((()=>hn(t,"transform",`rotate(${Fbe[i()]} 15 15) translate(0 2)`))),e}}))}function $be(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 Vbe(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var Bbe={top:"bottom",right:"left",bottom:"top",left:"right"};var zbe=Object.assign((function(e){const t=mve({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?$be(t):e?e.getBoundingClientRect():$be()}};var e,n},{direction:c}=eye();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=[Nbe((({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(Vbe))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(Obe({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(Rbe({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(Pbe({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(kbe({padding:t.detachedPadding})),i&&d.push(Mbe({element:i,padding:t.arrowPadding}));const p=await jbe(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...Cbe,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=Bbe[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(Abe(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),ct((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),$t(Lbe.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:Ube,Context:Lbe,usePopperContext:Dbe,Positioner:function(e){const t=Dbe(),[n,r]=Gt(e,["ref","style"]);return $t(Tve,qt({as:"div",ref(e){const r=Cge(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return Vge({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var Hbe="interactOutside.pointerDownOutside",qbe="interactOutside.focusOutside";var Gbe=xt();function Kbe(e){let t;const n=wt(Gbe),[r,o]=Gt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=hve;const o=()=>Kge(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(`[${hye}]`)&&!!qge(o(),r)&&!qge(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=eve([i,s]);r.addEventListener(Hbe,o,{once:!0});const a=new CustomEvent(Hbe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||tve(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=eve([a,s]);r.addEventListener(qbe,o,{once:!0});const i=new CustomEvent(qbe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};ct((()=>{Mme(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=>qge(t(),e)))||[...i].some((t=>qge(t,e)))),onPointerDownOutside:e=>{t&&!wye.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||wye.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===Yge.Escape&&e.onEscapeKeyDown?.(t)};ct((()=>{if(Mme(e.isDisabled))return;const n=e.ownerDocument?.()??Kge();n.addEventListener("keydown",t),mt((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Kge(t),onEscapeKeyDown:e=>{t&&wye.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),ht((()=>{if(!t)return;wye.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);wye.assignPointerEventToLayers(),wye.disableBodyPointerEvents(t),mt((()=>{t&&(wye.removeLayer(t),e?.(),wye.assignPointerEventToLayers(),wye.restoreBodyPointerEvents(t))}))})),ct(ft([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=wye.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,wye.assignPointerEventToLayers()),t&&wye.disableBodyPointerEvents(e),mt((()=>{wye.restoreBodyPointerEvents(e)}))}),{defer:!0}));return $t(Gbe.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return $t(Tve,qt({as:"div",ref(e){const n=Cge((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Wbe(e={}){const[t,n]=jve({value:()=>Mme(e.open),defaultValue:()=>!!Mme(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 Ybe={};Dve(Ybe,{Description:()=>Rve,ErrorMessage:()=>Ove,Item:()=>exe,ItemControl:()=>txe,ItemDescription:()=>nxe,ItemIndicator:()=>rxe,ItemInput:()=>oxe,ItemLabel:()=>ixe,Label:()=>axe,RadioGroup:()=>lxe,Root:()=>sxe});var Xbe=xt();function Zbe(){const e=wt(Xbe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var Qbe=xt();function Jbe(){const e=wt(Qbe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function exe(e){const t=Nve(),n=Zbe(),r=mve({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=>{Jge(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:Hge((()=>i.id)),registerInput:_ve(s),registerLabel:_ve(c),registerDescription:_ve(d),setIsFocused:m,setInputRef:f};return $t(Qbe.Provider,{value:x,get children(){return $t(Tve,qt({as:"div",role:"group",onPointerDown:y},b,i))}})}function txe(e){const t=Jbe(),n=mve({id:t.generateId("control")},e),[r,o]=Gt(n,["onClick","onKeyDown"]);return $t(Tve,qt({as:"div",onClick:e=>{Jge(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{Jge(e,r.onKeyDown),e.key===Yge.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function nxe(e){const t=Jbe(),n=mve({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Tve,qt({as:"div"},(()=>t.dataset()),n))}function rxe(e){const t=Jbe(),n=mve({id:t.generateId("indicator")},e),[r,o]=Gt(n,["ref","forceMount"]),[i,a]=at(),{present:s}=fye({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return $t(Jt,{get when(){return s()},get children(){return $t(Tve,qt({as:"div",ref(e){const t=Cge(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function oxe(e){const t=Nve(),n=Zbe(),r=Jbe(),o=mve({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(Tve,qt({as:"input",ref(e){const t=Cge(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 Vge({...wve},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(Jge(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{Jge(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{Jge(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function ixe(e){const t=Jbe(),n=mve({id:t.generateId("label")},e);return ct((()=>mt(t.registerLabel(n.id)))),$t(Tve,qt({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function axe(e){return $t(Pve,qt({as:"span"},e))}function sxe(e){let t;const n=mve({id:`radiogroup-${Yt()}`,orientation:"vertical"},e),[r,o,i]=Gt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],Cve),[a,s]=Mve({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=mve({id:`form-control-${Yt()}`},e),[n,r]=at(),[o,i]=at(),[a,s]=at(),[l,c]=at();return{formControlContext:{name:()=>Mme(t.name)??Mme(t.id),dataset:ut((()=>({"data-valid":"valid"===Mme(t.validationState)?"":void 0,"data-invalid":"invalid"===Mme(t.validationState)?"":void 0,"data-required":Mme(t.required)?"":void 0,"data-disabled":Mme(t.disabled)?"":void 0,"data-readonly":Mme(t.readOnly)?"":void 0}))),validationState:()=>Mme(t.validationState),isRequired:()=>Mme(t.required),isDisabled:()=>Mme(t.disabled),isReadOnly:()=>Mme(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:Hge((()=>Mme(t.id))),registerLabel:_ve(r),registerField:_ve(i),registerDescription:_ve(s),registerErrorMessage:_ve(c)}}}(o);kve((()=>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(Ave.Provider,{value:l,get children(){return $t(Xbe.Provider,{value:d,get children(){return $t(Tve,qt({as:"div",ref(e){const n=Cge((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return Mme(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(Mme(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var lxe=Object.assign(sxe,{Description:Rve,ErrorMessage:Ove,Item:exe,ItemControl:txe,ItemDescription:nxe,ItemIndicator:rxe,ItemInput:oxe,ItemLabel:ixe,Label:axe}),cxe=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 uxe(e,t,n){const r=function(e){const{locale:t}=eye(),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 tye.has(r)&&(o=tye.get(r)),o||(o=new Intl.Collator(t(),e),tye.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return sye({selectionManager:()=>Mme(e.selectionManager),keyboardDelegate:ut((()=>{const n=Mme(e.keyboardDelegate);return n||new cxe(e.collection,t,r)})),autoFocus:()=>Mme(e.autoFocus),deferAutoFocus:()=>Mme(e.deferAutoFocus),shouldFocusWrap:()=>Mme(e.shouldFocusWrap),disallowEmptySelection:()=>Mme(e.disallowEmptySelection),selectOnFocus:()=>Mme(e.selectOnFocus),disallowTypeAhead:()=>Mme(e.disallowTypeAhead),shouldUseVirtualFocus:()=>Mme(e.shouldUseVirtualFocus),allowsTabNavigation:()=>Mme(e.allowsTabNavigation),isVirtualized:()=>Mme(e.isVirtualized),scrollToKey:t=>Mme(e.scrollToKey)?.(t),orientation:()=>Mme(e.orientation)},t)}var dxe="focusScope.autoFocusOnMount",pxe="focusScope.autoFocusOnUnmount",fxe={bubbles:!1,cancelable:!0},hxe={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=Bge(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=Bge(this.stack,e),this.active()?.resume()}};function mxe(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=()=>Kge(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,wve),e},u=()=>{const e=t();return e?lve(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;hxe.add(o);const n=Gge(e);if(!qge(e,n)){const t=new CustomEvent(dxe,fxe);e.addEventListener(dxe,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{nve(d()),Gge(e)===n&&nve(e)}),0)}mt((()=>{e.removeEventListener(dxe,a),setTimeout((()=>{const r=new CustomEvent(pxe,fxe);(()=>{const e=t();if(!e)return!1;const n=Gge(e);return!!n&&!qge(e,n)&&uve(n)})()&&r.preventDefault(),e.addEventListener(pxe,s),e.dispatchEvent(r),r.defaultPrevented||nve(n??l().body),e.removeEventListener(pxe,s),hxe.remove(o)}),0)}))})),ct((()=>{const r=t();if(!r||!Mme(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${hye}]`)||(qge(r,t)?i=t:nve(i))},a=e=>{const t=e.relatedTarget??Gge(r);t?.closest(`[${hye}]`)||qge(r,t)||nve(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),mt((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),ct((()=>{const r=t();if(!r||!Mme(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})();nve(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 gxe="data-live-announcer";function vxe(e){ct((()=>{Mme(e.isDisabled)||mt(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${gxe}], [${hye}]`))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=yxe.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),yxe.set(e,t+1))};bxe.length&&bxe[bxe.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 bxe.push(s),()=>{a.disconnect();for(const e of r){const t=yxe.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),yxe.delete(e)):yxe.set(e,t-1)}s===bxe[bxe.length-1]?(bxe.pop(),bxe.length&&bxe[bxe.length-1].observe()):bxe.splice(bxe.indexOf(s),1)}}(Mme(e.targets),Mme(e.root)))}))}var yxe=new WeakMap,bxe=[];var xxe=new Map,wxe=e=>{ct((()=>{const t=pye(e.style)??{},n=pye(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=xxe.get(e.key);o?o.activeCount++:xxe.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=xxe.get(e.key);if(t)if(1===t.activeCount){xxe.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--}))}))},_xe=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},Sxe=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[Exe,Txe]=at([]),Cxe=e=>[e.deltaX,e.deltaY],Axe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],Nxe=(e,t,n,r)=>{const o=null!==r&&Rxe(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]=_xe(o,t),u=c-e-r*l;0===l&&0===u||!Sxe(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)},Rxe=(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},Oxe=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((()=>{pye(t.enabled)&&(Txe((e=>[...e,n])),mt((()=>{Txe((e=>e.filter((e=>e!==n))))})))})),ct((()=>{if(!pye(t.enabled)||!pye(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(pye(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===pye(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;wxe({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{pye(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else wxe({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),ct((()=>{var e;(e=n,Exe().indexOf(e)===Exe().length-1&&pye(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=Axe(e),o=null,i=null},s=e=>{const n=e.target,r=pye(t.element),o=Cxe(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=Nxe(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!Rxe(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=pye(t.element),a=e.target;let s;if(2===e.touches.length)s=!pye(t.allowPinchZoom);else{if(null==o||null===i){const t=Axe(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=Nxe(a,o,i,n);s=!n||!Rxe(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},Pxe=xt();function kxe(){return wt(Pxe)}function Mxe(){const e=kxe();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var jxe=xt();function Lxe(){const e=wt(jxe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var Dxe=xt();function Ixe(){const e=wt(Dxe);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function Fxe(e){let t;const n=Ixe(),r=Mxe(),o=mve({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)}))};zve({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=lye({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{Jge(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(nve(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{Jge(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{Jge(e,i.onPointerUp),i.disabled||0!==e.button||m()},x=e=>{if(Jge(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:Hge((()=>a.id)),registerLabel:_ve(l),registerDescription:_ve(u)};return $t(jxe.Provider,{value:S,get children(){return $t(Tve,qt({as:"div",ref(e){const n=Cge((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 eve([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return eve([b,g.onPointerUp])},get onClick(){return eve([i.onClick,g.onClick])},get onKeyDown(){return eve([x,g.onKeyDown])},get onMouseDown(){return eve([i.onMouseDown,g.onMouseDown])},get onFocus(){return eve([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function Uxe(e){const t=mve({closeOnSelect:!1},e),[n,r]=Gt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=jve({value:()=>Mme(e.isSelected),defaultValue:()=>!!Mme(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{Mme(e.isReadOnly)||Mme(e.isDisabled)||n(t)},toggle:()=>{Mme(e.isReadOnly)||Mme(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return $t(Fxe,qt({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var $xe=xt();function Vxe(){return wt($xe)}var Bxe={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>Bxe.next("ltr"===e?"rtl":"ltr",t)},zxe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",Hxe=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function qxe(e){const t=Ixe(),n=Mxe(),r=Vxe(),{direction:o}=eye(),i=mve({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=Sve((()=>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(Sye,qt({ref(e){const t=Cge(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=>{Jge(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{Jge(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{Jge(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if(Jge(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case zxe(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=pve(e);for(;e&&n&&e!==t&&n!==t;)bve(n,e),n=pve(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 Hxe(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case Bxe.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case Bxe.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{Jge(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 Gxe=xt();function Kxe(){return wt(Gxe)}function Wxe(e){let t;const n=Ixe(),r=Mxe(),o=Vxe(),i=Kxe(),{direction:a}=eye(),s=mve({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=uxe({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));mxe({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:Cge((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:eve([l.onKeyDown,p.onKeyDown,e=>{if(qge(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case Bxe.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case Bxe.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:eve([l.onMouseDown,p.onMouseDown]),onFocusIn:eve([l.onFocusIn,p.onFocusIn]),onFocusOut:eve([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{Jge(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if(Jge(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;qge(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(Tve,qt({as:"div"},(()=>r.dataset()),m,c))},get children(){return $t(zbe.Positioner,{get children(){return $t(Kbe,qt({get disableOutsidePointerEvents(){return ut((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Vge({"--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 Yxe(e){let t;const n=Ixe(),r=Mxe(),[o,i]=Gt(e,["ref"]);return Oxe({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),$t(Wxe,qt({ref(e){const n=Cge((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var Xxe=xt();function Zxe(e){const t=mve({id:Ixe().generateId(`group-${Yt()}`)},e),[n,r]=at(),o={generateId:Hge((()=>t.id)),registerLabelId:_ve(r)};return $t(Xxe.Provider,{value:o,get children(){return $t(Tve,qt({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function Qxe(e){const t=function(){const e=wt(Xxe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=mve({id:t.generateId("label")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerLabelId(r.id)))),$t(Tve,qt({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function Jxe(e){const t=Mxe();return $t(Tve,qt({as:"span","aria-hidden":"true"},(()=>t.dataset()),mve({children:"▼"},e)))}function ewe(e){return $t(Fxe,qt({role:"menuitem",closeOnSelect:!0},e))}function twe(e){const t=Lxe(),n=mve({id:t.generateId("description")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerDescription(r.id)))),$t(Tve,qt({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function nwe(e){const t=Lxe(),n=mve({id:t.generateId("indicator")},e),[r,o]=Gt(n,["forceMount"]);return $t(Jt,{get when(){return r.forceMount||t.isChecked()},get children(){return $t(Tve,qt({as:"div"},(()=>t.dataset()),o))}})}function rwe(e){const t=Lxe(),n=mve({id:t.generateId("label")},e),[r,o]=Gt(n,["ref","id"]);return ct((()=>mt(t.registerLabel(r.id)))),$t(Tve,qt({as:"div",ref(e){const n=Cge(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function owe(e){const t=Mxe();return $t(Jt,{get when(){return t.contentPresent()},get children(){return $t(On,e)}})}var iwe=xt();function awe(e){const t=mve({id:Ixe().generateId(`radiogroup-${Yt()}`)},e),[n,r]=Gt(t,["value","defaultValue","onChange","disabled"]),[o,i]=Mve({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return $t(iwe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return $t(Zxe,r)}})}function swe(e){const t=function(){const e=wt(iwe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=mve({closeOnSelect:!1},e),[r,o]=Gt(n,["value","onSelect"]);return $t(Fxe,qt({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function lwe(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 cwe(e){const t=Ixe(),n=Fve(),r=kxe(),o=Vxe(),i=Kxe(),a=mve({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}=Bve({items:C,onItemsChange:A}),R=Wbe({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:O}=fye({show:()=>t.forceMount()||R.isOpen(),element:()=>y()??null}),P=function(e){const t=aye(e),n=qve({dataSource:()=>Mme(e.dataSource),getKey:()=>Mme(e.getKey),getTextValue:()=>Mme(e.getTextValue),getDisabled:()=>Mme(e.getDisabled),getSectionChildren:()=>Mme(e.getSectionChildren),factory:t=>new uye(e.filter?e.filter(t):t)},[()=>e.filter]),r=new cye(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)},j=()=>{const e=y();e&&(nve(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},L=()=>{null!=i?setTimeout((()=>j())):j()},D=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};vxe({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:L,onItemEnter:e=>{D(e)&&e.preventDefault()},onItemLeave:e=>{D(e)||L()},onTriggerLeave:e=>{D(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=>Bge(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:_ve(f),registerContentId:_ve(m)};return $t(N,{get children(){return $t(Pxe.Provider,{value:I,get children(){return $t(Jt,{when:void 0===i,get fallback(){return l.children},get children(){return $t(zbe,qt({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function uwe(e){const{direction:t}=eye();return $t(cwe,qt({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var dwe=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function pwe(e){const t=Mxe(),n=Ixe(),[r,o]=Gt(e,["onFocusOutside","onKeyDown"]),{direction:i}=eye();return $t(Wxe,qt({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;qge(t.triggerRef(),n)||t.close()},onKeyDown:e=>{Jge(e,r.onKeyDown);const o=qge(e.currentTarget,e.target),a=dwe(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),nve(t.triggerRef()))}},o))}var fwe=["Enter"," "],hwe=(e,t)=>"ltr"===e?[...fwe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...fwe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function mwe(e){let t;const n=Ixe(),r=Mxe(),o=mve({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}=eye(),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=lye({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{Jge(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{Jge(e,i.onKeyDown),e.repeat||i.disabled||hwe(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(Tve,qt({as:"div",ref(e){const n=Cge((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 eve([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return eve([i.onPointerUp,p.onPointerUp])},get onClick(){return eve([f,p.onClick])},get onKeyDown(){return eve([h,p.onKeyDown])},get onMouseDown(){return eve([i.onMouseDown,p.onMouseDown])},get onFocus(){return eve([i.onFocus,p.onFocus])},onPointerMove:e=>{if(Jge(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)),nve(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if(Jge(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:lwe(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 gwe(e){const t=Vxe(),n=mve({id:`menu-${Yt()}`,modal:!0},e),[r,o]=Gt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Wbe({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:Hge((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return $t(Dxe.Provider,{value:a,get children(){return $t(cwe,qt({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function vwe(e){let t;const n=mve({orientation:"horizontal"},e),[r,o]=Gt(n,["ref","orientation"]),i=Sve((()=>t),(()=>"hr"));return $t(Tve,qt({as:"hr",ref(e){const n=Cge((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))}Dve({},{Root:()=>vwe,Separator:()=>ywe});var ywe=vwe,bwe={};function xwe(e){const t=Ixe(),n=Mxe(),[r,o]=Gt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return $t(Yxe,qt({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||nve(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function wwe(e){return $t(gwe,mve({id:`dropdownmenu-${Yt()}`},e))}Dve(bwe,{Arrow:()=>Ube,CheckboxItem:()=>Uxe,Content:()=>xwe,DropdownMenu:()=>_we,Group:()=>Zxe,GroupLabel:()=>Qxe,Icon:()=>Jxe,Item:()=>ewe,ItemDescription:()=>twe,ItemIndicator:()=>nwe,ItemLabel:()=>rwe,Portal:()=>owe,RadioGroup:()=>awe,RadioItem:()=>swe,Root:()=>wwe,Separator:()=>vwe,Sub:()=>uwe,SubContent:()=>pwe,SubTrigger:()=>mwe,Trigger:()=>qxe});var _we=Object.assign(wwe,{Arrow:Ube,CheckboxItem:Uxe,Content:xwe,Group:Zxe,GroupLabel:Qxe,Icon:Jxe,Item:ewe,ItemDescription:twe,ItemIndicator:nwe,ItemLabel:rwe,Portal:owe,RadioGroup:awe,RadioItem:swe,Separator:vwe,Sub:uwe,SubContent:pwe,SubTrigger:mwe,Trigger:qxe}),Swe={colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000000",white:"#ffffff",neutral:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},darkGray:{50:"#525c7a",100:"#49536e",200:"#414962",300:"#394056",400:"#313749",500:"#292e3d",600:"#212530",700:"#191c24",800:"#111318",900:"#0b0d10"},gray:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},blue:{25:"#F5FAFF",50:"#EFF8FF",100:"#D1E9FF",200:"#B2DDFF",300:"#84CAFF",400:"#53B1FD",500:"#2E90FA",600:"#1570EF",700:"#175CD3",800:"#1849A9",900:"#194185"},green:{25:"#F6FEF9",50:"#ECFDF3",100:"#D1FADF",200:"#A6F4C5",300:"#6CE9A6",400:"#32D583",500:"#12B76A",600:"#039855",700:"#027A48",800:"#05603A",900:"#054F31"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},yellow:{25:"#FFFCF5",50:"#FFFAEB",100:"#FEF0C7",200:"#FEDF89",300:"#FEC84B",400:"#FDB022",500:"#F79009",600:"#DC6803",700:"#B54708",800:"#93370D",900:"#7A2E0E"},purple:{25:"#FAFAFF",50:"#F4F3FF",100:"#EBE9FE",200:"#D9D6FE",300:"#BDB4FE",400:"#9B8AFB",500:"#7A5AF8",600:"#6938EF",700:"#5925DC",800:"#4A1FB8",900:"#3E1C96"},teal:{25:"#F6FEFC",50:"#F0FDF9",100:"#CCFBEF",200:"#99F6E0",300:"#5FE9D0",400:"#2ED3B7",500:"#15B79E",600:"#0E9384",700:"#107569",800:"#125D56",900:"#134E48"},pink:{25:"#fdf2f8",50:"#fce7f3",100:"#fbcfe8",200:"#f9a8d4",300:"#f472b6",400:"#ec4899",500:"#db2777",600:"#be185d",700:"#9d174d",800:"#831843",900:"#500724"},cyan:{25:"#ecfeff",50:"#cffafe",100:"#a5f3fc",200:"#67e8f9",300:"#22d3ee",400:"#06b6d4",500:"#0891b2",600:"#0e7490",700:"#155e75",800:"#164e63",900:"#083344"}},alpha:{90:"e5",80:"cc"},font:{size:{xs:"calc(var(--tsqd-font-size) * 0.75)",sm:"calc(var(--tsqd-font-size) * 0.875)",md:"var(--tsqd-font-size)"},lineHeight:{xs:"calc(var(--tsqd-font-size) * 1)",sm:"calc(var(--tsqd-font-size) * 1.25)",md:"calc(var(--tsqd-font-size) * 1.5)"},weight:{medium:"500",semibold:"600",bold:"700"}},border:{radius:{xs:"calc(var(--tsqd-font-size) * 0.125)",sm:"calc(var(--tsqd-font-size) * 0.25)",full:"9999px"}},size:{.25:"calc(var(--tsqd-font-size) * 0.0625)",.5:"calc(var(--tsqd-font-size) * 0.125)",1:"calc(var(--tsqd-font-size) * 0.25)",1.5:"calc(var(--tsqd-font-size) * 0.375)",2:"calc(var(--tsqd-font-size) * 0.5)",2.5:"calc(var(--tsqd-font-size) * 0.625)",3:"calc(var(--tsqd-font-size) * 0.75)",3.5:"calc(var(--tsqd-font-size) * 0.875)",4:"calc(var(--tsqd-font-size) * 1)",4.5:"calc(var(--tsqd-font-size) * 1.125)",5:"calc(var(--tsqd-font-size) * 1.25)",6:"calc(var(--tsqd-font-size) * 1.5)",6.5:"calc(var(--tsqd-font-size) * 1.625)",14:"calc(var(--tsqd-font-size) * 3.5)"},shadow:{xs:(e="rgb(0 0 0 / 0.1)")=>"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:(e="rgb(0 0 0 / 0.1)")=>`0 1px 3px 0 ${e}, 0 1px 2px -1px ${e}`,md:(e="rgb(0 0 0 / 0.1)")=>`0 4px 6px -1px ${e}, 0 2px 4px -2px ${e}`,lg:(e="rgb(0 0 0 / 0.1)")=>`0 10px 15px -3px ${e}, 0 4px 6px -4px ${e}`,xl:(e="rgb(0 0 0 / 0.1)")=>`0 20px 25px -5px ${e}, 0 8px 10px -6px ${e}`,"2xl":(e="rgb(0 0 0 / 0.25)")=>`0 25px 50px -12px ${e}`,inner:(e="rgb(0 0 0 / 0.05)")=>`inset 0 2px 4px 0 ${e}`,none:()=>"none"}},Ewe=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>'),Twe=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>'),Cwe=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>'),Awe=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>'),Nwe=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>'),Rwe=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>'),Owe=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>'),Pwe=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>'),kwe=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">'),Mwe=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">'),jwe=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>'),Lwe=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>'),Dwe=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>'),Iwe=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>'),Fwe=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>'),Uwe=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>'),$we=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>'),Vwe=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>'),Bwe=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>'),zwe=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>'),Hwe=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>'),qwe=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>'),Gwe=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 Kwe(){return Ewe()}function Wwe(){return Twe()}function Ywe(){return Cwe()}function Xwe(){return Awe()}function Zwe(){return Nwe()}function Qwe(){return(e=Nwe()).style.setProperty("transform","rotate(90deg)"),e;var e}function Jwe(){return(e=Nwe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function e_e(){return Rwe()}function t_e(){return Owe()}function n_e(){return Pwe()}function r_e(){return kwe()}function o_e(){return Mwe()}function i_e(){return jwe()}function a_e(){return Lwe()}function s_e(){return Dwe()}function l_e(){return Iwe()}function c_e(e){return t=Fwe(),n=t.firstChild,lt((()=>hn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function u_e(){return Uwe()}function d_e(){return $we()}function p_e(e){return[$t(Jt,{get when(){return e.checked},get children(){var t=Fwe(),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=Vwe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function f_e(){return Bwe()}function h_e(){return zwe()}function m_e(){return Hwe()}function g_e(){return qwe()}function v_e(){const e=Yt();return t=Gwe(),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,L=(j=(M=P.nextSibling).nextSibling).firstChild,I=(D=j.nextSibling).firstChild,$=(U=(F=D.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Q=(Z=(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,Le=(je=(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(L,"id",`af-${e}`),hn(D,"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(Z,"fill",`url(#s-${e})`),hn(Q,"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(je,"id",`z-${e}`),hn(Le,"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,j,L,D,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Z,Q,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,je,Le}var y_e=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>'),b_e=pn('<button title="Copy object to clipboard">'),x_e=pn('<button title="Remove all items"aria-label="Remove all items">'),w_e=pn('<button title="Delete item"aria-label="Delete item">'),__e=pn('<button title="Toggle value"aria-label="Toggle value">'),S_e=pn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),E_e=pn("<div>"),T_e=pn("<div><button> <span></span> <span> "),C_e=pn("<input>"),A_e=pn("<span>"),N_e=pn("<div><span>:"),R_e=pn("<div><div><button> [<!>...<!>]");var O_e=e=>{const t=Zme(),n=Gme().shadowDOMTarget?_ge.bind({target:Gme().shadowDOMTarget}):_ge,r=ut((()=>"dark"===t()?U_e(n):F_e(n)));return o=y_e(),lt((()=>mn(o,Ege(r().expander,n`
95
95
  transform: rotate(${e.expanded?90:0}deg);
96
96
  `,e.expanded&&n`
97
97
  & svg {