@getauthui/core 0.1.2 → 0.1.3

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.
@@ -1,13 +1,13 @@
1
- var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot&&(lt.ShadyCSS===void 0||lt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$t=Symbol(),ci=new WeakMap;let di=class{constructor(e,i,t){if(this._$cssResult$=!0,t!==$t)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(St&&e===void 0){const t=i!==void 0&&i.length===1;t&&(e=ci.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&ci.set(i,e))}return e}toString(){return this.cssText}};const on=n=>new di(typeof n=="string"?n:n+"",void 0,$t),Le=(n,...e)=>{const i=n.length===1?n[0]:e.reduce((t,o,a)=>t+(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.")})(o)+n[a+1],n[0]);return new di(i,n,$t)},an=(n,e)=>{if(St)n.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of e){const t=document.createElement("style"),o=lt.litNonce;o!==void 0&&t.setAttribute("nonce",o),t.textContent=i.cssText,n.appendChild(t)}},li=St?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let i="";for(const t of e.cssRules)i+=t.cssText;return on(i)})(n):n;const{is:sn,defineProperty:rn,getOwnPropertyDescriptor:cn,getOwnPropertyNames:dn,getOwnPropertySymbols:ln,getPrototypeOf:un}=Object,ut=globalThis,ui=ut.trustedTypes,pn=ui?ui.emptyScript:"",hn=ut.reactiveElementPolyfillSupport,Fe=(n,e)=>n,pt={toAttribute(n,e){switch(e){case Boolean:n=n?pn:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let i=n;switch(e){case Boolean:i=n!==null;break;case Number:i=n===null?null:Number(n);break;case Object:case Array:try{i=JSON.parse(n)}catch{i=null}}return i}},Pt=(n,e)=>!sn(n,e),pi={attribute:!0,type:String,converter:pt,reflect:!1,useDefault:!1,hasChanged:Pt};Symbol.metadata??=Symbol("metadata"),ut.litPropertyMetadata??=new WeakMap;let Je=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=pi){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 t=Symbol(),o=this.getPropertyDescriptor(e,t,i);o!==void 0&&rn(this.prototype,e,o)}}static getPropertyDescriptor(e,i,t){const{get:o,set:a}=cn(this.prototype,e)??{get(){return this[i]},set(s){this[i]=s}};return{get:o,set(s){const r=o?.call(this);a?.call(this,s),this.requestUpdate(e,r,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??pi}static _$Ei(){if(this.hasOwnProperty(Fe("elementProperties")))return;const e=un(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Fe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Fe("properties"))){const i=this.properties,t=[...dn(i),...ln(i)];for(const o of t)this.createProperty(o,i[o])}const e=this[Symbol.metadata];if(e!==null){const i=litPropertyMetadata.get(e);if(i!==void 0)for(const[t,o]of i)this.elementProperties.set(t,o)}this._$Eh=new Map;for(const[i,t]of this.elementProperties){const o=this._$Eu(i,t);o!==void 0&&this._$Eh.set(o,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const i=[];if(Array.isArray(e)){const t=new Set(e.flat(1/0).reverse());for(const o of t)i.unshift(li(o))}else e!==void 0&&i.push(li(e));return i}static _$Eu(e,i){const t=i.attribute;return t===!1?void 0:typeof t=="string"?t: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 t of i.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return an(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,t){this._$AK(e,t)}_$ET(e,i){const t=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,t);if(o!==void 0&&t.reflect===!0){const a=(t.converter?.toAttribute!==void 0?t.converter:pt).toAttribute(i,t.type);this._$Em=e,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(e,i){const t=this.constructor,o=t._$Eh.get(e);if(o!==void 0&&this._$Em!==o){const a=t.getPropertyOptions(o),s=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:pt;this._$Em=o;const r=s.fromAttribute(i,a.type);this[o]=r??this._$Ej?.get(o)??r,this._$Em=null}}requestUpdate(e,i,t,o=!1,a){if(e!==void 0){const s=this.constructor;if(o===!1&&(a=this[e]),t??=s.getPropertyOptions(e),!((t.hasChanged??Pt)(a,i)||t.useDefault&&t.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,t))))return;this.C(e,i,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,i,{useDefault:t,reflect:o,wrapped:a},s){t&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??i??this[e]),a!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||t||(i=void 0),this._$AL.set(e,i)),o===!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[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[o,a]of t){const{wrapped:s}=a,r=this[o];s!==!0||this._$AL.has(o)||r===void 0||this.C(o,void 0,a,r)}}let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(i)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}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){}};Je.elementStyles=[],Je.shadowRootOptions={mode:"open"},Je[Fe("elementProperties")]=new Map,Je[Fe("finalized")]=new Map,hn?.({ReactiveElement:Je}),(ut.reactiveElementVersions??=[]).push("2.1.2");const Ut=globalThis,hi=n=>n,ht=Ut.trustedTypes,fi=ht?ht.createPolicy("lit-html",{createHTML:n=>n}):void 0,yi="$lit$",Ne=`lit$${Math.random().toFixed(9).slice(2)}$`,gi="?"+Ne,fn=`<${gi}>`,Be=document,et=()=>Be.createComment(""),tt=n=>n===null||typeof n!="object"&&typeof n!="function",Ct=Array.isArray,yn=n=>Ct(n)||typeof n?.[Symbol.iterator]=="function",Mt=`[
2
- \f\r]`,it=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,mi=/-->/g,wi=/>/g,Xe=RegExp(`>|${Mt}(?:([^\\s"'>=/]+)(${Mt}*=${Mt}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),bi=/'/g,Ii=/"/g,vi=/^(?:script|style|textarea|title)$/i,Ai=n=>(e,...i)=>({_$litType$:n,strings:e,values:i}),S=Ai(1),G=Ai(2),Ye=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),ki=new WeakMap,Ve=Be.createTreeWalker(Be,129);function ji(n,e){if(!Ct(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return fi!==void 0?fi.createHTML(e):e}const gn=(n,e)=>{const i=n.length-1,t=[];let o,a=e===2?"<svg>":e===3?"<math>":"",s=it;for(let r=0;r<i;r++){const d=n[r];let c,h,u=-1,m=0;for(;m<d.length&&(s.lastIndex=m,h=s.exec(d),h!==null);)m=s.lastIndex,s===it?h[1]==="!--"?s=mi:h[1]!==void 0?s=wi:h[2]!==void 0?(vi.test(h[2])&&(o=RegExp("</"+h[2],"g")),s=Xe):h[3]!==void 0&&(s=Xe):s===Xe?h[0]===">"?(s=o??it,u=-1):h[1]===void 0?u=-2:(u=s.lastIndex-h[2].length,c=h[1],s=h[3]===void 0?Xe:h[3]==='"'?Ii:bi):s===Ii||s===bi?s=Xe:s===mi||s===wi?s=it:(s=Xe,o=void 0);const j=s===Xe&&n[r+1].startsWith("/>")?" ":"";a+=s===it?d+fn:u>=0?(t.push(c),d.slice(0,u)+yi+d.slice(u)+Ne+j):d+Ne+(u===-2?r:j)}return[ji(n,a+(n[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),t]};class nt{constructor({strings:e,_$litType$:i},t){let o;this.parts=[];let a=0,s=0;const r=e.length-1,d=this.parts,[c,h]=gn(e,i);if(this.el=nt.createElement(c,t),Ve.currentNode=this.el.content,i===2||i===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=Ve.nextNode())!==null&&d.length<r;){if(o.nodeType===1){if(o.hasAttributes())for(const u of o.getAttributeNames())if(u.endsWith(yi)){const m=h[s++],j=o.getAttribute(u).split(Ne),E=/([.?@])?(.*)/.exec(m);d.push({type:1,index:a,name:E[2],strings:j,ctor:E[1]==="."?wn:E[1]==="?"?bn:E[1]==="@"?In:ft}),o.removeAttribute(u)}else u.startsWith(Ne)&&(d.push({type:6,index:a}),o.removeAttribute(u));if(vi.test(o.tagName)){const u=o.textContent.split(Ne),m=u.length-1;if(m>0){o.textContent=ht?ht.emptyScript:"";for(let j=0;j<m;j++)o.append(u[j],et()),Ve.nextNode(),d.push({type:2,index:++a});o.append(u[m],et())}}}else if(o.nodeType===8)if(o.data===gi)d.push({type:2,index:a});else{let u=-1;for(;(u=o.data.indexOf(Ne,u+1))!==-1;)d.push({type:7,index:a}),u+=Ne.length-1}a++}}static createElement(e,i){const t=Be.createElement("template");return t.innerHTML=e,t}}function Ze(n,e,i=n,t){if(e===Ye)return e;let o=t!==void 0?i._$Co?.[t]:i._$Cl;const a=tt(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(n),o._$AT(n,i,t)),t!==void 0?(i._$Co??=[])[t]=o:i._$Cl=o),o!==void 0&&(e=Ze(n,o._$AS(n,e.values),o,t)),e}class mn{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:t}=this._$AD,o=(e?.creationScope??Be).importNode(i,!0);Ve.currentNode=o;let a=Ve.nextNode(),s=0,r=0,d=t[0];for(;d!==void 0;){if(s===d.index){let c;d.type===2?c=new ot(a,a.nextSibling,this,e):d.type===1?c=new d.ctor(a,d.name,d.strings,this,e):d.type===6&&(c=new vn(a,this,e)),this._$AV.push(c),d=t[++r]}s!==d?.index&&(a=Ve.nextNode(),s++)}return Ve.currentNode=Be,o}p(e){let i=0;for(const t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(e,t,i),i+=t.strings.length-2):t._$AI(e[i])),i++}}class ot{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,i,t,o){this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=t,this.options=o,this._$Cv=o?.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=Ze(this,e,i),tt(e)?e===x||e==null||e===""?(this._$AH!==x&&this._$AR(),this._$AH=x):e!==this._$AH&&e!==Ye&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):yn(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!==x&&tt(this._$AH)?this._$AA.nextSibling.data=e:this.T(Be.createTextNode(e)),this._$AH=e}$(e){const{values:i,_$litType$:t}=e,o=typeof t=="number"?this._$AC(e):(t.el===void 0&&(t.el=nt.createElement(ji(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===o)this._$AH.p(i);else{const a=new mn(o,this),s=a.u(this.options);a.p(i),this.T(s),this._$AH=a}}_$AC(e){let i=ki.get(e.strings);return i===void 0&&ki.set(e.strings,i=new nt(e)),i}k(e){Ct(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let t,o=0;for(const a of e)o===i.length?i.push(t=new ot(this.O(et()),this.O(et()),this,this.options)):t=i[o],t._$AI(a),o++;o<i.length&&(this._$AR(t&&t._$AB.nextSibling,o),i.length=o)}_$AR(e=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);e!==this._$AB;){const t=hi(e).nextSibling;hi(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class ft{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,i,t,o,a){this.type=1,this._$AH=x,this._$AN=void 0,this.element=e,this.name=i,this._$AM=o,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=x}_$AI(e,i=this,t,o){const a=this.strings;let s=!1;if(a===void 0)e=Ze(this,e,i,0),s=!tt(e)||e!==this._$AH&&e!==Ye,s&&(this._$AH=e);else{const r=e;let d,c;for(e=a[0],d=0;d<a.length-1;d++)c=Ze(this,r[t+d],i,d),c===Ye&&(c=this._$AH[d]),s||=!tt(c)||c!==this._$AH[d],c===x?e=x:e!==x&&(e+=(c??"")+a[d+1]),this._$AH[d]=c}s&&!o&&this.j(e)}j(e){e===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class wn extends ft{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===x?void 0:e}}class bn extends ft{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==x)}}class In extends ft{constructor(e,i,t,o,a){super(e,i,t,o,a),this.type=5}_$AI(e,i=this){if((e=Ze(this,e,i,0)??x)===Ye)return;const t=this._$AH,o=e===x&&t!==x||e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive,a=e!==x&&(t===x||o);o&&this.element.removeEventListener(this.name,this,t),a&&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 vn{constructor(e,i,t){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(e){Ze(this,e)}}const An=Ut.litHtmlPolyfillSupport;An?.(nt,ot),(Ut.litHtmlVersions??=[]).push("3.3.3");const kn=(n,e,i)=>{const t=i?.renderBefore??e;let o=t._$litPart$;if(o===void 0){const a=i?.renderBefore??null;t._$litPart$=o=new ot(e.insertBefore(et(),a),a,void 0,i??{})}return o._$AI(n),o};const Rt=globalThis;class We extends Je{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=kn(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ye}}We._$litElement$=!0,We.finalized=!0,Rt.litElementHydrateSupport?.({LitElement:We});const jn=Rt.litElementPolyfillSupport;jn?.({LitElement:We}),(Rt.litElementVersions??=[]).push("4.2.2");const Ge=n=>(e,i)=>{i!==void 0?i.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};const Sn={attribute:!0,type:String,converter:pt,reflect:!1,hasChanged:Pt},$n=(n=Sn,e,i)=>{const{kind:t,metadata:o}=i;let a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),t==="setter"&&((n=Object.create(n)).wrapped=!0),a.set(i.name,n),t==="accessor"){const{name:s}=i;return{set(r){const d=e.get.call(this);e.set.call(this,r),this.requestUpdate(s,d,n,!0,r)},init(r){return r!==void 0&&this.C(s,void 0,n,r),r}}}if(t==="setter"){const{name:s}=i;return function(r){const d=this[s];e.call(this,r),this.requestUpdate(s,d,n,!0,r)}}throw Error("Unsupported decorator location: "+t)};function F(n){return(e,i)=>typeof i=="object"?$n(n,e,i):((t,o,a)=>{const s=o.hasOwnProperty(a);return o.constructor.createProperty(a,t),s?Object.getOwnPropertyDescriptor(o,a):void 0})(n,e,i)}function z(n){return F({...n,state:!0,attribute:!1})}const Pn=(n,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,i),i);function Si(n,e){return(i,t,o)=>{const a=s=>s.renderRoot?.querySelector(n)??null;return Pn(i,t,{get(){return a(this)}})}}function Un(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var at={exports:{}},Et={exports:{}},yt={exports:{}},Cn=yt.exports,$i;function Pi(){return $i||($i=1,(function(n){(function(e){var i,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,o=Math.ceil,a=Math.floor,s="[BigNumber Error] ",r=s+"Number primitive has more than 15 significant digits: ",d=1e14,c=14,h=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,j=1e9;function E(H){var L,ee,V,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),T=20,te=4,re=-7,de=21,Ce=-1e7,Ie=1e7,qe=!1,ct=1,De=0,ii={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Ke="0123456789abcdefghijklmnopqrstuvwxyz",ni=!0;function M(l,f){var y,A,w,I,$,g,b,k,v=this;if(!(v instanceof M))return new M(l,f);if(f==null){if(l&&l._isBigNumber===!0){v.s=l.s,!l.c||l.e>Ie?v.c=v.e=null:l.e<Ce?v.c=[v.e=0]:(v.e=l.e,v.c=l.c.slice());return}if((g=typeof l=="number")&&l*0==0){if(v.s=1/l<0?(l=-l,-1):1,l===~~l){for(I=0,$=l;$>=10;$/=10,I++);I>Ie?v.c=v.e=null:(v.e=I,v.c=[l]);return}k=String(l)}else{if(!t.test(k=String(l)))return V(v,k,g);v.s=k.charCodeAt(0)==45?(k=k.slice(1),-1):1}(I=k.indexOf("."))>-1&&(k=k.replace(".","")),($=k.search(/e/i))>0?(I<0&&(I=$),I+=+k.slice($+1),k=k.substring(0,$)):I<0&&(I=k.length)}else{if(_(f,2,Ke.length,"Base"),f==10&&ni)return v=new M(l),je(v,T+v.e+1,te);if(k=String(l),g=typeof l=="number"){if(l*0!=0)return V(v,k,g,f);if(v.s=1/l<0?(k=k.slice(1),-1):1,M.DEBUG&&k.replace(/^0\.0*|\./,"").length>15)throw Error(r+l)}else v.s=k.charCodeAt(0)===45?(k=k.slice(1),-1):1;for(y=Ke.slice(0,f),I=$=0,b=k.length;$<b;$++)if(y.indexOf(A=k.charAt($))<0){if(A=="."){if($>I){I=b;continue}}else if(!w&&(k==k.toUpperCase()&&(k=k.toLowerCase())||k==k.toLowerCase()&&(k=k.toUpperCase()))){w=!0,$=-1,I=0;continue}return V(v,String(l),g,f)}g=!1,k=ee(k,f,10,v.s),(I=k.indexOf("."))>-1?k=k.replace(".",""):I=k.length}for($=0;k.charCodeAt($)===48;$++);for(b=k.length;k.charCodeAt(--b)===48;);if(k=k.slice($,++b)){if(b-=$,g&&M.DEBUG&&b>15&&(l>h||l!==a(l)))throw Error(r+v.s*l);if((I=I-$-1)>Ie)v.c=v.e=null;else if(I<Ce)v.c=[v.e=0];else{if(v.e=I,v.c=[],$=(I+1)%c,I<0&&($+=c),$<b){for($&&v.c.push(+k.slice(0,$)),b-=c;$<b;)v.c.push(+k.slice($,$+=c));$=c-(k=k.slice($)).length}else $-=b;for(;$--;k+="0");v.c.push(+k)}}else v.c=[v.e=0]}M.clone=E,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.set=function(l){var f,y;if(l!=null)if(typeof l=="object"){if(l.hasOwnProperty(f="DECIMAL_PLACES")&&(y=l[f],_(y,0,j,f),T=y),l.hasOwnProperty(f="ROUNDING_MODE")&&(y=l[f],_(y,0,8,f),te=y),l.hasOwnProperty(f="EXPONENTIAL_AT")&&(y=l[f],y&&y.pop?(_(y[0],-j,0,f),_(y[1],0,j,f),re=y[0],de=y[1]):(_(y,-j,j,f),re=-(de=y<0?-y:y))),l.hasOwnProperty(f="RANGE"))if(y=l[f],y&&y.pop)_(y[0],-j,-1,f),_(y[1],1,j,f),Ce=y[0],Ie=y[1];else if(_(y,-j,j,f),y)Ce=-(Ie=y<0?-y:y);else throw Error(s+f+" cannot be zero: "+y);if(l.hasOwnProperty(f="CRYPTO"))if(y=l[f],y===!!y)if(y)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))qe=y;else throw qe=!y,Error(s+"crypto unavailable");else qe=y;else throw Error(s+f+" not true or false: "+y);if(l.hasOwnProperty(f="MODULO_MODE")&&(y=l[f],_(y,0,9,f),ct=y),l.hasOwnProperty(f="POW_PRECISION")&&(y=l[f],_(y,0,j,f),De=y),l.hasOwnProperty(f="FORMAT"))if(y=l[f],typeof y=="object")ii=y;else throw Error(s+f+" not an object: "+y);if(l.hasOwnProperty(f="ALPHABET"))if(y=l[f],typeof y=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(y))ni=y.slice(0,10)=="0123456789",Ke=y;else throw Error(s+f+" invalid: "+y)}else throw Error(s+"Object expected: "+l);return{DECIMAL_PLACES:T,ROUNDING_MODE:te,EXPONENTIAL_AT:[re,de],RANGE:[Ce,Ie],CRYPTO:qe,MODULO_MODE:ct,POW_PRECISION:De,FORMAT:ii,ALPHABET:Ke}},M.isBigNumber=function(l){if(!l||l._isBigNumber!==!0)return!1;if(!M.DEBUG)return!0;var f,y,A=l.c,w=l.e,I=l.s;e:if({}.toString.call(A)=="[object Array]"){if((I===1||I===-1)&&w>=-j&&w<=j&&w===a(w)){if(A[0]===0){if(w===0&&A.length===1)return!0;break e}if(f=(w+1)%c,f<1&&(f+=c),String(A[0]).length==f){for(f=0;f<A.length;f++)if(y=A[f],y<0||y>=d||y!==a(y))break e;if(y!==0)return!0}}}else if(A===null&&w===null&&(I===null||I===1||I===-1))return!0;throw Error(s+"Invalid BigNumber: "+l)},M.maximum=M.max=function(){return nn(arguments,-1)},M.minimum=M.min=function(){return nn(arguments,1)},M.random=(function(){var l=9007199254740992,f=Math.random()*l&2097151?function(){return a(Math.random()*l)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(y){var A,w,I,$,g,b=0,k=[],v=new M(J);if(y==null?y=T:_(y,0,j),$=o(y/c),qe)if(crypto.getRandomValues){for(A=crypto.getRandomValues(new Uint32Array($*=2));b<$;)g=A[b]*131072+(A[b+1]>>>11),g>=9e15?(w=crypto.getRandomValues(new Uint32Array(2)),A[b]=w[0],A[b+1]=w[1]):(k.push(g%1e14),b+=2);b=$/2}else if(crypto.randomBytes){for(A=crypto.randomBytes($*=7);b<$;)g=(A[b]&31)*281474976710656+A[b+1]*1099511627776+A[b+2]*4294967296+A[b+3]*16777216+(A[b+4]<<16)+(A[b+5]<<8)+A[b+6],g>=9e15?crypto.randomBytes(7).copy(A,b):(k.push(g%1e14),b+=7);b=$/7}else throw qe=!1,Error(s+"crypto unavailable");if(!qe)for(;b<$;)g=f(),g<9e15&&(k[b++]=g%1e14);for($=k[--b],y%=c,$&&y&&(g=u[c-y],k[b]=a($/g)*g);k[b]===0;k.pop(),b--);if(b<0)k=[I=0];else{for(I=-1;k[0]===0;k.splice(0,1),I-=c);for(b=1,g=k[0];g>=10;g/=10,b++);b<c&&(I-=c-b)}return v.e=I,v.c=k,v}})(),M.sum=function(){for(var l=1,f=arguments,y=new M(f[0]);l<f.length;)y=y.plus(f[l++]);return y},ee=(function(){var l="0123456789";function f(y,A,w,I){for(var $,g=[0],b,k=0,v=y.length;k<v;){for(b=g.length;b--;g[b]*=A);for(g[0]+=I.indexOf(y.charAt(k++)),$=0;$<g.length;$++)g[$]>w-1&&(g[$+1]==null&&(g[$+1]=0),g[$+1]+=g[$]/w|0,g[$]%=w)}return g.reverse()}return function(y,A,w,I,$){var g,b,k,v,C,D,B,ie,le=y.indexOf("."),he=T,O=te;for(le>=0&&(v=De,De=0,y=y.replace(".",""),ie=new M(A),D=ie.pow(y.length-le),De=v,ie.c=f(ne(W(D.c),D.e,"0"),10,w,l),ie.e=ie.c.length),B=f(y,A,w,$?(g=Ke,l):(g=l,Ke)),k=v=B.length;B[--v]==0;B.pop());if(!B[0])return g.charAt(0);if(le<0?--k:(D.c=B,D.e=k,D.s=I,D=L(D,ie,he,O,w),B=D.c,C=D.r,k=D.e),b=k+he+1,le=B[b],v=w/2,C=C||b<0||B[b+1]!=null,C=O<4?(le!=null||C)&&(O==0||O==(D.s<0?3:2)):le>v||le==v&&(O==4||C||O==6&&B[b-1]&1||O==(D.s<0?8:7)),b<1||!B[0])y=C?ne(g.charAt(1),-he,g.charAt(0)):g.charAt(0);else{if(B.length=b,C)for(--w;++B[--b]>w;)B[b]=0,b||(++k,B=[1].concat(B));for(v=B.length;!B[--v];);for(le=0,y="";le<=v;y+=g.charAt(B[le++]));y=ne(y,k,g.charAt(0))}return y}})(),L=(function(){function l(A,w,I){var $,g,b,k,v=0,C=A.length,D=w%m,B=w/m|0;for(A=A.slice();C--;)b=A[C]%m,k=A[C]/m|0,$=B*b+k*D,g=D*b+$%m*m+v,v=(g/I|0)+($/m|0)+B*k,A[C]=g%I;return v&&(A=[v].concat(A)),A}function f(A,w,I,$){var g,b;if(I!=$)b=I>$?1:-1;else for(g=b=0;g<I;g++)if(A[g]!=w[g]){b=A[g]>w[g]?1:-1;break}return b}function y(A,w,I,$){for(var g=0;I--;)A[I]-=g,g=A[I]<w[I]?1:0,A[I]=g*$+A[I]-w[I];for(;!A[0]&&A.length>1;A.splice(0,1));}return function(A,w,I,$,g){var b,k,v,C,D,B,ie,le,he,O,se,me,jt,si,ri,Me,dt,Se=A.s==w.s?1:-1,we=A.c,ue=w.c;if(!we||!we[0]||!ue||!ue[0])return new M(!A.s||!w.s||(we?ue&&we[0]==ue[0]:!ue)?NaN:we&&we[0]==0||!ue?Se*0:Se/0);for(le=new M(Se),he=le.c=[],k=A.e-w.e,Se=I+k+1,g||(g=d,k=Q(A.e/c)-Q(w.e/c),Se=Se/c|0),v=0;ue[v]==(we[v]||0);v++);if(ue[v]>(we[v]||0)&&k--,Se<0)he.push(1),C=!0;else{for(si=we.length,Me=ue.length,v=0,Se+=2,D=a(g/(ue[0]+1)),D>1&&(ue=l(ue,D,g),we=l(we,D,g),Me=ue.length,si=we.length),jt=Me,O=we.slice(0,Me),se=O.length;se<Me;O[se++]=0);dt=ue.slice(),dt=[0].concat(dt),ri=ue[0],ue[1]>=g/2&&ri++;do{if(D=0,b=f(ue,O,Me,se),b<0){if(me=O[0],Me!=se&&(me=me*g+(O[1]||0)),D=a(me/ri),D>1)for(D>=g&&(D=g-1),B=l(ue,D,g),ie=B.length,se=O.length;f(B,O,ie,se)==1;)D--,y(B,Me<ie?dt:ue,ie,g),ie=B.length,b=1;else D==0&&(b=D=1),B=ue.slice(),ie=B.length;if(ie<se&&(B=[0].concat(B)),y(O,B,se,g),se=O.length,b==-1)for(;f(ue,O,Me,se)<1;)D++,y(O,Me<se?dt:ue,se,g),se=O.length}else b===0&&(D++,O=[0]);he[v++]=D,O[0]?O[se++]=we[jt]||0:(O=[we[jt]],se=1)}while((jt++<si||O[0]!=null)&&Se--);C=O[0]!=null,he[0]||he.splice(0,1)}if(g==d){for(v=1,Se=he[0];Se>=10;Se/=10,v++);je(le,I+(le.e=v+k*c-1)+1,$,C)}else le.e=k,le.r=+C;return le}})();function oi(l,f,y,A){var w,I,$,g,b;if(y==null?y=te:_(y,0,8),!l.c)return l.toString();if(w=l.c[0],$=l.e,f==null)b=W(l.c),b=A==1||A==2&&($<=re||$>=de)?Y(b,$):ne(b,$,"0");else if(l=je(new M(l),f,y),I=l.e,b=W(l.c),g=b.length,A==1||A==2&&(f<=I||I<=re)){for(;g<f;b+="0",g++);b=Y(b,I)}else if(f-=$+(A===2&&I>$),b=ne(b,I,"0"),I+1>g){if(--f>0)for(b+=".";f--;b+="0");}else if(f+=I-g,f>0)for(I+1==g&&(b+=".");f--;b+="0");return l.s<0&&w?"-"+b:b}function nn(l,f){for(var y,A,w=1,I=new M(l[0]);w<l.length;w++)A=new M(l[w]),(!A.s||(y=K(I,A))===f||y===0&&I.s===f)&&(I=A);return I}function ai(l,f,y){for(var A=1,w=f.length;!f[--w];f.pop());for(w=f[0];w>=10;w/=10,A++);return(y=A+y*c-1)>Ie?l.c=l.e=null:y<Ce?l.c=[l.e=0]:(l.e=y,l.c=f),l}V=(function(){var l=/^(-?)0([xbo])(?=\w[\w.]*$)/i,f=/^([^.]+)\.$/,y=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(I,$,g,b){var k,v=g?$:$.replace(w,"");if(A.test(v))I.s=isNaN(v)?null:v<0?-1:1;else{if(!g&&(v=v.replace(l,function(C,D,B){return k=(B=B.toLowerCase())=="x"?16:B=="b"?2:8,!b||b==k?D:C}),b&&(k=b,v=v.replace(f,"$1").replace(y,"0.$1")),$!=v))return new M(v,k);if(M.DEBUG)throw Error(s+"Not a"+(b?" base "+b:"")+" number: "+$);I.s=null}I.c=I.e=null}})();function je(l,f,y,A){var w,I,$,g,b,k,v,C=l.c,D=u;if(C){e:{for(w=1,g=C[0];g>=10;g/=10,w++);if(I=f-w,I<0)I+=c,$=f,b=C[k=0],v=a(b/D[w-$-1]%10);else if(k=o((I+1)/c),k>=C.length)if(A){for(;C.length<=k;C.push(0));b=v=0,w=1,I%=c,$=I-c+1}else break e;else{for(b=g=C[k],w=1;g>=10;g/=10,w++);I%=c,$=I-c+w,v=$<0?0:a(b/D[w-$-1]%10)}if(A=A||f<0||C[k+1]!=null||($<0?b:b%D[w-$-1]),A=y<4?(v||A)&&(y==0||y==(l.s<0?3:2)):v>5||v==5&&(y==4||A||y==6&&(I>0?$>0?b/D[w-$]:0:C[k-1])%10&1||y==(l.s<0?8:7)),f<1||!C[0])return C.length=0,A?(f-=l.e+1,C[0]=D[(c-f%c)%c],l.e=-f||0):C[0]=l.e=0,l;if(I==0?(C.length=k,g=1,k--):(C.length=k+1,g=D[c-I],C[k]=$>0?a(b/D[w-$]%D[$])*g:0),A)for(;;)if(k==0){for(I=1,$=C[0];$>=10;$/=10,I++);for($=C[0]+=g,g=1;$>=10;$/=10,g++);I!=g&&(l.e++,C[0]==d&&(C[0]=1));break}else{if(C[k]+=g,C[k]!=d)break;C[k--]=0,g=1}for(I=C.length;C[--I]===0;C.pop());}l.e>Ie?l.c=l.e=null:l.e<Ce&&(l.c=[l.e=0])}return l}function _e(l){var f,y=l.e;return y===null?l.toString():(f=W(l.c),f=y<=re||y>=de?Y(f,y):ne(f,y,"0"),l.s<0?"-"+f:f)}return R.absoluteValue=R.abs=function(){var l=new M(this);return l.s<0&&(l.s=1),l},R.comparedTo=function(l,f){return K(this,new M(l,f))},R.decimalPlaces=R.dp=function(l,f){var y,A,w,I=this;if(l!=null)return _(l,0,j),f==null?f=te:_(f,0,8),je(new M(I),l+I.e+1,f);if(!(y=I.c))return null;if(A=((w=y.length-1)-Q(this.e/c))*c,w=y[w])for(;w%10==0;w/=10,A--);return A<0&&(A=0),A},R.dividedBy=R.div=function(l,f){return L(this,new M(l,f),T,te)},R.dividedToIntegerBy=R.idiv=function(l,f){return L(this,new M(l,f),0,1)},R.exponentiatedBy=R.pow=function(l,f){var y,A,w,I,$,g,b,k,v,C=this;if(l=new M(l),l.c&&!l.isInteger())throw Error(s+"Exponent not an integer: "+_e(l));if(f!=null&&(f=new M(f)),g=l.e>14,!C.c||!C.c[0]||C.c[0]==1&&!C.e&&C.c.length==1||!l.c||!l.c[0])return v=new M(Math.pow(+_e(C),g?l.s*(2-N(l)):+_e(l))),f?v.mod(f):v;if(b=l.s<0,f){if(f.c?!f.c[0]:!f.s)return new M(NaN);A=!b&&C.isInteger()&&f.isInteger(),A&&(C=C.mod(f))}else{if(l.e>9&&(C.e>0||C.e<-1||(C.e==0?C.c[0]>1||g&&C.c[1]>=24e7:C.c[0]<8e13||g&&C.c[0]<=9999975e7)))return I=C.s<0&&N(l)?-0:0,C.e>-1&&(I=1/I),new M(b?1/I:I);De&&(I=o(De/c+2))}for(g?(y=new M(.5),b&&(l.s=1),k=N(l)):(w=Math.abs(+_e(l)),k=w%2),v=new M(J);;){if(k){if(v=v.times(C),!v.c)break;I?v.c.length>I&&(v.c.length=I):A&&(v=v.mod(f))}if(w){if(w=a(w/2),w===0)break;k=w%2}else if(l=l.times(y),je(l,l.e+1,1),l.e>14)k=N(l);else{if(w=+_e(l),w===0)break;k=w%2}C=C.times(C),I?C.c&&C.c.length>I&&(C.c.length=I):A&&(C=C.mod(f))}return A?v:(b&&(v=J.div(v)),f?v.mod(f):I?je(v,De,te,$):v)},R.integerValue=function(l){var f=new M(this);return l==null?l=te:_(l,0,8),je(f,f.e+1,l)},R.isEqualTo=R.eq=function(l,f){return K(this,new M(l,f))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(l,f){return K(this,new M(l,f))>0},R.isGreaterThanOrEqualTo=R.gte=function(l,f){return(f=K(this,new M(l,f)))===1||f===0},R.isInteger=function(){return!!this.c&&Q(this.e/c)>this.c.length-2},R.isLessThan=R.lt=function(l,f){return K(this,new M(l,f))<0},R.isLessThanOrEqualTo=R.lte=function(l,f){return(f=K(this,new M(l,f)))===-1||f===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(l,f){var y,A,w,I,$=this,g=$.s;if(l=new M(l,f),f=l.s,!g||!f)return new M(NaN);if(g!=f)return l.s=-f,$.plus(l);var b=$.e/c,k=l.e/c,v=$.c,C=l.c;if(!b||!k){if(!v||!C)return v?(l.s=-f,l):new M(C?$:NaN);if(!v[0]||!C[0])return C[0]?(l.s=-f,l):new M(v[0]?$:te==3?-0:0)}if(b=Q(b),k=Q(k),v=v.slice(),g=b-k){for((I=g<0)?(g=-g,w=v):(k=b,w=C),w.reverse(),f=g;f--;w.push(0));w.reverse()}else for(A=(I=(g=v.length)<(f=C.length))?g:f,g=f=0;f<A;f++)if(v[f]!=C[f]){I=v[f]<C[f];break}if(I&&(w=v,v=C,C=w,l.s=-l.s),f=(A=C.length)-(y=v.length),f>0)for(;f--;v[y++]=0);for(f=d-1;A>g;){if(v[--A]<C[A]){for(y=A;y&&!v[--y];v[y]=f);--v[y],v[A]+=d}v[A]-=C[A]}for(;v[0]==0;v.splice(0,1),--k);return v[0]?ai(l,v,k):(l.s=te==3?-1:1,l.c=[l.e=0],l)},R.modulo=R.mod=function(l,f){var y,A,w=this;return l=new M(l,f),!w.c||!l.s||l.c&&!l.c[0]?new M(NaN):!l.c||w.c&&!w.c[0]?new M(w):(ct==9?(A=l.s,l.s=1,y=L(w,l,0,3),l.s=A,y.s*=A):y=L(w,l,0,ct),l=w.minus(y.times(l)),!l.c[0]&&ct==1&&(l.s=w.s),l)},R.multipliedBy=R.times=function(l,f){var y,A,w,I,$,g,b,k,v,C,D,B,ie,le,he,O=this,se=O.c,me=(l=new M(l,f)).c;if(!se||!me||!se[0]||!me[0])return!O.s||!l.s||se&&!se[0]&&!me||me&&!me[0]&&!se?l.c=l.e=l.s=null:(l.s*=O.s,!se||!me?l.c=l.e=null:(l.c=[0],l.e=0)),l;for(A=Q(O.e/c)+Q(l.e/c),l.s*=O.s,b=se.length,C=me.length,b<C&&(ie=se,se=me,me=ie,w=b,b=C,C=w),w=b+C,ie=[];w--;ie.push(0));for(le=d,he=m,w=C;--w>=0;){for(y=0,D=me[w]%he,B=me[w]/he|0,$=b,I=w+$;I>w;)k=se[--$]%he,v=se[$]/he|0,g=B*k+v*D,k=D*k+g%he*he+ie[I]+y,y=(k/le|0)+(g/he|0)+B*v,ie[I--]=k%le;ie[I]=y}return y?++A:ie.splice(0,1),ai(l,ie,A)},R.negated=function(){var l=new M(this);return l.s=-l.s||null,l},R.plus=function(l,f){var y,A=this,w=A.s;if(l=new M(l,f),f=l.s,!w||!f)return new M(NaN);if(w!=f)return l.s=-f,A.minus(l);var I=A.e/c,$=l.e/c,g=A.c,b=l.c;if(!I||!$){if(!g||!b)return new M(w/0);if(!g[0]||!b[0])return b[0]?l:new M(g[0]?A:w*0)}if(I=Q(I),$=Q($),g=g.slice(),w=I-$){for(w>0?($=I,y=b):(w=-w,y=g),y.reverse();w--;y.push(0));y.reverse()}for(w=g.length,f=b.length,w-f<0&&(y=b,b=g,g=y,f=w),w=0;f;)w=(g[--f]=g[f]+b[f]+w)/d|0,g[f]=d===g[f]?0:g[f]%d;return w&&(g=[w].concat(g),++$),ai(l,g,$)},R.precision=R.sd=function(l,f){var y,A,w,I=this;if(l!=null&&l!==!!l)return _(l,1,j),f==null?f=te:_(f,0,8),je(new M(I),l,f);if(!(y=I.c))return null;if(w=y.length-1,A=w*c+1,w=y[w]){for(;w%10==0;w/=10,A--);for(w=y[0];w>=10;w/=10,A++);}return l&&I.e+1>A&&(A=I.e+1),A},R.shiftedBy=function(l){return _(l,-h,h),this.times("1e"+l)},R.squareRoot=R.sqrt=function(){var l,f,y,A,w,I=this,$=I.c,g=I.s,b=I.e,k=T+4,v=new M("0.5");if(g!==1||!$||!$[0])return new M(!g||g<0&&(!$||$[0])?NaN:$?I:1/0);if(g=Math.sqrt(+_e(I)),g==0||g==1/0?(f=W($),(f.length+b)%2==0&&(f+="0"),g=Math.sqrt(+f),b=Q((b+1)/2)-(b<0||b%2),g==1/0?f="5e"+b:(f=g.toExponential(),f=f.slice(0,f.indexOf("e")+1)+b),y=new M(f)):y=new M(g+""),y.c[0]){for(b=y.e,g=b+k,g<3&&(g=0);;)if(w=y,y=v.times(w.plus(L(I,w,k,1))),W(w.c).slice(0,g)===(f=W(y.c)).slice(0,g))if(y.e<b&&--g,f=f.slice(g-3,g+1),f=="9999"||!A&&f=="4999"){if(!A&&(je(w,w.e+T+2,0),w.times(w).eq(I))){y=w;break}k+=4,g+=4,A=1}else{(!+f||!+f.slice(1)&&f.charAt(0)=="5")&&(je(y,y.e+T+2,1),l=!y.times(y).eq(I));break}}return je(y,y.e+T+1,te,l)},R.toExponential=function(l,f){return l!=null&&(_(l,0,j),l++),oi(this,l,f,1)},R.toFixed=function(l,f){return l!=null&&(_(l,0,j),l=l+this.e+1),oi(this,l,f)},R.toFormat=function(l,f,y){var A,w=this;if(y==null)l!=null&&f&&typeof f=="object"?(y=f,f=null):l&&typeof l=="object"?(y=l,l=f=null):y=ii;else if(typeof y!="object")throw Error(s+"Argument not an object: "+y);if(A=w.toFixed(l,f),w.c){var I,$=A.split("."),g=+y.groupSize,b=+y.secondaryGroupSize,k=y.groupSeparator||"",v=$[0],C=$[1],D=w.s<0,B=D?v.slice(1):v,ie=B.length;if(b&&(I=g,g=b,b=I,ie-=I),g>0&&ie>0){for(I=ie%g||g,v=B.substr(0,I);I<ie;I+=g)v+=k+B.substr(I,g);b>0&&(v+=k+B.slice(I)),D&&(v="-"+v)}A=C?v+(y.decimalSeparator||"")+((b=+y.fractionGroupSize)?C.replace(new RegExp("\\d{"+b+"}\\B","g"),"$&"+(y.fractionGroupSeparator||"")):C):v}return(y.prefix||"")+A+(y.suffix||"")},R.toFraction=function(l){var f,y,A,w,I,$,g,b,k,v,C,D,B=this,ie=B.c;if(l!=null&&(g=new M(l),!g.isInteger()&&(g.c||g.s!==1)||g.lt(J)))throw Error(s+"Argument "+(g.isInteger()?"out of range: ":"not an integer: ")+_e(g));if(!ie)return new M(B);for(f=new M(J),k=y=new M(J),A=b=new M(J),D=W(ie),I=f.e=D.length-B.e-1,f.c[0]=u[($=I%c)<0?c+$:$],l=!l||g.comparedTo(f)>0?I>0?f:k:g,$=Ie,Ie=1/0,g=new M(D),b.c[0]=0;v=L(g,f,0,1),w=y.plus(v.times(A)),w.comparedTo(l)!=1;)y=A,A=w,k=b.plus(v.times(w=k)),b=w,f=g.minus(v.times(w=f)),g=w;return w=L(l.minus(y),A,0,1),b=b.plus(w.times(k)),y=y.plus(w.times(A)),b.s=k.s=B.s,I=I*2,C=L(k,A,I,te).minus(B).abs().comparedTo(L(b,y,I,te).minus(B).abs())<1?[k,A]:[b,y],Ie=$,C},R.toNumber=function(){return+_e(this)},R.toPrecision=function(l,f){return l!=null&&_(l,1,j),oi(this,l,f,2)},R.toString=function(l){var f,y=this,A=y.s,w=y.e;return w===null?A?(f="Infinity",A<0&&(f="-"+f)):f="NaN":(l==null?f=w<=re||w>=de?Y(W(y.c),w):ne(W(y.c),w,"0"):l===10&&ni?(y=je(new M(y),T+w+1,te),f=ne(W(y.c),y.e,"0")):(_(l,2,Ke.length,"Base"),f=ee(ne(W(y.c),w,"0"),10,l,A,!0)),A<0&&y.c[0]&&(f="-"+f)),f},R.valueOf=R.toJSON=function(){return _e(this)},R._isBigNumber=!0,H!=null&&M.set(H),M}function Q(H){var L=H|0;return H>0||H===L?L:L-1}function W(H){for(var L,ee,V=1,R=H.length,J=H[0]+"";V<R;){for(L=H[V++]+"",ee=c-L.length;ee--;L="0"+L);J+=L}for(R=J.length;J.charCodeAt(--R)===48;);return J.slice(0,R+1||1)}function K(H,L){var ee,V,R=H.c,J=L.c,T=H.s,te=L.s,re=H.e,de=L.e;if(!T||!te)return null;if(ee=R&&!R[0],V=J&&!J[0],ee||V)return ee?V?0:-te:T;if(T!=te)return T;if(ee=T<0,V=re==de,!R||!J)return V?0:!R^ee?1:-1;if(!V)return re>de^ee?1:-1;for(te=(re=R.length)<(de=J.length)?re:de,T=0;T<te;T++)if(R[T]!=J[T])return R[T]>J[T]^ee?1:-1;return re==de?0:re>de^ee?1:-1}function _(H,L,ee,V){if(H<L||H>ee||H!==a(H))throw Error(s+(V||"Argument")+(typeof H=="number"?H<L||H>ee?" out of range: ":" not an integer: ":" not a primitive number: ")+String(H))}function N(H){var L=H.c.length-1;return Q(H.e/c)==L&&H.c[L]%2!=0}function Y(H,L){return(H.length>1?H.charAt(0)+"."+H.slice(1):H)+(L<0?"e":"e+")+L}function ne(H,L,ee){var V,R;if(L<0){for(R=ee+".";++L;R+=ee);H=R+H}else if(V=H.length,++L>V){for(R=ee,L-=V;--L;R+=ee);H+=R}else L<V&&(H=H.slice(0,L)+"."+H.slice(L));return H}i=E(),i.default=i.BigNumber=i,n.exports?n.exports=i:(e||(e=typeof self<"u"&&self?self:window),e.BigNumber=i)})(Cn)})(yt)),yt.exports}var Ui;function Mn(){return Ui||(Ui=1,(function(n){var e=Pi(),i=n.exports;(function(){var t=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o,a,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},r;function d(h){return t.lastIndex=0,t.test(h)?'"'+h.replace(t,function(u){var m=s[u];return typeof m=="string"?m:"\\u"+("0000"+u.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+h+'"'}function c(h,u){var m,j,E,Q,W=o,K,_=u[h],N=_!=null&&(_ instanceof e||e.isBigNumber(_));switch(_&&typeof _=="object"&&typeof _.toJSON=="function"&&(_=_.toJSON(h)),typeof r=="function"&&(_=r.call(u,h,_)),typeof _){case"string":return N?_:d(_);case"number":return isFinite(_)?String(_):"null";case"boolean":case"null":case"bigint":return String(_);case"object":if(!_)return"null";if(o+=a,K=[],Object.prototype.toString.apply(_)==="[object Array]"){for(Q=_.length,m=0;m<Q;m+=1)K[m]=c(m,_)||"null";return E=K.length===0?"[]":o?`[
1
+ var AuthUI=(function(P){"use strict";var qe;const ut=globalThis,$t=ut.ShadowRoot&&(ut.ShadyCSS===void 0||ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Pt=Symbol(),li=new WeakMap;let ui=class{constructor(e,i,t){if(this._$cssResult$=!0,t!==Pt)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($t&&e===void 0){const t=i!==void 0&&i.length===1;t&&(e=li.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&li.set(i,e))}return e}toString(){return this.cssText}};const an=n=>new ui(typeof n=="string"?n:n+"",void 0,Pt),Le=(n,...e)=>{const i=n.length===1?n[0]:e.reduce((t,o,a)=>t+(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.")})(o)+n[a+1],n[0]);return new ui(i,n,Pt)},sn=(n,e)=>{if($t)n.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of e){const t=document.createElement("style"),o=ut.litNonce;o!==void 0&&t.setAttribute("nonce",o),t.textContent=i.cssText,n.appendChild(t)}},pi=$t?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let i="";for(const t of e.cssRules)i+=t.cssText;return an(i)})(n):n;const{is:rn,defineProperty:cn,getOwnPropertyDescriptor:dn,getOwnPropertyNames:ln,getOwnPropertySymbols:un,getPrototypeOf:pn}=Object,pt=globalThis,hi=pt.trustedTypes,hn=hi?hi.emptyScript:"",fn=pt.reactiveElementPolyfillSupport,et=(n,e)=>n,ht={toAttribute(n,e){switch(e){case Boolean:n=n?hn:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let i=n;switch(e){case Boolean:i=n!==null;break;case Number:i=n===null?null:Number(n);break;case Object:case Array:try{i=JSON.parse(n)}catch{i=null}}return i}},Ut=(n,e)=>!rn(n,e),fi={attribute:!0,type:String,converter:ht,reflect:!1,useDefault:!1,hasChanged:Ut};Symbol.metadata??=Symbol("metadata"),pt.litPropertyMetadata??=new WeakMap;let Je=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=fi){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 t=Symbol(),o=this.getPropertyDescriptor(e,t,i);o!==void 0&&cn(this.prototype,e,o)}}static getPropertyDescriptor(e,i,t){const{get:o,set:a}=dn(this.prototype,e)??{get(){return this[i]},set(s){this[i]=s}};return{get:o,set(s){const r=o?.call(this);a?.call(this,s),this.requestUpdate(e,r,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??fi}static _$Ei(){if(this.hasOwnProperty(et("elementProperties")))return;const e=pn(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(et("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(et("properties"))){const i=this.properties,t=[...ln(i),...un(i)];for(const o of t)this.createProperty(o,i[o])}const e=this[Symbol.metadata];if(e!==null){const i=litPropertyMetadata.get(e);if(i!==void 0)for(const[t,o]of i)this.elementProperties.set(t,o)}this._$Eh=new Map;for(const[i,t]of this.elementProperties){const o=this._$Eu(i,t);o!==void 0&&this._$Eh.set(o,i)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const i=[];if(Array.isArray(e)){const t=new Set(e.flat(1/0).reverse());for(const o of t)i.unshift(pi(o))}else e!==void 0&&i.push(pi(e));return i}static _$Eu(e,i){const t=i.attribute;return t===!1?void 0:typeof t=="string"?t: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 t of i.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return sn(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,t){this._$AK(e,t)}_$ET(e,i){const t=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,t);if(o!==void 0&&t.reflect===!0){const a=(t.converter?.toAttribute!==void 0?t.converter:ht).toAttribute(i,t.type);this._$Em=e,a==null?this.removeAttribute(o):this.setAttribute(o,a),this._$Em=null}}_$AK(e,i){const t=this.constructor,o=t._$Eh.get(e);if(o!==void 0&&this._$Em!==o){const a=t.getPropertyOptions(o),s=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:ht;this._$Em=o;const r=s.fromAttribute(i,a.type);this[o]=r??this._$Ej?.get(o)??r,this._$Em=null}}requestUpdate(e,i,t,o=!1,a){if(e!==void 0){const s=this.constructor;if(o===!1&&(a=this[e]),t??=s.getPropertyOptions(e),!((t.hasChanged??Ut)(a,i)||t.useDefault&&t.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,t))))return;this.C(e,i,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,i,{useDefault:t,reflect:o,wrapped:a},s){t&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??i??this[e]),a!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||t||(i=void 0),this._$AL.set(e,i)),o===!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[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[o,a]of t){const{wrapped:s}=a,r=this[o];s!==!0||this._$AL.has(o)||r===void 0||this.C(o,void 0,a,r)}}let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(i)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}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){}};Je.elementStyles=[],Je.shadowRootOptions={mode:"open"},Je[et("elementProperties")]=new Map,Je[et("finalized")]=new Map,fn?.({ReactiveElement:Je}),(pt.reactiveElementVersions??=[]).push("2.1.2");const Ct=globalThis,gi=n=>n,ft=Ct.trustedTypes,yi=ft?ft.createPolicy("lit-html",{createHTML:n=>n}):void 0,mi="$lit$",Ne=`lit$${Math.random().toFixed(9).slice(2)}$`,wi="?"+Ne,gn=`<${wi}>`,Be=document,tt=()=>Be.createComment(""),it=n=>n===null||typeof n!="object"&&typeof n!="function",Mt=Array.isArray,yn=n=>Mt(n)||typeof n?.[Symbol.iterator]=="function",Rt=`[
2
+ \f\r]`,nt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bi=/-->/g,Ii=/>/g,Xe=RegExp(`>|${Rt}(?:([^\\s"'>=/]+)(${Rt}*=${Rt}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),vi=/'/g,Ai=/"/g,ki=/^(?:script|style|textarea|title)$/i,Si=n=>(e,...i)=>({_$litType$:n,strings:e,values:i}),v=Si(1),G=Si(2),Ye=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),ji=new WeakMap,Ve=Be.createTreeWalker(Be,129);function $i(n,e){if(!Mt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return yi!==void 0?yi.createHTML(e):e}const mn=(n,e)=>{const i=n.length-1,t=[];let o,a=e===2?"<svg>":e===3?"<math>":"",s=nt;for(let r=0;r<i;r++){const d=n[r];let c,h,u=-1,m=0;for(;m<d.length&&(s.lastIndex=m,h=s.exec(d),h!==null);)m=s.lastIndex,s===nt?h[1]==="!--"?s=bi:h[1]!==void 0?s=Ii:h[2]!==void 0?(ki.test(h[2])&&(o=RegExp("</"+h[2],"g")),s=Xe):h[3]!==void 0&&(s=Xe):s===Xe?h[0]===">"?(s=o??nt,u=-1):h[1]===void 0?u=-2:(u=s.lastIndex-h[2].length,c=h[1],s=h[3]===void 0?Xe:h[3]==='"'?Ai:vi):s===Ai||s===vi?s=Xe:s===bi||s===Ii?s=nt:(s=Xe,o=void 0);const j=s===Xe&&n[r+1].startsWith("/>")?" ":"";a+=s===nt?d+gn:u>=0?(t.push(c),d.slice(0,u)+mi+d.slice(u)+Ne+j):d+Ne+(u===-2?r:j)}return[$i(n,a+(n[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),t]};class ot{constructor({strings:e,_$litType$:i},t){let o;this.parts=[];let a=0,s=0;const r=e.length-1,d=this.parts,[c,h]=mn(e,i);if(this.el=ot.createElement(c,t),Ve.currentNode=this.el.content,i===2||i===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=Ve.nextNode())!==null&&d.length<r;){if(o.nodeType===1){if(o.hasAttributes())for(const u of o.getAttributeNames())if(u.endsWith(mi)){const m=h[s++],j=o.getAttribute(u).split(Ne),q=/([.?@])?(.*)/.exec(m);d.push({type:1,index:a,name:q[2],strings:j,ctor:q[1]==="."?bn:q[1]==="?"?In:q[1]==="@"?vn:gt}),o.removeAttribute(u)}else u.startsWith(Ne)&&(d.push({type:6,index:a}),o.removeAttribute(u));if(ki.test(o.tagName)){const u=o.textContent.split(Ne),m=u.length-1;if(m>0){o.textContent=ft?ft.emptyScript:"";for(let j=0;j<m;j++)o.append(u[j],tt()),Ve.nextNode(),d.push({type:2,index:++a});o.append(u[m],tt())}}}else if(o.nodeType===8)if(o.data===wi)d.push({type:2,index:a});else{let u=-1;for(;(u=o.data.indexOf(Ne,u+1))!==-1;)d.push({type:7,index:a}),u+=Ne.length-1}a++}}static createElement(e,i){const t=Be.createElement("template");return t.innerHTML=e,t}}function Ze(n,e,i=n,t){if(e===Ye)return e;let o=t!==void 0?i._$Co?.[t]:i._$Cl;const a=it(e)?void 0:e._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),a===void 0?o=void 0:(o=new a(n),o._$AT(n,i,t)),t!==void 0?(i._$Co??=[])[t]=o:i._$Cl=o),o!==void 0&&(e=Ze(n,o._$AS(n,e.values),o,t)),e}class wn{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:t}=this._$AD,o=(e?.creationScope??Be).importNode(i,!0);Ve.currentNode=o;let a=Ve.nextNode(),s=0,r=0,d=t[0];for(;d!==void 0;){if(s===d.index){let c;d.type===2?c=new at(a,a.nextSibling,this,e):d.type===1?c=new d.ctor(a,d.name,d.strings,this,e):d.type===6&&(c=new An(a,this,e)),this._$AV.push(c),d=t[++r]}s!==d?.index&&(a=Ve.nextNode(),s++)}return Ve.currentNode=Be,o}p(e){let i=0;for(const t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(e,t,i),i+=t.strings.length-2):t._$AI(e[i])),i++}}class at{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,i,t,o){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=e,this._$AB=i,this._$AM=t,this.options=o,this._$Cv=o?.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=Ze(this,e,i),it(e)?e===E||e==null||e===""?(this._$AH!==E&&this._$AR(),this._$AH=E):e!==this._$AH&&e!==Ye&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):yn(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&&it(this._$AH)?this._$AA.nextSibling.data=e:this.T(Be.createTextNode(e)),this._$AH=e}$(e){const{values:i,_$litType$:t}=e,o=typeof t=="number"?this._$AC(e):(t.el===void 0&&(t.el=ot.createElement($i(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===o)this._$AH.p(i);else{const a=new wn(o,this),s=a.u(this.options);a.p(i),this.T(s),this._$AH=a}}_$AC(e){let i=ji.get(e.strings);return i===void 0&&ji.set(e.strings,i=new ot(e)),i}k(e){Mt(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let t,o=0;for(const a of e)o===i.length?i.push(t=new at(this.O(tt()),this.O(tt()),this,this.options)):t=i[o],t._$AI(a),o++;o<i.length&&(this._$AR(t&&t._$AB.nextSibling,o),i.length=o)}_$AR(e=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);e!==this._$AB;){const t=gi(e).nextSibling;gi(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class gt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,i,t,o,a){this.type=1,this._$AH=E,this._$AN=void 0,this.element=e,this.name=i,this._$AM=o,this.options=a,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=E}_$AI(e,i=this,t,o){const a=this.strings;let s=!1;if(a===void 0)e=Ze(this,e,i,0),s=!it(e)||e!==this._$AH&&e!==Ye,s&&(this._$AH=e);else{const r=e;let d,c;for(e=a[0],d=0;d<a.length-1;d++)c=Ze(this,r[t+d],i,d),c===Ye&&(c=this._$AH[d]),s||=!it(c)||c!==this._$AH[d],c===E?e=E:e!==E&&(e+=(c??"")+a[d+1]),this._$AH[d]=c}s&&!o&&this.j(e)}j(e){e===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class bn extends gt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===E?void 0:e}}class In extends gt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==E)}}class vn extends gt{constructor(e,i,t,o,a){super(e,i,t,o,a),this.type=5}_$AI(e,i=this){if((e=Ze(this,e,i,0)??E)===Ye)return;const t=this._$AH,o=e===E&&t!==E||e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive,a=e!==E&&(t===E||o);o&&this.element.removeEventListener(this.name,this,t),a&&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 An{constructor(e,i,t){this.element=e,this.type=6,this._$AN=void 0,this._$AM=i,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(e){Ze(this,e)}}const kn=Ct.litHtmlPolyfillSupport;kn?.(ot,at),(Ct.litHtmlVersions??=[]).push("3.3.3");const Sn=(n,e,i)=>{const t=i?.renderBefore??e;let o=t._$litPart$;if(o===void 0){const a=i?.renderBefore??null;t._$litPart$=o=new at(e.insertBefore(tt(),a),a,void 0,i??{})}return o._$AI(n),o};const Et=globalThis;class We extends Je{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=Sn(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ye}}We._$litElement$=!0,We.finalized=!0,Et.litElementHydrateSupport?.({LitElement:We});const jn=Et.litElementPolyfillSupport;jn?.({LitElement:We}),(Et.litElementVersions??=[]).push("4.2.2");const Ge=n=>(e,i)=>{i!==void 0?i.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};const $n={attribute:!0,type:String,converter:ht,reflect:!1,hasChanged:Ut},Pn=(n=$n,e,i)=>{const{kind:t,metadata:o}=i;let a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),t==="setter"&&((n=Object.create(n)).wrapped=!0),a.set(i.name,n),t==="accessor"){const{name:s}=i;return{set(r){const d=e.get.call(this);e.set.call(this,r),this.requestUpdate(s,d,n,!0,r)},init(r){return r!==void 0&&this.C(s,void 0,n,r),r}}}if(t==="setter"){const{name:s}=i;return function(r){const d=this[s];e.call(this,r),this.requestUpdate(s,d,n,!0,r)}}throw Error("Unsupported decorator location: "+t)};function ee(n){return(e,i)=>typeof i=="object"?Pn(n,e,i):((t,o,a)=>{const s=o.hasOwnProperty(a);return o.constructor.createProperty(a,t),s?Object.getOwnPropertyDescriptor(o,a):void 0})(n,e,i)}function Y(n){return ee({...n,state:!0,attribute:!1})}const Un=(n,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,i),i);function Pi(n,e){return(i,t,o)=>{const a=s=>s.renderRoot?.querySelector(n)??null;return Un(i,t,{get(){return a(this)}})}}function Cn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var st={exports:{}},qt={exports:{}},yt={exports:{}},Mn=yt.exports,Ui;function Ci(){return Ui||(Ui=1,(function(n){(function(e){var i,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,o=Math.ceil,a=Math.floor,s="[BigNumber Error] ",r=s+"Number primitive has more than 15 significant digits: ",d=1e14,c=14,h=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,j=1e9;function q(D){var N,te,V,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),z=20,ie=4,ce=-7,de=21,Ce=-1e7,ve=1e7,xe=!1,dt=1,De=0,oi={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Ke="0123456789abcdefghijklmnopqrstuvwxyz",ai=!0;function M(l,f){var g,k,w,I,$,y,b,S,A=this;if(!(A instanceof M))return new M(l,f);if(f==null){if(l&&l._isBigNumber===!0){A.s=l.s,!l.c||l.e>ve?A.c=A.e=null:l.e<Ce?A.c=[A.e=0]:(A.e=l.e,A.c=l.c.slice());return}if((y=typeof l=="number")&&l*0==0){if(A.s=1/l<0?(l=-l,-1):1,l===~~l){for(I=0,$=l;$>=10;$/=10,I++);I>ve?A.c=A.e=null:(A.e=I,A.c=[l]);return}S=String(l)}else{if(!t.test(S=String(l)))return V(A,S,y);A.s=S.charCodeAt(0)==45?(S=S.slice(1),-1):1}(I=S.indexOf("."))>-1&&(S=S.replace(".","")),($=S.search(/e/i))>0?(I<0&&(I=$),I+=+S.slice($+1),S=S.substring(0,$)):I<0&&(I=S.length)}else{if(_(f,2,Ke.length,"Base"),f==10&&ai)return A=new M(l),je(A,z+A.e+1,ie);if(S=String(l),y=typeof l=="number"){if(l*0!=0)return V(A,S,y,f);if(A.s=1/l<0?(S=S.slice(1),-1):1,M.DEBUG&&S.replace(/^0\.0*|\./,"").length>15)throw Error(r+l)}else A.s=S.charCodeAt(0)===45?(S=S.slice(1),-1):1;for(g=Ke.slice(0,f),I=$=0,b=S.length;$<b;$++)if(g.indexOf(k=S.charAt($))<0){if(k=="."){if($>I){I=b;continue}}else if(!w&&(S==S.toUpperCase()&&(S=S.toLowerCase())||S==S.toLowerCase()&&(S=S.toUpperCase()))){w=!0,$=-1,I=0;continue}return V(A,String(l),y,f)}y=!1,S=te(S,f,10,A.s),(I=S.indexOf("."))>-1?S=S.replace(".",""):I=S.length}for($=0;S.charCodeAt($)===48;$++);for(b=S.length;S.charCodeAt(--b)===48;);if(S=S.slice($,++b)){if(b-=$,y&&M.DEBUG&&b>15&&(l>h||l!==a(l)))throw Error(r+A.s*l);if((I=I-$-1)>ve)A.c=A.e=null;else if(I<Ce)A.c=[A.e=0];else{if(A.e=I,A.c=[],$=(I+1)%c,I<0&&($+=c),$<b){for($&&A.c.push(+S.slice(0,$)),b-=c;$<b;)A.c.push(+S.slice($,$+=c));$=c-(S=S.slice($)).length}else $-=b;for(;$--;S+="0");A.c.push(+S)}}else A.c=[A.e=0]}M.clone=q,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.set=function(l){var f,g;if(l!=null)if(typeof l=="object"){if(l.hasOwnProperty(f="DECIMAL_PLACES")&&(g=l[f],_(g,0,j,f),z=g),l.hasOwnProperty(f="ROUNDING_MODE")&&(g=l[f],_(g,0,8,f),ie=g),l.hasOwnProperty(f="EXPONENTIAL_AT")&&(g=l[f],g&&g.pop?(_(g[0],-j,0,f),_(g[1],0,j,f),ce=g[0],de=g[1]):(_(g,-j,j,f),ce=-(de=g<0?-g:g))),l.hasOwnProperty(f="RANGE"))if(g=l[f],g&&g.pop)_(g[0],-j,-1,f),_(g[1],1,j,f),Ce=g[0],ve=g[1];else if(_(g,-j,j,f),g)Ce=-(ve=g<0?-g:g);else throw Error(s+f+" cannot be zero: "+g);if(l.hasOwnProperty(f="CRYPTO"))if(g=l[f],g===!!g)if(g)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))xe=g;else throw xe=!g,Error(s+"crypto unavailable");else xe=g;else throw Error(s+f+" not true or false: "+g);if(l.hasOwnProperty(f="MODULO_MODE")&&(g=l[f],_(g,0,9,f),dt=g),l.hasOwnProperty(f="POW_PRECISION")&&(g=l[f],_(g,0,j,f),De=g),l.hasOwnProperty(f="FORMAT"))if(g=l[f],typeof g=="object")oi=g;else throw Error(s+f+" not an object: "+g);if(l.hasOwnProperty(f="ALPHABET"))if(g=l[f],typeof g=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(g))ai=g.slice(0,10)=="0123456789",Ke=g;else throw Error(s+f+" invalid: "+g)}else throw Error(s+"Object expected: "+l);return{DECIMAL_PLACES:z,ROUNDING_MODE:ie,EXPONENTIAL_AT:[ce,de],RANGE:[Ce,ve],CRYPTO:xe,MODULO_MODE:dt,POW_PRECISION:De,FORMAT:oi,ALPHABET:Ke}},M.isBigNumber=function(l){if(!l||l._isBigNumber!==!0)return!1;if(!M.DEBUG)return!0;var f,g,k=l.c,w=l.e,I=l.s;e:if({}.toString.call(k)=="[object Array]"){if((I===1||I===-1)&&w>=-j&&w<=j&&w===a(w)){if(k[0]===0){if(w===0&&k.length===1)return!0;break e}if(f=(w+1)%c,f<1&&(f+=c),String(k[0]).length==f){for(f=0;f<k.length;f++)if(g=k[f],g<0||g>=d||g!==a(g))break e;if(g!==0)return!0}}}else if(k===null&&w===null&&(I===null||I===1||I===-1))return!0;throw Error(s+"Invalid BigNumber: "+l)},M.maximum=M.max=function(){return on(arguments,-1)},M.minimum=M.min=function(){return on(arguments,1)},M.random=(function(){var l=9007199254740992,f=Math.random()*l&2097151?function(){return a(Math.random()*l)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(g){var k,w,I,$,y,b=0,S=[],A=new M(J);if(g==null?g=z:_(g,0,j),$=o(g/c),xe)if(crypto.getRandomValues){for(k=crypto.getRandomValues(new Uint32Array($*=2));b<$;)y=k[b]*131072+(k[b+1]>>>11),y>=9e15?(w=crypto.getRandomValues(new Uint32Array(2)),k[b]=w[0],k[b+1]=w[1]):(S.push(y%1e14),b+=2);b=$/2}else if(crypto.randomBytes){for(k=crypto.randomBytes($*=7);b<$;)y=(k[b]&31)*281474976710656+k[b+1]*1099511627776+k[b+2]*4294967296+k[b+3]*16777216+(k[b+4]<<16)+(k[b+5]<<8)+k[b+6],y>=9e15?crypto.randomBytes(7).copy(k,b):(S.push(y%1e14),b+=7);b=$/7}else throw xe=!1,Error(s+"crypto unavailable");if(!xe)for(;b<$;)y=f(),y<9e15&&(S[b++]=y%1e14);for($=S[--b],g%=c,$&&g&&(y=u[c-g],S[b]=a($/y)*y);S[b]===0;S.pop(),b--);if(b<0)S=[I=0];else{for(I=-1;S[0]===0;S.splice(0,1),I-=c);for(b=1,y=S[0];y>=10;y/=10,b++);b<c&&(I-=c-b)}return A.e=I,A.c=S,A}})(),M.sum=function(){for(var l=1,f=arguments,g=new M(f[0]);l<f.length;)g=g.plus(f[l++]);return g},te=(function(){var l="0123456789";function f(g,k,w,I){for(var $,y=[0],b,S=0,A=g.length;S<A;){for(b=y.length;b--;y[b]*=k);for(y[0]+=I.indexOf(g.charAt(S++)),$=0;$<y.length;$++)y[$]>w-1&&(y[$+1]==null&&(y[$+1]=0),y[$+1]+=y[$]/w|0,y[$]%=w)}return y.reverse()}return function(g,k,w,I,$){var y,b,S,A,C,B,X,ne,le=g.indexOf("."),he=z,F=ie;for(le>=0&&(A=De,De=0,g=g.replace(".",""),ne=new M(k),B=ne.pow(g.length-le),De=A,ne.c=f(oe(W(B.c),B.e,"0"),10,w,l),ne.e=ne.c.length),X=f(g,k,w,$?(y=Ke,l):(y=l,Ke)),S=A=X.length;X[--A]==0;X.pop());if(!X[0])return y.charAt(0);if(le<0?--S:(B.c=X,B.e=S,B.s=I,B=N(B,ne,he,F,w),X=B.c,C=B.r,S=B.e),b=S+he+1,le=X[b],A=w/2,C=C||b<0||X[b+1]!=null,C=F<4?(le!=null||C)&&(F==0||F==(B.s<0?3:2)):le>A||le==A&&(F==4||C||F==6&&X[b-1]&1||F==(B.s<0?8:7)),b<1||!X[0])g=C?oe(y.charAt(1),-he,y.charAt(0)):y.charAt(0);else{if(X.length=b,C)for(--w;++X[--b]>w;)X[b]=0,b||(++S,X=[1].concat(X));for(A=X.length;!X[--A];);for(le=0,g="";le<=A;g+=y.charAt(X[le++]));g=oe(g,S,y.charAt(0))}return g}})(),N=(function(){function l(k,w,I){var $,y,b,S,A=0,C=k.length,B=w%m,X=w/m|0;for(k=k.slice();C--;)b=k[C]%m,S=k[C]/m|0,$=X*b+S*B,y=B*b+$%m*m+A,A=(y/I|0)+($/m|0)+X*S,k[C]=y%I;return A&&(k=[A].concat(k)),k}function f(k,w,I,$){var y,b;if(I!=$)b=I>$?1:-1;else for(y=b=0;y<I;y++)if(k[y]!=w[y]){b=k[y]>w[y]?1:-1;break}return b}function g(k,w,I,$){for(var y=0;I--;)k[I]-=y,y=k[I]<w[I]?1:0,k[I]=y*$+k[I]-w[I];for(;!k[0]&&k.length>1;k.splice(0,1));}return function(k,w,I,$,y){var b,S,A,C,B,X,ne,le,he,F,se,me,jt,ci,di,Me,lt,$e=k.s==w.s?1:-1,we=k.c,ue=w.c;if(!we||!we[0]||!ue||!ue[0])return new M(!k.s||!w.s||(we?ue&&we[0]==ue[0]:!ue)?NaN:we&&we[0]==0||!ue?$e*0:$e/0);for(le=new M($e),he=le.c=[],S=k.e-w.e,$e=I+S+1,y||(y=d,S=T(k.e/c)-T(w.e/c),$e=$e/c|0),A=0;ue[A]==(we[A]||0);A++);if(ue[A]>(we[A]||0)&&S--,$e<0)he.push(1),C=!0;else{for(ci=we.length,Me=ue.length,A=0,$e+=2,B=a(y/(ue[0]+1)),B>1&&(ue=l(ue,B,y),we=l(we,B,y),Me=ue.length,ci=we.length),jt=Me,F=we.slice(0,Me),se=F.length;se<Me;F[se++]=0);lt=ue.slice(),lt=[0].concat(lt),di=ue[0],ue[1]>=y/2&&di++;do{if(B=0,b=f(ue,F,Me,se),b<0){if(me=F[0],Me!=se&&(me=me*y+(F[1]||0)),B=a(me/di),B>1)for(B>=y&&(B=y-1),X=l(ue,B,y),ne=X.length,se=F.length;f(X,F,ne,se)==1;)B--,g(X,Me<ne?lt:ue,ne,y),ne=X.length,b=1;else B==0&&(b=B=1),X=ue.slice(),ne=X.length;if(ne<se&&(X=[0].concat(X)),g(F,X,se,y),se=F.length,b==-1)for(;f(ue,F,Me,se)<1;)B++,g(F,Me<se?lt:ue,se,y),se=F.length}else b===0&&(B++,F=[0]);he[A++]=B,F[0]?F[se++]=we[jt]||0:(F=[we[jt]],se=1)}while((jt++<ci||F[0]!=null)&&$e--);C=F[0]!=null,he[0]||he.splice(0,1)}if(y==d){for(A=1,$e=he[0];$e>=10;$e/=10,A++);je(le,I+(le.e=A+S*c-1)+1,$,C)}else le.e=S,le.r=+C;return le}})();function si(l,f,g,k){var w,I,$,y,b;if(g==null?g=ie:_(g,0,8),!l.c)return l.toString();if(w=l.c[0],$=l.e,f==null)b=W(l.c),b=k==1||k==2&&($<=ce||$>=de)?Z(b,$):oe(b,$,"0");else if(l=je(new M(l),f,g),I=l.e,b=W(l.c),y=b.length,k==1||k==2&&(f<=I||I<=ce)){for(;y<f;b+="0",y++);b=Z(b,I)}else if(f-=$+(k===2&&I>$),b=oe(b,I,"0"),I+1>y){if(--f>0)for(b+=".";f--;b+="0");}else if(f+=I-y,f>0)for(I+1==y&&(b+=".");f--;b+="0");return l.s<0&&w?"-"+b:b}function on(l,f){for(var g,k,w=1,I=new M(l[0]);w<l.length;w++)k=new M(l[w]),(!k.s||(g=K(I,k))===f||g===0&&I.s===f)&&(I=k);return I}function ri(l,f,g){for(var k=1,w=f.length;!f[--w];f.pop());for(w=f[0];w>=10;w/=10,k++);return(g=k+g*c-1)>ve?l.c=l.e=null:g<Ce?l.c=[l.e=0]:(l.e=g,l.c=f),l}V=(function(){var l=/^(-?)0([xbo])(?=\w[\w.]*$)/i,f=/^([^.]+)\.$/,g=/^\.([^.]+)$/,k=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(I,$,y,b){var S,A=y?$:$.replace(w,"");if(k.test(A))I.s=isNaN(A)?null:A<0?-1:1;else{if(!y&&(A=A.replace(l,function(C,B,X){return S=(X=X.toLowerCase())=="x"?16:X=="b"?2:8,!b||b==S?B:C}),b&&(S=b,A=A.replace(f,"$1").replace(g,"0.$1")),$!=A))return new M(A,S);if(M.DEBUG)throw Error(s+"Not a"+(b?" base "+b:"")+" number: "+$);I.s=null}I.c=I.e=null}})();function je(l,f,g,k){var w,I,$,y,b,S,A,C=l.c,B=u;if(C){e:{for(w=1,y=C[0];y>=10;y/=10,w++);if(I=f-w,I<0)I+=c,$=f,b=C[S=0],A=a(b/B[w-$-1]%10);else if(S=o((I+1)/c),S>=C.length)if(k){for(;C.length<=S;C.push(0));b=A=0,w=1,I%=c,$=I-c+1}else break e;else{for(b=y=C[S],w=1;y>=10;y/=10,w++);I%=c,$=I-c+w,A=$<0?0:a(b/B[w-$-1]%10)}if(k=k||f<0||C[S+1]!=null||($<0?b:b%B[w-$-1]),k=g<4?(A||k)&&(g==0||g==(l.s<0?3:2)):A>5||A==5&&(g==4||k||g==6&&(I>0?$>0?b/B[w-$]:0:C[S-1])%10&1||g==(l.s<0?8:7)),f<1||!C[0])return C.length=0,k?(f-=l.e+1,C[0]=B[(c-f%c)%c],l.e=-f||0):C[0]=l.e=0,l;if(I==0?(C.length=S,y=1,S--):(C.length=S+1,y=B[c-I],C[S]=$>0?a(b/B[w-$]%B[$])*y:0),k)for(;;)if(S==0){for(I=1,$=C[0];$>=10;$/=10,I++);for($=C[0]+=y,y=1;$>=10;$/=10,y++);I!=y&&(l.e++,C[0]==d&&(C[0]=1));break}else{if(C[S]+=y,C[S]!=d)break;C[S--]=0,y=1}for(I=C.length;C[--I]===0;C.pop());}l.e>ve?l.c=l.e=null:l.e<Ce&&(l.c=[l.e=0])}return l}function _e(l){var f,g=l.e;return g===null?l.toString():(f=W(l.c),f=g<=ce||g>=de?Z(f,g):oe(f,g,"0"),l.s<0?"-"+f:f)}return R.absoluteValue=R.abs=function(){var l=new M(this);return l.s<0&&(l.s=1),l},R.comparedTo=function(l,f){return K(this,new M(l,f))},R.decimalPlaces=R.dp=function(l,f){var g,k,w,I=this;if(l!=null)return _(l,0,j),f==null?f=ie:_(f,0,8),je(new M(I),l+I.e+1,f);if(!(g=I.c))return null;if(k=((w=g.length-1)-T(this.e/c))*c,w=g[w])for(;w%10==0;w/=10,k--);return k<0&&(k=0),k},R.dividedBy=R.div=function(l,f){return N(this,new M(l,f),z,ie)},R.dividedToIntegerBy=R.idiv=function(l,f){return N(this,new M(l,f),0,1)},R.exponentiatedBy=R.pow=function(l,f){var g,k,w,I,$,y,b,S,A,C=this;if(l=new M(l),l.c&&!l.isInteger())throw Error(s+"Exponent not an integer: "+_e(l));if(f!=null&&(f=new M(f)),y=l.e>14,!C.c||!C.c[0]||C.c[0]==1&&!C.e&&C.c.length==1||!l.c||!l.c[0])return A=new M(Math.pow(+_e(C),y?l.s*(2-H(l)):+_e(l))),f?A.mod(f):A;if(b=l.s<0,f){if(f.c?!f.c[0]:!f.s)return new M(NaN);k=!b&&C.isInteger()&&f.isInteger(),k&&(C=C.mod(f))}else{if(l.e>9&&(C.e>0||C.e<-1||(C.e==0?C.c[0]>1||y&&C.c[1]>=24e7:C.c[0]<8e13||y&&C.c[0]<=9999975e7)))return I=C.s<0&&H(l)?-0:0,C.e>-1&&(I=1/I),new M(b?1/I:I);De&&(I=o(De/c+2))}for(y?(g=new M(.5),b&&(l.s=1),S=H(l)):(w=Math.abs(+_e(l)),S=w%2),A=new M(J);;){if(S){if(A=A.times(C),!A.c)break;I?A.c.length>I&&(A.c.length=I):k&&(A=A.mod(f))}if(w){if(w=a(w/2),w===0)break;S=w%2}else if(l=l.times(g),je(l,l.e+1,1),l.e>14)S=H(l);else{if(w=+_e(l),w===0)break;S=w%2}C=C.times(C),I?C.c&&C.c.length>I&&(C.c.length=I):k&&(C=C.mod(f))}return k?A:(b&&(A=J.div(A)),f?A.mod(f):I?je(A,De,ie,$):A)},R.integerValue=function(l){var f=new M(this);return l==null?l=ie:_(l,0,8),je(f,f.e+1,l)},R.isEqualTo=R.eq=function(l,f){return K(this,new M(l,f))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(l,f){return K(this,new M(l,f))>0},R.isGreaterThanOrEqualTo=R.gte=function(l,f){return(f=K(this,new M(l,f)))===1||f===0},R.isInteger=function(){return!!this.c&&T(this.e/c)>this.c.length-2},R.isLessThan=R.lt=function(l,f){return K(this,new M(l,f))<0},R.isLessThanOrEqualTo=R.lte=function(l,f){return(f=K(this,new M(l,f)))===-1||f===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(l,f){var g,k,w,I,$=this,y=$.s;if(l=new M(l,f),f=l.s,!y||!f)return new M(NaN);if(y!=f)return l.s=-f,$.plus(l);var b=$.e/c,S=l.e/c,A=$.c,C=l.c;if(!b||!S){if(!A||!C)return A?(l.s=-f,l):new M(C?$:NaN);if(!A[0]||!C[0])return C[0]?(l.s=-f,l):new M(A[0]?$:ie==3?-0:0)}if(b=T(b),S=T(S),A=A.slice(),y=b-S){for((I=y<0)?(y=-y,w=A):(S=b,w=C),w.reverse(),f=y;f--;w.push(0));w.reverse()}else for(k=(I=(y=A.length)<(f=C.length))?y:f,y=f=0;f<k;f++)if(A[f]!=C[f]){I=A[f]<C[f];break}if(I&&(w=A,A=C,C=w,l.s=-l.s),f=(k=C.length)-(g=A.length),f>0)for(;f--;A[g++]=0);for(f=d-1;k>y;){if(A[--k]<C[k]){for(g=k;g&&!A[--g];A[g]=f);--A[g],A[k]+=d}A[k]-=C[k]}for(;A[0]==0;A.splice(0,1),--S);return A[0]?ri(l,A,S):(l.s=ie==3?-1:1,l.c=[l.e=0],l)},R.modulo=R.mod=function(l,f){var g,k,w=this;return l=new M(l,f),!w.c||!l.s||l.c&&!l.c[0]?new M(NaN):!l.c||w.c&&!w.c[0]?new M(w):(dt==9?(k=l.s,l.s=1,g=N(w,l,0,3),l.s=k,g.s*=k):g=N(w,l,0,dt),l=w.minus(g.times(l)),!l.c[0]&&dt==1&&(l.s=w.s),l)},R.multipliedBy=R.times=function(l,f){var g,k,w,I,$,y,b,S,A,C,B,X,ne,le,he,F=this,se=F.c,me=(l=new M(l,f)).c;if(!se||!me||!se[0]||!me[0])return!F.s||!l.s||se&&!se[0]&&!me||me&&!me[0]&&!se?l.c=l.e=l.s=null:(l.s*=F.s,!se||!me?l.c=l.e=null:(l.c=[0],l.e=0)),l;for(k=T(F.e/c)+T(l.e/c),l.s*=F.s,b=se.length,C=me.length,b<C&&(ne=se,se=me,me=ne,w=b,b=C,C=w),w=b+C,ne=[];w--;ne.push(0));for(le=d,he=m,w=C;--w>=0;){for(g=0,B=me[w]%he,X=me[w]/he|0,$=b,I=w+$;I>w;)S=se[--$]%he,A=se[$]/he|0,y=X*S+A*B,S=B*S+y%he*he+ne[I]+g,g=(S/le|0)+(y/he|0)+X*A,ne[I--]=S%le;ne[I]=g}return g?++k:ne.splice(0,1),ri(l,ne,k)},R.negated=function(){var l=new M(this);return l.s=-l.s||null,l},R.plus=function(l,f){var g,k=this,w=k.s;if(l=new M(l,f),f=l.s,!w||!f)return new M(NaN);if(w!=f)return l.s=-f,k.minus(l);var I=k.e/c,$=l.e/c,y=k.c,b=l.c;if(!I||!$){if(!y||!b)return new M(w/0);if(!y[0]||!b[0])return b[0]?l:new M(y[0]?k:w*0)}if(I=T(I),$=T($),y=y.slice(),w=I-$){for(w>0?($=I,g=b):(w=-w,g=y),g.reverse();w--;g.push(0));g.reverse()}for(w=y.length,f=b.length,w-f<0&&(g=b,b=y,y=g,f=w),w=0;f;)w=(y[--f]=y[f]+b[f]+w)/d|0,y[f]=d===y[f]?0:y[f]%d;return w&&(y=[w].concat(y),++$),ri(l,y,$)},R.precision=R.sd=function(l,f){var g,k,w,I=this;if(l!=null&&l!==!!l)return _(l,1,j),f==null?f=ie:_(f,0,8),je(new M(I),l,f);if(!(g=I.c))return null;if(w=g.length-1,k=w*c+1,w=g[w]){for(;w%10==0;w/=10,k--);for(w=g[0];w>=10;w/=10,k++);}return l&&I.e+1>k&&(k=I.e+1),k},R.shiftedBy=function(l){return _(l,-h,h),this.times("1e"+l)},R.squareRoot=R.sqrt=function(){var l,f,g,k,w,I=this,$=I.c,y=I.s,b=I.e,S=z+4,A=new M("0.5");if(y!==1||!$||!$[0])return new M(!y||y<0&&(!$||$[0])?NaN:$?I:1/0);if(y=Math.sqrt(+_e(I)),y==0||y==1/0?(f=W($),(f.length+b)%2==0&&(f+="0"),y=Math.sqrt(+f),b=T((b+1)/2)-(b<0||b%2),y==1/0?f="5e"+b:(f=y.toExponential(),f=f.slice(0,f.indexOf("e")+1)+b),g=new M(f)):g=new M(y+""),g.c[0]){for(b=g.e,y=b+S,y<3&&(y=0);;)if(w=g,g=A.times(w.plus(N(I,w,S,1))),W(w.c).slice(0,y)===(f=W(g.c)).slice(0,y))if(g.e<b&&--y,f=f.slice(y-3,y+1),f=="9999"||!k&&f=="4999"){if(!k&&(je(w,w.e+z+2,0),w.times(w).eq(I))){g=w;break}S+=4,y+=4,k=1}else{(!+f||!+f.slice(1)&&f.charAt(0)=="5")&&(je(g,g.e+z+2,1),l=!g.times(g).eq(I));break}}return je(g,g.e+z+1,ie,l)},R.toExponential=function(l,f){return l!=null&&(_(l,0,j),l++),si(this,l,f,1)},R.toFixed=function(l,f){return l!=null&&(_(l,0,j),l=l+this.e+1),si(this,l,f)},R.toFormat=function(l,f,g){var k,w=this;if(g==null)l!=null&&f&&typeof f=="object"?(g=f,f=null):l&&typeof l=="object"?(g=l,l=f=null):g=oi;else if(typeof g!="object")throw Error(s+"Argument not an object: "+g);if(k=w.toFixed(l,f),w.c){var I,$=k.split("."),y=+g.groupSize,b=+g.secondaryGroupSize,S=g.groupSeparator||"",A=$[0],C=$[1],B=w.s<0,X=B?A.slice(1):A,ne=X.length;if(b&&(I=y,y=b,b=I,ne-=I),y>0&&ne>0){for(I=ne%y||y,A=X.substr(0,I);I<ne;I+=y)A+=S+X.substr(I,y);b>0&&(A+=S+X.slice(I)),B&&(A="-"+A)}k=C?A+(g.decimalSeparator||"")+((b=+g.fractionGroupSize)?C.replace(new RegExp("\\d{"+b+"}\\B","g"),"$&"+(g.fractionGroupSeparator||"")):C):A}return(g.prefix||"")+k+(g.suffix||"")},R.toFraction=function(l){var f,g,k,w,I,$,y,b,S,A,C,B,X=this,ne=X.c;if(l!=null&&(y=new M(l),!y.isInteger()&&(y.c||y.s!==1)||y.lt(J)))throw Error(s+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+_e(y));if(!ne)return new M(X);for(f=new M(J),S=g=new M(J),k=b=new M(J),B=W(ne),I=f.e=B.length-X.e-1,f.c[0]=u[($=I%c)<0?c+$:$],l=!l||y.comparedTo(f)>0?I>0?f:S:y,$=ve,ve=1/0,y=new M(B),b.c[0]=0;A=N(y,f,0,1),w=g.plus(A.times(k)),w.comparedTo(l)!=1;)g=k,k=w,S=b.plus(A.times(w=S)),b=w,f=y.minus(A.times(w=f)),y=w;return w=N(l.minus(g),k,0,1),b=b.plus(w.times(S)),g=g.plus(w.times(k)),b.s=S.s=X.s,I=I*2,C=N(S,k,I,ie).minus(X).abs().comparedTo(N(b,g,I,ie).minus(X).abs())<1?[S,k]:[b,g],ve=$,C},R.toNumber=function(){return+_e(this)},R.toPrecision=function(l,f){return l!=null&&_(l,1,j),si(this,l,f,2)},R.toString=function(l){var f,g=this,k=g.s,w=g.e;return w===null?k?(f="Infinity",k<0&&(f="-"+f)):f="NaN":(l==null?f=w<=ce||w>=de?Z(W(g.c),w):oe(W(g.c),w,"0"):l===10&&ai?(g=je(new M(g),z+w+1,ie),f=oe(W(g.c),g.e,"0")):(_(l,2,Ke.length,"Base"),f=te(oe(W(g.c),w,"0"),10,l,k,!0)),k<0&&g.c[0]&&(f="-"+f)),f},R.valueOf=R.toJSON=function(){return _e(this)},R._isBigNumber=!0,D!=null&&M.set(D),M}function T(D){var N=D|0;return D>0||D===N?N:N-1}function W(D){for(var N,te,V=1,R=D.length,J=D[0]+"";V<R;){for(N=D[V++]+"",te=c-N.length;te--;N="0"+N);J+=N}for(R=J.length;J.charCodeAt(--R)===48;);return J.slice(0,R+1||1)}function K(D,N){var te,V,R=D.c,J=N.c,z=D.s,ie=N.s,ce=D.e,de=N.e;if(!z||!ie)return null;if(te=R&&!R[0],V=J&&!J[0],te||V)return te?V?0:-ie:z;if(z!=ie)return z;if(te=z<0,V=ce==de,!R||!J)return V?0:!R^te?1:-1;if(!V)return ce>de^te?1:-1;for(ie=(ce=R.length)<(de=J.length)?ce:de,z=0;z<ie;z++)if(R[z]!=J[z])return R[z]>J[z]^te?1:-1;return ce==de?0:ce>de^te?1:-1}function _(D,N,te,V){if(D<N||D>te||D!==a(D))throw Error(s+(V||"Argument")+(typeof D=="number"?D<N||D>te?" out of range: ":" not an integer: ":" not a primitive number: ")+String(D))}function H(D){var N=D.c.length-1;return T(D.e/c)==N&&D.c[N]%2!=0}function Z(D,N){return(D.length>1?D.charAt(0)+"."+D.slice(1):D)+(N<0?"e":"e+")+N}function oe(D,N,te){var V,R;if(N<0){for(R=te+".";++N;R+=te);D=R+D}else if(V=D.length,++N>V){for(R=te,N-=V;--N;R+=te);D+=R}else N<V&&(D=D.slice(0,N)+"."+D.slice(N));return D}i=q(),i.default=i.BigNumber=i,n.exports?n.exports=i:(e||(e=typeof self<"u"&&self?self:window),e.BigNumber=i)})(Mn)})(yt)),yt.exports}var Mi;function Rn(){return Mi||(Mi=1,(function(n){var e=Ci(),i=n.exports;(function(){var t=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o,a,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},r;function d(h){return t.lastIndex=0,t.test(h)?'"'+h.replace(t,function(u){var m=s[u];return typeof m=="string"?m:"\\u"+("0000"+u.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+h+'"'}function c(h,u){var m,j,q,T,W=o,K,_=u[h],H=_!=null&&(_ instanceof e||e.isBigNumber(_));switch(_&&typeof _=="object"&&typeof _.toJSON=="function"&&(_=_.toJSON(h)),typeof r=="function"&&(_=r.call(u,h,_)),typeof _){case"string":return H?_:d(_);case"number":return isFinite(_)?String(_):"null";case"boolean":case"null":case"bigint":return String(_);case"object":if(!_)return"null";if(o+=a,K=[],Object.prototype.toString.apply(_)==="[object Array]"){for(T=_.length,m=0;m<T;m+=1)K[m]=c(m,_)||"null";return q=K.length===0?"[]":o?`[
4
4
  `+o+K.join(`,
5
5
  `+o)+`
6
- `+W+"]":"["+K.join(",")+"]",o=W,E}if(r&&typeof r=="object")for(Q=r.length,m=0;m<Q;m+=1)typeof r[m]=="string"&&(j=r[m],E=c(j,_),E&&K.push(d(j)+(o?": ":":")+E));else Object.keys(_).forEach(function(Y){var ne=c(Y,_);ne&&K.push(d(Y)+(o?": ":":")+ne)});return E=K.length===0?"{}":o?`{
6
+ `+W+"]":"["+K.join(",")+"]",o=W,q}if(r&&typeof r=="object")for(T=r.length,m=0;m<T;m+=1)typeof r[m]=="string"&&(j=r[m],q=c(j,_),q&&K.push(d(j)+(o?": ":":")+q));else Object.keys(_).forEach(function(Z){var oe=c(Z,_);oe&&K.push(d(Z)+(o?": ":":")+oe)});return q=K.length===0?"{}":o?`{
7
7
  `+o+K.join(`,
8
8
  `+o)+`
9
- `+W+"}":"{"+K.join(",")+"}",o=W,E}}typeof i.stringify!="function"&&(i.stringify=function(h,u,m){var j;if(o="",a="",typeof m=="number")for(j=0;j<m;j+=1)a+=" ";else typeof m=="string"&&(a=m);if(r=u,u&&typeof u!="function"&&(typeof u!="object"||typeof u.length!="number"))throw new Error("JSON.stringify");return c("",{"":h})})})()})(Et)),Et.exports}var xt,Ci;function Rn(){if(Ci)return xt;Ci=1;var n=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 t=function(o){var a={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(o!=null){if(o.strict===!0&&(a.strict=!0),o.storeAsString===!0&&(a.storeAsString=!0),a.alwaysParseAsBig=o.alwaysParseAsBig===!0?o.alwaysParseAsBig:!1,a.useNativeBigInt=o.useNativeBigInt===!0?o.useNativeBigInt:!1,typeof o.constructorAction<"u")if(o.constructorAction==="error"||o.constructorAction==="ignore"||o.constructorAction==="preserve")a.constructorAction=o.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${o.constructorAction}`);if(typeof o.protoAction<"u")if(o.protoAction==="error"||o.protoAction==="ignore"||o.protoAction==="preserve")a.protoAction=o.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${o.protoAction}`)}var s,r,d={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
10
- `,r:"\r",t:" "},c,h=function(N){throw{name:"SyntaxError",message:N,at:s,text:c}},u=function(N){return N&&N!==r&&h("Expected '"+N+"' instead of '"+r+"'"),r=c.charAt(s),s+=1,r},m=function(){var N,Y="";for(r==="-"&&(Y="-",u("-"));r>="0"&&r<="9";)Y+=r,u();if(r===".")for(Y+=".";u()&&r>="0"&&r<="9";)Y+=r;if(r==="e"||r==="E")for(Y+=r,u(),(r==="-"||r==="+")&&(Y+=r,u());r>="0"&&r<="9";)Y+=r,u();if(N=+Y,!isFinite(N))h("Bad number");else return n==null&&(n=Pi()),Y.length>15?a.storeAsString?Y:a.useNativeBigInt?BigInt(Y):new n(Y):a.alwaysParseAsBig?a.useNativeBigInt?BigInt(N):new n(N):N},j=function(){var N,Y,ne="",H;if(r==='"')for(var L=s;u();){if(r==='"')return s-1>L&&(ne+=c.substring(L,s-1)),u(),ne;if(r==="\\"){if(s-1>L&&(ne+=c.substring(L,s-1)),u(),r==="u"){for(H=0,Y=0;Y<4&&(N=parseInt(u(),16),!!isFinite(N));Y+=1)H=H*16+N;ne+=String.fromCharCode(H)}else if(typeof d[r]=="string")ne+=d[r];else break;L=s}}h("Bad string")},E=function(){for(;r&&r<=" ";)u()},Q=function(){switch(r){case"t":return u("t"),u("r"),u("u"),u("e"),!0;case"f":return u("f"),u("a"),u("l"),u("s"),u("e"),!1;case"n":return u("n"),u("u"),u("l"),u("l"),null}h("Unexpected '"+r+"'")},W,K=function(){var N=[];if(r==="["){if(u("["),E(),r==="]")return u("]"),N;for(;r;){if(N.push(W()),E(),r==="]")return u("]"),N;u(","),E()}}h("Bad array")},_=function(){var N,Y=Object.create(null);if(r==="{"){if(u("{"),E(),r==="}")return u("}"),Y;for(;r;){if(N=j(),E(),u(":"),a.strict===!0&&Object.hasOwnProperty.call(Y,N)&&h('Duplicate key "'+N+'"'),e.test(N)===!0?a.protoAction==="error"?h("Object contains forbidden prototype property"):a.protoAction==="ignore"?W():Y[N]=W():i.test(N)===!0?a.constructorAction==="error"?h("Object contains forbidden constructor property"):a.constructorAction==="ignore"?W():Y[N]=W():Y[N]=W(),E(),r==="}")return u("}"),Y;u(","),E()}}h("Bad object")};return W=function(){switch(E(),r){case"{":return _();case"[":return K();case'"':return j();case"-":return m();default:return r>="0"&&r<="9"?m():Q()}},function(N,Y){var ne;return c=N+"",s=0,r=" ",ne=W(),E(),r&&h("Syntax error"),typeof Y=="function"?(function H(L,ee){var V,R=L[ee];return R&&typeof R=="object"&&Object.keys(R).forEach(function(J){V=H(R,J),V!==void 0?R[J]=V:delete R[J]}),Y.call(L,ee,R)})({"":ne},""):ne}};return xt=t,xt}var Mi;function En(){if(Mi)return at.exports;Mi=1;var n=Mn().stringify,e=Rn();return at.exports=function(i){return{parse:e(i),stringify:n}},at.exports.parse=e(),at.exports.stringify=n,at.exports}var xn=En();const qt=Un(xn);function be(n,e,i,t){function o(a){return a instanceof i?a:new i(function(s){s(a)})}return new(i||(i=Promise))(function(a,s){function r(h){try{c(t.next(h))}catch(u){s(u)}}function d(h){try{c(t.throw(h))}catch(u){s(u)}}function c(h){h.done?a(h.value):o(h.value).then(r,d)}c((t=t.apply(n,e||[])).next())})}function qn(n,e,i,t){if(typeof e=="function"?n!==e||!t:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?t:i==="a"?t.call(n):t?t.value:e.get(n)}typeof SuppressedError=="function"&&SuppressedError;var gt,Ri;class He{static custom(e){return e}static unique(e=7){const i=qn(gt,gt,"m",Ri).call(gt);let t="";for(let o=0;o<e;o++){const a=Math.floor(Math.random()*16).toString(16);t+=a}return i+t}}gt=He,Ri=function(){const e=new Date,i=Math.floor(e.getTime()/1e3),t=e.getMilliseconds();return i.toString(16)+t.toString(16).padStart(5,"0")};const mt=qt({useNativeBigInt:!0});class U{constructor(e,i,t){this.method=e,this.attribute=i,t!==void 0&&(Array.isArray(t)?this.values=t:this.values=[t])}toString(){return mt.stringify({method:this.method,attribute:this.attribute,values:this.values})}}U.equal=(n,e)=>new U("equal",n,e).toString(),U.notEqual=(n,e)=>new U("notEqual",n,e).toString(),U.regex=(n,e)=>new U("regex",n,e).toString(),U.lessThan=(n,e)=>new U("lessThan",n,e).toString(),U.lessThanEqual=(n,e)=>new U("lessThanEqual",n,e).toString(),U.greaterThan=(n,e)=>new U("greaterThan",n,e).toString(),U.greaterThanEqual=(n,e)=>new U("greaterThanEqual",n,e).toString(),U.isNull=n=>new U("isNull",n).toString(),U.isNotNull=n=>new U("isNotNull",n).toString(),U.exists=n=>new U("exists",void 0,n).toString(),U.notExists=n=>new U("notExists",void 0,n).toString(),U.between=(n,e,i)=>new U("between",n,[e,i]).toString(),U.startsWith=(n,e)=>new U("startsWith",n,e).toString(),U.endsWith=(n,e)=>new U("endsWith",n,e).toString(),U.select=n=>new U("select",void 0,n).toString(),U.search=(n,e)=>new U("search",n,e).toString(),U.orderDesc=n=>new U("orderDesc",n).toString(),U.orderAsc=n=>new U("orderAsc",n).toString(),U.orderRandom=()=>new U("orderRandom").toString(),U.cursorAfter=n=>new U("cursorAfter",void 0,n).toString(),U.cursorBefore=n=>new U("cursorBefore",void 0,n).toString(),U.limit=n=>new U("limit",void 0,n).toString(),U.offset=n=>new U("offset",void 0,n).toString(),U.contains=(n,e)=>new U("contains",n,e).toString(),U.containsAny=(n,e)=>new U("containsAny",n,e).toString(),U.containsAll=(n,e)=>new U("containsAll",n,e).toString(),U.notContains=(n,e)=>new U("notContains",n,e).toString(),U.notSearch=(n,e)=>new U("notSearch",n,e).toString(),U.notBetween=(n,e,i)=>new U("notBetween",n,[e,i]).toString(),U.notStartsWith=(n,e)=>new U("notStartsWith",n,e).toString(),U.notEndsWith=(n,e)=>new U("notEndsWith",n,e).toString(),U.createdBefore=n=>U.lessThan("$createdAt",n),U.createdAfter=n=>U.greaterThan("$createdAt",n),U.createdBetween=(n,e)=>U.between("$createdAt",n,e),U.updatedBefore=n=>U.lessThan("$updatedAt",n),U.updatedAfter=n=>U.greaterThan("$updatedAt",n),U.updatedBetween=(n,e)=>U.between("$updatedAt",n,e),U.or=n=>new U("or",void 0,n.map(e=>mt.parse(e))).toString(),U.and=n=>new U("and",void 0,n.map(e=>mt.parse(e))).toString(),U.elemMatch=(n,e)=>new U("elemMatch",n,e.map(i=>mt.parse(i))).toString(),U.distanceEqual=(n,e,i,t=!0)=>new U("distanceEqual",n,[[e,i,t]]).toString(),U.distanceNotEqual=(n,e,i,t=!0)=>new U("distanceNotEqual",n,[[e,i,t]]).toString(),U.distanceGreaterThan=(n,e,i,t=!0)=>new U("distanceGreaterThan",n,[[e,i,t]]).toString(),U.distanceLessThan=(n,e,i,t=!0)=>new U("distanceLessThan",n,[[e,i,t]]).toString(),U.vectorDot=(n,e)=>new U("vectorDot",n,[e]).toString(),U.vectorCosine=(n,e)=>new U("vectorCosine",n,[e]).toString(),U.vectorEuclidean=(n,e)=>new U("vectorEuclidean",n,[e]).toString(),U.intersects=(n,e)=>new U("intersects",n,[e]).toString(),U.notIntersects=(n,e)=>new U("notIntersects",n,[e]).toString(),U.crosses=(n,e)=>new U("crosses",n,[e]).toString(),U.notCrosses=(n,e)=>new U("notCrosses",n,[e]).toString(),U.overlaps=(n,e)=>new U("overlaps",n,[e]).toString(),U.notOverlaps=(n,e)=>new U("notOverlaps",n,[e]).toString(),U.touches=(n,e)=>new U("touches",n,[e]).toString(),U.notTouches=(n,e)=>new U("notTouches",n,[e]).toString();const _n=qt({storeAsString:!1}),Ln=qt({useNativeBigInt:!0}),Nn=BigInt(Number.MAX_SAFE_INTEGER),Hn=BigInt(Number.MIN_SAFE_INTEGER),Dn=BigInt("9223372036854775807"),Bn=BigInt("-9223372036854775808");function Xn(n){return n!==null&&typeof n=="object"&&n._isBigNumber===!0&&typeof n.isInteger=="function"&&typeof n.toFixed=="function"&&typeof n.toNumber=="function"}function Vn(n,e){if(Xn(e)){if(e.isInteger()){const i=e.toFixed(),t=BigInt(i);return t>=Hn&&t<=Nn?Number(i):t>=Bn&&t<=Dn?t:e.toNumber()}return e.toNumber()}return e}const ge={parse:n=>_n.parse(n,Vn),stringify:Ln.stringify};class p extends Error{constructor(e,i=0,t="",o=""){super(e),this.name="AppwriteException",this.message=e,this.code=i,this.type=t,this.response=o}}class $e{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(ge.stringify({type:"ping"}))},2e4)},createSocket:()=>{var e,i,t,o,a;if(this.realtime.subscriptions.size<1){this.realtime.reconnect=!1,(e=this.realtime.socket)===null||e===void 0||e.close();return}let r="project="+encodeURIComponent((i=this.config.project)!==null&&i!==void 0?i:"");this.config.jwt&&(r+="&jwt="+encodeURIComponent(this.config.jwt));const d=this.config.endpointRealtime+"/realtime?"+r;d!==this.realtime.url||!this.realtime.socket||((t=this.realtime.socket)===null||t===void 0?void 0:t.readyState)>WebSocket.OPEN?(this.realtime.socket&&((o=this.realtime.socket)===null||o===void 0?void 0:o.readyState)<WebSocket.CLOSING&&(this.realtime.reconnect=!1,this.realtime.socket.close()),this.realtime.url=d,this.realtime.socket=new WebSocket(d),this.realtime.socket.addEventListener("message",this.realtime.onMessage),this.realtime.socket.addEventListener("open",c=>{this.realtime.reconnectAttempts=0,this.realtime.createHeartbeat()}),this.realtime.socket.addEventListener("close",c=>{var h,u,m;if(!this.realtime.reconnect||((u=(h=this.realtime)===null||h===void 0?void 0:h.lastMessage)===null||u===void 0?void 0:u.type)==="error"&&((m=this.realtime)===null||m===void 0?void 0:m.lastMessage.data).code===1008){this.realtime.reconnect=!0;return}const j=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${j/1e3} seconds.`,c.reason),setTimeout(()=>{this.realtime.reconnectAttempts++,this.realtime.createSocket()},j)})):((a=this.realtime.socket)===null||a===void 0?void 0:a.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(ge.stringify({type:"subscribe",data:e}))},onMessage:e=>{var i,t;try{const o=ge.parse(e.data);switch(this.realtime.lastMessage=o,o.type){case"connected":{const a=o.data;let s=this.config.session;if(!s){const r=ge.parse((i=window.localStorage.getItem("cookieFallback"))!==null&&i!==void 0?i:"{}");s=r?.[`a_session_${this.config.project}`]}s&&!a?.user&&((t=this.realtime.socket)===null||t===void 0||t.send(ge.stringify({type:"authentication",data:{session:s}}))),this.realtime.subscriptions.forEach((r,d)=>{var c;this.realtime.pendingSubscribes.set(d,{subscriptionId:d,channels:r.channels,queries:(c=r.queries)!==null&&c!==void 0?c:[]})}),this.realtime.sendPendingSubscribes();break}case"response":break;case"event":{const a=o.data;if(!a?.channels)break;const s=a.subscriptions;if(s&&s.length>0)for(const r of s){const d=this.realtime.subscriptions.get(r);d&&setTimeout(()=>d.callback(a))}else{if(!a.channels.some(d=>this.realtime.channels.has(d)))break;this.realtime.subscriptions.forEach(d=>{a.channels.some(c=>d.channels.includes(c))&&setTimeout(()=>d.callback(a))})}break}case"pong":break;case"error":throw o.data;default:break}}catch(o){console.error(o)}}}}getHeaders(){return Object.assign({},this.headers)}setEndpoint(e){if(!e||typeof e!="string")throw new p("Endpoint must be a valid string");if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new p("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 p("Endpoint must be a valid string");if(!e.startsWith("ws://")&&!e.startsWith("wss://"))throw new p("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,t=[]){const a=(Array.isArray(e)?e:[e]).map(c=>typeof c=="string"?c:c&&typeof c.toString=="function"?c.toString():String(c));a.forEach(c=>this.realtime.channels.add(c));const s=(t??[]).map(c=>typeof c=="string"?c:c.toString());let r="";const d=this.realtime.subscriptions.size+1;for(let c=0;c<d;c++){const h=He.unique();if(!this.realtime.subscriptions.has(h)){r=h;break}}if(r==="")throw new p("Failed to generate unique subscription id");return this.realtime.subscriptions.set(r,{channels:a,queries:s,callback:i}),this.realtime.pendingSubscribes.set(r,{subscriptionId:r,channels:a,queries:s}),this.realtime.connect(),()=>{this.realtime.subscriptions.delete(r),this.realtime.pendingSubscribes.delete(r);const c=new Set;this.realtime.subscriptions.forEach(h=>{h.channels.forEach(u=>c.add(u))}),this.realtime.channels.forEach(h=>{c.has(h)||this.realtime.channels.delete(h)}),this.realtime.connect()}}prepareRequest(e,i,t={},o={}){if(e=e.toUpperCase(),t=Object.assign({},this.headers,t),typeof window<"u"&&window.localStorage){const s=window.localStorage.getItem("cookieFallback");s&&(t["X-Fallback-Cookies"]=s)}const a={method:e,headers:t};if(t["X-Appwrite-Dev-Key"]===void 0&&(a.credentials="include"),e==="GET")for(const[s,r]of Object.entries($e.flatten(o)))i.searchParams.append(s,r);else switch(t["content-type"]){case"application/json":a.body=ge.stringify(o);break;case"multipart/form-data":{const s=new FormData;for(const[r,d]of Object.entries(o))if(d instanceof File)s.append(r,d,d.name);else if(Array.isArray(d))for(const c of d)s.append(`${r}[]`,c);else s.append(r,d);a.body=s,delete t["content-type"];break}}return{uri:i.toString(),options:a}}chunkedUpload(e,i){return be(this,arguments,void 0,function*(t,o,a={},s={},r){var d;const[c,h]=(d=Object.entries(s).find(([J,T])=>T instanceof File))!==null&&d!==void 0?d:[];if(!h||!c)throw new Error("File not found in payload");if(h.size<=$e.CHUNK_SIZE)return yield this.call(t,o,a,s);const u=Math.ceil(h.size/$e.CHUNK_SIZE),m=Math.min($e.CHUNK_SIZE,h.size),j=Object.assign(Object.assign({},a),{"content-range":`bytes 0-${m-1}/${h.size}`}),E=h.slice(0,m),Q=Object.assign({},s);Q[c]=new File([E],h.name);const W=yield this.call(t,o,j,Q),K=W?.$id;if(r&&typeof r=="function"&&r({$id:K,progress:Math.round(m/h.size*100),sizeUploaded:m,chunksTotal:u,chunksUploaded:1}),u===1)return W;const _=[];for(let J=1;J<u;J++){const T=J*$e.CHUNK_SIZE,te=Math.min(T+$e.CHUNK_SIZE,h.size);_.push({start:T,end:te})}const N=8;let Y=1,ne=m,H=W,L=null,ee=!1;const V=J=>{var T;const te=J?.chunksUploaded,re=(T=J?.chunksTotal)!==null&&T!==void 0?T:u;return typeof te=="number"&&typeof re=="number"&&te>=re},R=J=>be(this,void 0,void 0,function*(){const T=Object.assign({},a);K&&(T["x-appwrite-id"]=K),T["content-range"]=`bytes ${J.start}-${J.end-1}/${h.size}`;const te=h.slice(J.start,J.end),re=Object.assign({},s);re[c]=new File([te],h.name);const de=yield this.call(t,o,T,re);return ee||(Y++,ne+=J.end-J.start,H=de,V(de)&&(L=de),r&&typeof r=="function"&&r({$id:K,progress:Math.round(ne/h.size*100),sizeUploaded:ne,chunksTotal:u,chunksUploaded:Y})),de});return yield new Promise((J,T)=>{let te=0,re=0,de=0;const Ce=()=>{if(!ee){if(de===_.length){J();return}for(;re<N&&te<_.length;){const Ie=_[te++];re++,R(Ie).then(()=>{re--,de++,Ce()}).catch(qe=>{ee=!0,T(qe)})}}};Ce()}),L??H})}ping(){return be(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 be(this,arguments,void 0,function*(t,o,a={},s={},r="json"){var d,c,h;const{uri:u,options:m}=this.prepareRequest(t,o,a,s);let j=null;const E=yield fetch(u,m);if(E.type==="opaque")throw new p(`Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`,403,"forbidden","");const Q=E.headers.get("x-appwrite-warning");if(Q&&Q.split(";").forEach(K=>console.warn("Warning: "+K)),!((d=E.headers.get("content-type"))===null||d===void 0)&&d.includes("application/json")?j=ge.parse(yield E.text()):r==="arrayBuffer"?j=yield E.arrayBuffer():j={message:yield E.text()},400<=E.status){let K;throw!((c=E.headers.get("content-type"))===null||c===void 0)&&c.includes("application/json")||r==="arrayBuffer"?K=ge.stringify(j):K=j?.message,new p((h=j?.message)!==null&&h!==void 0?h:K,E.status,j?.type,K)}const W=E.headers.get("X-Fallback-Cookies");return typeof window<"u"&&window.localStorage&&W&&(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",W)),j&&typeof j=="object"&&Object.defineProperty(j,"toString",{value:()=>ge.stringify(j),writable:!0,enumerable:!1,configurable:!0}),j})}static flatten(e,i=""){let t={};for(const[o,a]of Object.entries(e)){const s=i?i+"["+o+"]":o;Array.isArray(a)?t=Object.assign(Object.assign({},t),$e.flatten(a,s)):t[s]=a}return t}}$e.CHUNK_SIZE=5242880;class ye{constructor(e){this.client=e}static flatten(e,i=""){let t={};for(const[o,a]of Object.entries(e)){const s=i?i+"["+o+"]":o;Array.isArray(a)?t=Object.assign(Object.assign({},t),ye.flatten(a,s)):t[s]=a}return t}}ye.CHUNK_SIZE=5242880;class Ei{constructor(e){this.client=e}get(){const e="/account",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}create(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,email:i[0],password:i[1],name:i[2]};const o=t.userId,a=t.email,s=t.password,r=t.name;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "email"');if(typeof s>"u")throw new p('Missing required parameter: "password"');const d="/account",c={};typeof o<"u"&&(c.userId=o),typeof a<"u"&&(c.email=a),typeof s<"u"&&(c.password=s),typeof r<"u"&&(c.name=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,u,c)}listConsents(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0]};const o=t.queries,a=t.total,s="/account/consents",r={};typeof o<"u"&&(r.queries=o),typeof a<"u"&&(r.total=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}getConsent(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={consentId:e};const t=i.consentId;if(typeof t>"u")throw new p('Missing required parameter: "consentId"');const o="/account/consents/{consentId}".replace("{consentId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}deleteConsent(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={consentId:e};const t=i.consentId;if(typeof t>"u")throw new p('Missing required parameter: "consentId"');const o="/account/consents/{consentId}".replace("{consentId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",s,r,a)}listConsentTokens(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={consentId:e,queries:i[0],total:i[1]};const o=t.consentId,a=t.queries,s=t.total;if(typeof o>"u")throw new p('Missing required parameter: "consentId"');const r="/account/consents/{consentId}/tokens".replace("{consentId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.queries=a),typeof s<"u"&&(d.total=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}getConsentToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={consentId:e,tokenId:i[0]};const o=t.consentId,a=t.tokenId;if(typeof o>"u")throw new p('Missing required parameter: "consentId"');if(typeof a>"u")throw new p('Missing required parameter: "tokenId"');const s="/account/consents/{consentId}/tokens/{tokenId}".replace("{consentId}",encodeURIComponent(String(o))).replace("{tokenId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}deleteConsentToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={consentId:e,tokenId:i[0]};const o=t.consentId,a=t.tokenId;if(typeof o>"u")throw new p('Missing required parameter: "consentId"');if(typeof a>"u")throw new p('Missing required parameter: "tokenId"');const s="/account/consents/{consentId}/tokens/{tokenId}".replace("{consentId}",encodeURIComponent(String(o))).replace("{tokenId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",d,c,r)}updateEmail(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={email:e,password:i[0]};const o=t.email,a=t.password;if(typeof o>"u")throw new p('Missing required parameter: "email"');if(typeof a>"u")throw new p('Missing required parameter: "password"');const s="/account/email",r={};typeof o<"u"&&(r.email=o),typeof a<"u"&&(r.password=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",d,c,r)}listIdentities(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0]};const o=t.queries,a=t.total,s="/account/identities",r={};typeof o<"u"&&(r.queries=o),typeof a<"u"&&(r.total=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}deleteIdentity(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={identityId:e};const t=i.identityId;if(typeof t>"u")throw new p('Missing required parameter: "identityId"');const o="/account/identities/{identityId}".replace("{identityId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createJWT(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={duration:e};const t=i.duration,o="/account/jwts",a={};typeof t<"u"&&(a.duration=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}listLogs(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0]};const o=t.queries,a=t.total,s="/account/logs",r={};typeof o<"u"&&(r.queries=o),typeof a<"u"&&(r.total=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}updateMFA(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={mfa:e};const t=i.mfa;if(typeof t>"u")throw new p('Missing required parameter: "mfa"');const o="/account/mfa",a={};typeof t<"u"&&(a.mfa=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,r,a)}createMfaAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const t=i.type;if(typeof t>"u")throw new p('Missing required parameter: "type"');const o="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}createMFAAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const t=i.type;if(typeof t>"u")throw new p('Missing required parameter: "type"');const o="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}updateMfaAuthenticator(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("type"in e||"otp"in e)?t=e||{}:t={type:e,otp:i[0]};const o=t.type,a=t.otp;if(typeof o>"u")throw new p('Missing required parameter: "type"');if(typeof a>"u")throw new p('Missing required parameter: "otp"');const s="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.otp=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}updateMFAAuthenticator(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("type"in e||"otp"in e)?t=e||{}:t={type:e,otp:i[0]};const o=t.type,a=t.otp;if(typeof o>"u")throw new p('Missing required parameter: "type"');if(typeof a>"u")throw new p('Missing required parameter: "otp"');const s="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.otp=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}deleteMfaAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const t=i.type;if(typeof t>"u")throw new p('Missing required parameter: "type"');const o="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}deleteMFAAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const t=i.type;if(typeof t>"u")throw new p('Missing required parameter: "type"');const o="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createMfaChallenge(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"factor"in e?i=e||{}:i={factor:e};const t=i.factor;if(typeof t>"u")throw new p('Missing required parameter: "factor"');const o="/account/mfa/challenges",a={};typeof t<"u"&&(a.factor=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}createMFAChallenge(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"factor"in e?i=e||{}:i={factor:e};const t=i.factor;if(typeof t>"u")throw new p('Missing required parameter: "factor"');const o="/account/mfa/challenges",a={};typeof t<"u"&&(a.factor=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}updateMfaChallenge(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={challengeId:e,otp:i[0]};const o=t.challengeId,a=t.otp;if(typeof o>"u")throw new p('Missing required parameter: "challengeId"');if(typeof a>"u")throw new p('Missing required parameter: "otp"');const s="/account/mfa/challenges",r={};typeof o<"u"&&(r.challengeId=o),typeof a<"u"&&(r.otp=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}updateMFAChallenge(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={challengeId:e,otp:i[0]};const o=t.challengeId,a=t.otp;if(typeof o>"u")throw new p('Missing required parameter: "challengeId"');if(typeof a>"u")throw new p('Missing required parameter: "otp"');const s="/account/mfa/challenges",r={};typeof o<"u"&&(r.challengeId=o),typeof a<"u"&&(r.otp=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}listMfaFactors(){const e="/account/mfa/factors",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listMFAFactors(){const e="/account/mfa/factors",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}getMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}getMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}createMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",t,o,i)}createMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",t,o,i)}updateMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",t,o,i)}updateMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",t,o,i)}updateName(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={name:e};const t=i.name;if(typeof t>"u")throw new p('Missing required parameter: "name"');const o="/account/name",a={};typeof t<"u"&&(a.name=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,r,a)}updatePassword(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={password:e,oldPassword:i[0]};const o=t.password,a=t.oldPassword;if(typeof o>"u")throw new p('Missing required parameter: "password"');const s="/account/password",r={};typeof o<"u"&&(r.password=o),typeof a<"u"&&(r.oldPassword=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",d,c,r)}updatePhone(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={phone:e,password:i[0]};const o=t.phone,a=t.password;if(typeof o>"u")throw new p('Missing required parameter: "phone"');if(typeof a>"u")throw new p('Missing required parameter: "password"');const s="/account/phone",r={};typeof o<"u"&&(r.phone=o),typeof a<"u"&&(r.password=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",d,c,r)}getPrefs(){const e="/account/prefs",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}updatePrefs(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"prefs"in e?i=e||{}:i={prefs:e};const t=i.prefs;if(typeof t>"u")throw new p('Missing required parameter: "prefs"');const o="/account/prefs",a={};typeof t<"u"&&(a.prefs=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,r,a)}createRecovery(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={email:e,url:i[0]};const o=t.email,a=t.url;if(typeof o>"u")throw new p('Missing required parameter: "email"');if(typeof a>"u")throw new p('Missing required parameter: "url"');const s="/account/recovery",r={};typeof o<"u"&&(r.email=o),typeof a<"u"&&(r.url=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}updateRecovery(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0],password:i[1]};const o=t.userId,a=t.secret,s=t.password;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');if(typeof s>"u")throw new p('Missing required parameter: "password"');const r="/account/recovery",d={};typeof o<"u"&&(d.userId=o),typeof a<"u"&&(d.secret=a),typeof s<"u"&&(d.password=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",c,h,d)}listSessions(){const e="/account/sessions",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}deleteSessions(){const e="/account/sessions",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",t,o,i)}createAnonymousSession(){const e="/account/sessions/anonymous",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",t,o,i)}createEmailPasswordSession(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={email:e,password:i[0]};const o=t.email,a=t.password;if(typeof o>"u")throw new p('Missing required parameter: "email"');if(typeof a>"u")throw new p('Missing required parameter: "password"');const s="/account/sessions/email",r={};typeof o<"u"&&(r.email=o),typeof a<"u"&&(r.password=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}updateMagicURLSession(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/sessions/magic-url",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}createOAuth2Session(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("provider"in e||"success"in e||"failure"in e||"scopes"in e)?t=e||{}:t={provider:e,success:i[0],failure:i[1],scopes:i[2]};const o=t.provider,a=t.success,s=t.failure,r=t.scopes;if(typeof o>"u")throw new p('Missing required parameter: "provider"');const d="/account/sessions/oauth2/{provider}".replace("{provider}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.success=a),typeof s<"u"&&(c.failure=s),typeof r<"u"&&(c.scopes=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project;for(const[u,m]of Object.entries(ye.flatten(c)))h.searchParams.append(u,m);if(typeof window<"u"&&window?.location){window.location.href=h.toString();return}else return h.toString()}updatePhoneSession(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/sessions/phone",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}createSession(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/sessions/token",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}getSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const t=i.sessionId;if(typeof t>"u")throw new p('Missing required parameter: "sessionId"');const o="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const t=i.sessionId;if(typeof t>"u")throw new p('Missing required parameter: "sessionId"');const o="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,r,a)}deleteSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const t=i.sessionId;if(typeof t>"u")throw new p('Missing required parameter: "sessionId"');const o="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}updateStatus(){const e="/account/status",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",t,o,i)}createPushTarget(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={targetId:e,identifier:i[0],providerId:i[1]};const o=t.targetId,a=t.identifier,s=t.providerId;if(typeof o>"u")throw new p('Missing required parameter: "targetId"');if(typeof a>"u")throw new p('Missing required parameter: "identifier"');const r="/account/targets/push",d={};typeof o<"u"&&(d.targetId=o),typeof a<"u"&&(d.identifier=a),typeof s<"u"&&(d.providerId=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}updatePushTarget(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={targetId:e,identifier:i[0]};const o=t.targetId,a=t.identifier;if(typeof o>"u")throw new p('Missing required parameter: "targetId"');if(typeof a>"u")throw new p('Missing required parameter: "identifier"');const s="/account/targets/{targetId}/push".replace("{targetId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.identifier=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}deletePushTarget(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={targetId:e};const t=i.targetId;if(typeof t>"u")throw new p('Missing required parameter: "targetId"');const o="/account/targets/{targetId}/push".replace("{targetId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createEmailToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,email:i[0],phrase:i[1]};const o=t.userId,a=t.email,s=t.phrase;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "email"');const r="/account/tokens/email",d={};typeof o<"u"&&(d.userId=o),typeof a<"u"&&(d.email=a),typeof s<"u"&&(d.phrase=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}createMagicURLToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,email:i[0],url:i[1],phrase:i[2]};const o=t.userId,a=t.email,s=t.url,r=t.phrase;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "email"');const d="/account/tokens/magic-url",c={};typeof o<"u"&&(c.userId=o),typeof a<"u"&&(c.email=a),typeof s<"u"&&(c.url=s),typeof r<"u"&&(c.phrase=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,u,c)}createOAuth2Token(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("provider"in e||"success"in e||"failure"in e||"scopes"in e)?t=e||{}:t={provider:e,success:i[0],failure:i[1],scopes:i[2]};const o=t.provider,a=t.success,s=t.failure,r=t.scopes;if(typeof o>"u")throw new p('Missing required parameter: "provider"');const d="/account/tokens/oauth2/{provider}".replace("{provider}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.success=a),typeof s<"u"&&(c.failure=s),typeof r<"u"&&(c.scopes=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project;for(const[u,m]of Object.entries(ye.flatten(c)))h.searchParams.append(u,m);if(typeof window<"u"&&window?.location){window.location.href=h.toString();return}else return h.toString()}createPhoneToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,phone:i[0]};const o=t.userId,a=t.phone;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "phone"');const s="/account/tokens/phone",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.phone=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}createEmailVerification(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const t=i.url;if(typeof t>"u")throw new p('Missing required parameter: "url"');const o="/account/verifications/email",a={};typeof t<"u"&&(a.url=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}createVerification(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const t=i.url;if(typeof t>"u")throw new p('Missing required parameter: "url"');const o="/account/verifications/email",a={};typeof t<"u"&&(a.url=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}updateEmailVerification(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/verifications/email",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}updateVerification(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/verifications/email",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}createPhoneVerification(){const e="/account/verifications/phone",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",t,o,i)}updatePhoneVerification(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/verifications/phone",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}}class xi{constructor(e){this.client=e}getBrowser(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?t=e||{}:t={code:e,width:i[0],height:i[1],quality:i[2]};const o=t.code,a=t.width,s=t.height,r=t.quality;if(typeof o>"u")throw new p('Missing required parameter: "code"');const d="/avatars/browsers/{code}".replace("{code}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.width=a),typeof s<"u"&&(c.height=s),typeof r<"u"&&(c.quality=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ye.flatten(c)))h.searchParams.append(u,m);return h.toString()}getCreditCard(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?t=e||{}:t={code:e,width:i[0],height:i[1],quality:i[2]};const o=t.code,a=t.width,s=t.height,r=t.quality;if(typeof o>"u")throw new p('Missing required parameter: "code"');const d="/avatars/credit-cards/{code}".replace("{code}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.width=a),typeof s<"u"&&(c.height=s),typeof r<"u"&&(c.quality=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ye.flatten(c)))h.searchParams.append(u,m);return h.toString()}getFavicon(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const t=i.url;if(typeof t>"u")throw new p('Missing required parameter: "url"');const o="/avatars/favicon",a={};typeof t<"u"&&(a.url=t);const s=new URL(this.client.config.endpoint+o);a.project=this.client.config.project,a.impersonateuserid=this.client.config.impersonateuserid;for(const[r,d]of Object.entries(ye.flatten(a)))s.searchParams.append(r,d);return s.toString()}getFlag(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?t=e||{}:t={code:e,width:i[0],height:i[1],quality:i[2]};const o=t.code,a=t.width,s=t.height,r=t.quality;if(typeof o>"u")throw new p('Missing required parameter: "code"');const d="/avatars/flags/{code}".replace("{code}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.width=a),typeof s<"u"&&(c.height=s),typeof r<"u"&&(c.quality=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ye.flatten(c)))h.searchParams.append(u,m);return h.toString()}getImage(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={url:e,width:i[0],height:i[1]};const o=t.url,a=t.width,s=t.height;if(typeof o>"u")throw new p('Missing required parameter: "url"');const r="/avatars/image",d={};typeof o<"u"&&(d.url=o),typeof a<"u"&&(d.width=a),typeof s<"u"&&(d.height=s);const c=new URL(this.client.config.endpoint+r);d.project=this.client.config.project,d.impersonateuserid=this.client.config.impersonateuserid;for(const[h,u]of Object.entries(ye.flatten(d)))c.searchParams.append(h,u);return c.toString()}getInitials(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={name:e,width:i[0],height:i[1],background:i[2]};const o=t.name,a=t.width,s=t.height,r=t.background,d="/avatars/initials",c={};typeof o<"u"&&(c.name=o),typeof a<"u"&&(c.width=a),typeof s<"u"&&(c.height=s),typeof r<"u"&&(c.background=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ye.flatten(c)))h.searchParams.append(u,m);return h.toString()}getPhoto(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={width:e,height:i[0],quality:i[1],output:i[2],rating:i[3],userId:i[4],emailHash:i[5],name:i[6]};const o=t.width,a=t.height,s=t.quality,r=t.output,d=t.rating,c=t.userId,h=t.emailHash,u=t.name,m="/avatars/photo",j={};typeof o<"u"&&(j.width=o),typeof a<"u"&&(j.height=a),typeof s<"u"&&(j.quality=s),typeof r<"u"&&(j.output=r),typeof d<"u"&&(j.rating=d),typeof c<"u"&&(j.userId=c),typeof h<"u"&&(j.emailHash=h),typeof u<"u"&&(j.name=u);const E=new URL(this.client.config.endpoint+m);j.project=this.client.config.project,j.impersonateuserid=this.client.config.impersonateuserid;for(const[Q,W]of Object.entries(ye.flatten(j)))E.searchParams.append(Q,W);return E.toString()}getQR(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={text:e,size:i[0],margin:i[1],download:i[2]};const o=t.text,a=t.size,s=t.margin,r=t.download;if(typeof o>"u")throw new p('Missing required parameter: "text"');const d="/avatars/qr",c={};typeof o<"u"&&(c.text=o),typeof a<"u"&&(c.size=a),typeof s<"u"&&(c.margin=s),typeof r<"u"&&(c.download=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ye.flatten(c)))h.searchParams.append(u,m);return h.toString()}getScreenshot(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={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 o=t.url,a=t.headers,s=t.viewportWidth,r=t.viewportHeight,d=t.scale,c=t.theme,h=t.userAgent,u=t.fullpage,m=t.locale,j=t.timezone,E=t.latitude,Q=t.longitude,W=t.accuracy,K=t.touch,_=t.permissions,N=t.sleep,Y=t.width,ne=t.height,H=t.quality,L=t.output;if(typeof o>"u")throw new p('Missing required parameter: "url"');const ee="/avatars/screenshots",V={};typeof o<"u"&&(V.url=o),typeof a<"u"&&(V.headers=a),typeof s<"u"&&(V.viewportWidth=s),typeof r<"u"&&(V.viewportHeight=r),typeof d<"u"&&(V.scale=d),typeof c<"u"&&(V.theme=c),typeof h<"u"&&(V.userAgent=h),typeof u<"u"&&(V.fullpage=u),typeof m<"u"&&(V.locale=m),typeof j<"u"&&(V.timezone=j),typeof E<"u"&&(V.latitude=E),typeof Q<"u"&&(V.longitude=Q),typeof W<"u"&&(V.accuracy=W),typeof K<"u"&&(V.touch=K),typeof _<"u"&&(V.permissions=_),typeof N<"u"&&(V.sleep=N),typeof Y<"u"&&(V.width=Y),typeof ne<"u"&&(V.height=ne),typeof H<"u"&&(V.quality=H),typeof L<"u"&&(V.output=L);const R=new URL(this.client.config.endpoint+ee);V.project=this.client.config.project,V.impersonateuserid=this.client.config.impersonateuserid;for(const[J,T]of Object.entries(ye.flatten(V)))R.searchParams.append(J,T);return R.toString()}}class Wn{constructor(e){this.client=e}listTransactions(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={queries:e};const t=i.queries,o="/databases/transactions",a={};typeof t<"u"&&(a.queries=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}createTransaction(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={ttl:e};const t=i.ttl,o="/databases/transactions",a={};typeof t<"u"&&(a.ttl=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}getTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/databases/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateTransaction(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,commit:i[0],rollback:i[1]};const o=t.transactionId,a=t.commit,s=t.rollback;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const r="/databases/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.commit=a),typeof s<"u"&&(d.rollback=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/databases/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createOperations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,operations:i[0]};const o=t.transactionId,a=t.operations;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const s="/databases/transactions/{transactionId}/operations".replace("{transactionId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.operations=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}listDocuments(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.collectionId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');const h="/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",m,j,u)}createDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "data"');const h="/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.documentId=s),typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}getDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],queries:i[2],transactionId:i[3]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.queries,d=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const c="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),h={};typeof r<"u"&&(h.queries=r),typeof d<"u"&&(h.transactionId=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",u,m,h)}upsertDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",m,j,u)}updateDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}deleteDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],transactionId:i[2]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const d="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),c={};typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",h,u,c)}decrementDocumentAttribute(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],attribute:i[2],value:i[3],min:i[4],transactionId:i[5]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.attribute,d=t.value,c=t.min,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "attribute"');const u="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))).replace("{attribute}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.min=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),E={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,E,m)}incrementDocumentAttribute(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],attribute:i[2],value:i[3],max:i[4],transactionId:i[5]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.attribute,d=t.value,c=t.max,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "attribute"');const u="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))).replace("{attribute}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.max=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),E={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,E,m)}}class Gn{constructor(e){this.client=e}listTransactions(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={queries:e};const t=i.queries,o="/documentsdb/transactions",a={};typeof t<"u"&&(a.queries=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}createTransaction(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={ttl:e};const t=i.ttl,o="/documentsdb/transactions",a={};typeof t<"u"&&(a.ttl=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}getTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/documentsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateTransaction(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,commit:i[0],rollback:i[1]};const o=t.transactionId,a=t.commit,s=t.rollback;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const r="/documentsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.commit=a),typeof s<"u"&&(d.rollback=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/documentsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createOperations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,operations:i[0]};const o=t.transactionId,a=t.operations;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const s="/documentsdb/transactions/{transactionId}/operations".replace("{transactionId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.operations=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}listDocuments(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.collectionId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');const h="/documentsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",m,j,u)}createDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "data"');const h="/documentsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.documentId=s),typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}createDocuments(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documents:i[1],transactionId:i[2]};const o=t.databaseId,a=t.collectionId,s=t.documents,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documents"');const d="/documentsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),c={};typeof s<"u"&&(c.documents=s),typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,u,c)}getDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],queries:i[2],transactionId:i[3]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.queries,d=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const c="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),h={};typeof r<"u"&&(h.queries=r),typeof d<"u"&&(h.transactionId=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",u,m,h)}upsertDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",m,j,u)}updateDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}deleteDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],transactionId:i[2]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const d="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),c={};typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",h,u,c)}decrementDocumentAttribute(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],attribute:i[2],value:i[3],min:i[4],transactionId:i[5]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.attribute,d=t.value,c=t.min,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "attribute"');const u="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))).replace("{attribute}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.min=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),E={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,E,m)}incrementDocumentAttribute(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],attribute:i[2],value:i[3],max:i[4],transactionId:i[5]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.attribute,d=t.value,c=t.max,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "attribute"');const u="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))).replace("{attribute}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.max=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),E={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,E,m)}}class Kn{constructor(e){this.client=e}listExecutions(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={functionId:e,queries:i[0],total:i[1]};const o=t.functionId,a=t.queries,s=t.total;if(typeof o>"u")throw new p('Missing required parameter: "functionId"');const r="/functions/{functionId}/executions".replace("{functionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.queries=a),typeof s<"u"&&(d.total=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}createExecution(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={functionId:e,body:i[0],async:i[1],xpath:i[2],method:i[3],headers:i[4],scheduledAt:i[5]};const o=t.functionId,a=t.body,s=t.async,r=t.xpath,d=t.method,c=t.headers,h=t.scheduledAt;if(typeof o>"u")throw new p('Missing required parameter: "functionId"');const u="/functions/{functionId}/executions".replace("{functionId}",encodeURIComponent(String(o))),m={};typeof a<"u"&&(m.body=a),typeof s<"u"&&(m.async=s),typeof r<"u"&&(m.path=r),typeof d<"u"&&(m.method=d),typeof c<"u"&&(m.headers=c),typeof h<"u"&&(m.scheduledAt=h);const j=new URL(this.client.config.endpoint+u),E={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",j,E,m)}getExecution(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={functionId:e,executionId:i[0]};const o=t.functionId,a=t.executionId;if(typeof o>"u")throw new p('Missing required parameter: "functionId"');if(typeof a>"u")throw new p('Missing required parameter: "executionId"');const s="/functions/{functionId}/executions/{executionId}".replace("{functionId}",encodeURIComponent(String(o))).replace("{executionId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}}class Jn{constructor(e){this.client=e}query(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"query"in e?i=e||{}:i={query:e};const t=i.query;if(typeof t>"u")throw new p('Missing required parameter: "query"');const o="/graphql",a={};typeof t<"u"&&(a.query=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"x-sdk-graphql":"true","content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}mutation(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"query"in e?i=e||{}:i={query:e};const t=i.query;if(typeof t>"u")throw new p('Missing required parameter: "query"');const o="/graphql/mutation",a={};typeof t<"u"&&(a.query=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"x-sdk-graphql":"true","content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}}class Yn{constructor(e){this.client=e}get(){const e="/locale",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCodes(){const e="/locale/codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listContinents(){const e="/locale/continents",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCountries(){const e="/locale/countries",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCountriesEU(){const e="/locale/countries/eu",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCountriesPhones(){const e="/locale/countries/phones",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCurrencies(){const e="/locale/currencies",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listLanguages(){const e="/locale/languages",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}}class Zn{constructor(e){this.client=e}createSubscriber(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={topicId:e,subscriberId:i[0],targetId:i[1]};const o=t.topicId,a=t.subscriberId,s=t.targetId;if(typeof o>"u")throw new p('Missing required parameter: "topicId"');if(typeof a>"u")throw new p('Missing required parameter: "subscriberId"');if(typeof s>"u")throw new p('Missing required parameter: "targetId"');const r="/messaging/topics/{topicId}/subscribers".replace("{topicId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.subscriberId=a),typeof s<"u"&&(d.targetId=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}deleteSubscriber(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={topicId:e,subscriberId:i[0]};const o=t.topicId,a=t.subscriberId;if(typeof o>"u")throw new p('Missing required parameter: "topicId"');if(typeof a>"u")throw new p('Missing required parameter: "subscriberId"');const s="/messaging/topics/{topicId}/subscribers/{subscriberId}".replace("{topicId}",encodeURIComponent(String(o))).replace("{subscriberId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",d,c,r)}}class Qn{constructor(e){this.client=e}listInstallations(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0]};const o=t.queries,a=t.total,s="/organization/installations",r={};typeof o<"u"&&(r.queries=o),typeof a<"u"&&(r.total=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}createInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={appId:e,authorizationDetails:i[0]};const o=t.appId,a=t.authorizationDetails;if(typeof o>"u")throw new p('Missing required parameter: "appId"');const s="/organization/installations",r={};typeof o<"u"&&(r.appId=o),typeof a<"u"&&(r.authorizationDetails=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}getInstallation(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={installationId:e};const t=i.installationId;if(typeof t>"u")throw new p('Missing required parameter: "installationId"');const o="/organization/installations/{installationId}".replace("{installationId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={installationId:e,authorizationDetails:i[0]};const o=t.installationId,a=t.authorizationDetails;if(typeof o>"u")throw new p('Missing required parameter: "installationId"');const s="/organization/installations/{installationId}".replace("{installationId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.authorizationDetails=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}deleteInstallation(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={installationId:e};const t=i.installationId;if(typeof t>"u")throw new p('Missing required parameter: "installationId"');const o="/organization/installations/{installationId}".replace("{installationId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",s,r,a)}}class Tn{constructor(e){this.client=e}list(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0],ttl:i[1]};const o=t.queries,a=t.total,s=t.ttl,r="/presences",d={};typeof o<"u"&&(d.queries=o),typeof a<"u"&&(d.total=a),typeof s<"u"&&(d.ttl=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}get(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={presenceId:e};const t=i.presenceId;if(typeof t>"u")throw new p('Missing required parameter: "presenceId"');const o="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}upsert(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={presenceId:e,status:i[0],permissions:i[1],expiresAt:i[2],metadata:i[3]};const o=t.presenceId,a=t.status,s=t.permissions,r=t.expiresAt,d=t.metadata;if(typeof o>"u")throw new p('Missing required parameter: "presenceId"');if(typeof a>"u")throw new p('Missing required parameter: "status"');const c="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(o))),h={};typeof a<"u"&&(h.status=a),typeof s<"u"&&(h.permissions=s),typeof r<"u"&&(h.expiresAt=r),typeof d<"u"&&(h.metadata=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",u,m,h)}update(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={presenceId:e,status:i[0],expiresAt:i[1],metadata:i[2],permissions:i[3],purge:i[4]};const o=t.presenceId,a=t.status,s=t.expiresAt,r=t.metadata,d=t.permissions,c=t.purge;if(typeof o>"u")throw new p('Missing required parameter: "presenceId"');const h="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(o))),u={};typeof a<"u"&&(u.status=a),typeof s<"u"&&(u.expiresAt=s),typeof r<"u"&&(u.metadata=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.purge=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}delete(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={presenceId:e};const t=i.presenceId;if(typeof t>"u")throw new p('Missing required parameter: "presenceId"');const o="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}}class zn{constructor(e){this.client=e}listFiles(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,queries:i[0],search:i[1],total:i[2]};const o=t.bucketId,a=t.queries,s=t.search,r=t.total;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');const d="/storage/buckets/{bucketId}/files".replace("{bucketId}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.queries=a),typeof s<"u"&&(c.search=s),typeof r<"u"&&(c.total=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",h,u,c)}createFile(e,...i){let t,o;e&&typeof e=="object"&&!Array.isArray(e)?(t=e||{},o=e?.onProgress):(t={bucketId:e,fileId:i[0],file:i[1],permissions:i[2],folder:i[3]},o=i[4]);const a=t.bucketId,s=t.fileId,r=t.file,d=t.permissions,c=t.folder;if(typeof a>"u")throw new p('Missing required parameter: "bucketId"');if(typeof s>"u")throw new p('Missing required parameter: "fileId"');if(typeof r>"u")throw new p('Missing required parameter: "file"');const h="/storage/buckets/{bucketId}/files".replace("{bucketId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.fileId=s),typeof r<"u"&&(u.file=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.folder=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"multipart/form-data",accept:"application/json"};return this.client.chunkedUpload("post",m,j,u,o)}getFile(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0]};const o=t.bucketId,a=t.fileId;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const s="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}updateFile(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0],name:i[1],permissions:i[2]};const o=t.bucketId,a=t.fileId,s=t.name,r=t.permissions;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const d="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),c={};typeof s<"u"&&(c.name=s),typeof r<"u"&&(c.permissions=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,u,c)}deleteFile(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0]};const o=t.bucketId,a=t.fileId;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const s="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",d,c,r)}getFileDownload(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0],token:i[1]};const o=t.bucketId,a=t.fileId,s=t.token;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const r="/storage/buckets/{bucketId}/files/{fileId}/download".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),d={};typeof s<"u"&&(d.token=s);const c=new URL(this.client.config.endpoint+r);d.project=this.client.config.project,d.impersonateuserid=this.client.config.impersonateuserid;for(const[h,u]of Object.entries(ye.flatten(d)))c.searchParams.append(h,u);return c.toString()}getFilePreview(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0],width:i[1],height:i[2],gravity:i[3],quality:i[4],borderWidth:i[5],borderColor:i[6],borderRadius:i[7],opacity:i[8],rotation:i[9],background:i[10],output:i[11],token:i[12]};const o=t.bucketId,a=t.fileId,s=t.width,r=t.height,d=t.gravity,c=t.quality,h=t.borderWidth,u=t.borderColor,m=t.borderRadius,j=t.opacity,E=t.rotation,Q=t.background,W=t.output,K=t.token;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const _="/storage/buckets/{bucketId}/files/{fileId}/preview".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),N={};typeof s<"u"&&(N.width=s),typeof r<"u"&&(N.height=r),typeof d<"u"&&(N.gravity=d),typeof c<"u"&&(N.quality=c),typeof h<"u"&&(N.borderWidth=h),typeof u<"u"&&(N.borderColor=u),typeof m<"u"&&(N.borderRadius=m),typeof j<"u"&&(N.opacity=j),typeof E<"u"&&(N.rotation=E),typeof Q<"u"&&(N.background=Q),typeof W<"u"&&(N.output=W),typeof K<"u"&&(N.token=K);const Y=new URL(this.client.config.endpoint+_);N.project=this.client.config.project,N.impersonateuserid=this.client.config.impersonateuserid;for(const[ne,H]of Object.entries(ye.flatten(N)))Y.searchParams.append(ne,H);return Y.toString()}getFileView(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0],token:i[1]};const o=t.bucketId,a=t.fileId,s=t.token;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const r="/storage/buckets/{bucketId}/files/{fileId}/view".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),d={};typeof s<"u"&&(d.token=s);const c=new URL(this.client.config.endpoint+r);d.project=this.client.config.project,d.impersonateuserid=this.client.config.impersonateuserid;for(const[h,u]of Object.entries(ye.flatten(d)))c.searchParams.append(h,u);return c.toString()}}class On{constructor(e){this.client=e}listTransactions(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={queries:e};const t=i.queries,o="/tablesdb/transactions",a={};typeof t<"u"&&(a.queries=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}createTransaction(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={ttl:e};const t=i.ttl,o="/tablesdb/transactions",a={};typeof t<"u"&&(a.ttl=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}getTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/tablesdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateTransaction(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,commit:i[0],rollback:i[1]};const o=t.transactionId,a=t.commit,s=t.rollback;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const r="/tablesdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.commit=a),typeof s<"u"&&(d.rollback=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/tablesdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createOperations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,operations:i[0]};const o=t.transactionId,a=t.operations;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const s="/tablesdb/transactions/{transactionId}/operations".replace("{transactionId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.operations=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}listRows(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.tableId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');const h="/tablesdb/{databaseId}/tables/{tableId}/rows".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",m,j,u)}createRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');if(typeof r>"u")throw new p('Missing required parameter: "data"');const h="/tablesdb/{databaseId}/tables/{tableId}/rows".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.rowId=s),typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}getRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],queries:i[2],transactionId:i[3]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.queries,d=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');const c="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))),h={};typeof r<"u"&&(h.queries=r),typeof d<"u"&&(h.transactionId=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",u,m,h)}upsertRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');const h="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",m,j,u)}updateRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');const h="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}deleteRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],transactionId:i[2]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');const d="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))),c={};typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",h,u,c)}decrementRowColumn(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],column:i[2],value:i[3],min:i[4],transactionId:i[5]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.column,d=t.value,c=t.min,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');if(typeof r>"u")throw new p('Missing required parameter: "column"');const u="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))).replace("{column}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.min=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),E={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,E,m)}incrementRowColumn(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],column:i[2],value:i[3],max:i[4],transactionId:i[5]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.column,d=t.value,c=t.max,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');if(typeof r>"u")throw new p('Missing required parameter: "column"');const u="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))).replace("{column}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.max=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),E={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,E,m)}}class Fn{constructor(e){this.client=e}list(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,search:i[0],total:i[1]};const o=t.queries,a=t.search,s=t.total,r="/teams",d={};typeof o<"u"&&(d.queries=o),typeof a<"u"&&(d.search=a),typeof s<"u"&&(d.total=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}create(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,name:i[0],roles:i[1]};const o=t.teamId,a=t.name,s=t.roles;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "name"');const r="/teams",d={};typeof o<"u"&&(d.teamId=o),typeof a<"u"&&(d.name=a),typeof s<"u"&&(d.roles=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}get(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={teamId:e};const t=i.teamId;if(typeof t>"u")throw new p('Missing required parameter: "teamId"');const o="/teams/{teamId}".replace("{teamId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateName(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,name:i[0]};const o=t.teamId,a=t.name;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "name"');const s="/teams/{teamId}".replace("{teamId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.name=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}delete(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={teamId:e};const t=i.teamId;if(typeof t>"u")throw new p('Missing required parameter: "teamId"');const o="/teams/{teamId}".replace("{teamId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}listInstallations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,queries:i[0],total:i[1]};const o=t.teamId,a=t.queries,s=t.total;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');const r="/teams/{teamId}/installations".replace("{teamId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.queries=a),typeof s<"u"&&(d.total=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}createInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,appId:i[0],authorizationDetails:i[1]};const o=t.teamId,a=t.appId,s=t.authorizationDetails;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "appId"');const r="/teams/{teamId}/installations".replace("{teamId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.appId=a),typeof s<"u"&&(d.authorizationDetails=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}getInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,installationId:i[0]};const o=t.teamId,a=t.installationId;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "installationId"');const s="/teams/{teamId}/installations/{installationId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{installationId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}updateInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,installationId:i[0],authorizationDetails:i[1]};const o=t.teamId,a=t.installationId,s=t.authorizationDetails;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "installationId"');const r="/teams/{teamId}/installations/{installationId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{installationId}",encodeURIComponent(String(a))),d={};typeof s<"u"&&(d.authorizationDetails=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",c,h,d)}deleteInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,installationId:i[0]};const o=t.teamId,a=t.installationId;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "installationId"');const s="/teams/{teamId}/installations/{installationId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{installationId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",d,c,r)}listMemberships(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,queries:i[0],search:i[1],total:i[2]};const o=t.teamId,a=t.queries,s=t.search,r=t.total;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');const d="/teams/{teamId}/memberships".replace("{teamId}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.queries=a),typeof s<"u"&&(c.search=s),typeof r<"u"&&(c.total=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",h,u,c)}createMembership(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,roles:i[0],email:i[1],userId:i[2],phone:i[3],url:i[4],name:i[5]};const o=t.teamId,a=t.roles,s=t.email,r=t.userId,d=t.phone,c=t.url,h=t.name;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "roles"');const u="/teams/{teamId}/memberships".replace("{teamId}",encodeURIComponent(String(o))),m={};typeof s<"u"&&(m.email=s),typeof r<"u"&&(m.userId=r),typeof d<"u"&&(m.phone=d),typeof a<"u"&&(m.roles=a),typeof c<"u"&&(m.url=c),typeof h<"u"&&(m.name=h);const j=new URL(this.client.config.endpoint+u),E={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",j,E,m)}getMembership(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,membershipId:i[0]};const o=t.teamId,a=t.membershipId;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "membershipId"');const s="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{membershipId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}updateMembership(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,membershipId:i[0],roles:i[1]};const o=t.teamId,a=t.membershipId,s=t.roles;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "membershipId"');if(typeof s>"u")throw new p('Missing required parameter: "roles"');const r="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{membershipId}",encodeURIComponent(String(a))),d={};typeof s<"u"&&(d.roles=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteMembership(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,membershipId:i[0]};const o=t.teamId,a=t.membershipId;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "membershipId"');const s="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{membershipId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",d,c,r)}updateMembershipStatus(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,membershipId:i[0],userId:i[1],secret:i[2]};const o=t.teamId,a=t.membershipId,s=t.userId,r=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "membershipId"');if(typeof s>"u")throw new p('Missing required parameter: "userId"');if(typeof r>"u")throw new p('Missing required parameter: "secret"');const d="/teams/{teamId}/memberships/{membershipId}/status".replace("{teamId}",encodeURIComponent(String(o))).replace("{membershipId}",encodeURIComponent(String(a))),c={};typeof s<"u"&&(c.userId=s),typeof r<"u"&&(c.secret=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",h,u,c)}getPrefs(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={teamId:e};const t=i.teamId;if(typeof t>"u")throw new p('Missing required parameter: "teamId"');const o="/teams/{teamId}/prefs".replace("{teamId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updatePrefs(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,prefs:i[0]};const o=t.teamId,a=t.prefs;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "prefs"');const s="/teams/{teamId}/prefs".replace("{teamId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.prefs=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}}class eo{constructor(e){this.client=e}listTransactions(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={queries:e};const t=i.queries,o="/vectorsdb/transactions",a={};typeof t<"u"&&(a.queries=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}createTransaction(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={ttl:e};const t=i.ttl,o="/vectorsdb/transactions",a={};typeof t<"u"&&(a.ttl=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}getTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/vectorsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateTransaction(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,commit:i[0],rollback:i[1]};const o=t.transactionId,a=t.commit,s=t.rollback;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const r="/vectorsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.commit=a),typeof s<"u"&&(d.rollback=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/vectorsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createOperations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,operations:i[0]};const o=t.transactionId,a=t.operations;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const s="/vectorsdb/transactions/{transactionId}/operations".replace("{transactionId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.operations=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}listDocuments(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.collectionId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",m,j,u)}createDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "data"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.documentId=s),typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}createQuery(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.collectionId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents/query".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}getDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],queries:i[2],transactionId:i[3]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.queries,d=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const c="/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),h={};typeof r<"u"&&(h.queries=r),typeof d<"u"&&(h.transactionId=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",u,m,h)}upsertDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",m,j,u)}updateDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}deleteDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],transactionId:i[2]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const d="/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),c={};typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",h,u,c)}}var wt;(function(n){n[n.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",n[n.POLICY_VIOLATION=1008]="POLICY_VIOLATION",n[n.UNKNOWN_ERROR=-1]="UNKNOWN_ERROR"})(wt||(wt={}));class to{constructor(e){this.TYPE_ERROR="error",this.TYPE_EVENT="event",this.TYPE_PONG="pong",this.TYPE_CONNECTED="connected",this.DEBOUNCE_MS=1,this.HEARTBEAT_INTERVAL=2e4,this.activeSubscriptions=new Map,this.pendingSubscribes=new Map,this.appConnected=!1,this.subCallDepth=0,this.reconnectAttempts=0,this.connectionId=0,this.reconnect=!0,this.onErrorCallbacks=[],this.onCloseCallbacks=[],this.onOpenCallbacks=[],this.client=e}onError(e){this.onErrorCallbacks.push(e)}onClose(e){this.onCloseCallbacks.push(e)}onOpen(e){this.onOpenCallbacks.push(e)}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=window?.setInterval(()=>{this.socket&&this.socket.readyState===WebSocket.OPEN&&this.socket.send(ge.stringify({type:"ping"}))},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatTimer&&(window?.clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}createSocket(){return be(this,void 0,void 0,function*(){if(!(this.socket&&this.socket.readyState<WebSocket.CLOSING))return this.socketCreationPromise?this.socketCreationPromise:(this.socketCreationPromise=this.createSocketLocked().finally(()=>{this.socketCreationPromise=void 0}),this.socketCreationPromise)})}createSocketLocked(){return be(this,void 0,void 0,function*(){if(this.activeSubscriptions.size===0&&!this.pendingPresence){this.reconnect=!1,yield this.closeSocket();return}const e=this.client.config.project;if(!e)throw new p("Missing project ID");let i=`project=${e}`;const t=this.client.config.jwt;t&&(i+=`&jwt=${encodeURIComponent(t)}`);const s=`${(this.client.config.endpointRealtime!==""?this.client.config.endpointRealtime:this.client.config.endpoint||"").replace("https://","wss://").replace("http://","ws://")}/realtime?${i}`;return this.socket&&(this.reconnect=!1,this.socket.readyState<WebSocket.CLOSING&&(yield this.closeSocket()),this.reconnect=!0),new Promise((r,d)=>{if(this.activeSubscriptions.size===0&&!this.pendingPresence){r();return}try{const c=++this.connectionId,h=this.socket=new WebSocket(s);h.addEventListener("open",()=>{c===this.connectionId&&(this.reconnectAttempts=0,this.onOpenCallbacks.forEach(u=>u()),this.startHeartbeat(),r())}),h.addEventListener("message",u=>{if(c===this.connectionId)try{const m=ge.parse(u.data);this.handleMessage(m)}catch(m){console.error("Failed to parse message:",m)}}),h.addEventListener("close",u=>be(this,void 0,void 0,function*(){if(c!==this.connectionId||h!==this.socket)return;if(this.appConnected=!1,this.stopHeartbeat(),this.onCloseCallbacks.forEach(j=>j()),!this.reconnect||u.code===wt.POLICY_VIOLATION){this.reconnect=!0;return}const m=this.getTimeout();console.log(`Realtime disconnected. Re-connecting in ${m/1e3} seconds.`),yield this.sleep(m),this.reconnectAttempts++;try{yield this.createSocket()}catch(j){console.error("Failed to reconnect:",j)}})),h.addEventListener("error",u=>{if(c!==this.connectionId||h!==this.socket)return;this.stopHeartbeat();const m=new Error("WebSocket error");console.error("WebSocket error:",m.message),this.onErrorCallbacks.forEach(j=>j(m)),d(m)})}catch(c){d(c)}})})}closeSocket(){return be(this,void 0,void 0,function*(){if(this.stopHeartbeat(),this.socket)return new Promise(e=>{if(!this.socket){e();return}this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING?(this.socket.addEventListener("close",()=>{e()},{once:!0}),this.socket.close(wt.NORMAL_CLOSURE)):e()})})}getTimeout(){return this.reconnectAttempts<5?1e3:this.reconnectAttempts<15?5e3:this.reconnectAttempts<100?1e4:6e4}sleep(e){return new Promise(i=>setTimeout(i,e))}sendUnsubscribeMessage(e){const i=e.filter(t=>typeof t=="string"&&t.length>0);i.length!==0&&(!this.socket||this.socket.readyState!==WebSocket.OPEN||this.socket.send(ge.stringify({type:"unsubscribe",data:i.map(t=>({subscriptionId:t}))})))}generateUniqueSubscriptionId(){const e=this.activeSubscriptions.size+1;for(let i=0;i<e;i++){const t=He.unique();if(!this.activeSubscriptions.has(t))return t}throw new p("Failed to generate unique subscription id")}enqueuePendingSubscribe(e){var i;const t=this.activeSubscriptions.get(e);t&&this.pendingSubscribes.set(e,{subscriptionId:e,channels:Array.from(t.channels),queries:(i=t.queries)!==null&&i!==void 0?i:[]})}disconnect(){return be(this,void 0,void 0,function*(){this.activeSubscriptions.clear(),this.pendingSubscribes.clear(),this.pendingPresence=void 0,this.appConnected=!1,this.reconnect=!1,this.socketCreationPromise=void 0,yield this.closeSocket()})}sendPendingSubscribes(){if(!this.socket||this.socket.readyState!==WebSocket.OPEN||!this.appConnected||this.pendingSubscribes.size<1)return;const e=Array.from(this.pendingSubscribes.values());this.pendingSubscribes.clear(),this.socket.send(ge.stringify({type:"subscribe",data:e}))}channelToString(e){return typeof e=="string"?e:e&&typeof e.toString=="function"?e.toString():String(e)}subscribe(e,i){return be(this,arguments,void 0,function*(t,o,a=[]){const r=(Array.isArray(t)?t:[t]).map(E=>this.channelToString(E)),d=new Set(r),c=[];for(const E of a??[])if(Array.isArray(E))for(const Q of E)c.push(typeof Q=="string"?Q:Q.toString());else c.push(typeof E=="string"?E:E.toString());const h=this.generateUniqueSubscriptionId();this.activeSubscriptions.set(h,{channels:d,queries:c,callback:o}),this.enqueuePendingSubscribe(h),this.subCallDepth++;try{yield this.sleep(this.DEBOUNCE_MS),this.subCallDepth===1&&(!this.socket||this.socket.readyState>WebSocket.OPEN?yield this.createSocket():this.socket.readyState===WebSocket.OPEN&&this.sendPendingSubscribes())}finally{this.subCallDepth--}const u=()=>be(this,void 0,void 0,function*(){this.activeSubscriptions.has(h)&&(this.activeSubscriptions.delete(h),this.pendingSubscribes.delete(h),this.sendUnsubscribeMessage([h]))});return{unsubscribe:u,update:E=>be(this,void 0,void 0,function*(){const Q=this.activeSubscriptions.get(h);if(Q){if(E.channels!==void 0){const W=E.channels.map(K=>this.channelToString(K));Q.channels=new Set(W)}if(E.queries!==void 0){const W=[];for(const K of E.queries)if(Array.isArray(K))for(const _ of K)W.push(typeof _=="string"?_:_.toString());else W.push(typeof K=="string"?K:K.toString());Q.queries=W}this.enqueuePendingSubscribe(h),this.subCallDepth++;try{yield this.sleep(this.DEBOUNCE_MS),this.subCallDepth===1&&(!this.socket||this.socket.readyState>WebSocket.OPEN?yield this.createSocket():this.socket.readyState===WebSocket.OPEN&&this.sendPendingSubscribes())}finally{this.subCallDepth--}}}),close:()=>be(this,void 0,void 0,function*(){yield u(),this.activeSubscriptions.size===0&&(this.reconnect=!1,yield this.closeSocket())})}})}upsertPresence(e){return be(this,void 0,void 0,function*(){const i={status:e.status,presenceId:e.presenceId};e.permissions!==void 0&&(i.permissions=e.permissions),e.metadata!==void 0&&(i.metadata=e.metadata),this.pendingPresence=i,(!this.socket||this.socket.readyState>=WebSocket.CLOSING)&&this.createSocket().catch(t=>{console.error("Failed to open realtime socket for presence:",t)}),this.flushPendingPresence()})}flushPendingPresence(){this.pendingPresence&&(!this.socket||this.socket.readyState!==WebSocket.OPEN||this.appConnected&&this.socket.send(ge.stringify({type:"presence",data:this.pendingPresence})))}handleMessage(e){if(e.type)switch(e.type){case this.TYPE_CONNECTED:this.handleResponseConnected(e);break;case this.TYPE_ERROR:this.handleResponseError(e);break;case this.TYPE_EVENT:this.handleResponseEvent(e);break;case this.TYPE_PONG:break}}handleResponseConnected(e){var i,t;if(!e.data)return;const o=e.data;let a=this.client.config.session;if(!a)try{const s=ge.parse((i=window.localStorage.getItem("cookieFallback"))!==null&&i!==void 0?i:"{}");a=s?.[`a_session_${this.client.config.project}`]}catch(s){console.error("Failed to parse cookie fallback:",s)}a&&!o.user&&((t=this.socket)===null||t===void 0||t.send(ge.stringify({type:"authentication",data:{session:a}})));for(const s of this.activeSubscriptions.keys())this.enqueuePendingSubscribe(s);this.appConnected=!0,this.sendPendingSubscribes(),this.flushPendingPresence()}handleResponseError(e){var i,t;const o=new p(((i=e.data)===null||i===void 0?void 0:i.message)||"Unknown error"),a=(t=e.data)===null||t===void 0?void 0:t.code;this.onErrorCallbacks.forEach(s=>s(o,a))}handleResponseEvent(e){const i=e.data;if(!i)return;const t=i.channels,o=i.events,a=i.payload,s=i.timestamp,r=i.subscriptions;if(!(!t||!o||!a||!r||r.length===0))for(const d of r){const c=this.activeSubscriptions.get(d);c&&c.callback({events:o,channels:t,timestamp:s,payload:a,subscriptions:r})}}}class Qe{}Qe.read=n=>`read("${n}")`,Qe.write=n=>`write("${n}")`,Qe.create=n=>`create("${n}")`,Qe.update=n=>`update("${n}")`,Qe.delete=n=>`delete("${n}")`;class io{static any(){return"any"}static user(e,i=""){return i===""?`user:${e}`:`user:${e}/${i}`}static users(e=""){return e===""?"users":`users/${e}`}static guests(){return"guests"}static team(e,i=""){return i===""?`team:${e}`:`team:${e}/${i}`}static member(e){return`member:${e}`}static label(e){return`label:${e}`}}function Re(n){if(n==null)throw new Error("Channel ID is required");const e=String(n).trim();if(e==="")throw new Error("Channel ID is required");return e}class ve{constructor(e){this.segments=e}next(e,i){const t=i===void 0?[...this.segments,e]:[...this.segments,e,Re(i)];return new ve(t)}resolve(e){return new ve([...this.segments,e])}toString(){return this.segments.join(".")}collection(e){return this.next("collections",e)}document(e){return this.next("documents",e)}table(e){return this.next("tables",e)}row(e){return this.next("rows",e)}file(e){return this.next("files",e)}create(){return this.resolve("create")}upsert(){return this.resolve("upsert")}update(){return this.resolve("update")}delete(){return this.resolve("delete")}static database(e){return new ve(["databases",Re(e)])}static execution(e){return new ve(["executions",Re(e)])}static tablesdb(e){return new ve(["tablesdb",Re(e)])}static bucket(e){return new ve(["buckets",Re(e)])}static function(e){return new ve(["functions",Re(e)])}static team(e){return new ve(["teams",Re(e)])}static membership(e){return new ve(["memberships",Re(e)])}static presence(e){return new ve(["presences",Re(e)])}static account(){return"account"}static documents(){return"documents"}static rows(){return"rows"}static files(){return"files"}static executions(){return"executions"}static teams(){return"teams"}static memberships(){return"memberships"}static presences(){return"presences"}}var _t;(function(n){n.Equal="equal",n.NotEqual="notEqual",n.GreaterThan="greaterThan",n.GreaterThanEqual="greaterThanEqual",n.LessThan="lessThan",n.LessThanEqual="lessThanEqual",n.Contains="contains",n.IsNull="isNull",n.IsNotNull="isNotNull"})(_t||(_t={}));class Z{constructor(e,i){this.method=e,i!==void 0&&(Array.isArray(i)?this.values=i:this.values=[i])}toString(){return JSON.stringify({method:this.method,values:this.values})}}Z.increment=(n=1,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Value cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Max cannot be NaN or Infinity");const i=[n];return e!==void 0&&i.push(e),new Z("increment",i).toString()},Z.decrement=(n=1,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Value cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Min cannot be NaN or Infinity");const i=[n];return e!==void 0&&i.push(e),new Z("decrement",i).toString()},Z.multiply=(n,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Factor cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Max cannot be NaN or Infinity");const i=[n];return e!==void 0&&i.push(e),new Z("multiply",i).toString()},Z.divide=(n,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Divisor cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Min cannot be NaN or Infinity");if(n===0)throw new Error("Divisor cannot be zero");const i=[n];return e!==void 0&&i.push(e),new Z("divide",i).toString()},Z.modulo=n=>{if(isNaN(n)||!isFinite(n))throw new Error("Divisor cannot be NaN or Infinity");if(n===0)throw new Error("Divisor cannot be zero");return new Z("modulo",[n]).toString()},Z.power=(n,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Exponent cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Max cannot be NaN or Infinity");const i=[n];return e!==void 0&&i.push(e),new Z("power",i).toString()},Z.arrayAppend=n=>new Z("arrayAppend",n).toString(),Z.arrayPrepend=n=>new Z("arrayPrepend",n).toString(),Z.arrayInsert=(n,e)=>new Z("arrayInsert",[n,e]).toString(),Z.arrayRemove=n=>new Z("arrayRemove",[n]).toString(),Z.arrayUnique=()=>new Z("arrayUnique",[]).toString(),Z.arrayIntersect=n=>new Z("arrayIntersect",n).toString(),Z.arrayDiff=n=>new Z("arrayDiff",n).toString(),Z.arrayFilter=(n,e)=>{const i=[n,e===void 0?null:e];return new Z("arrayFilter",i).toString()},Z.stringConcat=n=>new Z("stringConcat",[n]).toString(),Z.stringReplace=(n,e)=>new Z("stringReplace",[n,e]).toString(),Z.toggle=()=>new Z("toggle",[]).toString(),Z.dateAddDays=n=>new Z("dateAddDays",[n]).toString(),Z.dateSubDays=n=>new Z("dateSubDays",[n]).toString(),Z.dateSetNow=()=>new Z("dateSetNow",[]).toString();var Lt;(function(n){n.Totp="totp"})(Lt||(Lt={}));var Nt;(function(n){n.Email="email",n.Phone="phone",n.Totp="totp",n.Recoverycode="recoverycode",n.Custom="custom"})(Nt||(Nt={}));var Ht;(function(n){n.Amazon="amazon",n.Apple="apple",n.Appwrite="appwrite",n.Auth0="auth0",n.Authentik="authentik",n.Autodesk="autodesk",n.Bitbucket="bitbucket",n.Bitly="bitly",n.Box="box",n.Cloudflare="cloudflare",n.Dailymotion="dailymotion",n.Discord="discord",n.Disqus="disqus",n.Dropbox="dropbox",n.Etsy="etsy",n.Facebook="facebook",n.Figma="figma",n.Fusionauth="fusionauth",n.Github="github",n.Gitlab="gitlab",n.Google="google",n.Huggingface="huggingface",n.Keycloak="keycloak",n.Kick="kick",n.Linkedin="linkedin",n.Microsoft="microsoft",n.Notion="notion",n.Oidc="oidc",n.Okta="okta",n.Paypal="paypal",n.PaypalSandbox="paypalSandbox",n.Podio="podio",n.Resend="resend",n.Salesforce="salesforce",n.Slack="slack",n.Spotify="spotify",n.Stripe="stripe",n.Tradeshift="tradeshift",n.TradeshiftBox="tradeshiftBox",n.Twitch="twitch",n.Wordpress="wordpress",n.X="x",n.Yahoo="yahoo",n.Yammer="yammer",n.Yandex="yandex",n.Zoho="zoho",n.Zoom="zoom"})(Ht||(Ht={}));var Dt;(function(n){n.AvantBrowser="aa",n.AndroidWebViewBeta="an",n.GoogleChrome="ch",n.GoogleChromeIOS="ci",n.GoogleChromeMobile="cm",n.Chromium="cr",n.MozillaFirefox="ff",n.Safari="sf",n.MobileSafari="mf",n.MicrosoftEdge="ps",n.MicrosoftEdgeIOS="oi",n.OperaMini="om",n.Opera="op",n.OperaNext="on"})(Dt||(Dt={}));var Bt;(function(n){n.AmericanExpress="amex",n.Argencard="argencard",n.Cabal="cabal",n.Cencosud="cencosud",n.DinersClub="diners",n.Discover="discover",n.Elo="elo",n.Hipercard="hipercard",n.JCB="jcb",n.Mastercard="mastercard",n.Naranja="naranja",n.TarjetaShopping="targeta-shopping",n.UnionPay="unionpay",n.Visa="visa",n.MIR="mir",n.Maestro="maestro",n.Rupay="rupay"})(Bt||(Bt={}));var Xt;(function(n){n.Afghanistan="af",n.Angola="ao",n.Albania="al",n.Andorra="ad",n.UnitedArabEmirates="ae",n.Argentina="ar",n.Armenia="am",n.AntiguaAndBarbuda="ag",n.Australia="au",n.Austria="at",n.Azerbaijan="az",n.Burundi="bi",n.Belgium="be",n.Benin="bj",n.BurkinaFaso="bf",n.Bangladesh="bd",n.Bulgaria="bg",n.Bahrain="bh",n.Bahamas="bs",n.BosniaAndHerzegovina="ba",n.Belarus="by",n.Belize="bz",n.Bolivia="bo",n.Brazil="br",n.Barbados="bb",n.BruneiDarussalam="bn",n.Bhutan="bt",n.Botswana="bw",n.CentralAfricanRepublic="cf",n.Canada="ca",n.Switzerland="ch",n.Chile="cl",n.China="cn",n.CoteDIvoire="ci",n.Cameroon="cm",n.DemocraticRepublicOfTheCongo="cd",n.RepublicOfTheCongo="cg",n.Colombia="co",n.Comoros="km",n.CapeVerde="cv",n.CostaRica="cr",n.Cuba="cu",n.Cyprus="cy",n.CzechRepublic="cz",n.Germany="de",n.Djibouti="dj",n.Dominica="dm",n.Denmark="dk",n.DominicanRepublic="do",n.Algeria="dz",n.Ecuador="ec",n.Egypt="eg",n.Eritrea="er",n.Spain="es",n.Estonia="ee",n.Ethiopia="et",n.Finland="fi",n.Fiji="fj",n.France="fr",n.MicronesiaFederatedStatesOf="fm",n.Gabon="ga",n.UnitedKingdom="gb",n.Georgia="ge",n.Ghana="gh",n.Guinea="gn",n.Gambia="gm",n.GuineaBissau="gw",n.EquatorialGuinea="gq",n.Greece="gr",n.Grenada="gd",n.Guatemala="gt",n.Guyana="gy",n.Honduras="hn",n.Croatia="hr",n.Haiti="ht",n.Hungary="hu",n.Indonesia="id",n.India="in",n.Ireland="ie",n.IranIslamicRepublicOf="ir",n.Iraq="iq",n.Iceland="is",n.Israel="il",n.Italy="it",n.Jamaica="jm",n.Jordan="jo",n.Japan="jp",n.Kazakhstan="kz",n.Kenya="ke",n.Kyrgyzstan="kg",n.Cambodia="kh",n.Kiribati="ki",n.SaintKittsAndNevis="kn",n.SouthKorea="kr",n.Kuwait="kw",n.LaoPeopleSDemocraticRepublic="la",n.Lebanon="lb",n.Liberia="lr",n.Libya="ly",n.SaintLucia="lc",n.Liechtenstein="li",n.SriLanka="lk",n.Lesotho="ls",n.Lithuania="lt",n.Luxembourg="lu",n.Latvia="lv",n.Morocco="ma",n.Monaco="mc",n.Moldova="md",n.Madagascar="mg",n.Maldives="mv",n.Mexico="mx",n.MarshallIslands="mh",n.NorthMacedonia="mk",n.Mali="ml",n.Malta="mt",n.Myanmar="mm",n.Montenegro="me",n.Mongolia="mn",n.Mozambique="mz",n.Mauritania="mr",n.Mauritius="mu",n.Malawi="mw",n.Malaysia="my",n.Namibia="na",n.Niger="ne",n.Nigeria="ng",n.Nicaragua="ni",n.Netherlands="nl",n.Norway="no",n.Nepal="np",n.Nauru="nr",n.NewZealand="nz",n.Oman="om",n.Pakistan="pk",n.Panama="pa",n.Peru="pe",n.Philippines="ph",n.Palau="pw",n.PapuaNewGuinea="pg",n.Poland="pl",n.FrenchPolynesia="pf",n.NorthKorea="kp",n.Portugal="pt",n.Paraguay="py",n.Qatar="qa",n.Romania="ro",n.Russia="ru",n.Rwanda="rw",n.SaudiArabia="sa",n.Sudan="sd",n.Senegal="sn",n.Singapore="sg",n.SolomonIslands="sb",n.SierraLeone="sl",n.ElSalvador="sv",n.SanMarino="sm",n.Somalia="so",n.Serbia="rs",n.SouthSudan="ss",n.SaoTomeAndPrincipe="st",n.Suriname="sr",n.Slovakia="sk",n.Slovenia="si",n.Sweden="se",n.Eswatini="sz",n.Seychelles="sc",n.Syria="sy",n.Chad="td",n.Togo="tg",n.Thailand="th",n.Tajikistan="tj",n.Turkmenistan="tm",n.TimorLeste="tl",n.Tonga="to",n.TrinidadAndTobago="tt",n.Tunisia="tn",n.Turkey="tr",n.Tuvalu="tv",n.Tanzania="tz",n.Uganda="ug",n.Ukraine="ua",n.Uruguay="uy",n.UnitedStates="us",n.Uzbekistan="uz",n.VaticanCity="va",n.SaintVincentAndTheGrenadines="vc",n.Venezuela="ve",n.Vietnam="vn",n.Vanuatu="vu",n.Samoa="ws",n.Yemen="ye",n.SouthAfrica="za",n.Zambia="zm",n.Zimbabwe="zw"})(Xt||(Xt={}));var Vt;(function(n){n.Light="light",n.Dark="dark"})(Vt||(Vt={}));var Wt;(function(n){n.AfricaAbidjan="africa/abidjan",n.AfricaAccra="africa/accra",n.AfricaAddisAbaba="africa/addis_ababa",n.AfricaAlgiers="africa/algiers",n.AfricaAsmara="africa/asmara",n.AfricaBamako="africa/bamako",n.AfricaBangui="africa/bangui",n.AfricaBanjul="africa/banjul",n.AfricaBissau="africa/bissau",n.AfricaBlantyre="africa/blantyre",n.AfricaBrazzaville="africa/brazzaville",n.AfricaBujumbura="africa/bujumbura",n.AfricaCairo="africa/cairo",n.AfricaCasablanca="africa/casablanca",n.AfricaCeuta="africa/ceuta",n.AfricaConakry="africa/conakry",n.AfricaDakar="africa/dakar",n.AfricaDarEsSalaam="africa/dar_es_salaam",n.AfricaDjibouti="africa/djibouti",n.AfricaDouala="africa/douala",n.AfricaElAaiun="africa/el_aaiun",n.AfricaFreetown="africa/freetown",n.AfricaGaborone="africa/gaborone",n.AfricaHarare="africa/harare",n.AfricaJohannesburg="africa/johannesburg",n.AfricaJuba="africa/juba",n.AfricaKampala="africa/kampala",n.AfricaKhartoum="africa/khartoum",n.AfricaKigali="africa/kigali",n.AfricaKinshasa="africa/kinshasa",n.AfricaLagos="africa/lagos",n.AfricaLibreville="africa/libreville",n.AfricaLome="africa/lome",n.AfricaLuanda="africa/luanda",n.AfricaLubumbashi="africa/lubumbashi",n.AfricaLusaka="africa/lusaka",n.AfricaMalabo="africa/malabo",n.AfricaMaputo="africa/maputo",n.AfricaMaseru="africa/maseru",n.AfricaMbabane="africa/mbabane",n.AfricaMogadishu="africa/mogadishu",n.AfricaMonrovia="africa/monrovia",n.AfricaNairobi="africa/nairobi",n.AfricaNdjamena="africa/ndjamena",n.AfricaNiamey="africa/niamey",n.AfricaNouakchott="africa/nouakchott",n.AfricaOuagadougou="africa/ouagadougou",n.AfricaPortonovo="africa/porto-novo",n.AfricaSaoTome="africa/sao_tome",n.AfricaTripoli="africa/tripoli",n.AfricaTunis="africa/tunis",n.AfricaWindhoek="africa/windhoek",n.AmericaAdak="america/adak",n.AmericaAnchorage="america/anchorage",n.AmericaAnguilla="america/anguilla",n.AmericaAntigua="america/antigua",n.AmericaAraguaina="america/araguaina",n.AmericaArgentinaBuenosAires="america/argentina/buenos_aires",n.AmericaArgentinaCatamarca="america/argentina/catamarca",n.AmericaArgentinaCordoba="america/argentina/cordoba",n.AmericaArgentinaJujuy="america/argentina/jujuy",n.AmericaArgentinaLaRioja="america/argentina/la_rioja",n.AmericaArgentinaMendoza="america/argentina/mendoza",n.AmericaArgentinaRioGallegos="america/argentina/rio_gallegos",n.AmericaArgentinaSalta="america/argentina/salta",n.AmericaArgentinaSanJuan="america/argentina/san_juan",n.AmericaArgentinaSanLuis="america/argentina/san_luis",n.AmericaArgentinaTucuman="america/argentina/tucuman",n.AmericaArgentinaUshuaia="america/argentina/ushuaia",n.AmericaAruba="america/aruba",n.AmericaAsuncion="america/asuncion",n.AmericaAtikokan="america/atikokan",n.AmericaBahia="america/bahia",n.AmericaBahiaBanderas="america/bahia_banderas",n.AmericaBarbados="america/barbados",n.AmericaBelem="america/belem",n.AmericaBelize="america/belize",n.AmericaBlancsablon="america/blanc-sablon",n.AmericaBoaVista="america/boa_vista",n.AmericaBogota="america/bogota",n.AmericaBoise="america/boise",n.AmericaCambridgeBay="america/cambridge_bay",n.AmericaCampoGrande="america/campo_grande",n.AmericaCancun="america/cancun",n.AmericaCaracas="america/caracas",n.AmericaCayenne="america/cayenne",n.AmericaCayman="america/cayman",n.AmericaChicago="america/chicago",n.AmericaChihuahua="america/chihuahua",n.AmericaCiudadJuarez="america/ciudad_juarez",n.AmericaCostaRica="america/costa_rica",n.AmericaCoyhaique="america/coyhaique",n.AmericaCreston="america/creston",n.AmericaCuiaba="america/cuiaba",n.AmericaCuracao="america/curacao",n.AmericaDanmarkshavn="america/danmarkshavn",n.AmericaDawson="america/dawson",n.AmericaDawsonCreek="america/dawson_creek",n.AmericaDenver="america/denver",n.AmericaDetroit="america/detroit",n.AmericaDominica="america/dominica",n.AmericaEdmonton="america/edmonton",n.AmericaEirunepe="america/eirunepe",n.AmericaElSalvador="america/el_salvador",n.AmericaFortNelson="america/fort_nelson",n.AmericaFortaleza="america/fortaleza",n.AmericaGlaceBay="america/glace_bay",n.AmericaGooseBay="america/goose_bay",n.AmericaGrandTurk="america/grand_turk",n.AmericaGrenada="america/grenada",n.AmericaGuadeloupe="america/guadeloupe",n.AmericaGuatemala="america/guatemala",n.AmericaGuayaquil="america/guayaquil",n.AmericaGuyana="america/guyana",n.AmericaHalifax="america/halifax",n.AmericaHavana="america/havana",n.AmericaHermosillo="america/hermosillo",n.AmericaIndianaIndianapolis="america/indiana/indianapolis",n.AmericaIndianaKnox="america/indiana/knox",n.AmericaIndianaMarengo="america/indiana/marengo",n.AmericaIndianaPetersburg="america/indiana/petersburg",n.AmericaIndianaTellCity="america/indiana/tell_city",n.AmericaIndianaVevay="america/indiana/vevay",n.AmericaIndianaVincennes="america/indiana/vincennes",n.AmericaIndianaWinamac="america/indiana/winamac",n.AmericaInuvik="america/inuvik",n.AmericaIqaluit="america/iqaluit",n.AmericaJamaica="america/jamaica",n.AmericaJuneau="america/juneau",n.AmericaKentuckyLouisville="america/kentucky/louisville",n.AmericaKentuckyMonticello="america/kentucky/monticello",n.AmericaKralendijk="america/kralendijk",n.AmericaLaPaz="america/la_paz",n.AmericaLima="america/lima",n.AmericaLosAngeles="america/los_angeles",n.AmericaLowerPrinces="america/lower_princes",n.AmericaMaceio="america/maceio",n.AmericaManagua="america/managua",n.AmericaManaus="america/manaus",n.AmericaMarigot="america/marigot",n.AmericaMartinique="america/martinique",n.AmericaMatamoros="america/matamoros",n.AmericaMazatlan="america/mazatlan",n.AmericaMenominee="america/menominee",n.AmericaMerida="america/merida",n.AmericaMetlakatla="america/metlakatla",n.AmericaMexicoCity="america/mexico_city",n.AmericaMiquelon="america/miquelon",n.AmericaMoncton="america/moncton",n.AmericaMonterrey="america/monterrey",n.AmericaMontevideo="america/montevideo",n.AmericaMontserrat="america/montserrat",n.AmericaNassau="america/nassau",n.AmericaNewYork="america/new_york",n.AmericaNome="america/nome",n.AmericaNoronha="america/noronha",n.AmericaNorthDakotaBeulah="america/north_dakota/beulah",n.AmericaNorthDakotaCenter="america/north_dakota/center",n.AmericaNorthDakotaNewSalem="america/north_dakota/new_salem",n.AmericaNuuk="america/nuuk",n.AmericaOjinaga="america/ojinaga",n.AmericaPanama="america/panama",n.AmericaParamaribo="america/paramaribo",n.AmericaPhoenix="america/phoenix",n.AmericaPortauprince="america/port-au-prince",n.AmericaPortOfSpain="america/port_of_spain",n.AmericaPortoVelho="america/porto_velho",n.AmericaPuertoRico="america/puerto_rico",n.AmericaPuntaArenas="america/punta_arenas",n.AmericaRankinInlet="america/rankin_inlet",n.AmericaRecife="america/recife",n.AmericaRegina="america/regina",n.AmericaResolute="america/resolute",n.AmericaRioBranco="america/rio_branco",n.AmericaSantarem="america/santarem",n.AmericaSantiago="america/santiago",n.AmericaSantoDomingo="america/santo_domingo",n.AmericaSaoPaulo="america/sao_paulo",n.AmericaScoresbysund="america/scoresbysund",n.AmericaSitka="america/sitka",n.AmericaStBarthelemy="america/st_barthelemy",n.AmericaStJohns="america/st_johns",n.AmericaStKitts="america/st_kitts",n.AmericaStLucia="america/st_lucia",n.AmericaStThomas="america/st_thomas",n.AmericaStVincent="america/st_vincent",n.AmericaSwiftCurrent="america/swift_current",n.AmericaTegucigalpa="america/tegucigalpa",n.AmericaThule="america/thule",n.AmericaTijuana="america/tijuana",n.AmericaToronto="america/toronto",n.AmericaTortola="america/tortola",n.AmericaVancouver="america/vancouver",n.AmericaWhitehorse="america/whitehorse",n.AmericaWinnipeg="america/winnipeg",n.AmericaYakutat="america/yakutat",n.AntarcticaCasey="antarctica/casey",n.AntarcticaDavis="antarctica/davis",n.AntarcticaDumontdurville="antarctica/dumontdurville",n.AntarcticaMacquarie="antarctica/macquarie",n.AntarcticaMawson="antarctica/mawson",n.AntarcticaMcmurdo="antarctica/mcmurdo",n.AntarcticaPalmer="antarctica/palmer",n.AntarcticaRothera="antarctica/rothera",n.AntarcticaSyowa="antarctica/syowa",n.AntarcticaTroll="antarctica/troll",n.AntarcticaVostok="antarctica/vostok",n.ArcticLongyearbyen="arctic/longyearbyen",n.AsiaAden="asia/aden",n.AsiaAlmaty="asia/almaty",n.AsiaAmman="asia/amman",n.AsiaAnadyr="asia/anadyr",n.AsiaAqtau="asia/aqtau",n.AsiaAqtobe="asia/aqtobe",n.AsiaAshgabat="asia/ashgabat",n.AsiaAtyrau="asia/atyrau",n.AsiaBaghdad="asia/baghdad",n.AsiaBahrain="asia/bahrain",n.AsiaBaku="asia/baku",n.AsiaBangkok="asia/bangkok",n.AsiaBarnaul="asia/barnaul",n.AsiaBeirut="asia/beirut",n.AsiaBishkek="asia/bishkek",n.AsiaBrunei="asia/brunei",n.AsiaChita="asia/chita",n.AsiaColombo="asia/colombo",n.AsiaDamascus="asia/damascus",n.AsiaDhaka="asia/dhaka",n.AsiaDili="asia/dili",n.AsiaDubai="asia/dubai",n.AsiaDushanbe="asia/dushanbe",n.AsiaFamagusta="asia/famagusta",n.AsiaGaza="asia/gaza",n.AsiaHebron="asia/hebron",n.AsiaHoChiMinh="asia/ho_chi_minh",n.AsiaHongKong="asia/hong_kong",n.AsiaHovd="asia/hovd",n.AsiaIrkutsk="asia/irkutsk",n.AsiaJakarta="asia/jakarta",n.AsiaJayapura="asia/jayapura",n.AsiaJerusalem="asia/jerusalem",n.AsiaKabul="asia/kabul",n.AsiaKamchatka="asia/kamchatka",n.AsiaKarachi="asia/karachi",n.AsiaKathmandu="asia/kathmandu",n.AsiaKhandyga="asia/khandyga",n.AsiaKolkata="asia/kolkata",n.AsiaKrasnoyarsk="asia/krasnoyarsk",n.AsiaKualaLumpur="asia/kuala_lumpur",n.AsiaKuching="asia/kuching",n.AsiaKuwait="asia/kuwait",n.AsiaMacau="asia/macau",n.AsiaMagadan="asia/magadan",n.AsiaMakassar="asia/makassar",n.AsiaManila="asia/manila",n.AsiaMuscat="asia/muscat",n.AsiaNicosia="asia/nicosia",n.AsiaNovokuznetsk="asia/novokuznetsk",n.AsiaNovosibirsk="asia/novosibirsk",n.AsiaOmsk="asia/omsk",n.AsiaOral="asia/oral",n.AsiaPhnomPenh="asia/phnom_penh",n.AsiaPontianak="asia/pontianak",n.AsiaPyongyang="asia/pyongyang",n.AsiaQatar="asia/qatar",n.AsiaQostanay="asia/qostanay",n.AsiaQyzylorda="asia/qyzylorda",n.AsiaRiyadh="asia/riyadh",n.AsiaSakhalin="asia/sakhalin",n.AsiaSamarkand="asia/samarkand",n.AsiaSeoul="asia/seoul",n.AsiaShanghai="asia/shanghai",n.AsiaSingapore="asia/singapore",n.AsiaSrednekolymsk="asia/srednekolymsk",n.AsiaTaipei="asia/taipei",n.AsiaTashkent="asia/tashkent",n.AsiaTbilisi="asia/tbilisi",n.AsiaTehran="asia/tehran",n.AsiaThimphu="asia/thimphu",n.AsiaTokyo="asia/tokyo",n.AsiaTomsk="asia/tomsk",n.AsiaUlaanbaatar="asia/ulaanbaatar",n.AsiaUrumqi="asia/urumqi",n.AsiaUstnera="asia/ust-nera",n.AsiaVientiane="asia/vientiane",n.AsiaVladivostok="asia/vladivostok",n.AsiaYakutsk="asia/yakutsk",n.AsiaYangon="asia/yangon",n.AsiaYekaterinburg="asia/yekaterinburg",n.AsiaYerevan="asia/yerevan",n.AtlanticAzores="atlantic/azores",n.AtlanticBermuda="atlantic/bermuda",n.AtlanticCanary="atlantic/canary",n.AtlanticCapeVerde="atlantic/cape_verde",n.AtlanticFaroe="atlantic/faroe",n.AtlanticMadeira="atlantic/madeira",n.AtlanticReykjavik="atlantic/reykjavik",n.AtlanticSouthGeorgia="atlantic/south_georgia",n.AtlanticStHelena="atlantic/st_helena",n.AtlanticStanley="atlantic/stanley",n.AustraliaAdelaide="australia/adelaide",n.AustraliaBrisbane="australia/brisbane",n.AustraliaBrokenHill="australia/broken_hill",n.AustraliaDarwin="australia/darwin",n.AustraliaEucla="australia/eucla",n.AustraliaHobart="australia/hobart",n.AustraliaLindeman="australia/lindeman",n.AustraliaLordHowe="australia/lord_howe",n.AustraliaMelbourne="australia/melbourne",n.AustraliaPerth="australia/perth",n.AustraliaSydney="australia/sydney",n.EuropeAmsterdam="europe/amsterdam",n.EuropeAndorra="europe/andorra",n.EuropeAstrakhan="europe/astrakhan",n.EuropeAthens="europe/athens",n.EuropeBelgrade="europe/belgrade",n.EuropeBerlin="europe/berlin",n.EuropeBratislava="europe/bratislava",n.EuropeBrussels="europe/brussels",n.EuropeBucharest="europe/bucharest",n.EuropeBudapest="europe/budapest",n.EuropeBusingen="europe/busingen",n.EuropeChisinau="europe/chisinau",n.EuropeCopenhagen="europe/copenhagen",n.EuropeDublin="europe/dublin",n.EuropeGibraltar="europe/gibraltar",n.EuropeGuernsey="europe/guernsey",n.EuropeHelsinki="europe/helsinki",n.EuropeIsleOfMan="europe/isle_of_man",n.EuropeIstanbul="europe/istanbul",n.EuropeJersey="europe/jersey",n.EuropeKaliningrad="europe/kaliningrad",n.EuropeKirov="europe/kirov",n.EuropeKyiv="europe/kyiv",n.EuropeLisbon="europe/lisbon",n.EuropeLjubljana="europe/ljubljana",n.EuropeLondon="europe/london",n.EuropeLuxembourg="europe/luxembourg",n.EuropeMadrid="europe/madrid",n.EuropeMalta="europe/malta",n.EuropeMariehamn="europe/mariehamn",n.EuropeMinsk="europe/minsk",n.EuropeMonaco="europe/monaco",n.EuropeMoscow="europe/moscow",n.EuropeOslo="europe/oslo",n.EuropeParis="europe/paris",n.EuropePodgorica="europe/podgorica",n.EuropePrague="europe/prague",n.EuropeRiga="europe/riga",n.EuropeRome="europe/rome",n.EuropeSamara="europe/samara",n.EuropeSanMarino="europe/san_marino",n.EuropeSarajevo="europe/sarajevo",n.EuropeSaratov="europe/saratov",n.EuropeSimferopol="europe/simferopol",n.EuropeSkopje="europe/skopje",n.EuropeSofia="europe/sofia",n.EuropeStockholm="europe/stockholm",n.EuropeTallinn="europe/tallinn",n.EuropeTirane="europe/tirane",n.EuropeUlyanovsk="europe/ulyanovsk",n.EuropeVaduz="europe/vaduz",n.EuropeVatican="europe/vatican",n.EuropeVienna="europe/vienna",n.EuropeVilnius="europe/vilnius",n.EuropeVolgograd="europe/volgograd",n.EuropeWarsaw="europe/warsaw",n.EuropeZagreb="europe/zagreb",n.EuropeZurich="europe/zurich",n.IndianAntananarivo="indian/antananarivo",n.IndianChagos="indian/chagos",n.IndianChristmas="indian/christmas",n.IndianCocos="indian/cocos",n.IndianComoro="indian/comoro",n.IndianKerguelen="indian/kerguelen",n.IndianMahe="indian/mahe",n.IndianMaldives="indian/maldives",n.IndianMauritius="indian/mauritius",n.IndianMayotte="indian/mayotte",n.IndianReunion="indian/reunion",n.PacificApia="pacific/apia",n.PacificAuckland="pacific/auckland",n.PacificBougainville="pacific/bougainville",n.PacificChatham="pacific/chatham",n.PacificChuuk="pacific/chuuk",n.PacificEaster="pacific/easter",n.PacificEfate="pacific/efate",n.PacificFakaofo="pacific/fakaofo",n.PacificFiji="pacific/fiji",n.PacificFunafuti="pacific/funafuti",n.PacificGalapagos="pacific/galapagos",n.PacificGambier="pacific/gambier",n.PacificGuadalcanal="pacific/guadalcanal",n.PacificGuam="pacific/guam",n.PacificHonolulu="pacific/honolulu",n.PacificKanton="pacific/kanton",n.PacificKiritimati="pacific/kiritimati",n.PacificKosrae="pacific/kosrae",n.PacificKwajalein="pacific/kwajalein",n.PacificMajuro="pacific/majuro",n.PacificMarquesas="pacific/marquesas",n.PacificMidway="pacific/midway",n.PacificNauru="pacific/nauru",n.PacificNiue="pacific/niue",n.PacificNorfolk="pacific/norfolk",n.PacificNoumea="pacific/noumea",n.PacificPagoPago="pacific/pago_pago",n.PacificPalau="pacific/palau",n.PacificPitcairn="pacific/pitcairn",n.PacificPohnpei="pacific/pohnpei",n.PacificPortMoresby="pacific/port_moresby",n.PacificRarotonga="pacific/rarotonga",n.PacificSaipan="pacific/saipan",n.PacificTahiti="pacific/tahiti",n.PacificTarawa="pacific/tarawa",n.PacificTongatapu="pacific/tongatapu",n.PacificWake="pacific/wake",n.PacificWallis="pacific/wallis",n.Utc="utc"})(Wt||(Wt={}));var Gt;(function(n){n.Geolocation="geolocation",n.Camera="camera",n.Microphone="microphone",n.Notifications="notifications",n.Midi="midi",n.Push="push",n.Clipboardread="clipboard-read",n.Clipboardwrite="clipboard-write",n.Paymenthandler="payment-handler",n.Usb="usb",n.Bluetooth="bluetooth",n.Accelerometer="accelerometer",n.Gyroscope="gyroscope",n.Magnetometer="magnetometer",n.Ambientlightsensor="ambient-light-sensor",n.Backgroundsync="background-sync",n.Persistentstorage="persistent-storage",n.Screenwakelock="screen-wake-lock",n.Webshare="web-share",n.Xrspatialtracking="xr-spatial-tracking"})(Gt||(Gt={}));var Kt;(function(n){n.Jpg="jpg",n.Jpeg="jpeg",n.Png="png",n.Webp="webp",n.Heic="heic",n.Avif="avif",n.Gif="gif"})(Kt||(Kt={}));var Jt;(function(n){n.GET="GET",n.POST="POST",n.PUT="PUT",n.PATCH="PATCH",n.DELETE="DELETE",n.OPTIONS="OPTIONS",n.HEAD="HEAD"})(Jt||(Jt={}));var Yt;(function(n){n.Auto="auto",n.Center="center",n.Topleft="top-left",n.Top="top",n.Topright="top-right",n.Left="left",n.Right="right",n.Bottomleft="bottom-left",n.Bottom="bottom",n.Bottomright="bottom-right"})(Yt||(Yt={}));var Zt;(function(n){n.Functions="functions",n.Sites="sites"})(Zt||(Zt={}));var Qt;(function(n){n.Http="http",n.Schedule="schedule",n.Event="event"})(Qt||(Qt={}));var Tt;(function(n){n.Waiting="waiting",n.Processing="processing",n.Completed="completed",n.Failed="failed",n.Scheduled="scheduled"})(Tt||(Tt={}));const no=Object.freeze(Object.defineProperty({__proto__:null,Account:Ei,AppwriteException:p,get AuthenticationFactor(){return Nt},get AuthenticatorType(){return Lt},Avatars:xi,get Browser(){return Dt},get BrowserPermission(){return Gt},get BrowserTheme(){return Vt},Channel:ve,Client:$e,get Condition(){return _t},get CreditCard(){return Bt},Databases:Wn,DocumentsDB:Gn,get ExecutionMethod(){return Jt},get ExecutionResourceType(){return Zt},get ExecutionStatus(){return Tt},get ExecutionTrigger(){return Qt},get Flag(){return Xt},Functions:Kn,Graphql:Jn,ID:He,get ImageFormat(){return Kt},get ImageGravity(){return Yt},Locale:Yn,Messaging:Zn,get OAuthProvider(){return Ht},Operator:Z,Organization:Qn,Permission:Qe,Presences:Tn,Query:U,Realtime:to,Role:io,Storage:zn,TablesDB:On,Teams:Fn,get Timezone(){return Wt},VectorsDB:eo},Symbol.toStringTag,{value:"Module"})),qi={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.",preview:"Preview"};function oo(n,e={}){return n.replace(/\{(\w+)\}/g,(i,t)=>t in e?String(e[t]):`{${t}}`)}const ao={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 Te(n){return ao[n]??n.charAt(0).toUpperCase()+n.slice(1)}const bt=(n,e,i=401)=>Object.assign(new Error(e),{type:n,code:i}),Pe=()=>new Date().toISOString(),Ee=n=>new Date(Date.now()-n*6e4).toISOString(),It=["amber","brave","calm","delta","ember","fable","glide","harbor","ivory","juniper","kite","lumen"],_i=()=>`${It[Math.floor(Math.random()*It.length)]}-${It[Math.floor(Math.random()*It.length)]}`,ze=()=>Math.random().toString(36).slice(2,12),Li=()=>Array.from({length:2},()=>Math.random().toString(36).slice(2,7)).join("-"),so={name:"Ada Lovelace",email:"ada@example.com",phone:"+15550100"};class Ni{constructor(e=so){this.seed=e,this.user=null,this.mfaPending=!1,this.mfaEnabled=!1,this.totpEnrolled=!1,this.recoveryCodes=[],this.lastChallenge=0,this.sessions=[],this.identities=[],this.logs=[],this.tokens=new Map,this.pendingAuthenticator=null}makeUser(e={}){const i=e.anonymous??!1;return this.user={$id:"preview-user",$createdAt:Ee(43200),$updatedAt:Pe(),name:i?"":e.name??this.seed.name,registration:Ee(43200),status:!0,labels:[],passwordUpdate:i?"":Ee(10080),email:i?"":e.email??this.seed.email,phone:i?"":e.phone??this.seed.phone,emailVerification:!i,phoneVerification:!1,mfa:this.mfaEnabled,prefs:{},targets:[],accessedAt:Pe()},this.seedActivity(i?"anonymous":"email"),this.user}seedActivity(e){if(this.sessions.length>0)return;const i={$createdAt:Pe(),$updatedAt:Pe(),userId:"preview-user",expire:new Date(Date.now()+365*864e5).toISOString(),providerUid:"",providerAccessToken:"",providerAccessTokenExpiry:"",providerRefreshToken:"",clientType:"browser",clientCode:"CH",clientEngine:"Blink",clientEngineVersion:"128",deviceName:"desktop",deviceBrand:"",deviceModel:"",factors:["password"],secret:"",mfaUpdatedAt:""};this.sessions=[{...i,$id:"current",provider:e,ip:"203.0.113.24",osCode:"MAC",osName:"macOS",osVersion:"15",clientName:"Chrome",clientVersion:"128",countryCode:"de",countryName:"Germany",current:!0},{...i,$id:ze(),$createdAt:Ee(300),provider:e,ip:"198.51.100.7",osCode:"IOS",osName:"iOS",osVersion:"18",clientName:"Safari",clientVersion:"18",clientType:"browser",deviceName:"smartphone",countryCode:"de",countryName:"Germany",current:!1},{...i,$id:ze(),$createdAt:Ee(4320),provider:"oauth2",ip:"192.0.2.90",osCode:"WIN",osName:"Windows",osVersion:"11",clientName:"Firefox",clientVersion:"130",countryCode:"us",countryName:"United States",current:!1}],this.identities=[{$id:"identity-github",$createdAt:Ee(28800),$updatedAt:Ee(28800),userId:"preview-user",provider:"github",providerUid:"8675309",providerEmail:this.seed.email,providerAccessToken:"",providerAccessTokenExpiry:"",providerRefreshToken:""}],this.logs=[{event:"session.create",time:Pe(),clientName:"Chrome",osName:"macOS",countryName:"Germany",ip:"203.0.113.24"},{event:"user.update.name",time:Ee(2880),clientName:"Safari",osName:"iOS",countryName:"Germany",ip:"198.51.100.7"},{event:"session.create",time:Ee(4320),clientName:"Firefox",osName:"Windows",countryName:"United States",ip:"192.0.2.90"}]}requireUser(){if(!this.user)throw bt("general_unauthorized_scope","User (role: guests) missing scope (account)");if(this.mfaPending)throw bt("user_more_factors_required","More factors are required to complete the sign in process.");return this.user}requireRecentChallenge(){if(Date.now()-this.lastChallenge>18e5)throw bt("user_challenge_required","A recently successful challenge is required to complete this action.")}afterPrimarySignIn(){const e=this.totpEnrolled||this.user?.emailVerification;this.mfaPending=!!(this.user?.mfa&&e)}async delay(e,i=150){return await new Promise(t=>setTimeout(t,i)),typeof e=="function"?e():e}signInDirectly(){this.user||this.makeUser(),this.mfaPending=!1}async get(){return this.delay(()=>this.requireUser(),120)}async create(e,i,t,o){return this.delay(()=>this.makeUser({email:i,name:o||i.split("@")[0]}))}async createEmailPasswordSession(e){return this.delay(()=>((!this.user||this.user.email!==e)&&this.makeUser({email:e,name:this.user?.name||this.seed.name}),this.afterPrimarySignIn(),this.sessions[0]))}async createAnonymousSession(){return this.delay(()=>(this.makeUser({anonymous:!0}),this.mfaPending=!1,this.sessions[0]))}async createOAuth2Token(e){return this.delay(()=>{this.makeUser({email:`ada@${e}.example`,name:this.seed.name}),this.afterPrimarySignIn()},800)}async createMagicURLToken(e,i){return this.tokens.set(e,{email:i}),this.delay({$id:ze(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:_i()})}async createEmailToken(e,i){return this.tokens.set(e,{email:i}),this.delay({$id:ze(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:_i()})}async createPhoneToken(e,i){return this.tokens.set(e,{phone:i}),this.delay({$id:ze(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:""})}async createSession(e){return this.delay(()=>{const i=this.tokens.get(e)??{};return this.makeUser({email:i.email??this.seed.email,phone:i.phone??this.seed.phone}),i.phone&&(this.user.phoneVerification=!0),this.afterPrimarySignIn(),this.sessions[0]})}async createRecovery(){return this.delay({})}async updateRecovery(){return this.delay({})}async createEmailVerification(){return this.delay({})}async updateEmailVerification(){return this.delay(()=>(this.user&&(this.user.emailVerification=!0),{}))}async createPhoneVerification(){return this.delay({})}async updatePhoneVerification(){return this.delay(()=>(this.user&&(this.user.phoneVerification=!0),{}))}async getPrefs(){return this.delay(()=>({...this.requireUser().prefs}))}async updatePrefs(e){return this.delay(()=>{const i=this.requireUser();return i.prefs={...e},i})}async updateName(e){return this.delay(()=>(this.requireUser().name=e,this.user))}async updateEmail(e){return this.delay(()=>{const i=this.requireUser();return i.email=e,i.emailVerification=!1,i.passwordUpdate=Pe(),i})}async updatePhone(e){return this.delay(()=>{const i=this.requireUser();return i.phone=e,i.phoneVerification=!1,i})}async updatePassword(){return this.delay(()=>{const e=this.requireUser();return e.passwordUpdate=Pe(),e})}async updateStatus(){return this.delay(()=>(this.requireUser(),this.reset(),this.mfaEnabled=!1,this.totpEnrolled=!1,this.recoveryCodes=[],{}))}async listSessions(){return this.delay(()=>(this.requireUser(),{total:this.sessions.length,sessions:this.sessions}))}async deleteSession(e="current"){return this.delay(()=>(e==="current"?this.reset():this.sessions=this.sessions.filter(i=>i.$id!==e),{}))}async deleteSessions(){return this.delay(()=>(this.reset(),{}))}async listIdentities(){return this.delay(()=>(this.requireUser(),{total:this.identities.length,identities:this.identities}))}async deleteIdentity(e){return this.delay(()=>(this.identities=this.identities.filter(i=>i.$id!==e),{}))}async listLogs(){return this.delay(()=>(this.requireUser(),{total:this.logs.length,logs:this.logs}))}async listMFAFactors(){return this.delay({totp:this.totpEnrolled,email:!!this.user?.emailVerification,phone:!!this.user?.phoneVerification,recoveryCode:this.recoveryCodes.length>0,custom:!1})}async createMFAChallenge(){return this.delay({$id:ze(),$createdAt:Pe(),userId:"preview-user",expire:""})}async updateMFAChallenge(){return this.delay(()=>(this.mfaPending=!1,this.lastChallenge=Date.now(),this.sessions[0]))}async updateMFA(e){return this.delay(()=>{const i=this.requireUser();return this.mfaEnabled=e,i.mfa=e,i})}async createMFAAuthenticator(){return this.delay(()=>{const e="JBSWY3DPEHPK3PXP";return this.pendingAuthenticator={secret:e,uri:`otpauth://totp/Preview:${encodeURIComponent(this.user?.email??"user")}?secret=${e}&issuer=Preview`},this.pendingAuthenticator})}async updateMFAAuthenticator(){return this.delay(()=>(this.totpEnrolled=!0,this.pendingAuthenticator=null,this.lastChallenge=Date.now(),this.requireUser()))}async deleteMFAAuthenticator(){return this.delay(()=>(this.requireRecentChallenge(),this.totpEnrolled=!1,{}))}async createMFARecoveryCodes(){return this.delay(()=>{if(this.recoveryCodes.length>0)throw bt("user_recovery_codes_already_exists","Recovery codes already generated.",409);return this.recoveryCodes=Array.from({length:6},Li),{recoveryCodes:this.recoveryCodes}})}async getMFARecoveryCodes(){return this.delay(()=>(this.requireRecentChallenge(),{recoveryCodes:this.recoveryCodes}))}async updateMFARecoveryCodes(){return this.delay(()=>(this.requireRecentChallenge(),this.recoveryCodes=Array.from({length:6},Li),{recoveryCodes:this.recoveryCodes}))}reset(){this.user=null,this.mfaPending=!1,this.sessions=[],this.identities=[],this.logs=[],this.tokens.clear()}}function ro(n){let e=2166136261;const i=()=>(e^=e<<13,e^=e>>>17,e^=e<<5,(e>>>0)/4294967296);for(const r of n)e=(e^r.charCodeAt(0))*16777619;const t=25;let o="";const a=(r,d)=>`<rect x="${r}" y="${d}" width="7" height="7"/><rect x="${r+1}" y="${d+1}" width="5" height="5" fill="#fff"/><rect x="${r+2}" y="${d+2}" width="3" height="3"/>`;for(let r=0;r<t;r++)for(let d=0;d<t;d++)!(d<8&&r<8||d>=t-8&&r<8||d<8&&r>=t-8)&&i()<.45&&(o+=`<rect x="${d}" y="${r}" width="1" height="1"/>`);const s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${t}" shape-rendering="crispEdges"><rect width="${t}" height="${t}" fill="#fff"/><g fill="#000">${a(0,0)}${a(t-7,0)}${a(0,t-7)}${o}</g></svg>`;return`data:image/svg+xml;utf8,${encodeURIComponent(s)}`}const ce={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 st(n){if(n&&typeof n=="object"){const e=n;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(n),type:"",code:0}}function vt(n,e){return st(n).type===e}function zt(n,e,i="link"){const t=st(n);switch(t.type){case ce.invalidCredentials:return e.errorInvalidCredentials;case ce.userAlreadyExists:case ce.emailAlreadyExists:case ce.phoneAlreadyExists:return e.errorUserExists;case ce.userBlocked:return e.errorUserBlocked;case ce.rateLimit:return e.errorRateLimit;case ce.invalidToken:return i==="code"?e.errorInvalidCode:e.errorInvalidToken;case ce.invalidCode:return e.errorInvalidCode;case ce.passwordMismatch:return e.errorPasswordMismatch;case ce.passwordRecentlyUsed:return e.errorPasswordRecentlyUsed;case ce.passwordPersonalData:return e.errorPasswordPersonalData;case ce.passwordWeak:return e.errorPasswordWeak;case ce.passwordPwned:return e.errorPasswordPwned;case ce.challengeRequired:return e.errorChallengeRequired;case ce.sessionAlreadyExists:return e.errorSessionExists;case ce.oauthUnauthorized:case ce.oauthBadRequest:return e.errorOAuth;case ce.authMethodUnsupported:return e.errorMethodDisabled}return t.code===0&&/fetch|network/i.test(t.message)?e.errorNetwork:t.message||e.errorGeneric}function Ae(n,e,i){for(const t of e){const o=n[t];if(typeof o=="function")return o.apply(n,i)}return Promise.reject(new Error(`Appwrite SDK is missing ${e[0]}(). Update the appwrite package.`))}const Ot="authui",Hi=["userId","secret","expire","project","error",Ot],Di=()=>({status:"loading",user:null,mfaFactors:null,pending:null,configured:!1});class Bi{constructor(){this.client=null,this.account=null,this.config=null,this.state=Di(),this.listeners=new Map,this.refreshPromise=null,this.preview=null}configure(e){this.config=e,this.client=new $e().setEndpoint(e.endpoint).setProject(e.project),this.preview=e.preview?new Ni:null,this.account=this.preview?this.preview:new Ei(this.client),this.setState({configured:!0,status:"loading"}),this.preview?this.refresh():typeof window<"u"&&this.handleRedirect().then(()=>this.refresh())}get isConfigured(){return this.config!==null}get isPreview(){return this.preview!==null}async previewSignIn(){this.preview&&(this.preview.signInDirectly(),await this.refresh())}getConfig(){return this.config}getClient(){return this.client}getAccount(){return this.account}getStrings(){return{...qi,...this.config?.strings??{}}}getState(){return{...this.state}}get user(){return this.state.user}on(e,i){let t=this.listeners.get(e);return t||(t=new Set,this.listeners.set(e,t)),t.add(i),()=>t.delete(i)}emit(e,i){this.listeners.get(e)?.forEach(t=>{try{t(i)}catch(o){console.error("[authui] listener failed",o)}}),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=st(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(vt(i,ce.moreFactorsRequired)){let t=null;try{t=await Ae(this.account,["listMFAFactors","listMfaFactors"],[])}catch{}this.setState({status:"mfa-required",user:null,mfaFactors:t})}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(t){this.fail(t)}await this.afterSignIn()}async signUp(e,i,t){try{await this.acct().create(He.unique(),e.trim(),i,t?.trim()||void 0),await this.acct().createEmailPasswordSession(e.trim(),i)}catch(o){this.fail(o)}await this.afterSignIn()}async signInAnonymously(){try{await this.acct().createAnonymousSession()}catch(e){this.fail(e)}await this.afterSignIn()}async signInWithOAuth(e){const i=this.config?.oauthScopes?.[e];let t;try{t=this.acct().createOAuth2Token(e,this.redirectUrl("oauth"),this.redirectUrl("oauth-failed"),i)}catch(o){this.fail(o)}if(t&&typeof t.then=="function"){try{await t}catch(o){this.fail(o)}await this.afterSignIn()}}async sendMagicUrl(e){try{return await this.acct().createMagicURLToken(He.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(He.unique(),e.trim(),this.config?.securityPhrase??!0)}catch(i){return this.fail(i)}}async sendPhoneOtp(e){try{return await this.acct().createPhoneToken(He.unique(),e.replace(/[\s()-]/g,""))}catch(i){return this.fail(i)}}async signInWithToken(e,i){try{await this.acct().createSession(e,i.trim())}catch(t){this.fail(t)}await this.afterSignIn()}async createMfaChallenge(e){try{return await Ae(this.acct(),["createMFAChallenge","createMfaChallenge"],[e])}catch(i){return this.fail(i)}}async completeMfaChallenge(e,i,t={}){try{await Ae(this.acct(),["updateMFAChallenge","updateMfaChallenge"],[e,i.trim()])}catch(o){this.fail(o)}(t.signIn??!0)&&await this.afterSignIn()}async listMfaFactors(){try{return await Ae(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 Ae(this.acct(),["createMFAAuthenticator","createMfaAuthenticator"],["totp"])}catch(e){return this.fail(e)}}async verifyAuthenticator(e){try{await Ae(this.acct(),["updateMFAAuthenticator","updateMfaAuthenticator"],["totp",e.trim()])}catch(i){this.fail(i)}await this.refresh()}async removeAuthenticator(){try{await Ae(this.acct(),["deleteMFAAuthenticator","deleteMfaAuthenticator"],["totp"])}catch(e){this.fail(e)}await this.refresh()}async createRecoveryCodes(){try{return(await Ae(this.acct(),["createMFARecoveryCodes","createMfaRecoveryCodes"],[])).recoveryCodes}catch(e){return this.fail(e)}}async regenerateRecoveryCodes(){try{return(await Ae(this.acct(),["updateMFARecoveryCodes","updateMfaRecoveryCodes"],[])).recoveryCodes}catch(e){return this.fail(e)}}async getRecoveryCodes(){try{return(await Ae(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,t){try{await this.acct().updateRecovery(e,i,t)}catch(o){this.fail(o)}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(t){this.fail(t)}await this.refresh()}async updatePhone(e,i){try{await this.acct().updatePhone(e.replace(/[\s()-]/g,""),i)}catch(t){this.fail(t)}await this.refresh()}async updatePassword(e,i){try{await this.acct().updatePassword(e,i||void 0)}catch(t){this.fail(t)}await this.refresh()}async convertGuest(e,i,t){try{await this.acct().updateEmail(e.trim(),i),t?.trim()&&await this.acct().updateName(t.trim())}catch(o){this.fail(o)}await this.refresh()}async sendEmailVerification(){try{await Ae(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(t){this.fail(t)}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:""),t=new URL(i,typeof window<"u"?window.location.href:void 0);for(const o of Hi)t.searchParams.delete(o);return t.searchParams.set(Ot,e),t.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(Ot);if(!i)return!1;const t=e.get("userId")??"",o=e.get("secret")??"";this.cleanUrl();try{switch(i){case"oauth":case"magic-url":t&&o&&await this.acct().createSession(t,o);break;case"oauth-failed":this.setState({pending:{type:"oauth-failed"}});break;case"recovery":t&&o&&this.setState({pending:{type:"reset-password",userId:t,secret:o}});break;case"verify-email":t&&o&&(await Ae(this.acct(),["updateEmailVerification","updateVerification"],[t,o]),this.setState({pending:{type:"notice",message:this.getStrings().emailVerified,tone:"success"}}));break}}catch(a){const s=st(a);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 Hi)e.searchParams.delete(i);window.history.replaceState(window.history.state,"",e.toString())}reset(){this.client=null,this.account=null,this.preview=null,this.config=null,this.state=Di(),this.listeners.clear()}}const q=new Bi;class co{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 Xi=new co,Vi={none:"0px",sm:"0.25rem",md:"0.625rem",lg:"0.875rem",xl:"1.125rem",full:"1.5rem"},lo=Le`
9
+ `+W+"}":"{"+K.join(",")+"}",o=W,q}}typeof i.stringify!="function"&&(i.stringify=function(h,u,m){var j;if(o="",a="",typeof m=="number")for(j=0;j<m;j+=1)a+=" ";else typeof m=="string"&&(a=m);if(r=u,u&&typeof u!="function"&&(typeof u!="object"||typeof u.length!="number"))throw new Error("JSON.stringify");return c("",{"":h})})})()})(qt)),qt.exports}var xt,Ri;function En(){if(Ri)return xt;Ri=1;var n=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 t=function(o){var a={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(o!=null){if(o.strict===!0&&(a.strict=!0),o.storeAsString===!0&&(a.storeAsString=!0),a.alwaysParseAsBig=o.alwaysParseAsBig===!0?o.alwaysParseAsBig:!1,a.useNativeBigInt=o.useNativeBigInt===!0?o.useNativeBigInt:!1,typeof o.constructorAction<"u")if(o.constructorAction==="error"||o.constructorAction==="ignore"||o.constructorAction==="preserve")a.constructorAction=o.constructorAction;else throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${o.constructorAction}`);if(typeof o.protoAction<"u")if(o.protoAction==="error"||o.protoAction==="ignore"||o.protoAction==="preserve")a.protoAction=o.protoAction;else throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${o.protoAction}`)}var s,r,d={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
10
+ `,r:"\r",t:" "},c,h=function(H){throw{name:"SyntaxError",message:H,at:s,text:c}},u=function(H){return H&&H!==r&&h("Expected '"+H+"' instead of '"+r+"'"),r=c.charAt(s),s+=1,r},m=function(){var H,Z="";for(r==="-"&&(Z="-",u("-"));r>="0"&&r<="9";)Z+=r,u();if(r===".")for(Z+=".";u()&&r>="0"&&r<="9";)Z+=r;if(r==="e"||r==="E")for(Z+=r,u(),(r==="-"||r==="+")&&(Z+=r,u());r>="0"&&r<="9";)Z+=r,u();if(H=+Z,!isFinite(H))h("Bad number");else return n==null&&(n=Ci()),Z.length>15?a.storeAsString?Z:a.useNativeBigInt?BigInt(Z):new n(Z):a.alwaysParseAsBig?a.useNativeBigInt?BigInt(H):new n(H):H},j=function(){var H,Z,oe="",D;if(r==='"')for(var N=s;u();){if(r==='"')return s-1>N&&(oe+=c.substring(N,s-1)),u(),oe;if(r==="\\"){if(s-1>N&&(oe+=c.substring(N,s-1)),u(),r==="u"){for(D=0,Z=0;Z<4&&(H=parseInt(u(),16),!!isFinite(H));Z+=1)D=D*16+H;oe+=String.fromCharCode(D)}else if(typeof d[r]=="string")oe+=d[r];else break;N=s}}h("Bad string")},q=function(){for(;r&&r<=" ";)u()},T=function(){switch(r){case"t":return u("t"),u("r"),u("u"),u("e"),!0;case"f":return u("f"),u("a"),u("l"),u("s"),u("e"),!1;case"n":return u("n"),u("u"),u("l"),u("l"),null}h("Unexpected '"+r+"'")},W,K=function(){var H=[];if(r==="["){if(u("["),q(),r==="]")return u("]"),H;for(;r;){if(H.push(W()),q(),r==="]")return u("]"),H;u(","),q()}}h("Bad array")},_=function(){var H,Z=Object.create(null);if(r==="{"){if(u("{"),q(),r==="}")return u("}"),Z;for(;r;){if(H=j(),q(),u(":"),a.strict===!0&&Object.hasOwnProperty.call(Z,H)&&h('Duplicate key "'+H+'"'),e.test(H)===!0?a.protoAction==="error"?h("Object contains forbidden prototype property"):a.protoAction==="ignore"?W():Z[H]=W():i.test(H)===!0?a.constructorAction==="error"?h("Object contains forbidden constructor property"):a.constructorAction==="ignore"?W():Z[H]=W():Z[H]=W(),q(),r==="}")return u("}"),Z;u(","),q()}}h("Bad object")};return W=function(){switch(q(),r){case"{":return _();case"[":return K();case'"':return j();case"-":return m();default:return r>="0"&&r<="9"?m():T()}},function(H,Z){var oe;return c=H+"",s=0,r=" ",oe=W(),q(),r&&h("Syntax error"),typeof Z=="function"?(function D(N,te){var V,R=N[te];return R&&typeof R=="object"&&Object.keys(R).forEach(function(J){V=D(R,J),V!==void 0?R[J]=V:delete R[J]}),Z.call(N,te,R)})({"":oe},""):oe}};return xt=t,xt}var Ei;function qn(){if(Ei)return st.exports;Ei=1;var n=Rn().stringify,e=En();return st.exports=function(i){return{parse:e(i),stringify:n}},st.exports.parse=e(),st.exports.stringify=n,st.exports}var xn=qn();const _t=Cn(xn);function be(n,e,i,t){function o(a){return a instanceof i?a:new i(function(s){s(a)})}return new(i||(i=Promise))(function(a,s){function r(h){try{c(t.next(h))}catch(u){s(u)}}function d(h){try{c(t.throw(h))}catch(u){s(u)}}function c(h){h.done?a(h.value):o(h.value).then(r,d)}c((t=t.apply(n,e||[])).next())})}function _n(n,e,i,t){if(typeof e=="function"?n!==e||!t:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?t:i==="a"?t.call(n):t?t.value:e.get(n)}typeof SuppressedError=="function"&&SuppressedError;var mt,qi;class He{static custom(e){return e}static unique(e=7){const i=_n(mt,mt,"m",qi).call(mt);let t="";for(let o=0;o<e;o++){const a=Math.floor(Math.random()*16).toString(16);t+=a}return i+t}}mt=He,qi=function(){const e=new Date,i=Math.floor(e.getTime()/1e3),t=e.getMilliseconds();return i.toString(16)+t.toString(16).padStart(5,"0")};const wt=_t({useNativeBigInt:!0});class U{constructor(e,i,t){this.method=e,this.attribute=i,t!==void 0&&(Array.isArray(t)?this.values=t:this.values=[t])}toString(){return wt.stringify({method:this.method,attribute:this.attribute,values:this.values})}}U.equal=(n,e)=>new U("equal",n,e).toString(),U.notEqual=(n,e)=>new U("notEqual",n,e).toString(),U.regex=(n,e)=>new U("regex",n,e).toString(),U.lessThan=(n,e)=>new U("lessThan",n,e).toString(),U.lessThanEqual=(n,e)=>new U("lessThanEqual",n,e).toString(),U.greaterThan=(n,e)=>new U("greaterThan",n,e).toString(),U.greaterThanEqual=(n,e)=>new U("greaterThanEqual",n,e).toString(),U.isNull=n=>new U("isNull",n).toString(),U.isNotNull=n=>new U("isNotNull",n).toString(),U.exists=n=>new U("exists",void 0,n).toString(),U.notExists=n=>new U("notExists",void 0,n).toString(),U.between=(n,e,i)=>new U("between",n,[e,i]).toString(),U.startsWith=(n,e)=>new U("startsWith",n,e).toString(),U.endsWith=(n,e)=>new U("endsWith",n,e).toString(),U.select=n=>new U("select",void 0,n).toString(),U.search=(n,e)=>new U("search",n,e).toString(),U.orderDesc=n=>new U("orderDesc",n).toString(),U.orderAsc=n=>new U("orderAsc",n).toString(),U.orderRandom=()=>new U("orderRandom").toString(),U.cursorAfter=n=>new U("cursorAfter",void 0,n).toString(),U.cursorBefore=n=>new U("cursorBefore",void 0,n).toString(),U.limit=n=>new U("limit",void 0,n).toString(),U.offset=n=>new U("offset",void 0,n).toString(),U.contains=(n,e)=>new U("contains",n,e).toString(),U.containsAny=(n,e)=>new U("containsAny",n,e).toString(),U.containsAll=(n,e)=>new U("containsAll",n,e).toString(),U.notContains=(n,e)=>new U("notContains",n,e).toString(),U.notSearch=(n,e)=>new U("notSearch",n,e).toString(),U.notBetween=(n,e,i)=>new U("notBetween",n,[e,i]).toString(),U.notStartsWith=(n,e)=>new U("notStartsWith",n,e).toString(),U.notEndsWith=(n,e)=>new U("notEndsWith",n,e).toString(),U.createdBefore=n=>U.lessThan("$createdAt",n),U.createdAfter=n=>U.greaterThan("$createdAt",n),U.createdBetween=(n,e)=>U.between("$createdAt",n,e),U.updatedBefore=n=>U.lessThan("$updatedAt",n),U.updatedAfter=n=>U.greaterThan("$updatedAt",n),U.updatedBetween=(n,e)=>U.between("$updatedAt",n,e),U.or=n=>new U("or",void 0,n.map(e=>wt.parse(e))).toString(),U.and=n=>new U("and",void 0,n.map(e=>wt.parse(e))).toString(),U.elemMatch=(n,e)=>new U("elemMatch",n,e.map(i=>wt.parse(i))).toString(),U.distanceEqual=(n,e,i,t=!0)=>new U("distanceEqual",n,[[e,i,t]]).toString(),U.distanceNotEqual=(n,e,i,t=!0)=>new U("distanceNotEqual",n,[[e,i,t]]).toString(),U.distanceGreaterThan=(n,e,i,t=!0)=>new U("distanceGreaterThan",n,[[e,i,t]]).toString(),U.distanceLessThan=(n,e,i,t=!0)=>new U("distanceLessThan",n,[[e,i,t]]).toString(),U.vectorDot=(n,e)=>new U("vectorDot",n,[e]).toString(),U.vectorCosine=(n,e)=>new U("vectorCosine",n,[e]).toString(),U.vectorEuclidean=(n,e)=>new U("vectorEuclidean",n,[e]).toString(),U.intersects=(n,e)=>new U("intersects",n,[e]).toString(),U.notIntersects=(n,e)=>new U("notIntersects",n,[e]).toString(),U.crosses=(n,e)=>new U("crosses",n,[e]).toString(),U.notCrosses=(n,e)=>new U("notCrosses",n,[e]).toString(),U.overlaps=(n,e)=>new U("overlaps",n,[e]).toString(),U.notOverlaps=(n,e)=>new U("notOverlaps",n,[e]).toString(),U.touches=(n,e)=>new U("touches",n,[e]).toString(),U.notTouches=(n,e)=>new U("notTouches",n,[e]).toString();const Ln=_t({storeAsString:!1}),Nn=_t({useNativeBigInt:!0}),Hn=BigInt(Number.MAX_SAFE_INTEGER),Dn=BigInt(Number.MIN_SAFE_INTEGER),Bn=BigInt("9223372036854775807"),Xn=BigInt("-9223372036854775808");function Vn(n){return n!==null&&typeof n=="object"&&n._isBigNumber===!0&&typeof n.isInteger=="function"&&typeof n.toFixed=="function"&&typeof n.toNumber=="function"}function Wn(n,e){if(Vn(e)){if(e.isInteger()){const i=e.toFixed(),t=BigInt(i);return t>=Dn&&t<=Hn?Number(i):t>=Xn&&t<=Bn?t:e.toNumber()}return e.toNumber()}return e}const ye={parse:n=>Ln.parse(n,Wn),stringify:Nn.stringify};class p extends Error{constructor(e,i=0,t="",o=""){super(e),this.name="AppwriteException",this.message=e,this.code=i,this.type=t,this.response=o}}class Ae{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(ye.stringify({type:"ping"}))},2e4)},createSocket:()=>{var e,i,t,o,a;if(this.realtime.subscriptions.size<1){this.realtime.reconnect=!1,(e=this.realtime.socket)===null||e===void 0||e.close();return}let r="project="+encodeURIComponent((i=this.config.project)!==null&&i!==void 0?i:"");this.config.jwt&&(r+="&jwt="+encodeURIComponent(this.config.jwt));const d=this.config.endpointRealtime+"/realtime?"+r;d!==this.realtime.url||!this.realtime.socket||((t=this.realtime.socket)===null||t===void 0?void 0:t.readyState)>WebSocket.OPEN?(this.realtime.socket&&((o=this.realtime.socket)===null||o===void 0?void 0:o.readyState)<WebSocket.CLOSING&&(this.realtime.reconnect=!1,this.realtime.socket.close()),this.realtime.url=d,this.realtime.socket=new WebSocket(d),this.realtime.socket.addEventListener("message",this.realtime.onMessage),this.realtime.socket.addEventListener("open",c=>{this.realtime.reconnectAttempts=0,this.realtime.createHeartbeat()}),this.realtime.socket.addEventListener("close",c=>{var h,u,m;if(!this.realtime.reconnect||((u=(h=this.realtime)===null||h===void 0?void 0:h.lastMessage)===null||u===void 0?void 0:u.type)==="error"&&((m=this.realtime)===null||m===void 0?void 0:m.lastMessage.data).code===1008){this.realtime.reconnect=!0;return}const j=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${j/1e3} seconds.`,c.reason),setTimeout(()=>{this.realtime.reconnectAttempts++,this.realtime.createSocket()},j)})):((a=this.realtime.socket)===null||a===void 0?void 0:a.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(ye.stringify({type:"subscribe",data:e}))},onMessage:e=>{var i,t;try{const o=ye.parse(e.data);switch(this.realtime.lastMessage=o,o.type){case"connected":{const a=o.data;let s=this.config.session;if(!s){const r=ye.parse((i=window.localStorage.getItem("cookieFallback"))!==null&&i!==void 0?i:"{}");s=r?.[`a_session_${this.config.project}`]}s&&!a?.user&&((t=this.realtime.socket)===null||t===void 0||t.send(ye.stringify({type:"authentication",data:{session:s}}))),this.realtime.subscriptions.forEach((r,d)=>{var c;this.realtime.pendingSubscribes.set(d,{subscriptionId:d,channels:r.channels,queries:(c=r.queries)!==null&&c!==void 0?c:[]})}),this.realtime.sendPendingSubscribes();break}case"response":break;case"event":{const a=o.data;if(!a?.channels)break;const s=a.subscriptions;if(s&&s.length>0)for(const r of s){const d=this.realtime.subscriptions.get(r);d&&setTimeout(()=>d.callback(a))}else{if(!a.channels.some(d=>this.realtime.channels.has(d)))break;this.realtime.subscriptions.forEach(d=>{a.channels.some(c=>d.channels.includes(c))&&setTimeout(()=>d.callback(a))})}break}case"pong":break;case"error":throw o.data;default:break}}catch(o){console.error(o)}}}}getHeaders(){return Object.assign({},this.headers)}setEndpoint(e){if(!e||typeof e!="string")throw new p("Endpoint must be a valid string");if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new p("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 p("Endpoint must be a valid string");if(!e.startsWith("ws://")&&!e.startsWith("wss://"))throw new p("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,t=[]){const a=(Array.isArray(e)?e:[e]).map(c=>typeof c=="string"?c:c&&typeof c.toString=="function"?c.toString():String(c));a.forEach(c=>this.realtime.channels.add(c));const s=(t??[]).map(c=>typeof c=="string"?c:c.toString());let r="";const d=this.realtime.subscriptions.size+1;for(let c=0;c<d;c++){const h=He.unique();if(!this.realtime.subscriptions.has(h)){r=h;break}}if(r==="")throw new p("Failed to generate unique subscription id");return this.realtime.subscriptions.set(r,{channels:a,queries:s,callback:i}),this.realtime.pendingSubscribes.set(r,{subscriptionId:r,channels:a,queries:s}),this.realtime.connect(),()=>{this.realtime.subscriptions.delete(r),this.realtime.pendingSubscribes.delete(r);const c=new Set;this.realtime.subscriptions.forEach(h=>{h.channels.forEach(u=>c.add(u))}),this.realtime.channels.forEach(h=>{c.has(h)||this.realtime.channels.delete(h)}),this.realtime.connect()}}prepareRequest(e,i,t={},o={}){if(e=e.toUpperCase(),t=Object.assign({},this.headers,t),typeof window<"u"&&window.localStorage){const s=window.localStorage.getItem("cookieFallback");s&&(t["X-Fallback-Cookies"]=s)}const a={method:e,headers:t};if(t["X-Appwrite-Dev-Key"]===void 0&&(a.credentials="include"),e==="GET")for(const[s,r]of Object.entries(Ae.flatten(o)))i.searchParams.append(s,r);else switch(t["content-type"]){case"application/json":a.body=ye.stringify(o);break;case"multipart/form-data":{const s=new FormData;for(const[r,d]of Object.entries(o))if(d instanceof File)s.append(r,d,d.name);else if(Array.isArray(d))for(const c of d)s.append(`${r}[]`,c);else s.append(r,d);a.body=s,delete t["content-type"];break}}return{uri:i.toString(),options:a}}chunkedUpload(e,i){return be(this,arguments,void 0,function*(t,o,a={},s={},r){var d;const[c,h]=(d=Object.entries(s).find(([J,z])=>z instanceof File))!==null&&d!==void 0?d:[];if(!h||!c)throw new Error("File not found in payload");if(h.size<=Ae.CHUNK_SIZE)return yield this.call(t,o,a,s);const u=Math.ceil(h.size/Ae.CHUNK_SIZE),m=Math.min(Ae.CHUNK_SIZE,h.size),j=Object.assign(Object.assign({},a),{"content-range":`bytes 0-${m-1}/${h.size}`}),q=h.slice(0,m),T=Object.assign({},s);T[c]=new File([q],h.name);const W=yield this.call(t,o,j,T),K=W?.$id;if(r&&typeof r=="function"&&r({$id:K,progress:Math.round(m/h.size*100),sizeUploaded:m,chunksTotal:u,chunksUploaded:1}),u===1)return W;const _=[];for(let J=1;J<u;J++){const z=J*Ae.CHUNK_SIZE,ie=Math.min(z+Ae.CHUNK_SIZE,h.size);_.push({start:z,end:ie})}const H=8;let Z=1,oe=m,D=W,N=null,te=!1;const V=J=>{var z;const ie=J?.chunksUploaded,ce=(z=J?.chunksTotal)!==null&&z!==void 0?z:u;return typeof ie=="number"&&typeof ce=="number"&&ie>=ce},R=J=>be(this,void 0,void 0,function*(){const z=Object.assign({},a);K&&(z["x-appwrite-id"]=K),z["content-range"]=`bytes ${J.start}-${J.end-1}/${h.size}`;const ie=h.slice(J.start,J.end),ce=Object.assign({},s);ce[c]=new File([ie],h.name);const de=yield this.call(t,o,z,ce);return te||(Z++,oe+=J.end-J.start,D=de,V(de)&&(N=de),r&&typeof r=="function"&&r({$id:K,progress:Math.round(oe/h.size*100),sizeUploaded:oe,chunksTotal:u,chunksUploaded:Z})),de});return yield new Promise((J,z)=>{let ie=0,ce=0,de=0;const Ce=()=>{if(!te){if(de===_.length){J();return}for(;ce<H&&ie<_.length;){const ve=_[ie++];ce++,R(ve).then(()=>{ce--,de++,Ce()}).catch(xe=>{te=!0,z(xe)})}}};Ce()}),N??D})}ping(){return be(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 be(this,arguments,void 0,function*(t,o,a={},s={},r="json"){var d,c,h;const{uri:u,options:m}=this.prepareRequest(t,o,a,s);let j=null;const q=yield fetch(u,m);if(q.type==="opaque")throw new p(`Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`,403,"forbidden","");const T=q.headers.get("x-appwrite-warning");if(T&&T.split(";").forEach(K=>console.warn("Warning: "+K)),!((d=q.headers.get("content-type"))===null||d===void 0)&&d.includes("application/json")?j=ye.parse(yield q.text()):r==="arrayBuffer"?j=yield q.arrayBuffer():j={message:yield q.text()},400<=q.status){let K;throw!((c=q.headers.get("content-type"))===null||c===void 0)&&c.includes("application/json")||r==="arrayBuffer"?K=ye.stringify(j):K=j?.message,new p((h=j?.message)!==null&&h!==void 0?h:K,q.status,j?.type,K)}const W=q.headers.get("X-Fallback-Cookies");return typeof window<"u"&&window.localStorage&&W&&(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",W)),j&&typeof j=="object"&&Object.defineProperty(j,"toString",{value:()=>ye.stringify(j),writable:!0,enumerable:!1,configurable:!0}),j})}static flatten(e,i=""){let t={};for(const[o,a]of Object.entries(e)){const s=i?i+"["+o+"]":o;Array.isArray(a)?t=Object.assign(Object.assign({},t),Ae.flatten(a,s)):t[s]=a}return t}}Ae.CHUNK_SIZE=5242880;class ge{constructor(e){this.client=e}static flatten(e,i=""){let t={};for(const[o,a]of Object.entries(e)){const s=i?i+"["+o+"]":o;Array.isArray(a)?t=Object.assign(Object.assign({},t),ge.flatten(a,s)):t[s]=a}return t}}ge.CHUNK_SIZE=5242880;class Lt{constructor(e){this.client=e}get(){const e="/account",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}create(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,email:i[0],password:i[1],name:i[2]};const o=t.userId,a=t.email,s=t.password,r=t.name;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "email"');if(typeof s>"u")throw new p('Missing required parameter: "password"');const d="/account",c={};typeof o<"u"&&(c.userId=o),typeof a<"u"&&(c.email=a),typeof s<"u"&&(c.password=s),typeof r<"u"&&(c.name=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,u,c)}listConsents(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0]};const o=t.queries,a=t.total,s="/account/consents",r={};typeof o<"u"&&(r.queries=o),typeof a<"u"&&(r.total=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}getConsent(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={consentId:e};const t=i.consentId;if(typeof t>"u")throw new p('Missing required parameter: "consentId"');const o="/account/consents/{consentId}".replace("{consentId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}deleteConsent(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={consentId:e};const t=i.consentId;if(typeof t>"u")throw new p('Missing required parameter: "consentId"');const o="/account/consents/{consentId}".replace("{consentId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",s,r,a)}listConsentTokens(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={consentId:e,queries:i[0],total:i[1]};const o=t.consentId,a=t.queries,s=t.total;if(typeof o>"u")throw new p('Missing required parameter: "consentId"');const r="/account/consents/{consentId}/tokens".replace("{consentId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.queries=a),typeof s<"u"&&(d.total=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}getConsentToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={consentId:e,tokenId:i[0]};const o=t.consentId,a=t.tokenId;if(typeof o>"u")throw new p('Missing required parameter: "consentId"');if(typeof a>"u")throw new p('Missing required parameter: "tokenId"');const s="/account/consents/{consentId}/tokens/{tokenId}".replace("{consentId}",encodeURIComponent(String(o))).replace("{tokenId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}deleteConsentToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={consentId:e,tokenId:i[0]};const o=t.consentId,a=t.tokenId;if(typeof o>"u")throw new p('Missing required parameter: "consentId"');if(typeof a>"u")throw new p('Missing required parameter: "tokenId"');const s="/account/consents/{consentId}/tokens/{tokenId}".replace("{consentId}",encodeURIComponent(String(o))).replace("{tokenId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",d,c,r)}updateEmail(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={email:e,password:i[0]};const o=t.email,a=t.password;if(typeof o>"u")throw new p('Missing required parameter: "email"');if(typeof a>"u")throw new p('Missing required parameter: "password"');const s="/account/email",r={};typeof o<"u"&&(r.email=o),typeof a<"u"&&(r.password=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",d,c,r)}listIdentities(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0]};const o=t.queries,a=t.total,s="/account/identities",r={};typeof o<"u"&&(r.queries=o),typeof a<"u"&&(r.total=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}deleteIdentity(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={identityId:e};const t=i.identityId;if(typeof t>"u")throw new p('Missing required parameter: "identityId"');const o="/account/identities/{identityId}".replace("{identityId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createJWT(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={duration:e};const t=i.duration,o="/account/jwts",a={};typeof t<"u"&&(a.duration=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}listLogs(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0]};const o=t.queries,a=t.total,s="/account/logs",r={};typeof o<"u"&&(r.queries=o),typeof a<"u"&&(r.total=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}updateMFA(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={mfa:e};const t=i.mfa;if(typeof t>"u")throw new p('Missing required parameter: "mfa"');const o="/account/mfa",a={};typeof t<"u"&&(a.mfa=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,r,a)}createMfaAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const t=i.type;if(typeof t>"u")throw new p('Missing required parameter: "type"');const o="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}createMFAAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const t=i.type;if(typeof t>"u")throw new p('Missing required parameter: "type"');const o="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}updateMfaAuthenticator(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("type"in e||"otp"in e)?t=e||{}:t={type:e,otp:i[0]};const o=t.type,a=t.otp;if(typeof o>"u")throw new p('Missing required parameter: "type"');if(typeof a>"u")throw new p('Missing required parameter: "otp"');const s="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.otp=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}updateMFAAuthenticator(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("type"in e||"otp"in e)?t=e||{}:t={type:e,otp:i[0]};const o=t.type,a=t.otp;if(typeof o>"u")throw new p('Missing required parameter: "type"');if(typeof a>"u")throw new p('Missing required parameter: "otp"');const s="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.otp=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}deleteMfaAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const t=i.type;if(typeof t>"u")throw new p('Missing required parameter: "type"');const o="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}deleteMFAAuthenticator(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"type"in e?i=e||{}:i={type:e};const t=i.type;if(typeof t>"u")throw new p('Missing required parameter: "type"');const o="/account/mfa/authenticators/{type}".replace("{type}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createMfaChallenge(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"factor"in e?i=e||{}:i={factor:e};const t=i.factor;if(typeof t>"u")throw new p('Missing required parameter: "factor"');const o="/account/mfa/challenges",a={};typeof t<"u"&&(a.factor=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}createMFAChallenge(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"factor"in e?i=e||{}:i={factor:e};const t=i.factor;if(typeof t>"u")throw new p('Missing required parameter: "factor"');const o="/account/mfa/challenges",a={};typeof t<"u"&&(a.factor=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}updateMfaChallenge(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={challengeId:e,otp:i[0]};const o=t.challengeId,a=t.otp;if(typeof o>"u")throw new p('Missing required parameter: "challengeId"');if(typeof a>"u")throw new p('Missing required parameter: "otp"');const s="/account/mfa/challenges",r={};typeof o<"u"&&(r.challengeId=o),typeof a<"u"&&(r.otp=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}updateMFAChallenge(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={challengeId:e,otp:i[0]};const o=t.challengeId,a=t.otp;if(typeof o>"u")throw new p('Missing required parameter: "challengeId"');if(typeof a>"u")throw new p('Missing required parameter: "otp"');const s="/account/mfa/challenges",r={};typeof o<"u"&&(r.challengeId=o),typeof a<"u"&&(r.otp=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}listMfaFactors(){const e="/account/mfa/factors",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listMFAFactors(){const e="/account/mfa/factors",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}getMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}getMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}createMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",t,o,i)}createMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",t,o,i)}updateMfaRecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",t,o,i)}updateMFARecoveryCodes(){const e="/account/mfa/recovery-codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",t,o,i)}updateName(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={name:e};const t=i.name;if(typeof t>"u")throw new p('Missing required parameter: "name"');const o="/account/name",a={};typeof t<"u"&&(a.name=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,r,a)}updatePassword(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={password:e,oldPassword:i[0]};const o=t.password,a=t.oldPassword;if(typeof o>"u")throw new p('Missing required parameter: "password"');const s="/account/password",r={};typeof o<"u"&&(r.password=o),typeof a<"u"&&(r.oldPassword=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",d,c,r)}updatePhone(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={phone:e,password:i[0]};const o=t.phone,a=t.password;if(typeof o>"u")throw new p('Missing required parameter: "phone"');if(typeof a>"u")throw new p('Missing required parameter: "password"');const s="/account/phone",r={};typeof o<"u"&&(r.phone=o),typeof a<"u"&&(r.password=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",d,c,r)}getPrefs(){const e="/account/prefs",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}updatePrefs(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"prefs"in e?i=e||{}:i={prefs:e};const t=i.prefs;if(typeof t>"u")throw new p('Missing required parameter: "prefs"');const o="/account/prefs",a={};typeof t<"u"&&(a.prefs=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,r,a)}createRecovery(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={email:e,url:i[0]};const o=t.email,a=t.url;if(typeof o>"u")throw new p('Missing required parameter: "email"');if(typeof a>"u")throw new p('Missing required parameter: "url"');const s="/account/recovery",r={};typeof o<"u"&&(r.email=o),typeof a<"u"&&(r.url=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}updateRecovery(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0],password:i[1]};const o=t.userId,a=t.secret,s=t.password;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');if(typeof s>"u")throw new p('Missing required parameter: "password"');const r="/account/recovery",d={};typeof o<"u"&&(d.userId=o),typeof a<"u"&&(d.secret=a),typeof s<"u"&&(d.password=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",c,h,d)}listSessions(){const e="/account/sessions",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}deleteSessions(){const e="/account/sessions",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",t,o,i)}createAnonymousSession(){const e="/account/sessions/anonymous",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",t,o,i)}createEmailPasswordSession(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={email:e,password:i[0]};const o=t.email,a=t.password;if(typeof o>"u")throw new p('Missing required parameter: "email"');if(typeof a>"u")throw new p('Missing required parameter: "password"');const s="/account/sessions/email",r={};typeof o<"u"&&(r.email=o),typeof a<"u"&&(r.password=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}updateMagicURLSession(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/sessions/magic-url",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}createOAuth2Session(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("provider"in e||"success"in e||"failure"in e||"scopes"in e)?t=e||{}:t={provider:e,success:i[0],failure:i[1],scopes:i[2]};const o=t.provider,a=t.success,s=t.failure,r=t.scopes;if(typeof o>"u")throw new p('Missing required parameter: "provider"');const d="/account/sessions/oauth2/{provider}".replace("{provider}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.success=a),typeof s<"u"&&(c.failure=s),typeof r<"u"&&(c.scopes=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project;for(const[u,m]of Object.entries(ge.flatten(c)))h.searchParams.append(u,m);if(typeof window<"u"&&window?.location){window.location.href=h.toString();return}else return h.toString()}updatePhoneSession(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/sessions/phone",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}createSession(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/sessions/token",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}getSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const t=i.sessionId;if(typeof t>"u")throw new p('Missing required parameter: "sessionId"');const o="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const t=i.sessionId;if(typeof t>"u")throw new p('Missing required parameter: "sessionId"');const o="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",s,r,a)}deleteSession(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={sessionId:e};const t=i.sessionId;if(typeof t>"u")throw new p('Missing required parameter: "sessionId"');const o="/account/sessions/{sessionId}".replace("{sessionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}updateStatus(){const e="/account/status",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",t,o,i)}createPushTarget(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={targetId:e,identifier:i[0],providerId:i[1]};const o=t.targetId,a=t.identifier,s=t.providerId;if(typeof o>"u")throw new p('Missing required parameter: "targetId"');if(typeof a>"u")throw new p('Missing required parameter: "identifier"');const r="/account/targets/push",d={};typeof o<"u"&&(d.targetId=o),typeof a<"u"&&(d.identifier=a),typeof s<"u"&&(d.providerId=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}updatePushTarget(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={targetId:e,identifier:i[0]};const o=t.targetId,a=t.identifier;if(typeof o>"u")throw new p('Missing required parameter: "targetId"');if(typeof a>"u")throw new p('Missing required parameter: "identifier"');const s="/account/targets/{targetId}/push".replace("{targetId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.identifier=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}deletePushTarget(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={targetId:e};const t=i.targetId;if(typeof t>"u")throw new p('Missing required parameter: "targetId"');const o="/account/targets/{targetId}/push".replace("{targetId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createEmailToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,email:i[0],phrase:i[1]};const o=t.userId,a=t.email,s=t.phrase;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "email"');const r="/account/tokens/email",d={};typeof o<"u"&&(d.userId=o),typeof a<"u"&&(d.email=a),typeof s<"u"&&(d.phrase=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}createMagicURLToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,email:i[0],url:i[1],phrase:i[2]};const o=t.userId,a=t.email,s=t.url,r=t.phrase;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "email"');const d="/account/tokens/magic-url",c={};typeof o<"u"&&(c.userId=o),typeof a<"u"&&(c.email=a),typeof s<"u"&&(c.url=s),typeof r<"u"&&(c.phrase=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,u,c)}createOAuth2Token(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("provider"in e||"success"in e||"failure"in e||"scopes"in e)?t=e||{}:t={provider:e,success:i[0],failure:i[1],scopes:i[2]};const o=t.provider,a=t.success,s=t.failure,r=t.scopes;if(typeof o>"u")throw new p('Missing required parameter: "provider"');const d="/account/tokens/oauth2/{provider}".replace("{provider}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.success=a),typeof s<"u"&&(c.failure=s),typeof r<"u"&&(c.scopes=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project;for(const[u,m]of Object.entries(ge.flatten(c)))h.searchParams.append(u,m);if(typeof window<"u"&&window?.location){window.location.href=h.toString();return}else return h.toString()}createPhoneToken(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,phone:i[0]};const o=t.userId,a=t.phone;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "phone"');const s="/account/tokens/phone",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.phone=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}createEmailVerification(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const t=i.url;if(typeof t>"u")throw new p('Missing required parameter: "url"');const o="/account/verifications/email",a={};typeof t<"u"&&(a.url=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}createVerification(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const t=i.url;if(typeof t>"u")throw new p('Missing required parameter: "url"');const o="/account/verifications/email",a={};typeof t<"u"&&(a.url=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}updateEmailVerification(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/verifications/email",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}updateVerification(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/verifications/email",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}createPhoneVerification(){const e="/account/verifications/phone",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",t,o,i)}updatePhoneVerification(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={userId:e,secret:i[0]};const o=t.userId,a=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "userId"');if(typeof a>"u")throw new p('Missing required parameter: "secret"');const s="/account/verifications/phone",r={};typeof o<"u"&&(r.userId=o),typeof a<"u"&&(r.secret=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}}class xi{constructor(e){this.client=e}getBrowser(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?t=e||{}:t={code:e,width:i[0],height:i[1],quality:i[2]};const o=t.code,a=t.width,s=t.height,r=t.quality;if(typeof o>"u")throw new p('Missing required parameter: "code"');const d="/avatars/browsers/{code}".replace("{code}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.width=a),typeof s<"u"&&(c.height=s),typeof r<"u"&&(c.quality=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ge.flatten(c)))h.searchParams.append(u,m);return h.toString()}getCreditCard(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?t=e||{}:t={code:e,width:i[0],height:i[1],quality:i[2]};const o=t.code,a=t.width,s=t.height,r=t.quality;if(typeof o>"u")throw new p('Missing required parameter: "code"');const d="/avatars/credit-cards/{code}".replace("{code}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.width=a),typeof s<"u"&&(c.height=s),typeof r<"u"&&(c.quality=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ge.flatten(c)))h.searchParams.append(u,m);return h.toString()}getFavicon(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={url:e};const t=i.url;if(typeof t>"u")throw new p('Missing required parameter: "url"');const o="/avatars/favicon",a={};typeof t<"u"&&(a.url=t);const s=new URL(this.client.config.endpoint+o);a.project=this.client.config.project,a.impersonateuserid=this.client.config.impersonateuserid;for(const[r,d]of Object.entries(ge.flatten(a)))s.searchParams.append(r,d);return s.toString()}getFlag(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)&&("code"in e||"width"in e||"height"in e||"quality"in e)?t=e||{}:t={code:e,width:i[0],height:i[1],quality:i[2]};const o=t.code,a=t.width,s=t.height,r=t.quality;if(typeof o>"u")throw new p('Missing required parameter: "code"');const d="/avatars/flags/{code}".replace("{code}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.width=a),typeof s<"u"&&(c.height=s),typeof r<"u"&&(c.quality=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ge.flatten(c)))h.searchParams.append(u,m);return h.toString()}getImage(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={url:e,width:i[0],height:i[1]};const o=t.url,a=t.width,s=t.height;if(typeof o>"u")throw new p('Missing required parameter: "url"');const r="/avatars/image",d={};typeof o<"u"&&(d.url=o),typeof a<"u"&&(d.width=a),typeof s<"u"&&(d.height=s);const c=new URL(this.client.config.endpoint+r);d.project=this.client.config.project,d.impersonateuserid=this.client.config.impersonateuserid;for(const[h,u]of Object.entries(ge.flatten(d)))c.searchParams.append(h,u);return c.toString()}getInitials(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={name:e,width:i[0],height:i[1],background:i[2]};const o=t.name,a=t.width,s=t.height,r=t.background,d="/avatars/initials",c={};typeof o<"u"&&(c.name=o),typeof a<"u"&&(c.width=a),typeof s<"u"&&(c.height=s),typeof r<"u"&&(c.background=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ge.flatten(c)))h.searchParams.append(u,m);return h.toString()}getPhoto(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={width:e,height:i[0],quality:i[1],output:i[2],rating:i[3],userId:i[4],emailHash:i[5],name:i[6]};const o=t.width,a=t.height,s=t.quality,r=t.output,d=t.rating,c=t.userId,h=t.emailHash,u=t.name,m="/avatars/photo",j={};typeof o<"u"&&(j.width=o),typeof a<"u"&&(j.height=a),typeof s<"u"&&(j.quality=s),typeof r<"u"&&(j.output=r),typeof d<"u"&&(j.rating=d),typeof c<"u"&&(j.userId=c),typeof h<"u"&&(j.emailHash=h),typeof u<"u"&&(j.name=u);const q=new URL(this.client.config.endpoint+m);j.project=this.client.config.project,j.impersonateuserid=this.client.config.impersonateuserid;for(const[T,W]of Object.entries(ge.flatten(j)))q.searchParams.append(T,W);return q.toString()}getQR(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={text:e,size:i[0],margin:i[1],download:i[2]};const o=t.text,a=t.size,s=t.margin,r=t.download;if(typeof o>"u")throw new p('Missing required parameter: "text"');const d="/avatars/qr",c={};typeof o<"u"&&(c.text=o),typeof a<"u"&&(c.size=a),typeof s<"u"&&(c.margin=s),typeof r<"u"&&(c.download=r);const h=new URL(this.client.config.endpoint+d);c.project=this.client.config.project,c.impersonateuserid=this.client.config.impersonateuserid;for(const[u,m]of Object.entries(ge.flatten(c)))h.searchParams.append(u,m);return h.toString()}getScreenshot(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={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 o=t.url,a=t.headers,s=t.viewportWidth,r=t.viewportHeight,d=t.scale,c=t.theme,h=t.userAgent,u=t.fullpage,m=t.locale,j=t.timezone,q=t.latitude,T=t.longitude,W=t.accuracy,K=t.touch,_=t.permissions,H=t.sleep,Z=t.width,oe=t.height,D=t.quality,N=t.output;if(typeof o>"u")throw new p('Missing required parameter: "url"');const te="/avatars/screenshots",V={};typeof o<"u"&&(V.url=o),typeof a<"u"&&(V.headers=a),typeof s<"u"&&(V.viewportWidth=s),typeof r<"u"&&(V.viewportHeight=r),typeof d<"u"&&(V.scale=d),typeof c<"u"&&(V.theme=c),typeof h<"u"&&(V.userAgent=h),typeof u<"u"&&(V.fullpage=u),typeof m<"u"&&(V.locale=m),typeof j<"u"&&(V.timezone=j),typeof q<"u"&&(V.latitude=q),typeof T<"u"&&(V.longitude=T),typeof W<"u"&&(V.accuracy=W),typeof K<"u"&&(V.touch=K),typeof _<"u"&&(V.permissions=_),typeof H<"u"&&(V.sleep=H),typeof Z<"u"&&(V.width=Z),typeof oe<"u"&&(V.height=oe),typeof D<"u"&&(V.quality=D),typeof N<"u"&&(V.output=N);const R=new URL(this.client.config.endpoint+te);V.project=this.client.config.project,V.impersonateuserid=this.client.config.impersonateuserid;for(const[J,z]of Object.entries(ge.flatten(V)))R.searchParams.append(J,z);return R.toString()}}class Gn{constructor(e){this.client=e}listTransactions(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={queries:e};const t=i.queries,o="/databases/transactions",a={};typeof t<"u"&&(a.queries=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}createTransaction(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={ttl:e};const t=i.ttl,o="/databases/transactions",a={};typeof t<"u"&&(a.ttl=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}getTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/databases/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateTransaction(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,commit:i[0],rollback:i[1]};const o=t.transactionId,a=t.commit,s=t.rollback;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const r="/databases/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.commit=a),typeof s<"u"&&(d.rollback=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/databases/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createOperations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,operations:i[0]};const o=t.transactionId,a=t.operations;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const s="/databases/transactions/{transactionId}/operations".replace("{transactionId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.operations=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}listDocuments(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.collectionId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');const h="/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",m,j,u)}createDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "data"');const h="/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.documentId=s),typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}getDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],queries:i[2],transactionId:i[3]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.queries,d=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const c="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),h={};typeof r<"u"&&(h.queries=r),typeof d<"u"&&(h.transactionId=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",u,m,h)}upsertDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",m,j,u)}updateDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}deleteDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],transactionId:i[2]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const d="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),c={};typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",h,u,c)}decrementDocumentAttribute(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],attribute:i[2],value:i[3],min:i[4],transactionId:i[5]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.attribute,d=t.value,c=t.min,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "attribute"');const u="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))).replace("{attribute}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.min=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),q={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,q,m)}incrementDocumentAttribute(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],attribute:i[2],value:i[3],max:i[4],transactionId:i[5]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.attribute,d=t.value,c=t.max,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "attribute"');const u="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))).replace("{attribute}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.max=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),q={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,q,m)}}class Kn{constructor(e){this.client=e}listTransactions(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={queries:e};const t=i.queries,o="/documentsdb/transactions",a={};typeof t<"u"&&(a.queries=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}createTransaction(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={ttl:e};const t=i.ttl,o="/documentsdb/transactions",a={};typeof t<"u"&&(a.ttl=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}getTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/documentsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateTransaction(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,commit:i[0],rollback:i[1]};const o=t.transactionId,a=t.commit,s=t.rollback;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const r="/documentsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.commit=a),typeof s<"u"&&(d.rollback=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/documentsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createOperations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,operations:i[0]};const o=t.transactionId,a=t.operations;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const s="/documentsdb/transactions/{transactionId}/operations".replace("{transactionId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.operations=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}listDocuments(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.collectionId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');const h="/documentsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",m,j,u)}createDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "data"');const h="/documentsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.documentId=s),typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}createDocuments(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documents:i[1],transactionId:i[2]};const o=t.databaseId,a=t.collectionId,s=t.documents,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documents"');const d="/documentsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),c={};typeof s<"u"&&(c.documents=s),typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",h,u,c)}getDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],queries:i[2],transactionId:i[3]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.queries,d=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const c="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),h={};typeof r<"u"&&(h.queries=r),typeof d<"u"&&(h.transactionId=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",u,m,h)}upsertDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",m,j,u)}updateDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}deleteDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],transactionId:i[2]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const d="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),c={};typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",h,u,c)}decrementDocumentAttribute(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],attribute:i[2],value:i[3],min:i[4],transactionId:i[5]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.attribute,d=t.value,c=t.min,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "attribute"');const u="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))).replace("{attribute}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.min=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),q={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,q,m)}incrementDocumentAttribute(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],attribute:i[2],value:i[3],max:i[4],transactionId:i[5]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.attribute,d=t.value,c=t.max,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "attribute"');const u="/documentsdb/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))).replace("{attribute}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.max=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),q={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,q,m)}}class Jn{constructor(e){this.client=e}listExecutions(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={functionId:e,queries:i[0],total:i[1]};const o=t.functionId,a=t.queries,s=t.total;if(typeof o>"u")throw new p('Missing required parameter: "functionId"');const r="/functions/{functionId}/executions".replace("{functionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.queries=a),typeof s<"u"&&(d.total=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}createExecution(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={functionId:e,body:i[0],async:i[1],xpath:i[2],method:i[3],headers:i[4],scheduledAt:i[5]};const o=t.functionId,a=t.body,s=t.async,r=t.xpath,d=t.method,c=t.headers,h=t.scheduledAt;if(typeof o>"u")throw new p('Missing required parameter: "functionId"');const u="/functions/{functionId}/executions".replace("{functionId}",encodeURIComponent(String(o))),m={};typeof a<"u"&&(m.body=a),typeof s<"u"&&(m.async=s),typeof r<"u"&&(m.path=r),typeof d<"u"&&(m.method=d),typeof c<"u"&&(m.headers=c),typeof h<"u"&&(m.scheduledAt=h);const j=new URL(this.client.config.endpoint+u),q={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",j,q,m)}getExecution(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={functionId:e,executionId:i[0]};const o=t.functionId,a=t.executionId;if(typeof o>"u")throw new p('Missing required parameter: "functionId"');if(typeof a>"u")throw new p('Missing required parameter: "executionId"');const s="/functions/{functionId}/executions/{executionId}".replace("{functionId}",encodeURIComponent(String(o))).replace("{executionId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}}class Yn{constructor(e){this.client=e}query(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"query"in e?i=e||{}:i={query:e};const t=i.query;if(typeof t>"u")throw new p('Missing required parameter: "query"');const o="/graphql",a={};typeof t<"u"&&(a.query=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"x-sdk-graphql":"true","content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}mutation(e){let i;e&&typeof e=="object"&&!Array.isArray(e)&&"query"in e?i=e||{}:i={query:e};const t=i.query;if(typeof t>"u")throw new p('Missing required parameter: "query"');const o="/graphql/mutation",a={};typeof t<"u"&&(a.query=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"x-sdk-graphql":"true","content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}}class Zn{constructor(e){this.client=e}get(){const e="/locale",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCodes(){const e="/locale/codes",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listContinents(){const e="/locale/continents",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCountries(){const e="/locale/countries",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCountriesEU(){const e="/locale/countries/eu",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCountriesPhones(){const e="/locale/countries/phones",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listCurrencies(){const e="/locale/currencies",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}listLanguages(){const e="/locale/languages",i={},t=new URL(this.client.config.endpoint+e),o={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",t,o,i)}}class Qn{constructor(e){this.client=e}createSubscriber(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={topicId:e,subscriberId:i[0],targetId:i[1]};const o=t.topicId,a=t.subscriberId,s=t.targetId;if(typeof o>"u")throw new p('Missing required parameter: "topicId"');if(typeof a>"u")throw new p('Missing required parameter: "subscriberId"');if(typeof s>"u")throw new p('Missing required parameter: "targetId"');const r="/messaging/topics/{topicId}/subscribers".replace("{topicId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.subscriberId=a),typeof s<"u"&&(d.targetId=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}deleteSubscriber(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={topicId:e,subscriberId:i[0]};const o=t.topicId,a=t.subscriberId;if(typeof o>"u")throw new p('Missing required parameter: "topicId"');if(typeof a>"u")throw new p('Missing required parameter: "subscriberId"');const s="/messaging/topics/{topicId}/subscribers/{subscriberId}".replace("{topicId}",encodeURIComponent(String(o))).replace("{subscriberId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",d,c,r)}}class Tn{constructor(e){this.client=e}listInstallations(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0]};const o=t.queries,a=t.total,s="/organization/installations",r={};typeof o<"u"&&(r.queries=o),typeof a<"u"&&(r.total=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}createInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={appId:e,authorizationDetails:i[0]};const o=t.appId,a=t.authorizationDetails;if(typeof o>"u")throw new p('Missing required parameter: "appId"');const s="/organization/installations",r={};typeof o<"u"&&(r.appId=o),typeof a<"u"&&(r.authorizationDetails=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}getInstallation(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={installationId:e};const t=i.installationId;if(typeof t>"u")throw new p('Missing required parameter: "installationId"');const o="/organization/installations/{installationId}".replace("{installationId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={installationId:e,authorizationDetails:i[0]};const o=t.installationId,a=t.authorizationDetails;if(typeof o>"u")throw new p('Missing required parameter: "installationId"');const s="/organization/installations/{installationId}".replace("{installationId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.authorizationDetails=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}deleteInstallation(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={installationId:e};const t=i.installationId;if(typeof t>"u")throw new p('Missing required parameter: "installationId"');const o="/organization/installations/{installationId}".replace("{installationId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",s,r,a)}}class zn{constructor(e){this.client=e}list(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,total:i[0],ttl:i[1]};const o=t.queries,a=t.total,s=t.ttl,r="/presences",d={};typeof o<"u"&&(d.queries=o),typeof a<"u"&&(d.total=a),typeof s<"u"&&(d.ttl=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}get(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={presenceId:e};const t=i.presenceId;if(typeof t>"u")throw new p('Missing required parameter: "presenceId"');const o="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}upsert(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={presenceId:e,status:i[0],permissions:i[1],expiresAt:i[2],metadata:i[3]};const o=t.presenceId,a=t.status,s=t.permissions,r=t.expiresAt,d=t.metadata;if(typeof o>"u")throw new p('Missing required parameter: "presenceId"');if(typeof a>"u")throw new p('Missing required parameter: "status"');const c="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(o))),h={};typeof a<"u"&&(h.status=a),typeof s<"u"&&(h.permissions=s),typeof r<"u"&&(h.expiresAt=r),typeof d<"u"&&(h.metadata=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",u,m,h)}update(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={presenceId:e,status:i[0],expiresAt:i[1],metadata:i[2],permissions:i[3],purge:i[4]};const o=t.presenceId,a=t.status,s=t.expiresAt,r=t.metadata,d=t.permissions,c=t.purge;if(typeof o>"u")throw new p('Missing required parameter: "presenceId"');const h="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(o))),u={};typeof a<"u"&&(u.status=a),typeof s<"u"&&(u.expiresAt=s),typeof r<"u"&&(u.metadata=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.purge=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}delete(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={presenceId:e};const t=i.presenceId;if(typeof t>"u")throw new p('Missing required parameter: "presenceId"');const o="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}}class On{constructor(e){this.client=e}listFiles(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,queries:i[0],search:i[1],total:i[2]};const o=t.bucketId,a=t.queries,s=t.search,r=t.total;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');const d="/storage/buckets/{bucketId}/files".replace("{bucketId}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.queries=a),typeof s<"u"&&(c.search=s),typeof r<"u"&&(c.total=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",h,u,c)}createFile(e,...i){let t,o;e&&typeof e=="object"&&!Array.isArray(e)?(t=e||{},o=e?.onProgress):(t={bucketId:e,fileId:i[0],file:i[1],permissions:i[2],folder:i[3]},o=i[4]);const a=t.bucketId,s=t.fileId,r=t.file,d=t.permissions,c=t.folder;if(typeof a>"u")throw new p('Missing required parameter: "bucketId"');if(typeof s>"u")throw new p('Missing required parameter: "fileId"');if(typeof r>"u")throw new p('Missing required parameter: "file"');const h="/storage/buckets/{bucketId}/files".replace("{bucketId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.fileId=s),typeof r<"u"&&(u.file=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.folder=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"multipart/form-data",accept:"application/json"};return this.client.chunkedUpload("post",m,j,u,o)}getFile(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0]};const o=t.bucketId,a=t.fileId;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const s="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}updateFile(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0],name:i[1],permissions:i[2]};const o=t.bucketId,a=t.fileId,s=t.name,r=t.permissions;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const d="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),c={};typeof s<"u"&&(c.name=s),typeof r<"u"&&(c.permissions=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",h,u,c)}deleteFile(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0]};const o=t.bucketId,a=t.fileId;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const s="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",d,c,r)}getFileDownload(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0],token:i[1]};const o=t.bucketId,a=t.fileId,s=t.token;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const r="/storage/buckets/{bucketId}/files/{fileId}/download".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),d={};typeof s<"u"&&(d.token=s);const c=new URL(this.client.config.endpoint+r);d.project=this.client.config.project,d.impersonateuserid=this.client.config.impersonateuserid;for(const[h,u]of Object.entries(ge.flatten(d)))c.searchParams.append(h,u);return c.toString()}getFilePreview(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0],width:i[1],height:i[2],gravity:i[3],quality:i[4],borderWidth:i[5],borderColor:i[6],borderRadius:i[7],opacity:i[8],rotation:i[9],background:i[10],output:i[11],token:i[12]};const o=t.bucketId,a=t.fileId,s=t.width,r=t.height,d=t.gravity,c=t.quality,h=t.borderWidth,u=t.borderColor,m=t.borderRadius,j=t.opacity,q=t.rotation,T=t.background,W=t.output,K=t.token;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const _="/storage/buckets/{bucketId}/files/{fileId}/preview".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),H={};typeof s<"u"&&(H.width=s),typeof r<"u"&&(H.height=r),typeof d<"u"&&(H.gravity=d),typeof c<"u"&&(H.quality=c),typeof h<"u"&&(H.borderWidth=h),typeof u<"u"&&(H.borderColor=u),typeof m<"u"&&(H.borderRadius=m),typeof j<"u"&&(H.opacity=j),typeof q<"u"&&(H.rotation=q),typeof T<"u"&&(H.background=T),typeof W<"u"&&(H.output=W),typeof K<"u"&&(H.token=K);const Z=new URL(this.client.config.endpoint+_);H.project=this.client.config.project,H.impersonateuserid=this.client.config.impersonateuserid;for(const[oe,D]of Object.entries(ge.flatten(H)))Z.searchParams.append(oe,D);return Z.toString()}getFileView(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={bucketId:e,fileId:i[0],token:i[1]};const o=t.bucketId,a=t.fileId,s=t.token;if(typeof o>"u")throw new p('Missing required parameter: "bucketId"');if(typeof a>"u")throw new p('Missing required parameter: "fileId"');const r="/storage/buckets/{bucketId}/files/{fileId}/view".replace("{bucketId}",encodeURIComponent(String(o))).replace("{fileId}",encodeURIComponent(String(a))),d={};typeof s<"u"&&(d.token=s);const c=new URL(this.client.config.endpoint+r);d.project=this.client.config.project,d.impersonateuserid=this.client.config.impersonateuserid;for(const[h,u]of Object.entries(ge.flatten(d)))c.searchParams.append(h,u);return c.toString()}}class Fn{constructor(e){this.client=e}listTransactions(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={queries:e};const t=i.queries,o="/tablesdb/transactions",a={};typeof t<"u"&&(a.queries=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}createTransaction(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={ttl:e};const t=i.ttl,o="/tablesdb/transactions",a={};typeof t<"u"&&(a.ttl=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}getTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/tablesdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateTransaction(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,commit:i[0],rollback:i[1]};const o=t.transactionId,a=t.commit,s=t.rollback;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const r="/tablesdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.commit=a),typeof s<"u"&&(d.rollback=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/tablesdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createOperations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,operations:i[0]};const o=t.transactionId,a=t.operations;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const s="/tablesdb/transactions/{transactionId}/operations".replace("{transactionId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.operations=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}listRows(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.tableId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');const h="/tablesdb/{databaseId}/tables/{tableId}/rows".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",m,j,u)}createRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');if(typeof r>"u")throw new p('Missing required parameter: "data"');const h="/tablesdb/{databaseId}/tables/{tableId}/rows".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.rowId=s),typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}getRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],queries:i[2],transactionId:i[3]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.queries,d=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');const c="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))),h={};typeof r<"u"&&(h.queries=r),typeof d<"u"&&(h.transactionId=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",u,m,h)}upsertRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');const h="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",m,j,u)}updateRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');const h="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}deleteRow(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],transactionId:i[2]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');const d="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))),c={};typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",h,u,c)}decrementRowColumn(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],column:i[2],value:i[3],min:i[4],transactionId:i[5]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.column,d=t.value,c=t.min,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');if(typeof r>"u")throw new p('Missing required parameter: "column"');const u="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))).replace("{column}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.min=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),q={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,q,m)}incrementRowColumn(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,tableId:i[0],rowId:i[1],column:i[2],value:i[3],max:i[4],transactionId:i[5]};const o=t.databaseId,a=t.tableId,s=t.rowId,r=t.column,d=t.value,c=t.max,h=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "tableId"');if(typeof s>"u")throw new p('Missing required parameter: "rowId"');if(typeof r>"u")throw new p('Missing required parameter: "column"');const u="/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment".replace("{databaseId}",encodeURIComponent(String(o))).replace("{tableId}",encodeURIComponent(String(a))).replace("{rowId}",encodeURIComponent(String(s))).replace("{column}",encodeURIComponent(String(r))),m={};typeof d<"u"&&(m.value=d),typeof c<"u"&&(m.max=c),typeof h<"u"&&(m.transactionId=h);const j=new URL(this.client.config.endpoint+u),q={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",j,q,m)}}class eo{constructor(e){this.client=e}list(e,...i){let t;typeof e>"u"&&i.length===0||e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={queries:e,search:i[0],total:i[1]};const o=t.queries,a=t.search,s=t.total,r="/teams",d={};typeof o<"u"&&(d.queries=o),typeof a<"u"&&(d.search=a),typeof s<"u"&&(d.total=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}create(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,name:i[0],roles:i[1]};const o=t.teamId,a=t.name,s=t.roles;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "name"');const r="/teams",d={};typeof o<"u"&&(d.teamId=o),typeof a<"u"&&(d.name=a),typeof s<"u"&&(d.roles=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}get(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={teamId:e};const t=i.teamId;if(typeof t>"u")throw new p('Missing required parameter: "teamId"');const o="/teams/{teamId}".replace("{teamId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateName(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,name:i[0]};const o=t.teamId,a=t.name;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "name"');const s="/teams/{teamId}".replace("{teamId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.name=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}delete(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={teamId:e};const t=i.teamId;if(typeof t>"u")throw new p('Missing required parameter: "teamId"');const o="/teams/{teamId}".replace("{teamId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}listInstallations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,queries:i[0],total:i[1]};const o=t.teamId,a=t.queries,s=t.total;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');const r="/teams/{teamId}/installations".replace("{teamId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.queries=a),typeof s<"u"&&(d.total=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,h,d)}createInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,appId:i[0],authorizationDetails:i[1]};const o=t.teamId,a=t.appId,s=t.authorizationDetails;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "appId"');const r="/teams/{teamId}/installations".replace("{teamId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.appId=a),typeof s<"u"&&(d.authorizationDetails=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,h,d)}getInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,installationId:i[0]};const o=t.teamId,a=t.installationId;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "installationId"');const s="/teams/{teamId}/installations/{installationId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{installationId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}updateInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,installationId:i[0],authorizationDetails:i[1]};const o=t.teamId,a=t.installationId,s=t.authorizationDetails;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "installationId"');const r="/teams/{teamId}/installations/{installationId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{installationId}",encodeURIComponent(String(a))),d={};typeof s<"u"&&(d.authorizationDetails=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",c,h,d)}deleteInstallation(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,installationId:i[0]};const o=t.teamId,a=t.installationId;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "installationId"');const s="/teams/{teamId}/installations/{installationId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{installationId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("delete",d,c,r)}listMemberships(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,queries:i[0],search:i[1],total:i[2]};const o=t.teamId,a=t.queries,s=t.search,r=t.total;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');const d="/teams/{teamId}/memberships".replace("{teamId}",encodeURIComponent(String(o))),c={};typeof a<"u"&&(c.queries=a),typeof s<"u"&&(c.search=s),typeof r<"u"&&(c.total=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",h,u,c)}createMembership(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,roles:i[0],email:i[1],userId:i[2],phone:i[3],url:i[4],name:i[5]};const o=t.teamId,a=t.roles,s=t.email,r=t.userId,d=t.phone,c=t.url,h=t.name;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "roles"');const u="/teams/{teamId}/memberships".replace("{teamId}",encodeURIComponent(String(o))),m={};typeof s<"u"&&(m.email=s),typeof r<"u"&&(m.userId=r),typeof d<"u"&&(m.phone=d),typeof a<"u"&&(m.roles=a),typeof c<"u"&&(m.url=c),typeof h<"u"&&(m.name=h);const j=new URL(this.client.config.endpoint+u),q={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",j,q,m)}getMembership(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,membershipId:i[0]};const o=t.teamId,a=t.membershipId;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "membershipId"');const s="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{membershipId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",d,c,r)}updateMembership(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,membershipId:i[0],roles:i[1]};const o=t.teamId,a=t.membershipId,s=t.roles;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "membershipId"');if(typeof s>"u")throw new p('Missing required parameter: "roles"');const r="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{membershipId}",encodeURIComponent(String(a))),d={};typeof s<"u"&&(d.roles=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteMembership(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,membershipId:i[0]};const o=t.teamId,a=t.membershipId;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "membershipId"');const s="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",encodeURIComponent(String(o))).replace("{membershipId}",encodeURIComponent(String(a))),r={},d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",d,c,r)}updateMembershipStatus(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,membershipId:i[0],userId:i[1],secret:i[2]};const o=t.teamId,a=t.membershipId,s=t.userId,r=t.secret;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "membershipId"');if(typeof s>"u")throw new p('Missing required parameter: "userId"');if(typeof r>"u")throw new p('Missing required parameter: "secret"');const d="/teams/{teamId}/memberships/{membershipId}/status".replace("{teamId}",encodeURIComponent(String(o))).replace("{membershipId}",encodeURIComponent(String(a))),c={};typeof s<"u"&&(c.userId=s),typeof r<"u"&&(c.secret=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",h,u,c)}getPrefs(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={teamId:e};const t=i.teamId;if(typeof t>"u")throw new p('Missing required parameter: "teamId"');const o="/teams/{teamId}/prefs".replace("{teamId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updatePrefs(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={teamId:e,prefs:i[0]};const o=t.teamId,a=t.prefs;if(typeof o>"u")throw new p('Missing required parameter: "teamId"');if(typeof a>"u")throw new p('Missing required parameter: "prefs"');const s="/teams/{teamId}/prefs".replace("{teamId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.prefs=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",d,c,r)}}class to{constructor(e){this.client=e}listTransactions(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={queries:e};const t=i.queries,o="/vectorsdb/transactions",a={};typeof t<"u"&&(a.queries=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}createTransaction(e){let i;typeof e>"u"||e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={ttl:e};const t=i.ttl,o="/vectorsdb/transactions",a={};typeof t<"u"&&(a.ttl=t);const s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",s,r,a)}getTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/vectorsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",s,r,a)}updateTransaction(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,commit:i[0],rollback:i[1]};const o=t.transactionId,a=t.commit,s=t.rollback;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const r="/vectorsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(o))),d={};typeof a<"u"&&(d.commit=a),typeof s<"u"&&(d.rollback=s);const c=new URL(this.client.config.endpoint+r),h={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,h,d)}deleteTransaction(e){let i;e&&typeof e=="object"&&!Array.isArray(e)?i=e||{}:i={transactionId:e};const t=i.transactionId;if(typeof t>"u")throw new p('Missing required parameter: "transactionId"');const o="/vectorsdb/transactions/{transactionId}".replace("{transactionId}",encodeURIComponent(String(t))),a={},s=new URL(this.client.config.endpoint+o),r={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",s,r,a)}createOperations(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={transactionId:e,operations:i[0]};const o=t.transactionId,a=t.operations;if(typeof o>"u")throw new p('Missing required parameter: "transactionId"');const s="/vectorsdb/transactions/{transactionId}/operations".replace("{transactionId}",encodeURIComponent(String(o))),r={};typeof a<"u"&&(r.operations=a);const d=new URL(this.client.config.endpoint+s),c={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",d,c,r)}listDocuments(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.collectionId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",m,j,u)}createDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');if(typeof r>"u")throw new p('Missing required parameter: "data"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.documentId=s),typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}createQuery(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],queries:i[1],transactionId:i[2],total:i[3],ttl:i[4]};const o=t.databaseId,a=t.collectionId,s=t.queries,r=t.transactionId,d=t.total,c=t.ttl;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents/query".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))),u={};typeof s<"u"&&(u.queries=s),typeof r<"u"&&(u.transactionId=r),typeof d<"u"&&(u.total=d),typeof c<"u"&&(u.ttl=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",m,j,u)}getDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],queries:i[2],transactionId:i[3]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.queries,d=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const c="/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),h={};typeof r<"u"&&(h.queries=r),typeof d<"u"&&(h.transactionId=d);const u=new URL(this.client.config.endpoint+c),m={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",u,m,h)}upsertDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",m,j,u)}updateDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],data:i[2],permissions:i[3],transactionId:i[4]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.data,d=t.permissions,c=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const h="/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),u={};typeof r<"u"&&(u.data=r),typeof d<"u"&&(u.permissions=d),typeof c<"u"&&(u.transactionId=c);const m=new URL(this.client.config.endpoint+h),j={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",m,j,u)}deleteDocument(e,...i){let t;e&&typeof e=="object"&&!Array.isArray(e)?t=e||{}:t={databaseId:e,collectionId:i[0],documentId:i[1],transactionId:i[2]};const o=t.databaseId,a=t.collectionId,s=t.documentId,r=t.transactionId;if(typeof o>"u")throw new p('Missing required parameter: "databaseId"');if(typeof a>"u")throw new p('Missing required parameter: "collectionId"');if(typeof s>"u")throw new p('Missing required parameter: "documentId"');const d="/vectorsdb/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",encodeURIComponent(String(o))).replace("{collectionId}",encodeURIComponent(String(a))).replace("{documentId}",encodeURIComponent(String(s))),c={};typeof r<"u"&&(c.transactionId=r);const h=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",h,u,c)}}var bt;(function(n){n[n.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",n[n.POLICY_VIOLATION=1008]="POLICY_VIOLATION",n[n.UNKNOWN_ERROR=-1]="UNKNOWN_ERROR"})(bt||(bt={}));class io{constructor(e){this.TYPE_ERROR="error",this.TYPE_EVENT="event",this.TYPE_PONG="pong",this.TYPE_CONNECTED="connected",this.DEBOUNCE_MS=1,this.HEARTBEAT_INTERVAL=2e4,this.activeSubscriptions=new Map,this.pendingSubscribes=new Map,this.appConnected=!1,this.subCallDepth=0,this.reconnectAttempts=0,this.connectionId=0,this.reconnect=!0,this.onErrorCallbacks=[],this.onCloseCallbacks=[],this.onOpenCallbacks=[],this.client=e}onError(e){this.onErrorCallbacks.push(e)}onClose(e){this.onCloseCallbacks.push(e)}onOpen(e){this.onOpenCallbacks.push(e)}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=window?.setInterval(()=>{this.socket&&this.socket.readyState===WebSocket.OPEN&&this.socket.send(ye.stringify({type:"ping"}))},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatTimer&&(window?.clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}createSocket(){return be(this,void 0,void 0,function*(){if(!(this.socket&&this.socket.readyState<WebSocket.CLOSING))return this.socketCreationPromise?this.socketCreationPromise:(this.socketCreationPromise=this.createSocketLocked().finally(()=>{this.socketCreationPromise=void 0}),this.socketCreationPromise)})}createSocketLocked(){return be(this,void 0,void 0,function*(){if(this.activeSubscriptions.size===0&&!this.pendingPresence){this.reconnect=!1,yield this.closeSocket();return}const e=this.client.config.project;if(!e)throw new p("Missing project ID");let i=`project=${e}`;const t=this.client.config.jwt;t&&(i+=`&jwt=${encodeURIComponent(t)}`);const s=`${(this.client.config.endpointRealtime!==""?this.client.config.endpointRealtime:this.client.config.endpoint||"").replace("https://","wss://").replace("http://","ws://")}/realtime?${i}`;return this.socket&&(this.reconnect=!1,this.socket.readyState<WebSocket.CLOSING&&(yield this.closeSocket()),this.reconnect=!0),new Promise((r,d)=>{if(this.activeSubscriptions.size===0&&!this.pendingPresence){r();return}try{const c=++this.connectionId,h=this.socket=new WebSocket(s);h.addEventListener("open",()=>{c===this.connectionId&&(this.reconnectAttempts=0,this.onOpenCallbacks.forEach(u=>u()),this.startHeartbeat(),r())}),h.addEventListener("message",u=>{if(c===this.connectionId)try{const m=ye.parse(u.data);this.handleMessage(m)}catch(m){console.error("Failed to parse message:",m)}}),h.addEventListener("close",u=>be(this,void 0,void 0,function*(){if(c!==this.connectionId||h!==this.socket)return;if(this.appConnected=!1,this.stopHeartbeat(),this.onCloseCallbacks.forEach(j=>j()),!this.reconnect||u.code===bt.POLICY_VIOLATION){this.reconnect=!0;return}const m=this.getTimeout();console.log(`Realtime disconnected. Re-connecting in ${m/1e3} seconds.`),yield this.sleep(m),this.reconnectAttempts++;try{yield this.createSocket()}catch(j){console.error("Failed to reconnect:",j)}})),h.addEventListener("error",u=>{if(c!==this.connectionId||h!==this.socket)return;this.stopHeartbeat();const m=new Error("WebSocket error");console.error("WebSocket error:",m.message),this.onErrorCallbacks.forEach(j=>j(m)),d(m)})}catch(c){d(c)}})})}closeSocket(){return be(this,void 0,void 0,function*(){if(this.stopHeartbeat(),this.socket)return new Promise(e=>{if(!this.socket){e();return}this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING?(this.socket.addEventListener("close",()=>{e()},{once:!0}),this.socket.close(bt.NORMAL_CLOSURE)):e()})})}getTimeout(){return this.reconnectAttempts<5?1e3:this.reconnectAttempts<15?5e3:this.reconnectAttempts<100?1e4:6e4}sleep(e){return new Promise(i=>setTimeout(i,e))}sendUnsubscribeMessage(e){const i=e.filter(t=>typeof t=="string"&&t.length>0);i.length!==0&&(!this.socket||this.socket.readyState!==WebSocket.OPEN||this.socket.send(ye.stringify({type:"unsubscribe",data:i.map(t=>({subscriptionId:t}))})))}generateUniqueSubscriptionId(){const e=this.activeSubscriptions.size+1;for(let i=0;i<e;i++){const t=He.unique();if(!this.activeSubscriptions.has(t))return t}throw new p("Failed to generate unique subscription id")}enqueuePendingSubscribe(e){var i;const t=this.activeSubscriptions.get(e);t&&this.pendingSubscribes.set(e,{subscriptionId:e,channels:Array.from(t.channels),queries:(i=t.queries)!==null&&i!==void 0?i:[]})}disconnect(){return be(this,void 0,void 0,function*(){this.activeSubscriptions.clear(),this.pendingSubscribes.clear(),this.pendingPresence=void 0,this.appConnected=!1,this.reconnect=!1,this.socketCreationPromise=void 0,yield this.closeSocket()})}sendPendingSubscribes(){if(!this.socket||this.socket.readyState!==WebSocket.OPEN||!this.appConnected||this.pendingSubscribes.size<1)return;const e=Array.from(this.pendingSubscribes.values());this.pendingSubscribes.clear(),this.socket.send(ye.stringify({type:"subscribe",data:e}))}channelToString(e){return typeof e=="string"?e:e&&typeof e.toString=="function"?e.toString():String(e)}subscribe(e,i){return be(this,arguments,void 0,function*(t,o,a=[]){const r=(Array.isArray(t)?t:[t]).map(q=>this.channelToString(q)),d=new Set(r),c=[];for(const q of a??[])if(Array.isArray(q))for(const T of q)c.push(typeof T=="string"?T:T.toString());else c.push(typeof q=="string"?q:q.toString());const h=this.generateUniqueSubscriptionId();this.activeSubscriptions.set(h,{channels:d,queries:c,callback:o}),this.enqueuePendingSubscribe(h),this.subCallDepth++;try{yield this.sleep(this.DEBOUNCE_MS),this.subCallDepth===1&&(!this.socket||this.socket.readyState>WebSocket.OPEN?yield this.createSocket():this.socket.readyState===WebSocket.OPEN&&this.sendPendingSubscribes())}finally{this.subCallDepth--}const u=()=>be(this,void 0,void 0,function*(){this.activeSubscriptions.has(h)&&(this.activeSubscriptions.delete(h),this.pendingSubscribes.delete(h),this.sendUnsubscribeMessage([h]))});return{unsubscribe:u,update:q=>be(this,void 0,void 0,function*(){const T=this.activeSubscriptions.get(h);if(T){if(q.channels!==void 0){const W=q.channels.map(K=>this.channelToString(K));T.channels=new Set(W)}if(q.queries!==void 0){const W=[];for(const K of q.queries)if(Array.isArray(K))for(const _ of K)W.push(typeof _=="string"?_:_.toString());else W.push(typeof K=="string"?K:K.toString());T.queries=W}this.enqueuePendingSubscribe(h),this.subCallDepth++;try{yield this.sleep(this.DEBOUNCE_MS),this.subCallDepth===1&&(!this.socket||this.socket.readyState>WebSocket.OPEN?yield this.createSocket():this.socket.readyState===WebSocket.OPEN&&this.sendPendingSubscribes())}finally{this.subCallDepth--}}}),close:()=>be(this,void 0,void 0,function*(){yield u(),this.activeSubscriptions.size===0&&(this.reconnect=!1,yield this.closeSocket())})}})}upsertPresence(e){return be(this,void 0,void 0,function*(){const i={status:e.status,presenceId:e.presenceId};e.permissions!==void 0&&(i.permissions=e.permissions),e.metadata!==void 0&&(i.metadata=e.metadata),this.pendingPresence=i,(!this.socket||this.socket.readyState>=WebSocket.CLOSING)&&this.createSocket().catch(t=>{console.error("Failed to open realtime socket for presence:",t)}),this.flushPendingPresence()})}flushPendingPresence(){this.pendingPresence&&(!this.socket||this.socket.readyState!==WebSocket.OPEN||this.appConnected&&this.socket.send(ye.stringify({type:"presence",data:this.pendingPresence})))}handleMessage(e){if(e.type)switch(e.type){case this.TYPE_CONNECTED:this.handleResponseConnected(e);break;case this.TYPE_ERROR:this.handleResponseError(e);break;case this.TYPE_EVENT:this.handleResponseEvent(e);break;case this.TYPE_PONG:break}}handleResponseConnected(e){var i,t;if(!e.data)return;const o=e.data;let a=this.client.config.session;if(!a)try{const s=ye.parse((i=window.localStorage.getItem("cookieFallback"))!==null&&i!==void 0?i:"{}");a=s?.[`a_session_${this.client.config.project}`]}catch(s){console.error("Failed to parse cookie fallback:",s)}a&&!o.user&&((t=this.socket)===null||t===void 0||t.send(ye.stringify({type:"authentication",data:{session:a}})));for(const s of this.activeSubscriptions.keys())this.enqueuePendingSubscribe(s);this.appConnected=!0,this.sendPendingSubscribes(),this.flushPendingPresence()}handleResponseError(e){var i,t;const o=new p(((i=e.data)===null||i===void 0?void 0:i.message)||"Unknown error"),a=(t=e.data)===null||t===void 0?void 0:t.code;this.onErrorCallbacks.forEach(s=>s(o,a))}handleResponseEvent(e){const i=e.data;if(!i)return;const t=i.channels,o=i.events,a=i.payload,s=i.timestamp,r=i.subscriptions;if(!(!t||!o||!a||!r||r.length===0))for(const d of r){const c=this.activeSubscriptions.get(d);c&&c.callback({events:o,channels:t,timestamp:s,payload:a,subscriptions:r})}}}class Qe{}Qe.read=n=>`read("${n}")`,Qe.write=n=>`write("${n}")`,Qe.create=n=>`create("${n}")`,Qe.update=n=>`update("${n}")`,Qe.delete=n=>`delete("${n}")`;class no{static any(){return"any"}static user(e,i=""){return i===""?`user:${e}`:`user:${e}/${i}`}static users(e=""){return e===""?"users":`users/${e}`}static guests(){return"guests"}static team(e,i=""){return i===""?`team:${e}`:`team:${e}/${i}`}static member(e){return`member:${e}`}static label(e){return`label:${e}`}}function Re(n){if(n==null)throw new Error("Channel ID is required");const e=String(n).trim();if(e==="")throw new Error("Channel ID is required");return e}class ke{constructor(e){this.segments=e}next(e,i){const t=i===void 0?[...this.segments,e]:[...this.segments,e,Re(i)];return new ke(t)}resolve(e){return new ke([...this.segments,e])}toString(){return this.segments.join(".")}collection(e){return this.next("collections",e)}document(e){return this.next("documents",e)}table(e){return this.next("tables",e)}row(e){return this.next("rows",e)}file(e){return this.next("files",e)}create(){return this.resolve("create")}upsert(){return this.resolve("upsert")}update(){return this.resolve("update")}delete(){return this.resolve("delete")}static database(e){return new ke(["databases",Re(e)])}static execution(e){return new ke(["executions",Re(e)])}static tablesdb(e){return new ke(["tablesdb",Re(e)])}static bucket(e){return new ke(["buckets",Re(e)])}static function(e){return new ke(["functions",Re(e)])}static team(e){return new ke(["teams",Re(e)])}static membership(e){return new ke(["memberships",Re(e)])}static presence(e){return new ke(["presences",Re(e)])}static account(){return"account"}static documents(){return"documents"}static rows(){return"rows"}static files(){return"files"}static executions(){return"executions"}static teams(){return"teams"}static memberships(){return"memberships"}static presences(){return"presences"}}var Nt;(function(n){n.Equal="equal",n.NotEqual="notEqual",n.GreaterThan="greaterThan",n.GreaterThanEqual="greaterThanEqual",n.LessThan="lessThan",n.LessThanEqual="lessThanEqual",n.Contains="contains",n.IsNull="isNull",n.IsNotNull="isNotNull"})(Nt||(Nt={}));class Q{constructor(e,i){this.method=e,i!==void 0&&(Array.isArray(i)?this.values=i:this.values=[i])}toString(){return JSON.stringify({method:this.method,values:this.values})}}Q.increment=(n=1,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Value cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Max cannot be NaN or Infinity");const i=[n];return e!==void 0&&i.push(e),new Q("increment",i).toString()},Q.decrement=(n=1,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Value cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Min cannot be NaN or Infinity");const i=[n];return e!==void 0&&i.push(e),new Q("decrement",i).toString()},Q.multiply=(n,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Factor cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Max cannot be NaN or Infinity");const i=[n];return e!==void 0&&i.push(e),new Q("multiply",i).toString()},Q.divide=(n,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Divisor cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Min cannot be NaN or Infinity");if(n===0)throw new Error("Divisor cannot be zero");const i=[n];return e!==void 0&&i.push(e),new Q("divide",i).toString()},Q.modulo=n=>{if(isNaN(n)||!isFinite(n))throw new Error("Divisor cannot be NaN or Infinity");if(n===0)throw new Error("Divisor cannot be zero");return new Q("modulo",[n]).toString()},Q.power=(n,e)=>{if(isNaN(n)||!isFinite(n))throw new Error("Exponent cannot be NaN or Infinity");if(e!==void 0&&(isNaN(e)||!isFinite(e)))throw new Error("Max cannot be NaN or Infinity");const i=[n];return e!==void 0&&i.push(e),new Q("power",i).toString()},Q.arrayAppend=n=>new Q("arrayAppend",n).toString(),Q.arrayPrepend=n=>new Q("arrayPrepend",n).toString(),Q.arrayInsert=(n,e)=>new Q("arrayInsert",[n,e]).toString(),Q.arrayRemove=n=>new Q("arrayRemove",[n]).toString(),Q.arrayUnique=()=>new Q("arrayUnique",[]).toString(),Q.arrayIntersect=n=>new Q("arrayIntersect",n).toString(),Q.arrayDiff=n=>new Q("arrayDiff",n).toString(),Q.arrayFilter=(n,e)=>{const i=[n,e===void 0?null:e];return new Q("arrayFilter",i).toString()},Q.stringConcat=n=>new Q("stringConcat",[n]).toString(),Q.stringReplace=(n,e)=>new Q("stringReplace",[n,e]).toString(),Q.toggle=()=>new Q("toggle",[]).toString(),Q.dateAddDays=n=>new Q("dateAddDays",[n]).toString(),Q.dateSubDays=n=>new Q("dateSubDays",[n]).toString(),Q.dateSetNow=()=>new Q("dateSetNow",[]).toString();var Ht;(function(n){n.Totp="totp"})(Ht||(Ht={}));var Dt;(function(n){n.Email="email",n.Phone="phone",n.Totp="totp",n.Recoverycode="recoverycode",n.Custom="custom"})(Dt||(Dt={}));var Bt;(function(n){n.Amazon="amazon",n.Apple="apple",n.Appwrite="appwrite",n.Auth0="auth0",n.Authentik="authentik",n.Autodesk="autodesk",n.Bitbucket="bitbucket",n.Bitly="bitly",n.Box="box",n.Cloudflare="cloudflare",n.Dailymotion="dailymotion",n.Discord="discord",n.Disqus="disqus",n.Dropbox="dropbox",n.Etsy="etsy",n.Facebook="facebook",n.Figma="figma",n.Fusionauth="fusionauth",n.Github="github",n.Gitlab="gitlab",n.Google="google",n.Huggingface="huggingface",n.Keycloak="keycloak",n.Kick="kick",n.Linkedin="linkedin",n.Microsoft="microsoft",n.Notion="notion",n.Oidc="oidc",n.Okta="okta",n.Paypal="paypal",n.PaypalSandbox="paypalSandbox",n.Podio="podio",n.Resend="resend",n.Salesforce="salesforce",n.Slack="slack",n.Spotify="spotify",n.Stripe="stripe",n.Tradeshift="tradeshift",n.TradeshiftBox="tradeshiftBox",n.Twitch="twitch",n.Wordpress="wordpress",n.X="x",n.Yahoo="yahoo",n.Yammer="yammer",n.Yandex="yandex",n.Zoho="zoho",n.Zoom="zoom"})(Bt||(Bt={}));var Xt;(function(n){n.AvantBrowser="aa",n.AndroidWebViewBeta="an",n.GoogleChrome="ch",n.GoogleChromeIOS="ci",n.GoogleChromeMobile="cm",n.Chromium="cr",n.MozillaFirefox="ff",n.Safari="sf",n.MobileSafari="mf",n.MicrosoftEdge="ps",n.MicrosoftEdgeIOS="oi",n.OperaMini="om",n.Opera="op",n.OperaNext="on"})(Xt||(Xt={}));var Vt;(function(n){n.AmericanExpress="amex",n.Argencard="argencard",n.Cabal="cabal",n.Cencosud="cencosud",n.DinersClub="diners",n.Discover="discover",n.Elo="elo",n.Hipercard="hipercard",n.JCB="jcb",n.Mastercard="mastercard",n.Naranja="naranja",n.TarjetaShopping="targeta-shopping",n.UnionPay="unionpay",n.Visa="visa",n.MIR="mir",n.Maestro="maestro",n.Rupay="rupay"})(Vt||(Vt={}));var Wt;(function(n){n.Afghanistan="af",n.Angola="ao",n.Albania="al",n.Andorra="ad",n.UnitedArabEmirates="ae",n.Argentina="ar",n.Armenia="am",n.AntiguaAndBarbuda="ag",n.Australia="au",n.Austria="at",n.Azerbaijan="az",n.Burundi="bi",n.Belgium="be",n.Benin="bj",n.BurkinaFaso="bf",n.Bangladesh="bd",n.Bulgaria="bg",n.Bahrain="bh",n.Bahamas="bs",n.BosniaAndHerzegovina="ba",n.Belarus="by",n.Belize="bz",n.Bolivia="bo",n.Brazil="br",n.Barbados="bb",n.BruneiDarussalam="bn",n.Bhutan="bt",n.Botswana="bw",n.CentralAfricanRepublic="cf",n.Canada="ca",n.Switzerland="ch",n.Chile="cl",n.China="cn",n.CoteDIvoire="ci",n.Cameroon="cm",n.DemocraticRepublicOfTheCongo="cd",n.RepublicOfTheCongo="cg",n.Colombia="co",n.Comoros="km",n.CapeVerde="cv",n.CostaRica="cr",n.Cuba="cu",n.Cyprus="cy",n.CzechRepublic="cz",n.Germany="de",n.Djibouti="dj",n.Dominica="dm",n.Denmark="dk",n.DominicanRepublic="do",n.Algeria="dz",n.Ecuador="ec",n.Egypt="eg",n.Eritrea="er",n.Spain="es",n.Estonia="ee",n.Ethiopia="et",n.Finland="fi",n.Fiji="fj",n.France="fr",n.MicronesiaFederatedStatesOf="fm",n.Gabon="ga",n.UnitedKingdom="gb",n.Georgia="ge",n.Ghana="gh",n.Guinea="gn",n.Gambia="gm",n.GuineaBissau="gw",n.EquatorialGuinea="gq",n.Greece="gr",n.Grenada="gd",n.Guatemala="gt",n.Guyana="gy",n.Honduras="hn",n.Croatia="hr",n.Haiti="ht",n.Hungary="hu",n.Indonesia="id",n.India="in",n.Ireland="ie",n.IranIslamicRepublicOf="ir",n.Iraq="iq",n.Iceland="is",n.Israel="il",n.Italy="it",n.Jamaica="jm",n.Jordan="jo",n.Japan="jp",n.Kazakhstan="kz",n.Kenya="ke",n.Kyrgyzstan="kg",n.Cambodia="kh",n.Kiribati="ki",n.SaintKittsAndNevis="kn",n.SouthKorea="kr",n.Kuwait="kw",n.LaoPeopleSDemocraticRepublic="la",n.Lebanon="lb",n.Liberia="lr",n.Libya="ly",n.SaintLucia="lc",n.Liechtenstein="li",n.SriLanka="lk",n.Lesotho="ls",n.Lithuania="lt",n.Luxembourg="lu",n.Latvia="lv",n.Morocco="ma",n.Monaco="mc",n.Moldova="md",n.Madagascar="mg",n.Maldives="mv",n.Mexico="mx",n.MarshallIslands="mh",n.NorthMacedonia="mk",n.Mali="ml",n.Malta="mt",n.Myanmar="mm",n.Montenegro="me",n.Mongolia="mn",n.Mozambique="mz",n.Mauritania="mr",n.Mauritius="mu",n.Malawi="mw",n.Malaysia="my",n.Namibia="na",n.Niger="ne",n.Nigeria="ng",n.Nicaragua="ni",n.Netherlands="nl",n.Norway="no",n.Nepal="np",n.Nauru="nr",n.NewZealand="nz",n.Oman="om",n.Pakistan="pk",n.Panama="pa",n.Peru="pe",n.Philippines="ph",n.Palau="pw",n.PapuaNewGuinea="pg",n.Poland="pl",n.FrenchPolynesia="pf",n.NorthKorea="kp",n.Portugal="pt",n.Paraguay="py",n.Qatar="qa",n.Romania="ro",n.Russia="ru",n.Rwanda="rw",n.SaudiArabia="sa",n.Sudan="sd",n.Senegal="sn",n.Singapore="sg",n.SolomonIslands="sb",n.SierraLeone="sl",n.ElSalvador="sv",n.SanMarino="sm",n.Somalia="so",n.Serbia="rs",n.SouthSudan="ss",n.SaoTomeAndPrincipe="st",n.Suriname="sr",n.Slovakia="sk",n.Slovenia="si",n.Sweden="se",n.Eswatini="sz",n.Seychelles="sc",n.Syria="sy",n.Chad="td",n.Togo="tg",n.Thailand="th",n.Tajikistan="tj",n.Turkmenistan="tm",n.TimorLeste="tl",n.Tonga="to",n.TrinidadAndTobago="tt",n.Tunisia="tn",n.Turkey="tr",n.Tuvalu="tv",n.Tanzania="tz",n.Uganda="ug",n.Ukraine="ua",n.Uruguay="uy",n.UnitedStates="us",n.Uzbekistan="uz",n.VaticanCity="va",n.SaintVincentAndTheGrenadines="vc",n.Venezuela="ve",n.Vietnam="vn",n.Vanuatu="vu",n.Samoa="ws",n.Yemen="ye",n.SouthAfrica="za",n.Zambia="zm",n.Zimbabwe="zw"})(Wt||(Wt={}));var Gt;(function(n){n.Light="light",n.Dark="dark"})(Gt||(Gt={}));var Kt;(function(n){n.AfricaAbidjan="africa/abidjan",n.AfricaAccra="africa/accra",n.AfricaAddisAbaba="africa/addis_ababa",n.AfricaAlgiers="africa/algiers",n.AfricaAsmara="africa/asmara",n.AfricaBamako="africa/bamako",n.AfricaBangui="africa/bangui",n.AfricaBanjul="africa/banjul",n.AfricaBissau="africa/bissau",n.AfricaBlantyre="africa/blantyre",n.AfricaBrazzaville="africa/brazzaville",n.AfricaBujumbura="africa/bujumbura",n.AfricaCairo="africa/cairo",n.AfricaCasablanca="africa/casablanca",n.AfricaCeuta="africa/ceuta",n.AfricaConakry="africa/conakry",n.AfricaDakar="africa/dakar",n.AfricaDarEsSalaam="africa/dar_es_salaam",n.AfricaDjibouti="africa/djibouti",n.AfricaDouala="africa/douala",n.AfricaElAaiun="africa/el_aaiun",n.AfricaFreetown="africa/freetown",n.AfricaGaborone="africa/gaborone",n.AfricaHarare="africa/harare",n.AfricaJohannesburg="africa/johannesburg",n.AfricaJuba="africa/juba",n.AfricaKampala="africa/kampala",n.AfricaKhartoum="africa/khartoum",n.AfricaKigali="africa/kigali",n.AfricaKinshasa="africa/kinshasa",n.AfricaLagos="africa/lagos",n.AfricaLibreville="africa/libreville",n.AfricaLome="africa/lome",n.AfricaLuanda="africa/luanda",n.AfricaLubumbashi="africa/lubumbashi",n.AfricaLusaka="africa/lusaka",n.AfricaMalabo="africa/malabo",n.AfricaMaputo="africa/maputo",n.AfricaMaseru="africa/maseru",n.AfricaMbabane="africa/mbabane",n.AfricaMogadishu="africa/mogadishu",n.AfricaMonrovia="africa/monrovia",n.AfricaNairobi="africa/nairobi",n.AfricaNdjamena="africa/ndjamena",n.AfricaNiamey="africa/niamey",n.AfricaNouakchott="africa/nouakchott",n.AfricaOuagadougou="africa/ouagadougou",n.AfricaPortonovo="africa/porto-novo",n.AfricaSaoTome="africa/sao_tome",n.AfricaTripoli="africa/tripoli",n.AfricaTunis="africa/tunis",n.AfricaWindhoek="africa/windhoek",n.AmericaAdak="america/adak",n.AmericaAnchorage="america/anchorage",n.AmericaAnguilla="america/anguilla",n.AmericaAntigua="america/antigua",n.AmericaAraguaina="america/araguaina",n.AmericaArgentinaBuenosAires="america/argentina/buenos_aires",n.AmericaArgentinaCatamarca="america/argentina/catamarca",n.AmericaArgentinaCordoba="america/argentina/cordoba",n.AmericaArgentinaJujuy="america/argentina/jujuy",n.AmericaArgentinaLaRioja="america/argentina/la_rioja",n.AmericaArgentinaMendoza="america/argentina/mendoza",n.AmericaArgentinaRioGallegos="america/argentina/rio_gallegos",n.AmericaArgentinaSalta="america/argentina/salta",n.AmericaArgentinaSanJuan="america/argentina/san_juan",n.AmericaArgentinaSanLuis="america/argentina/san_luis",n.AmericaArgentinaTucuman="america/argentina/tucuman",n.AmericaArgentinaUshuaia="america/argentina/ushuaia",n.AmericaAruba="america/aruba",n.AmericaAsuncion="america/asuncion",n.AmericaAtikokan="america/atikokan",n.AmericaBahia="america/bahia",n.AmericaBahiaBanderas="america/bahia_banderas",n.AmericaBarbados="america/barbados",n.AmericaBelem="america/belem",n.AmericaBelize="america/belize",n.AmericaBlancsablon="america/blanc-sablon",n.AmericaBoaVista="america/boa_vista",n.AmericaBogota="america/bogota",n.AmericaBoise="america/boise",n.AmericaCambridgeBay="america/cambridge_bay",n.AmericaCampoGrande="america/campo_grande",n.AmericaCancun="america/cancun",n.AmericaCaracas="america/caracas",n.AmericaCayenne="america/cayenne",n.AmericaCayman="america/cayman",n.AmericaChicago="america/chicago",n.AmericaChihuahua="america/chihuahua",n.AmericaCiudadJuarez="america/ciudad_juarez",n.AmericaCostaRica="america/costa_rica",n.AmericaCoyhaique="america/coyhaique",n.AmericaCreston="america/creston",n.AmericaCuiaba="america/cuiaba",n.AmericaCuracao="america/curacao",n.AmericaDanmarkshavn="america/danmarkshavn",n.AmericaDawson="america/dawson",n.AmericaDawsonCreek="america/dawson_creek",n.AmericaDenver="america/denver",n.AmericaDetroit="america/detroit",n.AmericaDominica="america/dominica",n.AmericaEdmonton="america/edmonton",n.AmericaEirunepe="america/eirunepe",n.AmericaElSalvador="america/el_salvador",n.AmericaFortNelson="america/fort_nelson",n.AmericaFortaleza="america/fortaleza",n.AmericaGlaceBay="america/glace_bay",n.AmericaGooseBay="america/goose_bay",n.AmericaGrandTurk="america/grand_turk",n.AmericaGrenada="america/grenada",n.AmericaGuadeloupe="america/guadeloupe",n.AmericaGuatemala="america/guatemala",n.AmericaGuayaquil="america/guayaquil",n.AmericaGuyana="america/guyana",n.AmericaHalifax="america/halifax",n.AmericaHavana="america/havana",n.AmericaHermosillo="america/hermosillo",n.AmericaIndianaIndianapolis="america/indiana/indianapolis",n.AmericaIndianaKnox="america/indiana/knox",n.AmericaIndianaMarengo="america/indiana/marengo",n.AmericaIndianaPetersburg="america/indiana/petersburg",n.AmericaIndianaTellCity="america/indiana/tell_city",n.AmericaIndianaVevay="america/indiana/vevay",n.AmericaIndianaVincennes="america/indiana/vincennes",n.AmericaIndianaWinamac="america/indiana/winamac",n.AmericaInuvik="america/inuvik",n.AmericaIqaluit="america/iqaluit",n.AmericaJamaica="america/jamaica",n.AmericaJuneau="america/juneau",n.AmericaKentuckyLouisville="america/kentucky/louisville",n.AmericaKentuckyMonticello="america/kentucky/monticello",n.AmericaKralendijk="america/kralendijk",n.AmericaLaPaz="america/la_paz",n.AmericaLima="america/lima",n.AmericaLosAngeles="america/los_angeles",n.AmericaLowerPrinces="america/lower_princes",n.AmericaMaceio="america/maceio",n.AmericaManagua="america/managua",n.AmericaManaus="america/manaus",n.AmericaMarigot="america/marigot",n.AmericaMartinique="america/martinique",n.AmericaMatamoros="america/matamoros",n.AmericaMazatlan="america/mazatlan",n.AmericaMenominee="america/menominee",n.AmericaMerida="america/merida",n.AmericaMetlakatla="america/metlakatla",n.AmericaMexicoCity="america/mexico_city",n.AmericaMiquelon="america/miquelon",n.AmericaMoncton="america/moncton",n.AmericaMonterrey="america/monterrey",n.AmericaMontevideo="america/montevideo",n.AmericaMontserrat="america/montserrat",n.AmericaNassau="america/nassau",n.AmericaNewYork="america/new_york",n.AmericaNome="america/nome",n.AmericaNoronha="america/noronha",n.AmericaNorthDakotaBeulah="america/north_dakota/beulah",n.AmericaNorthDakotaCenter="america/north_dakota/center",n.AmericaNorthDakotaNewSalem="america/north_dakota/new_salem",n.AmericaNuuk="america/nuuk",n.AmericaOjinaga="america/ojinaga",n.AmericaPanama="america/panama",n.AmericaParamaribo="america/paramaribo",n.AmericaPhoenix="america/phoenix",n.AmericaPortauprince="america/port-au-prince",n.AmericaPortOfSpain="america/port_of_spain",n.AmericaPortoVelho="america/porto_velho",n.AmericaPuertoRico="america/puerto_rico",n.AmericaPuntaArenas="america/punta_arenas",n.AmericaRankinInlet="america/rankin_inlet",n.AmericaRecife="america/recife",n.AmericaRegina="america/regina",n.AmericaResolute="america/resolute",n.AmericaRioBranco="america/rio_branco",n.AmericaSantarem="america/santarem",n.AmericaSantiago="america/santiago",n.AmericaSantoDomingo="america/santo_domingo",n.AmericaSaoPaulo="america/sao_paulo",n.AmericaScoresbysund="america/scoresbysund",n.AmericaSitka="america/sitka",n.AmericaStBarthelemy="america/st_barthelemy",n.AmericaStJohns="america/st_johns",n.AmericaStKitts="america/st_kitts",n.AmericaStLucia="america/st_lucia",n.AmericaStThomas="america/st_thomas",n.AmericaStVincent="america/st_vincent",n.AmericaSwiftCurrent="america/swift_current",n.AmericaTegucigalpa="america/tegucigalpa",n.AmericaThule="america/thule",n.AmericaTijuana="america/tijuana",n.AmericaToronto="america/toronto",n.AmericaTortola="america/tortola",n.AmericaVancouver="america/vancouver",n.AmericaWhitehorse="america/whitehorse",n.AmericaWinnipeg="america/winnipeg",n.AmericaYakutat="america/yakutat",n.AntarcticaCasey="antarctica/casey",n.AntarcticaDavis="antarctica/davis",n.AntarcticaDumontdurville="antarctica/dumontdurville",n.AntarcticaMacquarie="antarctica/macquarie",n.AntarcticaMawson="antarctica/mawson",n.AntarcticaMcmurdo="antarctica/mcmurdo",n.AntarcticaPalmer="antarctica/palmer",n.AntarcticaRothera="antarctica/rothera",n.AntarcticaSyowa="antarctica/syowa",n.AntarcticaTroll="antarctica/troll",n.AntarcticaVostok="antarctica/vostok",n.ArcticLongyearbyen="arctic/longyearbyen",n.AsiaAden="asia/aden",n.AsiaAlmaty="asia/almaty",n.AsiaAmman="asia/amman",n.AsiaAnadyr="asia/anadyr",n.AsiaAqtau="asia/aqtau",n.AsiaAqtobe="asia/aqtobe",n.AsiaAshgabat="asia/ashgabat",n.AsiaAtyrau="asia/atyrau",n.AsiaBaghdad="asia/baghdad",n.AsiaBahrain="asia/bahrain",n.AsiaBaku="asia/baku",n.AsiaBangkok="asia/bangkok",n.AsiaBarnaul="asia/barnaul",n.AsiaBeirut="asia/beirut",n.AsiaBishkek="asia/bishkek",n.AsiaBrunei="asia/brunei",n.AsiaChita="asia/chita",n.AsiaColombo="asia/colombo",n.AsiaDamascus="asia/damascus",n.AsiaDhaka="asia/dhaka",n.AsiaDili="asia/dili",n.AsiaDubai="asia/dubai",n.AsiaDushanbe="asia/dushanbe",n.AsiaFamagusta="asia/famagusta",n.AsiaGaza="asia/gaza",n.AsiaHebron="asia/hebron",n.AsiaHoChiMinh="asia/ho_chi_minh",n.AsiaHongKong="asia/hong_kong",n.AsiaHovd="asia/hovd",n.AsiaIrkutsk="asia/irkutsk",n.AsiaJakarta="asia/jakarta",n.AsiaJayapura="asia/jayapura",n.AsiaJerusalem="asia/jerusalem",n.AsiaKabul="asia/kabul",n.AsiaKamchatka="asia/kamchatka",n.AsiaKarachi="asia/karachi",n.AsiaKathmandu="asia/kathmandu",n.AsiaKhandyga="asia/khandyga",n.AsiaKolkata="asia/kolkata",n.AsiaKrasnoyarsk="asia/krasnoyarsk",n.AsiaKualaLumpur="asia/kuala_lumpur",n.AsiaKuching="asia/kuching",n.AsiaKuwait="asia/kuwait",n.AsiaMacau="asia/macau",n.AsiaMagadan="asia/magadan",n.AsiaMakassar="asia/makassar",n.AsiaManila="asia/manila",n.AsiaMuscat="asia/muscat",n.AsiaNicosia="asia/nicosia",n.AsiaNovokuznetsk="asia/novokuznetsk",n.AsiaNovosibirsk="asia/novosibirsk",n.AsiaOmsk="asia/omsk",n.AsiaOral="asia/oral",n.AsiaPhnomPenh="asia/phnom_penh",n.AsiaPontianak="asia/pontianak",n.AsiaPyongyang="asia/pyongyang",n.AsiaQatar="asia/qatar",n.AsiaQostanay="asia/qostanay",n.AsiaQyzylorda="asia/qyzylorda",n.AsiaRiyadh="asia/riyadh",n.AsiaSakhalin="asia/sakhalin",n.AsiaSamarkand="asia/samarkand",n.AsiaSeoul="asia/seoul",n.AsiaShanghai="asia/shanghai",n.AsiaSingapore="asia/singapore",n.AsiaSrednekolymsk="asia/srednekolymsk",n.AsiaTaipei="asia/taipei",n.AsiaTashkent="asia/tashkent",n.AsiaTbilisi="asia/tbilisi",n.AsiaTehran="asia/tehran",n.AsiaThimphu="asia/thimphu",n.AsiaTokyo="asia/tokyo",n.AsiaTomsk="asia/tomsk",n.AsiaUlaanbaatar="asia/ulaanbaatar",n.AsiaUrumqi="asia/urumqi",n.AsiaUstnera="asia/ust-nera",n.AsiaVientiane="asia/vientiane",n.AsiaVladivostok="asia/vladivostok",n.AsiaYakutsk="asia/yakutsk",n.AsiaYangon="asia/yangon",n.AsiaYekaterinburg="asia/yekaterinburg",n.AsiaYerevan="asia/yerevan",n.AtlanticAzores="atlantic/azores",n.AtlanticBermuda="atlantic/bermuda",n.AtlanticCanary="atlantic/canary",n.AtlanticCapeVerde="atlantic/cape_verde",n.AtlanticFaroe="atlantic/faroe",n.AtlanticMadeira="atlantic/madeira",n.AtlanticReykjavik="atlantic/reykjavik",n.AtlanticSouthGeorgia="atlantic/south_georgia",n.AtlanticStHelena="atlantic/st_helena",n.AtlanticStanley="atlantic/stanley",n.AustraliaAdelaide="australia/adelaide",n.AustraliaBrisbane="australia/brisbane",n.AustraliaBrokenHill="australia/broken_hill",n.AustraliaDarwin="australia/darwin",n.AustraliaEucla="australia/eucla",n.AustraliaHobart="australia/hobart",n.AustraliaLindeman="australia/lindeman",n.AustraliaLordHowe="australia/lord_howe",n.AustraliaMelbourne="australia/melbourne",n.AustraliaPerth="australia/perth",n.AustraliaSydney="australia/sydney",n.EuropeAmsterdam="europe/amsterdam",n.EuropeAndorra="europe/andorra",n.EuropeAstrakhan="europe/astrakhan",n.EuropeAthens="europe/athens",n.EuropeBelgrade="europe/belgrade",n.EuropeBerlin="europe/berlin",n.EuropeBratislava="europe/bratislava",n.EuropeBrussels="europe/brussels",n.EuropeBucharest="europe/bucharest",n.EuropeBudapest="europe/budapest",n.EuropeBusingen="europe/busingen",n.EuropeChisinau="europe/chisinau",n.EuropeCopenhagen="europe/copenhagen",n.EuropeDublin="europe/dublin",n.EuropeGibraltar="europe/gibraltar",n.EuropeGuernsey="europe/guernsey",n.EuropeHelsinki="europe/helsinki",n.EuropeIsleOfMan="europe/isle_of_man",n.EuropeIstanbul="europe/istanbul",n.EuropeJersey="europe/jersey",n.EuropeKaliningrad="europe/kaliningrad",n.EuropeKirov="europe/kirov",n.EuropeKyiv="europe/kyiv",n.EuropeLisbon="europe/lisbon",n.EuropeLjubljana="europe/ljubljana",n.EuropeLondon="europe/london",n.EuropeLuxembourg="europe/luxembourg",n.EuropeMadrid="europe/madrid",n.EuropeMalta="europe/malta",n.EuropeMariehamn="europe/mariehamn",n.EuropeMinsk="europe/minsk",n.EuropeMonaco="europe/monaco",n.EuropeMoscow="europe/moscow",n.EuropeOslo="europe/oslo",n.EuropeParis="europe/paris",n.EuropePodgorica="europe/podgorica",n.EuropePrague="europe/prague",n.EuropeRiga="europe/riga",n.EuropeRome="europe/rome",n.EuropeSamara="europe/samara",n.EuropeSanMarino="europe/san_marino",n.EuropeSarajevo="europe/sarajevo",n.EuropeSaratov="europe/saratov",n.EuropeSimferopol="europe/simferopol",n.EuropeSkopje="europe/skopje",n.EuropeSofia="europe/sofia",n.EuropeStockholm="europe/stockholm",n.EuropeTallinn="europe/tallinn",n.EuropeTirane="europe/tirane",n.EuropeUlyanovsk="europe/ulyanovsk",n.EuropeVaduz="europe/vaduz",n.EuropeVatican="europe/vatican",n.EuropeVienna="europe/vienna",n.EuropeVilnius="europe/vilnius",n.EuropeVolgograd="europe/volgograd",n.EuropeWarsaw="europe/warsaw",n.EuropeZagreb="europe/zagreb",n.EuropeZurich="europe/zurich",n.IndianAntananarivo="indian/antananarivo",n.IndianChagos="indian/chagos",n.IndianChristmas="indian/christmas",n.IndianCocos="indian/cocos",n.IndianComoro="indian/comoro",n.IndianKerguelen="indian/kerguelen",n.IndianMahe="indian/mahe",n.IndianMaldives="indian/maldives",n.IndianMauritius="indian/mauritius",n.IndianMayotte="indian/mayotte",n.IndianReunion="indian/reunion",n.PacificApia="pacific/apia",n.PacificAuckland="pacific/auckland",n.PacificBougainville="pacific/bougainville",n.PacificChatham="pacific/chatham",n.PacificChuuk="pacific/chuuk",n.PacificEaster="pacific/easter",n.PacificEfate="pacific/efate",n.PacificFakaofo="pacific/fakaofo",n.PacificFiji="pacific/fiji",n.PacificFunafuti="pacific/funafuti",n.PacificGalapagos="pacific/galapagos",n.PacificGambier="pacific/gambier",n.PacificGuadalcanal="pacific/guadalcanal",n.PacificGuam="pacific/guam",n.PacificHonolulu="pacific/honolulu",n.PacificKanton="pacific/kanton",n.PacificKiritimati="pacific/kiritimati",n.PacificKosrae="pacific/kosrae",n.PacificKwajalein="pacific/kwajalein",n.PacificMajuro="pacific/majuro",n.PacificMarquesas="pacific/marquesas",n.PacificMidway="pacific/midway",n.PacificNauru="pacific/nauru",n.PacificNiue="pacific/niue",n.PacificNorfolk="pacific/norfolk",n.PacificNoumea="pacific/noumea",n.PacificPagoPago="pacific/pago_pago",n.PacificPalau="pacific/palau",n.PacificPitcairn="pacific/pitcairn",n.PacificPohnpei="pacific/pohnpei",n.PacificPortMoresby="pacific/port_moresby",n.PacificRarotonga="pacific/rarotonga",n.PacificSaipan="pacific/saipan",n.PacificTahiti="pacific/tahiti",n.PacificTarawa="pacific/tarawa",n.PacificTongatapu="pacific/tongatapu",n.PacificWake="pacific/wake",n.PacificWallis="pacific/wallis",n.Utc="utc"})(Kt||(Kt={}));var Jt;(function(n){n.Geolocation="geolocation",n.Camera="camera",n.Microphone="microphone",n.Notifications="notifications",n.Midi="midi",n.Push="push",n.Clipboardread="clipboard-read",n.Clipboardwrite="clipboard-write",n.Paymenthandler="payment-handler",n.Usb="usb",n.Bluetooth="bluetooth",n.Accelerometer="accelerometer",n.Gyroscope="gyroscope",n.Magnetometer="magnetometer",n.Ambientlightsensor="ambient-light-sensor",n.Backgroundsync="background-sync",n.Persistentstorage="persistent-storage",n.Screenwakelock="screen-wake-lock",n.Webshare="web-share",n.Xrspatialtracking="xr-spatial-tracking"})(Jt||(Jt={}));var Yt;(function(n){n.Jpg="jpg",n.Jpeg="jpeg",n.Png="png",n.Webp="webp",n.Heic="heic",n.Avif="avif",n.Gif="gif"})(Yt||(Yt={}));var Zt;(function(n){n.GET="GET",n.POST="POST",n.PUT="PUT",n.PATCH="PATCH",n.DELETE="DELETE",n.OPTIONS="OPTIONS",n.HEAD="HEAD"})(Zt||(Zt={}));var Qt;(function(n){n.Auto="auto",n.Center="center",n.Topleft="top-left",n.Top="top",n.Topright="top-right",n.Left="left",n.Right="right",n.Bottomleft="bottom-left",n.Bottom="bottom",n.Bottomright="bottom-right"})(Qt||(Qt={}));var Tt;(function(n){n.Functions="functions",n.Sites="sites"})(Tt||(Tt={}));var zt;(function(n){n.Http="http",n.Schedule="schedule",n.Event="event"})(zt||(zt={}));var Ot;(function(n){n.Waiting="waiting",n.Processing="processing",n.Completed="completed",n.Failed="failed",n.Scheduled="scheduled"})(Ot||(Ot={}));const oo=Object.freeze(Object.defineProperty({__proto__:null,Account:Lt,AppwriteException:p,get AuthenticationFactor(){return Dt},get AuthenticatorType(){return Ht},Avatars:xi,get Browser(){return Xt},get BrowserPermission(){return Jt},get BrowserTheme(){return Gt},Channel:ke,Client:Ae,get Condition(){return Nt},get CreditCard(){return Vt},Databases:Gn,DocumentsDB:Kn,get ExecutionMethod(){return Zt},get ExecutionResourceType(){return Tt},get ExecutionStatus(){return Ot},get ExecutionTrigger(){return zt},get Flag(){return Wt},Functions:Jn,Graphql:Yn,ID:He,get ImageFormat(){return Yt},get ImageGravity(){return Qt},Locale:Zn,Messaging:Qn,get OAuthProvider(){return Bt},Operator:Q,Organization:Tn,Permission:Qe,Presences:zn,Query:U,Realtime:io,Role:no,Storage:On,TablesDB:Fn,Teams:eo,get Timezone(){return Kt},VectorsDB:to},Symbol.toStringTag,{value:"Module"})),_i={signIn:"Sign in",dialogSignIn:"Sign in",signUp:"Sign up",signOut:"Sign out",continueAsGuest:"Continue as guest",email:"Email",password:"Password",showPassword:"Show password",hidePassword:"Hide 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",resendCode:"Resend code",useDifferentEmail:"Use a different email",useDifferentPhone:"Use a different phone number",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",requestNewLink:"Request a new 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",verificationResendIn:"Sent. You can resend in {seconds} s",verificationSent:"Verification email sent. Check your inbox.",emailVerified:"Your email is verified.",changePassword:"Change password",currentPassword:"Current password",twoFactor:"Two-factor authentication",mfaBadge:"MFA",twoFactorDescription:"Require a second factor when signing in to this account.",mfaNoFactorWarning:"Turn on an authenticator, or verify your email or phone, before enabling two-factor authentication. Without a factor, this setting does not protect the 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.",qrCodeAlt:"QR code",authenticatorManual:"Or enter this key manually",authenticatorCopyKey:"Copy key",authenticatorVerify:"Verify and enable",recoveryCodes:"Recovery codes",viewRecoveryCodes:"View recovery codes",recoveryCodesDescription:"Use a recovery code to sign in if you lose access to your other factors.",recoveryCodesOnceHint:"Recovery codes can be viewed only once after they are generated. Viewing them again requires a recent second factor.",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",connectProvider:"Connect {provider}",noActivity:"No recent activity.",noSessions:"No active sessions.",deleteAccount:"Delete account",deleteAccountDescription:"Deleting disables your account and signs you out everywhere. An administrator can restore it.",deleteAccountConfirm:"Delete my account",loading:"Loading",copied:"Copied",copyFailed:"Could not copy. Select the text and copy it manually.",copy:"Copy",done:"Done",nameUpdated:"Name updated.",emailUpdated:"Email updated. Verify the new address.",phoneUpdated:"Phone number updated.",phoneVerified:"Phone verified.",authenticatorAdded:"Authenticator added.",accountConverted:"Account created.",enabled:"Enabled",disabled:"Disabled",createPassword:"Create a password",createPasswordHint:"This becomes your sign-in password.",errorCurrentPassword:"Current password is incorrect.",errorGeneric:"Something went wrong. Please try again.",errorInvalidCredentials:"Invalid email or password.",errorInvalidEmail:"Enter a valid email address.",errorInvalidPassword:"Password must be between 8 and 256 characters.",errorInvalidPhone:"Enter a phone number in E.164 format, starting with +.",errorInvalidName:"Enter a name.",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",dialogAccount:"Account",continue:"Continue",provider:"Provider",lastActive:"Last active",guestAccount:"Guest account",guestAccountDescription:"Add an email and password to keep your data.",preview:"Preview"};function ao(n,e={}){return n.replace(/\{(\w+)\}/g,(i,t)=>t in e?String(e[t]):`{${t}}`)}const so={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 Te(n){return so[n]??n.charAt(0).toUpperCase()+n.slice(1)}const It=(n,e,i=401)=>Object.assign(new Error(e),{type:n,code:i}),Pe=()=>new Date().toISOString(),Ee=n=>new Date(Date.now()-n*6e4).toISOString(),vt=["amber","brave","calm","delta","ember","fable","glide","harbor","ivory","juniper","kite","lumen"],Li=()=>`${vt[Math.floor(Math.random()*vt.length)]}-${vt[Math.floor(Math.random()*vt.length)]}`,ze=()=>Math.random().toString(36).slice(2,12),Ni=()=>Array.from({length:2},()=>Math.random().toString(36).slice(2,7)).join("-"),ro={name:"Ada Lovelace",email:"ada@example.com",phone:"+15550100"};class Hi{constructor(e=ro){this.seed=e,this.user=null,this.mfaPending=!1,this.mfaEnabled=!1,this.totpEnrolled=!1,this.recoveryCodes=[],this.lastChallenge=0,this.sessions=[],this.identities=[],this.logs=[],this.tokens=new Map,this.pendingAuthenticator=null}makeUser(e={}){const i=e.anonymous??!1;return this.user={$id:"preview-user",$createdAt:Ee(43200),$updatedAt:Pe(),name:i?"":e.name??this.seed.name,registration:Ee(43200),status:!0,labels:[],passwordUpdate:i?"":Ee(10080),email:i?"":e.email??this.seed.email,phone:i?"":e.phone??this.seed.phone,emailVerification:!i,phoneVerification:!1,mfa:this.mfaEnabled,prefs:{},targets:[],accessedAt:Pe()},this.seedActivity(i?"anonymous":"email"),this.user}seedActivity(e){if(this.sessions.length>0)return;const i={$createdAt:Pe(),$updatedAt:Pe(),userId:"preview-user",expire:new Date(Date.now()+365*864e5).toISOString(),providerUid:"",providerAccessToken:"",providerAccessTokenExpiry:"",providerRefreshToken:"",clientType:"browser",clientCode:"CH",clientEngine:"Blink",clientEngineVersion:"128",deviceName:"desktop",deviceBrand:"",deviceModel:"",factors:["password"],secret:"",mfaUpdatedAt:""};this.sessions=[{...i,$id:"current",provider:e,ip:"203.0.113.24",osCode:"MAC",osName:"macOS",osVersion:"15",clientName:"Chrome",clientVersion:"128",countryCode:"de",countryName:"Germany",current:!0},{...i,$id:ze(),$createdAt:Ee(300),provider:e,ip:"198.51.100.7",osCode:"IOS",osName:"iOS",osVersion:"18",clientName:"Safari",clientVersion:"18",clientType:"browser",deviceName:"smartphone",countryCode:"de",countryName:"Germany",current:!1},{...i,$id:ze(),$createdAt:Ee(4320),provider:"oauth2",ip:"192.0.2.90",osCode:"WIN",osName:"Windows",osVersion:"11",clientName:"Firefox",clientVersion:"130",countryCode:"us",countryName:"United States",current:!1}],this.identities=[{$id:"identity-github",$createdAt:Ee(28800),$updatedAt:Ee(28800),userId:"preview-user",provider:"github",providerUid:"8675309",providerEmail:this.seed.email,providerAccessToken:"",providerAccessTokenExpiry:"",providerRefreshToken:""}],this.logs=[{event:"session.create",time:Pe(),clientName:"Chrome",osName:"macOS",countryName:"Germany",ip:"203.0.113.24"},{event:"user.update.name",time:Ee(2880),clientName:"Safari",osName:"iOS",countryName:"Germany",ip:"198.51.100.7"},{event:"session.create",time:Ee(4320),clientName:"Firefox",osName:"Windows",countryName:"United States",ip:"192.0.2.90"}]}requireUser(){if(!this.user)throw It("general_unauthorized_scope","User (role: guests) missing scope (account)");if(this.mfaPending)throw It("user_more_factors_required","More factors are required to complete the sign in process.");return this.user}requireRecentChallenge(){if(Date.now()-this.lastChallenge>18e5)throw It("user_challenge_required","A recently successful challenge is required to complete this action.")}afterPrimarySignIn(){const e=this.totpEnrolled||this.user?.emailVerification;this.mfaPending=!!(this.user?.mfa&&e)}async delay(e,i=150){return await new Promise(t=>setTimeout(t,i)),typeof e=="function"?e():e}signInDirectly(){this.user||this.makeUser(),this.mfaPending=!1}async get(){return this.delay(()=>this.requireUser(),120)}async create(e,i,t,o){return this.delay(()=>this.makeUser({email:i,name:o||i.split("@")[0]}))}async createEmailPasswordSession(e){return this.delay(()=>((!this.user||this.user.email!==e)&&this.makeUser({email:e,name:this.user?.name||this.seed.name}),this.afterPrimarySignIn(),this.sessions[0]))}async createAnonymousSession(){return this.delay(()=>(this.makeUser({anonymous:!0}),this.mfaPending=!1,this.sessions[0]))}async createOAuth2Token(e){return this.delay(()=>{this.makeUser({email:`ada@${e}.example`,name:this.seed.name}),this.afterPrimarySignIn()},800)}async createMagicURLToken(e,i){return this.tokens.set(e,{email:i}),this.delay({$id:ze(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:Li()})}async createEmailToken(e,i){return this.tokens.set(e,{email:i}),this.delay({$id:ze(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:Li()})}async createPhoneToken(e,i){return this.tokens.set(e,{phone:i}),this.delay({$id:ze(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:""})}async createSession(e){return this.delay(()=>{const i=this.tokens.get(e)??{};return this.makeUser({email:i.email??this.seed.email,phone:i.phone??this.seed.phone}),i.phone&&(this.user.phoneVerification=!0),this.afterPrimarySignIn(),this.sessions[0]})}async createRecovery(){return this.delay({})}async updateRecovery(){return this.delay({})}async createEmailVerification(){return this.delay({})}async updateEmailVerification(){return this.delay(()=>(this.user&&(this.user.emailVerification=!0),{}))}async createPhoneVerification(){return this.delay({})}async updatePhoneVerification(){return this.delay(()=>(this.user&&(this.user.phoneVerification=!0),{}))}async getPrefs(){return this.delay(()=>({...this.requireUser().prefs}))}async updatePrefs(e){return this.delay(()=>{const i=this.requireUser();return i.prefs={...e},i})}async updateName(e){return this.delay(()=>(this.requireUser().name=e,this.user))}async updateEmail(e){return this.delay(()=>{const i=this.requireUser();return i.email=e,i.emailVerification=!1,i.passwordUpdate=Pe(),i})}async updatePhone(e){return this.delay(()=>{const i=this.requireUser();return i.phone=e,i.phoneVerification=!1,i})}async updatePassword(){return this.delay(()=>{const e=this.requireUser();return e.passwordUpdate=Pe(),e})}async updateStatus(){return this.delay(()=>(this.requireUser(),this.reset(),this.mfaEnabled=!1,this.totpEnrolled=!1,this.recoveryCodes=[],{}))}async listSessions(){return this.delay(()=>(this.requireUser(),{total:this.sessions.length,sessions:this.sessions}))}async deleteSession(e="current"){return this.delay(()=>{const i=this.sessions.find(t=>t.$id===e);return e==="current"||i?.current?this.reset():this.sessions=this.sessions.filter(t=>t.$id!==e),{}})}async deleteSessions(){return this.delay(()=>(this.reset(),{}))}async listIdentities(){return this.delay(()=>(this.requireUser(),{total:this.identities.length,identities:this.identities}))}async deleteIdentity(e){return this.delay(()=>(this.identities=this.identities.filter(i=>i.$id!==e),{}))}async listLogs(){return this.delay(()=>(this.requireUser(),{total:this.logs.length,logs:this.logs}))}async listMFAFactors(){return this.delay({totp:this.totpEnrolled,email:!!this.user?.emailVerification,phone:!!this.user?.phoneVerification,recoveryCode:this.recoveryCodes.length>0,custom:!1})}async createMFAChallenge(){return this.delay({$id:ze(),$createdAt:Pe(),userId:"preview-user",expire:""})}async updateMFAChallenge(){return this.delay(()=>(this.mfaPending=!1,this.lastChallenge=Date.now(),this.sessions[0]))}async updateMFA(e){return this.delay(()=>{const i=this.requireUser();return this.mfaEnabled=e,i.mfa=e,i})}async createMFAAuthenticator(){return this.delay(()=>{const e="JBSWY3DPEHPK3PXP";return this.pendingAuthenticator={secret:e,uri:`otpauth://totp/Preview:${encodeURIComponent(this.user?.email??"user")}?secret=${e}&issuer=Preview`},this.pendingAuthenticator})}async updateMFAAuthenticator(){return this.delay(()=>(this.totpEnrolled=!0,this.pendingAuthenticator=null,this.lastChallenge=Date.now(),this.requireUser()))}async deleteMFAAuthenticator(){return this.delay(()=>(this.requireRecentChallenge(),this.totpEnrolled=!1,{}))}async createMFARecoveryCodes(){return this.delay(()=>{if(this.recoveryCodes.length>0)throw It("user_recovery_codes_already_exists","Recovery codes already generated.",409);return this.recoveryCodes=Array.from({length:6},Ni),{recoveryCodes:this.recoveryCodes}})}async getMFARecoveryCodes(){return this.delay(()=>(this.requireRecentChallenge(),{recoveryCodes:this.recoveryCodes}))}async updateMFARecoveryCodes(){return this.delay(()=>(this.requireRecentChallenge(),this.recoveryCodes=Array.from({length:6},Ni),{recoveryCodes:this.recoveryCodes}))}reset(){this.user=null,this.mfaPending=!1,this.sessions=[],this.identities=[],this.logs=[],this.tokens.clear()}}function co(n){let e=2166136261;const i=()=>(e^=e<<13,e^=e>>>17,e^=e<<5,(e>>>0)/4294967296);for(const r of n)e=(e^r.charCodeAt(0))*16777619;const t=25;let o="";const a=(r,d)=>`<rect x="${r}" y="${d}" width="7" height="7"/><rect x="${r+1}" y="${d+1}" width="5" height="5" fill="#fff"/><rect x="${r+2}" y="${d+2}" width="3" height="3"/>`;for(let r=0;r<t;r++)for(let d=0;d<t;d++)!(d<8&&r<8||d>=t-8&&r<8||d<8&&r>=t-8)&&i()<.45&&(o+=`<rect x="${d}" y="${r}" width="1" height="1"/>`);const s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${t}" shape-rendering="crispEdges"><rect width="${t}" height="${t}" fill="#fff"/><g fill="#000">${a(0,0)}${a(t-7,0)}${a(0,t-7)}${o}</g></svg>`;return`data:image/svg+xml;utf8,${encodeURIComponent(s)}`}const re={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",argumentInvalid:"general_argument_invalid"};function rt(n){if(n&&typeof n=="object"){const e=n;let i=typeof e.message=="string"?e.message:"Unknown error";return/^\s*<(!doctype|html)/i.test(i)&&(i=""),{message:i,type:typeof e.type=="string"?e.type:"",code:typeof e.code=="number"?e.code:0}}return{message:String(n),type:"",code:0}}function ct(n,e){return rt(n).type===e}function At(n,e,i="link"){const t=rt(n);switch(t.type){case re.invalidCredentials:return i==="password"?e.errorCurrentPassword:e.errorInvalidCredentials;case re.userAlreadyExists:case re.emailAlreadyExists:case re.phoneAlreadyExists:return e.errorUserExists;case re.userBlocked:return e.errorUserBlocked;case re.rateLimit:return e.errorRateLimit;case re.invalidToken:return i==="code"?e.errorInvalidCode:e.errorInvalidToken;case re.invalidCode:return e.errorInvalidCode;case re.passwordMismatch:return e.errorPasswordMismatch;case re.passwordRecentlyUsed:return e.errorPasswordRecentlyUsed;case re.passwordPersonalData:return e.errorPasswordPersonalData;case re.passwordWeak:return e.errorPasswordWeak;case re.passwordPwned:return e.errorPasswordPwned;case re.challengeRequired:return e.errorChallengeRequired;case re.sessionAlreadyExists:return e.errorSessionExists;case re.oauthUnauthorized:case re.oauthBadRequest:return e.errorOAuth;case re.authMethodUnsupported:return e.errorMethodDisabled}if(t.type===re.argumentInvalid||/Invalid `\w+` param/i.test(t.message)){const o=t.message.match(/Invalid `([^`]+)` param/i)?.[1]?.toLowerCase();return o==="email"?e.errorInvalidEmail:o==="password"?e.errorInvalidPassword:o==="phone"?e.errorInvalidPhone:o==="name"?e.errorInvalidName:e.errorGeneric}return t.code===0&&/fetch|network/i.test(t.message)?e.errorNetwork:/Invalid `\w+` param/i.test(t.message)||/^\s*<(!doctype|html)/i.test(t.message)?e.errorGeneric:t.message||e.errorGeneric}function Se(n,e,i){for(const t of e){const o=n[t];if(typeof o=="function")return o.apply(n,i)}return Promise.reject(new Error(`Appwrite SDK is missing ${e[0]}(). Update the appwrite package.`))}const Ft="authui",Di=["userId","secret","expire","project","error",Ft],Bi=()=>({status:"loading",user:null,mfaFactors:null,pending:null,configured:!1});class Xi{constructor(){this.client=null,this.account=null,this.config=null,this.state=Bi(),this.listeners=new Map,this.refreshPromise=null,this.preview=null}configure(e){this.config=e,this.client=new Ae().setEndpoint(e.endpoint).setProject(e.project),this.preview=e.preview?new Hi:null,this.account=this.preview?this.preview:new Lt(this.client),this.setState({configured:!0,status:"loading"}),this.preview?this.refresh():typeof window<"u"&&this.handleRedirect().then(()=>this.refresh())}get isConfigured(){return this.config!==null}get isPreview(){return this.preview!==null}async previewSignIn(){this.preview&&(this.preview.signInDirectly(),await this.refresh())}getConfig(){return this.config}getClient(){return this.client}getAccount(){return this.account}getStrings(){return{..._i,...this.config?.strings??{}}}getState(){return{...this.state}}get user(){return this.state.user}on(e,i){let t=this.listeners.get(e);return t||(t=new Set,this.listeners.set(e,t)),t.add(i),()=>t.delete(i)}emit(e,i){this.listeners.get(e)?.forEach(t=>{try{t(i)}catch(o){console.error("[authui] listener failed",o)}}),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=rt(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,re.moreFactorsRequired)){let t=null;try{t=await Se(this.account,["listMFAFactors","listMfaFactors"],[])}catch{}this.setState({status:"mfa-required",user:null,mfaFactors:t})}else ct(i,re.userBlocked)?(await this.purgeLocalSession(),this.setState({status:"signed-out",user:null,mfaFactors:null,pending:{type:"notice",tone:"error",message:this.getStrings().errorUserBlocked}}),e&&this.emit("signed-out",void 0)):(this.setState({status:"signed-out",user:null,mfaFactors:null}),e&&this.emit("signed-out",void 0))}})().finally(()=>{this.refreshPromise=null}),this.refreshPromise)}async afterSignIn(){if(await this.refresh(),this.state.status!=="signed-in"&&this.state.status!=="mfa-required"){const i=this.state.pending;if(i?.type==="notice"&&i.tone==="error")throw Object.assign(new Error(i.message),{type:re.userBlocked,code:401})}const e=this.config?.successUrl;e&&this.state.status==="signed-in"&&typeof window<"u"&&window.location.assign(e)}async purgeLocalSession(){try{await this.account?.deleteSession("current")}catch{}try{this.client?.setSession("")}catch{}if(typeof localStorage<"u")try{localStorage.removeItem("cookieFallback")}catch{}this.config&&!this.preview&&(this.client=new Ae().setEndpoint(this.config.endpoint).setProject(this.config.project),this.account=new Lt(this.client))}async signInWithEmailPassword(e,i){try{await this.acct().createEmailPasswordSession(e.trim(),i)}catch(t){this.fail(t)}await this.afterSignIn()}async signUp(e,i,t){try{await this.acct().create(He.unique(),e.trim(),i,t?.trim()||void 0),await this.acct().createEmailPasswordSession(e.trim(),i)}catch(o){this.fail(o)}await this.afterSignIn()}async signInAnonymously(){try{await this.acct().createAnonymousSession()}catch(e){this.fail(e)}await this.afterSignIn()}async signInWithOAuth(e){const i=this.config?.oauthScopes?.[e];let t;try{t=this.acct().createOAuth2Token(e,this.redirectUrl("oauth"),this.redirectUrl("oauth-failed"),i)}catch(o){this.fail(o)}if(t&&typeof t.then=="function"){try{await t}catch(o){this.fail(o)}await this.afterSignIn()}}async sendMagicUrl(e){try{return await this.acct().createMagicURLToken(He.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(He.unique(),e.trim(),this.config?.securityPhrase??!0)}catch(i){return this.fail(i)}}async sendPhoneOtp(e){try{return await this.acct().createPhoneToken(He.unique(),e.replace(/[\s()-]/g,""))}catch(i){return this.fail(i)}}async signInWithToken(e,i){try{await this.acct().createSession(e,i.trim())}catch(t){this.fail(t)}await this.afterSignIn()}async createMfaChallenge(e){try{return await Se(this.acct(),["createMFAChallenge","createMfaChallenge"],[e])}catch(i){return this.fail(i)}}async completeMfaChallenge(e,i,t={}){try{await Se(this.acct(),["updateMFAChallenge","updateMfaChallenge"],[e,i.trim()])}catch(o){this.fail(o)}(t.signIn??!0)&&await this.afterSignIn()}async listMfaFactors(){try{return await Se(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 Se(this.acct(),["createMFAAuthenticator","createMfaAuthenticator"],["totp"])}catch(e){return this.fail(e)}}async verifyAuthenticator(e){try{await Se(this.acct(),["updateMFAAuthenticator","updateMfaAuthenticator"],["totp",e.trim()])}catch(i){this.fail(i)}await this.refresh()}async removeAuthenticator(){try{await Se(this.acct(),["deleteMFAAuthenticator","deleteMfaAuthenticator"],["totp"])}catch(e){this.fail(e)}await this.refresh()}async createRecoveryCodes(){try{return(await Se(this.acct(),["createMFARecoveryCodes","createMfaRecoveryCodes"],[])).recoveryCodes}catch(e){return this.fail(e)}}async regenerateRecoveryCodes(){try{return(await Se(this.acct(),["updateMFARecoveryCodes","updateMfaRecoveryCodes"],[])).recoveryCodes}catch(e){return this.fail(e)}}async getRecoveryCodes(){try{return(await Se(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,t){try{await this.acct().updateRecovery(e,i,t)}catch(o){this.fail(o)}this.setState({pending:null})}async signOut(e="current"){try{await this.acct().deleteSession(e)}catch(i){this.fail(i)}if(e==="current"){this.setState({status:"signed-out",user:null,mfaFactors:null}),this.emit("signed-out",void 0);return}try{await this.acct().get()}catch{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(t){this.fail(t)}await this.refresh()}async updatePhone(e,i){try{await this.acct().updatePhone(e.replace(/[\s()-]/g,""),i)}catch(t){this.fail(t)}await this.refresh()}async updatePassword(e,i){try{await this.acct().updatePassword(e,i||void 0)}catch(t){this.fail(t)}await this.refresh()}async convertGuest(e,i,t){try{await this.acct().updateEmail(e.trim(),i),t?.trim()&&await this.acct().updateName(t.trim())}catch(o){this.fail(o)}await this.refresh()}async sendEmailVerification(){try{await Se(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(t){this.fail(t)}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:""),t=new URL(i,typeof window<"u"?window.location.href:void 0);for(const o of Di)t.searchParams.delete(o);return t.searchParams.set(Ft,e),t.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(Ft);if(!i)return!1;const t=e.get("userId")??"",o=e.get("secret")??"";this.cleanUrl();const a=()=>{this.setState({pending:{type:"notice",message:this.getStrings().errorInvalidToken,tone:"error"}})};try{switch(i){case"oauth":case"magic-url":t&&o?await this.acct().createSession(t,o):a();break;case"oauth-failed":this.setState({pending:{type:"oauth-failed"}});break;case"recovery":t&&o?this.setState({pending:{type:"reset-password",userId:t,secret:o}}):a();break;case"verify-email":t&&o?(await Se(this.acct(),["updateEmailVerification","updateVerification"],[t,o]),this.setState({pending:{type:"notice",message:this.getStrings().emailVerified,tone:"success"}})):a();break}}catch(s){const r=rt(s),d=At(s,this.getStrings(),"link");this.emit("error",r),this.setState({pending:{type:"notice",message:d,tone:"error"}})}return!0}cleanUrl(){const e=new URL(window.location.href);for(const i of Di)e.searchParams.delete(i);window.history.replaceState(window.history.state,"",e.toString())}reset(){this.client=null,this.account=null,this.preview=null,this.config=null,this.state=Bi(),this.listeners.clear()}}const x=new Xi;class lo{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 Vi=new lo,Wi={none:"0px",sm:"0.25rem",md:"0.625rem",lg:"0.875rem",xl:"1.125rem",full:"1.5rem"},uo=Le`
11
11
  :host {
12
12
  /* Light theme (matches :root in the console) */
13
13
  --authui-background: oklch(1 0 0);
@@ -85,7 +85,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
85
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
86
  color-scheme: dark;
87
87
  }
88
- `,uo=Le`
88
+ `,po=Le`
89
89
  *,
90
90
  *::before,
91
91
  *::after {
@@ -100,6 +100,8 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
100
100
  -webkit-font-smoothing: antialiased;
101
101
  -moz-osx-font-smoothing: grayscale;
102
102
  text-align: start;
103
+ min-width: 0;
104
+ max-width: 100%;
103
105
  }
104
106
 
105
107
  [hidden] {
@@ -355,6 +357,9 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
355
357
  }
356
358
 
357
359
  /* ── Alert ── */
360
+ .alert:has(.dismiss) {
361
+ padding-inline-end: 36px;
362
+ }
358
363
  .alert {
359
364
  position: relative;
360
365
  width: 100%;
@@ -476,7 +481,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
476
481
  .tabs {
477
482
  display: inline-flex;
478
483
  align-items: center;
479
- justify-content: center;
484
+ justify-content: flex-start;
480
485
  height: 36px;
481
486
  width: fit-content;
482
487
  max-width: 100%;
@@ -487,6 +492,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
487
492
  padding: 3px;
488
493
  gap: 2px;
489
494
  scrollbar-width: none;
495
+ -webkit-overflow-scrolling: touch;
490
496
  }
491
497
  :host([data-theme="dark"]) .tabs {
492
498
  background: color-mix(in oklab, var(--authui-muted) 80%, transparent);
@@ -497,7 +503,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
497
503
  justify-content: center;
498
504
  gap: 6px;
499
505
  height: 100%;
500
- flex: 1;
506
+ flex: 0 0 auto;
501
507
  padding: 4px 10px;
502
508
  border-radius: var(--authui-radius-md);
503
509
  border: 1px solid transparent;
@@ -624,6 +630,8 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
624
630
  align-items: center;
625
631
  gap: 8px;
626
632
  flex-wrap: wrap;
633
+ min-width: 0;
634
+ flex: 1;
627
635
  }
628
636
  .between {
629
637
  display: flex;
@@ -732,6 +740,9 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
732
740
  .providers.two {
733
741
  grid-template-columns: repeat(2, minmax(0, 1fr));
734
742
  }
743
+ .providers.two > :last-child:nth-child(odd) {
744
+ grid-column: 1 / -1;
745
+ }
735
746
  .providers .btn svg {
736
747
  width: 18px;
737
748
  height: 18px;
@@ -827,17 +838,20 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
827
838
  animation-duration: 0.01ms !important;
828
839
  }
829
840
  }
830
- `;var po=Object.defineProperty,ho=(n,e,i,t)=>{for(var o=void 0,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=s(e,i,o)||o);return o&&po(e,i,o),o};const Wi=(xe=class extends We{constructor(){super(...arguments),this.auth=q.getState(),this.unsubscribeStore=null,this.unsubscribeTheme=null,this.stopKeys=e=>e.stopPropagation()}connectedCallback(){super.connectedCallback();for(const e of xe.KEY_EVENTS)this.addEventListener(e,this.stopKeys);this.auth=q.getState(),this.unsubscribeStore=q.on("change",e=>{this.auth=e,this.applyBranding()}),this.unsubscribeTheme=Xi.subscribe(()=>this.applyBranding()),this.applyBranding()}disconnectedCallback(){super.disconnectedCallback();for(const e of xe.KEY_EVENTS)this.removeEventListener(e,this.stopKeys);this.unsubscribeStore?.(),this.unsubscribeTheme?.(),this.unsubscribeStore=null,this.unsubscribeTheme=null}get strings(){return q.getStrings()}t(e,i){return oo(this.strings[e],i)}get config(){return q.getConfig()}get productName(){return this.config?.branding?.name??""}applyBranding(){const e=this.config?.branding,i=Xi.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&&Vi[e.radius]&&this.style.setProperty("--authui-radius",Vi[e.radius])}fire(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!0}))}},xe.styles=[lo,uo],xe.KEY_EVENTS=["keydown","keyup","keypress"],xe);ho([z()],Wi.prototype,"auth");let Ue=Wi;var fo=Object.defineProperty,yo=Object.getOwnPropertyDescriptor,pe=(n,e,i,t)=>{for(var o=t>1?void 0:t?yo(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&fo(e,i,o),o};P.AuthUIConfigElement=class extends We{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="",this.preview=""}connectedCallback(){super.connectedCallback(),this.configure()}updated(){this.configure()}configure(){if(!this.endpoint||!this.project)return;const e=this.toConfig(),i=q.getConfig();i&&JSON.stringify(i)===JSON.stringify(e)||q.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},preview:this.preview===""||this.preview==="false"?void 0:!0}}},P.AuthUIConfigElement.styles=Le`
841
+ `;var ho=Object.defineProperty,fo=(n,e,i,t)=>{for(var o=void 0,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=s(e,i,o)||o);return o&&ho(e,i,o),o};const Gi=(qe=class extends We{constructor(){super(...arguments),this.auth=x.getState(),this.unsubscribeStore=null,this.unsubscribeTheme=null,this.stopKeys=e=>e.stopPropagation()}connectedCallback(){super.connectedCallback();for(const e of qe.KEY_EVENTS)this.addEventListener(e,this.stopKeys);this.auth=x.getState(),this.unsubscribeStore=x.on("change",e=>{this.auth=e,this.applyBranding()}),this.unsubscribeTheme=Vi.subscribe(()=>this.applyBranding()),this.applyBranding()}disconnectedCallback(){super.disconnectedCallback();for(const e of qe.KEY_EVENTS)this.removeEventListener(e,this.stopKeys);this.unsubscribeStore?.(),this.unsubscribeTheme?.(),this.unsubscribeStore=null,this.unsubscribeTheme=null}get strings(){return x.getStrings()}t(e,i){return ao(this.strings[e],i)}get config(){return x.getConfig()}get productName(){return this.config?.branding?.name??""}applyBranding(){const e=this.config?.branding,i=Vi.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&&Wi[e.radius]&&this.style.setProperty("--authui-radius",Wi[e.radius])}fire(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!0}))}},qe.styles=[uo,po],qe.KEY_EVENTS=["keydown","keyup","keypress"],qe);fo([Y()],Gi.prototype,"auth");let Ue=Gi;var go=Object.defineProperty,yo=Object.getOwnPropertyDescriptor,pe=(n,e,i,t)=>{for(var o=t>1?void 0:t?yo(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&go(e,i,o),o};P.AuthUIConfigElement=class extends We{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="",this.preview=""}connectedCallback(){super.connectedCallback(),this.configure()}updated(){this.configure()}configure(){if(!this.endpoint||!this.project)return;const e=this.toConfig(),i=x.getConfig();i&&JSON.stringify(i)===JSON.stringify(e)||x.configure(e)}toConfig(){const e={oauth:[]},i=this.methods.split(/[\s,]+/).filter(Boolean);for(const t of i)t.startsWith("oauth:")?e.oauth.push(t.slice(6)):t==="email-password"?e.emailPassword=!0:t==="magic-url"?e.magicUrl=!0:t==="email-otp"?e.emailOtp=!0:t==="phone"?e.phone=!0:(t==="anonymous"||t==="guest")&&(e.anonymous=!0);return e.emailPassword=i.length>0?i.includes("email-password"):!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},preview:this.preview===""||this.preview==="false"?void 0:!0}}},P.AuthUIConfigElement.styles=Le`
831
842
  :host {
832
843
  display: none;
833
844
  }
834
- `,pe([F({type:String})],P.AuthUIConfigElement.prototype,"endpoint",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"project",2),pe([F({type:String,attribute:"redirect-url"})],P.AuthUIConfigElement.prototype,"redirectUrl",2),pe([F({type:String,attribute:"success-url"})],P.AuthUIConfigElement.prototype,"successUrl",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"methods",2),pe([F({type:String,attribute:"sign-up"})],P.AuthUIConfigElement.prototype,"signUp",2),pe([F({type:String,attribute:"require-name"})],P.AuthUIConfigElement.prototype,"requireName",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"mfa",2),pe([F({type:String,attribute:"security-phrase"})],P.AuthUIConfigElement.prototype,"securityPhrase",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"name",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"logo",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"theme",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"radius",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"primary",2),pe([F({type:String,attribute:"primary-foreground"})],P.AuthUIConfigElement.prototype,"primaryForeground",2),pe([F({type:String,attribute:"terms-url"})],P.AuthUIConfigElement.prototype,"termsUrl",2),pe([F({type:String,attribute:"privacy-url"})],P.AuthUIConfigElement.prototype,"privacyUrl",2),pe([F({type:String})],P.AuthUIConfigElement.prototype,"preview",2),P.AuthUIConfigElement=pe([Ge("authui-config")],P.AuthUIConfigElement);var go=Object.defineProperty,mo=Object.getOwnPropertyDescriptor,At=(n,e,i,t)=>{for(var o=t>1?void 0:t?mo(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&go(e,i,o),o};if(typeof document<"u"&&!document.getElementById("authui-fouc")){const n=document.createElement("style");n.id="authui-fouc",n.textContent="authui-show:not([ready]){display:none}",document.head.appendChild(n)}const wo=["loading","signed-out","signed-in","mfa-required"];function Ft(n){return n?n.split(/[\s,]+/).map(e=>e.trim()).filter(e=>wo.includes(e)):[]}P.AuthUIShow=class extends We{constructor(){super(...arguments),this.when="",this.unless="",this.status=q.getState().status,this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this.status=q.getState().status,this.unsubscribe=q.on("change",e=>this.status=e.status)}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.(),this.unsubscribe=null}get visible(){const e=Ft(this.when),i=Ft(this.unless);return!(this.status==="loading"&&!e.includes("loading")||e.length>0&&!e.includes(this.status)||i.includes(this.status))}updated(){(this.status!=="loading"||Ft(this.when).includes("loading"))&&(this.setAttribute("ready",""),this.style.display="contents")}render(){return this.visible?S`<slot></slot>`:x}},At([F({type:String})],P.AuthUIShow.prototype,"when",2),At([F({type:String})],P.AuthUIShow.prototype,"unless",2),At([z()],P.AuthUIShow.prototype,"status",2),P.AuthUIShow=At([Ge("authui-show")],P.AuthUIShow);const bo=Le`
845
+ `,pe([ee({type:String})],P.AuthUIConfigElement.prototype,"endpoint",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"project",2),pe([ee({type:String,attribute:"redirect-url"})],P.AuthUIConfigElement.prototype,"redirectUrl",2),pe([ee({type:String,attribute:"success-url"})],P.AuthUIConfigElement.prototype,"successUrl",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"methods",2),pe([ee({type:String,attribute:"sign-up"})],P.AuthUIConfigElement.prototype,"signUp",2),pe([ee({type:String,attribute:"require-name"})],P.AuthUIConfigElement.prototype,"requireName",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"mfa",2),pe([ee({type:String,attribute:"security-phrase"})],P.AuthUIConfigElement.prototype,"securityPhrase",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"name",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"logo",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"theme",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"radius",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"primary",2),pe([ee({type:String,attribute:"primary-foreground"})],P.AuthUIConfigElement.prototype,"primaryForeground",2),pe([ee({type:String,attribute:"terms-url"})],P.AuthUIConfigElement.prototype,"termsUrl",2),pe([ee({type:String,attribute:"privacy-url"})],P.AuthUIConfigElement.prototype,"privacyUrl",2),pe([ee({type:String})],P.AuthUIConfigElement.prototype,"preview",2),P.AuthUIConfigElement=pe([Ge("authui-config")],P.AuthUIConfigElement);var mo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,kt=(n,e,i,t)=>{for(var o=t>1?void 0:t?wo(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&mo(e,i,o),o};if(typeof document<"u"&&!document.getElementById("authui-fouc")){const n=document.createElement("style");n.id="authui-fouc",n.textContent="authui-show:not([ready]){display:none}",document.head.appendChild(n)}const bo=["loading","signed-out","signed-in","mfa-required"];function ei(n){return n?n.split(/[\s,]+/).map(e=>e.trim()).filter(e=>bo.includes(e)):[]}P.AuthUIShow=class extends We{constructor(){super(...arguments),this.when="",this.unless="",this.status=x.getState().status,this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this.status=x.getState().status,this.unsubscribe=x.on("change",e=>this.status=e.status)}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.(),this.unsubscribe=null}get visible(){const e=ei(this.when),i=ei(this.unless);return!(this.status==="loading"&&!e.includes("loading")||e.length>0&&!e.includes(this.status)||i.includes(this.status))}updated(){(this.status!=="loading"||ei(this.when).includes("loading"))&&(this.setAttribute("ready",""),this.style.display="contents")}render(){return this.visible?v`<slot></slot>`:E}},kt([ee({type:String})],P.AuthUIShow.prototype,"when",2),kt([ee({type:String})],P.AuthUIShow.prototype,"unless",2),kt([Y()],P.AuthUIShow.prototype,"status",2),P.AuthUIShow=kt([Ge("authui-show")],P.AuthUIShow);const Io=Le`
835
846
  :host {
836
847
  display: block;
837
848
  width: 100%;
838
849
  max-width: 420px;
850
+ min-width: 0;
839
851
  }
840
852
  .panel {
853
+ min-width: 0;
854
+ overflow: hidden;
841
855
  background: var(--authui-card);
842
856
  color: var(--authui-card-foreground);
843
857
  border: 1px solid var(--authui-border);
@@ -867,6 +881,9 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
867
881
  align-self: center;
868
882
  margin-bottom: 4px;
869
883
  }
884
+ .alert:has(.dismiss) {
885
+ padding-inline-end: 36px;
886
+ }
870
887
  .alert .dismiss {
871
888
  position: absolute;
872
889
  top: 4px;
@@ -879,7 +896,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
879
896
  height: 14px;
880
897
  margin: 0;
881
898
  }
882
- `,oe=n=>S`<svg
899
+ `,ae=n=>v`<svg
883
900
  xmlns="http://www.w3.org/2000/svg"
884
901
  viewBox="0 0 24 24"
885
902
  fill="none"
@@ -890,45 +907,50 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
890
907
  aria-hidden="true"
891
908
  >
892
909
  ${n}
893
- </svg>`,X={mail:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`),key:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`),monitor:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),check:oe(G`<path d="M20 6 9 17l-5-5"/>`),copy:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),alert:oe(G`<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:oe(G`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),checkCircle:oe(G`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),link:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<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:oe(G`<path d="m6 9 6 6 6-6"/>`),ghost:oe(G`<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:oe(G`<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"/>`)},fe=(n,e="0 0 24 24")=>S`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${e} aria-hidden="true">${n}</svg>`,Io={google:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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 ei(n){return Io[n]??X.globe}var vo=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,ke=(n,e,i,t)=>{for(var o=t>1?void 0:t?Ao(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&vo(e,i,o),o};P.AuthUISignIn=class extends Ue{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 q.signInWithEmailPassword(this.email,this.password),this.password="",this.fire("authui-success",{method:"email-password"})})},this.onSignUp=e=>{e.preventDefault(),this.run(async()=>{await q.signUp(this.email,this.password,this.name),this.password="",this.fire("authui-success",{method:"sign-up"})})},this.onGuest=()=>{this.run(async()=>{await q.signInAnonymously(),this.fire("authui-success",{method:"anonymous"})})},this.onOAuth=e=>{this.run(async()=>{if(await q.signInWithOAuth(e),q.isPreview){this.fire("authui-success",{method:"oauth"});return}await new Promise(i=>setTimeout(i,4e3))})},this.onForgot=e=>{e.preventDefault(),this.run(async()=>{await q.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 q.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 q.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 q.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 q.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 q.signInWithToken(i.userId,this.code),this.code="",this.fire("authui-success",{method:i.kind})},"code")},this.onChooseFactor=e=>{this.run(async()=>{const i=await q.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 q.completeMfaChallenge(i.id,this.code),this.code="",this.challenge=null,this.fire("authui-success",{method:"mfa"})},"code")},this.onCancelMfa=()=>{this.run(async()=>{try{await q.signOut()}catch(e){if(!vt(e,ce.sessionNotFound))throw e}this.go("sign-in")})},this.onSignOut=()=>{this.run(()=>q.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")},q.setPending(null)),i?.type==="notice"&&(this.notice={tone:i.tone==="error"?"error":i.tone,message:i.message},q.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(t){this.error=zt(t,this.strings,i)}finally{this.busy=!1}}}bind(e){return i=>{this[e]=i.target.value}}render(){const e=this.renderStep();return S`
910
+ </svg>`,L={mail:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`),key:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`),monitor:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),check:ae(G`<path d="M20 6 9 17l-5-5"/>`),copy:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),alert:ae(G`<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:ae(G`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),checkCircle:ae(G`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),link:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<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:ae(G`<path d="m6 9 6 6 6-6"/>`),ghost:ae(G`<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:ae(G`<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"/>`)},fe=(n,e="0 0 24 24")=>v`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${e} aria-hidden="true">${n}</svg>`,vo={google:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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:fe(G`<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 ti(n){return vo[n]??L.globe}function ii(n){const e=(n.trim()[0]??"?").toUpperCase();return/[A-Z0-9]/i.test(e)?e:L.user}function Oe(n){typeof document>"u"||(document.querySelector("authui-modal")||document.body.appendChild(document.createElement("authui-modal")),queueMicrotask(()=>{window.dispatchEvent(new CustomEvent("authui:open",{detail:{view:n}}))}))}function Ki(){typeof window>"u"||window.dispatchEvent(new CustomEvent("authui:close"))}var Ao=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,Ie=(n,e,i,t)=>{for(var o=t>1?void 0:t?ko(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&Ao(e,i,o),o};P.AuthUISignIn=class extends Ue{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.focusOnStep=!1,this.resendCooldownUntil=0,this.challenge=null,this.recovery=null,this.email="",this.password="",this.passwordConfirm="",this.name="",this.phone="",this.code="",this.onSignIn=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{await x.signInWithEmailPassword(this.email,this.password),this.password="",this.fire("authui-success",{method:"email-password"})})},this.onSignUp=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{await x.signUp(this.email,this.password,this.name),this.password="",this.fire("authui-success",{method:"sign-up"})})},this.onGuest=()=>{this.run(async()=>{await x.signInAnonymously(),this.fire("authui-success",{method:"anonymous"})})},this.onOAuth=e=>{this.run(async()=>{if(await x.signInWithOAuth(e),x.isPreview){this.fire("authui-success",{method:"oauth"});return}await new Promise(i=>setTimeout(i,4e3))})},this.onForgot=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{await x.sendPasswordRecovery(this.email),this.notice={tone:"success",message:this.t("resetLinkSent",{email:this.email})}})},this.onReset=e=>{if(e.preventDefault(),!this.requireValid(e))return;if(this.password!==this.passwordConfirm){this.error=this.t("errorPasswordMismatch");return}const i=this.recovery;i&&this.run(async()=>{await x.completePasswordRecovery(i.userId,i.secret,this.password),this.password="",this.passwordConfirm="",this.recovery=null,this.auth.pending?.type==="reset-password"&&x.setPending(null),this.notice={tone:"success",message:this.t("passwordUpdated")},this.go("sign-in")})},this.onMagicUrl=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{const i=await x.sendMagicUrl(this.email);this.token={userId:i.userId,kind:"magic-url",target:this.email,phrase:i.phrase}})},this.onEmailOtp=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{const i=await x.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.requireValid(e)&&this.run(async()=>{const i=await x.sendPhoneOtp(this.phone);this.token={userId:i.userId,kind:"phone",target:this.phone},this.code=""})},this.onVerifyCode=e=>{if(e.preventDefault(),!this.requireValid(e))return;const i=this.token;i&&this.run(async()=>{await x.signInWithToken(i.userId,this.code),this.code="",this.token=null,this.fire("authui-success",{method:i.kind})},"code")},this.onChooseFactor=e=>{this.run(async()=>{const i=await x.createMfaChallenge(e);this.challenge={id:i.$id,factor:e},this.code=""})},this.onVerifyFactor=e=>{if(e.preventDefault(),!this.requireValid(e))return;const i=this.challenge;i&&this.run(async()=>{await x.completeMfaChallenge(i.id,this.code),this.code="",this.challenge=null,this.go("sign-in"),this.fire("authui-success",{method:"mfa"})},"code")},this.onCancelMfa=()=>{this.run(async()=>{try{await x.signOut()}catch(e){if(!ct(e,re.sessionNotFound))throw e}this.go("sign-in")})},this.onSignOut=()=>{this.run(()=>x.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")&&(this.focusOnStep||this.embedded)&&(this.focusOnStep=!1,requestAnimationFrame(()=>this.firstInput?.focus()))}syncFromStore(){const{status:e,pending:i}=this.auth;e==="mfa-required"&&this.step!=="mfa"&&this.go("mfa");const t=this.step==="reset-password"||i?.type==="reset-password"||this.recovery!==null;(e==="signed-in"||e==="signed-out")&&!t&&(this.step==="mfa"||this.step==="phone"||this.step==="email-otp"||this.step==="magic-url"||this.step==="forgot-password"||this.token!==null||this.challenge!==null||e==="signed-out")&&(this.token=null,this.challenge=null,this.code="",this.password="",this.notice=null,this.go(this.view==="sign-up"?"sign-up":"sign-in")),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")},x.setPending(null)),i?.type==="notice"&&!this.notice&&(this.notice={tone:i.tone==="error"?"error":i.tone,message:i.message})}dismissNotice(){this.notice=null,this.auth.pending?.type==="notice"&&x.setPending(null)}go(e){e==="sign-up"&&this.config?.signUp===!1&&(e="sign-in"),this.focusOnStep=!0,this.step=e,this.error="",this.notice=null,this.auth.pending?.type==="notice"&&x.setPending(null),this.busy=!1,this.showPassword=!1,this.password="",this.passwordConfirm="",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(t){this.error=At(t,this.strings,i)}finally{this.busy=!1}}}requireValid(e){const i=e.target;return!(i&&typeof i.reportValidity=="function"&&!i.reportValidity())}bind(e){return i=>{this[e]=i.target.value}}render(){const e=this.renderStep();return v`
894
911
  <div class="panel ${this.embedded?"embedded":""}" part="panel">
895
912
  ${this.renderHeader()}
896
- ${this.notice?S`<div class="alert alert-${this.notice.tone}" role="status">
897
- ${this.notice.tone==="success"?X.checkCircle:this.notice.tone==="error"?X.alert:X.info}
913
+ ${this.notice?v`<div class="alert alert-${this.notice.tone}" role="status">
914
+ ${this.notice.tone==="success"?L.checkCircle:this.notice.tone==="error"?L.alert:L.info}
898
915
  <div class="alert-body">${this.notice.message}</div>
899
916
  <button
900
917
  class="btn btn-ghost btn-icon dismiss"
901
- @click=${()=>this.notice=null}
918
+ @click=${()=>this.dismissNotice()}
902
919
  aria-label=${this.t("close")}
903
920
  >
904
- ${X.x}
921
+ ${L.x}
905
922
  </button>
906
- </div>`:x}
923
+ </div>`:E}
907
924
  ${e}
908
925
  </div>
909
- `}renderHeader(){const e=this.config?.branding?.logo,i=this.productName;let t="",o="";switch(this.step){case"sign-in":t=this.auth.status==="signed-in"?this.t("signedInAs"):i?this.t("signInTitle",{name:i}):this.t("welcomeBack");break;case"sign-up":t=i?this.t("signUpTitle",{name:i}):this.t("createAccount");break;case"forgot-password":case"reset-password":t=this.t("resetPassword");break;case"magic-url":case"email-otp":t=this.t("continueWithEmail");break;case"phone":t=this.t("continueWithPhone");break;case"mfa":t=this.t("mfaTitle"),o=this.t("mfaDescription");break}return S`
910
- <header class="header">
911
- ${e?S`<img class="logo" src=${e} alt=${i||"Logo"} />`:x}
912
- ${q.isPreview?S`<span class="badge badge-info preview">${this.t("preview")}</span>`:x}
926
+ `}renderHeader(){const e=this.config?.branding?.logo,i=this.productName;let t="",o="";if(this.auth.status==="signed-in")t=this.t("signedInAs");else switch(this.step){case"sign-in":t=i?this.t("signInTitle",{name:i}):this.t("welcomeBack");break;case"sign-up":t=i?this.t("signUpTitle",{name:i}):this.t("createAccount");break;case"forgot-password":case"reset-password":t=this.t("resetPassword");break;case"magic-url":case"email-otp":t=this.t("continueWithEmail");break;case"phone":t=this.t("continueWithPhone");break;case"mfa":t=this.t("mfaTitle"),o=this.t("mfaDescription");break}return v`
927
+ <div class="header">
928
+ ${e?v`<img
929
+ class="logo"
930
+ src=${e}
931
+ alt=""
932
+ @error=${a=>{a.target.hidden=!0}}
933
+ />`:E}
934
+ ${x.isPreview?v`<span class="badge badge-info preview">${this.t("preview")}</span>`:E}
913
935
  <h2 class="title" id="authui-title">${t}</h2>
914
- ${o?S`<p class="description">${o}</p>`:x}
915
- </header>
916
- `}renderError(){return this.error?S`<div class="alert alert-error" role="alert">
917
- ${X.alert}
936
+ ${o?v`<p class="description">${o}</p>`:E}
937
+ </div>
938
+ `}renderError(){return this.error?v`<div class="alert alert-error" role="alert">
939
+ ${L.alert}
918
940
  <div class="alert-body">${this.error}</div>
919
- </div>`:x}submitButton(e,i="btn-primary"){return S`<button class="btn ${i} btn-block" type="submit" ?disabled=${this.busy}>
920
- ${this.busy?S`<span class="spinner" aria-hidden="true"></span>`:x} ${e}
921
- </button>`}passwordField(e){return S`
941
+ </div>`:E}submitButton(e,i="btn-primary"){return v`<button class="btn ${i} btn-block" type="submit" ?disabled=${this.busy}>
942
+ ${this.busy?v`<span class="spinner" aria-hidden="true"></span>`:E} ${e}
943
+ </button>`}passwordField(e){return v`
922
944
  <div class="field">
923
945
  <label class="label" for=${e.id}>
924
946
  ${e.label}
925
- ${e.forgot?S`<button
947
+ ${e.forgot?v`<button
926
948
  type="button"
927
949
  class="btn btn-link small"
928
950
  @click=${()=>this.go("forgot-password")}
929
951
  >
930
952
  ${this.t("forgotPassword")}
931
- </button>`:x}
953
+ </button>`:E}
932
954
  </label>
933
955
  <div class="input-wrap">
934
956
  <input
@@ -945,15 +967,15 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
945
967
  type="button"
946
968
  class="btn btn-ghost btn-icon"
947
969
  @click=${()=>this.showPassword=!this.showPassword}
948
- aria-label=${this.showPassword?"Hide password":"Show password"}
970
+ aria-label=${this.showPassword?this.t("hidePassword"):this.t("showPassword")}
949
971
  tabindex="-1"
950
972
  >
951
- ${this.showPassword?X.eyeOff:X.eye}
973
+ ${this.showPassword?L.eyeOff:L.eye}
952
974
  </button>
953
975
  </div>
954
- ${e.hint?S`<p class="hint">${e.hint}</p>`:x}
976
+ ${e.hint?v`<p class="hint">${e.hint}</p>`:E}
955
977
  </div>
956
- `}emailField(e="email"){return S`
978
+ `}emailField(e="email"){return v`
957
979
  <div class="field">
958
980
  <label class="label" for="authui-email">${this.t("email")}</label>
959
981
  <input
@@ -967,7 +989,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
967
989
  @input=${this.bind("email")}
968
990
  />
969
991
  </div>
970
- `}codeField(){return S`
992
+ `}codeField(){return v`
971
993
  <div class="field">
972
994
  <label class="label" for="authui-code">${this.t("code")}</label>
973
995
  <input
@@ -976,105 +998,107 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
976
998
  type="text"
977
999
  inputmode="numeric"
978
1000
  autocomplete="one-time-code"
1001
+ maxlength="6"
1002
+ pattern="[0-9]*"
979
1003
  required
980
1004
  .value=${this.code}
981
1005
  @input=${this.bind("code")}
982
1006
  />
983
1007
  </div>
984
- `}legal(){const e=this.config?.legal;return!e?.termsUrl&&!e?.privacyUrl?x:S`<p class="legal">
1008
+ `}legal(){const e=this.config?.legal;return!e?.termsUrl&&!e?.privacyUrl?E:v`<p class="legal">
985
1009
  ${this.t("agreeTo")}
986
- ${e.termsUrl?S`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>`:x}
987
- ${e.termsUrl&&e.privacyUrl?S` ${this.t("and")} `:x}
988
- ${e.privacyUrl?S`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>`:x}.
989
- </p>`}backLink(e="sign-in"){return S`<div class="links">
1010
+ ${e.termsUrl?v`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>`:E}
1011
+ ${e.termsUrl&&e.privacyUrl?v` ${this.t("and")} `:E}
1012
+ ${e.privacyUrl?v`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>`:E}.
1013
+ </p>`}backLink(e="sign-in"){return v`<div class="links">
990
1014
  <button type="button" class="btn btn-link" @click=${()=>this.go(e)}>
991
- ${X.arrowLeft} ${this.t("back")}
1015
+ ${L.arrowLeft} ${this.t("back")}
992
1016
  </button>
993
- </div>`}renderStep(){if(!this.auth.configured)return S`<div class="alert alert-error" role="alert">
994
- ${X.alert}
1017
+ </div>`}renderStep(){if(!this.auth.configured)return v`<div class="alert alert-error" role="alert">
1018
+ ${L.alert}
995
1019
  <div class="alert-body">${this.t("errorNotConfigured")}</div>
996
- </div>`;if(this.auth.status==="loading")return S`<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 S`
1020
+ </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.config?.signUp===!1?this.renderSignIn():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`
997
1021
  <div class="stack">
998
1022
  <div class="row">
999
1023
  <div class="inline">
1000
- <span class="avatar">${i[0]??"?"}</span>
1024
+ <span class="avatar">${ii(i)}</span>
1001
1025
  <div class="row-main">
1002
- <span class="row-title">${i}</span>
1003
- ${e.email&&e.name?S`<span class="row-sub">${e.email}</span>`:x}
1026
+ <span class="row-title" title=${i}>${i}</span>
1027
+ ${e.email&&e.name?v`<span class="row-sub" title=${e.email}>${e.email}</span>`:E}
1004
1028
  </div>
1005
1029
  </div>
1006
1030
  </div>
1007
1031
  ${this.renderError()}
1008
1032
  <div class="stack-sm">
1009
- ${this.config?.successUrl?S`<a class="btn btn-primary btn-block" href=${this.config.successUrl}
1033
+ ${this.config?.successUrl?v`<a class="btn btn-primary btn-block" href=${this.config.successUrl}
1010
1034
  >${this.t("continue")}</a
1011
- >`:x}
1035
+ >`:E}
1012
1036
  <button
1013
1037
  class="btn btn-outline btn-block"
1014
- @click=${()=>this.fire("authui-open",{view:"account"})}
1038
+ @click=${()=>{this.embedded?this.fire("authui-open",{view:"account"}):Oe("account")}}
1015
1039
  >
1016
- ${X.settings} ${this.t("manageAccount")}
1040
+ ${L.settings} ${this.t("manageAccount")}
1017
1041
  </button>
1018
1042
  <button class="btn btn-ghost btn-block" @click=${this.onSignOut} ?disabled=${this.busy}>
1019
- ${X.logOut} ${this.t("signOut")}
1043
+ ${L.logOut} ${this.t("signOut")}
1020
1044
  </button>
1021
1045
  </div>
1022
1046
  </div>
1023
- `}renderProviders(){const e=this.config?.methods?.oauth??[];if(e.length===0)return x;const i=e.length>2;return S`
1047
+ `}renderProviders(){const e=this.config?.methods?.oauth??[];if(e.length===0)return E;const i=e.length>2;return v`
1024
1048
  <div class="providers ${i?"two":""}">
1025
- ${e.map(t=>S`<button
1049
+ ${e.map(t=>v`<button
1026
1050
  type="button"
1027
1051
  class="btn btn-outline"
1028
1052
  @click=${()=>this.onOAuth(t)}
1029
1053
  ?disabled=${this.busy}
1030
1054
  aria-label=${this.t("continueWith",{provider:Te(t)})}
1031
1055
  >
1032
- ${ei(t)}
1056
+ ${ti(t)}
1033
1057
  <span
1034
1058
  >${i?Te(t):this.t("continueWith",{provider:Te(t)})}</span
1035
1059
  >
1036
1060
  </button>`)}
1037
1061
  </div>
1038
- `}renderSignIn(){const e=this.config?.methods??{},i=e.emailPassword!==!1,t=(e.oauth?.length??0)>0,o=[e.magicUrl?{step:"magic-url",icon:X.link,label:this.t("sendMagicLink")}:null,e.emailOtp?{step:"email-otp",icon:X.mail,label:this.t("continueWithEmail")}:null,e.phone?{step:"phone",icon:X.smartphone,label:this.t("continueWithPhone")}:null].filter(Boolean);return S`
1062
+ `}renderSignIn(){const e=this.config?.methods??{},i=e.emailPassword!==!1,t=(e.oauth?.length??0)>0,o=[e.magicUrl?{step:"magic-url",icon:L.link,label:this.t("sendMagicLink")}:null,e.emailOtp?{step:"email-otp",icon:L.mail,label:this.t("continueWithEmail")}:null,e.phone?{step:"phone",icon:L.smartphone,label:this.t("continueWithPhone")}:null].filter(Boolean);return v`
1039
1063
  <div class="stack">
1040
1064
  ${this.renderProviders()}
1041
- ${t&&(i||o.length>0)?S`<div class="separator-text">${this.t("or")}</div>`:x}
1042
- ${i?S`<form class="form" @submit=${this.onSignIn} novalidate>
1065
+ ${t&&(i||o.length>0)?v`<div class="separator-text">${this.t("or")}</div>`:E}
1066
+ ${i?v`<form class="form" @submit=${this.onSignIn} novalidate>
1043
1067
  ${this.emailField()}
1044
1068
  ${this.passwordField({label:this.t("password"),autocomplete:"current-password",id:"authui-password",field:"password",forgot:!0})}
1045
1069
  ${this.renderError()} ${this.submitButton(this.t("signIn"))}
1046
1070
  </form>`:this.renderError()}
1047
- ${o.length>0?S`<div class="stack-sm">
1048
- ${o.map(a=>S`<button
1071
+ ${o.length>0?v`<div class="stack-sm">
1072
+ ${o.map(a=>v`<button
1049
1073
  type="button"
1050
1074
  class="btn btn-secondary btn-block"
1051
1075
  @click=${()=>this.go(a.step)}
1052
1076
  >
1053
1077
  ${a.icon} ${a.label}
1054
1078
  </button>`)}
1055
- </div>`:x}
1056
- ${e.anonymous?S`<button
1079
+ </div>`:E}
1080
+ ${e.anonymous?v`<button
1057
1081
  type="button"
1058
1082
  class="btn btn-ghost btn-block"
1059
1083
  @click=${this.onGuest}
1060
1084
  ?disabled=${this.busy}
1061
1085
  >
1062
- ${X.ghost} ${this.t("continueAsGuest")}
1063
- </button>`:x}
1064
- ${i&&this.config?.signUp!==!1?S`<div class="links">
1086
+ ${L.ghost} ${this.t("continueAsGuest")}
1087
+ </button>`:E}
1088
+ ${i&&this.config?.signUp!==!1?v`<div class="links">
1065
1089
  <span>${this.t("noAccount")}</span>
1066
1090
  <button type="button" class="btn btn-link" @click=${()=>this.go("sign-up")}>
1067
1091
  ${this.t("signUp")}
1068
1092
  </button>
1069
- </div>`:x}
1093
+ </div>`:E}
1070
1094
  ${this.legal()}
1071
1095
  </div>
1072
- `}renderSignUp(){return S`
1096
+ `}renderSignUp(){return v`
1073
1097
  <div class="stack">
1074
1098
  ${this.renderProviders()}
1075
- ${(this.config?.methods?.oauth?.length??0)>0?S`<div class="separator-text">${this.t("or")}</div>`:x}
1099
+ ${(this.config?.methods?.oauth?.length??0)>0?v`<div class="separator-text">${this.t("or")}</div>`:E}
1076
1100
  <form class="form" @submit=${this.onSignUp} novalidate>
1077
- ${this.config?.requireName!==!1?S`<div class="field">
1101
+ ${this.config?.requireName!==!1?v`<div class="field">
1078
1102
  <label class="label" for="authui-name">${this.t("name")}</label>
1079
1103
  <input
1080
1104
  class="input"
@@ -1085,7 +1109,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1085
1109
  .value=${this.name}
1086
1110
  @input=${this.bind("name")}
1087
1111
  />
1088
- </div>`:x}
1112
+ </div>`:E}
1089
1113
  ${this.emailField()}
1090
1114
  ${this.passwordField({label:this.t("password"),autocomplete:"new-password",id:"authui-password",field:"password",hint:this.t("passwordHint")})}
1091
1115
  ${this.renderError()} ${this.submitButton(this.t("createAccount"))}
@@ -1098,50 +1122,66 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1098
1122
  </div>
1099
1123
  ${this.legal()}
1100
1124
  </div>
1101
- `}renderForgot(){return S`
1125
+ `}renderForgot(){return v`
1102
1126
  <div class="stack">
1103
1127
  <form class="form" @submit=${this.onForgot} novalidate>
1104
1128
  ${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendResetLink"))}
1105
1129
  </form>
1106
1130
  ${this.backLink()}
1107
1131
  </div>
1108
- `}renderReset(){return this.recovery?S`
1132
+ `}renderReset(){return this.recovery?v`
1109
1133
  <div class="stack">
1110
1134
  <form class="form" @submit=${this.onReset} novalidate>
1111
1135
  ${this.passwordField({label:this.t("newPassword"),autocomplete:"new-password",id:"authui-password",field:"password",hint:this.t("passwordHint")})}
1112
1136
  ${this.passwordField({label:this.t("confirmPassword"),autocomplete:"new-password",id:"authui-password-confirm",field:"passwordConfirm"})}
1113
1137
  ${this.renderError()} ${this.submitButton(this.t("resetPassword"))}
1114
1138
  </form>
1115
- ${this.backLink()}
1139
+ <div class="links">
1140
+ <button
1141
+ type="button"
1142
+ class="btn btn-link"
1143
+ @click=${()=>{this.step="sign-in",this.error="",this.notice=null,this.focusOnStep=!0,this.fire("authui-view",{view:"sign-in"})}}
1144
+ >
1145
+ ${L.arrowLeft} ${this.t("back")}
1146
+ </button>
1147
+ </div>
1116
1148
  </div>
1117
- `:S`<div class="stack">
1149
+ `:v`<div class="stack">
1118
1150
  <div class="alert alert-error" role="alert">
1119
- ${X.alert}
1151
+ ${L.alert}
1120
1152
  <div class="alert-body">${this.t("errorInvalidToken")}</div>
1121
1153
  </div>
1122
- ${this.backLink()}
1123
- </div>`}phraseBox(e){return e?S`<div class="alert alert-info">
1124
- ${X.shield}
1154
+ <div class="links">
1155
+ <button
1156
+ type="button"
1157
+ class="btn btn-link"
1158
+ @click=${()=>{this.go("forgot-password")}}
1159
+ >
1160
+ ${this.t("requestNewLink")}
1161
+ </button>
1162
+ </div>
1163
+ </div>`}phraseBox(e){return e?v`<div class="alert alert-info">
1164
+ ${L.shield}
1125
1165
  <div class="alert-title">
1126
1166
  ${this.t("securityPhrase")}: <span class="code">${e}</span>
1127
1167
  </div>
1128
1168
  <div class="alert-body">${this.t("securityPhraseHint")}</div>
1129
- </div>`:x}renderMagicUrl(){return this.token?S`<div class="stack">
1169
+ </div>`:E}renderMagicUrl(){return this.token?v`<div class="stack">
1130
1170
  <div class="alert alert-success" role="status">
1131
- ${X.mail}
1171
+ ${L.mail}
1132
1172
  <div class="alert-body">${this.t("magicLinkSent",{email:this.token.target})}</div>
1133
1173
  </div>
1134
1174
  ${this.phraseBox(this.token.phrase)} ${this.backLink()}
1135
- </div>`:S`
1175
+ </div>`:v`
1136
1176
  <div class="stack">
1137
1177
  <form class="form" @submit=${this.onMagicUrl} novalidate>
1138
1178
  ${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendMagicLink"))}
1139
1179
  </form>
1140
- ${this.backLink()}
1180
+ ${this.backLink()} ${this.legal()}
1141
1181
  </div>
1142
- `}renderCodeEntry(){return S`
1182
+ `}async onResendCode(){const e=this.token;!e||Date.now()<this.resendCooldownUntil||(this.error="",await this.run(async()=>{if(e.kind==="phone"){const i=await x.sendPhoneOtp(e.target);this.token={userId:i.userId,kind:"phone",target:e.target}}else{const i=await x.sendEmailOtp(e.target);this.token={userId:i.userId,kind:"email-otp",target:e.target,phrase:i.phrase}}this.resendCooldownUntil=Date.now()+3e4,window.setTimeout(()=>this.requestUpdate(),3e4)}))}renderCodeEntry(){const e=this.token?.kind==="phone",i=Date.now()<this.resendCooldownUntil;return v`
1143
1183
  <div class="alert alert-info" role="status">
1144
- ${X.mail}
1184
+ ${e?L.smartphone:L.mail}
1145
1185
  <div class="alert-body">${this.t("codeSent",{target:this.token.target})}</div>
1146
1186
  </div>
1147
1187
  ${this.phraseBox(this.token.phrase)}
@@ -1149,22 +1189,31 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1149
1189
  ${this.codeField()} ${this.renderError()} ${this.submitButton(this.t("verifyCode"))}
1150
1190
  </form>
1151
1191
  <div class="links">
1152
- <button type="button" class="btn btn-link" @click=${()=>this.token=null}>
1153
- ${this.t("sendCode")}
1192
+ <button
1193
+ type="button"
1194
+ class="btn btn-link"
1195
+ ?disabled=${i||this.busy}
1196
+ @click=${()=>{this.onResendCode()}}
1197
+ >
1198
+ ${this.t("resendCode")}
1154
1199
  </button>
1155
1200
  <span aria-hidden="true">·</span>
1156
- <button type="button" class="btn btn-link" @click=${()=>this.go("sign-in")}>
1157
- ${this.t("back")}
1201
+ <button
1202
+ type="button"
1203
+ class="btn btn-link"
1204
+ @click=${()=>{this.token=null,this.error=""}}
1205
+ >
1206
+ ${e?this.t("useDifferentPhone"):this.t("useDifferentEmail")}
1158
1207
  </button>
1159
1208
  </div>
1160
- `}renderEmailOtp(){return this.token?S`<div class="stack">${this.renderCodeEntry()}</div>`:S`
1209
+ `}renderEmailOtp(){return this.token?v`<div class="stack">${this.renderCodeEntry()}</div>`:v`
1161
1210
  <div class="stack">
1162
1211
  <form class="form" @submit=${this.onEmailOtp} novalidate>
1163
1212
  ${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendCode"))}
1164
1213
  </form>
1165
- ${this.backLink()}
1214
+ ${this.backLink()} ${this.legal()}
1166
1215
  </div>
1167
- `}renderPhone(){return this.token?S`<div class="stack">${this.renderCodeEntry()}</div>`:S`
1216
+ `}renderPhone(){return this.token?v`<div class="stack">${this.renderCodeEntry()}</div>`:v`
1168
1217
  <div class="stack">
1169
1218
  <form class="form" @submit=${this.onPhoneOtp} novalidate>
1170
1219
  <div class="field">
@@ -1182,12 +1231,12 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1182
1231
  </div>
1183
1232
  ${this.renderError()} ${this.submitButton(this.t("sendCode"))}
1184
1233
  </form>
1185
- ${this.backLink()}
1234
+ ${this.backLink()} ${this.legal()}
1186
1235
  </div>
1187
- `}renderMfa(){const e=this.auth.mfaFactors;if(!this.challenge){const t=[{factor:"totp",icon:X.smartphone,label:this.t("mfaUseAuthenticator"),available:e?.totp??!0},{factor:"email",icon:X.mail,label:this.t("mfaUseEmail"),available:e?.email??!0},{factor:"phone",icon:X.phone,label:this.t("mfaUsePhone"),available:e?.phone??!0},{factor:"recoverycode",icon:X.key,label:this.t("mfaUseRecoveryCode"),available:e?.recoveryCode??!0}];return S`
1236
+ `}renderMfa(){const e=this.auth.mfaFactors;if(!this.challenge){const t=[{factor:"totp",icon:L.smartphone,label:this.t("mfaUseAuthenticator"),available:e?.totp??!0},{factor:"email",icon:L.mail,label:this.t("mfaUseEmail"),available:e?.email??!0},{factor:"phone",icon:L.phone,label:this.t("mfaUsePhone"),available:e?.phone??!0},{factor:"recoverycode",icon:L.key,label:this.t("mfaUseRecoveryCode"),available:e?.recoveryCode??!0}];return v`
1188
1237
  <div class="stack">
1189
1238
  <div class="stack-sm">
1190
- ${t.filter(o=>o.available).map(o=>S`<button
1239
+ ${t.filter(o=>o.available).map(o=>v`<button
1191
1240
  type="button"
1192
1241
  class="choice"
1193
1242
  @click=${()=>this.onChooseFactor(o.factor)}
@@ -1203,10 +1252,10 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1203
1252
  </button>
1204
1253
  </div>
1205
1254
  </div>
1206
- `}const i=this.challenge.factor==="recoverycode";return S`
1255
+ `}const i=this.challenge.factor==="recoverycode";return v`
1207
1256
  <div class="stack">
1208
1257
  <form class="form" @submit=${this.onVerifyFactor} novalidate>
1209
- ${i?S`<div class="field">
1258
+ ${i?v`<div class="field">
1210
1259
  <label class="label" for="authui-code">${this.t("recoveryCode")}</label>
1211
1260
  <input
1212
1261
  class="input mono"
@@ -1222,7 +1271,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1222
1271
  </form>
1223
1272
  <div class="links">
1224
1273
  <button type="button" class="btn btn-link" @click=${()=>this.challenge=null}>
1225
- ${X.arrowLeft} ${this.t("back")}
1274
+ ${L.arrowLeft} ${this.t("back")}
1226
1275
  </button>
1227
1276
  <span aria-hidden="true">·</span>
1228
1277
  <button type="button" class="btn btn-link" @click=${this.onCancelMfa}>
@@ -1230,60 +1279,79 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1230
1279
  </button>
1231
1280
  </div>
1232
1281
  </div>
1233
- `}},P.AuthUISignIn.styles=[...Ue.styles,bo],ke([F({type:String})],P.AuthUISignIn.prototype,"view",2),ke([F({type:Boolean})],P.AuthUISignIn.prototype,"embedded",2),ke([z()],P.AuthUISignIn.prototype,"step",2),ke([z()],P.AuthUISignIn.prototype,"busy",2),ke([z()],P.AuthUISignIn.prototype,"error",2),ke([z()],P.AuthUISignIn.prototype,"notice",2),ke([z()],P.AuthUISignIn.prototype,"showPassword",2),ke([z()],P.AuthUISignIn.prototype,"token",2),ke([z()],P.AuthUISignIn.prototype,"challenge",2),ke([z()],P.AuthUISignIn.prototype,"recovery",2),ke([Si("form input:not([type=hidden])")],P.AuthUISignIn.prototype,"firstInput",2),P.AuthUISignIn=ke([Ge("authui-sign-in")],P.AuthUISignIn);var ko=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,ae=(n,e,i,t)=>{for(var o=t>1?void 0:t?jo(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&ko(e,i,o),o};P.AuthUIAccount=class extends Ue{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",()=>q.updateName(this.nameInput),this.t("done"))},this.onUpdateEmail=e=>{e.preventDefault(),this.run("email",async()=>{await q.updateEmail(this.emailInput,this.emailPassword),this.emailPassword=""},this.t("done"))},this.onUpdatePhone=e=>{e.preventDefault(),this.run("phone",async()=>{await q.updatePhone(this.phoneInput,this.phonePassword),this.phonePassword=""},this.t("done"))},this.onConvertGuest=e=>{e.preventDefault(),this.run("guest",async()=>{await q.convertGuest(this.emailInput,this.emailPassword,this.guestName),this.emailPassword=""},this.t("done"))},this.onSendVerification=()=>{this.run("verify",()=>q.sendEmailVerification(),this.t("verificationSent"))},this.onSendPhoneVerification=()=>{this.run("verify-phone",async()=>{await q.sendPhoneVerification(),this.phoneCodeSent=!0})},this.onConfirmPhoneVerification=e=>{e.preventDefault(),this.run("verify-phone-code",async()=>{await q.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 q.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 q.setMfaEnabled(e),await this.loadFactors()})},this.onAddAuthenticator=()=>{this.run("authenticator",async()=>{this.authenticator=await q.addAuthenticator(),this.authenticatorCode=""})},this.onVerifyAuthenticator=e=>{e.preventDefault(),this.run("authenticator-code",async()=>{await q.verifyAuthenticator(this.authenticatorCode),this.authenticator=null,this.authenticatorCode="",await this.loadFactors()},this.t("done"))},this.onRemoveAuthenticator=()=>{this.run("remove-authenticator",async()=>{await q.removeAuthenticator(),await this.loadFactors()})},this.onRecoveryCodes=()=>{this.run("recovery",async()=>{try{this.recoveryCodes=await q.createRecoveryCodes()}catch(e){if(!vt(e,ce.recoveryCodesExist))throw e;this.recoveryCodes=await q.getRecoveryCodes()}await this.loadFactors()})},this.onRegenerateRecoveryCodes=()=>{this.run("recovery",async()=>{this.recoveryCodes=await q.regenerateRecoveryCodes()})},this.onCopyCodes=async()=>{if(this.recoveryCodes)try{await navigator.clipboard.writeText(this.recoveryCodes.join(`
1234
- `)),this.copied=!0,setTimeout(()=>this.copied=!1,1500)}catch{}},this.onStepUpFactor=e=>{this.run("stepup",async()=>{const i=await q.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 q.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 q.signOut(e),this.sessions=(this.sessions??[]).filter(i=>i.$id!==e)})},this.onSignOutAll=()=>{this.run("sessions-all",()=>q.signOutEverywhere())},this.onDeleteIdentity=e=>{this.run(`identity-${e}`,async()=>{await q.deleteIdentity(e),this.identities=(this.identities??[]).filter(i=>i.$id!==e)})},this.onDeleteAccount=()=>{this.run("delete",()=>q.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,t){if(!this.busy){this.busy=e,this.errors={...this.errors,[e]:""};try{await i(),t&&(this.notice={tone:"success",message:t})}catch(o){vt(o,ce.challengeRequired)?this.stepUp={retry:()=>this.run(e,i,t)}:this.errors={...this.errors,[e]:zt(o,this.strings,e.includes("code")?"code":"link")}}finally{this.busy=""}}}async loadSessions(){await this.run("sessions",async()=>{this.sessions=await q.listSessions()})}async loadIdentities(){await this.run("identities",async()=>{this.identities=await q.listIdentities()})}async loadLogs(){this.busy="logs";try{this.logs=await q.listLogs()}catch{this.logsSupported=!1,this.logs=[]}finally{this.busy=""}}async loadFactors(){if(!this.factorsLoading){this.factorsLoading=!0;try{this.factors=await q.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 S`<div class="alert alert-error" role="alert">
1235
- ${X.alert}
1282
+ `}},P.AuthUISignIn.styles=[...Ue.styles,Io],Ie([ee({type:String})],P.AuthUISignIn.prototype,"view",2),Ie([ee({type:Boolean})],P.AuthUISignIn.prototype,"embedded",2),Ie([Y()],P.AuthUISignIn.prototype,"step",2),Ie([Y()],P.AuthUISignIn.prototype,"busy",2),Ie([Y()],P.AuthUISignIn.prototype,"error",2),Ie([Y()],P.AuthUISignIn.prototype,"notice",2),Ie([Y()],P.AuthUISignIn.prototype,"showPassword",2),Ie([Y()],P.AuthUISignIn.prototype,"token",2),Ie([Y()],P.AuthUISignIn.prototype,"resendCooldownUntil",2),Ie([Y()],P.AuthUISignIn.prototype,"challenge",2),Ie([Y()],P.AuthUISignIn.prototype,"recovery",2),Ie([Pi("form input:not([type=hidden])")],P.AuthUISignIn.prototype,"firstInput",2),P.AuthUISignIn=Ie([Ge("authui-sign-in")],P.AuthUISignIn);var So=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,O=(n,e,i,t)=>{for(var o=t>1?void 0:t?jo(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&So(e,i,o),o};P.AuthUIAccount=class extends Ue{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=null,this.logsProbeStarted=!1,this.confirmDelete=!1,this.confirmRegenerate=!1,this.confirmRemoveAuthenticator=!1,this.confirmSignOutAll=!1,this.confirmDisconnectId=null,this.verifyEmailCooldownUntil=0,this.onTabsKeydown=e=>{const i=[...this.renderRoot?.querySelectorAll('[role="tab"]')??[]];if(!i.length)return;const t=i.findIndex(s=>s.getAttribute("aria-selected")==="true");let o=t;if(e.key==="ArrowRight"||e.key==="ArrowDown")o=(t+1)%i.length;else if(e.key==="ArrowLeft"||e.key==="ArrowUp")o=(t-1+i.length)%i.length;else if(e.key==="Home")o=0;else if(e.key==="End")o=i.length-1;else return;e.preventDefault();const a=i[o].id.replace("authui-tab-","");this.select(a),requestAnimationFrame(()=>i[o]?.focus())},this.noticeTimer=null,this.factorsLoading=!1,this.onUpdateName=e=>{e.preventDefault(),this.requireValid(e)&&this.run("name",()=>x.updateName(this.nameInput),this.t("nameUpdated"))},this.onUpdateEmail=e=>{e.preventDefault(),this.requireValid(e)&&this.run("email",async()=>{await x.updateEmail(this.emailInput,this.emailPassword),this.emailPassword=""},this.t("emailUpdated"))},this.onUpdatePhone=e=>{e.preventDefault(),this.requireValid(e)&&this.run("phone",async()=>{await x.updatePhone(this.phoneInput,this.phonePassword),this.phonePassword=""},this.t("phoneUpdated"))},this.onConvertGuest=e=>{e.preventDefault(),this.requireValid(e)&&this.run("guest",async()=>{await x.convertGuest(this.emailInput,this.emailPassword,this.guestName),this.emailPassword=""},this.t("accountConverted"))},this.onSendVerification=()=>{Date.now()<this.verifyEmailCooldownUntil||this.run("verify",async()=>{await x.sendEmailVerification(),this.verifyEmailCooldownUntil=Date.now()+45e3,window.setTimeout(()=>this.requestUpdate(),45e3)},this.t("verificationSent"))},this.onSendPhoneVerification=()=>{this.run("verify-phone",async()=>{await x.sendPhoneVerification(),this.phoneCodeSent=!0})},this.onConfirmPhoneVerification=e=>{e.preventDefault(),this.requireValid(e)&&this.run("verify-phone-code",async()=>{await x.confirmPhoneVerification(this.phoneCode),this.phoneCode="",this.phoneCodeSent=!1},this.t("phoneVerified"))},this.onChangePassword=e=>{if(e.preventDefault(),!!this.requireValid(e)){if(this.newPassword!==this.newPasswordConfirm){this.errors={...this.errors,password:this.t("errorPasswordMismatch")};return}this.run("password",async()=>{await x.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 x.setMfaEnabled(e),await this.loadFactors()})},this.onAddAuthenticator=()=>{this.run("authenticator",async()=>{this.authenticator=await x.addAuthenticator(),this.authenticatorCode=""})},this.onVerifyAuthenticator=e=>{e.preventDefault(),this.requireValid(e)&&this.run("authenticator-code",async()=>{await x.verifyAuthenticator(this.authenticatorCode),this.authenticator=null,this.authenticatorCode="",await this.loadFactors()},this.t("authenticatorAdded"))},this.onRemoveAuthenticator=()=>{if(!this.confirmRemoveAuthenticator){this.confirmRemoveAuthenticator=!0;return}this.confirmRemoveAuthenticator=!1,this.run("remove-authenticator",async()=>{await x.removeAuthenticator(),await this.loadFactors()})},this.onRecoveryCodes=()=>{this.run("recovery",async()=>{try{this.recoveryCodes=await x.createRecoveryCodes()}catch(e){if(!ct(e,re.recoveryCodesExist))throw e;this.recoveryCodes=await x.getRecoveryCodes()}await this.loadFactors()})},this.onRegenerateRecoveryCodes=()=>{if(!this.confirmRegenerate){this.confirmRegenerate=!0;return}this.confirmRegenerate=!1,this.run("recovery",async()=>{this.recoveryCodes=await x.regenerateRecoveryCodes()})},this.onCopyCodes=async()=>{if(this.recoveryCodes)try{await navigator.clipboard.writeText(this.recoveryCodes.join(`
1283
+ `)),this.copied=!0,setTimeout(()=>this.copied=!1,1500)}catch{this.setNotice("error",this.t("copyFailed"))}},this.onCopySecret=async()=>{const e=this.authenticator?.secret;if(e)try{await navigator.clipboard.writeText(e),this.copied=!0,setTimeout(()=>this.copied=!1,1500)}catch{this.setNotice("error",this.t("copyFailed"))}},this.onStepUpFactor=e=>{this.run("stepup",async()=>{const i=await x.createMfaChallenge(e);this.stepUp={...this.stepUp,challenge:{id:i.$id,factor:e}},this.stepUpCode=""})},this.onStepUpVerify=e=>{if(e.preventDefault(),!this.requireValid(e))return;const i=this.stepUp;i?.challenge&&this.run("stepup-code",async()=>{await x.completeMfaChallenge(i.challenge.id,this.stepUpCode,{signIn:!1}),this.stepUp=null,this.stepUpCode="",await i.retry()})},this.onDeleteSession=e=>{this.run(`session-${e}`,async()=>{if((this.sessions??[]).some(t=>t.$id===e&&t.current)){await x.signOut(),this.sessions=[];return}await x.signOut(e),this.sessions=(this.sessions??[]).filter(t=>t.$id!==e)})},this.onSignOutAll=()=>{if(!this.confirmSignOutAll){this.confirmSignOutAll=!0;return}this.confirmSignOutAll=!1,this.run("sessions-all",()=>x.signOutEverywhere())},this.onDeleteIdentity=e=>{if(this.confirmDisconnectId!==e){this.confirmDisconnectId=e;return}this.confirmDisconnectId=null,this.run(`identity-${e}`,async()=>{await x.deleteIdentity(e),this.identities=(this.identities??[]).filter(i=>i.$id!==e)})},this.onDeleteAccount=()=>{this.run("delete",()=>x.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.logsProbeStarted||this.probeLogsSupport(),this.active==="sessions"&&this.sessions===null?this.loadSessions():this.active==="connections"&&this.identities===null?this.loadIdentities():this.active==="activity"&&this.logsSupported===!0&&this.logs===null?this.loadLogs():this.active==="activity"&&this.logsSupported===!1?this.active="profile":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={}}updated(e){e.has("active")&&requestAnimationFrame(()=>{const i=this.renderRoot.querySelector('.tab[aria-selected="true"]');i&&typeof i.scrollIntoView=="function"&&i.scrollIntoView({inline:"nearest",block:"nearest",behavior:"smooth"})})}setNotice(e,i){this.notice={tone:e,message:i},this.noticeTimer&&clearTimeout(this.noticeTimer),this.noticeTimer=setTimeout(()=>{this.notice=null,this.noticeTimer=null},8e3)}requireValid(e){const i=e.target;return!(i&&typeof i.reportValidity=="function"&&!i.reportValidity())}async run(e,i,t){if(!this.busy){this.busy=e,this.errors={...this.errors,[e]:""},this.notice=null;try{await i(),t&&this.setNotice("success",t)}catch(o){ct(o,re.challengeRequired)?this.stepUp={retry:()=>this.run(e,i,t)}:this.errors={...this.errors,[e]:At(o,this.strings,e.includes("code")?"code":e==="password"?"password":"link")}}finally{this.busy=""}}}async loadSessions(){await this.run("sessions",async()=>{this.sessions=await x.listSessions()})}async loadIdentities(){await this.run("identities",async()=>{this.identities=await x.listIdentities()})}async probeLogsSupport(){if(!this.logsProbeStarted){this.logsProbeStarted=!0;try{this.logs=await x.listLogs(),this.logsSupported=!0}catch{this.logsSupported=!1,this.logs=[],this.active==="activity"&&(this.active="profile")}}}async loadLogs(){if(this.logsSupported===!1){this.active==="activity"&&(this.active="profile");return}this.busy="logs";try{this.logs=await x.listLogs()}catch{this.logsSupported=!1,this.logs=[],this.active==="activity"&&(this.active="profile")}finally{this.busy=""}}async loadFactors(){if(!this.factorsLoading){this.factorsLoading=!0;try{this.factors=await x.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">
1284
+ ${L.alert}
1236
1285
  <div class="alert-body">${this.t("errorNotConfigured")}</div>
1237
- </div>`;if(this.auth.status==="loading")return S`<div class="empty"><span class="spinner"></span></div>`;if(!this.user)return S`<div class="panel ${this.embedded?"embedded":""}">
1286
+ </div>`;if(this.auth.status==="loading")return v`<div class="panel ${this.embedded?"embedded":""}" part="panel">
1287
+ <div class="empty"><span class="spinner"></span></div>
1288
+ </div>`;if(!this.user)return v`<div class="panel ${this.embedded?"embedded":""}">
1238
1289
  <authui-sign-in embedded></authui-sign-in>
1239
- </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 S`
1290
+ </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`
1240
1291
  <div class="panel ${this.embedded?"embedded":""}" part="panel">
1241
1292
  ${this.renderIdentity()}
1242
- <div class="tabs" role="tablist">
1243
- ${e.map(i=>S`<button
1293
+ <div class="tabs" role="tablist" @keydown=${this.onTabsKeydown}>
1294
+ ${e.map(i=>v`<button
1244
1295
  class="tab"
1245
1296
  role="tab"
1297
+ id=${`authui-tab-${i.id}`}
1298
+ aria-controls=${`authui-panel-${i.id}`}
1246
1299
  aria-selected=${this.active===i.id?"true":"false"}
1300
+ tabindex=${this.active===i.id?"0":"-1"}
1247
1301
  @click=${()=>this.select(i.id)}
1248
1302
  >
1249
1303
  ${i.label}
1250
1304
  </button>`)}
1251
1305
  </div>
1252
- ${this.notice?S`<div class="alert alert-${this.notice.tone}" role="status">
1253
- ${this.notice.tone==="success"?X.checkCircle:X.info}
1306
+ ${this.notice?v`<div class="alert alert-${this.notice.tone}" role="status">
1307
+ ${this.notice.tone==="success"?L.checkCircle:L.info}
1254
1308
  <div class="alert-body">${this.notice.message}</div>
1255
- </div>`:x}
1256
- ${this.stepUp?this.renderStepUp():this.renderTab()}
1309
+ <button
1310
+ class="btn btn-ghost btn-icon dismiss"
1311
+ @click=${()=>{this.notice=null,this.noticeTimer&&(clearTimeout(this.noticeTimer),this.noticeTimer=null)}}
1312
+ aria-label=${this.t("close")}
1313
+ >
1314
+ ${L.x}
1315
+ </button>
1316
+ </div>`:E}
1317
+ ${this.stepUp?this.renderStepUp():v`<div
1318
+ class="tabpanel"
1319
+ role="tabpanel"
1320
+ id=${`authui-panel-${this.active}`}
1321
+ aria-labelledby=${`authui-tab-${this.active}`}
1322
+ >
1323
+ ${this.renderTab()}
1324
+ </div>`}
1257
1325
  </div>
1258
- `}renderIdentity(){const e=this.user,i=e.name||e.email||e.phone||this.t("guestAccount");return S`
1326
+ `}renderIdentity(){const e=this.user,i=e.name||e.email||e.phone||this.t("guestAccount");return v`
1259
1327
  <div class="between">
1260
1328
  <div class="identity">
1261
- <span class="avatar">${i[0]??"?"}</span>
1329
+ <span class="avatar">${ii(i)}</span>
1262
1330
  <div class="row-main">
1263
- <span class="row-title">
1331
+ <span class="row-title" title=${i}>
1264
1332
  ${i}
1265
- ${e.mfa?S`<span class="badge badge-success">${X.shieldCheck} MFA</span>`:x}
1266
- ${q.isPreview?S`<span class="badge badge-info">${this.t("preview")}</span>`:x}
1333
+ ${e.mfa?v`<span class="badge badge-success">${L.shieldCheck} ${this.t("mfaBadge")}</span>`:E}
1334
+ ${x.isPreview?v`<span class="badge badge-info">${this.t("preview")}</span>`:E}
1267
1335
  </span>
1268
- ${e.email&&e.name?S`<span class="row-sub">${e.email}</span>`:x}
1336
+ ${e.email&&e.name?v`<span class="row-sub" title=${e.email}>${e.email}</span>`:E}
1269
1337
  </div>
1270
1338
  </div>
1271
- <button class="btn btn-outline btn-sm" @click=${()=>q.signOut()}>
1272
- ${X.logOut} ${this.t("signOut")}
1339
+ <button class="btn btn-outline btn-sm" @click=${()=>x.signOut()}>
1340
+ ${L.logOut} ${this.t("signOut")}
1273
1341
  </button>
1274
1342
  </div>
1275
- `}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?S`<div class="alert alert-error" role="alert">
1276
- ${X.alert}
1343
+ `}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">
1344
+ ${L.alert}
1277
1345
  <div class="alert-body">${i}</div>
1278
- </div>`:x}spinner(e){return this.busy===e?S`<span class="spinner" aria-hidden="true"></span>`:x}card(e,i,t,o,a=!1){return S`<section class="card ${a?"card-danger":""}">
1346
+ </div>`:E}spinner(e){return this.busy===e?v`<span class="spinner" aria-hidden="true"></span>`:E}card(e,i,t,o,a=!1){return v`<section class="card ${a?"card-danger":""}">
1279
1347
  <div class="card-header">
1280
1348
  <h3 class="card-title">${e}</h3>
1281
- ${i?S`<p class="card-description">${i}</p>`:x}
1349
+ ${i?v`<p class="card-description">${i}</p>`:E}
1282
1350
  </div>
1283
1351
  <div class="card-body">${t}</div>
1284
- ${o?S`<div class="card-footer">${o}</div>`:x}
1285
- </section>`}verifiedBadge(e){return e?S`<span class="badge badge-success">${X.check} ${this.t("verified")}</span>`:S`<span class="badge badge-warning">${this.t("unverified")}</span>`}renderProfile(){const e=this.user;return this.isGuest?S`<div class="section">
1286
- ${this.card(this.t("guestAccount"),this.t("guestAccountDescription"),S`<form class="form" id="guest-form" @submit=${this.onConvertGuest} novalidate>
1352
+ ${o?v`<div class="card-footer">${o}</div>`:E}
1353
+ </section>`}verifiedBadge(e){return e?v`<span class="badge badge-success">${L.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">
1354
+ ${this.card(this.t("guestAccount"),this.t("guestAccountDescription"),v`<form class="form" id="guest-form" @submit=${this.onConvertGuest} novalidate>
1287
1355
  <div class="field">
1288
1356
  <label class="label" for="guest-name">${this.t("name")}</label>
1289
1357
  <input
@@ -1321,7 +1389,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1321
1389
  <p class="hint">${this.t("passwordHint")}</p>
1322
1390
  </div>
1323
1391
  ${this.error("guest")}
1324
- </form>`,S`<button
1392
+ </form>`,v`<button
1325
1393
  class="btn btn-primary btn-sm"
1326
1394
  type="submit"
1327
1395
  form="guest-form"
@@ -1329,8 +1397,8 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1329
1397
  >
1330
1398
  ${this.spinner("guest")} ${this.t("createAccount")}
1331
1399
  </button>`)}
1332
- </div>`:S`<div class="section">
1333
- ${this.card(this.t("name"),void 0,S`<form class="form" id="name-form" @submit=${this.onUpdateName} novalidate>
1400
+ </div>`:v`<div class="section">
1401
+ ${this.card(this.t("name"),void 0,v`<form class="form" id="name-form" @submit=${this.onUpdateName} novalidate>
1334
1402
  <div class="field">
1335
1403
  <label class="label" for="acc-name">${this.t("name")}</label>
1336
1404
  <input
@@ -1343,19 +1411,19 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1343
1411
  />
1344
1412
  </div>
1345
1413
  ${this.error("name")}
1346
- </form>`,S`<button
1414
+ </form>`,v`<button
1347
1415
  class="btn btn-primary btn-sm"
1348
1416
  type="submit"
1349
1417
  form="name-form"
1350
- ?disabled=${!!this.busy||this.nameInput===e.name}
1418
+ ?disabled=${!!this.busy||!this.nameInput.trim()||this.nameInput===e.name}
1351
1419
  >
1352
1420
  ${this.spinner("name")} ${this.t("update")}
1353
1421
  </button>`)}
1354
- ${this.card(this.t("email"),void 0,S`<form class="form" id="email-form" @submit=${this.onUpdateEmail} novalidate>
1422
+ ${this.card(this.t("email"),void 0,v`<form class="form" id="email-form" @submit=${this.onUpdateEmail} novalidate>
1355
1423
  <div class="field">
1356
1424
  <label class="label" for="acc-email"
1357
1425
  >${this.t("email")}
1358
- ${e.email?this.verifiedBadge(e.emailVerification):x}</label
1426
+ ${e.email?this.verifiedBadge(e.emailVerification):E}</label
1359
1427
  >
1360
1428
  <input
1361
1429
  class="input"
@@ -1367,42 +1435,46 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1367
1435
  required
1368
1436
  />
1369
1437
  </div>
1370
- ${this.emailInput!==e.email?S`<div class="field">
1371
- <label class="label" for="acc-email-password">${this.t("currentPassword")}</label>
1438
+ ${this.emailInput!==e.email?v`<div class="field">
1439
+ <label class="label" for="acc-email-password"
1440
+ >${e.passwordUpdate?this.t("currentPassword"):this.t("createPassword")}</label
1441
+ >
1372
1442
  <input
1373
1443
  class="input"
1374
1444
  id="acc-email-password"
1375
1445
  type="password"
1376
1446
  .value=${this.emailPassword}
1377
1447
  @input=${this.bind("emailPassword")}
1378
- autocomplete="current-password"
1448
+ autocomplete=${e.passwordUpdate?"current-password":"new-password"}
1379
1449
  required
1380
1450
  />
1381
- </div>`:x}
1451
+ ${e.passwordUpdate?E:v`<p class="hint">${this.t("createPasswordHint")}</p>`}
1452
+ </div>`:E}
1382
1453
  ${this.error("email")} ${this.error("verify")}
1383
- </form>`,S`
1384
- ${e.email&&!e.emailVerification?S`<button
1454
+ </form>`,v`
1455
+ ${e.email&&!e.emailVerification?v`<button
1385
1456
  class="btn btn-outline btn-sm"
1386
1457
  type="button"
1387
1458
  @click=${this.onSendVerification}
1388
- ?disabled=${!!this.busy}
1459
+ ?disabled=${!!this.busy||Date.now()<this.verifyEmailCooldownUntil}
1389
1460
  >
1390
- ${this.spinner("verify")} ${this.t("verifyEmail")}
1391
- </button>`:x}
1461
+ ${this.spinner("verify")}
1462
+ ${Date.now()<this.verifyEmailCooldownUntil?this.t("verificationResendIn",{seconds:Math.max(1,Math.ceil((this.verifyEmailCooldownUntil-Date.now())/1e3))}):this.t("verifyEmail")}
1463
+ </button>`:E}
1392
1464
  <button
1393
1465
  class="btn btn-primary btn-sm"
1394
1466
  type="submit"
1395
1467
  form="email-form"
1396
- ?disabled=${!!this.busy||this.emailInput===e.email}
1468
+ ?disabled=${!!this.busy||!this.emailInput.trim()||this.emailInput===e.email}
1397
1469
  >
1398
1470
  ${this.spinner("email")} ${this.t("update")}
1399
1471
  </button>
1400
1472
  `)}
1401
- ${this.card(this.t("phone"),void 0,S`<form class="form" id="phone-form" @submit=${this.onUpdatePhone} novalidate>
1473
+ ${this.card(this.t("phone"),void 0,v`<form class="form" id="phone-form" @submit=${this.onUpdatePhone} novalidate>
1402
1474
  <div class="field">
1403
1475
  <label class="label" for="acc-phone"
1404
1476
  >${this.t("phone")}
1405
- ${e.phone?this.verifiedBadge(e.phoneVerification):x}</label
1477
+ ${e.phone?this.verifiedBadge(e.phoneVerification):E}</label
1406
1478
  >
1407
1479
  <input
1408
1480
  class="input"
@@ -1414,61 +1486,68 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1414
1486
  autocomplete="tel"
1415
1487
  />
1416
1488
  </div>
1417
- ${this.phoneInput!==e.phone?S`<div class="field">
1418
- <label class="label" for="acc-phone-password">${this.t("currentPassword")}</label>
1489
+ ${this.phoneInput!==e.phone?v`<div class="field">
1490
+ <label class="label" for="acc-phone-password"
1491
+ >${e.passwordUpdate?this.t("currentPassword"):this.t("createPassword")}</label
1492
+ >
1419
1493
  <input
1420
1494
  class="input"
1421
1495
  id="acc-phone-password"
1422
1496
  type="password"
1423
1497
  .value=${this.phonePassword}
1424
1498
  @input=${this.bind("phonePassword")}
1425
- autocomplete="current-password"
1499
+ autocomplete=${e.passwordUpdate?"current-password":"new-password"}
1426
1500
  required
1427
1501
  />
1428
- </div>`:x}
1429
- ${this.phoneCodeSent?S`<div class="field">
1502
+ ${e.passwordUpdate?E:v`<p class="hint">${this.t("createPasswordHint")}</p>`}
1503
+ </div>`:E}
1504
+ ${this.phoneCodeSent?v`<div class="field">
1430
1505
  <label class="label" for="acc-phone-code">${this.t("code")}</label>
1431
1506
  <input
1432
1507
  class="input input-otp"
1433
1508
  id="acc-phone-code"
1434
1509
  inputmode="numeric"
1435
1510
  autocomplete="one-time-code"
1511
+ maxlength="6"
1512
+ pattern="[0-9]*"
1513
+ required
1436
1514
  .value=${this.phoneCode}
1437
1515
  @input=${this.bind("phoneCode")}
1516
+ @keydown=${i=>{i.key==="Enter"&&(i.preventDefault(),this.onConfirmPhoneVerification(i))}}
1438
1517
  />
1439
- </div>`:x}
1518
+ </div>`:E}
1440
1519
  ${this.error("phone")} ${this.error("verify-phone")} ${this.error("verify-phone-code")}
1441
- </form>`,S`
1442
- ${e.phone&&!e.phoneVerification&&!this.phoneCodeSent?S`<button
1520
+ </form>`,v`
1521
+ ${e.phone&&!e.phoneVerification&&!this.phoneCodeSent?v`<button
1443
1522
  class="btn btn-outline btn-sm"
1444
1523
  type="button"
1445
1524
  @click=${this.onSendPhoneVerification}
1446
1525
  ?disabled=${!!this.busy}
1447
1526
  >
1448
1527
  ${this.spinner("verify-phone")} ${this.t("sendCode")}
1449
- </button>`:x}
1450
- ${this.phoneCodeSent?S`<button
1528
+ </button>`:E}
1529
+ ${this.phoneCodeSent?v`<button
1451
1530
  class="btn btn-outline btn-sm"
1452
1531
  type="button"
1453
1532
  @click=${this.onConfirmPhoneVerification}
1454
1533
  ?disabled=${!!this.busy}
1455
1534
  >
1456
1535
  ${this.spinner("verify-phone-code")} ${this.t("verifyCode")}
1457
- </button>`:x}
1536
+ </button>`:E}
1458
1537
  <button
1459
1538
  class="btn btn-primary btn-sm"
1460
1539
  type="submit"
1461
1540
  form="phone-form"
1462
- ?disabled=${!!this.busy||this.phoneInput===e.phone}
1541
+ ?disabled=${!!this.busy||!this.phoneInput.trim()||this.phoneInput===e.phone}
1463
1542
  >
1464
1543
  ${this.spinner("phone")} ${this.t("update")}
1465
1544
  </button>
1466
1545
  `)}
1467
1546
  ${this.renderDanger()}
1468
- </div>`}renderDanger(){return this.card(this.t("deleteAccount"),this.t("deleteAccountDescription"),S`${this.error("delete")}
1469
- ${this.confirmDelete?S`<div class="inline">
1547
+ </div>`}renderDanger(){return this.card(this.t("deleteAccount"),this.t("deleteAccountDescription"),v`${this.error("delete")}
1548
+ ${this.confirmDelete?v`<div class="inline">
1470
1549
  <button
1471
- class="btn btn-destructive btn-sm"
1550
+ class="btn btn-outline btn-sm warn"
1472
1551
  @click=${this.onDeleteAccount}
1473
1552
  ?disabled=${!!this.busy}
1474
1553
  >
@@ -1477,19 +1556,19 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1477
1556
  <button class="btn btn-ghost btn-sm" @click=${()=>this.confirmDelete=!1}>
1478
1557
  ${this.t("cancel")}
1479
1558
  </button>
1480
- </div>`:S`<button
1559
+ </div>`:v`<button
1481
1560
  class="btn btn-outline btn-sm warn"
1482
1561
  @click=${()=>this.confirmDelete=!0}
1483
1562
  >
1484
- ${X.userX} ${this.t("deleteAccount")}
1485
- </button>`}`,void 0,!0)}renderSecurity(){const e=this.user,i=this.config?.mfa!==!1;return S`<div class="section">
1486
- ${this.isGuest?x:this.card(this.t("changePassword"),void 0,S`<form
1563
+ ${L.userX} ${this.t("deleteAccount")}
1564
+ </button>`}`,void 0,!0)}renderSecurity(){const e=this.user,i=this.config?.mfa!==!1;return v`<div class="section">
1565
+ ${this.isGuest?E:this.card(this.t("changePassword"),void 0,v`<form
1487
1566
  class="form"
1488
1567
  id="password-form"
1489
1568
  @submit=${this.onChangePassword}
1490
1569
  novalidate
1491
1570
  >
1492
- ${e.passwordUpdate?S`<div class="field">
1571
+ ${e.passwordUpdate?v`<div class="field">
1493
1572
  <label class="label" for="acc-old-password"
1494
1573
  >${this.t("currentPassword")}</label
1495
1574
  >
@@ -1500,8 +1579,9 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1500
1579
  .value=${this.oldPassword}
1501
1580
  @input=${this.bind("oldPassword")}
1502
1581
  autocomplete="current-password"
1582
+ required
1503
1583
  />
1504
- </div>`:x}
1584
+ </div>`:E}
1505
1585
  <div class="field">
1506
1586
  <label class="label" for="acc-new-password">${this.t("newPassword")}</label>
1507
1587
  <input
@@ -1532,7 +1612,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1532
1612
  />
1533
1613
  </div>
1534
1614
  ${this.error("password")}
1535
- </form>`,S`<button
1615
+ </form>`,v`<button
1536
1616
  class="btn btn-primary btn-sm"
1537
1617
  type="submit"
1538
1618
  form="password-form"
@@ -1540,13 +1620,13 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1540
1620
  >
1541
1621
  ${this.spinner("password")} ${this.t("update")}
1542
1622
  </button>`)}
1543
- ${i?this.renderMfaCard():x}
1544
- ${i?this.renderRecoveryCard():x}
1545
- </div>`}renderMfaCard(){const e=this.user,i=this.factors?.totp??!1,t=this.authenticator?q.isPreview?ro(this.authenticator.uri):new xi(q.getClient()).getQR(this.authenticator.uri,400,1).toString():"";return this.card(this.t("twoFactor"),this.t("twoFactorDescription"),S`<div class="kv">
1623
+ ${i?this.renderMfaCard():E}
1624
+ ${i?this.renderRecoveryCard():E}
1625
+ </div>`}renderMfaCard(){const e=this.user,i=this.factors?.totp??!1,t=this.authenticator?x.isPreview?co(this.authenticator.uri):new xi(x.getClient()).getQR(this.authenticator.uri,400,1).toString():"";return this.card(this.t("twoFactor"),this.t("twoFactorDescription"),v`<div class="kv">
1546
1626
  <div class="toggle-row">
1547
1627
  <div class="row-main">
1548
1628
  <span class="row-title">${this.t("twoFactor")}</span>
1549
- <span class="row-sub">${e.mfa?this.t("enable"):this.t("disable")}d</span>
1629
+ <span class="row-sub">${e.mfa?this.t("enabled"):this.t("disabled")}</span>
1550
1630
  </div>
1551
1631
  <button
1552
1632
  class="switch"
@@ -1557,22 +1637,52 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1557
1637
  aria-label=${this.t("twoFactor")}
1558
1638
  ></button>
1559
1639
  </div>
1640
+ ${e.mfa&&!(this.factors?.totp||e.emailVerification||e.phoneVerification)?v`<div class="alert alert-warning" role="status">
1641
+ ${L.alert}
1642
+ <div class="alert-body">
1643
+ ${this.t("mfaNoFactorWarning")}
1644
+ ${this.factors?.totp?E:v`<div class="links">
1645
+ <button
1646
+ type="button"
1647
+ class="btn btn-link"
1648
+ @click=${this.onAddAuthenticator}
1649
+ ?disabled=${!!this.busy||!!this.authenticator}
1650
+ >
1651
+ ${this.t("authenticatorAdd")}
1652
+ </button>
1653
+ </div>`}
1654
+ </div>
1655
+ </div>`:E}
1560
1656
  ${this.error("mfa")}
1561
1657
  <div class="separator"></div>
1562
1658
  <div class="toggle-row">
1563
1659
  <div class="row-main">
1564
1660
  <span class="row-title"
1565
- >${X.smartphone} ${this.t("authenticatorApp")}
1566
- ${i?this.verifiedBadge(!0):x}</span
1661
+ >${L.smartphone} ${this.t("authenticatorApp")}
1662
+ ${i?this.verifiedBadge(!0):E}</span
1567
1663
  >
1568
1664
  </div>
1569
- ${i?S`<button
1570
- class="btn btn-outline btn-sm"
1571
- @click=${this.onRemoveAuthenticator}
1572
- ?disabled=${!!this.busy}
1573
- >
1574
- ${this.spinner("remove-authenticator")} ${this.t("remove")}
1575
- </button>`:this.authenticator?x:S`<button
1665
+ ${i?this.confirmRemoveAuthenticator?v`<div class="inline">
1666
+ <button
1667
+ class="btn btn-outline btn-sm warn"
1668
+ @click=${this.onRemoveAuthenticator}
1669
+ ?disabled=${!!this.busy}
1670
+ >
1671
+ ${this.spinner("remove-authenticator")} ${this.t("remove")}
1672
+ </button>
1673
+ <button
1674
+ class="btn btn-ghost btn-sm"
1675
+ @click=${()=>this.confirmRemoveAuthenticator=!1}
1676
+ >
1677
+ ${this.t("cancel")}
1678
+ </button>
1679
+ </div>`:v`<button
1680
+ class="btn btn-outline btn-sm"
1681
+ @click=${this.onRemoveAuthenticator}
1682
+ ?disabled=${!!this.busy}
1683
+ >
1684
+ ${this.spinner("remove-authenticator")} ${this.t("remove")}
1685
+ </button>`:this.authenticator?E:v`<button
1576
1686
  class="btn btn-outline btn-sm"
1577
1687
  @click=${this.onAddAuthenticator}
1578
1688
  ?disabled=${!!this.busy}
@@ -1581,13 +1691,23 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1581
1691
  </button>`}
1582
1692
  </div>
1583
1693
  ${this.error("authenticator")} ${this.error("remove-authenticator")}
1584
- ${this.authenticator?S`<form class="form" @submit=${this.onVerifyAuthenticator} novalidate>
1694
+ ${this.authenticator?v`<form class="form" @submit=${this.onVerifyAuthenticator} novalidate>
1585
1695
  <p class="hint">${this.t("authenticatorScan")}</p>
1586
- <img class="qr" src=${t} alt="QR code" />
1587
- <p class="hint center">
1588
- ${this.t("authenticatorManual")}:
1589
- <span class="code">${this.authenticator.secret}</span>
1590
- </p>
1696
+ <img class="qr" src=${t} alt=${this.t("qrCodeAlt")} />
1697
+ <p class="hint center">${this.t("authenticatorManual")}</p>
1698
+ <div class="inline">
1699
+ <span class="code"
1700
+ >${this.authenticator.secret.match(/.{1,4}/g)?.join(" ")??this.authenticator.secret}</span
1701
+ >
1702
+ <button
1703
+ class="btn btn-ghost btn-sm"
1704
+ type="button"
1705
+ @click=${()=>{this.onCopySecret()}}
1706
+ >
1707
+ ${this.copied?L.check:L.copy}
1708
+ ${this.copied?this.t("copied"):this.t("authenticatorCopyKey")}
1709
+ </button>
1710
+ </div>
1591
1711
  <div class="field">
1592
1712
  <label class="label" for="acc-totp">${this.t("code")}</label>
1593
1713
  <input
@@ -1595,6 +1715,8 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1595
1715
  id="acc-totp"
1596
1716
  inputmode="numeric"
1597
1717
  autocomplete="one-time-code"
1718
+ maxlength="6"
1719
+ pattern="[0-9]*"
1598
1720
  required
1599
1721
  .value=${this.authenticatorCode}
1600
1722
  @input=${this.bind("authenticatorCode")}
@@ -1613,37 +1735,57 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1613
1735
  ${this.t("cancel")}
1614
1736
  </button>
1615
1737
  </div>
1616
- </form>`:x}
1617
- </div>`)}renderRecoveryCard(){const e=this.factors?.recoveryCode??!1;return this.card(this.t("recoveryCodes"),this.t("recoveryCodesDescription"),S`<div class="kv">
1618
- ${this.recoveryCodes?S`<div class="alert alert-warning">
1619
- ${X.alert}
1738
+ </form>`:E}
1739
+ </div>`)}renderRecoveryCard(){const e=this.factors?.recoveryCode??!1;return this.card(this.t("recoveryCodes"),this.t("recoveryCodesDescription")+" "+this.t("recoveryCodesOnceHint"),v`<div class="kv">
1740
+ ${this.recoveryCodes?v`<div class="alert alert-warning">
1741
+ ${L.alert}
1620
1742
  <div class="alert-body">${this.t("recoveryCodesWarning")}</div>
1621
1743
  </div>
1622
1744
  <div class="codes">
1623
- ${this.recoveryCodes.map(i=>S`<span class="code">${i}</span>`)}
1745
+ ${this.recoveryCodes.map(i=>v`<span class="code">${i}</span>`)}
1624
1746
  </div>
1625
1747
  <div class="inline">
1626
1748
  <button class="btn btn-outline btn-sm" @click=${this.onCopyCodes}>
1627
- ${this.copied?X.check:X.copy}
1749
+ ${this.copied?L.check:L.copy}
1628
1750
  ${this.copied?this.t("copied"):this.t("copy")}
1629
1751
  </button>
1630
1752
  <button class="btn btn-ghost btn-sm" @click=${()=>this.recoveryCodes=null}>
1631
1753
  ${this.t("done")}
1632
1754
  </button>
1633
- </div>`:S`<div class="inline">
1755
+ </div>`:v`<div class="inline">
1634
1756
  <button
1635
1757
  class="btn btn-outline btn-sm"
1636
1758
  @click=${this.onRecoveryCodes}
1637
1759
  ?disabled=${!!this.busy}
1638
1760
  >
1639
- ${this.spinner("recovery")} ${X.key}
1640
- ${e?this.t("recoveryCodes"):this.t("generateRecoveryCodes")}
1761
+ ${this.spinner("recovery")} ${L.key}
1762
+ ${e?this.t("viewRecoveryCodes"):this.t("generateRecoveryCodes")}
1641
1763
  </button>
1642
- ${e?S`<button class="btn btn-ghost btn-sm" @click=${this.onRegenerateRecoveryCodes} ?disabled=${!!this.busy}>${X.refresh} ${this.t("regenerateRecoveryCodes")}</button>`:x}
1764
+ ${e?this.confirmRegenerate?v`<div class="inline">
1765
+ <button
1766
+ class="btn btn-outline btn-sm warn"
1767
+ @click=${this.onRegenerateRecoveryCodes}
1768
+ ?disabled=${!!this.busy}
1769
+ >
1770
+ ${L.refresh} ${this.t("regenerateRecoveryCodes")}
1771
+ </button>
1772
+ <button
1773
+ class="btn btn-ghost btn-sm"
1774
+ @click=${()=>this.confirmRegenerate=!1}
1775
+ >
1776
+ ${this.t("cancel")}
1777
+ </button>
1778
+ </div>`:v`<button
1779
+ class="btn btn-ghost btn-sm"
1780
+ @click=${this.onRegenerateRecoveryCodes}
1781
+ ?disabled=${!!this.busy}
1782
+ >
1783
+ ${L.refresh} ${this.t("regenerateRecoveryCodes")}
1784
+ </button>`:E}
1643
1785
  </div>`}
1644
1786
  ${this.error("recovery")}
1645
- </div>`)}renderStepUp(){const e=this.stepUp,i=this.factors,t=[{factor:"totp",icon:X.smartphone,label:this.t("mfaUseAuthenticator"),available:i?.totp??!0},{factor:"email",icon:X.mail,label:this.t("mfaUseEmail"),available:i?.email??!0},{factor:"phone",icon:X.phone,label:this.t("mfaUsePhone"),available:i?.phone??!0},{factor:"recoverycode",icon:X.key,label:this.t("mfaUseRecoveryCode"),available:i?.recoveryCode??!0}];return this.card(this.t("mfaTitle"),this.t("errorChallengeRequired"),S`<div class="kv">
1646
- ${e.challenge?S`<form class="form" @submit=${this.onStepUpVerify} novalidate>
1787
+ </div>`)}renderStepUp(){const e=this.stepUp,i=this.factors,t=[{factor:"totp",icon:L.smartphone,label:this.t("mfaUseAuthenticator"),available:i?.totp??!0},{factor:"email",icon:L.mail,label:this.t("mfaUseEmail"),available:i?.email??!0},{factor:"phone",icon:L.phone,label:this.t("mfaUsePhone"),available:i?.phone??!0},{factor:"recoverycode",icon:L.key,label:this.t("mfaUseRecoveryCode"),available:i?.recoveryCode??!0}];return this.card(this.t("mfaTitle"),this.t("errorChallengeRequired"),v`<div class="kv">
1788
+ ${e.challenge?v`<form class="form" @submit=${this.onStepUpVerify} novalidate>
1647
1789
  <div class="field">
1648
1790
  <label class="label" for="acc-stepup"
1649
1791
  >${e.challenge.factor==="recoverycode"?this.t("recoveryCode"):this.t("code")}</label
@@ -1651,6 +1793,9 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1651
1793
  <input
1652
1794
  class="input ${e.challenge.factor==="recoverycode"?"mono":"input-otp"}"
1653
1795
  id="acc-stepup"
1796
+ inputmode=${e.challenge.factor==="recoverycode"?"text":"numeric"}
1797
+ maxlength=${e.challenge.factor==="recoverycode"?"64":"6"}
1798
+ pattern=${e.challenge.factor==="recoverycode"?".*":"[0-9]*"}
1654
1799
  autocomplete="one-time-code"
1655
1800
  required
1656
1801
  .value=${this.stepUpCode}
@@ -1660,8 +1805,8 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1660
1805
  <button class="btn btn-primary btn-sm" type="submit" ?disabled=${!!this.busy}>
1661
1806
  ${this.spinner("stepup-code")} ${this.t("verifyCode")}
1662
1807
  </button>
1663
- </form>`:S`<div class="stack-sm">
1664
- ${t.filter(o=>o.available).map(o=>S`<button
1808
+ </form>`:v`<div class="stack-sm">
1809
+ ${t.filter(o=>o.available).map(o=>v`<button
1665
1810
  type="button"
1666
1811
  class="choice"
1667
1812
  @click=${()=>this.onStepUpFactor(o.factor)}
@@ -1671,18 +1816,18 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1671
1816
  </button>`)}
1672
1817
  </div>`}
1673
1818
  ${this.error("stepup")} ${this.error("stepup-code")}
1674
- </div>`,S`<button class="btn btn-ghost btn-sm" @click=${()=>this.stepUp=null}>
1819
+ </div>`,v`<button class="btn btn-ghost btn-sm" @click=${()=>this.stepUp=null}>
1675
1820
  ${this.t("cancel")}
1676
- </button>`)}deviceIcon(e){const i=(e.deviceName||"").toLowerCase(),t=(e.osName||e.osCode||"").toLowerCase();return/phone|tablet|mobile/.test(i)||/ios|android|ipados/.test(t)?X.smartphone:/desktop|browser/.test(i)||/mac|windows|linux|chrome os/.test(t)?X.monitor:X.globe}renderSessions(){const e=this.sessions;return S`<div class="section">
1677
- ${this.card(this.t("sessions"),void 0,S`${this.error("sessions")}
1678
- ${e===null?S`<div class="empty"><span class="spinner"></span></div>`:e.length===0?S`<div class="empty">${this.t("noActivity")}</div>`:e.map(i=>S`<div class="row">
1821
+ </button>`)}deviceIcon(e){const i=(e.deviceName||"").toLowerCase(),t=(e.osName||e.osCode||"").toLowerCase();return/phone|tablet|mobile/.test(i)||/ios|android|ipados/.test(t)?L.smartphone:/desktop|browser/.test(i)||/mac|windows|linux|chrome os/.test(t)?L.monitor:L.globe}renderSessions(){const e=this.sessions;return v`<div class="section">
1822
+ ${this.card(this.t("sessions"),void 0,v`${this.error("sessions")}
1823
+ ${e===null?v`<div class="empty"><span class="spinner"></span></div>`:e.length===0?v`<div class="empty">${this.t("noSessions")}</div>`:e.map(i=>v`<div class="row">
1679
1824
  <div class="inline">
1680
1825
  <span class="device">${this.deviceIcon(i)}</span>
1681
1826
  <div class="row-main">
1682
1827
  <span class="row-title">
1683
1828
  ${i.clientName||i.provider}
1684
- ${i.clientVersion?S`<span class="muted small">${i.clientVersion}</span>`:x}
1685
- ${i.current?S`<span class="badge badge-info">${this.t("currentSession")}</span>`:x}
1829
+ ${i.clientVersion?v`<span class="muted small">${i.clientVersion}</span>`:E}
1830
+ ${i.current?v`<span class="badge badge-info">${this.t("currentSession")}</span>`:E}
1686
1831
  </span>
1687
1832
  <span class="row-sub"
1688
1833
  >${[i.osName,i.countryName||i.countryCode,i.ip].filter(Boolean).join(" · ")}</span
@@ -1690,53 +1835,84 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1690
1835
  </div>
1691
1836
  </div>
1692
1837
  <div class="row-actions">
1693
- ${this.busy===`session-${i.$id}`?S`<span class="spinner"></span>`:x}
1838
+ ${this.busy===`session-${i.$id}`?v`<span class="spinner"></span>`:E}
1694
1839
  <button
1695
1840
  class="btn btn-ghost btn-sm"
1696
1841
  @click=${()=>this.onDeleteSession(i.$id)}
1697
1842
  ?disabled=${!!this.busy}
1698
1843
  aria-label=${this.t("signOutSession")}
1699
1844
  >
1700
- ${X.logOut}
1845
+ ${L.logOut}
1701
1846
  </button>
1702
1847
  </div>
1703
1848
  </div>`)}`)}
1704
- ${this.card(this.t("signOutAllSessions"),this.t("signOutAllSessionsDescription"),S`${this.error("sessions-all")}
1705
- <button
1706
- class="btn btn-outline btn-sm warn"
1707
- @click=${this.onSignOutAll}
1708
- ?disabled=${!!this.busy}
1709
- >
1710
- ${this.spinner("sessions-all")} ${X.logOut} ${this.t("signOutAllSessions")}
1711
- </button>`,void 0,!0)}
1712
- </div>`}renderConnections(){const e=this.identities,i=this.config?.methods?.oauth??[];return S`<div class="section">
1713
- ${this.card(this.t("connections"),void 0,S`${this.error("identities")}
1714
- ${e===null?S`<div class="empty"><span class="spinner"></span></div>`:e.length===0?S`<div class="empty">${this.t("noConnections")}</div>`:e.map(t=>S`<div class="row">
1849
+ ${this.card(this.t("signOutAllSessions"),this.t("signOutAllSessionsDescription"),v`${this.error("sessions-all")}
1850
+ ${this.confirmSignOutAll?v`<div class="inline">
1851
+ <button
1852
+ class="btn btn-outline btn-sm warn"
1853
+ @click=${this.onSignOutAll}
1854
+ ?disabled=${!!this.busy}
1855
+ >
1856
+ ${this.spinner("sessions-all")} ${L.logOut} ${this.t("signOutAllSessions")}
1857
+ </button>
1858
+ <button
1859
+ class="btn btn-ghost btn-sm"
1860
+ @click=${()=>this.confirmSignOutAll=!1}
1861
+ >
1862
+ ${this.t("cancel")}
1863
+ </button>
1864
+ </div>`:v`<button
1865
+ class="btn btn-outline btn-sm warn"
1866
+ @click=${this.onSignOutAll}
1867
+ ?disabled=${!!this.busy}
1868
+ >
1869
+ ${this.spinner("sessions-all")} ${L.logOut} ${this.t("signOutAllSessions")}
1870
+ </button>`}`,void 0,!0)}
1871
+ </div>`}renderConnections(){const e=this.identities,i=this.config?.methods?.oauth??[];return v`<div class="section">
1872
+ ${this.card(this.t("connections"),void 0,v`${this.error("identities")}
1873
+ ${e===null?v`<div class="empty"><span class="spinner"></span></div>`:e.length===0?v`<div class="empty">${this.t("noConnections")}</div>`:e.map(t=>v`<div class="row">
1715
1874
  <div class="inline">
1716
- <span class="device">${ei(t.provider)}</span>
1875
+ <span class="device">${ti(t.provider)}</span>
1717
1876
  <div class="row-main">
1718
1877
  <span class="row-title">${Te(t.provider)}</span>
1719
1878
  <span class="row-sub">${t.providerEmail||t.providerUid}</span>
1720
1879
  </div>
1721
1880
  </div>
1722
1881
  <div class="row-actions">
1723
- <button
1724
- class="btn btn-ghost btn-sm"
1725
- @click=${()=>this.onDeleteIdentity(t.$id)}
1726
- ?disabled=${!!this.busy}
1727
- >
1728
- ${this.busy===`identity-${t.$id}`?S`<span class="spinner"></span>`:x}
1729
- ${this.t("disconnect")}
1730
- </button>
1882
+ ${this.confirmDisconnectId===t.$id?v`<div class="inline">
1883
+ <button
1884
+ class="btn btn-outline btn-sm warn"
1885
+ @click=${()=>this.onDeleteIdentity(t.$id)}
1886
+ ?disabled=${!!this.busy}
1887
+ >
1888
+ ${this.busy===`identity-${t.$id}`?v`<span class="spinner"></span>`:E}
1889
+ ${this.t("disconnect")}
1890
+ </button>
1891
+ <button
1892
+ class="btn btn-ghost btn-sm"
1893
+ @click=${()=>this.confirmDisconnectId=null}
1894
+ >
1895
+ ${this.t("cancel")}
1896
+ </button>
1897
+ </div>`:v`<button
1898
+ class="btn btn-ghost btn-sm"
1899
+ @click=${()=>this.onDeleteIdentity(t.$id)}
1900
+ ?disabled=${!!this.busy}
1901
+ >
1902
+ ${this.busy===`identity-${t.$id}`?v`<span class="spinner"></span>`:E}
1903
+ ${this.t("disconnect")}
1904
+ </button>`}
1731
1905
  </div>
1732
- </div>`)}`,i.length>0?S`${i.filter(t=>!(e??[]).some(o=>o.provider===t)).map(t=>S`<button
1906
+ </div>`)}`,i.length>0?v`${i.filter(t=>!(e??[]).some(o=>o.provider===t)).map(t=>v`<button
1733
1907
  class="btn btn-outline btn-sm"
1734
- @click=${()=>q.signInWithOAuth(t)}
1908
+ @click=${()=>{this.run(`connect-${t}`,()=>x.signInWithOAuth(t))}}
1909
+ ?disabled=${!!this.busy}
1735
1910
  >
1736
- ${ei(t)} ${Te(t)}
1911
+ ${this.spinner(`connect-${t}`)} ${ti(t)}
1912
+ ${this.t("connectProvider",{provider:Te(t)})}
1737
1913
  </button>`)}`:void 0)}
1738
- </div>`}renderActivity(){const e=this.logs;return S`<div class="section">
1739
- ${this.card(this.t("activity"),void 0,S`${e===null?S`<div class="empty"><span class="spinner"></span></div>`:e.length===0?S`<div class="empty">${this.t("noActivity")}</div>`:e.map(i=>S`<div class="row">
1914
+ </div>`}renderActivity(){const e=this.logs;return v`<div class="section">
1915
+ ${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">
1740
1916
  <div class="row-main">
1741
1917
  <span class="row-title">${i.event}</span>
1742
1918
  <span class="row-sub"
@@ -1750,8 +1926,11 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1750
1926
  display: block;
1751
1927
  width: 100%;
1752
1928
  max-width: 560px;
1929
+ min-width: 0;
1753
1930
  }
1754
1931
  .panel {
1932
+ min-width: 0;
1933
+ overflow: hidden;
1755
1934
  background: var(--authui-card);
1756
1935
  color: var(--authui-card-foreground);
1757
1936
  border: 1px solid var(--authui-border);
@@ -1772,6 +1951,22 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1772
1951
  display: flex;
1773
1952
  align-items: center;
1774
1953
  gap: 12px;
1954
+ min-width: 0;
1955
+ flex: 1;
1956
+ }
1957
+ .identity .row-title {
1958
+ display: block;
1959
+ overflow: hidden;
1960
+ text-overflow: ellipsis;
1961
+ white-space: nowrap;
1962
+ }
1963
+ .identity .row-title .badge {
1964
+ display: inline-flex;
1965
+ vertical-align: middle;
1966
+ margin-inline-start: 6px;
1967
+ }
1968
+ .between > .btn {
1969
+ flex-shrink: 0;
1775
1970
  }
1776
1971
  .identity .avatar {
1777
1972
  width: 44px;
@@ -1820,14 +2015,15 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1820
2015
  .warn {
1821
2016
  color: var(--authui-destructive-foreground);
1822
2017
  }
1823
- `],ae([F({type:Boolean})],P.AuthUIAccount.prototype,"embedded",2),ae([F({type:String})],P.AuthUIAccount.prototype,"tab",2),ae([z()],P.AuthUIAccount.prototype,"active",2),ae([z()],P.AuthUIAccount.prototype,"busy",2),ae([z()],P.AuthUIAccount.prototype,"notice",2),ae([z()],P.AuthUIAccount.prototype,"errors",2),ae([z()],P.AuthUIAccount.prototype,"nameInput",2),ae([z()],P.AuthUIAccount.prototype,"emailInput",2),ae([z()],P.AuthUIAccount.prototype,"emailPassword",2),ae([z()],P.AuthUIAccount.prototype,"phoneInput",2),ae([z()],P.AuthUIAccount.prototype,"phonePassword",2),ae([z()],P.AuthUIAccount.prototype,"phoneCode",2),ae([z()],P.AuthUIAccount.prototype,"phoneCodeSent",2),ae([z()],P.AuthUIAccount.prototype,"guestName",2),ae([z()],P.AuthUIAccount.prototype,"oldPassword",2),ae([z()],P.AuthUIAccount.prototype,"newPassword",2),ae([z()],P.AuthUIAccount.prototype,"newPasswordConfirm",2),ae([z()],P.AuthUIAccount.prototype,"authenticator",2),ae([z()],P.AuthUIAccount.prototype,"authenticatorCode",2),ae([z()],P.AuthUIAccount.prototype,"factors",2),ae([z()],P.AuthUIAccount.prototype,"recoveryCodes",2),ae([z()],P.AuthUIAccount.prototype,"stepUp",2),ae([z()],P.AuthUIAccount.prototype,"stepUpCode",2),ae([z()],P.AuthUIAccount.prototype,"copied",2),ae([z()],P.AuthUIAccount.prototype,"sessions",2),ae([z()],P.AuthUIAccount.prototype,"identities",2),ae([z()],P.AuthUIAccount.prototype,"logs",2),ae([z()],P.AuthUIAccount.prototype,"logsSupported",2),ae([z()],P.AuthUIAccount.prototype,"confirmDelete",2),P.AuthUIAccount=ae([Ge("authui-account")],P.AuthUIAccount);var So=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,Oe=(n,e,i,t)=>{for(var o=t>1?void 0:t?$o(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&So(e,i,o),o};P.AuthUIModal=class extends Ue{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 S`
2018
+ `],O([ee({type:Boolean})],P.AuthUIAccount.prototype,"embedded",2),O([ee({type:String})],P.AuthUIAccount.prototype,"tab",2),O([Y()],P.AuthUIAccount.prototype,"active",2),O([Y()],P.AuthUIAccount.prototype,"busy",2),O([Y()],P.AuthUIAccount.prototype,"notice",2),O([Y()],P.AuthUIAccount.prototype,"errors",2),O([Y()],P.AuthUIAccount.prototype,"nameInput",2),O([Y()],P.AuthUIAccount.prototype,"emailInput",2),O([Y()],P.AuthUIAccount.prototype,"emailPassword",2),O([Y()],P.AuthUIAccount.prototype,"phoneInput",2),O([Y()],P.AuthUIAccount.prototype,"phonePassword",2),O([Y()],P.AuthUIAccount.prototype,"phoneCode",2),O([Y()],P.AuthUIAccount.prototype,"phoneCodeSent",2),O([Y()],P.AuthUIAccount.prototype,"guestName",2),O([Y()],P.AuthUIAccount.prototype,"oldPassword",2),O([Y()],P.AuthUIAccount.prototype,"newPassword",2),O([Y()],P.AuthUIAccount.prototype,"newPasswordConfirm",2),O([Y()],P.AuthUIAccount.prototype,"authenticator",2),O([Y()],P.AuthUIAccount.prototype,"authenticatorCode",2),O([Y()],P.AuthUIAccount.prototype,"factors",2),O([Y()],P.AuthUIAccount.prototype,"recoveryCodes",2),O([Y()],P.AuthUIAccount.prototype,"stepUp",2),O([Y()],P.AuthUIAccount.prototype,"stepUpCode",2),O([Y()],P.AuthUIAccount.prototype,"copied",2),O([Y()],P.AuthUIAccount.prototype,"sessions",2),O([Y()],P.AuthUIAccount.prototype,"identities",2),O([Y()],P.AuthUIAccount.prototype,"logs",2),O([Y()],P.AuthUIAccount.prototype,"logsSupported",2),O([Y()],P.AuthUIAccount.prototype,"confirmDelete",2),O([Y()],P.AuthUIAccount.prototype,"confirmRegenerate",2),O([Y()],P.AuthUIAccount.prototype,"confirmRemoveAuthenticator",2),O([Y()],P.AuthUIAccount.prototype,"confirmSignOutAll",2),O([Y()],P.AuthUIAccount.prototype,"confirmDisconnectId",2),O([Y()],P.AuthUIAccount.prototype,"verifyEmailCooldownUntil",2),P.AuthUIAccount=O([Ge("authui-account")],P.AuthUIAccount);var $o=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,Fe=(n,e,i,t)=>{for(var o=t>1?void 0:t?Po(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&$o(e,i,o),o};P.AuthUIModal=class extends Ue{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==="account"&&this.auth.status!=="signed-in"?this.view="sign-in":e?this.view=e:this.auth.status==="signed-in"?this.view="account":this.view="sign-in",this.open=!0}hide(){this.open=!1}updated(e){if(e.has("open")&&this.dialog&&(this.open&&!this.dialog.open&&(this.dialog.showModal(),requestAnimationFrame(()=>this.focusPrimary())),!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),this.open&&this.view==="account"&&this.auth.status!=="signed-in"&&(this.view="sign-in"),this.open&&this.auth.status==="signed-out"&&this.view==="account"&&(this.view="sign-in")}}focusPrimary(){const e=this.dialog;if(!e)return;const t=e.querySelector("authui-sign-in, authui-account")?.shadowRoot;(t?.querySelector(".alert[role=alert], .alert[role=status]")??t?.querySelector("input:not([type=hidden]), button.choice, [role=tab]"))?.focus?.()}render(){const e=this.auth.status==="signed-in",i=this.view==="account"&&e;return v`
1824
2019
  <dialog
1825
- class=${e?"wide":""}
1826
- aria-labelledby="authui-title"
2020
+ class=${i?"wide":""}
2021
+ aria-label=${i?this.t("dialogAccount"):this.t("dialogSignIn")}
1827
2022
  @close=${()=>this.open=!1}
1828
- @cancel=${i=>{i.preventDefault(),this.hide()}}
2023
+ @cancel=${t=>{t.preventDefault(),this.hide()}}
1829
2024
  @click=${this.onBackdrop}
1830
2025
  @authui-open=${this.onInnerOpen}
2026
+ @authui-success=${this.onSuccess}
1831
2027
  >
1832
2028
  <div class="body">
1833
2029
  <button
@@ -1835,13 +2031,12 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1835
2031
  @click=${this.hide}
1836
2032
  aria-label=${this.t("close")}
1837
2033
  >
1838
- ${X.x}
2034
+ ${L.x}
1839
2035
  </button>
1840
- ${this.open?e?S`<authui-account embedded></authui-account>`:S`<authui-sign-in
2036
+ ${this.open?i?v`<authui-account embedded></authui-account>`:v`<authui-sign-in
1841
2037
  embedded
1842
- .view=${this.view}
1843
- @authui-success=${this.onSuccess}
1844
- ></authui-sign-in>`:x}
2038
+ .view=${this.view==="account"?"sign-in":this.view}
2039
+ ></authui-sign-in>`:E}
1845
2040
  </div>
1846
2041
  </dialog>
1847
2042
  `}},P.AuthUIModal.styles=[...Ue.styles,Le`
@@ -1902,9 +2097,9 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1902
2097
  authui-account {
1903
2098
  max-width: none;
1904
2099
  }
1905
- `],Oe([F({type:Boolean,reflect:!0})],P.AuthUIModal.prototype,"open",2),Oe([F({type:String})],P.AuthUIModal.prototype,"view",2),Oe([F({type:Boolean,attribute:"close-on-success"})],P.AuthUIModal.prototype,"closeOnSuccess",2),Oe([z()],P.AuthUIModal.prototype,"handledPending",2),Oe([Si("dialog")],P.AuthUIModal.prototype,"dialog",2),P.AuthUIModal=Oe([Ge("authui-modal")],P.AuthUIModal);function rt(n){typeof document>"u"||(document.querySelector("authui-modal")||document.body.appendChild(document.createElement("authui-modal")),queueMicrotask(()=>{window.dispatchEvent(new CustomEvent("authui:open",{detail:{view:n}}))}))}function Gi(){typeof window>"u"||window.dispatchEvent(new CustomEvent("authui:close"))}var Po=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,kt=(n,e,i,t)=>{for(var o=t>1?void 0:t?Uo(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&Po(e,i,o),o};P.AuthUIButton=class extends Ue{constructor(){super(...arguments),this.view="sign-in",this.variant="primary",this.size="md"}render(){const e=this.size==="md"?"":`btn-${this.size}`;return S`<button
2100
+ `],Fe([ee({type:Boolean,reflect:!0})],P.AuthUIModal.prototype,"open",2),Fe([ee({type:String})],P.AuthUIModal.prototype,"view",2),Fe([ee({type:Boolean,attribute:"close-on-success"})],P.AuthUIModal.prototype,"closeOnSuccess",2),Fe([Y()],P.AuthUIModal.prototype,"handledPending",2),Fe([Pi("dialog")],P.AuthUIModal.prototype,"dialog",2),P.AuthUIModal=Fe([Ge("authui-modal")],P.AuthUIModal);var Uo=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,St=(n,e,i,t)=>{for(var o=t>1?void 0:t?Co(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&Uo(e,i,o),o};P.AuthUIButton=class extends Ue{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
1906
2101
  class="btn btn-${this.variant} ${e}"
1907
- @click=${()=>rt(this.view)}
2102
+ @click=${()=>Oe(this.view)}
1908
2103
  part="button"
1909
2104
  >
1910
2105
  <slot
@@ -1917,9 +2112,9 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1917
2112
  .btn {
1918
2113
  width: 100%;
1919
2114
  }
1920
- `],kt([F({type:String})],P.AuthUIButton.prototype,"view",2),kt([F({type:String})],P.AuthUIButton.prototype,"variant",2),kt([F({type:String})],P.AuthUIButton.prototype,"size",2),P.AuthUIButton=kt([Ge("authui-button")],P.AuthUIButton);var Co=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,ti=(n,e,i,t)=>{for(var o=t>1?void 0:t?Mo(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&Co(e,i,o),o};P.AuthUIUserButton=class extends Ue{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),this.addEventListener("keydown",this.onKeydown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.onDocumentClick,!0),document.removeEventListener("keydown",this.onKeydown),this.removeEventListener("keydown",this.onKeydown)}render(){const{status:e,user:i}=this.auth;if(e==="loading")return S`<span class="avatar"><span class="spinner"></span></span>`;if(e!=="signed-in"||!i)return S`<button class="btn btn-primary btn-sm" @click=${()=>rt("sign-in")}>
2115
+ `],St([ee({type:String})],P.AuthUIButton.prototype,"view",2),St([ee({type:String})],P.AuthUIButton.prototype,"variant",2),St([ee({type:String})],P.AuthUIButton.prototype,"size",2),P.AuthUIButton=St([Ge("authui-button")],P.AuthUIButton);var Mo=Object.defineProperty,Ro=Object.getOwnPropertyDescriptor,ni=(n,e,i,t)=>{for(var o=t>1?void 0:t?Ro(e,i):e,a=n.length-1,s;a>=0;a--)(s=n[a])&&(o=(t?s(e,i,o):s(o))||o);return t&&o&&Mo(e,i,o),o};P.AuthUIUserButton=class extends Ue{constructor(){super(...arguments),this.src="",this.menuOpen=!1,this.onDocumentClick=e=>{e.composedPath().includes(this)||(this.menuOpen=!1)},this.onKeydown=e=>{if(!this.menuOpen){(e.key==="ArrowDown"||e.key==="Enter"||e.key===" ")&&e.target===this.renderRoot?.querySelector(".trigger")&&e.key==="ArrowDown"&&(e.preventDefault(),this.menuOpen=!0,requestAnimationFrame(()=>this.focusMenuItem(0)));return}const i=[...this.renderRoot?.querySelectorAll('[role="menuitem"]')??[]],t=i.findIndex(o=>o===this.shadowRoot?.activeElement);if(e.key==="Escape"){e.preventDefault(),this.menuOpen=!1,this.renderRoot?.querySelector(".trigger")?.focus();return}e.key==="ArrowDown"?(e.preventDefault(),this.focusMenuItem(t<0?0:(t+1)%i.length)):e.key==="ArrowUp"?(e.preventDefault(),this.focusMenuItem(t<0?i.length-1:(t-1+i.length)%i.length)):e.key==="Home"?(e.preventDefault(),this.focusMenuItem(0)):e.key==="End"&&(e.preventDefault(),this.focusMenuItem(i.length-1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.onDocumentClick,!0),document.addEventListener("keydown",this.onKeydown),this.addEventListener("keydown",this.onKeydown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.onDocumentClick,!0),document.removeEventListener("keydown",this.onKeydown),this.removeEventListener("keydown",this.onKeydown)}focusMenuItem(e){[...this.renderRoot?.querySelectorAll('[role="menuitem"]')??[]][e]?.focus()}updated(e){e.has("menuOpen")&&this.menuOpen&&requestAnimationFrame(()=>this.focusMenuItem(0))}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=${()=>Oe("sign-in")}>
1921
2116
  <slot>${this.t("signIn")}</slot>
1922
- </button>`;const t=i.name||i.email||i.phone||this.t("guestAccount");return S`
2117
+ </button>`;const t=i.name||i.email||i.phone||this.t("guestAccount");return v`
1923
2118
  <button
1924
2119
  class="trigger"
1925
2120
  aria-haspopup="menu"
@@ -1928,29 +2123,29 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1928
2123
  aria-label=${t}
1929
2124
  >
1930
2125
  <span class="avatar"
1931
- >${this.src?S`<img src=${this.src} alt="" />`:t[0]??"?"}</span
2126
+ >${this.src?v`<img src=${this.src} alt="" />`:ii(t)}</span
1932
2127
  >
1933
2128
  </button>
1934
- ${this.menuOpen?S`<div class="menu" role="menu">
2129
+ ${this.menuOpen?v`<div class="menu" role="menu">
1935
2130
  <div class="menu-header">
1936
- <span class="row-title">${t}</span>
1937
- ${i.email&&i.name?S`<span class="row-sub">${i.email}</span>`:x}
2131
+ <span class="row-title" title=${t}>${t}</span>
2132
+ ${i.email&&i.name?v`<span class="row-sub" title=${i.email}>${i.email}</span>`:E}
1938
2133
  </div>
1939
2134
  <button
1940
2135
  class="menu-item"
1941
2136
  role="menuitem"
1942
- @click=${()=>{this.menuOpen=!1,rt("account")}}
2137
+ @click=${()=>{this.menuOpen=!1,Oe("account")}}
1943
2138
  >
1944
- ${X.settings} ${this.t("manageAccount")}
2139
+ ${L.settings} ${this.t("manageAccount")}
1945
2140
  </button>
1946
2141
  <button
1947
2142
  class="menu-item"
1948
2143
  role="menuitem"
1949
- @click=${()=>{this.menuOpen=!1,q.signOut()}}
2144
+ @click=${()=>{this.menuOpen=!1,x.signOut()}}
1950
2145
  >
1951
- ${X.logOut} ${this.t("signOut")}
2146
+ ${L.logOut} ${this.t("signOut")}
1952
2147
  </button>
1953
- </div>`:x}
2148
+ </div>`:E}
1954
2149
  `}},P.AuthUIUserButton.styles=[...Ue.styles,Le`
1955
2150
  :host {
1956
2151
  display: inline-block;
@@ -1978,6 +2173,7 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1978
2173
  top: calc(100% + 6px);
1979
2174
  inset-inline-end: 0;
1980
2175
  min-width: 220px;
2176
+ max-width: min(320px, 90vw);
1981
2177
  background: var(--authui-popover);
1982
2178
  color: var(--authui-popover-foreground);
1983
2179
  border: 1px solid var(--authui-border);
@@ -1990,6 +2186,8 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1990
2186
  gap: 2px;
1991
2187
  }
1992
2188
  .menu-header {
2189
+ min-width: 0;
2190
+ overflow: hidden;
1993
2191
  padding: 8px 10px 10px;
1994
2192
  display: flex;
1995
2193
  flex-direction: column;
@@ -1997,6 +2195,14 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
1997
2195
  border-bottom: 1px solid var(--authui-border);
1998
2196
  margin-bottom: 4px;
1999
2197
  }
2198
+ .menu .row-title,
2199
+ .menu .row-sub {
2200
+ display: block;
2201
+ overflow: hidden;
2202
+ text-overflow: ellipsis;
2203
+ white-space: nowrap;
2204
+ }
2205
+
2000
2206
  .menu-item {
2001
2207
  display: flex;
2002
2208
  align-items: center;
@@ -2027,4 +2233,4 @@ var AuthUI=(function(P){"use strict";var xe;const lt=globalThis,St=lt.ShadowRoot
2027
2233
  height: 32px;
2028
2234
  font-size: 13px;
2029
2235
  }
2030
- `],ti([F({type:String})],P.AuthUIUserButton.prototype,"src",2),ti([z()],P.AuthUIUserButton.prototype,"menuOpen",2),P.AuthUIUserButton=ti([Ge("authui-user-button")],P.AuthUIUserButton);function Ki(n){return q.configure(n),tn}function Ji(n){rt(n)}function Yi(){Gi()}function Zi(){return q.signOut()}function Qi(){return q.user}function Ti(){return q.getState()}function zi(){return q.getClient()}function Oi(){return q.getAccount()}function Fi(){return q.previewSignIn()}function en(n,e){return q.on(n,e)}const tn={init:Ki,open:Ji,close:Yi,signOut:Zi,getUser:Qi,getState:Ti,getClient:zi,getAccount:Oi,on:en,previewSignIn:Fi,store:q};return P.AuthStore=Bi,P.AuthUI=tn,P.AuthUIElement=Ue,P.ErrorTypes=ce,P.PreviewAccount=Ni,P.appwrite=no,P.authStore=q,P.close=Yi,P.closeModal=Gi,P.defaultStrings=qi,P.describeError=zt,P.getAccount=Oi,P.getClient=zi,P.getState=Ti,P.getUser=Qi,P.init=Ki,P.on=en,P.open=Ji,P.openModal=rt,P.previewSignIn=Fi,P.providerLabel=Te,P.signOut=Zi,P.toAuthUIError=st,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),P})({});
2236
+ `],ni([ee({type:String})],P.AuthUIUserButton.prototype,"src",2),ni([Y()],P.AuthUIUserButton.prototype,"menuOpen",2),P.AuthUIUserButton=ni([Ge("authui-user-button")],P.AuthUIUserButton);function Ji(n){return x.configure(n),nn}function Yi(n){Oe(n)}function Zi(){Ki()}function Qi(){return x.signOut()}function Ti(){return x.user}function zi(){return x.getState()}function Oi(){return x.getClient()}function Fi(){return x.getAccount()}function en(){return x.previewSignIn()}function tn(n,e){return x.on(n,e)}const nn={init:Ji,open:Yi,close:Zi,signOut:Qi,getUser:Ti,getState:zi,getClient:Oi,getAccount:Fi,on:tn,previewSignIn:en,store:x};return P.AuthStore=Xi,P.AuthUI=nn,P.AuthUIElement=Ue,P.ErrorTypes=re,P.PreviewAccount=Hi,P.appwrite=oo,P.authStore=x,P.close=Zi,P.closeModal=Ki,P.defaultStrings=_i,P.describeError=At,P.getAccount=Fi,P.getClient=Oi,P.getState=zi,P.getUser=Ti,P.init=Ji,P.on=tn,P.open=Yi,P.openModal=Oe,P.previewSignIn=en,P.providerLabel=Te,P.signOut=Qi,P.toAuthUIError=rt,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),P})({});