@getauthui/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2018 @@
1
+ var AuthUI=(function($){"use strict";const et=globalThis,dt=et.ShadowRoot&&(et.ShadyCSS===void 0||et.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ht=Symbol(),Rt=new WeakMap;let Lt=class{constructor(e,i,a){if(this._$cssResult$=!0,a!==ht)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=i}get styleSheet(){let e=this.o;const i=this.t;if(dt&&e===void 0){const a=i!==void 0&&i.length===1;a&&(e=Rt.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),a&&Rt.set(i,e))}return e}toString(){return this.cssText}};const Bi=t=>new Lt(typeof t=="string"?t:t+"",void 0,ht),je=(t,...e)=>{const i=t.length===1?t[0]:e.reduce((a,n,r)=>a+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[r+1],t[0]);return new Lt(i,t,ht)},Hi=(t,e)=>{if(dt)t.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of e){const a=document.createElement("style"),n=et.litNonce;n!==void 0&&a.setAttribute("nonce",n),a.textContent=i.cssText,t.appendChild(a)}},Nt=dt?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let i="";for(const a of e.cssRules)i+=a.cssText;return Bi(i)})(t):t;const{is:Di,defineProperty:Vi,getOwnPropertyDescriptor:Xi,getOwnPropertyNames:Gi,getOwnPropertySymbols:Wi,getPrototypeOf:Ki}=Object,tt=globalThis,qt=tt.trustedTypes,Ji=qt?qt.emptyScript:"",Yi=tt.reactiveElementPolyfillSupport,Ge=(t,e)=>t,it={toAttribute(t,e){switch(e){case Boolean:t=t?Ji:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=t!==null;break;case Number:i=t===null?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch{i=null}}return i}},pt=(t,e)=>!Di(t,e),Bt={attribute:!0,type:String,converter:it,reflect:!1,useDefault:!1,hasChanged:pt};Symbol.metadata??=Symbol("metadata"),tt.litPropertyMetadata??=new WeakMap;let qe=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,i=Bt){if(i.state&&(i.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((i=Object.create(i)).wrapped=!0),this.elementProperties.set(e,i),!i.noAccessor){const a=Symbol(),n=this.getPropertyDescriptor(e,a,i);n!==void 0&&Vi(this.prototype,e,n)}}static getPropertyDescriptor(e,i,a){const{get:n,set:r}=Xi(this.prototype,e)??{get(){return this[i]},set(s){this[i]=s}};return{get:n,set(s){const o=n?.call(this);r?.call(this,s),this.requestUpdate(e,o,a)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Bt}static _$Ei(){if(this.hasOwnProperty(Ge("elementProperties")))return;const e=Ki(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ge("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ge("properties"))){const i=this.properties,a=[...Gi(i),...Wi(i)];for(const n of a)this.createProperty(n,i[n])}const e=this[Symbol.metadata];if(e!==null){const i=litPropertyMetadata.get(e);if(i!==void 0)for(const[a,n]of i)this.elementProperties.set(a,n)}this._$Eh=new Map;for(const[i,a]of this.elementProperties){const n=this._$Eu(i,a);n!==void 0&&this._$Eh.set(n,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const i=[];if(Array.isArray(e)){const a=new Set(e.flat(1/0).reverse());for(const n of a)i.unshift(Nt(n))}else e!==void 0&&i.push(Nt(e));return i}static _$Eu(e,i){const a=i.attribute;return a===!1?void 0:typeof a=="string"?a:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,i=this.constructor.elementProperties;for(const a of i.keys())this.hasOwnProperty(a)&&(e.set(a,this[a]),delete this[a]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Hi(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,i,a){this._$AK(e,a)}_$ET(e,i){const a=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,a);if(n!==void 0&&a.reflect===!0){const r=(a.converter?.toAttribute!==void 0?a.converter:it).toAttribute(i,a.type);this._$Em=e,r==null?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(e,i){const a=this.constructor,n=a._$Eh.get(e);if(n!==void 0&&this._$Em!==n){const r=a.getPropertyOptions(n),s=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:it;this._$Em=n;const o=s.fromAttribute(i,r.type);this[n]=o??this._$Ej?.get(n)??o,this._$Em=null}}requestUpdate(e,i,a,n=!1,r){if(e!==void 0){const s=this.constructor;if(n===!1&&(r=this[e]),a??=s.getPropertyOptions(e),!((a.hasChanged??pt)(r,i)||a.useDefault&&a.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,a))))return;this.C(e,i,a)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,i,{useDefault:a,reflect:n,wrapped:r},s){a&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??i??this[e]),r!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||a||(i=void 0),this._$AL.set(e,i)),n===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(i){Promise.reject(i)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[n,r]of this._$Ep)this[n]=r;this._$Ep=void 0}const a=this.constructor.elementProperties;if(a.size>0)for(const[n,r]of a){const{wrapped:s}=r,o=this[n];s!==!0||this._$AL.has(n)||o===void 0||this.C(n,void 0,r,o)}}let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),this._$EO?.forEach(a=>a.hostUpdate?.()),this.update(i)):this._$EM()}catch(a){throw e=!1,this._$EM(),a}e&&this._$AE(i)}willUpdate(e){}_$AE(e){this._$EO?.forEach(i=>i.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(i=>this._$ET(i,this[i])),this._$EM()}updated(e){}firstUpdated(e){}};qe.elementStyles=[],qe.shadowRootOptions={mode:"open"},qe[Ge("elementProperties")]=new Map,qe[Ge("finalized")]=new Map,Yi?.({ReactiveElement:qe}),(tt.reactiveElementVersions??=[]).push("2.1.2");const ft=globalThis,Ht=t=>t,at=ft.trustedTypes,Dt=at?at.createPolicy("lit-html",{createHTML:t=>t}):void 0,Vt="$lit$",Ce=`lit$${Math.random().toFixed(9).slice(2)}$`,Xt="?"+Ce,Zi=`<${Xt}>`,_e=document,We=()=>_e.createComment(""),Ke=t=>t===null||typeof t!="object"&&typeof t!="function",gt=Array.isArray,Qi=t=>gt(t)||typeof t?.[Symbol.iterator]=="function",yt=`[
2
+ \f\r]`,Je=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gt=/-->/g,Wt=/>/g,Me=RegExp(`>|${yt}(?:([^\\s"'>=/]+)(${yt}*=${yt}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Kt=/'/g,Jt=/"/g,Yt=/^(?:script|style|textarea|title)$/i,Zt=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),v=Zt(1),D=Zt(2),Be=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),Qt=new WeakMap,Re=_e.createTreeWalker(_e,129);function Ot(t,e){if(!gt(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dt!==void 0?Dt.createHTML(e):e}const Oi=(t,e)=>{const i=t.length-1,a=[];let n,r=e===2?"<svg>":e===3?"<math>":"",s=Je;for(let o=0;o<i;o++){const h=t[o];let l,k,S=-1,U=0;for(;U<h.length&&(s.lastIndex=U,k=s.exec(h),k!==null);)U=s.lastIndex,s===Je?k[1]==="!--"?s=Gt:k[1]!==void 0?s=Wt:k[2]!==void 0?(Yt.test(k[2])&&(n=RegExp("</"+k[2],"g")),s=Me):k[3]!==void 0&&(s=Me):s===Me?k[0]===">"?(s=n??Je,S=-1):k[1]===void 0?S=-2:(S=s.lastIndex-k[2].length,l=k[1],s=k[3]===void 0?Me:k[3]==='"'?Jt:Kt):s===Jt||s===Kt?s=Me:s===Gt||s===Wt?s=Je:(s=Me,n=void 0);const C=s===Me&&t[o+1].startsWith("/>")?" ":"";r+=s===Je?h+Zi:S>=0?(a.push(l),h.slice(0,S)+Vt+h.slice(S)+Ce+C):h+Ce+(S===-2?o:C)}return[Ot(t,r+(t[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),a]};class Ye{constructor({strings:e,_$litType$:i},a){let n;this.parts=[];let r=0,s=0;const o=e.length-1,h=this.parts,[l,k]=Oi(e,i);if(this.el=Ye.createElement(l,a),Re.currentNode=this.el.content,i===2||i===3){const S=this.el.content.firstChild;S.replaceWith(...S.childNodes)}for(;(n=Re.nextNode())!==null&&h.length<o;){if(n.nodeType===1){if(n.hasAttributes())for(const S of n.getAttributeNames())if(S.endsWith(Vt)){const U=k[s++],C=n.getAttribute(S).split(Ce),X=/([.?@])?(.*)/.exec(U);h.push({type:1,index:r,name:X[2],strings:C,ctor:X[1]==="."?zi:X[1]==="?"?Fi:X[1]==="@"?ea:nt}),n.removeAttribute(S)}else S.startsWith(Ce)&&(h.push({type:6,index:r}),n.removeAttribute(S));if(Yt.test(n.tagName)){const S=n.textContent.split(Ce),U=S.length-1;if(U>0){n.textContent=at?at.emptyScript:"";for(let C=0;C<U;C++)n.append(S[C],We()),Re.nextNode(),h.push({type:2,index:++r});n.append(S[U],We())}}}else if(n.nodeType===8)if(n.data===Xt)h.push({type:2,index:r});else{let S=-1;for(;(S=n.data.indexOf(Ce,S+1))!==-1;)h.push({type:7,index:r}),S+=Ce.length-1}r++}}static createElement(e,i){const a=_e.createElement("template");return a.innerHTML=e,a}}function He(t,e,i=t,a){if(e===Be)return e;let n=a!==void 0?i._$Co?.[a]:i._$Cl;const r=Ke(e)?void 0:e._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),r===void 0?n=void 0:(n=new r(t),n._$AT(t,i,a)),a!==void 0?(i._$Co??=[])[a]=n:i._$Cl=n),n!==void 0&&(e=He(t,n._$AS(t,e.values),n,a)),e}class Ti{constructor(e,i){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:i},parts:a}=this._$AD,n=(e?.creationScope??_e).importNode(i,!0);Re.currentNode=n;let r=Re.nextNode(),s=0,o=0,h=a[0];for(;h!==void 0;){if(s===h.index){let l;h.type===2?l=new Ze(r,r.nextSibling,this,e):h.type===1?l=new h.ctor(r,h.name,h.strings,this,e):h.type===6&&(l=new ta(r,this,e)),this._$AV.push(l),h=a[++o]}s!==h?.index&&(r=Re.nextNode(),s++)}return Re.currentNode=_e,n}p(e){let i=0;for(const a of this._$AV)a!==void 0&&(a.strings!==void 0?(a._$AI(e,a,i),i+=a.strings.length-2):a._$AI(e[i])),i++}}class Ze{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,i,a,n){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=a,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const i=this._$AM;return i!==void 0&&e?.nodeType===11&&(e=i.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,i=this){e=He(this,e,i),Ke(e)?e===E||e==null||e===""?(this._$AH!==E&&this._$AR(),this._$AH=E):e!==this._$AH&&e!==Be&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Qi(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==E&&Ke(this._$AH)?this._$AA.nextSibling.data=e:this.T(_e.createTextNode(e)),this._$AH=e}$(e){const{values:i,_$litType$:a}=e,n=typeof a=="number"?this._$AC(e):(a.el===void 0&&(a.el=Ye.createElement(Ot(a.h,a.h[0]),this.options)),a);if(this._$AH?._$AD===n)this._$AH.p(i);else{const r=new Ti(n,this),s=r.u(this.options);r.p(i),this.T(s),this._$AH=r}}_$AC(e){let i=Qt.get(e.strings);return i===void 0&&Qt.set(e.strings,i=new Ye(e)),i}k(e){gt(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let a,n=0;for(const r of e)n===i.length?i.push(a=new Ze(this.O(We()),this.O(We()),this,this.options)):a=i[n],a._$AI(r),n++;n<i.length&&(this._$AR(a&&a._$AB.nextSibling,n),i.length=n)}_$AR(e=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);e!==this._$AB;){const a=Ht(e).nextSibling;Ht(e).remove(),e=a}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class nt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,i,a,n,r){this.type=1,this._$AH=E,this._$AN=void 0,this.element=e,this.name=i,this._$AM=n,this.options=r,a.length>2||a[0]!==""||a[1]!==""?(this._$AH=Array(a.length-1).fill(new String),this.strings=a):this._$AH=E}_$AI(e,i=this,a,n){const r=this.strings;let s=!1;if(r===void 0)e=He(this,e,i,0),s=!Ke(e)||e!==this._$AH&&e!==Be,s&&(this._$AH=e);else{const o=e;let h,l;for(e=r[0],h=0;h<r.length-1;h++)l=He(this,o[a+h],i,h),l===Be&&(l=this._$AH[h]),s||=!Ke(l)||l!==this._$AH[h],l===E?e=E:e!==E&&(e+=(l??"")+r[h+1]),this._$AH[h]=l}s&&!n&&this.j(e)}j(e){e===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class zi extends nt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===E?void 0:e}}class Fi extends nt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==E)}}class ea extends nt{constructor(e,i,a,n,r){super(e,i,a,n,r),this.type=5}_$AI(e,i=this){if((e=He(this,e,i,0)??E)===Be)return;const a=this._$AH,n=e===E&&a!==E||e.capture!==a.capture||e.once!==a.once||e.passive!==a.passive,r=e!==E&&(a===E||n);n&&this.element.removeEventListener(this.name,this,a),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ta{constructor(e,i,a){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=a}get _$AU(){return this._$AM._$AU}_$AI(e){He(this,e)}}const ia=ft.litHtmlPolyfillSupport;ia?.(Ye,Ze),(ft.litHtmlVersions??=[]).push("3.3.3");const aa=(t,e,i)=>{const a=i?.renderBefore??e;let n=a._$litPart$;if(n===void 0){const r=i?.renderBefore??null;a._$litPart$=n=new Ze(e.insertBefore(We(),r),r,void 0,i??{})}return n._$AI(t),n};const mt=globalThis;class Le extends qe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=aa(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Be}}Le._$litElement$=!0,Le.finalized=!0,mt.litElementHydrateSupport?.({LitElement:Le});const na=mt.litElementPolyfillSupport;na?.({LitElement:Le}),(mt.litElementVersions??=[]).push("4.2.2");const Ue=t=>(e,i)=>{i!==void 0?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)};const ra={attribute:!0,type:String,converter:it,reflect:!1,hasChanged:pt},sa=(t=ra,e,i)=>{const{kind:a,metadata:n}=i;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),a==="setter"&&((t=Object.create(t)).wrapped=!0),r.set(i.name,t),a==="accessor"){const{name:s}=i;return{set(o){const h=e.get.call(this);e.set.call(this,o),this.requestUpdate(s,h,t,!0,o)},init(o){return o!==void 0&&this.C(s,void 0,t,o),o}}}if(a==="setter"){const{name:s}=i;return function(o){const h=this[s];e.call(this,o),this.requestUpdate(s,h,t,!0,o)}}throw Error("Unsupported decorator location: "+a)};function ie(t){return(e,i)=>typeof i=="object"?sa(t,e,i):((a,n,r)=>{const s=n.hasOwnProperty(r);return n.constructor.createProperty(r,a),s?Object.getOwnPropertyDescriptor(n,r):void 0})(t,e,i)}function Y(t){return ie({...t,state:!0,attribute:!1})}const oa=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(t,e,i),i);function Tt(t,e){return(i,a,n)=>{const r=s=>s.renderRoot?.querySelector(t)??null;return oa(i,a,{get(){return r(this)}})}}function ca(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Qe={exports:{}},bt={exports:{}},rt={exports:{}},ua=rt.exports,zt;function Ft(){return zt||(zt=1,(function(t){(function(e){var i,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,r=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",h=1e14,l=14,k=9007199254740991,S=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],U=1e7,C=1e9;function X(N){var M,O,H,j=P.prototype={constructor:P,toString:null,valueOf:null},V=new P(1),W=20,T=4,re=-7,oe=21,$e=-1e7,me=1e7,xe=!1,ze=1,Ee=0,jt={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Ne="0123456789abcdefghijklmnopqrstuvwxyz",Ct=!0;function P(c,u){var d,b,f,y,A,p,g,w,m=this;if(!(m instanceof P))return new P(c,u);if(u==null){if(c&&c._isBigNumber===!0){m.s=c.s,!c.c||c.e>me?m.c=m.e=null:c.e<$e?m.c=[m.e=0]:(m.e=c.e,m.c=c.c.slice());return}if((p=typeof c=="number")&&c*0==0){if(m.s=1/c<0?(c=-c,-1):1,c===~~c){for(y=0,A=c;A>=10;A/=10,y++);y>me?m.c=m.e=null:(m.e=y,m.c=[c]);return}w=String(c)}else{if(!a.test(w=String(c)))return H(m,w,p);m.s=w.charCodeAt(0)==45?(w=w.slice(1),-1):1}(y=w.indexOf("."))>-1&&(w=w.replace(".","")),(A=w.search(/e/i))>0?(y<0&&(y=A),y+=+w.slice(A+1),w=w.substring(0,A)):y<0&&(y=w.length)}else{if(R(u,2,Ne.length,"Base"),u==10&&Ct)return m=new P(c),ve(m,W+m.e+1,T);if(w=String(c),p=typeof c=="number"){if(c*0!=0)return H(m,w,p,u);if(m.s=1/c<0?(w=w.slice(1),-1):1,P.DEBUG&&w.replace(/^0\.0*|\./,"").length>15)throw Error(o+c)}else m.s=w.charCodeAt(0)===45?(w=w.slice(1),-1):1;for(d=Ne.slice(0,u),y=A=0,g=w.length;A<g;A++)if(d.indexOf(b=w.charAt(A))<0){if(b=="."){if(A>y){y=g;continue}}else if(!f&&(w==w.toUpperCase()&&(w=w.toLowerCase())||w==w.toLowerCase()&&(w=w.toUpperCase()))){f=!0,A=-1,y=0;continue}return H(m,String(c),p,u)}p=!1,w=O(w,u,10,m.s),(y=w.indexOf("."))>-1?w=w.replace(".",""):y=w.length}for(A=0;w.charCodeAt(A)===48;A++);for(g=w.length;w.charCodeAt(--g)===48;);if(w=w.slice(A,++g)){if(g-=A,p&&P.DEBUG&&g>15&&(c>k||c!==r(c)))throw Error(o+m.s*c);if((y=y-A-1)>me)m.c=m.e=null;else if(y<$e)m.c=[m.e=0];else{if(m.e=y,m.c=[],A=(y+1)%l,y<0&&(A+=l),A<g){for(A&&m.c.push(+w.slice(0,A)),g-=l;A<g;)m.c.push(+w.slice(A,A+=l));A=l-(w=w.slice(A)).length}else A-=g;for(;A--;w+="0");m.c.push(+w)}}else m.c=[m.e=0]}P.clone=X,P.ROUND_UP=0,P.ROUND_DOWN=1,P.ROUND_CEIL=2,P.ROUND_FLOOR=3,P.ROUND_HALF_UP=4,P.ROUND_HALF_DOWN=5,P.ROUND_HALF_EVEN=6,P.ROUND_HALF_CEIL=7,P.ROUND_HALF_FLOOR=8,P.EUCLID=9,P.config=P.set=function(c){var u,d;if(c!=null)if(typeof c=="object"){if(c.hasOwnProperty(u="DECIMAL_PLACES")&&(d=c[u],R(d,0,C,u),W=d),c.hasOwnProperty(u="ROUNDING_MODE")&&(d=c[u],R(d,0,8,u),T=d),c.hasOwnProperty(u="EXPONENTIAL_AT")&&(d=c[u],d&&d.pop?(R(d[0],-C,0,u),R(d[1],0,C,u),re=d[0],oe=d[1]):(R(d,-C,C,u),re=-(oe=d<0?-d:d))),c.hasOwnProperty(u="RANGE"))if(d=c[u],d&&d.pop)R(d[0],-C,-1,u),R(d[1],1,C,u),$e=d[0],me=d[1];else if(R(d,-C,C,u),d)$e=-(me=d<0?-d:d);else throw Error(s+u+" cannot be zero: "+d);if(c.hasOwnProperty(u="CRYPTO"))if(d=c[u],d===!!d)if(d)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))xe=d;else throw xe=!d,Error(s+"crypto unavailable");else xe=d;else throw Error(s+u+" not true or false: "+d);if(c.hasOwnProperty(u="MODULO_MODE")&&(d=c[u],R(d,0,9,u),ze=d),c.hasOwnProperty(u="POW_PRECISION")&&(d=c[u],R(d,0,C,u),Ee=d),c.hasOwnProperty(u="FORMAT"))if(d=c[u],typeof d=="object")jt=d;else throw Error(s+u+" not an object: "+d);if(c.hasOwnProperty(u="ALPHABET"))if(d=c[u],typeof d=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(d))Ct=d.slice(0,10)=="0123456789",Ne=d;else throw Error(s+u+" invalid: "+d)}else throw Error(s+"Object expected: "+c);return{DECIMAL_PLACES:W,ROUNDING_MODE:T,EXPONENTIAL_AT:[re,oe],RANGE:[$e,me],CRYPTO:xe,MODULO_MODE:ze,POW_PRECISION:Ee,FORMAT:jt,ALPHABET:Ne}},P.isBigNumber=function(c){if(!c||c._isBigNumber!==!0)return!1;if(!P.DEBUG)return!0;var u,d,b=c.c,f=c.e,y=c.s;e:if({}.toString.call(b)=="[object Array]"){if((y===1||y===-1)&&f>=-C&&f<=C&&f===r(f)){if(b[0]===0){if(f===0&&b.length===1)return!0;break e}if(u=(f+1)%l,u<1&&(u+=l),String(b[0]).length==u){for(u=0;u<b.length;u++)if(d=b[u],d<0||d>=h||d!==r(d))break e;if(d!==0)return!0}}}else if(b===null&&f===null&&(y===null||y===1||y===-1))return!0;throw Error(s+"Invalid BigNumber: "+c)},P.maximum=P.max=function(){return qi(arguments,-1)},P.minimum=P.min=function(){return qi(arguments,1)},P.random=(function(){var c=9007199254740992,u=Math.random()*c&2097151?function(){return r(Math.random()*c)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(d){var b,f,y,A,p,g=0,w=[],m=new P(V);if(d==null?d=W:R(d,0,C),A=n(d/l),xe)if(crypto.getRandomValues){for(b=crypto.getRandomValues(new Uint32Array(A*=2));g<A;)p=b[g]*131072+(b[g+1]>>>11),p>=9e15?(f=crypto.getRandomValues(new Uint32Array(2)),b[g]=f[0],b[g+1]=f[1]):(w.push(p%1e14),g+=2);g=A/2}else if(crypto.randomBytes){for(b=crypto.randomBytes(A*=7);g<A;)p=(b[g]&31)*281474976710656+b[g+1]*1099511627776+b[g+2]*4294967296+b[g+3]*16777216+(b[g+4]<<16)+(b[g+5]<<8)+b[g+6],p>=9e15?crypto.randomBytes(7).copy(b,g):(w.push(p%1e14),g+=7);g=A/7}else throw xe=!1,Error(s+"crypto unavailable");if(!xe)for(;g<A;)p=u(),p<9e15&&(w[g++]=p%1e14);for(A=w[--g],d%=l,A&&d&&(p=S[l-d],w[g]=r(A/p)*p);w[g]===0;w.pop(),g--);if(g<0)w=[y=0];else{for(y=-1;w[0]===0;w.splice(0,1),y-=l);for(g=1,p=w[0];p>=10;p/=10,g++);g<l&&(y-=l-g)}return m.e=y,m.c=w,m}})(),P.sum=function(){for(var c=1,u=arguments,d=new P(u[0]);c<u.length;)d=d.plus(u[c++]);return d},O=(function(){var c="0123456789";function u(d,b,f,y){for(var A,p=[0],g,w=0,m=d.length;w<m;){for(g=p.length;g--;p[g]*=b);for(p[0]+=y.indexOf(d.charAt(w++)),A=0;A<p.length;A++)p[A]>f-1&&(p[A+1]==null&&(p[A+1]=0),p[A+1]+=p[A]/f|0,p[A]%=f)}return p.reverse()}return function(d,b,f,y,A){var p,g,w,m,I,L,q,z,ce=d.indexOf("."),le=W,Q=T;for(ce>=0&&(m=Ee,Ee=0,d=d.replace(".",""),z=new P(b),L=z.pow(d.length-ce),Ee=m,z.c=u(ae(K(L.c),L.e,"0"),10,f,c),z.e=z.c.length),q=u(d,b,f,A?(p=Ne,c):(p=c,Ne)),w=m=q.length;q[--m]==0;q.pop());if(!q[0])return p.charAt(0);if(ce<0?--w:(L.c=q,L.e=w,L.s=y,L=M(L,z,le,Q,f),q=L.c,I=L.r,w=L.e),g=w+le+1,ce=q[g],m=f/2,I=I||g<0||q[g+1]!=null,I=Q<4?(ce!=null||I)&&(Q==0||Q==(L.s<0?3:2)):ce>m||ce==m&&(Q==4||I||Q==6&&q[g-1]&1||Q==(L.s<0?8:7)),g<1||!q[0])d=I?ae(p.charAt(1),-le,p.charAt(0)):p.charAt(0);else{if(q.length=g,I)for(--f;++q[--g]>f;)q[g]=0,g||(++w,q=[1].concat(q));for(m=q.length;!q[--m];);for(ce=0,d="";ce<=m;d+=p.charAt(q[ce++]));d=ae(d,w,p.charAt(0))}return d}})(),M=(function(){function c(b,f,y){var A,p,g,w,m=0,I=b.length,L=f%U,q=f/U|0;for(b=b.slice();I--;)g=b[I]%U,w=b[I]/U|0,A=q*g+w*L,p=L*g+A%U*U+m,m=(p/y|0)+(A/U|0)+q*w,b[I]=p%y;return m&&(b=[m].concat(b)),b}function u(b,f,y,A){var p,g;if(y!=A)g=y>A?1:-1;else for(p=g=0;p<y;p++)if(b[p]!=f[p]){g=b[p]>f[p]?1:-1;break}return g}function d(b,f,y,A){for(var p=0;y--;)b[y]-=p,p=b[y]<f[y]?1:0,b[y]=p*A+b[y]-f[y];for(;!b[0]&&b.length>1;b.splice(0,1));}return function(b,f,y,A,p){var g,w,m,I,L,q,z,ce,le,Q,ne,pe,lt,_t,Mt,Se,Fe,Ae=b.s==f.s?1:-1,fe=b.c,ue=f.c;if(!fe||!fe[0]||!ue||!ue[0])return new P(!b.s||!f.s||(fe?ue&&fe[0]==ue[0]:!ue)?NaN:fe&&fe[0]==0||!ue?Ae*0:Ae/0);for(ce=new P(Ae),le=ce.c=[],w=b.e-f.e,Ae=y+w+1,p||(p=h,w=te(b.e/l)-te(f.e/l),Ae=Ae/l|0),m=0;ue[m]==(fe[m]||0);m++);if(ue[m]>(fe[m]||0)&&w--,Ae<0)le.push(1),I=!0;else{for(_t=fe.length,Se=ue.length,m=0,Ae+=2,L=r(p/(ue[0]+1)),L>1&&(ue=c(ue,L,p),fe=c(fe,L,p),Se=ue.length,_t=fe.length),lt=Se,Q=fe.slice(0,Se),ne=Q.length;ne<Se;Q[ne++]=0);Fe=ue.slice(),Fe=[0].concat(Fe),Mt=ue[0],ue[1]>=p/2&&Mt++;do{if(L=0,g=u(ue,Q,Se,ne),g<0){if(pe=Q[0],Se!=ne&&(pe=pe*p+(Q[1]||0)),L=r(pe/Mt),L>1)for(L>=p&&(L=p-1),q=c(ue,L,p),z=q.length,ne=Q.length;u(q,Q,z,ne)==1;)L--,d(q,Se<z?Fe:ue,z,p),z=q.length,g=1;else L==0&&(g=L=1),q=ue.slice(),z=q.length;if(z<ne&&(q=[0].concat(q)),d(Q,q,ne,p),ne=Q.length,g==-1)for(;u(ue,Q,Se,ne)<1;)L++,d(Q,Se<ne?Fe:ue,ne,p),ne=Q.length}else g===0&&(L++,Q=[0]);le[m++]=L,Q[0]?Q[ne++]=fe[lt]||0:(Q=[fe[lt]],ne=1)}while((lt++<_t||Q[0]!=null)&&Ae--);I=Q[0]!=null,le[0]||le.splice(0,1)}if(p==h){for(m=1,Ae=le[0];Ae>=10;Ae/=10,m++);ve(ce,y+(ce.e=m+w*l-1)+1,A,I)}else ce.e=w,ce.r=+I;return ce}})();function Ut(c,u,d,b){var f,y,A,p,g;if(d==null?d=T:R(d,0,8),!c.c)return c.toString();if(f=c.c[0],A=c.e,u==null)g=K(c.c),g=b==1||b==2&&(A<=re||A>=oe)?J(g,A):ae(g,A,"0");else if(c=ve(new P(c),u,d),y=c.e,g=K(c.c),p=g.length,b==1||b==2&&(u<=y||y<=re)){for(;p<u;g+="0",p++);g=J(g,y)}else if(u-=A+(b===2&&y>A),g=ae(g,y,"0"),y+1>p){if(--u>0)for(g+=".";u--;g+="0");}else if(u+=y-p,u>0)for(y+1==p&&(g+=".");u--;g+="0");return c.s<0&&f?"-"+g:g}function qi(c,u){for(var d,b,f=1,y=new P(c[0]);f<c.length;f++)b=new P(c[f]),(!b.s||(d=Z(y,b))===u||d===0&&y.s===u)&&(y=b);return y}function Et(c,u,d){for(var b=1,f=u.length;!u[--f];u.pop());for(f=u[0];f>=10;f/=10,b++);return(d=b+d*l-1)>me?c.c=c.e=null:d<$e?c.c=[c.e=0]:(c.e=d,c.c=u),c}H=(function(){var c=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,d=/^\.([^.]+)$/,b=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(y,A,p,g){var w,m=p?A:A.replace(f,"");if(b.test(m))y.s=isNaN(m)?null:m<0?-1:1;else{if(!p&&(m=m.replace(c,function(I,L,q){return w=(q=q.toLowerCase())=="x"?16:q=="b"?2:8,!g||g==w?L:I}),g&&(w=g,m=m.replace(u,"$1").replace(d,"0.$1")),A!=m))return new P(m,w);if(P.DEBUG)throw Error(s+"Not a"+(g?" base "+g:"")+" number: "+A);y.s=null}y.c=y.e=null}})();function ve(c,u,d,b){var f,y,A,p,g,w,m,I=c.c,L=S;if(I){e:{for(f=1,p=I[0];p>=10;p/=10,f++);if(y=u-f,y<0)y+=l,A=u,g=I[w=0],m=r(g/L[f-A-1]%10);else if(w=n((y+1)/l),w>=I.length)if(b){for(;I.length<=w;I.push(0));g=m=0,f=1,y%=l,A=y-l+1}else break e;else{for(g=p=I[w],f=1;p>=10;p/=10,f++);y%=l,A=y-l+f,m=A<0?0:r(g/L[f-A-1]%10)}if(b=b||u<0||I[w+1]!=null||(A<0?g:g%L[f-A-1]),b=d<4?(m||b)&&(d==0||d==(c.s<0?3:2)):m>5||m==5&&(d==4||b||d==6&&(y>0?A>0?g/L[f-A]:0:I[w-1])%10&1||d==(c.s<0?8:7)),u<1||!I[0])return I.length=0,b?(u-=c.e+1,I[0]=L[(l-u%l)%l],c.e=-u||0):I[0]=c.e=0,c;if(y==0?(I.length=w,p=1,w--):(I.length=w+1,p=L[l-y],I[w]=A>0?r(g/L[f-A]%L[A])*p:0),b)for(;;)if(w==0){for(y=1,A=I[0];A>=10;A/=10,y++);for(A=I[0]+=p,p=1;A>=10;A/=10,p++);y!=p&&(c.e++,I[0]==h&&(I[0]=1));break}else{if(I[w]+=p,I[w]!=h)break;I[w--]=0,p=1}for(y=I.length;I[--y]===0;I.pop());}c.e>me?c.c=c.e=null:c.e<$e&&(c.c=[c.e=0])}return c}function Pe(c){var u,d=c.e;return d===null?c.toString():(u=K(c.c),u=d<=re||d>=oe?J(u,d):ae(u,d,"0"),c.s<0?"-"+u:u)}return j.absoluteValue=j.abs=function(){var c=new P(this);return c.s<0&&(c.s=1),c},j.comparedTo=function(c,u){return Z(this,new P(c,u))},j.decimalPlaces=j.dp=function(c,u){var d,b,f,y=this;if(c!=null)return R(c,0,C),u==null?u=T:R(u,0,8),ve(new P(y),c+y.e+1,u);if(!(d=y.c))return null;if(b=((f=d.length-1)-te(this.e/l))*l,f=d[f])for(;f%10==0;f/=10,b--);return b<0&&(b=0),b},j.dividedBy=j.div=function(c,u){return M(this,new P(c,u),W,T)},j.dividedToIntegerBy=j.idiv=function(c,u){return M(this,new P(c,u),0,1)},j.exponentiatedBy=j.pow=function(c,u){var d,b,f,y,A,p,g,w,m,I=this;if(c=new P(c),c.c&&!c.isInteger())throw Error(s+"Exponent not an integer: "+Pe(c));if(u!=null&&(u=new P(u)),p=c.e>14,!I.c||!I.c[0]||I.c[0]==1&&!I.e&&I.c.length==1||!c.c||!c.c[0])return m=new P(Math.pow(+Pe(I),p?c.s*(2-G(c)):+Pe(c))),u?m.mod(u):m;if(g=c.s<0,u){if(u.c?!u.c[0]:!u.s)return new P(NaN);b=!g&&I.isInteger()&&u.isInteger(),b&&(I=I.mod(u))}else{if(c.e>9&&(I.e>0||I.e<-1||(I.e==0?I.c[0]>1||p&&I.c[1]>=24e7:I.c[0]<8e13||p&&I.c[0]<=9999975e7)))return y=I.s<0&&G(c)?-0:0,I.e>-1&&(y=1/y),new P(g?1/y:y);Ee&&(y=n(Ee/l+2))}for(p?(d=new P(.5),g&&(c.s=1),w=G(c)):(f=Math.abs(+Pe(c)),w=f%2),m=new P(V);;){if(w){if(m=m.times(I),!m.c)break;y?m.c.length>y&&(m.c.length=y):b&&(m=m.mod(u))}if(f){if(f=r(f/2),f===0)break;w=f%2}else if(c=c.times(d),ve(c,c.e+1,1),c.e>14)w=G(c);else{if(f=+Pe(c),f===0)break;w=f%2}I=I.times(I),y?I.c&&I.c.length>y&&(I.c.length=y):b&&(I=I.mod(u))}return b?m:(g&&(m=V.div(m)),u?m.mod(u):y?ve(m,Ee,T,A):m)},j.integerValue=function(c){var u=new P(this);return c==null?c=T:R(c,0,8),ve(u,u.e+1,c)},j.isEqualTo=j.eq=function(c,u){return Z(this,new P(c,u))===0},j.isFinite=function(){return!!this.c},j.isGreaterThan=j.gt=function(c,u){return Z(this,new P(c,u))>0},j.isGreaterThanOrEqualTo=j.gte=function(c,u){return(u=Z(this,new P(c,u)))===1||u===0},j.isInteger=function(){return!!this.c&&te(this.e/l)>this.c.length-2},j.isLessThan=j.lt=function(c,u){return Z(this,new P(c,u))<0},j.isLessThanOrEqualTo=j.lte=function(c,u){return(u=Z(this,new P(c,u)))===-1||u===0},j.isNaN=function(){return!this.s},j.isNegative=function(){return this.s<0},j.isPositive=function(){return this.s>0},j.isZero=function(){return!!this.c&&this.c[0]==0},j.minus=function(c,u){var d,b,f,y,A=this,p=A.s;if(c=new P(c,u),u=c.s,!p||!u)return new P(NaN);if(p!=u)return c.s=-u,A.plus(c);var g=A.e/l,w=c.e/l,m=A.c,I=c.c;if(!g||!w){if(!m||!I)return m?(c.s=-u,c):new P(I?A:NaN);if(!m[0]||!I[0])return I[0]?(c.s=-u,c):new P(m[0]?A:T==3?-0:0)}if(g=te(g),w=te(w),m=m.slice(),p=g-w){for((y=p<0)?(p=-p,f=m):(w=g,f=I),f.reverse(),u=p;u--;f.push(0));f.reverse()}else for(b=(y=(p=m.length)<(u=I.length))?p:u,p=u=0;u<b;u++)if(m[u]!=I[u]){y=m[u]<I[u];break}if(y&&(f=m,m=I,I=f,c.s=-c.s),u=(b=I.length)-(d=m.length),u>0)for(;u--;m[d++]=0);for(u=h-1;b>p;){if(m[--b]<I[b]){for(d=b;d&&!m[--d];m[d]=u);--m[d],m[b]+=h}m[b]-=I[b]}for(;m[0]==0;m.splice(0,1),--w);return m[0]?Et(c,m,w):(c.s=T==3?-1:1,c.c=[c.e=0],c)},j.modulo=j.mod=function(c,u){var d,b,f=this;return c=new P(c,u),!f.c||!c.s||c.c&&!c.c[0]?new P(NaN):!c.c||f.c&&!f.c[0]?new P(f):(ze==9?(b=c.s,c.s=1,d=M(f,c,0,3),c.s=b,d.s*=b):d=M(f,c,0,ze),c=f.minus(d.times(c)),!c.c[0]&&ze==1&&(c.s=f.s),c)},j.multipliedBy=j.times=function(c,u){var d,b,f,y,A,p,g,w,m,I,L,q,z,ce,le,Q=this,ne=Q.c,pe=(c=new P(c,u)).c;if(!ne||!pe||!ne[0]||!pe[0])return!Q.s||!c.s||ne&&!ne[0]&&!pe||pe&&!pe[0]&&!ne?c.c=c.e=c.s=null:(c.s*=Q.s,!ne||!pe?c.c=c.e=null:(c.c=[0],c.e=0)),c;for(b=te(Q.e/l)+te(c.e/l),c.s*=Q.s,g=ne.length,I=pe.length,g<I&&(z=ne,ne=pe,pe=z,f=g,g=I,I=f),f=g+I,z=[];f--;z.push(0));for(ce=h,le=U,f=I;--f>=0;){for(d=0,L=pe[f]%le,q=pe[f]/le|0,A=g,y=f+A;y>f;)w=ne[--A]%le,m=ne[A]/le|0,p=q*w+m*L,w=L*w+p%le*le+z[y]+d,d=(w/ce|0)+(p/le|0)+q*m,z[y--]=w%ce;z[y]=d}return d?++b:z.splice(0,1),Et(c,z,b)},j.negated=function(){var c=new P(this);return c.s=-c.s||null,c},j.plus=function(c,u){var d,b=this,f=b.s;if(c=new P(c,u),u=c.s,!f||!u)return new P(NaN);if(f!=u)return c.s=-u,b.minus(c);var y=b.e/l,A=c.e/l,p=b.c,g=c.c;if(!y||!A){if(!p||!g)return new P(f/0);if(!p[0]||!g[0])return g[0]?c:new P(p[0]?b:f*0)}if(y=te(y),A=te(A),p=p.slice(),f=y-A){for(f>0?(A=y,d=g):(f=-f,d=p),d.reverse();f--;d.push(0));d.reverse()}for(f=p.length,u=g.length,f-u<0&&(d=g,g=p,p=d,u=f),f=0;u;)f=(p[--u]=p[u]+g[u]+f)/h|0,p[u]=h===p[u]?0:p[u]%h;return f&&(p=[f].concat(p),++A),Et(c,p,A)},j.precision=j.sd=function(c,u){var d,b,f,y=this;if(c!=null&&c!==!!c)return R(c,1,C),u==null?u=T:R(u,0,8),ve(new P(y),c,u);if(!(d=y.c))return null;if(f=d.length-1,b=f*l+1,f=d[f]){for(;f%10==0;f/=10,b--);for(f=d[0];f>=10;f/=10,b++);}return c&&y.e+1>b&&(b=y.e+1),b},j.shiftedBy=function(c){return R(c,-k,k),this.times("1e"+c)},j.squareRoot=j.sqrt=function(){var c,u,d,b,f,y=this,A=y.c,p=y.s,g=y.e,w=W+4,m=new P("0.5");if(p!==1||!A||!A[0])return new P(!p||p<0&&(!A||A[0])?NaN:A?y:1/0);if(p=Math.sqrt(+Pe(y)),p==0||p==1/0?(u=K(A),(u.length+g)%2==0&&(u+="0"),p=Math.sqrt(+u),g=te((g+1)/2)-(g<0||g%2),p==1/0?u="5e"+g:(u=p.toExponential(),u=u.slice(0,u.indexOf("e")+1)+g),d=new P(u)):d=new P(p+""),d.c[0]){for(g=d.e,p=g+w,p<3&&(p=0);;)if(f=d,d=m.times(f.plus(M(y,f,w,1))),K(f.c).slice(0,p)===(u=K(d.c)).slice(0,p))if(d.e<g&&--p,u=u.slice(p-3,p+1),u=="9999"||!b&&u=="4999"){if(!b&&(ve(f,f.e+W+2,0),f.times(f).eq(y))){d=f;break}w+=4,p+=4,b=1}else{(!+u||!+u.slice(1)&&u.charAt(0)=="5")&&(ve(d,d.e+W+2,1),c=!d.times(d).eq(y));break}}return ve(d,d.e+W+1,T,c)},j.toExponential=function(c,u){return c!=null&&(R(c,0,C),c++),Ut(this,c,u,1)},j.toFixed=function(c,u){return c!=null&&(R(c,0,C),c=c+this.e+1),Ut(this,c,u)},j.toFormat=function(c,u,d){var b,f=this;if(d==null)c!=null&&u&&typeof u=="object"?(d=u,u=null):c&&typeof c=="object"?(d=c,c=u=null):d=jt;else if(typeof d!="object")throw Error(s+"Argument not an object: "+d);if(b=f.toFixed(c,u),f.c){var y,A=b.split("."),p=+d.groupSize,g=+d.secondaryGroupSize,w=d.groupSeparator||"",m=A[0],I=A[1],L=f.s<0,q=L?m.slice(1):m,z=q.length;if(g&&(y=p,p=g,g=y,z-=y),p>0&&z>0){for(y=z%p||p,m=q.substr(0,y);y<z;y+=p)m+=w+q.substr(y,p);g>0&&(m+=w+q.slice(y)),L&&(m="-"+m)}b=I?m+(d.decimalSeparator||"")+((g=+d.fractionGroupSize)?I.replace(new RegExp("\\d{"+g+"}\\B","g"),"$&"+(d.fractionGroupSeparator||"")):I):m}return(d.prefix||"")+b+(d.suffix||"")},j.toFraction=function(c){var u,d,b,f,y,A,p,g,w,m,I,L,q=this,z=q.c;if(c!=null&&(p=new P(c),!p.isInteger()&&(p.c||p.s!==1)||p.lt(V)))throw Error(s+"Argument "+(p.isInteger()?"out of range: ":"not an integer: ")+Pe(p));if(!z)return new P(q);for(u=new P(V),w=d=new P(V),b=g=new P(V),L=K(z),y=u.e=L.length-q.e-1,u.c[0]=S[(A=y%l)<0?l+A:A],c=!c||p.comparedTo(u)>0?y>0?u:w:p,A=me,me=1/0,p=new P(L),g.c[0]=0;m=M(p,u,0,1),f=d.plus(m.times(b)),f.comparedTo(c)!=1;)d=b,b=f,w=g.plus(m.times(f=w)),g=f,u=p.minus(m.times(f=u)),p=f;return f=M(c.minus(d),b,0,1),g=g.plus(f.times(w)),d=d.plus(f.times(b)),g.s=w.s=q.s,y=y*2,I=M(w,b,y,T).minus(q).abs().comparedTo(M(g,d,y,T).minus(q).abs())<1?[w,b]:[g,d],me=A,I},j.toNumber=function(){return+Pe(this)},j.toPrecision=function(c,u){return c!=null&&R(c,1,C),Ut(this,c,u,2)},j.toString=function(c){var u,d=this,b=d.s,f=d.e;return f===null?b?(u="Infinity",b<0&&(u="-"+u)):u="NaN":(c==null?u=f<=re||f>=oe?J(K(d.c),f):ae(K(d.c),f,"0"):c===10&&Ct?(d=ve(new P(d),W+f+1,T),u=ae(K(d.c),d.e,"0")):(R(c,2,Ne.length,"Base"),u=O(ae(K(d.c),f,"0"),10,c,b,!0)),b<0&&d.c[0]&&(u="-"+u)),u},j.valueOf=j.toJSON=function(){return Pe(this)},j._isBigNumber=!0,N!=null&&P.set(N),P}function te(N){var M=N|0;return N>0||N===M?M:M-1}function K(N){for(var M,O,H=1,j=N.length,V=N[0]+"";H<j;){for(M=N[H++]+"",O=l-M.length;O--;M="0"+M);V+=M}for(j=V.length;V.charCodeAt(--j)===48;);return V.slice(0,j+1||1)}function Z(N,M){var O,H,j=N.c,V=M.c,W=N.s,T=M.s,re=N.e,oe=M.e;if(!W||!T)return null;if(O=j&&!j[0],H=V&&!V[0],O||H)return O?H?0:-T:W;if(W!=T)return W;if(O=W<0,H=re==oe,!j||!V)return H?0:!j^O?1:-1;if(!H)return re>oe^O?1:-1;for(T=(re=j.length)<(oe=V.length)?re:oe,W=0;W<T;W++)if(j[W]!=V[W])return j[W]>V[W]^O?1:-1;return re==oe?0:re>oe^O?1:-1}function R(N,M,O,H){if(N<M||N>O||N!==r(N))throw Error(s+(H||"Argument")+(typeof N=="number"?N<M||N>O?" out of range: ":" not an integer: ":" not a primitive number: ")+String(N))}function G(N){var M=N.c.length-1;return te(N.e/l)==M&&N.c[M]%2!=0}function J(N,M){return(N.length>1?N.charAt(0)+"."+N.slice(1):N)+(M<0?"e":"e+")+M}function ae(N,M,O){var H,j;if(M<0){for(j=O+".";++M;j+=O);N=j+N}else if(H=N.length,++M>H){for(j=O,M-=H;--M;j+=O);N+=j}else M<H&&(N=N.slice(0,M)+"."+N.slice(M));return N}i=X(),i.default=i.BigNumber=i,t.exports?t.exports=i:(e||(e=typeof self<"u"&&self?self:window),e.BigNumber=i)})(ua)})(rt)),rt.exports}var ei;function la(){return ei||(ei=1,(function(t){var e=Ft(),i=t.exports;(function(){var a=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,r,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},o;function h(k){return a.lastIndex=0,a.test(k)?'"'+k.replace(a,function(S){var U=s[S];return typeof U=="string"?U:"\\u"+("0000"+S.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+k+'"'}function l(k,S){var U,C,X,te,K=n,Z,R=S[k],G=R!=null&&(R instanceof e||e.isBigNumber(R));switch(R&&typeof R=="object"&&typeof R.toJSON=="function"&&(R=R.toJSON(k)),typeof o=="function"&&(R=o.call(S,k,R)),typeof R){case"string":return G?R:h(R);case"number":return isFinite(R)?String(R):"null";case"boolean":case"null":case"bigint":return String(R);case"object":if(!R)return"null";if(n+=r,Z=[],Object.prototype.toString.apply(R)==="[object Array]"){for(te=R.length,U=0;U<te;U+=1)Z[U]=l(U,R)||"null";return X=Z.length===0?"[]":n?`[
4
+ `+n+Z.join(`,
5
+ `+n)+`
6
+ `+K+"]":"["+Z.join(",")+"]",n=K,X}if(o&&typeof o=="object")for(te=o.length,U=0;U<te;U+=1)typeof o[U]=="string"&&(C=o[U],X=l(C,R),X&&Z.push(h(C)+(n?": ":":")+X));else Object.keys(R).forEach(function(J){var ae=l(J,R);ae&&Z.push(h(J)+(n?": ":":")+ae)});return X=Z.length===0?"{}":n?`{
7
+ `+n+Z.join(`,
8
+ `+n)+`
9
+ `+K+"}":"{"+Z.join(",")+"}",n=K,X}}typeof i.stringify!="function"&&(i.stringify=function(k,S,U){var C;if(n="",r="",typeof U=="number")for(C=0;C<U;C+=1)r+=" ";else typeof U=="string"&&(r=U);if(o=S,S&&typeof S!="function"&&(typeof S!="object"||typeof S.length!="number"))throw new Error("JSON.stringify");return l("",{"":k})})})()})(bt)),bt.exports}var wt,ti;function da(){if(ti)return wt;ti=1;var t=null;const e=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,i=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;var a=function(n){var r={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(n!=null){if(n.strict===!0&&(r.strict=!0),n.storeAsString===!0&&(r.storeAsString=!0),r.alwaysParseAsBig=n.alwaysParseAsBig===!0?n.alwaysParseAsBig:!1,r.useNativeBigInt=n.useNativeBigInt===!0?n.useNativeBigInt:!1,typeof n.constructorAction<"u")if(n.constructorAction==="error"||n.constructorAction==="ignore"||n.constructorAction==="preserve")r.constructorAction=n.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${n.constructorAction}`);if(typeof n.protoAction<"u")if(n.protoAction==="error"||n.protoAction==="ignore"||n.protoAction==="preserve")r.protoAction=n.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${n.protoAction}`)}var s,o,h={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
10
+ `,r:"\r",t:" "},l,k=function(G){throw{name:"SyntaxError",message:G,at:s,text:l}},S=function(G){return G&&G!==o&&k("Expected '"+G+"' instead of '"+o+"'"),o=l.charAt(s),s+=1,o},U=function(){var G,J="";for(o==="-"&&(J="-",S("-"));o>="0"&&o<="9";)J+=o,S();if(o===".")for(J+=".";S()&&o>="0"&&o<="9";)J+=o;if(o==="e"||o==="E")for(J+=o,S(),(o==="-"||o==="+")&&(J+=o,S());o>="0"&&o<="9";)J+=o,S();if(G=+J,!isFinite(G))k("Bad number");else return t==null&&(t=Ft()),J.length>15?r.storeAsString?J:r.useNativeBigInt?BigInt(J):new t(J):r.alwaysParseAsBig?r.useNativeBigInt?BigInt(G):new t(G):G},C=function(){var G,J,ae="",N;if(o==='"')for(var M=s;S();){if(o==='"')return s-1>M&&(ae+=l.substring(M,s-1)),S(),ae;if(o==="\\"){if(s-1>M&&(ae+=l.substring(M,s-1)),S(),o==="u"){for(N=0,J=0;J<4&&(G=parseInt(S(),16),!!isFinite(G));J+=1)N=N*16+G;ae+=String.fromCharCode(N)}else if(typeof h[o]=="string")ae+=h[o];else break;M=s}}k("Bad string")},X=function(){for(;o&&o<=" ";)S()},te=function(){switch(o){case"t":return S("t"),S("r"),S("u"),S("e"),!0;case"f":return S("f"),S("a"),S("l"),S("s"),S("e"),!1;case"n":return S("n"),S("u"),S("l"),S("l"),null}k("Unexpected '"+o+"'")},K,Z=function(){var G=[];if(o==="["){if(S("["),X(),o==="]")return S("]"),G;for(;o;){if(G.push(K()),X(),o==="]")return S("]"),G;S(","),X()}}k("Bad array")},R=function(){var G,J=Object.create(null);if(o==="{"){if(S("{"),X(),o==="}")return S("}"),J;for(;o;){if(G=C(),X(),S(":"),r.strict===!0&&Object.hasOwnProperty.call(J,G)&&k('Duplicate key "'+G+'"'),e.test(G)===!0?r.protoAction==="error"?k("Object contains forbidden prototype property"):r.protoAction==="ignore"?K():J[G]=K():i.test(G)===!0?r.constructorAction==="error"?k("Object contains forbidden constructor property"):r.constructorAction==="ignore"?K():J[G]=K():J[G]=K(),X(),o==="}")return S("}"),J;S(","),X()}}k("Bad object")};return K=function(){switch(X(),o){case"{":return R();case"[":return Z();case'"':return C();case"-":return U();default:return o>="0"&&o<="9"?U():te()}},function(G,J){var ae;return l=G+"",s=0,o=" ",ae=K(),X(),o&&k("Syntax error"),typeof J=="function"?(function N(M,O){var H,j=M[O];return j&&typeof j=="object"&&Object.keys(j).forEach(function(V){H=N(j,V),H!==void 0?j[V]=H:delete j[V]}),J.call(M,O,j)})({"":ae},""):ae}};return wt=a,wt}var ii;function ha(){if(ii)return Qe.exports;ii=1;var t=la().stringify,e=da();return Qe.exports=function(i){return{parse:e(i),stringify:t}},Qe.exports.parse=e(),Qe.exports.stringify=t,Qe.exports}var pa=ha();const vt=ca(pa);function st(t,e,i,a){function n(r){return r instanceof i?r:new i(function(s){s(r)})}return new(i||(i=Promise))(function(r,s){function o(k){try{l(a.next(k))}catch(S){s(S)}}function h(k){try{l(a.throw(k))}catch(S){s(S)}}function l(k){k.done?r(k.value):n(k.value).then(o,h)}l((a=a.apply(t,e||[])).next())})}function fa(t,e,i,a){if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(t):a?a.value:e.get(t)}typeof SuppressedError=="function"&&SuppressedError;var ot,ai;class De{static custom(e){return e}static unique(e=7){const i=fa(ot,ot,"m",ai).call(ot);let a="";for(let n=0;n<e;n++){const r=Math.floor(Math.random()*16).toString(16);a+=r}return i+a}}ot=De,ai=function(){const e=new Date,i=Math.floor(e.getTime()/1e3),a=e.getMilliseconds();return i.toString(16)+a.toString(16).padStart(5,"0")},vt({useNativeBigInt:!0});const ga=vt({storeAsString:!1}),ya=vt({useNativeBigInt:!0}),ma=BigInt(Number.MAX_SAFE_INTEGER),ba=BigInt(Number.MIN_SAFE_INTEGER),wa=BigInt("9223372036854775807"),va=BigInt("-9223372036854775808");function Aa(t){return t!==null&&typeof t=="object"&&t._isBigNumber===!0&&typeof t.isInteger=="function"&&typeof t.toFixed=="function"&&typeof t.toNumber=="function"}function ka(t,e){if(Aa(e)){if(e.isInteger()){const i=e.toFixed(),a=BigInt(i);return a>=ba&&a<=ma?Number(i):a>=va&&a<=wa?a:e.toNumber()}return e.toNumber()}return e}const Ie={parse:t=>ga.parse(t,ka),stringify:ya.stringify};class x extends Error{constructor(e,i=0,a="",n=""){super(e),this.name="AppwriteException",this.message=e,this.code=i,this.type=a,this.response=n}}class ke{constructor(){this.config={endpoint:"https://cloud.appwrite.io/v1",endpointRealtime:"",project:"",jwt:"",bearer:"",locale:"",session:"",devkey:"",cookie:"",impersonateuserid:"",impersonateuseremail:"",impersonateuserphone:""},this.headers={"x-sdk-name":"Web","x-sdk-platform":"client","x-sdk-language":"web","x-sdk-version":"27.0.0","X-Appwrite-Response-Format":"2.0.0"},this.realtime={socket:void 0,timeout:void 0,heartbeat:void 0,url:"",channels:new Set,subscriptions:new Map,pendingSubscribes:new Map,reconnect:!0,reconnectAttempts:0,lastMessage:void 0,connect:()=>{clearTimeout(this.realtime.timeout),this.realtime.timeout=window?.setTimeout(()=>{this.realtime.createSocket()},50)},getTimeout:()=>{switch(!0){case this.realtime.reconnectAttempts<5:return 1e3;case this.realtime.reconnectAttempts<15:return 5e3;case this.realtime.reconnectAttempts<100:return 1e4;default:return 6e4}},createHeartbeat:()=>{this.realtime.heartbeat&&clearTimeout(this.realtime.heartbeat),this.realtime.heartbeat=window?.setInterval(()=>{var e;(e=this.realtime.socket)===null||e===void 0||e.send(Ie.stringify({type:"ping"}))},2e4)},createSocket:()=>{var e,i,a,n,r;if(this.realtime.subscriptions.size<1){this.realtime.reconnect=!1,(e=this.realtime.socket)===null||e===void 0||e.close();return}let o="project="+encodeURIComponent((i=this.config.project)!==null&&i!==void 0?i:"");this.config.jwt&&(o+="&jwt="+encodeURIComponent(this.config.jwt));const h=this.config.endpointRealtime+"/realtime?"+o;h!==this.realtime.url||!this.realtime.socket||((a=this.realtime.socket)===null||a===void 0?void 0:a.readyState)>WebSocket.OPEN?(this.realtime.socket&&((n=this.realtime.socket)===null||n===void 0?void 0:n.readyState)<WebSocket.CLOSING&&(this.realtime.reconnect=!1,this.realtime.socket.close()),this.realtime.url=h,this.realtime.socket=new WebSocket(h),this.realtime.socket.addEventListener("message",this.realtime.onMessage),this.realtime.socket.addEventListener("open",l=>{this.realtime.reconnectAttempts=0,this.realtime.createHeartbeat()}),this.realtime.socket.addEventListener("close",l=>{var k,S,U;if(!this.realtime.reconnect||((S=(k=this.realtime)===null||k===void 0?void 0:k.lastMessage)===null||S===void 0?void 0:S.type)==="error"&&((U=this.realtime)===null||U===void 0?void 0:U.lastMessage.data).code===1008){this.realtime.reconnect=!0;return}const C=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${C/1e3} seconds.`,l.reason),setTimeout(()=>{this.realtime.reconnectAttempts++,this.realtime.createSocket()},C)})):((r=this.realtime.socket)===null||r===void 0?void 0:r.readyState)===WebSocket.OPEN&&this.realtime.sendPendingSubscribes()},sendPendingSubscribes:()=>{if(!this.realtime.socket||this.realtime.socket.readyState!==WebSocket.OPEN||this.realtime.pendingSubscribes.size<1)return;const e=Array.from(this.realtime.pendingSubscribes.values());this.realtime.pendingSubscribes.clear(),this.realtime.socket.send(Ie.stringify({type:"subscribe",data:e}))},onMessage:e=>{var i,a;try{const n=Ie.parse(e.data);switch(this.realtime.lastMessage=n,n.type){case"connected":{const r=n.data;let s=this.config.session;if(!s){const o=Ie.parse((i=window.localStorage.getItem("cookieFallback"))!==null&&i!==void 0?i:"{}");s=o?.[`a_session_${this.config.project}`]}s&&!r?.user&&((a=this.realtime.socket)===null||a===void 0||a.send(Ie.stringify({type:"authentication",data:{session:s}}))),this.realtime.subscriptions.forEach((o,h)=>{var l;this.realtime.pendingSubscribes.set(h,{subscriptionId:h,channels:o.channels,queries:(l=o.queries)!==null&&l!==void 0?l:[]})}),this.realtime.sendPendingSubscribes();break}case"response":break;case"event":{const r=n.data;if(!r?.channels)break;const s=r.subscriptions;if(s&&s.length>0)for(const o of s){const h=this.realtime.subscriptions.get(o);h&&setTimeout(()=>h.callback(r))}else{if(!r.channels.some(h=>this.realtime.channels.has(h)))break;this.realtime.subscriptions.forEach(h=>{r.channels.some(l=>h.channels.includes(l))&&setTimeout(()=>h.callback(r))})}break}case"pong":break;case"error":throw n.data;default:break}}catch(n){console.error(n)}}}}getHeaders(){return Object.assign({},this.headers)}setEndpoint(e){if(!e||typeof e!="string")throw new x("Endpoint must be a valid string");if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new x("Invalid endpoint URL: "+e);return this.config.endpoint=e,this.config.endpointRealtime=e.replace("https://","wss://").replace("http://","ws://"),this}setEndpointRealtime(e){if(!e||typeof e!="string")throw new x("Endpoint must be a valid string");if(!e.startsWith("ws://")&&!e.startsWith("wss://"))throw new x("Invalid realtime endpoint URL: "+e);return this.config.endpointRealtime=e,this}setProject(e){return this.config.project=e,this}setJWT(e){return this.headers["X-Appwrite-JWT"]=e,this.config.jwt=e,this}setBearer(e){return this.headers.Authorization=`Bearer ${e}`,this.config.bearer=e,this}setLocale(e){return this.headers["X-Appwrite-Locale"]=e,this.config.locale=e,this}setSession(e){return this.headers["X-Appwrite-Session"]=e,this.config.session=e,this}setDevKey(e){return this.headers["X-Appwrite-Dev-Key"]=e,this.config.devkey=e,this}setCookie(e){return this.headers.Cookie=e,this.config.cookie=e,this}setImpersonateUserId(e){return this.headers["X-Appwrite-Impersonate-User-Id"]=e,this.config.impersonateuserid=e,this}setImpersonateUserEmail(e){return this.headers["X-Appwrite-Impersonate-User-Email"]=e,this.config.impersonateuseremail=e,this}setImpersonateUserPhone(e){return this.headers["X-Appwrite-Impersonate-User-Phone"]=e,this.config.impersonateuserphone=e,this}subscribe(e,i,a=[]){const r=(Array.isArray(e)?e:[e]).map(l=>typeof l=="string"?l:l&&typeof l.toString=="function"?l.toString():String(l));r.forEach(l=>this.realtime.channels.add(l));const s=(a??[]).map(l=>typeof l=="string"?l:l.toString());let o="";const h=this.realtime.subscriptions.size+1;for(let l=0;l<h;l++){const k=De.unique();if(!this.realtime.subscriptions.has(k)){o=k;break}}if(o==="")throw new x("Failed to generate unique subscription id");return this.realtime.subscriptions.set(o,{channels:r,queries:s,callback:i}),this.realtime.pendingSubscribes.set(o,{subscriptionId:o,channels:r,queries:s}),this.realtime.connect(),()=>{this.realtime.subscriptions.delete(o),this.realtime.pendingSubscribes.delete(o);const l=new Set;this.realtime.subscriptions.forEach(k=>{k.channels.forEach(S=>l.add(S))}),this.realtime.channels.forEach(k=>{l.has(k)||this.realtime.channels.delete(k)}),this.realtime.connect()}}prepareRequest(e,i,a={},n={}){if(e=e.toUpperCase(),a=Object.assign({},this.headers,a),typeof window<"u"&&window.localStorage){const s=window.localStorage.getItem("cookieFallback");s&&(a["X-Fallback-Cookies"]=s)}const r={method:e,headers:a};if(a["X-Appwrite-Dev-Key"]===void 0&&(r.credentials="include"),e==="GET")for(const[s,o]of Object.entries(ke.flatten(n)))i.searchParams.append(s,o);else switch(a["content-type"]){case"application/json":r.body=Ie.stringify(n);break;case"multipart/form-data":{const s=new FormData;for(const[o,h]of Object.entries(n))if(h instanceof File)s.append(o,h,h.name);else if(Array.isArray(h))for(const l of h)s.append(`${o}[]`,l);else s.append(o,h);r.body=s,delete a["content-type"];break}}return{uri:i.toString(),options:r}}chunkedUpload(e,i){return st(this,arguments,void 0,function*(a,n,r={},s={},o){var h;const[l,k]=(h=Object.entries(s).find(([V,W])=>W instanceof File))!==null&&h!==void 0?h:[];if(!k||!l)throw new Error("File not found in payload");if(k.size<=ke.CHUNK_SIZE)return yield this.call(a,n,r,s);const S=Math.ceil(k.size/ke.CHUNK_SIZE),U=Math.min(ke.CHUNK_SIZE,k.size),C=Object.assign(Object.assign({},r),{"content-range":`bytes 0-${U-1}/${k.size}`}),X=k.slice(0,U),te=Object.assign({},s);te[l]=new File([X],k.name);const K=yield this.call(a,n,C,te),Z=K?.$id;if(o&&typeof o=="function"&&o({$id:Z,progress:Math.round(U/k.size*100),sizeUploaded:U,chunksTotal:S,chunksUploaded:1}),S===1)return K;const R=[];for(let V=1;V<S;V++){const W=V*ke.CHUNK_SIZE,T=Math.min(W+ke.CHUNK_SIZE,k.size);R.push({start:W,end:T})}const G=8;let J=1,ae=U,N=K,M=null,O=!1;const H=V=>{var W;const T=V?.chunksUploaded,re=(W=V?.chunksTotal)!==null&&W!==void 0?W:S;return typeof T=="number"&&typeof re=="number"&&T>=re},j=V=>st(this,void 0,void 0,function*(){const W=Object.assign({},r);Z&&(W["x-appwrite-id"]=Z),W["content-range"]=`bytes ${V.start}-${V.end-1}/${k.size}`;const T=k.slice(V.start,V.end),re=Object.assign({},s);re[l]=new File([T],k.name);const oe=yield this.call(a,n,W,re);return O||(J++,ae+=V.end-V.start,N=oe,H(oe)&&(M=oe),o&&typeof o=="function"&&o({$id:Z,progress:Math.round(ae/k.size*100),sizeUploaded:ae,chunksTotal:S,chunksUploaded:J})),oe});return yield new Promise((V,W)=>{let T=0,re=0,oe=0;const $e=()=>{if(!O){if(oe===R.length){V();return}for(;re<G&&T<R.length;){const me=R[T++];re++,j(me).then(()=>{re--,oe++,$e()}).catch(xe=>{O=!0,W(xe)})}}};$e()}),M??N})}ping(){return st(this,void 0,void 0,function*(){return this.call("GET",new URL(this.config.endpoint+"/ping"),{"X-Appwrite-Project":this.config.project,accept:"application/json"})})}call(e,i){return st(this,arguments,void 0,function*(a,n,r={},s={},o="json"){var h,l,k;const{uri:S,options:U}=this.prepareRequest(a,n,r,s);let C=null;const X=yield fetch(S,U);if(X.type==="opaque")throw new x(`Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`,403,"forbidden","");const te=X.headers.get("x-appwrite-warning");if(te&&te.split(";").forEach(Z=>console.warn("Warning: "+Z)),!((h=X.headers.get("content-type"))===null||h===void 0)&&h.includes("application/json")?C=Ie.parse(yield X.text()):o==="arrayBuffer"?C=yield X.arrayBuffer():C={message:yield X.text()},400<=X.status){let Z;throw!((l=X.headers.get("content-type"))===null||l===void 0)&&l.includes("application/json")||o==="arrayBuffer"?Z=Ie.stringify(C):Z=C?.message,new x((k=C?.message)!==null&&k!==void 0?k:Z,X.status,C?.type,Z)}const K=X.headers.get("X-Fallback-Cookies");return typeof window<"u"&&window.localStorage&&K&&(window.console.warn("Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint."),window.localStorage.setItem("cookieFallback",K)),C&&typeof C=="object"&&Object.defineProperty(C,"toString",{value:()=>Ie.stringify(C),writable:!0,enumerable:!1,configurable:!0}),C})}static flatten(e,i=""){let a={};for(const[n,r]of Object.entries(e)){const s=i?i+"["+n+"]":n;Array.isArray(r)?a=Object.assign(Object.assign({},a),ke.flatten(r,s)):a[s]=r}return a}}ke.CHUNK_SIZE=5242880;class ge{constructor(e){this.client=e}static flatten(e,i=""){let a={};for(const[n,r]of Object.entries(e)){const s=i?i+"["+n+"]":n;Array.isArray(r)?a=Object.assign(Object.assign({},a),ge.flatten(r,s)):a[s]=r}return a}}ge.CHUNK_SIZE=5242880;class $a{constructor(e){this.client=e}get(){const e="/account",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",a,n,i)}create(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,email:i[0],password:i[1],name:i[2]};const n=a.userId,r=a.email,s=a.password,o=a.name;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "email"');if(typeof s>"u")throw new x('Missing required parameter: "password"');const h="/account",l={};typeof n<"u"&&(l.userId=n),typeof r<"u"&&(l.email=r),typeof s<"u"&&(l.password=s),typeof o<"u"&&(l.name=o);const k=new URL(this.client.config.endpoint+h),S={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",k,S,l)}listConsents(e,...i){let a;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={queries:e,total:i[0]};const n=a.queries,r=a.total,s="/account/consents",o={};typeof n<"u"&&(o.queries=n),typeof r<"u"&&(o.total=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",h,l,o)}getConsent(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={consentId:e};const a=i.consentId;if(typeof a>"u")throw new x('Missing required parameter: "consentId"');const n="/account/consents/{consentId}".replace("{consentId}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,o,r)}deleteConsent(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={consentId:e};const a=i.consentId;if(typeof a>"u")throw new x('Missing required parameter: "consentId"');const n="/account/consents/{consentId}".replace("{consentId}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",s,o,r)}listConsentTokens(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={consentId:e,queries:i[0],total:i[1]};const n=a.consentId,r=a.queries,s=a.total;if(typeof n>"u")throw new x('Missing required parameter: "consentId"');const o="/account/consents/{consentId}/tokens".replace("{consentId}",encodeURIComponent(String(n))),h={};typeof r<"u"&&(h.queries=r),typeof s<"u"&&(h.total=s);const l=new URL(this.client.config.endpoint+o),k={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",l,k,h)}getConsentToken(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={consentId:e,tokenId:i[0]};const n=a.consentId,r=a.tokenId;if(typeof n>"u")throw new x('Missing required parameter: "consentId"');if(typeof r>"u")throw new x('Missing required parameter: "tokenId"');const s="/account/consents/{consentId}/tokens/{tokenId}".replace("{consentId}",encodeURIComponent(String(n))).replace("{tokenId}",encodeURIComponent(String(r))),o={},h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",h,l,o)}deleteConsentToken(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={consentId:e,tokenId:i[0]};const n=a.consentId,r=a.tokenId;if(typeof n>"u")throw new x('Missing required parameter: "consentId"');if(typeof r>"u")throw new x('Missing required parameter: "tokenId"');const s="/account/consents/{consentId}/tokens/{tokenId}".replace("{consentId}",encodeURIComponent(String(n))).replace("{tokenId}",encodeURIComponent(String(r))),o={},h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",h,l,o)}updateEmail(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={email:e,password:i[0]};const n=a.email,r=a.password;if(typeof n>"u")throw new x('Missing required parameter: "email"');if(typeof r>"u")throw new x('Missing required parameter: "password"');const s="/account/email",o={};typeof n<"u"&&(o.email=n),typeof r<"u"&&(o.password=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",h,l,o)}listIdentities(e,...i){let a;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={queries:e,total:i[0]};const n=a.queries,r=a.total,s="/account/identities",o={};typeof n<"u"&&(o.queries=n),typeof r<"u"&&(o.total=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",h,l,o)}deleteIdentity(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={identityId:e};const a=i.identityId;if(typeof a>"u")throw new x('Missing required parameter: "identityId"');const n="/account/identities/{identityId}".replace("{identityId}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,o,r)}createJWT(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={duration:e};const a=i.duration,n="/account/jwts",r={};typeof a<"u"&&(r.duration=a);const s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,o,r)}listLogs(e,...i){let a;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={queries:e,total:i[0]};const n=a.queries,r=a.total,s="/account/logs",o={};typeof n<"u"&&(o.queries=n),typeof r<"u"&&(o.total=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",h,l,o)}updateMFA(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={mfa:e};const a=i.mfa;if(typeof a>"u")throw new x('Missing required parameter: "mfa"');const n="/account/mfa",r={};typeof a<"u"&&(r.mfa=a);const s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,o,r)}createMfaAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const a=i.type;if(typeof a>"u")throw new x('Missing required parameter: "type"');const n="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,o,r)}createMFAAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const a=i.type;if(typeof a>"u")throw new x('Missing required parameter: "type"');const n="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,o,r)}updateMfaAuthenticator(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)&&("type"in e||"otp"in e)?a=e||{}:a={type:e,otp:i[0]};const n=a.type,r=a.otp;if(typeof n>"u")throw new x('Missing required parameter: "type"');if(typeof r>"u")throw new x('Missing required parameter: "otp"');const s="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(n))),o={};typeof r<"u"&&(o.otp=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}updateMFAAuthenticator(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)&&("type"in e||"otp"in e)?a=e||{}:a={type:e,otp:i[0]};const n=a.type,r=a.otp;if(typeof n>"u")throw new x('Missing required parameter: "type"');if(typeof r>"u")throw new x('Missing required parameter: "otp"');const s="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(n))),o={};typeof r<"u"&&(o.otp=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}deleteMfaAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const a=i.type;if(typeof a>"u")throw new x('Missing required parameter: "type"');const n="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,o,r)}deleteMFAAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const a=i.type;if(typeof a>"u")throw new x('Missing required parameter: "type"');const n="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,o,r)}createMfaChallenge(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"factor"in e?i=e||{}:i={factor:e};const a=i.factor;if(typeof a>"u")throw new x('Missing required parameter: "factor"');const n="/account/mfa/challenges",r={};typeof a<"u"&&(r.factor=a);const s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,o,r)}createMFAChallenge(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"factor"in e?i=e||{}:i={factor:e};const a=i.factor;if(typeof a>"u")throw new x('Missing required parameter: "factor"');const n="/account/mfa/challenges",r={};typeof a<"u"&&(r.factor=a);const s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,o,r)}updateMfaChallenge(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={challengeId:e,otp:i[0]};const n=a.challengeId,r=a.otp;if(typeof n>"u")throw new x('Missing required parameter: "challengeId"');if(typeof r>"u")throw new x('Missing required parameter: "otp"');const s="/account/mfa/challenges",o={};typeof n<"u"&&(o.challengeId=n),typeof r<"u"&&(o.otp=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}updateMFAChallenge(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={challengeId:e,otp:i[0]};const n=a.challengeId,r=a.otp;if(typeof n>"u")throw new x('Missing required parameter: "challengeId"');if(typeof r>"u")throw new x('Missing required parameter: "otp"');const s="/account/mfa/challenges",o={};typeof n<"u"&&(o.challengeId=n),typeof r<"u"&&(o.otp=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}listMfaFactors(){const e="/account/mfa/factors",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",a,n,i)}listMFAFactors(){const e="/account/mfa/factors",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",a,n,i)}getMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",a,n,i)}getMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",a,n,i)}createMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",a,n,i)}createMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",a,n,i)}updateMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",a,n,i)}updateMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",a,n,i)}updateName(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={name:e};const a=i.name;if(typeof a>"u")throw new x('Missing required parameter: "name"');const n="/account/name",r={};typeof a<"u"&&(r.name=a);const s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,o,r)}updatePassword(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={password:e,oldPassword:i[0]};const n=a.password,r=a.oldPassword;if(typeof n>"u")throw new x('Missing required parameter: "password"');const s="/account/password",o={};typeof n<"u"&&(o.password=n),typeof r<"u"&&(o.oldPassword=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",h,l,o)}updatePhone(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={phone:e,password:i[0]};const n=a.phone,r=a.password;if(typeof n>"u")throw new x('Missing required parameter: "phone"');if(typeof r>"u")throw new x('Missing required parameter: "password"');const s="/account/phone",o={};typeof n<"u"&&(o.phone=n),typeof r<"u"&&(o.password=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",h,l,o)}getPrefs(){const e="/account/prefs",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",a,n,i)}updatePrefs(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"prefs"in e?i=e||{}:i={prefs:e};const a=i.prefs;if(typeof a>"u")throw new x('Missing required parameter: "prefs"');const n="/account/prefs",r={};typeof a<"u"&&(r.prefs=a);const s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,o,r)}createRecovery(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={email:e,url:i[0]};const n=a.email,r=a.url;if(typeof n>"u")throw new x('Missing required parameter: "email"');if(typeof r>"u")throw new x('Missing required parameter: "url"');const s="/account/recovery",o={};typeof n<"u"&&(o.email=n),typeof r<"u"&&(o.url=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,l,o)}updateRecovery(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,secret:i[0],password:i[1]};const n=a.userId,r=a.secret,s=a.password;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "secret"');if(typeof s>"u")throw new x('Missing required parameter: "password"');const o="/account/recovery",h={};typeof n<"u"&&(h.userId=n),typeof r<"u"&&(h.secret=r),typeof s<"u"&&(h.password=s);const l=new URL(this.client.config.endpoint+o),k={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",l,k,h)}listSessions(){const e="/account/sessions",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",a,n,i)}deleteSessions(){const e="/account/sessions",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",a,n,i)}createAnonymousSession(){const e="/account/sessions/anonymous",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",a,n,i)}createEmailPasswordSession(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={email:e,password:i[0]};const n=a.email,r=a.password;if(typeof n>"u")throw new x('Missing required parameter: "email"');if(typeof r>"u")throw new x('Missing required parameter: "password"');const s="/account/sessions/email",o={};typeof n<"u"&&(o.email=n),typeof r<"u"&&(o.password=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,l,o)}updateMagicURLSession(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,secret:i[0]};const n=a.userId,r=a.secret;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "secret"');const s="/account/sessions/magic-url",o={};typeof n<"u"&&(o.userId=n),typeof r<"u"&&(o.secret=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}createOAuth2Session(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)&&("provider"in e||"success"in e||"failure"in e||"scopes"in e)?a=e||{}:a={provider:e,success:i[0],failure:i[1],scopes:i[2]};const n=a.provider,r=a.success,s=a.failure,o=a.scopes;if(typeof n>"u")throw new x('Missing required parameter: "provider"');const h="/account/sessions/oauth2/{provider}".replace("{provider}",encodeURIComponent(String(n))),l={};typeof r<"u"&&(l.success=r),typeof s<"u"&&(l.failure=s),typeof o<"u"&&(l.scopes=o);const k=new URL(this.client.config.endpoint+h);l.project=this.client.config.project;for(const[S,U]of Object.entries(ge.flatten(l)))k.searchParams.append(S,U);if(typeof window<"u"&&window?.location){window.location.href=k.toString();return}else return k.toString()}updatePhoneSession(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,secret:i[0]};const n=a.userId,r=a.secret;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "secret"');const s="/account/sessions/phone",o={};typeof n<"u"&&(o.userId=n),typeof r<"u"&&(o.secret=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}createSession(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,secret:i[0]};const n=a.userId,r=a.secret;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "secret"');const s="/account/sessions/token",o={};typeof n<"u"&&(o.userId=n),typeof r<"u"&&(o.secret=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,l,o)}getSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const a=i.sessionId;if(typeof a>"u")throw new x('Missing required parameter: "sessionId"');const n="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,o,r)}updateSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const a=i.sessionId;if(typeof a>"u")throw new x('Missing required parameter: "sessionId"');const n="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,o,r)}deleteSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const a=i.sessionId;if(typeof a>"u")throw new x('Missing required parameter: "sessionId"');const n="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,o,r)}updateStatus(){const e="/account/status",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",a,n,i)}createPushTarget(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={targetId:e,identifier:i[0],providerId:i[1]};const n=a.targetId,r=a.identifier,s=a.providerId;if(typeof n>"u")throw new x('Missing required parameter: "targetId"');if(typeof r>"u")throw new x('Missing required parameter: "identifier"');const o="/account/targets/push",h={};typeof n<"u"&&(h.targetId=n),typeof r<"u"&&(h.identifier=r),typeof s<"u"&&(h.providerId=s);const l=new URL(this.client.config.endpoint+o),k={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",l,k,h)}updatePushTarget(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={targetId:e,identifier:i[0]};const n=a.targetId,r=a.identifier;if(typeof n>"u")throw new x('Missing required parameter: "targetId"');if(typeof r>"u")throw new x('Missing required parameter: "identifier"');const s="/account/targets/{targetId}/push".replace("{targetId}",encodeURIComponent(String(n))),o={};typeof r<"u"&&(o.identifier=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}deletePushTarget(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={targetId:e};const a=i.targetId;if(typeof a>"u")throw new x('Missing required parameter: "targetId"');const n="/account/targets/{targetId}/push".replace("{targetId}",encodeURIComponent(String(a))),r={},s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,o,r)}createEmailToken(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,email:i[0],phrase:i[1]};const n=a.userId,r=a.email,s=a.phrase;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "email"');const o="/account/tokens/email",h={};typeof n<"u"&&(h.userId=n),typeof r<"u"&&(h.email=r),typeof s<"u"&&(h.phrase=s);const l=new URL(this.client.config.endpoint+o),k={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",l,k,h)}createMagicURLToken(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,email:i[0],url:i[1],phrase:i[2]};const n=a.userId,r=a.email,s=a.url,o=a.phrase;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "email"');const h="/account/tokens/magic-url",l={};typeof n<"u"&&(l.userId=n),typeof r<"u"&&(l.email=r),typeof s<"u"&&(l.url=s),typeof o<"u"&&(l.phrase=o);const k=new URL(this.client.config.endpoint+h),S={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",k,S,l)}createOAuth2Token(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)&&("provider"in e||"success"in e||"failure"in e||"scopes"in e)?a=e||{}:a={provider:e,success:i[0],failure:i[1],scopes:i[2]};const n=a.provider,r=a.success,s=a.failure,o=a.scopes;if(typeof n>"u")throw new x('Missing required parameter: "provider"');const h="/account/tokens/oauth2/{provider}".replace("{provider}",encodeURIComponent(String(n))),l={};typeof r<"u"&&(l.success=r),typeof s<"u"&&(l.failure=s),typeof o<"u"&&(l.scopes=o);const k=new URL(this.client.config.endpoint+h);l.project=this.client.config.project;for(const[S,U]of Object.entries(ge.flatten(l)))k.searchParams.append(S,U);if(typeof window<"u"&&window?.location){window.location.href=k.toString();return}else return k.toString()}createPhoneToken(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,phone:i[0]};const n=a.userId,r=a.phone;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "phone"');const s="/account/tokens/phone",o={};typeof n<"u"&&(o.userId=n),typeof r<"u"&&(o.phone=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,l,o)}createEmailVerification(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const a=i.url;if(typeof a>"u")throw new x('Missing required parameter: "url"');const n="/account/verifications/email",r={};typeof a<"u"&&(r.url=a);const s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,o,r)}createVerification(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const a=i.url;if(typeof a>"u")throw new x('Missing required parameter: "url"');const n="/account/verifications/email",r={};typeof a<"u"&&(r.url=a);const s=new URL(this.client.config.endpoint+n),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,o,r)}updateEmailVerification(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,secret:i[0]};const n=a.userId,r=a.secret;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "secret"');const s="/account/verifications/email",o={};typeof n<"u"&&(o.userId=n),typeof r<"u"&&(o.secret=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}updateVerification(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,secret:i[0]};const n=a.userId,r=a.secret;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "secret"');const s="/account/verifications/email",o={};typeof n<"u"&&(o.userId=n),typeof r<"u"&&(o.secret=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}createPhoneVerification(){const e="/account/verifications/phone",i={},a=new URL(this.client.config.endpoint+e),n={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",a,n,i)}updatePhoneVerification(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={userId:e,secret:i[0]};const n=a.userId,r=a.secret;if(typeof n>"u")throw new x('Missing required parameter: "userId"');if(typeof r>"u")throw new x('Missing required parameter: "secret"');const s="/account/verifications/phone",o={};typeof n<"u"&&(o.userId=n),typeof r<"u"&&(o.secret=r);const h=new URL(this.client.config.endpoint+s),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,l,o)}}class Sa{constructor(e){this.client=e}getBrowser(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?a=e||{}:a={code:e,width:i[0],height:i[1],quality:i[2]};const n=a.code,r=a.width,s=a.height,o=a.quality;if(typeof n>"u")throw new x('Missing required parameter: "code"');const h="/avatars/browsers/{code}".replace("{code}",encodeURIComponent(String(n))),l={};typeof r<"u"&&(l.width=r),typeof s<"u"&&(l.height=s),typeof o<"u"&&(l.quality=o);const k=new URL(this.client.config.endpoint+h);l.project=this.client.config.project,l.impersonateuserid=this.client.config.impersonateuserid;for(const[S,U]of Object.entries(ge.flatten(l)))k.searchParams.append(S,U);return k.toString()}getCreditCard(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?a=e||{}:a={code:e,width:i[0],height:i[1],quality:i[2]};const n=a.code,r=a.width,s=a.height,o=a.quality;if(typeof n>"u")throw new x('Missing required parameter: "code"');const h="/avatars/credit-cards/{code}".replace("{code}",encodeURIComponent(String(n))),l={};typeof r<"u"&&(l.width=r),typeof s<"u"&&(l.height=s),typeof o<"u"&&(l.quality=o);const k=new URL(this.client.config.endpoint+h);l.project=this.client.config.project,l.impersonateuserid=this.client.config.impersonateuserid;for(const[S,U]of Object.entries(ge.flatten(l)))k.searchParams.append(S,U);return k.toString()}getFavicon(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const a=i.url;if(typeof a>"u")throw new x('Missing required parameter: "url"');const n="/avatars/favicon",r={};typeof a<"u"&&(r.url=a);const s=new URL(this.client.config.endpoint+n);r.project=this.client.config.project,r.impersonateuserid=this.client.config.impersonateuserid;for(const[o,h]of Object.entries(ge.flatten(r)))s.searchParams.append(o,h);return s.toString()}getFlag(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?a=e||{}:a={code:e,width:i[0],height:i[1],quality:i[2]};const n=a.code,r=a.width,s=a.height,o=a.quality;if(typeof n>"u")throw new x('Missing required parameter: "code"');const h="/avatars/flags/{code}".replace("{code}",encodeURIComponent(String(n))),l={};typeof r<"u"&&(l.width=r),typeof s<"u"&&(l.height=s),typeof o<"u"&&(l.quality=o);const k=new URL(this.client.config.endpoint+h);l.project=this.client.config.project,l.impersonateuserid=this.client.config.impersonateuserid;for(const[S,U]of Object.entries(ge.flatten(l)))k.searchParams.append(S,U);return k.toString()}getImage(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={url:e,width:i[0],height:i[1]};const n=a.url,r=a.width,s=a.height;if(typeof n>"u")throw new x('Missing required parameter: "url"');const o="/avatars/image",h={};typeof n<"u"&&(h.url=n),typeof r<"u"&&(h.width=r),typeof s<"u"&&(h.height=s);const l=new URL(this.client.config.endpoint+o);h.project=this.client.config.project,h.impersonateuserid=this.client.config.impersonateuserid;for(const[k,S]of Object.entries(ge.flatten(h)))l.searchParams.append(k,S);return l.toString()}getInitials(e,...i){let a;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={name:e,width:i[0],height:i[1],background:i[2]};const n=a.name,r=a.width,s=a.height,o=a.background,h="/avatars/initials",l={};typeof n<"u"&&(l.name=n),typeof r<"u"&&(l.width=r),typeof s<"u"&&(l.height=s),typeof o<"u"&&(l.background=o);const k=new URL(this.client.config.endpoint+h);l.project=this.client.config.project,l.impersonateuserid=this.client.config.impersonateuserid;for(const[S,U]of Object.entries(ge.flatten(l)))k.searchParams.append(S,U);return k.toString()}getPhoto(e,...i){let a;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={width:e,height:i[0],quality:i[1],output:i[2],rating:i[3],userId:i[4],emailHash:i[5],name:i[6]};const n=a.width,r=a.height,s=a.quality,o=a.output,h=a.rating,l=a.userId,k=a.emailHash,S=a.name,U="/avatars/photo",C={};typeof n<"u"&&(C.width=n),typeof r<"u"&&(C.height=r),typeof s<"u"&&(C.quality=s),typeof o<"u"&&(C.output=o),typeof h<"u"&&(C.rating=h),typeof l<"u"&&(C.userId=l),typeof k<"u"&&(C.emailHash=k),typeof S<"u"&&(C.name=S);const X=new URL(this.client.config.endpoint+U);C.project=this.client.config.project,C.impersonateuserid=this.client.config.impersonateuserid;for(const[te,K]of Object.entries(ge.flatten(C)))X.searchParams.append(te,K);return X.toString()}getQR(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={text:e,size:i[0],margin:i[1],download:i[2]};const n=a.text,r=a.size,s=a.margin,o=a.download;if(typeof n>"u")throw new x('Missing required parameter: "text"');const h="/avatars/qr",l={};typeof n<"u"&&(l.text=n),typeof r<"u"&&(l.size=r),typeof s<"u"&&(l.margin=s),typeof o<"u"&&(l.download=o);const k=new URL(this.client.config.endpoint+h);l.project=this.client.config.project,l.impersonateuserid=this.client.config.impersonateuserid;for(const[S,U]of Object.entries(ge.flatten(l)))k.searchParams.append(S,U);return k.toString()}getScreenshot(e,...i){let a;e&&typeof e=="object"&&!Array.isArray(e)?a=e||{}:a={url:e,headers:i[0],viewportWidth:i[1],viewportHeight:i[2],scale:i[3],theme:i[4],userAgent:i[5],fullpage:i[6],locale:i[7],timezone:i[8],latitude:i[9],longitude:i[10],accuracy:i[11],touch:i[12],permissions:i[13],sleep:i[14],width:i[15],height:i[16],quality:i[17],output:i[18]};const n=a.url,r=a.headers,s=a.viewportWidth,o=a.viewportHeight,h=a.scale,l=a.theme,k=a.userAgent,S=a.fullpage,U=a.locale,C=a.timezone,X=a.latitude,te=a.longitude,K=a.accuracy,Z=a.touch,R=a.permissions,G=a.sleep,J=a.width,ae=a.height,N=a.quality,M=a.output;if(typeof n>"u")throw new x('Missing required parameter: "url"');const O="/avatars/screenshots",H={};typeof n<"u"&&(H.url=n),typeof r<"u"&&(H.headers=r),typeof s<"u"&&(H.viewportWidth=s),typeof o<"u"&&(H.viewportHeight=o),typeof h<"u"&&(H.scale=h),typeof l<"u"&&(H.theme=l),typeof k<"u"&&(H.userAgent=k),typeof S<"u"&&(H.fullpage=S),typeof U<"u"&&(H.locale=U),typeof C<"u"&&(H.timezone=C),typeof X<"u"&&(H.latitude=X),typeof te<"u"&&(H.longitude=te),typeof K<"u"&&(H.accuracy=K),typeof Z<"u"&&(H.touch=Z),typeof R<"u"&&(H.permissions=R),typeof G<"u"&&(H.sleep=G),typeof J<"u"&&(H.width=J),typeof ae<"u"&&(H.height=ae),typeof N<"u"&&(H.quality=N),typeof M<"u"&&(H.output=M);const j=new URL(this.client.config.endpoint+O);H.project=this.client.config.project,H.impersonateuserid=this.client.config.impersonateuserid;for(const[V,W]of Object.entries(ge.flatten(H)))j.searchParams.append(V,W);return j.toString()}}var ni;(function(t){t[t.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",t[t.POLICY_VIOLATION=1008]="POLICY_VIOLATION",t[t.UNKNOWN_ERROR=-1]="UNKNOWN_ERROR"})(ni||(ni={}));var ri;(function(t){t.Equal="equal",t.NotEqual="notEqual",t.GreaterThan="greaterThan",t.GreaterThanEqual="greaterThanEqual",t.LessThan="lessThan",t.LessThanEqual="lessThanEqual",t.Contains="contains",t.IsNull="isNull",t.IsNotNull="isNotNull"})(ri||(ri={}));var si;(function(t){t.Totp="totp"})(si||(si={}));var oi;(function(t){t.Email="email",t.Phone="phone",t.Totp="totp",t.Recoverycode="recoverycode",t.Custom="custom"})(oi||(oi={}));var ci;(function(t){t.Amazon="amazon",t.Apple="apple",t.Appwrite="appwrite",t.Auth0="auth0",t.Authentik="authentik",t.Autodesk="autodesk",t.Bitbucket="bitbucket",t.Bitly="bitly",t.Box="box",t.Cloudflare="cloudflare",t.Dailymotion="dailymotion",t.Discord="discord",t.Disqus="disqus",t.Dropbox="dropbox",t.Etsy="etsy",t.Facebook="facebook",t.Figma="figma",t.Fusionauth="fusionauth",t.Github="github",t.Gitlab="gitlab",t.Google="google",t.Huggingface="huggingface",t.Keycloak="keycloak",t.Kick="kick",t.Linkedin="linkedin",t.Microsoft="microsoft",t.Notion="notion",t.Oidc="oidc",t.Okta="okta",t.Paypal="paypal",t.PaypalSandbox="paypalSandbox",t.Podio="podio",t.Resend="resend",t.Salesforce="salesforce",t.Slack="slack",t.Spotify="spotify",t.Stripe="stripe",t.Tradeshift="tradeshift",t.TradeshiftBox="tradeshiftBox",t.Twitch="twitch",t.Wordpress="wordpress",t.X="x",t.Yahoo="yahoo",t.Yammer="yammer",t.Yandex="yandex",t.Zoho="zoho",t.Zoom="zoom"})(ci||(ci={}));var ui;(function(t){t.AvantBrowser="aa",t.AndroidWebViewBeta="an",t.GoogleChrome="ch",t.GoogleChromeIOS="ci",t.GoogleChromeMobile="cm",t.Chromium="cr",t.MozillaFirefox="ff",t.Safari="sf",t.MobileSafari="mf",t.MicrosoftEdge="ps",t.MicrosoftEdgeIOS="oi",t.OperaMini="om",t.Opera="op",t.OperaNext="on"})(ui||(ui={}));var li;(function(t){t.AmericanExpress="amex",t.Argencard="argencard",t.Cabal="cabal",t.Cencosud="cencosud",t.DinersClub="diners",t.Discover="discover",t.Elo="elo",t.Hipercard="hipercard",t.JCB="jcb",t.Mastercard="mastercard",t.Naranja="naranja",t.TarjetaShopping="targeta-shopping",t.UnionPay="unionpay",t.Visa="visa",t.MIR="mir",t.Maestro="maestro",t.Rupay="rupay"})(li||(li={}));var di;(function(t){t.Afghanistan="af",t.Angola="ao",t.Albania="al",t.Andorra="ad",t.UnitedArabEmirates="ae",t.Argentina="ar",t.Armenia="am",t.AntiguaAndBarbuda="ag",t.Australia="au",t.Austria="at",t.Azerbaijan="az",t.Burundi="bi",t.Belgium="be",t.Benin="bj",t.BurkinaFaso="bf",t.Bangladesh="bd",t.Bulgaria="bg",t.Bahrain="bh",t.Bahamas="bs",t.BosniaAndHerzegovina="ba",t.Belarus="by",t.Belize="bz",t.Bolivia="bo",t.Brazil="br",t.Barbados="bb",t.BruneiDarussalam="bn",t.Bhutan="bt",t.Botswana="bw",t.CentralAfricanRepublic="cf",t.Canada="ca",t.Switzerland="ch",t.Chile="cl",t.China="cn",t.CoteDIvoire="ci",t.Cameroon="cm",t.DemocraticRepublicOfTheCongo="cd",t.RepublicOfTheCongo="cg",t.Colombia="co",t.Comoros="km",t.CapeVerde="cv",t.CostaRica="cr",t.Cuba="cu",t.Cyprus="cy",t.CzechRepublic="cz",t.Germany="de",t.Djibouti="dj",t.Dominica="dm",t.Denmark="dk",t.DominicanRepublic="do",t.Algeria="dz",t.Ecuador="ec",t.Egypt="eg",t.Eritrea="er",t.Spain="es",t.Estonia="ee",t.Ethiopia="et",t.Finland="fi",t.Fiji="fj",t.France="fr",t.MicronesiaFederatedStatesOf="fm",t.Gabon="ga",t.UnitedKingdom="gb",t.Georgia="ge",t.Ghana="gh",t.Guinea="gn",t.Gambia="gm",t.GuineaBissau="gw",t.EquatorialGuinea="gq",t.Greece="gr",t.Grenada="gd",t.Guatemala="gt",t.Guyana="gy",t.Honduras="hn",t.Croatia="hr",t.Haiti="ht",t.Hungary="hu",t.Indonesia="id",t.India="in",t.Ireland="ie",t.IranIslamicRepublicOf="ir",t.Iraq="iq",t.Iceland="is",t.Israel="il",t.Italy="it",t.Jamaica="jm",t.Jordan="jo",t.Japan="jp",t.Kazakhstan="kz",t.Kenya="ke",t.Kyrgyzstan="kg",t.Cambodia="kh",t.Kiribati="ki",t.SaintKittsAndNevis="kn",t.SouthKorea="kr",t.Kuwait="kw",t.LaoPeopleSDemocraticRepublic="la",t.Lebanon="lb",t.Liberia="lr",t.Libya="ly",t.SaintLucia="lc",t.Liechtenstein="li",t.SriLanka="lk",t.Lesotho="ls",t.Lithuania="lt",t.Luxembourg="lu",t.Latvia="lv",t.Morocco="ma",t.Monaco="mc",t.Moldova="md",t.Madagascar="mg",t.Maldives="mv",t.Mexico="mx",t.MarshallIslands="mh",t.NorthMacedonia="mk",t.Mali="ml",t.Malta="mt",t.Myanmar="mm",t.Montenegro="me",t.Mongolia="mn",t.Mozambique="mz",t.Mauritania="mr",t.Mauritius="mu",t.Malawi="mw",t.Malaysia="my",t.Namibia="na",t.Niger="ne",t.Nigeria="ng",t.Nicaragua="ni",t.Netherlands="nl",t.Norway="no",t.Nepal="np",t.Nauru="nr",t.NewZealand="nz",t.Oman="om",t.Pakistan="pk",t.Panama="pa",t.Peru="pe",t.Philippines="ph",t.Palau="pw",t.PapuaNewGuinea="pg",t.Poland="pl",t.FrenchPolynesia="pf",t.NorthKorea="kp",t.Portugal="pt",t.Paraguay="py",t.Qatar="qa",t.Romania="ro",t.Russia="ru",t.Rwanda="rw",t.SaudiArabia="sa",t.Sudan="sd",t.Senegal="sn",t.Singapore="sg",t.SolomonIslands="sb",t.SierraLeone="sl",t.ElSalvador="sv",t.SanMarino="sm",t.Somalia="so",t.Serbia="rs",t.SouthSudan="ss",t.SaoTomeAndPrincipe="st",t.Suriname="sr",t.Slovakia="sk",t.Slovenia="si",t.Sweden="se",t.Eswatini="sz",t.Seychelles="sc",t.Syria="sy",t.Chad="td",t.Togo="tg",t.Thailand="th",t.Tajikistan="tj",t.Turkmenistan="tm",t.TimorLeste="tl",t.Tonga="to",t.TrinidadAndTobago="tt",t.Tunisia="tn",t.Turkey="tr",t.Tuvalu="tv",t.Tanzania="tz",t.Uganda="ug",t.Ukraine="ua",t.Uruguay="uy",t.UnitedStates="us",t.Uzbekistan="uz",t.VaticanCity="va",t.SaintVincentAndTheGrenadines="vc",t.Venezuela="ve",t.Vietnam="vn",t.Vanuatu="vu",t.Samoa="ws",t.Yemen="ye",t.SouthAfrica="za",t.Zambia="zm",t.Zimbabwe="zw"})(di||(di={}));var hi;(function(t){t.Light="light",t.Dark="dark"})(hi||(hi={}));var pi;(function(t){t.AfricaAbidjan="africa/abidjan",t.AfricaAccra="africa/accra",t.AfricaAddisAbaba="africa/addis_ababa",t.AfricaAlgiers="africa/algiers",t.AfricaAsmara="africa/asmara",t.AfricaBamako="africa/bamako",t.AfricaBangui="africa/bangui",t.AfricaBanjul="africa/banjul",t.AfricaBissau="africa/bissau",t.AfricaBlantyre="africa/blantyre",t.AfricaBrazzaville="africa/brazzaville",t.AfricaBujumbura="africa/bujumbura",t.AfricaCairo="africa/cairo",t.AfricaCasablanca="africa/casablanca",t.AfricaCeuta="africa/ceuta",t.AfricaConakry="africa/conakry",t.AfricaDakar="africa/dakar",t.AfricaDarEsSalaam="africa/dar_es_salaam",t.AfricaDjibouti="africa/djibouti",t.AfricaDouala="africa/douala",t.AfricaElAaiun="africa/el_aaiun",t.AfricaFreetown="africa/freetown",t.AfricaGaborone="africa/gaborone",t.AfricaHarare="africa/harare",t.AfricaJohannesburg="africa/johannesburg",t.AfricaJuba="africa/juba",t.AfricaKampala="africa/kampala",t.AfricaKhartoum="africa/khartoum",t.AfricaKigali="africa/kigali",t.AfricaKinshasa="africa/kinshasa",t.AfricaLagos="africa/lagos",t.AfricaLibreville="africa/libreville",t.AfricaLome="africa/lome",t.AfricaLuanda="africa/luanda",t.AfricaLubumbashi="africa/lubumbashi",t.AfricaLusaka="africa/lusaka",t.AfricaMalabo="africa/malabo",t.AfricaMaputo="africa/maputo",t.AfricaMaseru="africa/maseru",t.AfricaMbabane="africa/mbabane",t.AfricaMogadishu="africa/mogadishu",t.AfricaMonrovia="africa/monrovia",t.AfricaNairobi="africa/nairobi",t.AfricaNdjamena="africa/ndjamena",t.AfricaNiamey="africa/niamey",t.AfricaNouakchott="africa/nouakchott",t.AfricaOuagadougou="africa/ouagadougou",t.AfricaPortonovo="africa/porto-novo",t.AfricaSaoTome="africa/sao_tome",t.AfricaTripoli="africa/tripoli",t.AfricaTunis="africa/tunis",t.AfricaWindhoek="africa/windhoek",t.AmericaAdak="america/adak",t.AmericaAnchorage="america/anchorage",t.AmericaAnguilla="america/anguilla",t.AmericaAntigua="america/antigua",t.AmericaAraguaina="america/araguaina",t.AmericaArgentinaBuenosAires="america/argentina/buenos_aires",t.AmericaArgentinaCatamarca="america/argentina/catamarca",t.AmericaArgentinaCordoba="america/argentina/cordoba",t.AmericaArgentinaJujuy="america/argentina/jujuy",t.AmericaArgentinaLaRioja="america/argentina/la_rioja",t.AmericaArgentinaMendoza="america/argentina/mendoza",t.AmericaArgentinaRioGallegos="america/argentina/rio_gallegos",t.AmericaArgentinaSalta="america/argentina/salta",t.AmericaArgentinaSanJuan="america/argentina/san_juan",t.AmericaArgentinaSanLuis="america/argentina/san_luis",t.AmericaArgentinaTucuman="america/argentina/tucuman",t.AmericaArgentinaUshuaia="america/argentina/ushuaia",t.AmericaAruba="america/aruba",t.AmericaAsuncion="america/asuncion",t.AmericaAtikokan="america/atikokan",t.AmericaBahia="america/bahia",t.AmericaBahiaBanderas="america/bahia_banderas",t.AmericaBarbados="america/barbados",t.AmericaBelem="america/belem",t.AmericaBelize="america/belize",t.AmericaBlancsablon="america/blanc-sablon",t.AmericaBoaVista="america/boa_vista",t.AmericaBogota="america/bogota",t.AmericaBoise="america/boise",t.AmericaCambridgeBay="america/cambridge_bay",t.AmericaCampoGrande="america/campo_grande",t.AmericaCancun="america/cancun",t.AmericaCaracas="america/caracas",t.AmericaCayenne="america/cayenne",t.AmericaCayman="america/cayman",t.AmericaChicago="america/chicago",t.AmericaChihuahua="america/chihuahua",t.AmericaCiudadJuarez="america/ciudad_juarez",t.AmericaCostaRica="america/costa_rica",t.AmericaCoyhaique="america/coyhaique",t.AmericaCreston="america/creston",t.AmericaCuiaba="america/cuiaba",t.AmericaCuracao="america/curacao",t.AmericaDanmarkshavn="america/danmarkshavn",t.AmericaDawson="america/dawson",t.AmericaDawsonCreek="america/dawson_creek",t.AmericaDenver="america/denver",t.AmericaDetroit="america/detroit",t.AmericaDominica="america/dominica",t.AmericaEdmonton="america/edmonton",t.AmericaEirunepe="america/eirunepe",t.AmericaElSalvador="america/el_salvador",t.AmericaFortNelson="america/fort_nelson",t.AmericaFortaleza="america/fortaleza",t.AmericaGlaceBay="america/glace_bay",t.AmericaGooseBay="america/goose_bay",t.AmericaGrandTurk="america/grand_turk",t.AmericaGrenada="america/grenada",t.AmericaGuadeloupe="america/guadeloupe",t.AmericaGuatemala="america/guatemala",t.AmericaGuayaquil="america/guayaquil",t.AmericaGuyana="america/guyana",t.AmericaHalifax="america/halifax",t.AmericaHavana="america/havana",t.AmericaHermosillo="america/hermosillo",t.AmericaIndianaIndianapolis="america/indiana/indianapolis",t.AmericaIndianaKnox="america/indiana/knox",t.AmericaIndianaMarengo="america/indiana/marengo",t.AmericaIndianaPetersburg="america/indiana/petersburg",t.AmericaIndianaTellCity="america/indiana/tell_city",t.AmericaIndianaVevay="america/indiana/vevay",t.AmericaIndianaVincennes="america/indiana/vincennes",t.AmericaIndianaWinamac="america/indiana/winamac",t.AmericaInuvik="america/inuvik",t.AmericaIqaluit="america/iqaluit",t.AmericaJamaica="america/jamaica",t.AmericaJuneau="america/juneau",t.AmericaKentuckyLouisville="america/kentucky/louisville",t.AmericaKentuckyMonticello="america/kentucky/monticello",t.AmericaKralendijk="america/kralendijk",t.AmericaLaPaz="america/la_paz",t.AmericaLima="america/lima",t.AmericaLosAngeles="america/los_angeles",t.AmericaLowerPrinces="america/lower_princes",t.AmericaMaceio="america/maceio",t.AmericaManagua="america/managua",t.AmericaManaus="america/manaus",t.AmericaMarigot="america/marigot",t.AmericaMartinique="america/martinique",t.AmericaMatamoros="america/matamoros",t.AmericaMazatlan="america/mazatlan",t.AmericaMenominee="america/menominee",t.AmericaMerida="america/merida",t.AmericaMetlakatla="america/metlakatla",t.AmericaMexicoCity="america/mexico_city",t.AmericaMiquelon="america/miquelon",t.AmericaMoncton="america/moncton",t.AmericaMonterrey="america/monterrey",t.AmericaMontevideo="america/montevideo",t.AmericaMontserrat="america/montserrat",t.AmericaNassau="america/nassau",t.AmericaNewYork="america/new_york",t.AmericaNome="america/nome",t.AmericaNoronha="america/noronha",t.AmericaNorthDakotaBeulah="america/north_dakota/beulah",t.AmericaNorthDakotaCenter="america/north_dakota/center",t.AmericaNorthDakotaNewSalem="america/north_dakota/new_salem",t.AmericaNuuk="america/nuuk",t.AmericaOjinaga="america/ojinaga",t.AmericaPanama="america/panama",t.AmericaParamaribo="america/paramaribo",t.AmericaPhoenix="america/phoenix",t.AmericaPortauprince="america/port-au-prince",t.AmericaPortOfSpain="america/port_of_spain",t.AmericaPortoVelho="america/porto_velho",t.AmericaPuertoRico="america/puerto_rico",t.AmericaPuntaArenas="america/punta_arenas",t.AmericaRankinInlet="america/rankin_inlet",t.AmericaRecife="america/recife",t.AmericaRegina="america/regina",t.AmericaResolute="america/resolute",t.AmericaRioBranco="america/rio_branco",t.AmericaSantarem="america/santarem",t.AmericaSantiago="america/santiago",t.AmericaSantoDomingo="america/santo_domingo",t.AmericaSaoPaulo="america/sao_paulo",t.AmericaScoresbysund="america/scoresbysund",t.AmericaSitka="america/sitka",t.AmericaStBarthelemy="america/st_barthelemy",t.AmericaStJohns="america/st_johns",t.AmericaStKitts="america/st_kitts",t.AmericaStLucia="america/st_lucia",t.AmericaStThomas="america/st_thomas",t.AmericaStVincent="america/st_vincent",t.AmericaSwiftCurrent="america/swift_current",t.AmericaTegucigalpa="america/tegucigalpa",t.AmericaThule="america/thule",t.AmericaTijuana="america/tijuana",t.AmericaToronto="america/toronto",t.AmericaTortola="america/tortola",t.AmericaVancouver="america/vancouver",t.AmericaWhitehorse="america/whitehorse",t.AmericaWinnipeg="america/winnipeg",t.AmericaYakutat="america/yakutat",t.AntarcticaCasey="antarctica/casey",t.AntarcticaDavis="antarctica/davis",t.AntarcticaDumontdurville="antarctica/dumontdurville",t.AntarcticaMacquarie="antarctica/macquarie",t.AntarcticaMawson="antarctica/mawson",t.AntarcticaMcmurdo="antarctica/mcmurdo",t.AntarcticaPalmer="antarctica/palmer",t.AntarcticaRothera="antarctica/rothera",t.AntarcticaSyowa="antarctica/syowa",t.AntarcticaTroll="antarctica/troll",t.AntarcticaVostok="antarctica/vostok",t.ArcticLongyearbyen="arctic/longyearbyen",t.AsiaAden="asia/aden",t.AsiaAlmaty="asia/almaty",t.AsiaAmman="asia/amman",t.AsiaAnadyr="asia/anadyr",t.AsiaAqtau="asia/aqtau",t.AsiaAqtobe="asia/aqtobe",t.AsiaAshgabat="asia/ashgabat",t.AsiaAtyrau="asia/atyrau",t.AsiaBaghdad="asia/baghdad",t.AsiaBahrain="asia/bahrain",t.AsiaBaku="asia/baku",t.AsiaBangkok="asia/bangkok",t.AsiaBarnaul="asia/barnaul",t.AsiaBeirut="asia/beirut",t.AsiaBishkek="asia/bishkek",t.AsiaBrunei="asia/brunei",t.AsiaChita="asia/chita",t.AsiaColombo="asia/colombo",t.AsiaDamascus="asia/damascus",t.AsiaDhaka="asia/dhaka",t.AsiaDili="asia/dili",t.AsiaDubai="asia/dubai",t.AsiaDushanbe="asia/dushanbe",t.AsiaFamagusta="asia/famagusta",t.AsiaGaza="asia/gaza",t.AsiaHebron="asia/hebron",t.AsiaHoChiMinh="asia/ho_chi_minh",t.AsiaHongKong="asia/hong_kong",t.AsiaHovd="asia/hovd",t.AsiaIrkutsk="asia/irkutsk",t.AsiaJakarta="asia/jakarta",t.AsiaJayapura="asia/jayapura",t.AsiaJerusalem="asia/jerusalem",t.AsiaKabul="asia/kabul",t.AsiaKamchatka="asia/kamchatka",t.AsiaKarachi="asia/karachi",t.AsiaKathmandu="asia/kathmandu",t.AsiaKhandyga="asia/khandyga",t.AsiaKolkata="asia/kolkata",t.AsiaKrasnoyarsk="asia/krasnoyarsk",t.AsiaKualaLumpur="asia/kuala_lumpur",t.AsiaKuching="asia/kuching",t.AsiaKuwait="asia/kuwait",t.AsiaMacau="asia/macau",t.AsiaMagadan="asia/magadan",t.AsiaMakassar="asia/makassar",t.AsiaManila="asia/manila",t.AsiaMuscat="asia/muscat",t.AsiaNicosia="asia/nicosia",t.AsiaNovokuznetsk="asia/novokuznetsk",t.AsiaNovosibirsk="asia/novosibirsk",t.AsiaOmsk="asia/omsk",t.AsiaOral="asia/oral",t.AsiaPhnomPenh="asia/phnom_penh",t.AsiaPontianak="asia/pontianak",t.AsiaPyongyang="asia/pyongyang",t.AsiaQatar="asia/qatar",t.AsiaQostanay="asia/qostanay",t.AsiaQyzylorda="asia/qyzylorda",t.AsiaRiyadh="asia/riyadh",t.AsiaSakhalin="asia/sakhalin",t.AsiaSamarkand="asia/samarkand",t.AsiaSeoul="asia/seoul",t.AsiaShanghai="asia/shanghai",t.AsiaSingapore="asia/singapore",t.AsiaSrednekolymsk="asia/srednekolymsk",t.AsiaTaipei="asia/taipei",t.AsiaTashkent="asia/tashkent",t.AsiaTbilisi="asia/tbilisi",t.AsiaTehran="asia/tehran",t.AsiaThimphu="asia/thimphu",t.AsiaTokyo="asia/tokyo",t.AsiaTomsk="asia/tomsk",t.AsiaUlaanbaatar="asia/ulaanbaatar",t.AsiaUrumqi="asia/urumqi",t.AsiaUstnera="asia/ust-nera",t.AsiaVientiane="asia/vientiane",t.AsiaVladivostok="asia/vladivostok",t.AsiaYakutsk="asia/yakutsk",t.AsiaYangon="asia/yangon",t.AsiaYekaterinburg="asia/yekaterinburg",t.AsiaYerevan="asia/yerevan",t.AtlanticAzores="atlantic/azores",t.AtlanticBermuda="atlantic/bermuda",t.AtlanticCanary="atlantic/canary",t.AtlanticCapeVerde="atlantic/cape_verde",t.AtlanticFaroe="atlantic/faroe",t.AtlanticMadeira="atlantic/madeira",t.AtlanticReykjavik="atlantic/reykjavik",t.AtlanticSouthGeorgia="atlantic/south_georgia",t.AtlanticStHelena="atlantic/st_helena",t.AtlanticStanley="atlantic/stanley",t.AustraliaAdelaide="australia/adelaide",t.AustraliaBrisbane="australia/brisbane",t.AustraliaBrokenHill="australia/broken_hill",t.AustraliaDarwin="australia/darwin",t.AustraliaEucla="australia/eucla",t.AustraliaHobart="australia/hobart",t.AustraliaLindeman="australia/lindeman",t.AustraliaLordHowe="australia/lord_howe",t.AustraliaMelbourne="australia/melbourne",t.AustraliaPerth="australia/perth",t.AustraliaSydney="australia/sydney",t.EuropeAmsterdam="europe/amsterdam",t.EuropeAndorra="europe/andorra",t.EuropeAstrakhan="europe/astrakhan",t.EuropeAthens="europe/athens",t.EuropeBelgrade="europe/belgrade",t.EuropeBerlin="europe/berlin",t.EuropeBratislava="europe/bratislava",t.EuropeBrussels="europe/brussels",t.EuropeBucharest="europe/bucharest",t.EuropeBudapest="europe/budapest",t.EuropeBusingen="europe/busingen",t.EuropeChisinau="europe/chisinau",t.EuropeCopenhagen="europe/copenhagen",t.EuropeDublin="europe/dublin",t.EuropeGibraltar="europe/gibraltar",t.EuropeGuernsey="europe/guernsey",t.EuropeHelsinki="europe/helsinki",t.EuropeIsleOfMan="europe/isle_of_man",t.EuropeIstanbul="europe/istanbul",t.EuropeJersey="europe/jersey",t.EuropeKaliningrad="europe/kaliningrad",t.EuropeKirov="europe/kirov",t.EuropeKyiv="europe/kyiv",t.EuropeLisbon="europe/lisbon",t.EuropeLjubljana="europe/ljubljana",t.EuropeLondon="europe/london",t.EuropeLuxembourg="europe/luxembourg",t.EuropeMadrid="europe/madrid",t.EuropeMalta="europe/malta",t.EuropeMariehamn="europe/mariehamn",t.EuropeMinsk="europe/minsk",t.EuropeMonaco="europe/monaco",t.EuropeMoscow="europe/moscow",t.EuropeOslo="europe/oslo",t.EuropeParis="europe/paris",t.EuropePodgorica="europe/podgorica",t.EuropePrague="europe/prague",t.EuropeRiga="europe/riga",t.EuropeRome="europe/rome",t.EuropeSamara="europe/samara",t.EuropeSanMarino="europe/san_marino",t.EuropeSarajevo="europe/sarajevo",t.EuropeSaratov="europe/saratov",t.EuropeSimferopol="europe/simferopol",t.EuropeSkopje="europe/skopje",t.EuropeSofia="europe/sofia",t.EuropeStockholm="europe/stockholm",t.EuropeTallinn="europe/tallinn",t.EuropeTirane="europe/tirane",t.EuropeUlyanovsk="europe/ulyanovsk",t.EuropeVaduz="europe/vaduz",t.EuropeVatican="europe/vatican",t.EuropeVienna="europe/vienna",t.EuropeVilnius="europe/vilnius",t.EuropeVolgograd="europe/volgograd",t.EuropeWarsaw="europe/warsaw",t.EuropeZagreb="europe/zagreb",t.EuropeZurich="europe/zurich",t.IndianAntananarivo="indian/antananarivo",t.IndianChagos="indian/chagos",t.IndianChristmas="indian/christmas",t.IndianCocos="indian/cocos",t.IndianComoro="indian/comoro",t.IndianKerguelen="indian/kerguelen",t.IndianMahe="indian/mahe",t.IndianMaldives="indian/maldives",t.IndianMauritius="indian/mauritius",t.IndianMayotte="indian/mayotte",t.IndianReunion="indian/reunion",t.PacificApia="pacific/apia",t.PacificAuckland="pacific/auckland",t.PacificBougainville="pacific/bougainville",t.PacificChatham="pacific/chatham",t.PacificChuuk="pacific/chuuk",t.PacificEaster="pacific/easter",t.PacificEfate="pacific/efate",t.PacificFakaofo="pacific/fakaofo",t.PacificFiji="pacific/fiji",t.PacificFunafuti="pacific/funafuti",t.PacificGalapagos="pacific/galapagos",t.PacificGambier="pacific/gambier",t.PacificGuadalcanal="pacific/guadalcanal",t.PacificGuam="pacific/guam",t.PacificHonolulu="pacific/honolulu",t.PacificKanton="pacific/kanton",t.PacificKiritimati="pacific/kiritimati",t.PacificKosrae="pacific/kosrae",t.PacificKwajalein="pacific/kwajalein",t.PacificMajuro="pacific/majuro",t.PacificMarquesas="pacific/marquesas",t.PacificMidway="pacific/midway",t.PacificNauru="pacific/nauru",t.PacificNiue="pacific/niue",t.PacificNorfolk="pacific/norfolk",t.PacificNoumea="pacific/noumea",t.PacificPagoPago="pacific/pago_pago",t.PacificPalau="pacific/palau",t.PacificPitcairn="pacific/pitcairn",t.PacificPohnpei="pacific/pohnpei",t.PacificPortMoresby="pacific/port_moresby",t.PacificRarotonga="pacific/rarotonga",t.PacificSaipan="pacific/saipan",t.PacificTahiti="pacific/tahiti",t.PacificTarawa="pacific/tarawa",t.PacificTongatapu="pacific/tongatapu",t.PacificWake="pacific/wake",t.PacificWallis="pacific/wallis",t.Utc="utc"})(pi||(pi={}));var fi;(function(t){t.Geolocation="geolocation",t.Camera="camera",t.Microphone="microphone",t.Notifications="notifications",t.Midi="midi",t.Push="push",t.Clipboardread="clipboard-read",t.Clipboardwrite="clipboard-write",t.Paymenthandler="payment-handler",t.Usb="usb",t.Bluetooth="bluetooth",t.Accelerometer="accelerometer",t.Gyroscope="gyroscope",t.Magnetometer="magnetometer",t.Ambientlightsensor="ambient-light-sensor",t.Backgroundsync="background-sync",t.Persistentstorage="persistent-storage",t.Screenwakelock="screen-wake-lock",t.Webshare="web-share",t.Xrspatialtracking="xr-spatial-tracking"})(fi||(fi={}));var gi;(function(t){t.Jpg="jpg",t.Jpeg="jpeg",t.Png="png",t.Webp="webp",t.Heic="heic",t.Avif="avif",t.Gif="gif"})(gi||(gi={}));var yi;(function(t){t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH",t.DELETE="DELETE",t.OPTIONS="OPTIONS",t.HEAD="HEAD"})(yi||(yi={}));var mi;(function(t){t.Auto="auto",t.Center="center",t.Topleft="top-left",t.Top="top",t.Topright="top-right",t.Left="left",t.Right="right",t.Bottomleft="bottom-left",t.Bottom="bottom",t.Bottomright="bottom-right"})(mi||(mi={}));var bi;(function(t){t.Functions="functions",t.Sites="sites"})(bi||(bi={}));var wi;(function(t){t.Http="http",t.Schedule="schedule",t.Event="event"})(wi||(wi={}));var vi;(function(t){t.Waiting="waiting",t.Processing="processing",t.Completed="completed",t.Failed="failed",t.Scheduled="scheduled"})(vi||(vi={}));const Ai={signIn:"Sign in",signUp:"Sign up",signOut:"Sign out",continueAsGuest:"Continue as guest",email:"Email",password:"Password",newPassword:"New password",confirmPassword:"Confirm password",name:"Name",phone:"Phone number",code:"Code",forgotPassword:"Forgot password?",noAccount:"Don't have an account?",haveAccount:"Already have an account?",or:"or",continueWith:"Continue with {provider}",continueWithEmail:"Continue with email",sendEmailCode:"Email me a code",continueWithPhone:"Continue with phone",sendMagicLink:"Send magic link",sendCode:"Send code",verifyCode:"Verify code",magicLinkSent:"We sent a sign-in link to {email}. Open it on this device to continue.",codeSent:"We sent a code to {target}. Enter it below to continue.",securityPhrase:"Security phrase",securityPhraseHint:"The message we sent includes this phrase. Do not continue if it differs.",back:"Back",cancel:"Cancel",save:"Save",update:"Update",remove:"Remove",close:"Close",resetPassword:"Reset password",resetLinkSent:"If an account exists for {email}, a reset link is on its way.",passwordUpdated:"Your password was updated. You can sign in now.",sendResetLink:"Send reset link",agreeTo:"By continuing you agree to our",terms:"Terms of Service",privacy:"Privacy Policy",and:"and",welcomeBack:"Welcome back",createAccount:"Create your account",signInTitle:"Sign in to {name}",signUpTitle:"Sign up for {name}",mfaTitle:"Two-factor authentication",mfaDescription:"Confirm it is you with a second factor.",mfaUseAuthenticator:"Use authenticator app",mfaUseEmail:"Send code to email",mfaUsePhone:"Send code by SMS",mfaUseRecoveryCode:"Use a recovery code",recoveryCode:"Recovery code",account:"Account",profile:"Profile",security:"Security",sessions:"Sessions",connections:"Connections",activity:"Activity",dangerZone:"Danger zone",verified:"Verified",unverified:"Unverified",verifyEmail:"Verify email",verificationSent:"Verification email sent. Check your inbox.",emailVerified:"Your email is verified.",changePassword:"Change password",currentPassword:"Current password",twoFactor:"Two-factor authentication",twoFactorDescription:"Require a second factor when signing in to this account.",enable:"Enable",disable:"Disable",authenticatorApp:"Authenticator app",authenticatorAdd:"Add authenticator",authenticatorScan:"Scan this QR code with your authenticator app, then enter the 6-digit code.",authenticatorManual:"Or enter this key manually",authenticatorVerify:"Verify and enable",recoveryCodes:"Recovery codes",recoveryCodesDescription:"Use a recovery code to sign in if you lose access to your other factors.",generateRecoveryCodes:"Generate recovery codes",regenerateRecoveryCodes:"Regenerate",recoveryCodesWarning:"Store these codes somewhere safe. Each code works once.",currentSession:"This device",signOutSession:"Sign out",signOutAllSessions:"Sign out everywhere",signOutAllSessionsDescription:"End every session, including this one.",noConnections:"No connected accounts.",disconnect:"Disconnect",noActivity:"No recent activity.",deleteAccount:"Delete account",deleteAccountDescription:"Your account is disabled and you are signed out. An administrator can restore it.",deleteAccountConfirm:"Delete my account",loading:"Loading",copied:"Copied",copy:"Copy",done:"Done",errorGeneric:"Something went wrong. Please try again.",errorInvalidCredentials:"Invalid email or password.",errorUserExists:"An account with this email already exists.",errorUserBlocked:"This account is blocked. Contact support.",errorRateLimit:"Too many attempts. Wait a moment and try again.",errorInvalidToken:"This link is invalid or has expired. Request a new one.",errorInvalidCode:"That code is not valid. Check it and try again.",errorPasswordMismatch:"Passwords do not match.",errorPasswordRecentlyUsed:"You used this password recently. Choose a different one.",errorPasswordPersonalData:"Password must not contain your name, email or phone.",errorPasswordWeak:"Password is too common or too short. Use at least 8 characters.",errorPasswordPwned:"This password appeared in a data breach. Choose a different one.",errorChallengeRequired:"Confirm a second factor to continue.",errorSessionExists:"You are already signed in.",errorOAuth:"Sign in with the provider failed. Please try again.",errorNetwork:"Could not reach the server. Check your connection.",errorMethodDisabled:"This sign-in method is disabled for this project.",errorNotConfigured:"Auth UI is not configured. Call AuthUI.init() or add <authui-config>.",passwordHint:"At least 8 characters.",signedInAs:"Signed in as",manageAccount:"Manage account",continue:"Continue",provider:"Provider",lastActive:"Last active",guestAccount:"Guest account",guestAccountDescription:"Add an email and password to keep your data."};function Ia(t,e={}){return t.replace(/\{(\w+)\}/g,(i,a)=>a in e?String(e[a]):`{${a}}`)}const xa={amazon:"Amazon",apple:"Apple",appwrite:"Appwrite",auth0:"Auth0",authentik:"Authentik",autodesk:"Autodesk",bitbucket:"Bitbucket",bitly:"Bitly",box:"Box",cloudflare:"Cloudflare",dailymotion:"Dailymotion",discord:"Discord",disqus:"Disqus",dropbox:"Dropbox",etsy:"Etsy",facebook:"Facebook",figma:"Figma",fusionauth:"FusionAuth",github:"GitHub",gitlab:"GitLab",google:"Google",huggingface:"Hugging Face",kakao:"Kakao",keycloak:"Keycloak",kick:"Kick",linkedin:"LinkedIn",microsoft:"Microsoft",notion:"Notion",oidc:"OpenID Connect",okta:"Okta",paypal:"PayPal",paypalSandbox:"PayPal Sandbox",podio:"Podio",resend:"Resend",salesforce:"Salesforce",slack:"Slack",spotify:"Spotify",stripe:"Stripe",tiktok:"TikTok",tradeshift:"Tradeshift",tradeshiftBox:"Tradeshift Box",twitch:"Twitch",wordpress:"WordPress",x:"X",yahoo:"Yahoo",yammer:"Yammer",yandex:"Yandex",zoho:"Zoho",zoom:"Zoom"};function Ve(t){return xa[t]??t.charAt(0).toUpperCase()+t.slice(1)}const se={moreFactorsRequired:"user_more_factors_required",invalidCredentials:"user_invalid_credentials",userAlreadyExists:"user_already_exists",emailAlreadyExists:"user_email_already_exists",phoneAlreadyExists:"user_phone_already_exists",userBlocked:"user_blocked",rateLimit:"general_rate_limit_exceeded",invalidToken:"user_invalid_token",invalidCode:"user_invalid_code",passwordMismatch:"user_password_mismatch",passwordRecentlyUsed:"password_recently_used",passwordPersonalData:"password_personal_data",passwordWeak:"user_password_weak",passwordPwned:"password_pwned",challengeRequired:"user_challenge_required",recoveryCodesExist:"user_recovery_codes_already_exists",recoveryCodesNotFound:"user_recovery_codes_not_found",authenticatorNotFound:"user_authenticator_not_found",routeNotFound:"general_route_not_found",emailAlreadyVerified:"user_email_already_verified",sessionNotFound:"user_session_not_found",wafChallenged:"waf_request_challenged",sessionAlreadyExists:"user_session_already_exists",oauthUnauthorized:"user_oauth2_unauthorized",oauthBadRequest:"user_oauth2_bad_request",unauthorized:"general_unauthorized_scope",userUnauthorized:"user_unauthorized",authMethodUnsupported:"user_auth_method_unsupported",countMaxExceeded:"user_count_exceeded",targetAlreadyExists:"user_target_already_exists"};function Oe(t){if(t&&typeof t=="object"){const e=t;return{message:typeof e.message=="string"?e.message:"Unknown error",type:typeof e.type=="string"?e.type:"",code:typeof e.code=="number"?e.code:0}}return{message:String(t),type:"",code:0}}function ct(t,e){return Oe(t).type===e}function At(t,e,i="link"){const a=Oe(t);switch(a.type){case se.invalidCredentials:return e.errorInvalidCredentials;case se.userAlreadyExists:case se.emailAlreadyExists:case se.phoneAlreadyExists:return e.errorUserExists;case se.userBlocked:return e.errorUserBlocked;case se.rateLimit:return e.errorRateLimit;case se.invalidToken:return i==="code"?e.errorInvalidCode:e.errorInvalidToken;case se.invalidCode:return e.errorInvalidCode;case se.passwordMismatch:return e.errorPasswordMismatch;case se.passwordRecentlyUsed:return e.errorPasswordRecentlyUsed;case se.passwordPersonalData:return e.errorPasswordPersonalData;case se.passwordWeak:return e.errorPasswordWeak;case se.passwordPwned:return e.errorPasswordPwned;case se.challengeRequired:return e.errorChallengeRequired;case se.sessionAlreadyExists:return e.errorSessionExists;case se.oauthUnauthorized:case se.oauthBadRequest:return e.errorOAuth;case se.authMethodUnsupported:return e.errorMethodDisabled}return a.code===0&&/fetch|network/i.test(a.message)?e.errorNetwork:a.message||e.errorGeneric}function be(t,e,i){for(const a of e){const n=t[a];if(typeof n=="function")return n.apply(t,i)}return Promise.reject(new Error(`Appwrite SDK is missing ${e[0]}(). Update the appwrite package.`))}const kt="authui",ki=["userId","secret","expire","project","error",kt],$i=()=>({status:"loading",user:null,mfaFactors:null,pending:null,configured:!1});class Si{constructor(){this.client=null,this.account=null,this.config=null,this.state=$i(),this.listeners=new Map,this.refreshPromise=null}configure(e){this.config=e,this.client=new ke().setEndpoint(e.endpoint).setProject(e.project),this.account=new $a(this.client),this.setState({configured:!0,status:"loading"}),typeof window<"u"&&this.handleRedirect().then(()=>this.refresh())}get isConfigured(){return this.config!==null}getConfig(){return this.config}getClient(){return this.client}getStrings(){return{...Ai,...this.config?.strings??{}}}getState(){return{...this.state}}get user(){return this.state.user}on(e,i){let a=this.listeners.get(e);return a||(a=new Set,this.listeners.set(e,a)),a.add(i),()=>a.delete(i)}emit(e,i){this.listeners.get(e)?.forEach(a=>{try{a(i)}catch(n){console.error("[authui] listener failed",n)}}),typeof window<"u"&&window.dispatchEvent(new CustomEvent(`authui:${e}`,{detail:i}))}setState(e){this.state={...this.state,...e},this.emit("change",this.getState())}fail(e){const i=Oe(e);throw this.emit("error",i),e}acct(){if(!this.account)throw new Error(this.getStrings().errorNotConfigured);return this.account}refresh(){return this.refreshPromise?this.refreshPromise:(this.refreshPromise=(async()=>{if(!this.account){this.setState({status:"signed-out",user:null,mfaFactors:null});return}const e=this.state.status==="signed-in";try{const i=await this.account.get();this.setState({status:"signed-in",user:i,mfaFactors:null}),e||this.emit("signed-in",i)}catch(i){if(ct(i,se.moreFactorsRequired)){let a=null;try{a=await be(this.account,["listMFAFactors","listMfaFactors"],[])}catch{}this.setState({status:"mfa-required",user:null,mfaFactors:a})}else this.setState({status:"signed-out",user:null,mfaFactors:null}),e&&this.emit("signed-out",void 0)}})().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}async afterSignIn(){await this.refresh();const e=this.config?.successUrl;e&&this.state.status==="signed-in"&&typeof window<"u"&&window.location.assign(e)}async signInWithEmailPassword(e,i){try{await this.acct().createEmailPasswordSession(e.trim(),i)}catch(a){this.fail(a)}await this.afterSignIn()}async signUp(e,i,a){try{await this.acct().create(De.unique(),e.trim(),i,a?.trim()||void 0),await this.acct().createEmailPasswordSession(e.trim(),i)}catch(n){this.fail(n)}await this.afterSignIn()}async signInAnonymously(){try{await this.acct().createAnonymousSession()}catch(e){this.fail(e)}await this.afterSignIn()}signInWithOAuth(e){const i=this.config?.oauthScopes?.[e];try{this.acct().createOAuth2Token(e,this.redirectUrl("oauth"),this.redirectUrl("oauth-failed"),i)}catch(a){this.fail(a)}}async sendMagicUrl(e){try{return await this.acct().createMagicURLToken(De.unique(),e.trim(),this.redirectUrl("magic-url"),this.config?.securityPhrase??!0)}catch(i){return this.fail(i)}}async sendEmailOtp(e){try{return await this.acct().createEmailToken(De.unique(),e.trim(),this.config?.securityPhrase??!0)}catch(i){return this.fail(i)}}async sendPhoneOtp(e){try{return await this.acct().createPhoneToken(De.unique(),e.replace(/[\s()-]/g,""))}catch(i){return this.fail(i)}}async signInWithToken(e,i){try{await this.acct().createSession(e,i.trim())}catch(a){this.fail(a)}await this.afterSignIn()}async createMfaChallenge(e){try{return await be(this.acct(),["createMFAChallenge","createMfaChallenge"],[e])}catch(i){return this.fail(i)}}async completeMfaChallenge(e,i,a={}){try{await be(this.acct(),["updateMFAChallenge","updateMfaChallenge"],[e,i.trim()])}catch(n){this.fail(n)}(a.signIn??!0)&&await this.afterSignIn()}async listMfaFactors(){try{return await be(this.acct(),["listMFAFactors","listMfaFactors"],[])}catch(e){return this.fail(e)}}async setMfaEnabled(e){try{await this.acct().updateMFA(e)}catch(i){this.fail(i)}await this.refresh()}async addAuthenticator(){try{return await be(this.acct(),["createMFAAuthenticator","createMfaAuthenticator"],["totp"])}catch(e){return this.fail(e)}}async verifyAuthenticator(e){try{await be(this.acct(),["updateMFAAuthenticator","updateMfaAuthenticator"],["totp",e.trim()])}catch(i){this.fail(i)}await this.refresh()}async removeAuthenticator(){try{await be(this.acct(),["deleteMFAAuthenticator","deleteMfaAuthenticator"],["totp"])}catch(e){this.fail(e)}await this.refresh()}async createRecoveryCodes(){try{return(await be(this.acct(),["createMFARecoveryCodes","createMfaRecoveryCodes"],[])).recoveryCodes}catch(e){return this.fail(e)}}async regenerateRecoveryCodes(){try{return(await be(this.acct(),["updateMFARecoveryCodes","updateMfaRecoveryCodes"],[])).recoveryCodes}catch(e){return this.fail(e)}}async getRecoveryCodes(){try{return(await be(this.acct(),["getMFARecoveryCodes","getMfaRecoveryCodes"],[])).recoveryCodes}catch(e){return this.fail(e)}}async sendPasswordRecovery(e){try{await this.acct().createRecovery(e.trim(),this.redirectUrl("recovery"))}catch(i){this.fail(i)}}async completePasswordRecovery(e,i,a){try{await this.acct().updateRecovery(e,i,a)}catch(n){this.fail(n)}this.setState({pending:null})}async signOut(e="current"){try{await this.acct().deleteSession(e)}catch(i){this.fail(i)}e==="current"&&(this.setState({status:"signed-out",user:null,mfaFactors:null}),this.emit("signed-out",void 0))}async signOutEverywhere(){try{await this.acct().deleteSessions()}catch(e){this.fail(e)}this.setState({status:"signed-out",user:null,mfaFactors:null}),this.emit("signed-out",void 0)}async listSessions(){try{return(await this.acct().listSessions()).sessions}catch(e){return this.fail(e)}}async listIdentities(){try{return(await this.acct().listIdentities()).identities}catch(e){return this.fail(e)}}async deleteIdentity(e){try{await this.acct().deleteIdentity(e)}catch(i){this.fail(i)}}async listLogs(){try{return(await this.acct().listLogs()).logs}catch(e){return this.fail(e)}}async updateName(e){try{await this.acct().updateName(e.trim())}catch(i){this.fail(i)}await this.refresh()}async updateEmail(e,i){try{await this.acct().updateEmail(e.trim(),i)}catch(a){this.fail(a)}await this.refresh()}async updatePhone(e,i){try{await this.acct().updatePhone(e.replace(/[\s()-]/g,""),i)}catch(a){this.fail(a)}await this.refresh()}async updatePassword(e,i){try{await this.acct().updatePassword(e,i||void 0)}catch(a){this.fail(a)}await this.refresh()}async convertGuest(e,i,a){try{await this.acct().updateEmail(e.trim(),i),a?.trim()&&await this.acct().updateName(a.trim())}catch(n){this.fail(n)}await this.refresh()}async sendEmailVerification(){try{await be(this.acct(),["createEmailVerification","createVerification"],[this.redirectUrl("verify-email")])}catch(e){this.fail(e)}}async sendPhoneVerification(){try{await this.acct().createPhoneVerification()}catch(e){this.fail(e)}}async confirmPhoneVerification(e){const i=this.state.user?.$id;if(i){try{await this.acct().updatePhoneVerification(i,e.trim())}catch(a){this.fail(a)}await this.refresh()}}async deleteAccount(){try{await this.acct().updateStatus()}catch(e){this.fail(e)}this.setState({status:"signed-out",user:null,mfaFactors:null}),this.emit("signed-out",void 0)}redirectUrl(e){const i=this.config?.redirectUrl??(typeof window<"u"?window.location.origin+window.location.pathname:""),a=new URL(i,typeof window<"u"?window.location.href:void 0);for(const n of ki)a.searchParams.delete(n);return a.searchParams.set(kt,e),a.toString()}setPending(e){this.setState({pending:e})}async handleRedirect(){if(typeof window>"u")return!1;const e=new URLSearchParams(window.location.search),i=e.get(kt);if(!i)return!1;const a=e.get("userId")??"",n=e.get("secret")??"";this.cleanUrl();try{switch(i){case"oauth":case"magic-url":a&&n&&await this.acct().createSession(a,n);break;case"oauth-failed":this.setState({pending:{type:"oauth-failed"}});break;case"recovery":a&&n&&this.setState({pending:{type:"reset-password",userId:a,secret:n}});break;case"verify-email":a&&n&&(await be(this.acct(),["updateEmailVerification","updateVerification"],[a,n]),this.setState({pending:{type:"notice",message:this.getStrings().emailVerified,tone:"success"}}));break}}catch(r){const s=Oe(r);this.emit("error",s),this.setState({pending:{type:"notice",message:s.message,tone:"error"}})}return!0}cleanUrl(){const e=new URL(window.location.href);for(const i of ki)e.searchParams.delete(i);window.history.replaceState(window.history.state,"",e.toString())}reset(){this.client=null,this.account=null,this.config=null,this.state=$i(),this.listeners.clear()}}const _=new Si;class Pa{constructor(){this.listeners=new Set,this.observer=null,this.media=null,this.notify=()=>{const e=this.isDark("auto");this.listeners.forEach(i=>i(e))}}isDark(e="auto"){if(e==="dark")return!0;if(e==="light"||typeof document>"u")return!1;const i=document.documentElement.classList;return i.contains("dark")?!0:i.contains("light")?!1:document.documentElement.dataset.theme==="dark"?!0:document.documentElement.dataset.theme==="light"?!1:typeof window<"u"&&!!window.matchMedia?.("(prefers-color-scheme: dark)").matches}subscribe(e){return this.listeners.add(e),this.start(),()=>{this.listeners.delete(e),this.listeners.size===0&&this.stop()}}start(){this.observer||typeof document>"u"||(this.observer=new MutationObserver(this.notify),this.observer.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),typeof window<"u"&&window.matchMedia&&(this.media=window.matchMedia("(prefers-color-scheme: dark)"),this.media.addEventListener?.("change",this.notify)))}stop(){this.observer?.disconnect(),this.observer=null,this.media?.removeEventListener?.("change",this.notify),this.media=null}}const Ii=new Pa,xi={none:"0px",sm:"0.25rem",md:"0.625rem",lg:"0.875rem",xl:"1.125rem",full:"1.5rem"},ja=je`
11
+ :host {
12
+ /* Light theme (matches :root in the console) */
13
+ --authui-background: oklch(1 0 0);
14
+ --authui-foreground: oklch(0.141 0.005 285.823);
15
+ --authui-card: oklch(1 0 0);
16
+ --authui-card-foreground: oklch(0.141 0.005 285.823);
17
+ --authui-popover: oklch(1 0 0);
18
+ --authui-popover-foreground: oklch(0.141 0.005 285.823);
19
+ --authui-primary: oklch(0.21 0.006 285.885);
20
+ --authui-primary-foreground: oklch(0.985 0 0);
21
+ --authui-secondary: oklch(0.967 0.001 286.375);
22
+ --authui-secondary-foreground: oklch(0.21 0.006 285.885);
23
+ --authui-muted: oklch(0.967 0.001 286.375);
24
+ --authui-muted-foreground: oklch(0.552 0.016 285.938);
25
+ --authui-accent: oklch(0.967 0.001 286.375);
26
+ --authui-accent-foreground: oklch(0.21 0.006 285.885);
27
+ --authui-destructive: oklch(0.577 0.245 27.325);
28
+ --authui-destructive-foreground: oklch(0.577 0.245 27.325);
29
+ --authui-border: oklch(0.93 0.0035 286.32);
30
+ --authui-input: oklch(0.93 0.0035 286.32);
31
+ --authui-ring: oklch(0.898 0.004 286.286);
32
+ --authui-brand: #fd366e;
33
+ --authui-brand-foreground: #ffffff;
34
+ --authui-success: oklch(0.696 0.17 162.48);
35
+ --authui-success-foreground: #047857;
36
+ --authui-success-bg: rgba(16, 185, 129, 0.1);
37
+ --authui-warning-foreground: #b45309;
38
+ --authui-warning-bg: rgba(245, 158, 11, 0.1);
39
+ --authui-error-foreground: #dc2626;
40
+ --authui-error-bg: rgba(239, 68, 68, 0.1);
41
+ --authui-info-foreground: #475569;
42
+ --authui-info-bg: rgba(100, 116, 139, 0.1);
43
+ --authui-overlay: rgba(0, 0, 0, 0.5);
44
+
45
+ --authui-radius: 0.625rem;
46
+ --authui-radius-sm: calc(var(--authui-radius) - 4px);
47
+ --authui-radius-md: calc(var(--authui-radius) - 2px);
48
+ --authui-radius-lg: var(--authui-radius);
49
+ --authui-radius-xl: calc(var(--authui-radius) + 4px);
50
+
51
+ --authui-font:
52
+ -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans",
53
+ "Droid Sans", "Helvetica Neue", sans-serif;
54
+ --authui-font-mono: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
55
+
56
+ --authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
57
+ --authui-z: 110;
58
+ }
59
+
60
+ :host([data-theme="dark"]) {
61
+ --authui-background: #19191c;
62
+ --authui-foreground: oklch(0.985 0 0);
63
+ --authui-card: #1d1d21;
64
+ --authui-card-foreground: oklch(0.985 0 0);
65
+ --authui-popover: #1d1d21;
66
+ --authui-popover-foreground: oklch(0.985 0 0);
67
+ --authui-primary: oklch(0.985 0 0);
68
+ --authui-primary-foreground: oklch(0.21 0.006 285.885);
69
+ --authui-secondary: #2d2d31;
70
+ --authui-secondary-foreground: oklch(0.985 0 0);
71
+ --authui-muted: #2d2d31;
72
+ --authui-muted-foreground: oklch(0.705 0.015 286.067);
73
+ --authui-accent: #2d2d31;
74
+ --authui-accent-foreground: oklch(0.985 0 0);
75
+ --authui-destructive: oklch(0.396 0.141 25.723);
76
+ --authui-destructive-foreground: oklch(0.637 0.237 25.331);
77
+ --authui-border: oklch(0.252 0.005 286.32);
78
+ --authui-input: #2d2d31;
79
+ --authui-ring: oklch(0.448 0.015 285.786);
80
+ --authui-success-foreground: #34d399;
81
+ --authui-warning-foreground: #fbbf24;
82
+ --authui-error-foreground: #f87171;
83
+ --authui-info-foreground: #94a3b8;
84
+ --authui-overlay: rgba(0, 0, 0, 0.6);
85
+ --authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
86
+ color-scheme: dark;
87
+ }
88
+ `,Ca=je`
89
+ *,
90
+ *::before,
91
+ *::after {
92
+ box-sizing: border-box;
93
+ }
94
+
95
+ :host {
96
+ font-family: var(--authui-font);
97
+ color: var(--authui-foreground);
98
+ font-size: 14px;
99
+ line-height: 1.5;
100
+ -webkit-font-smoothing: antialiased;
101
+ -moz-osx-font-smoothing: grayscale;
102
+ text-align: start;
103
+ }
104
+
105
+ [hidden] {
106
+ display: none !important;
107
+ }
108
+
109
+ .sr-only {
110
+ position: absolute;
111
+ width: 1px;
112
+ height: 1px;
113
+ padding: 0;
114
+ margin: -1px;
115
+ overflow: hidden;
116
+ clip: rect(0, 0, 0, 0);
117
+ white-space: nowrap;
118
+ border: 0;
119
+ }
120
+
121
+ /* ── Typography ── */
122
+ .title {
123
+ font-size: 18px;
124
+ line-height: 1.2;
125
+ font-weight: 600;
126
+ letter-spacing: -0.01em;
127
+ margin: 0;
128
+ color: var(--authui-foreground);
129
+ }
130
+ .description {
131
+ font-size: 13px;
132
+ color: var(--authui-muted-foreground);
133
+ margin: 6px 0 0;
134
+ }
135
+ .eyebrow {
136
+ font-size: 12px;
137
+ font-weight: 600;
138
+ text-transform: uppercase;
139
+ letter-spacing: 0.08em;
140
+ color: var(--authui-muted-foreground);
141
+ }
142
+ .muted {
143
+ color: var(--authui-muted-foreground);
144
+ }
145
+ .small {
146
+ font-size: 13px;
147
+ }
148
+ .mono {
149
+ font-family: var(--authui-font-mono);
150
+ }
151
+
152
+ /* ── Button ── */
153
+ .btn {
154
+ display: inline-flex;
155
+ align-items: center;
156
+ justify-content: center;
157
+ gap: 6px;
158
+ white-space: nowrap;
159
+ border-radius: var(--authui-radius-md);
160
+ font-size: 14px;
161
+ font-weight: 500;
162
+ font-family: inherit;
163
+ height: 36px;
164
+ padding: 0 16px;
165
+ border: 1px solid transparent;
166
+ cursor: pointer;
167
+ transition:
168
+ background-color 150ms,
169
+ color 150ms,
170
+ border-color 150ms,
171
+ box-shadow 150ms,
172
+ opacity 150ms;
173
+ outline: none;
174
+ flex-shrink: 0;
175
+ text-decoration: none;
176
+ position: relative;
177
+ }
178
+ .btn:focus-visible {
179
+ border-color: var(--authui-ring);
180
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-ring) 50%, transparent);
181
+ }
182
+ .btn:disabled,
183
+ .btn[aria-disabled="true"] {
184
+ pointer-events: none;
185
+ opacity: 0.5;
186
+ }
187
+ .btn svg {
188
+ width: 16px;
189
+ height: 16px;
190
+ flex-shrink: 0;
191
+ pointer-events: none;
192
+ }
193
+ .btn-primary {
194
+ background: var(--authui-primary);
195
+ color: var(--authui-primary-foreground);
196
+ }
197
+ .btn-primary:hover {
198
+ background: color-mix(in oklab, var(--authui-primary) 90%, transparent);
199
+ }
200
+ .btn-brand {
201
+ background: var(--authui-brand);
202
+ color: var(--authui-brand-foreground);
203
+ }
204
+ .btn-brand:hover {
205
+ opacity: 0.9;
206
+ }
207
+ .btn-outline {
208
+ border-color: var(--authui-border);
209
+ background: transparent;
210
+ color: var(--authui-foreground);
211
+ }
212
+ .btn-outline:hover {
213
+ background: var(--authui-accent);
214
+ color: var(--authui-accent-foreground);
215
+ }
216
+ .btn-secondary {
217
+ background: var(--authui-secondary);
218
+ color: var(--authui-secondary-foreground);
219
+ }
220
+ .btn-secondary:hover {
221
+ background: color-mix(in oklab, var(--authui-secondary) 80%, transparent);
222
+ }
223
+ .btn-ghost {
224
+ background: transparent;
225
+ color: var(--authui-muted-foreground);
226
+ }
227
+ .btn-ghost:hover {
228
+ background: var(--authui-accent);
229
+ color: var(--authui-foreground);
230
+ }
231
+ .btn-destructive {
232
+ background: var(--authui-destructive);
233
+ color: #fff;
234
+ }
235
+ .btn-destructive:hover {
236
+ background: color-mix(in oklab, var(--authui-destructive) 90%, transparent);
237
+ }
238
+ .btn-link {
239
+ height: auto;
240
+ padding: 0;
241
+ border: 0;
242
+ background: none;
243
+ font-weight: 500;
244
+ color: color-mix(in oklab, var(--authui-foreground) 85%, transparent);
245
+ text-decoration: underline;
246
+ text-decoration-style: dotted;
247
+ text-decoration-color: color-mix(in oklab, var(--authui-muted-foreground) 38%, transparent);
248
+ text-underline-offset: 3px;
249
+ text-decoration-thickness: 1px;
250
+ border-radius: 2px;
251
+ }
252
+ .btn-link:hover {
253
+ color: var(--authui-foreground);
254
+ text-decoration-color: color-mix(in oklab, var(--authui-muted-foreground) 58%, transparent);
255
+ }
256
+ .btn-sm {
257
+ height: 32px;
258
+ padding: 0 12px;
259
+ font-size: 13px;
260
+ }
261
+ .btn-lg {
262
+ height: 40px;
263
+ padding: 0 24px;
264
+ }
265
+ .btn-icon {
266
+ width: 36px;
267
+ height: 36px;
268
+ padding: 0;
269
+ }
270
+ .btn-block {
271
+ width: 100%;
272
+ }
273
+
274
+ /* ── Form ── */
275
+ .field {
276
+ display: flex;
277
+ flex-direction: column;
278
+ gap: 6px;
279
+ }
280
+ .label {
281
+ display: flex;
282
+ align-items: center;
283
+ justify-content: space-between;
284
+ gap: 8px;
285
+ font-size: 14px;
286
+ line-height: 1;
287
+ font-weight: 500;
288
+ user-select: none;
289
+ }
290
+ .input {
291
+ font: inherit;
292
+ font-size: 14px;
293
+ height: 36px;
294
+ width: 100%;
295
+ min-width: 0;
296
+ border-radius: var(--authui-radius-md);
297
+ border: 1px solid var(--authui-input);
298
+ background: transparent;
299
+ color: var(--authui-foreground);
300
+ padding: 4px 12px;
301
+ outline: none;
302
+ transition:
303
+ border-color 150ms,
304
+ box-shadow 150ms;
305
+ }
306
+ :host([data-theme="dark"]) .input {
307
+ background: color-mix(in oklab, var(--authui-input) 30%, transparent);
308
+ }
309
+ .input::placeholder {
310
+ color: var(--authui-muted-foreground);
311
+ }
312
+ .input:focus-visible {
313
+ border-color: var(--authui-ring);
314
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-ring) 50%, transparent);
315
+ }
316
+ .input[aria-invalid="true"] {
317
+ border-color: var(--authui-destructive);
318
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-destructive) 20%, transparent);
319
+ }
320
+ .input:disabled {
321
+ opacity: 0.5;
322
+ cursor: not-allowed;
323
+ }
324
+ .input-wrap {
325
+ position: relative;
326
+ display: flex;
327
+ align-items: center;
328
+ }
329
+ .input-wrap .input {
330
+ padding-inline-end: 40px;
331
+ }
332
+ .input-wrap .btn-icon {
333
+ position: absolute;
334
+ inset-inline-end: 2px;
335
+ width: 32px;
336
+ height: 32px;
337
+ color: var(--authui-muted-foreground);
338
+ }
339
+ .input-otp {
340
+ letter-spacing: 0.4em;
341
+ text-align: center;
342
+ font-family: var(--authui-font-mono);
343
+ font-size: 18px;
344
+ height: 44px;
345
+ }
346
+ .hint {
347
+ font-size: 12px;
348
+ color: var(--authui-muted-foreground);
349
+ margin: 0;
350
+ }
351
+ .form {
352
+ display: flex;
353
+ flex-direction: column;
354
+ gap: 16px;
355
+ }
356
+
357
+ /* ── Alert ── */
358
+ .alert {
359
+ position: relative;
360
+ width: 100%;
361
+ border-radius: var(--authui-radius-lg);
362
+ border: 1px solid var(--authui-border);
363
+ padding: 12px 16px;
364
+ font-size: 13px;
365
+ display: grid;
366
+ grid-template-columns: 16px 1fr;
367
+ column-gap: 12px;
368
+ row-gap: 2px;
369
+ align-items: start;
370
+ background: var(--authui-card);
371
+ color: var(--authui-card-foreground);
372
+ }
373
+ .alert svg {
374
+ width: 16px;
375
+ height: 16px;
376
+ margin-top: 2px;
377
+ }
378
+ .alert-title {
379
+ grid-column: 2;
380
+ font-weight: 500;
381
+ letter-spacing: -0.01em;
382
+ }
383
+ .alert-body {
384
+ grid-column: 2;
385
+ color: var(--authui-muted-foreground);
386
+ line-height: 1.55;
387
+ }
388
+ .alert-error {
389
+ color: var(--authui-error-foreground);
390
+ border-color: color-mix(in oklab, var(--authui-error-foreground) 30%, transparent);
391
+ background: var(--authui-error-bg);
392
+ }
393
+ .alert-error .alert-body {
394
+ color: color-mix(in oklab, var(--authui-error-foreground) 90%, transparent);
395
+ }
396
+ .alert-success {
397
+ color: var(--authui-success-foreground);
398
+ border-color: color-mix(in oklab, var(--authui-success-foreground) 30%, transparent);
399
+ background: var(--authui-success-bg);
400
+ }
401
+ .alert-success .alert-body {
402
+ color: color-mix(in oklab, var(--authui-success-foreground) 90%, transparent);
403
+ }
404
+ .alert-info {
405
+ background: var(--authui-info-bg);
406
+ }
407
+ .alert-warning {
408
+ color: var(--authui-warning-foreground);
409
+ border-color: color-mix(in oklab, var(--authui-warning-foreground) 30%, transparent);
410
+ background: var(--authui-warning-bg);
411
+ }
412
+
413
+ /* ── Badge ── */
414
+ .badge {
415
+ display: inline-flex;
416
+ align-items: center;
417
+ justify-content: center;
418
+ gap: 4px;
419
+ border-radius: var(--authui-radius-md);
420
+ padding: 2px 8px;
421
+ font-size: 12px;
422
+ font-weight: 500;
423
+ white-space: nowrap;
424
+ width: fit-content;
425
+ }
426
+ .badge svg {
427
+ width: 12px;
428
+ height: 12px;
429
+ }
430
+ .badge-success {
431
+ background: var(--authui-success-bg);
432
+ color: var(--authui-success-foreground);
433
+ }
434
+ .badge-error {
435
+ background: var(--authui-error-bg);
436
+ color: var(--authui-error-foreground);
437
+ }
438
+ .badge-warning {
439
+ background: var(--authui-warning-bg);
440
+ color: var(--authui-warning-foreground);
441
+ }
442
+ .badge-info {
443
+ background: var(--authui-info-bg);
444
+ color: var(--authui-info-foreground);
445
+ }
446
+ .badge-outline {
447
+ background: color-mix(in oklab, var(--authui-muted) 60%, transparent);
448
+ color: color-mix(in oklab, var(--authui-foreground) 80%, transparent);
449
+ }
450
+
451
+ /* ── Separator ── */
452
+ .separator {
453
+ height: 1px;
454
+ width: 100%;
455
+ background: var(--authui-border);
456
+ flex-shrink: 0;
457
+ }
458
+ .separator-text {
459
+ display: flex;
460
+ align-items: center;
461
+ gap: 12px;
462
+ font-size: 12px;
463
+ color: var(--authui-muted-foreground);
464
+ text-transform: uppercase;
465
+ letter-spacing: 0.06em;
466
+ }
467
+ .separator-text::before,
468
+ .separator-text::after {
469
+ content: "";
470
+ flex: 1;
471
+ height: 1px;
472
+ background: var(--authui-border);
473
+ }
474
+
475
+ /* ── Tabs ── */
476
+ .tabs {
477
+ display: inline-flex;
478
+ align-items: center;
479
+ justify-content: center;
480
+ height: 36px;
481
+ width: fit-content;
482
+ max-width: 100%;
483
+ overflow-x: auto;
484
+ border-radius: var(--authui-radius-lg);
485
+ background: color-mix(in oklab, var(--authui-muted) 50%, transparent);
486
+ color: var(--authui-muted-foreground);
487
+ padding: 3px;
488
+ gap: 2px;
489
+ scrollbar-width: none;
490
+ }
491
+ :host([data-theme="dark"]) .tabs {
492
+ background: color-mix(in oklab, var(--authui-muted) 80%, transparent);
493
+ }
494
+ .tab {
495
+ display: inline-flex;
496
+ align-items: center;
497
+ justify-content: center;
498
+ gap: 6px;
499
+ height: 100%;
500
+ flex: 1;
501
+ padding: 4px 10px;
502
+ border-radius: var(--authui-radius-md);
503
+ border: 1px solid transparent;
504
+ background: transparent;
505
+ color: var(--authui-muted-foreground);
506
+ font: inherit;
507
+ font-size: 13px;
508
+ font-weight: 500;
509
+ white-space: nowrap;
510
+ cursor: pointer;
511
+ transition:
512
+ color 150ms,
513
+ background-color 150ms,
514
+ box-shadow 150ms;
515
+ }
516
+ .tab:hover {
517
+ color: var(--authui-foreground);
518
+ }
519
+ .tab[aria-selected="true"] {
520
+ background: var(--authui-background);
521
+ color: var(--authui-foreground);
522
+ border-color: var(--authui-input);
523
+ }
524
+ .tab:focus-visible {
525
+ outline: none;
526
+ box-shadow: inset 0 0 0 3px color-mix(in oklab, var(--authui-ring) 50%, transparent);
527
+ }
528
+
529
+ /* ── Settings card (console "Settings Card Structure") ── */
530
+ .card {
531
+ border-radius: var(--authui-radius-xl);
532
+ border: 1px solid var(--authui-border);
533
+ background: color-mix(in oklab, var(--authui-card) 50%, transparent);
534
+ overflow: hidden;
535
+ }
536
+ .card-header {
537
+ padding: 16px 24px;
538
+ }
539
+ .card-title {
540
+ font-size: 15px;
541
+ font-weight: 600;
542
+ margin: 0;
543
+ color: var(--authui-foreground);
544
+ }
545
+ .card-description {
546
+ font-size: 13px;
547
+ color: var(--authui-muted-foreground);
548
+ margin: 8px 0 0;
549
+ }
550
+ .card-body {
551
+ padding: 16px 24px;
552
+ border-top: 1px solid var(--authui-border);
553
+ }
554
+ .card-footer {
555
+ padding: 16px 24px;
556
+ border-top: 1px solid var(--authui-border);
557
+ background: color-mix(in oklab, var(--authui-muted) 30%, transparent);
558
+ display: flex;
559
+ justify-content: flex-end;
560
+ gap: 8px;
561
+ }
562
+ .card-danger {
563
+ border-color: color-mix(in oklab, var(--authui-destructive) 40%, transparent);
564
+ }
565
+
566
+ /* ── Lists / rows ── */
567
+ .row {
568
+ display: flex;
569
+ align-items: center;
570
+ justify-content: space-between;
571
+ gap: 12px;
572
+ padding: 12px 0;
573
+ }
574
+ .row + .row {
575
+ border-top: 1px solid var(--authui-border);
576
+ }
577
+ .row-main {
578
+ display: flex;
579
+ flex-direction: column;
580
+ gap: 2px;
581
+ min-width: 0;
582
+ }
583
+ .row-title {
584
+ font-size: 14px;
585
+ font-weight: 500;
586
+ display: flex;
587
+ align-items: center;
588
+ gap: 8px;
589
+ flex-wrap: wrap;
590
+ }
591
+ .row-sub {
592
+ font-size: 12px;
593
+ color: var(--authui-muted-foreground);
594
+ overflow: hidden;
595
+ text-overflow: ellipsis;
596
+ white-space: nowrap;
597
+ }
598
+ .row-actions {
599
+ display: flex;
600
+ align-items: center;
601
+ gap: 8px;
602
+ flex-shrink: 0;
603
+ }
604
+
605
+ /* ── Misc ── */
606
+ .stack {
607
+ display: flex;
608
+ flex-direction: column;
609
+ gap: 12px;
610
+ }
611
+ .stack-sm {
612
+ display: flex;
613
+ flex-direction: column;
614
+ gap: 8px;
615
+ }
616
+ .inline {
617
+ display: flex;
618
+ align-items: center;
619
+ gap: 8px;
620
+ flex-wrap: wrap;
621
+ }
622
+ .between {
623
+ display: flex;
624
+ align-items: center;
625
+ justify-content: space-between;
626
+ gap: 8px;
627
+ }
628
+ .center {
629
+ text-align: center;
630
+ }
631
+ .spinner {
632
+ width: 16px;
633
+ height: 16px;
634
+ border-radius: 50%;
635
+ border: 2px solid color-mix(in oklab, currentColor 30%, transparent);
636
+ border-top-color: currentColor;
637
+ animation: authui-spin 0.7s linear infinite;
638
+ flex-shrink: 0;
639
+ }
640
+ @keyframes authui-spin {
641
+ to {
642
+ transform: rotate(360deg);
643
+ }
644
+ }
645
+ .avatar {
646
+ width: 36px;
647
+ height: 36px;
648
+ border-radius: 50%;
649
+ background: var(--authui-muted);
650
+ color: var(--authui-muted-foreground);
651
+ display: inline-flex;
652
+ align-items: center;
653
+ justify-content: center;
654
+ font-weight: 600;
655
+ font-size: 14px;
656
+ flex-shrink: 0;
657
+ overflow: hidden;
658
+ text-transform: uppercase;
659
+ }
660
+ .avatar img {
661
+ width: 100%;
662
+ height: 100%;
663
+ object-fit: cover;
664
+ }
665
+ .logo {
666
+ display: block;
667
+ max-height: 40px;
668
+ max-width: 160px;
669
+ margin: 0 auto 16px;
670
+ }
671
+ .code {
672
+ font-family: var(--authui-font-mono);
673
+ font-size: 13px;
674
+ border-radius: var(--authui-radius-md);
675
+ border: 1px solid var(--authui-border);
676
+ background: color-mix(in oklab, var(--authui-muted) 50%, transparent);
677
+ padding: 2px 6px;
678
+ color: color-mix(in oklab, var(--authui-foreground) 85%, transparent);
679
+ word-break: break-all;
680
+ user-select: all;
681
+ }
682
+ .codes {
683
+ display: grid;
684
+ grid-template-columns: repeat(2, minmax(0, 1fr));
685
+ gap: 8px;
686
+ }
687
+ .qr {
688
+ display: block;
689
+ width: 168px;
690
+ height: 168px;
691
+ margin: 0 auto;
692
+ border-radius: var(--authui-radius-md);
693
+ border: 1px solid var(--authui-border);
694
+ background: #fff;
695
+ padding: 8px;
696
+ }
697
+ .legal {
698
+ font-size: 12px;
699
+ color: var(--authui-muted-foreground);
700
+ text-align: center;
701
+ margin: 0;
702
+ line-height: 1.6;
703
+ }
704
+ .legal a {
705
+ color: inherit;
706
+ text-decoration: underline;
707
+ text-decoration-style: dotted;
708
+ text-underline-offset: 3px;
709
+ }
710
+ .legal a:hover {
711
+ color: var(--authui-foreground);
712
+ }
713
+ .links {
714
+ display: flex;
715
+ justify-content: center;
716
+ align-items: center;
717
+ gap: 12px;
718
+ font-size: 13px;
719
+ color: var(--authui-muted-foreground);
720
+ flex-wrap: wrap;
721
+ }
722
+ .providers {
723
+ display: grid;
724
+ gap: 8px;
725
+ }
726
+ .providers.two {
727
+ grid-template-columns: repeat(2, minmax(0, 1fr));
728
+ }
729
+ .providers .btn svg {
730
+ width: 18px;
731
+ height: 18px;
732
+ }
733
+ .empty {
734
+ padding: 24px 0;
735
+ text-align: center;
736
+ font-size: 13px;
737
+ color: var(--authui-muted-foreground);
738
+ }
739
+ .choice {
740
+ display: flex;
741
+ align-items: center;
742
+ gap: 12px;
743
+ width: 100%;
744
+ padding: 12px 14px;
745
+ border-radius: var(--authui-radius-lg);
746
+ border: 1px solid var(--authui-border);
747
+ background: transparent;
748
+ color: var(--authui-foreground);
749
+ font: inherit;
750
+ text-align: start;
751
+ cursor: pointer;
752
+ transition:
753
+ background-color 150ms,
754
+ border-color 150ms;
755
+ }
756
+ .choice:hover {
757
+ background: var(--authui-accent);
758
+ }
759
+ .choice:focus-visible {
760
+ outline: none;
761
+ border-color: var(--authui-ring);
762
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-ring) 50%, transparent);
763
+ }
764
+ .choice svg {
765
+ width: 18px;
766
+ height: 18px;
767
+ color: var(--authui-muted-foreground);
768
+ flex-shrink: 0;
769
+ }
770
+ .choice-title {
771
+ font-weight: 500;
772
+ font-size: 14px;
773
+ }
774
+ .choice-sub {
775
+ font-size: 12px;
776
+ color: var(--authui-muted-foreground);
777
+ }
778
+ .switch {
779
+ position: relative;
780
+ width: 36px;
781
+ height: 20px;
782
+ border-radius: 999px;
783
+ border: 1px solid transparent;
784
+ background: var(--authui-input);
785
+ cursor: pointer;
786
+ transition: background-color 150ms;
787
+ flex-shrink: 0;
788
+ padding: 0;
789
+ }
790
+ .switch[aria-checked="true"] {
791
+ background: var(--authui-primary);
792
+ }
793
+ .switch::after {
794
+ content: "";
795
+ position: absolute;
796
+ top: 2px;
797
+ inset-inline-start: 2px;
798
+ width: 14px;
799
+ height: 14px;
800
+ border-radius: 50%;
801
+ background: var(--authui-background);
802
+ transition: transform 150ms;
803
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
804
+ }
805
+ .switch[aria-checked="true"]::after {
806
+ transform: translateX(16px);
807
+ }
808
+ .switch:focus-visible {
809
+ outline: none;
810
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-ring) 50%, transparent);
811
+ }
812
+ .switch:disabled {
813
+ opacity: 0.5;
814
+ cursor: not-allowed;
815
+ }
816
+ @media (prefers-reduced-motion: reduce) {
817
+ *,
818
+ *::before,
819
+ *::after {
820
+ transition: none !important;
821
+ animation-duration: 0.01ms !important;
822
+ }
823
+ }
824
+ `;var Ua=Object.defineProperty,Ea=(t,e,i,a)=>{for(var n=void 0,r=t.length-1,s;r>=0;r--)(s=t[r])&&(n=s(e,i,n)||n);return n&&Ua(e,i,n),n};const Pt=class Pt extends Le{constructor(){super(...arguments),this.auth=_.getState(),this.unsubscribeStore=null,this.unsubscribeTheme=null}connectedCallback(){super.connectedCallback(),this.auth=_.getState(),this.unsubscribeStore=_.on("change",e=>{this.auth=e,this.applyBranding()}),this.unsubscribeTheme=Ii.subscribe(()=>this.applyBranding()),this.applyBranding()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeStore?.(),this.unsubscribeTheme?.(),this.unsubscribeStore=null,this.unsubscribeTheme=null}get strings(){return _.getStrings()}t(e,i){return Ia(this.strings[e],i)}get config(){return _.getConfig()}get productName(){return this.config?.branding?.name??""}applyBranding(){const e=this.config?.branding,i=Ii.isDark(e?.theme??"auto");this.setAttribute("data-theme",i?"dark":"light"),e?.primary&&(this.style.setProperty("--authui-primary",e.primary),this.style.setProperty("--authui-primary-foreground",e.primaryForeground??"#ffffff")),e?.radius&&xi[e.radius]&&this.style.setProperty("--authui-radius",xi[e.radius])}fire(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!0}))}};Pt.styles=[ja,Ca];let ye=Pt;Ea([Y()],ye.prototype,"auth");var _a=Object.defineProperty,Ma=Object.getOwnPropertyDescriptor,de=(t,e,i,a)=>{for(var n=a>1?void 0:a?Ma(e,i):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(n=(a?s(e,i,n):s(n))||n);return a&&n&&_a(e,i,n),n};$.AuthUIConfigElement=class extends Le{constructor(){super(...arguments),this.endpoint="",this.project="",this.redirectUrl="",this.successUrl="",this.methods="email-password",this.signUp="true",this.requireName="true",this.mfa="true",this.securityPhrase="true",this.name="",this.logo="",this.theme="auto",this.radius="",this.primary="",this.primaryForeground="",this.termsUrl="",this.privacyUrl=""}connectedCallback(){super.connectedCallback(),this.configure()}updated(){this.configure()}configure(){if(!this.endpoint||!this.project)return;const e=this.toConfig(),i=_.getConfig();i&&JSON.stringify(i)===JSON.stringify(e)||_.configure(e)}toConfig(){const e={oauth:[]};for(const i of this.methods.split(/[\s,]+/).filter(Boolean))i.startsWith("oauth:")?e.oauth.push(i.slice(6)):i==="email-password"?e.emailPassword=!0:i==="magic-url"?e.magicUrl=!0:i==="email-otp"?e.emailOtp=!0:i==="phone"?e.phone=!0:(i==="anonymous"||i==="guest")&&(e.anonymous=!0);return e.emailPassword===void 0&&!this.methods.trim()&&(e.emailPassword=!0),{endpoint:this.endpoint,project:this.project,redirectUrl:this.redirectUrl||void 0,successUrl:this.successUrl||void 0,methods:e,signUp:this.signUp!=="false",requireName:this.requireName!=="false",mfa:this.mfa!=="false",securityPhrase:this.securityPhrase!=="false",branding:{name:this.name||void 0,logo:this.logo||void 0,theme:this.theme||"auto",radius:this.radius||void 0,primary:this.primary||void 0,primaryForeground:this.primaryForeground||void 0},legal:{termsUrl:this.termsUrl||void 0,privacyUrl:this.privacyUrl||void 0}}}},$.AuthUIConfigElement.styles=je`
825
+ :host {
826
+ display: none;
827
+ }
828
+ `,de([ie({type:String})],$.AuthUIConfigElement.prototype,"endpoint",2),de([ie({type:String})],$.AuthUIConfigElement.prototype,"project",2),de([ie({type:String,attribute:"redirect-url"})],$.AuthUIConfigElement.prototype,"redirectUrl",2),de([ie({type:String,attribute:"success-url"})],$.AuthUIConfigElement.prototype,"successUrl",2),de([ie({type:String})],$.AuthUIConfigElement.prototype,"methods",2),de([ie({type:String,attribute:"sign-up"})],$.AuthUIConfigElement.prototype,"signUp",2),de([ie({type:String,attribute:"require-name"})],$.AuthUIConfigElement.prototype,"requireName",2),de([ie({type:String})],$.AuthUIConfigElement.prototype,"mfa",2),de([ie({type:String,attribute:"security-phrase"})],$.AuthUIConfigElement.prototype,"securityPhrase",2),de([ie({type:String})],$.AuthUIConfigElement.prototype,"name",2),de([ie({type:String})],$.AuthUIConfigElement.prototype,"logo",2),de([ie({type:String})],$.AuthUIConfigElement.prototype,"theme",2),de([ie({type:String})],$.AuthUIConfigElement.prototype,"radius",2),de([ie({type:String})],$.AuthUIConfigElement.prototype,"primary",2),de([ie({type:String,attribute:"primary-foreground"})],$.AuthUIConfigElement.prototype,"primaryForeground",2),de([ie({type:String,attribute:"terms-url"})],$.AuthUIConfigElement.prototype,"termsUrl",2),de([ie({type:String,attribute:"privacy-url"})],$.AuthUIConfigElement.prototype,"privacyUrl",2),$.AuthUIConfigElement=de([Ue("authui-config")],$.AuthUIConfigElement);var Ra=Object.defineProperty,La=Object.getOwnPropertyDescriptor,$t=(t,e,i,a)=>{for(var n=a>1?void 0:a?La(e,i):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(n=(a?s(e,i,n):s(n))||n);return a&&n&&Ra(e,i,n),n};if(typeof document<"u"&&!document.getElementById("authui-fouc")){const t=document.createElement("style");t.id="authui-fouc",t.textContent="authui-signed-in:not([ready]),authui-signed-out:not([ready]){display:none}",document.head.appendChild(t)}class St extends Le{constructor(){super(...arguments),this.show=!1,this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this.evaluate(_.getState().status),this.unsubscribe=_.on("change",e=>this.evaluate(e.status))}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.()}evaluate(e){e!=="loading"&&(this.show=this.shouldShow(e),this.setAttribute("ready",""),this.style.display="contents")}render(){return this.show?v`<slot></slot>`:E}}$t([Y()],St.prototype,"show",2),$.AuthUISignedIn=class extends St{shouldShow(e){return e==="signed-in"}},$.AuthUISignedIn=$t([Ue("authui-signed-in")],$.AuthUISignedIn),$.AuthUISignedOut=class extends St{shouldShow(e){return e!=="signed-in"}},$.AuthUISignedOut=$t([Ue("authui-signed-out")],$.AuthUISignedOut);const Na=je`
829
+ :host {
830
+ display: block;
831
+ width: 100%;
832
+ max-width: 420px;
833
+ }
834
+ .panel {
835
+ background: var(--authui-card);
836
+ color: var(--authui-card-foreground);
837
+ border: 1px solid var(--authui-border);
838
+ border-radius: var(--authui-radius-xl);
839
+ padding: 24px;
840
+ display: flex;
841
+ flex-direction: column;
842
+ gap: 20px;
843
+ box-shadow: var(--authui-shadow-lg);
844
+ }
845
+ .panel.embedded {
846
+ border: 0;
847
+ box-shadow: none;
848
+ padding: 0;
849
+ background: transparent;
850
+ }
851
+ .header {
852
+ text-align: center;
853
+ display: flex;
854
+ flex-direction: column;
855
+ gap: 4px;
856
+ }
857
+ .header:empty {
858
+ display: none;
859
+ }
860
+ .alert .dismiss {
861
+ position: absolute;
862
+ top: 4px;
863
+ inset-inline-end: 4px;
864
+ width: 28px;
865
+ height: 28px;
866
+ }
867
+ .alert .dismiss svg {
868
+ width: 14px;
869
+ height: 14px;
870
+ margin: 0;
871
+ }
872
+ `,F=t=>v`<svg
873
+ xmlns="http://www.w3.org/2000/svg"
874
+ viewBox="0 0 24 24"
875
+ fill="none"
876
+ stroke="currentColor"
877
+ stroke-width="2"
878
+ stroke-linecap="round"
879
+ stroke-linejoin="round"
880
+ aria-hidden="true"
881
+ >
882
+ ${t}
883
+ </svg>`,B={mail:F(D`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>`),phone:F(D`<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>`),user:F(D`<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`),userX:F(D`<path d="M2 21a8 8 0 0 1 11.873-7"/><circle cx="10" cy="8" r="5"/><path d="m17 17 5 5"/><path d="m22 17-5 5"/>`),lock:F(D`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`),key:F(D`<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>`),shield:F(D`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>`),shieldCheck:F(D`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>`),smartphone:F(D`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`),monitor:F(D`<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>`),globe:F(D`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`),logOut:F(D`<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" x2="9" y1="12" y2="12"/>`),settings:F(D`<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`),x:F(D`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),check:F(D`<path d="M20 6 9 17l-5-5"/>`),copy:F(D`<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`),eye:F(D`<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>`),eyeOff:F(D`<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/>`),arrowLeft:F(D`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),alert:F(D`<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>`),info:F(D`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),checkCircle:F(D`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),link:F(D`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`),activity:F(D`<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>`),trash:F(D`<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>`),sparkles:F(D`<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>`),refresh:F(D`<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>`),chevronDown:F(D`<path d="m6 9 6 6 6-6"/>`),ghost:F(D`<path d="M9 10h.01"/><path d="M15 10h.01"/><path d="M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z"/>`),qr:F(D`<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>`)},he=(t,e="0 0 24 24")=>v`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${e} aria-hidden="true">${t}</svg>`,qa={google:he(D`<path fill="#4285F4" d="M23.49 12.27c0-.79-.07-1.54-.19-2.27H12v4.51h6.47a5.57 5.57 0 0 1-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z"/><path fill="#34A853" d="M12 24c3.24 0 5.95-1.08 7.93-2.91l-3.86-3c-1.08.72-2.45 1.16-4.07 1.16-3.13 0-5.78-2.11-6.73-4.96H1.29v3.09A11.99 11.99 0 0 0 12 24z"/><path fill="#FBBC05" d="M5.27 14.29A7.2 7.2 0 0 1 4.89 12c0-.8.14-1.57.38-2.29V6.62H1.29A11.97 11.97 0 0 0 0 12c0 1.94.46 3.77 1.29 5.38l3.98-3.09z"/><path fill="#EA4335" d="M12 4.75c1.77 0 3.35.61 4.6 1.8l3.42-3.42C17.95 1.19 15.24 0 12 0 7.31 0 3.26 2.69 1.29 6.62l3.98 3.09C6.22 6.86 8.87 4.75 12 4.75z"/>`),github:he(D`<path fill="currentColor" d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/>`),apple:he(D`<path fill="currentColor" d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/>`),facebook:he(D`<path fill="#1877F2" d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/>`),x:he(D`<path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>`),microsoft:he(D`<path fill="#F25022" d="M1 1h10v10H1z"/><path fill="#7FBA00" d="M13 1h10v10H13z"/><path fill="#00A4EF" d="M1 13h10v10H1z"/><path fill="#FFB900" d="M13 13h10v10H13z"/>`),discord:he(D`<path fill="#5865F2" d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"/>`),gitlab:he(D`<path fill="#FC6D26" d="m23.6 9.593-.033-.086L20.3.98a.851.851 0 0 0-.336-.405.876.876 0 0 0-1.001.054.874.874 0 0 0-.29.44l-2.205 6.748H7.535L5.33 1.069a.857.857 0 0 0-.29-.441.876.876 0 0 0-1.001-.054.86.86 0 0 0-.336.405L.436 9.502l-.032.086a6.066 6.066 0 0 0 2.012 7.01l.011.009.03.021 4.976 3.727 2.462 1.863 1.5 1.132a1.009 1.009 0 0 0 1.22 0l1.5-1.132 2.461-1.863 5.006-3.75.013-.01a6.068 6.068 0 0 0 2.006-7.002z"/>`),linkedin:he(D`<path fill="#0A66C2" d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/>`),slack:he(D`<path fill="#E01E5A" d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z"/><path fill="#36C5F0" d="M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z"/><path fill="#2EB67D" d="M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zm-1.27 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.163 0a2.528 2.528 0 0 1 2.523 2.522v6.312z"/><path fill="#ECB22E" d="M15.163 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.163 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zm0-1.27a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.315A2.527 2.527 0 0 1 24 15.163a2.528 2.528 0 0 1-2.522 2.523h-6.315z"/>`),twitch:he(D`<path fill="#9146FF" d="M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0 1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z"/>`),spotify:he(D`<path fill="#1DB954" d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z"/>`),notion:he(D`<path fill="currentColor" d="M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"/>`),dropbox:he(D`<path fill="#0061FF" d="M6 1.807 0 5.629l6 3.822 6.001-3.822L6 1.807zm12 0-6 3.822 6 3.822 6-3.822-6-3.822zM0 13.274l6 3.822 6.001-3.822L6 9.452l-6 3.822zm18-3.822-6 3.822 6 3.822 6-3.822-6-3.822zM6 18.371l6.001 3.822 6-3.822-6-3.822L6 18.371z"/>`),figma:he(D`<path fill="#F24E1E" d="M8 24a4 4 0 0 0 4-4v-4H8a4 4 0 0 0 0 8z"/><path fill="#A259FF" d="M4 12a4 4 0 0 1 4-4h4v8H8a4 4 0 0 1-4-4z"/><path fill="#FF7262" d="M4 4a4 4 0 0 1 4-4h4v8H8a4 4 0 0 1-4-4z"/><path fill="#1ABCFE" d="M12 0h4a4 4 0 0 1 0 8h-4V0z"/><path fill="#0ACF83" d="M20 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0z"/>`),bitbucket:he(D`<path fill="#2684FF" d="M.778 1.213a.768.768 0 0 0-.768.892l3.263 19.81c.084.5.515.868 1.022.873H19.95a.772.772 0 0 0 .77-.646l3.27-20.03a.768.768 0 0 0-.768-.891zM14.52 15.53H9.522L8.17 8.466h7.561z"/>`),amazon:he(D`<path fill="currentColor" d="M.045 18.02c.072-.116.187-.124.348-.022 3.636 2.11 7.594 3.166 11.87 3.166 2.852 0 5.668-.533 8.447-1.595l.315-.14c.138-.06.234-.1.293-.13.226-.088.39-.046.525.13.12.174.09.336-.12.48-.256.19-.6.41-1.006.654-1.244.743-2.64 1.316-4.185 1.726a17.617 17.617 0 0 1-10.951-.577 17.88 17.88 0 0 1-5.43-3.35c-.1-.074-.151-.15-.151-.22 0-.047.021-.09.051-.13zm6.565-6.218c0-1.005.247-1.863.743-2.577.495-.71 1.17-1.25 2.04-1.615.796-.335 1.756-.575 2.912-.72.39-.046 1.033-.103 1.92-.174v-.37c0-.93-.105-1.558-.3-1.875-.302-.43-.78-.65-1.44-.65h-.182c-.48.046-.896.196-1.246.46-.35.27-.575.63-.675 1.096-.06.3-.206.465-.435.51l-2.52-.315c-.248-.06-.372-.18-.372-.39 0-.046.007-.09.022-.15.247-1.29.855-2.25 1.82-2.88.976-.616 2.1-.975 3.39-1.05h.54c1.65 0 2.957.434 3.888 1.29.135.15.27.3.405.48.12.165.224.314.283.45.075.134.15.33.195.57.06.254.105.42.135.51.03.104.062.3.076.615.01.313.02.493.02.553v5.28c0 .376.06.72.165 1.036.105.313.21.54.315.674l.51.674c.09.136.136.256.136.36 0 .12-.06.226-.18.314-1.2 1.05-1.86 1.62-1.963 1.71-.165.135-.373.15-.61.045a6.62 6.62 0 0 1-.526-.496l-.31-.347a9.858 9.858 0 0 1-.317-.42l-.3-.435c-.81.886-1.603 1.44-2.4 1.665-.494.15-1.093.227-1.83.227-1.11 0-2.04-.343-2.76-1.034-.72-.69-1.08-1.665-1.08-2.94l-.05-.076zm3.753-.438c0 .566.14 1.02.425 1.364.285.34.675.512 1.155.512.045 0 .106-.007.195-.02.09-.016.134-.023.166-.023.614-.16 1.08-.553 1.424-1.178.165-.28.285-.58.36-.91.09-.32.12-.59.135-.8.015-.195.015-.54.015-1.005v-.54c-.84 0-1.484.06-1.92.18-1.275.36-1.92 1.17-1.92 2.43l-.035-.01zm9.162 7.027c.03-.06.075-.11.132-.17.362-.243.714-.41 1.05-.5a8.094 8.094 0 0 1 1.612-.24c.14-.012.28 0 .41.03.65.06 1.05.168 1.172.33.063.09.099.228.099.39v.15c0 .51-.149 1.11-.424 1.8-.278.69-.664 1.248-1.156 1.68-.073.06-.14.09-.197.09-.03 0-.06 0-.09-.012-.09-.044-.107-.12-.064-.24.54-1.26.806-2.143.806-2.64 0-.15-.03-.27-.087-.344-.145-.166-.55-.257-1.224-.257-.243 0-.533.016-.87.045-.363.045-.7.09-1 .135-.09 0-.148-.014-.18-.044-.03-.03-.036-.06-.02-.106 0-.014.007-.03.02-.06z"/>`),paypal:he(D`<path fill="#003087" d="M7.076 21.337H2.47a.641.641 0 0 1-.633-.74L4.944.901C5.026.382 5.474 0 5.998 0h7.46c2.57 0 4.578.543 5.69 1.81 1.01 1.15 1.304 2.42 1.012 4.287-.023.143-.047.288-.077.437-.983 5.05-4.349 6.797-8.647 6.797h-2.19c-.524 0-.968.382-1.05.9l-1.12 7.106zm14.146-14.42a3.35 3.35 0 0 0-.607-.541c-.013.076-.026.175-.041.254-.93 4.778-4.005 7.201-9.138 7.201h-2.19a.563.563 0 0 0-.556.479l-1.187 7.527h-.506l-.24 1.516a.56.56 0 0 0 .554.647h3.882c.46 0 .85-.334.922-.788.06-.26.76-4.852.816-5.09a.932.932 0 0 1 .923-.788h.58c3.76 0 6.705-1.528 7.565-5.946.36-1.847.174-3.388-.777-4.471z"/>`)};function It(t){return qa[t]??B.globe}var Ba=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,we=(t,e,i,a)=>{for(var n=a>1?void 0:a?Ha(e,i):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(n=(a?s(e,i,n):s(n))||n);return a&&n&&Ba(e,i,n),n};$.AuthUISignIn=class extends ye{constructor(){super(...arguments),this.view="sign-in",this.embedded=!1,this.step="sign-in",this.busy=!1,this.error="",this.notice=null,this.showPassword=!1,this.token=null,this.challenge=null,this.recovery=null,this.email="",this.password="",this.passwordConfirm="",this.name="",this.phone="",this.code="",this.onSignIn=e=>{e.preventDefault(),this.run(async()=>{await _.signInWithEmailPassword(this.email,this.password),this.password="",this.fire("authui-success",{method:"email-password"})})},this.onSignUp=e=>{e.preventDefault(),this.run(async()=>{await _.signUp(this.email,this.password,this.name),this.password="",this.fire("authui-success",{method:"sign-up"})})},this.onGuest=()=>{this.run(async()=>{await _.signInAnonymously(),this.fire("authui-success",{method:"anonymous"})})},this.onOAuth=e=>{this.run(async()=>{_.signInWithOAuth(e),await new Promise(i=>setTimeout(i,4e3))})},this.onForgot=e=>{e.preventDefault(),this.run(async()=>{await _.sendPasswordRecovery(this.email),this.notice={tone:"success",message:this.t("resetLinkSent",{email:this.email})}})},this.onReset=e=>{if(e.preventDefault(),this.password!==this.passwordConfirm){this.error=this.t("errorPasswordMismatch");return}const i=this.recovery;i&&this.run(async()=>{await _.completePasswordRecovery(i.userId,i.secret,this.password),this.password="",this.passwordConfirm="",this.recovery=null,this.notice={tone:"success",message:this.t("passwordUpdated")},this.go("sign-in")})},this.onMagicUrl=e=>{e.preventDefault(),this.run(async()=>{const i=await _.sendMagicUrl(this.email);this.token={userId:i.userId,kind:"magic-url",target:this.email,phrase:i.phrase}})},this.onEmailOtp=e=>{e.preventDefault(),this.run(async()=>{const i=await _.sendEmailOtp(this.email);this.token={userId:i.userId,kind:"email-otp",target:this.email,phrase:i.phrase},this.code=""})},this.onPhoneOtp=e=>{e.preventDefault(),this.run(async()=>{const i=await _.sendPhoneOtp(this.phone);this.token={userId:i.userId,kind:"phone",target:this.phone},this.code=""})},this.onVerifyCode=e=>{e.preventDefault();const i=this.token;i&&this.run(async()=>{await _.signInWithToken(i.userId,this.code),this.code="",this.fire("authui-success",{method:i.kind})},"code")},this.onChooseFactor=e=>{this.run(async()=>{const i=await _.createMfaChallenge(e);this.challenge={id:i.$id,factor:e},this.code=""})},this.onVerifyFactor=e=>{e.preventDefault();const i=this.challenge;i&&this.run(async()=>{await _.completeMfaChallenge(i.id,this.code),this.code="",this.challenge=null,this.fire("authui-success",{method:"mfa"})},"code")},this.onCancelMfa=()=>{this.run(async()=>{try{await _.signOut()}catch(e){if(!ct(e,se.sessionNotFound))throw e}this.go("sign-in")})},this.onSignOut=()=>{this.run(()=>_.signOut())}}connectedCallback(){super.connectedCallback(),this.step=this.view,this.syncFromStore()}willUpdate(e){e.has("view")&&e.get("view")!==void 0&&this.go(this.view),e.has("auth")&&this.syncFromStore()}updated(e){e.has("step")&&requestAnimationFrame(()=>this.firstInput?.focus())}syncFromStore(){const{status:e,pending:i}=this.auth;e==="mfa-required"&&this.step!=="mfa"&&this.go("mfa"),i?.type==="reset-password"&&this.step!=="reset-password"&&(this.recovery={userId:i.userId,secret:i.secret},this.go("reset-password")),i?.type==="oauth-failed"&&(this.notice={tone:"error",message:this.t("errorOAuth")},_.setPending(null)),i?.type==="notice"&&(this.notice={tone:i.tone==="error"?"error":i.tone,message:i.message},_.setPending(null))}go(e){this.step=e,this.error="",this.busy=!1,this.showPassword=!1,e!=="mfa"&&(this.challenge=null),e!=="email-otp"&&e!=="phone"&&e!=="magic-url"&&(this.token=null),this.fire("authui-view",{view:e})}async run(e,i="link"){if(!this.busy){this.busy=!0,this.error="";try{await e()}catch(a){this.error=At(a,this.strings,i)}finally{this.busy=!1}}}bind(e){return i=>{this[e]=i.target.value}}render(){const e=this.renderStep();return v`
884
+ <div class="panel ${this.embedded?"embedded":""}" part="panel">
885
+ ${this.renderHeader()}
886
+ ${this.notice?v`<div class="alert alert-${this.notice.tone}" role="status">
887
+ ${this.notice.tone==="success"?B.checkCircle:this.notice.tone==="error"?B.alert:B.info}
888
+ <div class="alert-body">${this.notice.message}</div>
889
+ <button
890
+ class="btn btn-ghost btn-icon dismiss"
891
+ @click=${()=>this.notice=null}
892
+ aria-label=${this.t("close")}
893
+ >
894
+ ${B.x}
895
+ </button>
896
+ </div>`:E}
897
+ ${e}
898
+ </div>
899
+ `}renderHeader(){const e=this.config?.branding?.logo,i=this.productName;let a="",n="";switch(this.step){case"sign-in":a=this.auth.status==="signed-in"?this.t("signedInAs"):i?this.t("signInTitle",{name:i}):this.t("welcomeBack");break;case"sign-up":a=i?this.t("signUpTitle",{name:i}):this.t("createAccount");break;case"forgot-password":case"reset-password":a=this.t("resetPassword");break;case"magic-url":case"email-otp":a=this.t("continueWithEmail");break;case"phone":a=this.t("continueWithPhone");break;case"mfa":a=this.t("mfaTitle"),n=this.t("mfaDescription");break}return v`
900
+ <header class="header">
901
+ ${e?v`<img class="logo" src=${e} alt=${i||"Logo"} />`:E}
902
+ <h2 class="title" id="authui-title">${a}</h2>
903
+ ${n?v`<p class="description">${n}</p>`:E}
904
+ </header>
905
+ `}renderError(){return this.error?v`<div class="alert alert-error" role="alert">
906
+ ${B.alert}
907
+ <div class="alert-body">${this.error}</div>
908
+ </div>`:E}submitButton(e,i="btn-primary"){return v`<button class="btn ${i} btn-block" type="submit" ?disabled=${this.busy}>
909
+ ${this.busy?v`<span class="spinner" aria-hidden="true"></span>`:E} ${e}
910
+ </button>`}passwordField(e){return v`
911
+ <div class="field">
912
+ <label class="label" for=${e.id}>
913
+ ${e.label}
914
+ ${e.forgot?v`<button
915
+ type="button"
916
+ class="btn btn-link small"
917
+ @click=${()=>this.go("forgot-password")}
918
+ >
919
+ ${this.t("forgotPassword")}
920
+ </button>`:E}
921
+ </label>
922
+ <div class="input-wrap">
923
+ <input
924
+ class="input"
925
+ id=${e.id}
926
+ type=${this.showPassword?"text":"password"}
927
+ autocomplete=${e.autocomplete}
928
+ required
929
+ minlength="8"
930
+ .value=${this[e.field]}
931
+ @input=${this.bind(e.field)}
932
+ />
933
+ <button
934
+ type="button"
935
+ class="btn btn-ghost btn-icon"
936
+ @click=${()=>this.showPassword=!this.showPassword}
937
+ aria-label=${this.showPassword?"Hide password":"Show password"}
938
+ tabindex="-1"
939
+ >
940
+ ${this.showPassword?B.eyeOff:B.eye}
941
+ </button>
942
+ </div>
943
+ ${e.hint?v`<p class="hint">${e.hint}</p>`:E}
944
+ </div>
945
+ `}emailField(e="email"){return v`
946
+ <div class="field">
947
+ <label class="label" for="authui-email">${this.t("email")}</label>
948
+ <input
949
+ class="input"
950
+ id="authui-email"
951
+ type="email"
952
+ autocomplete=${e}
953
+ required
954
+ inputmode="email"
955
+ .value=${this.email}
956
+ @input=${this.bind("email")}
957
+ />
958
+ </div>
959
+ `}codeField(){return v`
960
+ <div class="field">
961
+ <label class="label" for="authui-code">${this.t("code")}</label>
962
+ <input
963
+ class="input input-otp"
964
+ id="authui-code"
965
+ type="text"
966
+ inputmode="numeric"
967
+ autocomplete="one-time-code"
968
+ required
969
+ .value=${this.code}
970
+ @input=${this.bind("code")}
971
+ />
972
+ </div>
973
+ `}legal(){const e=this.config?.legal;return!e?.termsUrl&&!e?.privacyUrl?E:v`<p class="legal">
974
+ ${this.t("agreeTo")}
975
+ ${e.termsUrl?v`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>`:E}
976
+ ${e.termsUrl&&e.privacyUrl?v` ${this.t("and")} `:E}
977
+ ${e.privacyUrl?v`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>`:E}.
978
+ </p>`}backLink(e="sign-in"){return v`<div class="links">
979
+ <button type="button" class="btn btn-link" @click=${()=>this.go(e)}>
980
+ ${B.arrowLeft} ${this.t("back")}
981
+ </button>
982
+ </div>`}renderStep(){if(!this.auth.configured)return v`<div class="alert alert-error" role="alert">
983
+ ${B.alert}
984
+ <div class="alert-body">${this.t("errorNotConfigured")}</div>
985
+ </div>`;if(this.auth.status==="loading")return v`<div class="empty"><span class="spinner"></span></div>`;if(this.auth.status==="signed-in"&&this.step!=="mfa")return this.renderSignedIn();switch(this.step){case"sign-up":return this.renderSignUp();case"forgot-password":return this.renderForgot();case"reset-password":return this.renderReset();case"magic-url":return this.renderMagicUrl();case"email-otp":return this.renderEmailOtp();case"phone":return this.renderPhone();case"mfa":return this.renderMfa();default:return this.renderSignIn()}}renderSignedIn(){const e=this.auth.user,i=e.name||e.email||e.phone||this.t("guestAccount");return v`
986
+ <div class="stack">
987
+ <div class="row">
988
+ <div class="inline">
989
+ <span class="avatar">${i[0]??"?"}</span>
990
+ <div class="row-main">
991
+ <span class="row-title">${i}</span>
992
+ ${e.email&&e.name?v`<span class="row-sub">${e.email}</span>`:E}
993
+ </div>
994
+ </div>
995
+ </div>
996
+ ${this.renderError()}
997
+ <div class="stack-sm">
998
+ ${this.config?.successUrl?v`<a class="btn btn-primary btn-block" href=${this.config.successUrl}
999
+ >${this.t("continue")}</a
1000
+ >`:E}
1001
+ <button
1002
+ class="btn btn-outline btn-block"
1003
+ @click=${()=>this.fire("authui-open",{view:"account"})}
1004
+ >
1005
+ ${B.settings} ${this.t("manageAccount")}
1006
+ </button>
1007
+ <button class="btn btn-ghost btn-block" @click=${this.onSignOut} ?disabled=${this.busy}>
1008
+ ${B.logOut} ${this.t("signOut")}
1009
+ </button>
1010
+ </div>
1011
+ </div>
1012
+ `}renderProviders(){const e=this.config?.methods?.oauth??[];if(e.length===0)return E;const i=e.length>2;return v`
1013
+ <div class="providers ${i?"two":""}">
1014
+ ${e.map(a=>v`<button
1015
+ type="button"
1016
+ class="btn btn-outline"
1017
+ @click=${()=>this.onOAuth(a)}
1018
+ ?disabled=${this.busy}
1019
+ aria-label=${this.t("continueWith",{provider:Ve(a)})}
1020
+ >
1021
+ ${It(a)}
1022
+ <span
1023
+ >${i?Ve(a):this.t("continueWith",{provider:Ve(a)})}</span
1024
+ >
1025
+ </button>`)}
1026
+ </div>
1027
+ `}renderSignIn(){const e=this.config?.methods??{},i=e.emailPassword!==!1,a=(e.oauth?.length??0)>0,n=[e.magicUrl?{step:"magic-url",icon:B.link,label:this.t("sendMagicLink")}:null,e.emailOtp?{step:"email-otp",icon:B.mail,label:this.t("continueWithEmail")}:null,e.phone?{step:"phone",icon:B.smartphone,label:this.t("continueWithPhone")}:null].filter(Boolean);return v`
1028
+ <div class="stack">
1029
+ ${this.renderProviders()}
1030
+ ${a&&(i||n.length>0)?v`<div class="separator-text">${this.t("or")}</div>`:E}
1031
+ ${i?v`<form class="form" @submit=${this.onSignIn} novalidate>
1032
+ ${this.emailField()}
1033
+ ${this.passwordField({label:this.t("password"),autocomplete:"current-password",id:"authui-password",field:"password",forgot:!0})}
1034
+ ${this.renderError()} ${this.submitButton(this.t("signIn"))}
1035
+ </form>`:this.renderError()}
1036
+ ${n.length>0?v`<div class="stack-sm">
1037
+ ${n.map(r=>v`<button
1038
+ type="button"
1039
+ class="btn btn-secondary btn-block"
1040
+ @click=${()=>this.go(r.step)}
1041
+ >
1042
+ ${r.icon} ${r.label}
1043
+ </button>`)}
1044
+ </div>`:E}
1045
+ ${e.anonymous?v`<button
1046
+ type="button"
1047
+ class="btn btn-ghost btn-block"
1048
+ @click=${this.onGuest}
1049
+ ?disabled=${this.busy}
1050
+ >
1051
+ ${B.ghost} ${this.t("continueAsGuest")}
1052
+ </button>`:E}
1053
+ ${i&&this.config?.signUp!==!1?v`<div class="links">
1054
+ <span>${this.t("noAccount")}</span>
1055
+ <button type="button" class="btn btn-link" @click=${()=>this.go("sign-up")}>
1056
+ ${this.t("signUp")}
1057
+ </button>
1058
+ </div>`:E}
1059
+ ${this.legal()}
1060
+ </div>
1061
+ `}renderSignUp(){return v`
1062
+ <div class="stack">
1063
+ ${this.renderProviders()}
1064
+ ${(this.config?.methods?.oauth?.length??0)>0?v`<div class="separator-text">${this.t("or")}</div>`:E}
1065
+ <form class="form" @submit=${this.onSignUp} novalidate>
1066
+ ${this.config?.requireName!==!1?v`<div class="field">
1067
+ <label class="label" for="authui-name">${this.t("name")}</label>
1068
+ <input
1069
+ class="input"
1070
+ id="authui-name"
1071
+ type="text"
1072
+ autocomplete="name"
1073
+ required
1074
+ .value=${this.name}
1075
+ @input=${this.bind("name")}
1076
+ />
1077
+ </div>`:E}
1078
+ ${this.emailField()}
1079
+ ${this.passwordField({label:this.t("password"),autocomplete:"new-password",id:"authui-password",field:"password",hint:this.t("passwordHint")})}
1080
+ ${this.renderError()} ${this.submitButton(this.t("createAccount"))}
1081
+ </form>
1082
+ <div class="links">
1083
+ <span>${this.t("haveAccount")}</span>
1084
+ <button type="button" class="btn btn-link" @click=${()=>this.go("sign-in")}>
1085
+ ${this.t("signIn")}
1086
+ </button>
1087
+ </div>
1088
+ ${this.legal()}
1089
+ </div>
1090
+ `}renderForgot(){return v`
1091
+ <div class="stack">
1092
+ <form class="form" @submit=${this.onForgot} novalidate>
1093
+ ${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendResetLink"))}
1094
+ </form>
1095
+ ${this.backLink()}
1096
+ </div>
1097
+ `}renderReset(){return this.recovery?v`
1098
+ <div class="stack">
1099
+ <form class="form" @submit=${this.onReset} novalidate>
1100
+ ${this.passwordField({label:this.t("newPassword"),autocomplete:"new-password",id:"authui-password",field:"password",hint:this.t("passwordHint")})}
1101
+ ${this.passwordField({label:this.t("confirmPassword"),autocomplete:"new-password",id:"authui-password-confirm",field:"passwordConfirm"})}
1102
+ ${this.renderError()} ${this.submitButton(this.t("resetPassword"))}
1103
+ </form>
1104
+ ${this.backLink()}
1105
+ </div>
1106
+ `:v`<div class="stack">
1107
+ <div class="alert alert-error" role="alert">
1108
+ ${B.alert}
1109
+ <div class="alert-body">${this.t("errorInvalidToken")}</div>
1110
+ </div>
1111
+ ${this.backLink()}
1112
+ </div>`}phraseBox(e){return e?v`<div class="alert alert-info">
1113
+ ${B.shield}
1114
+ <div class="alert-title">
1115
+ ${this.t("securityPhrase")}: <span class="code">${e}</span>
1116
+ </div>
1117
+ <div class="alert-body">${this.t("securityPhraseHint")}</div>
1118
+ </div>`:E}renderMagicUrl(){return this.token?v`<div class="stack">
1119
+ <div class="alert alert-success" role="status">
1120
+ ${B.mail}
1121
+ <div class="alert-body">${this.t("magicLinkSent",{email:this.token.target})}</div>
1122
+ </div>
1123
+ ${this.phraseBox(this.token.phrase)} ${this.backLink()}
1124
+ </div>`:v`
1125
+ <div class="stack">
1126
+ <form class="form" @submit=${this.onMagicUrl} novalidate>
1127
+ ${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendMagicLink"))}
1128
+ </form>
1129
+ ${this.backLink()}
1130
+ </div>
1131
+ `}renderCodeEntry(){return v`
1132
+ <div class="alert alert-info" role="status">
1133
+ ${B.mail}
1134
+ <div class="alert-body">${this.t("codeSent",{target:this.token.target})}</div>
1135
+ </div>
1136
+ ${this.phraseBox(this.token.phrase)}
1137
+ <form class="form" @submit=${this.onVerifyCode} novalidate>
1138
+ ${this.codeField()} ${this.renderError()} ${this.submitButton(this.t("verifyCode"))}
1139
+ </form>
1140
+ <div class="links">
1141
+ <button type="button" class="btn btn-link" @click=${()=>this.token=null}>
1142
+ ${this.t("sendCode")}
1143
+ </button>
1144
+ <span aria-hidden="true">·</span>
1145
+ <button type="button" class="btn btn-link" @click=${()=>this.go("sign-in")}>
1146
+ ${this.t("back")}
1147
+ </button>
1148
+ </div>
1149
+ `}renderEmailOtp(){return this.token?v`<div class="stack">${this.renderCodeEntry()}</div>`:v`
1150
+ <div class="stack">
1151
+ <form class="form" @submit=${this.onEmailOtp} novalidate>
1152
+ ${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendCode"))}
1153
+ </form>
1154
+ ${this.backLink()}
1155
+ </div>
1156
+ `}renderPhone(){return this.token?v`<div class="stack">${this.renderCodeEntry()}</div>`:v`
1157
+ <div class="stack">
1158
+ <form class="form" @submit=${this.onPhoneOtp} novalidate>
1159
+ <div class="field">
1160
+ <label class="label" for="authui-phone">${this.t("phone")}</label>
1161
+ <input
1162
+ class="input"
1163
+ id="authui-phone"
1164
+ type="tel"
1165
+ autocomplete="tel"
1166
+ placeholder="+1 555 000 0000"
1167
+ required
1168
+ .value=${this.phone}
1169
+ @input=${this.bind("phone")}
1170
+ />
1171
+ </div>
1172
+ ${this.renderError()} ${this.submitButton(this.t("sendCode"))}
1173
+ </form>
1174
+ ${this.backLink()}
1175
+ </div>
1176
+ `}renderMfa(){const e=this.auth.mfaFactors;if(!this.challenge){const a=[{factor:"totp",icon:B.smartphone,label:this.t("mfaUseAuthenticator"),available:e?.totp??!0},{factor:"email",icon:B.mail,label:this.t("mfaUseEmail"),available:e?.email??!0},{factor:"phone",icon:B.phone,label:this.t("mfaUsePhone"),available:e?.phone??!0},{factor:"recoverycode",icon:B.key,label:this.t("mfaUseRecoveryCode"),available:e?.recoveryCode??!0}];return v`
1177
+ <div class="stack">
1178
+ <div class="stack-sm">
1179
+ ${a.filter(n=>n.available).map(n=>v`<button
1180
+ type="button"
1181
+ class="choice"
1182
+ @click=${()=>this.onChooseFactor(n.factor)}
1183
+ ?disabled=${this.busy}
1184
+ >
1185
+ ${n.icon}<span class="choice-title">${n.label}</span>
1186
+ </button>`)}
1187
+ </div>
1188
+ ${this.renderError()}
1189
+ <div class="links">
1190
+ <button type="button" class="btn btn-link" @click=${this.onCancelMfa}>
1191
+ ${this.t("cancel")}
1192
+ </button>
1193
+ </div>
1194
+ </div>
1195
+ `}const i=this.challenge.factor==="recoverycode";return v`
1196
+ <div class="stack">
1197
+ <form class="form" @submit=${this.onVerifyFactor} novalidate>
1198
+ ${i?v`<div class="field">
1199
+ <label class="label" for="authui-code">${this.t("recoveryCode")}</label>
1200
+ <input
1201
+ class="input mono"
1202
+ id="authui-code"
1203
+ type="text"
1204
+ autocomplete="off"
1205
+ required
1206
+ .value=${this.code}
1207
+ @input=${this.bind("code")}
1208
+ />
1209
+ </div>`:this.codeField()}
1210
+ ${this.renderError()} ${this.submitButton(this.t("verifyCode"))}
1211
+ </form>
1212
+ <div class="links">
1213
+ <button type="button" class="btn btn-link" @click=${()=>this.challenge=null}>
1214
+ ${B.arrowLeft} ${this.t("back")}
1215
+ </button>
1216
+ <span aria-hidden="true">·</span>
1217
+ <button type="button" class="btn btn-link" @click=${this.onCancelMfa}>
1218
+ ${this.t("cancel")}
1219
+ </button>
1220
+ </div>
1221
+ </div>
1222
+ `}},$.AuthUISignIn.styles=[...ye.styles,Na],we([ie({type:String})],$.AuthUISignIn.prototype,"view",2),we([ie({type:Boolean})],$.AuthUISignIn.prototype,"embedded",2),we([Y()],$.AuthUISignIn.prototype,"step",2),we([Y()],$.AuthUISignIn.prototype,"busy",2),we([Y()],$.AuthUISignIn.prototype,"error",2),we([Y()],$.AuthUISignIn.prototype,"notice",2),we([Y()],$.AuthUISignIn.prototype,"showPassword",2),we([Y()],$.AuthUISignIn.prototype,"token",2),we([Y()],$.AuthUISignIn.prototype,"challenge",2),we([Y()],$.AuthUISignIn.prototype,"recovery",2),we([Tt("form input:not([type=hidden])")],$.AuthUISignIn.prototype,"firstInput",2),$.AuthUISignIn=we([Ue("authui-sign-in")],$.AuthUISignIn);var Da=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,ee=(t,e,i,a)=>{for(var n=a>1?void 0:a?Va(e,i):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(n=(a?s(e,i,n):s(n))||n);return a&&n&&Da(e,i,n),n};$.AuthUIAccount=class extends ye{constructor(){super(...arguments),this.embedded=!1,this.tab="profile",this.active="profile",this.busy="",this.notice=null,this.errors={},this.nameInput="",this.emailInput="",this.emailPassword="",this.phoneInput="",this.phonePassword="",this.phoneCode="",this.phoneCodeSent=!1,this.guestName="",this.oldPassword="",this.newPassword="",this.newPasswordConfirm="",this.authenticator=null,this.authenticatorCode="",this.factors=null,this.recoveryCodes=null,this.stepUp=null,this.stepUpCode="",this.copied=!1,this.sessions=null,this.identities=null,this.logs=null,this.logsSupported=!0,this.confirmDelete=!1,this.factorsLoading=!1,this.onUpdateName=e=>{e.preventDefault(),this.run("name",()=>_.updateName(this.nameInput),this.t("done"))},this.onUpdateEmail=e=>{e.preventDefault(),this.run("email",async()=>{await _.updateEmail(this.emailInput,this.emailPassword),this.emailPassword=""},this.t("done"))},this.onUpdatePhone=e=>{e.preventDefault(),this.run("phone",async()=>{await _.updatePhone(this.phoneInput,this.phonePassword),this.phonePassword=""},this.t("done"))},this.onConvertGuest=e=>{e.preventDefault(),this.run("guest",async()=>{await _.convertGuest(this.emailInput,this.emailPassword,this.guestName),this.emailPassword=""},this.t("done"))},this.onSendVerification=()=>{this.run("verify",()=>_.sendEmailVerification(),this.t("verificationSent"))},this.onSendPhoneVerification=()=>{this.run("verify-phone",async()=>{await _.sendPhoneVerification(),this.phoneCodeSent=!0})},this.onConfirmPhoneVerification=e=>{e.preventDefault(),this.run("verify-phone-code",async()=>{await _.confirmPhoneVerification(this.phoneCode),this.phoneCode="",this.phoneCodeSent=!1},this.t("done"))},this.onChangePassword=e=>{if(e.preventDefault(),this.newPassword!==this.newPasswordConfirm){this.errors={...this.errors,password:this.t("errorPasswordMismatch")};return}this.run("password",async()=>{await _.updatePassword(this.newPassword,this.oldPassword),this.oldPassword=this.newPassword=this.newPasswordConfirm=""},this.t("passwordUpdated"))},this.onToggleMfa=()=>{const e=!this.user?.mfa;this.run("mfa",async()=>{await _.setMfaEnabled(e),await this.loadFactors()})},this.onAddAuthenticator=()=>{this.run("authenticator",async()=>{this.authenticator=await _.addAuthenticator(),this.authenticatorCode=""})},this.onVerifyAuthenticator=e=>{e.preventDefault(),this.run("authenticator-code",async()=>{await _.verifyAuthenticator(this.authenticatorCode),this.authenticator=null,this.authenticatorCode="",await this.loadFactors()},this.t("done"))},this.onRemoveAuthenticator=()=>{this.run("remove-authenticator",async()=>{await _.removeAuthenticator(),await this.loadFactors()})},this.onRecoveryCodes=()=>{this.run("recovery",async()=>{try{this.recoveryCodes=await _.createRecoveryCodes()}catch(e){if(!ct(e,se.recoveryCodesExist))throw e;this.recoveryCodes=await _.getRecoveryCodes()}await this.loadFactors()})},this.onRegenerateRecoveryCodes=()=>{this.run("recovery",async()=>{this.recoveryCodes=await _.regenerateRecoveryCodes()})},this.onCopyCodes=async()=>{if(this.recoveryCodes)try{await navigator.clipboard.writeText(this.recoveryCodes.join(`
1223
+ `)),this.copied=!0,setTimeout(()=>this.copied=!1,1500)}catch{}},this.onStepUpFactor=e=>{this.run("stepup",async()=>{const i=await _.createMfaChallenge(e);this.stepUp={...this.stepUp,challenge:{id:i.$id,factor:e}},this.stepUpCode=""})},this.onStepUpVerify=e=>{e.preventDefault();const i=this.stepUp;i?.challenge&&this.run("stepup-code",async()=>{await _.completeMfaChallenge(i.challenge.id,this.stepUpCode,{signIn:!1}),this.stepUp=null,this.stepUpCode="",await i.retry()})},this.onDeleteSession=e=>{this.run(`session-${e}`,async()=>{await _.signOut(e),this.sessions=(this.sessions??[]).filter(i=>i.$id!==e)})},this.onSignOutAll=()=>{this.run("sessions-all",()=>_.signOutEverywhere())},this.onDeleteIdentity=e=>{this.run(`identity-${e}`,async()=>{await _.deleteIdentity(e),this.identities=(this.identities??[]).filter(i=>i.$id!==e)})},this.onDeleteAccount=()=>{this.run("delete",()=>_.deleteAccount())}}connectedCallback(){super.connectedCallback(),this.active=this.tab,this.hydrate()}willUpdate(e){e.has("tab")&&e.get("tab")!==void 0&&(this.active=this.tab),e.has("auth")&&this.hydrate(),this.ensureLoaded()}ensureLoaded(){!this.user||this.busy||(this.active==="sessions"&&this.sessions===null?this.loadSessions():this.active==="connections"&&this.identities===null?this.loadIdentities():this.active==="activity"&&this.logs===null?this.loadLogs():this.active==="security"&&this.factors===null&&this.loadFactors())}hydrate(){const e=this.auth.user;e&&(this.nameInput||(this.nameInput=e.name??""),this.emailInput||(this.emailInput=e.email??""),this.phoneInput||(this.phoneInput=e.phone??""))}get user(){return this.auth.user}get isGuest(){const e=this.user;return!!e&&!e.email&&!e.phone}select(e){this.active=e,this.notice=null,this.errors={}}async run(e,i,a){if(!this.busy){this.busy=e,this.errors={...this.errors,[e]:""};try{await i(),a&&(this.notice={tone:"success",message:a})}catch(n){ct(n,se.challengeRequired)?this.stepUp={retry:()=>this.run(e,i,a)}:this.errors={...this.errors,[e]:At(n,this.strings,e.includes("code")?"code":"link")}}finally{this.busy=""}}}async loadSessions(){await this.run("sessions",async()=>{this.sessions=await _.listSessions()})}async loadIdentities(){await this.run("identities",async()=>{this.identities=await _.listIdentities()})}async loadLogs(){this.busy="logs";try{this.logs=await _.listLogs()}catch{this.logsSupported=!1,this.logs=[]}finally{this.busy=""}}async loadFactors(){if(!this.factorsLoading){this.factorsLoading=!0;try{this.factors=await _.listMfaFactors()}catch{this.factors={totp:!1,phone:!1,email:!1,recoveryCode:!1,custom:!1}}finally{this.factorsLoading=!1}}}bind(e){return i=>{this[e]=i.target.value}}render(){if(!this.auth.configured)return v`<div class="alert alert-error" role="alert">
1224
+ ${B.alert}
1225
+ <div class="alert-body">${this.t("errorNotConfigured")}</div>
1226
+ </div>`;if(this.auth.status==="loading")return v`<div class="empty"><span class="spinner"></span></div>`;if(!this.user)return v`<div class="panel ${this.embedded?"embedded":""}">
1227
+ <authui-sign-in embedded></authui-sign-in>
1228
+ </div>`;const e=[{id:"profile",label:this.t("profile")},{id:"security",label:this.t("security")},{id:"sessions",label:this.t("sessions")},{id:"connections",label:this.t("connections")},...this.logsSupported?[{id:"activity",label:this.t("activity")}]:[]];return v`
1229
+ <div class="panel ${this.embedded?"embedded":""}" part="panel">
1230
+ ${this.renderIdentity()}
1231
+ <div class="tabs" role="tablist">
1232
+ ${e.map(i=>v`<button
1233
+ class="tab"
1234
+ role="tab"
1235
+ aria-selected=${this.active===i.id?"true":"false"}
1236
+ @click=${()=>this.select(i.id)}
1237
+ >
1238
+ ${i.label}
1239
+ </button>`)}
1240
+ </div>
1241
+ ${this.notice?v`<div class="alert alert-${this.notice.tone}" role="status">
1242
+ ${this.notice.tone==="success"?B.checkCircle:B.info}
1243
+ <div class="alert-body">${this.notice.message}</div>
1244
+ </div>`:E}
1245
+ ${this.stepUp?this.renderStepUp():this.renderTab()}
1246
+ </div>
1247
+ `}renderIdentity(){const e=this.user,i=e.name||e.email||e.phone||this.t("guestAccount");return v`
1248
+ <div class="between">
1249
+ <div class="identity">
1250
+ <span class="avatar">${i[0]??"?"}</span>
1251
+ <div class="row-main">
1252
+ <span class="row-title">
1253
+ ${i}
1254
+ ${e.mfa?v`<span class="badge badge-success">${B.shieldCheck} MFA</span>`:E}
1255
+ </span>
1256
+ ${e.email&&e.name?v`<span class="row-sub">${e.email}</span>`:E}
1257
+ </div>
1258
+ </div>
1259
+ <button class="btn btn-outline btn-sm" @click=${()=>_.signOut()}>
1260
+ ${B.logOut} ${this.t("signOut")}
1261
+ </button>
1262
+ </div>
1263
+ `}renderTab(){switch(this.active){case"security":return this.renderSecurity();case"sessions":return this.renderSessions();case"connections":return this.renderConnections();case"activity":return this.renderActivity();default:return this.renderProfile()}}error(e){const i=this.errors[e];return i?v`<div class="alert alert-error" role="alert">
1264
+ ${B.alert}
1265
+ <div class="alert-body">${i}</div>
1266
+ </div>`:E}spinner(e){return this.busy===e?v`<span class="spinner" aria-hidden="true"></span>`:E}card(e,i,a,n,r=!1){return v`<section class="card ${r?"card-danger":""}">
1267
+ <div class="card-header">
1268
+ <h3 class="card-title">${e}</h3>
1269
+ ${i?v`<p class="card-description">${i}</p>`:E}
1270
+ </div>
1271
+ <div class="card-body">${a}</div>
1272
+ ${n?v`<div class="card-footer">${n}</div>`:E}
1273
+ </section>`}verifiedBadge(e){return e?v`<span class="badge badge-success">${B.check} ${this.t("verified")}</span>`:v`<span class="badge badge-warning">${this.t("unverified")}</span>`}renderProfile(){const e=this.user;return this.isGuest?v`<div class="section">
1274
+ ${this.card(this.t("guestAccount"),this.t("guestAccountDescription"),v`<form class="form" id="guest-form" @submit=${this.onConvertGuest} novalidate>
1275
+ <div class="field">
1276
+ <label class="label" for="guest-name">${this.t("name")}</label>
1277
+ <input
1278
+ class="input"
1279
+ id="guest-name"
1280
+ .value=${this.guestName}
1281
+ @input=${this.bind("guestName")}
1282
+ autocomplete="name"
1283
+ />
1284
+ </div>
1285
+ <div class="field">
1286
+ <label class="label" for="guest-email">${this.t("email")}</label>
1287
+ <input
1288
+ class="input"
1289
+ id="guest-email"
1290
+ type="email"
1291
+ required
1292
+ .value=${this.emailInput}
1293
+ @input=${this.bind("emailInput")}
1294
+ autocomplete="email"
1295
+ />
1296
+ </div>
1297
+ <div class="field">
1298
+ <label class="label" for="guest-password">${this.t("password")}</label>
1299
+ <input
1300
+ class="input"
1301
+ id="guest-password"
1302
+ type="password"
1303
+ required
1304
+ minlength="8"
1305
+ .value=${this.emailPassword}
1306
+ @input=${this.bind("emailPassword")}
1307
+ autocomplete="new-password"
1308
+ />
1309
+ <p class="hint">${this.t("passwordHint")}</p>
1310
+ </div>
1311
+ ${this.error("guest")}
1312
+ </form>`,v`<button
1313
+ class="btn btn-primary btn-sm"
1314
+ type="submit"
1315
+ form="guest-form"
1316
+ ?disabled=${!!this.busy}
1317
+ >
1318
+ ${this.spinner("guest")} ${this.t("createAccount")}
1319
+ </button>`)}
1320
+ </div>`:v`<div class="section">
1321
+ ${this.card(this.t("name"),void 0,v`<form class="form" id="name-form" @submit=${this.onUpdateName} novalidate>
1322
+ <div class="field">
1323
+ <label class="label" for="acc-name">${this.t("name")}</label>
1324
+ <input
1325
+ class="input"
1326
+ id="acc-name"
1327
+ .value=${this.nameInput}
1328
+ @input=${this.bind("nameInput")}
1329
+ autocomplete="name"
1330
+ required
1331
+ />
1332
+ </div>
1333
+ ${this.error("name")}
1334
+ </form>`,v`<button
1335
+ class="btn btn-primary btn-sm"
1336
+ type="submit"
1337
+ form="name-form"
1338
+ ?disabled=${!!this.busy||this.nameInput===e.name}
1339
+ >
1340
+ ${this.spinner("name")} ${this.t("update")}
1341
+ </button>`)}
1342
+ ${this.card(this.t("email"),void 0,v`<form class="form" id="email-form" @submit=${this.onUpdateEmail} novalidate>
1343
+ <div class="field">
1344
+ <label class="label" for="acc-email"
1345
+ >${this.t("email")}
1346
+ ${e.email?this.verifiedBadge(e.emailVerification):E}</label
1347
+ >
1348
+ <input
1349
+ class="input"
1350
+ id="acc-email"
1351
+ type="email"
1352
+ .value=${this.emailInput}
1353
+ @input=${this.bind("emailInput")}
1354
+ autocomplete="email"
1355
+ required
1356
+ />
1357
+ </div>
1358
+ ${this.emailInput!==e.email?v`<div class="field">
1359
+ <label class="label" for="acc-email-password">${this.t("currentPassword")}</label>
1360
+ <input
1361
+ class="input"
1362
+ id="acc-email-password"
1363
+ type="password"
1364
+ .value=${this.emailPassword}
1365
+ @input=${this.bind("emailPassword")}
1366
+ autocomplete="current-password"
1367
+ required
1368
+ />
1369
+ </div>`:E}
1370
+ ${this.error("email")} ${this.error("verify")}
1371
+ </form>`,v`
1372
+ ${e.email&&!e.emailVerification?v`<button
1373
+ class="btn btn-outline btn-sm"
1374
+ type="button"
1375
+ @click=${this.onSendVerification}
1376
+ ?disabled=${!!this.busy}
1377
+ >
1378
+ ${this.spinner("verify")} ${this.t("verifyEmail")}
1379
+ </button>`:E}
1380
+ <button
1381
+ class="btn btn-primary btn-sm"
1382
+ type="submit"
1383
+ form="email-form"
1384
+ ?disabled=${!!this.busy||this.emailInput===e.email}
1385
+ >
1386
+ ${this.spinner("email")} ${this.t("update")}
1387
+ </button>
1388
+ `)}
1389
+ ${this.card(this.t("phone"),void 0,v`<form class="form" id="phone-form" @submit=${this.onUpdatePhone} novalidate>
1390
+ <div class="field">
1391
+ <label class="label" for="acc-phone"
1392
+ >${this.t("phone")}
1393
+ ${e.phone?this.verifiedBadge(e.phoneVerification):E}</label
1394
+ >
1395
+ <input
1396
+ class="input"
1397
+ id="acc-phone"
1398
+ type="tel"
1399
+ placeholder="+1 555 000 0000"
1400
+ .value=${this.phoneInput}
1401
+ @input=${this.bind("phoneInput")}
1402
+ autocomplete="tel"
1403
+ />
1404
+ </div>
1405
+ ${this.phoneInput!==e.phone?v`<div class="field">
1406
+ <label class="label" for="acc-phone-password">${this.t("currentPassword")}</label>
1407
+ <input
1408
+ class="input"
1409
+ id="acc-phone-password"
1410
+ type="password"
1411
+ .value=${this.phonePassword}
1412
+ @input=${this.bind("phonePassword")}
1413
+ autocomplete="current-password"
1414
+ required
1415
+ />
1416
+ </div>`:E}
1417
+ ${this.phoneCodeSent?v`<div class="field">
1418
+ <label class="label" for="acc-phone-code">${this.t("code")}</label>
1419
+ <input
1420
+ class="input input-otp"
1421
+ id="acc-phone-code"
1422
+ inputmode="numeric"
1423
+ autocomplete="one-time-code"
1424
+ .value=${this.phoneCode}
1425
+ @input=${this.bind("phoneCode")}
1426
+ />
1427
+ </div>`:E}
1428
+ ${this.error("phone")} ${this.error("verify-phone")} ${this.error("verify-phone-code")}
1429
+ </form>`,v`
1430
+ ${e.phone&&!e.phoneVerification&&!this.phoneCodeSent?v`<button
1431
+ class="btn btn-outline btn-sm"
1432
+ type="button"
1433
+ @click=${this.onSendPhoneVerification}
1434
+ ?disabled=${!!this.busy}
1435
+ >
1436
+ ${this.spinner("verify-phone")} ${this.t("sendCode")}
1437
+ </button>`:E}
1438
+ ${this.phoneCodeSent?v`<button
1439
+ class="btn btn-outline btn-sm"
1440
+ type="button"
1441
+ @click=${this.onConfirmPhoneVerification}
1442
+ ?disabled=${!!this.busy}
1443
+ >
1444
+ ${this.spinner("verify-phone-code")} ${this.t("verifyCode")}
1445
+ </button>`:E}
1446
+ <button
1447
+ class="btn btn-primary btn-sm"
1448
+ type="submit"
1449
+ form="phone-form"
1450
+ ?disabled=${!!this.busy||this.phoneInput===e.phone}
1451
+ >
1452
+ ${this.spinner("phone")} ${this.t("update")}
1453
+ </button>
1454
+ `)}
1455
+ ${this.renderDanger()}
1456
+ </div>`}renderDanger(){return this.card(this.t("deleteAccount"),this.t("deleteAccountDescription"),v`${this.error("delete")}
1457
+ ${this.confirmDelete?v`<div class="inline">
1458
+ <button
1459
+ class="btn btn-destructive btn-sm"
1460
+ @click=${this.onDeleteAccount}
1461
+ ?disabled=${!!this.busy}
1462
+ >
1463
+ ${this.spinner("delete")} ${this.t("deleteAccountConfirm")}
1464
+ </button>
1465
+ <button class="btn btn-ghost btn-sm" @click=${()=>this.confirmDelete=!1}>
1466
+ ${this.t("cancel")}
1467
+ </button>
1468
+ </div>`:v`<button
1469
+ class="btn btn-outline btn-sm warn"
1470
+ @click=${()=>this.confirmDelete=!0}
1471
+ >
1472
+ ${B.userX} ${this.t("deleteAccount")}
1473
+ </button>`}`,void 0,!0)}renderSecurity(){const e=this.user,i=this.config?.mfa!==!1;return v`<div class="section">
1474
+ ${this.isGuest?E:this.card(this.t("changePassword"),void 0,v`<form
1475
+ class="form"
1476
+ id="password-form"
1477
+ @submit=${this.onChangePassword}
1478
+ novalidate
1479
+ >
1480
+ ${e.passwordUpdate?v`<div class="field">
1481
+ <label class="label" for="acc-old-password"
1482
+ >${this.t("currentPassword")}</label
1483
+ >
1484
+ <input
1485
+ class="input"
1486
+ id="acc-old-password"
1487
+ type="password"
1488
+ .value=${this.oldPassword}
1489
+ @input=${this.bind("oldPassword")}
1490
+ autocomplete="current-password"
1491
+ />
1492
+ </div>`:E}
1493
+ <div class="field">
1494
+ <label class="label" for="acc-new-password">${this.t("newPassword")}</label>
1495
+ <input
1496
+ class="input"
1497
+ id="acc-new-password"
1498
+ type="password"
1499
+ required
1500
+ minlength="8"
1501
+ .value=${this.newPassword}
1502
+ @input=${this.bind("newPassword")}
1503
+ autocomplete="new-password"
1504
+ />
1505
+ <p class="hint">${this.t("passwordHint")}</p>
1506
+ </div>
1507
+ <div class="field">
1508
+ <label class="label" for="acc-new-password-confirm"
1509
+ >${this.t("confirmPassword")}</label
1510
+ >
1511
+ <input
1512
+ class="input"
1513
+ id="acc-new-password-confirm"
1514
+ type="password"
1515
+ required
1516
+ minlength="8"
1517
+ .value=${this.newPasswordConfirm}
1518
+ @input=${this.bind("newPasswordConfirm")}
1519
+ autocomplete="new-password"
1520
+ />
1521
+ </div>
1522
+ ${this.error("password")}
1523
+ </form>`,v`<button
1524
+ class="btn btn-primary btn-sm"
1525
+ type="submit"
1526
+ form="password-form"
1527
+ ?disabled=${!!this.busy||!this.newPassword}
1528
+ >
1529
+ ${this.spinner("password")} ${this.t("update")}
1530
+ </button>`)}
1531
+ ${i?this.renderMfaCard():E}
1532
+ ${i?this.renderRecoveryCard():E}
1533
+ </div>`}renderMfaCard(){const e=this.user,i=this.factors?.totp??!1,a=this.authenticator?new Sa(_.getClient()).getQR(this.authenticator.uri,400,1).toString():"";return this.card(this.t("twoFactor"),this.t("twoFactorDescription"),v`<div class="kv">
1534
+ <div class="toggle-row">
1535
+ <div class="row-main">
1536
+ <span class="row-title">${this.t("twoFactor")}</span>
1537
+ <span class="row-sub">${e.mfa?this.t("enable"):this.t("disable")}d</span>
1538
+ </div>
1539
+ <button
1540
+ class="switch"
1541
+ role="switch"
1542
+ aria-checked=${e.mfa?"true":"false"}
1543
+ @click=${this.onToggleMfa}
1544
+ ?disabled=${!!this.busy}
1545
+ aria-label=${this.t("twoFactor")}
1546
+ ></button>
1547
+ </div>
1548
+ ${this.error("mfa")}
1549
+ <div class="separator"></div>
1550
+ <div class="toggle-row">
1551
+ <div class="row-main">
1552
+ <span class="row-title"
1553
+ >${B.smartphone} ${this.t("authenticatorApp")}
1554
+ ${i?this.verifiedBadge(!0):E}</span
1555
+ >
1556
+ </div>
1557
+ ${i?v`<button
1558
+ class="btn btn-outline btn-sm"
1559
+ @click=${this.onRemoveAuthenticator}
1560
+ ?disabled=${!!this.busy}
1561
+ >
1562
+ ${this.spinner("remove-authenticator")} ${this.t("remove")}
1563
+ </button>`:this.authenticator?E:v`<button
1564
+ class="btn btn-outline btn-sm"
1565
+ @click=${this.onAddAuthenticator}
1566
+ ?disabled=${!!this.busy}
1567
+ >
1568
+ ${this.spinner("authenticator")} ${this.t("authenticatorAdd")}
1569
+ </button>`}
1570
+ </div>
1571
+ ${this.error("authenticator")} ${this.error("remove-authenticator")}
1572
+ ${this.authenticator?v`<form class="form" @submit=${this.onVerifyAuthenticator} novalidate>
1573
+ <p class="hint">${this.t("authenticatorScan")}</p>
1574
+ <img class="qr" src=${a} alt="QR code" />
1575
+ <p class="hint center">
1576
+ ${this.t("authenticatorManual")}:
1577
+ <span class="code">${this.authenticator.secret}</span>
1578
+ </p>
1579
+ <div class="field">
1580
+ <label class="label" for="acc-totp">${this.t("code")}</label>
1581
+ <input
1582
+ class="input input-otp"
1583
+ id="acc-totp"
1584
+ inputmode="numeric"
1585
+ autocomplete="one-time-code"
1586
+ required
1587
+ .value=${this.authenticatorCode}
1588
+ @input=${this.bind("authenticatorCode")}
1589
+ />
1590
+ </div>
1591
+ ${this.error("authenticator-code")}
1592
+ <div class="inline">
1593
+ <button class="btn btn-primary btn-sm" type="submit" ?disabled=${!!this.busy}>
1594
+ ${this.spinner("authenticator-code")} ${this.t("authenticatorVerify")}
1595
+ </button>
1596
+ <button
1597
+ class="btn btn-ghost btn-sm"
1598
+ type="button"
1599
+ @click=${()=>this.authenticator=null}
1600
+ >
1601
+ ${this.t("cancel")}
1602
+ </button>
1603
+ </div>
1604
+ </form>`:E}
1605
+ </div>`)}renderRecoveryCard(){const e=this.factors?.recoveryCode??!1;return this.card(this.t("recoveryCodes"),this.t("recoveryCodesDescription"),v`<div class="kv">
1606
+ ${this.recoveryCodes?v`<div class="alert alert-warning">
1607
+ ${B.alert}
1608
+ <div class="alert-body">${this.t("recoveryCodesWarning")}</div>
1609
+ </div>
1610
+ <div class="codes">
1611
+ ${this.recoveryCodes.map(i=>v`<span class="code">${i}</span>`)}
1612
+ </div>
1613
+ <div class="inline">
1614
+ <button class="btn btn-outline btn-sm" @click=${this.onCopyCodes}>
1615
+ ${this.copied?B.check:B.copy}
1616
+ ${this.copied?this.t("copied"):this.t("copy")}
1617
+ </button>
1618
+ <button class="btn btn-ghost btn-sm" @click=${()=>this.recoveryCodes=null}>
1619
+ ${this.t("done")}
1620
+ </button>
1621
+ </div>`:v`<div class="inline">
1622
+ <button
1623
+ class="btn btn-outline btn-sm"
1624
+ @click=${this.onRecoveryCodes}
1625
+ ?disabled=${!!this.busy}
1626
+ >
1627
+ ${this.spinner("recovery")} ${B.key}
1628
+ ${e?this.t("recoveryCodes"):this.t("generateRecoveryCodes")}
1629
+ </button>
1630
+ ${e?v`<button class="btn btn-ghost btn-sm" @click=${this.onRegenerateRecoveryCodes} ?disabled=${!!this.busy}>${B.refresh} ${this.t("regenerateRecoveryCodes")}</button>`:E}
1631
+ </div>`}
1632
+ ${this.error("recovery")}
1633
+ </div>`)}renderStepUp(){const e=this.stepUp,i=this.factors,a=[{factor:"totp",icon:B.smartphone,label:this.t("mfaUseAuthenticator"),available:i?.totp??!0},{factor:"email",icon:B.mail,label:this.t("mfaUseEmail"),available:i?.email??!0},{factor:"phone",icon:B.phone,label:this.t("mfaUsePhone"),available:i?.phone??!0},{factor:"recoverycode",icon:B.key,label:this.t("mfaUseRecoveryCode"),available:i?.recoveryCode??!0}];return this.card(this.t("mfaTitle"),this.t("errorChallengeRequired"),v`<div class="kv">
1634
+ ${e.challenge?v`<form class="form" @submit=${this.onStepUpVerify} novalidate>
1635
+ <div class="field">
1636
+ <label class="label" for="acc-stepup"
1637
+ >${e.challenge.factor==="recoverycode"?this.t("recoveryCode"):this.t("code")}</label
1638
+ >
1639
+ <input
1640
+ class="input ${e.challenge.factor==="recoverycode"?"mono":"input-otp"}"
1641
+ id="acc-stepup"
1642
+ autocomplete="one-time-code"
1643
+ required
1644
+ .value=${this.stepUpCode}
1645
+ @input=${this.bind("stepUpCode")}
1646
+ />
1647
+ </div>
1648
+ <button class="btn btn-primary btn-sm" type="submit" ?disabled=${!!this.busy}>
1649
+ ${this.spinner("stepup-code")} ${this.t("verifyCode")}
1650
+ </button>
1651
+ </form>`:v`<div class="stack-sm">
1652
+ ${a.filter(n=>n.available).map(n=>v`<button
1653
+ type="button"
1654
+ class="choice"
1655
+ @click=${()=>this.onStepUpFactor(n.factor)}
1656
+ ?disabled=${!!this.busy}
1657
+ >
1658
+ ${n.icon}<span class="choice-title">${n.label}</span>
1659
+ </button>`)}
1660
+ </div>`}
1661
+ ${this.error("stepup")} ${this.error("stepup-code")}
1662
+ </div>`,v`<button class="btn btn-ghost btn-sm" @click=${()=>this.stepUp=null}>
1663
+ ${this.t("cancel")}
1664
+ </button>`)}deviceIcon(e){const i=(e.clientType||e.deviceName||"").toLowerCase();return i.includes("smartphone")||i.includes("phone")||i.includes("tablet")?B.smartphone:i.includes("browser")||i.includes("desktop")?B.monitor:B.globe}renderSessions(){const e=this.sessions;return v`<div class="section">
1665
+ ${this.card(this.t("sessions"),void 0,v`${this.error("sessions")}
1666
+ ${e===null?v`<div class="empty"><span class="spinner"></span></div>`:e.length===0?v`<div class="empty">${this.t("noActivity")}</div>`:e.map(i=>v`<div class="row">
1667
+ <div class="inline">
1668
+ <span class="device">${this.deviceIcon(i)}</span>
1669
+ <div class="row-main">
1670
+ <span class="row-title">
1671
+ ${i.clientName||i.provider}
1672
+ ${i.clientVersion?v`<span class="muted small">${i.clientVersion}</span>`:E}
1673
+ ${i.current?v`<span class="badge badge-info">${this.t("currentSession")}</span>`:E}
1674
+ </span>
1675
+ <span class="row-sub"
1676
+ >${[i.osName,i.countryName||i.countryCode,i.ip].filter(Boolean).join(" · ")}</span
1677
+ >
1678
+ </div>
1679
+ </div>
1680
+ <div class="row-actions">
1681
+ ${this.busy===`session-${i.$id}`?v`<span class="spinner"></span>`:E}
1682
+ <button
1683
+ class="btn btn-ghost btn-sm"
1684
+ @click=${()=>this.onDeleteSession(i.$id)}
1685
+ ?disabled=${!!this.busy}
1686
+ aria-label=${this.t("signOutSession")}
1687
+ >
1688
+ ${B.logOut}
1689
+ </button>
1690
+ </div>
1691
+ </div>`)}`)}
1692
+ ${this.card(this.t("signOutAllSessions"),this.t("signOutAllSessionsDescription"),v`${this.error("sessions-all")}
1693
+ <button
1694
+ class="btn btn-outline btn-sm warn"
1695
+ @click=${this.onSignOutAll}
1696
+ ?disabled=${!!this.busy}
1697
+ >
1698
+ ${this.spinner("sessions-all")} ${B.logOut} ${this.t("signOutAllSessions")}
1699
+ </button>`,void 0,!0)}
1700
+ </div>`}renderConnections(){const e=this.identities,i=this.config?.methods?.oauth??[];return v`<div class="section">
1701
+ ${this.card(this.t("connections"),void 0,v`${this.error("identities")}
1702
+ ${e===null?v`<div class="empty"><span class="spinner"></span></div>`:e.length===0?v`<div class="empty">${this.t("noConnections")}</div>`:e.map(a=>v`<div class="row">
1703
+ <div class="inline">
1704
+ <span class="device">${It(a.provider)}</span>
1705
+ <div class="row-main">
1706
+ <span class="row-title">${Ve(a.provider)}</span>
1707
+ <span class="row-sub">${a.providerEmail||a.providerUid}</span>
1708
+ </div>
1709
+ </div>
1710
+ <div class="row-actions">
1711
+ <button
1712
+ class="btn btn-ghost btn-sm"
1713
+ @click=${()=>this.onDeleteIdentity(a.$id)}
1714
+ ?disabled=${!!this.busy}
1715
+ >
1716
+ ${this.busy===`identity-${a.$id}`?v`<span class="spinner"></span>`:E}
1717
+ ${this.t("disconnect")}
1718
+ </button>
1719
+ </div>
1720
+ </div>`)}`,i.length>0?v`${i.filter(a=>!(e??[]).some(n=>n.provider===a)).map(a=>v`<button
1721
+ class="btn btn-outline btn-sm"
1722
+ @click=${()=>_.signInWithOAuth(a)}
1723
+ >
1724
+ ${It(a)} ${Ve(a)}
1725
+ </button>`)}`:void 0)}
1726
+ </div>`}renderActivity(){const e=this.logs;return v`<div class="section">
1727
+ ${this.card(this.t("activity"),void 0,v`${e===null?v`<div class="empty"><span class="spinner"></span></div>`:e.length===0?v`<div class="empty">${this.t("noActivity")}</div>`:e.map(i=>v`<div class="row">
1728
+ <div class="row-main">
1729
+ <span class="row-title">${i.event}</span>
1730
+ <span class="row-sub"
1731
+ >${[i.clientName,i.osName,i.countryName||i.countryCode,i.ip].filter(Boolean).join(" · ")}</span
1732
+ >
1733
+ </div>
1734
+ <span class="log-time">${new Date(i.time).toLocaleString()}</span>
1735
+ </div>`)}`)}
1736
+ </div>`}},$.AuthUIAccount.styles=[...ye.styles,je`
1737
+ :host {
1738
+ display: block;
1739
+ width: 100%;
1740
+ max-width: 560px;
1741
+ }
1742
+ .panel {
1743
+ background: var(--authui-card);
1744
+ color: var(--authui-card-foreground);
1745
+ border: 1px solid var(--authui-border);
1746
+ border-radius: var(--authui-radius-xl);
1747
+ padding: 24px;
1748
+ display: flex;
1749
+ flex-direction: column;
1750
+ gap: 20px;
1751
+ box-shadow: var(--authui-shadow-lg);
1752
+ }
1753
+ .panel.embedded {
1754
+ border: 0;
1755
+ box-shadow: none;
1756
+ padding: 0;
1757
+ background: transparent;
1758
+ }
1759
+ .identity {
1760
+ display: flex;
1761
+ align-items: center;
1762
+ gap: 12px;
1763
+ }
1764
+ .identity .avatar {
1765
+ width: 44px;
1766
+ height: 44px;
1767
+ font-size: 16px;
1768
+ }
1769
+ .tabs {
1770
+ width: 100%;
1771
+ }
1772
+ .section {
1773
+ display: flex;
1774
+ flex-direction: column;
1775
+ gap: 16px;
1776
+ }
1777
+ .kv {
1778
+ display: flex;
1779
+ flex-direction: column;
1780
+ gap: 12px;
1781
+ }
1782
+ .toggle-row {
1783
+ display: flex;
1784
+ align-items: center;
1785
+ justify-content: space-between;
1786
+ gap: 16px;
1787
+ }
1788
+ .device {
1789
+ width: 36px;
1790
+ height: 36px;
1791
+ border-radius: var(--authui-radius-md);
1792
+ background: var(--authui-muted);
1793
+ color: var(--authui-muted-foreground);
1794
+ display: inline-flex;
1795
+ align-items: center;
1796
+ justify-content: center;
1797
+ flex-shrink: 0;
1798
+ }
1799
+ .device svg {
1800
+ width: 18px;
1801
+ height: 18px;
1802
+ }
1803
+ .log-time {
1804
+ font-size: 12px;
1805
+ color: var(--authui-muted-foreground);
1806
+ white-space: nowrap;
1807
+ }
1808
+ .warn {
1809
+ color: var(--authui-destructive-foreground);
1810
+ }
1811
+ `],ee([ie({type:Boolean})],$.AuthUIAccount.prototype,"embedded",2),ee([ie({type:String})],$.AuthUIAccount.prototype,"tab",2),ee([Y()],$.AuthUIAccount.prototype,"active",2),ee([Y()],$.AuthUIAccount.prototype,"busy",2),ee([Y()],$.AuthUIAccount.prototype,"notice",2),ee([Y()],$.AuthUIAccount.prototype,"errors",2),ee([Y()],$.AuthUIAccount.prototype,"nameInput",2),ee([Y()],$.AuthUIAccount.prototype,"emailInput",2),ee([Y()],$.AuthUIAccount.prototype,"emailPassword",2),ee([Y()],$.AuthUIAccount.prototype,"phoneInput",2),ee([Y()],$.AuthUIAccount.prototype,"phonePassword",2),ee([Y()],$.AuthUIAccount.prototype,"phoneCode",2),ee([Y()],$.AuthUIAccount.prototype,"phoneCodeSent",2),ee([Y()],$.AuthUIAccount.prototype,"guestName",2),ee([Y()],$.AuthUIAccount.prototype,"oldPassword",2),ee([Y()],$.AuthUIAccount.prototype,"newPassword",2),ee([Y()],$.AuthUIAccount.prototype,"newPasswordConfirm",2),ee([Y()],$.AuthUIAccount.prototype,"authenticator",2),ee([Y()],$.AuthUIAccount.prototype,"authenticatorCode",2),ee([Y()],$.AuthUIAccount.prototype,"factors",2),ee([Y()],$.AuthUIAccount.prototype,"recoveryCodes",2),ee([Y()],$.AuthUIAccount.prototype,"stepUp",2),ee([Y()],$.AuthUIAccount.prototype,"stepUpCode",2),ee([Y()],$.AuthUIAccount.prototype,"copied",2),ee([Y()],$.AuthUIAccount.prototype,"sessions",2),ee([Y()],$.AuthUIAccount.prototype,"identities",2),ee([Y()],$.AuthUIAccount.prototype,"logs",2),ee([Y()],$.AuthUIAccount.prototype,"logsSupported",2),ee([Y()],$.AuthUIAccount.prototype,"confirmDelete",2),$.AuthUIAccount=ee([Ue("authui-account")],$.AuthUIAccount);var Xa=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,Xe=(t,e,i,a)=>{for(var n=a>1?void 0:a?Ga(e,i):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(n=(a?s(e,i,n):s(n))||n);return a&&n&&Xa(e,i,n),n};$.AuthUIModal=class extends ye{constructor(){super(...arguments),this.open=!1,this.view="sign-in",this.closeOnSuccess=!0,this.handledPending=null,this.onOpenEvent=e=>{const i=e.detail??{};this.show(i.view)},this.onCloseEvent=()=>this.hide(),this.onSuccess=()=>{this.fire("authui-signed-in",this.auth.user),this.closeOnSuccess&&!this.config?.successUrl&&this.hide()},this.onInnerOpen=e=>{const i=e.detail?.view;i&&(this.view=i)},this.onBackdrop=e=>{e.target===this.dialog&&this.hide()}}connectedCallback(){super.connectedCallback(),window.addEventListener("authui:open",this.onOpenEvent),window.addEventListener("authui:close",this.onCloseEvent)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("authui:open",this.onOpenEvent),window.removeEventListener("authui:close",this.onCloseEvent)}show(e){e?this.view=e:this.auth.status==="signed-in"&&(this.view="account"),this.open=!0}hide(){this.open=!1}updated(e){if(e.has("open")&&this.dialog&&(this.open&&!this.dialog.open&&this.dialog.showModal(),!this.open&&this.dialog.open&&this.dialog.close()),e.has("auth")){const i=this.auth.pending;i&&i!==this.handledPending&&i.type!=="notice"&&(this.handledPending=i,this.view="sign-in",this.open=!0),i?.type==="notice"&&i!==this.handledPending&&(this.handledPending=i,this.open=!0)}}render(){const e=this.view==="account";return v`
1812
+ <dialog
1813
+ class=${e?"wide":""}
1814
+ aria-labelledby="authui-title"
1815
+ @close=${()=>this.open=!1}
1816
+ @cancel=${i=>{i.preventDefault(),this.hide()}}
1817
+ @click=${this.onBackdrop}
1818
+ @authui-open=${this.onInnerOpen}
1819
+ >
1820
+ <div class="body">
1821
+ <button
1822
+ class="btn btn-ghost btn-icon close"
1823
+ @click=${this.hide}
1824
+ aria-label=${this.t("close")}
1825
+ >
1826
+ ${B.x}
1827
+ </button>
1828
+ ${this.open?e?v`<authui-account embedded></authui-account>`:v`<authui-sign-in
1829
+ embedded
1830
+ .view=${this.view}
1831
+ @authui-success=${this.onSuccess}
1832
+ ></authui-sign-in>`:E}
1833
+ </div>
1834
+ </dialog>
1835
+ `}},$.AuthUIModal.styles=[...ye.styles,je`
1836
+ :host {
1837
+ display: contents;
1838
+ }
1839
+ dialog {
1840
+ border: 1px solid var(--authui-border);
1841
+ border-radius: var(--authui-radius-lg);
1842
+ background: var(--authui-background);
1843
+ color: var(--authui-foreground);
1844
+ padding: 0;
1845
+ width: calc(100% - 2rem);
1846
+ max-width: 440px;
1847
+ max-height: calc(100dvh - 2rem);
1848
+ box-shadow: var(--authui-shadow-lg);
1849
+ overflow: hidden;
1850
+ z-index: var(--authui-z);
1851
+ }
1852
+ dialog.wide {
1853
+ max-width: 600px;
1854
+ }
1855
+ dialog::backdrop {
1856
+ background: var(--authui-overlay);
1857
+ backdrop-filter: blur(4px);
1858
+ }
1859
+ dialog[open] {
1860
+ animation: authui-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
1861
+ }
1862
+ @keyframes authui-in {
1863
+ from {
1864
+ opacity: 0;
1865
+ transform: scale(0.96);
1866
+ }
1867
+ to {
1868
+ opacity: 1;
1869
+ transform: none;
1870
+ }
1871
+ }
1872
+ .body {
1873
+ padding: 24px;
1874
+ max-height: calc(100dvh - 2rem);
1875
+ overflow-y: auto;
1876
+ }
1877
+ .close {
1878
+ position: absolute;
1879
+ top: 12px;
1880
+ inset-inline-end: 12px;
1881
+ width: 32px;
1882
+ height: 32px;
1883
+ border-radius: var(--authui-radius-sm);
1884
+ opacity: 0.7;
1885
+ }
1886
+ .close:hover {
1887
+ opacity: 1;
1888
+ }
1889
+ authui-sign-in,
1890
+ authui-account {
1891
+ max-width: none;
1892
+ }
1893
+ `],Xe([ie({type:Boolean,reflect:!0})],$.AuthUIModal.prototype,"open",2),Xe([ie({type:String})],$.AuthUIModal.prototype,"view",2),Xe([ie({type:Boolean,attribute:"close-on-success"})],$.AuthUIModal.prototype,"closeOnSuccess",2),Xe([Y()],$.AuthUIModal.prototype,"handledPending",2),Xe([Tt("dialog")],$.AuthUIModal.prototype,"dialog",2),$.AuthUIModal=Xe([Ue("authui-modal")],$.AuthUIModal);function Te(t){typeof document>"u"||(document.querySelector("authui-modal")||document.body.appendChild(document.createElement("authui-modal")),queueMicrotask(()=>{window.dispatchEvent(new CustomEvent("authui:open",{detail:{view:t}}))}))}function Pi(){typeof window>"u"||window.dispatchEvent(new CustomEvent("authui:close"))}var Wa=Object.defineProperty,Ka=Object.getOwnPropertyDescriptor,ut=(t,e,i,a)=>{for(var n=a>1?void 0:a?Ka(e,i):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(n=(a?s(e,i,n):s(n))||n);return a&&n&&Wa(e,i,n),n};$.AuthUIButton=class extends ye{constructor(){super(...arguments),this.view="sign-in",this.variant="primary",this.size="md"}render(){const e=this.size==="md"?"":`btn-${this.size}`;return v`<button
1894
+ class="btn btn-${this.variant} ${e}"
1895
+ @click=${()=>Te(this.view)}
1896
+ part="button"
1897
+ >
1898
+ <slot
1899
+ >${this.view==="sign-up"?this.t("signUp"):this.view==="account"?this.t("manageAccount"):this.t("signIn")}</slot
1900
+ >
1901
+ </button>`}},$.AuthUIButton.styles=[...ye.styles,je`
1902
+ :host {
1903
+ display: inline-block;
1904
+ }
1905
+ .btn {
1906
+ width: 100%;
1907
+ }
1908
+ `],ut([ie({type:String})],$.AuthUIButton.prototype,"view",2),ut([ie({type:String})],$.AuthUIButton.prototype,"variant",2),ut([ie({type:String})],$.AuthUIButton.prototype,"size",2),$.AuthUIButton=ut([Ue("authui-button")],$.AuthUIButton);var Ja=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,xt=(t,e,i,a)=>{for(var n=a>1?void 0:a?Ya(e,i):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(n=(a?s(e,i,n):s(n))||n);return a&&n&&Ja(e,i,n),n};$.AuthUIUserButton=class extends ye{constructor(){super(...arguments),this.src="",this.menuOpen=!1,this.onDocumentClick=e=>{e.composedPath().includes(this)||(this.menuOpen=!1)},this.onKeydown=e=>{e.key==="Escape"&&(this.menuOpen=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.onDocumentClick,!0),document.addEventListener("keydown",this.onKeydown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.onDocumentClick,!0),document.removeEventListener("keydown",this.onKeydown)}render(){const{status:e,user:i}=this.auth;if(e==="loading")return v`<span class="avatar"><span class="spinner"></span></span>`;if(e!=="signed-in"||!i)return v`<button class="btn btn-primary btn-sm" @click=${()=>Te("sign-in")}>
1909
+ <slot>${this.t("signIn")}</slot>
1910
+ </button>`;const a=i.name||i.email||i.phone||this.t("guestAccount");return v`
1911
+ <button
1912
+ class="trigger"
1913
+ aria-haspopup="menu"
1914
+ aria-expanded=${this.menuOpen?"true":"false"}
1915
+ @click=${()=>this.menuOpen=!this.menuOpen}
1916
+ aria-label=${a}
1917
+ >
1918
+ <span class="avatar"
1919
+ >${this.src?v`<img src=${this.src} alt="" />`:a[0]??"?"}</span
1920
+ >
1921
+ </button>
1922
+ ${this.menuOpen?v`<div class="menu" role="menu">
1923
+ <div class="menu-header">
1924
+ <span class="row-title">${a}</span>
1925
+ ${i.email&&i.name?v`<span class="row-sub">${i.email}</span>`:E}
1926
+ </div>
1927
+ <button
1928
+ class="menu-item"
1929
+ role="menuitem"
1930
+ @click=${()=>{this.menuOpen=!1,Te("account")}}
1931
+ >
1932
+ ${B.settings} ${this.t("manageAccount")}
1933
+ </button>
1934
+ <button
1935
+ class="menu-item"
1936
+ role="menuitem"
1937
+ @click=${()=>{this.menuOpen=!1,_.signOut()}}
1938
+ >
1939
+ ${B.logOut} ${this.t("signOut")}
1940
+ </button>
1941
+ </div>`:E}
1942
+ `}},$.AuthUIUserButton.styles=[...ye.styles,je`
1943
+ :host {
1944
+ display: inline-block;
1945
+ position: relative;
1946
+ }
1947
+ .trigger {
1948
+ border: 1px solid transparent;
1949
+ background: transparent;
1950
+ padding: 2px;
1951
+ border-radius: 999px;
1952
+ cursor: pointer;
1953
+ display: inline-flex;
1954
+ transition: border-color 150ms;
1955
+ }
1956
+ .trigger:hover,
1957
+ .trigger[aria-expanded="true"] {
1958
+ border-color: var(--authui-border);
1959
+ }
1960
+ .trigger:focus-visible {
1961
+ outline: none;
1962
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-ring) 50%, transparent);
1963
+ }
1964
+ .menu {
1965
+ position: absolute;
1966
+ top: calc(100% + 6px);
1967
+ inset-inline-end: 0;
1968
+ min-width: 220px;
1969
+ background: var(--authui-popover);
1970
+ color: var(--authui-popover-foreground);
1971
+ border: 1px solid var(--authui-border);
1972
+ border-radius: var(--authui-radius-md);
1973
+ box-shadow: var(--authui-shadow-lg);
1974
+ padding: 4px;
1975
+ z-index: var(--authui-z);
1976
+ display: flex;
1977
+ flex-direction: column;
1978
+ gap: 2px;
1979
+ }
1980
+ .menu-header {
1981
+ padding: 8px 10px 10px;
1982
+ display: flex;
1983
+ flex-direction: column;
1984
+ gap: 2px;
1985
+ border-bottom: 1px solid var(--authui-border);
1986
+ margin-bottom: 4px;
1987
+ }
1988
+ .menu-item {
1989
+ display: flex;
1990
+ align-items: center;
1991
+ gap: 8px;
1992
+ padding: 6px 10px;
1993
+ border-radius: var(--authui-radius-sm);
1994
+ border: 0;
1995
+ background: transparent;
1996
+ color: inherit;
1997
+ font: inherit;
1998
+ font-size: 14px;
1999
+ cursor: pointer;
2000
+ text-align: start;
2001
+ width: 100%;
2002
+ }
2003
+ .menu-item:hover,
2004
+ .menu-item:focus-visible {
2005
+ background: var(--authui-accent);
2006
+ outline: none;
2007
+ }
2008
+ .menu-item svg {
2009
+ width: 16px;
2010
+ height: 16px;
2011
+ color: var(--authui-muted-foreground);
2012
+ }
2013
+ .avatar {
2014
+ width: 32px;
2015
+ height: 32px;
2016
+ font-size: 13px;
2017
+ }
2018
+ `],xt([ie({type:String})],$.AuthUIUserButton.prototype,"src",2),xt([Y()],$.AuthUIUserButton.prototype,"menuOpen",2),$.AuthUIUserButton=xt([Ue("authui-user-button")],$.AuthUIUserButton);function ji(t){return _.configure(t),Ni}function Ci(t){Te(t)}function Ui(){Pi()}function Ei(){return _.signOut()}function _i(){return _.user}function Mi(){return _.getState()}function Ri(){return _.getClient()}function Li(t,e){return _.on(t,e)}const Ni={init:ji,open:Ci,close:Ui,signOut:Ei,getUser:_i,getState:Mi,getClient:Ri,on:Li,store:_};return $.AuthStore=Si,$.AuthUI=Ni,$.AuthUIElement=ye,$.ErrorTypes=se,$.authStore=_,$.close=Ui,$.closeModal=Pi,$.defaultStrings=Ai,$.describeError=At,$.getClient=Ri,$.getState=Mi,$.getUser=_i,$.init=ji,$.on=Li,$.open=Ci,$.openModal=Te,$.providerLabel=Ve,$.signOut=Ei,$.toAuthUIError=Oe,Object.defineProperty($,Symbol.toStringTag,{value:"Module"}),$})({});