const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StaffPortalApp-CVlGLsBu.js","assets/vendor-BNlRLOjx.js","assets/react-vendor-D4HGTDMJ.js"])))=>i.map(i=>d[i]); var us=Object.defineProperty;var fs=(e,t,r)=>t in e?us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var re=(e,t,r)=>fs(e,typeof t!="symbol"?t+"":t,r);import{j as l,c as ps,u as ms,_ as hs,Q as gs,a as ys}from"./vendor-BNlRLOjx.js";import{a as $t,r as u,R as S,b as wn,d as xn,u as zt,e as Ut,L as vs,B as ws,f as xs,h as Xe}from"./react-vendor-D4HGTDMJ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(o){if(o.ep)return;o.ep=!0;const s=r(o);fetch(o.href,s)}})();var bn,Wr=$t;bn=Wr.createRoot,Wr.hydrateRoot;const bs=1,Es=1e6;let tr=0;function Cs(){return tr=(tr+1)%Number.MAX_SAFE_INTEGER,tr.toString()}const rr=new Map,Vr=e=>{if(rr.has(e))return;const t=setTimeout(()=>{rr.delete(e),ut({type:"REMOVE_TOAST",toastId:e})},Es);rr.set(e,t)},Rs=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,bs)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Vr(r):e.toasts.forEach(n=>{Vr(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},Nt=[];let Pt={toasts:[]};function ut(e){Pt=Rs(Pt,e),Nt.forEach(t=>{t(Pt)})}function Ts({...e}){const t=Cs(),r=o=>ut({type:"UPDATE_TOAST",toast:{...o,id:t}}),n=()=>ut({type:"DISMISS_TOAST",toastId:t});return ut({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||n()}}}),{id:t,dismiss:n,update:r}}function Ss(){const[e,t]=u.useState(Pt);return u.useEffect(()=>(Nt.push(t),()=>{const r=Nt.indexOf(t);r>-1&&Nt.splice(r,1)}),[e]),{...e,toast:Ts,dismiss:r=>ut({type:"DISMISS_TOAST",toastId:r})}}function te(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o.defaultPrevented)return t?.(o)}}function Kr(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function En(...e){return t=>{let r=!1;const n=e.map(o=>{const s=Kr(o,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let o=0;o{const{children:a,...i}=s,f=u.useMemo(()=>i,Object.values(i));return l.jsx(r.Provider,{value:f,children:a})};n.displayName=e+"Provider";function o(s){const a=u.useContext(r);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[n,o]}function Ht(e,t=[]){let r=[];function n(s,a){const i=u.createContext(a),f=r.length;r=[...r,a];const d=m=>{const{scope:g,children:c,...v}=m,h=g?.[e]?.[f]||i,y=u.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:y,children:c})};d.displayName=s+"Provider";function p(m,g){const c=g?.[e]?.[f]||i,v=u.useContext(c);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${s}\``)}return[d,p]}const o=()=>{const s=r.map(a=>u.createContext(a));return function(i){const f=i?.[e]||s;return u.useMemo(()=>({[`__scope${e}`]:{...i,[e]:f}}),[i,f])}};return o.scopeName=e,[n,Ns(o,...t)]}function Ns(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=n.reduce((i,{useScope:f,scopeName:d})=>{const m=f(s)[`__scope${d}`];return{...i,...m}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function jt(e){const t=As(e),r=u.forwardRef((n,o)=>{const{children:s,...a}=n,i=u.Children.toArray(s),f=i.find(js);if(f){const d=f.props.children,p=i.map(m=>m===f?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:m);return l.jsx(t,{...a,ref:o,children:u.isValidElement(d)?u.cloneElement(d,void 0,p):null})}return l.jsx(t,{...a,ref:o,children:s})});return r.displayName=`${e}.Slot`,r}var Ps=jt("Slot");function As(e){const t=u.forwardRef((r,n)=>{const{children:o,...s}=r;if(u.isValidElement(o)){const a=Ds(o),i=_s(s,o.props);return o.type!==u.Fragment&&(i.ref=n?En(n,a):a),u.cloneElement(o,i)}return u.Children.count(o)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Cn=Symbol("radix.slottable");function Os(e){const t=({children:r})=>l.jsx(l.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Cn,t}function js(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Cn}function _s(e,t){const r={...t};for(const n in t){const o=e[n],s=t[n];/^on[A-Z]/.test(n)?o&&s?r[n]=(...i)=>{const f=s(...i);return o(...i),f}:o&&(r[n]=o):n==="style"?r[n]={...o,...s}:n==="className"&&(r[n]=[o,s].filter(Boolean).join(" "))}return{...e,...r}}function Ds(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function ks(e){const t=e+"CollectionProvider",[r,n]=Ht(t),[o,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=h=>{const{scope:y,children:x}=h,w=S.useRef(null),E=S.useRef(new Map).current;return l.jsx(o,{scope:y,itemMap:E,collectionRef:w,children:x})};a.displayName=t;const i=e+"CollectionSlot",f=jt(i),d=S.forwardRef((h,y)=>{const{scope:x,children:w}=h,E=s(i,x),R=ye(y,E.collectionRef);return l.jsx(f,{ref:R,children:w})});d.displayName=i;const p=e+"CollectionItemSlot",m="data-radix-collection-item",g=jt(p),c=S.forwardRef((h,y)=>{const{scope:x,children:w,...E}=h,R=S.useRef(null),N=ye(y,R),O=s(p,x);return S.useEffect(()=>(O.itemMap.set(R,{ref:R,...E}),()=>void O.itemMap.delete(R))),l.jsx(g,{[m]:"",ref:N,children:w})});c.displayName=p;function v(h){const y=s(e+"CollectionConsumer",h);return S.useCallback(()=>{const w=y.collectionRef.current;if(!w)return[];const E=Array.from(w.querySelectorAll(`[${m}]`));return Array.from(y.itemMap.values()).sort((O,j)=>E.indexOf(O.ref.current)-E.indexOf(j.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:d,ItemSlot:c},v,n]}var Is=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oe=Is.reduce((e,t)=>{const r=jt(`Primitive.${t}`),n=u.forwardRef((o,s)=>{const{asChild:a,...i}=o,f=a?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(f,{...i,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Rn(e,t){e&&$t.flushSync(()=>e.dispatchEvent(t))}function $e(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...r)=>t.current?.(...r),[])}function Ls(e,t=globalThis?.document){const r=$e(e);u.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Ms="DismissableLayer",dr="dismissableLayer.update",Fs="dismissableLayer.pointerDownOutside",$s="dismissableLayer.focusOutside",Yr,Tn=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),br=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...f}=e,d=u.useContext(Tn),[p,m]=u.useState(null),g=p?.ownerDocument??globalThis?.document,[,c]=u.useState({}),v=ye(t,j=>m(j)),h=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=h.indexOf(y),w=p?h.indexOf(p):-1,E=d.layersWithOutsidePointerEventsDisabled.size>0,R=w>=x,N=Us(j=>{const $=j.target,F=[...d.branches].some(z=>z.contains($));!R||F||(o?.(j),a?.(j),j.defaultPrevented||i?.())},g),O=Hs(j=>{const $=j.target;[...d.branches].some(z=>z.contains($))||(s?.(j),a?.(j),j.defaultPrevented||i?.())},g);return Ls(j=>{w===d.layers.size-1&&(n?.(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},g),u.useEffect(()=>{if(p)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Yr=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),qr(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Yr)}},[p,g,r,d]),u.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),qr())},[p,d]),u.useEffect(()=>{const j=()=>c({});return document.addEventListener(dr,j),()=>document.removeEventListener(dr,j)},[]),l.jsx(oe.div,{...f,ref:v,style:{pointerEvents:E?R?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,O.onFocusCapture),onBlurCapture:te(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,N.onPointerDownCapture)})});br.displayName=Ms;var zs="DismissableLayerBranch",Sn=u.forwardRef((e,t)=>{const r=u.useContext(Tn),n=u.useRef(null),o=ye(t,n);return u.useEffect(()=>{const s=n.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),l.jsx(oe.div,{...e,ref:o})});Sn.displayName=zs;function Us(e,t=globalThis?.document){const r=$e(e),n=u.useRef(!1),o=u.useRef(()=>{});return u.useEffect(()=>{const s=i=>{if(i.target&&!n.current){let f=function(){Nn(Fs,r,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=f,t.addEventListener("click",o.current,{once:!0})):f()}else t.removeEventListener("click",o.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function Hs(e,t=globalThis?.document){const r=$e(e),n=u.useRef(!1);return u.useEffect(()=>{const o=s=>{s.target&&!n.current&&Nn($s,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function qr(){const e=new CustomEvent(dr);document.dispatchEvent(e)}function Nn(e,t,r,{discrete:n}){const o=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?Rn(o,s):o.dispatchEvent(s)}var Bs=br,Ws=Sn,Oe=globalThis?.document?u.useLayoutEffect:()=>{},Vs="Portal",Pn=u.forwardRef((e,t)=>{const{container:r,...n}=e,[o,s]=u.useState(!1);Oe(()=>s(!0),[]);const a=r||o&&globalThis?.document?.body;return a?wn.createPortal(l.jsx(oe.div,{...n,ref:t}),a):null});Pn.displayName=Vs;function Ks(e,t){return u.useReducer((r,n)=>t[r][n]??r,e)}var Er=e=>{const{present:t,children:r}=e,n=Ys(t),o=typeof r=="function"?r({present:n.isPresent}):u.Children.only(r),s=ye(n.ref,qs(o));return typeof r=="function"||n.isPresent?u.cloneElement(o,{ref:s}):null};Er.displayName="Presence";function Ys(e){const[t,r]=u.useState(),n=u.useRef(null),o=u.useRef(e),s=u.useRef("none"),a=e?"mounted":"unmounted",[i,f]=Ks(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Ct(n.current);s.current=i==="mounted"?d:"none"},[i]),Oe(()=>{const d=n.current,p=o.current;if(p!==e){const g=s.current,c=Ct(d);e?f("MOUNT"):c==="none"||d?.display==="none"?f("UNMOUNT"):f(p&&g!==c?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),Oe(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,m=c=>{const h=Ct(n.current).includes(c.animationName);if(c.target===t&&h&&(f("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},g=c=>{c.target===t&&(s.current=Ct(n.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:u.useCallback(d=>{n.current=d?getComputedStyle(d):null,r(d)},[])}}function Ct(e){return e?.animationName||"none"}function qs(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Gs=xn[" useInsertionEffect ".trim().toString()]||Oe;function An({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,s,a]=Xs({defaultProp:t,onChange:r}),i=e!==void 0,f=i?e:o;{const p=u.useRef(e!==void 0);u.useEffect(()=>{const m=p.current;m!==i&&console.warn(`${n} is changing from ${m?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=i},[i,n])}const d=u.useCallback(p=>{if(i){const m=Qs(p)?p(e):p;m!==e&&a.current?.(m)}else s(p)},[i,e,s,a]);return[f,d]}function Xs({defaultProp:e,onChange:t}){const[r,n]=u.useState(e),o=u.useRef(r),s=u.useRef(t);return Gs(()=>{s.current=t},[t]),u.useEffect(()=>{o.current!==r&&(s.current?.(r),o.current=r)},[r,o]),[r,n,s]}function Qs(e){return typeof e=="function"}var Js=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Zs="VisuallyHidden",Bt=u.forwardRef((e,t)=>l.jsx(oe.span,{...e,ref:t,style:{...Js,...e.style}}));Bt.displayName=Zs;var ea=Bt,Cr="ToastProvider",[Rr,ta,ra]=ks("Toast"),[On,Cd]=Ht("Toast",[ra]),[na,Wt]=On(Cr),jn=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:a}=e,[i,f]=u.useState(null),[d,p]=u.useState(0),m=u.useRef(!1),g=u.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${Cr}\`. Expected non-empty \`string\`.`),l.jsx(Rr.Provider,{scope:t,children:l.jsx(na,{scope:t,label:r,duration:n,swipeDirection:o,swipeThreshold:s,toastCount:d,viewport:i,onViewportChange:f,onToastAdd:u.useCallback(()=>p(c=>c+1),[]),onToastRemove:u.useCallback(()=>p(c=>c-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};jn.displayName=Cr;var _n="ToastViewport",oa=["F8"],ur="toast.viewportPause",fr="toast.viewportResume",Dn=u.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=oa,label:o="Notifications ({hotkey})",...s}=e,a=Wt(_n,r),i=ta(r),f=u.useRef(null),d=u.useRef(null),p=u.useRef(null),m=u.useRef(null),g=ye(t,m,a.onViewportChange),c=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=a.toastCount>0;u.useEffect(()=>{const y=x=>{n.length!==0&&n.every(E=>x[E]||x.code===E)&&m.current?.focus()};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]),u.useEffect(()=>{const y=f.current,x=m.current;if(v&&y&&x){const w=()=>{if(!a.isClosePausedRef.current){const O=new CustomEvent(ur);x.dispatchEvent(O),a.isClosePausedRef.current=!0}},E=()=>{if(a.isClosePausedRef.current){const O=new CustomEvent(fr);x.dispatchEvent(O),a.isClosePausedRef.current=!1}},R=O=>{!y.contains(O.relatedTarget)&&E()},N=()=>{y.contains(document.activeElement)||E()};return y.addEventListener("focusin",w),y.addEventListener("focusout",R),y.addEventListener("pointermove",w),y.addEventListener("pointerleave",N),window.addEventListener("blur",w),window.addEventListener("focus",E),()=>{y.removeEventListener("focusin",w),y.removeEventListener("focusout",R),y.removeEventListener("pointermove",w),y.removeEventListener("pointerleave",N),window.removeEventListener("blur",w),window.removeEventListener("focus",E)}}},[v,a.isClosePausedRef]);const h=u.useCallback(({tabbingDirection:y})=>{const w=i().map(E=>{const R=E.ref.current,N=[R,...ya(R)];return y==="forwards"?N:N.reverse()});return(y==="forwards"?w.reverse():w).flat()},[i]);return u.useEffect(()=>{const y=m.current;if(y){const x=w=>{const E=w.altKey||w.ctrlKey||w.metaKey;if(w.key==="Tab"&&!E){const N=document.activeElement,O=w.shiftKey;if(w.target===y&&O){d.current?.focus();return}const F=h({tabbingDirection:O?"backwards":"forwards"}),z=F.findIndex(P=>P===N);nr(F.slice(z+1))?w.preventDefault():O?d.current?.focus():p.current?.focus()}};return y.addEventListener("keydown",x),()=>y.removeEventListener("keydown",x)}},[i,h]),l.jsxs(Ws,{ref:f,role:"region","aria-label":o.replace("{hotkey}",c),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&l.jsx(pr,{ref:d,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"forwards"});nr(y)}}),l.jsx(Rr.Slot,{scope:r,children:l.jsx(oe.ol,{tabIndex:-1,...s,ref:g})}),v&&l.jsx(pr,{ref:p,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"backwards"});nr(y)}})]})});Dn.displayName=_n;var kn="ToastFocusProxy",pr=u.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...o}=e,s=Wt(kn,r);return l.jsx(Bt,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:a=>{const i=a.relatedTarget;!s.viewport?.contains(i)&&n()}})});pr.displayName=kn;var ht="Toast",sa="toast.swipeStart",aa="toast.swipeMove",ia="toast.swipeCancel",la="toast.swipeEnd",In=u.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:o,onOpenChange:s,...a}=e,[i,f]=An({prop:n,defaultProp:o??!0,onChange:s,caller:ht});return l.jsx(Er,{present:r||i,children:l.jsx(ua,{open:i,...a,ref:t,onClose:()=>f(!1),onPause:$e(e.onPause),onResume:$e(e.onResume),onSwipeStart:te(e.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:te(e.onSwipeMove,d=>{const{x:p,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:te(e.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:te(e.onSwipeEnd,d=>{const{x:p,y:m}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),f(!1)})})})});In.displayName=ht;var[ca,da]=On(ht,{onClose(){}}),ua=u.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:o,open:s,onClose:a,onEscapeKeyDown:i,onPause:f,onResume:d,onSwipeStart:p,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:c,...v}=e,h=Wt(ht,r),[y,x]=u.useState(null),w=ye(t,b=>x(b)),E=u.useRef(null),R=u.useRef(null),N=o||h.duration,O=u.useRef(0),j=u.useRef(N),$=u.useRef(0),{onToastAdd:F,onToastRemove:z}=h,P=$e(()=>{y?.contains(document.activeElement)&&h.viewport?.focus(),a()}),C=u.useCallback(b=>{!b||b===1/0||(window.clearTimeout($.current),O.current=new Date().getTime(),$.current=window.setTimeout(P,b))},[P]);u.useEffect(()=>{const b=h.viewport;if(b){const k=()=>{C(j.current),d?.()},_=()=>{const M=new Date().getTime()-O.current;j.current=j.current-M,window.clearTimeout($.current),f?.()};return b.addEventListener(ur,_),b.addEventListener(fr,k),()=>{b.removeEventListener(ur,_),b.removeEventListener(fr,k)}}},[h.viewport,N,f,d,C]),u.useEffect(()=>{s&&!h.isClosePausedRef.current&&C(N)},[s,N,h.isClosePausedRef,C]),u.useEffect(()=>(F(),()=>z()),[F,z]);const T=u.useMemo(()=>y?Hn(y):null,[y]);return h.viewport?l.jsxs(l.Fragment,{children:[T&&l.jsx(fa,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:T}),l.jsx(ca,{scope:r,onClose:P,children:$t.createPortal(l.jsx(Rr.ItemSlot,{scope:r,children:l.jsx(Bs,{asChild:!0,onEscapeKeyDown:te(i,()=>{h.isFocusedToastEscapeKeyDownRef.current||P(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(oe.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":h.swipeDirection,...v,ref:w,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:te(e.onKeyDown,b=>{b.key==="Escape"&&(i?.(b.nativeEvent),b.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,P()))}),onPointerDown:te(e.onPointerDown,b=>{b.button===0&&(E.current={x:b.clientX,y:b.clientY})}),onPointerMove:te(e.onPointerMove,b=>{if(!E.current)return;const k=b.clientX-E.current.x,_=b.clientY-E.current.y,M=!!R.current,D=["left","right"].includes(h.swipeDirection),A=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,B=D?A(0,k):0,q=D?0:A(0,_),W=b.pointerType==="touch"?10:2,V={x:B,y:q},I={originalEvent:b,delta:V};M?(R.current=V,Rt(aa,m,I,{discrete:!1})):Gr(V,h.swipeDirection,W)?(R.current=V,Rt(sa,p,I,{discrete:!1}),b.target.setPointerCapture(b.pointerId)):(Math.abs(k)>W||Math.abs(_)>W)&&(E.current=null)}),onPointerUp:te(e.onPointerUp,b=>{const k=R.current,_=b.target;if(_.hasPointerCapture(b.pointerId)&&_.releasePointerCapture(b.pointerId),R.current=null,E.current=null,k){const M=b.currentTarget,D={originalEvent:b,delta:k};Gr(k,h.swipeDirection,h.swipeThreshold)?Rt(la,c,D,{discrete:!0}):Rt(ia,g,D,{discrete:!0}),M.addEventListener("click",A=>A.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),fa=e=>{const{__scopeToast:t,children:r,...n}=e,o=Wt(ht,t),[s,a]=u.useState(!1),[i,f]=u.useState(!1);return ha(()=>a(!0)),u.useEffect(()=>{const d=window.setTimeout(()=>f(!0),1e3);return()=>window.clearTimeout(d)},[]),i?null:l.jsx(Pn,{asChild:!0,children:l.jsx(Bt,{...n,children:s&&l.jsxs(l.Fragment,{children:[o.label," ",r]})})})},pa="ToastTitle",Ln=u.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(oe.div,{...n,ref:t})});Ln.displayName=pa;var ma="ToastDescription",Mn=u.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return l.jsx(oe.div,{...n,ref:t})});Mn.displayName=ma;var Fn="ToastAction",$n=u.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?l.jsx(Un,{altText:r,asChild:!0,children:l.jsx(Tr,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Fn}\`. Expected non-empty \`string\`.`),null)});$n.displayName=Fn;var zn="ToastClose",Tr=u.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,o=da(zn,r);return l.jsx(Un,{asChild:!0,children:l.jsx(oe.button,{type:"button",...n,ref:t,onClick:te(e.onClick,o.onClose)})})});Tr.displayName=zn;var Un=u.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...o}=e;return l.jsx(oe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...o,ref:t})});function Hn(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),ga(n)){const o=n.ariaHidden||n.hidden||n.style.display==="none",s=n.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const a=n.dataset.radixToastAnnounceAlt;a&&t.push(a)}else t.push(...Hn(n))}}),t}function Rt(e,t,r,{discrete:n}){const o=r.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?Rn(o,s):o.dispatchEvent(s)}var Gr=(e,t,r=0)=>{const n=Math.abs(e.x),o=Math.abs(e.y),s=n>o;return t==="left"||t==="right"?s&&n>r:!s&&o>r};function ha(e=()=>{}){const t=$e(e);Oe(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function ga(e){return e.nodeType===e.ELEMENT_NODE}function ya(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const o=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||o?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function nr(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var va=jn,Bn=Dn,Wn=In,Vn=Ln,Kn=Mn,Yn=$n,qn=Tr;function Gn(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,Qr=Xn,Vt=(e,t)=>r=>{var n;if(t?.variants==null)return Qr(e,r?.class,r?.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(d=>{const p=r?.[d],m=s?.[d];if(p===null)return null;const g=Xr(p)||Xr(m);return o[d][g]}),i=r&&Object.entries(r).reduce((d,p)=>{let[m,g]=p;return g===void 0||(d[m]=g),d},{}),f=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,p)=>{let{class:m,className:g,...c}=p;return Object.entries(c).every(v=>{let[h,y]=v;return Array.isArray(y)?y.includes({...s,...i}[h]):{...s,...i}[h]===y})?[...d,m,g]:d},[]);return Qr(e,a,f,r?.class,r?.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wa=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Qn=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var xa={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ba=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:o="",children:s,iconNode:a,...i},f)=>u.createElement("svg",{ref:f,...xa,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Qn("lucide",o),...i},[...a.map(([d,p])=>u.createElement(d,p)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ue=(e,t)=>{const r=u.forwardRef(({className:n,...o},s)=>u.createElement(ba,{ref:s,iconNode:t,className:Qn(`lucide-${wa(e)}`,n),...o}));return r.displayName=`${e}`,r};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ea=ue("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _t=ue("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ca=ue("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ra=ue("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ta=ue("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const At=ue("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sa=ue("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jn=ue("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zn=ue("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Na=ue("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pa=ue("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aa=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Sr="-",Oa=e=>{const t=_a(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:a=>{const i=a.split(Sr);return i[0]===""&&i.length!==1&&i.shift(),eo(i,t)||ja(a)},getConflictingClassGroupIds:(a,i)=>{const f=r[a]||[];return i&&n[a]?[...f,...n[a]]:f}}},eo=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),o=n?eo(e.slice(1),n):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Sr);return t.validators.find(({validator:a})=>a(s))?.classGroupId},Jr=/^\[(.+)\]$/,ja=e=>{if(Jr.test(e)){const t=Jr.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},_a=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return ka(Object.entries(e.classGroups),r).forEach(([s,a])=>{mr(a,n,s,t)}),n},mr=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Zr(t,o);s.classGroupId=r;return}if(typeof o=="function"){if(Da(o)){mr(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([s,a])=>{mr(a,Zr(t,s),r,n)})})},Zr=(e,t)=>{let r=e;return t.split(Sr).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},Da=e=>e.isThemeGetter,ka=(e,t)=>t?e.map(([r,n])=>{const o=n.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([a,i])=>[t+a,i])):s);return[r,o]}):e,Ia=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const o=(s,a)=>{r.set(s,a),t++,t>e&&(t=0,n=r,r=new Map)};return{get(s){let a=r.get(s);if(a!==void 0)return a;if((a=n.get(s))!==void 0)return o(s,a),a},set(s,a){r.has(s)?r.set(s,a):o(s,a)}}},to="!",La=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,o=t[0],s=t.length,a=i=>{const f=[];let d=0,p=0,m;for(let y=0;yp?m-p:void 0;return{modifiers:f,hasImportantModifier:c,baseClassName:v,maybePostfixModifierPosition:h}};return r?i=>r({className:i,parseClassName:a}):a},Ma=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},Fa=e=>({cache:Ia(e.cacheSize),parseClassName:La(e),...Oa(e)}),$a=/\s+/,za=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=t,s=[],a=e.trim().split($a);let i="";for(let f=a.length-1;f>=0;f-=1){const d=a[f],{modifiers:p,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:c}=r(d);let v=!!c,h=n(v?g.substring(0,c):g);if(!h){if(!v){i=d+(i.length>0?" "+i:i);continue}if(h=n(g),!h){i=d+(i.length>0?" "+i:i);continue}v=!1}const y=Ma(p).join(":"),x=m?y+to:y,w=x+h;if(s.includes(w))continue;s.push(w);const E=o(h,v);for(let R=0;R0?" "+i:i)}return i};function Ua(){let e=0,t,r,n="";for(;e{if(typeof e=="string")return e;let t,r="";for(let n=0;nm(p),e());return r=Fa(d),n=r.cache.get,o=r.cache.set,s=i,i(f)}function i(f){const d=n(f);if(d)return d;const p=za(f,r);return o(f,p),p}return function(){return s(Ua.apply(null,arguments))}}const X=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},no=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ba=/^\d+\/\d+$/,Wa=new Set(["px","full","screen"]),Va=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ka=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ya=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,qa=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ga=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ne=e=>Qe(e)||Wa.has(e)||Ba.test(e),Me=e=>tt(e,"length",ni),Qe=e=>!!e&&!Number.isNaN(Number(e)),or=e=>tt(e,"number",Qe),it=e=>!!e&&Number.isInteger(Number(e)),Xa=e=>e.endsWith("%")&&Qe(e.slice(0,-1)),H=e=>no.test(e),Fe=e=>Va.test(e),Qa=new Set(["length","size","percentage"]),Ja=e=>tt(e,Qa,oo),Za=e=>tt(e,"position",oo),ei=new Set(["image","url"]),ti=e=>tt(e,ei,si),ri=e=>tt(e,"",oi),lt=()=>!0,tt=(e,t,r)=>{const n=no.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},ni=e=>Ka.test(e)&&!Ya.test(e),oo=()=>!1,oi=e=>qa.test(e),si=e=>Ga.test(e),ai=()=>{const e=X("colors"),t=X("spacing"),r=X("blur"),n=X("brightness"),o=X("borderColor"),s=X("borderRadius"),a=X("borderSpacing"),i=X("borderWidth"),f=X("contrast"),d=X("grayscale"),p=X("hueRotate"),m=X("invert"),g=X("gap"),c=X("gradientColorStops"),v=X("gradientColorStopPositions"),h=X("inset"),y=X("margin"),x=X("opacity"),w=X("padding"),E=X("saturate"),R=X("scale"),N=X("sepia"),O=X("skew"),j=X("space"),$=X("translate"),F=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",H,t],C=()=>[H,t],T=()=>["",Ne,Me],b=()=>["auto",Qe,H],k=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],_=()=>["solid","dashed","dotted","double","none"],M=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],D=()=>["start","end","center","between","around","evenly","stretch"],A=()=>["","0",H],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[Qe,H];return{cacheSize:500,separator:":",theme:{colors:[lt],spacing:[Ne,Me],blur:["none","",Fe,H],brightness:q(),borderColor:[e],borderRadius:["none","","full",Fe,H],borderSpacing:C(),borderWidth:T(),contrast:q(),grayscale:A(),hueRotate:q(),invert:A(),gap:C(),gradientColorStops:[e],gradientColorStopPositions:[Xa,Me],inset:P(),margin:P(),opacity:q(),padding:C(),saturate:q(),scale:q(),sepia:A(),skew:q(),space:C(),translate:C()},classGroups:{aspect:[{aspect:["auto","square","video",H]}],container:["container"],columns:[{columns:[Fe]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...k(),H]}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",it,H]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",H]}],grow:[{grow:A()}],shrink:[{shrink:A()}],order:[{order:["first","last","none",it,H]}],"grid-cols":[{"grid-cols":[lt]}],"col-start-end":[{col:["auto",{span:["full",it,H]},H]}],"col-start":[{"col-start":b()}],"col-end":[{"col-end":b()}],"grid-rows":[{"grid-rows":[lt]}],"row-start-end":[{row:["auto",{span:[it,H]},H]}],"row-start":[{"row-start":b()}],"row-end":[{"row-end":b()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",H]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",H]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...D()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...D(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...D(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",H,t]}],"min-w":[{"min-w":[H,t,"min","max","fit"]}],"max-w":[{"max-w":[H,t,"none","full","min","max","fit","prose",{screen:[Fe]},Fe]}],h:[{h:[H,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[H,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[H,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[H,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Fe,Me]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",or]}],"font-family":[{font:[lt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",H]}],"line-clamp":[{"line-clamp":["none",Qe,or]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ne,H]}],"list-image":[{"list-image":["none",H]}],"list-style-type":[{list:["none","disc","decimal",H]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[..._(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ne,Me]}],"underline-offset":[{"underline-offset":["auto",Ne,H]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",H]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",H]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...k(),Za]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Ja]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ti]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[c]}],"gradient-via":[{via:[c]}],"gradient-to":[{to:[c]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[..._(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:_()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",..._()]}],"outline-offset":[{"outline-offset":[Ne,H]}],"outline-w":[{outline:[Ne,Me]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:T()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[Ne,Me]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Fe,ri]}],"shadow-color":[{shadow:[lt]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...M(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":M()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Fe,H]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[m]}],saturate:[{saturate:[E]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",H]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",H]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",H]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[it,H]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",H]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",H]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",H]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ne,Me,or]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},ii=Ha(ai);function Z(...e){return ii(Xn(e))}const li=va,so=u.forwardRef(({className:e,...t},r)=>l.jsx(Bn,{ref:r,className:Z("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));so.displayName=Bn.displayName;const ci=Vt("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),ao=u.forwardRef(({className:e,variant:t,...r},n)=>l.jsx(Wn,{ref:n,className:Z(ci({variant:t}),e),...r}));ao.displayName=Wn.displayName;const di=u.forwardRef(({className:e,...t},r)=>l.jsx(Yn,{ref:r,className:Z("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));di.displayName=Yn.displayName;const io=u.forwardRef(({className:e,...t},r)=>l.jsx(qn,{ref:r,className:Z("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:l.jsx(Aa,{className:"h-4 w-4"})}));io.displayName=qn.displayName;const lo=u.forwardRef(({className:e,...t},r)=>l.jsx(Vn,{ref:r,className:Z("text-sm font-semibold",e),...t}));lo.displayName=Vn.displayName;const co=u.forwardRef(({className:e,...t},r)=>l.jsx(Kn,{ref:r,className:Z("text-sm opacity-90",e),...t}));co.displayName=Kn.displayName;function ui(){const{toasts:e}=Ss();return l.jsxs(li,{children:[e.map(function({id:t,title:r,description:n,action:o,...s}){return l.jsxs(ao,{...s,children:[l.jsxs("div",{className:"grid gap-1",children:[r&&l.jsx(lo,{children:r}),n&&l.jsx(co,{children:n})]}),o,l.jsx(io,{})]},t)}),l.jsx(so,{})]})}var en=["light","dark"],fi="(prefers-color-scheme: dark)",pi=u.createContext(void 0),mi={setTheme:e=>{},themes:[]},hi=()=>{var e;return(e=u.useContext(pi))!=null?e:mi};u.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:o,defaultTheme:s,value:a,attrs:i,nonce:f})=>{let d=s==="system",p=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(v=>`'${v}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,m=o?en.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",g=(v,h=!1,y=!0)=>{let x=a?a[v]:v,w=h?v+"|| ''":`'${x}'`,E="";return o&&y&&!h&&en.includes(v)&&(E+=`d.style.colorScheme = '${v}';`),r==="class"?h||x?E+=`c.add(${w})`:E+="null":x&&(E+=`d[s](n,${w})`),E},c=e?`!function(){${p}${g(e)}}()`:n?`!function(){try{${p}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${d})){var t='${fi}',m=window.matchMedia(t);if(m.media!==t||m.matches){${g("dark")}}else{${g("light")}}}else if(e){${a?`var x=${JSON.stringify(a)};`:""}${g(a?"x[e]":"e",!0)}}${d?"":"else{"+g(s,!1,!1)+"}"}${m}}catch(e){}}()`:`!function(){try{${p}var e=localStorage.getItem('${t}');if(e){${a?`var x=${JSON.stringify(a)};`:""}${g(a?"x[e]":"e",!0)}}else{${g(s,!1,!1)};}${m}}catch(t){}}();`;return u.createElement("script",{nonce:f,dangerouslySetInnerHTML:{__html:c}})});var gi=e=>{switch(e){case"success":return wi;case"info":return bi;case"warning":return xi;case"error":return Ei;default:return null}},yi=Array(12).fill(0),vi=({visible:e,className:t})=>S.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},S.createElement("div",{className:"sonner-spinner"},yi.map((r,n)=>S.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),wi=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},S.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),xi=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},S.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),bi=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},S.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ei=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},S.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Ci=S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},S.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),S.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ri=()=>{let[e,t]=S.useState(document.hidden);return S.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},hr=1,Ti=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,o=typeof e?.id=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:hr++,s=this.toasts.find(i=>i.id===o),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),s?this.toasts=this.toasts.map(i=>i.id===o?(this.publish({...i,...e,id:o,title:r}),{...i,...e,id:o,dismissible:a,title:r}):i):this.addToast({title:r,...n,dismissible:a,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),o=r!==void 0,s,a=n.then(async f=>{if(s=["resolve",f],S.isValidElement(f))o=!1,this.create({id:r,type:"default",message:f});else if(Ni(f)&&!f.ok){o=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${f.status}`):t.error,p=typeof t.description=="function"?await t.description(`HTTP error! status: ${f.status}`):t.description;this.create({id:r,type:"error",message:d,description:p})}else if(t.success!==void 0){o=!1;let d=typeof t.success=="function"?await t.success(f):t.success,p=typeof t.description=="function"?await t.description(f):t.description;this.create({id:r,type:"success",message:d,description:p})}}).catch(async f=>{if(s=["reject",f],t.error!==void 0){o=!1;let d=typeof t.error=="function"?await t.error(f):t.error,p=typeof t.description=="function"?await t.description(f):t.description;this.create({id:r,type:"error",message:d,description:p})}}).finally(()=>{var f;o&&(this.dismiss(r),r=void 0),(f=t.finally)==null||f.call(t)}),i=()=>new Promise((f,d)=>a.then(()=>s[0]==="reject"?d(s[1]):f(s[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:i}:Object.assign(r,{unwrap:i})},this.custom=(e,t)=>{let r=t?.id||hr++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},se=new Ti,Si=(e,t)=>{let r=t?.id||hr++;return se.addToast({title:e,...t,id:r}),r},Ni=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Pi=Si,Ai=()=>se.toasts,Oi=()=>se.getActiveToasts(),Rd=Object.assign(Pi,{success:se.success,info:se.info,warning:se.warning,error:se.error,custom:se.custom,message:se.message,promise:se.promise,dismiss:se.dismiss,loading:se.loading},{getHistory:Ai,getToasts:Oi});function ji(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}ji(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} `);function Tt(e){return e.label!==void 0}var _i=3,Di="32px",ki="16px",tn=4e3,Ii=356,Li=14,Mi=20,Fi=200;function he(...e){return e.filter(Boolean).join(" ")}function $i(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var zi=e=>{var t,r,n,o,s,a,i,f,d,p,m;let{invert:g,toast:c,unstyled:v,interacting:h,setHeights:y,visibleToasts:x,heights:w,index:E,toasts:R,expanded:N,removeToast:O,defaultRichColors:j,closeButton:$,style:F,cancelButtonStyle:z,actionButtonStyle:P,className:C="",descriptionClassName:T="",duration:b,position:k,gap:_,loadingIcon:M,expandByDefault:D,classNames:A,icons:B,closeButtonAriaLabel:q="Close toast",pauseWhenPageIsHidden:W}=e,[V,I]=S.useState(null),[K,ce]=S.useState(null),[Y,De]=S.useState(!1),[xe,be]=S.useState(!1),[He,st]=S.useState(!1),[Be,Jo]=S.useState(!1),[Zo,Mr]=S.useState(!1),[es,Jt]=S.useState(0),[ts,Fr]=S.useState(0),at=S.useRef(c.duration||b||tn),$r=S.useRef(null),We=S.useRef(null),rs=E===0,ns=E+1<=x,de=c.type,Ye=c.dismissible!==!1,os=c.className||"",ss=c.descriptionClassName||"",Et=S.useMemo(()=>w.findIndex(U=>U.toastId===c.id)||0,[w,c.id]),as=S.useMemo(()=>{var U;return(U=c.closeButton)!=null?U:$},[c.closeButton,$]),zr=S.useMemo(()=>c.duration||b||tn,[c.duration,b]),Zt=S.useRef(0),qe=S.useRef(0),Ur=S.useRef(0),Ge=S.useRef(null),[is,ls]=k.split("-"),Hr=S.useMemo(()=>w.reduce((U,G,Q)=>Q>=Et?U:U+G.height,0),[w,Et]),Br=Ri(),cs=c.invert||g,er=de==="loading";qe.current=S.useMemo(()=>Et*_+Hr,[Et,Hr]),S.useEffect(()=>{at.current=zr},[zr]),S.useEffect(()=>{De(!0)},[]),S.useEffect(()=>{let U=We.current;if(U){let G=U.getBoundingClientRect().height;return Fr(G),y(Q=>[{toastId:c.id,height:G,position:c.position},...Q]),()=>y(Q=>Q.filter(fe=>fe.toastId!==c.id))}},[y,c.id]),S.useLayoutEffect(()=>{if(!Y)return;let U=We.current,G=U.style.height;U.style.height="auto";let Q=U.getBoundingClientRect().height;U.style.height=G,Fr(Q),y(fe=>fe.find(pe=>pe.toastId===c.id)?fe.map(pe=>pe.toastId===c.id?{...pe,height:Q}:pe):[{toastId:c.id,height:Q,position:c.position},...fe])},[Y,c.title,c.description,y,c.id]);let ke=S.useCallback(()=>{be(!0),Jt(qe.current),y(U=>U.filter(G=>G.toastId!==c.id)),setTimeout(()=>{O(c)},Fi)},[c,O,y,qe]);S.useEffect(()=>{if(c.promise&&de==="loading"||c.duration===1/0||c.type==="loading")return;let U;return N||h||W&&Br?(()=>{if(Ur.current{var G;(G=c.onAutoClose)==null||G.call(c,c),ke()},at.current)),()=>clearTimeout(U)},[N,h,c,de,W,Br,ke]),S.useEffect(()=>{c.delete&&ke()},[ke,c.delete]);function ds(){var U,G,Q;return B!=null&&B.loading?S.createElement("div",{className:he(A?.loader,(U=c?.classNames)==null?void 0:U.loader,"sonner-loader"),"data-visible":de==="loading"},B.loading):M?S.createElement("div",{className:he(A?.loader,(G=c?.classNames)==null?void 0:G.loader,"sonner-loader"),"data-visible":de==="loading"},M):S.createElement(vi,{className:he(A?.loader,(Q=c?.classNames)==null?void 0:Q.loader),visible:de==="loading"})}return S.createElement("li",{tabIndex:0,ref:We,className:he(C,os,A?.toast,(t=c?.classNames)==null?void 0:t.toast,A?.default,A?.[de],(r=c?.classNames)==null?void 0:r[de]),"data-sonner-toast":"","data-rich-colors":(n=c.richColors)!=null?n:j,"data-styled":!(c.jsx||c.unstyled||v),"data-mounted":Y,"data-promise":!!c.promise,"data-swiped":Zo,"data-removed":xe,"data-visible":ns,"data-y-position":is,"data-x-position":ls,"data-index":E,"data-front":rs,"data-swiping":He,"data-dismissible":Ye,"data-type":de,"data-invert":cs,"data-swipe-out":Be,"data-swipe-direction":K,"data-expanded":!!(N||D&&Y),style:{"--index":E,"--toasts-before":E,"--z-index":R.length-E,"--offset":`${xe?es:qe.current}px`,"--initial-height":D?"auto":`${ts}px`,...F,...c.style},onDragEnd:()=>{st(!1),I(null),Ge.current=null},onPointerDown:U=>{er||!Ye||($r.current=new Date,Jt(qe.current),U.target.setPointerCapture(U.pointerId),U.target.tagName!=="BUTTON"&&(st(!0),Ge.current={x:U.clientX,y:U.clientY}))},onPointerUp:()=>{var U,G,Q,fe;if(Be||!Ye)return;Ge.current=null;let pe=Number(((U=We.current)==null?void 0:U.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ie=Number(((G=We.current)==null?void 0:G.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ve=new Date().getTime()-((Q=$r.current)==null?void 0:Q.getTime()),me=V==="x"?pe:Ie,Le=Math.abs(me)/Ve;if(Math.abs(me)>=Mi||Le>.11){Jt(qe.current),(fe=c.onDismiss)==null||fe.call(c,c),ce(V==="x"?pe>0?"right":"left":Ie>0?"down":"up"),ke(),Jo(!0),Mr(!1);return}st(!1),I(null)},onPointerMove:U=>{var G,Q,fe,pe;if(!Ge.current||!Ye||((G=window.getSelection())==null?void 0:G.toString().length)>0)return;let Ie=U.clientY-Ge.current.y,Ve=U.clientX-Ge.current.x,me=(Q=e.swipeDirections)!=null?Q:$i(k);!V&&(Math.abs(Ve)>1||Math.abs(Ie)>1)&&I(Math.abs(Ve)>Math.abs(Ie)?"x":"y");let Le={x:0,y:0};V==="y"?(me.includes("top")||me.includes("bottom"))&&(me.includes("top")&&Ie<0||me.includes("bottom")&&Ie>0)&&(Le.y=Ie):V==="x"&&(me.includes("left")||me.includes("right"))&&(me.includes("left")&&Ve<0||me.includes("right")&&Ve>0)&&(Le.x=Ve),(Math.abs(Le.x)>0||Math.abs(Le.y)>0)&&Mr(!0),(fe=We.current)==null||fe.style.setProperty("--swipe-amount-x",`${Le.x}px`),(pe=We.current)==null||pe.style.setProperty("--swipe-amount-y",`${Le.y}px`)}},as&&!c.jsx?S.createElement("button",{"aria-label":q,"data-disabled":er,"data-close-button":!0,onClick:er||!Ye?()=>{}:()=>{var U;ke(),(U=c.onDismiss)==null||U.call(c,c)},className:he(A?.closeButton,(o=c?.classNames)==null?void 0:o.closeButton)},(s=B?.close)!=null?s:Ci):null,c.jsx||u.isValidElement(c.title)?c.jsx?c.jsx:typeof c.title=="function"?c.title():c.title:S.createElement(S.Fragment,null,de||c.icon||c.promise?S.createElement("div",{"data-icon":"",className:he(A?.icon,(a=c?.classNames)==null?void 0:a.icon)},c.promise||c.type==="loading"&&!c.icon?c.icon||ds():null,c.type!=="loading"?c.icon||B?.[de]||gi(de):null):null,S.createElement("div",{"data-content":"",className:he(A?.content,(i=c?.classNames)==null?void 0:i.content)},S.createElement("div",{"data-title":"",className:he(A?.title,(f=c?.classNames)==null?void 0:f.title)},typeof c.title=="function"?c.title():c.title),c.description?S.createElement("div",{"data-description":"",className:he(T,ss,A?.description,(d=c?.classNames)==null?void 0:d.description)},typeof c.description=="function"?c.description():c.description):null),u.isValidElement(c.cancel)?c.cancel:c.cancel&&Tt(c.cancel)?S.createElement("button",{"data-button":!0,"data-cancel":!0,style:c.cancelButtonStyle||z,onClick:U=>{var G,Q;Tt(c.cancel)&&Ye&&((Q=(G=c.cancel).onClick)==null||Q.call(G,U),ke())},className:he(A?.cancelButton,(p=c?.classNames)==null?void 0:p.cancelButton)},c.cancel.label):null,u.isValidElement(c.action)?c.action:c.action&&Tt(c.action)?S.createElement("button",{"data-button":!0,"data-action":!0,style:c.actionButtonStyle||P,onClick:U=>{var G,Q;Tt(c.action)&&((Q=(G=c.action).onClick)==null||Q.call(G,U),!U.defaultPrevented&&ke())},className:he(A?.actionButton,(m=c?.classNames)==null?void 0:m.actionButton)},c.action.label):null))};function rn(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Ui(e,t){let r={};return[e,t].forEach((n,o)=>{let s=o===1,a=s?"--mobile-offset":"--offset",i=s?ki:Di;function f(d){["top","right","bottom","left"].forEach(p=>{r[`${a}-${p}`]=typeof d=="number"?`${d}px`:d})}typeof n=="number"||typeof n=="string"?f(n):typeof n=="object"?["top","right","bottom","left"].forEach(d=>{n[d]===void 0?r[`${a}-${d}`]=i:r[`${a}-${d}`]=typeof n[d]=="number"?`${n[d]}px`:n[d]}):f(i)}),r}var Hi=u.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:o=["altKey","KeyT"],expand:s,closeButton:a,className:i,offset:f,mobileOffset:d,theme:p="light",richColors:m,duration:g,style:c,visibleToasts:v=_i,toastOptions:h,dir:y=rn(),gap:x=Li,loadingIcon:w,icons:E,containerAriaLabel:R="Notifications",pauseWhenPageIsHidden:N}=e,[O,j]=S.useState([]),$=S.useMemo(()=>Array.from(new Set([n].concat(O.filter(W=>W.position).map(W=>W.position)))),[O,n]),[F,z]=S.useState([]),[P,C]=S.useState(!1),[T,b]=S.useState(!1),[k,_]=S.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),M=S.useRef(null),D=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=S.useRef(null),B=S.useRef(!1),q=S.useCallback(W=>{j(V=>{var I;return(I=V.find(K=>K.id===W.id))!=null&&I.delete||se.dismiss(W.id),V.filter(({id:K})=>K!==W.id)})},[]);return S.useEffect(()=>se.subscribe(W=>{if(W.dismiss){j(V=>V.map(I=>I.id===W.id?{...I,delete:!0}:I));return}setTimeout(()=>{wn.flushSync(()=>{j(V=>{let I=V.findIndex(K=>K.id===W.id);return I!==-1?[...V.slice(0,I),{...V[I],...W},...V.slice(I+1)]:[W,...V]})})})}),[]),S.useEffect(()=>{if(p!=="system"){_(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?_("dark"):_("light")),typeof window>"u")return;let W=window.matchMedia("(prefers-color-scheme: dark)");try{W.addEventListener("change",({matches:V})=>{_(V?"dark":"light")})}catch{W.addListener(({matches:I})=>{try{_(I?"dark":"light")}catch(K){console.error(K)}})}},[p]),S.useEffect(()=>{O.length<=1&&C(!1)},[O]),S.useEffect(()=>{let W=V=>{var I,K;o.every(ce=>V[ce]||V.code===ce)&&(C(!0),(I=M.current)==null||I.focus()),V.code==="Escape"&&(document.activeElement===M.current||(K=M.current)!=null&&K.contains(document.activeElement))&&C(!1)};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[o]),S.useEffect(()=>{if(M.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,B.current=!1)}},[M.current]),S.createElement("section",{ref:t,"aria-label":`${R} ${D}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},$.map((W,V)=>{var I;let[K,ce]=W.split("-");return O.length?S.createElement("ol",{key:W,dir:y==="auto"?rn():y,tabIndex:-1,ref:M,className:i,"data-sonner-toaster":!0,"data-theme":k,"data-y-position":K,"data-lifted":P&&O.length>1&&!s,"data-x-position":ce,style:{"--front-toast-height":`${((I=F[0])==null?void 0:I.height)||0}px`,"--width":`${Ii}px`,"--gap":`${x}px`,...c,...Ui(f,d)},onBlur:Y=>{B.current&&!Y.currentTarget.contains(Y.relatedTarget)&&(B.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:Y=>{Y.target instanceof HTMLElement&&Y.target.dataset.dismissible==="false"||B.current||(B.current=!0,A.current=Y.relatedTarget)},onMouseEnter:()=>C(!0),onMouseMove:()=>C(!0),onMouseLeave:()=>{T||C(!1)},onDragEnd:()=>C(!1),onPointerDown:Y=>{Y.target instanceof HTMLElement&&Y.target.dataset.dismissible==="false"||b(!0)},onPointerUp:()=>b(!1)},O.filter(Y=>!Y.position&&V===0||Y.position===W).map((Y,De)=>{var xe,be;return S.createElement(zi,{key:Y.id,icons:E,index:De,toast:Y,defaultRichColors:m,duration:(xe=h?.duration)!=null?xe:g,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:r,visibleToasts:v,closeButton:(be=h?.closeButton)!=null?be:a,interacting:T,position:W,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,removeToast:q,toasts:O.filter(He=>He.position==Y.position),heights:F.filter(He=>He.position==Y.position),setHeights:z,expandByDefault:s,gap:x,loadingIcon:w,expanded:P,pauseWhenPageIsHidden:N,swipeDirections:e.swipeDirections})})):null}))});const Bi=({...e})=>{const{theme:t="system"}=hi();return l.jsx(Hi,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var Wi=xn[" useId ".trim().toString()]||(()=>{}),Vi=0;function Ki(e){const[t,r]=u.useState(Wi());return Oe(()=>{r(n=>n??String(Vi++))},[e]),t?`radix-${t}`:""}const Yi=["top","right","bottom","left"],ze=Math.min,ie=Math.max,Dt=Math.round,St=Math.floor,Re=e=>({x:e,y:e}),qi={left:"right",right:"left",bottom:"top",top:"bottom"},Gi={start:"end",end:"start"};function gr(e,t,r){return ie(e,ze(t,r))}function je(e,t){return typeof e=="function"?e(t):e}function _e(e){return e.split("-")[0]}function rt(e){return e.split("-")[1]}function Nr(e){return e==="x"?"y":"x"}function Pr(e){return e==="y"?"height":"width"}const Xi=new Set(["top","bottom"]);function Ee(e){return Xi.has(_e(e))?"y":"x"}function Ar(e){return Nr(Ee(e))}function Qi(e,t,r){r===void 0&&(r=!1);const n=rt(e),o=Ar(e),s=Pr(o);let a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=kt(a)),[a,kt(a)]}function Ji(e){const t=kt(e);return[yr(e),t,yr(t)]}function yr(e){return e.replace(/start|end/g,t=>Gi[t])}const nn=["left","right"],on=["right","left"],Zi=["top","bottom"],el=["bottom","top"];function tl(e,t,r){switch(e){case"top":case"bottom":return r?t?on:nn:t?nn:on;case"left":case"right":return t?Zi:el;default:return[]}}function rl(e,t,r,n){const o=rt(e);let s=tl(_e(e),r==="start",n);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(yr)))),s}function kt(e){return e.replace(/left|right|bottom|top/g,t=>qi[t])}function nl(e){return{top:0,right:0,bottom:0,left:0,...e}}function uo(e){return typeof e!="number"?nl(e):{top:e,right:e,bottom:e,left:e}}function It(e){const{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function sn(e,t,r){let{reference:n,floating:o}=e;const s=Ee(t),a=Ar(t),i=Pr(a),f=_e(t),d=s==="y",p=n.x+n.width/2-o.width/2,m=n.y+n.height/2-o.height/2,g=n[i]/2-o[i]/2;let c;switch(f){case"top":c={x:p,y:n.y-o.height};break;case"bottom":c={x:p,y:n.y+n.height};break;case"right":c={x:n.x+n.width,y:m};break;case"left":c={x:n.x-o.width,y:m};break;default:c={x:n.x,y:n.y}}switch(rt(t)){case"start":c[a]-=g*(r&&d?-1:1);break;case"end":c[a]+=g*(r&&d?-1:1);break}return c}const ol=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:s=[],platform:a}=r,i=s.filter(Boolean),f=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:m}=sn(d,n,f),g=n,c={},v=0;for(let h=0;h({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:s,platform:a,elements:i,middlewareData:f}=t,{element:d,padding:p=0}=je(e,t)||{};if(d==null)return{};const m=uo(p),g={x:r,y:n},c=Ar(o),v=Pr(c),h=await a.getDimensions(d),y=c==="y",x=y?"top":"left",w=y?"bottom":"right",E=y?"clientHeight":"clientWidth",R=s.reference[v]+s.reference[c]-g[c]-s.floating[v],N=g[c]-s.reference[c],O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let j=O?O[E]:0;(!j||!await(a.isElement==null?void 0:a.isElement(O)))&&(j=i.floating[E]||s.floating[v]);const $=R/2-N/2,F=j/2-h[v]/2-1,z=ze(m[x],F),P=ze(m[w],F),C=z,T=j-h[v]-P,b=j/2-h[v]/2+$,k=gr(C,b,T),_=!f.arrow&&rt(o)!=null&&b!==k&&s.reference[v]/2-(bb<=0)){var P,C;const b=(((P=s.flip)==null?void 0:P.index)||0)+1,k=j[b];if(k&&(!(m==="alignment"?w!==Ee(k):!1)||z.every(D=>D.overflows[0]>0&&Ee(D.placement)===w)))return{data:{index:b,overflows:z},reset:{placement:k}};let _=(C=z.filter(M=>M.overflows[0]<=0).sort((M,D)=>M.overflows[1]-D.overflows[1])[0])==null?void 0:C.placement;if(!_)switch(c){case"bestFit":{var T;const M=(T=z.filter(D=>{if(O){const A=Ee(D.placement);return A===w||A==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(A=>A>0).reduce((A,B)=>A+B,0)]).sort((D,A)=>D[1]-A[1])[0])==null?void 0:T[0];M&&(_=M);break}case"initialPlacement":_=i;break}if(o!==_)return{reset:{placement:_}}}return{}}}};function an(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ln(e){return Yi.some(t=>e[t]>=0)}const il=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...o}=je(e,t);switch(n){case"referenceHidden":{const s=await ft(t,{...o,elementContext:"reference"}),a=an(s,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ln(a)}}}case"escaped":{const s=await ft(t,{...o,altBoundary:!0}),a=an(s,r.floating);return{data:{escapedOffsets:a,escaped:ln(a)}}}default:return{}}}}},fo=new Set(["left","top"]);async function ll(e,t){const{placement:r,platform:n,elements:o}=e,s=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=_e(r),i=rt(r),f=Ee(r)==="y",d=fo.has(a)?-1:1,p=s&&f?-1:1,m=je(t,e);let{mainAxis:g,crossAxis:c,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return i&&typeof v=="number"&&(c=i==="end"?v*-1:v),f?{x:c*p,y:g*d}:{x:g*d,y:c*p}}const cl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:s,placement:a,middlewareData:i}=t,f=await ll(t,e);return a===((r=i.offset)==null?void 0:r.placement)&&(n=i.arrow)!=null&&n.alignmentOffset?{}:{x:o+f.x,y:s+f.y,data:{...f,placement:a}}}}},dl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:i={fn:y=>{let{x,y:w}=y;return{x,y:w}}},...f}=je(e,t),d={x:r,y:n},p=await ft(t,f),m=Ee(_e(o)),g=Nr(m);let c=d[g],v=d[m];if(s){const y=g==="y"?"top":"left",x=g==="y"?"bottom":"right",w=c+p[y],E=c-p[x];c=gr(w,c,E)}if(a){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",w=v+p[y],E=v-p[x];v=gr(w,v,E)}const h=i.fn({...t,[g]:c,[m]:v});return{...h,data:{x:h.x-r,y:h.y-n,enabled:{[g]:s,[m]:a}}}}}},ul=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:f=!0,crossAxis:d=!0}=je(e,t),p={x:r,y:n},m=Ee(o),g=Nr(m);let c=p[g],v=p[m];const h=je(i,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(f){const E=g==="y"?"height":"width",R=s.reference[g]-s.floating[E]+y.mainAxis,N=s.reference[g]+s.reference[E]-y.mainAxis;cN&&(c=N)}if(d){var x,w;const E=g==="y"?"width":"height",R=fo.has(_e(o)),N=s.reference[m]-s.floating[E]+(R&&((x=a.offset)==null?void 0:x[m])||0)+(R?0:y.crossAxis),O=s.reference[m]+s.reference[E]+(R?0:((w=a.offset)==null?void 0:w[m])||0)-(R?y.crossAxis:0);vO&&(v=O)}return{[g]:c,[m]:v}}}},fl=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:f=()=>{},...d}=je(e,t),p=await ft(t,d),m=_e(o),g=rt(o),c=Ee(o)==="y",{width:v,height:h}=s.floating;let y,x;m==="top"||m==="bottom"?(y=m,x=g===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(x=m,y=g==="end"?"top":"bottom");const w=h-p.top-p.bottom,E=v-p.left-p.right,R=ze(h-p[y],w),N=ze(v-p[x],E),O=!t.middlewareData.shift;let j=R,$=N;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&($=E),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(j=w),O&&!g){const z=ie(p.left,0),P=ie(p.right,0),C=ie(p.top,0),T=ie(p.bottom,0);c?$=v-2*(z!==0||P!==0?z+P:ie(p.left,p.right)):j=h-2*(C!==0||T!==0?C+T:ie(p.top,p.bottom))}await f({...t,availableWidth:$,availableHeight:j});const F=await a.getDimensions(i.floating);return v!==F.width||h!==F.height?{reset:{rects:!0}}:{}}}};function Kt(){return typeof window<"u"}function nt(e){return po(e)?(e.nodeName||"").toLowerCase():"#document"}function le(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Se(e){var t;return(t=(po(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function po(e){return Kt()?e instanceof Node||e instanceof le(e).Node:!1}function ve(e){return Kt()?e instanceof Element||e instanceof le(e).Element:!1}function Te(e){return Kt()?e instanceof HTMLElement||e instanceof le(e).HTMLElement:!1}function cn(e){return!Kt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof le(e).ShadowRoot}const pl=new Set(["inline","contents"]);function gt(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=we(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!pl.has(o)}const ml=new Set(["table","td","th"]);function hl(e){return ml.has(nt(e))}const gl=[":popover-open",":modal"];function Yt(e){return gl.some(t=>{try{return e.matches(t)}catch{return!1}})}const yl=["transform","translate","scale","rotate","perspective"],vl=["transform","translate","scale","rotate","perspective","filter"],wl=["paint","layout","strict","content"];function Or(e){const t=jr(),r=ve(e)?we(e):e;return yl.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||vl.some(n=>(r.willChange||"").includes(n))||wl.some(n=>(r.contain||"").includes(n))}function xl(e){let t=Ue(e);for(;Te(t)&&!Ze(t);){if(Or(t))return t;if(Yt(t))return null;t=Ue(t)}return null}function jr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const bl=new Set(["html","body","#document"]);function Ze(e){return bl.has(nt(e))}function we(e){return le(e).getComputedStyle(e)}function qt(e){return ve(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ue(e){if(nt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||cn(e)&&e.host||Se(e);return cn(t)?t.host:t}function mo(e){const t=Ue(e);return Ze(t)?e.ownerDocument?e.ownerDocument.body:e.body:Te(t)&>(t)?t:mo(t)}function pt(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=mo(e),s=o===((n=e.ownerDocument)==null?void 0:n.body),a=le(o);if(s){const i=vr(a);return t.concat(a,a.visualViewport||[],gt(o)?o:[],i&&r?pt(i):[])}return t.concat(o,pt(o,[],r))}function vr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ho(e){const t=we(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=Te(e),s=o?e.offsetWidth:r,a=o?e.offsetHeight:n,i=Dt(r)!==s||Dt(n)!==a;return i&&(r=s,n=a),{width:r,height:n,$:i}}function _r(e){return ve(e)?e:e.contextElement}function Je(e){const t=_r(e);if(!Te(t))return Re(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:s}=ho(t);let a=(s?Dt(r.width):r.width)/n,i=(s?Dt(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const El=Re(0);function go(e){const t=le(e);return!jr()||!t.visualViewport?El:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Cl(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==le(e)?!1:t}function Ke(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),s=_r(e);let a=Re(1);t&&(n?ve(n)&&(a=Je(n)):a=Je(e));const i=Cl(s,r,n)?go(s):Re(0);let f=(o.left+i.x)/a.x,d=(o.top+i.y)/a.y,p=o.width/a.x,m=o.height/a.y;if(s){const g=le(s),c=n&&ve(n)?le(n):n;let v=g,h=vr(v);for(;h&&n&&c!==v;){const y=Je(h),x=h.getBoundingClientRect(),w=we(h),E=x.left+(h.clientLeft+parseFloat(w.paddingLeft))*y.x,R=x.top+(h.clientTop+parseFloat(w.paddingTop))*y.y;f*=y.x,d*=y.y,p*=y.x,m*=y.y,f+=E,d+=R,v=le(h),h=vr(v)}}return It({width:p,height:m,x:f,y:d})}function Dr(e,t){const r=qt(e).scrollLeft;return t?t.left+r:Ke(Se(e)).left+r}function yo(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-(r?0:Dr(e,n)),s=n.top+t.scrollTop;return{x:o,y:s}}function Rl(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const s=o==="fixed",a=Se(n),i=t?Yt(t.floating):!1;if(n===a||i&&s)return r;let f={scrollLeft:0,scrollTop:0},d=Re(1);const p=Re(0),m=Te(n);if((m||!m&&!s)&&((nt(n)!=="body"||gt(a))&&(f=qt(n)),Te(n))){const c=Ke(n);d=Je(n),p.x=c.x+n.clientLeft,p.y=c.y+n.clientTop}const g=a&&!m&&!s?yo(a,f,!0):Re(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-f.scrollLeft*d.x+p.x+g.x,y:r.y*d.y-f.scrollTop*d.y+p.y+g.y}}function Tl(e){return Array.from(e.getClientRects())}function Sl(e){const t=Se(e),r=qt(e),n=e.ownerDocument.body,o=ie(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=ie(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+Dr(e);const i=-r.scrollTop;return we(n).direction==="rtl"&&(a+=ie(t.clientWidth,n.clientWidth)-o),{width:o,height:s,x:a,y:i}}function Nl(e,t){const r=le(e),n=Se(e),o=r.visualViewport;let s=n.clientWidth,a=n.clientHeight,i=0,f=0;if(o){s=o.width,a=o.height;const d=jr();(!d||d&&t==="fixed")&&(i=o.offsetLeft,f=o.offsetTop)}return{width:s,height:a,x:i,y:f}}const Pl=new Set(["absolute","fixed"]);function Al(e,t){const r=Ke(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,s=Te(e)?Je(e):Re(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,f=o*s.x,d=n*s.y;return{width:a,height:i,x:f,y:d}}function dn(e,t,r){let n;if(t==="viewport")n=Nl(e,r);else if(t==="document")n=Sl(Se(e));else if(ve(t))n=Al(t,r);else{const o=go(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return It(n)}function vo(e,t){const r=Ue(e);return r===t||!ve(r)||Ze(r)?!1:we(r).position==="fixed"||vo(r,t)}function Ol(e,t){const r=t.get(e);if(r)return r;let n=pt(e,[],!1).filter(i=>ve(i)&&nt(i)!=="body"),o=null;const s=we(e).position==="fixed";let a=s?Ue(e):e;for(;ve(a)&&!Ze(a);){const i=we(a),f=Or(a);!f&&i.position==="fixed"&&(o=null),(s?!f&&!o:!f&&i.position==="static"&&!!o&&Pl.has(o.position)||gt(a)&&!f&&vo(e,a))?n=n.filter(p=>p!==a):o=i,a=Ue(a)}return t.set(e,n),n}function jl(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const a=[...r==="clippingAncestors"?Yt(t)?[]:Ol(t,this._c):[].concat(r),n],i=a[0],f=a.reduce((d,p)=>{const m=dn(t,p,o);return d.top=ie(m.top,d.top),d.right=ze(m.right,d.right),d.bottom=ze(m.bottom,d.bottom),d.left=ie(m.left,d.left),d},dn(t,i,o));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function _l(e){const{width:t,height:r}=ho(e);return{width:t,height:r}}function Dl(e,t,r){const n=Te(t),o=Se(t),s=r==="fixed",a=Ke(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const f=Re(0);function d(){f.x=Dr(o)}if(n||!n&&!s)if((nt(t)!=="body"||gt(o))&&(i=qt(t)),n){const c=Ke(t,!0,s,t);f.x=c.x+t.clientLeft,f.y=c.y+t.clientTop}else o&&d();s&&!n&&o&&d();const p=o&&!n&&!s?yo(o,i):Re(0),m=a.left+i.scrollLeft-f.x-p.x,g=a.top+i.scrollTop-f.y-p.y;return{x:m,y:g,width:a.width,height:a.height}}function sr(e){return we(e).position==="static"}function un(e,t){if(!Te(e)||we(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Se(e)===r&&(r=r.ownerDocument.body),r}function wo(e,t){const r=le(e);if(Yt(e))return r;if(!Te(e)){let o=Ue(e);for(;o&&!Ze(o);){if(ve(o)&&!sr(o))return o;o=Ue(o)}return r}let n=un(e,t);for(;n&&hl(n)&&sr(n);)n=un(n,t);return n&&Ze(n)&&sr(n)&&!Or(n)?r:n||xl(e)||r}const kl=async function(e){const t=this.getOffsetParent||wo,r=this.getDimensions,n=await r(e.floating);return{reference:Dl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Il(e){return we(e).direction==="rtl"}const Ll={convertOffsetParentRelativeRectToViewportRelativeRect:Rl,getDocumentElement:Se,getClippingRect:jl,getOffsetParent:wo,getElementRects:kl,getClientRects:Tl,getDimensions:_l,getScale:Je,isElement:ve,isRTL:Il};function xo(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ml(e,t){let r=null,n;const o=Se(e);function s(){var i;clearTimeout(n),(i=r)==null||i.disconnect(),r=null}function a(i,f){i===void 0&&(i=!1),f===void 0&&(f=1),s();const d=e.getBoundingClientRect(),{left:p,top:m,width:g,height:c}=d;if(i||t(),!g||!c)return;const v=St(m),h=St(o.clientWidth-(p+g)),y=St(o.clientHeight-(m+c)),x=St(p),E={rootMargin:-v+"px "+-h+"px "+-y+"px "+-x+"px",threshold:ie(0,ze(1,f))||1};let R=!0;function N(O){const j=O[0].intersectionRatio;if(j!==f){if(!R)return a();j?a(!1,j):n=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!xo(d,e.getBoundingClientRect())&&a(),R=!1}try{r=new IntersectionObserver(N,{...E,root:o.ownerDocument})}catch{r=new IntersectionObserver(N,E)}r.observe(e)}return a(!0),s}function Fl(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:f=!1}=n,d=_r(e),p=o||s?[...d?pt(d):[],...pt(t)]:[];p.forEach(x=>{o&&x.addEventListener("scroll",r,{passive:!0}),s&&x.addEventListener("resize",r)});const m=d&&i?Ml(d,r):null;let g=-1,c=null;a&&(c=new ResizeObserver(x=>{let[w]=x;w&&w.target===d&&c&&(c.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=c)==null||E.observe(t)})),r()}),d&&!f&&c.observe(d),c.observe(t));let v,h=f?Ke(e):null;f&&y();function y(){const x=Ke(e);h&&!xo(h,x)&&r(),h=x,v=requestAnimationFrame(y)}return r(),()=>{var x;p.forEach(w=>{o&&w.removeEventListener("scroll",r),s&&w.removeEventListener("resize",r)}),m?.(),(x=c)==null||x.disconnect(),c=null,f&&cancelAnimationFrame(v)}}const $l=cl,zl=dl,Ul=al,Hl=fl,Bl=il,fn=sl,Wl=ul,Vl=(e,t,r)=>{const n=new Map,o={platform:Ll,...r},s={...o.platform,_c:n};return ol(e,t,{...o,platform:s})};var Kl=typeof document<"u",Yl=function(){},Ot=Kl?u.useLayoutEffect:Yl;function Lt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Lt(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const s=o[n];if(!(s==="_owner"&&e.$$typeof)&&!Lt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function bo(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pn(e,t){const r=bo(e);return Math.round(t*r)/r}function ar(e){const t=u.useRef(e);return Ot(()=>{t.current=e}),t}function ql(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:f,open:d}=e,[p,m]=u.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[g,c]=u.useState(n);Lt(g,n)||c(n);const[v,h]=u.useState(null),[y,x]=u.useState(null),w=u.useCallback(D=>{D!==O.current&&(O.current=D,h(D))},[]),E=u.useCallback(D=>{D!==j.current&&(j.current=D,x(D))},[]),R=s||v,N=a||y,O=u.useRef(null),j=u.useRef(null),$=u.useRef(p),F=f!=null,z=ar(f),P=ar(o),C=ar(d),T=u.useCallback(()=>{if(!O.current||!j.current)return;const D={placement:t,strategy:r,middleware:g};P.current&&(D.platform=P.current),Vl(O.current,j.current,D).then(A=>{const B={...A,isPositioned:C.current!==!1};b.current&&!Lt($.current,B)&&($.current=B,$t.flushSync(()=>{m(B)}))})},[g,t,r,P,C]);Ot(()=>{d===!1&&$.current.isPositioned&&($.current.isPositioned=!1,m(D=>({...D,isPositioned:!1})))},[d]);const b=u.useRef(!1);Ot(()=>(b.current=!0,()=>{b.current=!1}),[]),Ot(()=>{if(R&&(O.current=R),N&&(j.current=N),R&&N){if(z.current)return z.current(R,N,T);T()}},[R,N,T,z,F]);const k=u.useMemo(()=>({reference:O,floating:j,setReference:w,setFloating:E}),[w,E]),_=u.useMemo(()=>({reference:R,floating:N}),[R,N]),M=u.useMemo(()=>{const D={position:r,left:0,top:0};if(!_.floating)return D;const A=pn(_.floating,p.x),B=pn(_.floating,p.y);return i?{...D,transform:"translate("+A+"px, "+B+"px)",...bo(_.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:A,top:B}},[r,i,_.floating,p.x,p.y]);return u.useMemo(()=>({...p,update:T,refs:k,elements:_,floatingStyles:M}),[p,T,k,_,M])}const Gl=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:o}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?fn({element:n.current,padding:o}).fn(r):{}:n?fn({element:n,padding:o}).fn(r):{}}}},Xl=(e,t)=>({...$l(e),options:[e,t]}),Ql=(e,t)=>({...zl(e),options:[e,t]}),Jl=(e,t)=>({...Wl(e),options:[e,t]}),Zl=(e,t)=>({...Ul(e),options:[e,t]}),ec=(e,t)=>({...Hl(e),options:[e,t]}),tc=(e,t)=>({...Bl(e),options:[e,t]}),rc=(e,t)=>({...Gl(e),options:[e,t]});var nc="Arrow",Eo=u.forwardRef((e,t)=>{const{children:r,width:n=10,height:o=5,...s}=e;return l.jsx(oe.svg,{...s,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});Eo.displayName=nc;var oc=Eo;function sc(e){const[t,r]=u.useState(void 0);return Oe(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,i;if("borderBoxSize"in s){const f=s.borderBoxSize,d=Array.isArray(f)?f[0]:f;a=d.inlineSize,i=d.blockSize}else a=e.offsetWidth,i=e.offsetHeight;r({width:a,height:i})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var kr="Popper",[Co,Ro]=Ht(kr),[ac,To]=Co(kr),So=e=>{const{__scopePopper:t,children:r}=e,[n,o]=u.useState(null);return l.jsx(ac,{scope:t,anchor:n,onAnchorChange:o,children:r})};So.displayName=kr;var No="PopperAnchor",Po=u.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...o}=e,s=To(No,r),a=u.useRef(null),i=ye(t,a);return u.useEffect(()=>{s.onAnchorChange(n?.current||a.current)}),n?null:l.jsx(oe.div,{...o,ref:i})});Po.displayName=No;var Ir="PopperContent",[ic,lc]=Co(Ir),Ao=u.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:f=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:c="optimized",onPlaced:v,...h}=e,y=To(Ir,r),[x,w]=u.useState(null),E=ye(t,Y=>w(Y)),[R,N]=u.useState(null),O=sc(R),j=O?.width??0,$=O?.height??0,F=n+(s!=="center"?"-"+s:""),z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},P=Array.isArray(d)?d:[d],C=P.length>0,T={padding:z,boundary:P.filter(dc),altBoundary:C},{refs:b,floatingStyles:k,placement:_,isPositioned:M,middlewareData:D}=ql({strategy:"fixed",placement:F,whileElementsMounted:(...Y)=>Fl(...Y,{animationFrame:c==="always"}),elements:{reference:y.anchor},middleware:[Xl({mainAxis:o+$,alignmentAxis:a}),f&&Ql({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Jl():void 0,...T}),f&&Zl({...T}),ec({...T,apply:({elements:Y,rects:De,availableWidth:xe,availableHeight:be})=>{const{width:He,height:st}=De.reference,Be=Y.floating.style;Be.setProperty("--radix-popper-available-width",`${xe}px`),Be.setProperty("--radix-popper-available-height",`${be}px`),Be.setProperty("--radix-popper-anchor-width",`${He}px`),Be.setProperty("--radix-popper-anchor-height",`${st}px`)}}),R&&rc({element:R,padding:i}),uc({arrowWidth:j,arrowHeight:$}),g&&tc({strategy:"referenceHidden",...T})]}),[A,B]=_o(_),q=$e(v);Oe(()=>{M&&q?.()},[M,q]);const W=D.arrow?.x,V=D.arrow?.y,I=D.arrow?.centerOffset!==0,[K,ce]=u.useState();return Oe(()=>{x&&ce(window.getComputedStyle(x).zIndex)},[x]),l.jsx("div",{ref:b.setFloating,"data-radix-popper-content-wrapper":"",style:{...k,transform:M?k.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:K,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(ic,{scope:r,placedSide:A,onArrowChange:N,arrowX:W,arrowY:V,shouldHideArrow:I,children:l.jsx(oe.div,{"data-side":A,"data-align":B,...h,ref:E,style:{...h.style,animation:M?void 0:"none"}})})})});Ao.displayName=Ir;var Oo="PopperArrow",cc={top:"bottom",right:"left",bottom:"top",left:"right"},jo=u.forwardRef(function(t,r){const{__scopePopper:n,...o}=t,s=lc(Oo,n),a=cc[s.placedSide];return l.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:l.jsx(oc,{...o,ref:r,style:{...o.style,display:"block"}})})});jo.displayName=Oo;function dc(e){return e!==null}var uc=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,i=a?0:e.arrowWidth,f=a?0:e.arrowHeight,[d,p]=_o(r),m={start:"0%",center:"50%",end:"100%"}[p],g=(o.arrow?.x??0)+i/2,c=(o.arrow?.y??0)+f/2;let v="",h="";return d==="bottom"?(v=a?m:`${g}px`,h=`${-f}px`):d==="top"?(v=a?m:`${g}px`,h=`${n.floating.height+f}px`):d==="right"?(v=`${-f}px`,h=a?m:`${c}px`):d==="left"&&(v=`${n.floating.width+f}px`,h=a?m:`${c}px`),{data:{x:v,y:h}}}});function _o(e){const[t,r="center"]=e.split("-");return[t,r]}var fc=So,pc=Po,mc=Ao,hc=jo,[Gt,Td]=Ht("Tooltip",[Ro]),Xt=Ro(),Do="TooltipProvider",gc=700,wr="tooltip.open",[yc,Lr]=Gt(Do),ko=e=>{const{__scopeTooltip:t,delayDuration:r=gc,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:s}=e,a=u.useRef(!0),i=u.useRef(!1),f=u.useRef(0);return u.useEffect(()=>{const d=f.current;return()=>window.clearTimeout(d)},[]),l.jsx(yc,{scope:t,isOpenDelayedRef:a,delayDuration:r,onOpen:u.useCallback(()=>{window.clearTimeout(f.current),a.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>a.current=!0,n)},[n]),isPointerInTransitRef:i,onPointerInTransitChange:u.useCallback(d=>{i.current=d},[]),disableHoverableContent:o,children:s})};ko.displayName=Do;var mt="Tooltip",[vc,Qt]=Gt(mt),Io=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:o,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,f=Lr(mt,e.__scopeTooltip),d=Xt(t),[p,m]=u.useState(null),g=Ki(),c=u.useRef(0),v=a??f.disableHoverableContent,h=i??f.delayDuration,y=u.useRef(!1),[x,w]=An({prop:n,defaultProp:o??!1,onChange:j=>{j?(f.onOpen(),document.dispatchEvent(new CustomEvent(wr))):f.onClose(),s?.(j)},caller:mt}),E=u.useMemo(()=>x?y.current?"delayed-open":"instant-open":"closed",[x]),R=u.useCallback(()=>{window.clearTimeout(c.current),c.current=0,y.current=!1,w(!0)},[w]),N=u.useCallback(()=>{window.clearTimeout(c.current),c.current=0,w(!1)},[w]),O=u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>{y.current=!0,w(!0),c.current=0},h)},[h,w]);return u.useEffect(()=>()=>{c.current&&(window.clearTimeout(c.current),c.current=0)},[]),l.jsx(fc,{...d,children:l.jsx(vc,{scope:t,contentId:g,open:x,stateAttribute:E,trigger:p,onTriggerChange:m,onTriggerEnter:u.useCallback(()=>{f.isOpenDelayedRef.current?O():R()},[f.isOpenDelayedRef,O,R]),onTriggerLeave:u.useCallback(()=>{v?N():(window.clearTimeout(c.current),c.current=0)},[N,v]),onOpen:R,onClose:N,disableHoverableContent:v,children:r})})};Io.displayName=mt;var xr="TooltipTrigger",Lo=u.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,o=Qt(xr,r),s=Lr(xr,r),a=Xt(r),i=u.useRef(null),f=ye(t,i,o.onTriggerChange),d=u.useRef(!1),p=u.useRef(!1),m=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),l.jsx(pc,{asChild:!0,...a,children:l.jsx(oe.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:f,onPointerMove:te(e.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:te(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:te(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:te(e.onBlur,o.onClose),onClick:te(e.onClick,o.onClose)})})});Lo.displayName=xr;var wc="TooltipPortal",[Sd,xc]=Gt(wc,{forceMount:void 0}),et="TooltipContent",Mo=u.forwardRef((e,t)=>{const r=xc(et,e.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...s}=e,a=Qt(et,e.__scopeTooltip);return l.jsx(Er,{present:n||a.open,children:a.disableHoverableContent?l.jsx(Fo,{side:o,...s,ref:t}):l.jsx(bc,{side:o,...s,ref:t})})}),bc=u.forwardRef((e,t)=>{const r=Qt(et,e.__scopeTooltip),n=Lr(et,e.__scopeTooltip),o=u.useRef(null),s=ye(t,o),[a,i]=u.useState(null),{trigger:f,onClose:d}=r,p=o.current,{onPointerInTransitChange:m}=n,g=u.useCallback(()=>{i(null),m(!1)},[m]),c=u.useCallback((v,h)=>{const y=v.currentTarget,x={x:v.clientX,y:v.clientY},w=Sc(x,y.getBoundingClientRect()),E=Nc(x,w),R=Pc(h.getBoundingClientRect()),N=Oc([...E,...R]);i(N),m(!0)},[m]);return u.useEffect(()=>()=>g(),[g]),u.useEffect(()=>{if(f&&p){const v=y=>c(y,p),h=y=>c(y,f);return f.addEventListener("pointerleave",v),p.addEventListener("pointerleave",h),()=>{f.removeEventListener("pointerleave",v),p.removeEventListener("pointerleave",h)}}},[f,p,c,g]),u.useEffect(()=>{if(a){const v=h=>{const y=h.target,x={x:h.clientX,y:h.clientY},w=f?.contains(y)||p?.contains(y),E=!Ac(x,a);w?g():E&&(g(),d())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[f,p,a,d,g]),l.jsx(Fo,{...e,ref:s})}),[Ec,Cc]=Gt(mt,{isInside:!1}),Rc=Os("TooltipContent"),Fo=u.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,f=Qt(et,r),d=Xt(r),{onClose:p}=f;return u.useEffect(()=>(document.addEventListener(wr,p),()=>document.removeEventListener(wr,p)),[p]),u.useEffect(()=>{if(f.trigger){const m=g=>{g.target?.contains(f.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[f.trigger,p]),l.jsx(br,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:l.jsxs(mc,{"data-state":f.stateAttribute,...d,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(Rc,{children:n}),l.jsx(Ec,{scope:r,isInside:!0,children:l.jsx(ea,{id:f.contentId,role:"tooltip",children:o||n})})]})})});Mo.displayName=et;var $o="TooltipArrow",Tc=u.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,o=Xt(r);return Cc($o,r).isInside?null:l.jsx(hc,{...o,...n,ref:t})});Tc.displayName=$o;function Sc(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,o,s)){case s:return"left";case o:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function Nc(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function Pc(e){const{top:t,right:r,bottom:n,left:o}=e;return[{x:o,y:t},{x:r,y:t},{x:r,y:n},{x:o,y:n}]}function Ac(e,t){const{x:r,y:n}=e;let o=!1;for(let s=0,a=t.length-1;sn!=g>n&&r<(m-d)*(n-p)/(g-p)+d&&(o=!o)}return o}function Oc(e){const t=e.slice();return t.sort((r,n)=>r.xn.x?1:r.yn.y?1:0),jc(t)}function jc(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const o=e[n];for(;r.length>=2;){const s=r[r.length-1],a=r[r.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))r.pop();else break}r.push(o)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var _c=ko,Dc=Io,kc=Lo,zo=Mo;const Ic=_c,Nd=Dc,Pd=kc,Lc=u.forwardRef(({className:e,sideOffset:t=4,...r},n)=>l.jsx(zo,{ref:n,sideOffset:t,className:Z("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));Lc.displayName=zo.displayName;const Mc="https://ahqauomkgflopxgnlndd.supabase.co",Fc="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFocWF1b21rZ2Zsb3B4Z25sbmRkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQwMTA2NjcsImV4cCI6MjA3OTU4NjY2N30.WGZoTjcJMSDxG5ss1Oe4T0bSBzhsiijfj-I3DnviWGU";async function $c(e,t,r){return await r()}function zc(){return ps(Mc,Fc,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0,lock:$c}})}const ee=zc();function Uc(){const e=zt(),t=Ut(),[r,n]=u.useState(null);return u.useEffect(()=>{(async()=>{try{const a=new URLSearchParams(t.search).get("code");if(a){const{error:p}=await ee.auth.exchangeCodeForSession(a);if(p){console.error("Error exchanging code for session:",p),n(p.message);return}}const i=new URLSearchParams(t.hash.slice(1)),f=i.get("access_token"),d=i.get("type");if(f&&d==="recovery"){const{data:{session:p}}=await ee.auth.getSession();if(!p){n("Failed to establish session from recovery link");return}}e("/auth"+t.hash,{replace:!0})}catch(s){console.error("Error in recovery flow:",s),n("An unexpected error occurred")}})()},[t,e]),r?l.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-light/10 to-accent/30 flex items-center justify-center p-4",children:l.jsxs("div",{className:"text-center space-y-4",children:[l.jsx("h1",{className:"text-2xl font-bold text-destructive",children:"Password Reset Error"}),l.jsx("p",{className:"text-muted-foreground",children:r}),l.jsx("button",{onClick:()=>e("/auth"),className:"text-primary underline",children:"Return to login"})]})}):l.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-light/10 to-accent/30 flex items-center justify-center",children:l.jsxs("div",{className:"text-center space-y-4",children:[l.jsx(At,{className:"h-8 w-8 animate-spin text-primary mx-auto"}),l.jsx("p",{className:"text-muted-foreground",children:"Processing password reset..."})]})})}const Hc={user:null,isLoading:!1,error:null,login:async()=>{throw new Error("AuthenticationProvider not initialized")},logout:async()=>{throw new Error("AuthenticationProvider not initialized")},resetAuth:async()=>{throw new Error("AuthenticationProvider not initialized")},refreshUserData:async()=>{throw new Error("AuthenticationProvider not initialized")},userRole:null,tenantId:null,isAdmin:!1,loading:!1,signOut:async()=>{throw new Error("AuthenticationProvider not initialized")},signIn:async()=>{throw new Error("AuthenticationProvider not initialized")},signUp:async()=>{throw new Error("AuthenticationProvider not initialized")},resetPassword:async()=>{throw new Error("AuthenticationProvider not initialized")},isPasswordRecovery:!1,clearPasswordRecovery:()=>{}},Uo=u.createContext(Hc);function ot(){const e=u.useContext(Uo);if(!e)throw new Error("useAuth must be used within AuthenticationProvider");return e}var ne=(e=>(e.AUTHENTICATION="authentication",e.ROLE_DETECTION="role_detection",e.ROUTING="routing",e.QUERY_DEDUPLICATION="query_deduplication",e.CIRCUIT_BREAKER="circuit_breaker",e.CACHE="cache",e.SESSION="session",e))(ne||{});class Bc{constructor(){re(this,"isDevelopment",!1);re(this,"logHistory",[]);re(this,"MAX_HISTORY",100)}logAuth(t,r,n){this.log("info","authentication",t,r,n)}logRoleDetection(t,r,n){this.log("info","role_detection",t,r,n)}logRouting(t,r,n){this.log("info","routing",t,r,n)}logQueryDedup(t,r){this.log("debug","query_deduplication",t,r)}logCircuitBreaker(t,r){this.log("warn","circuit_breaker",t,r)}logCache(t,r){this.log("debug","cache",t,r)}logSession(t,r,n){this.log("info","session",t,r,n)}logError(t,r,n,o){const s={...o,error:n?{message:n.message,name:n.name,stack:n.stack}:void 0};this.log("error",t,r,s)}log(t,r,n,o,s){const a={timestamp:new Date().toISOString(),level:t,category:r,message:n,data:o,userId:s};this.logHistory.push(a),this.logHistory.length>this.MAX_HISTORY&&this.logHistory.shift(),this.isDevelopment?this.logToConsole(a):this.logStructured(a)}logToConsole(t){const r=`[${t.category}]`,n=t.userId?`[user:${t.userId}]`:"",o=`${r}${n} ${t.message}`;switch(t.level){case"debug":console.debug(o,t.data||"");break;case"info":console.log(o,t.data||"");break;case"warn":console.warn(o,t.data||"");break;case"error":console.error(o,t.data||"");break}}logStructured(t){const r={"@timestamp":t.timestamp,level:t.level,category:t.category,message:t.message,userId:t.userId,...t.data};(t.level==="warn"||t.level==="error")&&console.log(JSON.stringify(r))}getHistory(){return[...this.logHistory]}getHistoryByCategory(t){return this.logHistory.filter(r=>r.category===t)}getHistoryByUser(t){return this.logHistory.filter(r=>r.userId===t)}clearHistory(){this.logHistory=[]}exportLogs(){return JSON.stringify(this.logHistory,null,2)}}const L=new Bc;class dt{constructor(){re(this,"memoryCache",new Map);re(this,"STORAGE_PREFIX","auth_cache_");re(this,"DEFAULT_TTL",36e5)}set(t,r,n){const o={value:r,timestamp:Date.now(),ttl:n??this.DEFAULT_TTL};this.memoryCache.set(t,o),L.logCache("Cache set",{key:t,ttl:o.ttl,memoryCacheSize:this.memoryCache.size});try{sessionStorage.setItem(this.getStorageKey(t),JSON.stringify(o))}catch(s){L.logError(ne.CACHE,"Failed to sync to sessionStorage",s,{key:t})}}get(t){let r=this.memoryCache.get(t),n="memory";if(r||(r=this.loadFromStorage(t),r&&(this.memoryCache.set(t,r),n="sessionStorage")),!r)return L.logCache("Cache miss",{key:t}),null;const o=Date.now()-r.timestamp;return o>r.ttl?(L.logCache("Cache expired",{key:t,age:o,ttl:r.ttl}),this.delete(t),null):(L.logCache("Cache hit",{key:t,source:n,age:o}),r.value)}has(t){return this.get(t)!==null}delete(t){this.memoryCache.delete(t),L.logCache("Cache delete",{key:t});try{sessionStorage.removeItem(this.getStorageKey(t))}catch(r){L.logError(ne.CACHE,"Failed to remove from sessionStorage",r,{key:t})}}clear(){const t=this.memoryCache.size;this.memoryCache.clear(),L.logCache("Cache cleared",{clearedItems:t});try{const r=[];for(let n=0;nsessionStorage.removeItem(n))}catch(r){L.logError(ne.CACHE,"Failed to clear sessionStorage",r)}}getStats(){return{memoryCacheSize:this.memoryCache.size,keys:Array.from(this.memoryCache.keys())}}loadFromStorage(t){try{const r=sessionStorage.getItem(this.getStorageKey(t));if(!r)return null;const n=JSON.parse(r);return!n||typeof n.timestamp!="number"||typeof n.ttl!="number"?(L.logError(ne.CACHE,"Invalid cache entry structure",void 0,{key:t}),null):n}catch(r){return L.logError(ne.CACHE,"Failed to load from sessionStorage",r,{key:t}),null}}getStorageKey(t){return`${this.STORAGE_PREFIX}${t}`}static userKey(t){return`user:${t}`}static roleKey(t){return`role:${t}`}static permissionsKey(t){return`permissions:${t}`}static profileKey(t){return`profile:${t}`}static clinicianKey(t){return`clinician:${t}`}}const ae=new dt;class Wc{constructor(){re(this,"pending",new Map);re(this,"CLEANUP_DELAY",100)}async deduplicate(t,r){const n=this.pending.get(t);if(n)return L.logQueryDedup("Query deduplicated - using existing request",{key:t,queuedRequests:n.resolvers.length+1,age:Date.now()-n.timestamp}),new Promise((a,i)=>{n.resolvers.push(a),n.rejectors.push(i)});L.logQueryDedup("Executing new query",{key:t,pendingCount:this.pending.size});const o=r(),s={promise:o,resolvers:[],rejectors:[],timestamp:Date.now()};this.pending.set(t,s);try{const a=await o,i=Date.now()-s.timestamp;return L.logQueryDedup("Query completed successfully",{key:t,duration:i,queuedRequests:s.resolvers.length}),s.resolvers.forEach(f=>f(a)),a}catch(a){const i=Date.now()-s.timestamp;L.logError(ne.QUERY_DEDUPLICATION,"Query failed",a,{key:t,duration:i,queuedRequests:s.rejectors.length});const f=a instanceof Error?a:new Error(String(a));throw s.rejectors.forEach(d=>d(f)),a}finally{setTimeout(()=>{this.pending.delete(t),L.logQueryDedup("Query cleaned up from registry",{key:t})},this.CLEANUP_DELAY)}}clear(t){this.pending.delete(t)}clearAll(){this.pending.clear()}getPendingCount(){return this.pending.size}isPending(t){return this.pending.has(t)}getPendingKeys(){return Array.from(this.pending.keys())}}const ir=new Wc;class Vc{constructor(){re(this,"CACHE_TTL",36e5)}async detectUserRole(t){const r=this.getCachedRole(t);if(r)return L.logRoleDetection("Using cached role",{role:r.role,isClinician:r.isClinician,isAdmin:r.isAdmin},t),r;L.logRoleDetection("Starting role detection",{},t);const n=await this.fetchUserRoleData(t);return ae.set(dt.roleKey(t),n,this.CACHE_TTL),L.logRoleDetection("Role detection complete",{role:n.role,isClinician:n.isClinician,isAdmin:n.isAdmin,cached:!0},t),n}getCachedRole(t){return ae.get(dt.roleKey(t))}invalidateCache(t){ae.delete(dt.roleKey(t)),ae.delete(dt.profileKey(t)),ae.delete(`staff:${t}`),ae.delete(`tenantMembership:${t}`),L.logRoleDetection("Cache invalidated",{},t)}async fetchUserRoleData(t){const r=Date.now();L.logRoleDetection("Fetching role data from database",{},t);const n=await ir.deduplicate(`profile:${t}`,()=>this.fetchProfile(t));if(!n)return L.logError(ne.ROLE_DETECTION,"Profile not found - user needs to complete signup",void 0,{userId:t}),{userId:t,role:"staff",isStaff:!1,isClient:!1,isClinician:!1,isAdmin:!1,permissions:{profile_id:t,tenant_id:""},tenantId:"",profile:null,signupIncomplete:!0};L.logRoleDetection("Profile fetched",{profileId:n.id},t);const o=await ir.deduplicate(`tenantMembership:${t}`,()=>this.fetchTenantMembership(t));if(!o)throw L.logError(ne.ROLE_DETECTION,"Tenant membership not found",void 0,{userId:t}),new Error("User is not associated with any tenant");const s=o.tenant_id;L.logRoleDetection("Tenant membership fetched",{tenantId:s},t);const{data:a,error:i}=await ee.from("user_roles").select("role").eq("user_id",t);if(i)throw L.logError(ne.ROLE_DETECTION,"Failed to fetch roles",i,{userId:t}),i;const f=a?.map(w=>w.role)||[],d=f.includes("admin"),p=f.includes("staff")||d,m=f.includes("client");L.logRoleDetection("Roles fetched",{roles:f,isAdmin:d,isStaff:p,isClient:m},t);let g=null,c=!1,v=[];if(p||d)if(g=await ir.deduplicate(`staff:${t}`,()=>this.fetchStaffData(t,s)),g){const{data:w}=await ee.from("staff_role_assignments").select("staff_role_id, staff_roles!inner(is_clinical, code)").eq("staff_id",g.id),E=w;c=E?.some(R=>R.staff_roles?.is_clinical)||!1,v=E?.map(R=>R.staff_roles?.code).filter(Boolean)||[],L.logRoleDetection("Staff data fetched",{staffId:g.id,provStatus:g.prov_status,isClinician:c,staffRoleCodes:v},t)}else L.logRoleDetection("No staff record found",{},t);const h={profile_id:t,tenant_id:s,access_appointments:p||d,access_calendar:p||d,access_customers:p||d,access_forms:p||d,access_services:p||d,access_settings:d,access_user_management:d,supervisor:d};L.logRoleDetection("Permissions derived from roles",{isAdmin:d,isStaff:p},t);const y={userId:t,role:p?"staff":"client",isStaff:p,isClient:m,isClinician:c,isAdmin:d,permissions:h,tenantId:s,profile:n,staffData:g||void 0,staffRoleCodes:v.length>0?v:void 0},x=Date.now()-r;return L.logRoleDetection("Role detection complete",{role:y.role,isClinician:c,isAdmin:d,duration:x},t),y}async fetchProfile(t){const{data:r,error:n}=await ee.from("profiles").select("*").eq("id",t).single();return n?(L.logError(ne.ROLE_DETECTION,"Failed to fetch profile",n,{userId:t}),null):r}async fetchTenantMembership(t){const{data:r,error:n}=await ee.from("tenant_memberships").select("tenant_id, tenant_role").eq("profile_id",t).maybeSingle();return n?(L.logError(ne.ROLE_DETECTION,"Failed to fetch tenant membership",n,{userId:t}),null):r}async fetchStaffData(t,r){const{data:n,error:o}=await ee.from("staff").select("*").eq("profile_id",t).eq("tenant_id",r).maybeSingle();return o?(L.logError(ne.ROLE_DETECTION,"Failed to fetch staff data",o,{userId:t,tenantId:r}),null):n}}const ct=new Vc;var ge=(e=>(e.NETWORK_ERROR="NETWORK_ERROR",e.AUTHENTICATION_FAILED="AUTHENTICATION_FAILED",e.ROLE_DETECTION_FAILED="ROLE_DETECTION_FAILED",e.CIRCUIT_BREAKER_OPEN="CIRCUIT_BREAKER_OPEN",e.REDIRECT_LOOP_DETECTED="REDIRECT_LOOP_DETECTED",e.PERMISSION_DENIED="PERMISSION_DENIED",e.DATA_FETCH_FAILED="DATA_FETCH_FAILED",e.SESSION_EXPIRED="SESSION_EXPIRED",e.UNKNOWN_ERROR="UNKNOWN_ERROR",e))(ge||{});class J extends Error{constructor(r,n,o,s=!0,a){super(n);re(this,"type");re(this,"recoverable");re(this,"userMessage");re(this,"technicalDetails");this.name="AuthError",this.type=r,this.recoverable=s,this.userMessage=o,this.technicalDetails=a,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,J)}static fromError(r,n){if(r instanceof J)return r;if(r instanceof Error){const o=n||J.detectErrorType(r),s=J.getUserMessage(o,r);return new J(o,r.message,s,!0,{originalError:r})}return new J("UNKNOWN_ERROR","An unknown error occurred","Something went wrong. Please try again.",!0,{originalError:r})}static detectErrorType(r){const n=r.message.toLowerCase();return n.includes("network")||n.includes("fetch")?"NETWORK_ERROR":n.includes("circuit breaker")?"CIRCUIT_BREAKER_OPEN":n.includes("invalid")||n.includes("credentials")?"AUTHENTICATION_FAILED":n.includes("role")||n.includes("profile")?"ROLE_DETECTION_FAILED":n.includes("permission")||n.includes("access denied")?"PERMISSION_DENIED":n.includes("session")||n.includes("expired")?"SESSION_EXPIRED":"UNKNOWN_ERROR"}static getUserMessage(r,n){switch(r){case"NETWORK_ERROR":return"Network connection issue. Please check your internet connection and try again.";case"AUTHENTICATION_FAILED":return"Invalid email or password. Please check your credentials and try again.";case"ROLE_DETECTION_FAILED":return"Unable to determine your account type. Please contact support if this persists.";case"CIRCUIT_BREAKER_OPEN":return"The system is experiencing issues. Please wait a moment and try again.";case"REDIRECT_LOOP_DETECTED":return"Navigation error detected. Please refresh the page or contact support.";case"PERMISSION_DENIED":return"You do not have permission to access this resource.";case"DATA_FETCH_FAILED":return"Failed to load your account data. Please try again.";case"SESSION_EXPIRED":return"Your session has expired. Please log in again.";case"UNKNOWN_ERROR":default:return n?.message||"An unexpected error occurred. Please try again."}}isRecoverable(){return this.recoverable}shouldRetry(){return this.type==="NETWORK_ERROR"||this.type==="DATA_FETCH_FAILED"}getRetryDelay(r){return Math.min(1e3*Math.pow(2,r-1),4e3)}}function Kc({children:e}){console.log("πŸ—οΈ [AuthenticationProvider] Provider mounted/rendered");const t=ms(),[r,n]=u.useState(null),[o,s]=u.useState(!0),[a,i]=u.useState(null),[f,d]=u.useState(!1),[p,m]=u.useState(!1),g=u.useRef(null),c=u.useRef(null),v=u.useCallback(()=>{m(!1)},[]),h=u.useCallback(async(P,C)=>{console.debug("[AuthenticationProvider] Loading user data",{userId:P,email:C});try{const T=await ct.detectUserRole(P);let b;T.isStaff&&(b={is_clinician:T.isClinician,is_admin:T.isAdmin,prov_status:T.staffData?.prov_status,staffData:T.staffData,staffRoleCodes:T.staffRoleCodes});const k={id:P,email:C,profile:T.profile,role:T.role,staffAttributes:b,permissions:T.permissions,roleContext:T,user_metadata:{full_name:T.staffData?`${T.staffData.prov_name_f||""} ${T.staffData.prov_name_l||""}`.trim():"",first_name:T.staffData?.prov_name_f||null,last_name:T.staffData?.prov_name_l||null}};if(ae.set(`user:${P}`,k,36e5),!T.tenantId&&!T.signupIncomplete)throw new Error("User loaded but tenantId is missing - this indicates a profile or data integrity issue");n(k),c.current=k.id,i(null),console.log("βœ… [AuthenticationProvider] User data loaded successfully",{userId:P,email:C,role:k.role,tenantId:T.tenantId,isClinician:b?.is_clinician,isAdmin:b?.is_admin,hasProfile:!!T.profile,staffName:T.staffData?`${T.staffData.prov_name_f} ${T.staffData.prov_name_l}`:null})}catch(T){const b=J.fromError(T,ge.DATA_FETCH_FAILED);throw console.error("❌ [AuthenticationProvider] Failed to load user data",{userId:P,email:C,error:b.message,type:b.type,userMessage:b.userMessage,stack:T instanceof Error?T.stack:void 0}),i(b),b}},[]),y=u.useCallback(async(P,C)=>{console.debug("[AuthenticationProvider] Login initiated",{email:P}),s(!0),i(null);try{const{data:T,error:b}=await ee.auth.signInWithPassword({email:P,password:C});if(b)throw new J(ge.AUTHENTICATION_FAILED,b.message,"Invalid email or password. Please check your credentials and try again.",!1,{originalError:b});if(!T.user)throw new J(ge.AUTHENTICATION_FAILED,"Authentication succeeded but no user data returned","Login failed. Please try again.",!0);ct.invalidateCache(T.user.id),ae.delete(`user:${T.user.id}`),await h(T.user.id,T.user.email||P),console.debug("[AuthenticationProvider] Login completed successfully")}catch(T){const b=J.fromError(T);throw console.error("[AuthenticationProvider] Login failed",{error:b.message,type:b.type,userMessage:b.userMessage}),i(b),n(null),b}finally{s(!1)}},[h]),x=u.useCallback(async()=>{console.debug("[AuthenticationProvider] Logout initiated"),s(!0);try{const{error:P}=await ee.auth.signOut();P&&console.error("[AuthenticationProvider] Supabase sign out error",P),n(null),i(null),ae.clear(),r&&ct.invalidateCache(r.id),console.debug("[AuthenticationProvider] Logout completed")}catch(P){const C=J.fromError(P);console.error("[AuthenticationProvider] Logout error",{error:C.message,type:C.type,userMessage:C.userMessage}),n(null),i(null),ae.clear()}finally{s(!1)}},[r]),w=u.useCallback(async()=>{console.debug("[AuthenticationProvider] Reset authentication initiated"),s(!0),i(null);try{ae.clear(),r&&ct.invalidateCache(r.id);const{data:{session:P},error:C}=await ee.auth.getSession();if(C)throw new J(ge.SESSION_EXPIRED,C.message,"Failed to retrieve session. Please log in again.",!0,{originalError:C});P?.user?(await h(P.user.id,P.user.email||""),console.debug("[AuthenticationProvider] Reset and reload completed")):(n(null),console.debug("[AuthenticationProvider] Reset completed, no session found"))}catch(P){const C=J.fromError(P);throw console.error("[AuthenticationProvider] Reset error",{error:C.message,type:C.type,userMessage:C.userMessage}),i(C),C}finally{s(!1)}},[r,h]),E=u.useCallback(async()=>{if(console.debug("[AuthenticationProvider] Refresh user data initiated"),!r){console.warn("[AuthenticationProvider] Cannot refresh, no user logged in");return}s(!0),i(null);try{ct.invalidateCache(r.id),ae.delete(`user:${r.id}`),await h(r.id,r.email),console.debug("[AuthenticationProvider] Refresh completed")}catch(P){const C=J.fromError(P,ge.DATA_FETCH_FAILED);throw console.error("[AuthenticationProvider] Refresh error",{error:C.message,type:C.type,userMessage:C.userMessage}),i(C),C}finally{s(!1)}},[r,h]);u.useEffect(()=>{let P=!0;return(async()=>{console.log("[AuthenticationProvider] Initializing session");try{console.log("[AuthenticationProvider] Starting session initialization");const T=Date.now(),b=ee.auth.getSession(),k=new Promise((D,A)=>{g.current=setTimeout(()=>{console.error("[AuthenticationProvider] SAFETY TIMEOUT: Session initialization exceeded 8s"),A(new Error("Session initialization timeout after 8 seconds"))},8e3)}),{data:{session:_},error:M}=await Promise.race([b,k]);if(g.current&&(clearTimeout(g.current),g.current=null),console.log("[AuthenticationProvider] Session initialization completed",{duration:Date.now()-T,hasSession:!!_}),M)throw console.error("[AuthenticationProvider] Session error",M),M;if(_?.user&&P){console.log("[AuthenticationProvider] Session found, loading user data",{userId:_.user.id}),t.invalidateQueries({queryKey:["customers"]});const D=ae.get(`user:${_.user.id}`);if(D){console.log("[AuthenticationProvider] Using cached user data"),n(D),s(!1),d(!0);return}await h(_.user.id,_.user.email||"")}else console.log("[AuthenticationProvider] No session found")}catch(T){const b=J.fromError(T,ge.SESSION_EXPIRED);console.error("[AuthenticationProvider] Session initialization error",{error:b.message,type:b.type,userMessage:b.userMessage,diagnosis:"This may be caused by network issues or lock timeout. Refresh the page to retry."}),i(b)}finally{P&&(s(!1),d(!0))}})(),()=>{P=!1,g.current&&(clearTimeout(g.current),g.current=null)}},[h]),u.useEffect(()=>{console.debug("[AuthenticationProvider] Setting up auth state listener");let P=null;const{data:{subscription:C}}=ee.auth.onAuthStateChange(async(T,b)=>{console.debug("[AuthenticationProvider] Auth state changed",{event:T,userId:b?.user?.id});try{switch(T){case"PASSWORD_RECOVERY":console.log("[AuthenticationProvider] PASSWORD_RECOVERY event received"),m(!0),s(!1);return;case"SIGNED_IN":if(b?.user){if(c.current===b.user.id){console.debug("[AuthenticationProvider] SIGNED_IN skipped β€” already loaded (token refresh)");return}if(P===b.user.id){console.warn("[AuthenticationProvider] Skipping loadUserData - previously failed for this user");return}console.debug("[AuthenticationProvider] User signed in, loading data"),s(!0);try{await h(b.user.id,b.user.email||""),P=null}catch(k){throw P=b.user.id,k}finally{s(!1)}}break;case"SIGNED_OUT":console.debug("[AuthenticationProvider] User signed out, clearing state"),n(null),c.current=null,i(null),ae.clear();break;case"TOKEN_REFRESHED":console.debug("[AuthenticationProvider] Token refreshed");break;case"USER_UPDATED":console.debug("[AuthenticationProvider] User updated"),b?.user&&c.current!==null&&(console.debug("[AuthenticationProvider] Refreshing user data after update"),await h(b.user.id,b.user.email||""));break;case"INITIAL_SESSION":console.debug("[AuthenticationProvider] Initial session event (handled by initialization)");break;default:console.debug("[AuthenticationProvider] Unhandled auth event",T)}}catch(k){const _=J.fromError(k);console.error("[AuthenticationProvider] Auth state change error",{error:_.message,type:_.type,userMessage:_.userMessage}),i(_)}});return()=>{console.debug("[AuthenticationProvider] Cleaning up auth state listener"),C.unsubscribe()}},[h]);const R=u.useCallback(async(P,C)=>{try{return await y(P,C),{}}catch(T){return{error:T}}},[y]),N=u.useCallback(async(P,C,T,b,k,_,M)=>{try{const D=`${window.location.origin}/`,{error:A}=await ee.auth.signUp({email:P,password:C,options:{emailRedirectTo:D,data:{first_name:T,last_name:b,phone:k,company_name:_,user_type:M}}});return A?{error:A}:{}}catch(D){return{error:D}}},[]),O=u.useCallback(async P=>{try{const{error:C}=await ee.auth.resetPasswordForEmail(P,{redirectTo:`${window.location.origin}/auth?mode=reset`});return C?{error:C}:{}}catch(C){return{error:C}}},[]),j=r?.role||null,$=r?.roleContext?.tenantId||null,F=r?.staffAttributes?.is_admin||!1,z={user:r,isLoading:o,error:a,login:y,logout:x,resetAuth:w,refreshUserData:E,userRole:j,tenantId:$,isAdmin:F,loading:o,signOut:x,signIn:R,signUp:N,resetPassword:O,isPasswordRecovery:p,clearPasswordRecovery:v};return f?l.jsx(Uo.Provider,{value:z,children:e}):null}const Yc=Vt("inline-flex items-center justify-center gap-2 whitespace-nowrap 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 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ce=u.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},s)=>{const a=n?Ps:"button";return l.jsx(a,{className:Z(Yc({variant:t,size:r,className:e})),ref:s,...o})});Ce.displayName="Button";const yt=u.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:Z("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));yt.displayName="Card";const vt=u.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:Z("flex flex-col space-y-1.5 p-6",e),...t}));vt.displayName="CardHeader";const wt=u.forwardRef(({className:e,...t},r)=>l.jsx("h3",{ref:r,className:Z("text-2xl font-semibold leading-none tracking-tight",e),...t}));wt.displayName="CardTitle";const xt=u.forwardRef(({className:e,...t},r)=>l.jsx("p",{ref:r,className:Z("text-sm text-muted-foreground",e),...t}));xt.displayName="CardDescription";const bt=u.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:Z("p-6 pt-0",e),...t}));bt.displayName="CardContent";const Ho=u.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:Z("flex items-center p-6 pt-0",e),...t}));Ho.displayName="CardFooter";const qc=Vt("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Mt=u.forwardRef(({className:e,variant:t,...r},n)=>l.jsx("div",{ref:n,role:"alert",className:Z(qc({variant:t}),e),...r}));Mt.displayName="Alert";const Bo=u.forwardRef(({className:e,...t},r)=>l.jsx("h5",{ref:r,className:Z("mb-1 font-medium leading-none tracking-tight",e),...t}));Bo.displayName="AlertTitle";const Ft=u.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:Z("text-sm [&_p]:leading-relaxed",e),...t}));Ft.displayName="AlertDescription";function mn({error:e,onReset:t}){const r=()=>{console.debug("[RoutingErrorPage] Reset button clicked"),t()},n=()=>{console.debug("[RoutingErrorPage] Go home button clicked"),window.location.href="/"};return l.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:l.jsxs(yt,{className:"max-w-2xl w-full",children:[l.jsxs(vt,{children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(_t,{className:"h-6 w-6 text-destructive"}),l.jsx(wt,{children:"Navigation Error"})]}),l.jsx(xt,{children:"We encountered an issue while trying to navigate you to the correct page."})]}),l.jsxs(bt,{className:"space-y-4",children:[l.jsxs(Mt,{variant:"destructive",children:[l.jsx(_t,{className:"h-4 w-4"}),l.jsx(Bo,{children:"Error Details"}),l.jsx(Ft,{children:e.userMessage})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h3",{className:"font-semibold text-sm",children:"What you can try:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsx("li",{children:'Click "Reset and Retry" to clear the error and try again'}),l.jsx("li",{children:"Refresh your browser page"}),l.jsx("li",{children:"Clear your browser cache and cookies"}),l.jsx("li",{children:"If the problem persists, contact support"})]})]}),!1]}),l.jsxs(Ho,{className:"flex gap-2",children:[l.jsxs(Ce,{onClick:r,className:"flex items-center gap-2",children:[l.jsx(Zn,{className:"h-4 w-4"}),"Reset and Retry"]}),l.jsxs(Ce,{onClick:n,variant:"outline",className:"flex items-center gap-2",children:[l.jsx(Ra,{className:"h-4 w-4"}),"Go to Home"]})]})]})})}const Gc=["/auth","/login","/complete-signup","/public-invoice"],Xc=3,hn=5e3,gn=100;function Wo(e){return Gc.some(t=>e.startsWith(t))}function Qc(e,t){if(L.logRouting("Determining route",{userId:e?.id,role:e?.role,isClinician:e?.staffAttributes?.is_clinician,currentPath:t},e?.id),e?.roleContext?.signupIncomplete)return t==="/complete-signup"?(L.logRouting("User on signup completion page - no redirect",{currentPath:t},e.id),{shouldRedirect:!1,reason:"User completing signup"}):(L.logRouting("Incomplete signup - redirecting to completion",{from:t,to:"/complete-signup"},e.id),{shouldRedirect:!0,redirectTo:"/complete-signup",reason:"User signup incomplete"});if(!e)return Wo(t)?(L.logRouting("Public route - no redirect",{currentPath:t}),{shouldRedirect:!1,reason:"Public route, no authentication required"}):(L.logRouting("Unauthenticated - redirecting to auth",{currentPath:t}),{shouldRedirect:!0,redirectTo:"/auth",reason:"User not authenticated"});if(e.role==="staff"){const r=e.staffAttributes?.prov_status,n=e.staffAttributes?.is_admin===!0,o=r==="Invited";return L.logRouting("Staff routing decision",{provStatus:r,isAdmin:n,isInvited:o,hasStaffAttributes:!!e.staffAttributes,currentPath:t},e.id),o?t==="/staff/onboarding"?(L.logRouting("Invited staff on registration - no redirect",{currentPath:t},e.id),{shouldRedirect:!1,reason:"Invited staff on registration page"}):(L.logRouting("Invited staff redirecting to registration",{from:t,to:"/staff/onboarding"},e.id),{shouldRedirect:!0,redirectTo:"/staff/onboarding",reason:"Invited staff must complete registration"}):n?t.startsWith("/staff/")?(L.logRouting("Admin on staff route - no redirect",{currentPath:t},e.id),{shouldRedirect:!1,reason:"Admin accessing staff portal"}):(L.logRouting("Admin redirecting to dashboard",{from:t,to:"/staff/dashboard"},e.id),{shouldRedirect:!0,redirectTo:"/staff/dashboard",reason:"Admin redirected to dashboard"}):t.startsWith("/staff/")?(L.logRouting("Active staff on staff route - no redirect",{currentPath:t},e.id),{shouldRedirect:!1,reason:"Active staff accessing staff portal"}):(L.logRouting("Active staff redirecting to dashboard",{from:t,to:"/staff/dashboard"},e.id),{shouldRedirect:!0,redirectTo:"/staff/dashboard",reason:"Active staff redirected to dashboard"})}return L.logError(ne.ROUTING,"Unknown user state",void 0,{userId:e?.id,role:e?.role,currentPath:t}),{shouldRedirect:!0,redirectTo:"/auth",reason:"Unknown user state, redirecting to auth"}}function Jc({children:e}){const{user:t,isLoading:r,error:n,isPasswordRecovery:o}=ot(),s=Ut(),a=zt(),i=u.useRef([]),f=u.useRef(0),[d,p]=u.useState(null),m=()=>{const c=Date.now();if(c-f.currentc-v.timestamp=Xc){L.logError(ne.ROUTING,"Redirect limit exceeded",void 0,{redirectCount:i.current.length,windowMs:hn,history:i.current,userId:t?.id});const v=new J(ge.REDIRECT_LOOP_DETECTED,"Too many redirects detected","Navigation error detected. Please refresh the page or contact support.",!0,{redirectHistory:i.current,currentPath:s.pathname});return p(v),!1}return!0},g=c=>{const v=Date.now();i.current.push({path:c,timestamp:v}),f.current=v,L.logRouting("Redirect recorded",{path:c,redirectCount:i.current.length},t?.id)};return u.useEffect(()=>{if(r||d)return;if(n){L.logError(ne.ROUTING,"Authentication error in routing guard",n,{type:n instanceof J?n.type:"unknown",userId:t?.id}),n instanceof J&&(n.type===ge.AUTHENTICATION_FAILED||n.type===ge.SESSION_EXPIRED)&&(Wo(s.pathname)||(L.logRouting("Redirecting to auth due to error",{errorType:n.type,from:s.pathname},t?.id),a("/auth",{replace:!0})));return}if(o&&s.pathname.startsWith("/auth"))return;const c=Qc(t,s.pathname);if(c.shouldRedirect&&c.redirectTo){if(!m())return;g(c.redirectTo),L.logRouting("Executing redirect",{from:s.pathname,to:c.redirectTo,reason:c.reason},t?.id),a(c.redirectTo,{replace:!0})}},[t,r,n,s.pathname,a,d]),d?l.jsx(mn,{error:d,onReset:()=>{L.logRouting("Resetting redirect loop error",{},t?.id),p(null),i.current=[],f.current=0}}):r?l.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:l.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-primary"})}):n&&n instanceof J&&n.type===ge.ROLE_DETECTION_FAILED?l.jsx(mn,{error:n,onReset:()=>{L.logRouting("User requested reset from error page",{},t?.id),window.location.href="/auth"}}):l.jsx(l.Fragment,{children:e})}function Zc(e){const t=e.replace("#","");if(!/^([0-9A-F]{3}|[0-9A-F]{6})$/i.test(t))return null;const r=t.length===3?t.split("").map(g=>g+g).join(""):t,n=parseInt(r.substr(0,2),16)/255,o=parseInt(r.substr(2,2),16)/255,s=parseInt(r.substr(4,2),16)/255,a=Math.max(n,o,s),i=Math.min(n,o,s),f=a-i;let d=0,p=0;const m=(a+i)/2;if(f!==0){switch(p=m>.5?f/(2-a-i):f/(a+i),a){case n:d=(o-s)/f+(oh,[j]),F=JSON.stringify(y),z=u.useMemo(()=>y,[F]);u.useEffect(()=>{N.current=E,O.current=R});const P=u.useCallback(async(T=!1)=>{if(!w){console.log("⏸️ [useSupabaseQuery] Query skipped",{table:c,enabled:w,hasUser:!!r,reason:"Query not enabled"}),T||i(!1);return}if(($?.user_id!==void 0||$?.tenant_id!==void 0)&&!r){console.log("⏸️ [useSupabaseQuery] Query skipped - waiting for user",{table:c}),T||i(!1);return}console.log("πŸ” [useSupabaseQuery] fetchData called",{table:c,enabled:w,hasUser:!!r,userId:r,tenantId:n,isRefetch:T}),g.current&&g.current.abort(),g.current=new AbortController,T?d(!0):i(!0),m(null);try{let k=ee.from(c).select(v);$&&Object.entries($).forEach(([D,A])=>{if(A!=null){let B=A;D==="user_id"&&A==="current"?B=r:D==="tenant_id"&&(A==="current"||A==="auto")&&(B=n),k=k.eq(D,B)}}),z&&(k=k.order(z.column,{ascending:z.ascending??!0})),x&&x>0&&(k=k.limit(x));const{data:_,error:M}=await k;if(g.current?.signal.aborted){console.log("⏸️ [useSupabaseQuery] Query aborted",{table:c});return}if(M)throw M;console.log("βœ… [useSupabaseQuery] Query successful",{table:c,rowCount:_?.length??0}),s(_||null),m(null),N.current&&_&&N.current(_)}catch(k){if(k instanceof Error&&k.name==="AbortError")return;const _=k instanceof Error?k.message:"Unknown error";console.error("❌ [useSupabaseQuery] Query failed",{table:c,error:_}),m(_),s(null),O.current&&k instanceof Error&&O.current(k)}finally{T?d(!1):i(!1),g.current=null}},[c,v,$,z,x,w,r,n]),C=u.useCallback(async()=>{await P(!0)},[P]);return u.useEffect(()=>(P(!1),()=>{g.current&&g.current.abort()}),[P]),{data:o,loading:a,error:p,refetch:C,isRefreshing:f,isStale:!1,isCircuitBreakerOpen:!1,lastUpdated:new Date,errorType:void 0}}function Vo(){const{tenantId:e}=ot(),{data:t,loading:r,error:n}=td({table:"tenants",select:"id, display_name, logo_url, brand_primary_color, brand_secondary_color, brand_accent_color",filters:{id:e},enabled:!!e}),o=t?.[0]?.logo_url||null,s=t?.[0]?.display_name||null;return u.useEffect(()=>{if(s)return document.title=s,()=>{document.title="Loading..."}},[s]),u.useEffect(()=>{if(!o)return;let a=document.querySelector('link[rel="icon"]');a||(a=document.createElement("link"),a.rel="icon",document.head.appendChild(a));const i=a.href;return a.href=o,()=>{a&&(a.href=i||"/favicon.ico")}},[o]),{displayName:t?.[0]?.display_name||null,logoUrl:o,brandColors:{primary:t?.[0]?.brand_primary_color||null,secondary:t?.[0]?.brand_secondary_color||null,accent:t?.[0]?.brand_accent_color||null},loading:r,error:n}}const rd="160 84% 39%";function nd({children:e}){const{brandColors:t}=Vo();return u.useEffect(()=>{const r=ed,n=document.documentElement;n.style.setProperty("--primary",r.light.primary),n.style.setProperty("--primary-dark",r.light.primaryDark),n.style.setProperty("--primary-light",r.light.primaryLight),n.style.setProperty("--ring",r.light.ring),od(r.dark)},[]),u.useEffect(()=>{const r=document.documentElement;let n=rd;if(t.secondary){const o=Zc(t.secondary);o&&(n=o)}r.style.setProperty("--brand-secondary",n)},[t.secondary]),l.jsx(l.Fragment,{children:e})}function od(e){let t=document.getElementById("dynamic-dark-theme");t||(t=document.createElement("style"),t.id="dynamic-dark-theme",document.head.appendChild(t)),t.textContent=` .dark { --primary: ${e.primary}; --primary-dark: ${e.primaryDark}; --primary-light: ${e.primaryLight}; --ring: ${e.ring}; } `}const Ko=u.createContext(void 0);function sd({children:e}){const{user:t,isLoading:r}=ot(),o={permissions:t?.permissions,loading:r,error:null,hasCustomPermissions:!!t?.roleContext?.isClinician||!!t?.roleContext?.isAdmin,refetch:()=>{}};return l.jsx(Ko.Provider,{value:o,children:e})}function Ad(){const e=u.useContext(Ko);if(e===void 0)throw new Error("usePermissionContext must be used within a PermissionProvider");return e}class ad extends u.Component{constructor(){super(...arguments);re(this,"state",{hasError:!1});re(this,"handleRetry",()=>{this.setState({hasError:!1,error:void 0})})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,n){console.error("ErrorBoundary caught an error:",r,n)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:l.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:l.jsxs(yt,{className:"max-w-md w-full",children:[l.jsxs(vt,{className:"text-center",children:[l.jsx("div",{className:"flex justify-center mb-4",children:l.jsx(Na,{className:"h-12 w-12 text-red-500"})}),l.jsx(wt,{className:"text-xl",children:"Something went wrong"}),l.jsx(xt,{children:"An unexpected error occurred. Please try refreshing the page."})]}),l.jsxs(bt,{className:"text-center space-y-4",children:[this.state.error&&l.jsxs("details",{className:"text-left",children:[l.jsx("summary",{className:"cursor-pointer text-sm text-muted-foreground",children:"Error details"}),l.jsx("pre",{className:"mt-2 text-xs bg-muted p-2 rounded overflow-auto",children:this.state.error.message})]}),l.jsxs(Ce,{onClick:this.handleRetry,className:"w-full",children:[l.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Try Again"]})]})]})}):this.props.children}}const Pe=u.forwardRef(({className:e,type:t,...r},n)=>l.jsx("input",{type:t,className:Z("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));Pe.displayName="Input";var id="Label",Yo=u.forwardRef((e,t)=>l.jsx(oe.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Yo.displayName=id;var qo=Yo;const ld=Vt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ae=u.forwardRef(({className:e,...t},r)=>l.jsx(qo,{ref:r,className:Z(ld(),e),...t}));Ae.displayName=qo.displayName;var cd="Separator",yn="horizontal",dd=["horizontal","vertical"],Go=u.forwardRef((e,t)=>{const{decorative:r,orientation:n=yn,...o}=e,s=ud(n)?n:yn,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return l.jsx(oe.div,{"data-orientation":s,...i,...o,ref:t})});Go.displayName=cd;function ud(e){return dd.includes(e)}var Xo=Go;const Qo=u.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},o)=>l.jsx(Xo,{ref:o,decorative:r,orientation:t,className:Z("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Qo.displayName=Xo.displayName;const vn="/assets/valorwell-logo-BQcmtOXy.png";function lr(e,t="Unknown error"){if(typeof e=="string"&&e)return e;if(typeof e=="object"&&e!==null&&"message"in e){const{message:r}=e;if(typeof r=="string"&&r)return r}return t}function fd(){const[e,t]=u.useState(!0),[r,n]=u.useState(!1),[o,s]=u.useState(!1),[a,i]=u.useState(""),[f,d]=u.useState(""),[p,m]=u.useState(""),[g,c]=u.useState(""),[v,h]=u.useState(""),[y,x]=u.useState(""),[w,E]=u.useState(""),[R,N]=u.useState(""),[O,j]=u.useState(!1),[$,F]=u.useState(null),[z,P]=u.useState(null),{signIn:C,signUp:T,resetPassword:b,user:k,loading:_,isPasswordRecovery:M,clearPasswordRecovery:D}=ot(),{displayName:A}=Vo(),B=zt(),q=Ut();u.useEffect(()=>{let I=document.querySelector('link[rel="icon"]');I||(I=document.createElement("link"),I.rel="icon",document.head.appendChild(I));const K=I.href;return I.href=vn,()=>{I&&(I.href=K||"/favicon.ico")}},[]),u.useEffect(()=>{(async()=>{const K=new URLSearchParams(q.search),ce=new URLSearchParams(q.hash.slice(1)),Y=K.get("mode")==="reset",De=ce.get("type")==="recovery",xe=K.get("code");if(xe)try{const{error:be}=await ee.auth.exchangeCodeForSession(xe);if(be){F(`Failed to process reset link: ${be.message}`);return}window.history.replaceState(null,"",q.pathname+(Y?"?mode=reset":""))}catch{F("Failed to process reset link");return}(Y||De)&&(s(!0),n(!1),t(!0))})()},[q.search,q.hash]),u.useEffect(()=>{M&&(s(!0),n(!1),t(!0))},[M]),u.useEffect(()=>{if(k&&!_&&!M&&!o){const I=q.state?.from?.pathname||"/";B(I,{replace:!0})}},[k,_,B,q,M,o]);const W=async I=>{if(I.preventDefault(),j(!0),F(null),P(null),p!==g){F("Passwords do not match"),j(!1);return}if(p.length<6){F("Password must be at least 6 characters"),j(!1);return}try{const{error:K}=await ee.auth.updateUser({password:p});K?F(K.message):(D(),s(!1),m(""),c(""),window.history.replaceState(null,"",q.pathname),await ee.auth.signOut(),P("Password updated successfully! Please sign in with your new password."))}finally{j(!1)}},V=async I=>{I.preventDefault(),j(!0),F(null),P(null);try{if(r){const{error:K}=await b(a);K?F(lr(K,"Something went wrong. Please try again.")):(P("Password reset email sent! Check your inbox."),n(!1),i(""))}else if(e){const{error:K}=await C(a,f);if(K)F(lr(K,"Something went wrong. Please try again."));else{const ce=q.state?.from?.pathname||"/";B(ce,{replace:!0})}}else{const{error:K}=await T(a,f,v,y,w,R,"contractor");K?F(lr(K,"Something went wrong. Please try again.")):(t(!0),i(""),d(""),h(""),x(""),E(""),N(""))}}finally{j(!1)}};return _?l.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-light/10 to-accent/30 flex items-center justify-center",children:l.jsx(At,{className:"h-8 w-8 animate-spin text-primary"})}):l.jsx("div",{className:"min-h-screen bg-gradient-to-br from-primary-light/10 to-accent/30 flex items-center justify-center p-4",children:l.jsxs("div",{className:"w-full max-w-md space-y-6",children:[l.jsxs("div",{className:"text-center space-y-4",children:[l.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3",children:[l.jsx("img",{src:vn,alt:"ValorWell Logo",className:"h-20 w-20 object-contain"}),l.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Welcome to ValorWell"})]}),l.jsx("p",{className:"text-muted-foreground",children:"Your mental health practice management platform"})]}),l.jsxs(yt,{className:"shadow-material-lg",children:[l.jsxs(vt,{className:"space-y-1",children:[l.jsx(wt,{className:"text-2xl font-semibold text-center",children:o?"Set new password":r?"Reset your password":e?"Welcome back":"Create your account"}),l.jsx(xt,{className:"text-center",children:o?"Enter your new password below":r?"Enter your email address to receive a password reset link":e?`Sign in to your ${A||"ValorWell"} account`:`Get started with ${A||"ValorWell"} today`})]}),l.jsxs(bt,{className:"space-y-4",children:[z&&l.jsxs(Mt,{className:"border-primary/30 bg-primary/5",children:[l.jsx(Ca,{className:"h-4 w-4 text-primary"}),l.jsx(Ft,{className:"text-foreground",children:z})]}),o&&l.jsxs("form",{onSubmit:W,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ae,{htmlFor:"newPassword",children:"New Password"}),l.jsx(Pe,{id:"newPassword",placeholder:"Enter new password",type:"password",value:p,onChange:I=>m(I.target.value),required:!0,minLength:6,className:"transition-all duration-normal"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ae,{htmlFor:"confirmPassword",children:"Confirm Password"}),l.jsx(Pe,{id:"confirmPassword",placeholder:"Confirm new password",type:"password",value:g,onChange:I=>c(I.target.value),required:!0,minLength:6,className:"transition-all duration-normal"})]}),l.jsx(Ce,{type:"submit",className:"w-full",disabled:O,children:O?l.jsxs(l.Fragment,{children:[l.jsx(At,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating password..."]}):l.jsxs(l.Fragment,{children:[l.jsx(Ta,{className:"mr-2 h-4 w-4"}),"Update Password"]})})]}),!o&&l.jsxs(l.Fragment,{children:[r&&l.jsxs(Ce,{variant:"ghost",onClick:()=>{n(!1),i("")},className:"mb-4 p-0 h-auto text-sm text-muted-foreground hover:text-foreground",children:[l.jsx(Ea,{className:"mr-2 h-4 w-4"}),"Back to sign in"]}),l.jsxs("form",{onSubmit:V,className:"space-y-4",children:[!e&&!r&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ae,{htmlFor:"firstName",children:"First Name"}),l.jsx(Pe,{id:"firstName",placeholder:"Enter your first name",type:"text",value:v,onChange:I=>h(I.target.value),required:!e,className:"transition-all duration-normal"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ae,{htmlFor:"lastName",children:"Last Name"}),l.jsx(Pe,{id:"lastName",placeholder:"Enter your last name",type:"text",value:y,onChange:I=>x(I.target.value),required:!e,className:"transition-all duration-normal"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ae,{htmlFor:"phone",children:"Phone Number"}),l.jsx(Pe,{id:"phone",placeholder:"Enter your phone number",type:"tel",value:w,onChange:I=>E(I.target.value),required:!e,className:"transition-all duration-normal"})]}),!e&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ae,{htmlFor:"companyName",children:"Practice/Organization Name"}),l.jsx(Pe,{id:"companyName",placeholder:"Enter your practice or organization name",type:"text",value:R,onChange:I=>N(I.target.value),required:!e,className:"transition-all duration-normal"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(Ae,{htmlFor:"email",children:"Email"}),l.jsx(Pe,{id:"email",placeholder:"Enter your email",type:"email",value:a,onChange:I=>i(I.target.value),required:!0,className:"transition-all duration-normal"})]}),!r&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(Ae,{htmlFor:"password",children:"Password"}),e&&l.jsx(Ce,{type:"button",variant:"link",onClick:()=>n(!0),className:"p-0 h-auto text-sm text-muted-foreground hover:text-foreground",children:"Forgot password?"})]}),l.jsx(Pe,{id:"password",placeholder:"Enter your password",type:"password",value:f,onChange:I=>d(I.target.value),required:!0,className:"transition-all duration-normal"})]}),l.jsx(Ce,{type:"submit",className:"w-full",disabled:O,children:O?l.jsxs(l.Fragment,{children:[l.jsx(At,{className:"mr-2 h-4 w-4 animate-spin"}),r?"Sending email...":e?"Signing in...":"Creating account..."]}):l.jsx(l.Fragment,{children:r?l.jsxs(l.Fragment,{children:[l.jsx(Jn,{className:"mr-2 h-4 w-4"}),"Send Reset Email"]}):l.jsxs(l.Fragment,{children:[l.jsx(Pa,{className:"mr-2 h-4 w-4"}),e?"Sign In":"Sign Up as Staff"]})})})]}),!r&&l.jsx(l.Fragment,{children:l.jsx(Qo,{})})]})]})]}),$&&l.jsxs(Mt,{variant:"destructive",children:[l.jsx(_t,{className:"h-4 w-4"}),l.jsx(Ft,{children:$})]}),l.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"By continuing, you agree to our Terms of Service and Privacy Policy."})]})})}function pd(){const e=zt(),t=async()=>{await ee.auth.signOut(),e("/auth")},r=()=>{window.location.href="mailto:support@valorwell.org?subject=Account Setup Incomplete"};return l.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:l.jsxs(yt,{className:"max-w-md w-full",children:[l.jsxs(vt,{className:"text-center",children:[l.jsx("div",{className:"mx-auto mb-4 w-12 h-12 rounded-full bg-yellow-100 dark:bg-yellow-900/20 flex items-center justify-center",children:l.jsx(_t,{className:"w-6 h-6 text-yellow-600 dark:text-yellow-500"})}),l.jsx(wt,{children:"Account Setup Incomplete"}),l.jsx(xt,{children:"Your account was created, but some required information is missing."})]}),l.jsxs(bt,{className:"space-y-4",children:[l.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[l.jsx("p",{children:"We've detected that your account setup didn't complete successfully. This can happen if:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-1 ml-2",children:[l.jsx("li",{children:"Your invitation link expired"}),l.jsx("li",{children:"A technical error occurred during signup"}),l.jsx("li",{children:"Required profile data wasn't saved"})]})]}),l.jsxs("div",{className:"pt-4 space-y-3",children:[l.jsxs(Ce,{onClick:r,className:"w-full",variant:"default",children:[l.jsx(Jn,{className:"w-4 h-4 mr-2"}),"Contact Support"]}),l.jsxs(Ce,{onClick:t,className:"w-full",variant:"outline",children:[l.jsx(Sa,{className:"w-4 h-4 mr-2"}),"Sign Out"]})]}),l.jsx("div",{className:"pt-4 text-xs text-center text-muted-foreground",children:"Support will help complete your account setup and get you access to the system."})]})]})})}const md=()=>{const e=Ut(),{user:t,userRole:r}=ot();u.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]);const n=()=>t?r==="client"?"/client/dashboard":"/staff/dashboard":"/auth";return l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:l.jsxs("div",{className:"text-center",children:[l.jsx("h1",{className:"mb-4 text-4xl font-bold text-foreground",children:"404"}),l.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),l.jsx(vs,{to:n(),className:"text-primary underline hover:text-primary/80",children:"Return to Home"})]})})},hd=u.lazy(()=>hs(()=>import("./StaffPortalApp-CVlGLsBu.js").then(e=>e.ck),__vite__mapDeps([0,1,2]))),gd=()=>l.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:l.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-primary"})}),yd=new gs,vd=()=>l.jsx(ad,{children:l.jsx(ys,{client:yd,children:l.jsx(Kc,{children:l.jsx(sd,{children:l.jsx(nd,{children:l.jsxs(Ic,{children:[l.jsx(ui,{}),l.jsx(Bi,{}),l.jsx(ws,{children:l.jsx(Jc,{children:l.jsxs(xs,{children:[l.jsx(Xe,{path:"/auth",element:l.jsx(fd,{})}),l.jsx(Xe,{path:"/reset-password",element:l.jsx(Uc,{})}),l.jsx(Xe,{path:"/complete-signup",element:l.jsx(pd,{})}),l.jsx(Xe,{path:"/staff/*",element:l.jsx(u.Suspense,{fallback:l.jsx(gd,{}),children:l.jsx(hd,{})})}),l.jsx(Xe,{path:"/",element:l.jsx("div",{})}),l.jsx(Xe,{path:"*",element:l.jsx(md,{})})]})})})]})})})})})}),cr=document.getElementById("root");try{cr.innerHTML="",bn(cr).render(l.jsx(vd,{}))}catch(e){console.error("Failed to initialize app:",e),cr.innerHTML=`

Failed to load application

Please try refreshing the page.

`}export{Qo as $,Mt as A,Ce as B,_t as C,br as D,Pn as E,jt as F,Os as G,Ra as H,Yc as I,ks as J,sc as K,At as L,Ts as M,Oe as N,Ae as O,oe as P,Pe as Q,Zn as R,Ps as S,Na as T,Ro as U,pc as V,mc as W,Aa as X,hc as Y,Js as Z,fc as _,ot as a,En as a0,Rn as a1,Jn as a2,Xn as a3,Ea as a4,Zc as a5,xt as a6,Ic as a7,Nd as a8,Pd as a9,Lc as aa,ct as ab,ae as ac,Rd as ad,Pa as ae,Bo as b,ue as c,Ft as d,Z as e,Vt as f,Ca as g,Vo as h,Sa as i,Ss as j,lr as k,td as l,yt as m,vt as n,wt as o,bt as p,$e as q,ye as r,ee as s,Ht as t,Ad as u,te as v,Er as w,Ed as x,An as y,Ki as z};