1import{j as n}from"./vendor-query-DE4ddfaS.js";import{u as Ie}from"./use-toast-lAcQct5a.js";import{r,a as je}from"./vendor-react-Cnc6YwJC.js";import{f as Ae,g as oe,B as De,P as F,E as se,j as _e,l as Le,q as W,h as b,F as Me,p as Oe,y as ke,e as I}from"./index-CXCjBhtX.js";import{c as Ve,P as Ke}from"./index-BGHQPd4x.js";import{c as $e}from"./createLucideIcon-C_BWx8QT.js";import He from"./x-BWKABMLL.js";import"./vendor-supabase-Duv3QcMz.js";import"./vendor-sanitize--yiYCWnk.js";var G="ToastProvider",[J,We,Xe]=Ve("Toast"),[re,Et]=Ae("Toast",[Xe]),[Ue,X]=re(G),ne=e=>{const{__scopeToast:t,label:o="Notification",duration:s=5e3,swipeDirection:u="right",swipeThreshold:d=50,children:p}=e,[v,w]=r.useState(null),[c,h]=r.useState(0),x=r.useRef(!1),j=r.useRef(!1);return o.trim()||console.error(`Invalid prop \`label\` supplied to \`${G}\`. Expected non-empty \`string\`.`),n.jsx(J.Provider,{scope:t,children:n.jsx(Ue,{scope:t,label:o,duration:s,swipeDirection:u,swipeThreshold:d,toastCount:c,viewport:v,onViewportChange:w,onToastAdd:r.useCallback(()=>h(R=>R+1),[]),onToastRemove:r.useCallback(()=>h(R=>R-1),[]),isFocusedToastEscapeKeyDownRef:x,isClosePausedRef:j,children:p})})};ne.displayName=G;var ae="ToastViewport",Ye=["F8"],B="toast.viewportPause",q="toast.viewportResume",ie=r.forwardRef((e,t)=>{const{__scopeToast:o,hotkey:s=Ye,label:u="Notifications ({hotkey})",...d}=e,p=X(ae,o),v=We(o),w=r.useRef(null),c=r.useRef(null),h=r.useRef(null),x=r.useRef(null),j=oe(t,x,p.onViewportChange),R=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=p.toastCount>0;r.useEffect(()=>{const i=E=>{s.length!==0&&s.every(m=>E[m]||E.code===m)&&x.current?.focus()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[s]),r.useEffect(()=>{const i=w.current,E=x.current;if(N&&i&&E){const f=()=>{if(!p.isClosePausedRef.current){const T=new CustomEvent(B);E.dispatchEvent(T),p.isClosePausedRef.current=!0}},m=()=>{if(p.isClosePausedRef.current){const T=new CustomEvent(q);E.dispatchEvent(T),p.isClosePausedRef.current=!1}},y=T=>{!i.contains(T.relatedTarget)&&m()},g=()=>{i.contains(document.activeElement)||m()};return i.addEventListener("focusin",f),i.addEventListener("focusout",y),i.addEventListener("pointermove",f),i.addEventListener("pointerleave",g),window.addEventListener("blur",f),window.addEventListener("focus",m),()=>{i.removeEventListener("focusin",f),i.removeEventListener("focusout",y),i.removeEventListener("pointermove",f),i.removeEventListener("pointerleave",g),window.removeEventListener("blur",f),window.removeEventListener("focus",m)}}},[N,p.isClosePausedRef]);const l=r.useCallback(({tabbingDirection:i})=>{const f=v().map(m=>{const y=m.ref.current,g=[y,...nt(y)];return i==="forwards"?g:g.reverse()});return(i==="forwards"?f.reverse():f).flat()},[v]);return r.useEffect(()=>{const i=x.current;if(i){const E=f=>{const m=f.altKey||f.ctrlKey||f.metaKey;if(f.key==="Tab"&&!m){const g=document.activeElement,T=f.shiftKey;if(f.target===i&&T){c.current?.focus();return}const D=l({tabbingDirection:T?"backwards":"forwards"}),k=D.findIndex(S=>S===g);Y(D.slice(k+1))?f.preventDefault():T?c.current?.focus():h.current?.focus()}};return i.addEventListener("keydown",E),()=>i.removeEventListener("keydown",E)}},[v,l]),n.jsxs(De,{ref:w,role:"region","aria-label":u.replace("{hotkey}",R),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&n.jsx(z,{ref:c,onFocusFromOutsideViewport:()=>{const i=l({tabbingDirection:"forwards"});Y(i)}}),n.jsx(J.Slot,{scope:o,children:n.jsx(F.ol,{tabIndex:-1,...d,ref:j})}),N&&n.jsx(z,{ref:h,onFocusFromOutsideViewport:()=>{const i=l({tabbingDirection:"backwards"});Y(i)}})]})});ie.displayName=ae;var ce="ToastFocusProxy",z=r.forwardRef((e,t)=>{const{__scopeToast:o,onFocusFromOutsideViewport:s,...u}=e,d=X(ce,o);return n.jsx(se,{"aria-hidden":!0,tabIndex:0,...u,ref:t,style:{position:"fixed"},onFocus:p=>{const v=p.relatedTarget;!d.viewport?.contains(v)&&s()}})});z.displayName=ce;var M="Toast",Be="toast.swipeStart",qe="toast.swipeMove",ze="toast.swipeCancel",Ge="toast.swipeEnd",ue=r.forwardRef((e,t)=>{const{forceMount:o,open:s,defaultOpen:u,onOpenChange:d,...p}=e,[v,w]=_e({prop:s,defaultProp:u??!0,onChange:d,caller:M});return n.jsx(Le,{present:o||v,children:n.jsx(Ze,{open:v,...p,ref:t,onClose:()=>w(!1),onPause:W(e.onPause),onResume:W(e.onResume),onSwipeStart:b(e.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:b(e.onSwipeMove,c=>{const{x:h,y:x}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${x}px`)}),onSwipeCancel:b(e.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:b(e.onSwipeEnd,c=>{const{x:h,y:x}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${h}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${x}px`),w(!1)})})})});ue.displayName=M;var[Je,Qe]=re(M,{onClose(){}}),Ze=r.forwardRef((e,t)=>
1{const{__scopeToast:o,type:s="foreground",duration:u,open:d,onClose:p,onEscapeKeyDown:v,onPause:w,onResume:c,onSwipeStart:h,onSwipeMove:x,onSwipeCancel:j,onSwipeEnd:R,...N}=e,l=X(M,o),[i,E]=r.useState(null),f=oe(t,a=>E(a)),m=r.useRef(null),y=r.useRef(null),g=u||l.duration,T=r.useRef(0),A=r.useRef(g),O=r.useRef(0),{onToastAdd:D,onToastRemove:k}=l,S=W(()=>{i?.contains(document.activeElement)&&l.viewport?.focus(),p()}),V=r.useCallback(a=>{!a||a===1/0||(window.clearTimeout(O.current),T.current=new Date().getTime(),O.current=window.setTimeout(S,a))},[S]);r.useEffect(()=>{const a=l.viewport;if(a){const P=()=>{V(A.current),c?.()},C=()=>{const _=new Date().getTime()-T.current;A.current=A.current-_,window.clearTimeout(O.current),w?.()};return a.addEventListener(B,C),a.addEventListener(q,P),()=>{a.removeEventListener(B,C),a.removeEventListener(q,P)}}},[l.viewport,g,w,c,V]),r.useEffect(()=>{d&&!l.isClosePausedRef.current&&V(g)},[d,g,l.isClosePausedRef,V]),r.useEffect(()=>(D(),()=>k()),[D,k]);const Z=r.useMemo(()=>i?we(i):null,[i]);return l.viewport?n.jsxs(n.Fragment,{children:[Z&&n.jsx(et,{__scopeToast:o,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:Z}),n.jsx(Je,{scope:o,onClose:S,children:je.createPortal(n.jsx(J.ItemSlot,{scope:o,children:n.jsx(Me,{asChild:!0,onEscapeKeyDown:b(v,()=>{l.isFocusedToastEscapeKeyDownRef.current||S(),l.isFocusedToastEscapeKeyDownRef.current=!1}),children:n.jsx(F.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":d?"open":"closed","data-swipe-direction":l.swipeDirection,...N,ref:f,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:b(e.onKeyDown,a=>{a.key==="Escape"&&(v?.(a.nativeEvent),a.nativeEvent.defaultPrevented||(l.isFocusedToastEscapeKeyDownRef.current=!0,S()))}),onPointerDown:b(e.onPointerDown,a=>{a.button===0&&(m.current={x:a.clientX,y:a.clientY})}),onPointerMove:b(e.onPointerMove,a=>{if(!m.current)return;const P=a.clientX-m.current.x,C=a.clientY-m.current.y,_=!!y.current,L=["left","right"].includes(l.swipeDirection),K=["left","up"].includes(l.swipeDirection)?Math.min:Math.max,Se=L?K(0,P):0,Fe=L?0:K(0,C),U=a.pointerType==="touch"?10:2,$={x:Se,y:Fe},ee={originalEvent:a,delta:$};_?(y.current=$,H(qe,x,ee,{discrete:!1})):te($,l.swipeDirection,U)?(y.current=$,H(Be,h,ee,{discrete:!1}),a.target.setPointerCapture(a.pointerId)):(Math.abs(P)>U||Math.abs(C)>U)&&(m.current=null)}),onPointerUp:b(e.onPointerUp,a=>{const P=y.current,C=a.target;if(C.hasPointerCapture(a.pointerId)&&C.releasePointerCapture(a.pointerId),y.current=null,m.current=null,P){const _=a.currentTarget,L={originalEvent:a,delta:P};te(P,l.swipeDirection,l.swipeThreshold)?H(Ge,R,L,{discrete:!0}):H(ze,j,L,{discrete:!0}),_.addEventListener("click",K=>K.preventDefault(),{once:!0})}})})})}),l.viewport)})]}):null}),et=e=>{const{__scopeToast:t,children:o,...s}=e,u=X(M,t),[d,p]=r.useState(!1),[v,w]=r.useState(!1);return st(()=>p(!0)),r.useEffect(()=>{const c=window.setTimeout(()=>w(!0),1e3);return()=>window.clearTimeout(c)},[]),v?null:n.jsx(Ke,{asChild:!0,children:n.jsx(se,{...s,children:d&&n.jsxs(n.Fragment,{children:[u.label," ",o]})})})},tt="ToastTitle",de=r.forwardRef((e,t)=>{const{__scopeToast:o,...s}=e;return n.jsx(F.div,{...s,ref:t})});de.displayName=tt;var ot="ToastDescription",le=r.forwardRef((e,t)=>{const{__scopeToast:o,...s}=e;return n.jsx(F.div,{...s,ref:t})});le.displayName=ot;var pe="ToastAction",fe=r.forwardRef((e,t)=>{const{altText:o,...s}=e;return o.trim()?n.jsx(ve,{altText:o,asChild:!0,children:n.jsx(Q,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${pe}\`. Expected non-empty \`string\`.`),null)});fe.displayName=pe;var me="ToastClose",Q=r.forwardRef((e,t)=>{const{__scopeToast:o,...s}=e,u=Qe(me,o);return n.jsx(ve,{asChild:!0,children:n.jsx(F.button,{type:"button",...s,ref:t,onClick:b(e.onClick,u.onClose)})})});Q.displayName=me;var ve=r.forwardRef((e,t)=>{const{__scopeToast:o,altText:s,...u}=e;return n.jsx(F.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...u,ref:t})});function we(e){const t=[];
1return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),rt(s)){const u=s.ariaHidden||s.hidden||s.style.display==="none",d=s.dataset.radixToastAnnounceExclude==="";if(!u)if(d){const p=s.dataset.radixToastAnnounceAlt;p&&t.push(p)}else t.push(...we(s))}}),t}function H(e,t,o,{discrete:s}){const u=o.originalEvent.currentTarget,d=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o});t&&u.addEventListener(e,t,{once:!0}),s?ke(u,d):u.dispatchEvent(d)}var te=(e,t,o=0)=>{const s=Math.abs(e.x),u=Math.abs(e.y),d=s>u;return t==="left"||t==="right"?d&&s>o:!d&&u>o};function st(e=()=>{}){const t=W(e);Oe(()=>{let o=0,s=0;return o=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(o),window.cancelAnimationFrame(s)}},[t])}function rt(e){return e.nodeType===e.ELEMENT_NODE}function nt(e){const t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const u=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||u?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)t.push(o.currentNode);return t}function Y(e){const t=document.activeElement;return e.some(o=>o===t?!0:(o.focus(),document.activeElement!==t))}var at=ne,Te=ie,xe=ue,Ee=de,ye=le,ge=fe,he=Q;const it=at,be=r.forwardRef(({className:e,...t},o)=>n.jsx(Te,{ref:o,className:I("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}));be.displayName=Te.displayName;const ct=$e("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"}}),Pe=r.forwardRef(({className:e,variant:t,...o},s)=>n.jsx(xe,{ref:s,className:I(ct({variant:t}),e),...o}));Pe.displayName=xe.displayName;const ut=r.forwardRef(({className:e,...t},o)=>n.jsx(ge,{ref:o,className:I("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}));ut.displayName=ge.displayName;const Ce=r.forwardRef(({className:e,...t},o)=>n.jsx(he,{ref:o,className:I("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:n.jsx(He,{className:"h-4 w-4"})}));Ce.displayName=he.displayName;const Re=r.forwardRef(({className:e,...t},o)=>n.jsx(Ee,{ref:o,className:I("text-sm font-semibold",e),...t}));Re.displayName=Ee.displayName;const Ne=r.forwardRef(({className:e,...t},o)=>n.jsx(ye,{ref:o,className:I("text-sm opacity-90",e),...t}));Ne.displayName=ye.displayName;function yt(){const{toasts:e}=Ie();return n.jsxs(it,{children:[e.map(function({id:t,title:o,description:s,action:u,...d}){return n.jsxs(Pe,{...d,children:[n.jsxs("div",{className:"grid gap-1",children:[o&&n.jsx(Re,{children:o}),s&&n.jsx(Ne,{children:s})]}),u,n.jsx(Ce,{})]},t)}),n.jsx(be,{})]})}
1export{yt as Toaster};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.