PageSourceSearch

https://setverso.com/assets/index-DFRwvZ6i.js

js setverso.com collected 2026-10-06 04:45:07 UTC 453,387 bytes, 103 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ResetPasswordScreen-DYPVq02K.js","assets/motion-DQrxb1aq.js","assets/vendor-BTbeRSw2.js","assets/lock-BEU8CNk8.js","assets/eye-CR2tTsFX.js","assets/Index-roSOeQ_8.js","assets/index-rm6UIHd4.js","assets/trash-2-CT_YVMUm.js","assets/smartphone-CPdOlcMA.js","assets/button-s5Yi8lF6.js","assets/Index-CoWDvOvo.css","assets/NotFound-BAmrgXPp.js","assets/Admin-B76JzpYo.js","assets/globe-BIkISNZL.js","assets/Politicas-DCk41DpS.js","assets/ExcluirConta-fqQuf9nb.js","assets/Install-ClBk9kqx.js","assets/MigrationRedirect-lKCH0622.js","assets/index-XIFkKqiZ.js","assets/index-BGL46_Uy.js"])))=>i.map(i=>d[i]);
2var lu=Object.defineProperty,cu=Object.defineProperties;var uu=Object.getOwnPropertyDescriptors;var Ss=Object.getOwnPropertySymbols,du=Object.getPrototypeOf,Wi=Object.prototype.hasOwnProperty,Vi=Object.prototype.propertyIsEnumerable,hu=Reflect.get;var zi=t=>{throw TypeError(t)},Rn=Math.pow,An=(t,e,r)=>e in t?lu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,S=(t,e)=>{for(var r in e||(e={}))Wi.call(e,r)&&An(t,r,e[r]);if(Ss)for(var r of Ss(e))Vi.call(e,r)&&An(t,r,e[r]);return t},R=(t,e)=>cu(t,uu(e));var V=(t,e)=>{var r={};for(var s in t)Wi.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&Ss)for(var s of Ss(t))e.indexOf(s)<0&&Vi.call(t,s)&&(r[s]=t[s]);return r};var Cn=(t,e,r)=>An(t,typeof e!="symbol"?e+"":e,r),On=(t,e,r)=>e.has(t)||zi("Cannot "+r);var A=(t,e,r)=>(On(t,e,"read from private field"),r?r.call(t):e.get(t)),se=(t,e,r)=>e.has(t)?zi("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),G=(t,e,r,s)=>(On(t,e,"write to private field"),s?s.call(t,r):e.set(t,r),r),be=(t,e,r)=>(On(t,e,"access private method"),r);var Es=(t,e,r,s)=>({set _(n){G(t,e,n,r)},get _(){return A(t,e,s)}}),Te=(t,e,r)=>hu(du(t),r,e);var f=(t,e,r)=>new Promise((s,n)=>{var i=l=>{try{a(r.next(l))}catch(c){n(c)}},o=l=>{try{a(r.throw(l))}catch(c){n(c)}},a=l=>l.done?s(l.value):Promise.resolve(l.value).then(i,o);a((r=r.apply(t,e)).next())});import{j as m}from"./motion-DQrxb1aq.js";import{a as cn,r as w,R as O,b as qs,c as fu,B as pu,u as gu,d as mi,e as qi,f as Oe,N as Us}from"./vendor-BTbeRSw2.js";const mu=function(){const e=typeof document!="undefined"&&document.createElement("link").relList;return e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"}(),yu=function(t){return"/"+t},Ki={},Ne=function(e,r,s){let n=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));n=Promise.allSettled(r.map(l=>{if(l=yu(l),l in Ki)return;Ki[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":mu,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((p,u)=>{h.addEventListener("load",p),h.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return n.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};var Ba,Gi=cn;Ba=Gi.createRoot,Gi.hydrateRoot;const vu=1,bu=1e6;let Pn=0;function wu(){return Pn=(Pn+1)%Number.MAX_SAFE_INTEGER,Pn.toString()}const jn=new Map,Ji=t=>{if(jn.has(t))return;const e=setTimeout(()=>{jn.delete(t),Xr({type:"REMOVE_TOAST",toastId:t})},bu);jn.set(t,e)},_u=(t,e)=>{switch(e.type){case"ADD_TOAST":return R(S({},t),{toasts:[e.toast,...t.toasts].slice(0,vu)});case"UPDATE_TOAST":return R(S({},t),{toasts:t.toasts.map(r=>r.id===e.toast.id?S(S({},r),e.toast):r)});case"DISMISS_TOAST":{const{toastId:r}=e;return r?Ji(r):t.toasts.forEach(s=>{Ji(s.id)}),R(S({},t),{toasts:t.toasts.map(s=>
2s.id===r||r===void 0?R(S({},s),{open:!1}):s)})}case"REMOVE_TOAST":return e.toastId===void 0?R(S({},t),{toasts:[]}):R(S({},t),{toasts:t.toasts.filter(r=>r.id!==e.toastId)})}},Ms=[];let Bs={toasts:[]};function Xr(t){Bs=_u(Bs,t),Ms.forEach(e=>{e(Bs)})}function xu(e){var t=V(e,[]);const r=wu(),s=i=>Xr({type:"UPDATE_TOAST",toast:R(S({},i),{id:r})}),n=()=>Xr({type:"DISMISS_TOAST",toastId:r});return Xr({type:"ADD_TOAST",toast:R(S({},t),{id:r,open:!0,onOpenChange:i=>{i||n()}})}),{id:r,dismiss:n,update:s}}function Su(){const[t,e]=w.useState(Bs);return w.useEffect(()=>(Ms.push(e),()=>{const r=Ms.indexOf(e);r>-1&&Ms.splice(r,1)}),[t]),R(S({},t),{toast:xu,dismiss:r=>Xr({type:"DISMISS_TOAST",toastId:r})})}function me(t,e,{checkForDefaultPrevented:r=!0}={}){return function(n){if(t==null||t(n),r===!1||!n.defaultPrevented)return e==null?void 0:e(n)}}function Yi(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Fa(...t){return e=>{let r=!1;const s=t.map(n=>{const i=Yi(n,e);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let n=0;n<s.length;n++){const i=s[n];typeof i=="function"?i():Yi(t[n],null)}}}}function Ye(...t){return w.useCallback(Fa(...t),t)}function sb(t,e){const r=w.createContext(e),s=i=>{const c=i,{children:o}=c,a=V(c,["children"]),l=w.useMemo(()=>a,Object.values(a));return m.jsx(r.Provider,{value:l,children:o})};s.displayName=t+"Provider";function n(i){const o=w.useContext(r);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[s,n]}function un(t,e=[]){let r=[];function s(i,o){const a=w.createContext(o),l=r.length;r=[...r,o];const c=h=>{var x;const b=h,{scope:p,children:u}=b,y=V(b,["scope","children"]),g=((x=p==null?void 0:p[t])==null?void 0:x[l])||a,v=w.useMemo(()=>y,Object.values(y));return m.jsx(g.Provider,{value:v,children:u})};c.displayName=i+"Provider";function d(h,p){var g;const u=((g=p==null?void 0:p[t])==null?void 0:g[l])||a,y=w.useContext(u);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[c,d]}const n=()=>{const i=r.map(o=>w.createContext(o));return function(a){const l=(a==null?void 0:a[t])||i;return w.useMemo(()=>({[`__scope${t}`]:R(S({},a),{[t]:l})}),[a,l])}};return n.scopeName=t,[s,Eu(n,...e)]}function Eu(...t){const e=t[0];if(t.length===1)return e;const r=()=>{const s=t.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(i){const o=s.reduce((a,{useScope:l,scopeName:c})=>{const h=l(i)[`__scope${c}`];return S(S({},a),h)},{});return w.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return r.scopeName=e.scopeName,r}function Ks(t){const e=ku(t),r=w.forwardRef((s,n)=>{const c=s,{children:i}=c,o=V(c,["children"]),a=w.Children.toArray(i),l=a.find(Au);if(l){const d=l.props.children,h=a.map(p=>p===l?w.Children.count(d)>1?w.Children.only(null):w.isValidElement(d)?d.props.children:null:p);return m.jsx(e,R(S({},o),{ref:n,children:w.isValidElement(d)?w.cloneElement(d,void 0,h):null}))}return m.jsx(e,R(S({},o),{ref:n,children:i}))});return r.displayName=`${t}.Slot`,r}var nb=Ks("Slot");function ku(t){const e=w.forwardRef((r,s)=>{const o=r,{children:n}=o,i=V(o,["children"]);if(w.isValidElement(n)){const a=Cu(n),l=Ru(i,n.props);return n.type!==w.Fragment&&(l.ref=s?Fa(s,a):a),w.cloneElement(n,l)}return w.Children.count(n)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ha=Symbol("radix.slottable");function Tu(t){const e=({children:r})=>m.jsx(m.Fragment,{children:r});return e.displayName=`${t}.Slottable`,e.__radixId=Ha,e}function Au(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ha}function Ru(t,e){const r=S({},e);for(const s in e){const n=t[s],i=e[s];/^on[A-Z]/.test(s)?n&&i?r[s]=(...a)=>{const l=i(...a);return n(...a),l}:n&&(r[s]=n):s==="style"?r[s]=S(S({},n),i):s==="className"&&(r[s]=[n,i].filter(Boolean).join(" "))}return S(S({},t),r)}function Cu(t){var s,n;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(n=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.
2isReactWarning,r?t.props.ref:t.props.ref||t.ref)}function Ou(t){const e=t+"CollectionProvider",[r,s]=un(e),[n,i]=r(e,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:v,children:b}=g,x=O.useRef(null),_=O.useRef(new Map).current;return m.jsx(n,{scope:v,itemMap:_,collectionRef:x,children:b})};o.displayName=e;const a=t+"CollectionSlot",l=Ks(a),c=O.forwardRef((g,v)=>{const{scope:b,children:x}=g,_=i(a,b),E=Ye(v,_.collectionRef);return m.jsx(l,{ref:E,children:x})});c.displayName=a;const d=t+"CollectionItemSlot",h="data-radix-collection-item",p=Ks(d),u=O.forwardRef((g,v)=>{const C=g,{scope:b,children:x}=C,_=V(C,["scope","children"]),E=O.useRef(null),T=Ye(v,E),k=i(d,b);return O.useEffect(()=>(k.itemMap.set(E,S({ref:E},_)),()=>void k.itemMap.delete(E))),m.jsx(p,{[h]:"",ref:T,children:x})});u.displayName=d;function y(g){const v=i(t+"CollectionConsumer",g);return O.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const _=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((k,C)=>_.indexOf(k.ref.current)-_.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:c,ItemSlot:u},y,s]}var Pu=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ce=Pu.reduce((t,e)=>{const r=Ks(`Primitive.${e}`),s=w.forwardRef((n,i)=>{const c=n,{asChild:o}=c,a=V(c,["asChild"]),l=o?r:e;return typeof window!="undefined"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(l,R(S({},a),{ref:i}))});return s.displayName=`Primitive.${e}`,R(S({},t),{[e]:s})},{});function Wa(t,e){t&&cn.flushSync(()=>t.dispatchEvent(e))}function Lt(t){const e=w.useRef(t);return w.useEffect(()=>{e.current=t}),w.useMemo(()=>(...r)=>{var s;return(s=e.current)==null?void 0:s.call(e,...r)},[])}function ju(t,e=globalThis==null?void 0:globalThis.document){const r=Lt(t);w.useEffect(()=>{const s=n=>{n.key==="Escape"&&r(n)};return e.addEventListener("keydown",s,{capture:!0}),()=>e.removeEventListener("keydown",s,{capture:!0})},[r,e])}var Iu="DismissableLayer",qn="dismissableLayer.update",Nu="dismissableLayer.pointerDownOutside",$u="dismissableLayer.focusOutside",Qi,Va=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yi=w.forwardRef((t,e)=>{var M;const C=t,{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:s,onPointerDownOutside:n,onFocusOutside:i,onInteractOutside:o,onDismiss:a}=C,l=V(C,["disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss"]),c=w.useContext(Va),[d,h]=w.useState(null),p=(M=d==null?void 0:d.ownerDocument)!=null?M:globalThis==null?void 0:globalThis.document,[,u]=w.useState({}),y=Ye(e,I=>h(I)),g=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(v),x=d?g.indexOf(d):-1,_=c.layersWithOutsidePointerEventsDisabled.size>0,E=x>=b,T=Du(I=>{const L=I.target,B=[...c.branches].some(N=>N.contains(L));!E||B||(n==null||n(I),o==null||o(I),I.defaultPrevented||a==null||a())},p),k=Uu(I=>{const L=I.target;[...c.branches].some(N=>N.contains(L))||(i==null||i(I),o==null||o(I),I.defaultPrevented||a==null||a())},p);return ju(I=>{x===c.layers.size-1&&(s==null||s(I),!I.defaultPrevented&&a&&(I.preventDefault(),a()))},p),w.useEffect(()=>{if(d)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Qi=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),Xi(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Qi)}},[d,p,r,c]),w.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),Xi())},[d,c]),w.useEffect(()=>{const I=()=>u({});return document.addEventListener(qn,I),()=>document.removeEventListener(qn,I)},[]),m.jsx(Ce.div,R(S({},l),{ref:y,style:S({pointerEvents:_?E?"auto":"none":void 0},t.style),onFocusCapture:me(t.onFocusCapture,k.onFocusCapture),onBlurCapture:me(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:me(t.onPointerDownCapture,T.onPointerDownCapture)}))});yi.displayName=Iu;var Lu="DismissableLayerBranch",za=w.forwardRef((t,e)=>{const r=w.useContext(Va),s=w.useRef(null),n=Ye(e,s);return w.useEffect(()=>{const i=s.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),m.jsx(Ce.div,R(S({},t),{ref:n}))});za.displayName=Lu;function Du(t,e=globalThis==null?void 0:globalThis.document){const r=Lt(t),s=w.useRef(!1),n=w.useRef(()=>{});return w.useEffect(()=>{const i=a=>
vendor: 4,799 bytes, line 2
2{if(a.target&&!s.current){let l=function(){qa(Nu,r,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",n.current),n.current=l,e.addEventListener("click",n.current,{once:!0})):l()}else e.removeEventListener("click",n.current);s.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",n.current)}},[e,r]),{onPointerDownCapture:()=>s.current=!0}}function Uu(t,e=globalThis==null?void 0:globalThis.document){const r=Lt(t),s=w.useRef(!1);return w.useEffect(()=>{const n=i=>{i.target&&!s.current&&qa($u,r,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",n),()=>e.removeEventListener("focusin",n)},[e,r]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Xi(){const t=new CustomEvent(qn);document.dispatchEvent(t)}function qa(t,e,r,{discrete:s}){const n=r.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),s?Wa(n,i):n.dispatchEvent(i)}var Mu=yi,Bu=za,Dt=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},Fu="Portal",Ka=w.forwardRef((t,e)=>{var l;const a=t,{container:r}=a,s=V(a,["container"]),[n,i]=w.useState(!1);Dt(()=>i(!0),[]);const o=r||n&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?qs.createPortal(m.jsx(Ce.div,R(S({},s),{ref:e})),o):null});Ka.displayName=Fu;function Hu(t,e){return w.useReducer((r,s)=>{const n=e[r][s];return n!=null?n:r},t)}var vi=t=>{const{present:e,children:r}=t,s=Wu(e),n=typeof r=="function"?r({present:s.isPresent}):w.Children.only(r),i=Ye(s.ref,Vu(n));return typeof r=="function"||s.isPresent?w.cloneElement(n,{ref:i}):null};vi.displayName="Presence";function Wu(t){const[e,r]=w.useState(),s=w.useRef(null),n=w.useRef(t),i=w.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Hu(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=ks(s.current);i.current=a==="mounted"?c:"none"},[a]),Dt(()=>{const c=s.current,d=n.current;if(d!==t){const p=i.current,u=ks(c);t?l("MOUNT"):u==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&p!==u?"ANIMATION_OUT":"UNMOUNT"),n.current=t}},[t,l]),Dt(()=>{var c;if(e){let d;const h=(c=e.ownerDocument.defaultView)!=null?c:window,p=y=>{const v=ks(s.current).includes(y.animationName);if(y.target===e&&v&&(l("ANIMATION_END"),!n.current)){const b=e.style.animationFillMode;e.style.animationFillMode="forwards",d=h.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=b)})}},u=y=>{y.target===e&&(i.current=ks(s.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",p),e.addEventListener("animationend",p),()=>{h.clearTimeout(d),e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",p),e.removeEventListener("animationend",p)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(c=>{s.current=c?getComputedStyle(c):null,r(c)},[])}}function ks(t){return(t==null?void 0:t.animationName)||"none"}function Vu(t){var s,n;let e=(s=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:s.get,r=e&&"isReactWarning"in e&&e.isReactWarning;return r?t.ref:(e=(n=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:n.get,r=e&&"isReactWarning"in e&&e.isReactWarning,r?t.props.ref:t.props.ref||t.ref)}var zu=fu[" useInsertionEffect ".trim().toString()]||Dt;function qu({prop:t,defaultProp:e,onChange:r=()=>{},caller:s}){const[n,i,o]=Ku({defaultProp:e,onChange:r}),a=t!==void 0,l=a?t:n;{const d=w.useRef(t!==void 0);w.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${s} is changing from ${h?"controlled":"uncontrolled"} to ${a?"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.`),d.current=a},[a,s])}const c=w.useCallback(d=>{var h;if(a){const p=Gu(d)?d(t):d;p!==t&&((h=o.current)==null||h.call(o,p))}else i(d)},[a,t,i,o]);return[l,c]}function Ku({defaultProp:t,onChange:e}){const[r,s]=w.useState(t),n=w.useRef(r),i=w.useRef(e);return zu(()=>{i.current=e},[e]),w.useEffect(()=>{var o;n.current!==r&&((o=i.current)==null||o.call(i,r),n.current=r)},[r,n]),[r,s,i]}function Gu(t){return typeof t=="function"}var Ju=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"}),Yu="VisuallyHidden",dn=w.forwardRef((t,e)=>m.jsx(Ce.span,R(S({},t),{ref:e,style:S(S({},Ju),t.style)}
2)));dn.displayName=Yu;var Qu=dn,bi="ToastProvider",[wi,Xu,Zu]=Ou("Toast"),[Ga]=un("Toast",[Zu]),[ed,hn]=Ga(bi),Ja=t=>{const{__scopeToast:e,label:r="Notification",duration:s=5e3,swipeDirection:n="right",swipeThreshold:i=50,children:o}=t,[a,l]=w.useState(null),[c,d]=w.useState(0),h=w.useRef(!1),p=w.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${bi}\`. Expected non-empty \`string\`.`),m.jsx(wi.Provider,{scope:e,children:m.jsx(ed,{scope:e,label:r,duration:s,swipeDirection:n,swipeThreshold:i,toastCount:c,viewport:a,onViewportChange:l,onToastAdd:w.useCallback(()=>d(u=>u+1),[]),onToastRemove:w.useCallback(()=>d(u=>u-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:p,children:o})})};Ja.displayName=bi;var Ya="ToastViewport",td=["F8"],Kn="toast.viewportPause",Gn="toast.viewportResume",Qa=w.forwardRef((t,e)=>{const v=t,{__scopeToast:r,hotkey:s=td,label:n="Notifications ({hotkey})"}=v,i=V(v,["__scopeToast","hotkey","label"]),o=hn(Ya,r),a=Xu(r),l=w.useRef(null),c=w.useRef(null),d=w.useRef(null),h=w.useRef(null),p=Ye(e,h,o.onViewportChange),u=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=o.toastCount>0;w.useEffect(()=>{const b=x=>{var E;s.length!==0&&s.every(T=>x[T]||x.code===T)&&((E=h.current)==null||E.focus())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]),w.useEffect(()=>{const b=l.current,x=h.current;if(y&&b&&x){const _=()=>{if(!o.isClosePausedRef.current){const C=new CustomEvent(Kn);x.dispatchEvent(C),o.isClosePausedRef.current=!0}},E=()=>{if(o.isClosePausedRef.current){const C=new CustomEvent(Gn);x.dispatchEvent(C),o.isClosePausedRef.current=!1}},T=C=>{!b.contains(C.relatedTarget)&&E()},k=()=>{b.contains(document.activeElement)||E()};return b.addEventListener("focusin",_),b.addEventListener("focusout",T),b.addEventListener("pointermove",_),b.addEventListener("pointerleave",k),window.addEventListener("blur",_),window.addEventListener("focus",E),()=>{b.removeEventListener("focusin",_),b.removeEventListener("focusout",T),b.removeEventListener("pointermove",_),b.removeEventListener("pointerleave",k),window.removeEventListener("blur",_),window.removeEventListener("focus",E)}}},[y,o.isClosePausedRef]);const g=w.useCallback(({tabbingDirection:b})=>{const _=a().map(E=>{const T=E.ref.current,k=[T,...pd(T)];return b==="forwards"?k:k.reverse()});return(b==="forwards"?_.reverse():_).flat()},[a]);return w.useEffect(()=>{const b=h.current;if(b){const x=_=>{var k,C,M;const E=_.altKey||_.ctrlKey||_.metaKey;if(_.key==="Tab"&&!E){const I=document.activeElement,L=_.shiftKey;if(_.target===b&&L){(k=c.current)==null||k.focus();return}const z=g({tabbingDirection:L?"backwards":"forwards"}),Y=z.findIndex(D=>D===I);In(z.slice(Y+1))?_.preventDefault():L?(C=c.current)==null||C.focus():(M=d.current)==null||M.focus()}};return b.addEventListener("keydown",x),()=>b.removeEventListener("keydown",x)}},[a,g]),m.jsxs(Bu,{ref:l,role:"region","aria-label":n.replace("{hotkey}",u),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&m.jsx(Jn,{ref:c,onFocusFromOutsideViewport:()=>{const b=g({tabbingDirection:"forwards"});In(b)}}),m.jsx(wi.Slot,{scope:r,children:m.jsx(Ce.ol,R(S({tabIndex:-1},i),{ref:p}))}),y&&m.jsx(Jn,{ref:d,onFocusFromOutsideViewport:()=>{const b=g({tabbingDirection:"backwards"});In(b)}})]})});Qa.displayName=Ya;var Xa="ToastFocusProxy",Jn=w.forwardRef((t,e)=>{const o=t,{__scopeToast:r,onFocusFromOutsideViewport:s}=o,n=V(o,["__scopeToast","onFocusFromOutsideViewport"]),i=hn(Xa,r);return m.jsx(dn,R(S({"aria-hidden":!0,tabIndex:0},n),{ref:e,style:{position:"fixed"},onFocus:a=>{var d;const l=a.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&s()}}))});Jn.displayName=Xa;var gs="Toast",rd="toast.swipeStart",sd="toast.swipeMove",nd="toast.swipeCancel",id="toast.swipeEnd",Za=w.forwardRef((t,e)=>{const c=t,{forceMount:r,open:s,defaultOpen:n,onOpenChange:i}=c,o=V(c,["forceMount","open","defaultOpen","onOpenChange"]),[a,l]=qu({prop:s,defaultProp:n!=null?n:!0,onChange:i,caller:gs});return m.jsx(vi,{present:r||a,children:m.jsx(ld,R(S({open:a},o),{ref:e,onClose:()=>l(!1),onPause:Lt(t.onPause),onResume:Lt(t.onResume),onSwipeStart:me(t.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:me(t.onSwipeMove,d=>{const{x:h,y:p}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:me(t.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:me(t.onSwipeEnd,d=>{const{x:h,y:p}=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",`${h}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),l(!1)})}))})});Za.displayName=gs;var[od,ad]=Ga(gs,{onClose(){}}),ld=w.forwardRef((t,e)=>{const Y=t,{__scopeToast:r,type:s="foreground",duration:n,open:i,onClose:o,onEscapeKeyDown:a,onPause:l,onResume:c,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:p,onSwipeEnd:u}=Y,y=V(Y,["__scopeToast","type","duration","open","onClose","onEscapeKeyDown","onPause","onResume","onSwipeStart","onSwipeMove","onSwipeCancel","onSwipeEnd"]),g=hn(gs,r),[v,b]=w.useState(null),x=Ye(e,D=>b(D)),_=w.useRef(null),E=w.useRef(null),T=n||g.duration,k=w.useRef(0),C=w.useRef(T),M=w.useRef(0),{onToastAdd:I,onToastRemove:L}=g,B=Lt(()=>{var H;(v==null?void 0:v.contains(document.activeElement))&&((H=g.viewport)==null||H.focus()),o()}),N=w.useCallback(D=>
2{!D||D===1/0||(window.clearTimeout(M.current),k.current=new Date().getTime(),M.current=window.setTimeout(B,D))},[B]);w.useEffect(()=>{const D=g.viewport;if(D){const H=()=>{N(C.current),c==null||c()},Q=()=>{const W=new Date().getTime()-k.current;C.current=C.current-W,window.clearTimeout(M.current),l==null||l()};return D.addEventListener(Kn,Q),D.addEventListener(Gn,H),()=>{D.removeEventListener(Kn,Q),D.removeEventListener(Gn,H)}}},[g.viewport,T,l,c,N]),w.useEffect(()=>{i&&!g.isClosePausedRef.current&&N(T)},[i,T,g.isClosePausedRef,N]),w.useEffect(()=>(I(),()=>L()),[I,L]);const z=w.useMemo(()=>v?ol(v):null,[v]);return g.viewport?m.jsxs(m.Fragment,{children:[z&&m.jsx(cd,{__scopeToast:r,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:z}),m.jsx(od,{scope:r,onClose:B,children:cn.createPortal(m.jsx(wi.ItemSlot,{scope:r,children:m.jsx(Mu,{asChild:!0,onEscapeKeyDown:me(a,()=>{g.isFocusedToastEscapeKeyDownRef.current||B(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:m.jsx(Ce.li,R(S({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":g.swipeDirection},y),{ref:x,style:S({userSelect:"none",touchAction:"none"},t.style),onKeyDown:me(t.onKeyDown,D=>{D.key==="Escape"&&(a==null||a(D.nativeEvent),D.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,B()))}),onPointerDown:me(t.onPointerDown,D=>{D.button===0&&(_.current={x:D.clientX,y:D.clientY})}),onPointerMove:me(t.onPointerMove,D=>{if(!_.current)return;const H=D.clientX-_.current.x,Q=D.clientY-_.current.y,W=!!E.current,$=["left","right"].includes(g.swipeDirection),q=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,te=$?q(0,H):0,Z=$?0:q(0,Q),ee=D.pointerType==="touch"?10:2,re={x:te,y:Z},he={originalEvent:D,delta:re};W?(E.current=re,Ts(sd,h,he,{discrete:!1})):Zi(re,g.swipeDirection,ee)?(E.current=re,Ts(rd,d,he,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(H)>ee||Math.abs(Q)>ee)&&(_.current=null)}),onPointerUp:me(t.onPointerUp,D=>{const H=E.current,Q=D.target;if(Q.hasPointerCapture(D.pointerId)&&Q.releasePointerCapture(D.pointerId),E.current=null,_.current=null,H){const W=D.currentTarget,$={originalEvent:D,delta:H};Zi(H,g.swipeDirection,g.swipeThreshold)?Ts(id,u,$,{discrete:!0}):Ts(nd,p,$,{discrete:!0}),W.addEventListener("click",q=>q.preventDefault(),{once:!0})}})}))})}),g.viewport)})]}):null}),cd=t=>{const c=t,{__scopeToast:e,children:r}=c,s=V(c,["__scopeToast","children"]),n=hn(gs,e),[i,o]=w.useState(!1),[a,l]=w.useState(!1);return hd(()=>o(!0)),w.useEffect(()=>{const d=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(d)},[]),a?null:m.jsx(Ka,{asChild:!0,children:m.jsx(dn,R(S({},s),{children:i&&m.jsxs(m.Fragment,{children:[n.label," ",r]})}))})},ud="ToastTitle",el=w.forwardRef((t,e)=>{const n=t,{__scopeToast:r}=n,s=V(n,["__scopeToast"]);return m.jsx(Ce.div,R(S({},s),{ref:e}))});el.displayName=ud;var dd="ToastDescription",tl=w.forwardRef((t,e)=>{const n=t,{__scopeToast:r}=n,s=V(n,["__scopeToast"]);return m.jsx(Ce.div,R(S({},s),{ref:e}))});tl.displayName=dd;var rl="ToastAction",sl=w.forwardRef((t,e)=>{const n=t,{altText:r}=n,s=V(n,["altText"]);return r.trim()?m.jsx(il,{altText:r,asChild:!0,children:m.jsx(_i,R(S({},s),{ref:e}))}):(console.error(`Invalid prop \`altText\` supplied to \`${rl}\`. Expected non-empty \`string\`.`),null)});sl.displayName=rl;var nl="ToastClose",_i=w.forwardRef((t,e)=>{const i=t,{__scopeToast:r}=i,s=V(i,["__scopeToast"]),n=ad(nl,r);return m.jsx(il,{asChild:!0,children:m.jsx(Ce.button,R(S({type:"button"},s),{ref:e,onClick:me(t.onClick,n.onClose)}))})});_i.displayName=nl;var il=w.forwardRef((t,e)=>{const i=t,{__scopeToast:r,altText:s}=i,n=V(i,["__scopeToast","altText"]);return m.jsx(Ce.div,R(S({"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0},n),{ref:e}))});function ol(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),fd(s)){const n=s.ariaHidden||s.hidden||s.style.display==="none",i=s.dataset.radixToastAnnounceExclude==="";if(!n)if(i){const o=s.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...ol(s))}}),e}function Ts(t,e,r,{discrete:s}){const n=r.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r});e&&n.addEventListener(t,e,{once:!0}),s?Wa(n,i):n.dispatchEvent(i)}var Zi=(t,e,r=0)=>{const s=Math.abs(t.x),n=Math.abs(t.y),i=s>n;return e==="left"||e==="right"?i&&s>r:!i&&n>r};function hd(t=()=>{}){const e=Lt(t);Dt(()=>{let r=0,s=0;return r=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(s)}},[e])}function fd(t){return t.nodeType===t.ELEMENT_NODE}function pd(t){const e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const n=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||n?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)e.push(r.currentNode);return e}function In(t){const e=document.activeElement;return t.some(r=>r===e?!0:(r.focus(),document.activeElement!==e))}var gd=Ja,al=Qa,ll=Za,cl=el,ul=tl,dl=sl,hl=_i;function fl(t){var e,r,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(e=0;e<n;e++)t[e]&&(r=fl(t[e]))&&(s&&(s+=" "),s+=r)}else for(r in t)t[r]&&(s&&(s+=" "),s+=r);return s}function pl(){for(var t,e,r=0,s="",n=arguments.length;r<n;r++)(t=arguments[r])&&(e=fl(t))&&(s&&(s+=" "),s+=e);return s}const eo=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,to=pl,md=(t,e)=>r=>{var s;if((e==null?void 0:e.variants)==null)return to(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:i}=e,o=Object.keys(n).map(c=>{const d=r==null?void 0:r[c],h=i==null?void 0:i[c];if(d===null)return null;const p=eo(d)||eo(h);return n[c][p]}),a=r&&Object.entries(r).reduce((c,d)=>{let[h,p]=d;return p===void 0||(c[h]=p),c},{}),l=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((c,d)=>{let y=d,{class:h,className:p}=y,u=V(y,["class","className"]);return Object.entries(u).every(g=>{let[v,b]=g;return Array.isArray(b)?b.includes(S(S({},i),a)[v]):S(S({},i),a)[v]===b})?[...c,h,p]:c},[]);return to(t,o,l,r==null?void 0:r.class,r==null?void 0:r.className)};/**
3 * @license lucide-react v0.462.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const yd=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gl=(...t)=>t.filter((e,r,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===r).join(" ").trim();/**
8 * @license lucide-react v0.462.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */var vd={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"};/**
13 * @license lucide-react v0.462.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const bd=w.forwardRef((c,l)=>{var d=c,{color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:n="",children:i,iconNode:o}=d,a=V(d,["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"]);return w.createElement("svg",S(R(S({ref:l},vd),{width:e,height:e,stroke:t,strokeWidth:s?Number(r)*24/Number(e):r,className:gl("lucide",n)}),a),[...o.map(([h,p])=>w.createElement(h,p)),...Array.isArray(i)?i:[i]])});/**
18 * @license lucide-react v0.462.0 - ISC
19 *
20 * This source code is licensed under the ISC license.
21 * See the LICENSE file in the root directory of this source tree.
22 */const _t=(t,e)=>{const r=w.forwardRef((o,i)=>{var a=o,{className:s}=a,n=V(a,["className"]);return w.createElement(bd,S({ref:i,iconNode:e,className:gl(`lucide-${yd(t)}`,s)},n))});return r.displayName=`${t}`,r};/**
23 * @license lucide-react v0.462.0 - ISC
24 *
25 * This source code is licensed under the ISC license.
26 * See the LICENSE file in the root directory of this source tree.
27 */const wd=_t("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
28 * @license lucide-react v0.462.0 - ISC
29 *
30 * This source code is licensed under the ISC license.
31 * See the LICENSE file in the root directory of this source tree.
32 */const _d=_t("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
33 * @license lucide-react v0.462.0 - ISC
34 *
35 * This source code is licensed under the ISC license.
36 * See the LICENSE file in the root directory of this source tree.
37 */const xd=_t("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
38 * @license lucide-react v0.462.0 - ISC
39 *
40 * This source code is licensed under the ISC license.
41 * See the LICENSE file in the root directory of this source tree.
42 */const Sd=_t("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
43 * @license lucide-react v0.462.0 - ISC
44 *
45 * This source code is licensed under the ISC license.
46 * See the LICENSE file in the root directory of this source tree.
47 */const Gr=_t("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
48 * @license lucide-react v0.462.0 - ISC
49 *
50 * This source code is licensed under the ISC license.
51 * See the LICENSE file in the root directory of this source tree.
52 */const ro=_t("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"}]]);/**
53 * @license lucide-react v0.462.0 - ISC
54 *
55 * This source code is licensed under the ISC license.
56 * See the LICENSE file in the root directory of this source tree.
57 */const ml=_t("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
58 * @license lucide-react v0.462.0 - ISC
59 *
60 * This source code is licensed under the ISC license.
61 * See the LICENSE file in the root directory of this source tree.
62 */const Ed=_t("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
vendor: 6,147 bytes, lines 62-67
62y:"oel41y"}]]);/**
63 * @license lucide-react v0.462.0 - ISC
64 *
65 * This source code is licensed under the ISC license.
66 * See the LICENSE file in the root directory of this source tree.
67 */const kd=_t("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),xi="-",Td=t=>{const e=Rd(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:o=>{const a=o.split(xi);return a[0]===""&&a.length!==1&&a.shift(),yl(a,e)||Ad(o)},getConflictingClassGroupIds:(o,a)=>{const l=r[o]||[];return a&&s[o]?[...l,...s[o]]:l}}},yl=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const r=t[0],s=e.nextPart.get(r),n=s?yl(t.slice(1),s):void 0;if(n)return n;if(e.validators.length===0)return;const i=t.join(xi);return(o=e.validators.find(({validator:a})=>a(i)))==null?void 0:o.classGroupId},so=/^\[(.+)\]$/,Ad=t=>{if(so.test(t)){const e=so.exec(t)[1],r=e==null?void 0:e.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},Rd=t=>{const{theme:e,prefix:r}=t,s={nextPart:new Map,validators:[]};return Od(Object.entries(t.classGroups),r).forEach(([i,o])=>{Yn(o,s,i,e)}),s},Yn=(t,e,r,s)=>{t.forEach(n=>{if(typeof n=="string"){const i=n===""?e:no(e,n);i.classGroupId=r;return}if(typeof n=="function"){if(Cd(n)){Yn(n(s),e,r,s);return}e.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([i,o])=>{Yn(o,no(e,i),r,s)})})},no=(t,e)=>{let r=t;return e.split(xi).forEach(s=>{r.nextPart.has(s)||r.nextPart.set(s,{nextPart:new Map,validators:[]}),r=r.nextPart.get(s)}),r},Cd=t=>t.isThemeGetter,Od=(t,e)=>e?t.map(([r,s])=>{const n=s.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,a])=>[e+o,a])):i);return[r,n]}):t,Pd=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=new Map,s=new Map;const n=(i,o)=>{r.set(i,o),e++,e>t&&(e=0,s=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=s.get(i))!==void 0)return n(i,o),o},set(i,o){r.has(i)?r.set(i,o):n(i,o)}}},vl="!",jd=t=>{const{separator:e,experimentalParseClassName:r}=t,s=e.length===1,n=e[0],i=e.length,o=a=>{const l=[];let c=0,d=0,h;for(let v=0;v<a.length;v++){let b=a[v];if(c===0){if(b===n&&(s||a.slice(v,v+i)===e)){l.push(a.slice(d,v)),d=v+i;continue}if(b==="/"){h=v;continue}}b==="["?c++:b==="]"&&c--}const p=l.length===0?a:a.substring(d),u=p.startsWith(vl),y=u?p.substring(1):p,g=h&&h>d?h-d:void 0;return{modifiers:l,hasImportantModifier:u,baseClassName:y,maybePostfixModifierPosition:g}};return r?a=>r({className:a,parseClassName:o}):o},Id=t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(s=>{s[0]==="["?(e.push(...r.sort(),s),r=[]):r.push(s)}),e.push(...r.sort()),e},Nd=t=>S({cache:Pd(t.cacheSize),parseClassName:jd(t)},Td(t)),$d=/\s+/,Ld=(t,e)=>{const{parseClassName:r,getClassGroupId:s,getConflictingClassGroupIds:n}=e,i=[],o=t.trim().split($d);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:u}=r(c);let y=!!u,g=s(y?p.substring(0,u):p);if(!g){if(!y){a=c+(a.length>0?" "+a:a);continue}if(g=s(p),!g){a=c+(a.length>0?" "+a:a);continue}y=!1}const v=Id(d).join(":"),b=h?v+vl:v,x=b+g;if(i.includes(x))continue;i.push(x);const _=n(g,y);for(let E=0;E<_.length;++E){const T=_[E];i.push(b+T)}a=c+(a.length>0?" "+a:a)}return a};function Dd(){let t=0,e,r,s="";for(;t<arguments.length;)(e=arguments[t++])&&(r=bl(e))&&(s&&(s+=" "),s+=r);return s}const bl=t=>{if(typeof t=="string")return t;let e,r="";for(let s=0;s<t.length;s++)t[s]&&(e=bl(t[s]))&&(r&&(r+=" "),r+=e);return r};function Ud(t,...e){let r,s,n,i=o;function o(l){const c=e.reduce((d,h)=>h(d),t());return r=Nd(c),s=r.cache.get,n=r.cache.set,i=a,a(l)}function a(l){const c=s(l);if(c)return c;const d=Ld(l,r);return n(l,d),d}return function(){return i(Dd.apply(null,arguments))}}const ce=t=>{const e=r=>r[t]||[];return e.isThemeGetter=!0,e},wl=/^\[(?:([a-z-]+):)?(.+)\]$/i,Md=/^\d+\/\d+$/,Bd=new Set(["px","full","screen"]),Fd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hd=/\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$/,Wd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Vd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ut=t=>vr(t)||Bd.has(t)||Md.test(t),Tt=t=>Lr(t,"length",Zd),vr=t=>!!t&&!Number.isNaN(Number(t)),Nn=t=>Lr(t,"number",vr),Fr=t=>!!t&&Number.isInteger(Number(t)),qd=t=>t.endsWith("%")&&vr(t.slice(0,-1)),J=t=>wl.test(t),At=t=>Fd.test(t),Kd=new Set(["length","size","percentage"]),Gd=t=>Lr(t,Kd,_l),Jd=t=>Lr(t,"position",_l),Yd=new Set(["image","url"]),Qd=t=>Lr(t,Yd,th),Xd=t=>Lr(t,"",eh),Hr=()=>!0,Lr=(t,e,r)=>{const s=wl.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):r(s[2]):!1},Zd=t=>Hd.test(t)&&!Wd.test(t),_l=()=>!1,eh=t=>Vd.test(t),th=t=>zd.test(t),rh=()=>{const t=ce("colors"),e=ce("spacing"),r=ce("blur"),s=ce("brightness"),n=ce("borderColor"),i=ce("borderRadius"),o=ce("borderSpacing"),a=ce("borderWidth"),l=ce("contrast"),c=ce("grayscale"),d=ce("hueRotate"),h=ce("invert"),p=ce("gap"),u=ce("gradientColorStops"),y=ce("gradientColorStopPositions"),g=ce("inset"),v=ce("margin"),b=ce("opacity"),x=ce("padding"),_=ce("saturate"),E=ce("scale"),T=ce("sepia"),k=ce("skew"),C=ce("space"),M=ce("translate"),I=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",J,e],N=()=>[J,e],z=()=>["",ut,Tt],Y=()=>["auto",vr,J],D=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",J],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],te=()=>[vr,J];return{cacheSize:500,separator:":",theme:{colors:[Hr],spacing:[ut,Tt],blur:["none","",At,J],brightness:te(),borderColor:[t],borderRadius:["n
67one","","full",At,J],borderSpacing:N(),borderWidth:z(),contrast:te(),grayscale:$(),hueRotate:te(),invert:$(),gap:N(),gradientColorStops:[t],gradientColorStopPositions:[qd,Tt],inset:B(),margin:B(),opacity:te(),padding:N(),saturate:te(),scale:te(),sepia:$(),skew:te(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",J]}],container:["container"],columns:[{columns:[At]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"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:[...D(),J]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Fr,J]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",J]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",Fr,J]}],"grid-cols":[{"grid-cols":[Hr]}],"col-start-end":[{col:["auto",{span:["full",Fr,J]},J]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[Hr]}],"row-start-end":[{row:["auto",{span:[Fr,J]},J]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",J]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",J]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...W()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...W(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...W(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}
vendor: 8,319 bytes, line 67
67],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",J,e]}],"min-w":[{"min-w":[J,e,"min","max","fit"]}],"max-w":[{"max-w":[J,e,"none","full","min","max","fit","prose",{screen:[At]},At]}],h:[{h:[J,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[J,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[J,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[J,e,"auto","min","max","fit"]}],"font-size":[{text:["base",At,Tt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Nn]}],"font-family":[{font:[Hr]}],"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",J]}],"line-clamp":[{"line-clamp":["none",vr,Nn]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ut,J]}],"list-image":[{"list-image":["none",J]}],"list-style-type":[{list:["none","disc","decimal",J]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ut,Tt]}],"underline-offset":[{"underline-offset":["auto",ut,J]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",J]}],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",J]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...D(),Jd]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Gd]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Qd]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[u]}],"gradient-via":[{via:[u]}],"gradient-to":[{to:[u]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...H(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:H()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...H()]}],"outline-offset":[{"outline-offset":[ut,J]}],"outline-w":[{outline:[ut,Tt]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ut,Tt]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",At,Xd]}],"shadow-color":[{shadow:[Hr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[s]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",At,J]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[_]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[_]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",J]}],duration:[{duration:te()}],ease:[{ease:["linear","in","out","in-out",J]}],delay:[{delay:te()}],animate:[{animate:["none","spin","ping","pulse","bounce",J]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Fr,J]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",J]}],accent:[{accent:["auto",t]}],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",J]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"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"]}
67],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",J]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ut,Tt,Nn]}],stroke:[{stroke:[t,"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"]}}},sh=Ud(rh);function ir(...t){return sh(pl(t))}function ib(t){return t.toLowerCase().replace(/(?:^|\s|[-/])\S/g,e=>e.toUpperCase())}function ob(t,e=280){if(!t)return"";let r=String(t);return r=r.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/gi,""),r=r.replace(/<\/(p|div|h[1-6]|li|br)>/gi,`
68`),r=r.replace(/<br\s*\/?>/gi,`
69`),r=r.replace(/<[^>]+>/g,""),r=r.replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),r=r.replace(/^#{1,6}\s+/gm,""),r=r.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1"),r=r.replace(/__([^_]+)__/g,"$1").replace(/_([^_]+)_/g,"$1"),r=r.replace(/`([^`]+)`/g,"$1"),r=r.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),r=r.replace(/^[-*+]\s+/gm,""),r=r.replace(/\s+/g," ").trim(),r.length>e&&(r=r.slice(0,e).trimEnd()+"…"),r}function nh(t){if(!t)return"";let e=t;return e=e.replace(/\s+style\s*=\s*"[^"]*"/gi,""),e=e.replace(/\s+style\s*=\s*'[^']*'/gi,""),e=e.replace(/\s+class\s*=\s*"([^"]*)"/gi,(r,s)=>/\bsv-(video-wrap|yt-iframe)\b/.test(s)?` class="${s}"`:""),e=e.replace(/\s+class\s*=\s*'([^']*)'/gi,(r,s)=>/\bsv-(video-wrap|yt-iframe)\b/.test(s)?` class='${s}'`:""),e=e.replace(/\s+data-(start|end|pm-slice|placeholder)="[^"]*"/gi,""),e}const xl=/\.(mov|mp4|webm|m4v|avi)(\?[^"'\s]*)?$/i,Sl=/\.(mov|mp4|webm|m4v|avi)$/i,ih=/(?:youtu\.be\/|youtube\.com\/(?:watch\?v=|embed\/|shorts\/))([a-zA-Z0-9_-]{11})/;function Fs(t){const e=t.match(ih);return e?e[1]:null}function ab(t){if(!t)return null;const e=[...t.matchAll(/<a\s+[^>]*href="([^"]+)"[^>]*>([\s\S]*?)<\/a>/gi)];for(const i of e){const[,o,a]=i,l=a.replace(/<[^>]+>/g,"").trim();if(xl.test(o)||Sl.test(l)||Fs(o))return o}const r=[...t.matchAll(/<iframe\s+[^>]*src="([^"]+)"[^>]*>/gi)];for(const i of r){const o=i[1];if(Fs(o))return o}const s=t.match(/https?:\/\/(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:watch\?v=|embed\/|shorts\/))[a-zA-Z0-9_\-?=&%.]+/i);if(s&&Fs(s[0]))return s[0];const n=t.match(/https?:\/\/[^\s<>
69"']+\.(?:mov|mp4|webm|m4v|avi)(?:\?[^\s<>"']*)?/i);return n?n[0]:null}function io(t){const e=Fs(t);return e?{id:e,embedUrl:`https://www.youtube.com/embed/${e}?rel=0&modestbranding=1`,thumbnail:`https://img.youtube.com/vi/${e}/hqdefault.jpg`}:null}function oo(t){return t.includes("#")?t:`${t}#t=0.5`}function oh(t){let e=t.replace(/<a\s+([^>]*href="([^"]+)")([^>]*)>([\s\S]*?)<\/a>/gi,(r,s,n,i,o)=>{const a=o.replace(/<[^>]+>/g,"").trim();if(xl.test(n)||Sl.test(a))return`<div class="sv-video-wrap"><video src="${oo(n)}" controls playsinline preload="auto"></video></div>`;const l=io(n);return l?`<div class="sv-video-wrap"><iframe src="${l.embedUrl}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen class="sv-yt-iframe"></iframe></div>`:r});return e=e.replace(new RegExp(`(?<!["'=])(https?:\\/\\/[^\\s<>"]+\\.(mov|mp4|webm|m4v|avi)(\\?[^\\s<>"]*)?)`,"gi"),r=>`<div class="sv-video-wrap"><video src="${oo(r)}" controls playsinline preload="auto"></video></div>`),e=e.replace(new RegExp(`(?<!["'=])(https?:\\/\\/(?:youtu\\.be\\/|(?:www\\.)?youtube\\.com\\/(?:watch\\?v=|embed\\/|shorts\\/))([a-zA-Z0-9_-]{11})[^\\s<>"]*)`,"gi"),r=>{const s=io(r);return s?`<div class="sv-video-wrap"><iframe src="${s.embedUrl}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen class="sv-yt-iframe"></iframe></div>`:r}),e=e.replace(/<a\s+([^>]*href="(https?:\/\/[^"]+)"[^>]*)>/gi,(r,s,n)=>{try{if(new URL(n).pathname.startsWith("/membros/post/"))return r}catch(o){}return/data-external/i.test(s)?r:`<a ${s.replace(/\s*target\s*=\s*"[^"]*"/gi,"").replace(/\s*rel\s*=\s*"[^"]*"/gi,"").trim()} target="_blank" rel="noopener noreferrer" data-external="true">`}),e}function lb(t){try{const r=new URL(t,"https://dummy.com").pathname.match(/\/(?:membros\/)?post\/([0-9a-f-]{36})/i);return r?r[1]:null}catch(e){const r=t.match(/\/(?:membros\/)?post\/([0-9a-f-]{36})/i);return r?r[1]:null}}function cb(t){if(!t)return"";const e=/<(br|p|div|h[1-6]|ul|ol|li|a\s|b>|strong|em|i>|blockquote|hr|img\s|span|figure)[^>]*\/?>/i.test(t);let r;return e?r=t:(r=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),r=r.replace(/^---$/gm,"<hr/>"),r=r.replace(/^### (.+)$/gm,"<h3>$1</h3>"),r=r.replace(/^## (.+)$/gm,"<h2>$1</h2>"),r=r.replace(/^# (.+)$/gm,"<h1>$1</h1>"),r=r.replace(/^&gt; (.+)$/gm,"<blockquote>$1</blockquote>"),r=r.replace(/^- (.+)$/gm,"<li>$1</li>"),r=r.replace(/((?:<li>.*<\/li>\n?)+)/g,"<ul>$1</ul>"),r=r.replace(/\*\*\*(.+?)\*\*\*/g,"<b><i>$1</i></b>"),r=r.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),r=r.replace(new RegExp("(?<!\\w)_(.+?)_(?!\\w)","g"),"<em>$1</em>"),r=r.replace(new RegExp("(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)","g"),"<em>$1</em>"),r=r.replace(/`([^`]+)`/g,"<code>$1</code>"),r=r.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),r=r.replace(/\n/g,"<br>")),r=r.replace(new RegExp(`(<a\\b[^>]*>[\\s\\S]*?<\\/a>)|(?<!["'=])(https?:\\/\\/[^\\s<>"']+)`,"gi"),(s,n,i)=>{if(n)return n;if(/youtu\.be\/|youtube\.com\/(?:watch|embed|shorts)|\.(?:mov|mp4|webm|m4v|avi)(?:\?|$)/i.test(i))return i;const o=i.match(/[).,;:!?]+$/),a=o?i.slice(0,-o[0].length):i,l=o?o[0]:"";return`<a href="${a}">${a}</a>${l}`}),nh(oh(r))}const ah=gd,El=w.forwardRef((s,r)=>{var n=s,{className:t}=n,e=V(n,["className"]);return m.jsx(al,S({ref:r,className:ir("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]",t)},e))});El.displayName=al.displayName;const lh=md("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"}}),kl=w.forwardRef((n,s)=>{var i=n,{className:t,variant:e}=i,r=V(i,["className","variant"]);return m.jsx(ll,S({ref:s,className:ir(lh({variant:e}),t)},r))});kl.displayName=ll.displayName;const ch=w.forwardRef((s,r)=>{var n=s,{className:t}=n,e=V(n,["className"]);return m.jsx(dl,S({ref:r,className:ir("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",t)},e))});
69ch.displayName=dl.displayName;const Tl=w.forwardRef((s,r)=>{var n=s,{className:t}=n,e=V(n,["className"]);return m.jsx(hl,R(S({ref:r,className:ir("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",t),"toast-close":""},e),{children:m.jsx(kd,{className:"h-4 w-4"})}))});Tl.displayName=hl.displayName;const Al=w.forwardRef((s,r)=>{var n=s,{className:t}=n,e=V(n,["className"]);return m.jsx(cl,S({ref:r,className:ir("text-sm font-semibold",t)},e))});Al.displayName=cl.displayName;const Rl=w.forwardRef((s,r)=>{var n=s,{className:t}=n,e=V(n,["className"]);return m.jsx(ul,S({ref:r,className:ir("text-sm opacity-90",t)},e))});Rl.displayName=ul.displayName;function ao(){const{toasts:t}=Su();return m.jsxs(ah,{children:[t.map(function(o){var a=o,{id:e,title:r,description:s,action:n}=a,i=V(a,["id","title","description","action"]);return m.jsxs(kl,R(S({},i),{children:[m.jsxs("div",{className:"grid gap-1",children:[r&&m.jsx(Al,{children:r}),s&&m.jsx(Rl,{children:s})]}),n,m.jsx(Tl,{})]}),e)}),m.jsx(El,{})]})}var lo=["light","dark"],uh="(prefers-color-scheme: dark)",dh=w.createContext(void 0),hh={setTheme:t=>{},themes:[]},fh=()=>{var t;return(t=w.useContext(dh))!=null?t:hh};w.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:s,enableColorScheme:n,defaultTheme:i,value:o,attrs:a,nonce:l})=>{let c=i==="system",d=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(y=>`'${y}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,h=n?lo.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",p=(y,g=!1,v=!0)=>{let b=o?o[y]:y,x=g?y+"|| ''":`'${b}'`,_="";return n&&v&&!g&&lo.includes(y)&&(_+=`d.style.colorScheme = '${y}';`),r==="class"?g||b?_+=`c.add(${x})`:_+="null":b&&(_+=`d[s](n,${x})`),_},u=t?`!function(){${d}${p(t)}}()`:s?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${c})){var t='${uh}',m=window.matchMedia(t);if(m.media!==t||m.matches){${p("dark")}}else{${p("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${p(o?"x[e]":"e",!0)}}${c?"":"else{"+p(i,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${p(o?"x[e]":"e",!0)}}else{${p(i,!1,!1)};}${h}}catch(t){}}();`;return w.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:u}})});var ph=t=>{switch(t){case"success":return yh;case"info":return bh;case"warning":return vh;case"error":return wh;default:return null}},gh=Array(12).fill(0),mh=({visible:t,className:e})=>O.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},O.createElement("div",{className:"sonner-spinner"},gh.map((r,s)=>O.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),yh=O.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},O.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"})),vh=O.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},O.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"})),bh=O.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},O.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"})),wh=O.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},O.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"})),_h=O.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"},O.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),O.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),xh=()=>{let[t,e]=O.useState(document.hidden);return O.useEffect(()=>{let r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},Qn=1,Sh=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>
69{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let a=t,{message:r}=a,s=V(a,["message"]),n=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:Qn++,i=this.toasts.find(l=>l.id===n),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(n)&&this.dismissedToasts.delete(n),i?this.toasts=this.toasts.map(l=>l.id===n?(this.publish(R(S(S({},l),t),{id:n,title:r})),R(S(S({},l),t),{id:n,dismissible:o,title:r})):l):this.addToast(R(S({title:r},s),{dismissible:o,id:n})),n},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(r=>r({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create(R(S({},e),{message:t})),this.error=(t,e)=>this.create(R(S({},e),{message:t,type:"error"})),this.success=(t,e)=>this.create(R(S({},e),{type:"success",message:t})),this.info=(t,e)=>this.create(R(S({},e),{type:"info",message:t})),this.warning=(t,e)=>this.create(R(S({},e),{type:"warning",message:t})),this.loading=(t,e)=>this.create(R(S({},e),{type:"loading",message:t})),this.promise=(t,e)=>{if(!e)return;let r;e.loading!==void 0&&(r=this.create(R(S({},e),{promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0})));let s=t instanceof Promise?t:t(),n=r!==void 0,i,o=s.then(l=>f(this,null,function*(){if(i=["resolve",l],O.isValidElement(l))n=!1,this.create({id:r,type:"default",message:l});else if(kh(l)&&!l.ok){n=!1;let c=typeof e.error=="function"?yield e.error(`HTTP error! status: ${l.status}`):e.error,d=typeof e.description=="function"?yield e.description(`HTTP error! status: ${l.status}`):e.description;this.create({id:r,type:"error",message:c,description:d})}else if(e.success!==void 0){n=!1;let c=typeof e.success=="function"?yield e.success(l):e.success,d=typeof e.description=="function"?yield e.description(l):e.description;this.create({id:r,type:"success",message:c,description:d})}})).catch(l=>f(this,null,function*(){if(i=["reject",l],e.error!==void 0){n=!1;let c=typeof e.error=="function"?yield e.error(l):e.error,d=typeof e.description=="function"?yield e.description(l):e.description;this.create({id:r,type:"error",message:c,description:d})}})).finally(()=>{var l;n&&(this.dismiss(r),r=void 0),(l=e.finally)==null||l.call(e)}),a=()=>new Promise((l,c)=>o.then(()=>i[0]==="reject"?c(i[1]):l(i[1])).catch(c));return typeof r!="string"&&typeof r!="number"?{unwrap:a}:Object.assign(r,{unwrap:a})},this.custom=(t,e)=>{let r=(e==null?void 0:e.id)||Qn++;return this.create(S({jsx:t(r),id:r},e)),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ee=new Sh,Eh=(t,e)=>{let r=(e==null?void 0:e.id)||Qn++;return Ee.addToast(R(S({title:t},e),{id:r})),r},kh=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Th=Eh,Ah=()=>Ee.toasts,Rh=()=>Ee.getActiveToasts(),Cl=Object.assign(Th,{success:Ee.success,info:Ee.info,warning:Ee.warning,error:Ee.error,custom:Ee.custom,message:Ee.message,promise:Ee.promise,dismiss:Ee.dismiss,loading:Ee.loading},{getHistory:Ah,getToasts:Rh});function Ch(t,{insertAt:e}={}){if(typeof document=="undefined")return;let r=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",e==="top"&&r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.appendChild(document.createTextNode(t))}Ch(`: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;
69left: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}
69: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%);
69--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%)}
70`);function As(t){return t.label!==void 0}var Oh=3,Ph="32px",jh="16px",co=4e3,Ih=356,Nh=14,$h=20,Lh=200;function We(...t){return t.filter(Boolean).join(" ")}function Dh(t){let[e,r]=t.split("-"),s=[];return e&&s.push(e),r&&s.push(r),s}var Uh=t=>{var e,r,s,n,i,o,a,l,c,d,h;let{invert:p,toast:u,unstyled:y,interacting:g,setHeights:v,visibleToasts:b,heights:x,index:_,toasts:E,expanded:T,removeToast:k,defaultRichColors:C,closeButton:M,style:I,cancelButtonStyle:L,actionButtonStyle:B,className:N="",descriptionClassName:z="",duration:Y,position:D,gap:H,loadingIcon:Q,expandByDefault:W,classNames:$,icons:q,closeButtonAriaLabel:te="Close toast",pauseWhenPageIsHidden:Z}=t,[ee,re]=O.useState(null),[he,$e]=O.useState(null),[U,X]=O.useState(!1),[ne,oe]=O.useState(!1),[ue,Me]=O.useState(!1),[or,vs]=O.useState(!1),[bs,xt]=O.useState(!1),[ws,Br]=O.useState(0),[En,_s]=O.useState(0),Ft=O.useRef(u.duration||Y||co),Ht=O.useRef(null),Wt=O.useRef(null),Zc=_===0,eu=_+1<=b,Le=u.type,ar=u.dismissible!==!1,tu=u.className||"",ru=u.descriptionClassName||"",xs=O.useMemo(()=>x.findIndex(K=>
70K.toastId===u.id)||0,[x,u.id]),su=O.useMemo(()=>{var K;return(K=u.closeButton)!=null?K:M},[u.closeButton,M]),Mi=O.useMemo(()=>u.duration||Y||co,[u.duration,Y]),kn=O.useRef(0),lr=O.useRef(0),Bi=O.useRef(0),cr=O.useRef(null),[nu,iu]=D.split("-"),Fi=O.useMemo(()=>x.reduce((K,ie,de)=>de>=xs?K:K+ie.height,0),[x,xs]),Hi=xh(),ou=u.invert||p,Tn=Le==="loading";lr.current=O.useMemo(()=>xs*H+Fi,[xs,Fi]),O.useEffect(()=>{Ft.current=Mi},[Mi]),O.useEffect(()=>{X(!0)},[]),O.useEffect(()=>{let K=Wt.current;if(K){let ie=K.getBoundingClientRect().height;return _s(ie),v(de=>[{toastId:u.id,height:ie,position:u.position},...de]),()=>v(de=>de.filter(Be=>Be.toastId!==u.id))}},[v,u.id]),O.useLayoutEffect(()=>{if(!U)return;let K=Wt.current,ie=K.style.height;K.style.height="auto";let de=K.getBoundingClientRect().height;K.style.height=ie,_s(de),v(Be=>Be.find(Fe=>Fe.toastId===u.id)?Be.map(Fe=>Fe.toastId===u.id?R(S({},Fe),{height:de}):Fe):[{toastId:u.id,height:de,position:u.position},...Be])},[U,u.title,u.description,v,u.id]);let St=O.useCallback(()=>{oe(!0),Br(lr.current),v(K=>K.filter(ie=>ie.toastId!==u.id)),setTimeout(()=>{k(u)},Lh)},[u,k,v,lr]);O.useEffect(()=>{if(u.promise&&Le==="loading"||u.duration===1/0||u.type==="loading")return;let K;return T||g||Z&&Hi?(()=>{if(Bi.current<kn.current){let ie=new Date().getTime()-kn.current;Ft.current=Ft.current-ie}Bi.current=new Date().getTime()})():Ft.current!==1/0&&(kn.current=new Date().getTime(),K=setTimeout(()=>{var ie;(ie=u.onAutoClose)==null||ie.call(u,u),St()},Ft.current)),()=>clearTimeout(K)},[T,g,u,Le,Z,Hi,St]),O.useEffect(()=>{u.delete&&St()},[St,u.delete]);function au(){var K,ie,de;return q!=null&&q.loading?O.createElement("div",{className:We($==null?void 0:$.loader,(K=u==null?void 0:u.classNames)==null?void 0:K.loader,"sonner-loader"),"data-visible":Le==="loading"},q.loading):Q?O.createElement("div",{className:We($==null?void 0:$.loader,(ie=u==null?void 0:u.classNames)==null?void 0:ie.loader,"sonner-loader"),"data-visible":Le==="loading"},Q):O.createElement(mh,{className:We($==null?void 0:$.loader,(de=u==null?void 0:u.classNames)==null?void 0:de.loader),visible:Le==="loading"})}return O.createElement("li",{tabIndex:0,ref:Wt,className:We(N,tu,$==null?void 0:$.toast,(e=u==null?void 0:u.classNames)==null?void 0:e.toast,$==null?void 0:$.default,$==null?void 0:$[Le],(r=u==null?void 0:u.classNames)==null?void 0:r[Le]),"data-sonner-toast":"","data-rich-colors":(s=u.richColors)!=null?s:C,"data-styled":!(u.jsx||u.unstyled||y),"data-mounted":U,"data-promise":!!u.promise,"data-swiped":bs,"data-removed":ne,"data-visible":eu,"data-y-position":nu,"data-x-position":iu,"data-index":_,"data-front":Zc,"data-swiping":ue,"data-dismissible":ar,"data-type":Le,"data-invert":ou,"data-swipe-out":or,"data-swipe-direction":he,"data-expanded":!!(T||W&&U),style:S(S({"--index":_,"--toasts-before":_,"--z-index":E.length-_,"--offset":`${ne?ws:lr.current}px`,"--initial-height":W?"auto":`${En}px`},I),u.style),onDragEnd:()=>{Me(!1),re(null),cr.current=null},onPointerDown:K=>{Tn||!ar||(Ht.current=new Date,Br(lr.current),K.target.setPointerCapture(K.pointerId),K.target.tagName!=="BUTTON"&&(Me(!0),cr.current={x:K.clientX,y:K.clientY}))},onPointerUp:()=>{var K,ie,de,Be;if(or||!ar)return;cr.current=null;let Fe=Number(((K=Wt.current)==null?void 0:K.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Et=Number(((ie=Wt.current)==null?void 0:ie.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Vt=new Date().getTime()-((de=Ht.current)==null?void 0:de.getTime()),He=ee==="x"?Fe:Et,kt=Math.abs(He)/Vt;if(Math.abs(He)>=$h||kt>.11){Br(lr.current),(Be=u.onDismiss)==null||Be.call(u,u),$e(ee==="x"?Fe>0?"right":"left":Et>0?"down":"up"),St(),vs(!0),xt(!1);return}Me(!1),re(null)},onPointerMove:K=>{var ie,de,Be,Fe;if(!cr.current||!ar||((ie=window.getSelection())==null?void 0:ie.toString().length)>0)return;let Et=K.clientY-cr.current.y,Vt=K.clientX-cr.current.x,He=(de=t.swipeDirections)!=null?de:Dh(D);!ee&&(Math.abs(Vt)>1||Math.abs(Et)>1)&&re(Math.abs(Vt)>Math.abs(Et)?"x":"y");let kt={x:0,y:0};ee==="y"?(He.includes("top")||He.includes("bottom"))&&(He.includes("top")&&Et<0||He.includes("bottom")&&Et>0)&&(kt.y=Et):ee==="x"&&(He.includes("left")||He.includes("right"))&&(He.includes("left")&&Vt
70<0||He.includes("right")&&Vt>0)&&(kt.x=Vt),(Math.abs(kt.x)>0||Math.abs(kt.y)>0)&&xt(!0),(Be=Wt.current)==null||Be.style.setProperty("--swipe-amount-x",`${kt.x}px`),(Fe=Wt.current)==null||Fe.style.setProperty("--swipe-amount-y",`${kt.y}px`)}},su&&!u.jsx?O.createElement("button",{"aria-label":te,"data-disabled":Tn,"data-close-button":!0,onClick:Tn||!ar?()=>{}:()=>{var K;St(),(K=u.onDismiss)==null||K.call(u,u)},className:We($==null?void 0:$.closeButton,(n=u==null?void 0:u.classNames)==null?void 0:n.closeButton)},(i=q==null?void 0:q.close)!=null?i:_h):null,u.jsx||w.isValidElement(u.title)?u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title:O.createElement(O.Fragment,null,Le||u.icon||u.promise?O.createElement("div",{"data-icon":"",className:We($==null?void 0:$.icon,(o=u==null?void 0:u.classNames)==null?void 0:o.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||au():null,u.type!=="loading"?u.icon||(q==null?void 0:q[Le])||ph(Le):null):null,O.createElement("div",{"data-content":"",className:We($==null?void 0:$.content,(a=u==null?void 0:u.classNames)==null?void 0:a.content)},O.createElement("div",{"data-title":"",className:We($==null?void 0:$.title,(l=u==null?void 0:u.classNames)==null?void 0:l.title)},typeof u.title=="function"?u.title():u.title),u.description?O.createElement("div",{"data-description":"",className:We(z,ru,$==null?void 0:$.description,(c=u==null?void 0:u.classNames)==null?void 0:c.description)},typeof u.description=="function"?u.description():u.description):null),w.isValidElement(u.cancel)?u.cancel:u.cancel&&As(u.cancel)?O.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||L,onClick:K=>{var ie,de;As(u.cancel)&&ar&&((de=(ie=u.cancel).onClick)==null||de.call(ie,K),St())},className:We($==null?void 0:$.cancelButton,(d=u==null?void 0:u.classNames)==null?void 0:d.cancelButton)},u.cancel.label):null,w.isValidElement(u.action)?u.action:u.action&&As(u.action)?O.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||B,onClick:K=>{var ie,de;As(u.action)&&((de=(ie=u.action).onClick)==null||de.call(ie,K),!K.defaultPrevented&&St
70())},className:We($==null?void 0:$.actionButton,(h=u==null?void 0:u.classNames)==null?void 0:h.actionButton)},u.action.label):null))};function uo(){if(typeof window=="undefined"||typeof document=="undefined")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Mh(t,e){let r={};return[t,e].forEach((s,n)=>{let i=n===1,o=i?"--mobile-offset":"--offset",a=i?jh:Ph;function l(c){["top","right","bottom","left"].forEach(d=>{r[`${o}-${d}`]=typeof c=="number"?`${c}px`:c})}typeof s=="number"||typeof s=="string"?l(s):typeof s=="object"?["top","right","bottom","left"].forEach(c=>{s[c]===void 0?r[`${o}-${c}`]=a:r[`${o}-${c}`]=typeof s[c]=="number"?`${s[c]}px`:s[c]}):l(a)}),r}function Bh(){let[t,e]=O.useState([]);return O.useEffect(()=>Ee.subscribe(r=>{if(r.dismiss){setTimeout(()=>{qs.flushSync(()=>{e(s=>s.filter(n=>n.id!==r.id))})});return}setTimeout(()=>{qs.flushSync(()=>{e(s=>{let n=s.findIndex(i=>i.id===r.id);return n!==-1?[...s.slice(0,n),S(S({},s[n]),r),...s.slice(n+1)]:[r,...s]})})})}),[]),{toasts:t}}var Ol=w.forwardRef(function(t,e){let{invert:r,position:s="bottom-right",hotkey:n=["altKey","KeyT"],expand:i,closeButton:o,className:a,offset:l,mobileOffset:c,theme:d="light",richColors:h,duration:p,style:u,visibleToasts:y=Oh,toastOptions:g,dir:v=uo(),gap:b=Nh,loadingIcon:x,icons:_,containerAriaLabel:E="Notifications",pauseWhenPageIsHidden:T}=t,[k,C]=O.useState([]),M=O.useMemo(()=>Array.from(new Set([s].concat(k.filter(Z=>Z.position).map(Z=>Z.position)))),[k,s]),[I,L]=O.useState([]),[B,N]=O.useState(!1),[z,Y]=O.useState(!1),[D,H]=O.useState(d!=="system"?d:typeof window!="undefined"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=O.useRef(null),W=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=O.useRef(null),q=O.useRef(!1),te=O.useCallback(Z=>{C(ee=>{var re;return(re=ee.find(he=>he.id===Z.id))!=null&&re.delete||Ee.dismiss(Z.id),ee.filter(({id:he})=>he!==Z.id)})},[]);return O.useEffect(()=>Ee.subscribe(Z=>{if(Z.dismiss){C(ee=>ee.map(re=>re.id===Z.id?R(S({},re),{delete:!0}):re));return}setTimeout(()=>{qs.flushSync(()=>{C(ee=>{let re=ee.findIndex(he=>he.id===Z.id);return re!==-1?[...ee.slice(0,re),S(S({},ee[re]),Z),...ee.slice(re+1)]:[Z,...ee]})})})}),[]),O.useEffect(()=>{if(d!=="system"){H(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window=="undefined")return;let Z=window.matchMedia("(prefers-color-scheme: dark)");try{Z.addEventListener("change",({matches:ee})=>{H(ee?"dark":"light")})}catch(ee){Z.addListener(({matches:re})=>{try{H(re?"dark":"light")}catch(he){console.error(he)}})}},[d]),O.useEffect(()=>{k.length<=1&&N(!1)},[k]),O.useEffect(()=>{let Z=ee=>{var re,he;n.every($e=>ee[$e]||ee.code===$e)&&(N(!0),(re=Q.current)==null||re.focus()),ee.code==="Escape"&&(document.activeElement===Q.current||(he=Q.current)!=null&&he.contains(document.activeElement))&&N(!1)};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[n]),O.useEffect(()=>{if(Q.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,q.current=!1)}},[Q.current]),O.createElement("section",{ref:e,"aria-label":`${E} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((Z,ee)=>{var re;let[he,$e]=Z.split("-");return k.length?O.createElement("ol",{key:Z,dir:v==="auto"?uo():v,tabIndex:-1,ref:Q,className:a,"data-sonner-toaster":!0,"data-theme":D,"data-y-position":he,"data-lifted":B&&k.length>1&&!i,"data-x-position":$e,style:S(S({"--front-toast-height":`${((re=I[0])==null?void 0:re.height)||0}px`,"--width":`${Ih}px`,"--gap":`${b}px`},u),Mh(l,c)),onBlur:U=>{q.current&&!U.currentTarget.contains(U.relatedTarget)&&(q.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:U=>{U.target instanceof HTMLElement&&U.target.dataset.dismissible==="false"||q.current||(q.current=!0,$.current=U.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{z||N(!1)},onDragEnd:()=>N(!1),onPointerDown:U=>{U.target instanceof HTMLElement&&U.target.dataset.dismissible==="false"||Y(!0)},onPointerUp:()=>Y(!1)},k.filter(U=>!U.position&&ee===0||U.position===Z).map((U,X)=>{var ne,oe;return O.createElement(Uh,{key:U.id,icons:_,index:X,toast:U,defaultRichColors:h,duration:(ne=g==null?void 0:g.duration)!=null?ne:p,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:y,closeButton:(oe=g==null?void 0:g.closeButton)!=null?oe:o,interacting:z,position:Z,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:te,toasts:k.filter(ue=>ue.position==U.position),heights:I.filter(ue=>ue.position==U.position),setHeights:L,expandByDefault:i,gap:b,loadingIcon:x,expanded:B,pauseWhenPageIsHidden:T,swipeDirections:t.swipeDirections})})):null}))});const ub=Object.freeze(Object.defineProperty({__proto__:null,Toaster:Ol,toast:Cl,useSonner:Bh},Symbol.toStringTag,{value:"Module"})),ho=e=>{var t=V(e,[]);const{theme:r="system"}=fh();return m.jsx(Ol,S({theme:r,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"}}},t))},Fh=["top","right","bottom","left"],Ut=Math.min,Pe=Math.max,Gs=Math.round,Rs=Math.floor,ot=t=>({x:t,y:t}
70),Hh={left:"right",right:"left",bottom:"top",top:"bottom"},Wh={start:"end",end:"start"};function Xn(t,e,r){return Pe(t,Ut(e,r))}function bt(t,e){return typeof t=="function"?t(e):t}function wt(t){return t.split("-")[0]}function Dr(t){return t.split("-")[1]}function Si(t){return t==="x"?"y":"x"}function Ei(t){return t==="y"?"height":"width"}const Vh=new Set(["top","bottom"]);function it(t){return Vh.has(wt(t))?"y":"x"}function ki(t){return Si(it(t))}function zh(t,e,r){r===void 0&&(r=!1);const s=Dr(t),n=ki(t),i=Ei(n);let o=n==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Js(o)),[o,Js(o)]}function qh(t){const e=Js(t);return[Zn(t),e,Zn(e)]}function Zn(t){return t.replace(/start|end/g,e=>Wh[e])}const fo=["left","right"],po=["right","left"],Kh=["top","bottom"],Gh=["bottom","top"];function Jh(t,e,r){switch(t){case"top":case"bottom":return r?e?po:fo:e?fo:po;case"left":case"right":return e?Kh:Gh;default:return[]}}function Yh(t,e,r,s){const n=Dr(t);let i=Jh(wt(t),r==="start",s);return n&&(i=i.map(o=>o+"-"+n),e&&(i=i.concat(i.map(Zn)))),i}function Js(t){return t.replace(/left|right|bottom|top/g,e=>Hh[e])}function Qh(t){return S({top:0,right:0,bottom:0,left:0},t)}function Pl(t){return typeof t!="number"?Qh(t):{top:t,right:t,bottom:t,left:t}}function Ys(t){const{x:e,y:r,width:s,height:n}=t;return{width:s,height:n,top:r,left:e,right:e+s,bottom:r+n,x:e,y:r}}function go(t,e,r){let{reference:s,floating:n}=t;const i=it(e),o=ki(e),a=Ei(o),l=wt(e),c=i==="y",d=s.x+s.width/2-n.width/2,h=s.y+s.height/2-n.height/2,p=s[a]/2-n[a]/2;let u;switch(l){case"top":u={x:d,y:s.y-n.height};break;case"bottom":u={x:d,y:s.y+s.height};break;case"right":u={x:s.x+s.width,y:h};break;case"left":u={x:s.x-n.width,y:h};break;default:u={x:s.x,y:s.y}}switch(Dr(e)){case"start":u[o]-=p*(r&&c?-1:1);break;case"end":u[o]+=p*(r&&c?-1:1);break}return u}const Xh=(t,e,r)=>f(void 0,null,function*(){const{placement:s="bottom",strategy:n="absolute",middleware:i=[],platform:o}=r,a=i.filter(Boolean),l=yield o.isRTL==null?void 0:o.isRTL(e);let c=yield o.getElementRects({reference:t,floating:e,strategy:n}),{x:d,y:h}=go(c,s,l),p=s,u={},y=0;for(let g=0;g<a.length;g++){const{name:v,fn:b}=a[g],{x,y:_,data:E,reset:T}=yield b({x:d,y:h,initialPlacement:s,placement:p,strategy:n,middlewareData:u,rects:c,platform:o,elements:{reference:t,floating:e}});d=x!=null?x:d,h=_!=null?_:h,u=R(S({},u),{[v]:S(S({},u[v]),E)}),T&&y<=50&&(y++,typeof T=="object"&&(T.placement&&(p=T.placement),T.rects&&(c=T.rects===!0?yield o.getElementRects({reference:t,floating:e,strategy:n}):T.rects),{x:d,y:h}=go(c,p,l)),g=-1)}return{x:d,y:h,placement:p,strategy:n,middlewareData:u}});function ts(t,e){return f(this,null,function*(){var r;e===void 0&&(e={});const{x:s,y:n,platform:i,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:u=0}=bt(e,t),y=Pl(u),v=a[p?h==="floating"?"reference":"floating":h],b=Ys(yield i.getClippingRect({element:(r=yield i.isElement==null?void 0:i.isElement(v))==null||r?v:v.contextElement||(yield i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),x=h==="floating"?{x:s,y:n,width:o.floating.width,height:o.floating.height}:o.reference,_=yield i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating),E=(yield i.isElement==null?void 0:i.isElement(_))?(yield i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},T=Ys(i.convertOffsetParentRelativeRectToViewportRelativeRect?yield i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:_,strategy:l}):x);return{top:(b.top-T.top+y.top)/E.y,bottom:(T.bottom-b.bottom+y.bottom)/E.y,left:(b.left-T.left+y.left)/E.x,right:(T.right-b.right+y.right)/E.x}})}const Zh=t=>({name:"arrow",options:t,fn(r){return f(this,null,function*(){const{x:s,y:n,placement:i,rects:o,platform:a,elements:l,middlewareData:c}=r,{element:d,padding:h=0}=bt(t,r)||{};if(d==null)return{};const p=Pl(h),u={x:s,y:n},y=ki(i),g=Ei(y),v=yield a.getDimensions(d),b=y==="y",x=b?"top":"left",_=b?"bottom":"right",E=b?"clientHeight":"clientWidth",T=o.reference[g]+o.reference[y]-u[y]-o.floating[g],k=u[y]-o.reference[y],C=yield a.getOffsetParent==null?void 0:a.getOffsetParent(d);let M=C?C[E]:0;
70(!M||!(yield a.isElement==null?void 0:a.isElement(C)))&&(M=l.floating[E]||o.floating[g]);const I=T/2-k/2,L=M/2-v[g]/2-1,B=Ut(p[x],L),N=Ut(p[_],L),z=B,Y=M-v[g]-N,D=M/2-v[g]/2+I,H=Xn(z,D,Y),Q=!c.arrow&&Dr(i)!=null&&D!==H&&o.reference[g]/2-(D<z?B:N)-v[g]/2<0,W=Q?D<z?D-z:D-Y:0;return{[y]:u[y]+W,data:S({[y]:H,centerOffset:D-H-W},Q&&{alignmentOffset:W}),reset:Q}})}}),ef=function(t){return t===void 0&&(t={}),{name:"flip",options:t,fn(r){return f(this,null,function*(){var s,n;const{placement:i,middlewareData:o,rects:a,initialPlacement:l,platform:c,elements:d}=r,D=bt(t,r),{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:u,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0}=D,b=V(D,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if((s=o.arrow)!=null&&s.alignmentOffset)return{};const x=wt(i),_=it(l),E=wt(l)===l,T=yield c.isRTL==null?void 0:c.isRTL(d.floating),k=u||(E||!v?[Js(l)]:qh(l)),C=g!=="none";!u&&C&&k.push(...Yh(l,v,g,T));const M=[l,...k],I=yield ts(r,b),L=[];let B=((n=o.flip)==null?void 0:n.overflows)||[];if(h&&L.push(I[x]),p){const H=zh(i,a,T);L.push(I[H[0]],I[H[1]])}if(B=[...B,{placement:i,overflows:L}],!L.every(H=>H<=0)){var N,z;const H=(((N=o.flip)==null?void 0:N.index)||0)+1,Q=M[H];if(Q&&(!(p==="alignment"?_!==it(Q):!1)||B.every(q=>q.overflows[0]>0&&it(q.placement)===_)))return{data:{index:H,overflows:B},reset:{placement:Q}};let W=(z=B.filter($=>$.overflows[0]<=0).sort(($,q)=>$.overflows[1]-q.overflows[1])[0])==null?void 0:z.placement;if(!W)switch(y){case"bestFit":{var Y;const $=(Y=B.filter(q=>{if(C){const te=it(q.placement);return te===_||te==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(te=>te>0).reduce((te,Z)=>te+Z,0)]).sort((q,te)=>q[1]-te[1])[0])==null?void 0:Y[0];$&&(W=$);break}case"initialPlacement":W=l;break}if(i!==W)return{reset:{placement:W}}}return{}})}}};function mo(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function yo(t){return Fh.some(e=>t[e]>=0)}const tf=function(t){return t===void 0&&(t={}),{name:"hide",options:t,fn(r){return f(this,null,function*(){const{rects:s}=r,o=bt(t,r),{strategy:n="referenceHidden"}=o,i=V(o,["strategy"]);switch(n){case"referenceHidden":{const a=yield ts(r,R(S({},i),{elementContext:"reference"})),l=mo(a,s.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:yo(l)}}}case"escaped":{const a=yield ts(r,R(S({},i),{altBoundary:!0})),l=mo(a,s.floating);return{data:{escapedOffsets:l,escaped:yo(l)}}}default:return{}}})}}},jl=new Set(["left","top"]);function rf(t,e){return f(this,null,function*(){const{placement:r,platform:s,elements:n}=t,i=yield s.isRTL==null?void 0:s.isRTL(n.floating),o=wt(r),a=Dr(r),l=it(r)==="y",c=jl.has(o)?-1:1,d=i&&l?-1:1,h=bt(e,t);let{mainAxis:p,crossAxis:u,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof y=="number"&&(u=a==="end"?y*-1:y),l?{x:u*d,y:p*c}:{x:p*c,y:u*d}})}const sf=function(t){return t===void 0&&(t=0),{name:"offset",options:t,fn(r){return f(this,null,function*(){var s,n;const{x:i,y:o,placement:a,middlewareData:l}=r,c=yield rf(r,t);return a===((s=l.offset)==null?void 0:s.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:R(S({},c),{placement:a})}})}}},nf=function(t){return t===void 0&&(t={}),{name:"shift",options:t,fn(r){return f(this,null,function*(){const{x:s,y:n,placement:i}=r,b=bt(t,r),{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:x=>{let{x:_,y:E}=x;return{x:_,y:E}}}}=b,c=V(b,["mainAxis","crossAxis","limiter"]),d={x:s,y:n},h=yield ts(r,c),p=it(wt(i)),u=Si(p);let y=d[u],g=d[p];if(o){const x=u==="y"?"top":"left",_=u==="y"?"bottom":"right",E=y+h[x],T=y-h[_];y=Xn(E,y,T)}if(a){const x=p==="y"?"top":"left",_=p==="y"?"bottom":"right",E=g+h[x],T=g-h[_];g=Xn(E,g,T)}const v=l.fn(R(S({},r),{[u]:y,[p]:g}));return R(S({},v),{data:{x:v.x-s,y:v.y-n,enabled:{[u]:o,[p]:a}}})})}}},of=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:r,y:s,placement:n,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=bt(t,e),d={x:r,y:s},h=it(n),p=Si(h);let u=d[p],y=d[h];const g=bt(a,e),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:S({mainAxis:0,crossAxis:0},g);if(l){const _=p==="y"?"height":"width",E=i.reference[p]-i.floating[_]+v.mainAxis,T=i.reference[p]+i.reference[_]-v.mainAxis;
70u<E?u=E:u>T&&(u=T)}if(c){var b,x;const _=p==="y"?"width":"height",E=jl.has(wt(n)),T=i.reference[h]-i.floating[_]+(E&&((b=o.offset)==null?void 0:b[h])||0)+(E?0:v.crossAxis),k=i.reference[h]+i.reference[_]+(E?0:((x=o.offset)==null?void 0:x[h])||0)-(E?v.crossAxis:0);y<T?y=T:y>k&&(y=k)}return{[p]:u,[h]:y}}}},af=function(t){return t===void 0&&(t={}),{name:"size",options:t,fn(r){return f(this,null,function*(){var s,n;const{placement:i,rects:o,platform:a,elements:l}=r,B=bt(t,r),{apply:c=()=>{}}=B,d=V(B,["apply"]),h=yield ts(r,d),p=wt(i),u=Dr(i),y=it(i)==="y",{width:g,height:v}=o.floating;let b,x;p==="top"||p==="bottom"?(b=p,x=u===((yield a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(x=p,b=u==="end"?"top":"bottom");const _=v-h.top-h.bottom,E=g-h.left-h.right,T=Ut(v-h[b],_),k=Ut(g-h[x],E),C=!r.middlewareData.shift;let M=T,I=k;if((s=r.middlewareData.shift)!=null&&s.enabled.x&&(I=E),(n=r.middlewareData.shift)!=null&&n.enabled.y&&(M=_),C&&!u){const N=Pe(h.left,0),z=Pe(h.right,0),Y=Pe(h.top,0),D=Pe(h.bottom,0);y?I=g-2*(N!==0||z!==0?N+z:Pe(h.left,h.right)):M=v-2*(Y!==0||D!==0?Y+D:Pe(h.top,h.bottom))}yield c(R(S({},r),{availableWidth:I,availableHeight:M}));const L=yield a.getDimensions(l.floating);return g!==L.width||v!==L.height?{reset:{rects:!0}}:{}})}}};function fn(){return typeof window!="undefined"}function Ur(t){return Il(t)?(t.nodeName||"").toLowerCase():"#document"}function Ie(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function lt(t){var e;return(e=(Il(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Il(t){return fn()?t instanceof Node||t instanceof Ie(t).Node:!1}function Qe(t){return fn()?t instanceof Element||t instanceof Ie(t).Element:!1}function at(t){return fn()?t instanceof HTMLElement||t instanceof Ie(t).HTMLElement:!1}function vo(t){return!fn()||typeof ShadowRoot=="undefined"?!1:t instanceof ShadowRoot||t instanceof Ie(t).ShadowRoot}const lf=new Set(["inline","contents"]);function ms(t){const{overflow:e,overflowX:r,overflowY:s,display:n}=Xe(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+r)&&!lf.has(n)}const cf=new Set(["table","td","th"]);function uf(t){return cf.has(Ur(t))}const df=[":popover-open",":modal"];function pn(t){return df.some(e=>{try{return t.matches(e)}catch(r){return!1}})}const hf=["transform","translate","scale","rotate","perspective"],ff=["transform","translate","scale","rotate","perspective","filter"],pf=["paint","layout","strict","content"];function Ti(t){const e=Ai(),r=Qe(t)?Xe(t):t;return hf.some(s=>r[s]?r[s]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!e&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!e&&(r.filter?r.filter!=="none":!1)||ff.some(s=>(r.willChange||"").includes(s))||pf.some(s=>(r.contain||"").includes(s))}function gf(t){let e=Mt(t);for(;at(e)&&!Ir(e);){if(Ti(e))return e;if(pn(e))return null;e=Mt(e)}return null}function Ai(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const mf=new Set(["html","body","#document"]);function Ir(t){return mf.has(Ur(t))}function Xe(t){return Ie(t).getComputedStyle(t)}function gn(t){return Qe(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Mt(t){if(Ur(t)==="html")return t;const e=t.assignedSlot||t.parentNode||vo(t)&&t.host||lt(t);return vo(e)?e.host:e}function Nl(t){const e=Mt(t);return Ir(e)?t.ownerDocument?t.ownerDocument.body:t.body:at(e)&&ms(e)?e:Nl(e)}function rs(t,e,r){var s;e===void 0&&(e=[]),r===void 0&&(r=!0);const n=Nl(t),i=n===((s=t.ownerDocument)==null?void 0:s.body),o=Ie(n);if(i){const a=ei(o);return e.concat(o,o.visualViewport||[],ms(n)?n:[],a&&r?rs(a):[])}return e.concat(n,rs(n,[],r))}function ei(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function $l(t){const e=Xe(t);let r=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const n=at(t),i=n?t.offsetWidth:r,o=n?t.offsetHeight:s,a=Gs(r)!==i||Gs(s)!==o;return a&&(r=i,s=o),{width:r,height:s,$:a}}function Ri(t){return Qe(t)?t:t.contextElement}function br(t){const e=Ri(t);if(!at(e))return ot(1);const r=e.getBoundingClientRect(),{width:s,height:n,$:i}=$l(e);let o=(i?Gs(r.width):r.width)/s,a=(i?Gs(r.height):r.height)/n;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const yf=ot(0);function Ll(t){const e=Ie(t);
vendor: 5,085 bytes, line 70
70return!Ai()||!e.visualViewport?yf:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function vf(t,e,r){return e===void 0&&(e=!1),!r||e&&r!==Ie(t)?!1:e}function nr(t,e,r,s){e===void 0&&(e=!1),r===void 0&&(r=!1);const n=t.getBoundingClientRect(),i=Ri(t);let o=ot(1);e&&(s?Qe(s)&&(o=br(s)):o=br(t));const a=vf(i,r,s)?Ll(i):ot(0);let l=(n.left+a.x)/o.x,c=(n.top+a.y)/o.y,d=n.width/o.x,h=n.height/o.y;if(i){const p=Ie(i),u=s&&Qe(s)?Ie(s):s;let y=p,g=ei(y);for(;g&&s&&u!==y;){const v=br(g),b=g.getBoundingClientRect(),x=Xe(g),_=b.left+(g.clientLeft+parseFloat(x.paddingLeft))*v.x,E=b.top+(g.clientTop+parseFloat(x.paddingTop))*v.y;l*=v.x,c*=v.y,d*=v.x,h*=v.y,l+=_,c+=E,y=Ie(g),g=ei(y)}}return Ys({width:d,height:h,x:l,y:c})}function Ci(t,e){const r=gn(t).scrollLeft;return e?e.left+r:nr(lt(t)).left+r}function Dl(t,e,r){r===void 0&&(r=!1);const s=t.getBoundingClientRect(),n=s.left+e.scrollLeft-(r?0:Ci(t,s)),i=s.top+e.scrollTop;return{x:n,y:i}}function bf(t){let{elements:e,rect:r,offsetParent:s,strategy:n}=t;const i=n==="fixed",o=lt(s),a=e?pn(e.floating):!1;if(s===o||a&&i)return r;let l={scrollLeft:0,scrollTop:0},c=ot(1);const d=ot(0),h=at(s);if((h||!h&&!i)&&((Ur(s)!=="body"||ms(o))&&(l=gn(s)),at(s))){const u=nr(s);c=br(s),d.x=u.x+s.clientLeft,d.y=u.y+s.clientTop}const p=o&&!h&&!i?Dl(o,l,!0):ot(0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:r.y*c.y-l.scrollTop*c.y+d.y+p.y}}function wf(t){return Array.from(t.getClientRects())}function _f(t){const e=lt(t),r=gn(t),s=t.ownerDocument.body,n=Pe(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),i=Pe(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let o=-r.scrollLeft+Ci(t);const a=-r.scrollTop;return Xe(s).direction==="rtl"&&(o+=Pe(e.clientWidth,s.clientWidth)-n),{width:n,height:i,x:o,y:a}}function xf(t,e){const r=Ie(t),s=lt(t),n=r.visualViewport;let i=s.clientWidth,o=s.clientHeight,a=0,l=0;if(n){i=n.width,o=n.height;const c=Ai();(!c||c&&e==="fixed")&&(a=n.offsetLeft,l=n.offsetTop)}return{width:i,height:o,x:a,y:l}}const Sf=new Set(["absolute","fixed"]);function Ef(t,e){const r=nr(t,!0,e==="fixed"),s=r.top+t.clientTop,n=r.left+t.clientLeft,i=at(t)?br(t):ot(1),o=t.clientWidth*i.x,a=t.clientHeight*i.y,l=n*i.x,c=s*i.y;return{width:o,height:a,x:l,y:c}}function bo(t,e,r){let s;if(e==="viewport")s=xf(t,r);else if(e==="document")s=_f(lt(t));else if(Qe(e))s=Ef(e,r);else{const n=Ll(t);s={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return Ys(s)}function Ul(t,e){const r=Mt(t);return r===e||!Qe(r)||Ir(r)?!1:Xe(r).position==="fixed"||Ul(r,e)}function kf(t,e){const r=e.get(t);if(r)return r;let s=rs(t,[],!1).filter(a=>Qe(a)&&Ur(a)!=="body"),n=null;const i=Xe(t).position==="fixed";let o=i?Mt(t):t;for(;Qe(o)&&!Ir(o);){const a=Xe(o),l=Ti(o);!l&&a.position==="fixed"&&(n=null),(i?!l&&!n:!l&&a.position==="static"&&!!n&&Sf.has(n.position)||ms(o)&&!l&&Ul(t,o))?s=s.filter(d=>d!==o):n=a,o=Mt(o)}return e.set(t,s),s}function Tf(t){let{element:e,boundary:r,rootBoundary:s,strategy:n}=t;const o=[...r==="clippingAncestors"?pn(e)?[]:kf(e,this._c):[].concat(r),s],a=o[0],l=o.reduce((c,d)=>{const h=bo(e,d,n);return c.top=Pe(h.top,c.top),c.right=Ut(h.right,c.right),c.bottom=Ut(h.bottom,c.bottom),c.left=Pe(h.left,c.left),c},bo(e,a,n));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Af(t){const{width:e,height:r}=$l(t);return{width:e,height:r}}function Rf(t,e,r){const s=at(e),n=lt(e),i=r==="fixed",o=nr(t,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=ot(0);function c(){l.x=Ci(n)}if(s||!s&&!i)if((Ur(e)!=="body"||ms(n))&&(a=gn(e)),s){const u=nr(e,!0,i,e);l.x=u.x+e.clientLeft,l.y=u.y+e.clientTop}else n&&c();i&&!s&&n&&c();const d=n&&!s&&!i?Dl(n,a):ot(0),h=o.left+a.scrollLeft-l.x-d.x,p=o.top+a.scrollTop-l.y-d.y;return{x:h,y:p,width:o.width,height:o.height}}function $n(t){return Xe(t).position==="static"}function wo(t,e){if(!at(t)||Xe(t).position==="fixed")return null;if(e)return e(t);let r=t.offsetParent;return lt(t)===r&&(r=r.ownerDocument.body),r}function Ml(t,e){const r=Ie(t);if(pn(t))return r;if(!at(t)){let n=Mt(t);for(;n&&!Ir(n);){if(Qe(n)&&!$n(n))return n;n=Mt(n)}return r}let s=wo(t,e);for(;s&&uf(s)&&$n(s);)s=wo(s,e);return s&&Ir(s)&&$n(s)&&!Ti(s)?r:s||gf(t)||r}const Cf=function(t){return f(this,null,function*(){const e=this.getOffsetParent||Ml,r=this.getDimensions,s=yield r(t.floating);return{reference:Rf(t.reference,yield e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}})};function Of(t){return Xe(t).direction==="rtl"}const Pf={convertOffsetParentRelativeRectToViewportRelativeRect:bf,getDocumentElement:lt,getClippingRect:Tf,getOffsetParent:Ml,getElementRects:Cf,getClientRects:wf,getDimensions:Af,getScale:br,isElement:Qe,isRTL:Of};function Bl(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function jf(t,e){let r=null,s;const n=lt(t);function i(){var a;clearTimeout(s),(a=r)==null||a.disconnect(),r=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=t.getBoundingClientRect(),{left:d,top:h,width:p,height:u}=c;if(a||e(),!p||!u)return;
vendor: 3,413 bytes, line 70
70const y=Rs(h),g=Rs(n.clientWidth-(d+p)),v=Rs(n.clientHeight-(h+u)),b=Rs(d),_={rootMargin:-y+"px "+-g+"px "+-v+"px "+-b+"px",threshold:Pe(0,Ut(1,l))||1};let E=!0;function T(k){const C=k[0].intersectionRatio;if(C!==l){if(!E)return o();C?o(!1,C):s=setTimeout(()=>{o(!1,1e-7)},1e3)}C===1&&!Bl(c,t.getBoundingClientRect())&&o(),E=!1}try{r=new IntersectionObserver(T,R(S({},_),{root:n.ownerDocument}))}catch(k){r=new IntersectionObserver(T,_)}r.observe(t)}return o(!0),i}function If(t,e,r,s){s===void 0&&(s={});const{ancestorScroll:n=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,c=Ri(t),d=n||i?[...c?rs(c):[],...rs(e)]:[];d.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),i&&b.addEventListener("resize",r)});const h=c&&a?jf(c,r):null;let p=-1,u=null;o&&(u=new ResizeObserver(b=>{let[x]=b;x&&x.target===c&&u&&(u.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var _;(_=u)==null||_.observe(e)})),r()}),c&&!l&&u.observe(c),u.observe(e));let y,g=l?nr(t):null;l&&v();function v(){const b=nr(t);g&&!Bl(g,b)&&r(),g=b,y=requestAnimationFrame(v)}return r(),()=>{var b;d.forEach(x=>{n&&x.removeEventListener("scroll",r),i&&x.removeEventListener("resize",r)}),h==null||h(),(b=u)==null||b.disconnect(),u=null,l&&cancelAnimationFrame(y)}}const Nf=sf,$f=nf,Lf=ef,Df=af,Uf=tf,_o=Zh,Mf=of,Bf=(t,e,r)=>{const s=new Map,n=S({platform:Pf},r),i=R(S({},n.platform),{_c:s});return Xh(t,e,R(S({},n),{platform:i}))};var Ff=typeof document!="undefined",Hf=function(){},Hs=Ff?w.useLayoutEffect:Hf;function Qs(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let r,s,n;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==e.length)return!1;for(s=r;s--!==0;)if(!Qs(t[s],e[s]))return!1;return!0}if(n=Object.keys(t),r=n.length,r!==Object.keys(e).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(e,n[s]))return!1;for(s=r;s--!==0;){const i=n[s];if(!(i==="_owner"&&t.$$typeof)&&!Qs(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function Fl(t){return typeof window=="undefined"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function xo(t,e){const r=Fl(t);return Math.round(e*r)/r}function Ln(t){const e=w.useRef(t);return Hs(()=>{e.current=t}),e}function Wf(t){t===void 0&&(t={});const{placement:e="bottom",strategy:r="absolute",middleware:s=[],platform:n,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[d,h]=w.useState({x:0,y:0,strategy:r,placement:e,middlewareData:{},isPositioned:!1}),[p,u]=w.useState(s);Qs(p,s)||u(s);const[y,g]=w.useState(null),[v,b]=w.useState(null),x=w.useCallback(W=>{W!==k.current&&(k.current=W,g(W))},[]),_=w.useCallback(W=>{W!==C.current&&(C.current=W,b(W))},[]),E=i||y,T=o||v,k=w.useRef(null),C=w.useRef(null),M=w.useRef(d),I=l!=null,L=Ln(l),B=Ln(n),N=Ln(c),z=w.useCallback(()=>{if(!k.current||!C.current)return;const W={placement:e,strategy:r,middleware:p};B.current&&(W.platform=B.current),Bf(k.current,C.current,W).then($=>{const q=R(S({},$),{isPositioned:N.current!==!1});Y.current&&!Qs(M.current,q)&&(M.current=q,cn.flushSync(()=>{h(q)}))})},[p,e,r,B,N]);Hs(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,h(W=>R(S({},W),{isPositioned:!1})))},[c]);const Y=w.useRef(!1);Hs(()=>(Y.current=!0,()=>{Y.current=!1}),[]),Hs(()=>
70{if(E&&(k.current=E),T&&(C.current=T),E&&T){if(L.current)return L.current(E,T,z);z()}},[E,T,z,L,I]);const D=w.useMemo(()=>({reference:k,floating:C,setReference:x,setFloating:_}),[x,_]),H=w.useMemo(()=>({reference:E,floating:T}),[E,T]),Q=w.useMemo(()=>{const W={position:r,left:0,top:0};if(!H.floating)return W;const $=xo(H.floating,d.x),q=xo(H.floating,d.y);return a?S(R(S({},W),{transform:"translate("+$+"px, "+q+"px)"}),Fl(H.floating)>=1.5&&{willChange:"transform"}):{position:r,left:$,top:q}},[r,a,H.floating,d.x,d.y]);return w.useMemo(()=>R(S({},d),{update:z,refs:D,elements:H,floatingStyles:Q}),[d,z,D,H,Q])}const Vf=t=>{function e(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:t,fn(r){const{element:s,padding:n}=typeof t=="function"?t(r):t;return s&&e(s)?s.current!=null?_o({element:s.current,padding:n}).fn(r):{}:s?_o({element:s,padding:n}).fn(r):{}}}},zf=(t,e)=>R(S({},Nf(t)),{options:[t,e]}),qf=(t,e)=>R(S({},$f(t)),{options:[t,e]}),Kf=(t,e)=>R(S({},Mf(t)),{options:[t,e]}),Gf=(t,e)=>R(S({},Lf(t)),{options:[t,e]}),Jf=(t,e)=>R(S({},Df(t)),{options:[t,e]}),Yf=(t,e)=>R(S({},Uf(t)),{options:[t,e]}),Qf=(t,e)=>R(S({},Vf(t)),{options:[t,e]});var Xf="Arrow",Hl=w.forwardRef((t,e)=>{const o=t,{children:r,width:s=10,height:n=5}=o,i=V(o,["children","width","height"]);return m.jsx(Ce.svg,R(S({},i),{ref:e,width:s,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:m.jsx("polygon",{points:"0,0 30,0 15,10"})}))});Hl.displayName=Xf;var Zf=Hl;function ep(t){const[e,r]=w.useState(void 0);return Dt(()=>{if(t){r({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const i=n[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;r({width:o,height:a})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else r(void 0)},[t]),e}var Oi="Popper",[Wl,Vl]=un(Oi),[tp,zl]=Wl(Oi),ql=t=>{const{__scopePopper:e,children:r}=t,[s,n]=w.useState(null);return m.jsx(tp,{scope:e,anchor:s,onAnchorChange:n,children:r})};ql.displayName=Oi;var Kl="PopperAnchor",Gl=w.forwardRef((t,e)=>{const l=t,{__scopePopper:r,virtualRef:s}=l,n=V(l,["__scopePopper","virtualRef"]),i=zl(Kl,r),o=w.useRef(null),a=Ye(e,o);return w.useEffect(()=>{i.onAnchorChange((s==null?void 0:s.current)||o.current)}),s?null:m.jsx(Ce.div,R(S({},n),{ref:a}))});Gl.displayName=Kl;var Pi="PopperContent",[rp,sp]=Wl(Pi),Jl=w.forwardRef((t,e)=>{var X,ne,oe,ue,Me,or,vs,bs;const U=t,{__scopePopper:r,side:s="bottom",sideOffset:n=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:u="optimized",onPlaced:y}=U,g=V(U,["__scopePopper","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","onPlaced"]),v=zl(Pi,r),[b,x]=w.useState(null),_=Ye(e,xt=>x(xt)),[E,T]=w.useState(null),k=ep(E),C=(X=k==null?void 0:k.width)!=null?X:0,M=(ne=k==null?void 0:k.height)!=null?ne:0,I=s+(i!=="center"?"-"+i:""),L=typeof d=="number"?d:S({top:0,right:0,bottom:0,left:0},d),B=Array.isArray(c)?c:[c],N=B.length>0,z={padding:L,boundary:B.filter(ip),altBoundary:N},{refs:Y,floatingStyles:D,placement:H,isPositioned:Q,middlewareData:W}=Wf({strategy:"fixed",placement:I,whileElementsMounted:(...xt)=>If(...xt,{animationFrame:u==="always"}),elements:{reference:v.anchor},middleware:[zf({mainAxis:n+M,alignmentAxis:o}),l&&qf(S({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Kf():void 0},z)),l&&Gf(S({},z)),Jf(R(S({},z),{apply:({elements:xt,rects:ws,availableWidth:Br,availableHeight:En})=>{const{width:_s,height:Ft}=ws.reference,Ht=xt.floating.style;Ht.setProperty("--radix-popper-available-width",`${Br}px`),Ht.setProperty("--radix-popper-available-height",`${En}px`),Ht.setProperty("--radix-popper-anchor-width",`${_s}px`),Ht.setProperty("--radix-popper-anchor-height",`${Ft}px`)}})),E&&Qf({element:E,padding:a}),op({arrowWidth:C,arrowHeight:M}),p&&Yf(S({strategy:"referenceHidden"},z))]}),[$,q]=Xl(H),te=Lt(y);Dt(()=>{Q&&(te==null||te())},[Q,te]);const Z=(oe=W.arrow)==null?void 0:oe.x,ee=(ue=W.arrow)==null?void 0:ue.y,re=((Me=W.arrow)==null?void 0:Me.centerOffset)!==0,[he,$e]=w.useState();return Dt(()=>{b&&$e(window.getComputedStyle(b).zIndex)},[b]),m.jsx("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:S(R(S({},D),{transform:Q?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(or=W.transformOrigin)==null?void 0:or.x,(vs=W.transformOrigin)==null?void 0:vs.y].join(" ")}),((bs=W.hide)==null?void 0:bs.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}),dir:t.dir,children:m.jsx(rp,{scope:r,placedSide:$,onArrowChange:T,arrowX:Z,arrowY:ee,shouldHideArrow:re,children:m.jsx(Ce.div,R(S({"data-side":$,"data-align":q},g),{ref:_,style:R(S({},g.style),{animation:Q?void 0:"none"})}))})})});Jl.displayName=Pi;var Yl="PopperArrow",np={top:"bottom",right:"left",bottom:"top",left:"r
70ight"},Ql=w.forwardRef(function(e,r){const a=e,{__scopePopper:s}=a,n=V(a,["__scopePopper"]),i=sp(Yl,s),o=np[i.placedSide];return m.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:m.jsx(Zf,R(S({},n),{ref:r,style:R(S({},n.style),{display:"block"})}))})});Ql.displayName=Yl;function ip(t){return t!==null}var op=t=>({name:"transformOrigin",options:t,fn(e){var v,b,x,_,E;const{placement:r,rects:s,middlewareData:n}=e,o=((v=n.arrow)==null?void 0:v.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,d]=Xl(r),h={start:"0%",center:"50%",end:"100%"}[d],p=((x=(b=n.arrow)==null?void 0:b.x)!=null?x:0)+a/2,u=((E=(_=n.arrow)==null?void 0:_.y)!=null?E:0)+l/2;let y="",g="";return c==="bottom"?(y=o?h:`${p}px`,g=`${-l}px`):c==="top"?(y=o?h:`${p}px`,g=`${s.floating.height+l}px`):c==="right"?(y=`${-l}px`,g=o?h:`${u}px`):c==="left"&&(y=`${s.floating.width+l}px`,g=o?h:`${u}px`),{data:{x:y,y:g}}}});function Xl(t){const[e,r="center"]=t.split("-");return[e,r]}var db=ql,ap=Gl,lp=Jl,cp=Ql,[mn]=un("Tooltip",[Vl]),ji=Vl(),Zl="TooltipProvider",up=700,So="tooltip.open",[dp,ec]=mn(Zl),tc=t=>{const{__scopeTooltip:e,delayDuration:r=up,skipDelayDuration:s=300,disableHoverableContent:n=!1,children:i}=t,o=w.useRef(!0),a=w.useRef(!1),l=w.useRef(0);return w.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),m.jsx(dp,{scope:e,isOpenDelayedRef:o,delayDuration:r,onOpen:w.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,s)},[s]),isPointerInTransitRef:a,onPointerInTransitChange:w.useCallback(c=>{a.current=c},[]),disableHoverableContent:n,children:i})};tc.displayName=Zl;var rc="Tooltip",[hb,yn]=mn(rc),ti="TooltipTrigger",hp=w.forwardRef((t,e)=>{const p=t,{__scopeTooltip:r}=p,s=V(p,["__scopeTooltip"]),n=yn(ti,r),i=ec(ti,r),o=ji(r),a=w.useRef(null),l=Ye(e,a,n.onTriggerChange),c=w.useRef(!1),d=w.useRef(!1),h=w.useCallback(()=>c.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(ap,R(S({asChild:!0},o),{children:m.jsx(Ce.button,R(S({"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute},s),{ref:l,onPointerMove:me(t.onPointerMove,u=>{u.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(n.onTriggerEnter(),d.current=!0)}),onPointerLeave:me(t.onPointerLeave,()=>{n.onTriggerLeave(),d.current=!1}),onPointerDown:me(t.onPointerDown,()=>{n.open&&n.onClose(),c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:me(t.onFocus,()=>{c.current||n.onOpen()}),onBlur:me(t.onBlur,n.onClose),onClick:me(t.onClick,n.onClose)}))}))});hp.displayName=ti;var fp="TooltipPortal",[fb,pp]=mn(fp,{forceMount:void 0}),Nr="TooltipContent",sc=w.forwardRef((t,e)=>{const r=pp(Nr,t.__scopeTooltip),a=t,{forceMount:s=r.forceMount,side:n="top"}=a,i=V(a,["forceMount","side"]),o=yn(Nr,t.__scopeTooltip);return m.jsx(vi,{present:s||o.open,children:o.disableHoverableContent?m.jsx(nc,R(S({side:n},i),{ref:e})):m.jsx(gp,R(S({side:n},i),{ref:e}))})}),gp=w.forwardRef((t,e)=>{const r=yn(Nr,t.__scopeTooltip),s=ec(Nr,t.__scopeTooltip),n=w.useRef(null),i=Ye(e,n),[o,a]=w.useState(null),{trigger:l,onClose:c}=r,d=n.current,{onPointerInTransitChange:h}=s,p=w.useCallback(()=>{a(null),h(!1)},[h]),u=w.useCallback((y,g)=>{const v=y.currentTarget,b={x:y.clientX,y:y.clientY},x=wp(b,v.getBoundingClientRect()),_=_p(b,x),E=xp(g.getBoundingClientRect()),T=Ep([..._,...E]);a(T),h(!0)},[h]);return w.useEffect(()=>()=>p(),[p]),w.useEffect(()=>{if(l&&d){const y=v=>u(v,d),g=v=>u(v,l);return l.addEventListener("pointerleave",y),d.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",g)}}},[l,d,u,p]),w.useEffect(()=>{if(o){const y=g=>{const v=g.target,b={x:g.clientX,y:g.clientY},x=(l==null?void 0:l.contains(v))||(d==null?void 0:d.contains(v)),_=!Sp(b,o);x?p():_&&(p(),c())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,d,o,c,p]),m.jsx(nc,R(S({},t),{ref:i}
70))}),[mp,yp]=mn(rc,{isInside:!1}),vp=Tu("TooltipContent"),nc=w.forwardRef((t,e)=>{const h=t,{__scopeTooltip:r,children:s,"aria-label":n,onEscapeKeyDown:i,onPointerDownOutside:o}=h,a=V(h,["__scopeTooltip","children","aria-label","onEscapeKeyDown","onPointerDownOutside"]),l=yn(Nr,r),c=ji(r),{onClose:d}=l;return w.useEffect(()=>(document.addEventListener(So,d),()=>document.removeEventListener(So,d)),[d]),w.useEffect(()=>{if(l.trigger){const p=u=>{const y=u.target;y!=null&&y.contains(l.trigger)&&d()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[l.trigger,d]),m.jsx(yi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:p=>p.preventDefault(),onDismiss:d,children:m.jsxs(lp,R(S(S({"data-state":l.stateAttribute},c),a),{ref:e,style:R(S({},a.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:[m.jsx(vp,{children:s}),m.jsx(mp,{scope:r,isInside:!0,children:m.jsx(Qu,{id:l.contentId,role:"tooltip",children:n||s})})]}))})});sc.displayName=Nr;var ic="TooltipArrow",bp=w.forwardRef((t,e)=>{const o=t,{__scopeTooltip:r}=o,s=V(o,["__scopeTooltip"]),n=ji(r);return yp(ic,r).isInside?null:m.jsx(cp,R(S(S({},n),s),{ref:e}))});bp.displayName=ic;function wp(t,e){const r=Math.abs(e.top-t.y),s=Math.abs(e.bottom-t.y),n=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(r,s,n,i)){case i:return"left";case n:return"right";case r:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function _p(t,e,r=5){const s=[];
70switch(e){case"top":s.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":s.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":s.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":s.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return s}function xp(t){const{top:e,right:r,bottom:s,left:n}=t;return[{x:n,y:e},{x:r,y:e},{x:r,y:s},{x:n,y:s}]}function Sp(t,e){const{x:r,y:s}=t;let n=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,d=a.y,h=l.x,p=l.y;d>s!=p>s&&r<(h-c)*(s-d)/(p-d)+c&&(n=!n)}return n}function Ep(t){const e=t.slice();return e.sort((r,s)=>r.x<s.x?-1:r.x>s.x?1:r.y<s.y?-1:r.y>s.y?1:0),kp(e)}function kp(t){if(t.length<=1)return t.slice();const e=[];for(let s=0;s<t.length;s++){const n=t[s];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(n.y-o.y)>=(i.y-o.y)*(n.x-o.x))e.pop();else break}e.push(n)}e.pop();const r=[];for(let s=t.length-1;s>=0;s--){const n=t[s];for(;r.length>=2;){const i=r[r.length-1],o=r[r.length-2];if((i.x-o.x)*(n.y-o.y)>=(i.y-o.y)*(n.x-o.x))r.pop();else break}r.push(n)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var Tp=tc,oc=sc;const Eo=Tp,Ap=w.forwardRef((n,s)=>{var i=n,{className:t,sideOffset:e=4}=i,r=V(i,["className","sideOffset"]);return m.jsx(oc,S({ref:s,sideOffset:e,className:ir("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",t)},r))});Ap.displayName=oc.displayName;var vn=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},bn=typeof window=="undefined"||"Deno"in globalThis;function ze(){}function Rp(t,e){return typeof t=="function"?t(e):t}function Cp(t){return typeof t=="number"&&t>=0&&t!==1/0}function Op(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ri(t,e){return typeof t=="function"?t(e):t}function Pp(t,e){return typeof t=="function"?t(e):t}function ko(t,e){const{type:r="all",exact:s,fetchStatus:n,predicate:i,queryKey:o,stale:a}=t;if(o){if(s){if(e.queryHash!==Ii(o,e.options))return!1}else if(!ns(e.queryKey,o))return!1}if(r!=="all"){const l=e.isActive();if(r==="active"&&!l||r==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||n&&n!==e.state.fetchStatus||i&&!i(e))}function To(t,e){const{exact:r,status:s,predicate:n,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(ss(e.options.mutationKey)!==ss(i))return!1}else if(!ns(e.options.mutationKey,i))return!1}return!(s&&e.state.status!==s||n&&!n(e))}function Ii(t,e){return((e==null?void 0:e.queryKeyHashFn)||ss)(t)}function ss(t){return JSON.stringify(t,(e,r)=>si(r)?Object.keys(r).sort().reduce((s,n)=>(s[n]=r[n],s),{}):r)}function ns(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>ns(t[r],e[r])):!1}function ac(t,e){if(t===e)return t;const r=Ao(t)&&Ao(e);if(r||si(t)&&si(e)){const s=r?t:Object.keys(t),n=s.length,i=r?e:Object.keys(e),o=i.length,a=r?[]:{},l=new Set(s);let c=0;for(let d=0;d<o;d++){const h=r?d:i[d];(!r&&l.has(h)||r)&&t[h]===void 0&&e[h]===void 0?(a[h]=void 0,c++):(a[h]=ac(t[h],e[h]),a[h]===t[h]&&t[h]!==void 0&&c++)}return n===o&&c===n?t:a}return e}function pb(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(t[r]!==e[r])return!1;return!0}function Ao(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function si(t){if(!Ro(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!Ro(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Ro(t){return Object.prototype.toString.call(t)==="[object Object]"}function jp(t){return new Promise(e=>{setTimeout(e,t)})}function Ip(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?ac(t,e):e}function Np(t,e,r=0){const s=[...t,e];return r&&s.length>r?s.slice(1):s}function $p(t,e,r=0){const s=[e,...t];return r&&s.length>r?s.slice(0,-1):s}var Ni=Symbol();function lc(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Ni?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function gb(t,e){return typeof t=="function"?t(...e):!!t}var Xt,Pt,kr,Pa,Lp=(Pa=class extends vn{constructor(){super();se(this,Xt);se(this,Pt);se(this,kr);G(this,kr,e=>{if(!bn&&window.addEventListener){const r=()=>e();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){A(this,Pt)||this.setEventListener(A(this,kr))}onUnsubscribe(){var e;this.hasListeners()||((e=A(this,Pt))==null||e.call(this),G(this,Pt,void 0))}setEventListener(e){var r;G(this,kr,e),(r=A(this,Pt))==null||r.call(this),G(this,Pt,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){A(this,Xt)!==e&&(G(this,Xt,e),this.onFocus())}onFocus(){const e=this.isFocused();
70this.listeners.forEach(r=>{r(e)})}isFocused(){var e;return typeof A(this,Xt)=="boolean"?A(this,Xt):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Xt=new WeakMap,Pt=new WeakMap,kr=new WeakMap,Pa),cc=new Lp,Tr,jt,Ar,ja,Dp=(ja=class extends vn{constructor(){super();se(this,Tr,!0);se(this,jt);se(this,Ar);G(this,Ar,e=>{if(!bn&&window.addEventListener){const r=()=>e(!0),s=()=>e(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",s)}}})}onSubscribe(){A(this,jt)||this.setEventListener(A(this,Ar))}onUnsubscribe(){var e;this.hasListeners()||((e=A(this,jt))==null||e.call(this),G(this,jt,void 0))}setEventListener(e){var r;G(this,Ar,e),(r=A(this,jt))==null||r.call(this),G(this,jt,e(this.setOnline.bind(this)))}setOnline(e){A(this,Tr)!==e&&(G(this,Tr,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return A(this,Tr)}},Tr=new WeakMap,jt=new WeakMap,Ar=new WeakMap,ja),Xs=new Dp;function Up(){let t,e;const r=new Promise((n,i)=>{t=n,e=i});r.status="pending",r.catch(()=>{});function s(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{s({status:"fulfilled",value:n}),t(n)},r.reject=n=>{s({status:"rejected",reason:n}),e(n)},r}function Mp(t){return Math.min(1e3*Rn(2,t),3e4)}function uc(t){return(t!=null?t:"online")==="online"?Xs.isOnline():!0}var dc=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Dn(t){return t instanceof dc}function hc(t){let e=!1,r=0,s=!1,n;const i=Up(),o=g=>{var v;s||(p(new dc(g)),(v=t.abort)==null||v.call(t))},a=()=>{e=!0},l=()=>{e=!1},c=()=>cc.isFocused()&&(t.networkMode==="always"||Xs.isOnline())&&t.canRun(),d=()=>uc(t.networkMode)&&t.canRun(),h=g=>{var v;s||(s=!0,(v=t.onSuccess)==null||v.call(t,g),n==null||n(),i.resolve(g))},p=g=>{var v;s||(s=!0,(v=t.onError)==null||v.call(t,g),n==null||n(),i.reject(g))},u=()=>new Promise(g=>{var v;n=b=>{(s||c())&&g(b)},(v=t.onPause)==null||v.call(t)}).then(()=>{var g;n=void 0,s||(g=t.onContinue)==null||g.call(t)}),y=()=>{if(s)return;let g;const v=r===0?t.initialPromise:void 0;try{g=v!=null?v:t.fn()}catch(b){g=Promise.reject(b)}Promise.resolve(g).then(h).catch(b=>{var k,C,M;if(s)return;const x=(k=t.retry)!=null?k:bn?0:3,_=(C=t.retryDelay)!=null?C:Mp,E=typeof _=="function"?_(r,b):_,T=x===!0||typeof x=="number"&&r<x||typeof x=="function"&&x(r,b);if(e||!T){p(b);return}r++,(M=t.onFail)==null||M.call(t,r,b),jp(E).then(()=>c()?void 0:u()).then(()=>{e?p(b):y()})})};return{promise:i,cancel:o,continue:()=>(n==null||n(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?y():u().then(y),i)}}var Bp=t=>setTimeout(t,0);function Fp(){let t=[],e=0,r=a=>{a()},s=a=>{a()},n=Bp;const i=a=>{e?t.push(a):n(()=>{r(a)})},o=()=>{const a=t;t=[],a.length&&n(()=>{s(()=>{a.forEach(l=>{r(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{r=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{n=a}}}var ke=Fp(),Zt,Ia,fc=(Ia=class{constructor(){se(this,Zt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cp(this.gcTime)&&G(this,Zt,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t!=null?t:bn?1/0:5*60*1e3)}clearGcTimeout(){A(this,Zt)&&(clearTimeout(A(this,Zt)),G(this,Zt,void 0))}},Zt=new WeakMap,Ia),Rr,er,Ue,tr,we,fs,rr,Ke,ht,Na,Hp=(Na=class extends fc{constructor(e){var r;super();se(this,Ke);se(this,Rr);se(this,er);se(this,Ue);se(this,tr);se(this,we);se(this,fs);se(this,rr);G(this,rr,!1),G(this,fs,e.defaultOptions),this.setOptions(e.options),this.observers=[],G(this,tr,e.client),G(this,Ue,A(this,tr).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,G(this,Rr,Vp(this.options)),this.state=(r=e.state)!=null?r:A(this,Rr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=A(this,we))==null?void 0:e.promise}setOptions(e){this.options=S(S({},A(this,fs)),e),this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&A(this,Ue).remove(this)}setData(e,r){const s=Ip(this.state.data,e,this.options);return be(this,Ke,ht).call(this,{data:s,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),s}setState(e,r){be(this,Ke,ht).call(this,{type:"setState",state:e,setStateOptions:r})}cancel(e){var s,n;const r=(s=A(this,we))==null?void 0:s.promise;return(n=A(this,we))==null||n.cancel(e),r?r.then(ze).catch(ze):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(A(this,Rr))}isActive(){return this.observers.some(e=>Pp(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ni||this.state.dataUpdateCount+this.state.errorUpdate
70Count===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ri(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Op(this.state.dataUpdatedAt,e)}onFocus(){var r;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(r=A(this,we))==null||r.continue()}onOnline(){var r;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(r=A(this,we))==null||r.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),A(this,Ue).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(r=>r!==e),this.observers.length||(A(this,we)&&(A(this,rr)?A(this,we).cancel({revert:!0}):A(this,we).cancelRetry()),this.scheduleGc()),A(this,Ue).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||be(this,Ke,ht).call(this,{type:"invalidate"})}fetch(e,r){var c,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(A(this,we))return A(this,we).continueRetry(),A(this,we).promise}if(e&&this.setOptions(e),!this.options.queryFn){const p=this.observers.find(u=>u.options.queryFn);p&&this.setOptions(p.options)}const s=new AbortController,n=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(G(this,rr,!0),s.signal)})},i=()=>{const p=lc(this.options,r),y=(()=>{const g={client:A(this,tr),queryKey:this.queryKey,meta:this.meta};return n(g),g})();return G(this,rr,!1),this.options.persister?this.options.persister(p,y,this):p(y)},a=(()=>{const p={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:A(this,tr),state:this.state,fetchFn:i};return n(p),p})();(c=this.options.behavior)==null||c.onFetch(a,this),G(this,er,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&be(this,Ke,ht).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=p=>{var u,y,g,v;Dn(p)&&p.silent||be(this,Ke,ht).call(this,{type:"error",error:p}),Dn(p)||((y=(u=A(this,Ue).config).onError)==null||y.call(u,p,this),(v=(g=A(this,Ue).config).onSettled)==null||v.call(g,this.state.data,p,this)),this.scheduleGc()};return G(this,we,hc({initialPromise:r==null?void 0:r.initialPromise,fn:a.fetchFn,abort:s.abort.bind(s),onSuccess:p=>{var u,y,g,v;if(p===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(p)}catch(b){l(b);return}(y=(u=A(this,Ue).config).onSuccess)==null||y.call(u,p,this),(v=(g=A(this,Ue).config).onSettled)==null||v.call(g,p,this.state.error,this),this.scheduleGc()},onError:l,onFail:(p,u)=>{be(this,Ke,ht).call(this,{type:"failed",failureCount:p,error:u})},onPause:()=>{be(this,Ke,ht).call(this,{type:"pause"})},onContinue:()=>{be(this,Ke,ht).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),A(this,we).start()}},Rr=new WeakMap,er=new WeakMap,Ue=new WeakMap,tr=new WeakMap,we=new WeakMap,fs=new WeakMap,rr=new WeakMap,Ke=new WeakSet,ht=function(e){const r=s=>{var n,i;switch(e.type){case"failed":return R(S({},s),{fetchFailureCount:e.failureCount,fetchFailureReason:e.error});case"pause":return R(S({},s),{fetchStatus:"paused"});case"continue":return R(S({},s),{fetchStatus:"fetching"});case"fetch":return R(S(S({},s),Wp(s.data,this.options)),{fetchMeta:(n=e.meta)!=null?n:null});case"success":return G(this,er,void 0),S(R(S({},s),{data:e.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:(i=e.dataUpdatedAt)!=null?i:Date.now(),error:null,isInvalidated:!1,status:"success"}),!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null});case"error":const o=e.error;return Dn(o)&&o.revert&&A(this,er)?R(S({},A(this,er)),{fetchStatus:"idle"}):R(S({}
70,s),{error:o,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"});case"invalidate":return R(S({},s),{isInvalidated:!0});case"setState":return S(S({},s),e.state)}};this.state=r(this.state),ke.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),A(this,Ue).notify({query:this,type:"updated",action:e})})},Na);function Wp(t,e){return S({fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uc(e.networkMode)?"fetching":"paused"},t===void 0&&{error:null,status:"pending"})}function Vp(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,s=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?s!=null?s:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var et,$a,zp=($a=class extends vn{constructor(e={}){super();se(this,et);this.config=e,G(this,et,new Map)}build(e,r,s){var a;const n=r.queryKey,i=(a=r.queryHash)!=null?a:Ii(n,r);let o=this.get(i);return o||(o=new Hp({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(r),state:s,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){A(this,et).has(e.queryHash)||(A(this,et).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const r=A(this,et).get(e.queryHash);r&&(e.destroy(),r===e&&A(this,et).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){ke.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return A(this,et).get(e)}getAll(){return[...A(this,et).values()]}find(e){const r=S({exact:!0},e);return this.getAll().find(s=>ko(r,s))}findAll(e={}){const r=this.getAll();return Object.keys(e).length>0?r.filter(s=>ko(e,s)):r}notify(e){ke.batch(()=>{this.listeners.forEach(r=>{r(e)})})}onFocus(){ke.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ke.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},et=new WeakMap,$a),tt,xe,sr,rt,Rt,La,qp=(La=class extends fc{constructor(e){super();se(this,rt);se(this,tt);se(this,xe);se(this,sr);this.mutationId=e.mutationId,G(this,xe,e.mutationCache),G(this,tt,[]),this.state=e.state||Kp(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){A(this,tt).includes(e)||(A(this,tt).push(e),this.clearGcTimeout(),A(this,xe).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){G(this,tt,A(this,tt).filter(r=>r!==e)),this.scheduleGc(),A(this,xe).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){A(this,tt).length||(this.state.status==="pending"?this.scheduleGc():A(this,xe).remove(this))}continue(){var e,r;return(r=(e=A(this,sr))==null?void 0:e.continue())!=null?r:this.execute(this.state.variables)}execute(e){return f(this,null,function*(){var i,o,a,l,c,d,h,p,u,y,g,v,b,x,_,E,T,k,C,M,I;const r=()=>{be(this,rt,Rt).call(this,{type:"continue"})};G(this,sr,hc({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(L,B)=>{be(this,rt,Rt).call(this,{type:"failed",failureCount:L,error:B})},onPause:()=>{be(this,rt,Rt).call(this,{type:"pause"})},onContinue:r,retry:(i=this.options.retry)!=null?i:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>A(this,xe).canRun(this)}));const s=this.state.status==="pending",n=!A(this,sr).canStart();try{if(s)r();else{be(this,rt,Rt).call(this,{type:"pending",variables:e,isPaused:n}),yield(a=(o=A(this,xe).config).onMutate)==null?void 0:a.call(o,e,this);const B=yield(c=(l=this.options).onMutate)==null?void 0:c.call(l,e);B!==this.state.context&&be(this,rt,Rt).call(this,{type:"pending",context:B,variables:e,isPaused:n})}const L=yield A(this,sr).start();return yield(h=(d=A(this,xe).config).onSuccess)==null?void 0:h.call(d,L,e,this.state.context,this),yield(u=(p=this.options).onSuccess)==null?void 0:u.call(p,L,e,this.state.context),yield(g=(y=A(this,xe).config).onSettled)==null?void 0:g.call(y,L,null,this.state.variables,this.state.context,this),yield(b=(v=this.options).onSettled)==null?void 0:b.call(v,L,null,e,this.state.context),be(this,rt,Rt).call(this,{type:"success",data:L}),L}catch(L){try{throw yield(_=(x=A(this,xe).config).onError)==null?void 0:_.call(x,L,e,this.state.context,this),yield(T=(E=this.options).onError)==null?void 0:T.call(E,L,e,this.state.context),yield(C=(k=A(this,xe).config).onSettled)==null?void 0:C.call(k,void 0,L,this.state.variables,this.state.context,this),yield(I=(M=this.options).onSettled)==null?void 0:I.call(M,void 0,L,e,this.state.context),L}finally{be(this,rt,Rt).call(this,{type:"error",error:L})}}finally{A(this,xe).runNext(this)}})}},tt=new WeakMap,xe=new WeakMap,sr=new WeakMap,rt=new WeakSet,Rt=function(e){const r=s=>{switch(e.type){case"failed":return R(S({},s),{failureCount:e.failureCount,failureReason:e.error});case"pause":return R(S({},s),{isPaused:!0});case"continue":return R(S({},s),{isPaused:!1});
70case"pending":return R(S({},s),{context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()});case"success":return R(S({},s),{data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1});case"error":return R(S({},s),{data:void 0,error:e.error,failureCount:s.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"})}};this.state=r(this.state),ke.batch(()=>{A(this,tt).forEach(s=>{s.onMutationUpdate(e)}),A(this,xe).notify({mutation:this,type:"updated",action:e})})},La);function Kp(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yt,Ge,ps,Da,Gp=(Da=class extends vn{constructor(e={}){super();se(this,yt);se(this,Ge);se(this,ps);this.config=e,G(this,yt,new Set),G(this,Ge,new Map),G(this,ps,0)}build(e,r,s){const n=new qp({mutationCache:this,mutationId:++Es(this,ps)._,options:e.defaultMutationOptions(r),state:s});return this.add(n),n}add(e){A(this,yt).add(e);const r=Cs(e);if(typeof r=="string"){const s=A(this,Ge).get(r);s?s.push(e):A(this,Ge).set(r,[e])}this.notify({type:"added",mutation:e})}remove(e){if(A(this,yt).delete(e)){const r=Cs(e);if(typeof r=="string"){const s=A(this,Ge).get(r);if(s)if(s.length>1){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}else s[0]===e&&A(this,Ge).delete(r)}}this.notify({type:"removed",mutation:e})}canRun(e){const r=Cs(e);if(typeof r=="string"){const s=A(this,Ge).get(r),n=s==null?void 0:s.find(i=>i.state.status==="pending");return!n||n===e}else return!0}runNext(e){var s,n;const r=Cs(e);if(typeof r=="string"){const i=(s=A(this,Ge).get(r))==null?void 0:s.find(o=>o!==e&&o.state.isPaused);return(n=i==null?void 0:i.continue())!=null?n:Promise.resolve()}else return Promise.resolve()}clear(){ke.batch(()=>{A(this,yt).forEach(e=>{this.notify({type:"removed",mutation:e})}),A(this,yt).clear(),A(this,Ge).clear()})}getAll(){return Array.from(A(this,yt))}find(e){const r=S({exact:!0},e);return this.getAll().find(s=>To(r,s))}findAll(e={}){return this.getAll().filter(r=>To(e,r))}notify(e){ke.batch(()=>{this.listeners.forEach(r=>{r(e)})})}resumePausedMutations(){const e=this.getAll().filter(r=>
70r.state.isPaused);return ke.batch(()=>Promise.all(e.map(r=>r.continue().catch(ze))))}},yt=new WeakMap,Ge=new WeakMap,ps=new WeakMap,Da);function Cs(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Co(t){return{onFetch:(e,r)=>{var d,h,p,u,y;const s=e.options,n=(p=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:p.direction,i=((u=e.state.data)==null?void 0:u.pages)||[],o=((y=e.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=()=>f(this,null,function*(){var _;let g=!1;const v=E=>{Object.defineProperty(E,"signal",{enumerable:!0,get:()=>(e.signal.aborted?g=!0:e.signal.addEventListener("abort",()=>{g=!0}),e.signal)})},b=lc(e.options,e.fetchOptions),x=(E,T,k)=>f(this,null,function*(){if(g)return Promise.reject();if(T==null&&E.pages.length)return Promise.resolve(E);const M=(()=>{const N={client:e.client,queryKey:e.queryKey,pageParam:T,direction:k?"backward":"forward",meta:e.options.meta};return v(N),N})(),I=yield b(M),{maxPages:L}=e.options,B=k?$p:Np;return{pages:B(E.pages,I,L),pageParams:B(E.pageParams,T,L)}});if(n&&i.length){const E=n==="backward",T=E?Jp:Oo,k={pages:i,pageParams:o},C=T(s,k);a=yield x(k,C,E)}else{const E=t!=null?t:i.length;do{const T=l===0?(_=o[0])!=null?_:s.initialPageParam:Oo(s,a);if(l>0&&T==null)break;a=yield x(a,T),l++}while(l<E)}return a});e.options.persister?e.fetchFn=()=>{var g,v;return(v=(g=e.options).persister)==null?void 0:v.call(g,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r)}:e.fetchFn=c}}}function Oo(t,{pages:e,pageParams:r}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,r[s],r):void 0}function Jp(t,{pages:e,pageParams:r}){var s;return e.length>0?(s=t.getPreviousPageParam)==null?void 0:s.call(t,e[0],e,r[0],r):void 0}var fe,It,Nt,Cr,Or,$t,Pr,jr,Ua,Yp=(Ua=class{constructor(t={}){se(this,fe);se(this,It);se(this,Nt);se(this,Cr);se(this,Or);se(this,$t);se(this,Pr);se(this,jr);G(this,fe,t.queryCache||new zp),G(this,It,t.mutationCache||new Gp),G(this,Nt,t.defaultOptions||{}),G(this,Cr,new Map),G(this,Or,new Map),G(this,$t,0)}mount(){Es(this,$t)._++,A(this,$t)===1&&(G(this,Pr,cc.subscribe(t=>f(this,null,function*(){t&&(yield this.resumePausedMutations(),A(this,fe).onFocus())}))),G(this,jr,Xs.subscribe(t=>f(this,null,function*(){t&&(yield this.resumePausedMutations(),A(this,fe).onOnline())}))))}unmount(){var t,e;Es(this,$t)._--,A(this,$t)===0&&((t=A(this,Pr))==null||t.call(this),G(this,Pr,void 0),(e=A(this,jr))==null||e.call(this),G(this,jr,void 0))}isFetching(t){return A(this,fe).findAll(R(S({},t),{fetchStatus:"fetching"})).length}isMutating(t){return A(this,It).findAll(R(S({},t),{status:"pending"})).length}getQueryData(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=A(this,fe).get(e.queryHash))==null?void 0:r.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=A(this,fe).build(this,e),s=r.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(ri(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return A(this,fe).findAll(t).map(({queryKey:e,state:r})=>{const s=r.data;return[e,s]})}setQueryData(t,e,r){const s=this.defaultQueryOptions({queryKey:t}),n=A(this,fe).get(s.queryHash),i=n==null?void 0:n.state.data,o=Rp(e,i);if(o!==void 0)return A(this,fe).build(this,s).setData(o,R(S({},r),{manual:!0}))}setQueriesData(t,e,r){return ke.batch(()=>A(this,fe).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,r)]))}getQueryState(t){var r;const e=this.defaultQueryOptions({queryKey:t});return(r=A(this,fe).get(e.queryHash))==null?void 0:r.state}removeQueries(t){const e=A(this,fe);ke.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=A(this,fe);return ke.batch(()=>(r.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries(S({type:"active"},t),e)))}cancelQueries(t,e={}){const r=S({revert:!0},e),s=ke.batch(()=>A(this,fe).findAll(t).map(n=>n.cancel(r)));return Promise.all(s).then(ze).catch(ze)}invalidateQueries(t,e={}){return ke.batch(()=>{var r,s;return A(this,fe).findAll(t).forEach(n=>
70{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries(R(S({},t),{type:(s=(r=t==null?void 0:t.refetchType)!=null?r:t==null?void 0:t.type)!=null?s:"active"}),e)})}refetchQueries(t,e={}){var n;const r=R(S({},e),{cancelRefetch:(n=e.cancelRefetch)!=null?n:!0}),s=ke.batch(()=>A(this,fe).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,r);return r.throwOnError||(o=o.catch(ze)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(ze)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=A(this,fe).build(this,e);return r.isStaleByTime(ri(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(ze).catch(ze)}fetchInfiniteQuery(t){return t.behavior=Co(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(ze).catch(ze)}ensureInfiniteQueryData(t){return t.behavior=Co(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Xs.isOnline()?A(this,It).resumePausedMutations():Promise.resolve()}getQueryCache(){return A(this,fe)}getMutationCache(){return A(this,It)}getDefaultOptions(){return A(this,Nt)}setDefaultOptions(t){G(this,Nt,t)}setQueryDefaults(t,e){A(this,Cr).set(ss(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...A(this,Cr).values()],r={};return e.forEach(s=>{ns(t,s.queryKey)&&Object.assign(r,s.defaultOptions)}),r}setMutationDefaults(t,e){A(this,Or).set(ss(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...A(this,Or).values()],r={};return e.forEach(s=>{ns(t,s.mutationKey)&&Object.assign(r,s.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e=R(S(S(S({},A(this,Nt).queries),this.getQueryDefaults(t.queryKey)),t),{_defaulted:!0});return e.queryHash||(e.queryHash=Ii(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Ni&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:R(S(S(S({},A(this,Nt).mutations),(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey)),t),{_defaulted:!0})}clear(){A(this,fe).clear(),A(this,It).clear()}},fe=new WeakMap,It=new WeakMap,Nt=new WeakMap,Cr=new WeakMap,Or=new WeakMap,$t=new WeakMap,Pr=new WeakMap,jr=new WeakMap,Ua),pc=w.createContext(void 0),mb=t=>{const e=w.useContext(pc);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Po=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),m.jsx(pc.Provider,{value:t,children:e}));let ni=null;function jo(t){ni=t}function yb(t){if(!ni)return!1;try{return ni(t),!0}catch(e){return!1}}const Qp=Symbol.for("@supabase/supabase-js.traceContextExtractor");function Xp(){return globalThis[Qp]}var ii=function(t,e){return ii=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(r[n]=s[n])},ii(t,e)};function vb(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ii(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Io=function(){return Io=Object.assign||function(e){for(var r,s=1,n=arguments.length;s<n;s++){r=arguments[s];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Io.apply(this,arguments)};function wn(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function Zp(t,e,r,s){function n(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(d){try{c(s.next(d))}catch(h){o(h)}}function l(d){try{c(s.throw(d))}catch(h){o(h)}}function c(d){d.done?i(d.value):n(d.value).then(a,l)}c((s=s.apply(t,e||[])).next())})}function bb(t,e,r){if(r||arguments.length===2)for(var s=0,n=e.length,i;s<n;s++)(i||!(s in e))&&(i||(i=Array.prototype.slice.call(e,0,s)),i[s]=e[s]);return t.concat(i||Array.prototype.slice.call(e))}const eg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);
70class $i extends Error{constructor(e,r="FunctionsError",s){super(e),this.name=r,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class tg extends $i{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class No extends $i{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class $o extends $i{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var oi;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(oi||(oi={}));class rg{constructor(e,{headers:r={},customFetch:s,region:n=oi.Any}={}){this.url=e,this.headers=r,this.region=n,this.fetch=eg(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Zp(this,arguments,void 0,function*(r,s={}){var n,i;let o,a,l;try{const{headers:c,method:d,body:h,signal:p,timeout:u}=s;let y={},{region:g}=s;g||(g=this.region);const v=new URL(`${this.url}/${r}`);g&&g!=="any"&&(y["x-region"]=g,v.searchParams.set("forceFunctionRegion",g));let b;const x=!!c&&Object.keys(c).some(M=>M.toLowerCase()==="content-type");h&&!x?typeof Blob!="undefined"&&h instanceof Blob||h instanceof ArrayBuffer?(y["Content-Type"]="application/octet-stream",b=h):typeof h=="string"?(y["Content-Type"]="text/plain",b=h):typeof FormData!="undefined"&&h instanceof FormData?b=h:(y["Content-Type"]="application/json",b=JSON.stringify(h)):h&&typeof h!="string"&&!(typeof Blob!="undefined"&&h instanceof Blob)&&!(h instanceof ArrayBuffer)&&!(typeof FormData!="undefined"&&h instanceof FormData)?b=JSON.stringify(h):b=h;let _=p;u&&(a=new AbortController,o=setTimeout(()=>a.abort(),u),p?(_=a.signal,l=()=>a.abort(),p.addEventListener("abort",l)):_=a.signal);const E=yield this.fetch(v.toString(),{method:d||"POST",headers:Object.assign(Object.assign(Object.assign({},y),this.headers),c),body:b,signal:_}).catch(M=>{throw new tg(M)}),T=E.headers.get("x-relay-error");if(T&&T==="true")throw new No(E);if(!E.ok)throw new $o(E);let k=((n=E.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim().toLowerCase(),C;return k==="application/json"?C=yield E.json():k==="application/octet-stream"||k==="application/pdf"?C=yield E.blob():k==="text/event-stream"?C=E:k==="multipart/form-data"?C=yield E.formData():C=yield E.text(),{data:C,error:null,response:E}}catch(c){return{data:null,error:c,response:c instanceof $o||c instanceof No?c.context:void 0}}finally{o&&clearTimeout(o),l&&((i=s.signal)===null||i===void 0||i.removeEventListener("abort",l))}})}}var wr=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.co
70de=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};const gc=3,Lo=t=>Math.min(1e3*Rn(2,t),3e4),sg=[520,503],mc=["GET","HEAD","OPTIONS"];function is(t){"@babel/helpers - typeof";return is=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},is(t)}function ng(t,e){if(is(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(is(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ig(t){var e=ng(t,"string");return is(e)=="symbol"?e:e+""}function og(t,e,r){return(e=ig(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Do(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function Jt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Do(Object(r),!0).forEach(function(s){og(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Do(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}function Uo(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const s=setTimeout(()=>{e==null||e.removeEventListener("abort",n),r()},t);function n(){clearTimeout(s),r()}e==null||e.addEventListener("abort",n)})}function ag(t,e,r,s){return!(!s||r>=gc||!mc.includes(t)||!sg.includes(e))}function yc(t,e,r,s){return f(this,null,function*(){let n=0;for(;;){const a=Jt({},r.headers);n>0&&(a["X-Retry-Count"]=String(n));let l;try{l=yield t(e,{method:r.method,headers:a,body:r.body,signal:r.signal})}catch(c){if((c==null?void 0:c.name)==="AbortError"||(c==null?void 0:c.code)==="ABORT_ERR"||!mc.includes(r.method))throw c;if(s&&n<gc){const d=Lo(n);n++,yield Uo(d,r.signal);continue}throw c}if(ag(r.method,l.status,n,s)){var i,o;const c=(i=(o=l.headers)===null||o===void 0?void 0:o.get("Retry-After"))!==null&&i!==void 0?i:null,d=c!==null?Math.max(0,parseInt(c,10)||0)*1e3:Lo(n);yield l.text(),n++,yield Uo(d,r.signal);continue}return l}})}var lg=class{constructor(t){var e,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(s=t.shouldStripNulls)!==null&&s!==void 0?s:!1,this.urlLengthLimit=(n=t.urlLengthLimit)!==null&&n!==void 0?n:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const s=this.fetch;let i=f(this,null,function*(){const o={};r.headers.forEach((l,c)=>{o[c]=l});const a=yield yc(s,r.url.toString(),{method:r.method,headers:o,body:JSON.stringify(r.body,(l,c)=>typeof c=="bigint"?c.toString():c),signal:r.signal},r.retryEnabled);
70return yield r.processResponse(a)});return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",d="";const h=o==null?void 0:o.cause;if(h){var p,u,y,g;const x=(p=h==null?void 0:h.message)!==null&&p!==void 0?p:"",_=(u=h==null?void 0:h.code)!==null&&u!==void 0?u:"";l=`${(y=o==null?void 0:o.name)!==null&&y!==void 0?y:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
71
72Caused by: ${(g=h==null?void 0:h.name)!==null&&g!==void 0?g:"Error"}: ${x}`,_&&(l+=` (${_})`),h!=null&&h.stack&&(l+=`
73${h.stack}`)}else{var v;l=(v=o==null?void 0:o.stack)!==null&&v!==void 0?v:""}const b=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(d="",c="Request was aborted (timeout or manual cancellation)",b>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${b} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(d="",c="HTTP headers exceeded server limits (typically 16KB)",b>this.urlLengthLimit&&(c+=`. Your request URL is ${b} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:d},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}processResponse(t){return f(this,null,function*(){var e=this;let r=null,s=null,n=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const u=yield t.text();if(u!=="")if(e.headers.get("Accept")==="text/csv")s=u;else if(e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text")))s=u;else try{s=JSON.parse(u)}catch(y){if(r={message:u},s=null,e.shouldThrowOnError)throw new wr({message:u,details:"",hint:"",code:""})}}const h=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),p=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");if(h&&p&&p.length>1&&(n=parseInt(p[1])),e.isMaybeSingle&&Array.isArray(s))if(s.length>1){if(r={code:"PGRST116",details:`Results contain ${s.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},s=null,n=null,i=406,o="Not Acceptable",e.shouldThrowOnError){var d;throw new wr(Jt(Jt({},r),{},{hint:(d=r.hint)!==null&&d!==void 0?d:""}))}}else s.length===1?s=s[0]:s=null}else{const h=yield t.text();try{r=JSON.parse(h),Array.isArray(r)&&t.status===404&&(s=[],r=null,i=200,o="OK")}catch(p){t.status===404&&h===""?(i=204,o="No Content"):r={message:h}}if(r&&e.shouldThrowOnError)throw new wr(r)}return{success:r===null,error:r,data:s,count:n,status:i,statusText:o}})}returns(){return this}overrideTypes(){return this}},cg=class extends lg{throwOnError(){return super.throwOnError()}select(t){let e=!1;const r=(t!=null?t:"*").split("").map(s=>/\s/.test(s)&&!e?"":(s==='"'&&(e=!e),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const s=typeof r=="undefined"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:s=r}={}){const n=typeof s=="undefined"?"offset":`${s}.offset`,i=typeof s=="undefined"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
73explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Mo=new RegExp("[,()]");var gr=class extends cg{throwOnError(){return super.throwOnError()}eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(s=>typeof s=="string"&&Mo.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(s=>typeof s=="string"&&Mo.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:s}={}){let n="";s==="plain"?n="pl":s==="phrase"?n="ph":s==="websearch"&&(n="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${n}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},ug=class{constructor(t,{headers:e={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:s}=e!=null?e:{},n=r?"HEAD":"GET";let i=!1;const o=(t!=null?t:"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),s&&l.append("Prefer",`count=${s}`),new gr({method:n,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var s;const n="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>
730){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new gr({method:n,url:i,headers:o,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),s&&l.append("Prefer",`count=${s}`),n||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((d,h)=>d.concat(Object.keys(h)),[]);if(c.length>0){const d=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",d.join(","))}}return new gr({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const s="PATCH",{url:n,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new gr({method:s,url:n,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new gr({method:r,url:s,headers:n,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function dg(t,e){try{const o=JSON.parse(t);if(o&&typeof o=="object"&&!Array.isArray(o)){var r,s,n,i;return new wr({message:String((r=o.message)!==null&&r!==void 0?r:t),details:(s=o.details)!==null&&s!==void 0?s:"",hint:(n=o.hint)!==null&&n!==void 0?n:"",code:(i=o.code)!==null&&i!==void 0?i:""})}}catch(o){}return new wr({message:t||e,details:"",hint:"",code:""})}function Bo(t,e,r){var s;const n=t;return{success:!1,error:new wr({message:`${(s=n==null?void 0:n.name)!==null&&s!==void 0?s:"FetchError"}: ${n==null?void 0:n.message}`,details:"",hint:"",code:""}),data:null,count:null,status:e,statusText:r}}var hg=class vc{constructor(e,{headers:r={},schema:s,fetch:n,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=s,this.urlLengthLimit=o;const l=n!=null?n:globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,d)=>{const h=new AbortController,p=setTimeout(()=>h.abort(),i),u=d==null?void 0:d.signal;if(u){if(u.aborted)return clearTimeout(p),l(c,d);const y=()=>{clearTimeout(p),h.abort()};return u.addEventListener("abort",y,{once:!0}),l(c,Jt(Jt({},d),{},{signal:h.signal})).finally(()=>{clearTimeout(p),u.removeEventListener("abort",y)})}return l(c,Jt(Jt({},d),{},{signal:h.signal})).finally(()=>clearTimeout(p))}:this.fetch=l,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new ug(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new vc(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}getOpenApiSpec(){return f(this,null,function*(){var e=this,r;const s=new Headers(e.headers);s.set("Accept","application/openapi+json"),e.schemaName&&s.set("Accept-Profile",e.schemaName);const n={};s.forEach((c,d)=>{n[d]=c});const i=(r=e.fetch)!==null&&r!==void 0?r:globalThis.fetch;let o;try{var a;o=yield yc(i,`${e.url}/`,{method:"GET",headers:n},(a=e.retry)!==null&&a!==void 0?a:!0)}catch(c){return Bo(c,0,"")}let l;try{l=yield o.text()}catch(c){return Bo(c,o.status,o.statusText)}if(o.ok)try{return{success:!0,error:null,data:JSON.parse(l),count:null,status:o.status,statusText:o.statusText}}catch(c){}return{success:!1,error:dg(l,o.statusText),data:null,count:null,status:o.status,statusText:o.statusText}})}rpc(e,r={},{head:s=!1,get:n=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const d=u=>u!==null&&typeof u=="object"&&(!Array.isArray(u)||u.some(d)),h=s&&Object.values(r).some(d);h?(a="POST",c=r):s||n?(a=s?"HEAD":"GET",Object.entries(r).filter(([u,y])=>y!==void 0).map(([u,y])=>[u,Array.isArray(y)?`{${y.join(",")}}`:`${y}
73`]).forEach(([u,y])=>{l.searchParams.append(u,y)})):(a="POST",c=r);const p=new Headers(this.headers);return h?p.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&p.set("Prefer",`count=${i}`),new gr({method:a,url:l,headers:p,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class fg{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket!="undefined")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis!="undefined"&&typeof r.WebSocket!="undefined")return{type:"native",wsConstructor:r.WebSocket};const s=typeof global!="undefined"?global:void 0;if(s&&typeof s.WebSocket!="undefined")return{type:"native",wsConstructor:s.WebSocket};if(typeof globalThis!="undefined"&&typeof r.WebSocketPair!="undefined"&&typeof globalThis.WebSocket=="undefined")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis!="undefined"&&r.EdgeRuntime||typeof navigator!="undefined"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const i=n.versions;if(i&&i.node)return{type:"unsupported",error:"Node.js detected but native WebSocket not found.",workaround:"Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option."}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
74
75Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch(e){return!1}}}const pg="2.117.1",gg=`realtime-js/${pg}`,mg="1.0.0",bc="2.0.0",yg=bc,vg=1e4,bg=15e3,wg=1e4,_g=100,Ct={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},wc={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ai={connecting:"connecting",closing:"closing",closed:"closed"};class xg{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e!=null?e:[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,s;const n=(s=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var r,s;const n=(s=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&s!==void 0?s:{},o=new TextEncoder().encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,s){var n,i;const o=new TextEncoder,a=o.encode(e.topic),l=o.encode((n=e.ref)!==null&&n!==void 0?n:""),c=o.encode((i=e.join_ref)!==null&&i!==void 0?i:""),d=o.encode(e.payload.event),h=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},p=o.encode(Object.keys(h).length===0?"":JSON.stringify(h));if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`userEvent length ${d.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`metadata length ${p.length} exceeds maximum of 255`);const u=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+a.length+d.length+p.length,y=new ArrayBuffer(this.HEADER_LENGTH+u),g=new DataView(y),v=new Uint8Array(y);let b=0;g.setUint8(b++,this.KINDS.userBroadcastPush),g.setUint8(b++,c.length),g.setUint8(b++,l.length),g.setUint8(b++,a.length),g.setUint8(b++,d.length),g.setUint8(b++,p.length),g.setUint8(b++,r),v.set(c,b),b+=c.length,v.set(l,b),b+=l.length,v.set(a,b),b+=a.length,v.set(d,b),b+=d.length,v.set(p,b),b+=p.length;var x=new Uint8Array(y.byteLength+s.byteLength);return x.set(new Uint8Array(y),0),x.set(new Uint8Array(s),y.byteLength),x.buffer}decode(e,r){if(this._isArrayBuffer(e)){let s=this._binaryDecode(e);return r(s)}if(typeof e=="string"){const s=JSON.parse(e),[n,i,o,a,l]=s;return r({join_ref:n,ref:i,topic:o,event:a,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),s=r.getUint8(0),n=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,n)}}_decodeUserBroadcast(e,r,s){const n=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4);let l=this.HEADER_LENGTH+4;const c=s.decode(e.slice(l,l+n));l=l+n;const d=s.decode(e.slice(l,l+i));l=l+i;
75const h=s.decode(e.slice(l,l+o));l=l+o;const p=e.slice(l,e.byteLength),u=a===this.JSON_ENCODING?JSON.parse(s.decode(p)):p,y={type:this.BROADCAST_EVENT,event:d,payload:u};return o>0&&(y.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:y}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([s])=>r.includes(s)))}}var ae;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(ae||(ae={}));const Fo=(t,e,r={})=>{var s;const n=(s=r.skipTypes)!==null&&s!==void 0?s:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=Sg(o,t,e,n),i),{}):{}},Sg=(t,e,r,s)=>{const n=e.find(a=>a.name===t),i=n==null?void 0:n.type,o=r[t];return i&&!s.includes(i)?_c(i,o):li(o)},_c=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return Ag(e,r)}switch(t){case ae.bool:return Eg(e);case ae.float4:case ae.float8:case ae.int2:case ae.int4:case ae.int8:case ae.numeric:case ae.oid:return kg(e);case ae.json:case ae.jsonb:return Tg(e);case ae.timestamp:return Rg(e);case ae.abstime:case ae.date:case ae.daterange:case ae.int4range:case ae.int8range:case ae.money:case ae.reltime:case ae.text:case ae.time:case ae.timestamptz:case ae.timetz:case ae.tsrange:case ae.tstzrange:return li(e);default:return li(e)}},li=t=>t,Eg=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},kg=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Tg=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return t}return t},Ag=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,s=t[r];if(t[0]==="{"&&s==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch(a){i=o?o.split(","):[]}return i.map(a=>_c(e,a))}return t},Rg=t=>typeof t=="string"?t.replace(" ","T"):t,xc=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var _r=t=>typeof t=="function"?t:function(){return t},Cg=typeof self!="undefined"?self:null,mr=typeof window!="undefined"?window:null,Ze=Cg||mr||globalThis,Og="2.0.0",Pg=1e4,jg=1e3,Ig=100,st={connecting:0,open:1,closing:2,closed:3},Ae={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ft={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ci={longpoll:"longpoll",websocket:"websocket"},Ng={complete:4},ui="base64url.bearer.phx.",Os=class{constructor(t,e,r,s){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(s=>s.status===t).forEach(s=>s.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},Sc=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},$g=class{constructor(t,e,r){this.state=Ae.closed,this.topic=t,this.params=_r(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Os(this,ft.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Sc(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Ae.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",s=>{this.state=Ae.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Ae.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=Ae.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new Os(this,ft.leave,_r({}),this.timeout).send(),this.state=Ae.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(ft.reply,(s,n)=>{this.trigger(this.replyEventName(n),s)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ae.closed,this.bindings=[]}onClose(t){this.on(ft.close,t)}onError(t){return this.on(ft.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e=="undefined"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new Os(this,t,function(){return e},r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Ae.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(ft.close,"leave")},r=new Os(this,ft.leave,_r({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,s){return this.topic!==t?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Ae.joining,this.joinPush.resend(t))}trigger(t,e,r,s){let n=this.onMessage(t,e,r,s);if(e&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,r));for(let o=0;o<i.length;o++)i[o].callback(n,r,s||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===Ae.closed}isErrored(){return this.state===Ae.errored}isJoined(){return this.state===Ae.joined}isJoining(){return this.state===Ae.joining}isLeaving(){return this.state===Ae.leaving}},Zs=class{static request(t,e,r,s,n,i,o){if(Ze.XDomainRequest){let a=new Ze.XDomainRequest;return this.xdomainRequest(a,t,e,s,n,i,o)}else if(Ze.XMLHttpRequest){let a=new Ze.XMLHttpRequest;return this.xhrRequest(a,t,e,r,s,n,i,o)}else{if(Ze.fetch&&Ze.AbortController)return this.fetchRequest(t,e,r,s,n,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,s,n,i,o){let a={method:t,headers:r,body:s},l=null;return n&&(l=new AbortController,setTimeout(()=>l.abort(),n),a.signal=l.signal),Ze.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,r,s,n,i,o){return t.timeout=n,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(s),t}static xhrRequest(t,e,r,s,n,i,o,a){t.open(e,r,!0),t.timeout=i;for(let[l,c]of Object.entries(s))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===Ng.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(n),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch(e){return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let n=e?`${e}[${s}]`:s,i=t[s];typeof i=="object"?r.push(this.serialize(i,n)):r.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},Lg=t=>{let e="",r=new Uint8Array(t),s=r.byteLength;for(let n=0;n<s;n++)e+=String.fromCharCode(r[n]);return btoa(e)},ur=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(ui)&&(this.authToken=atob(e[1].slice(ui.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){}
vendor: 14,890 bytes, lines 75-76
75,this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=st.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ci.websocket),"$1/"+ci.longpoll)}endpointURL(){return Zs.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=st.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===st.open||this.readyState===st.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:s,messages:n}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=s}else r=0;switch(r){case 200:n.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=st.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(t){typeof t!="string"&&(t=Lg(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t,e=0){this.awaitingBatchAck=!0;const r=e+Ig,s=t.slice(e,r);this.ajax("POST",{"Content-Type":"application/x-ndjson"},s.join(`
76`),()=>this.onerror("timeout"),n=>{!n||n.status!==200?(this.awaitingBatchAck=!1,this.onerror(n&&n.status),this.closeAndRetry(1011,"internal server error",!1)):r<t.length?this.batchSend(t,r):this.batchBuffer.length>0?(this.batchSend(this.batchBuffer),this.batchBuffer=[]):this.awaitingBatchAck=!1})}close(t,e,r){for(let n of this.reqs)n.abort();this.readyState=st.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent!="undefined"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(t,e,r,s,n){let i,o=()=>{this.reqs.delete(i),s()};i=Zs.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&n(a)}),this.reqs.add(i)}},Dg=class Jr{constructor(e,r={}){let s=r.events||{state:"presence_state",diff:"presence_diff"};this.state=Object.create(null),this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(s.state,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Jr.syncState(this.state,n,i,o),this.pendingDiffs.forEach(l=>{this.state=Jr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(s.diff,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=Jr.syncDiff(this.state,n,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Jr.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,s,n){let i=this.toNullProtoObj(this.clone(e));r=this.toNullProtoObj(r);let o=Object.create(null),a=Object.create(null);return this.map(i,(l,c)=>{r[l]||(a[l]=c)}),this.map(r,(l,c)=>{let d=i[l];if(d){let h=c.metas.map(g=>g.phx_ref),p=d.metas.map(g=>g.phx_ref),u=c.metas.filter(g=>p.indexOf(g.phx_ref)<0),y=d.metas.filter(g=>h.indexOf(g.phx_ref)<0);u.length>0&&(o[l]=c,o[l].metas=u),y.length>0&&(a[l]=this.clone(d),a[l].metas=y)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},s,n)}static syncDiff(e,r,s,n){e=this.toNullProtoObj(e);let{joins:i,leaves:o}=this.clone(r);return s||(s=function(){}),n||(n=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let d=e[a].metas.map(p=>p.phx_ref),h=c.metas.filter(p=>d.indexOf(p.phx_ref)<0);e[a].metas.unshift(...h)}s(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let d=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>d.indexOf(h.phx_ref)<0),n(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(s,n){return n}),this.map(e,(s,n)=>r(s,n))}static map(e,r){return Object.getOwnPropertyNames(e).map(s=>r(s,e[s]))}static toNullProtoObj(e){if(Object.getPrototypeOf(e)===null)return e;let r=Object.create(null);return Object.getOwnPropertyNames(e).forEach(s=>{r[s]=e[s]}),r}static clone(e){return JSON.parse(JSON.stringify(e))}},Ps={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,s,n,i,o]=JSON.parse(t);return e({join_ref:r,ref:s,topic:n,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:s,topic:n,payload:i}=t,o=new TextEncoder,a=o.encode(e),l=o.encode(r),c=o.encode(n),d=o.encode(s);this.assertFieldSize(a.byteLength,"join_ref"),this.assertFieldSize(l.byteLength,"ref"),this.assertFieldSize(c.byteLength,"topic"),this.assertFieldSize(d.byteLength,"event");let h=this.META_LENGTH+a.byteLength+l.byteLength+c.byteLength+d.byteLength,p=new ArrayBuffer(this.HEADER_LENGTH+h),u=new Uint8Array(p),y=new DataView(p),g=0;y.setUint8(g++,this.KINDS.push),y.setUint8(g++,a.byteLength),y.setUint8(g++,l.byteLength),y.setUint8(g++,c.byteLength),y.setUint8(g++,d.byteLength),u.set(a,g),g+=a.byteLength,u.set(l,g),g+=l.byteLength,u.set(c,g),g+=c.byteLength,u.set(d,g),g+=d.byteLength;var v=new Uint8Array(p.byteLength+i.byteLength);return v.set(u,0),v.set(new Uint8Array(i),p.byteLength),v.buffer},assertFieldSize(t,e){if(t>255)throw new Error(`unable to convert ${e} to binary: must be less than or equal to 255 bytes, but is ${t} bytes`)},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,s);case this.KINDS.reply:return this.decodeReply(t,e,s);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,s)}},decodePush(t,e,r){let s=e.getUint8(1),n=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(o,o+s));o=o+s;let l=r.decode(t.slice(o,o+n));o=o+n;let c=r.decode(t.slice(o,o+i));o=o+i;let d=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:d}},decodeReply(t,e,r){let s=e.getUint8(1),n=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=r.decode(t.slice(a,a+s));a=a+s;let c=r.decode(t.slice(a,a+n));a=a+n;let d=r.decode(t.slice(a,a+i));a=a+i;let h=r.decode(t.slice(a,a+o));a=a+o;let p=t.slice(a,t.byteLength),u={status:h,response:p};return{join_ref:l,ref:c,topic:d,event:ft.reply,payload:u}},decodeBroadcast(t,e,r){let s=e.getUint8(1),n=e.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(t.slice(i,i+s));i=i+s;let a=r.decode(t.slice(i,i+n));i=i+n;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Ug=class{constructor(t,e={}){var n,i;this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||Pg,this.transport=e.transport||Ze.WebSocket||ur,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Ze&&Ze.sessionStorage}catch(o){}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=Ps.encode.bind(Ps),this.defaultDecoder=Ps.decode.bind(Ps),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==ur?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;mr&&mr.addEventListener&&(mr.addEventListener("pagehide",o=>{this.conn&&(this.disconnect(),s=this.connectClock)}),mr.addEventListener("pageshow",o=>{s===this.connectClock&&(s=null,this.connect())}),mr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=(n=e.autoSendHeartbeat)!=null?n:!0,this.heartbeatCallback=(i=e.heartbeatCallback)!=null?i:()=>{},this.rejoinAfterMs=o=>e.rejoinAfterMs?e.rejoinAfterMs(o):[1e3,2e3,5e3][o-1]||1e4,this.reconnectAfterMs=o=>e.reconnectAfterMs?e.reconnectAfterMs(o):[10,50,100,150,200,250,500,1e3,2e3][o-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(o,a,l)=>{console.log(`${o}: ${a}`,l)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=_r(e.params||{}),this.endPoint=`${t}/${ci.websocket}`,this.vsn=e.vsn||Og,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Sc(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>f(this,null,function*(){e.beforeReconnect&&(yield e.beforeReconnect()),this.connect()}))},this.reconnectAfterMs),this.authToken=e.authToken&&_r(e.authToken)}getLongPollTransport(){return ur}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Zs.appendParams(Zs.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=_r(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==ur?this.connectWithFallback(ur,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let s=this.onMessage(n=>{n.ref===e&&(this.off([s]),t(Date.now()-r))});return!0}transportName(t){switch(t){case ur:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${ui}${btoa(this.authToken()).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,s=!0,n,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([n,i]),s=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),i=this.onError(l=>{this.log("transport","error",l),s&&!r&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!s){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),jg,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const s=this.conn;this.waitForBufferDone(s,()=>{e?s.close(e,r||""):s.close(),this.waitForSocketClosed(s,()=>{this.conn===s&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===st.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}
76triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(ft.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case st.connecting:return"connecting";case st.open:return"open";case st.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new $g(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:s,ref:n,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${n})`,s)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:s,payload:n,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(n.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${n.status||""} ${r} ${s} ${i&&"("+i+")"||""}`.trim(),n);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(r,s,n,o)&&l.trigger(s,n,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,s])=>{try{s(...e)}catch(n){this.log("error",`error in ${t} callback`,n)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class Zr{constructor(e,r){const s=Bg(r);this.presence=new Dg(e.getChannel(),s),this.presence.onJoin((n,i,o)=>{const a=Zr.onJoinPayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((n,i,o)=>{const a=Zr.onLeavePayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Zr.transformState(this.presence.state)}static transformState(e){return e=Mg(e),Object.getOwnPropertyNames(e).reduce((r,s)=>{const n=e[s];return r[s]=Ws(n),r},{})}static onJoinPayload(e,r,s){const n=Ho(r),i=Ws(s);return{event:"join",key:e,currentPresences:n,newPresences:i}}static onLeavePayload(e,r,s){const n=Ho(r),i=Ws(s);return{event:"leave",key:e,currentPresences:n,leftPresences:i}}}function Ws(t){return t.metas.map(e=>{const r=Object.getOwnPropertyDescriptors(e),s=Object.defineProperties({},r);return s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s})}function Mg(t){return JSON.parse(JSON.stringify(t))}function Bg(t){return(t==null?void 0:t.events)&&{events:t.events}}function Ho(t){return t!=null&&t.metas?Ws(t):[]}var Wo;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Wo||(Wo={}));class Fg{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Zr(this.channel.channelAdapter,r)}}function Hg(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;
76if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class Wg{constructor(e,r,s){const n=Vg(s);this.channel=e.getSocket().channel(r,n),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,s){let n;try{n=this.channel.push(e,r,s)}catch(i){throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>_g){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return n}updateJoinPayload(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===Ct.joined}isJoined(){return this.state===Ct.joined}isJoining(){return this.state===Ct.joining}isClosed(){return this.state===Ct.closed}isLeaving(){return this.state===Ct.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Vg(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}const zg=/[,()"\\]/,qg=t=>zg.test(t)||t!==t.trim(),Kg=t=>`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Vo=t=>{const e=t===null?"null":String(t);return qg(e)?Kg(e):e},Gg=t=>t===null?"null":String(t),Jg=(t,e)=>{if(t==="in"){const r=Array.isArray(e)?e:[e];if(r.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(r)).map(n=>Vo(n)).join(",")})`}return t==="is"?`is.${Gg(e)}`:`${t}.${Vo(e)}`};class Yg{constructor(){this.filters=[]}add(e,r,s,n=!1){const i=n?"not.":"";return this.filters.push(`${e}=${i}${Jg(r,s)}`),this}eq(e,r){return this.add(e,"eq",r)}neq(e,r){return this.add(e,"neq",r)}gt(e,r){return this.add(e,"gt",r)}gte(e,r){return this.add(e,"gte",r)}lt(e,r){return this.add(e,"lt",r)}lte(e,r){return this.add(e,"lte",r)}in(e,r){return this.add(e,"in",r)}like(e,r){return this.add(e,"like",r)}ilike(e,r){return this.add(e,"ilike",r)}match(e,r){return this.add(e,"match",r)}imatch(e,r){return this.add(e,"imatch",r)}is(e,r){return this.add(e,"is",r)}isDistinct(e,r){return this.add(e,"isdistinct",r)}not(e,r,s){return this.add(e,r,s,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var zo;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(zo||(zo={}));var Kt;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Kt||(Kt={}));var pt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(pt||(pt={}));class gt{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},s){var n,i;if(this.topic=e,this.params=r,this.socket=s,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Wg(this.socket.socketAdapter,e,this.params),this.presence=new Fg(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=xc(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(n=this.params.config)===null||n===void 0?void 0:n.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,r=this.timeout){var s,n,i,o;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:l,private:c,postgres_changes_options:d}}=this.params,h=(n=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(v=>v.filter))!==null&&n!==void 0?n:[],p=!!this.bindings[Kt.PRESENCE]&&this.bindings[Kt.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,u={},y=Object.assign({broadcast:a,presence:Object.assign(Object.assign({},l),{enabled:p}),postgres_changes:h,private:c},d?{postgres_changes_options:d}:{});this.socket.accessTokenValue&&(u.access_token=this.socket.accessTokenValue),this._onError(v=>{e==null||e(pt.CHANNEL_ERROR,Hg(v))}),this._onClose(()=>e==null?void 0:e(pt.CLOSED)),this.updateJoinPayload(Object.assign({config:y},u)),this._updateFilterMessage();const g=d!=null&&d.wait&&h.length>0?Math.max(r,((o=d.timeout)!==null&&o!==void 0?o:bg)+wg):r;this.channelAdapter.subscribe(g).receive("ok",b=>f(this,[b],function*({postgres_changes:v}){if(this.socket._isManualToken()||this.socket.setAuth(),v===void 0){e==null||e(pt.SUBSCRIBED);return}this._updatePostgresBindings(v,e)})).receive("error",v=>{this.state=Ct.errored;const b=Object.values(v).join(", ")||"error";e==null||e(pt.CHANNEL_ERROR,new Error(b,{cause:v}))}).receive("timeout",()=>{e==null||e(pt.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var s;const n=this.bindings.postgres_changes,i=(s=n==null?void 0:n.length)!==null&&s!==void 0?s:0,o=[];for(let a=0;a<i;a++){const l=n[a],{filter:{event:c,schema:d,table:h,filter:p}}=l,u=e&&e[a];if(u&&u.event===c&&gt.isFilterValueEqual(u.schema,d)&&gt.isFilterValueEqual(u.table,h)&&gt.isFilterValueEqual(u.filter,p))o.push(Object.assign(Object.assign({},l),{id:u.id}));else{this.unsubscribe(),this.state=Ct.errored,r==null||r(pt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Ct.errored&&r&&r(pt.SUBSCRIBED)}presenceState(){return this.presence.state}track(s){return f(this,arguments,function*(e,r={}){return yield this.send({type:"presence",event:"track",payload:e},r)})}untrack(){return f(this,arguments,function*(e={}){return yield this.send({type:"presence",event:"untrack"},e)})}on(e,r,s){const n=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===Kt.PRESENCE||e===Kt.POSTGRES_CHANGES;if(n&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,s)}httpSend(n,i){return f(this,arguments,function*(e,r,s={}){var o;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const a=r instanceof ArrayBuffer||ArrayBuffer.isView(r),l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":a?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c=new URL(this.broadcastEndpointURL);c.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&c.searchParams.set("private","true");const d={method:"POST",headers:l,body:a?r:JSON.stringify(r)},h=yield this._fetchWithTimeout(c.toString(),d,(o=s.timeout)!==null&&o!==void 0?o:this.timeout);if(h.status===202)return{success:!0};if(h.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realt
76ime-js/migrations/httpsend-server-version.md"));let p=h.statusText;try{const u=yield h.json();p=u.error||u.message||p}catch(u){}return Promise.reject(new Error(p))})}send(s){return f(this,arguments,function*(e,r={}){var n,i;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){const o="Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.";this.socket.hasLogger()?this.socket.log("channel",o):console.warn(o);const{event:a,payload:l}=e,c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const d={method:"POST",headers:c,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:l,private:this.private}]})};try{const h=yield this._fetchWithTimeout(this.broadcastEndpointURL,d,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return yield(i=h.body)===null||i===void 0?void 0:i.cancel(),h.ok?"ok":"error"}catch(h){return h instanceof Error&&h.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var a,l,c;const d=this.channelAdapter.push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(a=this.params)===null||a===void 0?void 0:a.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&o("ok"),d.receive("ok",()=>o("ok")),d.receive("error",()=>o("error")),d.receive("timeout",()=>o("timed out"))})})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}unsubscribe(){return f(this,arguments,function*(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})})}teardown(){this.channelAdapter.teardown()}_fetchWithTimeout(e,r,s){return f(this,null,function*(){const n=new AbortController,i=setTimeout(()=>n.abort(),s),o=yield this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:n.signal}));return clearTimeout(i),o})}_on(e,r,s){var n;const i=e.toLocaleLowerCase(),o=r==null?void 0:r.filter;if((o instanceof Yg||typeof o=="object"&&o!==null&&typeof o.build=="function")&&(r=Object.assign(Object.assign({},r),{filter:o.build()})),i===Kt.POSTGRES_CHANGES&&((n=this.bindings[i])===null||n===void 0?void 0:n.find(d=>gt.isSamePostgresFilter(d.filter,r))))return this.socket.log("error",`duplicate \`postgres_changes\` binding for ${this.topic} ignored`,r),this;const a=this.channelAdapter.on(e,s),l={type:i,filter:r,callback:s,ref:a};return this.bindings[i]?this.bindings[i].push(l):this.bindings[i]=[l],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,s)=>{var n,i,o,a,l,c,d;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,s))return!1;const p=(n=this.bindings[h])===null||n===void 0?void 0:n.find(u=>u.ref===e.ref);if(!p)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in p){const u=p.id,y=(i=p.filter)===null||i===void 0?void 0:i.event;return u&&((o=r.ids)===null||o===void 0?void 0:o.includes(u))&&(y==="*"||(y==null?void 0:y.toLocaleLowerCase())===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const u=(c=(l=p==null?void 0:p.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return u==="*"||u===((d=r==null?void 0:r.event)===null||d===void 0?void 0:d.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,r){const{close:s,error:n,leave:i,join:o}=wc;return r&&[s,n,i,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,s)=>{if(typeof r=="object"&&"ids"in r){const n=r.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=n;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(n))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const s of e.bindings[r])this._on(s.type,s.filter,s.callback)}static isFilterValueEqual(e,r){const s=e!=null?e:void 0,n=r!=null?r:void 0;return s===n}static isSamePostgresFilter(e,r){var s,n,i,o;const a=(n=(s=e==null?void 0:e.select)===null||s===void 0?void 0:s.join())!==null&&n!==void 0?n:void 0,l=(o=(i=r==null?void 0:r.select)===null||i===void 0?void 0:i.join())!==null&&o!==void 0?o:void 0;return(e==null?void 0:e.event)===(r==null?void 0:r.event)&&gt.isFilterValueEqual(e==null?void 0:e.sc
76hema,r==null?void 0:r.schema)&&gt.isFilterValueEqual(e==null?void 0:e.table,r==null?void 0:r.table)&&gt.isFilterValueEqual(e==null?void 0:e.filter,r==null?void 0:r.filter)&&a===l}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=Fo(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=Fo(e.columns,e.old_record)),r}}class Qg{constructor(e,r){this.socket=new Ug(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,s,n=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),n),this.socket.disconnect(()=>{e(),i("ok")},r,s)})}push(e){this.socket.push(e)}log(e,r,s){this.socket.log(e,r,s)}hasLogger(){return this.socket.hasLogger()}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==ai.connecting}isDisconnecting(){return this.socket.connectionState()==ai.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const qo={HEARTBEAT_INTERVAL:25e3},Xg=[1e3,2e3,5e3,1e4],Zg=1e4;function em(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function tm(){try{if(typeof globalThis!="undefined"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(t){}return em()}const rm=`
77  addEventListener("message", (e) => {
78    if (e.data.event === "start") {
79      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
80    }
81  });`;class sm{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,r){var s;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new xg,this._manuallySetToken=!1,this._authPromise=null,this._authGeneration=0,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((s=r==null?void 0:r.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const n=this._initializeOptions(r);this.socketAdapter=new Qg(e,n),this.httpEndpoint=xc(e),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const r=e.message;throw new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}disconnect(e,r){return f(this,null,function*(){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":yield this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)})}getChannels(){return this.channels}removeChannel(e){return f(this,null,function*(){const r=yield e.unsubscribe();return r==="ok"&&e.teardown(),r})}removeAllChannels(){return f(this,null,function*(){const e=this.channels.map(s=>f(this,null,function*(){const n=yield s.unsubscribe();return s.teardown(),n})),r=yield Promise.all(e);return yield this.disconnect(),r})}log(e,r,s){this.socketAdapter.log(e,r,s)}hasLogger(){return this.socketAdapter.hasLogger()}connectionState(){return this.socketAdapter.connectionState()||ai.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const s=`realtime:${e}`,n=this.getChannels().find(i=>i.topic===s);if(n)return n;{const i=new gt(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}setAuth(e=null){return f(this,null,function*(){const r=++this._authGeneration,s=this._performAuth(e,r);r===this._authGeneration&&(this._authPromise=s);try{yield s}finally{this._authPromise===s&&(this._authPromise=null)}})}_isManualToken(){return this._manuallySetToken}sendHeartbeat(){return f(this,null,function*(){this.socketAdapter.sendHeartbeat()})}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
81this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}_performAuth(e,r){return f(this,null,function*(){let s,n=!1;if(e)s=e,n=!0;else if(this.accessToken)try{s=yield this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),s=this.accessTokenValue}else s=this.accessTokenValue;r===this._authGeneration&&(this.accessToken?this._manuallySetToken=!1:n&&(this._manuallySetToken=!0),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(i=>{const o={access_token:s,version:gg};i.updateJoinPayload(o),i.joinedOnce&&i.channelAdapter.isJoined()&&i.channelAdapter.push(wc.access_token,{access_token:s})})))})}_waitForAuthIfNeeded(){return f(this,null,function*(){this._authPromise&&(yield this._authPromise)})}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,s)=>{r!=="disconnected"&&(r=="sent"&&this._setAuthSafely(),e&&e(r,s))}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const s=new Blob([rm],{type:"application/javascript"});r=URL.createObjectURL(s)}return r}_initializeOptions(e){var r,s,n,i,o,a,l,c,d,h,p,u;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(s=e==null?void 0:e.accessToken)!==null&&s!==void 0?s:null;const y={};y.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:vg,y.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:qo.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:qo.HEARTBEAT_INTERVAL),y.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:fg.getWebSocketConstructor(),y.params=e==null?void 0:e.params,y.logger=e==null?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),y.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:tm(),y.reconnectAfterMs=(d=e==null?void 0:e.reconnectAfterMs)!==null&&d!==void 0?d:x=>Xg[x-1]||Zg;let g,v;const b=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:yg;switch(b){case mg:g=(x,_)=>_(JSON.stringify(x)),v=(x,_)=>_(JSON.parse(x));break;case bc:g=this.serializer.encode.bind(this.serializer),v=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=b,y.encode=(p=e==null?void 0:e.encode)!==null&&p!==void 0?p:g,y.decode=(u=e==null?void 0:e.decode)!==null&&u!==void 0?u:v,y.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if(typeof window!="undefined"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}_reconnectAuth(){return f(this,null,function*(){yield this._waitForAuthIfNeeded(),this.isConnected()||this.connect()})}}
81var os=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function nm(t,e,r){const s=new URL(e,t);if(r)for(const[n,i]of Object.entries(r))i!==void 0&&s.searchParams.set(n,i);return s.toString()}function im(t){return f(this,null,function*(){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?yield t.getHeaders():{}})}function om(t){var r;const e=(r=t.fetchImpl)!=null?r:globalThis.fetch;return{request(c){return f(this,arguments,function*({method:n,path:i,query:o,body:a,headers:l}){var v;const d=nm(t.baseUrl,i,o),h=yield im(t.auth),p=yield e(d,{method:n,headers:S(S(S({},a?{"Content-Type":"application/json"}:{}),h),l),body:a?JSON.stringify(a):void 0}),u=yield p.text(),y=(p.headers.get("content-type")||"").includes("application/json"),g=y&&u?JSON.parse(u):u;if(!p.ok){const b=y?g:void 0,x=b==null?void 0:b.error;throw new os((v=x==null?void 0:x.message)!=null?v:`Request failed with status ${p.status}`,{status:p.status,icebergType:x==null?void 0:x.type,icebergCode:x==null?void 0:x.code,details:b})}return{status:p.status,headers:p.headers,data:g}})}}}function js(t){return t.join("�")}var am=class{constructor(t,e=""){this.client=t,this.prefix=e}listNamespaces(t){return f(this,null,function*(){const e=t?{parent:js(t.namespace)}:void 0;return(yield this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(s=>({namespace:s}))})}createNamespace(t,e){return f(this,null,function*(){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(yield this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data})}dropNamespace(t){return f(this,null,function*(){yield this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${js(t.namespace)}`})})}loadNamespaceMetadata(t){return f(this,null,function*(){return{properties:(yield this.client.request({method:"GET",path:`${this.prefix}/namespaces/${js(t.namespace)}`})).data.properties}})}namespaceExists(t){return f(this,null,function*(){try{return yield this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${js(t.namespace)}`}),!0}catch(e){if(e instanceof os&&e.status===404)return!1;throw e}})}createNamespaceIfNotExists(t,e){return f(this,null,function*(){try{return yield this.createNamespace(t,e)}catch(r){if(r instanceof os&&r.status===409)return;throw r}})}};function dr(t){return t.join("�")}var lm=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}listTables(t){return f(this,null,function*(){return(yield this.client.request({method:"GET",path:`${this.prefix}/namespaces/${dr(t.namespace)}/tables`})).data.identifiers})}createTable(t,e){return f(this,null,function*(){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(yield this.client.request({method:"POST",path:`${this.prefix}/namespaces/${dr(t.namespace)}/tables`,body:e,headers:r})).data.metadata})}updateTable(t,e){return f(this,null,function*(){const r=yield this.client.request({method:"POST",path:`${this.prefix}/namespaces/${dr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}})}dropTable(t,e){return f(this,null,function*(){var r;yield this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${dr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((r=e==null?void 0:e.purge)!=null?r:!1)}})})}loadTable(t){return f(this,null,function*(){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(yield this.client.request({method:"GET",path:`${this.prefix}/namespaces/${dr(t.namespace)}
81/tables/${t.name}`,headers:e})).data.metadata})}tableExists(t){return f(this,null,function*(){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return yield this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${dr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof os&&r.status===404)return!1;throw r}})}createTableIfNotExists(t,e){return f(this,null,function*(){try{return yield this.createTable(t,e)}catch(r){if(r instanceof os&&r.status===409)return yield this.loadTable({namespace:t.namespace,name:e.name});throw r}})}},cm=class{constructor(t){var s;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=om({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(s=t.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new am(this.client,e),this.tableOps=new lm(this.client,e,this.accessDelegation)}listNamespaces(t){return f(this,null,function*(){return this.namespaceOps.listNamespaces(t)})}createNamespace(t,e){return f(this,null,function*(){return this.namespaceOps.createNamespace(t,e)})}dropNamespace(t){return f(this,null,function*(){yield this.namespaceOps.dropNamespace(t)})}loadNamespaceMetadata(t){return f(this,null,function*(){return this.namespaceOps.loadNamespaceMetadata(t)})}listTables(t){return f(this,null,function*(){return this.tableOps.listTables(t)})}createTable(t,e){return f(this,null,function*(){return this.tableOps.createTable(t,e)})}updateTable(t,e){return f(this,null,function*(){return this.tableOps.updateTable(t,e)})}dropTable(t,e){return f(this,null,function*(){yield this.tableOps.dropTable(t,e)})}loadTable(t){return f(this,null,function*(){return this.tableOps.loadTable(t)})}namespaceExists(t){return f(this,null,function*(){return this.namespaceOps.namespaceExists(t)})}tableExists(t){return f(this,null,function*(){return this.tableOps.tableExists(t)})}createNamespaceIfNotExists(t,e){return f(this,null,function*(){return this.namespaceOps.createNamespaceIfNotExists(t,e)})}createTableIfNotExists(t,e){return f(this,null,function*(){return this.tableOps.createTableIfNotExists(t,e)})}};function as(t){"@babel/helpers - typeof";return as=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},as(t)}function um(t,e){if(as(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(as(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dm(t){var e=um(t,"string");return as(e)=="symbol"?e:e+""}function hm(t,e,r){return(e=dm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ko(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function F(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ko(Object(r),!0).forEach(function(s){hm(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ko(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}var _n=class extends Error{constructor(t,e="storage",r,s){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function xn(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var di=class extends _n{constructor(t,e,r,s="storage",n){super(t,s,e,r),this.name=s==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r,this.co
81de=n}toJSON(){return F(F({},super.toJSON()),{},{code:this.code})}},Ec=class extends _n{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function en(t,e,r){const s=F({},t),n=e.toLowerCase();for(const i of Object.keys(s))i.toLowerCase()===n&&delete s[i];return s[n]=r,s}function fm(t){const e={};for(const[r,s]of Object.entries(t))e[r.toLowerCase()]=s;return e}const pm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),gm=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},hi=t=>{if(Array.isArray(t))return t.map(r=>hi(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,s])=>{const n=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[n]=hi(s)}),e},mm=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),fi=t=>t.split("/").map(encodeURIComponent).join("/"),Go=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},ym=(t,e,r,s)=>f(void 0,null,function*(){if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const n=t;let i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new di(Go(o),i,a,s,o==null?void 0:o.code))}).catch(()=>{const o=i+"";e(new di(n.statusText||`HTTP ${i} error`,i,o,s))})}else e(new Ec(Go(t),t,s))}),vm=(t,e,r,s)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!s)return F(F({},n),r);if(gm(s)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);n.headers=en(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),n.body=JSON.stringify(s)}else n.body=s;return e!=null&&e.duplex&&(n.duplex=e.duplex),F(F({},n),r)};function Wr(t,e,r,s,n,i,o){return f(this,null,function*(){return new Promise((a,l)=>{t(r,vm(e,s,n,i)).then(c=>{if(!c.ok)throw c;if(s!=null&&s.noResolveJson)return c;if(o==="vectors"){const d=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!d||!d.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>ym(c,l,s,o))})})}function kc(t="storage"){return{get:(e,r,s,n)=>f(this,null,function*(){return Wr(e,"GET",r,s,n,void 0,t)}),post:(e,r,s,n,i)=>f(this,null,function*(){return Wr(e,"POST",r,n,i,s,t)}),put:(e,r,s,n,i)=>f(this,null,function*(){return Wr(e,"PUT",r,n,i,s,t)}),head:(e,r,s,n)=>f(this,null,function*(){return Wr(e,"HEAD",r,F(F({},s),{},{noResolveJson:!0}),n,void 0,t)}),remove:(e,r,s,n,i)=>f(this,null,function*(){return Wr(e,"DELETE",r,n,i,s,t)})}}const bm=kc("storage"),{get:xr,post:qe,put:tn,head:wm,remove:Sr}=bm,je=kc("vectors");var Mr=class{constructor(t,e={},r,s="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=fm(e),this.fetch=pm(r),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=en(this.headers,t,e),this}handleOperation(t){return f(this,null,function*(){var e=this;try{return{data:yield t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(xn(r))return{data:null,error:r};throw r}})}};let Tc;Tc=Symbol.toStringTag;var _m=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Tc]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return f(this,null,function*(){var t=this;try{return{data:(yield t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(xn(e))return{data:null,error:e};throw e}})}};let Ac;Ac=Symbol.toStringTag;var xm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Ac]="BlobDownloadBuilder",this.promise=null}asStream(){return new _m(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return f(this,null,function*(){var t=this;try{return{data:yield(yield t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(xn(e))return{data:null,error:e};throw e}})}};const Un={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Jo={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Sm=class extends Mr{constructor(t,e={},r,s){super(t,e,s,"storage"),this.bucketId=r}uploadOrUpdate(t,e,r,s){return f(this,null,function*(){var n=this;return n.handleOperation(()=>f(this,null,function*(){let i;const o=F(F({},Jo),s);let a=F(F({},n.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob!="undefined"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",n.encodeMetadata(l)),i.append("",r)):typeof FormData!="undefined"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",n.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=n.toBase64(n.encodeMetadata(l))),(typeof ReadableStream!="undefined"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),s!=null&&s.headers)for(const[p,u]of Object.entries(s.headers))a=en(a,p,u);const c=n._removeEmptyFolders(e),d=n._getFinalPath(c),h=yield(t=="PUT"?tn:qe)(n.fetch,`${n.url}/object/${d}`,i,F({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}}))})}upload(t,e,r){return f(this,null,function*(){return this.uploadOrUpdate("POST",t,e,r)})}uploadToSignedUrl(t,e,r,s){return f(this,null,function*(){var n=this;const i=n._removeEmptyFolders(t),o=n._getFinalPath(i),a=new URL(n.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),n.handleOperation(()=>f(this,null,function*(){let l;const c=F(F({},Jo),s);let d=F(F({},n.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob!="undefined"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",n.encodeMetadata(h)),l.append("",r)):typeof FormData!="undefined"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.a
81ppend("metadata",n.encodeMetadata(h))):(l=r,d["cache-control"]=`max-age=${c.cacheControl}`,d["content-type"]=c.contentType,h&&(d["x-metadata"]=n.toBase64(n.encodeMetadata(h))),(typeof ReadableStream!="undefined"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),s!=null&&s.headers)for(const[p,u]of Object.entries(s.headers))d=en(d,p,u);return{path:i,fullPath:(yield tn(n.fetch,a.toString(),l,F({headers:d},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}}))})}createSignedUploadUrl(t,e){return f(this,null,function*(){var r=this;return r.handleOperation(()=>f(this,null,function*(){let s=r._getFinalPath(t);const n=F({},r.headers);e!=null&&e.upsert&&(n["x-upsert"]="true");const i=yield qe(r.fetch,`${r.url}/object/upload/sign/${s}`,{},{headers:n}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new _n("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}}))})}update(t,e,r){return f(this,null,function*(){return this.uploadOrUpdate("PUT",t,e,r)})}move(t,e,r){return f(this,null,function*(){var s=this;return s.handleOperation(()=>f(this,null,function*(){return yield qe(s.fetch,`${s.url}/object/move`,{bucketId:s.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket,sourceVersionId:r==null?void 0:r.sourceVersionId},{headers:s.headers})}))})}copy(t,e,r){return f(this,null,function*(){var s=this;return s.handleOperation(()=>f(this,null,function*(){return{path:(yield qe(s.fetch,`${s.url}/object/copy`,{bucketId:s.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket,sourceVersionId:r==null?void 0:r.sourceVersionId},{headers:s.headers})).Key}}))})}createSignedUrl(t,e,r){return f(this,null,function*(){var s=this;return s.handleOperation(()=>f(this,null,function*(){let n=s._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=yield qe(s.fetch,`${s.url}/object/sign/${n}`,F(F({expiresIn:e},i?{transform:r.transform}:{}),(r==null?void 0:r.versionId)!=null?{versionId:r.versionId}:{}),{headers:s.headers});const a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${s.url}${o.signedURL}${l?`&${l}`:""}`)}}))})}createSignedUrls(t,e,r){return f(this,null,function*(){var s=this;return s.handleOperation(()=>f(this,null,function*(){const n=yield qe(s.fetch,`${s.url}/object/sign/${s.bucketId}`,{expiresIn:e,paths:t},{headers:s.headers}),i=new URLSearchParams;r!=null&&r.download&&i.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));const o=i.toString();return n.map(a=>F(F({},a),{},{signedUrl:a.signedURL?encodeURI(`${s.url}${a.signedURL}${o?`&${o}`:""}`):null}))}))})}download(t,e,r){const s=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",n=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce)),(e==null?void 0:e.versionId)!=null&&n.set("versionId",String(e.versionId));const i=n.toString(),o=this._getFinalPath(t),a=()=>xr(this.fetch,`${this.url}/${s}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new xm(a,this.shouldThrowOnError)}info(t,e){return f(this,null,function*(){var r=this;const s=r._getFinalPath(t),n=new URLSearchParams;(e==null?void 0:e.versionId)!=null&&n.set("versionId",String(e.versionId));const i=n.toString();return r.handleOperation(()=>f(this,null,function*(){return hi(yield xr(r.fetch,`${r.url}/object/info/${s}${i?`?${i}`:""}`,{headers:r.headers}))}))})}exists(t){return f(this,null,function*(){var e=this;const r=e._getFinalPath(t);try{return yield wm(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(xn(n)){var s;const i=n instanceof di?n.status:n instanceof Ec?(s=n.originalError)===null||s===void 0?void 0:s.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:n}}throw n}})}getPublicUrl(t,e){const r=this._getFinalPath(t),s=new URLSearchParams;e!=null&&e.download&&s.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce)),(e==null?void 0:e.versionId)!=null&&s.set("versionId",String(e.versionId));const n=s.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(n?`?${n}`:"")}}}remove(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield Sr(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers})}))})}purgeCache(t,e,r){return f(this,null,function*(){var s=this;return s.handleOperation(()=>f(this,null,function*(){const n=fi(s._getFinalPath(t)),i=new URLSearchParams;e!=null&&e.transformations&&i.set("transformations","true");const o=i.toString();return yield Sr(s.fetch,`${s.url}/cdn/${n}${o?`?${o}`:""}`,{},{headers:s.headers},r)}))})}list(t,e,r){return f(this,null,function*(){var s=this;return s.handleOperation(()=>f(this,null,function*(){const n=e!=null&&e.sortBy?F(F({},Un.sortBy),e.sortBy):Un.sortBy,i=F(F(F({},Un),e),{},{sortBy:n,prefix:t||""});return yield qe(s.fetch,`${s.url}/object/list/${s.bucketId}`,i,{headers:s.headers},r)}))})}listV2(t,e){return f(this,null,function*(){var r=this;return r.handleOperation(()=>f(this,null,function*(){const s=F({},t);return yield qe(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,s,{headers:r.headers},e)}))})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer!="undefined"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("qual
81ity",e.quality.toString()),t}};const Em="2.117.1",ys={"X-Client-Info":`storage-js/${Em}`};var km=class extends Mr{constructor(t,e={},r,s){const n=new URL(t);s!=null&&s.useNewHostname&&/supabase\.(co|in|red)$/.test(n.hostname)&&!n.hostname.includes("storage.supabase.")&&(n.hostname=n.hostname.replace("supabase.","storage.supabase."));const i=n.href.replace(/\/$/,""),o=F(F({},ys),e);super(i,o,r,"storage")}listBuckets(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){const r=e.listBucketOptionsToQueryString(t);return yield xr(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})}))})}getBucket(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield xr(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers})}))})}createBucket(r){return f(this,arguments,function*(t,e={public:!1}){var s=this;return s.handleOperation(()=>f(this,null,function*(){return yield qe(s.fetch,`${s.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes,versioning_status:e.versioningStatus},{headers:s.headers})}))})}updateBucket(t,e){return f(this,null,function*(){var r=this;return r.handleOperation(()=>f(this,null,function*(){return yield tn(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes,versioning_status:e.versioningStatus},{headers:r.headers})}))})}emptyBucket(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield qe(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers})}))})}deleteBucket(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield Sr(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers})}))})}getBucketLifecycle(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield xr(e.fetch,e.bucketLifecycleUrl(t),{headers:e.headers})}))})}updateBucketLifecycle(t,e){return f(this,null,function*(){var r=this;return r.handleOperation(()=>f(this,null,function*(){return yield tn(r.fetch,r.bucketLifecycleUrl(t),e,{headers:r.headers})}))})}deleteBucketLifecycle(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield Sr(e.fetch,e.bucketLifecycleUrl(t),{},{headers:e.headers})}))})}purgeBucketCache(t,e,r){return f(this,null,function*(){var s=this;return s.handleOperation(()=>f(this,null,function*(){const n=new URLSearchParams;e!=null&&e.transformations&&n.set("transformations","true");const i=n.toString();return yield Sr(s.fetch,`${s.url}/cdn/${fi(t)}${i?`?${i}`:""}`,{},{headers:s.headers},r)}))})}bucketLifecycleUrl(t){return`${this.url}/bucket/${fi(t)}/lifecycle`}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Tm=class extends Mr{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},ys),e);super(s,n,r,"storage")}createBucket(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield qe(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers})}))})}listBuckets(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const s=r.toString(),n=s?`${e.url}/bucket?${s}`:`${e.url}/bucket`;return yield xr(e.fetch,n,{headers:e.headers})}))})}deleteBucket(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield Sr(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers})}))})}from(t){var e=this;if(!mm(t))throw new _n("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new cm({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:()=>f(this,null,function*(){return e.headers})},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(r,{get(n,i){const o=n[i];return typeof o!="function"?o:(...a)=>f(this,null,function*(){try{return{data:yield o.apply(n,a),error:null}}catch(l){if(s)throw l;return{data:null,error:l}}})}})}},Am=class extends Mr{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},ys),{},{"Content-Type":"application/json"},e);super(s,n,r,"vectors")}createIndex(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return(yield je.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers}))||{}}))})}getIndex(t,e){return f(this,null,function*(){var r=this;return r.handleOperation(()=>f(this,null,function*(){return yield je.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})}))})}listIndexes(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield je.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers})}))})}deleteIndex(t,e){return f(this,null,function*(){var r=this;return r.handleOperation(()=>f(this,null,function*(){return(yield je.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))||{}}))})}},Rm=class extends Mr{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},ys),{},{"Content-Type":"application/json"},e);super(s,n,r,"vectors")}putVectors(t){return f(this,null,function*(){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(()=>f(this,null,function*(){return(yield je.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers}))||{}}))})}getVectors(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield je.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers})}))})}listVectors(t){return f(this,null,function*(){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
81if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(()=>f(this,null,function*(){return yield je.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers})}))})}queryVectors(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield je.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers})}))})}deleteVectors(t){return f(this,null,function*(){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(()=>f(this,null,function*(){return(yield je.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers}))||{}}))})}},Cm=class extends Mr{constructor(t,e={},r){const s=t.replace(/\/$/,""),n=F(F({},ys),{},{"Content-Type":"application/json"},e);super(s,n,r,"vectors")}createBucket(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return(yield je.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers}))||{}}))})}getBucket(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield je.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers})}))})}listBuckets(){return f(this,arguments,function*(t={}){var e=this;return e.handleOperation(()=>f(this,null,function*(){return yield je.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers})}))})}deleteBucket(t){return f(this,null,function*(){var e=this;return e.handleOperation(()=>f(this,null,function*(){return(yield je.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers}))||{}}))})}},Om=class t extends Cm{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Pm(this.url,this.headers,e,this.fetch)}createBucket(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"createBucket"),s=this;return r().call(s,e)})}getBucket(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"getBucket"),s=this;return r().call(s,e)})}listBuckets(){return f(this,arguments,function*(e={}){var r=()=>Te(t.prototype,this,"listBuckets"),s=this;return r().call(s,e)})}deleteBucket(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"deleteBucket"),s=this;return r().call(s,e)})}},Pm=class t extends Am{constructor(e,r,s,n){super(e,r,n),this.vectorBucketName=s}createIndex(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"createIndex"),s=this;return r().call(s,F(F({},e),{},{vectorBucketName:s.vectorBucketName}))})}listIndexes(){return f(this,arguments,function*(e={}){var r=()=>Te(t.prototype,this,"listIndexes"),s=this;return r().call(s,F(F({},e),{},{vectorBucketName:s.vectorBucketName}))})}getIndex(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"getIndex"),s=this;return r().call(s,s.vectorBucketName,e)})}deleteIndex(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"deleteIndex"),s=this;return r().call(s,s.vectorBucketName,e)})}index(e){return new jm(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},jm=class t extends Rm{constructor(e,r,s,n,i){super(e,r,i),this.vectorBucketName=s,this.indexName=n}putVectors(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"putVectors"),s=this;return r().call(s,F(F({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))})}getVectors(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"getVectors"),s=this;return r().call(s,F(F({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))})}listVectors(){return f(this,arguments,function*(e={}){var r=()=>Te(t.prototype,this,"listVectors"),s=this;return r().call(s,F(F({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))})}queryVectors(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"queryVectors"),s=this;return r().call(s,F(F({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))})}deleteVectors(e){return f(this,null,function*(){var r=()=>Te(t.prototype,this,"deleteVectors"),s=this;return r().call(s,F(F({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))})}},Im=class extends km{constructor(t,e={},r,s){super(t,e,r,s)}from(t){return new Sm(this.url,this.headers,t,this.fetch)}get vectors(){return new Om(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Tm(this.url+"/iceberg",this.headers,this.fetch)}};const Rc="2.117.1",mt=30*1e3,Yr=3,Mn=Yr*mt,Nm=2*mt,$m="http://localhost:9999",Lm="supabase.auth.token",Dm={"X-Client-Info":`gotrue-js/${Rc}`},pi="X-Supabase-Api-Version",Cc={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Um=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Yt="sb_flow_id",Mm=5,Bm=10*60*1e3;
81class ls extends Error{constructor(e,r,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=s}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function P(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Fm extends ls{constructor(e,r,s){super(e,r,s),this.name="AuthApiError",this.status=r,this.code=s}}function Yo(t){return P(t)&&t.name==="AuthApiError"}class Je extends ls{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class ct extends ls{constructor(e,r,s,n){super(e,s,n),this.name=r,this.status=s}}class ye extends ct{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Is(t){return P(t)&&t.name==="AuthSessionMissingError"}class hr extends ct{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ns extends ct{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class $s extends ct{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Hm(t){return P(t)&&t.name==="AuthImplicitGrantRedirectError"}class Qo extends ct{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Wm extends ct{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Vs extends ct{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Ls(t){return P(t)&&t.name==="AuthRetryableFetchError"}class Xo extends ct{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function Zo(t){return P(t)&&t.name==="AuthRefreshDiscardedError"}class ea extends ct{constructor(e,r,s){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class rn extends ct{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ta=` 	
82\r=`.split(""),Vm=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<ta.length;e+=1)t[ta[e].charCodeAt(0)]=-2;for(let e=0;e<sn.length;e+=1)t[sn[e].charCodeAt(0)]=e;return t})();function ra(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;r(sn[s]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const s=e.queue>>e.queuedBits-6&63;r(sn[s]),e.queuedBits-=6}}function Oc(t,e,r){const s=Vm[t];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function sa(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{Km(o,s,r)};for(let o=0;o<t.length;o+=1)Oc(t.charCodeAt(o),n,i);return e.join("")}function zm(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function qm(t,e){for(let r=0;r<t.length;r+=1){let s=t.charCodeAt(r);if(s>55295&&s<=56319){const n=(s-55296)*1024&65535;s=(t.charCodeAt(r+1)-56320&65535|n)+65536,r+=1}zm(s,e)}}function Km(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let s=1;s<6;s+=1)if(!(t>>7-s&1)){e.utf8seq=s;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Er(t){const e=[],r={queue:0,queuedBits:0},s=n=>{e.push(n)};for(let n=0;n<t.length;n+=1)Oc(t.charCodeAt(n),r,s);return new Uint8Array(e)}function Gm(t){const e=[];return qm(t,r=>e.push(r)),new Uint8Array(e)}function Qt(t){const e=[],r={queue:0,queuedBits:0},s=n=>{e.push(n)};return t.forEach(n=>ra(n,r,s)),ra(null,r,s),e.join("")}function Pc(t){return Math.round(Date.now()/1e3)+t}function Jm(){return Symbol("auth-callback")}const ve=()=>typeof window!="undefined"&&typeof document!="undefined",zt={tested:!1,writable:!1},jc=()=>
82{if(!ve())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch(e){return!1}if(zt.tested)return zt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),zt.tested=!0,zt.writable=!0}catch(e){zt.tested=!0,zt.writable=!1}return zt.writable};function na(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((n,i)=>{e[i]=n})}catch(s){}return r.searchParams.forEach((s,n)=>{e[n]=s}),e}const Ic=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Ym=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",vt=(t,e,r)=>f(void 0,null,function*(){yield t.setItem(e,JSON.stringify(r))}),_e=(t,e)=>f(void 0,null,function*(){const r=yield t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch(s){return null}}),Re=(t,e)=>f(void 0,null,function*(){yield t.removeItem(e)});class Sn{constructor(){this.promise=new Sn.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}Sn.promiseConstructor=Promise;function Ds(t){const e=t.split(".");if(e.length!==3)throw new rn("Invalid JWT structure");for(let s=0;s<e.length;s++)if(!Um.test(e[s]))throw new rn("JWT not in base64url format");return{header:JSON.parse(sa(e[0])),payload:JSON.parse(sa(e[1])),signature:Er(e[2]),raw:{header:e[0],payload:e[1]}}}function Qm(t){return f(this,null,function*(){return yield new Promise(e=>{setTimeout(()=>e(null),t)})})}function Xm(t,e){return new Promise((s,n)=>{f(this,null,function*(){for(let i=0;i<1/0;i++)try{const o=yield t(i);if(!e(i,null,o)){s(o);return}}catch(o){if(!e(i,o)){n(o);return}}})})}function Nc(t){return("0"+t.toString(16)).substr(-2)}function Zm(){const e=new Uint32Array(56);if(typeof crypto=="undefined"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=r.length;let n="";for(let i=0;i<56;i++)n+=r.charAt(Math.floor(Math.random()*s));return n}return crypto.getRandomValues(e),Array.from(e,Nc).join("")}function ey(t){return f(this,null,function*(){const r=new TextEncoder().encode(t),s=yield crypto.subtle.digest("SHA-256",r),n=new Uint8Array(s);return Array.from(n).map(i=>String.fromCharCode(i)).join("")})}function ty(t){return f(this,null,function*(){if(!(typeof crypto!="undefined"&&typeof crypto.subtle!="undefined"&&typeof TextEncoder!="undefined"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=yield ey(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")})}const ry=/^[a-zA-Z0-9_-]{8,64}$/;function zs(t){return typeof t=="string"&&ry.test(t)?t:null}function sy(){if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,Nc).join("")}let t="";for(let e=0;e<32;e++)t+=Math.floor(Math.random()*16).toString(16);return t}const $r=(t,e)=>`${t}-flow-${e}-code-verifier`,cs=t=>`${t}-flows-code-verifier`;function Li(t,e){return f(this,null,function*(){const r=yield _e(t,cs(e));return Array.isArray(r)?r.filter(s=>zs(s)!==null):[]})}function ny(t,e,r,s,n){return f(this,null,function*(){yield vt(t,$r(e,r),s);const i=(yield Li(t,e)).filter(o=>o!==r);for(i.push(r);i.length>Mm;){const o=i.shift();yield Re(t,$r(e,o)),n==null||n(o)}yield vt(t,cs(e),i),yield vt(t,`${e}-code-verifier`,s)})}function iy(t,e,r){return f(this,null,function*(){if(r){const n=yield _e(t,$r(e,r));return{verifier:typeof n=="string"?n:null,flowId:r}}const s=yield _e(t,`${e}-code-verifier`);return{verifier:typeof s=="string"?s:null,flowId:null}})}function Ve(t,e,r){return f(this,null,function*(){const s=`${e}-code-verifier`;if(!r){yield Re(t,s);return}const n=$r(e,r),i=yield _e(t,n);yield Re(t,n);const o=yield Li(t,e),a=o.filter(l=>l!==r);a.length!==o.length&&(a.length>0?yield vt(t,cs(e),a):yield Re(t,cs(e))),i!=null&&i===(yield _e(t,s))&&(yield Re(t,s))})}function oy(t,e){return f(this,null,function*(){const r=yield Li(t,e);for(const s of r)yield Re(t,$r(e,s));yield Re(t,cs(e)),yield Re(t,`${e}-code-verifier`)})}function ay(t,e){const r=t.indexOf("#");let s=r===-1?t:t.slice(0,r);const n=r===-1?"":t.slice(r),i=s.indexOf("?");if(i!==-1){const a=s.slice(0,i),l=s.slice(i+1).split("&").filter(c=>c!==""&&c!==Yt&&!c.startsWith(`${Yt}=`));s=l.length>0?`${a}?${l.join("&")}`:a}const o=s.includes("?")?"&":"?";return`${s}${o}${Yt}=${encodeURIComponent(e)}${n}`}function ly(t,e,r=!1,s){return f(this,null,function*(){const n=Zm();let i=n;r&&(i+="/recovery");const o=sy();yield ny(t,e,o,i,s);const a=yield ty(n);return[a,n===a?"plain":"s256",o]})}const cy=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function uy(t){const e=t.headers.get(pi);if(!e||!e.match(cy))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch(r){return null}}function dy(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function hy(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const fy=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function dt(t){if(!fy.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Vr(t){if(!t.recoveryCodes)throw new Error("@supabase/auth-js: the MFA recovery codes API is experimental and disabled by default. Enable it by passing `auth: { experimental: { recoveryCodes: true } }` to createClient (or to the GoTrueClient constructor).")}function Bn(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;
82if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function py(t,e){return new Proxy(t,{get:(r,s,n)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const i=s.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,s,n)}return!e.value&&typeof s=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,s,n)}})}function ia(t){return JSON.parse(JSON.stringify(t))}const qt=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},oa=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];function aa(t){return f(this,null,function*(){var e;if(!Ym(t))throw new Vs(qt(t),0);let r;try{r=yield t.json()}catch(i){throw oa.includes(t.status)?new Vs(t.statusText||`HTTP ${t.status}`,t.status):new Je(qt(i),i)}if(oa.includes(t.status))throw new Vs(qt(r),t.status);let s;const n=uy(t);if(n&&n.getTime()>=Cc["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?s=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(s=r.error_code),s){if(s==="weak_password")throw new ea(qt(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new ye}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new ea(qt(r),t.status,r.weak_password.reasons);throw new Fm(qt(r),t.status||500,s)})}const gy=(t,e,r,s)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(s),Object.assign(Object.assign({},n),r))};function j(t,e,r,s){return f(this,null,function*(){var n;const i=Object.assign({},s==null?void 0:s.headers);i[pi]||(i[pi]=Cc["2024-01-01"].name),s!=null&&s.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const o=(n=s==null?void 0:s.query)!==null&&n!==void 0?n:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=yield my(t,e,r+a,{headers:i,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(l):{data:Object.assign({},l),error:null}})}function my(t,e,r,s,n,i){return f(this,null,function*(){const o=gy(e,s,n,i);let a;try{a=yield t(r,Object.assign({},o))}catch(l){throw new Vs(qt(l),0)}if(a.ok||(yield aa(a)),s!=null&&s.noResolveJson)return a;try{return yield a.json()}catch(l){yield aa(l)}})}function De(t){var e;let r=null;by(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=Pc(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:s},error:null}}function la(t){const e=De(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,s)=>r&&typeof s=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Ot(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function yy(t){return{data:t,error:null}}function vy(t){const{action_link:e,email_otp:r,hashed_token:s,redirect_to:n,verification_type:i}=t,o=wn(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:s,redirect_to:n,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function ca(t){return t}function by(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Fn=["global","local","others"];class wy{constructor({url:e="",headers:r={},fetch:s,experimental:n}){this.url=e,this.headers=r,this.fetch=Ic(s),this.experimental=n!=null?n:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}signOut(s){return f(this,arguments,function*(e,r=Fn[0]){if(Fn.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Fn.join(", ")}`);try{return yield j(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(P(n))return{data:null,error:n};throw n}})}inviteUserByEmail(s){return f(this,arguments,function*(e,r={}){try{return yield j(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ot})}catch(n){if(P(n))return{data:{user:null},error:n};throw n}})}generateLink(e){return f(this,null,function*(){try{const{options:r}=e,s=wn(e,["options"]),n=Object.assign(Object.assign({},s),r);return"newEmail"in s&&(n.new_email=s==null?void 0:s.newEmail,delete n.newEmail),yield j(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:vy,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(P(r))return{data:{properties:null,user:null},error:r};throw r}})}createUser(e){return f(this,null,function*(){try{return yield j(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Ot})}catch(r){if(P(r))return{data:{user:null},error:r};throw r}})}listUsers(e){return f(this,null,function*(){var r,s,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},d=yield j(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:ca});if(d.error)throw d.error;const h=yield d.json(),p=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,u=(l=(a=d.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return u.length>0&&(u.forEach(y=>{const g=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(y.split(";")[1].split("=")[1]);c[`${v}Page`]=g}),c.total=parseInt(p)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(P(c))return{data:{users:[]},error:c};throw c}})}getUserById(e){return f(this,null,function*(){dt(e);try{return yield j(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Ot})}catch(r){if(P(r))return{data:{user:null},error:r};throw r}})}updateUserById(e,r){return f(this,null,function*(){dt(e);try{return yield j(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Ot})}catch(s){if(P(s))return{data:{user:null},error:s};throw s}})}deleteUser(e,r=!1){return f(this,null,function*(){dt(e);
82try{return yield j(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ot})}catch(s){if(P(s))return{data:{user:null},error:s};throw s}})}_listFactors(e){return f(this,null,function*(){dt(e.userId);try{const{data:r,error:s}=yield j(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:r,error:s}}catch(r){if(P(r))return{data:null,error:r};throw r}})}_deleteFactor(e){return f(this,null,function*(){dt(e.userId),dt(e.id);try{return{data:yield j(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(P(r))return{data:null,error:r};throw r}})}_listOAuthClients(e){return f(this,null,function*(){var r,s,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},d=yield j(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&s!==void 0?s:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:ca});if(d.error)throw d.error;const h=yield d.json(),p=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,u=(l=(a=d.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return u.length>0&&(u.forEach(y=>{const g=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(y.split(";")[1].split("=")[1]);c[`${v}Page`]=g}),c.total=parseInt(p)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(P(c))return{data:{clients:[]},error:c};throw c}})}_createOAuthClient(e){return f(this,null,function*(){try{return yield j(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}})}_getOAuthClient(e){return f(this,null,function*(){try{return yield j(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}})}_updateOAuthClient(e,r){return f(this,null,function*(){try{return yield j(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(P(s))return{data:null,error:s};throw s}})}_deleteOAuthClient(e){return f(this,null,function*(){try{return yield j(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(P(r))return{data:null,error:r};throw r}})}_regenerateOAuthClientSecret(e){return f(this,null,function*(){try{return yield j(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}})}_listCustomProviders(e){return f(this,null,function*(){try{const r={};return e!=null&&e.type&&(r.type=e.type),yield j(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:s=>{var n;return{data:{providers:(n=s==null?void 0:s.providers)!==null&&n!==void 0?n:[]},error:null}}})}catch(r){if(P(r))return{data:{providers:[]},error:r};throw r}})}_createCustomProvider(e){return f(this,null,function*(){try{return yield j(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}})}_getCustomProvider(e){return f(this,null,function*(){try{return yield j(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}})}_updateCustomProvider(e,r){return f(this,null,function*(){try{return yield j(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(P(s))return{data:null,error:s};throw s}})}_deleteCustomProvider(e){return f(this,null,function*(){try{return yield j(this.fetch,"DELET
82E",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(P(r))return{data:null,error:r};throw r}})}_adminListPasskeys(e){return f(this,null,function*(){dt(e.userId);try{return yield j(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}})}_adminDeletePasskey(e){return f(this,null,function*(){dt(e.userId),dt(e.passkeyId);try{return yield j(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(P(r))return{data:null,error:r};throw r}})}}function ua(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}globalThis&&jc()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class _y extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function xy(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(t){typeof self!="undefined"&&(self.globalThis=self)}}function $c(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Sy(t){return parseInt(t,16)}function Ey(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function ky(t){var e;const{chainId:r,domain:s,expirationTime:n,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:d,uri:h,version:p}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(p!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${p}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
83`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const u=$c(t.address),y=d?`${d}://${s}`:s,g=t.statement?`${t.statement}
84`:"",v=`${y} wants you to sign in with your Ethereum account:
85${u}
86
87${g}`;let b=`URI: ${h}
88Version: ${p}
89Chain ID: ${r}${o?`
90Nonce: ${o}`:""}
91Issued At: ${i.toISOString()}`;if(n&&(b+=`
92Expiration Time: ${n.toISOString()}`),a&&(b+=`
93Not Before: ${a.toISOString()}`),l&&(b+=`
94Request ID: ${l}`),c){let x=`
95Resources:`;for(const _ of c){if(!_||typeof _!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${_}`);x+=`
96- ${_}`}b+=x}return`${v}
97${b}`}class ge extends Error{constructor({message:e,code:r,cause:s,name:n}){var i;super(e,{cause:s}),this.__isWebAuthnError=!0,this.name=(i=n!=null?n:s instanceof Error?s.name:void 0)!==null&&i!==void 0?i:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class nn extends ge{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function Ty({error:t,options:e}){var r,s,n;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ge({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ge({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new ge({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new ge({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new ge({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ge({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new ge({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ge({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(Lc(o)){if(i.rp.id!==o)return new ge({message:`The RP ID "${i.rp.id}
97" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ge({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new ge({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new ge({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ge({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Ay({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ge({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ge({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if(Lc(s)){if(r.rpId!==s)return new ge({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ge({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ge({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ge({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Ry{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const gi=new Ry;function da(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential!="undefined"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:s}=t,n=wn(t,["challenge","user","excludeCredentials"]),i=Er(e).buffer,o=Object.assign(Object.assign({},r),{id:Er(r.id).buffer}),a=Object.assign(Object.assign({},n),{challenge:i,user:o});if(s&&s.length>0){a.excludeCredentials=new Array(s.length);for(let l=0;l<s.length;l++){const c=s[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Er(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function ha(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential!="undefined"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,s=wn(t,["challenge","allowCredentials"]),n=Er(e).buffer,i=Object.assign(Object.assign({},s),{challenge:n});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const a=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Er(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function fa(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:Qt(new Uint8Array(t.response.attestationObject)),clientDataJSON:Qt(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function pa(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,s=t.getClientExtensionResults(),n=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Qt(new Uint8Array(n.authenticatorData)),clientDataJSON:Qt(new Uint8Array(n.clientDataJSON)),signature:Qt(new 
97Uint8Array(n.signature)),userHandle:n.userHandle?Qt(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Lc(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function on(){var t,e;return!!(ve()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}function Dc(t){return f(this,null,function*(){try{const e=yield navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new nn("Browser returned unexpected credential type",e)}:{data:null,error:new nn("Empty credential response",e)}}catch(e){return{data:null,error:Ty({error:e,options:t})}}})}function Uc(t){return f(this,null,function*(){try{const e=yield navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new nn("Browser returned unexpected credential type",e)}:{data:null,error:new nn("Empty credential response",e)}}catch(e){return{data:null,error:Ay({error:e,options:t})}}})}const Cy={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Oy={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function an(...t){const e=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),r=n=>n instanceof ArrayBuffer||ArrayBuffer.isView(n),s={};for(const n of t)if(n)for(const i in n){const o=n[i];if(o!==void 0)if(Array.isArray(o))s[i]=o;else if(r(o))s[i]=o;else if(e(o)){const a=s[i];e(a)?s[i]=an(a,o):s[i]=an(o)}else s[i]=o}return s}function Py(t,e){return an(Cy,t,e||{})}function jy(t,e){return an(Oy,t,e||{})}class Iy{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}_enroll(e){return f(this,null,function*(){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))})}_challenge(o,a){return f(this,arguments,function*({factorId:e,webauthn:r,friendlyName:s,signal:n},i){var l;try{const{data:c,error:d}=yield this.client.mfa.challenge({factorId:e,webauthn:r});if(!c)return{data:null,error:d};const h=n!=null?n:gi.createNewAbortSignal();if(c.webauthn.type==="create"){const{user:p}=c.webauthn.credential_options.publicKey;if(!p.name){const u=s;if(u)p.name=`${p.id}:${u}`;else{const g=(yield this.client.getUser()).data.user,v=((l=g==null?void 0:g.user_metadata)===null||l===void 0?void 0:l.name)||(g==null?void 0:g.email)||(g==null?void 0:g.id)||"User";p.name=`${p.id}:${v}`}}p.displayName||(p.displayName=p.name)}switch(c.webauthn.type){case"create":{const p=Py(c.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:u,error:y}=yield Dc({publicKey:p,signal:h});return u?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:u}},error:null}:{data:null,error:y}}case"request":{const p=jy(c.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:u,error:y}=yield Uc(Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:p,signal:h}));return u?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:u}},error:null}:{data:null,error:y}}}}catch(c){return P(c)?{data:null,error:c}:{data:null,error:new Je("Unexpected error in challenge",c)}}})}_verify(n){return f(this,arguments,function*({challengeId:e,factorId:r,webauthn:s}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:s})})}_authenticate(o,a){return f(this,arguments,function*({factorId:e,webauthn:{rpId:r=typeof window!="undefined"?window.location.hostname:void 0,rpOrigins:s=typeof window!="undefined"?[window.location.origin]:void 0,signal:n}={}},i){if(!r)return{data:null,error:new ls("rpId is required for WebAuthn authentication")};try{if(!on())return{data:null,error:new Je("Browser does not support WebAuthn",null)};const{data:l,error:c}=yield this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:s},signal:n},{request:i});if(!l)return{data:null,error:c};const{webauthn:d}=l;return this._verify({factorId:e,challengeId:l.challengeId,webauthn:{type:d.type,rpId:r,rpOrigins:s,credential_response:d.credential_response}})}catch(l){return P(l)?{data:null,error:l}:{data:null,error:new Je("Unexpected error in authenticate",l)}
97}})}_register(o,a){return f(this,arguments,function*({friendlyName:e,webauthn:{rpId:r=typeof window!="undefined"?window.location.hostname:void 0,rpOrigins:s=typeof window!="undefined"?[window.location.origin]:void 0,signal:n}={}},i){if(!r)return{data:null,error:new ls("rpId is required for WebAuthn registration")};try{if(!on())return{data:null,error:new Je("Browser does not support WebAuthn",null)};const{data:l,error:c}=yield this._enroll({friendlyName:e});if(!l)return yield this.client.mfa.listFactors().then(p=>{var u;return(u=p.data)===null||u===void 0?void 0:u.all.find(y=>y.factor_type==="webauthn"&&y.friendly_name===e&&y.status==="unverified")}).then(p=>p?this.client.mfa.unenroll({factorId:p==null?void 0:p.id}):void 0),{data:null,error:c};const{data:d,error:h}=yield this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:r,rpOrigins:s},signal:n},{create:i});return d?this._verify({factorId:l.id,challengeId:d.challengeId,webauthn:{rpId:r,rpOrigins:s,type:d.webauthn.type,credential_response:d.webauthn.credential_response}}):{data:null,error:h}}catch(l){return P(l)?{data:null,error:l}:{data:null,error:new Je("Unexpected error in register",l)}}})}}xy();const Ny={url:$m,storageKey:Lm,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Dm,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},fr={};let ga=!1;class us{get jwks(){var e,r;return(r=(e=fr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){fr[this.storageKey]=Object.assign(Object.assign({},fr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=fr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){fr[this.storageKey]=Object.assign(Object.assign({},fr[this.storageKey]),{cachedAt:e})}constructor(e){var r,s,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this._pendingInitNotifications=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},Ny),e);if(this.storageKey=i.storageKey,this.instanceID=(r=us.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,us.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.instanceID>0&&ve()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=(s=i.experimental)!==null&&s!==void 0?s:{},this.admin=new wy({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=Ic(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,i.lock!=null&&(this.lock=i.lock,ga||(ga=!0,console.warn(`${this._logPrefix()} The "lock" option is deprecated and will be removed in v3. The client now coordinates session refreshes without a lock, so most apps can drop the option. See https://github.com/supabase/supabase-js/blob/master/packages/core/auth-js/migrations/lockless-coordination.md`))),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Iy(this),recoveryCodes:{getStatus:this._getRecoveryCodesStatus.bind(this),generate:this._generateRecoveryCodes.bind(this),verify:this._verifyRecoveryCode.bind(this),regenerate:this._regenerateRecoveryCodes.bind(this),unenroll:this._unenrollRecoveryCodes.bind(this)}}
97,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:jc()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ua(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=ua(this.memoryStorage)),ve()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",o=>f(this,null,function*(){this._debug("received broadcast notification from other tab or client",o),(o.data.event==="TOKEN_REFRESHED"||o.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{yield this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(a){this._debug("#broadcastChannel","error",a)}}))}i.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Rc}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}initialize(){return f(this,null,function*(){var e;if(this.initializePromise)return yield this.initializePromise;this._pendingInitNotifications=[],this.initializePromise=f(this,null,function*(){return this.lock!=null?yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return yield this._initialize()})):yield this._initialize()});const r=yield this.initializePromise,s=(e=this._pendingInitNotifications)!==null&&e!==void 0?e:[];this._pendingInitNotifications=null;for(const n of s)yield this._notifyAllSubscribers(n.event,n.session,n.broadcast);return r})}_initialize(){return f(this,null,function*(){var e;try{let r={},s="none";if(ve()&&(r=na(window.location.href),this._isImplicitGrantCallback(r)?s="implicit":(yield this._isPKCECallback(r))&&(s="pkce")),ve()&&this.detectSessionInUrl&&s!=="none"){const{data:n,error:i}=yield this._getSessionFromURL(r,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Hm(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=n;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),yield this._saveSession(o),setTimeout(()=>f(this,null,function*(){a==="recovery"?yield this._notifyAllSubscribers("PASSWORD_RECOVERY",o):yield this._notifyAllSubscribers("SIGNED_IN",o)}),0),{error:null}}return yield this._recoverAndRefresh(),{error:null}}catch(r){return P(r)?this._returnResult({error:r}):this._returnResult({error:new Je("Unexpected error during initialization",r)})}finally{yield this._handleVisibilityChange(),this._debug("#_initialize()","end")}})}signInAnonymously(e){return f(this,null,function*(){var r,s,n;try{const i=yield j(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:De}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(yield this._saveSession(o.session),yield this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(P(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}signUp(e){return f(this,null,function*(){var r,s,n;let i=null;try{let o;if("email"in e){const{email:h,password:p,options:u}=e;let y=null,g=null;this.flowType==="pkce"&&([y,g,i]=yield this._getCodeChallengeAndMethod()),o=yield j(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(u==null?void 0:u.emailRedirectTo,i),body:{email:h,password:p,data:(r=u==null?void 0:u.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:y,code_challenge_method:g},xform:De})}else if("phone"in e){const{phone:h,password:p,options:u}=e;o=yield j(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:h,password:p,data:(s=u==null?void 0:u.data)!==null&&s!==void 0?s:{},channel:(n=u==null?void 0:u.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken}},xform:De})}else throw new Ns("You must provide either an email or phone number and a password");const{data:a,error:l}=o;if(l||!a)return yield Ve(this.storage,this.storageKey,i),this._returnResult({data:{user:null,session:null},error:l});const c=a.session,d=a.user;return a.session&&(yield this._saveSession(a.session),yield this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:d,session:c},error:null})}catch(o){if(yield Ve(this.storage,this.storageKey,i),P(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}signInWithPassword(e){return f(this,null,function*(){try{let r;if("email"in e){const{email:i,password:o,options:a}=e;r=yield j(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:la})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=yield j(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:la})}else throw new Ns("You must provide either an email or phone number and a password");const{data:s,error:n}=r;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!s||!s.session||!s.user){const i=new hr;return this._returnResult({data:{user:null,session:null},error:i})}return s.session&&(yield this._saveSession(s.session),yield this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:n})}catch(r){if(P(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}signInWithOAuth(e){return f(this,null,function*(){var r,s,n,i;return yield this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(n=e.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})})}exchangeCodeForSession(e,r){return f(this,null,function*(){return yield this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return this._exchangeCodeForSession(e,r)})):this._exchangeCodeForSession(e,r)})}signInWithWeb3(e){return f(this,null,function*(){const{chain:r}=e;switch(r){case"ethereum":return yield this.signInWithEthereum(e);case"solana":return yield this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}})}signInWithEthereum(e){return f(this,null,function*(){var r,s,n,i,o,a,l,c,d,h,p;let u,y;if("message"in e)u=e.message,y=e.signature;else{const{chain:g,wallet:v,statement:b,options:x}=e;let _;if(ve())if(typeof v=="object")_=v;else{const I=window;if("ethereum"in I&&typeof I.ethereum=="object"&&"request"in I.ethereum&&typeof I.ethereum.request=="function")_=I.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof v!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=v}const E=new URL((r=x==null?void 0:x.url)!==null&&r!==void 0?r:window.location.href),T=yield _.request({method:"eth_requestAccounts"}).then(I=>I).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=$c(T[0]);let C=(s=x==null?void 0:x.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!C){const I=yield _.request({method:"eth_chainId"});C=Sy(I)}const M={domain:E.host,address:k,statement:b,uri:E.href,version:"1",chainId:C,nonce:(n=x==null?void 0:x.signInWithEthereum)===null||n===void 0?void 0:n.nonce,issuedAt:(o=(i=x==null?void 0:x.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=x==null?void 0:x.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=x==null?void 0:x.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=x==null?void 0:x.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(d=x==null?void 0:x.signInWithEthereum)===null||d===void 0?void 0:d.resources};u=ky(M),y=yield _.request({method:"personal_sign",params:[Ey(u),k]})}try{const{data:g,error:v}=yield j(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:u,signature:y}
97,!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:De});if(v)throw v;if(!g||!g.session||!g.user){const b=new hr;return this._returnResult({data:{user:null,session:null},error:b})}return g.session&&(yield this._saveSession(g.session),yield this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:v})}catch(g){if(P(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}})}signInWithSolana(e){return f(this,null,function*(){var r,s,n,i,o,a,l,c,d,h,p,u;let y,g;if("message"in e)y=e.message,g=e.signature;else{const{chain:v,wallet:b,statement:x,options:_}=e;let E;if(ve())if(typeof b=="object")E=b;else{const k=window;if("solana"in k&&typeof k.solana=="object"&&("signIn"in k.solana&&typeof k.solana.signIn=="function"||"signMessage"in k.solana&&typeof k.solana.signMessage=="function"))E=k.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");E=b}const T=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in E&&E.signIn){const k=yield E.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},_==null?void 0:_.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),x?{statement:x}:null));let C;if(Array.isArray(k)&&k[0]&&typeof k[0]=="object")C=k[0];else if(k&&typeof k=="object"&&"signedMessage"in k&&"signature"in k)C=k;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)y=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),g=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in E)||typeof E.signMessage!="function"||!("publicKey"in E)||typeof E!="object"||!E.publicKey||!("toBase58"in E.publicKey)||typeof E.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");y=[`${T.host} wants you to sign in with your Solana account:`,E.publicKey.toBase58(),...x?["",x,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(n=(s=_==null?void 0:_.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((i=_==null?void 0:_.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${_.signInWithSolana.notBefore}`]:[],...!((o=_==null?void 0:_.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${_.signInWithSolana.expirationTime}`]:[],...!((a=_==null?void 0:_.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${_.signInWithSolana.chainId}`]:[],...!((l=_==null?void 0:_.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${_.signInWithSolana.nonce}`]:[],...!((c=_==null?void 0:_.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${_.signInWithSolana.requestId}`]:[],...!((h=(d=_==null?void 0:_.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",..._.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
98`);const k=yield E.signMessage(new TextEncoder().encode(y),"utf8");if(!k||!(k instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=k}}try{const{data:v,error:b}=yield j(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:y,signature:Qt(g)},!((p=e.options)===null||p===void 0)&&p.captchaToken?{gotrue_meta_security:{captcha_token:(u=e.options)===null||u===void 0?void 0:u.captchaToken}}:null),xform:De});if(b)throw b;if(!v||!v.session||!v.user){const x=new hr;return this._returnResult({data:{user:null,session:null},error:x})}return v.session&&(yield this._saveSession(v.session),yield this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:b})}catch(v){if(P(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}})}_exchangeCodeForSession(e,r){return f(this,null,function*(){const s=(r==null?void 0:r.flowId)!=null,n=s?zs(r==null?void 0:r.flowId):ve()?zs(na(window.location.href)[Yt]):null;s&&!n&&this._debug("#_exchangeCodeForSession()","provided flowId is not a valid flow id",r==null?void 0:r.flowId);const{verifier:i,flowId:o}=s&&!n?{verifier:null,flowId:null}:yield iy(this.storage,this.storageKey,n),[a,l]=(i!=null?i:"").split("/");try{if(!a&&this.flowType==="pkce")throw new Wm;const{data:c,error:d}=yield j(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:a},xform:De});if(yield Ve(this.storage,this.storageKey,o),d)throw d;if(!c||!c.session||!c.user){const h=new hr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:h})}return c.session&&(yield this._saveSession(c.session),yield this._notifyAllSubscribers(l==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c.session)),this._returnResult({data:Object.assign(Object.assign({},c),{redirectType:l!=null?l:null}),error:d})}catch(c){if(yield Ve(this.storage,this.storageKey,o),P(c))return this._returnResult({data:{user:null,session:null,redirectType:null},error:c});throw c}})}signInWithIdToken(e){return f(this,null,function*(){try{const{options:r,provider:s,token:n,access_token:i,nonce:o}=e,a=yield j(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:n,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:De}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const d=new hr;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(yield this._saveSession(l.session),yield this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(r){if(P(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}signInWithOtp(e){return f(this,null,function*(){var r,s,n,i,o;let a=null;try{if("email"in e){const{email:l,options:c}=e;let d=null,h=null;this.flowType==="pkce"&&([d,h,a]=yield this._getCodeChallengeAndMethod());const{error:p}=yield j(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(s=c==null?void 0:c.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:d,code_challenge_method:h},redirectTo:this._maybeAppendFlowIdToRedirect(c==null?void 0:c.emailRedirectTo,a)});return this._returnResult({data:{user:null,session:null},error:p})}if("phone"in e){const{phone:l,options:c}=e,{data:d,error:h}=yield j(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(n=c==null?void 0:c.data)!==null&&n!==void 0?n:{},create_user:(i=c==null?void 0:c.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:h})}throw new Ns("You must provide either an email or phone number.")}catch(l){if(yield Ve(this.storage,this.storageKey,a),P(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}})}verifyOtp(e){return f(this,null,function*(){var r,s;try{let n,i;"options"in e&&(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:a}=yield j(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:De});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(yield this._saveSession(l),yield this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(n){if(P(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}})}signInWithSSO(e){return f(this,null,function*(){var r,s,n,i;let o=null;try{let a=null,l=null;this.flowType==="pkce"&&([a,l,o]=yield this._getCodeChallengeAndMethod());const c=yield j(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:this._maybeAppendFlowIdToRedirect((r=e.options)===null||r===void 0?void 0:r.redirectTo,o)}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:yy});return!((n=c.data)===null||n===void 0)&&n.url&&ve()&&!(!((i=e.options)===null||i===void 0)&&i.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(yield Ve(this.storage,this.storageKey,o),P(a))return this._returnResult({data:null,error:a});throw a}})}reauthenticate(){return f(this,null,function*(){return yield this.initializePromise,this.lock!=null?yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return yield this._reauthenticate()})):yield this._reauthenticate()})}_reauthenticate(){return f(this,null,function*(){try{return yield this._useSession(e=>f(this,null,function*(){const{data:{session:r},error:s}=e;if(s)throw s;if(!r)throw new ye;const{error:n}=yield j(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:n})}))}catch(e){if(P(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}resend(e){return f(this,null,function*(){let r=null;try{const s=`${this.url}/resend`;if("email"in e){const{email:n,type:i,options:o}=e;let a=null,l=null;this.flowType==="pkce"&&([a,l,r]=yield this._getCodeChallengeAndMethod());const{error:c}=yield j(this.fetch,"POST",s,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken},code_challenge:a,code_challenge_method:l},redirectTo:this._maybeAppendFlowIdToRedirect(o==null?void 0:o.emailRedirectTo,r)});return c&&(yield Ve(this.storage,this.storageKey,r)),this._returnResult({data:{user:null,session:null},error:c})}else if("phone"in e){const{phone:n,type:i,options:o}=e,{data:a,error:l}=yield j(this.fetch,"POST",s,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:l})}throw new Ns("You must provide either an email or phone number and a type")}catch(s){if(yield Ve(this.storage,this.storageKey,r),P(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}getSession(){return f(this,null,function*(){return yield this.initializePromise,this.lock!=null?yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return this._useSession(e=>f(this,null,function*(){return e}))})):yield this._useSession(e=>f(this,null,function*(){return e}))})}_acquireLock(e,r){return f(this,null,function*(){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=f(this,null,function*(){return yield s,yield r()});return this.pendingInLock.push(f(this,null,function*(){try{yield n}catch(i){}})),n}return yield this.lock(`lock:${this.storageKey}`,e,()=>f(this,null,function*(){this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=r();for(this.pendingInLock.push(f(this,null,function*(){try{yield s}catch(n){}})),yield s;this.pendingInLock.length;){const n=[...this.pendingInLock];yield Promise.all(n),this.pendingInLock.splice(0,n.length)}return yield s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}}))}finally{this._debug("#_acquireLock","end")}})}_useSession(e){return f(this,null,function*(){this._debug("#_useSession","begin");try{const r=yield this.__loadSession();return yield e(r)}finally{this._debug("#_useSession","end")}})}__loadSession(){return f(this,null,function*(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=yield _e(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not val
98id"),yield this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at*1e3-Date.now()<Mn:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s)return{data:{session:yield this._hydrateSessionUser(e)},error:null};const{data:n,error:i}=yield this._callRefreshToken(e.refresh_token);if(i){const o=yield _e(this.storage,this.storageKey);return o&&this._isValidSession(o)&&o.expires_at&&o.expires_at*1e3>Date.now()?this._returnResult({data:{session:yield this._hydrateSessionUser(o)},error:null}):this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:n},error:null})}finally{this._debug("#__loadSession()","end")}})}_hydrateSessionUser(e){return f(this,null,function*(){if(this.userStorage){const r=yield _e(this.userStorage,this.storageKey+"-user");e.user=r!=null&&r.user?r.user:Bn()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const r={value:this.suppressGetSessionWarning};e.user=py(e.user,r),r.value&&(this.suppressGetSessionWarning=!0)}return e})}getUser(e){return f(this,null,function*(){if(e)return yield this._getUser(e);yield this.initializePromise;let r;return this.lock!=null?r=yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return yield this._getUser()})):r=yield this._getUser(),r.data.user&&(this.suppressGetSessionWarning=!0),r})}_getUser(e){return f(this,null,function*(){try{return e?yield j(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Ot}):yield this._useSession(r=>f(this,null,function*(){var s,n,i;const{data:o,error:a}=r;if(a)throw a;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ye}:yield j(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0,xform:Ot})}))}catch(r){if(P(r))return Is(r)&&(yield this._removeSession()),this._returnResult({data:{user:null},error:r});throw r}})}updateUser(s){return f(this,arguments,function*(e,r={}){return yield this.initializePromise,this.lock!=null?yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return yield this._updateUser(e,r)})):yield this._updateUser(e,r)})}_updateUser(s){return f(this,arguments,function*(e,r={}){let n=null;try{return yield this._useSession(i=>f(this,null,function*(){const{data:o,error:a}=i;if(a)throw a;if(!o.session)throw new ye;const l=o.session;let c=null,d=null;this.flowType==="pkce"&&e.email!=null&&([c,d,n]=yield this._getCodeChallengeAndMethod());const{data:h,error:p}=yield j(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(r==null?void 0:r.emailRedirectTo,n),body:Object.assign(Object.assign({},e),{code_challenge:c,code_challenge_method:d}),jwt:l.access_token,xform:Ot});if(p)throw p;return l.user=h.user,yield this._saveSession(l),yield this._notifyAllSubscribers("USER_UPDATED",l),this._returnResult({data:{user:l.user},error:null})}))}catch(i){if(yield Ve(this.storage,this.storageKey,n),P(i))return this._returnResult({data:{user:null},error:i});throw i}})}setSession(e){return f(this,null,function*(){return yield this.initializePromise,this.lock!=null?yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return yield this._setSession(e)})):yield this._setSession(e)})}_setSession(e){return f(this,null,function*(){try{if(!e.access_token||!e.refresh_token)throw new ye;const r=Date.now()/1e3;let s=r,n=!0,i=null;const{payload:o}=Ds(e.access_token);if(o.exp&&(s=o.exp,n=s<=r),n){const{data:a,error:l}=yield this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=yield this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:s-r,expires_at:s},yield this._saveSession(i),yield this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(P(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}})}refreshSession(e){return f(this,null,function*(){return yield this.initializePromise,this.lock!=null?yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return yield this._refreshSession(e)})):yield this._refreshSession(e)})}_refreshSession(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){var s;if(!e){const{data:o,error:a}=r;if(a)throw a;e=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new ye;const{data:n,error:i}=yield this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})}))}catch(r){if(P(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}_getSessionFromURL(e,r){return f(this,null,function*(){var s;try{if(!ve())throw new $s("No browser detected.");
98if(e.error||e.error_description||e.error_code)throw new $s(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Qo("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new $s("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Qo("No code detected.");const{data:_,error:E}=yield this._exchangeCodeForSession(e.code,{flowId:e[Yt]});if(E)throw E;const T=new URL(window.location.href);return T.searchParams.delete("code"),T.searchParams.delete(Yt),window.history.replaceState(window.history.state,"",T.toString()),{data:{session:_.session,redirectType:(s=_.redirectType)!==null&&s!==void 0?s:null},error:null}}const{provider_token:n,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:d}=e;if(!o||!l||!a||!d)throw new $s("No session defined in URL");const h=Math.round(Date.now()/1e3),p=parseInt(l);let u=h+p;c&&(u=parseInt(c));const y=u-h;y*1e3<=mt&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${p}s`);const g=u-p;h-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,u,h):h-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,u,h);const{data:v,error:b}=yield this._getUser(o);if(b)throw b;const x={provider_token:n,provider_refresh_token:i,access_token:o,expires_in:p,expires_at:u,refresh_token:a,token_type:d,user:v.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:x,redirectType:e.type},error:null})}catch(n){if(P(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}})}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}_isPKCECallback(e){return f(this,null,function*(){if(!e.code)return!1;const r=zs(e[Yt]);return r&&(yield _e(this.storage,$r(this.storageKey,r)))?!0:!!(yield _e(this.storage,`${this.storageKey}-code-verifier`))})}signOut(){return f(this,arguments,function*(e={scope:"global"}){return yield this.initializePromise,this.lock!=null?yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){return yield this._signOut(e)})):yield this._signOut(e)})}_signOut(){return f(this,arguments,function*({scope:e}={scope:"global"}){return yield this._useSession(r=>f(this,null,function*(){var s;const n=()=>f(this,null,function*(){yield this._removeSession()}),{data:i,error:o}=r;if(o&&!Is(o))return this._returnResult({error:o});const a=(s=i.session)===null||s===void 0?void 0:s.access_token;if(a){const{error:l}=yield this.admin.signOut(a,e);if(l&&!(Yo(l)&&(l.status===404||l.status===401||l.status===403)||Is(l)))return e!=="others"&&(yield n()),this._returnResult({error:l})}return e!=="others"&&(yield n()),this._returnResult({error:null})}))})}onAuthStateChange(e){const r=Jm(),s={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,s),f(this,null,function*(){yield this.initializePromise,this.lock!=null?yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){this._emitInitialSession(r)})):yield this._emitInitialSession(r)}),{data:{subscription:s}}}_emitInitialSession(e){return f(this,null,function*(){return yield this._useSession(r=>f(this,null,function*(){var s,n;try{const{data:{session:i},error:o}=r;if(o)throw o;yield(s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",i),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){if(yield(n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null),this._debug("INITIAL_SESSION","callback id",e,"error",i),Zo(i))return;Is(i)||Ls(i)||Yo(i)&&(i.code==="refresh_token_not_found"||i.code==="refresh_token_already_used"||i.code==="session_expired")?console.warn(i):console.error(i)}}))})}resetPasswordForEmail(s){return f(this,arguments,function*(e,r={}){let n=null,i=null,o=null;this.flowType==="pkce"&&([n,i,o]=yield this._getCodeChallengeAndMethod(!0));try{return yield j(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:this._maybeAppendFlowIdToRedirect(r.redirectTo,o)})}catch(a){if(yield Ve(this.storage,this.storageKey,o),P(a))return this._returnResult({data:null,error:a});throw a}})}getUserIdentities(){return f(this,null,function*(){var e;try{const{data:r,error:s}=yield this.getUser();if(s)throw s;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}linkIdentity(e){return f(this,null,function*(){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)})}linkIdentityOAuth(e){return f(this,null,function*(){var r;let s=null;try{const{data:n,error:i}=yield this._useSession(o=>f(this,null,function*(){var a,l,c,d,h;const{data:p,error:u}=o;if(u)throw u;const{url:y,flowId:g}=yield this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return s=g,yield j(this.fetch,"GET",y,{headers:this.headers,jwt:(h=(d=p.session)===null||d===void 0?void 0:d.access_token)!==null&&h!==void 0?h:void 0})}));if(i)throw i;return ve()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url,flowId:s},error:null})}catch(n){if(P(n))return this._returnResult({data:{provider:e.provider,url:null,flowId:s},error:n});throw n}})}linkIdentityIdToken(e){return f(this,null,function*(){return yield this._useSession(r=>f(this,null,function*(){var s;try{const{error:n,data:{session:i}}=r;if(n)throw n;const{options:o,provider:a,token:l,access_token:c,nonce:d}=e,h=yield j(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=i==null?void 0:i.access_token)!==null&&s!==void 0?s:void 0,body:{provider:a,id_token:l,access_token:c,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:De}),{data:p,error:u}=h;return u?this._returnResult({data:{user:null,session:null},error:u}):!p||!p.session||!p.user?this._returnResult({data:{user:null,session:null},error:new hr}):(p.session&&(yield this._saveSession(p.session),yield this._notifyAllSubscribers("USER_UPDATED",p.session)),this._returnResult({data:p,error:u}))}catch(n){if(yield Ve(this.storage,this.storageKey,null),P(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}))})}unlinkIdentity(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){var s,n;const{data:i,error:o}=r;if(o)throw o;
98return yield j(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&n!==void 0?n:void 0})}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}_refreshAccessToken(e){return f(this,null,function*(){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const s=Date.now();return yield Xm(n=>f(this,null,function*(){return n>0&&(yield Qm(200*Math.pow(2,n-1))),this._debug(r,"refreshing attempt",n),yield j(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:De})}),(n,i)=>{const o=200*Math.pow(2,n);return i&&Ls(i)&&Date.now()+o-s<mt})}catch(s){if(this._debug(r,"error",s),P(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}finally{this._debug(r,"end")}})}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}_handleProviderSignIn(e,r){return f(this,null,function*(){const{url:s,flowId:n}=yield this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",s),ve()&&!r.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s,flowId:n},error:null}})}_recoverAndRefresh(){return f(this,null,function*(){var e,r;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const n=yield _e(this.storage,this.storageKey);if(n&&this.userStorage){let o=yield _e(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},yield vt(this.userStorage,this.storageKey+"-user",o)),n.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Bn()}else if(n&&!n.user&&!n.user){const o=yield _e(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,yield Re(this.storage,this.storageKey+"-user"),yield vt(this.storage,this.storageKey,n)):n.user=Bn()}if(this._debug(s,"session from storage",n),!this._isValidSession(n)){this._debug(s,"session is not valid"),n!==null&&(yield this._removeSession());return}const i=((r=n.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Mn;if(this._debug(s,`session has${i?"":" not"} expired with margin of ${Mn}
98s`),i){if(this.autoRefreshToken&&n.refresh_token){const{error:o}=yield this._callRefreshToken(n.refresh_token);o&&(Zo(o)?this._debug(s,"refresh discarded by commit guard",o):this._debug(s,"refresh failed",o))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=yield this._getUser(n.access_token);!a&&(o!=null&&o.user)?(n.user=o.user,yield this._saveSession(n),yield this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(s,"error getting user data, skipping SIGNED_IN notification",o)}else yield this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(s,"error",n),Ls(n)?console.warn(n):console.error(n);return}finally{this._debug(s,"end")}})}_callRefreshToken(e){return f(this,null,function*(){var r,s;if(!e)throw new ye;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===e&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const n="#_callRefreshToken()";this._debug(n,"begin");try{this.refreshingDeferred=new Sn,this.refreshingDeferred.promise.then(void 0,()=>{});const i=yield _e(this.storage,this.storageKey),{data:o,error:a}=yield this._refreshAccessToken(e);if(a)throw a;if(!o.session)throw new ye;const l=yield _e(this.storage,this.storageKey);if(i!==null&&(l===null||l.refresh_token!==i.refresh_token)){this._debug(n,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:l?"replaced":"cleared"});const p={data:null,error:new Xo};return this.refreshingDeferred.resolve(p),p}const d=this._sessionRemovalEpoch;if(yield this._saveSession(o.session),this._sessionRemovalEpoch!==d){this._debug(n,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),yield Re(this.storage,this.storageKey),this.userStorage&&(yield Re(this.userStorage,this.storageKey+"-user"));const p={data:null,error:new Xo};return this.refreshingDeferred.resolve(p),p}yield this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const h={data:o.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(h),h}catch(i){if(this._debug(n,"error",i),P(i)){const o={data:null,error:i};if(!Ls(i)){const a=yield _e(this.storage,this.storageKey);!!(a!=null&&a.expires_at&&a.expires_at*1e3>Date.now())?this._debug(n,"proactive refresh failed, access token still valid — preserving session"):yield this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:o,expiresAt:Date.now()+Nm},(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}})}_notifyAllSubscribers(e,r,s=!0){return f(this,null,function*(){if(this._pendingInitNotifications!==null&&s){this._pendingInitNotifications.push({event:e,session:r,broadcast:s});return}const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",r,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(a=>f(this,null,function*(){try{yield a.callback(e,r)}catch(l){i.push(l)}}));if(yield Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(n,"end")}})}_saveSession(e){return f(this,null,function*(){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;const r=Object.assign({},e),s=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&r.user&&(yield vt(this.userStorage,this.storageKey+"-user",{user:r.user}));const n=Object.assign({},r);delete n.user;const i=ia(n);yield vt(this.storage,this.storageKey,i)}else{const n=ia(r);yield vt(this.storage,this.storageKey,n)}})}_removeSession(){return f(this,null,function*(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,yield Re(this.storage,this.storageKey),yield oy(this.storage,this.storageKey),yield Re(this.storage,this.storageKey+"-user"),this.userStorage&&(yield Re(this.userStorage,this.storageKey+"-user")),yield this._notifyAllSubscribers("SIGNED_OUT",null)})}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ve()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
98catch(r){console.error("removing visibilitychange callback failed",r)}}_startAutoRefresh(){return f(this,null,function*(){yield this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),mt);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno!="undefined"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(()=>f(this,null,function*(){yield this.initializePromise,yield this._autoRefreshTokenTick()}),0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno!="undefined"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)})}_stopAutoRefresh(){return f(this,null,function*(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)})}startAutoRefresh(){return f(this,null,function*(){this._removeVisibilityChangedCallback(),yield this._startAutoRefresh()})}stopAutoRefresh(){return f(this,null,function*(){this._removeVisibilityChangedCallback(),yield this._stopAutoRefresh()})}dispose(){return f(this,null,function*(){var e;this._removeVisibilityChangedCallback(),yield this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()})}_autoRefreshTokenTick(){return f(this,null,function*(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{yield this._acquireLock(0,()=>f(this,null,function*(){try{const e=Date.now();try{return yield this._useSession(r=>f(this,null,function*(){const{data:{session:s}}=r;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((s.expires_at*1e3-e)/mt);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${mt}ms, refresh threshold is ${Yr} ticks`),n<=Yr&&(yield this._callRefreshToken(s.refresh_token))}))}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}))}catch(e){if(e instanceof _y)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{yield this._useSession(r=>f(this,null,function*(){const{data:{session:s}}=r;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((s.expires_at*1e3-e)/mt);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${mt}ms, refresh threshold is ${Yr} ticks`),n<=Yr&&(yield this._callRefreshToken(s.refresh_token))}))}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}_handleVisibilityChange(){return f(this,null,function*(){if(this._debug("#_handleVisibilityChange()"),!ve()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=()=>f(this,null,function*(){try{yield this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}}),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),yield this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}})}_onVisibilityChanged(e){return f(this,null,function*(){const r=`#_onVisibilityChanged(${e})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(yield this.initializePromise,this.lock!=null)yield this._acquireLock(this.lockAcquireTimeout,()=>f(this,null,function*(){if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}yield this._recoverAndRefresh()}));else{if(document.visibilityState!=="visible"){this._debug(r,"visibilityState is no longer visible, skipping recovery");return}yield this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()})}_getUrlForProvider(e,r,s){return f(this,null,function*(){let n=s==null?void 0:s.redirectTo,i=null,o=null,a=null;this.flowType==="pkce"&&([i,o,a]=yield this._getCodeChallengeAndMethod(),n=this._maybeAppendFlowIdToRedirect(n,a));const l=[`provider=${encodeURIComponent(r)}`];if(n&&l.push(`redirect_to=${encodeURIComponent(n)}
98`),s!=null&&s.scopes&&l.push(`scopes=${encodeURIComponent(s.scopes)}`),i!=null&&o!=null){const c=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});l.push(c.toString())}if(s!=null&&s.queryParams){const c=new URLSearchParams(s.queryParams);l.push(c.toString())}return s!=null&&s.skipBrowserRedirect&&l.push(`skip_http_redirect=${s.skipBrowserRedirect}`),{url:`${e}?${l.join("&")}`,flowId:a}})}_maybeAppendFlowIdToRedirect(e,r){return!e||!r||!this.experimental.appendPkceFlowIdToRedirects?e!=null?e:void 0:ay(e,r)}_getCodeChallengeAndMethod(e=!1){return f(this,null,function*(){return ly(this.storage,this.storageKey,e,r=>this._debug("#_getCodeChallengeAndMethod()","evicted oldest pending PKCE verifier slot",r))})}_unenroll(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){var s;const{data:n,error:i}=r;return i?this._returnResult({data:null,error:i}):yield j(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token})}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}_enroll(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){var s,n;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=yield j(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((n=l==null?void 0:l.totp)===null||n===void 0)&&n.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}_verify(e){return f(this,null,function*(){const r=()=>f(this,null,function*(){try{return yield this._useSession(s=>f(this,null,function*(){var n;const{data:i,error:o}=s;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?fa(e.webauthn.credential_response):pa(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:c}=yield j(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(yield this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),yield this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))}))}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}});return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()})}_challenge(e){return f(this,null,function*(){const r=()=>f(this,null,function*(){try{return yield this._useSession(s=>f(this,null,function*(){var n;const{data:i,error:o}=s;if(o)return this._returnResult({data:null,error:o});const a=yield j(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});if(a.error)return a;const{data:l}=a;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:da(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:ha(l.webauthn.credential_options.publicKey)})})}),error:null}}}))}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}});return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()})}_challengeAndVerify(e){return f(this,null,function*(){const{data:r,error:s}=yield this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):yield this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})})}_listFactors(){return f(this,null,function*(){var e;const{data:{user:r},error:s}=yield this.getUser();if(s)return{data:null,error:s};const n={all:[],phone:[],totp:[],webauthn:[],recovery_code:[]};for(const i of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])n.all.push(i),i.status==="verified"&&i.factor_type in n&&Array.isArray(n[i.factor_type])&&n[i.factor_type].push(i);return{data:n,error:null}})}_getAuthenticatorAssuranceLevel(e){return f(this,null,function*(){var r,s,n,i;if(e)try{const{payload:u}=Ds(e);let y=null;u.aal&&(y=u.aal);let g=y;const{data:{user:v},error:b}=yield this.getUser(e);if(b)return this._returnResult({data:null,error:b});((s=(r=v==null?void 0:v.factors)===null||r===void 0?void 0:r.filter(E=>E.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(g="aal2");const _=u.amr||[];return{data:{currentLevel:y,nextLevel:g,currentAuthenticationMethods:_},error:null}}catch(u){if(P(u))return this._returnResult({data:null,error:u});throw u}const{data:{session:o},error:a}
98=yield this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=Ds(o.access_token);let c=null;l.aal&&(c=l.aal);let d=c;((i=(n=o.user.factors)===null||n===void 0?void 0:n.filter(u=>u.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(d="aal2");const p=l.amr||[];return{data:{currentLevel:c,nextLevel:d,currentAuthenticationMethods:p},error:null}})}_getRecoveryCodesStatus(){return f(this,null,function*(){Vr(this.experimental);try{return yield this._useSession(e=>f(this,null,function*(){var r;const{data:s,error:n}=e;if(n)return this._returnResult({data:null,error:n});const{data:i,error:o}=yield j(this.fetch,"GET",`${this.url}/factors/recovery-codes`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})}))}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}})}_generateRecoveryCodes(e){return f(this,null,function*(){Vr(this.experimental);try{return yield this._useSession(r=>f(this,null,function*(){var s;const{data:n,error:i}=r;if(i)return this._returnResult({data:null,error:i});const{data:o,error:a}=yield j(this.fetch,"POST",`${this.url}/factors/recovery-codes`,{body:e!=null&&e.friendlyName?{friendly_name:e.friendlyName}:void 0,headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token});return a?this._returnResult({data:null,error:a}):this._returnResult({data:o,error:null})}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}_verifyRecoveryCode(e){return f(this,null,function*(){Vr(this.experimental);const r=()=>f(this,null,function*(){try{return yield this._useSession(s=>f(this,null,function*(){var n;const{data:i,error:o}=s;if(o)return this._returnResult({data:null,error:o});const{data:a,error:l}=yield j(this.fetch,"POST",`${this.url}/factors/recovery-codes/verify`,{body:{code:e.code},headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});if(l)return this._returnResult({data:null,error:l});const c=Object.assign({expires_at:Pc(a.expires_in)},a);return yield this._saveSession(c),yield this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",c),this._returnResult({data:a,error:null})}))}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}});return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()})}_regenerateRecoveryCodes(){return f(this,null,function*(){Vr(this.experimental);try{return yield this._useSession(e=>f(this,null,function*(){var r;const{data:s,error:n}=e;if(n)return this._returnResult({data:null,error:n});const{data:i,error:o}=yield j(this.fetch,"POST",`${this.url}/factors/recovery-codes/regenerate`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})}))}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}})}_unenrollRecoveryCodes(){return f(this,null,function*(){Vr(this.experimental);try{return yield this._useSession(e=>f(this,null,function*(){var r;const{data:s,error:n}=e;if(n)return this._returnResult({data:null,error:n});const{data:i,error:o}=yield j(this.fetch,"DELETE",`${this.url}/factors/recovery-codes`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})}))}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}})}_getAuthorizationDetails(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){const{data:{session:s},error:n}=r;return n?this._returnResult({data:null,error:n}):s?yield j(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new ye})}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}_approveAuthorization(e,r){return f(this,null,function*(){try{return yield this._useSession(s=>f(this,null,function*(){const{data:{session:n},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new ye});const o=yield j(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&ve()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o}))}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}})}_denyAuthorization(e,r){return f(this,null,function*(){try{return yield this._useSession(s=>f(this,null,function*(){const{data:{session:n},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new ye});const o=yield j(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&ve()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o}))}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}})}_listOAuthGrants(){return f(this,null,function*(){try{return yield this._useSession(e=>f(this,null,function*(){const{data:{session:r},error:s}=e;return s?this._returnResult({data:null,error:s}):r?yield j(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:n=>({data:n,error:null})}):this._returnResult({data:null,error:new ye})}))}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}})}_revokeOAuthGrant(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){const{data:{session:s},error:n}=r;return n?this._returnResult({data:null,error:n}
98):s?(yield j(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new ye})}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}fetchJwk(s){return f(this,arguments,function*(e,r={keys:[]}){let n=r.keys.find(l=>l.kid===e);if(n)return n;const i=Date.now();if(n=this.jwks.keys.find(l=>l.kid===e),n&&this.jwks_cached_at+Bm>i)return n;const{data:o,error:a}=yield j(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=i,n=o.keys.find(l=>l.kid===e),!n)?null:n})}getClaims(s){return f(this,arguments,function*(e,r={}){try{let n=e;if(!n){const{data:y,error:g}=yield this.getSession();if(g||!y.session)return this._returnResult({data:null,error:g});n=y.session.access_token}const{header:i,payload:o,signature:a,raw:{header:l,payload:c}}=Ds(n);if(!(r!=null&&r.allowExpired))try{dy(o.exp)}catch(y){throw new rn(y instanceof Error?y.message:"JWT validation failed")}const d=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:yield this.fetchJwk(i.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!d){const{error:y}=yield this.getUser(n);if(y)throw y;return{data:{claims:o,header:i,signature:a},error:null}}const h=hy(i.alg),p=yield crypto.subtle.importKey("jwk",d,h,!0,["verify"]);if(!(yield crypto.subtle.verify(h,p,a,Gm(`${l}.${c}`))))throw new rn("Invalid JWT signature");return{data:{claims:o,header:i,signature:a},error:null}}catch(n){if(P(n))return this._returnResult({data:null,error:n});throw n}})}signInWithPasskey(e){return f(this,null,function*(){var r,s,n,i;try{if(!on())return this._returnResult({data:null,error:new Je("Browser does not support WebAuthn",null)});const{data:o,error:a}=yield this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(a||!o)return this._returnResult({data:null,error:a});const l=ha(o.options),c=(n=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.signal)!==null&&n!==void 0?n:gi.createNewAbortSignal(),{data:d,error:h}=yield Uc({publicKey:l,signal:c,mediation:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.mediation});if(h||!d)return this._returnResult({data:null,error:h!=null?h:new Je("WebAuthn ceremony failed",null)});const p=pa(d);return this._verifyPasskeyAuthentication({challengeId:o.challenge_id,credential:p})}catch(o){if(P(o))return this._returnResult({data:null,error:o});throw o}})}registerPasskey(e){return f(this,null,function*(){var r,s;try{if(!on())return this._returnResult({data:null,error:new Je("Browser does not support WebAuthn",null)});const{data:n,error:i}=yield this._startPasskeyRegistration();if(i||!n)return this._returnResult({data:null,error:i});const o=da(n.options),a=(s=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:gi.createNewAbortSignal(),{data:l,error:c}=yield Dc({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c!=null?c:new Je("WebAuthn ceremony failed",null)});const d=fa(l);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:d})}catch(n){if(P(n))return this._returnResult({data:null,error:n});throw n}})}_startPasskeyRegistration(){return f(this,null,function*(){try{return yield this._useSession(e=>f(this,null,function*(){const{data:{session:r},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new ye});const{data:n,error:i}=yield j(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})}))}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}})}_verifyPasskeyRegistration(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ye});const{data:i,error:o}=yield j(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}_startPasskeyAuthentication(e){return f(this,null,function*(){var r;try{const{data:s,error:n}=yield j(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:s,error:null})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}})}_verifyPasskeyAuthentication(e){return f(this,null,function*(){try{const{data:r,error:s}=yield j(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:De});return s?this._returnResult({data:null,error:s}):(r.session&&(yield this._saveSession(r.session),yield this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}_listPasskeys(){return f(this,null,function*(){try{return yield this._useSession(e=>f(this,null,function*(){const{data:{session:r},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new ye});const{data:n,error:i}=yield j(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})}))}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}})}_updatePasskey(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ye});const{data:i,error:o}=yield j(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}_deletePasskey(e){return f(this,null,function*(){try{return yield this._useSession(r=>f(this,null,function*(){const{data:{session:s},error:n}=r;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new ye});const{error:i}
98=yield j(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})}))}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}})}}us.nextInstanceID={};const $y=us,Ly="2.117.1";let Qr="",ln;if(typeof Deno!="undefined"){var Hn;Qr="deno",ln=(Hn=Deno.version)===null||Hn===void 0?void 0:Hn.deno}else if(typeof document!="undefined")Qr="web";else if(typeof navigator!="undefined"&&navigator.product==="ReactNative")Qr="react-native";else{var Wn;Qr="node";const t=globalThis.process;ln=t==null||(Wn=t.version)===null||Wn===void 0?void 0:Wn.replace(/^v/,"")}const Mc=[`runtime=${Qr}`];ln&&Mc.push(`runtime-version=${ln}`);const Dy={"X-Client-Info":`supabase-js/${Ly}; ${Mc.join("; ")}`},Uy={headers:Dy},My={schema:"public"},By={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Fy={},Hy={enabled:!1,respectSamplingDecision:!0};function Wy(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,s,n,i]=e;if(r.length!==2||s.length!==32||n.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(s)||!o.test(n)||!o.test(i)||s==="00000000000000000000000000000000"||n==="0000000000000000"?null:{version:r,traceId:s,parentId:n,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function Vy(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch(s){return!1}for(const s of e)try{if(typeof s=="string"){if(zy(r.hostname,s))return!0}else if(s instanceof RegExp){if(s.test(r.hostname))return!0}else if(typeof s=="function"&&s(r))return!0}catch(n){continue}return!1}function zy(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function qy(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch(r){}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function ds(t){"@babel/helpers - typeof";return ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ds(t)}function Ky(t,e){if(ds(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var s=r.call(t,e);if(ds(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Gy(t){var e=Ky(t,"string");return ds(e)=="symbol"?e:e+""}function Jy(t,e,r){return(e=Gy(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ma(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,s)}return r}function pe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ma(Object(r),!0).forEach(function(s){Jy(t,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ma(Object(r)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(r,s))})}return t}const Yy=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Qy=()=>Headers,Bc=t=>t.startsWith("sb_publishable_")||t.startsWith("sb_secret_"),Xy="sb_temp_",ya=new Set,Zy=t=>{var e,r;if(!t.startsWith("sb_")||Bc(t)||t.startsWith(Xy))return;const s=(e=(r=t.match(/^sb_[a-zA-Z0-9]+_/))===null||r===void 0?void 0:r[0])!==null&&e!==void 0?e:"unknown";ya.has(s)||(ya.add(s),console.warn("@supabase/supabase-js: Unrecognized Supabase API key format. The client will proceed and send this key as-is; if you see authentication errors you may need to upgrade @supabase/supabase-js to a version that recognizes this key type."))},va=(t,e,r,s,n,i)=>{const o=Yy(s),a=Qy(),l=(n==null?void 0:n.enabled)===!0,c=(n==null?void 0:n.respectSamplingDecision)!==!1,d=l?qy(e):null,h=!(i!=null&&i.omitApiKeyAsBearer&&Bc(t));return(p,u)=>f(void 0,null,function*(){const y=yield r();
98let g=new a(u==null?void 0:u.headers);if(g.has("apikey")||g.set("apikey",t),!g.has("Authorization")){const v=y!=null?y:h?t:null;v&&g.set("Authorization",`Bearer ${v}`)}if(d){const v=ev(p,d,c);v&&(v.traceparent&&!g.has("traceparent")&&g.set("traceparent",v.traceparent),v.tracestate&&!g.has("tracestate")&&g.set("tracestate",v.tracestate),v.baggage&&!g.has("baggage")&&g.set("baggage",v.baggage))}return o(p,pe(pe({},u),{},{headers:g}))})};let ba=!1,wa=!1;function ev(t,e,r){const s=Xp();if(!s)return ba||(ba=!0,console.warn("@supabase/supabase-js: tracePropagation is enabled but the tracing runtime is not loaded, so trace headers will not be attached. Add `import '@supabase/supabase-js/tracing'` at your application entry point (requires the OpenTelemetry API package to be installed). The CDN/UMD build does not support trace propagation.")),null;if(!Vy(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=s();if(!n||!n.traceparent){var i;if(!(n==null||(i=n.carrierKeys)===null||i===void 0)&&i.length&&!wa){wa=!0;const o=n.carrierKeys.includes("sentry-trace")?" Sentry detected: set `propagateTraceparent: true` in Sentry.init() to emit it.":" Configure your tracing SDK to emit W3C trace context on outgoing requests.";console.warn(`@supabase/supabase-js: tracePropagation is enabled and a tracing SDK is active, but its propagator wrote [${n.carrierKeys.join(", ")}] and no W3C traceparent header, so trace headers will not be attached.`+o)}return null}if(r){const o=Wy(n.traceparent);if(o&&!o.isSampled)return{traceparent:n.traceparent}}return n}function _a(t){return typeof t=="boolean"?{enabled:t}:t}function tv(t){return t.endsWith("/")?t:t+"/"}let xa=!1;function rv(t){xa||typeof t!="object"||t===null||!("schema"in t)||t.schema===void 0||(xa=!0,console.warn(`@supabase/supabase-js: The "schema" option must be nested under "db", e.g. createClient(url, key, { db: { schema: 'myschema' } }). A top-level "schema" is ignored and queries go to the default schema.`))}function sv(t,e){var r,s,n,i,o,a;const{db:l,auth:c,realtime:d,global:h}=t,{db:p,auth:u,realtime:y,global:g}=e,v=_a(t.tracePropagation),b=_a(e.tracePropagation),x={db:pe(pe({},p),l),auth:pe(pe({},u),c),realtime:pe(pe({},y),d),storage:{},global:pe(pe(pe({},g),h),{},{headers:pe(pe({},(r=g==null?void 0:g.headers)!==null&&r!==void 0?r:{}),(s=h==null?void 0:h.headers)!==null&&s!==void 0?s:{})}),tracePropagation:{enabled:(n=(i=v==null?void 0:v.enabled)!==null&&i!==void 0?i:b==null?void 0:b.enabled)!==null&&n!==void 0?n:!1,respectSamplingDecision:(o=(a=v==null?void 0:v.respectSamplingDecision)!==null&&a!==void 0?a:b==null?void 0:b.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:()=>f(this,null,function*(){return""})};return t.accessToken?x.accessToken=t.accessToken:delete x.accessToken,x}function nv(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(tv(e))}catch(r){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var iv=class extends $y{constructor(t){super(t)}},ov=class{constructor(t,e,r){var s,n;this.supabaseUrl=t,this.supabaseKey=e;const i=nv(t);if(!e)throw new Error("supabaseKey is required.");Zy(e),rv(r),this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:My,realtime:Fy,auth:pe(pe({},By),{},{storageKey:o}),global:Uy,tracePropagation:Hy},l=sv(r!=null?r:{},a);if(this.settings=l,this.storageKey=(s=l.auth.storageKey)!==null&&s!==void 0?s:"",this.headers=(n=l.global.headers)!==null&&n!==void 0?n:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=va(e,t,this._getSessionToken.bind(this),l.global.fetch,l.tracePropagation),this.functionsFetch=va(e,t,this._getSessionToken.bind(this),l.global.fetch,l.tracePropagation,{omitApiKeyAsBearer
98:!0}),this.realtime=this._initRealtimeClient(pe({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new hg(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit,retry:l.db.retry}),this.storage=new Im(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new rg(this.functionsUrl.href,{headers:this.headers,customFetch:this.functionsFetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}getOpenApiSpec(){return this.rest.getOpenApiSpec()}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getSessionToken(){return f(this,null,function*(){var t=this,e,r;if(t.accessToken)return yield t.accessToken();const{data:s}=yield t.auth.getSession();return(e=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:null})}_getAccessToken(){return f(this,null,function*(){var t=this,e;return(e=yield t._getSessionToken())!==null&&e!==void 0?e:t.supabaseKey})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:s,userStorage:n,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:d,lockAcquireTimeout:h,skipAutoInitialize:p},u,y){const g={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new iv({url:this.authUrl.href,headers:pe(pe({},g),u),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:s,userStorage:n,flowType:o,lock:a,debug:l,throwOnError:c,experimental:d,fetch:y,lockAcquireTimeout:h,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(v=>v.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new sm(this.realtimeUrl.href,pe(pe({},t),{},{params:pe(pe({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN"||t==="INITIAL_SESSION")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const av=(t,e,r)=>new ov(t,e,r);function lv(){if(typeof window!="undefined"||globalThis.Deno!==void 0)return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=20:!1}lv()&&console.warn("⚠️  Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715");function cv(){var v,b,x;if(typeof window=="undefined")return;const t=location.hostname,r=["lovableproject.com","lovableproject-dev.com","lovable.app","gpt-eng.com","gptengineer.run"].some(_=>t===_||t.endsWith("."+_)),s="[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",n=r?(x=(v=t.match(new RegExp("^(?:id-preview(?:-[a-z0-9]+)?|project)--("+s+")(?:-dev)?(?=\\.|$)","i")))==null?void 0:v[1])!=null?x:(b=t.match(new RegExp("^("+s+")(?=[.-])","i")))==null?void 0:b[1]:void 0,i=window.parent&&window.parent!==window;if(!n||!i)return localStorage;const o=t.endsWith(".lovableproject-dev.com")||t.endsWith(".gpt-eng.com"),a=o?/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$|^http:\/\/localhost:3000$/:/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$/,l=location.ancestorOrigins&&location.ancestorOrigins[0]||(document.referrer?new URL(document.referrer).origin:""),c=l&&a.test(l)?[l]:o?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],d="lovable-preview-auth:result",h=2e3,p=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),u=(_,E,T)=>new Promise(k=>{const C=p();let M=!1,I;const L=z=>{M||(M=!0,clearTimeout(I),window.removeEventListener("message",B),
98k(z))},B=z=>{if(c.indexOf(z.origin)<0)return;const Y=z.data;Y&&Y.type===d&&Y.requestId===C&&L(Y)};window.addEventListener("message",B);const N={type:_,requestId:C,projectId:n,key:E};T!==void 0&&(N.value=T);for(const z of c)window.parent.postMessage(N,z);I=setTimeout(()=>L(null),h)});let y=!0;const g=250;return{getItem:_=>f(this,null,function*(){let E=yield u("lovable-preview-auth:get",_);return!E&&y&&(yield new Promise(T=>setTimeout(T,g)),E=yield u("lovable-preview-auth:get",_)),y=!1,E&&E.ok&&typeof E.value=="string"?E.value===""?(localStorage.removeItem(_),null):E.value:localStorage.getItem(_)}),setItem:(_,E)=>(localStorage.setItem(_,E),u("lovable-preview-auth:set",_,E).then(()=>{})),removeItem:_=>(localStorage.removeItem(_),u("lovable-preview-auth:remove",_).then(()=>{}))}}const uv="https://rnxhicoiinwcninuxxej.supabase.co",dv="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJueGhpY29paW53Y25pbnV4eGVqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQzODQ3MjAsImV4cCI6MjA4OTk2MDcyMH0.Sxn4K7nhXHpKTRTW4llQVBnApUwqO5IFOz63C_RsYsw",le=av(uv,dv,{auth:{storage:cv(),persistSession:!0,autoRefreshToken:!0}}),Fc=Object.freeze(Object.defineProperty({__proto__:null,supabase:le},Symbol.toStringTag,{value:"Module"}));function hv(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){var r;return(r=t.get(e))!=null?r:null},key(e){var r;return(r=Array.from(t.keys())[e])!=null?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function pr(t){if(typeof window=="undefined")return null;try{return t==="local"?window.localStorage:window.sessionStorage}catch(e){return null}}function Hc(t){const e=hv();return{get length(){var s;const r=pr(t);return(s=r==null?void 0:r.length)!=null?s:e.length},clear(){const r=pr(t);try{r==null||r.clear()}catch(s){}e.clear()},getItem(r){var n;const s=pr(t);try{const i=(n=s==null?void 0:s.getItem(r))!=null?n:null;return i!=null?i:e.getItem(r)}catch(i){return e.getItem(r)}},key(r){var n;const s=pr(t);try{return(n=s==null?void 0:s.key(r))!=null?n:e.key(r)}catch(i){return e.key(r)}},removeItem(r){const s=pr(t);
98try{s==null||s.removeItem(r)}catch(n){}e.removeItem(r)},setItem(r,s){const n=pr(t);try{n==null||n.setItem(r,s)}catch(i){}e.setItem(r,s)}}}const es=Hc("local"),nt=Hc("session"),zr="lazyRetry_reloaded";function fv(t){var r;const e=String((r=t==null?void 0:t.message)!=null?r:"").toLowerCase();return e.includes("failed to fetch")||e.includes("dynamically imported module")||e.includes("loading chunk")||e.includes("loading css chunk")||e.includes("failed to resolve module")}function Bt(t){return w.lazy(()=>t().then(e=>(nt.removeItem(zr),e)).catch(e=>new Promise((r,s)=>{setTimeout(()=>{t().then(n=>{nt.removeItem(zr),r(n)}).catch(n=>{if(fv(n)&&!nt.getItem(zr))return nt.setItem(zr,"1"),window.location.reload(),new Promise(()=>{});nt.removeItem(zr),s(n)})},1500)})))}class pv extends w.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,r){console.error("CheckoutErrorBoundary caught:",e,r)}render(){return this.state.hasError?m.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:m.jsxs("div",{className:"max-w-sm text-center space-y-4",children:[m.jsx("div",{className:"text-4xl",children:"😕"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Algo deu errado"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"Seu navegador pode não ser compatível com esta página. Tente atualizar ou usar outro navegador."}),m.jsx("button",{onClick:()=>window.location.reload(),className:"inline-flex items-center justify-center rounded-md bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground shadow",children:"Tentar novamente"})]})}):this.props.children}}const qr="appErrorBoundary_reloaded";function gv(t){var r;const e=String((r=t==null?void 0:t.message)!=null?r:"").toLowerCase();return e.includes("failed to fetch")||e.includes("dynamically imported module")||e.includes("loading chunk")||e.includes("loading css chunk")||e.includes("failed to resolve module")||e.includes("importing a module script failed")||e.includes("networkerror")}class Di extends w.Component{constructor(r){super(r);Cn(this,"handleRetry",()=>{nt.removeItem(qr);try{window.location.reload()}catch(r){}});Cn(this,"handleGoHome",()=>{nt.removeItem(qr);try{window.location.replace("/membros/feed")}catch(r){}});this.state={hasError:!1,message:""}}static getDerivedStateFromError(r){var s;return{hasError:!0,message:(s=r==null?void 0:r.message)!=null?s:""}}componentDidCatch(r,s){console.error("[AppErrorBoundary] caught:",r,s),gv(r)&&!nt.getItem(qr)&&(nt.setItem(qr,"1"),setTimeout(()=>{try{window.location.reload()}catch(n){}},300))}componentDidUpdate(r){r.resetKey!==this.props.resetKey&&this.state.hasError&&this.setState({hasError:!1,message:""})}render(){return this.state.hasError?nt.getItem(qr)?m.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:m.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-foreground
98/20 border-t-foreground/80 animate-spin"})}):m.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:m.jsxs("div",{className:"max-w-sm text-center space-y-4",children:[m.jsx("div",{className:"text-4xl",children:"😕"}),m.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Algo deu errado"}),m.jsx("p",{className:"text-sm text-muted-foreground",children:"Ocorreu um erro ao carregar a página. Tente atualizar."}),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("button",{onClick:this.handleRetry,className:"inline-flex items-center justify-center rounded-md bg-primary px-6 py-2.5 text-sm font-medium text-primary-foreground shadow",children:"Tentar novamente"}),m.jsx("button",{onClick:this.handleGoHome,className:"inline-flex items-center justify-center rounded-md border border-border px-6 py-2.5 text-sm font-medium text-foreground",children:"Voltar ao início"})]})]})}):this.props.children}}const mv=/(?:SetversoNative(?:IOS|Android)|SetVersoApp|LikePlayNativeAndroid)\/([\d.]+)/i,yv="0.0.0";function Wc(){var e;const t=(navigator.userAgent||"").match(mv);return(e=t==null?void 0:t[1])!=null?e:null}function Vc(){const t=navigator.userAgent||"";return/SetversoNativeAndroid|LikePlayNativeAndroid/i.test(t)?"android":/SetversoNativeIOS/i.test(t)?"ios":/Android/i.test(t)?"android":/iPhone|iPad|iPod/i.test(t)?"ios":"android"}function zc(t,e){var i,o;const r=t.split(".").map(a=>parseInt(a,10)||0),s=e.split(".").map(a=>parseInt(a,10)||0),n=Math.max(r.length,s.length);for(let a=0;a<n;a++){const l=(i=r[a])!=null?i:0,c=(o=s[a])!=null?o:0;if(l<c)return-1;if(l>c)return 1}return 0}function qc(){return f(this,null,function*(){var t;try{const e="https://rnxhicoiinwcninuxxej.supabase.co/rest/v1/app_settings?select=min_version_ios,min_version_android,ios_store_url,android_store_url&limit=1&_t="+Date.now(),r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJueGhpY29paW53Y25pbnV4eGVqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQzODQ3MjAsImV4cCI6MjA4OTk2MDcyMH0.Sxn4K7nhXHpKTRTW4llQVBnApUwqO5IFOz63C_RsYsw",s=yield fetch(e,{headers:{apikey:r,Authorization:`Bearer ${r}`,"Cache-Control":"no-cache",Pragma:"no-cache"},cache:"no-store"});if(!s.ok)throw new Error("HTTP "+s.status);const n=yield s.json();return(t=n==null?void 0:n[0])!=null?t:null}catch(e){try{const{data:r}=yield le.from("app_settings").select("min_version_ios, min_version_android, ios_store_url, android_store_url").limit(1).maybeSingle();return r!=null?r:null}catch(r){return null}}})}function Kc(){var n,i,o;const t=window;if((n=t.NativeBridge)!=null&&n.__isNativeApp||t.ReactNativeWebView||t.__IS_NATIVE_APP__)return!0;const e=navigator.userAgent||"";if(/Setverso(?:Native(?:IOS|Android)|App)|LikePlayNativeAndroid/i.test(e))return!0;const r=/iPhone|iPad|iPod/i.test(e),s=/Android/i.test(e);if(!r&&!s)return!1;if(s&&/;\s*wv\)/i.test(e)||r&&!/Safari\//i.test(e))return!0;try{if(navigator.standalone===!0||(o=(i=window.matchMedia)==null?void 0:i.call(window,"(display-mode: standalone)"))!=null&&o.matches)return!0}catch(a){}return!1}function Ui(){return f(this,null,function*(){const t=Vc(),e={needsUpdate:!1,platform:t,current:null,minimum:null,storeUrl:null,assumed:!1},r=navigator.userAgent||"";if(!/iPhone|iPad|iPod|Android/i.test(r))return console.log("[ForceUpdate] skipped: not mobile",{ua:r}),e;try{const u=window.location.hostname||"";if(window.self!==window.top||u.startsWith("id-preview--")||u.startsWith("preview--")||u==="lovableproject.com"||u.endsWith(".lovableproject.com")||u==="lovableproject-dev.com"||u.endsWith(".lovableproject-dev.com")||u==="beta.lovable.dev"||u.endsWith(".beta.lovable.dev")||u.endsWith(".lovable.app")&&u.startsWith("id-preview--"))return console.log("[ForceUpdate] skipped: Lovable preview",{host:u}),e}catch(u){}const n=yield qc();if(!n)return console.log("[ForceUpdate] skipped: app_settings fetch failed"),e;const i=t==="ios"?n.min_version_ios:n.min_version_android,o=t==="ios"?n.ios_store_url:n.android_store_url;if(!i||!i.trim())return console.log("[ForceUpdate] skipped: no minimum configured",{platform:t}),e;const a=Wc(),l=Kc();if(!a&&!l)return console.log("[ForceUpdate] skipped: mobile browser (not app)",{ua:r}),e;const c=a!=null?a:yv,d=!a,p={needsUpdate:zc(c,i.trim())<0,platform:t,current:c,minimum:i.trim(),storeUrl:(o==null?void 0:o.trim())||null,assumed:d};return console.log("[ForceUpdate] check",p),p})}function vv(){return f(this,null,function*(){var t,e,r,s;try{const n=yield Ui();if(n.needsUpdate&&n.storeUrl){const i=n.storeUrl;try{const o=window;(e=(t=o.NativeBridge)==null?void 0:t.openExternal)==null||e.call(t,i),(s=(r=o.ReactNativeWebView)==null?void 0:r.postMessage)==null||s.call(r,JSON.stringify({type:"OPEN_EXTERNAL",url:i}))}catch(o){}try{window.location.replace(i)}catch(o){}try{window.location.href=i}catch(o){}return!0}}catch(n){console.warn("[ForceUpdate] early check failed",n)}return!1})}const bv=Object.freeze(Object.defineProperty({__proto__:null,checkForceUpdate:Ui,compareVersions:zc,fetchAppSettings:qc,getNativePlatform:Vc,getNativeVersion:Wc,isAppContext:Kc,runEarlyForceUpdate:vv},Symbol.toStringTag,{value:"Module"}
98)),Gc="/assets/setverso-icon-red-DCfOQ3xW.png",wv="/assets/setverso-icon-DeBVatar.png";function _v(){const[t,e]=w.useState(null),r=w.useRef(!1),s=w.useCallback(l=>{var c,d,h,p;try{const u=document.createElement("a");u.href=l,u.target="_blank",u.rel="noopener noreferrer",u.setAttribute("data-external","true"),document.body.appendChild(u),u.click(),u.remove()}catch(u){}try{window.location.replace(l)}catch(u){}try{window.location.href=l}catch(u){}try{const u=window;(d=(c=u.NativeBridge)==null?void 0:c.openExternal)==null||d.call(c,l),(p=(h=u.ReactNativeWebView)==null?void 0:h.postMessage)==null||p.call(h,JSON.stringify({type:"OPEN_EXTERNAL",url:l}))}catch(u){}},[]),n=w.useCallback(()=>f(this,null,function*(){try{const l=yield Ui();l.needsUpdate?(e(l),l.storeUrl&&!r.current&&(r.current=!0,s(l.storeUrl))):e(null)}catch(l){}}),[s]);if(w.useEffect(()=>{n();const l=setTimeout(()=>void n(),1500),c=setTimeout(()=>void n(),4e3),d=()=>{document.visibilityState==="visible"&&(r.current=!1,n())},h=()=>{r.current=!1,n()},p=()=>{r.current=!1,n()};return document.addEventListener("visibilitychange",d),window.addEventListener("focus",h),window.addEventListener("pageshow",p),()=>{clearTimeout(l),clearTimeout(c),document.removeEventListener("visibilitychange",d),window.removeEventListener("focus",h),window.removeEventListener("pageshow",p)}},[n]),!(t!=null&&t.needsUpdate))return null;const i=t.platform==="ios",o=i?"App Store":"Google Play";new Date().toLocaleDateString("pt-BR",{day:"numeric",month:"long",year:"numeric"});const a=i?m.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"#fff","aria-hidden":"true",children:m.jsx("path",{d:"M17.05 12.04c-.02-2.4 1.96-3.55 2.05-3.61-1.12-1.64-2.86-1.87-3.48-1.89-1.48-.15-2.89.87-3.64.87-.76 0-1.92-.85-3.16-.83-1.62.02-3.13.95-3.96 2.4-1.69 2.93-.43 7.26 1.22 9.64.81 1.16 1.77 2.47 3.02 2.42 1.22-.05 1.68-.79 3.16-.79 1.47 0 1.89.79 3.17.76 1.31-.02 2.14-1.18 2.94-2.35.93-1.35 1.31-2.66 1.33-2.72-.03-.01-2.54-.97-2.65-3.9zM14.66 4.84c.67-.82 1.13-1.95 1-3.09-.97.04-2.14.65-2.84 1.46-.62.72-1.17 1.88-1.03 2.99 1.09.09 2.19-.55 2.87-1.36z"})}):m.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24","aria-hidden":"true",children:[m.jsx("path",{fill:"#34A853",d:"M3.5 20.5l9-9-9-9c-.3.2-.5.5-.5 1v16c0 .5.2.8.5 1z"}),m.jsx("path",{fill:"#FBBC04",d:"M16.8 11.5l-3.3-3.3-10 9.8 13.3-6.5z",opacity:".95"}),m.jsx("path",{fill:"#EA4335",d:"M16.8 11.5L3.5 3.5l10 7.7 3.3-.2z",opacity:".95"}),m.jsx("path",{fill:"#4285F4",d:"M16.8 11.5l3.7 2.1c.5.3.5 1 0 1.3l-3.7 2.1-3.3-3.3 3.3-2.2z"})]});return m.jsxs("div",{role:"alertdialog","aria-modal":"true","aria-labelledby":"force-update-title",style:{position:"fixed",inset:0,zIndex:2147483647,background:"#0a0a0a",display:"flex",alignItems:"center",justifyContent:"center",padding:24,overflow:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif'},onClick:l=>l.stopPropagation(),children:[m.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,background:"radial-gradient(circle at 50% 55%, rgba(220,38,38,0.18) 0%, rgba(220,38,38,0.08) 25%, rgba(0,0,0,0) 60%)",pointerEvents:"none"}}),m.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,background:"radial-gradient(circle at 50% 55%, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0) 35%), radial-gradient(circle at 50% 55%, rgba(255,255,255,0.025) 40%, rgba(255,255,255,0) 70%)",pointerEvents:"none"}}),m.jsxs("div",{style:{position:"relative",width:"100%",maxWidth:380,textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:28},children:[m.jsxs("h1",{id:"force-update-title",style:{fontSize:32,lineHeight:1.1,fontWeight:800,color:"#fff",letterSpacing:"-0.02em",margin:0,textShadow:"0 2px 20px rgba(0,0,0,0.4)"},children:["Não perca a",m.jsx("br",{}),"nova versão"]}),m.jsxs("div",{style:{position:"relative",padding:20},children:[m.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,borderRadius:"50%",background:"radial-gradient(circle, rgba(220,38,38,0.35) 0%, rgba(220,38,38,0) 70%)",filter:"blur(20px)"}}),m.jsx("div",{style:{position:"relative",width:132,height:132,borderRadius:30,background:"#000",boxShadow:"0 30px 60px -10px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.06) inset, 0 1px 0 rgba(255,255,255,0.08) inset",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",animation:"fu-float 4s ease-in-out infinite"},children:m.jsx("img",{src:Gc,alt:"",decoding:"async",loading:"eager",onError:l=>{const c=l.currentTarget;c.dataset.fallback!=="1"&&(c.dataset.fallback="1",c.src=wv)},style:{width:80,height:80,objectFit:"contain",display:"block"}})})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[m.jsx("p",{style:{margin:0,fontSize:17,fontWeight:700,color:"#fff",letterSpacing:"-0.01em"},children:"SetVerso"}),m.jsx("div",{"aria-hidden":"true",style:{width:140,height:1,background:"linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent)",margin:"2px auto 6px"}}),m.jsx("p",{style:{margin:0,fontSize:13,color:"rgba(255,255,255,0.55)",fontWeight:500},children:"Nova Atualização Disponível para Download"})]}),m.jsxs("button",{onClick:()=>{t.storeUrl&&(r.current=!0,s(t.storeUrl))},style:{marginTop:8,display:"inline-flex",alignItems:"center",gap:12,padding:"14px 26px 14px 22px",borderRadius:999,border:"1px solid rgba(255,255,255,0.14)",background:"rgba(0,0,0,0.85)",color:"#fff",cursor:"pointer",boxShadow:"0 10px 30px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset",transition:"transform .15s ease"},onMouseDown:l=>l.currentTarget.style.transform="scale(0.97)",onMouseUp:l=>l.currentTarget.style.transform="scale(1)",onMouseLeave:l=>l.currentTarget.style.transform="scale(1)",children:[a,m.jsxs("span",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",lineHeight:1.1},children:[m.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(255,255,255,0.7)",letterSpacing:"0.02em"},children:"Baixar na"}),m.jsx("span",{style:{fontSize:17,fontWeight:700,letterSpacing:"-0.01em"},children:o})]})]}),t.current&&t.minimum&&m.jsxs("p",{style:{fontSize:10.5,color:"rgba(255,255,255,0.3)",margin:0,letterSpacing:"0.04em"},children:["Versão ",t.current," · mínima ",t.minimum]})]}),m.jsx("style",{children:`
99        @keyframes fu-float {
100          0%, 100% { transform: translateY(0); }
101          50% { transform: translateY(-6px); }
102        }
103      `})]})}const yr=new Map,xv=!1;function Sv(t,e){return JSON.stringify({p:!!(e!=null&&e.private),c:t})}function wb(t,e,r,s){const n=Array.isArray(e)?e:[e],i=Sv(n,s);let o=yr.get(t);if(o)o.configKey!==i&&xv&&console.warn(`[realtimeManager] tópico "${t}" já existe com outra configuração. A configuração faz parte da identidade do tópico — use um nome de tópico distinto.`,{existente:o.configKey,nova:i});else{const c=s!=null&&s.private?le.channel(t,{config:{private:!0}}):le.channel(t),d={channel:c,configKey:i,listeners:new Set};for(const h of n)if(h.type==="broadcast")c.on("broadcast",{event:h.event},p=>
103{d.listeners.forEach(u=>u(p))});else{const l=h,{type:p}=l,u=V(l,["type"]);c.on("postgres_changes",u,y=>{d.listeners.forEach(g=>g(y))})}c.subscribe(),yr.set(t,d),o=d}o.listeners.add(r);let a=!1;return()=>{if(a)return;a=!0;const c=yr.get(t);if(c&&(c.listeners.delete(r),c.listeners.size===0)){yr.delete(t);try{le.removeChannel(c.channel)}catch(d){}}}}function Jc(){yr.forEach(t=>{t.listeners.clear();try{le.removeChannel(t.channel)}catch(e){}}),yr.clear()}le.auth.onAuthStateChange(t=>{t==="SIGNED_OUT"&&Jc()});function Ev(){if(typeof navigator=="undefined")return["web"];const t=navigator.userAgent,e=/iPhone|iPad|iPod/.test(t),r=/Android/.test(t);let s=!1;try{s=window.matchMedia("(display-mode: standalone)").matches}catch(n){}return e?s?["ios","pwa-ios"]:["ios","web"]:r?s?["android","pwa-android"]:["android","web"]:s?["pwa","web"]:["web"]}function Yc(){return f(this,null,function*(){var t,e;try{const{data:r}=yield le.auth.getSession(),s=(e=(t=r.session)==null?void 0:t.user)==null?void 0:e.id;if(s){const n=Ev();yield le.from("push_subscriptions").update({is_active:!1}).eq("user_id",s).in("platform",n)}}catch(r){console.warn("[logout] push cleanup failed (continuing)",r)}try{Jc()}catch(r){}yield le.auth.signOut()})}const _b=Object.freeze(Object.defineProperty({__proto__:null,logoutWithPushCleanup:Yc},Symbol.toStringTag,{value:"Module"}));function kv(t){w.useEffect(()=>{if(!t)return;let e=!1;const r=n=>f(this,null,function*(){if(!e){e=!0;try{Cl.error("Sua assinatura foi cancelada. Você foi desconectado.")}catch(i){}try{yield Yc()}catch(i){}try{window.location.replace("/login")}catch(i){}}}),s=le.channel(`force-logout-${t}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"force_logout_events",filter:`user_id=eq.${t}`},n=>{var i,o;(o=(i=n==null?void 0:n.new)==null?void 0:i.reason)!=null,r()}).subscribe();return()=>{try{le.removeChannel(s)}catch(n){}}},[t])}const Sa="https://lp.setverso.com";function Tv(){try{const t=new URL(Sa);if(new URLSearchParams(window.location.search).forEach((r,s)=>{t.searchParams.append(s,r)}),document.referrer&&!t.searchParams.has("ref"))try{const r=new URL(document.referrer).hostname;r&&r!==window.location.hostname&&t.searchParams.set("ref",r)}catch(r){}return t.toString()+(window.location.hash||"")}catch(t){return Sa+window.location.search+window.location.hash}}function Av(t){document.title="Redirecionando…";const e=document.querySelector('meta[name="description"]');e&&e.setAttribute("content","Redirecionando para lp.setverso.com");let r=document.querySelector('meta[http-equiv="refresh"]');r||(r=document.createElement("meta"),r.httpEquiv="refresh",document.head.appendChild(r)),r.content=`0; url=${t}`;let s=document.querySelector('link[rel="canonical"]');s||(s=document.createElement("link"),s.rel="canonical",document.head.appendChild(s)),s.href=t;const n=document.querySelector('meta[property="og:url"]');n&&n.setAttribute("content",t)}function Ea(){const t=w.useMemo(()=>Tv(),[]);return w.useEffect(()=>{Av(t);try{window.location.replace(t)}catch(e){window.location.href=t}},[t]),m.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-black text-white",children:[m.jsx("p",{className:"text-sm opacity-70",children:"Redirecionando…"}),m.jsx("a",{href:t,className:"mt-4 text-sm underline opacity-80",children:"Clique aqui se não for redirecionado"})]})}function Qc(t){const e=t.replace(/\D/g,"").slice(0,11);return e.length===0?"":e.length<=2?`(${e}`:e.length<=7?`(${e.slice(0,2)}) ${e.slice(2)}`:e.length<=10?`(${e.slice(0,2)}) ${e.slice(2,6)}-${e.slice(6)}`:`(${e.slice(0,2)}) ${e.slice(2,7)}-${e.slice(7)}`}const Rv="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJueGhpY29paW53Y25pbnV4eGVqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQzODQ3MjAsImV4cCI6MjA4OTk2MDcyMH0.Sxn4K7nhXHpKTRTW4llQVBnApUwqO5IFOz63C_RsYsw";function Cv(){const t="https://rnxhicoiinwcninuxxej.supabase.co";return/^https?:\/\//.test(t)?t.replace(/\/$/,""):"https://rnxhicoiinwcninuxxej.supabase.co"}function Ov(){const t="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJueGhpY29paW53Y25pbnV4eGVqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQzODQ3MjAsImV4cCI6MjA4OTk2MDcyMH0.Sxn4K7nhXHpKTRTW4llQVBnApUwqO5IFOz63C_RsYsw";return t.length>20?t:Rv}function Pv(t){return`${Cv()}/functions/v1/${t.replace(/^\//,"")}`}function Kr(r){return f(this,arguments,function*(t,e={}){const d=e,{withAnonAuth:s=!0,headers:n}=d,i=V(d,["withAnonAuth","headers"]),o=Ov(),a=S(S({"Content-Type":"application/json",apikey:o},s?{Authorization:`Bearer ${o}`}:{}),n),l=Pv(t),c=()=>fetch(l,R(S({},i),{headers:a,cache:"no-store"}));try{return yield c()}catch(h){return yield new Promise(p=>setTimeout(p,350)),yield c()}})}const Se="#e8395b",jv="#c42d4a",Vn=`linear-gradient(135deg, ${Se} 0%, ${jv} 100%)`;function Iv(t){return t?{isLight:!0,bg:"#ffffff",pageFont:"'Inter', system-ui, sans-serif",topBar:{background:"linear-gradient(90deg, #0f0f0f, #1a1a2e)",border:"none",text:"rgba(255,255,255,0.8)"},backBtn:"text-gray-400 hover:text-gray-700",title:"text-gray-900",subtitle:"text-gray-500",strongText:"text-gray-900",label:"text-gray-400",iconBadge:{background:"linear-gradient(135deg, #fef2f4, #fde8ec)",border:"1px solid rgba(232,57,91,0.15)",shadow:"none"},card:{background:"white",border:"1px solid rgba(0,0,0,0.08)",boxShadow:"0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04)",backdropFilter:"none"},input:{background:"#f8f9fc",border:"1px solid #e2e5ec",borderFocus:`1px solid ${Se}`,ringFocus:"0 0 0 4px rgba(232,57,91,0.10)",text:"text-gray-900",placeholder:"placeholder:text-gray-300",iconIdle:"rgba(156,163,175,1)"}
103,otp:{idleBg:"#f8f9fc",idleBorder:"2px solid #e2e5ec",activeBg:"rgba(232,57,91,0.06)",activeBorder:`2px solid ${Se}`,text:"#1a1a2e",activeShadow:"0 0 12px rgba(232,57,91,0.10)",idleShadow:"none"},muted:"text-gray-400",footerHint:"text-gray-400",glows:!1,grid:!1}:{isLight:!1,bg:"#0a0a0d",pageFont:"'Inter', system-ui, sans-serif",topBar:{background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.06)",text:"rgba(255,255,255,0.7)"},backBtn:"text-white/50 hover:text-white",title:"text-white",subtitle:"text-white/50",strongText:"text-white",label:"text-white/40",iconBadge:{background:"linear-gradient(135deg, rgba(232,57,91,0.18), rgba(232,57,91,0.04))",border:"1px solid rgba(232,57,91,0.35)",shadow:"0 8px 32px rgba(232,57,91,0.25), inset 0 1px 0 rgba(255,255,255,0.08)"},card:{background:"linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015))",border:"1px solid rgba(255,255,255,0.08)",boxShadow:"0 24px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05)",backdropFilter:"blur(20px)"},input:{background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)",borderFocus:`1px solid ${Se}`,ringFocus:"0 0 0 4px rgba(232,57,91,0.12)",text:"text-white",placeholder:"placeholder:text-white/25",iconIdle:"rgba(255,255,255,0.4)"},otp:{idleBg:"rgba(255,255,255,0.04)",idleBorder:"2px solid rgba(255,255,255,0.08)",activeBg:"rgba(232,57,91,0.12)",activeBorder:`2px solid ${Se}`,text:"#ffffff",activeShadow:"0 0 18px rgba(232,57,91,0.35), inset 0 1px 0 rgba(255,255,255,0.05)",idleShadow:"inset 0 1px 0 rgba(255,255,255,0.03)"},muted:"text-white/40",footerHint:"text-white/30",glows:!0,grid:!0}}function Nv(){const[t,e]=w.useState(()=>typeof document!="undefined"&&document.documentElement.classList.contains("checkout-light"));return w.useEffect(()=>{const r=new MutationObserver(()=>{e(document.documentElement.classList.contains("checkout-light"))});return r.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>r.disconnect()},[]),w.useEffect(()=>
103{const r=t?"#ffffff":"#0a0a0d",s=document.documentElement.style.backgroundColor,n=document.body.style.backgroundColor;return document.documentElement.style.backgroundColor=r,document.body.style.backgroundColor=r,()=>{document.documentElement.style.backgroundColor=s,document.body.style.backgroundColor=n}},[t]),Iv(t)}const ka="Sem conexão com o servidor. Toque novamente em alguns segundos.";function $v({onSuccess:t}){const e=Nv(),[r,s]=w.useState(!1),[n,i]=w.useState("email"),[o,a]=w.useState(""),[l,c]=w.useState(""),[d,h]=w.useState(!1),[p,u]=w.useState(""),[y,g]=w.useState(!0),[v,b]=w.useState(!0),[x,_]=w.useState(""),[E,T]=w.useState(!1),[k,C]=w.useState(0),[M,I]=w.useState(!1),L=w.useRef(null),B=w.useRef(""),[N,z]=w.useState(!1),[Y,D]=w.useState(""),[H,Q]=w.useState(!1);w.useEffect(()=>{let U=!0;return f(this,null,function*(){var X;try{const ne=yield Kr("get-ui-settings",{method:"GET",withAnonAuth:!1});if(!ne.ok)return;const oe=yield ne.json();if(!U)return;const ue=(X=oe==null?void 0:oe.settings)!=null?X:{};typeof ue._ui_login_saiba_mais=="boolean"&&g(ue._ui_login_saiba_mais),typeof ue._ui_login_join_cta=="boolean"&&b(ue._ui_login_join_cta)}catch(ne){}}),()=>{U=!1}},[]),w.useEffect(()=>{if(k<=0)return;const U=setTimeout(()=>C(X=>X-1),1e3);return()=>clearTimeout(U)},[k]),w.useEffect(()=>{if(n!=="token")return;const U=L.current;if(!U)return;const X=ne=>Z(ne.target.value);return U.addEventListener("input",X),()=>U.removeEventListener("input",X)},[n]);const W=U=>f(this,null,function*(){var ne;U.preventDefault();const X=o.trim().toLowerCase();if(!X||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(X)){u("Digite um e-mail válido");return}if(h(!0),u(""),X==="[email protected]"){a(X),yield $("123456",X),h(!1);return}try{const oe=yield Kr("login-token-send",{method:"POST",body:JSON.stringify({email:X})}),ue=yield oe.json().catch(()=>({}));if(!oe.ok){u((ne=ue.error)!=null?ne:"Erro ao enviar código");return}c(ue.name||""),C(60),i("token"),setTimeout(()=>{var Me;return(Me=L.current)==null?void 0:Me.focus()},100)}catch(oe){u(ka)}finally{h(!1)}}),$=(U,X)=>f(this,null,function*(){var ne;h(!0),u("");try{const oe=yield Kr("login-token-verify",{method:"POST",body:JSON.stringify({email:(X!=null?X:o).trim().toLowerCase(),token:U})}),ue=yield oe.json().catch(()=>({}));
103if(!oe.ok||!ue.hashed_token){u((ne=ue.error)!=null?ne:"Código inválido"),te();return}const{error:Me}=yield le.auth.verifyOtp({type:"magiclink",token_hash:ue.hashed_token});if(Me){u("Erro ao iniciar sessão. Tente novamente.");return}if(ue.needs_whatsapp)try{localStorage.setItem("needs_whatsapp_capture","1")}catch(or){}t()}catch(oe){u(ka)}finally{h(!1)}}),q=()=>f(this,null,function*(){var X;const U=Y.replace(/\D/g,"");if(!(U.length<10||U.length>11)){Q(!0);try{const{data:ne}=yield le.auth.getSession(),oe=(X=ne.session)==null?void 0:X.access_token;yield Kr("update-member-whatsapp",{method:"POST",headers:oe?{Authorization:`Bearer ${oe}`}:void 0,withAnonAuth:!oe,body:JSON.stringify({whatsapp:U})})}catch(ne){console.error("save whatsapp error",ne)}finally{Q(!1),z(!1),t()}}}),te=()=>{_(""),B.current="",L.current&&(L.current.value=""),setTimeout(()=>{var U;return(U=L.current)==null?void 0:U.focus()},50)},Z=U=>{const X=U.replace(/\D/g,"").slice(0,6);_(X),u(""),X.length===6&&B.current!==X&&(B.current=X,$(X))},ee=U=>{U.preventDefault(),Z(U.clipboardData.getData("text"))},re=()=>f(this,null,function*(){if(!(k>0)){I(!0),u("");try{yield Kr("login-token-send",{method:"POST",body:JSON.stringify({email:o.trim().toLowerCase()})}),C(60),te()}finally{I(!1)}}}),he=x,$e=he.length===6;return m.jsxs("div",{className:"flex flex-col overflow-hidden relative",style:{position:"fixed",inset:0,paddingTop:"env(safe-area-inset-top, 0px)",paddingBottom:"env(safe-area-inset-bottom, 0px)",background:e.bg,fontFamily:e.pageFont},children:[e.glows&&m.jsxs(m.Fragment,{children:[m.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{top:"-15%",left:"-20%",width:"70%",height:"55%",background:"radial-gradient(circle, rgba(232,57,91,0.22), transparent 60%)",filter:"blur(60px)"}}),m.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{bottom:"-20%",right:"-25%",width:"75%",height:"55%",background:"radial-gradient(circle, rgba(96,80,255,0.16), transparent 60%)",filter:"blur(70px)"}}),m.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 opacity-[0.05]",style:{backgroundImage:"linear-gradient(rgba(255,255,255,0.6) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.6) 1px, transparent 1px)",backgroundSize:"44px 44px",maskImage:"radial-gradient(ellipse at center, black 40%, transparent 75%)",WebkitMaskImage:"radial-gradient(ellipse at center, black 40%, transparent 75%)"}})]}),m.jsxs("div",{className:"w-full py-2 px-4 flex items-center justify-center gap-2 relative z-10",style:{background:e.topBar.background,borderBottom:e.topBar.border,backdropFilter:e.isLight?void 0:"blur(10px)"},children:[m.jsx(Sd,{className:"h-3.5 w-3.5",style:{color:Se}}),m.jsx("span",{className:"text-[10px] sm:text-xs font-medium tracking-wide",style:{color:e.topBar.text},children:"Área exclusiva para membros SetVerso"})]}),n==="email"&&y&&m.jsx("div",{className:"flex justify-end px-5 py-2 relative z-10",children:m.jsx("a",{href:"https://lp.setverso.com",target:"_blank",rel:"noopener noreferrer","data-external":"true",className:"text-[12px] font-semibold transition-opacity hover:opacity-70",style:{color:Se},children:"Saiba mais →"})}),n==="token"&&m.jsx("div",{className:"w-full px-5 pt-3 relative z-10",children:m.jsxs("button",{onClick:()=>{i("email"),_(""),B.current="",u("")},className:`flex items-center gap-2 transition-colors text-sm font-semibold ${e.backBtn}`,children:[m.jsx(wd,{size:16})," Voltar"]})}),m.jsx("div",{className:"flex-1 flex items-center justify-center px-5 pb-4 overflow-y-auto relative z-10",children:m.jsxs("div",{className:"w-full max-w-sm",children:[n==="email"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-col items-center mb-6",children:[m.jsx("img",{src:Gc,alt:"SetVerso",className:"w-12 h-12 object-contain mb-3"}),m.jsx("span",{className:"text-[10px] font-bold uppercase tracking-[0.2em] mb-2 px-3 py-1 rounded-full",style:{color:Se,background:e.isLight?"rgba(232,57,91,0.08)":"rgba(232,57,91,0.12)",border:e.isLight?"1px solid rgba(232,57,91,0.18)":"1px solid rgba(232,57,91,0.35)"},children:"Login de membros"}),m.jsx("h1",{className:`text-3xl font-extrabold tracking-tight ${e.title}`,style:{fontFamily:"'Plus Jakarta Sans', 'Inter', sans-serif"},children:"Entrar no SetVerso"}),m.jsx("p",{className:`text-sm text-center mt-2 max-w-[300px] ${e.subtitle}`,children:"Já é assinante? Digite seu e-mail e receba um código de acesso para entrar."})]}),m.jsxs("div",{className:"rounded-2xl p-6 sm:p-8 relative overflow-hidden",style:{background:e.card.background,border:e.card.border,boxShadow:e.card.boxShadow,backdropFilter:e.card.backdropFilter},children:[m.jsxs("form",{onSubmit:W,className:"flex flex-col gap-4",children:[m.jsxs("div",{children:[m.jsx("label",{className:`block text-[10px] font-bold uppercase tracking-[0.14em] mb-2 ${e.label}`,children:"E-mail"}
103),m.jsxs("div",{className:"flex items-center gap-3 px-4 rounded-xl transition-all duration-200",style:{height:"52px",background:e.input.background,border:r?e.input.borderFocus:e.input.border,boxShadow:r?e.input.ringFocus:"none"},children:[m.jsx(ro,{size:16,className:"shrink-0",style:{color:r?Se:e.input.iconIdle}}),m.jsx("input",{type:"email",value:o,onChange:U=>{a(U.target.value),u("")},onFocus:()=>s(!0),onBlur:()=>s(!1),placeholder:"[email protected]",autoFocus:!0,autoComplete:"email",className:`flex-1 bg-transparent text-sm outline-none ${e.input.text} ${e.input.placeholder}`})]})]}),p&&m.jsx("p",{className:"text-xs font-semibold",style:{color:Se},children:p}),m.jsx("button",{type:"submit",disabled:d||!o.trim(),className:"flex items-center justify-center gap-2 w-full rounded-xl py-3.5 text-sm font-bold transition-all duration-200 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",style:{background:Vn,color:"#fff",boxShadow:e.isLight?"0 4px 16px rgba(232,57,91,0.3)":"0 8px 24px rgba(232,57,91,0.35), inset 0 1px 0 rgba(255,255,255,0.2)"},children:d?m.jsx(Gr,{size:16,className:"animate-spin"}):m.jsxs(m.Fragment,{children:["Receber código",m.jsx(_d,{size:16})]})})]}),v&&m.jsxs("a",{href:"https://lp.setverso.com",target:"_blank",rel:"noopener noreferrer","data-external":"true",className:"block text-center text-[11px] mt-5 transition-opacity hover:opacity-80",children:[m.jsx("span",{style:{color:Se,fontWeight:600},children:"Ainda não é membro? Toque aqui"}),m.jsx("span",{className:e.muted,children:" para conhecer a maior comunidade de talentos do país!"})]})]}),m.jsxs("div",{className:`flex items-center justify-center gap-4 mt-6 text-[10px] ${e.footerHint}`,children:[m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(Ed,{className:"h-3.5 w-3.5 text-green-500"})," Seguro"]}),m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(xd,{className:"h-3.5 w-3.5 text-green-500"})," Sem senha"]})]})]}),n==="token"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-col items-center mb-6",children:[m.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mb-4",style:{background:e.iconBadge.background,border:e.iconBadge.border,boxShadow:e.iconBadge.shadow},children:e.isLight?m.jsx("span",{className:"text-2xl",children:"✉️"}):m.jsx(ro,{size:22,style:{color:Se}})}),m.jsx("h1",{className:`text-2xl font-extrabold tracking-tight mb-1 ${e.title}`,style:{fontFamily:"'Plus Jakarta Sans', 'Inter', sans-serif"},children:l?`Olá, ${l.split(" ")[0]}!`:"Verifique seu e-mail"}),m.jsx("p",{className:`text-sm text-center ${e.subtitle}`,children:"Enviamos um código de 6 dígitos para"}),m.jsx("p",{className:`text-sm font-bold mt-1 ${e.strongText}`,children:o})]}),m.jsxs("div",{className:"rounded-2xl p-6 sm:p-8 relative overflow-hidden",style:{background:e.card.background,border:e.card.border,boxShadow:e.card.boxShadow,backdropFilter:e.card.backdropFilter},children:[m.jsxs("form",{onSubmit:U=>{U.preventDefault(),$e&&!d&&$(he)},children:[m.jsxs("div",{className:"relative flex gap-2.5 justify-center mb-6",children:[Array.from({length:6},(U,X)=>{var ue;const ne=(ue=x[X])!=null?ue:"",oe=E&&!d&&X===Math.min(x.length,5);return m.jsx("div",{"aria-hidden":!0,className:"flex items-center justify-center font-extrabold transition-all duration-200",style:{flex:"1 1 0",minWidth:0,maxWidth:"46px",height:"58px",borderRadius:"12px",background:ne?e.otp.activeBg:e.otp.idleBg,border:ne||oe?e.otp.activeBorder:e.otp.idleBorder,color:e.otp.text,boxShadow:ne?e.otp.activeShadow:e.otp.idleShadow,fontSize:"22px",opacity:d?.4:1},children:ne||(oe?m.jsx("span",{className:"animate-pulse",style:{width:2,height:24,background:Se}}):null)},X)}),m.jsx("input",{ref:L,type:"text",inputMode:"numeric",autoComplete:"one-time-code",pattern:"\\d{6}",name:"otp","aria-label":"Código de 6 dígitos",maxLength:6,value:x,onChange:U=>Z(U.target.value),onPaste:ee,onFocus:()=>T(!0),onBlur:()=>T(!1),disabled:d,className:"absolute inset-0 w-full h-full outline-none",style:{background:"transparent",border:"none",color:"transparent",caretColor:"transparent",fontSize:"16px"}})]}),p&&m.jsx("p",{className:"text-xs font-semibold text-center mb-4",style:{color:Se},children:p}),m.jsx("button",{type:"submit",disabled:!$e||d,className:"flex items-center justify-center gap-2 w-full rounded-xl py-3.5 text-sm font-bold transition-all duration-200 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",style:{background:Vn,color:"#fff",boxShadow:$e?e.isLight?"0 4px 16px rgba(232,57,91,0.3)":"0 8px 24px rgba(232,57,91,0.35), inset 0 1px 0 rgba(255,255,255,0.2)":"none"},children:d?m.jsx(Gr,{size:16,className:"animate-spin"}):"Entrar"})]}),m.jsxs("div",{className:"flex items-center justify-center mt-5 gap-1",children:[m.jsx("p",{className:`text-xs ${e.muted}`,children:"Não recebeu?"}),m.jsxs("button",{onClick:re,disabled:k>0||M,className:"flex items-center gap-1 text-xs font-bold transition-colors disabled:opacity-40 disabled:cursor-not-allowed",style:{color:k>0?e.isLight?"#aaa":"rgba(255,255,255,0.3)":Se},children:[M&&m.jsx(Gr,{size:11,className:"animate-spin"}),k>0?`Reenviar em ${k}s`:"Reenviar código"]})]})]}),m.jsx("p",{className:`text-[11px] text-center mt-4 ${e.footerHint}`,children:"⏱ O código expira em 15 minutos"})]})]})}),N&&m.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center px-5",style:{background:"rgba(15,15,15,0.55)",backdropFilter:"blur(6px)"},children:m.jsxs("div",{className:"w-full max-w-sm rounded-2xl p-6 sm:p-7",style:{background:"white",boxShadow:"0 20px 60px rgba(0,0,0,0.25)"},children:[m.jsxs("div",{className:"flex flex-col items-center text-center mb-5",children:[m.jsx("div",{className:"w-14 h-14 roun
103ded-2xl flex items-center justify-center mb-3",style:{background:"linear-gradient(135deg, #e6fff0, #d1fae5)",border:"1px solid rgba(34,197,94,0.2)"},children:m.jsx(ml,{className:"h-6 w-6",style:{color:"#16a34a"}})}),m.jsx("h2",{className:"text-lg font-extrabold text-gray-900",style:{fontFamily:"'Plus Jakarta Sans', 'Inter', sans-serif"},children:"Receba seus códigos no WhatsApp"}),m.jsx("p",{className:"text-sm text-gray-500 mt-1.5",children:"Cadastre seu número para receber tokens de acesso e novidades."})]}),m.jsx("label",{className:"block text-xs font-semibold uppercase tracking-wider text-gray-400 mb-2",children:"WhatsApp"}),m.jsxs("div",{className:"flex items-center gap-3 px-4 rounded-xl mb-5",style:{height:"50px",background:"#f8f9fc",border:"1px solid #e2e5ec"},children:[m.jsx("span",{className:"text-sm text-gray-400",children:"🇧🇷"}),m.jsx("input",{type:"tel",inputMode:"tel",value:Y,onChange:U=>D(Qc(U.target.value)),placeholder:"(11) 99999-9999",autoFocus:!0,className:"flex-1 bg-transparent text-sm text-gray-900 placeholder:text-gray-300 outline-none"})]}),m.jsx("button",{onClick:q,disabled:H||Y.replace(/\D/g,"").length<10,className:"flex items-center justify-center gap-2 w-full rounded-xl py-3.5 text-sm font-bold transition-all duration-200 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",style:{background:Vn,color:"#fff",boxShadow:"0 4px 16px rgba(232,57,91,0.3)"},children:H?m.jsx(Gr,{size:16,className:"animate-spin"}):"Salvar e continuar"}),m.jsx("button",{onClick:()=>{z(!1),t()},disabled:H,className:"block w-full text-center text-xs font-semibold text-gray-400 hover:text-gray-600 transition-colors mt-3 py-2",children:"Agora não"})]})})]})}const Lv="#e8395b",Dv="#c42d4a",Uv=`linear-gradient(135deg, ${Lv} 0%, ${Dv} 100%)`,Mv="rnxhicoiinwcninuxxej",Bv=`https://${Mv}.supabase.co/functions/v1`,Ta="needs_whatsapp_capture";function Fv(){const[t,e]=w.useState(!1),[r,s]=w.useState(""),[n,i]=w.useState(!1);w.useEffect(()=>{const l=()=>{try{localStorage.getItem(Ta)==="1"&&e(!0)}catch(h){}};l();const c=setTimeout(l,300),d=setTimeout(l,1e3);return()=>{clearTimeout(c),clearTimeout(d)}},[]);const o=()=>{try{localStorage.removeItem(Ta)}catch(l){}e(!1)},a=()=>f(this,null,function*(){var c;const l=r.replace(/\D/g,"");if(!(l.length<10||l.length>11)){i(!0);try{const{data:d}=yield le.auth.getSession(),h=(c=d.session)==null?void 0:c.access_token;if(!h){o();return}yield fetch(`${Bv}/update-member-whatsapp`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${h}`},body:JSON.stringify({whatsapp:l})})}catch(d){console.error("save whatsapp error",d)}finally{i(!1),o()}}});return t?m.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center px-5",style:{background:"rgba(15,15,15,0.55)",backdropFilter:"blur(6px)"},children:m.jsxs("div",{className:"w-full max-w-sm rounded-2xl p-6 sm:p-7",style:{background:"white",boxShadow:"0 20px 60px rgba(0,0,0,0.25)"},children:[m.jsxs("div",{className:"flex flex-col items-center text-center mb-5",children:[m.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mb-3",style:{background:"linear-gradient(135deg, #e6fff0, #d1fae5)",border:"1px solid rgba(34,197,94,0.2)"},children:m.jsx(ml,{className:"h-6 w-6",style:{color:"#16a34a"}})}),m.jsx("h2",{className:"text-lg font-extrabold text-gray-900",style:{fontFamily:"'Plus Jakarta Sans', 'Inter', sans-serif"},children:"Receba seus códigos no WhatsApp"}),m.jsx("p",{className:"text-sm text-gray-500 mt-1.5",children:"Cadastre seu número para receber tokens de acesso e novidades."})]}),m.jsx("label",{className:"block text-xs font-semibold uppercase tracking-wider text-gray-400 mb-2",children:"WhatsApp"}),m.jsxs("div",{className:"flex items-center gap-3 px-4 rounded-xl mb-5",style:{height:"50px",background:"#f8f9fc",border:"1px solid #e2e5ec"},children:[m.jsx("span",{className:"text-sm text-gray-400",children:"🇧🇷"}),m.jsx("input",{type:"tel",inputMode:"tel",value:r,onChange:l=>s(Qc(l.target.value)),placeholder:"(11) 99999-9999",autoFocus:!0,className:"flex-1 bg-transparent text-sm text-gray-900 placeholder:text-gray-300 outline-none"})]}),m.jsx("button",{onClick:a,disabled:n||r.replace(/\D/g,"").length<10,className:"flex items-center justify-center gap-2 w-full rounded-xl py-3.5 text-sm font-bold transition-all duration-200 active:scale-[0.98] disabled:opacity-40 disabled:cursor-not-allowed",style:{background:Uv,color:"#fff",boxShadow:"0 4px 16px rgba(232,57,91,0.3)"},children:n?m.jsx(Gr,{size:16,className:"animate-spin"}):"Salvar e continuar"}),m.jsx("button",{onClick:o,disabled:n,className:"block w-full text-center text-xs font-semibold text-gray-400 hover:text-gray-600 transition-colors mt-3 py-2",children:"Agora não"})]})}):null}function Hv(){const t=mi();return m.jsx(Us,{to:{pathname:"/membros/feed",search:t.search,hash:t.hash},replace:!0})}const Wv=Bt(()=>Ne(()=>import("./ResetPasswordScreen-DYPVq02K.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>
103({default:t.ResetPasswordScreen}))),zn=Bt(()=>Ne(()=>import("./Index-roSOeQ_8.js"),__vite__mapDeps([5,1,2,6,3,7,8,9,10]))),Vv=Bt(()=>Ne(()=>import("./NotFound-BAmrgXPp.js"),__vite__mapDeps([11,1,2]))),Aa=Bt(()=>Ne(()=>import("./Admin-B76JzpYo.js"),__vite__mapDeps([12,1,2,6,7,3,4,8,13]))),zv=Bt(()=>Ne(()=>import("./Politicas-DCk41DpS.js"),__vite__mapDeps([14,1,2]))),qv=Bt(()=>Ne(()=>import("./ExcluirConta-fqQuf9nb.js"),__vite__mapDeps([15,1,2,9,7]))),Kv=Bt(()=>Ne(()=>import("./Install-ClBk9kqx.js"),__vite__mapDeps([16,1,2,8,13]))),Gv=Bt(()=>Ne(()=>import("./MigrationRedirect-lKCH0622.js"),__vite__mapDeps([17,1,2]))),Ra=new Yp,Gt=m.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-3 bg-background text-foreground",children:[m.jsx("div",{className:"w-6 h-6 rounded-full border-2 border-foreground/20 border-t-foreground/80 animate-spin"}),m.jsx("span",{className:"text-foreground/50 text-xs",children:"Carregando..."})]});function Ca({onAuthenticated:t}){return m.jsx(Di,{children:m.jsx($v,{onSuccess:t,onSignUp:()=>{},onForgotPassword:()=>{}})})}function Jv(){const t=gu();return w.useEffect(()=>(jo(e=>t(e)),()=>jo(null)),[t]),w.useEffect(()=>{const e=s=>{try{if(typeof s!="string"||!s)return!1;const n=new URL(s,window.location.origin);return n.origin!==window.location.origin?!1:(t(`${n.pathname}${n.search}${n.hash}`),!0)}catch(n){return!1}},r=window;return r.SetVersoWeb=R(S({},r.SetVersoWeb||{}),{openDeepLink:e}),()=>{var s;((s=r.SetVersoWeb)==null?void 0:s.openDeepLink)===e&&delete r.SetVersoWeb.openDeepLink}},[t]),null}function Yv(){const e=mi().pathname;return e==="/"||e==="/login"||e.startsWith("/lp")||e==="/politicas"||e==="/excluir-conta"?null:m.jsx(Fv,{})}function Qv({session:t,onAuthenticated:e}){const r=mi(),s=r.pathname.startsWith("/lp"),n=r.pathname==="/login";return s?m.jsx(Ea,{}):r.pathname==="/"||r.pathname==="/index.html"||r.pathname==="/politicas"||r.pathname==="/excluir-conta"||r.pathname==="/install"||r.pathname.startsWith("/m/")?m.jsx(pv,{children:m.jsx(w.Suspense,{fallback:Gt,children:m.jsxs(qi,{children:[m.jsx(Oe,{path:"/",element:t===void 0?Gt:t?m.jsx(Us,{to:"/membros",replace:!0}):m.jsx(Ca,{onAuthenticated:e})}),m.jsx(Oe,{path:"/index.html",element:m.jsx(Ea,{})}),m.jsx(Oe,{path:"/politicas",element:m.jsx(zv,{})}),m.jsx(Oe,{path:"/excluir-conta",element:m.jsx(qv,{})}),m.jsx(Oe,{path:"/install",element:m.jsx(Kv,{})}),m.jsx(Oe,{path:"/m/:code",element:m.jsx(Gv,{})})]})})}):n?t===void 0?Gt:t?m.jsx(Us,{to:"/membros",replace:!0}):m.jsx(Ca,{onAuthenticated:e}):t===void 0?Gt:t?m.jsx(Di,{resetKey:r.pathname,children:m.jsx(w.Suspense,{fallback:Gt,children:m.jsxs(qi,{children:[m.jsx(Oe,{path:"/membros",element:m.jsx(Hv,{})}),m.jsx(Oe,{path:"/membros/post/:postId",element:m.jsx(zn,{})}),m.jsx(Oe,{path:"/membros/:section",element:m.jsx(zn,{})}),m.jsx(Oe,{path:"/membros/:section/*",element:m.jsx(zn,{})}),m.jsx(Oe,{path:"/admin",element:m.jsx(Aa,{})}),m.jsx(Oe,{path:"/admin/:tab",element:m.jsx(Aa,{})}),m.jsx(Oe,{path:"*",element:m.jsx(Vv,{})})]})})}):m.jsx(Us,{to:"/login",replace:!0})}const Xv=()=>{var a,l;const[t,e]=w.useState(void 0),[r,s]=w.useState(null),[n,i]=w.useState(!1);if(w.useEffect(()=>{let c=!1;const d=v=>{c=!0,e(v),i(!0)},{data:{subscription:h}}=le.auth.onAuthStateChange((v,b)=>{var x,_;if(v==="PASSWORD_RECOVERY"){const E=(_=(x=b==null?void 0:b.user)==null?void 0:x.email)!=null?_:"";s(E),d(b);return}if(v==="INITIAL_SESSION"){if(c||!b)return;d(b),b&&setTimeout(()=>{le.functions.invoke("sync-user-entitlements").catch(()=>{})},0);return}v==="SIGNED_IN"&&b&&setTimeout(()=>{le.functions.invoke("sync-user-entitlements").catch(()=>{})},0),e(b),i(!0)});le.auth.getSession().then(({data:{session:v},error:b})=>{var _,E;const x=(E=(_=b==null?void 0:b.message)==null?void 0:_.toLowerCase())!=null?E:"";b&&(x.includes("refresh")||x.includes("token"))&&le.auth.signOut({scope:"local"}).catch(()=>{}),!c&&d(v!=null?v:null)}).catch(()=>{c||d(null)});const p=setTimeout(()=>{i(!0)},3e3),u=()=>f(void 0,null,function*(){var T,k;const v=yield le.auth.getSession();if(!v.data.session){e(C=>C&&null);return}e(C=>C===null?v.data.session:C);const{error:b}=yield le.auth.getUser();if(!b)return;const x=(k=(T=b.message)==null?void 0:T.toLowerCase())!=null?k:"",_=b.status;if(x.includes("fetch")||x.includes("network")||x.includes("failed")||x.includes("timeout")||_===0||_===void 0)return;const{error:E}=yield le.auth.refreshSession();E&&(yield le.auth.signOut({scope:"local"}))}),y=setInterval(u,6e4),g=()=>{document.visibilityState==="visible"&&u()};return document.addEventListener("visibilitychange",g),()=>{h.unsubscribe(),clearTimeout(p),clearInterval(y),document.removeEventListener("visibilitychange",g)}},[]),kv((l=(a=t==null?void 0:t.user)==null?void 0:a.id)!=null?l:null),!n)return Gt;if(r!==null&&t)return m.jsx(Po,{client:Ra,children:m.jsxs(Eo,{children:[m.jsx(ao,{}),m.jsx(ho,{}),m.jsx(Di,{children:m.jsx(w.Suspense,{fallback:Gt,children:m.jsx(Wv,{email:r,onSuccess:()=>{s(null),le.auth.signOut({scope:"local"}).finally(()=>{window.location.replace("/login")})},onBack:()=>{s(null),le.auth.signOut({scope:"local"})}})})})]})});const o=()=>{};return m.jsx(Po,{client:Ra,children:m.jsxs(Eo,{children:[m.jsx(ao,{}),m.jsx(ho,{}),m.jsxs(pu,{children:[m.jsx(Jv,{}),m.jsx(Qv,{session:t,onAuthenticated:o}),t?m.jsx(Yv,{}):null,m.jsx(_v,{})]})]})})};try{es.removeItem("sv_theme")}catch(t){}const Zv=es.getItem("sv_theme_choice");Zv==="light"?document.documentElement.classList.add("checkout-light"):document.documentElement.classList.remove("checkout-light");function Xc(){var s,n,i,o,a,l;const t=document.documentElement.classList.contains("checkout-light"),e=t?"#ffffff"
103:"#000000";let r=document.querySelector('meta[name="theme-color"]');r||(r=document.createElement("meta"),r.name="theme-color",document.head.appendChild(r)),r.content=e,document.documentElement.style.backgroundColor=e,document.body&&(document.body.style.backgroundColor=e);try{(o=(i=(n=(s=window.Capacitor)==null?void 0:s.Plugins)==null?void 0:n.StatusBar)==null?void 0:i.setBackgroundColor)==null||o.call(i,{color:e}),(l=(a=window.ReactNativeWebView)==null?void 0:a.postMessage)==null||l.call(a,JSON.stringify({type:"theme",color:e,isLight:t}))}catch(c){}}Xc();new MutationObserver(Xc).observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});var Ma;try{const t="sv_build_version",e=document.querySelector('meta[name="app-version"]'),r=(Ma=e==null?void 0:e.content)!=null?Ma:"";if(!0&&r&&r!=="__BUILD_TS__"){const n=es.getItem(t);n&&n!==r?(es.setItem(t,r),window.location.reload()):es.setItem(t,r)}}catch(t){}function hs(t,e){return f(this,null,function*(){var l,c;const{supabase:r}=yield Ne(()=>f(this,null,function*(){const{supabase:d}=yield Promise.resolve().then(()=>Fc);return{supabase:d}}),void 0),{data:s}=yield r.auth.getSession(),n=(c=(l=s.session)==null?void 0:l.user)==null?void 0:c.id;if(console.log("[NativeBridge] processNativeToken called",{tokenPrefix:(t==null?void 0:t.substring(0,20))+"...",platform:e,userId:n!=null?n:"NO_USER"}),window.__NATIVE_PUSH_TOKEN_CACHE__={token:t,platform:e},!n||!t){console.warn("[NativeBridge] Missing userId or token, storing as pending"),window.__NATIVE_PUSH_TOKEN__={token:t,platform:e};return}const i=r,{data:o,error:a}=yield i.from("push_subscriptions").upsert({user_id:n,token:t,platform:e,is_active:!0,device_info:{userAgent:navigator.userAgent,native:!0},last_used_at:new Date().toISOString()},{onConflict:"user_id,platform"}).select().single();a?console.error("[NativeBridge] Error saving token:",a):console.log("[NativeBridge] ✅ Token saved successfully",{id:o==null?void 0:o.id,platform:e,userId:n,tokenPrefix:(t==null?void 0:t.substring(0,20))+"..."}),window.__NATIVE_PUSH_TOKEN__=null})}window.addEventListener("pushToken",t=>{var s,n,i;const e=((s=t.detail)==null?void 0:s.token)||t.detail,r=((n=t.detail)==null?void 0:n.platform)||(/iPhone|iPad|iPod/.test(navigator.userAgent)?"ios":"android");console.log("[NativeBridge] Received pushToken CustomEvent",{tokenPrefix:((i=String(e))==null?void 0:i.substring(0,20))+"...",platform:r}),e&&hs(String(e),r)});window.NativeBridge={__isNativeApp:!1,registerToken:(t,e="android")=>{console.log("[NativeBridge] registerToken called",{tokenPrefix:(t==null?void 0:t.substring(0,20))+"...",platform:e}),hs(t,e)}};f(void 0,null,function*(){const{supabase:t}=yield Ne(()=>f(void 0,null,function*(){const{supabase:r}=yield Promise.resolve().then(()=>Fc);return{supabase:r}}),void 0);t.auth.onAuthStateChange(r=>{if(r==="SIGNED_IN"){const s=window.__NATIVE_PUSH_TOKEN__,n=window.__NATIVE_PUSH_TOKEN_CACHE__;s!=null&&s.token?(console.log("[NativeBridge] Processing pending token after SIGNED_IN"),hs(s.token,s.platform||"android")):n!=null&&n.token?(console.log("[NativeBridge] Re-registering cached token after SIGNED_IN"),hs(n.token,n.platform||"android")):Oa(t)}});const{data:{session:e}}=yield t.auth.getSession();e!=null&&e.user&&Oa(t)});function Oa(t){let e=0;const r=setInterval(()=>f(this,null,function*(){if(e++,e>60){clearInterval(r);return}const s=window.__NATIVE_PUSH_TOKEN__;if(!s)return;const{data:{session:n}}=yield t.auth.getSession();if(!(n!=null&&n.user))return;console.log("[NativeBridge] Polling found pending token, registering...");const i=window.__NATIVE_PUSH_PLATFORM__||"ios";yield hs(String(s),i),window.__NATIVE_PUSH_TOKEN__=null,clearInterval(r)}),500)}f(void 0,null,function*(){var t,e;try{const{Capacitor:r}=yield Ne(()=>f(void 0,null,function*(){const{Capacitor:s}=yield import("./index-BGL46_Uy.js");return{Capacitor:s}}),[]);if((t=r.isNativePlatform)!=null&&t.call(r)&&((e=r.getPlatform)==null?void 0:e.call(r))==="ios"){const{Keyboard:s}=yield Ne(()=>f(void 0,null,function*(){const{Keyboard:n}=yield import("./index-XIFkKqiZ.js");return{Keyboard:n}}),__vite__mapDeps([18,19]));
103yield s.setAccessoryBarVisible({isVisible:!1})}}catch(r){console.warn("[Keyboard] accessory bar hide skipped",r)}});f(void 0,null,function*(){try{const{runEarlyForceUpdate:t}=yield Ne(()=>f(void 0,null,function*(){const{runEarlyForceUpdate:e}=yield Promise.resolve().then(()=>bv);return{runEarlyForceUpdate:e}}),void 0);t()}catch(t){}});Ba(document.getElementById("root")).render(m.jsx(Xv,{}));export{Pp as $,wd as A,cb as B,xd as C,yi as D,nh as E,Sd as F,io as G,lb as H,ib as I,Kc as J,ro as K,Gr as L,ml as M,Tu as N,yb as O,Ce as P,Gc as Q,db as R,Ed as S,ab as T,ob as U,pl as V,mb as W,kd as X,vn as Y,Up as Z,Ne as _,Dt as a,pb as a0,ri as a1,ze as a2,bn as a3,Cp as a4,Op as a5,cc as a6,Wp as a7,Ip as a8,ke as a9,ss as aa,Kp as ab,gb as ac,ep as ad,wn as ae,bb as af,sb as ag,nb as ah,Kr as ai,ub as aj,Fc as ak,_b as al,un as b,_t as c,ir as d,vb as e,Io as f,Cl as g,Qc as h,es as i,wb as j,md as k,Ou as l,me as m,Ye as n,qu as o,ap as p,Vl as q,vi as r,le as s,Ka as t,Lt as u,Wa as v,lp as w,Ks as x,cp as y,Fa as z};

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.