blog/source/files/magicbroad/assets/index.13b310ab.js
2022-06-09 09:09:09 +08:00

26 lines
141 KiB
JavaScript

var dr=Object.defineProperty,pr=Object.defineProperties;var mr=Object.getOwnPropertyDescriptors;var Ze=Object.getOwnPropertySymbols;var en=Object.prototype.hasOwnProperty,tn=Object.prototype.propertyIsEnumerable;var Zt=(n,e,t)=>e in n?dr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,S=(n,e)=>{for(var t in e||(e={}))en.call(e,t)&&Zt(n,t,e[t]);if(Ze)for(var t of Ze(e))tn.call(e,t)&&Zt(n,t,e[t]);return n},K=(n,e)=>pr(n,mr(e));var nn=(n,e)=>{var t={};for(var r in n)en.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&Ze)for(var r of Ze(n))e.indexOf(r)<0&&tn.call(n,r)&&(t[r]=n[r]);return t};const gr=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerpolicy&&(i.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?i.credentials="include":s.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=t(s);fetch(s.href,i)}};gr();const O={};function Ue(n){O.context=n}const yr=(n,e)=>n===e,he=Symbol("solid-proxy"),Sn=Symbol("solid-track"),at={equals:yr};let En=Rn;const xe={},me=1,ct=2,$n={owned:null,cleanups:null,context:null,owner:null},[vr,Ja]=q(!1);var R=null;let qe=null,x=null,Fe=null,G=null,Q=null,Lt=0;function we(n,e){const t=x,r=R,s=n.length===0?$n:{owned:null,cleanups:null,context:null,owner:e||r};R=s,x=null;try{return gt(()=>n(()=>zt(s)),!0)}finally{x=t,R=r}}function q(n,e){e=e?Object.assign({},at,e):at;const t={value:n,observers:null,observerSlots:null,pending:xe,comparator:e.equals||void 0},r=s=>(typeof s=="function"&&(s=s(t.pending!==xe?t.pending:t.value)),Mt(t,s));return[xn.bind(t),r]}function lt(n,e,t){const r=mt(n,e,!0,me);Ce(r)}function re(n,e,t){const r=mt(n,e,!1,me);Ce(r)}function Tn(n,e,t){En=kr;const r=mt(n,e,!1,me);r.user=!0,Q?Q.push(r):Ce(r)}function N(n,e,t){t=t?Object.assign({},at,t):at;const r=mt(n,e,!0,0);return r.pending=xe,r.observers=null,r.observerSlots=null,r.comparator=t.equals||void 0,Ce(r),xn.bind(r)}function br(n,e,t){arguments.length===2?typeof e=="object"&&(t=e,e=n,n=!0):arguments.length===1&&(e=n,n=!0),t||(t={});const r=new Set,[s,i]=q(t.initialValue),[o,a]=q(void 0,{equals:!1}),[l,u]=q(!1),[c,h]=q();let p,d=null,g=null,v=null,_=!1,U="initialValue"in t,P=typeof n=="function"&&N(n);O.context&&(v=`${O.context.id}${O.context.count++}`,O.load&&(g=O.load(v)));function j(w,y,E,V){return d===w&&(d=null,U=!0,g&&(w===g||y===g)&&t.onHydrated&&queueMicrotask(()=>t.onHydrated(V,{value:y})),g=null,h(p=E),L(y)),y}function L(w){fe(()=>{i(()=>w),u(!1);for(const y of r.keys())y.decrement();r.clear()})}function M(){const w=$r,y=s();if(p)throw p;return x&&!x.user&&w&&lt(()=>{o(),d&&(w.resolved||r.has(w)||(w.increment(),r.add(w)))}),y}function te(w){if(w&&_)return;_=!1,h(p=void 0);const y=P?P():n;if(y==null||y===!1){j(d,W(s));return}const E=g||W(()=>e(y,{value:s(),refetching:w}));return typeof E!="object"||!("then"in E)?(j(d,E),E):(d=E,_=!0,queueMicrotask(()=>_=!1),fe(()=>{u(!0),a()}),E.then(V=>j(E,V,void 0,y),V=>j(E,V,V)))}return Object.defineProperties(M,{loading:{get(){return l()}},error:{get(){return c()}},latest:{get(){if(!U)return M();if(p)throw p;return s()}}}),P?lt(()=>te(!1)):te(!1),[M,{refetch:te,mutate:i}]}function fe(n){if(Fe)return n();let e;const t=Fe=[];try{e=n()}finally{Fe=null}return gt(()=>{for(let r=0;r<t.length;r+=1){const s=t[r];if(s.pending!==xe){const i=s.pending;s.pending=xe,Mt(s,i)}}},!1),e}function W(n){let e,t=x;return x=null,e=n(),x=t,e}function On(n,e,t){const r=Array.isArray(n);let s,i=t&&t.defer;return o=>{let a;if(r){a=Array(n.length);for(let u=0;u<n.length;u++)a[u]=n[u]()}else a=n();if(i){i=!1;return}const l=W(()=>e(a,s,o));return s=a,l}}function qa(n){Tn(()=>W(n))}function oe(n){return R===null||(R.cleanups===null?R.cleanups=[n]:R.cleanups.push(n)),n}function kn(){return x}function _r(){return R}function wr(n,e){const t=R;R=n;try{return gt(e,!0)}finally{R=t}}function Sr(n){const e=x,t=R;return Promise.resolve().then(()=>{x=e,R=t;let r;return fe(n),x=R=null,r?r.done:void 0})}function Er(){return[vr,Sr]}function Ve(n){const e=Symbol("context");return{id:e,Provider:Ar(e),defaultValue:n}}function je(n){let e;return(e=Pn(R,n.id))!==void 0?e:n.defaultValue}function An(n){const e=N(n);return N(()=>At(e()))}let $r;function xn(){const n=qe;if(this.sources&&(this.state||n)){const e=G;G=null,this.state===me||n?Ce(this):ut(this),G=e}if(x){const e=this.observers?this.observers.length:0;x.sources?(x.sources.push(this),x.sourceSlots.push(e)):(x.sources=[this],x.sourceSlots=[e]),this.observers?(this.observers.push(x),this.observerSlots.push(x.sources.length-1)):(this.observers=[x],this.observerSlots=[x.sources.length-1])}return this.value}function Mt(n,e,t){if(Fe)return n.pending===xe&&Fe.push(n),n.pending=e,e;if(n.comparator&&n.comparator(n.value,e))return e;let r=!1;return n.value=e,n.observers&&n.observers.length&&gt(()=>{for(let s=0;s<n.observers.length;s+=1){const i=n.observers[s];r&&qe.disposed.has(i),(r&&!i.tState||!r&&!i.state)&&(i.pure?G.push(i):Q.push(i),i.observers&&jn(i)),r||(i.state=me)}if(G.length>1e6)throw G=[],new Error},!1),e}function Ce(n){if(!n.fn)return;zt(n);const e=R,t=x,r=Lt;x=R=n,Tr(n,n.value,r),x=t,R=e}function Tr(n,e,t){let r;try{r=n.fn(e)}catch(s){Cn(s)}(!n.updatedAt||n.updatedAt<=t)&&(n.observers&&n.observers.length?Mt(n,r):n.value=r,n.updatedAt=t)}function mt(n,e,t,r,s){const i={fn:n,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:R,context:null,pure:t};return R===null||R!==$n&&(R.owned?R.owned.push(i):R.owned=[i]),i}function Le(n){const e=qe;if(n.state===0||e)return;if(n.state===ct||e)return ut(n);if(n.suspense&&W(n.suspense.inFallback))return n.suspense.effects.push(n);const t=[n];for(;(n=n.owner)&&(!n.updatedAt||n.updatedAt<Lt);)(n.state||e)&&t.push(n);for(let r=t.length-1;r>=0;r--)if(n=t[r],n.state===me||e)Ce(n);else if(n.state===ct||e){const s=G;G=null,ut(n,t[0]),G=s}}function gt(n,e){if(G)return n();let t=!1;e||(G=[]),Q?t=!0:Q=[],Lt++;try{const r=n();return Or(t),r}catch(r){Cn(r)}finally{G=null,t||(Q=null)}}function Or(n){G&&(Rn(G),G=null),!n&&(Q.length?fe(()=>{En(Q),Q=null}):Q=null)}function Rn(n){for(let e=0;e<n.length;e++)Le(n[e])}function kr(n){let e,t=0;for(e=0;e<n.length;e++){const s=n[e];s.user?n[t++]=s:Le(s)}O.context&&Ue();const r=n.length;for(e=0;e<t;e++)Le(n[e]);for(e=r;e<n.length;e++)Le(n[e])}function ut(n,e){const t=qe;n.state=0;for(let r=0;r<n.sources.length;r+=1){const s=n.sources[r];s.sources&&(s.state===me||t?s!==e&&Le(s):(s.state===ct||t)&&ut(s,e))}}function jn(n){const e=qe;for(let t=0;t<n.observers.length;t+=1){const r=n.observers[t];(!r.state||e)&&(r.state=ct,r.pure?G.push(r):Q.push(r),r.observers&&jn(r))}}function zt(n){let e;if(n.sources)for(;n.sources.length;){const t=n.sources.pop(),r=n.sourceSlots.pop(),s=t.observers;if(s&&s.length){const i=s.pop(),o=t.observerSlots.pop();r<s.length&&(i.sourceSlots[o]=r,s[r]=i,t.observerSlots[r]=o)}}if(n.owned){for(e=0;e<n.owned.length;e++)zt(n.owned[e]);n.owned=null}if(n.cleanups){for(e=0;e<n.cleanups.length;e++)n.cleanups[e]();n.cleanups=null}n.state=0,n.context=null}function Cn(n){throw n}function Pn(n,e){return n?n.context&&n.context[e]!==void 0?n.context[e]:Pn(n.owner,e):void 0}function At(n){if(typeof n=="function"&&!n.length)return At(n());if(Array.isArray(n)){const e=[];for(let t=0;t<n.length;t++){const r=At(n[t]);Array.isArray(r)?e.push.apply(e,r):e.push(r)}return e}return n}function Ar(n){return function(t){let r;return lt(()=>r=W(()=>(R.context={[n]:t.value},An(()=>t.children)))),r}}const xr=Symbol("fallback");function rn(n){for(let e=0;e<n.length;e++)n[e]()}function Rr(n,e,t={}){let r=[],s=[],i=[],o=0,a=e.length>1?[]:null;return oe(()=>rn(i)),()=>{let l=n()||[],u,c;return l[Sn],W(()=>{let p=l.length,d,g,v,_,U,P,j,L,M;if(p===0)o!==0&&(rn(i),i=[],r=[],s=[],o=0,a&&(a=[])),t.fallback&&(r=[xr],s[0]=we(te=>(i[0]=te,t.fallback())),o=1);else if(o===0){for(s=new Array(p),c=0;c<p;c++)r[c]=l[c],s[c]=we(h);o=p}else{for(v=new Array(p),_=new Array(p),a&&(U=new Array(p)),P=0,j=Math.min(o,p);P<j&&r[P]===l[P];P++);for(j=o-1,L=p-1;j>=P&&L>=P&&r[j]===l[L];j--,L--)v[L]=s[j],_[L]=i[j],a&&(U[L]=a[j]);for(d=new Map,g=new Array(L+1),c=L;c>=P;c--)M=l[c],u=d.get(M),g[c]=u===void 0?-1:u,d.set(M,c);for(u=P;u<=j;u++)M=r[u],c=d.get(M),c!==void 0&&c!==-1?(v[c]=s[u],_[c]=i[u],a&&(U[c]=a[u]),c=g[c],d.set(M,c)):i[u]();for(c=P;c<p;c++)c in v?(s[c]=v[c],i[c]=_[c],a&&(a[c]=U[c],a[c](c))):s[c]=we(h);s=s.slice(0,o=p),r=l.slice(0)}return s});function h(p){if(i[c]=p,a){const[d,g]=q(c);return a[c]=g,e(l[c],d)}return e(l[c])}}}function $(n,e){return W(()=>n(e||{}))}function et(){return!0}const In={get(n,e,t){return e===he?t:n.get(e)},has(n,e){return n.has(e)},set:et,deleteProperty:et,getOwnPropertyDescriptor(n,e){return{configurable:!0,enumerable:!0,get(){return n.get(e)},set:et,deleteProperty:et}},ownKeys(n){return n.keys()}};function $t(n){return(n=typeof n=="function"?n():n)==null?{}:n}function jr(...n){return new Proxy({get(e){for(let t=n.length-1;t>=0;t--){const r=$t(n[t])[e];if(r!==void 0)return r}},has(e){for(let t=n.length-1;t>=0;t--)if(e in $t(n[t]))return!0;return!1},keys(){const e=[];for(let t=0;t<n.length;t++)e.push(...Object.keys($t(n[t])));return[...new Set(e)]}},In)}function Nn(n,...e){const t=new Set(e.flat()),r=Object.getOwnPropertyDescriptors(n),s=e.map(i=>{const o={};for(let a=0;a<i.length;a++){const l=i[a];Object.defineProperty(o,l,r[l]?r[l]:{get(){return n[l]},set(){return!0}})}return o});return s.push(new Proxy({get(i){return t.has(i)?void 0:n[i]},has(i){return t.has(i)?!1:i in n},keys(){return Object.keys(n).filter(i=>!t.has(i))}},In)),s}function Pe(n){let e,t;const r=s=>{const i=O.context;if(i){const[a,l]=q();(t||(t=n())).then(u=>{Ue(i),l(()=>u.default),Ue()}),e=a}else if(e){const a=e();if(a)return a(s)}else{const[a]=br(()=>(t||(t=n())).then(l=>l.default));e=a}let o;return N(()=>(o=e())&&W(()=>{if(!i)return o(s);const a=O.context;Ue(i);const l=o(s);return Ue(a),l}))};return r.preload=()=>t||((t=n()).then(s=>e=()=>s.default),t),r}let Cr=0;function Va(){const n=O.context;return n?`${n.id}${n.count++}`:`cl-${Cr++}`}function Wa(n){const e="fallback"in n&&{fallback:()=>n.fallback};return N(Rr(()=>n.each,n.children,e||void 0))}function Gt(n){let e=!1;const t=N(()=>n.when,void 0,{equals:(r,s)=>e?r===s:!r==!s});return N(()=>{const r=t();if(r){const s=n.children;return(e=typeof s=="function"&&s.length>0)?W(()=>s(r)):s}return n.fallback})}function Ka(n){let e=!1;const t=An(()=>n.children),r=N(()=>{let s=t();Array.isArray(s)||(s=[s]);for(let i=0;i<s.length;i++){const o=s[i].when;if(o)return[i,o,s[i]]}return[-1]},void 0,{equals:(s,i)=>s[0]===i[0]&&(e?s[1]===i[1]:!s[1]==!i[1])&&s[2]===i[2]});return N(()=>{const[s,i,o]=r();if(s<0)return n.fallback;const a=o.children;return(e=typeof a=="function"&&a.length>0)?W(()=>a(i)):a})}function Xa(n){return n}const Pr=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Ir=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Pr]),Nr=new Set(["innerHTML","textContent","innerText","children"]),Dr={className:"class",htmlFor:"for"},sn={class:"className",formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"},Ur=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),Br=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),Fr={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function Ya(n,e){return N(n,void 0,e?void 0:{equals:e})}function Lr(n,e,t){let r=t.length,s=e.length,i=r,o=0,a=0,l=e[s-1].nextSibling,u=null;for(;o<s||a<i;){if(e[o]===t[a]){o++,a++;continue}for(;e[s-1]===t[i-1];)s--,i--;if(s===o){const c=i<r?a?t[a-1].nextSibling:t[i-a]:l;for(;a<i;)n.insertBefore(t[a++],c)}else if(i===a)for(;o<s;)(!u||!u.has(e[o]))&&e[o].remove(),o++;else if(e[o]===t[i-1]&&t[a]===e[s-1]){const c=e[--s].nextSibling;n.insertBefore(t[a++],e[o++].nextSibling),n.insertBefore(t[--i],c),e[s]=t[i]}else{if(!u){u=new Map;let h=a;for(;h<i;)u.set(t[h],h++)}const c=u.get(e[o]);if(c!=null)if(a<c&&c<i){let h=o,p=1,d;for(;++h<s&&h<i&&!((d=u.get(e[h]))==null||d!==c+p);)p++;if(p>c-a){const g=e[o];for(;a<c;)n.insertBefore(t[a++],g)}else n.replaceChild(t[a++],e[o++])}else o++;else e[o++].remove()}}}const on="_$DX_DELEGATE";function Mr(n,e,t){let r;return we(s=>{r=s,e===document?n():xt(e,n(),e.firstChild?null:void 0,t)}),()=>{r(),e.textContent=""}}function Qa(n,e,t){const r=document.createElement("template");r.innerHTML=n;let s=r.content.firstChild;return t&&(s=s.firstChild),s}function zr(n,e=window.document){const t=e[on]||(e[on]=new Set);for(let r=0,s=n.length;r<s;r++){const i=n[r];t.has(i)||(t.add(i),e.addEventListener(i,Zr))}}function Gr(n,e,t){t==null?n.removeAttribute(e):n.setAttribute(e,t)}function Hr(n,e,t,r){r==null?n.removeAttributeNS(e,t):n.setAttributeNS(e,t,r)}function Jr(n,e){e==null?n.removeAttribute("class"):n.className=e}function qr(n,e,t,r){r?Array.isArray(t)?(n[`$$${e}`]=t[0],n[`$$${e}Data`]=t[1]):n[`$$${e}`]=t:Array.isArray(t)?n.addEventListener(e,s=>t[0](t[1],s)):n.addEventListener(e,t)}function Vr(n,e,t={}){const r=Object.keys(e||{}),s=Object.keys(t);let i,o;for(i=0,o=s.length;i<o;i++){const a=s[i];!a||a==="undefined"||e[a]||(an(n,a,!1),delete t[a])}for(i=0,o=r.length;i<o;i++){const a=r[i],l=!!e[a];!a||a==="undefined"||t[a]===l||!l||(an(n,a,!0),t[a]=l)}return t}function Wr(n,e,t={}){const r=n.style,s=typeof t=="string";if(e==null&&s||typeof e=="string")return r.cssText=e;s&&(r.cssText=void 0,t={}),e||(e={});let i,o;for(o in t)e[o]==null&&r.removeProperty(o),delete t[o];for(o in e)i=e[o],i!==t[o]&&(r.setProperty(o,i),t[o]=i);return t}function Kr(n,e,t,r){typeof e=="function"?re(s=>ln(n,e(),s,t,r)):ln(n,e,void 0,t,r)}function xt(n,e,t,r){if(t!==void 0&&!r&&(r=[]),typeof e!="function")return Re(n,e,r,t);re(s=>Re(n,e(),s,t),r)}function Xr(n,e,t,r,s={},i){e||(e={});for(const o in s)if(!(o in e)){if(o==="children")continue;cn(n,o,null,s[o],t,i)}for(const o in e){if(o==="children"){r||Re(n,e.children);continue}const a=e[o];s[o]=cn(n,o,a,s[o],t,i)}}function Yr(n){let e,t;return!O.context||!(e=O.registry.get(t=es()))?n.cloneNode(!0):(O.completed&&O.completed.add(e),O.registry.delete(t),e)}function Qr(n){return n.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function an(n,e,t){const r=e.trim().split(/\s+/);for(let s=0,i=r.length;s<i;s++)n.classList.toggle(r[s],t)}function cn(n,e,t,r,s,i){let o,a,l;if(e==="style")return Wr(n,t,r);if(e==="classList")return Vr(n,t,r);if(t===r)return r;if(e==="ref")i||t(n);else if(e.slice(0,3)==="on:")n.addEventListener(e.slice(3),t);else if(e.slice(0,10)==="oncapture:")n.addEventListener(e.slice(10),t,!0);else if(e.slice(0,2)==="on"){const u=e.slice(2).toLowerCase(),c=Ur.has(u);qr(n,u,t,c),c&&zr([u])}else if((l=Nr.has(e))||!s&&(sn[e]||(a=Ir.has(e)))||(o=n.nodeName.includes("-")))e==="class"||e==="className"?Jr(n,t):o&&!a&&!l?n[Qr(e)]=t:n[sn[e]||e]=t;else{const u=s&&e.indexOf(":")>-1&&Fr[e.split(":")[0]];u?Hr(n,u,e,t):Gr(n,Dr[e]||e,t)}return t}function Zr(n){const e=`$$${n.type}`;let t=n.composedPath&&n.composedPath()[0]||n.target;for(n.target!==t&&Object.defineProperty(n,"target",{configurable:!0,value:t}),Object.defineProperty(n,"currentTarget",{configurable:!0,get(){return t||document}}),O.registry&&!O.done&&(O.done=!0,document.querySelectorAll("[id^=pl-]").forEach(r=>r.remove()));t!==null;){const r=t[e];if(r&&!t.disabled){const s=t[`${e}Data`];if(s!==void 0?r(s,n):r(n),n.cancelBubble)return}t=t.host&&t.host!==t&&t.host instanceof Node?t.host:t.parentNode}}function ln(n,e,t={},r,s){return e||(e={}),!s&&"children"in e&&re(()=>t.children=Re(n,e.children,t.children)),e.ref&&e.ref(n),re(()=>Xr(n,e,r,!0,t,!0)),t}function Re(n,e,t,r,s){for(O.context&&!t&&(t=[...n.childNodes]);typeof t=="function";)t=t();if(e===t)return t;const i=typeof e,o=r!==void 0;if(n=o&&t[0]&&t[0].parentNode||n,i==="string"||i==="number"){if(O.context)return t;if(i==="number"&&(e=e.toString()),o){let a=t[0];a&&a.nodeType===3?a.data=e:a=document.createTextNode(e),t=ge(n,t,r,a)}else t!==""&&typeof t=="string"?t=n.firstChild.data=e:t=n.textContent=e}else if(e==null||i==="boolean"){if(O.context)return t;t=ge(n,t,r)}else{if(i==="function")return re(()=>{let a=e();for(;typeof a=="function";)a=a();t=Re(n,a,t,r)}),()=>t;if(Array.isArray(e)){const a=[];if(Rt(a,e,s))return re(()=>t=Re(n,a,t,r,!0)),()=>t;if(O.context){for(let l=0;l<a.length;l++)if(a[l].parentNode)return t=a}if(a.length===0){if(t=ge(n,t,r),o)return t}else Array.isArray(t)?t.length===0?un(n,a,r):Lr(n,t,a):(t&&ge(n),un(n,a));t=a}else if(e instanceof Node){if(O.context&&e.parentNode)return t=o?[e]:e;if(Array.isArray(t)){if(o)return t=ge(n,t,r,e);ge(n,t,null,e)}else t==null||t===""||!n.firstChild?n.appendChild(e):n.replaceChild(e,n.firstChild);t=e}}return t}function Rt(n,e,t){let r=!1;for(let s=0,i=e.length;s<i;s++){let o=e[s],a;if(o instanceof Node)n.push(o);else if(!(o==null||o===!0||o===!1))if(Array.isArray(o))r=Rt(n,o)||r;else if((a=typeof o)=="string")n.push(document.createTextNode(o));else if(a==="function")if(t){for(;typeof o=="function";)o=o();r=Rt(n,Array.isArray(o)?o:[o])||r}else n.push(o),r=!0;else n.push(document.createTextNode(o.toString()))}return r}function un(n,e,t){for(let r=0,s=e.length;r<s;r++)n.insertBefore(e[r],t)}function ge(n,e,t,r){if(t===void 0)return n.textContent="";const s=r||document.createTextNode("");if(e.length){let i=!1;for(let o=e.length-1;o>=0;o--){const a=e[o];if(s!==a){const l=a.parentNode===n;!i&&!o?l?n.replaceChild(s,a):n.insertBefore(s,t):l&&a.remove()}else i=!0}}else n.insertBefore(s,t);return[s]}function es(){const n=O.context;return`${n.id}${n.count++}`}const ts="http://www.w3.org/2000/svg";function Dn(n,e=!1){return e?document.createElementNS(ts,n):document.createElement(n)}function Za(n){const{useShadow:e}=n,t=document.createTextNode(""),r=n.mount||document.body;function s(){if(O.context){const[i,o]=q(!1);return queueMicrotask(()=>o(!0)),()=>i()&&n.children}else return()=>n.children}if(r instanceof HTMLHeadElement){const[i,o]=q(!1),a=()=>o(!0);we(l=>xt(r,()=>i()?l():s()(),null)),oe(()=>{O.context?queueMicrotask(a):a()})}else{const i=Dn(n.isSVG?"g":"div",n.isSVG),o=e&&i.attachShadow?i.attachShadow({mode:"open"}):i;Object.defineProperty(i,"host",{get(){return t.parentNode}}),xt(o,s()),r.appendChild(i),n.ref&&n.ref(i),oe(()=>r.removeChild(i))}return t}function ec(n){const[e,t]=Nn(n,["component"]);return N(()=>{const r=e.component;switch(typeof r){case"function":return W(()=>r(t));case"string":const s=Br.has(r),i=O.context?Yr():Dn(r,s);return Kr(i,t,s),i}})}const ns="modulepreload",hn={},rs="/",Ie=function(e,t){return!t||t.length===0?e():Promise.all(t.map(r=>{if(r=`${rs}${r}`,r in hn)return;hn[r]=!0;const s=r.endsWith(".css"),i=s?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${i}`))return;const o=document.createElement("link");if(o.rel=s?"stylesheet":ns,s||(o.as="script",o.crossOrigin=""),o.href=r,document.head.appendChild(o),s)return new Promise((a,l)=>{o.addEventListener("load",a),o.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>e())};function ss(n,e,t){return n.addEventListener(e,t),()=>n.removeEventListener(e,t)}function is([n,e],t,r){return[t?()=>t(n()):n,r?s=>e(r(s)):e]}function os(n){try{return document.querySelector(n)}catch{return null}}function as(n,e){const t=os(`a#${n}`);t?t.scrollIntoView():e&&window.scrollTo(0,0)}function cs(n,e,t,r){let s=!1;const i=a=>typeof a=="string"?{value:a}:a,o=is(q(i(n()),{equals:(a,l)=>a.value===l.value}),void 0,a=>(!s&&e(a),a));return t&&oe(t((a=n())=>{s=!0,o[1](i(a)),s=!1})),{signal:o,utils:r}}function ls(n){if(n){if(Array.isArray(n))return{signal:n}}else return{signal:q({value:""})};return n}function us(){return cs(()=>({value:window.location.pathname+window.location.search+window.location.hash,state:history.state}),({value:n,replace:e,scroll:t,state:r})=>{e?window.history.replaceState(r,"",n):window.history.pushState(r,"",n),as(window.location.hash.slice(1),t)},n=>ss(window,"popstate",()=>n()),{go:n=>window.history.go(n)})}const hs=/^(?:[a-z0-9]+:)?\/\//i,fs=/^\/+|\/+$/g;function Me(n,e=!1){const t=n.replace(fs,"");return t?e||/^[?#]/.test(t)?t:"/"+t:""}function it(n,e,t){if(hs.test(e))return;const r=Me(n),s=t&&Me(t);let i="";return!s||e.startsWith("/")?i=r:s.toLowerCase().indexOf(r.toLowerCase())!==0?i=r+s:i=s,(i||"/")+Me(e,!i)}function ds(n,e){if(n==null)throw new Error(e);return n}function Un(n,e){return Me(n).replace(/\/*(\*.*)?$/g,"")+Me(e)}function ps(n){const e={};return n.searchParams.forEach((t,r)=>{e[r]=t}),e}function Se(n,e){return decodeURIComponent(e?n.replace(/\+/g," "):n)}function ms(n,e){const[t,r]=n.split("/*",2),s=t.split("/").filter(Boolean),i=s.length;return o=>{const a=o.split("/").filter(Boolean),l=a.length-i;if(l<0||l>0&&r===void 0&&!e)return null;const u={path:i?"":"/",params:{}};for(let c=0;c<i;c++){const h=s[c],p=a[c];if(h[0]===":")u.params[h.slice(1)]=p;else if(h.localeCompare(p,void 0,{sensitivity:"base"})!==0)return null;u.path+=`/${p}`}return r&&(u.params[r]=l?a.slice(-l).join("/"):""),u}}function gs(n){const[e,t]=n.pattern.split("/*",2),r=e.split("/").filter(Boolean);return r.reduce((s,i)=>s+(i.startsWith(":")?2:3),r.length-(t===void 0?0:1))}function Bn(n){const e=new Map,t=_r();return new Proxy({},{get(r,s){return e.has(s)||wr(t,()=>e.set(s,N(()=>n()[s]))),e.get(s)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(n())}})}const ys=100,Fn=Ve(),yt=Ve(),vt=()=>ds(je(Fn),"Make sure your app is wrapped in a <Router />");let He;const Ht=()=>He||je(yt)||vt().base,vs=()=>vt().navigatorFactory(),bs=()=>vt().location,tc=()=>Ht().params;function _s(n,e="",t){const{path:r,component:s,data:i,children:o}=n,a=!o||Array.isArray(o)&&!o.length,l=Un(e,r),u=a?l:l.split("/*",1)[0];return{originalPath:r,pattern:u,element:s?()=>$(s,{}):()=>{const{element:c}=n;return c===void 0&&t?$(t,{}):c},preload:n.component?s.preload:n.preload,data:i,matcher:ms(u,!a)}}function ws(n,e=0){return{routes:n,score:gs(n[n.length-1])*1e4-e,matcher(t){const r=[];for(let s=n.length-1;s>=0;s--){const i=n[s],o=i.matcher(t);if(!o)return null;r.unshift(K(S({},o),{route:i}))}return r}}}function Ln(n,e="",t,r=[],s=[]){const i=Array.isArray(n)?n:[n];for(let o=0,a=i.length;o<a;o++){const l=i[o];if(l&&typeof l=="object"&&l.hasOwnProperty("path")){const u=_s(l,e,t);if(r.push(u),l.children)Ln(l.children,u.pattern,t,r,s);else{const c=ws([...r],s.length);s.push(c)}r.pop()}}return r.length?s:s.sort((o,a)=>a.score-o.score)}function Ss(n,e){for(let t=0,r=n.length;t<r;t++){const s=n[t].matcher(e);if(s)return s}return[]}function Es(n,e){const t=new URL("http://sar"),r=N(l=>{const u=n();try{return new URL(u,t)}catch{return console.error(`Invalid path ${u}`),l}},t,{equals:(l,u)=>l.href===u.href}),s=N(()=>Se(r().pathname)),i=N(()=>Se(r().search,!0)),o=N(()=>Se(r().hash)),a=N(()=>"");return{get pathname(){return s()},get search(){return i()},get hash(){return o()},get state(){return e()},get key(){return a()},query:Bn(On(i,()=>ps(r())))}}function $s(n,e="",t,r){const{signal:[s,i],utils:o={}}=ls(n),a=o.parsePath||(w=>w),l=o.renderPath||(w=>w),u=it("",e),c=void 0;if(u===void 0)throw new Error(`${u} is not a valid base path`);u&&!s().value&&i({value:u,replace:!0,scroll:!1});const[h,p]=Er(),[d,g]=q(s().value),[v,_]=q(s().state),U=Es(d,v),P=[],j={pattern:u,params:{},path:()=>u,outlet:()=>null,resolvePath(w){return it(u,w)}};if(t)try{He=j,j.data=t({data:void 0,params:{},location:U,navigate:M(j)})}finally{He=void 0}function L(w,y,E){W(()=>{if(typeof y=="number"){y&&(o.go?o.go(y):console.warn("Router integration does not support relative routing"));return}const{replace:V,resolve:z,scroll:Ye,state:Z}=S({replace:!1,resolve:!0,scroll:!0},E),f=z?w.resolvePath(y):it("",y);if(f===void 0)throw new Error(`Path '${y}' is not a routable path`);if(P.length>=ys)throw new Error("Too many redirects");const m=d();if(f!==m||Z!==v()){const b=P.push({value:m,replace:V,scroll:Ye,state:v()});p(()=>{g(f),_(Z)}).then(()=>{P.length===b&&te({value:f,state:Z})})}})}function M(w){return w=w||je(yt)||j,(y,E)=>L(w,y,E)}function te(w){const y=P[0];y&&((w.value!==y.value||w.state!==y.state)&&i(K(S({},w),{replace:y.replace,scroll:y.scroll})),P.length=0)}re(()=>{const{value:w,state:y}=s();W(()=>{w!==d()&&p(()=>{g(w),_(y)})})});{let w=function(y){if(y.defaultPrevented||y.button!==0||y.metaKey||y.altKey||y.ctrlKey||y.shiftKey)return;const E=y.composedPath().find(D=>D instanceof Node&&D.nodeName.toUpperCase()==="A");if(!E)return;const V=E instanceof SVGAElement,z=V?E.href.baseVal:E.href;if((V?E.target.baseVal:E.target)||!z&&!E.hasAttribute("state"))return;const Z=(E.getAttribute("rel")||"").split(/\s+/);if(E.hasAttribute("download")||Z&&Z.includes("external"))return;const f=V?new URL(z,document.baseURI):new URL(z),m=Se(f.pathname);if(f.origin!==window.location.origin||u&&m&&!m.toLowerCase().startsWith(u.toLowerCase()))return;const b=a(m+Se(f.search,!0)+Se(f.hash)),B=E.getAttribute("state");y.preventDefault(),L(j,b,{resolve:!1,replace:E.hasAttribute("replace"),scroll:!E.hasAttribute("noscroll"),state:B&&JSON.parse(B)})};document.addEventListener("click",w),oe(()=>document.removeEventListener("click",w))}return{base:j,out:c,location:U,isRouting:h,renderPath:l,parsePath:a,navigatorFactory:M}}function Ts(n,e,t,r){const{base:s,location:i,navigatorFactory:o}=n,{pattern:a,element:l,preload:u,data:c}=r().route,h=N(()=>r().path),p=Bn(()=>r().params);u&&u();const d={parent:e,pattern:a,get child(){return t()},path:h,params:p,data:e.data,outlet:l,resolvePath(g){return it(s.path(),g,h())}};if(c)try{He=d,d.data=c({data:e.data,params:p,location:i,navigate:o(d)})}finally{He=void 0}return d}const Os=n=>{const{source:e,url:t,base:r,data:s,out:i}=n,o=e||us(),a=$s(o,r,s);return $(Fn.Provider,{value:a,get children(){return n.children}})},ks=n=>{const e=vt(),t=Ht(),r=N(()=>Ln(n.children,Un(t.pattern,n.base||""),As)),s=N(()=>Ss(r(),e.location.pathname));e.out&&e.out.matches.push(s().map(({route:l,path:u,params:c})=>({originalPath:l.originalPath,pattern:l.pattern,path:u,params:c})));const i=[];let o;const a=N(On(s,(l,u,c)=>{let h=u&&l.length===u.length;const p=[];for(let d=0,g=l.length;d<g;d++){const v=u&&u[d],_=l[d];c&&v&&_.route.pattern===v.route.pattern?p[d]=c[d]:(h=!1,i[d]&&i[d](),we(U=>{i[d]=U,p[d]=Ts(e,p[d-1]||t,()=>a()[d+1],()=>s()[d])}))}return i.splice(l.length).forEach(d=>d()),c&&h?c:(o=p[0],p)}));return $(Gt,{get when(){return a()&&o},children:l=>$(yt.Provider,{value:l,get children(){return l.outlet()}})})},ye=n=>n,As=()=>{const n=Ht();return $(Gt,{get when(){return n.child},children:e=>$(yt.Provider,{value:e,get children(){return e.outlet()}})})};function xs(n){const e=vs(),t=bs(),{href:r,state:s}=n,i=typeof r=="function"?r({navigate:e,location:t}):r;return e(i,{replace:!0,state:s}),null}function Rs(n,e,t){const r={};return Object.keys(n).forEach(s=>{r[s]=n[s].reduce((i,o)=>(o&&(t&&t[o]&&i.push(t[o]),i.push(e(o))),i),[]).join(" ")}),r}const Jt=Ve({});function Tt(n,e,t="px"){let r;if(n==="up")r=`(min-width:${e}${t})`;else if(n==="down")r=`(max-width:${e}${t})`;else if(n==="between"){const[s,i]=e;r=`(max-width:${s}${t}) and (min-width:${i}${t})`}else throw new Error(`Invalid comparator: ${n}`);return`@media ${r}`}const js={columns:12,keys:["xs","sm","md","lg","xl"],values:{xs:0,sm:600,md:900,lg:1200,xl:1536},unit:"px"};function Mn(n){const e=K(S(S({},js),n!=null?n:{}),{up:(t,r)=>{const s=Tt("up",e.resolve(t));return r?{[s]:r}:s},down:(t,r)=>{const s=Tt("down",e.resolve(t));return r?{[s]:r}:s},between:(t,r)=>{const s=Tt("between",[e.resolve(t[0]),e.resolve(t[1])]);return r?{[s]:r}:s},resolve:t=>typeof t=="number"?t:e.values[t]});return e}function zn(n){return typeof n=="function"?n:(...t)=>t.map(r=>typeof r=="number"?`${r*(n!=null?n:8)}px`:r).join(" ")}function Be(n){return n!==null&&typeof n=="object"&&n.constructor===Object}function Cs(n,e){for(const t of e){const r=n[t];delete n[t],n[t]=r}}function qt(n,e,t={clone:!0}){const r=t.clone?S({},n):n;return Be(n)&&Be(e)&&(Object.keys(e).forEach(s=>{s!=="__proto__"&&(Be(e[s])&&s in n&&Be(n[s])?r[s]=qt(n[s],e[s],t):r[s]=e[s])}),t.sortKeys&&Cs(r,Object.keys(e))),r}function jt(n){if(Array.isArray(n)){const e=[];for(const t of n)e.push(jt(t));return e}else if(Be(n)){const e={};for(const t in n)t!=="__proto__"&&(e[t]=jt(n[t]));return e}else return n}function We(n,...e){for(const t of e)qt(n,jt(t),{clone:!1});return n}const Ps={borderRadius:4};function Gn(n){return S({},We({},Ps,n))}function Is(n){return K(S({direction:"ltr",shadows:void 0,transitions:void 0,components:void 0,palette:void 0,typography:void 0,zIndex:void 0,mixins:void 0},n),{breakpoints:Mn(n==null?void 0:n.breakpoints),shape:Gn(n==null?void 0:n.shape),spacing:zn(n==null?void 0:n.spacing)})}function Hn(n){let e;return function(){return e||(e=n()),e}}var Ns=Hn(Is);function Ds(n){for(const e in n)return!1;return!0}function Jn(n=Ns,e=Jt){const t=je(e);if(Ds(t)&&n)return typeof n=="function"?n():n;if(!t)throw new Error("Theme is not defined");return t}function Us(n){return Jn(n,Jt)}function Bs(n){const e=Us(),t=s=>s,r=typeof n.propDefaults=="function"?n.propDefaults({set:t,inProps:n.props}):n.propDefaults;return jr(...r?[r]:[],()=>{var s,i;return((i=(s=e.components)==null?void 0:s[n.name])==null?void 0:i.defaultProps)||{}},n.props)}const qn=Symbol("store-raw"),ht=Symbol("store-node"),Fs=Symbol("store-name");function Vn(n){return n!=null&&typeof n=="object"&&(n[he]||!n.__proto__||n.__proto__===Object.prototype||Array.isArray(n))}function ft(n,e=new Set){let t,r,s,i;if(t=n!=null&&n[qn])return t;if(!Vn(n)||e.has(n))return n;if(Array.isArray(n)){Object.isFrozen(n)?n=n.slice(0):e.add(n);for(let o=0,a=n.length;o<a;o++)s=n[o],(r=ft(s,e))!==s&&(n[o]=r)}else{Object.isFrozen(n)?n=Object.assign({},n):e.add(n);const o=Object.keys(n),a=Object.getOwnPropertyDescriptors(n);for(let l=0,u=o.length;l<u;l++)i=o[l],!a[i].get&&(s=n[i],(r=ft(s,e))!==s&&(n[i]=r))}return n}function Vt(n){let e=n[ht];return e||Object.defineProperty(n,ht,{value:e={}}),e}function Ct(n,e,t){return n[e]||(n[e]=Kn(t,!0))}function Ls(n,e){const t=Reflect.getOwnPropertyDescriptor(n,e);return!t||t.get||!t.configurable||e===he||e===ht||e===Fs||(delete t.value,delete t.writable,t.get=()=>n[he][e]),t}function Wn(n){if(kn()){const e=Vt(n);(e._||(e._=Kn()))()}}function Ms(n){return Wn(n),Reflect.ownKeys(n)}function Kn(n,e){const[t,r]=q(n,e?{internal:!0}:{equals:!1,internal:!0});return t.$=r,t}function fn(n,e,t){if(n[e]===t)return;const r=n[e],s=n.length;t===void 0?delete n[e]:n[e]=t;let i=Vt(n),o;(o=Ct(i,e,r))&&o.$(()=>t),Array.isArray(n)&&n.length!==s&&(o=Ct(i,"length",s))&&o.$(n.length),(o=i._)&&o.$()}const zs={get(n,e,t){if(e===qn)return n;if(e===he)return t;if(e===Sn)return Wn(n);const r=Vt(n),s=r[e];let i=s?r[e]():n[e];if(e===ht||e==="__proto__")return i;if(!s){const o=Object.getOwnPropertyDescriptor(n,e),a=typeof i=="function";if(kn()&&(!a||n.hasOwnProperty(e))&&!(o&&o.get))i=Ct(r,e,i)();else if(i!=null&&a&&i===Array.prototype[e])return(...l)=>fe(()=>Array.prototype[e].apply(t,l))}return Vn(i)?Xn(i):i},set(n,e,t){return fn(n,e,ft(t)),!0},deleteProperty(n,e){return fn(n,e,void 0),!0},ownKeys:Ms,getOwnPropertyDescriptor:Ls};function Xn(n,e){let t=n[he];if(!t){Object.defineProperty(n,he,{value:t=new Proxy(n,zs)});const r=Object.keys(n),s=Object.getOwnPropertyDescriptors(n);for(let i=0,o=r.length;i<o;i++){const a=r[i];if(s[a].get){const l=s[a].get.bind(t);Object.defineProperty(n,a,{get:l})}if(s[a].set){const l=s[a].set;Object.defineProperty(n,a,{set:c=>fe(()=>l.call(t,c))})}}}return t}function Gs(n,e){const t=ft(n||{});return Xn(t)}function Yn(){return function(n){function e(a){const l=!!n.slotClasses,u=()=>{var h;if(!n.slotClasses)throw new Error("'slotClasses' option is not defined");if(!n.utilityClass)throw new Error("'utilityClass' option is not defined");return Rs(n.slotClasses(a),n.utilityClass,(h=a.classes)!=null?h:"")},c=Gs({});return l&&lt(()=>{const h=u();fe(()=>{for(const p in h)c[p]=h[p]})}),c}function t(a){const[l,u]=Nn(a,n.selfPropNames);return{allProps:a,props:l,otherProps:u}}function r(a){return Bs(K(S({propDefaults:n.propDefaults},a),{name:n.name}))}function s(a){const l=r({props:a});return t(l)}function i(a){return a.toString=()=>`${n.name}-root`,a}function o(a){const l=i(function(c){var v;const{allProps:h,otherProps:p,props:d}=s(c),g=(v=n.autoCallUseClasses)==null||v?e(h):{};return a({allProps:h,otherProps:p,props:d,classes:g})});return Object.defineProperty(l,"name",{value:a.name}),l}return{name:n.name,selfPropNames:n.selfPropNames,component:o,defineComponent:i,useClasses:e,useThemeProps:r,useProps:s,splitInProps:t}}}const Hs=Ve({});function Js(n){const e=n.reduce((t,r)=>("name"in r&&(t[`--${r.name}`]="0"),qt(t,r,{clone:!1,sortKeys:!0}),t),{});return delete e.name,e}function Qn(n){return n.startsWith("--")}function qs(n){return n.startsWith("__")}function Vs(n){return/[^a-z-]/i.test(n)&&!Qn(n)}function Ws(n){return n.startsWith("@global")}function Ks(n){return n.startsWith("@media")}function Xs(n){return n.startsWith("@keyframes")}function dn(n){return n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function pn(n,e,t=[],r={}){const s=n.split(",").map(i=>(i=i.trim(),i.includes("&")?i:`& ${i}`));return dt(e,(t.length?t:[""]).flatMap(i=>s.map(o=>o.replace(/&/g,i).trim())),S({},r))}function dt(n,e=[],t={}){const r=[],s=[];for(let o in n){const a=n[o];if(!qs(o))if(Ws(o))for(const l in a)s.push(...pn(l,a[l],[],t));else if(Ks(o))s.push(...dt(a,e,K(S({},t),{sublevel:!0})).map(l=>`${o} {
${l}
}`));else if(Qn(o))a!=null&&r.push(`${o}: ${a};`);else if(Xs(o)){const l=[];for(const u in a)l.push(...dt(a[u],[/^\d+$/.test(u)?`${u}%`:u],K(S({},t),{sublevel:!0})));s.push(`${o} {
${l.join(`
`)}
}`)}else if(Vs(o))s.push(...pn(o,a,e,t));else if(t.extraProperties&&o in t.extraProperties){const l=t.extraProperties[o](a);for(const u in l){const c=l[u],h=t.onPropertyValue?t.onPropertyValue(u,c):c;h!=null&&r.push(`${dn(u)}: ${h};`)}}else{o=dn(o);const l=t.onPropertyValue?t.onPropertyValue(o,a):a;l!=null&&r.push(`${o}: ${l};`)}}const i=o=>{const a=" ".repeat(o);return`${a}${r.join(`
${a}`)}`};if(e.length){const o=t.sublevel?" ":"",a=o+e.join(`,
${o}`);return[...r.length?[`${a} {
${i(t.sublevel?2:1)}
${o}}`]:[],...s]}else return[...r.length?[i(0)]:[],...s]}function Ys(){return Math.random().toString(36).substring(2,15).slice(0,8)}function Qs(n,e){return typeof n=="function"&&(n=n(...e||[])),n}function Zs(n){return n?Array.isArray(n)?n:[n]:[]}function ei(n,e){const t=Ys().slice(0,6);return{id:t,name:n,className:`${n}-${t}`,rules:e.replaceAll("$id",`${t}`)}}function ti(n){var i;const e=`${n.name}-$id`,r=Zs(Qs(n.props)).map(o=>typeof o=="string"?`.${e} {
${o}
}`:dt(o,[`.${e}`],{extraProperties:n.extraProperties}).join(`
`)).join(`
`),s=((i=n.cache)==null?void 0:i.get(r))||ei(n.name,r);return n.cache&&n.cache.set(r,s),s}function Zn(n,e){"styleSheet"in n?n.styleSheet.cssText=e:(n.innerText="",n.appendChild(document.createTextNode(e)))}function ni(n,e){for(const t in e){const r=e[t];r!==void 0&&(r===null?n.removeAttribute(t):n.setAttribute(t,r))}}function ri(n,e){const t=document.createElement("style");return t.type="text/css",e&&ni(t,e),Zn(t,n),t}function Pt(n){let e=Number(n.getAttribute("data-uses"));e++,n.setAttribute("data-uses",e.toString())}function si(n,e){Array.isArray(n)&&(n=n.join(`
`));const t=e==null?void 0:e.id,r=document.head||document.getElementsByTagName("head")[0],s=t&&document.getElementById(t);if(s&&s instanceof HTMLStyleElement)return Zn(s,n),Pt(s),s;{s&&s.remove();const i=ri(n,e);return Pt(i),r.appendChild(i),i}}function ii(n){return document.getElementById(n)}function mn(n){let e=Number(n.getAttribute("data-uses"));e--,e<=0?n.remove():n.setAttribute("data-uses",e.toString())}const oi=new Map;function ai(n){return n?(Array.isArray(n)?n:[n]).flat(1/0).filter(e=>!!e):[]}function ci(n){const e=je(Hs),[t,r]=q("");let s;return re(i=>{var l;const o=n();let a;return o&&(a=ti({name:"css",props:Js(ai(o)),cache:oi}),s=ii(a.id),s?Pt(s):s=si(a.rules,{id:a.id,once:(l=e.cache)==null?void 0:l.nonce})),i!=null&&i.styleElement&&mn(i.styleElement),typeof(a==null?void 0:a.className)=="string"?r(a.className):r(""),{className:a==null?void 0:a.className,styleElement:s}},void 0),oe(()=>{s&&mn(s)}),t}const li=Yn()({name:"MuiGlobalStyles",selfPropNames:["styles"]}),ui=li.component(function({props:e}){return ci(()=>({"@global":e.styles||{}})),[]}),hi={};function fi(n){return S({},We({},hi,n!=null?n:{}))}function di(n,e,t={}){return S({toolbar:{minHeight:56,[`${n.up("xs")} and (orientation: landscape)`]:{minHeight:48},[n.up("sm")]:{minHeight:64}}},t)}const de={black:"#000",white:"#fff"},Ee={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},$e={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},Te={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},Oe={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},ke={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},ze={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},pi={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"};function Wt(n,e=0,t=1){return Math.min(Math.max(e,n),t)}function mi(n){n=n.substr(1);const e=new RegExp(`.{1,${n.length>=6?2:1}}`,"g");let t=n.match(e);return t&&t[0].length===1&&(t=t.map(r=>r+r)),t?`rgb${t.length===4?"a":""}(${t.map((r,s)=>s<3?parseInt(r,16):Math.round(parseInt(r,16)/255*1e3)/1e3).join(", ")})`:""}function pe(n){if(typeof n!="string")return n;if(n.charAt(0)==="#")return pe(mi(n));const e=n.indexOf("("),t=n.substring(0,e);if(["rgb","rgba","hsl","hsla","color"].indexOf(t)===-1)throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+n);const r=n.substring(e+1,n.length-1);let s,i;if(t==="color"){if(s=r.split(" "),i=s.shift(),s.length===4&&s[3].charAt(0)==="/"&&(s[3]=s[3].substr(1)),["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i)===-1)throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020. "+i)}else s=r.split(",");return{type:t,values:s.map(o=>parseFloat(o)),colorSpace:i}}function bt(n){const{type:e,colorSpace:t}=n,{values:r}=n;let s;return e.indexOf("rgb")!==-1?s=r.map((i,o)=>o<3?parseInt(i.toString(),10):i).join(","):e.indexOf("hsl")!==-1&&(s=r.map((i,o)=>o===1||o===2?`${i}%`:i).join(",")),e.indexOf("color")!==-1?s=`${t} ${r.join(" ")}`:s=`${r.join(", ")}`,`${e}(${s})`}function gi(n){const e=pe(n),{values:t}=e,r=t[0],s=t[1]/100,i=t[2]/100,o=s*Math.min(i,1-i),a=(c,h=(c+r/30)%12)=>i-o*Math.max(Math.min(h-3,9-h,1),-1);let l="rgb";const u=[Math.round(a(0)*255),Math.round(a(8)*255),Math.round(a(4)*255)];return e.type==="hsla"&&(l+="a",u.push(t[3])),bt({type:l,values:u})}function gn(n){const{type:e,values:t}=pe(n);let r=e==="hsl"?pe(gi(n)).values:t;return r=r.map(s=>(e!=="color"&&(s/=255),s<=.03928?s/12.92:((s+.055)/1.055)**2.4)),Number((.2126*r[0]+.7152*r[1]+.0722*r[2]).toFixed(3))}function yi(n,e){const t=gn(n),r=gn(e);return(Math.max(t,r)+.05)/(Math.min(t,r)+.05)}function nc(n,e){let{type:t,values:r}=pe(n);return e=Wt(e),(t==="rgb"||t==="hsl")&&(t+="a"),t==="color"?r[3]=`/${e}`:r[3]=e,bt({type:t,values:r})}function vi(n,e){const t=pe(n);if(e=Wt(e),t.type.indexOf("hsl")!==-1)t.values[2]*=1-e;else if(t.type.indexOf("rgb")!==-1||t.type.indexOf("color")!==-1)for(let r=0;r<3;r+=1)t.values[r]*=1-e;return bt(t)}function bi(n,e){const t=pe(n);if(e=Wt(e),t.type.indexOf("hsl")!==-1)t.values[2]+=(100-t.values[2])*e;else if(t.type.indexOf("rgb")!==-1)for(let r=0;r<3;r+=1)t.values[r]+=(255-t.values[r])*e;else if(t.type.indexOf("color")!==-1)for(let r=0;r<3;r+=1)t.values[r]+=(1-t.values[r])*e;return bt(t)}const _i=()=>({text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:de.white,default:de.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}),wi={primary:{main:Te[700],light:Te[400],dark:Te[800]},secondary:{main:$e[500],light:$e[300],dark:$e[700]},error:{main:Ee[700],light:Ee[400],dark:Ee[800]},info:{main:Oe[700],light:Oe[800],dark:Oe[900]},success:{main:ke[800],light:ke[500],dark:ke[900]},warning:{main:"#ED6C02",light:ze[500],dark:ze[900]}},Si=()=>({text:{primary:de.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:de.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}),Ei={primary:{main:Te[200],light:Te[50],dark:Te[400]},secondary:{main:$e[200],light:$e[50],dark:$e[400]},error:{main:Ee[500],light:Ee[300],dark:Ee[700]},info:{main:Oe[400],light:Oe[300],dark:Oe[700]},success:{main:ke[400],light:ke[300],dark:ke[700]},warning:{main:ze[400],light:ze[300],dark:ze[700]}},$i={light:_i,dark:Si};function er(n,e){return yi(n,de.white)>=e?de.white:"rgba(0, 0, 0, 0.87)"}function yn(n,e,t,r){const s=typeof r=="number"?r:r.light,i=typeof r=="number"?r*1.5:r.dark;n[e]||(n.hasOwnProperty(t)?n[e]=n[t]:e==="light"?n.light=bi(n.main,s):e==="dark"&&(n.dark=vi(n.main,i)))}function Ti(n){var r,s,i;const e=S({},n.color),t=(r=n.mainShade)!=null?r:500;return!n.color.main&&n.color[t]&&(e.main=n.color[t]),yn(e,"light",(s=n.lightShade)!=null?s:300,n.tonalOffset),yn(e,"dark",(i=n.darkShade)!=null?i:700,n.tonalOffset),e.contrastText||(e.contrastText=er(e.main,n.contrastThreshold)),e}const Oi=()=>({mode:"light",tonalOffset:.2,contrastThreshold:3,grey:pi,common:de});function ki(n){var i;const e=["error","info","primary","secondary","success","warning"],t=Oi(),r=K(S({},We({},t,$i[(i=n==null?void 0:n.mode)!=null?i:t.mode](),n)),{isColorName(o){return e.includes(o)},getColorObject(o){return r[o]},getColor(o){return r.mode==="light"?r[o].light:r[o].dark},augmentColor(o){return Ti(K(S({},o),{tonalOffset:r.tonalOffset,contrastThreshold:r.contrastThreshold}))},getContrastText(o){return er(o,r.contrastThreshold)}}),s=o=>r.mode==="light"?wi[o]:Ei[o];return r.primary=r.augmentColor({color:r.primary||s("primary")}),r.secondary=r.augmentColor({color:r.secondary||s("secondary"),mainShade:"A400",lightShade:"A200",darkShade:"A700"}),r.error=r.augmentColor({color:r.error||s("error")}),r.warning=r.augmentColor({color:r.warning||s("warning")}),r.info=r.augmentColor({color:r.info||s("info")}),r.success=r.augmentColor({color:r.success||s("success")}),r}const Ot={},Ai=.2,xi=.14,Ri=.12;function C(...n){return[`${n[0]}px ${n[1]}px ${n[2]}px ${n[3]}px rgba(0,0,0,${Ai})`,`${n[4]}px ${n[5]}px ${n[6]}px ${n[7]}px rgba(0,0,0,${xi})`,`${n[8]}px ${n[9]}px ${n[10]}px ${n[11]}px rgba(0,0,0,${Ri})`].join(",")}const ji=[()=>"none",()=>C(0,2,1,-1,0,1,1,0,0,1,3,0),()=>C(0,3,1,-2,0,2,2,0,0,1,5,0),()=>C(0,3,3,-2,0,3,4,0,0,1,8,0),()=>C(0,2,4,-1,0,4,5,0,0,1,10,0),()=>C(0,3,5,-1,0,5,8,0,0,1,14,0),()=>C(0,3,5,-1,0,6,10,0,0,1,18,0),()=>C(0,4,5,-2,0,7,10,1,0,2,16,1),()=>C(0,5,5,-3,0,8,10,1,0,3,14,2),()=>C(0,5,6,-3,0,9,12,1,0,3,16,2),()=>C(0,6,6,-3,0,10,14,1,0,4,18,3),()=>C(0,6,7,-4,0,11,15,1,0,4,20,3),()=>C(0,7,8,-4,0,12,17,2,0,5,22,4),()=>C(0,7,8,-4,0,13,19,2,0,5,24,4),()=>C(0,7,9,-4,0,14,21,2,0,5,26,4),()=>C(0,8,9,-5,0,15,22,2,0,6,28,5),()=>C(0,8,10,-5,0,16,24,2,0,6,30,5),()=>C(0,8,11,-5,0,17,26,2,0,6,32,5),()=>C(0,9,11,-5,0,18,28,2,0,7,34,6),()=>C(0,9,12,-6,0,19,29,2,0,7,36,6),()=>C(0,10,13,-6,0,20,31,3,0,8,38,7),()=>C(0,10,13,-6,0,21,33,3,0,8,40,7),()=>C(0,10,14,-6,0,22,35,3,0,8,42,7),()=>C(0,11,14,-7,0,23,36,3,0,9,44,8),()=>C(0,11,15,-7,0,24,38,3,0,9,46,8)];function Ci(){return new Proxy([],{get:(n,e)=>typeof e!="string"||isNaN(Number(e))?n[e]:e in Ot?Ot[e]:Ot[e]=ji[e]()})}const Pi={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Ii={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function vn(n){return`${Math.round(n)}ms`}function Ni(n){if(!n)return 0;const e=n/36;return Math.round((4+15*e**.25+e/5)*10)}function Di(n){const e=S(S({},Pi),n.easing),t=S(S({},Ii),n.duration);return K(S({getAutoHeightDuration:Ni,create:(s=["all"],i={})=>{const c=i,{duration:o=t.standard,easing:a=e.easeInOut,delay:l=0}=c,u=nn(c,["duration","easing","delay"]);return(Array.isArray(s)?s:[s]).map(h=>`${h} ${typeof o=="string"?o:vn(o)} ${a} ${typeof l=="string"?l:vn(l)}`).join(",")}},n),{easing:e,duration:t})}const X={light:300,regular:400,medium:500,bold:700},tt={fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif',fontSize:14,htmlFontSize:16,h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},subtitle1:{},subtitle2:{},body1:{},body2:{},button:{},caption:{},overline:{},fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:700};function Ui(n){return Math.round(n*1e5)/1e5}function Y(n,e,t,r,s,i){return S({fontFamily:n.fontFamily,fontWeight:e,fontSize:n.pxToRem(t),lineHeight:`${r}`,letterSpacing:`${Ui(s/t)}em`},i?{textTransform:"uppercase"}:{})}function Bi(n={}){var t,r,s;const e={fontFamily:(t=n.fontFamily)!=null?t:tt.fontFamily,fontSize:(r=n.fontSize)!=null?r:tt.fontSize,htmlFontSize:(s=n==null?void 0:n.htmlFontSize)!=null?s:tt.htmlFontSize,pxToRem:i=>{const o=e.fontSize/14;return`${i/e.htmlFontSize*o}rem`}};return We(e,{h1:Y(e,X.light,96,1.167,-1.5),h2:Y(e,X.light,60,1.2,-.5),h3:Y(e,X.regular,48,1.167,0),h4:Y(e,X.regular,34,1.235,.25),h5:Y(e,X.regular,24,1.334,0),h6:Y(e,X.medium,20,1.6,.15),subtitle1:Y(e,X.regular,16,1.75,.15),subtitle2:Y(e,X.medium,14,1.57,.1),body1:Y(e,X.regular,16,1.5,.15),body2:Y(e,X.regular,14,1.43,.15),button:Y(e,X.medium,14,1.75,.4,!0),caption:Y(e,X.regular,12,1.66,.4),overline:Y(e,X.regular,12,2.66,1,!0)},tt,n)}const Fi={mobileStepper:1e3,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function Li(n){return S({},We({},Fi,n))}function Mi(n={}){const e=S({direction:"ltr"},n);function t(r,s){const i=n[r];Object.defineProperty(e,r,S({configurable:!0,enumerable:!0},typeof i=="function"?{get:i}:{value:s({[r]:i})}))}return t("breakpoints",r=>Mn(r.breakpoints)),t("components",r=>fi(r.components)),t("palette",r=>ki(r.palette)),t("shape",r=>Gn(r.shape)),t("spacing",r=>zn(r.spacing)),t("typography",r=>Bi(r.typography)),t("shadows",()=>Ci()),t("transitions",()=>Di({})),t("zIndex",r=>Li(r.zIndex)),t("mixins",()=>di(e.breakpoints)),e}var zi=Hn(Mi);function Gi(n=zi){return Jn(n,Jt)}const Hi=Yn()({name:"MuiCssBaseline",selfPropNames:["children","enableColorScheme"],propDefaults:({set:n})=>n({enableColorScheme:!1})}),Ji=(n,e)=>S({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%"},e&&{colorScheme:n.palette.mode}),qi=n=>K(S({color:n.palette.text.primary},n.typography.body1),{backgroundColor:n.palette.background.default,"@media print":{backgroundColor:n.palette.common.white}}),Vi=(n,e=!1)=>({html:Ji(n,e),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:n.typography.fontWeightBold},body:K(S({margin:0},qi(n)),{"&::backdrop":{backgroundColor:n.palette.background.default}})}),Wi=Hi.component(function({props:e}){const t=Gi();return $(ui,{get styles(){return Vi(t,e.enableColorScheme)}})});var tr=Ve(),Ki=n=>$(tr.Provider,{get value(){return n.client},get children(){return n.children}}),nr=()=>{let n=je(tr);if(!n)throw new Error("createSupabase must be used within a SupabaseContext.Provider");return n};function Xi(){return nr().auth}function rc(n){let e=nr(),{data:t}=e.auth.onAuthStateChange((r,s)=>{n(r,s)});re(()=>{e.auth.session()&&n("SIGNED_IN",e.auth.session()),oe(()=>{t==null||t.unsubscribe()})})}const Yi=n=>{const e=Xi();return $(Gt,{get when(){return e.user()},get fallback(){return $(xs,{get href(){return n.fallback}})},get children(){return n.children}})},Qi=Pe(()=>Ie(()=>import("./index.7d797b7f.js"),["assets/index.7d797b7f.js","assets/getDeviceId.e8f3946a.js","assets/ButtonBase.9bf595f5.js","assets/SvgIcon.c425712b.js","assets/isHostComponent.9ebad583.js","assets/ListItemText.52d31dfa.js"])),Zi=Pe(()=>Ie(()=>import("./index.9a756780.js"),["assets/index.9a756780.js","assets/Button.f5ab4cd7.js","assets/ButtonBase.9bf595f5.js","assets/getDeviceId.e8f3946a.js","assets/solid.5ae8e60d.js"])),eo=Pe(()=>Ie(()=>import("./index.3e50c9ce.js"),["assets/index.3e50c9ce.js","assets/Button.f5ab4cd7.js","assets/ButtonBase.9bf595f5.js","assets/TextField.2ea54ac2.js","assets/isHostComponent.9ebad583.js","assets/Popover.e8cf0efd.js","assets/SvgIcon.c425712b.js","assets/solid.5ae8e60d.js","assets/getDeviceId.e8f3946a.js","assets/ListItemText.52d31dfa.js"])),to=Pe(()=>Ie(()=>import("./index.016e8a17.js"),["assets/index.016e8a17.js","assets/Popover.e8cf0efd.js","assets/SvgIcon.c425712b.js","assets/ButtonBase.9bf595f5.js","assets/isHostComponent.9ebad583.js","assets/solid.5ae8e60d.js","assets/getDeviceId.e8f3946a.js","assets/Button.f5ab4cd7.js","assets/index.c1adcc6d.js","assets/index.276fa080.css","assets/index.79b5287a.js"])),no=Pe(()=>Ie(()=>import("./index.b61bf03f.js"),["assets/index.b61bf03f.js","assets/Button.f5ab4cd7.js","assets/ButtonBase.9bf595f5.js","assets/TextField.2ea54ac2.js","assets/isHostComponent.9ebad583.js","assets/index.c1adcc6d.js","assets/index.276fa080.css"])),ro=Pe(()=>Ie(()=>import("./index.b2b53b3b.js"),["assets/index.b2b53b3b.js","assets/Button.f5ab4cd7.js","assets/ButtonBase.9bf595f5.js","assets/TextField.2ea54ac2.js","assets/isHostComponent.9ebad583.js","assets/solid.5ae8e60d.js","assets/getDeviceId.e8f3946a.js","assets/index.79b5287a.js"])),so=()=>[$(Wi,{}),$(ks,{get children(){return[$(ye,{path:"/",get element(){return $(Yi,{fallback:"/login",get children(){return $(eo,{})}})}}),$(ye,{path:"/login",get element(){return $(Qi,{})}}),$(ye,{path:"/user",get element(){return $(Zi,{})}}),$(ye,{path:"/dev-draw-broad",get element(){return $(no,{})}}),$(ye,{path:"/rooms/:id",get element(){return $(to,{})}}),$(ye,{path:"/dev-mesh",get element(){return $(ro,{})}})]}})];var bn={url:"https://ocfdltqnwejgikshcagx.supabase.co",key:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9jZmRsdHFud2VqZ2lrc2hjYWd4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTA1MDkzNTEsImV4cCI6MTk2NjA4NTM1MX0.M7XD6RGPFsggSzG-JrfXvkW01wXD9JjQmIajKIc8N3o"};const io="1.35.3",rr={"X-Client-Info":`supabase-js/${io}`},oo="supabase.auth.token";function ao(n){return n.replace(/\/$/,"")}const co=()=>typeof window!="undefined",lo="1.22.15",uo="http://localhost:9999",ho={"X-Client-Info":`gotrue-js/${lo}`},nt=10,ae={ERROR_MESSAGE:"Request Failed",MAX_RETRIES:10,RETRY_INTERVAL:2},De="supabase.auth.token",fo={name:"sb",lifetime:60*60*8,domain:"",path:"/",sameSite:"lax"};var Ke=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};const po=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),mo=(n,e)=>{if(!(n!=null&&n.status))return e({message:ae.ERROR_MESSAGE});if(typeof n.json!="function")return e(n);n.json().then(t=>e({message:po(t),status:(n==null?void 0:n.status)||500}))},go=(n,e,t)=>{const r={method:n,headers:(e==null?void 0:e.headers)||{}};return n==="GET"||(r.headers=Object.assign({"Content-Type":"text/plain;charset=UTF-8"},e==null?void 0:e.headers),r.body=JSON.stringify(t)),r};function _t(n,e,t,r,s){return Ke(this,void 0,void 0,function*(){return new Promise((i,o)=>{n(t,go(e,r,s)).then(a=>{if(!a.ok)throw a;return r!=null&&r.noResolveJson?i:a.json()}).then(a=>i(a)).catch(a=>mo(a,o))})})}function kt(n,e,t){return Ke(this,void 0,void 0,function*(){return _t(n,"GET",e,t)})}function H(n,e,t,r){return Ke(this,void 0,void 0,function*(){return _t(n,"POST",e,r,t)})}function _n(n,e,t,r){return Ke(this,void 0,void 0,function*(){return _t(n,"PUT",e,r,t)})}function yo(n,e,t,r){return Ke(this,void 0,void 0,function*(){return _t(n,"DELETE",e,r,t)})}function vo(n,e,t){const r=t||{},s=encodeURIComponent,i=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;if(typeof s!="function")throw new TypeError("option encode is invalid");if(!i.test(n))throw new TypeError("argument name is invalid");const o=s(e);if(o&&!i.test(o))throw new TypeError("argument val is invalid");let a=n+"="+o;if(r.maxAge!=null){const l=r.maxAge-0;if(isNaN(l)||!isFinite(l))throw new TypeError("option maxAge is invalid");a+="; Max-Age="+Math.floor(l)}if(r.domain){if(!i.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain="+r.domain}if(r.path){if(!i.test(r.path))throw new TypeError("option path is invalid");a+="; Path="+r.path}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return a}function bo(n){if(!n||!n.headers||!n.headers.host)throw new Error('The "host" request header is not available');const e=n.headers.host.indexOf(":")>-1&&n.headers.host.split(":")[0]||n.headers.host;return!(["localhost","127.0.0.1"].indexOf(e)>-1||e.endsWith(".local"))}function _o(n,e){var t,r,s;return vo(n.name,n.value,{maxAge:n.maxAge,expires:new Date(Date.now()+n.maxAge*1e3),httpOnly:!0,secure:e,path:(t=n.path)!==null&&t!==void 0?t:"/",domain:(r=n.domain)!==null&&r!==void 0?r:"",sameSite:(s=n.sameSite)!==null&&s!==void 0?s:"lax"})}function It(n,e,t){const r=t.map(i=>_o(i,bo(n))),s=e.getHeader("Set-Cookie");return s&&(s instanceof Array?Array.prototype.push.apply(r,s):typeof s=="string"&&r.push(s)),r}function rt(n,e,t){e.setHeader("Set-Cookie",It(n,e,t))}var wo=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function sr(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Nt={exports:{}};(function(n,e){var t=typeof self!="undefined"?self:wo,r=function(){function i(){this.fetch=!1,this.DOMException=t.DOMException}return i.prototype=t,new i}();(function(i){(function(o){var a={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function l(f){return f&&DataView.prototype.isPrototypeOf(f)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(f){return f&&u.indexOf(Object.prototype.toString.call(f))>-1};function h(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function p(f){return typeof f!="string"&&(f=String(f)),f}function d(f){var m={next:function(){var b=f.shift();return{done:b===void 0,value:b}}};return a.iterable&&(m[Symbol.iterator]=function(){return m}),m}function g(f){this.map={},f instanceof g?f.forEach(function(m,b){this.append(b,m)},this):Array.isArray(f)?f.forEach(function(m){this.append(m[0],m[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(m){this.append(m,f[m])},this)}g.prototype.append=function(f,m){f=h(f),m=p(m);var b=this.map[f];this.map[f]=b?b+", "+m:m},g.prototype.delete=function(f){delete this.map[h(f)]},g.prototype.get=function(f){return f=h(f),this.has(f)?this.map[f]:null},g.prototype.has=function(f){return this.map.hasOwnProperty(h(f))},g.prototype.set=function(f,m){this.map[h(f)]=p(m)},g.prototype.forEach=function(f,m){for(var b in this.map)this.map.hasOwnProperty(b)&&f.call(m,this.map[b],b,this)},g.prototype.keys=function(){var f=[];return this.forEach(function(m,b){f.push(b)}),d(f)},g.prototype.values=function(){var f=[];return this.forEach(function(m){f.push(m)}),d(f)},g.prototype.entries=function(){var f=[];return this.forEach(function(m,b){f.push([b,m])}),d(f)},a.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function v(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function _(f){return new Promise(function(m,b){f.onload=function(){m(f.result)},f.onerror=function(){b(f.error)}})}function U(f){var m=new FileReader,b=_(m);return m.readAsArrayBuffer(f),b}function P(f){var m=new FileReader,b=_(m);return m.readAsText(f),b}function j(f){for(var m=new Uint8Array(f),b=new Array(m.length),B=0;B<m.length;B++)b[B]=String.fromCharCode(m[B]);return b.join("")}function L(f){if(f.slice)return f.slice(0);var m=new Uint8Array(f.byteLength);return m.set(new Uint8Array(f)),m.buffer}function M(){return this.bodyUsed=!1,this._initBody=function(f){this._bodyInit=f,f?typeof f=="string"?this._bodyText=f:a.blob&&Blob.prototype.isPrototypeOf(f)?this._bodyBlob=f:a.formData&&FormData.prototype.isPrototypeOf(f)?this._bodyFormData=f:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)?this._bodyText=f.toString():a.arrayBuffer&&a.blob&&l(f)?(this._bodyArrayBuffer=L(f.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(f)||c(f))?this._bodyArrayBuffer=L(f):this._bodyText=f=Object.prototype.toString.call(f):this._bodyText="",this.headers.get("content-type")||(typeof f=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(f)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var f=v(this);if(f)return f;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(U)}),this.text=function(){var f=v(this);if(f)return f;if(this._bodyBlob)return P(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(j(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(E)}),this.json=function(){return this.text().then(JSON.parse)},this}var te=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(f){var m=f.toUpperCase();return te.indexOf(m)>-1?m:f}function y(f,m){m=m||{};var b=m.body;if(f instanceof y){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,m.headers||(this.headers=new g(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!b&&f._bodyInit!=null&&(b=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=m.credentials||this.credentials||"same-origin",(m.headers||!this.headers)&&(this.headers=new g(m.headers)),this.method=w(m.method||this.method||"GET"),this.mode=m.mode||this.mode||null,this.signal=m.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&b)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(b)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})};function E(f){var m=new FormData;return f.trim().split("&").forEach(function(b){if(b){var B=b.split("="),D=B.shift().replace(/\+/g," "),T=B.join("=").replace(/\+/g," ");m.append(decodeURIComponent(D),decodeURIComponent(T))}}),m}function V(f){var m=new g,b=f.replace(/\r?\n[\t ]+/g," ");return b.split(/\r?\n/).forEach(function(B){var D=B.split(":"),T=D.shift().trim();if(T){var Qe=D.join(":").trim();m.append(T,Qe)}}),m}M.call(y.prototype);function z(f,m){m||(m={}),this.type="default",this.status=m.status===void 0?200:m.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in m?m.statusText:"OK",this.headers=new g(m.headers),this.url=m.url||"",this._initBody(f)}M.call(z.prototype),z.prototype.clone=function(){return new z(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},z.error=function(){var f=new z(null,{status:0,statusText:""});return f.type="error",f};var Ye=[301,302,303,307,308];z.redirect=function(f,m){if(Ye.indexOf(m)===-1)throw new RangeError("Invalid status code");return new z(null,{status:m,headers:{location:f}})},o.DOMException=i.DOMException;try{new o.DOMException}catch{o.DOMException=function(m,b){this.message=m,this.name=b;var B=Error(m);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Z(f,m){return new Promise(function(b,B){var D=new y(f,m);if(D.signal&&D.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function Qe(){T.abort()}T.onload=function(){var Ne={status:T.status,statusText:T.statusText,headers:V(T.getAllResponseHeaders()||"")};Ne.url="responseURL"in T?T.responseURL:Ne.headers.get("X-Request-URL");var Et="response"in T?T.response:T.responseText;b(new z(Et,Ne))},T.onerror=function(){B(new TypeError("Network request failed"))},T.ontimeout=function(){B(new TypeError("Network request failed"))},T.onabort=function(){B(new o.DOMException("Aborted","AbortError"))},T.open(D.method,D.url,!0),D.credentials==="include"?T.withCredentials=!0:D.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&a.blob&&(T.responseType="blob"),D.headers.forEach(function(Ne,Et){T.setRequestHeader(Et,Ne)}),D.signal&&(D.signal.addEventListener("abort",Qe),T.onreadystatechange=function(){T.readyState===4&&D.signal.removeEventListener("abort",Qe)}),T.send(typeof D._bodyInit=="undefined"?null:D._bodyInit)})}return Z.polyfill=!0,i.fetch||(i.fetch=Z,i.Headers=g,i.Request=y,i.Response=z),o.Headers=g,o.Request=y,o.Response=z,o.fetch=Z,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var s=r;e=s.fetch,e.default=s.fetch,e.fetch=s.fetch,e.Headers=s.Headers,e.Request=s.Request,e.Response=s.Response,n.exports=e})(Nt,Nt.exports);var wt=sr(Nt.exports),Kt=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};function se(n){return Math.round(Date.now()/1e3)+n}function So(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const e=Math.random()*16|0;return(n=="x"?e:e&3|8).toString(16)})}const ne=()=>typeof window!="undefined";function ie(n,e){var t;e||(e=((t=window==null?void 0:window.location)===null||t===void 0?void 0:t.href)||""),n=n.replace(/[\[\]]/g,"\\$&");const r=new RegExp("[?&#]"+n+"(=([^&#]*)|&|#|$)"),s=r.exec(e);return s?s[2]?decodeURIComponent(s[2].replace(/\+/g," ")):"":null}const Eo=n=>{let e;return n?e=n:typeof fetch=="undefined"?e=wt:e=fetch,(...t)=>e(...t)},$o=(n,e,t)=>Kt(void 0,void 0,void 0,function*(){ne()&&(yield n==null?void 0:n.setItem(e,JSON.stringify(t)))}),To=(n,e)=>Kt(void 0,void 0,void 0,function*(){const t=ne()&&(yield n==null?void 0:n.getItem(e));if(!t)return null;try{return JSON.parse(t)}catch{return t}}),Oo=(n,e)=>{const t=ne()&&(n==null?void 0:n.getItem(e));if(!t||typeof t!="string")return null;try{return JSON.parse(t)}catch{return t}},ko=(n,e)=>Kt(void 0,void 0,void 0,function*(){ne()&&(yield n==null?void 0:n.removeItem(e))});var I=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};class Ao{constructor({url:e="",headers:t={},cookieOptions:r,fetch:s}){this.url=e,this.headers=t,this.cookieOptions=Object.assign(Object.assign({},fo),r),this.fetch=Eo(s)}_createRequestHeaders(e){const t=Object.assign({},this.headers);return t.Authorization=`Bearer ${e}`,t}cookieName(){var e;return(e=this.cookieOptions.name)!==null&&e!==void 0?e:""}getUrlForProvider(e,t){const r=[`provider=${encodeURIComponent(e)}`];return t!=null&&t.redirectTo&&r.push(`redirect_to=${encodeURIComponent(t.redirectTo)}`),t!=null&&t.scopes&&r.push(`scopes=${encodeURIComponent(t.scopes)}`),`${this.url}/authorize?${r.join("&")}`}signUpWithEmail(e,t,r={}){return I(this,void 0,void 0,function*(){try{const s=Object.assign({},this.headers);let i="";r.redirectTo&&(i="?redirect_to="+encodeURIComponent(r.redirectTo));const o=yield H(this.fetch,`${this.url}/signup${i}`,{email:e,password:t,data:r.data,gotrue_meta_security:{hcaptcha_token:r.captchaToken}},{headers:s}),a=Object.assign({},o);return a.expires_in&&(a.expires_at=se(o.expires_in)),{data:a,error:null}}catch(s){return{data:null,error:s}}})}signInWithEmail(e,t,r={}){return I(this,void 0,void 0,function*(){try{const s=Object.assign({},this.headers);let i="?grant_type=password";r.redirectTo&&(i+="&redirect_to="+encodeURIComponent(r.redirectTo));const o=yield H(this.fetch,`${this.url}/token${i}`,{email:e,password:t},{headers:s}),a=Object.assign({},o);return a.expires_in&&(a.expires_at=se(o.expires_in)),{data:a,error:null}}catch(s){return{data:null,error:s}}})}signUpWithPhone(e,t,r={}){return I(this,void 0,void 0,function*(){try{const s=Object.assign({},this.headers),i=yield H(this.fetch,`${this.url}/signup`,{phone:e,password:t,data:r.data,gotrue_meta_security:{hcaptcha_token:r.captchaToken}},{headers:s}),o=Object.assign({},i);return o.expires_in&&(o.expires_at=se(i.expires_in)),{data:o,error:null}}catch(s){return{data:null,error:s}}})}signInWithPhone(e,t){return I(this,void 0,void 0,function*(){try{const r=Object.assign({},this.headers),s="?grant_type=password",i=yield H(this.fetch,`${this.url}/token${s}`,{phone:e,password:t},{headers:r}),o=Object.assign({},i);return o.expires_in&&(o.expires_at=se(i.expires_in)),{data:o,error:null}}catch(r){return{data:null,error:r}}})}signInWithOpenIDConnect({id_token:e,nonce:t,client_id:r,issuer:s,provider:i}){return I(this,void 0,void 0,function*(){try{const o=Object.assign({},this.headers),a="?grant_type=id_token",l=yield H(this.fetch,`${this.url}/token${a}`,{id_token:e,nonce:t,client_id:r,issuer:s,provider:i},{headers:o}),u=Object.assign({},l);return u.expires_in&&(u.expires_at=se(l.expires_in)),{data:u,error:null}}catch(o){return{data:null,error:o}}})}sendMagicLinkEmail(e,t={}){var r;return I(this,void 0,void 0,function*(){try{const s=Object.assign({},this.headers);let i="";t.redirectTo&&(i+="?redirect_to="+encodeURIComponent(t.redirectTo));const o=(r=t.shouldCreateUser)!==null&&r!==void 0?r:!0;return{data:yield H(this.fetch,`${this.url}/otp${i}`,{email:e,create_user:o,gotrue_meta_security:{hcaptcha_token:t.captchaToken}},{headers:s}),error:null}}catch(s){return{data:null,error:s}}})}sendMobileOTP(e,t={}){var r;return I(this,void 0,void 0,function*(){try{const s=(r=t.shouldCreateUser)!==null&&r!==void 0?r:!0,i=Object.assign({},this.headers);return{data:yield H(this.fetch,`${this.url}/otp`,{phone:e,create_user:s,gotrue_meta_security:{hcaptcha_token:t.captchaToken}},{headers:i}),error:null}}catch(s){return{data:null,error:s}}})}signOut(e){return I(this,void 0,void 0,function*(){try{return yield H(this.fetch,`${this.url}/logout`,{},{headers:this._createRequestHeaders(e),noResolveJson:!0}),{error:null}}catch(t){return{error:t}}})}verifyMobileOTP(e,t,r={}){return I(this,void 0,void 0,function*(){try{const s=Object.assign({},this.headers),i=yield H(this.fetch,`${this.url}/verify`,{phone:e,token:t,type:"sms",redirect_to:r.redirectTo},{headers:s}),o=Object.assign({},i);return o.expires_in&&(o.expires_at=se(i.expires_in)),{data:o,error:null}}catch(s){return{data:null,error:s}}})}verifyOTP({email:e,phone:t,token:r,type:s="sms"},i={}){return I(this,void 0,void 0,function*(){try{const o=Object.assign({},this.headers),a=yield H(this.fetch,`${this.url}/verify`,{email:e,phone:t,token:r,type:s,redirect_to:i.redirectTo},{headers:o}),l=Object.assign({},a);return l.expires_in&&(l.expires_at=se(a.expires_in)),{data:l,error:null}}catch(o){return{data:null,error:o}}})}inviteUserByEmail(e,t={}){return I(this,void 0,void 0,function*(){try{const r=Object.assign({},this.headers);let s="";return t.redirectTo&&(s+="?redirect_to="+encodeURIComponent(t.redirectTo)),{data:yield H(this.fetch,`${this.url}/invite${s}`,{email:e,data:t.data},{headers:r}),error:null}}catch(r){return{data:null,error:r}}})}resetPasswordForEmail(e,t={}){return I(this,void 0,void 0,function*(){try{const r=Object.assign({},this.headers);let s="";return t.redirectTo&&(s+="?redirect_to="+encodeURIComponent(t.redirectTo)),{data:yield H(this.fetch,`${this.url}/recover${s}`,{email:e,gotrue_meta_security:{hcaptcha_token:t.captchaToken}},{headers:r}),error:null}}catch(r){return{data:null,error:r}}})}refreshAccessToken(e){return I(this,void 0,void 0,function*(){try{const t=yield H(this.fetch,`${this.url}/token?grant_type=refresh_token`,{refresh_token:e},{headers:this.headers}),r=Object.assign({},t);return r.expires_in&&(r.expires_at=se(t.expires_in)),{data:r,error:null}}catch(t){return{data:null,error:t}}})}setAuthCookie(e,t){e.method!=="POST"&&(t.setHeader("Allow","POST"),t.status(405).end("Method Not Allowed"));const{event:r,session:s}=e.body;if(!r)throw new Error("Auth event missing!");if(r==="SIGNED_IN"){if(!s)throw new Error("Auth session missing!");rt(e,t,[{key:"access-token",value:s.access_token},{key:"refresh-token",value:s.refresh_token}].map(i=>{var o;return{name:`${this.cookieName()}-${i.key}`,value:i.value,domain:this.cookieOptions.domain,maxAge:(o=this.cookieOptions.lifetime)!==null&&o!==void 0?o:0,path:this.cookieOptions.path,sameSite:this.cookieOptions.sameSite}}))}r==="SIGNED_OUT"&&rt(e,t,["access-token","refresh-token"].map(i=>({name:`${this.cookieName()}-${i}`,value:"",maxAge:-1}))),t.status(200).json({})}deleteAuthCookie(e,t,{redirectTo:r="/"}){return rt(e,t,["access-token","refresh-token"].map(s=>({name:`${this.cookieName()}-${s}`,value:"",maxAge:-1}))),t.redirect(307,r)}getAuthCookieString(e,t){e.method!=="POST"&&(t.setHeader("Allow","POST"),t.status(405).end("Method Not Allowed"));const{event:r,session:s}=e.body;if(!r)throw new Error("Auth event missing!");if(r==="SIGNED_IN"){if(!s)throw new Error("Auth session missing!");return It(e,t,[{key:"access-token",value:s.access_token},{key:"refresh-token",value:s.refresh_token}].map(i=>{var o;return{name:`${this.cookieName()}-${i.key}`,value:i.value,domain:this.cookieOptions.domain,maxAge:(o=this.cookieOptions.lifetime)!==null&&o!==void 0?o:0,path:this.cookieOptions.path,sameSite:this.cookieOptions.sameSite}}))}return r==="SIGNED_OUT"?It(e,t,["access-token","refresh-token"].map(i=>({name:`${this.cookieName()}-${i}`,value:"",maxAge:-1}))):t.getHeader("Set-Cookie")}generateLink(e,t,r={}){return I(this,void 0,void 0,function*(){try{return{data:yield H(this.fetch,`${this.url}/admin/generate_link`,{type:e,email:t,password:r.password,data:r.data,redirect_to:r.redirectTo},{headers:this.headers}),error:null}}catch(s){return{data:null,error:s}}})}createUser(e){return I(this,void 0,void 0,function*(){try{const t=yield H(this.fetch,`${this.url}/admin/users`,e,{headers:this.headers});return{user:t,data:t,error:null}}catch(t){return{user:null,data:null,error:t}}})}listUsers(){return I(this,void 0,void 0,function*(){try{return{data:(yield kt(this.fetch,`${this.url}/admin/users`,{headers:this.headers})).users,error:null}}catch(e){return{data:null,error:e}}})}getUserById(e){return I(this,void 0,void 0,function*(){try{return{data:yield kt(this.fetch,`${this.url}/admin/users/${e}`,{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}})}getUserByCookie(e,t){return I(this,void 0,void 0,function*(){try{if(!e.cookies)throw new Error("Not able to parse cookies! When using Express make sure the cookie-parser middleware is in use!");const r=e.cookies[`${this.cookieName()}-access-token`],s=e.cookies[`${this.cookieName()}-refresh-token`];if(!r)throw new Error("No cookie found!");const{user:i,error:o}=yield this.getUser(r);if(o){if(!s)throw new Error("No refresh_token cookie found!");if(!t)throw new Error("You need to pass the res object to automatically refresh the session!");const{data:a,error:l}=yield this.refreshAccessToken(s);if(l)throw l;if(a)return rt(e,t,[{key:"access-token",value:a.access_token},{key:"refresh-token",value:a.refresh_token}].map(u=>{var c;return{name:`${this.cookieName()}-${u.key}`,value:u.value,domain:this.cookieOptions.domain,maxAge:(c=this.cookieOptions.lifetime)!==null&&c!==void 0?c:0,path:this.cookieOptions.path,sameSite:this.cookieOptions.sameSite}})),{token:a.access_token,user:a.user,data:a.user,error:null}}return{token:r,user:i,data:i,error:null}}catch(r){return{token:null,user:null,data:null,error:r}}})}updateUserById(e,t){return I(this,void 0,void 0,function*(){try{const r=yield _n(this.fetch,`${this.url}/admin/users/${e}`,t,{headers:this.headers});return{user:r,data:r,error:null}}catch(r){return{user:null,data:null,error:r}}})}deleteUser(e){return I(this,void 0,void 0,function*(){try{const t=yield yo(this.fetch,`${this.url}/admin/users/${e}`,{},{headers:this.headers});return{user:t,data:t,error:null}}catch(t){return{user:null,data:null,error:t}}})}getUser(e){return I(this,void 0,void 0,function*(){try{const t=yield kt(this.fetch,`${this.url}/user`,{headers:this._createRequestHeaders(e)});return{user:t,data:t,error:null}}catch(t){return{user:null,data:null,error:t}}})}updateUser(e,t){return I(this,void 0,void 0,function*(){try{const r=yield _n(this.fetch,`${this.url}/user`,t,{headers:this._createRequestHeaders(e)});return{user:r,data:r,error:null}}catch(r){return{user:null,data:null,error:r}}})}}function xo(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self!="undefined"&&(self.globalThis=self)}}var J=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};xo();const Ro={url:uo,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,multiTab:!0,headers:ho};class jo{constructor(e){this.stateChangeEmitters=new Map,this.networkRetries=0;const t=Object.assign(Object.assign({},Ro),e);this.currentUser=null,this.currentSession=null,this.autoRefreshToken=t.autoRefreshToken,this.persistSession=t.persistSession,this.multiTab=t.multiTab,this.localStorage=t.localStorage||globalThis.localStorage,this.api=new Ao({url:t.url,headers:t.headers,cookieOptions:t.cookieOptions,fetch:t.fetch}),this._recoverSession(),this._recoverAndRefresh(),this._listenForMultiTabEvents(),this._handleVisibilityChange(),t.detectSessionInUrl&&ne()&&!!ie("access_token")&&this.getSessionFromUrl({storeSession:!0}).then(({error:r})=>{r&&console.error("Error getting session from URL.",r)})}signUp({email:e,password:t,phone:r},s={}){return J(this,void 0,void 0,function*(){try{this._removeSession();const{data:i,error:o}=r&&t?yield this.api.signUpWithPhone(r,t,{data:s.data,captchaToken:s.captchaToken}):yield this.api.signUpWithEmail(e,t,{redirectTo:s.redirectTo,data:s.data,captchaToken:s.captchaToken});if(o)throw o;if(!i)throw"An error occurred on sign up.";let a=null,l=null;return i.access_token&&(a=i,l=a.user,this._saveSession(a),this._notifyAllSubscribers("SIGNED_IN")),i.id&&(l=i),{user:l,session:a,error:null}}catch(i){return{user:null,session:null,error:i}}})}signIn({email:e,phone:t,password:r,refreshToken:s,provider:i,oidc:o},a={}){return J(this,void 0,void 0,function*(){try{if(this._removeSession(),e&&!r){const{error:l}=yield this.api.sendMagicLinkEmail(e,{redirectTo:a.redirectTo,shouldCreateUser:a.shouldCreateUser,captchaToken:a.captchaToken});return{user:null,session:null,error:l}}if(e&&r)return this._handleEmailSignIn(e,r,{redirectTo:a.redirectTo});if(t&&!r){const{error:l}=yield this.api.sendMobileOTP(t,{shouldCreateUser:a.shouldCreateUser,captchaToken:a.captchaToken});return{user:null,session:null,error:l}}if(t&&r)return this._handlePhoneSignIn(t,r);if(s){const{error:l}=yield this._callRefreshToken(s);if(l)throw l;return{user:this.currentUser,session:this.currentSession,error:null}}if(i)return this._handleProviderSignIn(i,{redirectTo:a.redirectTo,scopes:a.scopes});if(o)return this._handleOpenIDConnectSignIn(o);throw new Error("You must provide either an email, phone number, a third-party provider or OpenID Connect.")}catch(l){return{user:null,session:null,error:l}}})}verifyOTP(e,t={}){return J(this,void 0,void 0,function*(){try{this._removeSession();const{data:r,error:s}=yield this.api.verifyOTP(e,t);if(s)throw s;if(!r)throw"An error occurred on token verification.";let i=null,o=null;return r.access_token&&(i=r,o=i.user,this._saveSession(i),this._notifyAllSubscribers("SIGNED_IN")),r.id&&(o=r),{user:o,session:i,error:null}}catch(r){return{user:null,session:null,error:r}}})}user(){return this.currentUser}session(){return this.currentSession}refreshSession(){var e;return J(this,void 0,void 0,function*(){try{if(!(!((e=this.currentSession)===null||e===void 0)&&e.access_token))throw new Error("Not logged in.");const{error:t}=yield this._callRefreshToken();if(t)throw t;return{data:this.currentSession,user:this.currentUser,error:null}}catch(t){return{data:null,user:null,error:t}}})}update(e){var t;return J(this,void 0,void 0,function*(){try{if(!(!((t=this.currentSession)===null||t===void 0)&&t.access_token))throw new Error("Not logged in.");const{user:r,error:s}=yield this.api.updateUser(this.currentSession.access_token,e);if(s)throw s;if(!r)throw Error("Invalid user data.");const i=Object.assign(Object.assign({},this.currentSession),{user:r});return this._saveSession(i),this._notifyAllSubscribers("USER_UPDATED"),{data:r,user:r,error:null}}catch(r){return{data:null,user:null,error:r}}})}setSession(e){return J(this,void 0,void 0,function*(){try{if(!e)throw new Error("No current session.");const{data:t,error:r}=yield this.api.refreshAccessToken(e);return r?{session:null,error:r}:(this._saveSession(t),this._notifyAllSubscribers("SIGNED_IN"),{session:t,error:null})}catch(t){return{error:t,session:null}}})}setAuth(e){return this.currentSession=Object.assign(Object.assign({},this.currentSession),{access_token:e,token_type:"bearer",user:this.user()}),this._notifyAllSubscribers("TOKEN_REFRESHED"),this.currentSession}getSessionFromUrl(e){return J(this,void 0,void 0,function*(){try{if(!ne())throw new Error("No browser detected.");const t=ie("error_description");if(t)throw new Error(t);const r=ie("provider_token"),s=ie("access_token");if(!s)throw new Error("No access_token detected.");const i=ie("expires_in");if(!i)throw new Error("No expires_in detected.");const o=ie("refresh_token");if(!o)throw new Error("No refresh_token detected.");const a=ie("token_type");if(!a)throw new Error("No token_type detected.");const u=Math.round(Date.now()/1e3)+parseInt(i),{user:c,error:h}=yield this.api.getUser(s);if(h)throw h;const p={provider_token:r,access_token:s,expires_in:parseInt(i),expires_at:u,refresh_token:o,token_type:a,user:c};if(e!=null&&e.storeSession){this._saveSession(p);const d=ie("type");this._notifyAllSubscribers("SIGNED_IN"),d==="recovery"&&this._notifyAllSubscribers("PASSWORD_RECOVERY")}return window.location.hash="",{data:p,error:null}}catch(t){return{data:null,error:t}}})}signOut(){var e;return J(this,void 0,void 0,function*(){const t=(e=this.currentSession)===null||e===void 0?void 0:e.access_token;if(this._removeSession(),this._notifyAllSubscribers("SIGNED_OUT"),t){const{error:r}=yield this.api.signOut(t);if(r)return{error:r}}return{error:null}})}onAuthStateChange(e){try{const t=So(),r={id:t,callback:e,unsubscribe:()=>{this.stateChangeEmitters.delete(t)}};return this.stateChangeEmitters.set(t,r),{data:r,error:null}}catch(t){return{data:null,error:t}}}_handleEmailSignIn(e,t,r={}){var s,i;return J(this,void 0,void 0,function*(){try{const{data:o,error:a}=yield this.api.signInWithEmail(e,t,{redirectTo:r.redirectTo});return a||!o?{data:null,user:null,session:null,error:a}:((((s=o==null?void 0:o.user)===null||s===void 0?void 0:s.confirmed_at)||((i=o==null?void 0:o.user)===null||i===void 0?void 0:i.email_confirmed_at))&&(this._saveSession(o),this._notifyAllSubscribers("SIGNED_IN")),{data:o,user:o.user,session:o,error:null})}catch(o){return{data:null,user:null,session:null,error:o}}})}_handlePhoneSignIn(e,t){var r;return J(this,void 0,void 0,function*(){try{const{data:s,error:i}=yield this.api.signInWithPhone(e,t);return i||!s?{data:null,user:null,session:null,error:i}:(!((r=s==null?void 0:s.user)===null||r===void 0)&&r.phone_confirmed_at&&(this._saveSession(s),this._notifyAllSubscribers("SIGNED_IN")),{data:s,user:s.user,session:s,error:null})}catch(s){return{data:null,user:null,session:null,error:s}}})}_handleProviderSignIn(e,t={}){const r=this.api.getUrlForProvider(e,{redirectTo:t.redirectTo,scopes:t.scopes});try{return ne()&&(window.location.href=r),{provider:e,url:r,data:null,session:null,user:null,error:null}}catch(s){return r?{provider:e,url:r,data:null,session:null,user:null,error:null}:{data:null,user:null,session:null,error:s}}}_handleOpenIDConnectSignIn({id_token:e,nonce:t,client_id:r,issuer:s,provider:i}){return J(this,void 0,void 0,function*(){if(e&&t&&(r&&s||i))try{const{data:o,error:a}=yield this.api.signInWithOpenIDConnect({id_token:e,nonce:t,client_id:r,issuer:s,provider:i});return a||!o?{user:null,session:null,error:a}:(this._saveSession(o),this._notifyAllSubscribers("SIGNED_IN"),{user:o.user,session:o,error:null})}catch(o){return{user:null,session:null,error:o}}throw new Error("You must provide a OpenID Connect provider with your id token and nonce.")})}_recoverSession(){try{const e=Oo(this.localStorage,De);if(!e)return null;const{currentSession:t,expiresAt:r}=e,s=Math.round(Date.now()/1e3);r>=s+nt&&(t==null?void 0:t.user)&&(this._saveSession(t),this._notifyAllSubscribers("SIGNED_IN"))}catch(e){console.log("error",e)}}_recoverAndRefresh(){return J(this,void 0,void 0,function*(){try{const e=yield To(this.localStorage,De);if(!e)return null;const{currentSession:t,expiresAt:r}=e,s=Math.round(Date.now()/1e3);if(r<s+nt)if(this.autoRefreshToken&&t.refresh_token){this.networkRetries++;const{error:i}=yield this._callRefreshToken(t.refresh_token);if(i){if(console.log(i.message),i.message===ae.ERROR_MESSAGE&&this.networkRetries<ae.MAX_RETRIES){this.refreshTokenTimer&&clearTimeout(this.refreshTokenTimer),this.refreshTokenTimer=setTimeout(()=>this._recoverAndRefresh(),Math.pow(ae.RETRY_INTERVAL,this.networkRetries)*100);return}yield this._removeSession()}this.networkRetries=0}else this._removeSession();else t?(this._saveSession(t),this._notifyAllSubscribers("SIGNED_IN")):(console.log("Current session is missing data."),this._removeSession())}catch(e){return console.error(e),null}})}_callRefreshToken(e){var t;return e===void 0&&(e=(t=this.currentSession)===null||t===void 0?void 0:t.refresh_token),J(this,void 0,void 0,function*(){try{if(!e)throw new Error("No current session.");const{data:r,error:s}=yield this.api.refreshAccessToken(e);if(s)throw s;if(!r)throw Error("Invalid session data.");return this._saveSession(r),this._notifyAllSubscribers("TOKEN_REFRESHED"),this._notifyAllSubscribers("SIGNED_IN"),{data:r,error:null}}catch(r){return{data:null,error:r}}})}_notifyAllSubscribers(e){this.stateChangeEmitters.forEach(t=>t.callback(e,this.currentSession))}_saveSession(e){this.currentSession=e,this.currentUser=e.user;const t=e.expires_at;if(t){const r=Math.round(Date.now()/1e3),s=t-r,i=s>nt?nt:.5;this._startAutoRefreshToken((s-i)*1e3)}this.persistSession&&e.expires_at&&this._persistSession(this.currentSession)}_persistSession(e){const t={currentSession:e,expiresAt:e.expires_at};$o(this.localStorage,De,t)}_removeSession(){return J(this,void 0,void 0,function*(){this.currentSession=null,this.currentUser=null,this.refreshTokenTimer&&clearTimeout(this.refreshTokenTimer),ko(this.localStorage,De)})}_startAutoRefreshToken(e){this.refreshTokenTimer&&clearTimeout(this.refreshTokenTimer),!(e<=0||!this.autoRefreshToken)&&(this.refreshTokenTimer=setTimeout(()=>J(this,void 0,void 0,function*(){this.networkRetries++;const{error:t}=yield this._callRefreshToken();t||(this.networkRetries=0),(t==null?void 0:t.message)===ae.ERROR_MESSAGE&&this.networkRetries<ae.MAX_RETRIES&&this._startAutoRefreshToken(Math.pow(ae.RETRY_INTERVAL,this.networkRetries)*100)}),e),typeof this.refreshTokenTimer.unref=="function"&&this.refreshTokenTimer.unref())}_listenForMultiTabEvents(){if(!this.multiTab||!ne()||!(window!=null&&window.addEventListener))return!1;try{window==null||window.addEventListener("storage",e=>{var t;if(e.key===De){const r=JSON.parse(String(e.newValue));!((t=r==null?void 0:r.currentSession)===null||t===void 0)&&t.access_token?(this._saveSession(r.currentSession),this._notifyAllSubscribers("SIGNED_IN")):(this._removeSession(),this._notifyAllSubscribers("SIGNED_OUT"))}})}catch(e){console.error("_listenForMultiTabEvents",e)}}_handleVisibilityChange(){if(!this.multiTab||!ne()||!(window!=null&&window.addEventListener))return!1;try{window==null||window.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this._recoverAndRefresh()})}catch(e){console.error("_handleVisibilityChange",e)}}}class Co extends jo{constructor(e){super(e)}}var Po=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};class Xt{constructor(e){Object.assign(this,e);let t;e.fetch?t=e.fetch:typeof fetch=="undefined"?t=wt:t=fetch,this.fetch=(...r)=>t(...r),this.shouldThrowOnError=e.shouldThrowOnError||!1}throwOnError(e){return e==null&&(e=!0),this.shouldThrowOnError=e,this}then(e,t){typeof this.schema=="undefined"||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");let r=this.fetch(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(s=>Po(this,void 0,void 0,function*(){var i,o,a;let l=null,u=null,c=null;if(s.ok){const p=(i=this.headers.Prefer)===null||i===void 0?void 0:i.split(",").includes("return=minimal");if(this.method!=="HEAD"&&!p){const v=yield s.text();v&&(this.headers.Accept==="text/csv"?u=v:u=JSON.parse(v))}const d=(o=this.headers.Prefer)===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),g=(a=s.headers.get("content-range"))===null||a===void 0?void 0:a.split("/");d&&g&&g.length>1&&(c=parseInt(g[1]))}else{const p=yield s.text();try{l=JSON.parse(p)}catch{l={message:p}}if(l&&this.shouldThrowOnError)throw l}return{error:l,data:u,count:c,status:s.status,statusText:s.statusText,body:u}}));return this.shouldThrowOnError||(r=r.catch(s=>({error:{message:`FetchError: ${s.message}`,details:"",hint:"",code:s.code||""},data:null,body:null,count:null,status:400,statusText:"Bad Request"}))),r.then(e,t)}}class Yt extends Xt{select(e="*"){let t=!1;const r=e.split("").map(s=>/\s/.test(s)&&!t?"":(s==='"'&&(t=!t),s)).join("");return this.url.searchParams.set("select",r),this}order(e,{ascending:t=!0,nullsFirst:r=!1,foreignTable:s}={}){const i=typeof s=="undefined"?"order":`${s}.order`,o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}.${r?"nullsfirst":"nullslast"}`),this}limit(e,{foreignTable:t}={}){const r=typeof t=="undefined"?"limit":`${t}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:r}={}){const s=typeof r=="undefined"?"offset":`${r}.offset`,i=typeof r=="undefined"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){this.headers.Accept="application/vnd.pgrst.object+json";const e=new Yt(this);return e.then=(t,r)=>this.then(s=>{var i,o;return!((o=(i=s.error)===null||i===void 0?void 0:i.details)===null||o===void 0)&&o.includes("Results contain 0 rows")?t({error:null,data:null,count:s.count,status:200,statusText:"OK",body:null}):t(s)},r),e}csv(){return this.headers.Accept="text/csv",this}}class be extends Yt{constructor(){super(...arguments),this.cs=this.contains,this.cd=this.containedBy,this.sl=this.rangeLt,this.sr=this.rangeGt,this.nxl=this.rangeGte,this.nxr=this.rangeLte,this.adj=this.rangeAdjacent,this.ov=this.overlaps}not(e,t,r){return this.url.searchParams.append(`${e}`,`not.${t}.${r}`),this}or(e,{foreignTable:t}={}){const r=typeof t=="undefined"?"or":`${t}.or`;return this.url.searchParams.append(r,`(${e})`),this}eq(e,t){return this.url.searchParams.append(`${e}`,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(`${e}`,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(`${e}`,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(`${e}`,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(`${e}`,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(`${e}`,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(`${e}`,`like.${t}`),this}ilike(e,t){return this.url.searchParams.append(`${e}`,`ilike.${t}`),this}is(e,t){return this.url.searchParams.append(`${e}`,`is.${t}`),this}in(e,t){const r=t.map(s=>typeof s=="string"&&new RegExp("[,()]").test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(`${e}`,`in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(`${e}`,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(`${e}`,`cs.{${t.join(",")}}`):this.url.searchParams.append(`${e}`,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(`${e}`,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(`${e}`,`cd.{${t.join(",")}}`):this.url.searchParams.append(`${e}`,`cd.${JSON.stringify(t)}`),this}rangeLt(e,t){return this.url.searchParams.append(`${e}`,`sl.${t}`),this}rangeGt(e,t){return this.url.searchParams.append(`${e}`,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(`${e}`,`nxl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(`${e}`,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(`${e}`,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(`${e}`,`ov.${t}`):this.url.searchParams.append(`${e}`,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s=null}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");const o=r===void 0?"":`(${r})`;return this.url.searchParams.append(`${e}`,`${i}fts${o}.${t}`),this}fts(e,t,{config:r}={}){const s=typeof r=="undefined"?"":`(${r})`;return this.url.searchParams.append(`${e}`,`fts${s}.${t}`),this}plfts(e,t,{config:r}={}){const s=typeof r=="undefined"?"":`(${r})`;return this.url.searchParams.append(`${e}`,`plfts${s}.${t}`),this}phfts(e,t,{config:r}={}){const s=typeof r=="undefined"?"":`(${r})`;return this.url.searchParams.append(`${e}`,`phfts${s}.${t}`),this}wfts(e,t,{config:r}={}){const s=typeof r=="undefined"?"":`(${r})`;return this.url.searchParams.append(`${e}`,`wfts${s}.${t}`),this}filter(e,t,r){return this.url.searchParams.append(`${e}`,`${t}.${r}`),this}match(e){return Object.keys(e).forEach(t=>{this.url.searchParams.append(`${t}`,`eq.${e[t]}`)}),this}}class ir extends Xt{constructor(e,{headers:t={},schema:r,fetch:s,shouldThrowOnError:i}={}){super({fetch:s,shouldThrowOnError:i}),this.url=new URL(e),this.headers=Object.assign({},t),this.schema=r}select(e="*",{head:t=!1,count:r=null}={}){this.method="GET";let s=!1;const i=e.split("").map(o=>/\s/.test(o)&&!s?"":(o==='"'&&(s=!s),o)).join("");return this.url.searchParams.set("select",i),r&&(this.headers.Prefer=`count=${r}`),t&&(this.method="HEAD"),new be(this)}insert(e,{upsert:t=!1,onConflict:r,returning:s="representation",count:i=null}={}){this.method="POST";const o=[`return=${s}`];if(t&&o.push("resolution=merge-duplicates"),t&&r!==void 0&&this.url.searchParams.set("on_conflict",r),this.body=e,i&&o.push(`count=${i}`),this.headers.Prefer&&o.unshift(this.headers.Prefer),this.headers.Prefer=o.join(","),Array.isArray(e)){const a=e.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(a.length>0){const l=[...new Set(a)].map(u=>`"${u}"`);this.url.searchParams.set("columns",l.join(","))}}return new be(this)}upsert(e,{onConflict:t,returning:r="representation",count:s=null,ignoreDuplicates:i=!1}={}){this.method="POST";const o=[`resolution=${i?"ignore":"merge"}-duplicates`,`return=${r}`];return t!==void 0&&this.url.searchParams.set("on_conflict",t),this.body=e,s&&o.push(`count=${s}`),this.headers.Prefer&&o.unshift(this.headers.Prefer),this.headers.Prefer=o.join(","),new be(this)}update(e,{returning:t="representation",count:r=null}={}){this.method="PATCH";const s=[`return=${t}`];return this.body=e,r&&s.push(`count=${r}`),this.headers.Prefer&&s.unshift(this.headers.Prefer),this.headers.Prefer=s.join(","),new be(this)}delete({returning:e="representation",count:t=null}={}){this.method="DELETE";const r=[`return=${e}`];return t&&r.push(`count=${t}`),this.headers.Prefer&&r.unshift(this.headers.Prefer),this.headers.Prefer=r.join(","),new be(this)}}class Io extends Xt{constructor(e,{headers:t={},schema:r,fetch:s,shouldThrowOnError:i}={}){super({fetch:s,shouldThrowOnError:i}),this.url=new URL(e),this.headers=Object.assign({},t),this.schema=r}rpc(e,{head:t=!1,count:r=null}={}){return t?(this.method="HEAD",e&&Object.entries(e).forEach(([s,i])=>{this.url.searchParams.append(s,i)})):(this.method="POST",this.body=e),r&&(this.headers.Prefer!==void 0?this.headers.Prefer+=`,count=${r}`:this.headers.Prefer=`count=${r}`),new be(this)}}const No="0.37.2",Do={"X-Client-Info":`postgrest-js/${No}`};class Uo{constructor(e,{headers:t={},schema:r,fetch:s,throwOnError:i}={}){this.url=e,this.headers=Object.assign(Object.assign({},Do),t),this.schema=r,this.fetch=s,this.shouldThrowOnError=i}auth(e){return this.headers.Authorization=`Bearer ${e}`,this}from(e){const t=`${this.url}/${e}`;return new ir(t,{headers:this.headers,schema:this.schema,fetch:this.fetch,shouldThrowOnError:this.shouldThrowOnError})}rpc(e,t,{head:r=!1,count:s=null}={}){const i=`${this.url}/rpc/${e}`;return new Io(i,{headers:this.headers,schema:this.schema,fetch:this.fetch,shouldThrowOnError:this.shouldThrowOnError}).rpc(t,{head:r,count:s})}}var k;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(k||(k={}));const wn=(n,e,t={})=>{var r;const s=(r=t.skipTypes)!==null&&r!==void 0?r:[];return Object.keys(e).reduce((i,o)=>(i[o]=Bo(o,n,e,s),i),{})},Bo=(n,e,t,r)=>{const s=e.find(a=>a.name===n),i=s==null?void 0:s.type,o=t[n];return i&&!r.includes(i)?or(i,o):Dt(o)},or=(n,e)=>{if(n.charAt(0)==="_"){const t=n.slice(1,n.length);return zo(e,t)}switch(n){case k.bool:return Fo(e);case k.float4:case k.float8:case k.int2:case k.int4:case k.int8:case k.numeric:case k.oid:return Lo(e);case k.json:case k.jsonb:return Mo(e);case k.timestamp:return Go(e);case k.abstime:case k.date:case k.daterange:case k.int4range:case k.int8range:case k.money:case k.reltime:case k.text:case k.time:case k.timestamptz:case k.timetz:case k.tsrange:case k.tstzrange:return Dt(e);default:return Dt(e)}},Dt=n=>n,Fo=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},Lo=n=>{if(typeof n=="string"){const e=parseFloat(n);if(!Number.isNaN(e))return e}return n},Mo=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(e){return console.log(`JSON parse error: ${e}`),n}return n},zo=(n,e)=>{if(typeof n!="string")return n;const t=n.length-1,r=n[t];if(n[0]==="{"&&r==="}"){let i;const o=n.slice(1,t);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>or(e,a))}return n},Go=n=>typeof n=="string"?n.replace(" ","T"):n,Ho="websocket",Jo="Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",qo=["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],Vo="Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)",Wo=["I\xF1aki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"],Ko="1.0.34",Xo={type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},Yo="https://github.com/theturtle32/WebSocket-Node",Qo={node:">=4.0.0"},Zo={bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},ea={"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},ta={verbose:!1},na={test:"tape test/unit/*.js",gulp:"gulp"},ra="index",sa={lib:"./lib"},ia="lib/browser.js",oa="Apache-2.0";var aa={name:Ho,description:Jo,keywords:qo,author:Vo,contributors:Wo,version:Ko,repository:Xo,homepage:Yo,engines:Qo,dependencies:Zo,devDependencies:ea,config:ta,scripts:na,main:ra,directories:sa,browser:ia,license:oa},ca=aa.version,ce;if(typeof globalThis=="object")ce=globalThis;else try{ce=require("es5-ext/global")}catch{}finally{if(!ce&&typeof window!="undefined"&&(ce=window),!ce)throw new Error("Could not determine global this")}var Je=ce.WebSocket||ce.MozWebSocket,la=ca;function ar(n,e){var t;return e?t=new Je(n,e):t=new Je(n),t}Je&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(n){Object.defineProperty(ar,n,{get:function(){return Je[n]}})});var ua={w3cwebsocket:Je?ar:null,version:la};const ha="1.7.2",fa={"X-Client-Info":`realtime-js/${ha}`},da="1.0.0",cr=1e4,pa=1e3;var Ge;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(Ge||(Ge={}));var A;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(A||(A={}));var F;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(F||(F={}));var Ut;(function(n){n.websocket="websocket"})(Ut||(Ut={}));var le;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(le||(le={}));class Qt{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}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))}}class ma{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){const s=t.getUint8(1),i=t.getUint8(2);let o=this.HEADER_LENGTH+2;const a=r.decode(e.slice(o,o+s));o=o+s;const l=r.decode(e.slice(o,o+i));o=o+i;const u=JSON.parse(r.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:l,payload:u}}}class Ae{constructor(e,t,r={},s=cr){this.channel=e,this.event=t,this.payload=r,this.timeout=s,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,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}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel instanceof Bt?this.channel.on(this.refEvent,e):this.channel.on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel.trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){!this.refEvent||(this.channel instanceof Bt?this.channel.off(this.refEvent):this.channel.off(this.refEvent,{}))}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}class Bt{constructor(e,t={},r){this.topic=e,this.params=t,this.socket=r,this.bindings=[],this.state=A.closed,this.joinedOnce=!1,this.pushBuffer=[],this.timeout=this.socket.timeout,this.joinPush=new Ae(this,F.join,this.params,this.timeout),this.rejoinTimer=new Qt(()=>this.rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=A.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=A.closed,this.socket.remove(this)}),this.onError(s=>{this.isLeaving()||this.isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=A.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{!this.isJoining()||(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=A.errored,this.rejoinTimer.scheduleTimeout())}),this.on(F.reply,(s,i)=>{this.trigger(this.replyEventName(i),s)})}rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this.rejoin()}subscribe(e=this.timeout){if(this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";return this.joinedOnce=!0,this.rejoin(e),this.joinPush}onClose(e){this.on(F.close,e)}onError(e){this.on(F.error,t=>e(t))}on(e,t){this.bindings.push({event:e,callback:t})}off(e){this.bindings=this.bindings.filter(t=>t.event!==e)}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new Ae(this,e,t,r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=A.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this.trigger(F.close,"leave",this.joinRef())};this.joinPush.destroy();let r=new Ae(this,F.leave,{},e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}isMember(e){return this.topic===e}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=A.joining,this.joinPush.resend(e))}trigger(e,t,r){let{close:s,error:i,leave:o,join:a}=F;if(r&&[s,i,o,a].indexOf(e)>=0&&r!==this.joinRef())return;let u=this.onMessage(e,t,r);if(t&&!u)throw"channel onMessage callbacks must return the payload, modified or unmodified";this.bindings.filter(c=>c.event==="*"?e===(t==null?void 0:t.type):c.event===e).map(c=>c.callback(u,r))}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===A.closed}isErrored(){return this.state===A.errored}isJoined(){return this.state===A.joined}isJoining(){return this.state===A.joining}isLeaving(){return this.state===A.leaving}}class _e{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel.on(r.state,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=_e.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=_e.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,{},s=>{const{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=_e.syncDiff(this.state,s,i,o),a())})}static syncState(e,t,r,s){const i=this.cloneDeep(e),o=this.transformState(t),a={},l={};return this.map(i,(u,c)=>{o[u]||(l[u]=c)}),this.map(o,(u,c)=>{const h=i[u];if(h){const p=c.map(_=>_.presence_id),d=h.map(_=>_.presence_id),g=c.filter(_=>d.indexOf(_.presence_id)<0),v=h.filter(_=>p.indexOf(_.presence_id)<0);g.length>0&&(a[u]=g),v.length>0&&(l[u]=v)}else a[u]=c}),this.syncDiff(i,{joins:a,leaves:l},r,s)}static syncDiff(e,t,r,s){const{joins:i,leaves:o}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),s||(s=()=>{}),this.map(i,(a,l)=>{const u=e[a];if(e[a]=this.cloneDeep(l),u){const c=e[a].map(p=>p.presence_id),h=u.filter(p=>c.indexOf(p.presence_id)<0);e[a].unshift(...h)}r(a,u,l)}),this.map(o,(a,l)=>{let u=e[a];if(!u)return;const c=l.map(h=>h.presence_id);u=u.filter(h=>c.indexOf(h.presence_id)<0),e[a]=u,s(a,u,l),u.length===0&&delete e[a]}),e}static list(e,t){return t||(t=(r,s)=>s),this.map(e,(r,s)=>t(r,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,r)=>{const s=e[r];return"metas"in s?t[r]=s.metas.map(i=>(i.presence_id=i.phx_ref,delete i.phx_ref,delete i.phx_ref_prev,i)):t[r]=s,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return _e.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}}class pt{constructor(e,t={},r){this.topic=e,this.params=t,this.socket=r,this.bindings=[],this.state=A.closed,this.joinedOnce=!1,this.pushBuffer=[],this.timeout=this.socket.timeout,this.joinPush=new Ae(this,F.join,this.params,this.timeout),this.rejoinTimer=new Qt(()=>this.rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=A.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=A.closed,this.socket.remove(this)}),this.onError(s=>{this.isLeaving()||this.isClosed()||(this.socket.log("channel",`error ${this.topic}`,s),this.state=A.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{!this.isJoining()||(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=A.errored,this.rejoinTimer.scheduleTimeout())}),this.on(F.reply,{},(s,i)=>{this.trigger(this.replyEventName(i),s)}),this.presence=new _e(this)}list(){return this.presence.list()}rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this.rejoin()}subscribe(e=this.timeout){if(this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const t=this.bindings.reduce((r,s)=>{const{type:i}=s;return["phx_close","phx_error","phx_reply","presence_diff","presence_state"].includes(i)||(r[i]=s),r},{});return Object.keys(t).length&&this.updateJoinPayload({configs:t}),this.joinedOnce=!0,this.rejoin(e),this.joinPush}}onClose(e){this.on(F.close,{},e)}onError(e){this.on(F.error,{},t=>e(t))}on(e,t,r){this.bindings.push({type:e,filter:t!=null?t:{},callback:r!=null?r:()=>{}})}off(e,t){this.bindings=this.bindings.filter(r=>!(r.type===e&&pt.isEqual(r.filter,t)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let s=new Ae(this,e,t,r);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=A.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this.trigger(F.close,"leave",this.joinRef())};this.joinPush.destroy();const r=new Ae(this,F.leave,{},e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}isMember(e){return this.topic===e}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=A.joining,this.joinPush.resend(e))}trigger(e,t,r){const{close:s,error:i,leave:o,join:a}=F;if(r&&[s,i,o,a].indexOf(e)>=0&&r!==this.joinRef())return;const u=this.onMessage(e,t,r);if(t&&!u)throw"channel onMessage callbacks must return the payload, modified or unmodified";this.bindings.filter(c=>{var h,p;return(c==null?void 0:c.type)===e&&(((h=c==null?void 0:c.filter)===null||h===void 0?void 0:h.event)==="*"||((p=c==null?void 0:c.filter)===null||p===void 0?void 0:p.event)===(t==null?void 0:t.event))}).map(c=>c.callback(u,r))}send(e){const t=this.push(e.type,e);return new Promise((r,s)=>{t.receive("ok",()=>r("ok")),t.receive("timeout",()=>s("timeout"))})}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===A.closed}isErrored(){return this.state===A.errored}isJoined(){return this.state===A.joined}isJoining(){return this.state===A.joining}isLeaving(){return this.state===A.leaving}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}}var ga=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})},ya=globalThis&&globalThis.__rest||function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t};const va=()=>{};class ba{constructor(e,t){this.accessToken=null,this.channels=[],this.endPoint="",this.headers=fa,this.params={},this.timeout=cr,this.transport=ua.w3cwebsocket,this.heartbeatIntervalMs=3e4,this.longpollerTimeout=2e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=va,this.conn=null,this.sendBuffer=[],this.serializer=new ma,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.endPoint=`${e}/${Ut.websocket}`,t!=null&&t.params&&(this.params=t.params),t!=null&&t.headers&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),t!=null&&t.timeout&&(this.timeout=t.timeout),t!=null&&t.logger&&(this.logger=t.logger),t!=null&&t.transport&&(this.transport=t.transport),t!=null&&t.heartbeatIntervalMs&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs),t!=null&&t.longpollerTimeout&&(this.longpollerTimeout=t.longpollerTimeout),this.reconnectAfterMs=t!=null&&t.reconnectAfterMs?t.reconnectAfterMs:r=>[1e3,2e3,5e3,1e4][r-1]||1e4,this.encode=t!=null&&t.encode?t.encode:(r,s)=>s(JSON.stringify(r)),this.decode=t!=null&&t.decode?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new Qt(()=>ga(this,void 0,void 0,function*(){yield this.disconnect(),this.connect()}),this.reconnectAfterMs)}connect(){this.conn||(this.conn=new this.transport(this.endPointURL(),[],null,this.headers),this.conn&&(this.conn.binaryType="arraybuffer",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)))}disconnect(e,t){return new Promise((r,s)=>{try{this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,t||""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset()),r({error:null,data:!0})}catch(i){r({error:i,data:!1})}})}log(e,t,r){this.logger(e,t,r)}onOpen(e){this.stateChangeCallbacks.open.push(e)}onClose(e){this.stateChangeCallbacks.close.push(e)}onError(e){this.stateChangeCallbacks.error.push(e)}onMessage(e){this.stateChangeCallbacks.message.push(e)}connectionState(){switch(this.conn&&this.conn.readyState){case Ge.connecting:return le.Connecting;case Ge.open:return le.Open;case Ge.closing:return le.Closing;default:return le.Closed}}isConnected(){return this.connectionState()===le.Open}remove(e){this.channels=this.channels.filter(t=>t.joinRef()!==e.joinRef())}channel(e,t={}){var r;const{selfBroadcast:s}=t,i=ya(t,["selfBroadcast"]);s&&(i.self_broadcast=s);const o=!((r=this.params)===null||r===void 0)&&r.vsndate?new pt(e,i,this):new Bt(e,i,this);return o instanceof pt&&(o.presence.onJoin((a,l,u)=>{o.trigger("presence",{event:"JOIN",key:a,currentPresences:l,newPresences:u})}),o.presence.onLeave((a,l,u)=>{o.trigger("presence",{event:"LEAVE",key:a,currentPresences:l,leftPresences:u})}),o.presence.onSync(()=>{o.trigger("presence",{event:"SYNC"})})),this.channels.push(o),o}push(e){const{topic:t,event:r,payload:s,ref:i}=e;let o=()=>{this.encode(e,a=>{var l;(l=this.conn)===null||l===void 0||l.send(a)})};this.log("push",`${t} ${r} (${i})`,s),this.isConnected()?o():this.sendBuffer.push(o)}onConnMessage(e){this.decode(e.data,t=>{let{topic:r,event:s,payload:i,ref:o}=t;(o&&o===this.pendingHeartbeatRef||s===(i==null?void 0:i.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${i.status||""} ${r} ${s} ${o&&"("+o+")"||""}`,i),this.channels.filter(a=>a.isMember(r)).forEach(a=>a.trigger(s,i,o)),this.stateChangeCallbacks.message.forEach(a=>a(t))})}endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:da}))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}setAuth(e){this.accessToken=e,this.channels.forEach(t=>{e&&t.updateJoinPayload({user_token:e}),t.joinedOnce&&t.isJoined()&&t.push(F.access_token,{access_token:e})})}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_onConnOpen(){this.log("transport",`connected to ${this.endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(t=>t(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(t=>t(e))}_triggerChanError(){this.channels.forEach(e=>e.trigger(F.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const r=e.match(/\?/)?"&":"?",s=new URLSearchParams(t);return`${e}${r}${s}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_sendHeartbeat(){var e;if(!!this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(e=this.conn)===null||e===void 0||e.close(pa,"hearbeat timeout");return}this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class _a{constructor(e,t,r,s){const i={},o=s==="*"?`realtime:${r}`:`realtime:${r}:${s}`,a=t.Authorization.split(" ")[1];a&&(i.user_token=a),this.subscription=e.channel(o,i)}getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=wn(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=wn(e.columns,e.old_record)),t}on(e,t){return this.subscription.on(e,r=>{let s={schema:r.schema,table:r.table,commit_timestamp:r.commit_timestamp,eventType:r.type,new:{},old:{},errors:r.errors};s=Object.assign(Object.assign({},s),this.getPayloadRecords(r)),t(s)}),this}subscribe(e=()=>{}){return this.subscription.onError(t=>e("SUBSCRIPTION_ERROR",t)),this.subscription.onClose(()=>e("CLOSED")),this.subscription.subscribe().receive("ok",()=>e("SUBSCRIBED")).receive("error",t=>e("SUBSCRIPTION_ERROR",t)).receive("timeout",()=>e("RETRYING_AFTER_TIMEOUT")),this.subscription}}class wa extends ir{constructor(e,{headers:t={},schema:r,realtime:s,table:i,fetch:o,shouldThrowOnError:a}){super(e,{headers:t,schema:r,fetch:o,shouldThrowOnError:a}),this._subscription=null,this._realtime=s,this._headers=t,this._schema=r,this._table=i}on(e,t){return this._realtime.isConnected()||this._realtime.connect(),this._subscription||(this._subscription=new _a(this._realtime,this._headers,this._schema,this._table)),this._subscription.on(e,t)}}const Sa="0.0.0",Ea={"X-Client-Info":`storage-js/${Sa}`};var Xe=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};const $a=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),Ta=(n,e)=>{if(typeof n.json!="function")return e(n);n.json().then(t=>e({message:$a(t),status:(n==null?void 0:n.status)||500}))},Oa=(n,e,t,r)=>{const s={method:n,headers:(e==null?void 0:e.headers)||{}};return n==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),t))};function St(n,e,t,r,s,i){return Xe(this,void 0,void 0,function*(){return new Promise((o,a)=>{n(t,Oa(e,r,s,i)).then(l=>{if(!l.ok)throw l;return r!=null&&r.noResolveJson?o(l):l.json()}).then(l=>o(l)).catch(l=>Ta(l,a))})})}function Ft(n,e,t,r){return Xe(this,void 0,void 0,function*(){return St(n,"GET",e,t,r)})}function ue(n,e,t,r,s){return Xe(this,void 0,void 0,function*(){return St(n,"POST",e,r,s,t)})}function ka(n,e,t,r,s){return Xe(this,void 0,void 0,function*(){return St(n,"PUT",e,r,s,t)})}function lr(n,e,t,r,s){return Xe(this,void 0,void 0,function*(){return St(n,"DELETE",e,r,s,t)})}const ur=n=>{let e;return n?e=n:typeof fetch=="undefined"?e=wt:e=fetch,(...t)=>e(...t)};var ve=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};class Aa{constructor(e,t={},r){this.url=e,this.headers=Object.assign(Object.assign({},Ea),t),this.fetch=ur(r)}listBuckets(){return ve(this,void 0,void 0,function*(){try{return{data:yield Ft(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){return{data:null,error:e}}})}getBucket(e){return ve(this,void 0,void 0,function*(){try{return{data:yield Ft(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}})}createBucket(e,t={public:!1}){return ve(this,void 0,void 0,function*(){try{return{data:(yield ue(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public},{headers:this.headers})).name,error:null}}catch(r){return{data:null,error:r}}})}updateBucket(e,t){return ve(this,void 0,void 0,function*(){try{return{data:yield ka(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public},{headers:this.headers}),error:null}}catch(r){return{data:null,error:r}}})}emptyBucket(e){return ve(this,void 0,void 0,function*(){try{return{data:yield ue(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}})}deleteBucket(e){return ve(this,void 0,void 0,function*(){try{return{data:yield lr(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}})}}var ee=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};const xa={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Ra={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ja{constructor(e,t={},r,s){this.url=e,this.headers=t,this.bucketId=r,this.fetch=ur(s)}uploadOrUpdate(e,t,r,s){return ee(this,void 0,void 0,function*(){try{let i;const o=Object.assign(Object.assign({},Ra),s),a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});typeof Blob!="undefined"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),i.append("",r)):typeof FormData!="undefined"&&r instanceof FormData?(i=r,i.append("cacheControl",o.cacheControl)):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType);const l=this._removeEmptyFolders(t),u=this._getFinalPath(l),c=yield this.fetch(`${this.url}/object/${u}`,{method:e,body:i,headers:a});if(c.ok)return{data:{Key:u},error:null};{const h=yield c.json();return{data:null,error:h}}}catch(i){return{data:null,error:i}}})}upload(e,t,r){return ee(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}update(e,t,r){return ee(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t){return ee(this,void 0,void 0,function*(){try{return{data:yield ue(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(r){return{data:null,error:r}}})}copy(e,t){return ee(this,void 0,void 0,function*(){try{return{data:yield ue(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(r){return{data:null,error:r}}})}createSignedUrl(e,t){return ee(this,void 0,void 0,function*(){try{const r=this._getFinalPath(e);let s=yield ue(this.fetch,`${this.url}/object/sign/${r}`,{expiresIn:t},{headers:this.headers});const i=`${this.url}${s.signedURL}`;return s={signedURL:i},{data:s,error:null,signedURL:i}}catch(r){return{data:null,error:r,signedURL:null}}})}createSignedUrls(e,t){return ee(this,void 0,void 0,function*(){try{return{data:(yield ue(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers})).map(s=>Object.assign(Object.assign({},s),{signedURL:s.signedURL?`${this.url}${s.signedURL}`:null})),error:null}}catch(r){return{data:null,error:r}}})}download(e){return ee(this,void 0,void 0,function*(){try{const t=this._getFinalPath(e);return{data:yield(yield Ft(this.fetch,`${this.url}/object/${t}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(t){return{data:null,error:t}}})}getPublicUrl(e){try{const t=this._getFinalPath(e),r=`${this.url}/object/public/${t}`;return{data:{publicURL:r},error:null,publicURL:r}}catch(t){return{data:null,error:t,publicURL:null}}}remove(e){return ee(this,void 0,void 0,function*(){try{return{data:yield lr(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){return{data:null,error:t}}})}list(e,t,r){return ee(this,void 0,void 0,function*(){try{const s=Object.assign(Object.assign(Object.assign({},xa),t),{prefix:e||""});return{data:yield ue(this.fetch,`${this.url}/object/list/${this.bucketId}`,s,{headers:this.headers},r),error:null}}catch(s){return{data:null,error:s}}})}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}}class Ca extends Aa{constructor(e,t={},r){super(e,t,r)}from(e){return new ja(this.url,this.headers,e,this.fetch)}}const Pa=n=>{let e;return n?e=n:typeof fetch=="undefined"?e=wt:e=fetch,(...t)=>e(...t)};var Ia=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};class Na{constructor(e,{headers:t={},customFetch:r}={}){this.url=e,this.headers=t,this.fetch=Pa(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t){return Ia(this,void 0,void 0,function*(){try{const{headers:r,body:s}=t!=null?t:{},i=yield this.fetch(`${this.url}/${e}`,{method:"POST",headers:Object.assign({},this.headers,r),body:s}),o=i.headers.get("x-relay-error");if(o&&o==="true")return{data:null,error:new Error(yield i.text())};let a;const{responseType:l}=t!=null?t:{};return!l||l==="json"?a=yield i.json():l==="arrayBuffer"?a=yield i.arrayBuffer():l==="blob"?a=yield i.blob():a=yield i.text(),{data:a,error:null}}catch(r){return{data:null,error:r}}})}}var st=globalThis&&globalThis.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function a(c){try{u(r.next(c))}catch(h){o(h)}}function l(c){try{u(r.throw(c))}catch(h){o(h)}}function u(c){c.done?i(c.value):s(c.value).then(a,l)}u((r=r.apply(n,e||[])).next())})};const Da={schema:"public",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,multiTab:!0,headers:rr};class Ua{constructor(e,t,r){if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const s=ao(e),i=Object.assign(Object.assign({},Da),r);if(this.restUrl=`${s}/rest/v1`,this.realtimeUrl=`${s}/realtime/v1`.replace("http","ws"),this.authUrl=`${s}/auth/v1`,this.storageUrl=`${s}/storage/v1`,s.match(/(supabase\.co)|(supabase\.in)/)){const a=s.split(".");this.functionsUrl=`${a[0]}.functions.${a[1]}.${a[2]}`}else this.functionsUrl=`${s}/functions/v1`;this.schema=i.schema,this.multiTab=i.multiTab,this.fetch=i.fetch,this.headers=Object.assign(Object.assign({},rr),r==null?void 0:r.headers),this.shouldThrowOnError=i.shouldThrowOnError||!1,this.auth=this._initSupabaseAuthClient(i),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},i.realtime)),this._listenForAuthEvents(),this._listenForMultiTabEvents()}get functions(){return new Na(this.functionsUrl,{headers:this._getAuthHeaders(),customFetch:this.fetch})}get storage(){return new Ca(this.storageUrl,this._getAuthHeaders(),this.fetch)}from(e){const t=`${this.restUrl}/${e}`;return new wa(t,{headers:this._getAuthHeaders(),schema:this.schema,realtime:this.realtime,table:e,fetch:this.fetch,shouldThrowOnError:this.shouldThrowOnError})}rpc(e,t,{head:r=!1,count:s=null}={}){return this._initPostgRESTClient().rpc(e,t,{head:r,count:s})}channel(e,t){var r,s;const i=(s=(r=this.auth.session())===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:this.supabaseKey;return this.realtime.isConnected()||this.realtime.connect(),this.realtime.channel(e,Object.assign(Object.assign({},t),{user_token:i}))}removeAllSubscriptions(){return st(this,void 0,void 0,function*(){const e=this.getSubscriptions().slice(),t=e.map(s=>this.removeSubscription(s));return(yield Promise.all(t)).map(({error:s},i)=>({data:{subscription:e[i]},error:s}))})}removeChannel(e){return st(this,void 0,void 0,function*(){const{error:t}=yield this._closeSubscription(e),r=this.getSubscriptions(),s=r.filter(i=>i.isJoined()).length;return r.length===0&&(yield this.realtime.disconnect()),{data:{openChannels:s},error:t}})}removeSubscription(e){return st(this,void 0,void 0,function*(){const{error:t}=yield this._closeSubscription(e),r=this.getSubscriptions(),s=r.filter(i=>i.isJoined()).length;return r.length===0&&(yield this.realtime.disconnect()),{data:{openSubscriptions:s},error:t}})}_closeSubscription(e){return st(this,void 0,void 0,function*(){let t=null;if(!e.isClosed()){const{error:r}=yield this._unsubscribeSubscription(e);t=r}return this.realtime.remove(e),{error:t}})}_unsubscribeSubscription(e){return new Promise(t=>{e.unsubscribe().receive("ok",()=>t({error:null})).receive("error",r=>t({error:r})).receive("timeout",()=>t({error:new Error("timed out")}))})}getSubscriptions(){return this.realtime.channels}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,localStorage:s,headers:i,fetch:o,cookieOptions:a,multiTab:l}){const u={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Co({url:this.authUrl,headers:Object.assign(Object.assign({},i),u),autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,localStorage:s,fetch:o,cookieOptions:a,multiTab:l})}_initRealtimeClient(e){return new ba(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign(Object.assign({},e==null?void 0:e.params),{apikey:this.supabaseKey})}))}_initPostgRESTClient(){return new Uo(this.restUrl,{headers:this._getAuthHeaders(),schema:this.schema,fetch:this.fetch,throwOnError:this.shouldThrowOnError})}_getAuthHeaders(){var e,t;const r=Object.assign({},this.headers),s=(t=(e=this.auth.session())===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:this.supabaseKey;return r.apikey=this.supabaseKey,r.Authorization=r.Authorization||`Bearer ${s}`,r}_listenForMultiTabEvents(){if(!this.multiTab||!co()||!(window!=null&&window.addEventListener))return null;try{return window==null?void 0:window.addEventListener("storage",e=>{var t,r,s;if(e.key===oo){const i=JSON.parse(String(e.newValue)),o=(r=(t=i==null?void 0:i.currentSession)===null||t===void 0?void 0:t.access_token)!==null&&r!==void 0?r:void 0,a=(s=this.auth.session())===null||s===void 0?void 0:s.access_token;o?!a&&o?this._handleTokenChanged("SIGNED_IN",o,"STORAGE"):a!==o&&this._handleTokenChanged("TOKEN_REFRESHED",o,"STORAGE"):this._handleTokenChanged("SIGNED_OUT",o,"STORAGE")}})}catch(e){return console.error("_listenForMultiTabEvents",e),null}}_listenForAuthEvents(){let{data:e}=this.auth.onAuthStateChange((t,r)=>{this._handleTokenChanged(t,r==null?void 0:r.access_token,"CLIENT")});return e}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==t?(this.realtime.setAuth(t),r=="STORAGE"&&this.auth.setAuth(t),this.changedAccessToken=t):(e==="SIGNED_OUT"||e==="USER_DELETED")&&(this.realtime.setAuth(this.supabaseKey),r=="STORAGE"&&this.auth.signOut())}}const Ba=(n,e,t)=>new Ua(n,e,t),Fa=Ba(bn.url,bn.key,{realtime:{params:{vsndate:"1.0.0"}}});var hr={};function La(n){for(var e=5381,t=n.length;t;)e=e*33^n.charCodeAt(--t);return e>>>0}var Ma=La,fr={};(function(n){n.__esModule=!0,n.default=void 0;function e(a,l){for(var u=0;u<l.length;u++){var c=l[u];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}}function t(a,l,u){return l&&e(a.prototype,l),u&&e(a,u),a}var r=typeof process!="undefined"&&process.env&&!0,s=function(l){return Object.prototype.toString.call(l)==="[object String]"},i=function(){function a(u){var c=u===void 0?{}:u,h=c.name,p=h===void 0?"stylesheet":h,d=c.optimizeForSpeed,g=d===void 0?r:d,v=c.isBrowser,_=v===void 0?typeof window!="undefined":v;o(s(p),"`name` must be a string"),this._name=p,this._deletedRulePlaceholder="#"+p+"-deleted-rule____{}",o(typeof g=="boolean","`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=g,this._isBrowser=_,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var U=this._isBrowser&&document.querySelector('meta[property="csp-nonce"]');this._nonce=U?U.getAttribute("content"):null}var l=a.prototype;return l.setOptimizeForSpeed=function(c){o(typeof c=="boolean","`setOptimizeForSpeed` accepts a boolean"),o(this._rulesCount===0,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=c,this.inject()},l.isOptimizeForSpeed=function(){return this._optimizeForSpeed},l.inject=function(){var c=this;if(o(!this._injected,"sheet already injected"),this._injected=!0,this._isBrowser&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(r||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(p,d){return typeof d=="number"?c._serverSheet.cssRules[d]={cssText:p}:c._serverSheet.cssRules.push({cssText:p}),d},deleteRule:function(p){c._serverSheet.cssRules[p]=null}}},l.getSheetForTag=function(c){if(c.sheet)return c.sheet;for(var h=0;h<document.styleSheets.length;h++)if(document.styleSheets[h].ownerNode===c)return document.styleSheets[h]},l.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},l.insertRule=function(c,h){if(o(s(c),"`insertRule` accepts only strings"),!this._isBrowser)return typeof h!="number"&&(h=this._serverSheet.cssRules.length),this._serverSheet.insertRule(c,h),this._rulesCount++;if(this._optimizeForSpeed){var p=this.getSheet();typeof h!="number"&&(h=p.cssRules.length);try{p.insertRule(c,h)}catch{return r||console.warn(`StyleSheet: illegal rule:
`+c+`
See https://stackoverflow.com/q/20007992 for more info`),-1}}else{var d=this._tags[h];this._tags.push(this.makeStyleTag(this._name,c,d))}return this._rulesCount++},l.replaceRule=function(c,h){if(this._optimizeForSpeed||!this._isBrowser){var p=this._isBrowser?this.getSheet():this._serverSheet;if(h.trim()||(h=this._deletedRulePlaceholder),!p.cssRules[c])return c;p.deleteRule(c);try{p.insertRule(h,c)}catch{r||console.warn(`StyleSheet: illegal rule:
`+h+`
See https://stackoverflow.com/q/20007992 for more info`),p.insertRule(this._deletedRulePlaceholder,c)}}else{var d=this._tags[c];o(d,"old rule at index `"+c+"` not found"),d.textContent=h}return c},l.deleteRule=function(c){if(!this._isBrowser){this._serverSheet.deleteRule(c);return}if(this._optimizeForSpeed)this.replaceRule(c,"");else{var h=this._tags[c];o(h,"rule at index `"+c+"` not found"),h.parentNode.removeChild(h),this._tags[c]=null}},l.flush=function(){this._injected=!1,this._rulesCount=0,this._isBrowser?(this._tags.forEach(function(c){return c&&c.parentNode.removeChild(c)}),this._tags=[]):this._serverSheet.cssRules=[]},l.cssRules=function(){var c=this;return this._isBrowser?this._tags.reduce(function(h,p){return p?h=h.concat(Array.prototype.map.call(c.getSheetForTag(p).cssRules,function(d){return d.cssText===c._deletedRulePlaceholder?null:d})):h.push(null),h},[]):this._serverSheet.cssRules},l.makeStyleTag=function(c,h,p){h&&o(s(h),"makeStyleTag acceps only strings as second parameter");var d=document.createElement("style");this._nonce&&d.setAttribute("nonce",this._nonce),d.type="text/css",d.setAttribute("data-"+c,""),h&&d.appendChild(document.createTextNode(h));var g=document.head||document.getElementsByTagName("head")[0];return p?g.insertBefore(d,p):g.appendChild(d),d},t(a,[{key:"length",get:function(){return this._rulesCount}}]),a}();n.default=i;function o(a,l){if(!a)throw new Error("StyleSheet: "+l+".")}})(fr);(function(n){n.__esModule=!0,n.default=void 0;var e=r(Ma),t=r(fr);function r(a){return a&&a.__esModule?a:{default:a}}var s=function(l){return l.replace(/\/style/gi,"\\/style")},i=function(){function a(u){var c=u===void 0?{}:u,h=c.styleSheet,p=h===void 0?null:h,d=c.optimizeForSpeed,g=d===void 0?!1:d,v=c.isBrowser,_=v===void 0?typeof window!="undefined":v;this._sheet=p||new t.default({name:"styled-jsx",optimizeForSpeed:g}),this._sheet.inject(),p&&typeof g=="boolean"&&(this._sheet.setOptimizeForSpeed(g),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._isBrowser=_,this._fromServer=void 0,this._indices={},this._instancesCounts={},this.computeId=this.createComputeId(),this.computeSelector=this.createComputeSelector()}var l=a.prototype;return l.add=function(c){var h=this;this._optimizeForSpeed===void 0&&(this._optimizeForSpeed=Array.isArray(c.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._isBrowser&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(_,U){return _[U]=0,_},{}));var p=this.getIdAndRules(c),d=p.styleId,g=p.rules;if(d in this._instancesCounts){this._instancesCounts[d]+=1;return}var v=g.map(function(_){return h._sheet.insertRule(_)}).filter(function(_){return _!==-1});this._indices[d]=v,this._instancesCounts[d]=1},l.remove=function(c){var h=this,p=this.getIdAndRules(c),d=p.styleId;if(o(d in this._instancesCounts,"styleId: `"+d+"` not found"),this._instancesCounts[d]-=1,this._instancesCounts[d]<1){var g=this._fromServer&&this._fromServer[d];g?(g.parentNode.removeChild(g),delete this._fromServer[d]):(this._indices[d].forEach(function(v){return h._sheet.deleteRule(v)}),delete this._indices[d]),delete this._instancesCounts[d]}},l.update=function(c,h){this.add(h),this.remove(c)},l.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={},this.computeId=this.createComputeId(),this.computeSelector=this.createComputeSelector()},l.cssRules=function(){var c=this,h=this._fromServer?Object.keys(this._fromServer).map(function(d){return[d,c._fromServer[d]]}):[],p=this._sheet.cssRules();return h.concat(Object.keys(this._indices).map(function(d){return[d,c._indices[d].map(function(g){return p[g].cssText}).join(c._optimizeForSpeed?"":`
`)]}).filter(function(d){return Boolean(d[1])}))},l.createComputeId=function(){var c={};return function(h,p){if(!p)return"jsx-"+h;var d=String(p),g=h+d;return c[g]||(c[g]="jsx-"+(0,e.default)(h+"-"+d)),c[g]}},l.createComputeSelector=function(c){c===void 0&&(c=/__jsx-style-dynamic-selector/g);var h={};return function(p,d){this._isBrowser||(d=s(d));var g=p+d;return h[g]||(h[g]=d.replace(c,p)),h[g]}},l.getIdAndRules=function(c){var h=this,p=c.children,d=c.dynamic,g=c.id;if(d){var v=this.computeId(g,d);return{styleId:v,rules:Array.isArray(p)?p.map(function(_){return h.computeSelector(v,_)}):[this.computeSelector(v,p)]}}return{styleId:this.computeId(g),rules:Array.isArray(p)?p:[p]}},l.selectFromServer=function(){var c=Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));return c.reduce(function(h,p){var d=p.id.slice(2);return h[d]=p,h},{})},a}();n.default=i;function o(a,l){if(!a)throw new Error("StyleSheetRegistry: "+l+".")}})(hr);var za=sr(hr);const ot=new za;function Ga(n){Tn(e=>{e&&ot.remove(e);const t=S({},n);return ot.add(t),t}),oe(()=>ot.remove(S({},n)))}Ga.dynamic=n=>n.map(e=>{const t=e[0],r=e[1];return ot.computeId(t,r)}).join(" ");Mr(()=>$(Ki,{client:Fa,get children(){return $(Os,{get children(){return $(so,{})}})}}),document.getElementById("app"));export{nc as A,je as B,Ve as C,ec as D,rc as E,nr as F,On as G,br as H,Wa as I,Ga as J,Ka as K,lt as L,Xa as M,xs as N,fe as O,ui as P,qt as Q,Va as R,Gt as S,W as T,Za as U,tc as V,wo as W,zr as X,N as a,An as b,Yn as c,$ as d,Ya as e,Ws as f,Xi as g,Ks as h,xt as i,Xs as j,Vs as k,ci as l,jr as m,Jn as n,Zs as o,Gi as p,q,Tn as r,Nn as s,Qa as t,vs as u,oe as v,re as w,Gs as x,Rr as y,qa as z};
//# sourceMappingURL=index.13b310ab.js.map