All files / app-dashboard/src/accounts client.generated.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3  6x  
// Generated by scripts/build-client.ts.
export const CLIENT_JS = "var Ce=globalThis,$e=Ce.ShadowRoot&&(Ce.ShadyCSS===void 0||Ce.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,at=Symbol(),Ft=new WeakMap,pe=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==at)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t,this.t=r}get styleSheet(){let t=this.o,r=this.t;if($e&&t===void 0){let n=r!==void 0&&r.length===1;n&&(t=Ft.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Ft.set(r,t))}return t}toString(){return this.cssText}},Vt=e=>new pe(typeof e==\"string\"?e:e+\"\",void 0,at),lt=(e,...t)=>{let r=e.length===1?e[0]:t.reduce((n,o,s)=>n+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i==\"number\")return i;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+i+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(o)+e[s+1],e[0]);return new pe(r,e,at)},Gt=(e,t)=>{if($e)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let n=document.createElement(\"style\"),o=Ce.litNonce;o!==void 0&&n.setAttribute(\"nonce\",o),n.textContent=r.cssText,e.appendChild(n)}},ct=$e?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r=\"\";for(let n of t.cssRules)r+=n.cssText;return Vt(r)})(e):e;var{is:bn,defineProperty:vn,getOwnPropertyDescriptor:Sn,getOwnPropertyNames:An,getOwnPropertySymbols:Rn,getPrototypeOf:wn}=Object,Pe=globalThis,zt=Pe.trustedTypes,_n=zt?zt.emptyScript:\"\",Tn=Pe.reactiveElementPolyfillSupport,me=(e,t)=>e,ut={toAttribute(e,t){switch(t){case Boolean:e=e?_n:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},Kt=(e,t)=>!bn(e,t),Wt={attribute:!0,type:String,converter:ut,reflect:!1,useDefault:!1,hasChanged:Kt};Symbol.metadata??=Symbol(\"metadata\"),Pe.litPropertyMetadata??=new WeakMap;var B=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,r=Wt){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(t,r),!r.noAccessor){let n=Symbol(),o=this.getPropertyDescriptor(t,n,r);o!==void 0&&vn(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){let{get:o,set:s}=Sn(this.prototype,t)??{get(){return this[r]},set(i){this[r]=i}};return{get:o,set(i){let l=o?.call(this);s?.call(this,i),this.requestUpdate(t,l,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Wt}static _$Ei(){if(this.hasOwnProperty(me(\"elementProperties\")))return;let t=wn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(me(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(me(\"properties\"))){let r=this.properties,n=[...An(r),...Rn(r)];for(let o of n)this.createProperty(o,r[o])}let t=this[Symbol.metadata];if(t!==null){let r=litPropertyMetadata.get(t);if(r!==void 0)for(let[n,o]of r)this.elementProperties.set(n,o)}this._$Eh=new Map;for(let[r,n]of this.elementProperties){let o=this._$Eu(r,n);o!==void 0&&this._$Eh.set(o,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let r=[];if(Array.isArray(t)){let n=new Set(t.flat(1/0).reverse());for(let o of n)r.unshift(ct(o))}else t!==void 0&&r.push(ct(t));return r}static _$Eu(t,r){let n=r.attribute;return n===!1?void 0:typeof n==\"string\"?n:typeof t==\"string\"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,r=this.constructor.elementProperties;for(let n of r.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Gt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,r,n){this._$AK(t,n)}_$ET(t,r){let n=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,n);if(o!==void 0&&n.reflect===!0){let s=(n.converter?.toAttribute!==void 0?n.converter:ut).toAttribute(r,n.type);this._$Em=t,s==null?this.removeAttribute(o):this.setAttribute(o,s),this._$Em=null}}_$AK(t,r){let n=this.constructor,o=n._$Eh.get(t);if(o!==void 0&&this._$Em!==o){let s=n.getPropertyOptions(o),i=typeof s.converter==\"function\"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ut;this._$Em=o;let l=i.fromAttribute(r,s.type);this[o]=l??this._$Ej?.get(o)??l,this._$Em=null}}requestUpdate(t,r,n,o=!1,s){if(t!==void 0){let i=this.constructor;if(o===!1&&(s=this[t]),n??=i.getPropertyOptions(t),!((n.hasChanged??Kt)(s,r)||n.useDefault&&n.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,n))))return;this.C(t,r,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:n,reflect:o,wrapped:s},i){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??r??this[t]),s!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||n||(r=void 0),this._$AL.set(t,r)),o===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[o,s]of this._$Ep)this[o]=s;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,s]of n){let{wrapped:i}=s,l=this[o];i!==!0||this._$AL.has(o)||l===void 0||this.C(o,void 0,s,l)}}let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(r)):this._$EM()}catch(n){throw t=!1,this._$EM(),n}t&&this._$AE(r)}willUpdate(t){}_$AE(t){this._$EO?.forEach(r=>r.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(r=>this._$ET(r,this[r])),this._$EM()}updated(t){}firstUpdated(t){}};B.elementStyles=[],B.shadowRootOptions={mode:\"open\"},B[me(\"elementProperties\")]=new Map,B[me(\"finalized\")]=new Map,Tn?.({ReactiveElement:B}),(Pe.reactiveElementVersions??=[]).push(\"2.1.2\");var ft=globalThis,Yt=e=>e,Ie=ft.trustedTypes,Jt=Ie?Ie.createPolicy(\"lit-html\",{createHTML:e=>e}):void 0,ht=\"$lit$\",j=`lit$${Math.random().toFixed(9).slice(2)}$`,pt=\"?\"+j,On=`<${pt}>`,J=document,ye=()=>J.createComment(\"\"),Ee=e=>e===null||typeof e!=\"object\"&&typeof e!=\"function\",mt=Array.isArray,rr=e=>mt(e)||typeof e?.[Symbol.iterator]==\"function\",dt=`[ \t\n\\f\\r]`,ge=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,Qt=/-->/g,Xt=/>/g,K=RegExp(`>|${dt}(?:([^\\\\s\"'>=/]+)(${dt}*=${dt}*(?:[^ \t\n\\f\\r\"'\\`<>=]|(\"|')|))|$)`,\"g\"),Zt=/'/g,er=/\"/g,nr=/^(?:script|style|textarea|title)$/i,gt=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),q=gt(1),Ts=gt(2),Os=gt(3),U=Symbol.for(\"lit-noChange\"),A=Symbol.for(\"lit-nothing\"),tr=new WeakMap,Y=J.createTreeWalker(J,129);function or(e,t){if(!mt(e)||!e.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return Jt!==void 0?Jt.createHTML(t):t}var sr=(e,t)=>{let r=e.length-1,n=[],o,s=t===2?\"<svg>\":t===3?\"<math>\":\"\",i=ge;for(let l=0;l<r;l++){let a=e[l],u,c,d=-1,h=0;for(;h<a.length&&(i.lastIndex=h,c=i.exec(a),c!==null);)h=i.lastIndex,i===ge?c[1]===\"!--\"?i=Qt:c[1]!==void 0?i=Xt:c[2]!==void 0?(nr.test(c[2])&&(o=RegExp(\"</\"+c[2],\"g\")),i=K):c[3]!==void 0&&(i=K):i===K?c[0]===\">\"?(i=o??ge,d=-1):c[1]===void 0?d=-2:(d=i.lastIndex-c[2].length,u=c[1],i=c[3]===void 0?K:c[3]==='\"'?er:Zt):i===er||i===Zt?i=K:i===Qt||i===Xt?i=ge:(i=K,o=void 0);let f=i===K&&e[l+1].startsWith(\"/>\")?\" \":\"\";s+=i===ge?a+On:d>=0?(n.push(u),a.slice(0,d)+ht+a.slice(d)+j+f):a+j+(d===-2?l:f)}return[or(e,s+(e[r]||\"<?>\")+(t===2?\"</svg>\":t===3?\"</math>\":\"\")),n]},be=class e{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let s=0,i=0,l=t.length-1,a=this.parts,[u,c]=sr(t,r);if(this.el=e.createElement(u,n),Y.currentNode=this.el.content,r===2||r===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(o=Y.nextNode())!==null&&a.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(ht)){let h=c[i++],f=o.getAttribute(d).split(j),m=/([.?@])?(.*)/.exec(h);a.push({type:1,index:s,name:m[2],strings:f,ctor:m[1]===\".\"?Ue:m[1]===\"?\"?ke:m[1]===\"@\"?Me:X}),o.removeAttribute(d)}else d.startsWith(j)&&(a.push({type:6,index:s}),o.removeAttribute(d));if(nr.test(o.tagName)){let d=o.textContent.split(j),h=d.length-1;if(h>0){o.textContent=Ie?Ie.emptyScript:\"\";for(let f=0;f<h;f++)o.append(d[f],ye()),Y.nextNode(),a.push({type:2,index:++s});o.append(d[h],ye())}}}else if(o.nodeType===8)if(o.data===pt)a.push({type:2,index:s});else{let d=-1;for(;(d=o.data.indexOf(j,d+1))!==-1;)a.push({type:7,index:s}),d+=j.length-1}s++}}static createElement(t,r){let n=J.createElement(\"template\");return n.innerHTML=t,n}};function Q(e,t,r=e,n){if(t===U)return t;let o=n!==void 0?r._$Co?.[n]:r._$Cl,s=Ee(t)?void 0:t._$litDirective$;return o?.constructor!==s&&(o?._$AO?.(!1),s===void 0?o=void 0:(o=new s(e),o._$AT(e,r,n)),n!==void 0?(r._$Co??=[])[n]=o:r._$Cl=o),o!==void 0&&(t=Q(e,o._$AS(e,t.values),o,n)),t}var Ne=class{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:r},parts:n}=this._$AD,o=(t?.creationScope??J).importNode(r,!0);Y.currentNode=o;let s=Y.nextNode(),i=0,l=0,a=n[0];for(;a!==void 0;){if(i===a.index){let u;a.type===2?u=new ie(s,s.nextSibling,this,t):a.type===1?u=new a.ctor(s,a.name,a.strings,this,t):a.type===6&&(u=new De(s,this,t)),this._$AV.push(u),a=n[++l]}i!==a?.index&&(s=Y.nextNode(),i++)}return Y.currentNode=J,o}p(t){let r=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(t,n,r),r+=n.strings.length-2):n._$AI(t[r])),r++}},ie=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,n,o){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=n,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=Q(this,t,r),Ee(t)?t===A||t==null||t===\"\"?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==U&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):rr(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==A&&Ee(this._$AH)?this._$AA.nextSibling.data=t:this.T(J.createTextNode(t)),this._$AH=t}$(t){let{values:r,_$litType$:n}=t,o=typeof n==\"number\"?this._$AC(t):(n.el===void 0&&(n.el=be.createElement(or(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===o)this._$AH.p(r);else{let s=new Ne(o,this),i=s.u(this.options);s.p(r),this.T(i),this._$AH=s}}_$AC(t){let r=tr.get(t.strings);return r===void 0&&tr.set(t.strings,r=new be(t)),r}k(t){mt(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,o=0;for(let s of t)o===r.length?r.push(n=new e(this.O(ye()),this.O(ye()),this,this.options)):n=r[o],n._$AI(s),o++;o<r.length&&(this._$AR(n&&n._$AB.nextSibling,o),r.length=o)}_$AR(t=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);t!==this._$AB;){let n=Yt(t).nextSibling;Yt(t).remove(),t=n}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},X=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,n,o,s){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=r,this._$AM=o,this.options=s,n.length>2||n[0]!==\"\"||n[1]!==\"\"?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=A}_$AI(t,r=this,n,o){let s=this.strings,i=!1;if(s===void 0)t=Q(this,t,r,0),i=!Ee(t)||t!==this._$AH&&t!==U,i&&(this._$AH=t);else{let l=t,a,u;for(t=s[0],a=0;a<s.length-1;a++)u=Q(this,l[n+a],r,a),u===U&&(u=this._$AH[a]),i||=!Ee(u)||u!==this._$AH[a],u===A?t=A:t!==A&&(t+=(u??\"\")+s[a+1]),this._$AH[a]=u}i&&!o&&this.j(t)}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??\"\")}},Ue=class extends X{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===A?void 0:t}},ke=class extends X{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A)}},Me=class extends X{constructor(t,r,n,o,s){super(t,r,n,o,s),this.type=5}_$AI(t,r=this){if((t=Q(this,t,r,0)??A)===U)return;let n=this._$AH,o=t===A&&n!==A||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,s=t!==A&&(n===A||o);o&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH==\"function\"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},De=class{constructor(t,r,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}},ir={M:ht,P:j,A:pt,C:1,L:sr,R:Ne,D:rr,V:Q,I:ie,H:X,N:ke,U:Me,B:Ue,F:De},Ln=ft.litHtmlPolyfillSupport;Ln?.(be,ie),(ft.litHtmlVersions??=[]).push(\"3.3.3\");var ar=(e,t,r)=>{let n=r?.renderBefore??t,o=n._$litPart$;if(o===void 0){let s=r?.renderBefore??null;n._$litPart$=o=new ie(t.insertBefore(ye(),s),s,void 0,r??{})}return o._$AI(e),o};var yt=globalThis,F=class extends B{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ar(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};F._$litElement$=!0,F.finalized=!0,yt.litElementHydrateSupport?.({LitElement:F});var xn=yt.litElementPolyfillSupport;xn?.({LitElement:F});(yt.litElementVersions??=[]).push(\"4.2.2\");var He={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Be=e=>(...t)=>({_$litDirective$:e,values:t}),ae=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,n){this._$Ct=t,this._$AM=r,this._$Ci=n}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}};var ve=class extends ae{constructor(t){if(super(t),this.it=A,t.type!==He.CHILD)throw Error(this.constructor.directiveName+\"() can only be used in child bindings\")}render(t){if(t===A||t==null)return this._t=void 0,this.it=t;if(t===U)return t;if(typeof t!=\"string\")throw Error(this.constructor.directiveName+\"() called with a non-string value\");if(t===this.it)return this._t;this.it=t;let r=[t];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};ve.directiveName=\"unsafeHTML\",ve.resultType=1;var je=Be(ve);var{I:Pn}=ir,cr=e=>e;var ur=()=>document.createComment(\"\"),le=(e,t,r)=>{let n=e._$AA.parentNode,o=t===void 0?e._$AB:t._$AA;if(r===void 0){let s=n.insertBefore(ur(),o),i=n.insertBefore(ur(),o);r=new Pn(s,i,e,e.options)}else{let s=r._$AB.nextSibling,i=r._$AM,l=i!==e;if(l){let a;r._$AQ?.(e),r._$AM=e,r._$AP!==void 0&&(a=e._$AU)!==i._$AU&&r._$AP(a)}if(s!==o||l){let a=r._$AA;for(;a!==s;){let u=cr(a).nextSibling;cr(n).insertBefore(a,o),a=u}}}return r},V=(e,t,r=e)=>(e._$AI(t,r),e),In={},dr=(e,t=In)=>e._$AH=t,fr=e=>e._$AH,qe=e=>{e._$AR(),e._$AA.remove()};var hr=(e,t,r)=>{let n=new Map;for(let o=t;o<=r;o++)n.set(e[o],o);return n},Nn=Be(class extends ae{constructor(e){if(super(e),e.type!==He.CHILD)throw Error(\"repeat() can only be used in text expressions\")}dt(e,t,r){let n;r===void 0?r=t:t!==void 0&&(n=t);let o=[],s=[],i=0;for(let l of e)o[i]=n?n(l,i):i,s[i]=r(l,i),i++;return{values:s,keys:o}}render(e,t,r){return this.dt(e,t,r).values}update(e,[t,r,n]){let o=fr(e),{values:s,keys:i}=this.dt(t,r,n);if(!Array.isArray(o))return this.ut=i,s;let l=this.ut??=[],a=[],u,c,d=0,h=o.length-1,f=0,m=s.length-1;for(;d<=h&&f<=m;)if(o[d]===null)d++;else if(o[h]===null)h--;else if(l[d]===i[f])a[f]=V(o[d],s[f]),d++,f++;else if(l[h]===i[m])a[m]=V(o[h],s[m]),h--,m--;else if(l[d]===i[m])a[m]=V(o[d],s[m]),le(e,a[m+1],o[d]),d++,m--;else if(l[h]===i[f])a[f]=V(o[h],s[f]),le(e,o[d],o[h]),h--,f++;else if(u===void 0&&(u=hr(i,f,m),c=hr(l,d,h)),u.has(l[d]))if(u.has(l[h])){let p=c.get(i[f]),y=p!==void 0?o[p]:null;if(y===null){let g=le(e,o[d]);V(g,s[f]),a[f]=g}else a[f]=V(y,s[f]),le(e,o[d],y),o[p]=null;f++}else qe(o[h]),h--;else qe(o[d]),d++;for(;f<=m;){let p=le(e,a[m+1]);V(p,s[f]),a[f++]=p}for(;d<=h;){let p=o[d++];p!==null&&qe(p)}return this.ut=i,dr(e,a),U}});var Fe=class extends F{static properties={message:{attribute:!1}};static styles=lt`\n    :host {\n      display: block;\n    }\n    :host([hidden]) {\n      display: none;\n    }\n  `;render(){return this.message===void 0?q`<slot></slot>`:q`<span part=\"message\">${this.message}</span>`}};function pr(e=customElements){let t=e.get(\"be-music-status\");if(t===void 0)e.define(\"be-music-status\",Fe);else if(t!==Fe)throw new Error(\"Conflicting be-music-status element\")}var Hn={requestFailed:\"Request failed\",continueFailed:\"Sign-in could not be continued. Return to the app and start again.\",tryAgain:\"Request failed. Please try again.\",profileFailed:\"Profile update failed\",cannotPrepare:\"Cannot prepare image\",cannotEncode:\"Cannot encode image\",welcome:{handleHint:\"3 to 15 letters, digits or _. Your player page lives at /players/your-handle.\",handleChecking:\"Checking\\u2026\",handleFree:\"That handle is free.\",handle:{format:\"Use 3 to 15 letters, digits or _.\",reserved:\"That handle is reserved.\",taken:\"That handle is taken.\"}},errors:{\"invalid-handle\":\"Handles are 3 to 15 letters, digits or _.\",\"invalid-display-name\":\"That display name cannot be used.\",\"handle-taken\":\"That handle is taken.\",\"not-found\":\"That profile was not found.\",\"sign-in-required\":\"Sign in first.\",\"invalid-origin\":\"That request was refused.\",\"invalid-json\":\"That request could not be read.\",\"invalid-profile\":\"That profile cannot be saved.\",\"avatar-too-large\":\"The image is too large.\",\"unsupported-image\":\"Use a PNG, JPEG or WebP image.\",\"empty-body\":\"Choose an image.\",\"method-not-allowed\":\"That request was refused.\"}},Bn={requestFailed:\"\\u30EA\\u30AF\\u30A8\\u30B9\\u30C8\\u306B\\u5931\\u6557\\u3057\\u307E\\u3057\\u305F\",continueFailed:\"\\u30ED\\u30B0\\u30A4\\u30F3\\u3092\\u7D9A\\u884C\\u3067\\u304D\\u307E\\u305B\\u3093\\u3067\\u3057\\u305F\\u3002\\u30A2\\u30D7\\u30EA\\u306B\\u623B\\u3063\\u3066\\u3001\\u3082\\u3046\\u4E00\\u5EA6\\u59CB\\u3081\\u3066\\u304F\\u3060\\u3055\\u3044\\u3002\",tryAgain:\"\\u30EA\\u30AF\\u30A8\\u30B9\\u30C8\\u306B\\u5931\\u6557\\u3057\\u307E\\u3057\\u305F\\u3002\\u3082\\u3046\\u4E00\\u5EA6\\u8A66\\u3057\\u3066\\u304F\\u3060\\u3055\\u3044\\u3002\",profileFailed:\"\\u30D7\\u30ED\\u30D5\\u30A3\\u30FC\\u30EB\\u3092\\u66F4\\u65B0\\u3067\\u304D\\u307E\\u305B\\u3093\\u3067\\u3057\\u305F\",cannotPrepare:\"\\u753B\\u50CF\\u3092\\u6E96\\u5099\\u3067\\u304D\\u307E\\u305B\\u3093\",cannotEncode:\"\\u753B\\u50CF\\u3092\\u66F8\\u304D\\u51FA\\u305B\\u307E\\u305B\\u3093\",welcome:{handleHint:\"\\u82F1\\u6570\\u5B57\\u3068 _ \\u3067 3\\u301C15 \\u6587\\u5B57\\u3002\\u30D7\\u30EC\\u30A4\\u30E4\\u30FC\\u30DA\\u30FC\\u30B8\\u306F /players/\\u30E6\\u30FC\\u30B6\\u30FC\\u540D \\u306B\\u306A\\u308A\\u307E\\u3059\\u3002\",handleChecking:\"\\u78BA\\u8A8D\\u3057\\u3066\\u3044\\u307E\\u3059\\u2026\",handleFree:\"\\u3053\\u306E\\u30E6\\u30FC\\u30B6\\u30FC\\u540D\\u306F\\u4F7F\\u3048\\u307E\\u3059\\u3002\",handle:{format:\"\\u82F1\\u6570\\u5B57\\u3068 _ \\u3067 3\\u301C15 \\u6587\\u5B57\\u306B\\u3057\\u3066\\u304F\\u3060\\u3055\\u3044\\u3002\",reserved:\"\\u3053\\u306E\\u30E6\\u30FC\\u30B6\\u30FC\\u540D\\u306F\\u4E88\\u7D04\\u3055\\u308C\\u3066\\u3044\\u307E\\u3059\\u3002\",taken:\"\\u3053\\u306E\\u30E6\\u30FC\\u30B6\\u30FC\\u540D\\u306F\\u3059\\u3067\\u306B\\u4F7F\\u308F\\u308C\\u3066\\u3044\\u307E\\u3059\\u3002\"}},errors:{\"invalid-handle\":\"\\u30E6\\u30FC\\u30B6\\u30FC\\u540D\\u306F\\u82F1\\u6570\\u5B57\\u3068 _ \\u3067 3\\u301C15 \\u6587\\u5B57\\u3067\\u3059\\u3002\",\"invalid-display-name\":\"\\u305D\\u306E\\u8868\\u793A\\u540D\\u306F\\u4F7F\\u3048\\u307E\\u305B\\u3093\\u3002\",\"handle-taken\":\"\\u3053\\u306E\\u30E6\\u30FC\\u30B6\\u30FC\\u540D\\u306F\\u3059\\u3067\\u306B\\u4F7F\\u308F\\u308C\\u3066\\u3044\\u307E\\u3059\\u3002\",\"not-found\":\"\\u30D7\\u30ED\\u30D5\\u30A3\\u30FC\\u30EB\\u304C\\u898B\\u3064\\u304B\\u308A\\u307E\\u305B\\u3093\\u3002\",\"sign-in-required\":\"\\u5148\\u306B\\u30ED\\u30B0\\u30A4\\u30F3\\u3057\\u3066\\u304F\\u3060\\u3055\\u3044\\u3002\",\"invalid-origin\":\"\\u3053\\u306E\\u30EA\\u30AF\\u30A8\\u30B9\\u30C8\\u306F\\u62D2\\u5426\\u3055\\u308C\\u307E\\u3057\\u305F\\u3002\",\"invalid-json\":\"\\u30EA\\u30AF\\u30A8\\u30B9\\u30C8\\u3092\\u8AAD\\u3081\\u307E\\u305B\\u3093\\u3067\\u3057\\u305F\\u3002\",\"invalid-profile\":\"\\u30D7\\u30ED\\u30D5\\u30A3\\u30FC\\u30EB\\u3092\\u4FDD\\u5B58\\u3067\\u304D\\u307E\\u305B\\u3093\\u3002\",\"avatar-too-large\":\"\\u753B\\u50CF\\u304C\\u5927\\u304D\\u3059\\u304E\\u307E\\u3059\\u3002\",\"unsupported-image\":\"PNG\\u30FBJPEG\\u30FBWebP \\u306E\\u753B\\u50CF\\u3092\\u4F7F\\u3063\\u3066\\u304F\\u3060\\u3055\\u3044\\u3002\",\"empty-body\":\"\\u753B\\u50CF\\u3092\\u9078\\u3093\\u3067\\u304F\\u3060\\u3055\\u3044\\u3002\",\"method-not-allowed\":\"\\u3053\\u306E\\u30EA\\u30AF\\u30A8\\u30B9\\u30C8\\u306F\\u62D2\\u5426\\u3055\\u308C\\u307E\\u3057\\u305F\\u3002\"}};function mr(e){return e?.toLowerCase().split(\"-\")[0]===\"ja\"?Bn:Hn}function Et(e,t,r){return e!==void 0&&e in r.errors?r.errors[e]:e??t}var gr=\"1.7.26\";var yr=gr;var bt=Symbol.for(\"better-auth:broadcast-channel\"),jn=()=>Math.floor(Date.now()/1e3),qn=class{listeners=new Set;name;constructor(e=\"better-auth.message\"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>\"u\"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:jn()}))}catch{}}setup(){if(typeof window>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=window,t=r=>{if(r.key!==this.name)return;let n=JSON.parse(r.newValue??\"{}\");n?.event!==\"session\"||!n?.data||this.listeners.forEach(o=>o(n))};return e.addEventListener(\"storage\",t),()=>{e.removeEventListener(\"storage\",t)}}};function Ve(e=\"better-auth.message\"){return globalThis[bt]||(globalThis[bt]=new qn(e)),globalThis[bt]}var C=[],Se=0,Z=null,vt=4,Fn=globalThis.nanostoresGlobal||={epoch:0},Vn=()=>{let e,t;for(;Se<C.length;){t=Se,Se+=vt;let r=Z?.get(C[t]);if(r){if(!r.has(C[t+1]))continue;r.clear()}try{C[t](C[t+1].value,C[t+2],C[t+3])}catch(n){e=n}}if(C.length=Se=0,e)throw e};var ee=e=>{let t=[],r={eq:Object.is,get(){return r.lc||r.listen(()=>{})(),r.value},init:e,lc:0,listen(n){return r.lc=t.push(n),()=>{Z?.get(n)?.delete(r);for(let s=Se;s<C.length;)C[s]===n&&C[s+1]===r?C.splice(s,vt):s+=vt;let o=t.indexOf(n);~o&&(t.splice(o,1),--r.lc||r.off())}},notify(n,o){Fn.epoch++;let s=!C.length&&!Z;for(let i of t){if(Z){let l=Z.get(i);if(l||Z.set(i,l=new Set),l.has(r))continue;l.add(r)}C.push(i,r,n,Z?void 0:o)}s&&Vn()},off(){},set(n){let o=r.value;r.eq(o,n)||(r.value=n,r.notify(o))},subscribe(n){let o=r.listen(n);return n(r.value),o},value:e};return r};var Gn=2;var zn=5,Ge=6,ze=10,Er=(e,t,r,n)=>(e.events=e.events||{},e.events[r+ze]||(e.events[r+ze]=n(o=>{e.events[r].reduceRight((s,i)=>(i(s),s),{shared:{},...o})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],s=o.indexOf(t);~s&&(o.splice(s,1),o.length||(e.events[r+ze](),delete e.events[r+ze]))});var St=(e,t)=>Er(e,t,Gn,r=>{let n=e.set,o=e.setKey;return e.setKey&&(e.setKey=(s,i)=>{let l;if(r({abort:()=>{l=!0},changed:s,newValue:{...e.value,[s]:i}}),!l)return o(s,i)}),e.set=s=>{let i;if(r({abort:()=>{i=!0},newValue:s}),!i)return n(s)},()=>{e.set=n,e.setKey=o}});var We=1e3,ce=(e,t)=>Er(e,n=>{let o=t(n);o&&e.events[Ge].push(o)},zn,n=>{let o=e.listen;e.listen=(...i)=>(!e.lc&&!e.active&&(e.active=!0,n()),o(...i));let s=e.off;return e.events[Ge]=[],e.off=()=>{s(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let i of e.events[Ge])i();e.events[Ge]=[]}},We)},()=>{e.listen=o,e.off=s}});function br(e){if(typeof e!=\"object\"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function G(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!G(e[r],t[r]))return!1;return!0}if(br(e)&&br(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!(o in t)||!G(e[o],t[o]))return!1;return!0}return!1}function Ke(e,t){return St(e,({newValue:r,abort:n})=>{t(e.value,r)&&n()})}var At=Symbol.for(\"better-auth:focus-manager\"),Wn=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>\"u\"||typeof document>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=document,t=()=>{document.visibilityState===\"visible\"&&this.setFocused(!0)};return e.addEventListener(\"visibilitychange\",t,!1),()=>{e.removeEventListener(\"visibilitychange\",t,!1)}}};function Rt(){return globalThis[At]||(globalThis[At]=new Wn),globalThis[At]}var wt=Symbol.for(\"better-auth:online-manager\"),Kn=class{listeners=new Set;isOnline=globalThis.navigator?.onLine??!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>\"u\"||typeof window.addEventListener>\"u\")return()=>{};let e=window,t=()=>this.setOnline(!0),r=()=>this.setOnline(!1);return e.addEventListener(\"online\",t,!1),e.addEventListener(\"offline\",r,!1),()=>{e.removeEventListener(\"online\",t,!1),e.removeEventListener(\"offline\",r,!1)}}};function Ye(){return globalThis[wt]||(globalThis[wt]=new Kn),globalThis[wt]}var Yn=/^\\s*[\"[{]|^\\s*-?\\d{1,16}(\\.\\d{1,17})?([Ee][+-]?\\d+)?\\s*$/,vr={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,\"-infinity\":Number.NEGATIVE_INFINITY},Jn=/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d{1,7}))?(?:Z|([+-])(\\d{2}):(\\d{2}))$/;function Qn(e){return e instanceof Date&&!isNaN(e.getTime())}function Xn(e){let t=Jn.exec(e);if(!t)return null;let[,r,n,o,s,i,l,a,u,c,d]=t,h=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(o,10),parseInt(s,10),parseInt(i,10),parseInt(l,10),a?parseInt(a.padEnd(3,\"0\"),10):0));if(u){let f=(parseInt(c,10)*60+parseInt(d,10))*(u===\"+\"?-1:1);h.setUTCMinutes(h.getUTCMinutes()+f)}return Qn(h)?h:null}function Zn(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:o,parseDates:s=!0}=t;if(typeof e!=\"string\")return e;let i=e.trim(),l=i.toLowerCase();if(l.length<=9&&l in vr)return vr[l];if(!Yn.test(i)){if(r)throw new SyntaxError(\"[better-json] Invalid JSON\");return e}try{return JSON.parse(i,(u,c)=>{if(u===\"__proto__\"||u===\"constructor\"&&c&&typeof c==\"object\"&&\"prototype\"in c){if(r)throw new Error(\"[better-json] Potential prototype pollution attempt detected\");n&&console.warn(`[better-json] Dropping \"${u}\" key to prevent prototype pollution`);return}if(s&&typeof c==\"string\"){let d=Xn(c);if(d)return d}return o?o(u,c):c})}catch(a){if(r)throw a;return e}}function Sr(e,t={strict:!0}){return Zn(e,t)}var eo=Symbol.for(\"better-auth:auth-query\");function Je(e){let t=ee(e);return Object.defineProperty(t,eo,{value:!0}),t}var to=()=>typeof window>\"u\";function ro(e,t){return G(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}var _t=(e,t,r,n)=>{let o=Je({data:null,error:null,isPending:!0,isRefetching:!1,refetch:d=>i(d)});ce(o,()=>Ke(o,ro));let s=0,i=async d=>{let h=++s;return new Promise(f=>{let m=typeof n==\"function\"?n({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):n;r(t,{...m,query:{...m?.query,...d?.query},async onSuccess(p){if(h===s){let y=o.get(),g=y.data!=null&&p.data!=null&&G(y.data,p.data)?y.data:p.data;o.set({data:g,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}await m?.onSuccess?.(p)},async onError(p){let{request:y}=p,g=typeof y.retry==\"number\"?y.retry:y.retry?.attempts,w=y.retryAttempt||0;if(!(g&&w<g)){if(h===s){let b=p.error.status===401;o.set({error:p.error,data:b?null:o.get().data,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}await m?.onError?.(p)}},async onRequest(p){if(h===s){let y=o.get();o.set({isPending:y.data===null,data:y.data,error:null,isRefetching:!0,refetch:o.value.refetch})}await m?.onRequest?.(p)}}).catch(p=>{h===s&&o.set({error:p,data:o.get().data,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{f(void 0)})})};e=Array.isArray(e)?e:[e];let l=!1,a=!1,u=!1,c=()=>{if(l){u=!0;return}l=!0,i().finally(()=>{l=!1;let d=u&&a;u=!1,d&&c()})};return ce(o,()=>{if(to())return;a=!0;let d=!1,h,f=e.map(m=>m.listen(()=>{d?i():(d=!0,clearTimeout(h),c())}));return h=setTimeout(()=>{d=!0,c()},0),()=>{a=!1;for(let m of f)m();clearTimeout(h)}}),o};var Tt=()=>Math.floor(Date.now()/1e3),no=5;function Ar(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:o={}}=e,s=o.sessionOptions?.refetchInterval??0,i=o.sessionOptions?.refetchOnWindowFocus??!0,l=o.sessionOptions?.refetchWhenOffline??!1,a={isInitialized:!1,lastSessionRequest:0},u=()=>l||Ye().isOnline,c=b=>{if(u()){if(b?.event===\"storage\"){t();return}if(b?.event===\"poll\"){a.lastSessionRequest=Tt(),t();return}if(b?.event===\"visibilitychange\"){if(Tt()-a.lastSessionRequest<no)return;a.lastSessionRequest=Tt(),t();return}t()}},d=b=>{Ve().post({event:\"session\",data:{trigger:b},clientId:Math.random().toString(36).substring(7)})},h=()=>{s&&s>0&&(a.pollInterval=setInterval(()=>{r()&&c({event:\"poll\"})},s*1e3))},f=()=>{a.unsubscribeBroadcast=Ve().subscribe(()=>{c({event:\"storage\"})})},m=()=>{i&&(a.unsubscribeFocus=Rt().subscribe(()=>{c({event:\"visibilitychange\"})}))},p=()=>{a.unsubscribeOnline=Ye().subscribe(b=>{b&&c({event:\"visibilitychange\"})})},y=()=>{a.unsubscribeSignal=n.listen(()=>{t()})};return{init:()=>{a.isInitialized||(a.isInitialized=!0,y(),!(typeof window>\"u\")&&(h(),f(),m(),p(),a.cleanupBroadcastSetup=Ve().setup(),a.cleanupFocusSetup=Rt().setup(),a.cleanupOnlineSetup=Ye().setup()))},cleanup:()=>{a.isInitialized&&(a.pollInterval&&(clearInterval(a.pollInterval),a.pollInterval=void 0),a.unsubscribeBroadcast&&(a.unsubscribeBroadcast(),a.unsubscribeBroadcast=void 0),a.unsubscribeFocus&&(a.unsubscribeFocus(),a.unsubscribeFocus=void 0),a.unsubscribeOnline&&(a.unsubscribeOnline(),a.unsubscribeOnline=void 0),a.unsubscribeSignal&&(a.unsubscribeSignal(),a.unsubscribeSignal=void 0),a.cleanupBroadcastSetup&&(a.cleanupBroadcastSetup(),a.cleanupBroadcastSetup=void 0),a.cleanupFocusSetup&&(a.cleanupFocusSetup(),a.cleanupFocusSetup=void 0),a.cleanupOnlineSetup&&(a.cleanupOnlineSetup(),a.cleanupOnlineSetup=void 0),a.isInitialized=!1,a.lastSessionRequest=0)},triggerRefetch:c,broadcastSessionUpdate:d}}var Rr=()=>\"Deno\"in globalThis,wr=()=>\"Bun\"in globalThis;var Qe=Object.create(null),Ae=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?Qe:globalThis),L=new Proxy(Qe,{get(e,t){return Ae()[t]??Qe[t]},has(e,t){return t in Ae()||t in Qe},set(e,t,r){let n=Ae(!0);return n[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=Ae(!0);return delete r[t],!0},ownKeys(){let e=Ae(!0);return Object.keys(e)}});var oo=L.NODE_ENV??\"\";function S(e,t){return typeof process<\"u\"&&process.env?process.env[e]??t:Rr()?Deno.env.get(e)??t:wr()?Bun.env[e]??t:t}var so=Object.freeze({get BETTER_AUTH_SECRET(){return S(\"BETTER_AUTH_SECRET\")},get AUTH_SECRET(){return S(\"AUTH_SECRET\")},get BETTER_AUTH_TELEMETRY(){return S(\"BETTER_AUTH_TELEMETRY\")},get BETTER_AUTH_TELEMETRY_ID(){return S(\"BETTER_AUTH_TELEMETRY_ID\")},get NODE_ENV(){return S(\"NODE_ENV\",\"development\")},get PACKAGE_VERSION(){return S(\"PACKAGE_VERSION\",\"0.0.0\")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return S(\"BETTER_AUTH_TELEMETRY_ENDPOINT\",\"\")}});var Re=1,T=4,M=8,I=24,_r={eterm:T,cons25:T,console:T,cygwin:T,dtterm:T,gnome:T,hurd:T,jfbterm:T,konsole:T,kterm:T,mlterm:T,mosh:I,putty:T,st:T,\"rxvt-unicode-24bit\":I,terminator:I,\"xterm-kitty\":I},io=new Map(Object.entries({APPVEYOR:M,BUILDKITE:M,CIRCLECI:I,DRONE:M,GITEA_ACTIONS:I,GITHUB_ACTIONS:I,GITLAB_CI:M,TRAVIS:M})),ao=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function Tr(){if(S(\"FORCE_COLOR\")!==void 0)switch(S(\"FORCE_COLOR\")){case\"\":case\"1\":case\"true\":return T;case\"2\":return M;case\"3\":return I;default:return Re}if(S(\"NODE_DISABLE_COLORS\")!==void 0&&S(\"NODE_DISABLE_COLORS\")!==\"\"||S(\"NO_COLOR\")!==void 0&&S(\"NO_COLOR\")!==\"\"||S(\"TERM\")===\"dumb\")return Re;if(S(\"TMUX\"))return I;if(\"TF_BUILD\"in L&&\"AGENT_NAME\"in L)return T;if(\"CI\"in L){for(let{0:e,1:t}of io)if(e in L)return t;return S(\"CI_NAME\")===\"codeship\"?M:Re}if(\"TEAMCITY_VERSION\"in L)return/^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.exec(S(\"TEAMCITY_VERSION\"))!==null?T:Re;switch(S(\"TERM_PROGRAM\")){case\"iTerm.app\":return!S(\"TERM_PROGRAM_VERSION\")||/^[0-2]\\./.exec(S(\"TERM_PROGRAM_VERSION\"))!==null?M:I;case\"HyperTerm\":case\"MacTerm\":return I;case\"Apple_Terminal\":return M}if(S(\"COLORTERM\")===\"truecolor\"||S(\"COLORTERM\")===\"24bit\")return I;if(S(\"TERM\")){if(/truecolor/.exec(S(\"TERM\"))!==null)return I;if(/^xterm-256/.exec(S(\"TERM\"))!==null)return M;let e=S(\"TERM\").toLowerCase();if(_r[e])return _r[e];if(ao.some(t=>t.exec(e)!==null))return T}return S(\"COLORTERM\")?T:Re}var we=Symbol.for(\"better-auth:global\"),_e=null,lo={},Ot=\"1.7.26\";function co(){return globalThis[we]||(globalThis[we]={version:Ot,epoch:1,context:lo},_e=globalThis[we]),_e=globalThis[we],_e.version!==Ot&&(_e.version=Ot,_e.epoch++),globalThis[we]}function Or(){return co().context.endpointContextAsyncStorage?.getStore()}var D={reset:\"\\x1B[0m\",bright:\"\\x1B[1m\",dim:\"\\x1B[2m\",undim:\"\\x1B[22m\",underscore:\"\\x1B[4m\",blink:\"\\x1B[5m\",reverse:\"\\x1B[7m\",hidden:\"\\x1B[8m\",fg:{black:\"\\x1B[30m\",red:\"\\x1B[31m\",green:\"\\x1B[32m\",yellow:\"\\x1B[33m\",blue:\"\\x1B[34m\",magenta:\"\\x1B[35m\",cyan:\"\\x1B[36m\",white:\"\\x1B[37m\"},bg:{black:\"\\x1B[40m\",red:\"\\x1B[41m\",green:\"\\x1B[42m\",yellow:\"\\x1B[43m\",blue:\"\\x1B[44m\",magenta:\"\\x1B[45m\",cyan:\"\\x1B[46m\",white:\"\\x1B[47m\"}},Lt=[\"debug\",\"info\",\"success\",\"warn\",\"error\"];function uo(e,t){return Lt.indexOf(t)>=Lt.indexOf(e)}var fo={info:D.fg.blue,success:D.fg.green,warn:D.fg.yellow,error:D.fg.red,debug:D.fg.magenta},ho=(e,t,r)=>{let n=new Date().toISOString();return r?`${D.dim}${n}${D.reset} ${fo[e]}${e.toUpperCase()}${D.reset} ${D.bright}[Better Auth]:${D.reset} ${t}`:`${n} ${e.toUpperCase()} [Better Auth]: ${t}`},po=e=>{let t=e?.disabled!==!0,r=e?.level??\"warn\",n=e?.disableColors!==void 0?!e.disableColors:Tr()!==1,o=(s,i,l=[])=>{if(!t||!uo(r,s))return;let a=ho(s,i,n);if(!e||typeof e.log!=\"function\"){s===\"error\"?console.error(a,...l):s===\"warn\"?console.warn(a,...l):console.log(a,...l);return}e.log(s===\"success\"?\"info\":s,i,...l)};return{...Object.fromEntries(Lt.map(s=>[s,(...[i,...l])=>o(s,i,l)])),get level(){return r}}},mo=po(),ue=()=>{let e=Or()?.context.logger;return e&&e!==xt?e:mo},xt={debug:(...e)=>ue().debug(...e),info:(...e)=>ue().info(...e),success:(...e)=>ue().success(...e),warn:(...e)=>ue().warn(...e),error:(...e)=>ue().error(...e),get level(){return ue().level}};function Xe(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{code:t,message:r,toString:()=>t}]))}function go(){let e=Object.getOwnPropertyDescriptor(Error,\"stackTraceLimit\");return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,\"writable\")?e.writable:e.set!==void 0}function yo(e){let t=e.split(`\n    at `);return t.length<=1?e:(t.splice(1,1),t.join(`\n    at `))}function Eo(e,t){class r extends e{#e;constructor(...o){if(go()){let i=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...o),Error.stackTraceLimit=i}else super(...o);let s=new Error().stack;s&&(this.#e=yo(s.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(r.prototype,\"constructor\",{get(){return t},enumerable:!1,configurable:!0}),r}var bo={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,\"I'M_A_TEAPOT\":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511},vo=class extends Error{status;body;headers;statusCode;constructor(e=\"INTERNAL_SERVER_ERROR\",t=void 0,r={},n=typeof e==\"number\"?e:bo[e]){if(super(t?.message,t&&\"cause\"in t?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name=\"APIError\",this.status=e,this.headers=r,this.statusCode=n,t&&\"cause\"in t){let{cause:o,...s}=t;this.body=Object.defineProperty(s,\"cause\",{value:o,writable:!0,configurable:!0});return}this.body=t}};var So=Eo(vo,Error);var de=class extends Error{constructor(e,t){super(e,t),this.name=\"BetterAuthError\",this.message=e,this.stack=\"\"}};var Ao=47;function xr(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===Ao;)t--;return t===e.length?e:e.slice(0,t)}function Ro(e){try{return(xr(new URL(e).pathname)||\"/\")!==\"/\"}catch{throw new de(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function wo(e){try{let t=new URL(e);if(t.protocol!==\"http:\"&&t.protocol!==\"https:\")throw new de(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof de?t:new de(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function Te(e,t=\"/api/auth\"){if(wo(e),Ro(e))return e;let r=xr(e);return!t||t===\"/\"?r:(t=t.startsWith(\"/\")?t:`/${t}`,`${r}${t}`)}function Lr(e,t){return!e||e.trim()===\"\"?!1:t===\"proto\"?e===\"http\"||e===\"https\":t===\"host\"?[/\\.\\./,/\\0/,/[\\s]/,/^[.]/,/[<>'\"]/,/javascript:/i,/file:/i,/data:/i].some(r=>r.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\\d{1,3}\\.){3}\\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\\[[0-9a-fA-F:]+\\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Cr(e,t,r,n,o){if(e)return Te(e,t);if(n!==!1){let l=L.BETTER_AUTH_URL||L.NEXT_PUBLIC_BETTER_AUTH_URL||L.PUBLIC_BETTER_AUTH_URL||L.NUXT_PUBLIC_BETTER_AUTH_URL||L.NUXT_PUBLIC_AUTH_URL||(L.BASE_URL!==\"/\"?L.BASE_URL:void 0);if(l)return Te(l,t)}let s=r?.headers.get(\"x-forwarded-host\"),i=r?.headers.get(\"x-forwarded-proto\");if(s&&i&&o&&Lr(i,\"proto\")&&Lr(s,\"host\"))try{return Te(`${i}://${s}`,t)}catch{}if(r){let l=_o(r.url);if(!l)throw new de(\"Could not get origin from request. Please provide a valid base URL.\");return Te(l,t)}if(typeof window<\"u\"&&window.location)return Te(window.location.origin,t)}function _o(e){try{let t=new URL(e);return t.origin===\"null\"?null:t.origin}catch{return null}}var To=[\"javascript:\",\"data:\",\"vbscript:\"];function $r(e){let t;try{t=new URL(e)}catch{return!0}return!To.includes(t.protocol)}var Pr={id:\"redirect\",name:\"Redirect\",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&$r(e.data.url)&&typeof window<\"u\"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};var Oo=()=>typeof window>\"u\",Lo=We;function Nr(e,t){if(typeof window>\"u\")return;let r=e.get();r.data!==null||t===null||e.set({...r,data:t,error:null,isPending:!1})}function Ir(e){return typeof e==\"object\"&&e!==null&&\"data\"in e&&\"error\"in e?e:{data:e,error:null}}function xo(e){return!e||e.session===null&&e.user===null?null:e}function Co(e,t){return G(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Ur(e,t){let r=ee(!1),n,o=0,s=0;r.listen(()=>{s++,o=0});let i=f=>c(f),l=Je({data:null,error:null,isPending:!0,isRefetching:!1,refetch:i});Ke(l,Co);let a=async(f,m)=>{let p=l.value;if(l.set({...p,isPending:p.data===null,isRefetching:!0,error:null,refetch:i}),f.aborted)return\"aborted\";try{let y=await e(\"/get-session\",{method:\"GET\",query:m?.query,signal:f});if(f.aborted)return\"aborted\";let{data:g,error:w}=Ir(y),b=\"fresh\";if(g?.needsRefresh)try{let E=await e(\"/get-session\",{method:\"POST\",body:{},signal:f});if(f.aborted)return\"aborted\";({data:g,error:w}=Ir(E))}catch{if(f.aborted)return\"aborted\";b=\"stale\"}if(w){let E=l.value,oe=w?.status===401;return l.set({data:oe?null:E.data,error:w,isPending:!1,isRefetching:!1,refetch:i}),\"failed\"}let P=xo(g),O=l.value,k=O.data!=null&&P!=null&&G(O.data,P)?O.data:P;return l.set({data:k,error:null,isPending:!1,isRefetching:!1,refetch:i}),b}catch(y){if(f.aborted)return\"aborted\";let g=l.value;return l.set({data:g.data,error:y,isPending:!1,isRefetching:!1,refetch:i}),\"failed\"}},u=()=>{let f=l.value.data?.session?.expiresAt,m=f instanceof Date?f.getTime():Number.POSITIVE_INFINITY;return Math.min(Date.now()+Lo,m)},c=f=>{o=0,n?.cancel();let m=new AbortController,p={cancel:()=>m.abort(),promise:Promise.resolve().then(()=>m.signal.aborted?\"aborted\":a(m.signal,f)),revision:s};n=p;let y=g=>{n===p&&(n=void 0,g===\"fresh\"&&p.revision===s&&(o=u()))};return p.promise.then(y,()=>y(\"failed\")),p.promise.then(()=>{})},d=()=>n?.revision===s?n.promise.then(()=>{}):Date.now()<o?Promise.resolve():c(),h=()=>{};return ce(l,()=>{let f;Oo()||(f=setTimeout(()=>{d()},0));let m=Ar({fetchSession:c,shouldPollSession:()=>l.value.data!=null,sessionSignal:r,options:t});return m.init(),h=m.broadcastSessionUpdate,()=>{f&&clearTimeout(f),m.cleanup()}}),{session:l,$sessionSignal:r,broadcastSessionUpdate:f=>h(f)}}function Ct(e){if(e===null||typeof e!=\"object\")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===\"[object Module]\":!0}function $t(e,t,r=\".\",n){if(!Ct(t))return $t(e,{},r,n);let o={...t};for(let s of Object.keys(e)){if(s===\"__proto__\"||s===\"constructor\")continue;let i=e[s];i!=null&&(n&&n(o,s,i,r)||(Array.isArray(i)&&Array.isArray(o[s])?o[s]=[...i,...o[s]]:Ct(i)&&Ct(o[s])?o[s]=$t(i,o[s],(r?`${r}.`:\"\")+s.toString(),n):o[s]=i))}return o}function Pt(e){return(...t)=>t.reduce((r,n)=>$t(r,n,\"\",e),{})}var kr=Pt(),$l=Pt((e,t,r)=>{if(e[t]!==void 0&&typeof r==\"function\")return e[t]=r(e[t]),!0}),Pl=Pt((e,t,r)=>{if(Array.isArray(e[t])&&typeof r==\"function\")return e[t]=r(e[t]),!0});var $o=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r,Error.captureStackTrace(this,this.constructor)}},Po=async(e,t)=>{let r=t||{},n={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:r,hooks:n};for(let c of t?.plugins||[]){var o,s,i,l,a;if(c.init){var u;let d=await((u=c.init)===null||u===void 0?void 0:u.call(c,e.toString(),r));r=d.options||r,e=d.url}n.onRequest.push((o=c.hooks)===null||o===void 0?void 0:o.onRequest),n.onResponse.push((s=c.hooks)===null||s===void 0?void 0:s.onResponse),n.onSuccess.push((i=c.hooks)===null||i===void 0?void 0:i.onSuccess),n.onError.push((l=c.hooks)===null||l===void 0?void 0:l.onError),n.onRetry.push((a=c.hooks)===null||a===void 0?void 0:a.onRetry)}return{url:e,options:r,hooks:n}},Mr=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Io=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function No(e){if(typeof e==\"number\")return new Mr({type:\"linear\",attempts:e,delay:1e3});switch(e.type){case\"linear\":return new Mr(e);case\"exponential\":return new Io(e);default:throw new Error(\"Invalid retry strategy\")}}var Uo=[\"get\",\"post\",\"put\",\"patch\",\"delete\"];function Ut(e){if(!e.startsWith(\"@\"))return{method:void 0,path:e};let t=e.indexOf(\"/\"),r=e.slice(1,t===-1?void 0:t);return Uo.includes(r)?{method:r,path:t===-1?e:e.slice(t+1)}:{method:void 0,path:e}}var jr=/^[a-z][a-z\\d+.-]*:\\/\\/[^/?#]+/i,ko=/^\\/+/;function qr(e){let t=e.length;for(;t>0&&e[t-1]===\"/\";)t--;return e.slice(0,t)}function It(e,t){let r=e.indexOf(t);return r===-1?[e,void 0]:[e.slice(0,r),e.slice(r+1)]}var Mo=e=>e===\".\"||e===\"..\",Do=e=>e.split(\":\").map(t=>encodeURIComponent(t)).join(\":\");function Ho(e,t){let r=t.get(e);if(r===void 0)return Do(e);if(Mo(r))throw new TypeError(\"Path parameters cannot be reserved path segments\");return encodeURIComponent(r)}function Bo(e,t){let r=new Map;if(t)if(Array.isArray(t)){let n=e.split(\"/\").filter(o=>o.startsWith(\":\"));for(let[o,s]of n.entries()){let i=t[o];r.set(s,String(i))}}else for(let[n,o]of Object.entries(t))r.set(`:${n}`,String(o));return r}function jo(e,t){let r=Bo(e,t);return e.split(\"/\").map(n=>Ho(n,r)).join(\"/\")}function qo(e,t){let r=new URLSearchParams(e);for(let[o,s]of Object.entries(t||{})){if(s==null)continue;let i;if(typeof s==\"string\")i=s;else if(Array.isArray(s)){for(let l of s)r.append(o,l);continue}else i=JSON.stringify(s);r.set(o,i)}let n=r.toString();return n.length>0?`?${n}`.replace(/\\+/g,\"%20\"):\"\"}function Fo(e,t){if(!t)return e;let r=`${qr(t)}/`;return e.startsWith(r)?e.slice(r.length):e}function Vo(e,t,r,n){let[o]=It(e,\"#\"),[s,i=\"\"]=It(o,\"?\"),l=t.replace(ko,\"\"),a=qo(`${i}&${r??\"\"}`,n),u=`${qr(s)}/${l}${a}`;return jr.test(u)?new URL(u):u}function Go(e,t){var r,n;let{baseURL:o,params:s,query:i}=t||{query:{},params:{},baseURL:\"\"},{path:l}=Ut(e),a=l===e?e:`/${l}`,u=(r=a.match(jr))===null||r===void 0?void 0:r[0],[c,d]=It(u?a.slice(u.length):Fo(a,o),\"?\"),h=jo(c,s);return Vo((n=u??o)!==null&&n!==void 0?n:\"\",h,d,i)}var zo=async e=>{let t={},r=async n=>typeof n==\"function\"?await n():n;if(e?.auth){if(e.auth.type===\"Bearer\"){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if(e.auth.type===\"Basic\"){let[n,o]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!o)return t;t.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if(e.auth.type===\"Custom\"){let[n,o]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!o)return t;t.authorization=`${n??\"\"} ${o}`}}return t},Wo=/^application\\/(?:[\\w!#$%&*.^`~-]*\\+)?json(;.+)?$/i;function Ko(e){let t=e.headers.get(\"content-type\"),r=new Set([\"image/svg\",\"application/xml\",\"application/xhtml\",\"application/html\"]);if(!t)return\"json\";let n=t.split(\";\").shift()||\"\";return Wo.test(n)?\"json\":r.has(n)||n.startsWith(\"text/\")?\"text\":\"blob\"}function Yo(e){try{return JSON.parse(e),!0}catch{return!1}}function Fr(e){if(e===void 0)return!1;let t=typeof e;return t===\"string\"||t===\"number\"||t===\"boolean\"||t===null?!0:t!==\"object\"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===\"Object\"||typeof e.toJSON==\"function\"}function Dr(e){try{return JSON.parse(e)}catch{return e}}function Hr(e){return typeof e==\"function\"}function Jo(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<\"u\"&&Hr(globalThis.fetch))return globalThis.fetch;if(typeof window<\"u\"&&Hr(window.fetch))return window.fetch;throw new Error(\"No fetch implementation found\")}function Vr(e){return e?[\"POST\",\"PUT\",\"PATCH\",\"DELETE\"].includes(e.toUpperCase()):!1}function Gr(...e){let t={};for(let r of e)if(r)if(r instanceof Headers)r.forEach((n,o)=>{t[o]=n});else{let n=Array.isArray(r)?r:Object.entries(r);for(let[o,s]of n)s!=null&&(t[o]=s)}return t}async function Qo(e){let t=new Headers(Gr(e?.headers,await zo(e)));if(!t.has(\"content-type\")){let r=Xo(e?.body);r&&t.set(\"content-type\",r)}return t}function Xo(e){return Fr(e)?\"application/json\":null}function Zo(e){let t=e.get(\"content-type\");return t?t.split(\";\")[0].trim().toLowerCase():null}function es(e,t){let{body:r}=e;return r?!Fr(r)||typeof r==\"string\"?r:Zo(t)===\"application/x-www-form-urlencoded\"?new URLSearchParams(r).toString():JSON.stringify(r):null}function ts(e,t){if(t?.method)return t.method.toUpperCase();let{method:r}=Ut(e);return r?r.toUpperCase():t?.body?\"POST\":\"GET\"}function rs(e,t){let r;return!e?.signal&&e?.timeout&&(r=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var ns=class zr extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,zr.prototype)}};async function Oe(e,t){let r=await e[\"~standard\"].validate(t);if(r.issues)throw new ns(r.issues);return r.value}function Le(e){\"@babel/helpers - typeof\";return Le=typeof Symbol==\"function\"&&typeof Symbol.iterator==\"symbol\"?function(t){return typeof t}:function(t){return t&&typeof Symbol==\"function\"&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},Le(e)}function os(e,t){if(Le(e)!=\"object\"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||\"default\");if(Le(n)!=\"object\")return n;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return(t===\"string\"?String:Number)(e)}function ss(e){var t=os(e,\"string\");return Le(t)==\"symbol\"?t:t+\"\"}function is(e,t,r){return(t=ss(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Br(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Br(Object(r),!0).forEach(function(n){is(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var Nt=async(e,t)=>{var r,n,o;let{hooks:s,url:i,options:l}=await Po(e,t),a=Jo(l),u=new AbortController,c=(r=l.signal)!==null&&r!==void 0?r:u.signal,d=Go(i,l),h=await Qo(l),f=es(l,h),m=ts(i,l),p=v(v({},l),{},{url:d,headers:h,body:f,method:m,signal:c});for(let x of s.onRequest)if(x){let _=await x(p);typeof _==\"object\"&&_!==null&&Object.assign(p,_)}(\"pipeTo\"in p&&typeof p.pipeTo==\"function\"||typeof(t==null||(n=t.body)===null||n===void 0?void 0:n.pipe)==\"function\")&&(\"duplex\"in p||(p.duplex=\"half\"));let{clearTimeout:y}=rs(l,u),g=await a(p.url,p);y();let w={response:g,request:p};for(let x of s.onResponse)if(x){var b;let _=await x(v(v({},w),{},{response:!(t==null||(b=t.hookOptions)===null||b===void 0)&&b.cloneResponse?g.clone():g}));_ instanceof Response?g=_:typeof _==\"object\"&&_!==null&&(g=_.response)}if(g.ok){if(p.method===\"HEAD\")return{data:\"\",error:null};let x=Ko(g),_={data:null,response:g,request:p};if(x===\"json\"||x===\"text\"){var P;let se=await g.text();_.data=await((P=p.jsonParser)!==null&&P!==void 0?P:Dr)(se)}else _.data=await g[x]();p?.output&&p.output&&!p.disableValidation&&(_.data=await Oe(p.output,_.data));for(let se of s.onSuccess)if(se){var O;await se(v(v({},_),{},{response:!(t==null||(O=t.hookOptions)===null||O===void 0)&&O.cloneResponse?g.clone():g}))}return t?.throw?_.data:{data:_.data,error:null}}let k=(o=t?.jsonParser)!==null&&o!==void 0?o:Dr,E=await g.text(),oe=Yo(E),ot=oe?await k(E):null,En={response:g,responseText:E,request:p,error:v(v({},ot),{},{status:g.status,statusText:g.statusText})};for(let x of s.onError)if(x){var st;await x(v(v({},En),{},{response:!(t==null||(st=t.hookOptions)===null||st===void 0)&&st.cloneResponse?g.clone():g}))}if(t?.retry){var it;let x=No(t.retry),_=(it=t.retryAttempt)!==null&&it!==void 0?it:0;if(await x.shouldAttemptRetry(_,g)){for(let xe of s.onRetry)xe&&await xe(w);let se=x.getDelay(_);return await new Promise(xe=>setTimeout(xe,se)),await Nt(e,v(v({},t),{},{retryAttempt:_+1}))}}if(t?.throw)throw new $o(g.status,g.statusText,oe?ot:E);return{data:null,error:v(v({},ot),{},{status:g.status,statusText:g.statusText})}},as=e=>({id:\"apply-schema\",name:\"Apply Schema\",version:\"1.0.0\",async init(t,r){var n;let o=v(v({},r),e.query!==void 0&&{query:v(v({},e.query),r?.query)}),s=((n=e.plugins)===null||n===void 0||(n=n.find(u=>{var c;return!((c=u.schema)===null||c===void 0)&&c.config?t.startsWith(u.schema.config.baseURL||\"\")||t.startsWith(u.schema.config.prefix||\"\"):!1}))===null||n===void 0?void 0:n.schema)||e.schema;if(s){var i,l;let u=t;!((i=s.config)===null||i===void 0)&&i.prefix&&u.startsWith(s.config.prefix)&&(u=u.replace(s.config.prefix,\"\"),s.config.baseURL&&(t=t.replace(s.config.prefix,s.config.baseURL))),!((l=s.config)===null||l===void 0)&&l.baseURL&&u.startsWith(s.config.baseURL)&&(u=u.replace(s.config.baseURL,\"\")),u.startsWith(\"/\")&&u.charAt(1)===\"@\"&&(u=u.substring(1));let c=s.schema[u];if(c){var a;let{method:d,path:h}=Ut(u);d&&(t=t.slice(0,t.length-u.length)+h);let f=r?.headers;if(c.headers&&!r?.disableValidation){let p={};if(r?.headers){if(r.headers instanceof Headers)r.headers.forEach((w,b)=>{p[b.toLowerCase()]=w});else if(typeof r.headers==\"object\")for(let[w,b]of Object.entries(r.headers))b!=null&&(p[w.toLowerCase()]=b)}let y=await Oe(c.headers,p),g={};for(let[w,b]of Object.entries(y))g[w.toLowerCase()]=b;f=g}let m=(a=c.method)!==null&&a!==void 0?a:d;if(o=v(v(v(v({},o),m!==void 0&&{method:m}),c.output!==void 0&&{output:c.output}),f!==void 0&&{headers:f}),!r?.disableValidation){if(c.query&&(o.query=await Oe(c.query,r?.query),o.query!==null&&typeof o.query==\"object\")){let p=v({},e.query);for(let y of Object.keys(p))r?.query&&Object.prototype.hasOwnProperty.call(r.query,y)&&(p[y]=r.query[y]);o.query=v(v({},p),o.query)}o=v(v({},o),{},{body:c.input?await Oe(c.input,r?.body):r?.body,params:c.params?await Oe(c.params,r?.params):r?.params})}return{url:t,options:o}}}return v({url:t},(r!==void 0||e.query!==void 0)&&{options:o})}}),Wr=e=>{async function t(r,n){let o=v(v(v({},e),n),{},{headers:Gr(e?.headers,n?.headers),plugins:[...e?.plugins||[],as(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await Nt(r,o)}catch(s){return{data:null,error:{status:500,statusText:\"Fetch Error\",message:\"Fetch related error. Captured by catchAllError option. See error property for more details.\",error:s}}}return await Nt(r,o)}return t};var ls=e=>{if(typeof process>\"u\")return;let t=e??\"/api/auth\";if(process.env.NEXT_PUBLIC_AUTH_URL)return process.env.NEXT_PUBLIC_AUTH_URL;if(typeof window>\"u\"){if(process.env.NEXTAUTH_URL)try{return process.env.NEXTAUTH_URL}catch{}if(process.env.VERCEL_URL)try{let r=process.env.VERCEL_URL.startsWith(\"http\")?\"\":\"https://\";return`${new URL(`${r}${process.env.VERCEL_URL}`).origin}${t}`}catch{}}},cs=e=>e===\"/sign-out\"||e===\"/update-user\"||e===\"/update-session\"||e===\"/sign-up/email\"||e===\"/sign-in/email\"||e===\"/delete-user\"||e===\"/verify-email\"||e===\"/revoke-sessions\"||e===\"/revoke-session\"||e===\"/revoke-other-sessions\"||e===\"/change-email\"||e===\"/change-password\",Kr=(e,t)=>{let r=\"credentials\"in Request.prototype,n=Cr(e?.baseURL,e?.basePath,void 0,t)??ls(e?.basePath)??\"/api/auth\",o=e?.plugins?.flatMap(E=>E.fetchPlugins).filter(E=>E!==void 0)||[],s={id:\"lifecycle-hooks\",name:\"lifecycle-hooks\",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:i,onError:l,onRequest:a,onResponse:u,...c}=e?.fetchOptions||{},d=Wr({baseURL:n,...r?{credentials:\"include\"}:{},method:\"GET\",jsonParser(E){return E?Sr(E,{strict:!1}):null},customFetchImpl:fetch,...c,plugins:[s,...c.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Pr],...o]}),{$sessionSignal:h,session:f,broadcastSessionUpdate:m}=Ur(d,e),p=!1,y=E=>{p||E===null||(p=!0,Nr(f,E))},g=e?.plugins||[],w={},b={$sessionSignal:h,session:f},P={\"/sign-out\":\"POST\",\"/revoke-sessions\":\"POST\",\"/revoke-other-sessions\":\"POST\",\"/delete-user\":\"POST\"},O=[{signal:\"$sessionSignal\",matcher:cs,callback(E){E===\"/sign-out\"?m(\"signout\"):(E===\"/update-user\"||E===\"/update-session\")&&m(\"updateUser\")}}];for(let E of g)E.getAtoms&&Object.assign(b,E.getAtoms?.(d)),E.pathMethods&&Object.assign(P,E.pathMethods),E.atomListeners&&O.push(...E.atomListeners);let k={notify:E=>{b[E].set(!b[E].get())},listen:(E,oe)=>{b[E].subscribe(oe)},atoms:b};for(let E of g)E.getActions&&(w=kr(E.getActions?.(d,k,e)??{},w));return{get baseURL(){return n},pluginsActions:w,pluginsAtoms:b,pluginPathMethods:P,atomListeners:O,hydrateSession:y,$sessionSignal:h,$fetch:d,$store:k}};function Yr(e){return typeof e==\"object\"&&e!==null&&\"get\"in e&&typeof e.get==\"function\"&&\"lc\"in e&&typeof e.lc==\"number\"}function Jr(e){return e.charAt(0).toUpperCase()+e.slice(1)}var us=/[\\p{Ll}\\d]+|\\p{Lu}+(?!\\p{Ll})|\\p{Lu}[\\p{Ll}\\d]+|\\p{Lo}+/gu,ds=/['\\u2019]/g;function fs(e){return e.replace(ds,\"\").match(us)??[]}function Qr(e){return fs(e).map(t=>t.toLowerCase()).join(\"-\")}function Xr(e,t,r,n,o){function s(i=[]){return new Proxy(function(){},{get(l,a){if(typeof a!=\"string\"||a===\"then\"||a===\"catch\"||a===\"finally\")return;let u=[...i,a],c=e;for(let d of u)if(c&&typeof c==\"object\"&&d in c)c=c[d];else{c=void 0;break}return typeof c==\"function\"||Yr(c)?c:s(u)},apply:async(l,a,u)=>{let c=\"/\"+i.map(Qr).join(\"/\"),d=u[0]||{},h=u[1]||{},{query:f,fetchOptions:m,...p}=d,y={...h,...m},g=r[c]||y.method||(Object.keys(p).length>0?\"POST\":\"GET\");return await t(c,{...y,body:Vr(g)?{...p,...y?.body||{}}:void 0,query:f||y?.query,method:g,async onSuccess(w){if(await y?.onSuccess?.(w),!o||y.disableSignal)return;let b=o.filter(O=>O.matcher(c));if(!b.length)return;let P=new Set;for(let O of b){let k=n[O.signal];if(!k)return;if(P.has(O.signal))continue;P.add(O.signal);let E=k.get();setTimeout(()=>{k.set(!E)},10),O.callback?.(c)}}})}})}return s()}function kt(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:n,hydrateSession:o,$fetch:s,atomListeners:i,$store:l}=Kr(e),a={};for(let[c,d]of Object.entries(n))a[`use${Jr(c)}`]=d;let u={...r,...a,hydrateSession:o,$fetch:s,$store:l};return Xr(u,s,t,n,i)}var Zr=Xe({INVALID_EMAIL_FORMAT:\"Email was not generated in a valid format\",FAILED_TO_CREATE_USER:\"Failed to create user\",COULD_NOT_CREATE_SESSION:\"Could not create session\",ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:\"Anonymous users cannot sign in again anonymously\",FAILED_TO_DELETE_ANONYMOUS_USER:\"Failed to delete anonymous user\",FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS:\"Failed to delete anonymous user sessions\",USER_IS_NOT_ANONYMOUS:\"User is not anonymous\",DELETE_ANONYMOUS_USER_DISABLED:\"Deleting anonymous users is disabled\"});var Mt=()=>({id:\"anonymous\",version:yr,$InferServerPlugin:{},pathMethods:{\"/sign-in/anonymous\":\"POST\",\"/delete-anonymous-user\":\"POST\"},atomListeners:[{matcher:e=>e===\"/sign-in/anonymous\",signal:\"$sessionSignal\"}],$ERROR_CODES:Zr});var te=Xe({ORIGIN_NOT_CONFIGURED:\"Passkey origin is not configured. Set the `origin` option of the passkey plugin or configure `baseURL`.\",CHALLENGE_NOT_FOUND:\"Challenge not found\",YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY:\"You are not allowed to register this passkey\",FAILED_TO_VERIFY_REGISTRATION:\"Failed to verify registration\",PASSKEY_NOT_FOUND:\"Passkey not found\",AUTHENTICATION_FAILED:\"Authentication failed\",UNABLE_TO_CREATE_SESSION:\"Unable to create session\",USER_NOT_FOUND:\"User not found\",FAILED_TO_UPDATE_PASSKEY:\"Failed to update passkey\",PREVIOUSLY_REGISTERED:\"Previously registered\",REGISTRATION_CANCELLED:\"Registration cancelled\",AUTH_CANCELLED:\"Auth cancelled\",UNKNOWN_ERROR:\"Unknown error\",SESSION_REQUIRED:\"Passkey registration requires an authenticated session\",RESOLVE_USER_REQUIRED:\"Passkey registration requires either an authenticated session or a resolveUser callback when requireSession is false\",RESOLVED_USER_INVALID:\"Resolved user is invalid\"}),en=\"1.7.26\";function N(e){let t=new Uint8Array(e),r=\"\";for(let o of t)r+=String.fromCharCode(o);return btoa(r).replace(/\\+/g,\"-\").replace(/\\//g,\"_\").replace(/=/g,\"\")}function re(e){let t=e.replace(/-/g,\"+\").replace(/_/g,\"/\"),r=(4-t.length%4)%4,n=t.padEnd(t.length+r,\"=\"),o=atob(n),s=new ArrayBuffer(o.length),i=new Uint8Array(s);for(let l=0;l<o.length;l++)i[l]=o.charCodeAt(l);return s}function ne(){return hs.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==\"function\")}var hs={stubThis:e=>e};function Ze(e){let{id:t}=e;return{...e,id:re(t),transports:e.transports}}function et(e){return e===\"localhost\"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var R=class extends Error{constructor({message:t,code:r,cause:n,name:o}){super(t,{cause:n}),Object.defineProperty(this,\"code\",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=o??n.name,this.code=r}};function tn({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error(\"options was missing required publicKey property\");if(e.name===\"AbortError\"){if(t.signal instanceof AbortSignal)return new R({message:\"Registration ceremony was sent an abort signal\",code:\"ERROR_CEREMONY_ABORTED\",cause:e})}else if(e.name===\"ConstraintError\"){if(r.authenticatorSelection?.requireResidentKey===!0)return new R({message:\"Discoverable credentials were required but no available authenticator supported it\",code:\"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT\",cause:e});if(t.mediation===\"conditional\"&&r.authenticatorSelection?.userVerification===\"required\")return new R({message:\"User verification was required during automatic registration but it could not be performed\",code:\"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE\",cause:e});if(r.authenticatorSelection?.userVerification===\"required\")return new R({message:\"User verification was required but no available authenticator supported it\",code:\"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT\",cause:e})}else{if(e.name===\"InvalidStateError\")return new R({message:\"The authenticator was previously registered\",code:\"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED\",cause:e});if(e.name===\"NotAllowedError\")return new R({message:e.message,code:\"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY\",cause:e});if(e.name===\"NotSupportedError\")return r.pubKeyCredParams.filter(o=>o.type===\"public-key\").length===0?new R({message:'No entry in pubKeyCredParams was of type \"public-key\"',code:\"ERROR_MALFORMED_PUBKEYCREDPARAMS\",cause:e}):new R({message:\"No available authenticator supported any of the specified pubKeyCredParams algorithms\",code:\"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG\",cause:e});if(e.name===\"SecurityError\"){let n=globalThis.location.hostname;if(et(n)){if(r.rp.id!==n)return new R({message:`The RP ID \"${r.rp.id}\" is invalid for this domain`,code:\"ERROR_INVALID_RP_ID\",cause:e})}else return new R({message:`${globalThis.location.hostname} is an invalid domain`,code:\"ERROR_INVALID_DOMAIN\",cause:e})}else if(e.name===\"TypeError\"){if(r.user.id.byteLength<1||r.user.id.byteLength>64)return new R({message:\"User ID was not between 1 and 64 characters\",code:\"ERROR_INVALID_USER_ID_LENGTH\",cause:e})}else if(e.name===\"UnknownError\")return new R({message:\"The authenticator was unable to process the specified options, or could not create a new credential\",code:\"ERROR_AUTHENTICATOR_GENERAL_ERROR\",cause:e})}return e}var Dt=class{constructor(){Object.defineProperty(this,\"controller\",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let r=new Error(\"Cancelling existing WebAuthn API call for new one\");r.name=\"AbortError\",this.controller.abort(r)}let t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){let t=new Error(\"Manually cancelling existing WebAuthn API call\");t.name=\"AbortError\",this.controller.abort(t),this.controller=void 0}}},tt=new Dt;var ps=[\"cross-platform\",\"platform\"];function rt(e){if(e&&!(ps.indexOf(e)<0))return e}async function rn(e){!e.optionsJSON&&e.challenge&&(console.warn(\"startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.\"),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:r=!1}=e;if(!ne())throw new Error(\"WebAuthn is not supported in this browser\");let n={...t,challenge:re(t.challenge),user:{...t.user,id:re(t.user.id)},excludeCredentials:t.excludeCredentials?.map(Ze)},o={};r&&(o.mediation=\"conditional\"),o.publicKey=n,o.signal=tt.createNewAbortSignal();let s;try{s=await navigator.credentials.create(o)}catch(m){throw tn({error:m,options:o})}if(!s)throw new Error(\"Registration was not completed\");let{id:i,rawId:l,response:a,type:u}=s,c;typeof a.getTransports==\"function\"&&(c=a.getTransports());let d;if(typeof a.getPublicKeyAlgorithm==\"function\")try{d=a.getPublicKeyAlgorithm()}catch(m){Ht(\"getPublicKeyAlgorithm()\",m)}let h;if(typeof a.getPublicKey==\"function\")try{let m=a.getPublicKey();m!==null&&(h=N(m))}catch(m){Ht(\"getPublicKey()\",m)}let f;if(typeof a.getAuthenticatorData==\"function\")try{f=N(a.getAuthenticatorData())}catch(m){Ht(\"getAuthenticatorData()\",m)}return{id:i,rawId:N(l),response:{attestationObject:N(a.attestationObject),clientDataJSON:N(a.clientDataJSON),transports:c,publicKeyAlgorithm:d,publicKey:h,authenticatorData:f},type:u,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:rt(s.authenticatorAttachment)}}function Ht(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function nn(){if(!ne())return Bt.stubThis(new Promise(t=>t(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?Bt.stubThis(new Promise(t=>t(!1))):Bt.stubThis(e.isConditionalMediationAvailable())}var Bt={stubThis:e=>e};function on({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error(\"options was missing required publicKey property\");if(e.name===\"AbortError\"){if(t.signal instanceof AbortSignal)return new R({message:\"Authentication ceremony was sent an abort signal\",code:\"ERROR_CEREMONY_ABORTED\",cause:e})}else{if(e.name===\"NotAllowedError\")return new R({message:e.message,code:\"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY\",cause:e});if(e.name===\"SecurityError\"){let n=globalThis.location.hostname;if(et(n)){if(r.rpId!==n)return new R({message:`The RP ID \"${r.rpId}\" is invalid for this domain`,code:\"ERROR_INVALID_RP_ID\",cause:e})}else return new R({message:`${globalThis.location.hostname} is an invalid domain`,code:\"ERROR_INVALID_DOMAIN\",cause:e})}else if(e.name===\"UnknownError\")return new R({message:\"The authenticator was unable to process the specified options, or could not create a new assertion signature\",code:\"ERROR_AUTHENTICATOR_GENERAL_ERROR\",cause:e})}return e}async function sn(e){!e.optionsJSON&&e.challenge&&(console.warn(\"startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.\"),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:r=!1,verifyBrowserAutofillInput:n=!0}=e;if(!ne())throw new Error(\"WebAuthn is not supported in this browser\");let o;t.allowCredentials?.length!==0&&(o=t.allowCredentials?.map(Ze));let s={...t,challenge:re(t.challenge),allowCredentials:o},i={};if(r){if(!await nn())throw Error(\"Browser does not support WebAuthn autofill\");if(document.querySelectorAll(\"input[autocomplete$='webauthn']\").length<1&&n)throw Error('No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected');i.mediation=\"conditional\",s.allowCredentials=[]}i.publicKey=s,i.signal=tt.createNewAbortSignal();let l;try{l=await navigator.credentials.get(i)}catch(f){throw on({error:f,options:i})}if(!l)throw new Error(\"Authentication was not completed\");let{id:a,rawId:u,response:c,type:d}=l,h;return c.userHandle&&(h=N(c.userHandle)),{id:a,rawId:N(u),response:{authenticatorData:N(c.authenticatorData),clientDataJSON:N(c.clientDataJSON),signature:N(c.signature),userHandle:h},type:d,clientExtensionResults:l.getClientExtensionResults(),authenticatorAttachment:rt(l.authenticatorAttachment)}}var ms=(e,{$listPasskeys:t,$store:r})=>({signIn:{passkey:async(s,i)=>{let l=await e(\"/passkey/generate-authenticate-options\",{method:\"GET\",throw:!1});if(!l.data)return l;let a=l.data.extensions||s?.extensions?{...l.data.extensions||{},...s?.extensions||{}}:void 0,u;try{u=await sn({optionsJSON:{...l.data,extensions:a},useBrowserAutofill:s?.autoFill})}catch(c){return{data:null,error:{code:c instanceof R?c.code:\"AUTH_CANCELLED\",message:te.AUTH_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}}}try{let{clientExtensionResults:c,...d}=u,h=await e(\"/passkey/verify-authentication\",{body:{response:d},...s?.fetchOptions,...i,method:\"POST\",throw:!1});return t.set(Math.random()),r.notify(\"$sessionSignal\"),s?.returnWebAuthnResponse?{...h,webauthn:{response:u,clientExtensionResults:c}}:h}catch(c){return console.error(\"[Better Auth] Error verifying passkey\",c),{data:null,error:{code:\"AUTH_CANCELLED\",message:te.AUTH_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}}}}},passkey:{addPasskey:async(s,i)=>{let l=await e(\"/passkey/generate-register-options\",{method:\"GET\",query:{...s?.authenticatorAttachment&&{authenticatorAttachment:s.authenticatorAttachment},...s?.name&&{name:s.name},...s?.context&&{context:s.context}},throw:!1});if(!l.data)return l;try{let a=l.data.extensions||s?.extensions?{...l.data.extensions||{},...s?.extensions||{}}:void 0,u=await rn({optionsJSON:{...l.data,extensions:a},useAutoRegister:s?.useAutoRegister}),{clientExtensionResults:c,...d}=u,h=await e(\"/passkey/verify-registration\",{...s?.fetchOptions,...i,body:{response:d,name:s?.name,...s?.createSession&&{createSession:!0}},method:\"POST\",throw:!1});return h.data?(t.set(Math.random()),h.data.session&&r.notify(\"$sessionSignal\"),s?.returnWebAuthnResponse?{...h,webauthn:{response:u,clientExtensionResults:c}}:h):h}catch(a){return a instanceof R?a.code===\"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED\"?{data:null,error:{code:a.code,message:te.PREVIOUSLY_REGISTERED.message,status:400,statusText:\"BAD_REQUEST\"}}:a.code===\"ERROR_CEREMONY_ABORTED\"?{data:null,error:{code:a.code,message:te.REGISTRATION_CANCELLED.message,status:400,statusText:\"BAD_REQUEST\"}}:{data:null,error:{code:a.code,message:a.message,status:400,statusText:\"BAD_REQUEST\"}}:{data:null,error:{code:\"UNKNOWN_ERROR\",message:a instanceof Error?a.message:te.UNKNOWN_ERROR.message,status:500,statusText:\"INTERNAL_SERVER_ERROR\"}}}}},$Infer:{}}),an=()=>{let e=ee();return{id:\"passkey\",version:en,$InferServerPlugin:{},getActions:(t,r)=>ms(t,{$listPasskeys:e,$store:r}),getAtoms(t){return{listPasskeys:_t(e,\"/passkey/list-user-passkeys\",t,{method:\"GET\"}),$listPasskeys:e}},pathMethods:{\"/passkey/register\":\"POST\",\"/passkey/authenticate\":\"POST\"},atomListeners:[{matcher(t){return t===\"/passkey/verify-registration\"||t===\"/passkey/delete-passkey\"||t===\"/passkey/update-passkey\"||t===\"/sign-out\"},signal:\"$listPasskeys\"},{matcher:t=>t===\"/passkey/verify-authentication\",signal:\"$sessionSignal\"}],$ERROR_CODES:te}};var ln=\"ba_param\";function gs(e){let t=e.getAll(ln);if(t.length)return new Set(t)}function cn(e){let t=new URLSearchParams(e);if(!t.has(\"sig\"))return;let r=gs(t);if(!r)return;let n=new URLSearchParams;for(let[o,s]of t.entries())(o===\"sig\"||o===ln||r.has(o))&&n.append(o,s);return n.toString()}var un=\"1.7.26\";var ys=/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z$/;function dn(e){if(typeof e==\"string\"&&ys.test(e)){let t=new Date(e);if(!isNaN(t.getTime()))return t}return e}function jt(e){if(e==null)return e;if(typeof e==\"string\")return dn(e);if(e instanceof Date)return e;if(Array.isArray(e))return e.map(jt);if(typeof e==\"object\"){let t={};for(let r of Object.keys(e))t[r]=jt(e[r]);return t}return e}function fn(e){try{return typeof e!=\"string\"?e==null?null:jt(e):JSON.parse(e,(t,r)=>dn(r))}catch(t){return xt.error(\"Error parsing JSON\",{error:t}),null}}var hn=()=>({id:\"oauth-provider-client\",version:un,fetchPlugins:[{id:\"oauth-provider-signin\",name:\"oauth-provider-signin\",description:\"Adds the current page query to oauth requests\",hooks:{async onRequest(e){let t=e.headers,r=typeof e.body==\"string\"?t.get(\"content-type\")===\"application/x-www-form-urlencoded\"?Object.fromEntries(new URLSearchParams(e.body)):fn(e.body??\"{}\"):e.body;r?.oauth_query||typeof window<\"u\"&&window?.location?.search&&!(e.method===\"GET\"||e.method===\"DELETE\")&&(e.body=JSON.stringify({...r,oauth_query:cn(window.location.search)}))}}}],$InferServerPlugin:{}});var Es=\"sign_in_method\";function bs(e){return e===\"google\"||e===\"discord\"?e:void 0}function pn(e){if(e.pathname!==\"/login\"||!e.providerConfigured||e.alreadyContinuing)return;let t=new URLSearchParams(e.search.startsWith(\"?\")?e.search.slice(1):e.search);if(!t.has(\"error\"))return bs(t.get(Es))}var H=kt({disableDefaultFetchPlugins:!0,plugins:[Mt(),an(),hn()]}),fe=location.pathname===\"/login\"?location.search.slice(1):\"\";pr();var W=document.querySelector(\"#status\"),$=mr(document.documentElement.lang),he=document.querySelector(\"[data-welcome]\"),vs=he===null?\"\":new URLSearchParams(location.search).get(\"oauth_query\")??\"\";async function yn(e,t){if(!e){location.assign(t);return}let r=await H.$fetch(\"/oauth2/continue\",{method:\"POST\",body:{selected:!0,oauth_query:e}});if(r.data?.url){location.assign(r.data.url);return}W.message=r.error?.message??$.continueFailed}async function mn(){let e=await fetch(\"/api/profile\");return e.ok?(await e.json()).onboarded===!1:!1}async function z(e){let t=e;if(t?.error){W.message=t.error.message??$.requestFailed;return}if(t?.data?.url){if(fe&&await mn()){location.assign(`/welcome?${new URLSearchParams({oauth_query:fe})}`);return}location.assign(t.data.url);return}if(he!==null){nt(\"finish\");return}if(await mn()){let r=new URLSearchParams(fe?{oauth_query:fe}:{next:\"/account\"});location.assign(`/welcome?${r}`);return}await yn(fe,\"/account\")}function nt(e){for(let t of document.querySelectorAll(\"[data-welcome-step]\"))t.hidden=t.dataset.welcomeStep!==e;document.querySelector(`[data-welcome-step=\"${e}\"] h2`)?.focus(),e===\"finish\"&&fetch(\"/api/profile/onboarded\",{method:\"POST\"})}document.addEventListener(\"click\",e=>{let t=e.target.closest(\"button[data-action], button[data-auth-action]\");if(!t)return;let r=t.dataset.authAction??t.dataset.action;t.disabled=!0,W.message=\"\",(async()=>{switch(r){case\"remove-avatar\":return qt(\"/api/profile/avatar\",{method:\"DELETE\"});case\"guest\":return z(await H.signIn.anonymous());case\"passkey\":return z(await H.signIn.passkey());case\"passkey-start\":{let n=await H.signIn.anonymous();return n?.error?z(n):(await H.passkey.addPasskey({name:\"Be-Music\"}),z(void 0))}case\"welcome-finish\":return await fetch(\"/api/profile/onboarded\",{method:\"POST\"}),yn(vs,he?.dataset.welcomeNext??\"/account\");case\"discord\":case\"google\":return z(await H.signIn.social({provider:r,callbackURL:\"/account\"}));case\"link-discord\":case\"link-google\":{let n=he===null?\"/account\":gn(\"finish\");return z(await H.linkSocial({provider:r===\"link-discord\"?\"discord\":\"google\",callbackURL:n,errorCallbackURL:he===null?\"/account\":gn(\"keep\")}))}case\"continue\":return z(await H.$fetch(\"/oauth2/continue\",{method:\"POST\",body:{selected:!0,oauth_query:fe}}));case\"add-passkey\":return z(await H.passkey.addPasskey({name:\"Be-Music\"}));case\"sign-out\":await H.signOut(),location.assign(\"/login\")}})().catch(()=>{W.message=$.tryAgain}).finally(()=>{t.disabled=!1})});document.documentElement.dataset.authReady=\"true\";function Ss(){let e=new URLSearchParams(location.search).get(\"sign_in_method\"),t=Array.from(document.querySelectorAll(\"button[data-auth-action]\")).find(o=>o.dataset.authAction===e),r=pn({pathname:location.pathname,search:location.search,providerConfigured:t!==void 0,alreadyContinuing:document.querySelector('[data-auth-action=\"continue\"]')!==null});if(r===void 0)return;let n=`be-music.sign-in.${r}`;try{if(sessionStorage.getItem(n)===location.search)return;sessionStorage.setItem(n,location.search)}catch{}t?.click()}Ss();async function qt(e,t){let r=await fetch(e,t);if(!r.ok){let n=await r.json();throw new Error(Et(n.error,$.profileFailed,$))}location.reload()}document.querySelector(\"#profile-form\")?.addEventListener(\"submit\",e=>{e.preventDefault();let t=e.currentTarget,r=new FormData(t),n=t.querySelector(\"button\");n.disabled=!0,qt(\"/api/profile\",{method:\"PATCH\",headers:{\"content-type\":\"application/json\"},body:JSON.stringify({handle:r.get(\"handle\"),displayName:r.get(\"displayName\")})}).catch(o=>{W.message=o.message}).finally(()=>{n.disabled=!1})});document.querySelector(\"#avatar-input\")?.addEventListener(\"change\",e=>{let t=e.currentTarget,r=t.files?.[0];r&&(t.disabled=!0,(async()=>{let n=await createImageBitmap(r);try{let o=document.createElement(\"canvas\");o.width=o.height=256;let s=o.getContext(\"2d\");if(!s)throw new Error($.cannotPrepare);let i=Math.min(n.width,n.height);s.drawImage(n,(n.width-i)/2,(n.height-i)/2,i,i,0,0,256,256);let l=await new Promise(a=>o.toBlob(a,\"image/webp\",.9));if(!l)throw new Error($.cannotEncode);await qt(\"/api/profile/avatar\",{method:\"PUT\",body:l})}finally{n.close()}})().catch(n=>{W.message=n.message}).finally(()=>{t.disabled=!1}))});function gn(e){let t=new URLSearchParams(location.search);return t.set(\"step\",e),`/welcome?${t}`}if(he!==null){let e=new URLSearchParams(location.search).get(\"step\");(e===\"finish\"||e===\"keep\")&&nt(e),document.addEventListener(\"click\",i=>{let l=i.target.closest(\"button[data-welcome-go]\");l&&nt(l.dataset.welcomeGo??\"finish\")});let t=document.querySelector(\"#welcome-profile-form\"),r=t?.querySelector('input[name=\"handle\"]'),n=document.querySelector(\"#welcome-handle-status\"),o=r?.value??\"\",s;r?.addEventListener(\"input\",()=>{if(clearTimeout(s),!n)return;let i=r.value;if(i===o){n.textContent=$.welcome.handleHint;return}n.textContent=$.welcome.handleChecking,s=setTimeout(()=>{fetch(`/api/profile/handle?${new URLSearchParams({value:i})}`).then(l=>l.json()).then(l=>{r.value===i&&(n.textContent=l.ok?$.welcome.handleFree:$.welcome.handle[l.reason??\"format\"])}).catch(()=>{n.textContent=$.welcome.handleHint})},300)}),t?.addEventListener(\"submit\",i=>{i.preventDefault();let l=new FormData(t),a=t.querySelector('button[type=\"submit\"]');a.disabled=!0;let u=l.get(\"displayName\"),c=typeof u==\"string\"?u.trim():\"\";fetch(\"/api/profile\",{method:\"PATCH\",headers:{\"content-type\":\"application/json\"},body:JSON.stringify({handle:l.get(\"handle\"),...c?{displayName:c}:{}})}).then(async d=>{if(!d.ok){let h=await d.json();throw new Error(Et(h.error,$.profileFailed,$))}W.message=\"\",nt(t.dataset.next??\"finish\")}).catch(d=>{W.message=d.message}).finally(()=>{a.disabled=!1})})}\n/*! Bundled license information:\n\n@lit/reactive-element/css-tag.js:\n  (**\n   * @license\n   * Copyright 2019 Google LLC\n   * SPDX-License-Identifier: BSD-3-Clause\n   *)\n\n@lit/reactive-element/reactive-element.js:\nlit-html/lit-html.js:\nlit-element/lit-element.js:\nlit-html/directive.js:\nlit-html/directives/unsafe-html.js:\nlit-html/directives/repeat.js:\n  (**\n   * @license\n   * Copyright 2017 Google LLC\n   * SPDX-License-Identifier: BSD-3-Clause\n   *)\n\nlit-html/is-server.js:\n  (**\n   * @license\n   * Copyright 2022 Google LLC\n   * SPDX-License-Identifier: BSD-3-Clause\n   *)\n\nlit-html/directives/if-defined.js:\n  (**\n   * @license\n   * Copyright 2018 Google LLC\n   * SPDX-License-Identifier: BSD-3-Clause\n   *)\n\nlit-html/directive-helpers.js:\n  (**\n   * @license\n   * Copyright 2020 Google LLC\n   * SPDX-License-Identifier: BSD-3-Clause\n   *)\n*/\n";