@getauthui/core 0.1.11 → 0.1.12
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.
- package/README.md +3 -3
- package/dist/{authui-user-button-BErNabVH.js → authui-user-button--QfXbaC8.js} +300 -227
- package/dist/authui.cdn.js +259 -211
- package/dist/authui.cdn.mjs +629 -556
- package/dist/authui.js +2 -2
- package/dist/components/authui-account.d.ts +7 -0
- package/dist/components/authui-account.d.ts.map +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
package/dist/authui.cdn.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var AuthUI=(function(
|
|
1
|
+
var AuthUI=(function(I){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot&&(yt.ShadyCSS===void 0||yt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Et=Symbol(),Ii=new WeakMap;let Ai=class{constructor(e,i,t){if(this._$cssResult$=!0,t!==Et)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(Rt&&e===void 0){const t=i!==void 0&&i.length===1;t&&(e=Ii.get(i)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&Ii.set(i,e))}return e}toString(){return this.cssText}};const vn=n=>new Ai(typeof n=="string"?n:n+"",void 0,Et),Ne=(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 Ai(i,n,Et)},In=(n,e)=>{if(Rt)n.adoptedStyleSheets=e.map(i=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(const i of e){const t=document.createElement("style"),o=yt.litNonce;o!==void 0&&t.setAttribute("nonce",o),t.textContent=i.cssText,n.appendChild(t)}},ki=Rt?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let i="";for(const t of e.cssRules)i+=t.cssText;return vn(i)})(n):n;const{is:An,defineProperty:kn,getOwnPropertyDescriptor:Sn,getOwnPropertyNames:$n,getOwnPropertySymbols:jn,getPrototypeOf:Pn}=Object,mt=globalThis,Si=mt.trustedTypes,Cn=Si?Si.emptyScript:"",Un=mt.reactiveElementPolyfillSupport,ot=(n,e)=>n,wt={toAttribute(n,e){switch(e){case Boolean:n=n?Cn: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}},qt=(n,e)=>!An(n,e),$i={attribute:!0,type:String,converter:wt,reflect:!1,useDefault:!1,hasChanged:qt};Symbol.metadata??=Symbol("metadata"),mt.litPropertyMetadata??=new WeakMap;let ze=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=$i){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&&kn(this.prototype,e,o)}}static getPropertyDescriptor(e,i,t){const{get:o,set:a}=Sn(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)??$i}static _$Ei(){if(this.hasOwnProperty(ot("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(ot("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ot("properties"))){const i=this.properties,t=[...$n(i),...jn(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(ki(o))}else e!==void 0&&i.push(ki(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 In(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:wt).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:wt;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??qt)(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){}};ze.elementStyles=[],ze.shadowRootOptions={mode:"open"},ze[ot("elementProperties")]=new Map,ze[ot("finalized")]=new Map,Un?.({ReactiveElement:ze}),(mt.reactiveElementVersions??=[]).push("2.1.2");const _t=globalThis,ji=n=>n,bt=_t.trustedTypes,Pi=bt?bt.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ci="$lit$",De=`lit$${Math.random().toFixed(9).slice(2)}$`,Ui="?"+De,xn=`<${Ui}>`,Ve=document,at=()=>Ve.createComment(""),st=n=>n===null||typeof n!="object"&&typeof n!="function",Lt=Array.isArray,Mn=n=>Lt(n)||typeof n?.[Symbol.iterator]=="function",Nt=`[
|
|
2
2
|
\f\r]`,rt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xi=/-->/g,Mi=/>/g,We=RegExp(`>|${Nt}(?:([^\\s"'>=/]+)(${Nt}*=${Nt}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ri=/'/g,Ei=/"/g,qi=/^(?:script|style|textarea|title)$/i,_i=n=>(e,...i)=>({_$litType$:n,strings:e,values:i}),b=_i(1),G=_i(2),Oe=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),Li=new WeakMap,Ge=Ve.createTreeWalker(Ve,129);function Ni(n,e){if(!Lt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Pi!==void 0?Pi.createHTML(e):e}const Rn=(n,e)=>{const i=n.length-1,t=[];let o,a=e===2?"<svg>":e===3?"<math>":"",s=rt;for(let r=0;r<i;r++){const d=n[r];let c,l,u=-1,m=0;for(;m<d.length&&(s.lastIndex=m,l=s.exec(d),l!==null);)m=s.lastIndex,s===rt?l[1]==="!--"?s=xi:l[1]!==void 0?s=Mi:l[2]!==void 0?(qi.test(l[2])&&(o=RegExp("</"+l[2],"g")),s=We):l[3]!==void 0&&(s=We):s===We?l[0]===">"?(s=o??rt,u=-1):l[1]===void 0?u=-2:(u=s.lastIndex-l[2].length,c=l[1],s=l[3]===void 0?We:l[3]==='"'?Ei:Ri):s===Ei||s===Ri?s=We:s===xi||s===Mi?s=rt:(s=We,o=void 0);const j=s===We&&n[r+1].startsWith("/>")?" ":"";a+=s===rt?d+xn:u>=0?(t.push(c),d.slice(0,u)+Ci+d.slice(u)+He+j):d+He+(u===-2?r:j)}return[Ni(n,a+(n[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),t]};class ct{constructor({strings:e,_$litType$:i},t){let o;this.parts=[];let a=0,s=0;const r=e.length-1,d=this.parts,[c,l]=Rn(e,i);if(this.el=ct.createElement(c,t),Ge.currentNode=this.el.content,i===2||i===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=Ge.nextNode())!==null&&d.length<r;){if(o.nodeType===1){if(o.hasAttributes())for(const u of o.getAttributeNames())if(u.endsWith(Ci)){const m=l[s++],j=o.getAttribute(u).split(He),q=/([.?@])?(.*)/.exec(m);d.push({type:1,index:a,name:q[2],strings:j,ctor:q[1]==="."?qn:q[1]==="?"?_n:q[1]==="@"?Ln:vt}),o.removeAttribute(u)}else u.startsWith(He)&&(d.push({type:6,index:a}),o.removeAttribute(u));if(qi.test(o.tagName)){const u=o.textContent.split(He),m=u.length-1;if(m>0){o.textContent=wt?wt.emptyScript:"";for(let j=0;j<m;j++)o.append(u[j],at()),Ge.nextNode(),d.push({type:2,index:++a});o.append(u[m],at())}}}else if(o.nodeType===8)if(o.data===Ui)d.push({type:2,index:a});else{let u=-1;for(;(u=o.data.indexOf(He,u+1))!==-1;)d.push({type:7,index:a}),u+=He.length-1}a++}}static createElement(e,i){const t=Ve.createElement("template");return t.innerHTML=e,t}}function Fe(n,e,i=n,t){if(e===Oe)return e;let o=t!==void 0?i._$Co?.[t]:i._$Cl;const a=st(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=Fe(n,o._$AS(n,e.values),o,t)),e}class En{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??Ve).importNode(i,!0);Ge.currentNode=o;let a=Ge.nextNode(),s=0,r=0,d=t[0];for(;d!==void 0;){if(s===d.index){let c;d.type===2?c=new dt(a,a.nextSibling,this,e):d.type===1?c=new d.ctor(a,d.name,d.strings,this,e):d.type===6&&(c=new Nn(a,this,e)),this._$AV.push(c),d=t[++r]}s!==d?.index&&(a=Ge.nextNode(),s++)}return Ge.currentNode=Ve,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 dt{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=Fe(this,e,i),st(e)?e===x||e==null||e===""?(this._$AH!==x&&this._$AR(),this._$AH=x):e!==this._$AH&&e!==Oe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Mn(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&&st(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ve.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=ct.createElement(Ni(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===o)this._$AH.p(i);else{const a=new En(o,this),s=a.u(this.options);a.p(i),this.T(s),this._$AH=a}}_$AC(e){let i=Li.get(e.strings);return i===void 0&&Li.set(e.strings,i=new ct(e)),i}k(e){Lt(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 dt(this.O(at()),this.O(at()),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=ji(e).nextSibling;ji(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class vt{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=Fe(this,e,i,0),s=!st(e)||e!==this._$AH&&e!==Oe,s&&(this._$AH=e);else{const r=e;let d,c;for(e=a[0],d=0;d<a.length-1;d++)c=Fe(this,r[t+d],i,d),c===Oe&&(c=this._$AH[d]),s||=!st(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 qn extends vt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===x?void 0:e}}class _n extends vt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==x)}}class Ln extends vt{constructor(e,i,t,o,a){super(e,i,t,o,a),this.type=5}_$AI(e,i=this){if((e=Fe(this,e,i,0)??x)===Oe)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 Nn{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){Fe(this,e)}}const Hn=_t.litHtmlPolyfillSupport;Hn?.(ct,dt),(_t.litHtmlVersions??=[]).push("3.3.3");const Dn=(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 dt(e.insertBefore(at(),a),a,void 0,i??{})}return o._$AI(n),o};const Ht=globalThis;class Ke extends ze{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=Dn(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Oe}}Ke._$litElement$=!0,Ke.finalized=!0,Ht.litElementHydrateSupport?.({LitElement:Ke});const Bn=Ht.litElementPolyfillSupport;Bn?.({LitElement:Ke}),(Ht.litElementVersions??=[]).push("4.2.2");const Ye=n=>(e,i)=>{i!==void 0?i.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};const Xn={attribute:!0,type:String,converter:bt,reflect:!1,hasChanged:qt},Vn=(n=Xn,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 O(n){return(e,i)=>typeof i=="object"?Vn(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 D(n){return O({...n,state:!0,attribute:!1})}const Wn=(n,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,i),i);function Dt(n,e){return(i,t,o)=>{const a=s=>s.renderRoot?.querySelector(n)??null;return Wn(i,t,{get(){return a(this)}})}}function Gn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lt={exports:{}},Bt={exports:{}},It={exports:{}},Kn=It.exports,Hi;function Di(){return Hi||(Hi=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,l=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,j=1e9;function q(B){var N,ie,W,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),z=20,ne=4,ce=-7,de=21,Ue=-1e7,Ie=1e7,_e=!1,ft=1,Xe=0,gi={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Te="0123456789abcdefghijklmnopqrstuvwxyz",yi=!0;function M(p,f){var g,S,w,I,P,y,v,$,k=this;if(!(k instanceof M))return new M(p,f);if(f==null){if(p&&p._isBigNumber===!0){k.s=p.s,!p.c||p.e>Ie?k.c=k.e=null:p.e<Ue?k.c=[k.e=0]:(k.e=p.e,k.c=p.c.slice());return}if((y=typeof p=="number")&&p*0==0){if(k.s=1/p<0?(p=-p,-1):1,p===~~p){for(I=0,P=p;P>=10;P/=10,I++);I>Ie?k.c=k.e=null:(k.e=I,k.c=[p]);return}$=String(p)}else{if(!t.test($=String(p)))return W(k,$,y);k.s=$.charCodeAt(0)==45?($=$.slice(1),-1):1}(I=$.indexOf("."))>-1&&($=$.replace(".","")),(P=$.search(/e/i))>0?(I<0&&(I=P),I+=+$.slice(P+1),$=$.substring(0,P)):I<0&&(I=$.length)}else{if(L(f,2,Te.length,"Base"),f==10&&yi)return k=new M(p),$e(k,z+k.e+1,ne);if($=String(p),y=typeof p=="number"){if(p*0!=0)return W(k,$,y,f);if(k.s=1/p<0?($=$.slice(1),-1):1,M.DEBUG&&$.replace(/^0\.0*|\./,"").length>15)throw Error(r+p)}else k.s=$.charCodeAt(0)===45?($=$.slice(1),-1):1;for(g=Te.slice(0,f),I=P=0,v=$.length;P<v;P++)if(g.indexOf(S=$.charAt(P))<0){if(S=="."){if(P>I){I=v;continue}}else if(!w&&($==$.toUpperCase()&&($=$.toLowerCase())||$==$.toLowerCase()&&($=$.toUpperCase()))){w=!0,P=-1,I=0;continue}return W(k,String(p),y,f)}y=!1,$=ie($,f,10,k.s),(I=$.indexOf("."))>-1?$=$.replace(".",""):I=$.length}for(P=0;$.charCodeAt(P)===48;P++);for(v=$.length;$.charCodeAt(--v)===48;);if($=$.slice(P,++v)){if(v-=P,y&&M.DEBUG&&v>15&&(p>l||p!==a(p)))throw Error(r+k.s*p);if((I=I-P-1)>Ie)k.c=k.e=null;else if(I<Ue)k.c=[k.e=0];else{if(k.e=I,k.c=[],P=(I+1)%c,I<0&&(P+=c),P<v){for(P&&k.c.push(+$.slice(0,P)),v-=c;P<v;)k.c.push(+$.slice(P,P+=c));P=c-($=$.slice(P)).length}else P-=v;for(;P--;$+="0");k.c.push(+$)}}else k.c=[k.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(p){var f,g;if(p!=null)if(typeof p=="object"){if(p.hasOwnProperty(f="DECIMAL_PLACES")&&(g=p[f],L(g,0,j,f),z=g),p.hasOwnProperty(f="ROUNDING_MODE")&&(g=p[f],L(g,0,8,f),ne=g),p.hasOwnProperty(f="EXPONENTIAL_AT")&&(g=p[f],g&&g.pop?(L(g[0],-j,0,f),L(g[1],0,j,f),ce=g[0],de=g[1]):(L(g,-j,j,f),ce=-(de=g<0?-g:g))),p.hasOwnProperty(f="RANGE"))if(g=p[f],g&&g.pop)L(g[0],-j,-1,f),L(g[1],1,j,f),Ue=g[0],Ie=g[1];else if(L(g,-j,j,f),g)Ue=-(Ie=g<0?-g:g);else throw Error(s+f+" cannot be zero: "+g);if(p.hasOwnProperty(f="CRYPTO"))if(g=p[f],g===!!g)if(g)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))_e=g;else throw _e=!g,Error(s+"crypto unavailable");else _e=g;else throw Error(s+f+" not true or false: "+g);if(p.hasOwnProperty(f="MODULO_MODE")&&(g=p[f],L(g,0,9,f),ft=g),p.hasOwnProperty(f="POW_PRECISION")&&(g=p[f],L(g,0,j,f),Xe=g),p.hasOwnProperty(f="FORMAT"))if(g=p[f],typeof g=="object")gi=g;else throw Error(s+f+" not an object: "+g);if(p.hasOwnProperty(f="ALPHABET"))if(g=p[f],typeof g=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(g))yi=g.slice(0,10)=="0123456789",Te=g;else throw Error(s+f+" invalid: "+g)}else throw Error(s+"Object expected: "+p);return{DECIMAL_PLACES:z,ROUNDING_MODE:ne,EXPONENTIAL_AT:[ce,de],RANGE:[Ue,Ie],CRYPTO:_e,MODULO_MODE:ft,POW_PRECISION:Xe,FORMAT:gi,ALPHABET:Te}},M.isBigNumber=function(p){if(!p||p._isBigNumber!==!0)return!1;if(!M.DEBUG)return!0;var f,g,S=p.c,w=p.e,I=p.s;e:if({}.toString.call(S)=="[object Array]"){if((I===1||I===-1)&&w>=-j&&w<=j&&w===a(w)){if(S[0]===0){if(w===0&&S.length===1)return!0;break e}if(f=(w+1)%c,f<1&&(f+=c),String(S[0]).length==f){for(f=0;f<S.length;f++)if(g=S[f],g<0||g>=d||g!==a(g))break e;if(g!==0)return!0}}}else if(S===null&&w===null&&(I===null||I===1||I===-1))return!0;throw Error(s+"Invalid BigNumber: "+p)},M.maximum=M.max=function(){return wn(arguments,-1)},M.minimum=M.min=function(){return wn(arguments,1)},M.random=(function(){var p=9007199254740992,f=Math.random()*p&2097151?function(){return a(Math.random()*p)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(g){var S,w,I,P,y,v=0,$=[],k=new M(J);if(g==null?g=z:L(g,0,j),P=o(g/c),_e)if(crypto.getRandomValues){for(S=crypto.getRandomValues(new Uint32Array(P*=2));v<P;)y=S[v]*131072+(S[v+1]>>>11),y>=9e15?(w=crypto.getRandomValues(new Uint32Array(2)),S[v]=w[0],S[v+1]=w[1]):($.push(y%1e14),v+=2);v=P/2}else if(crypto.randomBytes){for(S=crypto.randomBytes(P*=7);v<P;)y=(S[v]&31)*281474976710656+S[v+1]*1099511627776+S[v+2]*4294967296+S[v+3]*16777216+(S[v+4]<<16)+(S[v+5]<<8)+S[v+6],y>=9e15?crypto.randomBytes(7).copy(S,v):($.push(y%1e14),v+=7);v=P/7}else throw _e=!1,Error(s+"crypto unavailable");if(!_e)for(;v<P;)y=f(),y<9e15&&($[v++]=y%1e14);for(P=$[--v],g%=c,P&&g&&(y=u[c-g],$[v]=a(P/y)*y);$[v]===0;$.pop(),v--);if(v<0)$=[I=0];else{for(I=-1;$[0]===0;$.splice(0,1),I-=c);for(v=1,y=$[0];y>=10;y/=10,v++);v<c&&(I-=c-v)}return k.e=I,k.c=$,k}})(),M.sum=function(){for(var p=1,f=arguments,g=new M(f[0]);p<f.length;)g=g.plus(f[p++]);return g},ie=(function(){var p="0123456789";function f(g,S,w,I){for(var P,y=[0],v,$=0,k=g.length;$<k;){for(v=y.length;v--;y[v]*=S);for(y[0]+=I.indexOf(g.charAt($++)),P=0;P<y.length;P++)y[P]>w-1&&(y[P+1]==null&&(y[P+1]=0),y[P+1]+=y[P]/w|0,y[P]%=w)}return y.reverse()}return function(g,S,w,I,P){var y,v,$,k,U,X,V,oe,le=g.indexOf("."),fe=z,te=ne;for(le>=0&&(k=Xe,Xe=0,g=g.replace(".",""),oe=new M(S),X=oe.pow(g.length-le),Xe=k,oe.c=f(se(K(X.c),X.e,"0"),10,w,p),oe.e=oe.c.length),V=f(g,S,w,P?(y=Te,p):(y=p,Te)),$=k=V.length;V[--k]==0;V.pop());if(!V[0])return y.charAt(0);if(le<0?--$:(X.c=V,X.e=$,X.s=I,X=N(X,oe,fe,te,w),V=X.c,U=X.r,$=X.e),v=$+fe+1,le=V[v],k=w/2,U=U||v<0||V[v+1]!=null,U=te<4?(le!=null||U)&&(te==0||te==(X.s<0?3:2)):le>k||le==k&&(te==4||U||te==6&&V[v-1]&1||te==(X.s<0?8:7)),v<1||!V[0])g=U?se(y.charAt(1),-fe,y.charAt(0)):y.charAt(0);else{if(V.length=v,U)for(--w;++V[--v]>w;)V[v]=0,v||(++$,V=[1].concat(V));for(k=V.length;!V[--k];);for(le=0,g="";le<=k;g+=y.charAt(V[le++]));g=se(g,$,y.charAt(0))}return g}})(),N=(function(){function p(S,w,I){var P,y,v,$,k=0,U=S.length,X=w%m,V=w/m|0;for(S=S.slice();U--;)v=S[U]%m,$=S[U]/m|0,P=V*v+$*X,y=X*v+P%m*m+k,k=(y/I|0)+(P/m|0)+V*$,S[U]=y%I;return k&&(S=[k].concat(S)),S}function f(S,w,I,P){var y,v;if(I!=P)v=I>P?1:-1;else for(y=v=0;y<I;y++)if(S[y]!=w[y]){v=S[y]>w[y]?1:-1;break}return v}function g(S,w,I,P){for(var y=0;I--;)S[I]-=y,y=S[I]<w[I]?1:0,S[I]=y*P+S[I]-w[I];for(;!S[0]&&S.length>1;S.splice(0,1));}return function(S,w,I,P,y){var v,$,k,U,X,V,oe,le,fe,te,re,be,Mt,wi,vi,xe,gt,je=S.s==w.s?1:-1,we=S.c,ue=w.c;if(!we||!we[0]||!ue||!ue[0])return new M(!S.s||!w.s||(we?ue&&we[0]==ue[0]:!ue)?NaN:we&&we[0]==0||!ue?je*0:je/0);for(le=new M(je),fe=le.c=[],$=S.e-w.e,je=I+$+1,y||(y=d,$=T(S.e/c)-T(w.e/c),je=je/c|0),k=0;ue[k]==(we[k]||0);k++);if(ue[k]>(we[k]||0)&&$--,je<0)fe.push(1),U=!0;else{for(wi=we.length,xe=ue.length,k=0,je+=2,X=a(y/(ue[0]+1)),X>1&&(ue=p(ue,X,y),we=p(we,X,y),xe=ue.length,wi=we.length),Mt=xe,te=we.slice(0,xe),re=te.length;re<xe;te[re++]=0);gt=ue.slice(),gt=[0].concat(gt),vi=ue[0],ue[1]>=y/2&&vi++;do{if(X=0,v=f(ue,te,xe,re),v<0){if(be=te[0],xe!=re&&(be=be*y+(te[1]||0)),X=a(be/vi),X>1)for(X>=y&&(X=y-1),V=p(ue,X,y),oe=V.length,re=te.length;f(V,te,oe,re)==1;)X--,g(V,xe<oe?gt:ue,oe,y),oe=V.length,v=1;else X==0&&(v=X=1),V=ue.slice(),oe=V.length;if(oe<re&&(V=[0].concat(V)),g(te,V,re,y),re=te.length,v==-1)for(;f(ue,te,xe,re)<1;)X++,g(te,xe<re?gt:ue,re,y),re=te.length}else v===0&&(X++,te=[0]);fe[k++]=X,te[0]?te[re++]=we[Mt]||0:(te=[we[Mt]],re=1)}while((Mt++<wi||te[0]!=null)&&je--);U=te[0]!=null,fe[0]||fe.splice(0,1)}if(y==d){for(k=1,je=fe[0];je>=10;je/=10,k++);$e(le,I+(le.e=k+$*c-1)+1,P,U)}else le.e=$,le.r=+U;return le}})();function mi(p,f,g,S){var w,I,P,y,v;if(g==null?g=ne:L(g,0,8),!p.c)return p.toString();if(w=p.c[0],P=p.e,f==null)v=K(p.c),v=S==1||S==2&&(P<=ce||P>=de)?Z(v,P):se(v,P,"0");else if(p=$e(new M(p),f,g),I=p.e,v=K(p.c),y=v.length,S==1||S==2&&(f<=I||I<=ce)){for(;y<f;v+="0",y++);v=Z(v,I)}else if(f-=P+(S===2&&I>P),v=se(v,I,"0"),I+1>y){if(--f>0)for(v+=".";f--;v+="0");}else if(f+=I-y,f>0)for(I+1==y&&(v+=".");f--;v+="0");return p.s<0&&w?"-"+v:v}function wn(p,f){for(var g,S,w=1,I=new M(p[0]);w<p.length;w++)S=new M(p[w]),(!S.s||(g=Y(I,S))===f||g===0&&I.s===f)&&(I=S);return I}function bi(p,f,g){for(var S=1,w=f.length;!f[--w];f.pop());for(w=f[0];w>=10;w/=10,S++);return(g=S+g*c-1)>Ie?p.c=p.e=null:g<Ue?p.c=[p.e=0]:(p.e=g,p.c=f),p}W=(function(){var p=/^(-?)0([xbo])(?=\w[\w.]*$)/i,f=/^([^.]+)\.$/,g=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,w=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(I,P,y,v){var $,k=y?P:P.replace(w,"");if(S.test(k))I.s=isNaN(k)?null:k<0?-1:1;else{if(!y&&(k=k.replace(p,function(U,X,V){return $=(V=V.toLowerCase())=="x"?16:V=="b"?2:8,!v||v==$?X:U}),v&&($=v,k=k.replace(f,"$1").replace(g,"0.$1")),P!=k))return new M(k,$);if(M.DEBUG)throw Error(s+"Not a"+(v?" base "+v:"")+" number: "+P);I.s=null}I.c=I.e=null}})();function $e(p,f,g,S){var w,I,P,y,v,$,k,U=p.c,X=u;if(U){e:{for(w=1,y=U[0];y>=10;y/=10,w++);if(I=f-w,I<0)I+=c,P=f,v=U[$=0],k=a(v/X[w-P-1]%10);else if($=o((I+1)/c),$>=U.length)if(S){for(;U.length<=$;U.push(0));v=k=0,w=1,I%=c,P=I-c+1}else break e;else{for(v=y=U[$],w=1;y>=10;y/=10,w++);I%=c,P=I-c+w,k=P<0?0:a(v/X[w-P-1]%10)}if(S=S||f<0||U[$+1]!=null||(P<0?v:v%X[w-P-1]),S=g<4?(k||S)&&(g==0||g==(p.s<0?3:2)):k>5||k==5&&(g==4||S||g==6&&(I>0?P>0?v/X[w-P]:0:U[$-1])%10&1||g==(p.s<0?8:7)),f<1||!U[0])return U.length=0,S?(f-=p.e+1,U[0]=X[(c-f%c)%c],p.e=-f||0):U[0]=p.e=0,p;if(I==0?(U.length=$,y=1,$--):(U.length=$+1,y=X[c-I],U[$]=P>0?a(v/X[w-P]%X[P])*y:0),S)for(;;)if($==0){for(I=1,P=U[0];P>=10;P/=10,I++);for(P=U[0]+=y,y=1;P>=10;P/=10,y++);I!=y&&(p.e++,U[0]==d&&(U[0]=1));break}else{if(U[$]+=y,U[$]!=d)break;U[$--]=0,y=1}for(I=U.length;U[--I]===0;U.pop());}p.e>Ie?p.c=p.e=null:p.e<Ue&&(p.c=[p.e=0])}return p}function Le(p){var f,g=p.e;return g===null?p.toString():(f=K(p.c),f=g<=ce||g>=de?Z(f,g):se(f,g,"0"),p.s<0?"-"+f:f)}return R.absoluteValue=R.abs=function(){var p=new M(this);return p.s<0&&(p.s=1),p},R.comparedTo=function(p,f){return Y(this,new M(p,f))},R.decimalPlaces=R.dp=function(p,f){var g,S,w,I=this;if(p!=null)return L(p,0,j),f==null?f=ne:L(f,0,8),$e(new M(I),p+I.e+1,f);if(!(g=I.c))return null;if(S=((w=g.length-1)-T(this.e/c))*c,w=g[w])for(;w%10==0;w/=10,S--);return S<0&&(S=0),S},R.dividedBy=R.div=function(p,f){return N(this,new M(p,f),z,ne)},R.dividedToIntegerBy=R.idiv=function(p,f){return N(this,new M(p,f),0,1)},R.exponentiatedBy=R.pow=function(p,f){var g,S,w,I,P,y,v,$,k,U=this;if(p=new M(p),p.c&&!p.isInteger())throw Error(s+"Exponent not an integer: "+Le(p));if(f!=null&&(f=new M(f)),y=p.e>14,!U.c||!U.c[0]||U.c[0]==1&&!U.e&&U.c.length==1||!p.c||!p.c[0])return k=new M(Math.pow(+Le(U),y?p.s*(2-H(p)):+Le(p))),f?k.mod(f):k;if(v=p.s<0,f){if(f.c?!f.c[0]:!f.s)return new M(NaN);S=!v&&U.isInteger()&&f.isInteger(),S&&(U=U.mod(f))}else{if(p.e>9&&(U.e>0||U.e<-1||(U.e==0?U.c[0]>1||y&&U.c[1]>=24e7:U.c[0]<8e13||y&&U.c[0]<=9999975e7)))return I=U.s<0&&H(p)?-0:0,U.e>-1&&(I=1/I),new M(v?1/I:I);Xe&&(I=o(Xe/c+2))}for(y?(g=new M(.5),v&&(p.s=1),$=H(p)):(w=Math.abs(+Le(p)),$=w%2),k=new M(J);;){if($){if(k=k.times(U),!k.c)break;I?k.c.length>I&&(k.c.length=I):S&&(k=k.mod(f))}if(w){if(w=a(w/2),w===0)break;$=w%2}else if(p=p.times(g),$e(p,p.e+1,1),p.e>14)$=H(p);else{if(w=+Le(p),w===0)break;$=w%2}U=U.times(U),I?U.c&&U.c.length>I&&(U.c.length=I):S&&(U=U.mod(f))}return S?k:(v&&(k=J.div(k)),f?k.mod(f):I?$e(k,Xe,ne,P):k)},R.integerValue=function(p){var f=new M(this);return p==null?p=ne:L(p,0,8),$e(f,f.e+1,p)},R.isEqualTo=R.eq=function(p,f){return Y(this,new M(p,f))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(p,f){return Y(this,new M(p,f))>0},R.isGreaterThanOrEqualTo=R.gte=function(p,f){return(f=Y(this,new M(p,f)))===1||f===0},R.isInteger=function(){return!!this.c&&T(this.e/c)>this.c.length-2},R.isLessThan=R.lt=function(p,f){return Y(this,new M(p,f))<0},R.isLessThanOrEqualTo=R.lte=function(p,f){return(f=Y(this,new M(p,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(p,f){var g,S,w,I,P=this,y=P.s;if(p=new M(p,f),f=p.s,!y||!f)return new M(NaN);if(y!=f)return p.s=-f,P.plus(p);var v=P.e/c,$=p.e/c,k=P.c,U=p.c;if(!v||!$){if(!k||!U)return k?(p.s=-f,p):new M(U?P:NaN);if(!k[0]||!U[0])return U[0]?(p.s=-f,p):new M(k[0]?P:ne==3?-0:0)}if(v=T(v),$=T($),k=k.slice(),y=v-$){for((I=y<0)?(y=-y,w=k):($=v,w=U),w.reverse(),f=y;f--;w.push(0));w.reverse()}else for(S=(I=(y=k.length)<(f=U.length))?y:f,y=f=0;f<S;f++)if(k[f]!=U[f]){I=k[f]<U[f];break}if(I&&(w=k,k=U,U=w,p.s=-p.s),f=(S=U.length)-(g=k.length),f>0)for(;f--;k[g++]=0);for(f=d-1;S>y;){if(k[--S]<U[S]){for(g=S;g&&!k[--g];k[g]=f);--k[g],k[S]+=d}k[S]-=U[S]}for(;k[0]==0;k.splice(0,1),--$);return k[0]?bi(p,k,$):(p.s=ne==3?-1:1,p.c=[p.e=0],p)},R.modulo=R.mod=function(p,f){var g,S,w=this;return p=new M(p,f),!w.c||!p.s||p.c&&!p.c[0]?new M(NaN):!p.c||w.c&&!w.c[0]?new M(w):(ft==9?(S=p.s,p.s=1,g=N(w,p,0,3),p.s=S,g.s*=S):g=N(w,p,0,ft),p=w.minus(g.times(p)),!p.c[0]&&ft==1&&(p.s=w.s),p)},R.multipliedBy=R.times=function(p,f){var g,S,w,I,P,y,v,$,k,U,X,V,oe,le,fe,te=this,re=te.c,be=(p=new M(p,f)).c;if(!re||!be||!re[0]||!be[0])return!te.s||!p.s||re&&!re[0]&&!be||be&&!be[0]&&!re?p.c=p.e=p.s=null:(p.s*=te.s,!re||!be?p.c=p.e=null:(p.c=[0],p.e=0)),p;for(S=T(te.e/c)+T(p.e/c),p.s*=te.s,v=re.length,U=be.length,v<U&&(oe=re,re=be,be=oe,w=v,v=U,U=w),w=v+U,oe=[];w--;oe.push(0));for(le=d,fe=m,w=U;--w>=0;){for(g=0,X=be[w]%fe,V=be[w]/fe|0,P=v,I=w+P;I>w;)$=re[--P]%fe,k=re[P]/fe|0,y=V*$+k*X,$=X*$+y%fe*fe+oe[I]+g,g=($/le|0)+(y/fe|0)+V*k,oe[I--]=$%le;oe[I]=g}return g?++S:oe.splice(0,1),bi(p,oe,S)},R.negated=function(){var p=new M(this);return p.s=-p.s||null,p},R.plus=function(p,f){var g,S=this,w=S.s;if(p=new M(p,f),f=p.s,!w||!f)return new M(NaN);if(w!=f)return p.s=-f,S.minus(p);var I=S.e/c,P=p.e/c,y=S.c,v=p.c;if(!I||!P){if(!y||!v)return new M(w/0);if(!y[0]||!v[0])return v[0]?p:new M(y[0]?S:w*0)}if(I=T(I),P=T(P),y=y.slice(),w=I-P){for(w>0?(P=I,g=v):(w=-w,g=y),g.reverse();w--;g.push(0));g.reverse()}for(w=y.length,f=v.length,w-f<0&&(g=v,v=y,y=g,f=w),w=0;f;)w=(y[--f]=y[f]+v[f]+w)/d|0,y[f]=d===y[f]?0:y[f]%d;return w&&(y=[w].concat(y),++P),bi(p,y,P)},R.precision=R.sd=function(p,f){var g,S,w,I=this;if(p!=null&&p!==!!p)return L(p,1,j),f==null?f=ne:L(f,0,8),$e(new M(I),p,f);if(!(g=I.c))return null;if(w=g.length-1,S=w*c+1,w=g[w]){for(;w%10==0;w/=10,S--);for(w=g[0];w>=10;w/=10,S++);}return p&&I.e+1>S&&(S=I.e+1),S},R.shiftedBy=function(p){return L(p,-l,l),this.times("1e"+p)},R.squareRoot=R.sqrt=function(){var p,f,g,S,w,I=this,P=I.c,y=I.s,v=I.e,$=z+4,k=new M("0.5");if(y!==1||!P||!P[0])return new M(!y||y<0&&(!P||P[0])?NaN:P?I:1/0);if(y=Math.sqrt(+Le(I)),y==0||y==1/0?(f=K(P),(f.length+v)%2==0&&(f+="0"),y=Math.sqrt(+f),v=T((v+1)/2)-(v<0||v%2),y==1/0?f="5e"+v:(f=y.toExponential(),f=f.slice(0,f.indexOf("e")+1)+v),g=new M(f)):g=new M(y+""),g.c[0]){for(v=g.e,y=v+$,y<3&&(y=0);;)if(w=g,g=k.times(w.plus(N(I,w,$,1))),K(w.c).slice(0,y)===(f=K(g.c)).slice(0,y))if(g.e<v&&--y,f=f.slice(y-3,y+1),f=="9999"||!S&&f=="4999"){if(!S&&($e(w,w.e+z+2,0),w.times(w).eq(I))){g=w;break}$+=4,y+=4,S=1}else{(!+f||!+f.slice(1)&&f.charAt(0)=="5")&&($e(g,g.e+z+2,1),p=!g.times(g).eq(I));break}}return $e(g,g.e+z+1,ne,p)},R.toExponential=function(p,f){return p!=null&&(L(p,0,j),p++),mi(this,p,f,1)},R.toFixed=function(p,f){return p!=null&&(L(p,0,j),p=p+this.e+1),mi(this,p,f)},R.toFormat=function(p,f,g){var S,w=this;if(g==null)p!=null&&f&&typeof f=="object"?(g=f,f=null):p&&typeof p=="object"?(g=p,p=f=null):g=gi;else if(typeof g!="object")throw Error(s+"Argument not an object: "+g);if(S=w.toFixed(p,f),w.c){var I,P=S.split("."),y=+g.groupSize,v=+g.secondaryGroupSize,$=g.groupSeparator||"",k=P[0],U=P[1],X=w.s<0,V=X?k.slice(1):k,oe=V.length;if(v&&(I=y,y=v,v=I,oe-=I),y>0&&oe>0){for(I=oe%y||y,k=V.substr(0,I);I<oe;I+=y)k+=$+V.substr(I,y);v>0&&(k+=$+V.slice(I)),X&&(k="-"+k)}S=U?k+(g.decimalSeparator||"")+((v=+g.fractionGroupSize)?U.replace(new RegExp("\\d{"+v+"}\\B","g"),"$&"+(g.fractionGroupSeparator||"")):U):k}return(g.prefix||"")+S+(g.suffix||"")},R.toFraction=function(p){var f,g,S,w,I,P,y,v,$,k,U,X,V=this,oe=V.c;if(p!=null&&(y=new M(p),!y.isInteger()&&(y.c||y.s!==1)||y.lt(J)))throw Error(s+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+Le(y));if(!oe)return new M(V);for(f=new M(J),$=g=new M(J),S=v=new M(J),X=K(oe),I=f.e=X.length-V.e-1,f.c[0]=u[(P=I%c)<0?c+P:P],p=!p||y.comparedTo(f)>0?I>0?f:$:y,P=Ie,Ie=1/0,y=new M(X),v.c[0]=0;k=N(y,f,0,1),w=g.plus(k.times(S)),w.comparedTo(p)!=1;)g=S,S=w,$=v.plus(k.times(w=$)),v=w,f=y.minus(k.times(w=f)),y=w;return w=N(p.minus(g),S,0,1),v=v.plus(w.times($)),g=g.plus(w.times(S)),v.s=$.s=V.s,I=I*2,U=N($,S,I,ne).minus(V).abs().comparedTo(N(v,g,I,ne).minus(V).abs())<1?[$,S]:[v,g],Ie=P,U},R.toNumber=function(){return+Le(this)},R.toPrecision=function(p,f){return p!=null&&L(p,1,j),mi(this,p,f,2)},R.toString=function(p){var f,g=this,S=g.s,w=g.e;return w===null?S?(f="Infinity",S<0&&(f="-"+f)):f="NaN":(p==null?f=w<=ce||w>=de?Z(K(g.c),w):se(K(g.c),w,"0"):p===10&&yi?(g=$e(new M(g),z+w+1,ne),f=se(K(g.c),g.e,"0")):(L(p,2,Te.length,"Base"),f=ie(se(K(g.c),w,"0"),10,p,S,!0)),S<0&&g.c[0]&&(f="-"+f)),f},R.valueOf=R.toJSON=function(){return Le(this)},R._isBigNumber=!0,B!=null&&M.set(B),M}function T(B){var N=B|0;return B>0||B===N?N:N-1}function K(B){for(var N,ie,W=1,R=B.length,J=B[0]+"";W<R;){for(N=B[W++]+"",ie=c-N.length;ie--;N="0"+N);J+=N}for(R=J.length;J.charCodeAt(--R)===48;);return J.slice(0,R+1||1)}function Y(B,N){var ie,W,R=B.c,J=N.c,z=B.s,ne=N.s,ce=B.e,de=N.e;if(!z||!ne)return null;if(ie=R&&!R[0],W=J&&!J[0],ie||W)return ie?W?0:-ne:z;if(z!=ne)return z;if(ie=z<0,W=ce==de,!R||!J)return W?0:!R^ie?1:-1;if(!W)return ce>de^ie?1:-1;for(ne=(ce=R.length)<(de=J.length)?ce:de,z=0;z<ne;z++)if(R[z]!=J[z])return R[z]>J[z]^ie?1:-1;return ce==de?0:ce>de^ie?1:-1}function L(B,N,ie,W){if(B<N||B>ie||B!==a(B))throw Error(s+(W||"Argument")+(typeof B=="number"?B<N||B>ie?" out of range: ":" not an integer: ":" not a primitive number: ")+String(B))}function H(B){var N=B.c.length-1;return T(B.e/c)==N&&B.c[N]%2!=0}function Z(B,N){return(B.length>1?B.charAt(0)+"."+B.slice(1):B)+(N<0?"e":"e+")+N}function se(B,N,ie){var W,R;if(N<0){for(R=ie+".";++N;R+=ie);B=R+B}else if(W=B.length,++N>W){for(R=ie,N-=W;--N;R+=ie);B+=R}else N<W&&(B=B.slice(0,N)+"."+B.slice(N));return B}i=q(),i.default=i.BigNumber=i,n.exports?n.exports=i:(e||(e=typeof self<"u"&&self?self:window),e.BigNumber=i)})(Kn)})(It)),It.exports}var Bi;function Yn(){return Bi||(Bi=1,(function(n){var e=Di(),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(l){return t.lastIndex=0,t.test(l)?'"'+l.replace(t,function(u){var m=s[u];return typeof m=="string"?m:"\\u"+("0000"+u.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+l+'"'}function c(l,u){var m,j,q,T,K=o,Y,L=u[l],H=L!=null&&(L instanceof e||e.isBigNumber(L));switch(L&&typeof L=="object"&&typeof L.toJSON=="function"&&(L=L.toJSON(l)),typeof r=="function"&&(L=r.call(u,l,L)),typeof L){case"string":return H?L:d(L);case"number":return isFinite(L)?String(L):"null";case"boolean":case"null":case"bigint":return String(L);case"object":if(!L)return"null";if(o+=a,Y=[],Object.prototype.toString.apply(L)==="[object Array]"){for(T=L.length,m=0;m<T;m+=1)Y[m]=c(m,L)||"null";return q=Y.length===0?"[]":o?`[
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ri=/'/g,Ei=/"/g,qi=/^(?:script|style|textarea|title)$/i,_i=n=>(e,...i)=>({_$litType$:n,strings:e,values:i}),w=_i(1),G=_i(2),Oe=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),Li=new WeakMap,Ge=Ve.createTreeWalker(Ve,129);function Ni(n,e){if(!Lt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Pi!==void 0?Pi.createHTML(e):e}const Rn=(n,e)=>{const i=n.length-1,t=[];let o,a=e===2?"<svg>":e===3?"<math>":"",s=rt;for(let r=0;r<i;r++){const d=n[r];let c,l,u=-1,m=0;for(;m<d.length&&(s.lastIndex=m,l=s.exec(d),l!==null);)m=s.lastIndex,s===rt?l[1]==="!--"?s=xi:l[1]!==void 0?s=Mi:l[2]!==void 0?(qi.test(l[2])&&(o=RegExp("</"+l[2],"g")),s=We):l[3]!==void 0&&(s=We):s===We?l[0]===">"?(s=o??rt,u=-1):l[1]===void 0?u=-2:(u=s.lastIndex-l[2].length,c=l[1],s=l[3]===void 0?We:l[3]==='"'?Ei:Ri):s===Ei||s===Ri?s=We:s===xi||s===Mi?s=rt:(s=We,o=void 0);const j=s===We&&n[r+1].startsWith("/>")?" ":"";a+=s===rt?d+xn:u>=0?(t.push(c),d.slice(0,u)+Ci+d.slice(u)+De+j):d+De+(u===-2?r:j)}return[Ni(n,a+(n[i]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),t]};class ct{constructor({strings:e,_$litType$:i},t){let o;this.parts=[];let a=0,s=0;const r=e.length-1,d=this.parts,[c,l]=Rn(e,i);if(this.el=ct.createElement(c,t),Ge.currentNode=this.el.content,i===2||i===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(o=Ge.nextNode())!==null&&d.length<r;){if(o.nodeType===1){if(o.hasAttributes())for(const u of o.getAttributeNames())if(u.endsWith(Ci)){const m=l[s++],j=o.getAttribute(u).split(De),q=/([.?@])?(.*)/.exec(m);d.push({type:1,index:a,name:q[2],strings:j,ctor:q[1]==="."?qn:q[1]==="?"?_n:q[1]==="@"?Ln:vt}),o.removeAttribute(u)}else u.startsWith(De)&&(d.push({type:6,index:a}),o.removeAttribute(u));if(qi.test(o.tagName)){const u=o.textContent.split(De),m=u.length-1;if(m>0){o.textContent=bt?bt.emptyScript:"";for(let j=0;j<m;j++)o.append(u[j],at()),Ge.nextNode(),d.push({type:2,index:++a});o.append(u[m],at())}}}else if(o.nodeType===8)if(o.data===Ui)d.push({type:2,index:a});else{let u=-1;for(;(u=o.data.indexOf(De,u+1))!==-1;)d.push({type:7,index:a}),u+=De.length-1}a++}}static createElement(e,i){const t=Ve.createElement("template");return t.innerHTML=e,t}}function Fe(n,e,i=n,t){if(e===Oe)return e;let o=t!==void 0?i._$Co?.[t]:i._$Cl;const a=st(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=Fe(n,o._$AS(n,e.values),o,t)),e}class En{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??Ve).importNode(i,!0);Ge.currentNode=o;let a=Ge.nextNode(),s=0,r=0,d=t[0];for(;d!==void 0;){if(s===d.index){let c;d.type===2?c=new dt(a,a.nextSibling,this,e):d.type===1?c=new d.ctor(a,d.name,d.strings,this,e):d.type===6&&(c=new Nn(a,this,e)),this._$AV.push(c),d=t[++r]}s!==d?.index&&(a=Ge.nextNode(),s++)}return Ge.currentNode=Ve,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 dt{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=Fe(this,e,i),st(e)?e===x||e==null||e===""?(this._$AH!==x&&this._$AR(),this._$AH=x):e!==this._$AH&&e!==Oe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Mn(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&&st(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ve.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=ct.createElement(Ni(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===o)this._$AH.p(i);else{const a=new En(o,this),s=a.u(this.options);a.p(i),this.T(s),this._$AH=a}}_$AC(e){let i=Li.get(e.strings);return i===void 0&&Li.set(e.strings,i=new ct(e)),i}k(e){Lt(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 dt(this.O(at()),this.O(at()),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=ji(e).nextSibling;ji(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class vt{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=Fe(this,e,i,0),s=!st(e)||e!==this._$AH&&e!==Oe,s&&(this._$AH=e);else{const r=e;let d,c;for(e=a[0],d=0;d<a.length-1;d++)c=Fe(this,r[t+d],i,d),c===Oe&&(c=this._$AH[d]),s||=!st(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 qn extends vt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===x?void 0:e}}class _n extends vt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==x)}}class Ln extends vt{constructor(e,i,t,o,a){super(e,i,t,o,a),this.type=5}_$AI(e,i=this){if((e=Fe(this,e,i,0)??x)===Oe)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 Nn{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){Fe(this,e)}}const Dn=_t.litHtmlPolyfillSupport;Dn?.(ct,dt),(_t.litHtmlVersions??=[]).push("3.3.3");const Hn=(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 dt(e.insertBefore(at(),a),a,void 0,i??{})}return o._$AI(n),o};const Dt=globalThis;class Ke extends ze{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=Hn(i,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Oe}}Ke._$litElement$=!0,Ke.finalized=!0,Dt.litElementHydrateSupport?.({LitElement:Ke});const Bn=Dt.litElementPolyfillSupport;Bn?.({LitElement:Ke}),(Dt.litElementVersions??=[]).push("4.2.2");const Ye=n=>(e,i)=>{i!==void 0?i.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};const Xn={attribute:!0,type:String,converter:wt,reflect:!1,hasChanged:qt},Vn=(n=Xn,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"?Vn(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 N(n){return F({...n,state:!0,attribute:!1})}const Wn=(n,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,i),i);function Ht(n,e){return(i,t,o)=>{const a=s=>s.renderRoot?.querySelector(n)??null;return Wn(i,t,{get(){return a(this)}})}}function Gn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var lt={exports:{}},Bt={exports:{}},It={exports:{}},Kn=It.exports,Di;function Hi(){return Di||(Di=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,l=9007199254740991,u=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],m=1e7,j=1e9;function q(B){var D,ie,W,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),z=20,ne=4,ce=-7,de=21,Ue=-1e7,Ie=1e7,_e=!1,ft=1,Xe=0,gi={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Te="0123456789abcdefghijklmnopqrstuvwxyz",yi=!0;function M(p,f){var g,S,b,A,P,y,v,$,k=this;if(!(k instanceof M))return new M(p,f);if(f==null){if(p&&p._isBigNumber===!0){k.s=p.s,!p.c||p.e>Ie?k.c=k.e=null:p.e<Ue?k.c=[k.e=0]:(k.e=p.e,k.c=p.c.slice());return}if((y=typeof p=="number")&&p*0==0){if(k.s=1/p<0?(p=-p,-1):1,p===~~p){for(A=0,P=p;P>=10;P/=10,A++);A>Ie?k.c=k.e=null:(k.e=A,k.c=[p]);return}$=String(p)}else{if(!t.test($=String(p)))return W(k,$,y);k.s=$.charCodeAt(0)==45?($=$.slice(1),-1):1}(A=$.indexOf("."))>-1&&($=$.replace(".","")),(P=$.search(/e/i))>0?(A<0&&(A=P),A+=+$.slice(P+1),$=$.substring(0,P)):A<0&&(A=$.length)}else{if(L(f,2,Te.length,"Base"),f==10&&yi)return k=new M(p),$e(k,z+k.e+1,ne);if($=String(p),y=typeof p=="number"){if(p*0!=0)return W(k,$,y,f);if(k.s=1/p<0?($=$.slice(1),-1):1,M.DEBUG&&$.replace(/^0\.0*|\./,"").length>15)throw Error(r+p)}else k.s=$.charCodeAt(0)===45?($=$.slice(1),-1):1;for(g=Te.slice(0,f),A=P=0,v=$.length;P<v;P++)if(g.indexOf(S=$.charAt(P))<0){if(S=="."){if(P>A){A=v;continue}}else if(!b&&($==$.toUpperCase()&&($=$.toLowerCase())||$==$.toLowerCase()&&($=$.toUpperCase()))){b=!0,P=-1,A=0;continue}return W(k,String(p),y,f)}y=!1,$=ie($,f,10,k.s),(A=$.indexOf("."))>-1?$=$.replace(".",""):A=$.length}for(P=0;$.charCodeAt(P)===48;P++);for(v=$.length;$.charCodeAt(--v)===48;);if($=$.slice(P,++v)){if(v-=P,y&&M.DEBUG&&v>15&&(p>l||p!==a(p)))throw Error(r+k.s*p);if((A=A-P-1)>Ie)k.c=k.e=null;else if(A<Ue)k.c=[k.e=0];else{if(k.e=A,k.c=[],P=(A+1)%c,A<0&&(P+=c),P<v){for(P&&k.c.push(+$.slice(0,P)),v-=c;P<v;)k.c.push(+$.slice(P,P+=c));P=c-($=$.slice(P)).length}else P-=v;for(;P--;$+="0");k.c.push(+$)}}else k.c=[k.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(p){var f,g;if(p!=null)if(typeof p=="object"){if(p.hasOwnProperty(f="DECIMAL_PLACES")&&(g=p[f],L(g,0,j,f),z=g),p.hasOwnProperty(f="ROUNDING_MODE")&&(g=p[f],L(g,0,8,f),ne=g),p.hasOwnProperty(f="EXPONENTIAL_AT")&&(g=p[f],g&&g.pop?(L(g[0],-j,0,f),L(g[1],0,j,f),ce=g[0],de=g[1]):(L(g,-j,j,f),ce=-(de=g<0?-g:g))),p.hasOwnProperty(f="RANGE"))if(g=p[f],g&&g.pop)L(g[0],-j,-1,f),L(g[1],1,j,f),Ue=g[0],Ie=g[1];else if(L(g,-j,j,f),g)Ue=-(Ie=g<0?-g:g);else throw Error(s+f+" cannot be zero: "+g);if(p.hasOwnProperty(f="CRYPTO"))if(g=p[f],g===!!g)if(g)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))_e=g;else throw _e=!g,Error(s+"crypto unavailable");else _e=g;else throw Error(s+f+" not true or false: "+g);if(p.hasOwnProperty(f="MODULO_MODE")&&(g=p[f],L(g,0,9,f),ft=g),p.hasOwnProperty(f="POW_PRECISION")&&(g=p[f],L(g,0,j,f),Xe=g),p.hasOwnProperty(f="FORMAT"))if(g=p[f],typeof g=="object")gi=g;else throw Error(s+f+" not an object: "+g);if(p.hasOwnProperty(f="ALPHABET"))if(g=p[f],typeof g=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(g))yi=g.slice(0,10)=="0123456789",Te=g;else throw Error(s+f+" invalid: "+g)}else throw Error(s+"Object expected: "+p);return{DECIMAL_PLACES:z,ROUNDING_MODE:ne,EXPONENTIAL_AT:[ce,de],RANGE:[Ue,Ie],CRYPTO:_e,MODULO_MODE:ft,POW_PRECISION:Xe,FORMAT:gi,ALPHABET:Te}},M.isBigNumber=function(p){if(!p||p._isBigNumber!==!0)return!1;if(!M.DEBUG)return!0;var f,g,S=p.c,b=p.e,A=p.s;e:if({}.toString.call(S)=="[object Array]"){if((A===1||A===-1)&&b>=-j&&b<=j&&b===a(b)){if(S[0]===0){if(b===0&&S.length===1)return!0;break e}if(f=(b+1)%c,f<1&&(f+=c),String(S[0]).length==f){for(f=0;f<S.length;f++)if(g=S[f],g<0||g>=d||g!==a(g))break e;if(g!==0)return!0}}}else if(S===null&&b===null&&(A===null||A===1||A===-1))return!0;throw Error(s+"Invalid BigNumber: "+p)},M.maximum=M.max=function(){return bn(arguments,-1)},M.minimum=M.min=function(){return bn(arguments,1)},M.random=(function(){var p=9007199254740992,f=Math.random()*p&2097151?function(){return a(Math.random()*p)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(g){var S,b,A,P,y,v=0,$=[],k=new M(J);if(g==null?g=z:L(g,0,j),P=o(g/c),_e)if(crypto.getRandomValues){for(S=crypto.getRandomValues(new Uint32Array(P*=2));v<P;)y=S[v]*131072+(S[v+1]>>>11),y>=9e15?(b=crypto.getRandomValues(new Uint32Array(2)),S[v]=b[0],S[v+1]=b[1]):($.push(y%1e14),v+=2);v=P/2}else if(crypto.randomBytes){for(S=crypto.randomBytes(P*=7);v<P;)y=(S[v]&31)*281474976710656+S[v+1]*1099511627776+S[v+2]*4294967296+S[v+3]*16777216+(S[v+4]<<16)+(S[v+5]<<8)+S[v+6],y>=9e15?crypto.randomBytes(7).copy(S,v):($.push(y%1e14),v+=7);v=P/7}else throw _e=!1,Error(s+"crypto unavailable");if(!_e)for(;v<P;)y=f(),y<9e15&&($[v++]=y%1e14);for(P=$[--v],g%=c,P&&g&&(y=u[c-g],$[v]=a(P/y)*y);$[v]===0;$.pop(),v--);if(v<0)$=[A=0];else{for(A=-1;$[0]===0;$.splice(0,1),A-=c);for(v=1,y=$[0];y>=10;y/=10,v++);v<c&&(A-=c-v)}return k.e=A,k.c=$,k}})(),M.sum=function(){for(var p=1,f=arguments,g=new M(f[0]);p<f.length;)g=g.plus(f[p++]);return g},ie=(function(){var p="0123456789";function f(g,S,b,A){for(var P,y=[0],v,$=0,k=g.length;$<k;){for(v=y.length;v--;y[v]*=S);for(y[0]+=A.indexOf(g.charAt($++)),P=0;P<y.length;P++)y[P]>b-1&&(y[P+1]==null&&(y[P+1]=0),y[P+1]+=y[P]/b|0,y[P]%=b)}return y.reverse()}return function(g,S,b,A,P){var y,v,$,k,U,X,V,oe,le=g.indexOf("."),fe=z,te=ne;for(le>=0&&(k=Xe,Xe=0,g=g.replace(".",""),oe=new M(S),X=oe.pow(g.length-le),Xe=k,oe.c=f(se(K(X.c),X.e,"0"),10,b,p),oe.e=oe.c.length),V=f(g,S,b,P?(y=Te,p):(y=p,Te)),$=k=V.length;V[--k]==0;V.pop());if(!V[0])return y.charAt(0);if(le<0?--$:(X.c=V,X.e=$,X.s=A,X=D(X,oe,fe,te,b),V=X.c,U=X.r,$=X.e),v=$+fe+1,le=V[v],k=b/2,U=U||v<0||V[v+1]!=null,U=te<4?(le!=null||U)&&(te==0||te==(X.s<0?3:2)):le>k||le==k&&(te==4||U||te==6&&V[v-1]&1||te==(X.s<0?8:7)),v<1||!V[0])g=U?se(y.charAt(1),-fe,y.charAt(0)):y.charAt(0);else{if(V.length=v,U)for(--b;++V[--v]>b;)V[v]=0,v||(++$,V=[1].concat(V));for(k=V.length;!V[--k];);for(le=0,g="";le<=k;g+=y.charAt(V[le++]));g=se(g,$,y.charAt(0))}return g}})(),D=(function(){function p(S,b,A){var P,y,v,$,k=0,U=S.length,X=b%m,V=b/m|0;for(S=S.slice();U--;)v=S[U]%m,$=S[U]/m|0,P=V*v+$*X,y=X*v+P%m*m+k,k=(y/A|0)+(P/m|0)+V*$,S[U]=y%A;return k&&(S=[k].concat(S)),S}function f(S,b,A,P){var y,v;if(A!=P)v=A>P?1:-1;else for(y=v=0;y<A;y++)if(S[y]!=b[y]){v=S[y]>b[y]?1:-1;break}return v}function g(S,b,A,P){for(var y=0;A--;)S[A]-=y,y=S[A]<b[A]?1:0,S[A]=y*P+S[A]-b[A];for(;!S[0]&&S.length>1;S.splice(0,1));}return function(S,b,A,P,y){var v,$,k,U,X,V,oe,le,fe,te,re,we,Mt,bi,vi,xe,gt,je=S.s==b.s?1:-1,be=S.c,ue=b.c;if(!be||!be[0]||!ue||!ue[0])return new M(!S.s||!b.s||(be?ue&&be[0]==ue[0]:!ue)?NaN:be&&be[0]==0||!ue?je*0:je/0);for(le=new M(je),fe=le.c=[],$=S.e-b.e,je=A+$+1,y||(y=d,$=T(S.e/c)-T(b.e/c),je=je/c|0),k=0;ue[k]==(be[k]||0);k++);if(ue[k]>(be[k]||0)&&$--,je<0)fe.push(1),U=!0;else{for(bi=be.length,xe=ue.length,k=0,je+=2,X=a(y/(ue[0]+1)),X>1&&(ue=p(ue,X,y),be=p(be,X,y),xe=ue.length,bi=be.length),Mt=xe,te=be.slice(0,xe),re=te.length;re<xe;te[re++]=0);gt=ue.slice(),gt=[0].concat(gt),vi=ue[0],ue[1]>=y/2&&vi++;do{if(X=0,v=f(ue,te,xe,re),v<0){if(we=te[0],xe!=re&&(we=we*y+(te[1]||0)),X=a(we/vi),X>1)for(X>=y&&(X=y-1),V=p(ue,X,y),oe=V.length,re=te.length;f(V,te,oe,re)==1;)X--,g(V,xe<oe?gt:ue,oe,y),oe=V.length,v=1;else X==0&&(v=X=1),V=ue.slice(),oe=V.length;if(oe<re&&(V=[0].concat(V)),g(te,V,re,y),re=te.length,v==-1)for(;f(ue,te,xe,re)<1;)X++,g(te,xe<re?gt:ue,re,y),re=te.length}else v===0&&(X++,te=[0]);fe[k++]=X,te[0]?te[re++]=be[Mt]||0:(te=[be[Mt]],re=1)}while((Mt++<bi||te[0]!=null)&&je--);U=te[0]!=null,fe[0]||fe.splice(0,1)}if(y==d){for(k=1,je=fe[0];je>=10;je/=10,k++);$e(le,A+(le.e=k+$*c-1)+1,P,U)}else le.e=$,le.r=+U;return le}})();function mi(p,f,g,S){var b,A,P,y,v;if(g==null?g=ne:L(g,0,8),!p.c)return p.toString();if(b=p.c[0],P=p.e,f==null)v=K(p.c),v=S==1||S==2&&(P<=ce||P>=de)?Z(v,P):se(v,P,"0");else if(p=$e(new M(p),f,g),A=p.e,v=K(p.c),y=v.length,S==1||S==2&&(f<=A||A<=ce)){for(;y<f;v+="0",y++);v=Z(v,A)}else if(f-=P+(S===2&&A>P),v=se(v,A,"0"),A+1>y){if(--f>0)for(v+=".";f--;v+="0");}else if(f+=A-y,f>0)for(A+1==y&&(v+=".");f--;v+="0");return p.s<0&&b?"-"+v:v}function bn(p,f){for(var g,S,b=1,A=new M(p[0]);b<p.length;b++)S=new M(p[b]),(!S.s||(g=Y(A,S))===f||g===0&&A.s===f)&&(A=S);return A}function wi(p,f,g){for(var S=1,b=f.length;!f[--b];f.pop());for(b=f[0];b>=10;b/=10,S++);return(g=S+g*c-1)>Ie?p.c=p.e=null:g<Ue?p.c=[p.e=0]:(p.e=g,p.c=f),p}W=(function(){var p=/^(-?)0([xbo])(?=\w[\w.]*$)/i,f=/^([^.]+)\.$/,g=/^\.([^.]+)$/,S=/^-?(Infinity|NaN)$/,b=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,P,y,v){var $,k=y?P:P.replace(b,"");if(S.test(k))A.s=isNaN(k)?null:k<0?-1:1;else{if(!y&&(k=k.replace(p,function(U,X,V){return $=(V=V.toLowerCase())=="x"?16:V=="b"?2:8,!v||v==$?X:U}),v&&($=v,k=k.replace(f,"$1").replace(g,"0.$1")),P!=k))return new M(k,$);if(M.DEBUG)throw Error(s+"Not a"+(v?" base "+v:"")+" number: "+P);A.s=null}A.c=A.e=null}})();function $e(p,f,g,S){var b,A,P,y,v,$,k,U=p.c,X=u;if(U){e:{for(b=1,y=U[0];y>=10;y/=10,b++);if(A=f-b,A<0)A+=c,P=f,v=U[$=0],k=a(v/X[b-P-1]%10);else if($=o((A+1)/c),$>=U.length)if(S){for(;U.length<=$;U.push(0));v=k=0,b=1,A%=c,P=A-c+1}else break e;else{for(v=y=U[$],b=1;y>=10;y/=10,b++);A%=c,P=A-c+b,k=P<0?0:a(v/X[b-P-1]%10)}if(S=S||f<0||U[$+1]!=null||(P<0?v:v%X[b-P-1]),S=g<4?(k||S)&&(g==0||g==(p.s<0?3:2)):k>5||k==5&&(g==4||S||g==6&&(A>0?P>0?v/X[b-P]:0:U[$-1])%10&1||g==(p.s<0?8:7)),f<1||!U[0])return U.length=0,S?(f-=p.e+1,U[0]=X[(c-f%c)%c],p.e=-f||0):U[0]=p.e=0,p;if(A==0?(U.length=$,y=1,$--):(U.length=$+1,y=X[c-A],U[$]=P>0?a(v/X[b-P]%X[P])*y:0),S)for(;;)if($==0){for(A=1,P=U[0];P>=10;P/=10,A++);for(P=U[0]+=y,y=1;P>=10;P/=10,y++);A!=y&&(p.e++,U[0]==d&&(U[0]=1));break}else{if(U[$]+=y,U[$]!=d)break;U[$--]=0,y=1}for(A=U.length;U[--A]===0;U.pop());}p.e>Ie?p.c=p.e=null:p.e<Ue&&(p.c=[p.e=0])}return p}function Le(p){var f,g=p.e;return g===null?p.toString():(f=K(p.c),f=g<=ce||g>=de?Z(f,g):se(f,g,"0"),p.s<0?"-"+f:f)}return R.absoluteValue=R.abs=function(){var p=new M(this);return p.s<0&&(p.s=1),p},R.comparedTo=function(p,f){return Y(this,new M(p,f))},R.decimalPlaces=R.dp=function(p,f){var g,S,b,A=this;if(p!=null)return L(p,0,j),f==null?f=ne:L(f,0,8),$e(new M(A),p+A.e+1,f);if(!(g=A.c))return null;if(S=((b=g.length-1)-T(this.e/c))*c,b=g[b])for(;b%10==0;b/=10,S--);return S<0&&(S=0),S},R.dividedBy=R.div=function(p,f){return D(this,new M(p,f),z,ne)},R.dividedToIntegerBy=R.idiv=function(p,f){return D(this,new M(p,f),0,1)},R.exponentiatedBy=R.pow=function(p,f){var g,S,b,A,P,y,v,$,k,U=this;if(p=new M(p),p.c&&!p.isInteger())throw Error(s+"Exponent not an integer: "+Le(p));if(f!=null&&(f=new M(f)),y=p.e>14,!U.c||!U.c[0]||U.c[0]==1&&!U.e&&U.c.length==1||!p.c||!p.c[0])return k=new M(Math.pow(+Le(U),y?p.s*(2-H(p)):+Le(p))),f?k.mod(f):k;if(v=p.s<0,f){if(f.c?!f.c[0]:!f.s)return new M(NaN);S=!v&&U.isInteger()&&f.isInteger(),S&&(U=U.mod(f))}else{if(p.e>9&&(U.e>0||U.e<-1||(U.e==0?U.c[0]>1||y&&U.c[1]>=24e7:U.c[0]<8e13||y&&U.c[0]<=9999975e7)))return A=U.s<0&&H(p)?-0:0,U.e>-1&&(A=1/A),new M(v?1/A:A);Xe&&(A=o(Xe/c+2))}for(y?(g=new M(.5),v&&(p.s=1),$=H(p)):(b=Math.abs(+Le(p)),$=b%2),k=new M(J);;){if($){if(k=k.times(U),!k.c)break;A?k.c.length>A&&(k.c.length=A):S&&(k=k.mod(f))}if(b){if(b=a(b/2),b===0)break;$=b%2}else if(p=p.times(g),$e(p,p.e+1,1),p.e>14)$=H(p);else{if(b=+Le(p),b===0)break;$=b%2}U=U.times(U),A?U.c&&U.c.length>A&&(U.c.length=A):S&&(U=U.mod(f))}return S?k:(v&&(k=J.div(k)),f?k.mod(f):A?$e(k,Xe,ne,P):k)},R.integerValue=function(p){var f=new M(this);return p==null?p=ne:L(p,0,8),$e(f,f.e+1,p)},R.isEqualTo=R.eq=function(p,f){return Y(this,new M(p,f))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(p,f){return Y(this,new M(p,f))>0},R.isGreaterThanOrEqualTo=R.gte=function(p,f){return(f=Y(this,new M(p,f)))===1||f===0},R.isInteger=function(){return!!this.c&&T(this.e/c)>this.c.length-2},R.isLessThan=R.lt=function(p,f){return Y(this,new M(p,f))<0},R.isLessThanOrEqualTo=R.lte=function(p,f){return(f=Y(this,new M(p,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(p,f){var g,S,b,A,P=this,y=P.s;if(p=new M(p,f),f=p.s,!y||!f)return new M(NaN);if(y!=f)return p.s=-f,P.plus(p);var v=P.e/c,$=p.e/c,k=P.c,U=p.c;if(!v||!$){if(!k||!U)return k?(p.s=-f,p):new M(U?P:NaN);if(!k[0]||!U[0])return U[0]?(p.s=-f,p):new M(k[0]?P:ne==3?-0:0)}if(v=T(v),$=T($),k=k.slice(),y=v-$){for((A=y<0)?(y=-y,b=k):($=v,b=U),b.reverse(),f=y;f--;b.push(0));b.reverse()}else for(S=(A=(y=k.length)<(f=U.length))?y:f,y=f=0;f<S;f++)if(k[f]!=U[f]){A=k[f]<U[f];break}if(A&&(b=k,k=U,U=b,p.s=-p.s),f=(S=U.length)-(g=k.length),f>0)for(;f--;k[g++]=0);for(f=d-1;S>y;){if(k[--S]<U[S]){for(g=S;g&&!k[--g];k[g]=f);--k[g],k[S]+=d}k[S]-=U[S]}for(;k[0]==0;k.splice(0,1),--$);return k[0]?wi(p,k,$):(p.s=ne==3?-1:1,p.c=[p.e=0],p)},R.modulo=R.mod=function(p,f){var g,S,b=this;return p=new M(p,f),!b.c||!p.s||p.c&&!p.c[0]?new M(NaN):!p.c||b.c&&!b.c[0]?new M(b):(ft==9?(S=p.s,p.s=1,g=D(b,p,0,3),p.s=S,g.s*=S):g=D(b,p,0,ft),p=b.minus(g.times(p)),!p.c[0]&&ft==1&&(p.s=b.s),p)},R.multipliedBy=R.times=function(p,f){var g,S,b,A,P,y,v,$,k,U,X,V,oe,le,fe,te=this,re=te.c,we=(p=new M(p,f)).c;if(!re||!we||!re[0]||!we[0])return!te.s||!p.s||re&&!re[0]&&!we||we&&!we[0]&&!re?p.c=p.e=p.s=null:(p.s*=te.s,!re||!we?p.c=p.e=null:(p.c=[0],p.e=0)),p;for(S=T(te.e/c)+T(p.e/c),p.s*=te.s,v=re.length,U=we.length,v<U&&(oe=re,re=we,we=oe,b=v,v=U,U=b),b=v+U,oe=[];b--;oe.push(0));for(le=d,fe=m,b=U;--b>=0;){for(g=0,X=we[b]%fe,V=we[b]/fe|0,P=v,A=b+P;A>b;)$=re[--P]%fe,k=re[P]/fe|0,y=V*$+k*X,$=X*$+y%fe*fe+oe[A]+g,g=($/le|0)+(y/fe|0)+V*k,oe[A--]=$%le;oe[A]=g}return g?++S:oe.splice(0,1),wi(p,oe,S)},R.negated=function(){var p=new M(this);return p.s=-p.s||null,p},R.plus=function(p,f){var g,S=this,b=S.s;if(p=new M(p,f),f=p.s,!b||!f)return new M(NaN);if(b!=f)return p.s=-f,S.minus(p);var A=S.e/c,P=p.e/c,y=S.c,v=p.c;if(!A||!P){if(!y||!v)return new M(b/0);if(!y[0]||!v[0])return v[0]?p:new M(y[0]?S:b*0)}if(A=T(A),P=T(P),y=y.slice(),b=A-P){for(b>0?(P=A,g=v):(b=-b,g=y),g.reverse();b--;g.push(0));g.reverse()}for(b=y.length,f=v.length,b-f<0&&(g=v,v=y,y=g,f=b),b=0;f;)b=(y[--f]=y[f]+v[f]+b)/d|0,y[f]=d===y[f]?0:y[f]%d;return b&&(y=[b].concat(y),++P),wi(p,y,P)},R.precision=R.sd=function(p,f){var g,S,b,A=this;if(p!=null&&p!==!!p)return L(p,1,j),f==null?f=ne:L(f,0,8),$e(new M(A),p,f);if(!(g=A.c))return null;if(b=g.length-1,S=b*c+1,b=g[b]){for(;b%10==0;b/=10,S--);for(b=g[0];b>=10;b/=10,S++);}return p&&A.e+1>S&&(S=A.e+1),S},R.shiftedBy=function(p){return L(p,-l,l),this.times("1e"+p)},R.squareRoot=R.sqrt=function(){var p,f,g,S,b,A=this,P=A.c,y=A.s,v=A.e,$=z+4,k=new M("0.5");if(y!==1||!P||!P[0])return new M(!y||y<0&&(!P||P[0])?NaN:P?A:1/0);if(y=Math.sqrt(+Le(A)),y==0||y==1/0?(f=K(P),(f.length+v)%2==0&&(f+="0"),y=Math.sqrt(+f),v=T((v+1)/2)-(v<0||v%2),y==1/0?f="5e"+v:(f=y.toExponential(),f=f.slice(0,f.indexOf("e")+1)+v),g=new M(f)):g=new M(y+""),g.c[0]){for(v=g.e,y=v+$,y<3&&(y=0);;)if(b=g,g=k.times(b.plus(D(A,b,$,1))),K(b.c).slice(0,y)===(f=K(g.c)).slice(0,y))if(g.e<v&&--y,f=f.slice(y-3,y+1),f=="9999"||!S&&f=="4999"){if(!S&&($e(b,b.e+z+2,0),b.times(b).eq(A))){g=b;break}$+=4,y+=4,S=1}else{(!+f||!+f.slice(1)&&f.charAt(0)=="5")&&($e(g,g.e+z+2,1),p=!g.times(g).eq(A));break}}return $e(g,g.e+z+1,ne,p)},R.toExponential=function(p,f){return p!=null&&(L(p,0,j),p++),mi(this,p,f,1)},R.toFixed=function(p,f){return p!=null&&(L(p,0,j),p=p+this.e+1),mi(this,p,f)},R.toFormat=function(p,f,g){var S,b=this;if(g==null)p!=null&&f&&typeof f=="object"?(g=f,f=null):p&&typeof p=="object"?(g=p,p=f=null):g=gi;else if(typeof g!="object")throw Error(s+"Argument not an object: "+g);if(S=b.toFixed(p,f),b.c){var A,P=S.split("."),y=+g.groupSize,v=+g.secondaryGroupSize,$=g.groupSeparator||"",k=P[0],U=P[1],X=b.s<0,V=X?k.slice(1):k,oe=V.length;if(v&&(A=y,y=v,v=A,oe-=A),y>0&&oe>0){for(A=oe%y||y,k=V.substr(0,A);A<oe;A+=y)k+=$+V.substr(A,y);v>0&&(k+=$+V.slice(A)),X&&(k="-"+k)}S=U?k+(g.decimalSeparator||"")+((v=+g.fractionGroupSize)?U.replace(new RegExp("\\d{"+v+"}\\B","g"),"$&"+(g.fractionGroupSeparator||"")):U):k}return(g.prefix||"")+S+(g.suffix||"")},R.toFraction=function(p){var f,g,S,b,A,P,y,v,$,k,U,X,V=this,oe=V.c;if(p!=null&&(y=new M(p),!y.isInteger()&&(y.c||y.s!==1)||y.lt(J)))throw Error(s+"Argument "+(y.isInteger()?"out of range: ":"not an integer: ")+Le(y));if(!oe)return new M(V);for(f=new M(J),$=g=new M(J),S=v=new M(J),X=K(oe),A=f.e=X.length-V.e-1,f.c[0]=u[(P=A%c)<0?c+P:P],p=!p||y.comparedTo(f)>0?A>0?f:$:y,P=Ie,Ie=1/0,y=new M(X),v.c[0]=0;k=D(y,f,0,1),b=g.plus(k.times(S)),b.comparedTo(p)!=1;)g=S,S=b,$=v.plus(k.times(b=$)),v=b,f=y.minus(k.times(b=f)),y=b;return b=D(p.minus(g),S,0,1),v=v.plus(b.times($)),g=g.plus(b.times(S)),v.s=$.s=V.s,A=A*2,U=D($,S,A,ne).minus(V).abs().comparedTo(D(v,g,A,ne).minus(V).abs())<1?[$,S]:[v,g],Ie=P,U},R.toNumber=function(){return+Le(this)},R.toPrecision=function(p,f){return p!=null&&L(p,1,j),mi(this,p,f,2)},R.toString=function(p){var f,g=this,S=g.s,b=g.e;return b===null?S?(f="Infinity",S<0&&(f="-"+f)):f="NaN":(p==null?f=b<=ce||b>=de?Z(K(g.c),b):se(K(g.c),b,"0"):p===10&&yi?(g=$e(new M(g),z+b+1,ne),f=se(K(g.c),g.e,"0")):(L(p,2,Te.length,"Base"),f=ie(se(K(g.c),b,"0"),10,p,S,!0)),S<0&&g.c[0]&&(f="-"+f)),f},R.valueOf=R.toJSON=function(){return Le(this)},R._isBigNumber=!0,B!=null&&M.set(B),M}function T(B){var D=B|0;return B>0||B===D?D:D-1}function K(B){for(var D,ie,W=1,R=B.length,J=B[0]+"";W<R;){for(D=B[W++]+"",ie=c-D.length;ie--;D="0"+D);J+=D}for(R=J.length;J.charCodeAt(--R)===48;);return J.slice(0,R+1||1)}function Y(B,D){var ie,W,R=B.c,J=D.c,z=B.s,ne=D.s,ce=B.e,de=D.e;if(!z||!ne)return null;if(ie=R&&!R[0],W=J&&!J[0],ie||W)return ie?W?0:-ne:z;if(z!=ne)return z;if(ie=z<0,W=ce==de,!R||!J)return W?0:!R^ie?1:-1;if(!W)return ce>de^ie?1:-1;for(ne=(ce=R.length)<(de=J.length)?ce:de,z=0;z<ne;z++)if(R[z]!=J[z])return R[z]>J[z]^ie?1:-1;return ce==de?0:ce>de^ie?1:-1}function L(B,D,ie,W){if(B<D||B>ie||B!==a(B))throw Error(s+(W||"Argument")+(typeof B=="number"?B<D||B>ie?" out of range: ":" not an integer: ":" not a primitive number: ")+String(B))}function H(B){var D=B.c.length-1;return T(B.e/c)==D&&B.c[D]%2!=0}function Z(B,D){return(B.length>1?B.charAt(0)+"."+B.slice(1):B)+(D<0?"e":"e+")+D}function se(B,D,ie){var W,R;if(D<0){for(R=ie+".";++D;R+=ie);B=R+B}else if(W=B.length,++D>W){for(R=ie,D-=W;--D;R+=ie);B+=R}else D<W&&(B=B.slice(0,D)+"."+B.slice(D));return B}i=q(),i.default=i.BigNumber=i,n.exports?n.exports=i:(e||(e=typeof self<"u"&&self?self:window),e.BigNumber=i)})(Kn)})(It)),It.exports}var Bi;function Yn(){return Bi||(Bi=1,(function(n){var e=Hi(),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(l){return t.lastIndex=0,t.test(l)?'"'+l.replace(t,function(u){var m=s[u];return typeof m=="string"?m:"\\u"+("0000"+u.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+l+'"'}function c(l,u){var m,j,q,T,K=o,Y,L=u[l],H=L!=null&&(L instanceof e||e.isBigNumber(L));switch(L&&typeof L=="object"&&typeof L.toJSON=="function"&&(L=L.toJSON(l)),typeof r=="function"&&(L=r.call(u,l,L)),typeof L){case"string":return H?L:d(L);case"number":return isFinite(L)?String(L):"null";case"boolean":case"null":case"bigint":return String(L);case"object":if(!L)return"null";if(o+=a,Y=[],Object.prototype.toString.apply(L)==="[object Array]"){for(T=L.length,m=0;m<T;m+=1)Y[m]=c(m,L)||"null";return q=Y.length===0?"[]":o?`[
|
|
4
4
|
`+o+Y.join(`,
|
|
5
5
|
`+o)+`
|
|
6
6
|
`+K+"]":"["+Y.join(",")+"]",o=K,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,L),q&&Y.push(d(j)+(o?": ":":")+q));else Object.keys(L).forEach(function(Z){var se=c(Z,L);se&&Y.push(d(Z)+(o?": ":":")+se)});return q=Y.length===0?"{}":o?`{
|
|
7
7
|
`+o+Y.join(`,
|
|
8
8
|
`+o)+`
|
|
9
9
|
`+K+"}":"{"+Y.join(",")+"}",o=K,q}}typeof i.stringify!="function"&&(i.stringify=function(l,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("",{"":l})})})()})(Bt)),Bt.exports}var Xt,Xi;function Jn(){if(Xi)return Xt;Xi=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,l=function(H){throw{name:"SyntaxError",message:H,at:s,text:c}},u=function(H){return H&&H!==r&&l("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))l("Bad number");else return n==null&&(n=Di()),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,se="",B;if(r==='"')for(var N=s;u();){if(r==='"')return s-1>N&&(se+=c.substring(N,s-1)),u(),se;if(r==="\\"){if(s-1>N&&(se+=c.substring(N,s-1)),u(),r==="u"){for(B=0,Z=0;Z<4&&(H=parseInt(u(),16),!!isFinite(H));Z+=1)B=B*16+H;se+=String.fromCharCode(B)}else if(typeof d[r]=="string")se+=d[r];else break;N=s}}l("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}l("Unexpected '"+r+"'")},K,Y=function(){var H=[];if(r==="["){if(u("["),q(),r==="]")return u("]"),H;for(;r;){if(H.push(K()),q(),r==="]")return u("]"),H;u(","),q()}}l("Bad array")},L=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)&&l('Duplicate key "'+H+'"'),e.test(H)===!0?a.protoAction==="error"?l("Object contains forbidden prototype property"):a.protoAction==="ignore"?K():Z[H]=K():i.test(H)===!0?a.constructorAction==="error"?l("Object contains forbidden constructor property"):a.constructorAction==="ignore"?K():Z[H]=K():Z[H]=K(),q(),r==="}")return u("}"),Z;u(","),q()}}l("Bad object")};return K=function(){switch(q(),r){case"{":return L();case"[":return Y();case'"':return j();case"-":return m();default:return r>="0"&&r<="9"?m():T()}},function(H,Z){var se;return c=H+"",s=0,r=" ",se=K(),q(),r&&l("Syntax error"),typeof Z=="function"?(function B(N,ie){var W,R=N[ie];return R&&typeof R=="object"&&Object.keys(R).forEach(function(J){W=B(R,J),W!==void 0?R[J]=W:delete R[J]}),Z.call(N,ie,R)})({"":se},""):se}};return Xt=t,Xt}var Vi;function Zn(){if(Vi)return lt.exports;Vi=1;var n=Yn().stringify,e=Jn();return lt.exports=function(i){return{parse:e(i),stringify:n}},lt.exports.parse=e(),lt.exports.stringify=n,lt.exports}var Qn=Zn();const Vt=Gn(Qn);function ve(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(l){try{c(t.next(l))}catch(u){s(u)}}function d(l){try{c(t.throw(l))}catch(u){s(u)}}function c(l){l.done?a(l.value):o(l.value).then(r,d)}c((t=t.apply(n,e||[])).next())})}function Tn(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 At,Wi;class De{static custom(e){return e}static unique(e=7){const i=Tn(At,At,"m",Wi).call(At);let t="";for(let o=0;o<e;o++){const a=Math.floor(Math.random()*16).toString(16);t+=a}return i+t}}At=De,Wi=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 kt=Vt({useNativeBigInt:!0});class C{constructor(e,i,t){this.method=e,this.attribute=i,t!==void 0&&(Array.isArray(t)?this.values=t:this.values=[t])}toString(){return kt.stringify({method:this.method,attribute:this.attribute,values:this.values})}}C.equal=(n,e)=>new C("equal",n,e).toString(),C.notEqual=(n,e)=>new C("notEqual",n,e).toString(),C.regex=(n,e)=>new C("regex",n,e).toString(),C.lessThan=(n,e)=>new C("lessThan",n,e).toString(),C.lessThanEqual=(n,e)=>new C("lessThanEqual",n,e).toString(),C.greaterThan=(n,e)=>new C("greaterThan",n,e).toString(),C.greaterThanEqual=(n,e)=>new C("greaterThanEqual",n,e).toString(),C.isNull=n=>new C("isNull",n).toString(),C.isNotNull=n=>new C("isNotNull",n).toString(),C.exists=n=>new C("exists",void 0,n).toString(),C.notExists=n=>new C("notExists",void 0,n).toString(),C.between=(n,e,i)=>new C("between",n,[e,i]).toString(),C.startsWith=(n,e)=>new C("startsWith",n,e).toString(),C.endsWith=(n,e)=>new C("endsWith",n,e).toString(),C.select=n=>new C("select",void 0,n).toString(),C.search=(n,e)=>new C("search",n,e).toString(),C.orderDesc=n=>new C("orderDesc",n).toString(),C.orderAsc=n=>new C("orderAsc",n).toString(),C.orderRandom=()=>new C("orderRandom").toString(),C.cursorAfter=n=>new C("cursorAfter",void 0,n).toString(),C.cursorBefore=n=>new C("cursorBefore",void 0,n).toString(),C.limit=n=>new C("limit",void 0,n).toString(),C.offset=n=>new C("offset",void 0,n).toString(),C.contains=(n,e)=>new C("contains",n,e).toString(),C.containsAny=(n,e)=>new C("containsAny",n,e).toString(),C.containsAll=(n,e)=>new C("containsAll",n,e).toString(),C.notContains=(n,e)=>new C("notContains",n,e).toString(),C.notSearch=(n,e)=>new C("notSearch",n,e).toString(),C.notBetween=(n,e,i)=>new C("notBetween",n,[e,i]).toString(),C.notStartsWith=(n,e)=>new C("notStartsWith",n,e).toString(),C.notEndsWith=(n,e)=>new C("notEndsWith",n,e).toString(),C.createdBefore=n=>C.lessThan("$createdAt",n),C.createdAfter=n=>C.greaterThan("$createdAt",n),C.createdBetween=(n,e)=>C.between("$createdAt",n,e),C.updatedBefore=n=>C.lessThan("$updatedAt",n),C.updatedAfter=n=>C.greaterThan("$updatedAt",n),C.updatedBetween=(n,e)=>C.between("$updatedAt",n,e),C.or=n=>new C("or",void 0,n.map(e=>kt.parse(e))).toString(),C.and=n=>new C("and",void 0,n.map(e=>kt.parse(e))).toString(),C.elemMatch=(n,e)=>new C("elemMatch",n,e.map(i=>kt.parse(i))).toString(),C.distanceEqual=(n,e,i,t=!0)=>new C("distanceEqual",n,[[e,i,t]]).toString(),C.distanceNotEqual=(n,e,i,t=!0)=>new C("distanceNotEqual",n,[[e,i,t]]).toString(),C.distanceGreaterThan=(n,e,i,t=!0)=>new C("distanceGreaterThan",n,[[e,i,t]]).toString(),C.distanceLessThan=(n,e,i,t=!0)=>new C("distanceLessThan",n,[[e,i,t]]).toString(),C.vectorDot=(n,e)=>new C("vectorDot",n,[e]).toString(),C.vectorCosine=(n,e)=>new C("vectorCosine",n,[e]).toString(),C.vectorEuclidean=(n,e)=>new C("vectorEuclidean",n,[e]).toString(),C.intersects=(n,e)=>new C("intersects",n,[e]).toString(),C.notIntersects=(n,e)=>new C("notIntersects",n,[e]).toString(),C.crosses=(n,e)=>new C("crosses",n,[e]).toString(),C.notCrosses=(n,e)=>new C("notCrosses",n,[e]).toString(),C.overlaps=(n,e)=>new C("overlaps",n,[e]).toString(),C.notOverlaps=(n,e)=>new C("notOverlaps",n,[e]).toString(),C.touches=(n,e)=>new C("touches",n,[e]).toString(),C.notTouches=(n,e)=>new C("notTouches",n,[e]).toString();const zn=Vt({storeAsString:!1}),On=Vt({useNativeBigInt:!0}),Fn=BigInt(Number.MAX_SAFE_INTEGER),eo=BigInt(Number.MIN_SAFE_INTEGER),to=BigInt("9223372036854775807"),io=BigInt("-9223372036854775808");function no(n){return n!==null&&typeof n=="object"&&n._isBigNumber===!0&&typeof n.isInteger=="function"&&typeof n.toFixed=="function"&&typeof n.toNumber=="function"}function oo(n,e){if(no(e)){if(e.isInteger()){const i=e.toFixed(),t=BigInt(i);return t>=eo&&t<=Fn?Number(i):t>=io&&t<=to?t:e.toNumber()}return e.toNumber()}return e}const me={parse:n=>zn.parse(n,oo),stringify:On.stringify};class h 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(me.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 l,u,m;if(!this.realtime.reconnect||((u=(l=this.realtime)===null||l===void 0?void 0:l.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(me.stringify({type:"subscribe",data:e}))},onMessage:e=>{var i,t;try{const o=me.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=me.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(me.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 h("Endpoint must be a valid string");if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new h("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 h("Endpoint must be a valid string");if(!e.startsWith("ws://")&&!e.startsWith("wss://"))throw new h("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 l=De.unique();if(!this.realtime.subscriptions.has(l)){r=l;break}}if(r==="")throw new h("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(l=>{l.channels.forEach(u=>c.add(u))}),this.realtime.channels.forEach(l=>{c.has(l)||this.realtime.channels.delete(l)}),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=me.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 ve(this,arguments,void 0,function*(t,o,a={},s={},r){var d;const[c,l]=(d=Object.entries(s).find(([J,z])=>z instanceof File))!==null&&d!==void 0?d:[];if(!l||!c)throw new Error("File not found in payload");if(l.size<=Ae.CHUNK_SIZE)return yield this.call(t,o,a,s);const u=Math.ceil(l.size/Ae.CHUNK_SIZE),m=Math.min(Ae.CHUNK_SIZE,l.size),j=Object.assign(Object.assign({},a),{"content-range":`bytes 0-${m-1}/${l.size}`}),q=l.slice(0,m),T=Object.assign({},s);T[c]=new File([q],l.name);const K=yield this.call(t,o,j,T),Y=K?.$id;if(r&&typeof r=="function"&&r({$id:Y,progress:Math.round(m/l.size*100),sizeUploaded:m,chunksTotal:u,chunksUploaded:1}),u===1)return K;const L=[];for(let J=1;J<u;J++){const z=J*Ae.CHUNK_SIZE,ne=Math.min(z+Ae.CHUNK_SIZE,l.size);L.push({start:z,end:ne})}const H=8;let Z=1,se=m,B=K,N=null,ie=!1;const W=J=>{var z;const ne=J?.chunksUploaded,ce=(z=J?.chunksTotal)!==null&&z!==void 0?z:u;return typeof ne=="number"&&typeof ce=="number"&&ne>=ce},R=J=>ve(this,void 0,void 0,function*(){const z=Object.assign({},a);Y&&(z["x-appwrite-id"]=Y),z["content-range"]=`bytes ${J.start}-${J.end-1}/${l.size}`;const ne=l.slice(J.start,J.end),ce=Object.assign({},s);ce[c]=new File([ne],l.name);const de=yield this.call(t,o,z,ce);return ie||(Z++,se+=J.end-J.start,B=de,W(de)&&(N=de),r&&typeof r=="function"&&r({$id:Y,progress:Math.round(se/l.size*100),sizeUploaded:se,chunksTotal:u,chunksUploaded:Z})),de});return yield new Promise((J,z)=>{let ne=0,ce=0,de=0;const Ue=()=>{if(!ie){if(de===L.length){J();return}for(;ce<H&&ne<L.length;){const Ie=L[ne++];ce++,R(Ie).then(()=>{ce--,de++,Ue()}).catch(_e=>{ie=!0,z(_e)})}}};Ue()}),N??B})}ping(){return ve(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 ve(this,arguments,void 0,function*(t,o,a={},s={},r="json"){var d,c,l;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 h(`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(Y=>console.warn("Warning: "+Y)),!((d=q.headers.get("content-type"))===null||d===void 0)&&d.includes("application/json")?j=me.parse(yield q.text()):r==="arrayBuffer"?j=yield q.arrayBuffer():j={message:yield q.text()},400<=q.status){let Y;throw!((c=q.headers.get("content-type"))===null||c===void 0)&&c.includes("application/json")||r==="arrayBuffer"?Y=me.stringify(j):Y=j?.message,new h((l=j?.message)!==null&&l!==void 0?l:Y,q.status,j?.type,Y)}const K=q.headers.get("X-Fallback-Cookies");return typeof window<"u"&&window.localStorage&&K&&(window.console.warn("Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint."),window.localStorage.setItem("cookieFallback",K)),j&&typeof j=="object"&&Object.defineProperty(j,"toString",{value:()=>me.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 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 Wt{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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('Missing required parameter: "email"');if(typeof s>"u")throw new h('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 l=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",l,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 h('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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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 h('Missing required parameter: "consentId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "consentId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "email"');if(typeof a>"u")throw new h('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 h('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 h('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 h('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 h('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 h('Missing required parameter: "type"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "type"');if(typeof a>"u")throw new h('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 h('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 h('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 h('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 h('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 h('Missing required parameter: "challengeId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "challengeId"');if(typeof a>"u")throw new h('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 h('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 h('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 h('Missing required parameter: "phone"');if(typeof a>"u")throw new h('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 h('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 h('Missing required parameter: "email"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('Missing required parameter: "secret"');if(typeof s>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",c,l,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 h('Missing required parameter: "email"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('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 l=new URL(this.client.config.endpoint+d);c.project=this.client.config.project;for(const[u,m]of Object.entries(ye.flatten(c)))l.searchParams.append(u,m);if(typeof window<"u"&&window?.location){window.location.href=l.toString();return}else return l.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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('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 h('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 h('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 h('Missing required parameter: "targetId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('Missing required parameter: "targetId"');if(typeof a>"u")throw new h('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 h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 l=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",l,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 h('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 l=new URL(this.client.config.endpoint+d);c.project=this.client.config.project;for(const[u,m]of Object.entries(ye.flatten(c)))l.searchParams.append(u,m);if(typeof window<"u"&&window?.location){window.location.href=l.toString();return}else return l.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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('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 h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 Gi{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 h('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 l=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)))l.searchParams.append(u,m);return l.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 h('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 l=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)))l.searchParams.append(u,m);return l.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 h('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 h('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 l=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)))l.searchParams.append(u,m);return l.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 h('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[l,u]of Object.entries(ye.flatten(d)))c.searchParams.append(l,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 l=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)))l.searchParams.append(u,m);return l.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,l=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 l<"u"&&(j.emailHash=l),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,K]of Object.entries(ye.flatten(j)))q.searchParams.append(T,K);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 h('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 l=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)))l.searchParams.append(u,m);return l.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,l=t.userAgent,u=t.fullpage,m=t.locale,j=t.timezone,q=t.latitude,T=t.longitude,K=t.accuracy,Y=t.touch,L=t.permissions,H=t.sleep,Z=t.width,se=t.height,B=t.quality,N=t.output;if(typeof o>"u")throw new h('Missing required parameter: "url"');const ie="/avatars/screenshots",W={};typeof o<"u"&&(W.url=o),typeof a<"u"&&(W.headers=a),typeof s<"u"&&(W.viewportWidth=s),typeof r<"u"&&(W.viewportHeight=r),typeof d<"u"&&(W.scale=d),typeof c<"u"&&(W.theme=c),typeof l<"u"&&(W.userAgent=l),typeof u<"u"&&(W.fullpage=u),typeof m<"u"&&(W.locale=m),typeof j<"u"&&(W.timezone=j),typeof q<"u"&&(W.latitude=q),typeof T<"u"&&(W.longitude=T),typeof K<"u"&&(W.accuracy=K),typeof Y<"u"&&(W.touch=Y),typeof L<"u"&&(W.permissions=L),typeof H<"u"&&(W.sleep=H),typeof Z<"u"&&(W.width=Z),typeof se<"u"&&(W.height=se),typeof B<"u"&&(W.quality=B),typeof N<"u"&&(W.output=N);const R=new URL(this.client.config.endpoint+ie);W.project=this.client.config.project,W.impersonateuserid=this.client.config.impersonateuserid;for(const[J,z]of Object.entries(ye.flatten(W)))R.searchParams.append(J,z);return R.toString()}}class ao{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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('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 h('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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('Missing required parameter: "data"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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))),l={};typeof r<"u"&&(l.queries=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",l,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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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 so{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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('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 h('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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('Missing required parameter: "data"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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 l=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",l,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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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))),l={};typeof r<"u"&&(l.queries=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",l,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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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 ro{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 h('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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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,l=t.scheduledAt;if(typeof o>"u")throw new h('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 l<"u"&&(m.scheduledAt=l);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 h('Missing required parameter: "functionId"');if(typeof a>"u")throw new h('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 co{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 h('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 h('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 lo{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 uo{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 h('Missing required parameter: "topicId"');if(typeof a>"u")throw new h('Missing required parameter: "subscriberId"');if(typeof s>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('Missing required parameter: "topicId"');if(typeof a>"u")throw new h('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 po{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 h('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 h('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 h('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 h('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 ho{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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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 h('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 h('Missing required parameter: "presenceId"');if(typeof a>"u")throw new h('Missing required parameter: "status"');const c="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(o))),l={};typeof a<"u"&&(l.status=a),typeof s<"u"&&(l.permissions=s),typeof r<"u"&&(l.expiresAt=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "presenceId"');const l="/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+l),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 h('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 fo{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 h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",l,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 h('Missing required parameter: "bucketId"');if(typeof s>"u")throw new h('Missing required parameter: "fileId"');if(typeof r>"u")throw new h('Missing required parameter: "file"');const l="/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+l),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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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 l=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",l,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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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[l,u]of Object.entries(ye.flatten(d)))c.searchParams.append(l,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,l=t.borderWidth,u=t.borderColor,m=t.borderRadius,j=t.opacity,q=t.rotation,T=t.background,K=t.output,Y=t.token;if(typeof o>"u")throw new h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('Missing required parameter: "fileId"');const L="/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 l<"u"&&(H.borderWidth=l),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 K<"u"&&(H.output=K),typeof Y<"u"&&(H.token=Y);const Z=new URL(this.client.config.endpoint+L);H.project=this.client.config.project,H.impersonateuserid=this.client.config.impersonateuserid;for(const[se,B]of Object.entries(ye.flatten(H)))Z.searchParams.append(se,B);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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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[l,u]of Object.entries(ye.flatten(d)))c.searchParams.append(l,u);return c.toString()}}class go{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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('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 h('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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');if(typeof r>"u")throw new h('Missing required parameter: "data"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('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))),l={};typeof r<"u"&&(l.queries=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",l,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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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 Ki{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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",l,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,l=t.name;if(typeof o>"u")throw new h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 l<"u"&&(m.name=l);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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('Missing required parameter: "membershipId"');if(typeof s>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('Missing required parameter: "membershipId"');if(typeof s>"u")throw new h('Missing required parameter: "userId"');if(typeof r>"u")throw new h('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 l=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",l,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 h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 yo{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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('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 h('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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('Missing required parameter: "data"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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))),l={};typeof r<"u"&&(l.queries=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",l,u,c)}}var St;(function(n){n[n.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",n[n.POLICY_VIOLATION=1008]="POLICY_VIOLATION",n[n.UNKNOWN_ERROR=-1]="UNKNOWN_ERROR"})(St||(St={}));class mo{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(me.stringify({type:"ping"}))},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatTimer&&(window?.clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}createSocket(){return ve(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 ve(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 h("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,l=this.socket=new WebSocket(s);l.addEventListener("open",()=>{c===this.connectionId&&(this.reconnectAttempts=0,this.onOpenCallbacks.forEach(u=>u()),this.startHeartbeat(),r())}),l.addEventListener("message",u=>{if(c===this.connectionId)try{const m=me.parse(u.data);this.handleMessage(m)}catch(m){console.error("Failed to parse message:",m)}}),l.addEventListener("close",u=>ve(this,void 0,void 0,function*(){if(c!==this.connectionId||l!==this.socket)return;if(this.appConnected=!1,this.stopHeartbeat(),this.onCloseCallbacks.forEach(j=>j()),!this.reconnect||u.code===St.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)}})),l.addEventListener("error",u=>{if(c!==this.connectionId||l!==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 ve(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(St.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(me.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=De.unique();if(!this.activeSubscriptions.has(t))return t}throw new h("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 ve(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(me.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 ve(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 l=this.generateUniqueSubscriptionId();this.activeSubscriptions.set(l,{channels:d,queries:c,callback:o}),this.enqueuePendingSubscribe(l),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=()=>ve(this,void 0,void 0,function*(){this.activeSubscriptions.has(l)&&(this.activeSubscriptions.delete(l),this.pendingSubscribes.delete(l),this.sendUnsubscribeMessage([l]))});return{unsubscribe:u,update:q=>ve(this,void 0,void 0,function*(){const T=this.activeSubscriptions.get(l);if(T){if(q.channels!==void 0){const K=q.channels.map(Y=>this.channelToString(Y));T.channels=new Set(K)}if(q.queries!==void 0){const K=[];for(const Y of q.queries)if(Array.isArray(Y))for(const L of Y)K.push(typeof L=="string"?L:L.toString());else K.push(typeof Y=="string"?Y:Y.toString());T.queries=K}this.enqueuePendingSubscribe(l),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:()=>ve(this,void 0,void 0,function*(){yield u(),this.activeSubscriptions.size===0&&(this.reconnect=!1,yield this.closeSocket())})}})}upsertPresence(e){return ve(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(me.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=me.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(me.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 h(((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 et{}et.read=n=>`read("${n}")`,et.write=n=>`write("${n}")`,et.create=n=>`create("${n}")`,et.update=n=>`update("${n}")`,et.delete=n=>`delete("${n}")`;class bo{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 Me(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,Me(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",Me(e)])}static execution(e){return new ke(["executions",Me(e)])}static tablesdb(e){return new ke(["tablesdb",Me(e)])}static bucket(e){return new ke(["buckets",Me(e)])}static function(e){return new ke(["functions",Me(e)])}static team(e){return new ke(["teams",Me(e)])}static membership(e){return new ke(["memberships",Me(e)])}static presence(e){return new ke(["presences",Me(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 Gt;(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"})(Gt||(Gt={}));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 Kt;(function(n){n.Totp="totp"})(Kt||(Kt={}));var Yt;(function(n){n.Email="email",n.Phone="phone",n.Totp="totp",n.Recoverycode="recoverycode",n.Custom="custom"})(Yt||(Yt={}));var Jt;(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"})(Jt||(Jt={}));var Zt;(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"})(Zt||(Zt={}));var Qt;(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"})(Qt||(Qt={}));var Tt;(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"})(Tt||(Tt={}));var zt;(function(n){n.Light="light",n.Dark="dark"})(zt||(zt={}));var Ot;(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"})(Ot||(Ot={}));var Ft;(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"})(Ft||(Ft={}));var ei;(function(n){n.Jpg="jpg",n.Jpeg="jpeg",n.Png="png",n.Webp="webp",n.Heic="heic",n.Avif="avif",n.Gif="gif"})(ei||(ei={}));var ti;(function(n){n.GET="GET",n.POST="POST",n.PUT="PUT",n.PATCH="PATCH",n.DELETE="DELETE",n.OPTIONS="OPTIONS",n.HEAD="HEAD"})(ti||(ti={}));var ii;(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"})(ii||(ii={}));var ni;(function(n){n.Functions="functions",n.Sites="sites"})(ni||(ni={}));var oi;(function(n){n.Http="http",n.Schedule="schedule",n.Event="event"})(oi||(oi={}));var ai;(function(n){n.Waiting="waiting",n.Processing="processing",n.Completed="completed",n.Failed="failed",n.Scheduled="scheduled"})(ai||(ai={}));const wo=Object.freeze(Object.defineProperty({__proto__:null,Account:Wt,AppwriteException:h,get AuthenticationFactor(){return Yt},get AuthenticatorType(){return Kt},Avatars:Gi,get Browser(){return Zt},get BrowserPermission(){return Ft},get BrowserTheme(){return zt},Channel:ke,Client:Ae,get Condition(){return Gt},get CreditCard(){return Qt},Databases:ao,DocumentsDB:so,get ExecutionMethod(){return ti},get ExecutionResourceType(){return ni},get ExecutionStatus(){return ai},get ExecutionTrigger(){return oi},get Flag(){return Tt},Functions:ro,Graphql:co,ID:De,get ImageFormat(){return ei},get ImageGravity(){return ii},Locale:lo,Messaging:uo,get OAuthProvider(){return Jt},Operator:Q,Organization:po,Permission:et,Presences:ho,Query:C,Realtime:mo,Role:bo,Storage:fo,TablesDB:go,Teams:Ki,get Timezone(){return Ot},VectorsDB:yo},Symbol.toStringTag,{value:"Module"})),Yi={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.",passwordChanged:"Your password was updated.",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.",noConnectionsDescription:"Link an OAuth provider to sign in faster next time.",disconnect:"Disconnect",connectProvider:"Connect {provider}",noActivity:"No recent activity.",noActivityDescription:"Security events for this account will appear here.",noSessions:"No active sessions.",noSessionsDescription:"Active sessions will show up here once you sign in on a device.",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>.",errorConfigIncomplete:"Auth UI is missing endpoint or project. Set them on <authui-config> or pass them to AuthUI.init().",errorConfig:"Auth UI cannot reach this Appwrite project. Check that endpoint ends with /v1, the project ID is correct, and this hostname is registered as a Web platform.",errorConfigEndpoint:"Check that endpoint ends with /v1. Appwrite API URLs look like https://cloud.appwrite.io/v1.",passwordHint:"At least 8 characters.",passwordStrengthLabel:"Password strength",passwordStrengthTooWeak:"Too weak",passwordStrengthWeak:"Weak",passwordStrengthFair:"Fair",passwordStrengthStrong:"Strong",passwordStrengthVeryStrong:"Very strong",lastUsed:"Last used",teamsLabel:"Teams",noTeams:"You are not on any teams yet.",activeTeam:"Active",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",acceptLegal:"I agree to the",errorLegalRequired:"Accept the terms to continue."};function vo(n,e={}){return n.replace(/\{(\w+)\}/g,(i,t)=>t in e?String(e[t]):`{${t}}`)}const Io={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 tt(n){return Io[n]??n.charAt(0).toUpperCase()+n.slice(1)}const $t=(n,e,i=401)=>Object.assign(new Error(e),{type:n,code:i}),Pe=()=>new Date().toISOString(),Re=n=>new Date(Date.now()-n*6e4).toISOString(),jt=["amber","brave","calm","delta","ember","fable","glide","harbor","ivory","juniper","kite","lumen"],Ji=()=>`${jt[Math.floor(Math.random()*jt.length)]}-${jt[Math.floor(Math.random()*jt.length)]}`,it=()=>Math.random().toString(36).slice(2,12),Zi=()=>Array.from({length:2},()=>Math.random().toString(36).slice(2,7)).join("-"),Ao={name:"Ada Lovelace",email:"ada@example.com",phone:"+15550100"};class Qi{constructor(e=Ao){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:Re(43200),$updatedAt:Pe(),name:i?"":e.name??this.seed.name,registration:Re(43200),status:!0,labels:[],passwordUpdate:i?"":Re(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:it(),$createdAt:Re(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:it(),$createdAt:Re(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:Re(28800),$updatedAt:Re(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:Re(2880),clientName:"Safari",osName:"iOS",countryName:"Germany",ip:"198.51.100.7"},{event:"session.create",time:Re(4320),clientName:"Firefox",osName:"Windows",countryName:"United States",ip:"192.0.2.90"}]}requireUser(){if(!this.user)throw $t("general_unauthorized_scope","User (role: guests) missing scope (account)");if(this.mfaPending)throw $t("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 $t("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:it(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:Ji()})}async createEmailToken(e,i){return this.tokens.set(e,{email:i}),this.delay({$id:it(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:Ji()})}async createPhoneToken(e,i){return this.tokens.set(e,{phone:i}),this.delay({$id:it(),$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:it(),$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 $t("user_recovery_codes_already_exists","Recovery codes already generated.",409);return this.recoveryCodes=Array.from({length:6},Zi),{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},Zi),{recoveryCodes:this.recoveryCodes}))}reset(){this.user=null,this.mfaPending=!1,this.sessions=[],this.identities=[],this.logs=[],this.tokens.clear()}}function ko(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 ee={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",projectNotFound:"project_not_found",unknownOrigin:"general_unknown_origin",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 Je(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 ut(n,e){return Je(n).type===e}function pt(n,e,i="link"){const t=Je(n);switch(t.type){case ee.invalidCredentials:return i==="password"?e.errorCurrentPassword:e.errorInvalidCredentials;case ee.userAlreadyExists:case ee.emailAlreadyExists:case ee.phoneAlreadyExists:return e.errorUserExists;case ee.userBlocked:return e.errorUserBlocked;case ee.rateLimit:return e.errorRateLimit;case ee.invalidToken:return i==="code"?e.errorInvalidCode:e.errorInvalidToken;case ee.invalidCode:return e.errorInvalidCode;case ee.passwordMismatch:return e.errorPasswordMismatch;case ee.passwordRecentlyUsed:return e.errorPasswordRecentlyUsed;case ee.passwordPersonalData:return e.errorPasswordPersonalData;case ee.passwordWeak:return e.errorPasswordWeak;case ee.passwordPwned:return e.errorPasswordPwned;case ee.challengeRequired:return e.errorChallengeRequired;case ee.sessionAlreadyExists:return e.errorSessionExists;case ee.oauthUnauthorized:case ee.oauthBadRequest:return e.errorOAuth;case ee.authMethodUnsupported:return e.errorMethodDisabled}if(t.type===ee.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.type===ee.projectNotFound||t.type===ee.unknownOrigin?e.errorConfig:t.type===ee.routeNotFound?e.errorConfigEndpoint:t.code===0&&/fetch|network/i.test(t.message)?e.errorNetwork:/Invalid `\w+` param/i.test(t.message)?e.errorGeneric:t.message?t.message||e.errorGeneric:t.code===404||t.type===ee.routeNotFound?e.errorConfigEndpoint:e.errorGeneric}function Ti(n){const e=Je(n);return!!(e.type===ee.projectNotFound||e.type===ee.unknownOrigin||e.type===ee.routeNotFound||!e.message&&e.code===404||e.code===0&&/fetch|network|load failed|failed to fetch/i.test(e.message))}const si=n=>`authui:active-team:${n}`;function ri(n){if(typeof localStorage>"u"||!n)return null;try{return localStorage.getItem(si(n))}catch{return null}}function zi(n,e){if(!(typeof localStorage>"u"||!n))try{e?localStorage.setItem(si(n),e):localStorage.removeItem(si(n))}catch{}}const ci="authui:last-method";function Ze(n){if(!(typeof localStorage>"u")){if(!n||n==="mfa"||n==="sign-up")if(n==="sign-up")n="email-password";else return;try{localStorage.setItem(ci,n)}catch{}}}function Qe(){if(typeof localStorage>"u")return null;try{return localStorage.getItem(ci)}catch{return null}}function So(){if(!(typeof localStorage>"u"))try{localStorage.removeItem(ci)}catch{}}const Pt="authui:pending-oauth";function Oi(n){if(!(typeof sessionStorage>"u"))try{sessionStorage.setItem(Pt,n)}catch{}}function di(){if(!(typeof sessionStorage>"u"))try{const n=sessionStorage.getItem(Pt);sessionStorage.removeItem(Pt),n&&Ze(`oauth:${n}`)}catch{}}function li(){if(!(typeof sessionStorage>"u"))try{sessionStorage.removeItem(Pt)}catch{}}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 ui="authui",Fi=["userId","secret","expire","project","error",ui],en=()=>({status:"loading",user:null,mfaFactors:null,pending:null,configured:!1,configError:null});class tn{constructor(){this.client=null,this.account=null,this.config=null,this.state=en(),this.listeners=new Map,this.refreshPromise=null,this.preview=null,this.teams=null,this.activeTeamId=null}configure(e){const i=e.endpoint.trim().replace(/\/+$/,"");i&&!i.endsWith("/v1")&&console.warn(`[authui] endpoint should end with /v1 (got "${e.endpoint}"). Without it Appwrite returns HTML 404 pages.`),this.config=e,this.client=new Ae().setEndpoint(e.endpoint).setProject(e.project),this.preview=e.preview?new Qi:null,this.account=this.preview?this.preview:new Wt(this.client),this.teams=null,this.activeTeamId=ri(e.project),this.setState({configured:!0,status:"loading",configError:null}),this.preview?this.refresh():typeof window<"u"&&this.handleRedirect().then(()=>this.refresh())}notifyConfigIncomplete(){if(this.config)return;const e=this.getStrings().errorConfigIncomplete;console.warn(`[authui] ${e}`),this.setState({status:"signed-out",user:null,mfaFactors:null,configured:!1,configError:e,pending:{type:"notice",tone:"error",message:e}})}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}async listTeams(){if(this.preview||!this.client||this.state.status!=="signed-in")return[];this.teams??=new Ki(this.client);try{return(await this.teams.list()).teams??[]}catch(e){this.fail(e)}}getActiveTeamId(){if(this.activeTeamId)return this.activeTeamId;const e=this.config?.project;return e?(this.activeTeamId=ri(e),this.activeTeamId):null}setActiveTeam(e){const i=this.config?.project;i&&zi(i,e?.$id??null),this.activeTeamId=e?.$id??null,this.emit("active-team",{teamId:this.activeTeamId,team:e})}getStrings(){return{...Yi,...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=Je(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,configError:null}),e||this.emit("signed-in",i)}catch(i){if(ut(i,ee.moreFactorsRequired)){let t=null;try{t=await Se(this.account,["listMFAFactors","listMfaFactors"],[])}catch{}this.setState({status:"mfa-required",user:null,mfaFactors:t})}else if(ut(i,ee.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);else if(!e&&Ti(i)){const o=pt(i,this.getStrings())||this.getStrings().errorConfig;console.warn(`[authui] ${o} (endpoint=${this.config?.endpoint??"?"}, project=${this.config?.project??"?"})`);const a=Je(i);this.emit("error",{message:o,type:a.type,code:a.code}),this.setState({status:"signed-out",user:null,mfaFactors:null,configError:o,pending:{type:"notice",tone:"error",message:o}})}else this.setState({status:"signed-out",user:null,mfaFactors:null,configError: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:ee.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 Wt(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(De.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(De.unique(),e.trim(),this.redirectUrl("magic-url"),this.config?.securityPhrase??!0)}catch(i){return this.fail(i)}}async sendEmailOtp(e){try{return await this.acct().createEmailToken(De.unique(),e.trim(),this.config?.securityPhrase??!0)}catch(i){return this.fail(i)}}async sendPhoneOtp(e){try{return await this.acct().createPhoneToken(De.unique(),e.replace(/[\s()-]/g,""))}catch(i){return this.fail(i)}}async signInWithToken(e,i){try{await this.acct().createSession(e,i.trim())}catch(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 Fi)t.searchParams.delete(o);return t.searchParams.set(ui,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(ui);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),i==="oauth"?di():Ze("magic-url")):(i==="oauth"&&li(),a());break;case"oauth-failed":li(),this.setState({pending:{type:"notice",tone:"error",message:this.getStrings().errorOAuth}});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=Je(s),d=pt(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 Fi)e.searchParams.delete(i);window.history.replaceState(window.history.state,"",e.toString())}reset(){this.client=null,this.account=null,this.teams=null,this.activeTeamId=null,this.preview=null,this.config=null,this.state=en(),this.listeners.clear()}}const E=new tn;class $o{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 nn=new $o,on={none:"0px",sm:"0.25rem",md:"0.625rem",lg:"0.875rem",xl:"1.125rem",full:"1.5rem"},jo=Ne`
|
|
10
|
+
`,r:"\r",t:" "},c,l=function(H){throw{name:"SyntaxError",message:H,at:s,text:c}},u=function(H){return H&&H!==r&&l("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))l("Bad number");else return n==null&&(n=Hi()),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,se="",B;if(r==='"')for(var D=s;u();){if(r==='"')return s-1>D&&(se+=c.substring(D,s-1)),u(),se;if(r==="\\"){if(s-1>D&&(se+=c.substring(D,s-1)),u(),r==="u"){for(B=0,Z=0;Z<4&&(H=parseInt(u(),16),!!isFinite(H));Z+=1)B=B*16+H;se+=String.fromCharCode(B)}else if(typeof d[r]=="string")se+=d[r];else break;D=s}}l("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}l("Unexpected '"+r+"'")},K,Y=function(){var H=[];if(r==="["){if(u("["),q(),r==="]")return u("]"),H;for(;r;){if(H.push(K()),q(),r==="]")return u("]"),H;u(","),q()}}l("Bad array")},L=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)&&l('Duplicate key "'+H+'"'),e.test(H)===!0?a.protoAction==="error"?l("Object contains forbidden prototype property"):a.protoAction==="ignore"?K():Z[H]=K():i.test(H)===!0?a.constructorAction==="error"?l("Object contains forbidden constructor property"):a.constructorAction==="ignore"?K():Z[H]=K():Z[H]=K(),q(),r==="}")return u("}"),Z;u(","),q()}}l("Bad object")};return K=function(){switch(q(),r){case"{":return L();case"[":return Y();case'"':return j();case"-":return m();default:return r>="0"&&r<="9"?m():T()}},function(H,Z){var se;return c=H+"",s=0,r=" ",se=K(),q(),r&&l("Syntax error"),typeof Z=="function"?(function B(D,ie){var W,R=D[ie];return R&&typeof R=="object"&&Object.keys(R).forEach(function(J){W=B(R,J),W!==void 0?R[J]=W:delete R[J]}),Z.call(D,ie,R)})({"":se},""):se}};return Xt=t,Xt}var Vi;function Zn(){if(Vi)return lt.exports;Vi=1;var n=Yn().stringify,e=Jn();return lt.exports=function(i){return{parse:e(i),stringify:n}},lt.exports.parse=e(),lt.exports.stringify=n,lt.exports}var Qn=Zn();const Vt=Gn(Qn);function ve(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(l){try{c(t.next(l))}catch(u){s(u)}}function d(l){try{c(t.throw(l))}catch(u){s(u)}}function c(l){l.done?a(l.value):o(l.value).then(r,d)}c((t=t.apply(n,e||[])).next())})}function Tn(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 At,Wi;class He{static custom(e){return e}static unique(e=7){const i=Tn(At,At,"m",Wi).call(At);let t="";for(let o=0;o<e;o++){const a=Math.floor(Math.random()*16).toString(16);t+=a}return i+t}}At=He,Wi=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 kt=Vt({useNativeBigInt:!0});class C{constructor(e,i,t){this.method=e,this.attribute=i,t!==void 0&&(Array.isArray(t)?this.values=t:this.values=[t])}toString(){return kt.stringify({method:this.method,attribute:this.attribute,values:this.values})}}C.equal=(n,e)=>new C("equal",n,e).toString(),C.notEqual=(n,e)=>new C("notEqual",n,e).toString(),C.regex=(n,e)=>new C("regex",n,e).toString(),C.lessThan=(n,e)=>new C("lessThan",n,e).toString(),C.lessThanEqual=(n,e)=>new C("lessThanEqual",n,e).toString(),C.greaterThan=(n,e)=>new C("greaterThan",n,e).toString(),C.greaterThanEqual=(n,e)=>new C("greaterThanEqual",n,e).toString(),C.isNull=n=>new C("isNull",n).toString(),C.isNotNull=n=>new C("isNotNull",n).toString(),C.exists=n=>new C("exists",void 0,n).toString(),C.notExists=n=>new C("notExists",void 0,n).toString(),C.between=(n,e,i)=>new C("between",n,[e,i]).toString(),C.startsWith=(n,e)=>new C("startsWith",n,e).toString(),C.endsWith=(n,e)=>new C("endsWith",n,e).toString(),C.select=n=>new C("select",void 0,n).toString(),C.search=(n,e)=>new C("search",n,e).toString(),C.orderDesc=n=>new C("orderDesc",n).toString(),C.orderAsc=n=>new C("orderAsc",n).toString(),C.orderRandom=()=>new C("orderRandom").toString(),C.cursorAfter=n=>new C("cursorAfter",void 0,n).toString(),C.cursorBefore=n=>new C("cursorBefore",void 0,n).toString(),C.limit=n=>new C("limit",void 0,n).toString(),C.offset=n=>new C("offset",void 0,n).toString(),C.contains=(n,e)=>new C("contains",n,e).toString(),C.containsAny=(n,e)=>new C("containsAny",n,e).toString(),C.containsAll=(n,e)=>new C("containsAll",n,e).toString(),C.notContains=(n,e)=>new C("notContains",n,e).toString(),C.notSearch=(n,e)=>new C("notSearch",n,e).toString(),C.notBetween=(n,e,i)=>new C("notBetween",n,[e,i]).toString(),C.notStartsWith=(n,e)=>new C("notStartsWith",n,e).toString(),C.notEndsWith=(n,e)=>new C("notEndsWith",n,e).toString(),C.createdBefore=n=>C.lessThan("$createdAt",n),C.createdAfter=n=>C.greaterThan("$createdAt",n),C.createdBetween=(n,e)=>C.between("$createdAt",n,e),C.updatedBefore=n=>C.lessThan("$updatedAt",n),C.updatedAfter=n=>C.greaterThan("$updatedAt",n),C.updatedBetween=(n,e)=>C.between("$updatedAt",n,e),C.or=n=>new C("or",void 0,n.map(e=>kt.parse(e))).toString(),C.and=n=>new C("and",void 0,n.map(e=>kt.parse(e))).toString(),C.elemMatch=(n,e)=>new C("elemMatch",n,e.map(i=>kt.parse(i))).toString(),C.distanceEqual=(n,e,i,t=!0)=>new C("distanceEqual",n,[[e,i,t]]).toString(),C.distanceNotEqual=(n,e,i,t=!0)=>new C("distanceNotEqual",n,[[e,i,t]]).toString(),C.distanceGreaterThan=(n,e,i,t=!0)=>new C("distanceGreaterThan",n,[[e,i,t]]).toString(),C.distanceLessThan=(n,e,i,t=!0)=>new C("distanceLessThan",n,[[e,i,t]]).toString(),C.vectorDot=(n,e)=>new C("vectorDot",n,[e]).toString(),C.vectorCosine=(n,e)=>new C("vectorCosine",n,[e]).toString(),C.vectorEuclidean=(n,e)=>new C("vectorEuclidean",n,[e]).toString(),C.intersects=(n,e)=>new C("intersects",n,[e]).toString(),C.notIntersects=(n,e)=>new C("notIntersects",n,[e]).toString(),C.crosses=(n,e)=>new C("crosses",n,[e]).toString(),C.notCrosses=(n,e)=>new C("notCrosses",n,[e]).toString(),C.overlaps=(n,e)=>new C("overlaps",n,[e]).toString(),C.notOverlaps=(n,e)=>new C("notOverlaps",n,[e]).toString(),C.touches=(n,e)=>new C("touches",n,[e]).toString(),C.notTouches=(n,e)=>new C("notTouches",n,[e]).toString();const zn=Vt({storeAsString:!1}),On=Vt({useNativeBigInt:!0}),Fn=BigInt(Number.MAX_SAFE_INTEGER),eo=BigInt(Number.MIN_SAFE_INTEGER),to=BigInt("9223372036854775807"),io=BigInt("-9223372036854775808");function no(n){return n!==null&&typeof n=="object"&&n._isBigNumber===!0&&typeof n.isInteger=="function"&&typeof n.toFixed=="function"&&typeof n.toNumber=="function"}function oo(n,e){if(no(e)){if(e.isInteger()){const i=e.toFixed(),t=BigInt(i);return t>=eo&&t<=Fn?Number(i):t>=io&&t<=to?t:e.toNumber()}return e.toNumber()}return e}const me={parse:n=>zn.parse(n,oo),stringify:On.stringify};class h 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(me.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 l,u,m;if(!this.realtime.reconnect||((u=(l=this.realtime)===null||l===void 0?void 0:l.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(me.stringify({type:"subscribe",data:e}))},onMessage:e=>{var i,t;try{const o=me.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=me.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(me.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 h("Endpoint must be a valid string");if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new h("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 h("Endpoint must be a valid string");if(!e.startsWith("ws://")&&!e.startsWith("wss://"))throw new h("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 l=He.unique();if(!this.realtime.subscriptions.has(l)){r=l;break}}if(r==="")throw new h("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(l=>{l.channels.forEach(u=>c.add(u))}),this.realtime.channels.forEach(l=>{c.has(l)||this.realtime.channels.delete(l)}),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=me.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 ve(this,arguments,void 0,function*(t,o,a={},s={},r){var d;const[c,l]=(d=Object.entries(s).find(([J,z])=>z instanceof File))!==null&&d!==void 0?d:[];if(!l||!c)throw new Error("File not found in payload");if(l.size<=Ae.CHUNK_SIZE)return yield this.call(t,o,a,s);const u=Math.ceil(l.size/Ae.CHUNK_SIZE),m=Math.min(Ae.CHUNK_SIZE,l.size),j=Object.assign(Object.assign({},a),{"content-range":`bytes 0-${m-1}/${l.size}`}),q=l.slice(0,m),T=Object.assign({},s);T[c]=new File([q],l.name);const K=yield this.call(t,o,j,T),Y=K?.$id;if(r&&typeof r=="function"&&r({$id:Y,progress:Math.round(m/l.size*100),sizeUploaded:m,chunksTotal:u,chunksUploaded:1}),u===1)return K;const L=[];for(let J=1;J<u;J++){const z=J*Ae.CHUNK_SIZE,ne=Math.min(z+Ae.CHUNK_SIZE,l.size);L.push({start:z,end:ne})}const H=8;let Z=1,se=m,B=K,D=null,ie=!1;const W=J=>{var z;const ne=J?.chunksUploaded,ce=(z=J?.chunksTotal)!==null&&z!==void 0?z:u;return typeof ne=="number"&&typeof ce=="number"&&ne>=ce},R=J=>ve(this,void 0,void 0,function*(){const z=Object.assign({},a);Y&&(z["x-appwrite-id"]=Y),z["content-range"]=`bytes ${J.start}-${J.end-1}/${l.size}`;const ne=l.slice(J.start,J.end),ce=Object.assign({},s);ce[c]=new File([ne],l.name);const de=yield this.call(t,o,z,ce);return ie||(Z++,se+=J.end-J.start,B=de,W(de)&&(D=de),r&&typeof r=="function"&&r({$id:Y,progress:Math.round(se/l.size*100),sizeUploaded:se,chunksTotal:u,chunksUploaded:Z})),de});return yield new Promise((J,z)=>{let ne=0,ce=0,de=0;const Ue=()=>{if(!ie){if(de===L.length){J();return}for(;ce<H&&ne<L.length;){const Ie=L[ne++];ce++,R(Ie).then(()=>{ce--,de++,Ue()}).catch(_e=>{ie=!0,z(_e)})}}};Ue()}),D??B})}ping(){return ve(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 ve(this,arguments,void 0,function*(t,o,a={},s={},r="json"){var d,c,l;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 h(`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(Y=>console.warn("Warning: "+Y)),!((d=q.headers.get("content-type"))===null||d===void 0)&&d.includes("application/json")?j=me.parse(yield q.text()):r==="arrayBuffer"?j=yield q.arrayBuffer():j={message:yield q.text()},400<=q.status){let Y;throw!((c=q.headers.get("content-type"))===null||c===void 0)&&c.includes("application/json")||r==="arrayBuffer"?Y=me.stringify(j):Y=j?.message,new h((l=j?.message)!==null&&l!==void 0?l:Y,q.status,j?.type,Y)}const K=q.headers.get("X-Fallback-Cookies");return typeof window<"u"&&window.localStorage&&K&&(window.console.warn("Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint."),window.localStorage.setItem("cookieFallback",K)),j&&typeof j=="object"&&Object.defineProperty(j,"toString",{value:()=>me.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 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 Wt{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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('Missing required parameter: "email"');if(typeof s>"u")throw new h('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 l=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",l,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 h('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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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 h('Missing required parameter: "consentId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "consentId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "email"');if(typeof a>"u")throw new h('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 h('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 h('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 h('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 h('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 h('Missing required parameter: "type"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "type"');if(typeof a>"u")throw new h('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 h('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 h('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 h('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 h('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 h('Missing required parameter: "challengeId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "challengeId"');if(typeof a>"u")throw new h('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 h('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 h('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 h('Missing required parameter: "phone"');if(typeof a>"u")throw new h('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 h('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 h('Missing required parameter: "email"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('Missing required parameter: "secret"');if(typeof s>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",c,l,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 h('Missing required parameter: "email"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('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 l=new URL(this.client.config.endpoint+d);c.project=this.client.config.project;for(const[u,m]of Object.entries(ye.flatten(c)))l.searchParams.append(u,m);if(typeof window<"u"&&window?.location){window.location.href=l.toString();return}else return l.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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('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 h('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 h('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 h('Missing required parameter: "targetId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('Missing required parameter: "targetId"');if(typeof a>"u")throw new h('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 h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 l=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",l,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 h('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 l=new URL(this.client.config.endpoint+d);c.project=this.client.config.project;for(const[u,m]of Object.entries(ye.flatten(c)))l.searchParams.append(u,m);if(typeof window<"u"&&window?.location){window.location.href=l.toString();return}else return l.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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('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 h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "userId"');if(typeof a>"u")throw new h('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 Gi{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 h('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 l=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)))l.searchParams.append(u,m);return l.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 h('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 l=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)))l.searchParams.append(u,m);return l.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 h('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 h('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 l=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)))l.searchParams.append(u,m);return l.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 h('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[l,u]of Object.entries(ye.flatten(d)))c.searchParams.append(l,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 l=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)))l.searchParams.append(u,m);return l.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,l=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 l<"u"&&(j.emailHash=l),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,K]of Object.entries(ye.flatten(j)))q.searchParams.append(T,K);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 h('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 l=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)))l.searchParams.append(u,m);return l.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,l=t.userAgent,u=t.fullpage,m=t.locale,j=t.timezone,q=t.latitude,T=t.longitude,K=t.accuracy,Y=t.touch,L=t.permissions,H=t.sleep,Z=t.width,se=t.height,B=t.quality,D=t.output;if(typeof o>"u")throw new h('Missing required parameter: "url"');const ie="/avatars/screenshots",W={};typeof o<"u"&&(W.url=o),typeof a<"u"&&(W.headers=a),typeof s<"u"&&(W.viewportWidth=s),typeof r<"u"&&(W.viewportHeight=r),typeof d<"u"&&(W.scale=d),typeof c<"u"&&(W.theme=c),typeof l<"u"&&(W.userAgent=l),typeof u<"u"&&(W.fullpage=u),typeof m<"u"&&(W.locale=m),typeof j<"u"&&(W.timezone=j),typeof q<"u"&&(W.latitude=q),typeof T<"u"&&(W.longitude=T),typeof K<"u"&&(W.accuracy=K),typeof Y<"u"&&(W.touch=Y),typeof L<"u"&&(W.permissions=L),typeof H<"u"&&(W.sleep=H),typeof Z<"u"&&(W.width=Z),typeof se<"u"&&(W.height=se),typeof B<"u"&&(W.quality=B),typeof D<"u"&&(W.output=D);const R=new URL(this.client.config.endpoint+ie);W.project=this.client.config.project,W.impersonateuserid=this.client.config.impersonateuserid;for(const[J,z]of Object.entries(ye.flatten(W)))R.searchParams.append(J,z);return R.toString()}}class ao{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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('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 h('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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('Missing required parameter: "data"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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))),l={};typeof r<"u"&&(l.queries=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",l,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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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 so{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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('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 h('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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('Missing required parameter: "data"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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 l=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",l,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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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))),l={};typeof r<"u"&&(l.queries=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",l,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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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 ro{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 h('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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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,l=t.scheduledAt;if(typeof o>"u")throw new h('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 l<"u"&&(m.scheduledAt=l);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 h('Missing required parameter: "functionId"');if(typeof a>"u")throw new h('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 co{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 h('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 h('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 lo{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 uo{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 h('Missing required parameter: "topicId"');if(typeof a>"u")throw new h('Missing required parameter: "subscriberId"');if(typeof s>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('Missing required parameter: "topicId"');if(typeof a>"u")throw new h('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 po{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 h('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 h('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 h('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 h('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 ho{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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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 h('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 h('Missing required parameter: "presenceId"');if(typeof a>"u")throw new h('Missing required parameter: "status"');const c="/presences/{presenceId}".replace("{presenceId}",encodeURIComponent(String(o))),l={};typeof a<"u"&&(l.status=a),typeof s<"u"&&(l.permissions=s),typeof r<"u"&&(l.expiresAt=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "presenceId"');const l="/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+l),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 h('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 fo{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 h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",l,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 h('Missing required parameter: "bucketId"');if(typeof s>"u")throw new h('Missing required parameter: "fileId"');if(typeof r>"u")throw new h('Missing required parameter: "file"');const l="/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+l),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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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 l=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",l,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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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[l,u]of Object.entries(ye.flatten(d)))c.searchParams.append(l,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,l=t.borderWidth,u=t.borderColor,m=t.borderRadius,j=t.opacity,q=t.rotation,T=t.background,K=t.output,Y=t.token;if(typeof o>"u")throw new h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('Missing required parameter: "fileId"');const L="/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 l<"u"&&(H.borderWidth=l),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 K<"u"&&(H.output=K),typeof Y<"u"&&(H.token=Y);const Z=new URL(this.client.config.endpoint+L);H.project=this.client.config.project,H.impersonateuserid=this.client.config.impersonateuserid;for(const[se,B]of Object.entries(ye.flatten(H)))Z.searchParams.append(se,B);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 h('Missing required parameter: "bucketId"');if(typeof a>"u")throw new h('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[l,u]of Object.entries(ye.flatten(d)))c.searchParams.append(l,u);return c.toString()}}class go{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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('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 h('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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');if(typeof r>"u")throw new h('Missing required parameter: "data"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('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))),l={};typeof r<"u"&&(l.queries=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",l,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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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,l=t.transactionId;if(typeof o>"u")throw new h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "tableId"');if(typeof s>"u")throw new h('Missing required parameter: "rowId"');if(typeof r>"u")throw new h('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 l<"u"&&(m.transactionId=l);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 Ki{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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("post",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("put",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,accept:"application/json"};return this.client.call("get",l,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,l=t.name;if(typeof o>"u")throw new h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 l<"u"&&(m.name=l);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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('Missing required parameter: "membershipId"');if(typeof s>"u")throw new h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('Missing required parameter: "membershipId"');if(typeof s>"u")throw new h('Missing required parameter: "userId"');if(typeof r>"u")throw new h('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 l=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",l,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 h('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 h('Missing required parameter: "teamId"');if(typeof a>"u")throw new h('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 yo{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 h('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 h('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),l={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json",accept:"application/json"};return this.client.call("patch",c,l,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 h('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 h('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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');if(typeof r>"u")throw new h('Missing required parameter: "data"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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))),l={};typeof r<"u"&&(l.queries=r),typeof d<"u"&&(l.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,l)}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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('Missing required parameter: "documentId"');const l="/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+l),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 h('Missing required parameter: "databaseId"');if(typeof a>"u")throw new h('Missing required parameter: "collectionId"');if(typeof s>"u")throw new h('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 l=new URL(this.client.config.endpoint+d),u={"X-Appwrite-Project":this.client.config.project,"content-type":"application/json"};return this.client.call("delete",l,u,c)}}var St;(function(n){n[n.NORMAL_CLOSURE=1e3]="NORMAL_CLOSURE",n[n.POLICY_VIOLATION=1008]="POLICY_VIOLATION",n[n.UNKNOWN_ERROR=-1]="UNKNOWN_ERROR"})(St||(St={}));class mo{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(me.stringify({type:"ping"}))},this.HEARTBEAT_INTERVAL)}stopHeartbeat(){this.heartbeatTimer&&(window?.clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0)}createSocket(){return ve(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 ve(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 h("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,l=this.socket=new WebSocket(s);l.addEventListener("open",()=>{c===this.connectionId&&(this.reconnectAttempts=0,this.onOpenCallbacks.forEach(u=>u()),this.startHeartbeat(),r())}),l.addEventListener("message",u=>{if(c===this.connectionId)try{const m=me.parse(u.data);this.handleMessage(m)}catch(m){console.error("Failed to parse message:",m)}}),l.addEventListener("close",u=>ve(this,void 0,void 0,function*(){if(c!==this.connectionId||l!==this.socket)return;if(this.appConnected=!1,this.stopHeartbeat(),this.onCloseCallbacks.forEach(j=>j()),!this.reconnect||u.code===St.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)}})),l.addEventListener("error",u=>{if(c!==this.connectionId||l!==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 ve(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(St.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(me.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 h("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 ve(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(me.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 ve(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 l=this.generateUniqueSubscriptionId();this.activeSubscriptions.set(l,{channels:d,queries:c,callback:o}),this.enqueuePendingSubscribe(l),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=()=>ve(this,void 0,void 0,function*(){this.activeSubscriptions.has(l)&&(this.activeSubscriptions.delete(l),this.pendingSubscribes.delete(l),this.sendUnsubscribeMessage([l]))});return{unsubscribe:u,update:q=>ve(this,void 0,void 0,function*(){const T=this.activeSubscriptions.get(l);if(T){if(q.channels!==void 0){const K=q.channels.map(Y=>this.channelToString(Y));T.channels=new Set(K)}if(q.queries!==void 0){const K=[];for(const Y of q.queries)if(Array.isArray(Y))for(const L of Y)K.push(typeof L=="string"?L:L.toString());else K.push(typeof Y=="string"?Y:Y.toString());T.queries=K}this.enqueuePendingSubscribe(l),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:()=>ve(this,void 0,void 0,function*(){yield u(),this.activeSubscriptions.size===0&&(this.reconnect=!1,yield this.closeSocket())})}})}upsertPresence(e){return ve(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(me.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=me.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(me.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 h(((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 et{}et.read=n=>`read("${n}")`,et.write=n=>`write("${n}")`,et.create=n=>`create("${n}")`,et.update=n=>`update("${n}")`,et.delete=n=>`delete("${n}")`;class wo{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 Me(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,Me(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",Me(e)])}static execution(e){return new ke(["executions",Me(e)])}static tablesdb(e){return new ke(["tablesdb",Me(e)])}static bucket(e){return new ke(["buckets",Me(e)])}static function(e){return new ke(["functions",Me(e)])}static team(e){return new ke(["teams",Me(e)])}static membership(e){return new ke(["memberships",Me(e)])}static presence(e){return new ke(["presences",Me(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 Gt;(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"})(Gt||(Gt={}));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 Kt;(function(n){n.Totp="totp"})(Kt||(Kt={}));var Yt;(function(n){n.Email="email",n.Phone="phone",n.Totp="totp",n.Recoverycode="recoverycode",n.Custom="custom"})(Yt||(Yt={}));var Jt;(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"})(Jt||(Jt={}));var Zt;(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"})(Zt||(Zt={}));var Qt;(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"})(Qt||(Qt={}));var Tt;(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"})(Tt||(Tt={}));var zt;(function(n){n.Light="light",n.Dark="dark"})(zt||(zt={}));var Ot;(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"})(Ot||(Ot={}));var Ft;(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"})(Ft||(Ft={}));var ei;(function(n){n.Jpg="jpg",n.Jpeg="jpeg",n.Png="png",n.Webp="webp",n.Heic="heic",n.Avif="avif",n.Gif="gif"})(ei||(ei={}));var ti;(function(n){n.GET="GET",n.POST="POST",n.PUT="PUT",n.PATCH="PATCH",n.DELETE="DELETE",n.OPTIONS="OPTIONS",n.HEAD="HEAD"})(ti||(ti={}));var ii;(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"})(ii||(ii={}));var ni;(function(n){n.Functions="functions",n.Sites="sites"})(ni||(ni={}));var oi;(function(n){n.Http="http",n.Schedule="schedule",n.Event="event"})(oi||(oi={}));var ai;(function(n){n.Waiting="waiting",n.Processing="processing",n.Completed="completed",n.Failed="failed",n.Scheduled="scheduled"})(ai||(ai={}));const bo=Object.freeze(Object.defineProperty({__proto__:null,Account:Wt,AppwriteException:h,get AuthenticationFactor(){return Yt},get AuthenticatorType(){return Kt},Avatars:Gi,get Browser(){return Zt},get BrowserPermission(){return Ft},get BrowserTheme(){return zt},Channel:ke,Client:Ae,get Condition(){return Gt},get CreditCard(){return Qt},Databases:ao,DocumentsDB:so,get ExecutionMethod(){return ti},get ExecutionResourceType(){return ni},get ExecutionStatus(){return ai},get ExecutionTrigger(){return oi},get Flag(){return Tt},Functions:ro,Graphql:co,ID:He,get ImageFormat(){return ei},get ImageGravity(){return ii},Locale:lo,Messaging:uo,get OAuthProvider(){return Jt},Operator:Q,Organization:po,Permission:et,Presences:ho,Query:C,Realtime:mo,Role:wo,Storage:fo,TablesDB:go,Teams:Ki,get Timezone(){return Ot},VectorsDB:yo},Symbol.toStringTag,{value:"Module"})),Yi={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.",passwordChanged:"Your password was updated.",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:"Two-factor authentication is on, but no factors are set up yet. Add an authenticator, or verify your email or phone. 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.",noConnectionsDescription:"Link an OAuth provider to sign in faster next time.",disconnect:"Disconnect",connectProvider:"Connect {provider}",noActivity:"No recent activity.",noActivityDescription:"Security events for this account will appear here.",noSessions:"No active sessions.",noSessionsDescription:"Active sessions will show up here once you sign in on a device.",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>.",errorConfigIncomplete:"Auth UI is missing endpoint or project. Set them on <authui-config> or pass them to AuthUI.init().",errorConfig:"Auth UI cannot reach this Appwrite project. Check that endpoint ends with /v1, the project ID is correct, and this hostname is registered as a Web platform.",errorConfigEndpoint:"Check that endpoint ends with /v1. Appwrite API URLs look like https://cloud.appwrite.io/v1.",passwordHint:"At least 8 characters.",passwordStrengthLabel:"Password strength",passwordStrengthTooWeak:"Too weak",passwordStrengthWeak:"Weak",passwordStrengthFair:"Fair",passwordStrengthStrong:"Strong",passwordStrengthVeryStrong:"Very strong",lastUsed:"Last used",teamsLabel:"Teams",noTeams:"You are not on any teams yet.",activeTeam:"Active",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",acceptLegal:"I agree to the",errorLegalRequired:"Accept the terms to continue."};function vo(n,e={}){return n.replace(/\{(\w+)\}/g,(i,t)=>t in e?String(e[t]):`{${t}}`)}const Io={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 tt(n){return Io[n]??n.charAt(0).toUpperCase()+n.slice(1)}const $t=(n,e,i=401)=>Object.assign(new Error(e),{type:n,code:i}),Pe=()=>new Date().toISOString(),Re=n=>new Date(Date.now()-n*6e4).toISOString(),jt=["amber","brave","calm","delta","ember","fable","glide","harbor","ivory","juniper","kite","lumen"],Ji=()=>`${jt[Math.floor(Math.random()*jt.length)]}-${jt[Math.floor(Math.random()*jt.length)]}`,it=()=>Math.random().toString(36).slice(2,12),Zi=()=>Array.from({length:2},()=>Math.random().toString(36).slice(2,7)).join("-"),Ao={name:"Ada Lovelace",email:"ada@example.com",phone:"+15550100"};class Qi{constructor(e=Ao){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:Re(43200),$updatedAt:Pe(),name:i?"":e.name??this.seed.name,registration:Re(43200),status:!0,labels:[],passwordUpdate:i?"":Re(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:it(),$createdAt:Re(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:it(),$createdAt:Re(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:Re(28800),$updatedAt:Re(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:Re(2880),clientName:"Safari",osName:"iOS",countryName:"Germany",ip:"198.51.100.7"},{event:"session.create",time:Re(4320),clientName:"Firefox",osName:"Windows",countryName:"United States",ip:"192.0.2.90"}]}requireUser(){if(!this.user)throw $t("general_unauthorized_scope","User (role: guests) missing scope (account)");if(this.mfaPending)throw $t("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 $t("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:it(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:Ji()})}async createEmailToken(e,i){return this.tokens.set(e,{email:i}),this.delay({$id:it(),$createdAt:Pe(),userId:e,secret:"",expire:"",phrase:Ji()})}async createPhoneToken(e,i){return this.tokens.set(e,{phone:i}),this.delay({$id:it(),$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:it(),$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 $t("user_recovery_codes_already_exists","Recovery codes already generated.",409);return this.recoveryCodes=Array.from({length:6},Zi),{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},Zi),{recoveryCodes:this.recoveryCodes}))}reset(){this.user=null,this.mfaPending=!1,this.sessions=[],this.identities=[],this.logs=[],this.tokens.clear()}}function ko(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 ee={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",projectNotFound:"project_not_found",unknownOrigin:"general_unknown_origin",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 Je(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 ut(n,e){return Je(n).type===e}function pt(n,e,i="link"){const t=Je(n);switch(t.type){case ee.invalidCredentials:return i==="password"?e.errorCurrentPassword:e.errorInvalidCredentials;case ee.userAlreadyExists:case ee.emailAlreadyExists:case ee.phoneAlreadyExists:return e.errorUserExists;case ee.userBlocked:return e.errorUserBlocked;case ee.rateLimit:return e.errorRateLimit;case ee.invalidToken:return i==="code"?e.errorInvalidCode:e.errorInvalidToken;case ee.invalidCode:return e.errorInvalidCode;case ee.passwordMismatch:return e.errorPasswordMismatch;case ee.passwordRecentlyUsed:return e.errorPasswordRecentlyUsed;case ee.passwordPersonalData:return e.errorPasswordPersonalData;case ee.passwordWeak:return e.errorPasswordWeak;case ee.passwordPwned:return e.errorPasswordPwned;case ee.challengeRequired:return e.errorChallengeRequired;case ee.sessionAlreadyExists:return e.errorSessionExists;case ee.oauthUnauthorized:case ee.oauthBadRequest:return e.errorOAuth;case ee.authMethodUnsupported:return e.errorMethodDisabled}if(t.type===ee.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.type===ee.projectNotFound||t.type===ee.unknownOrigin?e.errorConfig:t.type===ee.routeNotFound?e.errorConfigEndpoint:t.code===0&&/fetch|network/i.test(t.message)?e.errorNetwork:/Invalid `\w+` param/i.test(t.message)?e.errorGeneric:t.message?t.message||e.errorGeneric:t.code===404||t.type===ee.routeNotFound?e.errorConfigEndpoint:e.errorGeneric}function Ti(n){const e=Je(n);return!!(e.type===ee.projectNotFound||e.type===ee.unknownOrigin||e.type===ee.routeNotFound||!e.message&&e.code===404||e.code===0&&/fetch|network|load failed|failed to fetch/i.test(e.message))}const si=n=>`authui:active-team:${n}`;function ri(n){if(typeof localStorage>"u"||!n)return null;try{return localStorage.getItem(si(n))}catch{return null}}function zi(n,e){if(!(typeof localStorage>"u"||!n))try{e?localStorage.setItem(si(n),e):localStorage.removeItem(si(n))}catch{}}const ci="authui:last-method";function Ze(n){if(!(typeof localStorage>"u")){if(!n||n==="mfa"||n==="sign-up")if(n==="sign-up")n="email-password";else return;try{localStorage.setItem(ci,n)}catch{}}}function Qe(){if(typeof localStorage>"u")return null;try{return localStorage.getItem(ci)}catch{return null}}function So(){if(!(typeof localStorage>"u"))try{localStorage.removeItem(ci)}catch{}}const Pt="authui:pending-oauth";function Oi(n){if(!(typeof sessionStorage>"u"))try{sessionStorage.setItem(Pt,n)}catch{}}function di(){if(!(typeof sessionStorage>"u"))try{const n=sessionStorage.getItem(Pt);sessionStorage.removeItem(Pt),n&&Ze(`oauth:${n}`)}catch{}}function li(){if(!(typeof sessionStorage>"u"))try{sessionStorage.removeItem(Pt)}catch{}}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 ui="authui",Fi=["userId","secret","expire","project","error",ui],en=()=>({status:"loading",user:null,mfaFactors:null,pending:null,configured:!1,configError:null});class tn{constructor(){this.client=null,this.account=null,this.config=null,this.state=en(),this.listeners=new Map,this.refreshPromise=null,this.preview=null,this.teams=null,this.activeTeamId=null}configure(e){const i=e.endpoint.trim().replace(/\/+$/,"");i&&!i.endsWith("/v1")&&console.warn(`[authui] endpoint should end with /v1 (got "${e.endpoint}"). Without it Appwrite returns HTML 404 pages.`),this.config=e,this.client=new Ae().setEndpoint(e.endpoint).setProject(e.project),this.preview=e.preview?new Qi:null,this.account=this.preview?this.preview:new Wt(this.client),this.teams=null,this.activeTeamId=ri(e.project),this.setState({configured:!0,status:"loading",configError:null}),this.preview?this.refresh():typeof window<"u"&&this.handleRedirect().then(()=>this.refresh())}notifyConfigIncomplete(){if(this.config)return;const e=this.getStrings().errorConfigIncomplete;console.warn(`[authui] ${e}`),this.setState({status:"signed-out",user:null,mfaFactors:null,configured:!1,configError:e,pending:{type:"notice",tone:"error",message:e}})}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}async listTeams(){if(this.preview||!this.client||this.state.status!=="signed-in")return[];this.teams??=new Ki(this.client);try{return(await this.teams.list()).teams??[]}catch(e){this.fail(e)}}getActiveTeamId(){if(this.activeTeamId)return this.activeTeamId;const e=this.config?.project;return e?(this.activeTeamId=ri(e),this.activeTeamId):null}setActiveTeam(e){const i=this.config?.project;i&&zi(i,e?.$id??null),this.activeTeamId=e?.$id??null,this.emit("active-team",{teamId:this.activeTeamId,team:e})}getStrings(){return{...Yi,...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=Je(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,configError:null}),e||this.emit("signed-in",i)}catch(i){if(ut(i,ee.moreFactorsRequired)){let t=null;try{t=await Se(this.account,["listMFAFactors","listMfaFactors"],[])}catch{}this.setState({status:"mfa-required",user:null,mfaFactors:t})}else if(ut(i,ee.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);else if(!e&&Ti(i)){const o=pt(i,this.getStrings())||this.getStrings().errorConfig;console.warn(`[authui] ${o} (endpoint=${this.config?.endpoint??"?"}, project=${this.config?.project??"?"})`);const a=Je(i);this.emit("error",{message:o,type:a.type,code:a.code}),this.setState({status:"signed-out",user:null,mfaFactors:null,configError:o,pending:{type:"notice",tone:"error",message:o}})}else this.setState({status:"signed-out",user:null,mfaFactors:null,configError: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:ee.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 Wt(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 Fi)t.searchParams.delete(o);return t.searchParams.set(ui,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(ui);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),i==="oauth"?di():Ze("magic-url")):(i==="oauth"&&li(),a());break;case"oauth-failed":li(),this.setState({pending:{type:"notice",tone:"error",message:this.getStrings().errorOAuth}});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=Je(s),d=pt(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 Fi)e.searchParams.delete(i);window.history.replaceState(window.history.state,"",e.toString())}reset(){this.client=null,this.account=null,this.teams=null,this.activeTeamId=null,this.preview=null,this.config=null,this.state=en(),this.listeners.clear()}}const E=new tn;class $o{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 nn=new $o,on={none:"0px",sm:"0.25rem",md:"0.625rem",lg:"0.875rem",xl:"1.125rem",full:"1.5rem"},jo=Ne`
|
|
11
11
|
:host {
|
|
12
12
|
/* Light theme (matches :root in the console) */
|
|
13
13
|
--authui-background: oklch(1 0 0);
|
|
@@ -1087,11 +1087,11 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1087
1087
|
animation-duration: 0.01ms !important;
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
|
-
`;var Co=Object.defineProperty,Uo=(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&&Co(e,i,o),o};const an=(qe=class extends Ke{constructor(){super(...arguments),this.auth=E.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=E.getState(),this.unsubscribeStore=E.on("change",e=>{this.auth=e,this.applyBranding()}),this.unsubscribeTheme=nn.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 E.getStrings()}t(e,i){return vo(this.strings[e],i)}get config(){return E.getConfig()}get productName(){return this.config?.branding?.name??""}applyBranding(){const e=this.config?.branding,i=nn.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&&on[e.radius]&&this.style.setProperty("--authui-radius",on[e.radius])}fire(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!0}))}},qe.styles=[jo,Po],qe.KEY_EVENTS=["keydown","keyup","keypress"],qe);Uo([
|
|
1090
|
+
`;var Co=Object.defineProperty,Uo=(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&&Co(e,i,o),o};const an=(qe=class extends Ke{constructor(){super(...arguments),this.auth=E.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=E.getState(),this.unsubscribeStore=E.on("change",e=>{this.auth=e,this.applyBranding()}),this.unsubscribeTheme=nn.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 E.getStrings()}t(e,i){return vo(this.strings[e],i)}get config(){return E.getConfig()}get productName(){return this.config?.branding?.name??""}applyBranding(){const e=this.config?.branding,i=nn.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&&on[e.radius]&&this.style.setProperty("--authui-radius",on[e.radius])}fire(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i,bubbles:!0,composed:!0}))}},qe.styles=[jo,Po],qe.KEY_EVENTS=["keydown","keyup","keypress"],qe);Uo([N()],an.prototype,"auth");let Ce=an;var xo=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,pe=(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&&xo(e,i,o),o};I.AuthUIConfigElement=class extends Ke{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.requireAcceptance="",this.oauthLayout="",this.preview=""}connectedCallback(){super.connectedCallback(),this.configure()}updated(){this.configure()}configure(){if(!this.endpoint||!this.project){queueMicrotask(()=>{(!this.endpoint||!this.project)&&E.notifyConfigIncomplete()});return}const e=this.toConfig(),i=E.getConfig();i&&JSON.stringify(i)===JSON.stringify(e)||E.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,this.oauthLayout&&(e.oauthLayout=this.oauthLayout),{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,requireAcceptance:this.requireAcceptance!==""&&this.requireAcceptance!=="false"?!0:void 0},preview:this.preview===""||this.preview==="false"?void 0:!0}}},I.AuthUIConfigElement.styles=Ne`
|
|
1091
1091
|
:host {
|
|
1092
1092
|
display: none;
|
|
1093
1093
|
}
|
|
1094
|
-
`,pe([
|
|
1094
|
+
`,pe([F({type:String})],I.AuthUIConfigElement.prototype,"endpoint",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"project",2),pe([F({type:String,attribute:"redirect-url"})],I.AuthUIConfigElement.prototype,"redirectUrl",2),pe([F({type:String,attribute:"success-url"})],I.AuthUIConfigElement.prototype,"successUrl",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"methods",2),pe([F({type:String,attribute:"sign-up"})],I.AuthUIConfigElement.prototype,"signUp",2),pe([F({type:String,attribute:"require-name"})],I.AuthUIConfigElement.prototype,"requireName",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"mfa",2),pe([F({type:String,attribute:"security-phrase"})],I.AuthUIConfigElement.prototype,"securityPhrase",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"name",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"logo",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"theme",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"radius",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"primary",2),pe([F({type:String,attribute:"primary-foreground"})],I.AuthUIConfigElement.prototype,"primaryForeground",2),pe([F({type:String,attribute:"terms-url"})],I.AuthUIConfigElement.prototype,"termsUrl",2),pe([F({type:String,attribute:"privacy-url"})],I.AuthUIConfigElement.prototype,"privacyUrl",2),pe([F({type:String,attribute:"require-acceptance"})],I.AuthUIConfigElement.prototype,"requireAcceptance",2),pe([F({type:String,attribute:"oauth-layout"})],I.AuthUIConfigElement.prototype,"oauthLayout",2),pe([F({type:String})],I.AuthUIConfigElement.prototype,"preview",2),I.AuthUIConfigElement=pe([Ye("authui-config")],I.AuthUIConfigElement);var Ro=Object.defineProperty,Eo=Object.getOwnPropertyDescriptor,Ct=(n,e,i,t)=>{for(var o=t>1?void 0:t?Eo(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&&Ro(e,i,o),o};const pi="authui-show:not([ready]){display:none}",qo="authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";let sn=!1;function _o(){if(!(typeof document>"u"||sn)){sn=!0;try{if(typeof CSSStyleSheet<"u"&&"adoptedStyleSheets"in Document.prototype){const n=new CSSStyleSheet;n.replaceSync(pi),document.adoptedStyleSheets=[...document.adoptedStyleSheets,n];return}}catch{}if(!document.getElementById("authui-fouc")){const n=document.createElement("style");n.id="authui-fouc",n.textContent=pi,document.head.appendChild(n)}}}_o();const Lo=["loading","signed-out","signed-in","mfa-required"];function hi(n){return n?n.split(/[\s,]+/).map(e=>e.trim()).filter(e=>Lo.includes(e)):[]}function No(n,e,i){const t=hi(e),o=hi(i);return!(n==="loading"&&!t.includes("loading")||t.length>0&&!t.includes(n)||o.includes(n))}I.AuthUIShow=class extends Ke{constructor(){super(...arguments),this.when="",this.unless="",this.status=E.getState().status,this.unsubscribe=null}connectedCallback(){super.connectedCallback(),this.status=E.getState().status,this.unsubscribe=E.on("change",e=>this.status=e.status)}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe?.(),this.unsubscribe=null}get visible(){return No(this.status,this.when,this.unless)}updated(){(this.status!=="loading"||hi(this.when).includes("loading"))&&(this.setAttribute("ready",""),this.style.display="contents")}render(){return this.visible?w`<slot></slot>`:x}},Ct([F({type:String})],I.AuthUIShow.prototype,"when",2),Ct([F({type:String})],I.AuthUIShow.prototype,"unless",2),Ct([N()],I.AuthUIShow.prototype,"status",2),I.AuthUIShow=Ct([Ye("authui-show")],I.AuthUIShow);const Do=Ne`
|
|
1095
1095
|
:host {
|
|
1096
1096
|
display: block;
|
|
1097
1097
|
width: 100%;
|
|
@@ -1145,7 +1145,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1145
1145
|
height: 14px;
|
|
1146
1146
|
margin: 0;
|
|
1147
1147
|
}
|
|
1148
|
-
`,ae=n=>
|
|
1148
|
+
`,ae=n=>w`<svg
|
|
1149
1149
|
xmlns="http://www.w3.org/2000/svg"
|
|
1150
1150
|
viewBox="0 0 24 24"
|
|
1151
1151
|
fill="none"
|
|
@@ -1156,10 +1156,10 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1156
1156
|
aria-hidden="true"
|
|
1157
1157
|
>
|
|
1158
1158
|
${n}
|
|
1159
|
-
</svg>`,_={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"/>`),users:ae(G`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>`),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"/>`)},ge=(n,e="0 0 24 24")=>b`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${e} aria-hidden="true">${n}</svg>`,Do={google:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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 ht(n){return Do[n]??_.globe}function fi(n){const e=(n.trim()[0]??"?").toUpperCase();return/[A-Z0-9]/i.test(e)?e:_.user}function nt(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 rn(){typeof window>"u"||window.dispatchEvent(new CustomEvent("authui:close"))}function Ut(n){const e={length:n.length>=8,long:n.length>=12,lower:/[a-z]/.test(n),upper:/[A-Z]/.test(n),number:/\d/.test(n),symbol:/[^A-Za-z0-9]/.test(n)};if(!n)return{level:0,percent:0,labelKey:"passwordStrengthTooWeak",checks:e};let i=0;e.length&&(i+=1),e.long&&(i+=1),e.lower&&e.upper&&(i+=1),e.number&&(i+=1),e.symbol&&(i+=1),n.length<8?i=Math.min(i,1):n.length<10&&(i=Math.min(i,3));let t,o;return!e.length||i<=1?(t=1,o="passwordStrengthTooWeak"):i===2?(t=2,o="passwordStrengthWeak"):i===3?(t=3,o="passwordStrengthFair"):i>=5&&e.long&&e.lower&&e.upper&&e.number&&e.symbol?(t=4,o="passwordStrengthVeryStrong"):(t=4,o="passwordStrengthStrong"),{level:t,percent:t*25,labelKey:o,checks:e}}var Bo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,he=(n,e,i,t)=>{for(var o=t>1?void 0:t?Xo(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&&Bo(e,i,o),o};A.AuthUISignIn=class extends Ce{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.showPasswordConfirm=!1,this.expandedOAuth=null,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.legalAccepted=!1,this.legalErrorFromOAuth=!1,this.onSignIn=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{await E.signInWithEmailPassword(this.email,this.password),this.password="",Ze("email-password"),this.fire("authui-success",{method:"email-password"})})},this.onSignUp=e=>{e.preventDefault(),this.requireValid(e)&&(this.legalErrorFromOAuth=!1,this.ensureLegalAccepted()&&this.run(async()=>{await E.signUp(this.email,this.password,this.name),this.password="",Ze("email-password"),this.fire("authui-success",{method:"sign-up"})}))},this.onGuest=()=>{this.run(async()=>{await E.signInAnonymously(),Ze("anonymous"),this.fire("authui-success",{method:"anonymous"})})},this.onOAuth=e=>{if(this.step==="sign-up"&&!this.ensureLegalAccepted()){this.legalErrorFromOAuth=!0;return}this.legalErrorFromOAuth=!1,this.run(async()=>{if(Oi(e),await E.signInWithOAuth(e),E.isPreview){di(),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 E.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 E.completePasswordRecovery(i.userId,i.secret,this.password),this.password="",this.passwordConfirm="",this.recovery=null,this.auth.pending?.type==="reset-password"&&E.setPending(null),this.go("sign-in"),this.notice={tone:"success",message:this.t("passwordUpdated")}})},this.onMagicUrl=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{const i=await E.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 E.sendEmailOtp(this.email);this.token={userId:i.userId,kind:"email-otp",target:this.email,phrase:i.phrase},this.code="",this.resendCooldownUntil=Date.now()+3e4,window.setTimeout(()=>this.requestUpdate(),3e4)})},this.onPhoneOtp=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{const i=await E.sendPhoneOtp(this.phone);this.token={userId:i.userId,kind:"phone",target:this.phone},this.code="",this.resendCooldownUntil=Date.now()+3e4,window.setTimeout(()=>this.requestUpdate(),3e4)})},this.onVerifyCode=e=>{if(e.preventDefault(),!this.requireValid(e))return;const i=this.token;i&&this.run(async()=>{await E.signInWithToken(i.userId,this.code),this.code="",this.token=null,Ze(i.kind),this.fire("authui-success",{method:i.kind})},"code")},this.onChooseFactor=e=>{this.run(async()=>{const i=await E.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 E.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 E.signOut()}catch(e){if(!ut(e,ee.sessionNotFound))throw e}this.go("sign-in")})},this.onSignOut=()=>{this.run(()=>E.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")}),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"&&E.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.busy=!1,this.showPassword=!1,this.showPasswordConfirm=!1,this.password="",this.passwordConfirm="",this.legalAccepted=!1,this.legalErrorFromOAuth=!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=pt(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 b`
|
|
1159
|
+
</svg>`,_={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"/>`),users:ae(G`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>`),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"/>`)},ge=(n,e="0 0 24 24")=>w`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${e} aria-hidden="true">${n}</svg>`,Ho={google:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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:ge(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 ht(n){return Ho[n]??_.globe}function fi(n){const e=(n.trim()[0]??"?").toUpperCase();return/[A-Z0-9]/i.test(e)?e:_.user}function nt(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 rn(){typeof window>"u"||window.dispatchEvent(new CustomEvent("authui:close"))}function Ut(n){const e={length:n.length>=8,long:n.length>=12,lower:/[a-z]/.test(n),upper:/[A-Z]/.test(n),number:/\d/.test(n),symbol:/[^A-Za-z0-9]/.test(n)};if(!n)return{level:0,percent:0,labelKey:"passwordStrengthTooWeak",checks:e};let i=0;e.length&&(i+=1),e.long&&(i+=1),e.lower&&e.upper&&(i+=1),e.number&&(i+=1),e.symbol&&(i+=1),n.length<8?i=Math.min(i,1):n.length<10&&(i=Math.min(i,3));let t,o;return!e.length||i<=1?(t=1,o="passwordStrengthTooWeak"):i===2?(t=2,o="passwordStrengthWeak"):i===3?(t=3,o="passwordStrengthFair"):i>=5&&e.long&&e.lower&&e.upper&&e.number&&e.symbol?(t=4,o="passwordStrengthVeryStrong"):(t=4,o="passwordStrengthStrong"),{level:t,percent:t*25,labelKey:o,checks:e}}var Bo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,he=(n,e,i,t)=>{for(var o=t>1?void 0:t?Xo(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&&Bo(e,i,o),o};I.AuthUISignIn=class extends Ce{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.showPasswordConfirm=!1,this.expandedOAuth=null,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.legalAccepted=!1,this.legalErrorFromOAuth=!1,this.onSignIn=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{await E.signInWithEmailPassword(this.email,this.password),this.password="",Ze("email-password"),this.fire("authui-success",{method:"email-password"})})},this.onSignUp=e=>{e.preventDefault(),this.requireValid(e)&&(this.legalErrorFromOAuth=!1,this.ensureLegalAccepted()&&this.run(async()=>{await E.signUp(this.email,this.password,this.name),this.password="",Ze("email-password"),this.fire("authui-success",{method:"sign-up"})}))},this.onGuest=()=>{this.run(async()=>{await E.signInAnonymously(),Ze("anonymous"),this.fire("authui-success",{method:"anonymous"})})},this.onOAuth=e=>{if(this.step==="sign-up"&&!this.ensureLegalAccepted()){this.legalErrorFromOAuth=!0;return}this.legalErrorFromOAuth=!1,this.run(async()=>{if(Oi(e),await E.signInWithOAuth(e),E.isPreview){di(),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 E.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 E.completePasswordRecovery(i.userId,i.secret,this.password),this.password="",this.passwordConfirm="",this.recovery=null,this.auth.pending?.type==="reset-password"&&E.setPending(null),this.go("sign-in"),this.notice={tone:"success",message:this.t("passwordUpdated")}})},this.onMagicUrl=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{const i=await E.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 E.sendEmailOtp(this.email);this.token={userId:i.userId,kind:"email-otp",target:this.email,phrase:i.phrase},this.code="",this.resendCooldownUntil=Date.now()+3e4,window.setTimeout(()=>this.requestUpdate(),3e4)})},this.onPhoneOtp=e=>{e.preventDefault(),this.requireValid(e)&&this.run(async()=>{const i=await E.sendPhoneOtp(this.phone);this.token={userId:i.userId,kind:"phone",target:this.phone},this.code="",this.resendCooldownUntil=Date.now()+3e4,window.setTimeout(()=>this.requestUpdate(),3e4)})},this.onVerifyCode=e=>{if(e.preventDefault(),!this.requireValid(e))return;const i=this.token;i&&this.run(async()=>{await E.signInWithToken(i.userId,this.code),this.code="",this.token=null,Ze(i.kind),this.fire("authui-success",{method:i.kind})},"code")},this.onChooseFactor=e=>{this.run(async()=>{const i=await E.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 E.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 E.signOut()}catch(e){if(!ut(e,ee.sessionNotFound))throw e}this.go("sign-in")})},this.onSignOut=()=>{this.run(()=>E.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")}),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"&&E.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.busy=!1,this.showPassword=!1,this.showPasswordConfirm=!1,this.password="",this.passwordConfirm="",this.legalAccepted=!1,this.legalErrorFromOAuth=!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=pt(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 w`
|
|
1160
1160
|
<div class="panel ${this.embedded?"embedded":""}" part="panel">
|
|
1161
1161
|
${this.renderHeader()}
|
|
1162
|
-
${this.notice?
|
|
1162
|
+
${this.notice?w`<div class="alert alert-${this.notice.tone}" role="status">
|
|
1163
1163
|
${this.notice.tone==="success"?_.checkCircle:this.notice.tone==="error"?_.alert:_.info}
|
|
1164
1164
|
<div class="alert-body">${this.notice.message}</div>
|
|
1165
1165
|
<button
|
|
@@ -1172,28 +1172,28 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1172
1172
|
</div>`:x}
|
|
1173
1173
|
${e}
|
|
1174
1174
|
</div>
|
|
1175
|
-
`}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
|
|
1175
|
+
`}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 w`
|
|
1176
1176
|
<div class="header">
|
|
1177
|
-
${e?
|
|
1177
|
+
${e?w`<img
|
|
1178
1178
|
class="logo"
|
|
1179
1179
|
src=${e}
|
|
1180
1180
|
alt=""
|
|
1181
1181
|
@error=${a=>{a.target.hidden=!0}}
|
|
1182
1182
|
/>`:x}
|
|
1183
|
-
${E.isPreview?
|
|
1183
|
+
${E.isPreview?w`<span class="badge badge-info preview">${this.t("preview")}</span>`:x}
|
|
1184
1184
|
<h2 class="title" id="authui-title">${t}</h2>
|
|
1185
|
-
${o?
|
|
1185
|
+
${o?w`<p class="description">${o}</p>`:x}
|
|
1186
1186
|
</div>
|
|
1187
|
-
`}renderError(){return this.error?
|
|
1187
|
+
`}renderError(){return this.error?w`<div class="alert alert-error" role="alert">
|
|
1188
1188
|
${_.alert}
|
|
1189
1189
|
<div class="alert-body">${this.error}</div>
|
|
1190
|
-
</div>`:x}submitButton(e,i="btn-primary"){return
|
|
1191
|
-
${this.busy?
|
|
1192
|
-
</button>`}passwordField(e){const i=this[e.field],t=e.field==="passwordConfirm"?this.showPasswordConfirm:this.showPassword,o=e.meter?Ut(i):null;return
|
|
1190
|
+
</div>`:x}submitButton(e,i="btn-primary"){return w`<button class="btn ${i} btn-block" type="submit" ?disabled=${this.busy}>
|
|
1191
|
+
${this.busy?w`<span class="spinner" aria-hidden="true"></span>`:x} ${e}
|
|
1192
|
+
</button>`}passwordField(e){const i=this[e.field],t=e.field==="passwordConfirm"?this.showPasswordConfirm:this.showPassword,o=e.meter?Ut(i):null;return w`
|
|
1193
1193
|
<div class="field">
|
|
1194
1194
|
<div class="field-header">
|
|
1195
1195
|
<label class="label" for=${e.id}>${e.label}</label>
|
|
1196
|
-
${e.forgot?
|
|
1196
|
+
${e.forgot?w`<button
|
|
1197
1197
|
type="button"
|
|
1198
1198
|
class="btn btn-link small"
|
|
1199
1199
|
@click=${()=>this.go("forgot-password")}
|
|
@@ -1221,7 +1221,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1221
1221
|
${t?_.eyeOff:_.eye}
|
|
1222
1222
|
</button>
|
|
1223
1223
|
</div>
|
|
1224
|
-
${o&&i?
|
|
1224
|
+
${o&&i?w`<div class="strength" aria-live="polite">
|
|
1225
1225
|
<div
|
|
1226
1226
|
class="strength-meter"
|
|
1227
1227
|
data-level=${String(o.level)}
|
|
@@ -1235,9 +1235,9 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1235
1235
|
<span></span><span></span><span></span><span></span>
|
|
1236
1236
|
</div>
|
|
1237
1237
|
<p class="strength-label">${this.t(o.labelKey)}</p>
|
|
1238
|
-
</div>`:e.hint?
|
|
1238
|
+
</div>`:e.hint?w`<p class="hint">${e.hint}</p>`:x}
|
|
1239
1239
|
</div>
|
|
1240
|
-
`}emailField(e="email"){return
|
|
1240
|
+
`}emailField(e="email"){return w`
|
|
1241
1241
|
<div class="field">
|
|
1242
1242
|
<label class="label" for="authui-email">${this.t("email")}</label>
|
|
1243
1243
|
<input
|
|
@@ -1251,7 +1251,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1251
1251
|
@input=${this.bind("email")}
|
|
1252
1252
|
/>
|
|
1253
1253
|
</div>
|
|
1254
|
-
`}codeField(){return
|
|
1254
|
+
`}codeField(){return w`
|
|
1255
1255
|
<div class="field">
|
|
1256
1256
|
<label class="label" for="authui-code">${this.t("code")}</label>
|
|
1257
1257
|
<input
|
|
@@ -1267,37 +1267,37 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1267
1267
|
@input=${this.bind("code")}
|
|
1268
1268
|
/>
|
|
1269
1269
|
</div>
|
|
1270
|
-
`}needsLegalAcceptance(){const e=this.config?.legal;return e?.requireAcceptance?!!(e.termsUrl||e.privacyUrl):!1}ensureLegalAccepted(){return!this.needsLegalAcceptance()||this.legalAccepted?!0:(this.error=this.t("errorLegalRequired"),!1)}legalLinks(){const e=this.config?.legal;return!e?.termsUrl&&!e?.privacyUrl?x:
|
|
1270
|
+
`}needsLegalAcceptance(){const e=this.config?.legal;return e?.requireAcceptance?!!(e.termsUrl||e.privacyUrl):!1}ensureLegalAccepted(){return!this.needsLegalAcceptance()||this.legalAccepted?!0:(this.error=this.t("errorLegalRequired"),!1)}legalLinks(){const e=this.config?.legal;return!e?.termsUrl&&!e?.privacyUrl?x:w`${e.termsUrl?w`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>`:x}${e.termsUrl&&e.privacyUrl?w` ${this.t("and")} `:x}${e.privacyUrl?w`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>`:x}`}legal(){const e=this.config?.legal;return!e?.termsUrl&&!e?.privacyUrl||this.step==="sign-up"&&this.needsLegalAcceptance()?x:w`<p class="legal">${this.t("agreeTo")} ${this.legalLinks()}.</p>`}legalAcceptField(){return this.needsLegalAcceptance()?w`<label class="legal-accept">
|
|
1271
1271
|
<input
|
|
1272
1272
|
type="checkbox"
|
|
1273
1273
|
.checked=${this.legalAccepted}
|
|
1274
1274
|
@change=${e=>{this.legalAccepted=e.target.checked,this.legalAccepted&&this.error===this.t("errorLegalRequired")&&(this.error="",this.legalErrorFromOAuth=!1)}}
|
|
1275
1275
|
/>
|
|
1276
1276
|
<span>${this.t("acceptLegal")} ${this.legalLinks()}.</span>
|
|
1277
|
-
</label>`:x}backLink(e="sign-in"){return
|
|
1277
|
+
</label>`:x}backLink(e="sign-in"){return w`<div class="links">
|
|
1278
1278
|
<button type="button" class="btn btn-link" @click=${()=>this.go(e)}>
|
|
1279
1279
|
${_.arrowLeft} ${this.t("back")}
|
|
1280
1280
|
</button>
|
|
1281
|
-
</div>`}renderStep(){if(this.auth.configError)return
|
|
1281
|
+
</div>`}renderStep(){if(this.auth.configError)return w`<div class="alert alert-error" role="alert">
|
|
1282
1282
|
${_.alert}
|
|
1283
1283
|
<div class="alert-body">${this.auth.configError}</div>
|
|
1284
|
-
</div>`;if(!this.auth.configured)return
|
|
1284
|
+
</div>`;if(!this.auth.configured)return w`<div class="alert alert-error" role="alert">
|
|
1285
1285
|
${_.alert}
|
|
1286
1286
|
<div class="alert-body">${this.t("errorNotConfigured")}</div>
|
|
1287
|
-
</div>`;if(this.auth.status==="loading")return
|
|
1287
|
+
</div>`;if(this.auth.status==="loading")return w`<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 w`
|
|
1288
1288
|
<div class="stack">
|
|
1289
1289
|
<div class="row">
|
|
1290
1290
|
<div class="inline">
|
|
1291
1291
|
<span class="avatar">${fi(i)}</span>
|
|
1292
1292
|
<div class="row-main">
|
|
1293
1293
|
<span class="row-title" title=${i}>${i}</span>
|
|
1294
|
-
${e.email&&e.name?
|
|
1294
|
+
${e.email&&e.name?w`<span class="row-sub" title=${e.email}>${e.email}</span>`:x}
|
|
1295
1295
|
</div>
|
|
1296
1296
|
</div>
|
|
1297
1297
|
</div>
|
|
1298
1298
|
${this.renderError()}
|
|
1299
1299
|
<div class="stack-sm">
|
|
1300
|
-
${this.config?.successUrl?
|
|
1300
|
+
${this.config?.successUrl?w`<a class="btn btn-primary btn-block" href=${this.config.successUrl}
|
|
1301
1301
|
>${this.t("continue")}</a
|
|
1302
1302
|
>`:x}
|
|
1303
1303
|
<button
|
|
@@ -1311,9 +1311,9 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1311
1311
|
</button>
|
|
1312
1312
|
</div>
|
|
1313
1313
|
</div>
|
|
1314
|
-
`}renderProviders(){const e=[...this.config?.methods?.oauth??[]];if(e.length===0)return x;const i=Qe(),t=e.find(r=>i===`oauth:${r}`)??null,o=this.config?.methods?.oauthLayout,a=o==="horizontal"||o==="icon"?"icon":o==="stack"||o==="accordion"?o:e.length<=2?"stack":"accordion";if(a==="icon"){const r=[...e].sort((d,c)=>{const l=i===`oauth:${d}`?0:1,u=i===`oauth:${c}`?0:1;return l-u});return
|
|
1314
|
+
`}renderProviders(){const e=[...this.config?.methods?.oauth??[]];if(e.length===0)return x;const i=Qe(),t=e.find(r=>i===`oauth:${r}`)??null,o=this.config?.methods?.oauthLayout,a=o==="horizontal"||o==="icon"?"icon":o==="stack"||o==="accordion"?o:e.length<=2?"stack":"accordion";if(a==="icon"){const r=[...e].sort((d,c)=>{const l=i===`oauth:${d}`?0:1,u=i===`oauth:${c}`?0:1;return l-u});return w`
|
|
1315
1315
|
<div class="providers icon">
|
|
1316
|
-
${r.map(d=>{const c=i===`oauth:${d}`,l=this.t("continueWith",{provider:tt(d)});return
|
|
1316
|
+
${r.map(d=>{const c=i===`oauth:${d}`,l=this.t("continueWith",{provider:tt(d)});return w`<button
|
|
1317
1317
|
type="button"
|
|
1318
1318
|
class="btn btn-outline ${c?"last-used":""}"
|
|
1319
1319
|
@click=${()=>this.onOAuth(d)}
|
|
@@ -1322,12 +1322,12 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1322
1322
|
title=${l}
|
|
1323
1323
|
>
|
|
1324
1324
|
${ht(d)}
|
|
1325
|
-
${c?
|
|
1325
|
+
${c?w`<span class="oauth-last-used-dot" aria-hidden="true"></span>`:x}
|
|
1326
1326
|
</button>`})}
|
|
1327
1327
|
</div>
|
|
1328
|
-
`}if(a==="stack"){const r=[...e].sort((d,c)=>{const l=i===`oauth:${d}`?0:1,u=i===`oauth:${c}`?0:1;return l-u});return
|
|
1328
|
+
`}if(a==="stack"){const r=[...e].sort((d,c)=>{const l=i===`oauth:${d}`?0:1,u=i===`oauth:${c}`?0:1;return l-u});return w`
|
|
1329
1329
|
<div class="providers">
|
|
1330
|
-
${r.map(d=>{const c=i===`oauth:${d}`,l=this.t("continueWith",{provider:tt(d)});return
|
|
1330
|
+
${r.map(d=>{const c=i===`oauth:${d}`,l=this.t("continueWith",{provider:tt(d)});return w`<button
|
|
1331
1331
|
type="button"
|
|
1332
1332
|
class="btn btn-outline ${c?"last-used":""}"
|
|
1333
1333
|
@click=${()=>this.onOAuth(d)}
|
|
@@ -1336,15 +1336,15 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1336
1336
|
>
|
|
1337
1337
|
${ht(d)}
|
|
1338
1338
|
<span>${l}</span>
|
|
1339
|
-
${c?
|
|
1339
|
+
${c?w`<span class="last-used-badge">${this.t("lastUsed")}</span>`:x}
|
|
1340
1340
|
</button>`})}
|
|
1341
1341
|
</div>
|
|
1342
|
-
`}const s=this.expandedOAuth&&e.includes(this.expandedOAuth)?this.expandedOAuth:t??e[0];return
|
|
1342
|
+
`}const s=this.expandedOAuth&&e.includes(this.expandedOAuth)?this.expandedOAuth:t??e[0];return w`
|
|
1343
1343
|
<div
|
|
1344
1344
|
class="providers accordion"
|
|
1345
1345
|
@mouseleave=${()=>{this.expandedOAuth=t??e[0]}}
|
|
1346
1346
|
>
|
|
1347
|
-
${e.map(r=>{const d=i===`oauth:${r}`,c=s===r,l=this.t("continueWith",{provider:tt(r)});return
|
|
1347
|
+
${e.map(r=>{const d=i===`oauth:${r}`,c=s===r,l=this.t("continueWith",{provider:tt(r)});return w`<div
|
|
1348
1348
|
class="provider-slot ${c?"is-expanded":""}"
|
|
1349
1349
|
@mouseenter=${()=>{this.expandedOAuth=r}}
|
|
1350
1350
|
>
|
|
@@ -1360,50 +1360,50 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1360
1360
|
<span class="provider-label"
|
|
1361
1361
|
><span><span class="provider-label-text">${l}</span></span></span
|
|
1362
1362
|
>
|
|
1363
|
-
${d?
|
|
1363
|
+
${d?w`<span class="oauth-last-used" data-last-used=${r} aria-hidden="true">
|
|
1364
1364
|
<span class="oauth-last-used-dot"></span>
|
|
1365
1365
|
<span class="oauth-last-used-pill">${this.t("lastUsed")}</span>
|
|
1366
1366
|
</span>`:x}
|
|
1367
1367
|
</button>
|
|
1368
1368
|
</div>`})}
|
|
1369
1369
|
</div>
|
|
1370
|
-
`}renderSignIn(){const e=this.config?.methods??{},i=e.emailPassword!==!1,t=(e.oauth?.length??0)>0,o=[e.magicUrl?{step:"magic-url",icon:_.link,label:this.t("sendMagicLink")}:null,e.emailOtp?{step:"email-otp",icon:_.mail,label:this.t("continueWithEmail")}:null,e.phone?{step:"phone",icon:_.smartphone,label:this.t("continueWithPhone")}:null].filter(Boolean);return
|
|
1370
|
+
`}renderSignIn(){const e=this.config?.methods??{},i=e.emailPassword!==!1,t=(e.oauth?.length??0)>0,o=[e.magicUrl?{step:"magic-url",icon:_.link,label:this.t("sendMagicLink")}:null,e.emailOtp?{step:"email-otp",icon:_.mail,label:this.t("continueWithEmail")}:null,e.phone?{step:"phone",icon:_.smartphone,label:this.t("continueWithPhone")}:null].filter(Boolean);return w`
|
|
1371
1371
|
<div class="stack">
|
|
1372
1372
|
${this.renderProviders()}
|
|
1373
|
-
${t&&(i||o.length>0)?
|
|
1374
|
-
${i?
|
|
1373
|
+
${t&&(i||o.length>0)?w`<div class="separator-text">${this.t("or")}</div>`:x}
|
|
1374
|
+
${i?w`<form
|
|
1375
1375
|
class="form ${Qe()==="email-password"?"last-used-form":""}"
|
|
1376
1376
|
@submit=${this.onSignIn}
|
|
1377
1377
|
novalidate
|
|
1378
1378
|
>
|
|
1379
|
-
${Qe()==="email-password"?
|
|
1379
|
+
${Qe()==="email-password"?w`<p class="hint">
|
|
1380
1380
|
<span class="last-used-badge">${this.t("lastUsed")}</span>
|
|
1381
1381
|
</p>`:x}
|
|
1382
1382
|
${this.emailField()}
|
|
1383
1383
|
${this.passwordField({label:this.t("password"),autocomplete:"current-password",id:"authui-password",field:"password",forgot:!0})}
|
|
1384
1384
|
${this.renderError()} ${this.submitButton(this.t("signIn"))}
|
|
1385
1385
|
</form>`:this.renderError()}
|
|
1386
|
-
${o.length>0?
|
|
1387
|
-
${o.map(a=>{const s=Qe()===a.step;return
|
|
1386
|
+
${o.length>0?w`<div class="stack-sm">
|
|
1387
|
+
${o.map(a=>{const s=Qe()===a.step;return w`<button
|
|
1388
1388
|
type="button"
|
|
1389
1389
|
class="btn btn-secondary btn-block ${s?"last-used":""}"
|
|
1390
1390
|
@click=${()=>this.go(a.step)}
|
|
1391
1391
|
?disabled=${this.busy}
|
|
1392
1392
|
>
|
|
1393
1393
|
${a.icon} ${a.label}
|
|
1394
|
-
${s?
|
|
1394
|
+
${s?w`<span class="last-used-badge">${this.t("lastUsed")}</span>`:x}
|
|
1395
1395
|
</button>`})}
|
|
1396
1396
|
</div>`:x}
|
|
1397
|
-
${e.anonymous?
|
|
1397
|
+
${e.anonymous?w`<button
|
|
1398
1398
|
type="button"
|
|
1399
1399
|
class="btn btn-ghost btn-block ${Qe()==="anonymous"?"last-used":""}"
|
|
1400
1400
|
@click=${this.onGuest}
|
|
1401
1401
|
?disabled=${this.busy}
|
|
1402
1402
|
>
|
|
1403
1403
|
${_.ghost} ${this.t("continueAsGuest")}
|
|
1404
|
-
${Qe()==="anonymous"?
|
|
1404
|
+
${Qe()==="anonymous"?w`<span class="last-used-badge">${this.t("lastUsed")}</span>`:x}
|
|
1405
1405
|
</button>`:x}
|
|
1406
|
-
${i&&this.config?.signUp!==!1?
|
|
1406
|
+
${i&&this.config?.signUp!==!1?w`<div class="links">
|
|
1407
1407
|
<span>${this.t("noAccount")}</span>
|
|
1408
1408
|
<button type="button" class="btn btn-link" @click=${()=>this.go("sign-up")}>
|
|
1409
1409
|
${this.t("signUp")}
|
|
@@ -1411,12 +1411,12 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1411
1411
|
</div>`:x}
|
|
1412
1412
|
${this.legal()}
|
|
1413
1413
|
</div>
|
|
1414
|
-
`}renderSignUp(){const e=this.legalErrorFromOAuth&&this.error===this.t("errorLegalRequired");return
|
|
1414
|
+
`}renderSignUp(){const e=this.legalErrorFromOAuth&&this.error===this.t("errorLegalRequired");return w`
|
|
1415
1415
|
<div class="stack">
|
|
1416
1416
|
${this.renderProviders()} ${e?this.renderError():x}
|
|
1417
|
-
${(this.config?.methods?.oauth?.length??0)>0?
|
|
1417
|
+
${(this.config?.methods?.oauth?.length??0)>0?w`<div class="separator-text">${this.t("or")}</div>`:x}
|
|
1418
1418
|
<form class="form" @submit=${this.onSignUp} novalidate>
|
|
1419
|
-
${this.config?.requireName!==!1?
|
|
1419
|
+
${this.config?.requireName!==!1?w`<div class="field">
|
|
1420
1420
|
<label class="label" for="authui-name">${this.t("name")}</label>
|
|
1421
1421
|
<input
|
|
1422
1422
|
class="input"
|
|
@@ -1441,14 +1441,14 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1441
1441
|
</div>
|
|
1442
1442
|
${this.legal()}
|
|
1443
1443
|
</div>
|
|
1444
|
-
`}renderForgot(){return
|
|
1444
|
+
`}renderForgot(){return w`
|
|
1445
1445
|
<div class="stack">
|
|
1446
1446
|
<form class="form" @submit=${this.onForgot} novalidate>
|
|
1447
1447
|
${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendResetLink"))}
|
|
1448
1448
|
</form>
|
|
1449
1449
|
${this.backLink()}
|
|
1450
1450
|
</div>
|
|
1451
|
-
`}renderReset(){return this.recovery?
|
|
1451
|
+
`}renderReset(){return this.recovery?w`
|
|
1452
1452
|
<div class="stack">
|
|
1453
1453
|
<form class="form" @submit=${this.onReset} novalidate>
|
|
1454
1454
|
${this.passwordField({label:this.t("newPassword"),autocomplete:"new-password",id:"authui-password",field:"password",hint:this.t("passwordHint"),meter:!0})}
|
|
@@ -1465,7 +1465,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1465
1465
|
</button>
|
|
1466
1466
|
</div>
|
|
1467
1467
|
</div>
|
|
1468
|
-
`:
|
|
1468
|
+
`:w`<div class="stack">
|
|
1469
1469
|
<div class="alert alert-error" role="alert">
|
|
1470
1470
|
${_.alert}
|
|
1471
1471
|
<div class="alert-body">${this.t("errorInvalidToken")}</div>
|
|
@@ -1479,26 +1479,26 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1479
1479
|
${this.t("requestNewLink")}
|
|
1480
1480
|
</button>
|
|
1481
1481
|
</div>
|
|
1482
|
-
</div>`}phraseBox(e){return e?
|
|
1482
|
+
</div>`}phraseBox(e){return e?w`<div class="alert alert-info">
|
|
1483
1483
|
${_.shield}
|
|
1484
1484
|
<div class="alert-title">
|
|
1485
1485
|
${this.t("securityPhrase")}: <span class="code">${e}</span>
|
|
1486
1486
|
</div>
|
|
1487
1487
|
<div class="alert-body">${this.t("securityPhraseHint")}</div>
|
|
1488
|
-
</div>`:x}renderMagicUrl(){return this.token?
|
|
1488
|
+
</div>`:x}renderMagicUrl(){return this.token?w`<div class="stack">
|
|
1489
1489
|
<div class="alert alert-success" role="status">
|
|
1490
1490
|
${_.mail}
|
|
1491
1491
|
<div class="alert-body">${this.t("magicLinkSent",{email:this.token.target})}</div>
|
|
1492
1492
|
</div>
|
|
1493
1493
|
${this.phraseBox(this.token.phrase)} ${this.backLink()}
|
|
1494
|
-
</div>`:
|
|
1494
|
+
</div>`:w`
|
|
1495
1495
|
<div class="stack">
|
|
1496
1496
|
<form class="form" @submit=${this.onMagicUrl} novalidate>
|
|
1497
1497
|
${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendMagicLink"))}
|
|
1498
1498
|
</form>
|
|
1499
1499
|
${this.backLink()} ${this.legal()}
|
|
1500
1500
|
</div>
|
|
1501
|
-
`}async onResendCode(){const e=this.token;!e||Date.now()<this.resendCooldownUntil||(this.error="",await this.run(async()=>{if(e.kind==="phone"){const i=await E.sendPhoneOtp(e.target);this.token={userId:i.userId,kind:"phone",target:e.target}}else{const i=await E.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
|
|
1501
|
+
`}async onResendCode(){const e=this.token;!e||Date.now()<this.resendCooldownUntil||(this.error="",await this.run(async()=>{if(e.kind==="phone"){const i=await E.sendPhoneOtp(e.target);this.token={userId:i.userId,kind:"phone",target:e.target}}else{const i=await E.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 w`
|
|
1502
1502
|
<div class="alert alert-info" role="status">
|
|
1503
1503
|
${e?_.smartphone:_.mail}
|
|
1504
1504
|
<div class="alert-body">${this.t("codeSent",{target:this.token.target})}</div>
|
|
@@ -1525,14 +1525,14 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1525
1525
|
${e?this.t("useDifferentPhone"):this.t("useDifferentEmail")}
|
|
1526
1526
|
</button>
|
|
1527
1527
|
</div>
|
|
1528
|
-
`}renderEmailOtp(){return this.token?
|
|
1528
|
+
`}renderEmailOtp(){return this.token?w`<div class="stack">${this.renderCodeEntry()}</div>`:w`
|
|
1529
1529
|
<div class="stack">
|
|
1530
1530
|
<form class="form" @submit=${this.onEmailOtp} novalidate>
|
|
1531
1531
|
${this.emailField()} ${this.renderError()} ${this.submitButton(this.t("sendCode"))}
|
|
1532
1532
|
</form>
|
|
1533
1533
|
${this.backLink()} ${this.legal()}
|
|
1534
1534
|
</div>
|
|
1535
|
-
`}renderPhone(){return this.token?
|
|
1535
|
+
`}renderPhone(){return this.token?w`<div class="stack">${this.renderCodeEntry()}</div>`:w`
|
|
1536
1536
|
<div class="stack">
|
|
1537
1537
|
<form class="form" @submit=${this.onPhoneOtp} novalidate>
|
|
1538
1538
|
<div class="field">
|
|
@@ -1552,10 +1552,10 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1552
1552
|
</form>
|
|
1553
1553
|
${this.backLink()} ${this.legal()}
|
|
1554
1554
|
</div>
|
|
1555
|
-
`}renderMfa(){const e=this.auth.mfaFactors;if(!this.challenge){const t=[{factor:"totp",icon:_.smartphone,label:this.t("mfaUseAuthenticator"),available:e?.totp??!0},{factor:"email",icon:_.mail,label:this.t("mfaUseEmail"),available:e?.email??!0},{factor:"phone",icon:_.phone,label:this.t("mfaUsePhone"),available:e?.phone??!0},{factor:"recoverycode",icon:_.key,label:this.t("mfaUseRecoveryCode"),available:e?.recoveryCode??!0}];return
|
|
1555
|
+
`}renderMfa(){const e=this.auth.mfaFactors;if(!this.challenge){const t=[{factor:"totp",icon:_.smartphone,label:this.t("mfaUseAuthenticator"),available:e?.totp??!0},{factor:"email",icon:_.mail,label:this.t("mfaUseEmail"),available:e?.email??!0},{factor:"phone",icon:_.phone,label:this.t("mfaUsePhone"),available:e?.phone??!0},{factor:"recoverycode",icon:_.key,label:this.t("mfaUseRecoveryCode"),available:e?.recoveryCode??!0}];return w`
|
|
1556
1556
|
<div class="stack">
|
|
1557
1557
|
<div class="stack-sm">
|
|
1558
|
-
${t.filter(o=>o.available).map(o=>
|
|
1558
|
+
${t.filter(o=>o.available).map(o=>w`<button
|
|
1559
1559
|
type="button"
|
|
1560
1560
|
class="choice"
|
|
1561
1561
|
@click=${()=>this.onChooseFactor(o.factor)}
|
|
@@ -1571,10 +1571,10 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1571
1571
|
</button>
|
|
1572
1572
|
</div>
|
|
1573
1573
|
</div>
|
|
1574
|
-
`}const i=this.challenge.factor==="recoverycode";return
|
|
1574
|
+
`}const i=this.challenge.factor==="recoverycode";return w`
|
|
1575
1575
|
<div class="stack">
|
|
1576
1576
|
<form class="form" @submit=${this.onVerifyFactor} novalidate>
|
|
1577
|
-
${i?
|
|
1577
|
+
${i?w`<div class="field">
|
|
1578
1578
|
<label class="label" for="authui-code">${this.t("recoveryCode")}</label>
|
|
1579
1579
|
<input
|
|
1580
1580
|
class="input mono"
|
|
@@ -1598,19 +1598,19 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1598
1598
|
</button>
|
|
1599
1599
|
</div>
|
|
1600
1600
|
</div>
|
|
1601
|
-
`}},
|
|
1602
|
-
`)),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 E.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&&(async()=>{let t=!1;await this.run("stepup-code",async()=>{await E.completeMfaChallenge(i.challenge.id,this.stepUpCode,{signIn:!1}),this.stepUp=null,this.stepUpCode="",t=!0}),t&&await i.retry()})()},this.onDeleteSession=e=>{this.run(`session-${e}`,async()=>{if((this.sessions??[]).some(t=>t.$id===e&&t.current)){await E.signOut(),this.sessions=[];return}await E.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",()=>E.signOutEverywhere())},this.onDeleteIdentity=e=>{if(this.confirmDisconnectId!==e){this.confirmDisconnectId=e;return}this.confirmDisconnectId=null,this.run(`identity-${e}`,async()=>{await E.deleteIdentity(e),this.identities=(this.identities??[]).filter(i=>i.$id!==e)})},this.onDeleteAccount=()=>{this.run("delete",()=>E.deleteAccount())}}connectedCallback(){super.connectedCallback(),this.active=this.tab,this.hydrate()}disconnectedCallback(){super.disconnectedCallback(),this.clearVerifyEmailCooldownTimer(),this.noticeTimer&&(clearTimeout(this.noticeTimer),this.noticeTimer=null)}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 t=this.renderRoot.querySelector('.tab[aria-selected="true"]');t&&typeof t.scrollIntoView=="function"&&t.scrollIntoView({inline:"nearest",block:"nearest",behavior:"smooth"})}),(e.has("confirmDelete")&&this.confirmDelete||e.has("confirmSignOutAll")&&this.confirmSignOutAll||e.has("confirmDisconnectId")&&this.confirmDisconnectId!==null)&&requestAnimationFrame(()=>{this.renderRoot.querySelector(".card-footer [autofocus], .row-actions [autofocus], .inline [autofocus], .card-footer .btn-outline, .row-actions .btn-outline, .inline .btn-outline")?.focus({preventScroll:!0})})}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){ut(o,ee.challengeRequired)?this.stepUp={retry:()=>this.run(e,i,t)}:this.errors={...this.errors,[e]:pt(o,this.strings,e.includes("code")?"code":e==="password"?"password":"link")}}finally{this.busy=""}}}async loadSessions(){await this.run("sessions",async()=>{this.sessions=await E.listSessions()})}async loadIdentities(){await this.run("identities",async()=>{this.identities=await E.listIdentities()})}async probeLogsSupport(){if(!this.logsProbeStarted){this.logsProbeStarted=!0;try{this.logs=await E.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 E.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 E.listMfaFactors()}catch{this.factors={totp:!1,phone:!1,email:!1,recoveryCode:!1,custom:!1}}finally{this.factorsLoading=!1}}}startVerifyEmailCooldown(){this.verifyEmailCooldownUntil=Date.now()+45e3,this.clearVerifyEmailCooldownTimer(),this.verifyEmailCooldownTimer=setInterval(()=>{this.requestUpdate(),Date.now()>=this.verifyEmailCooldownUntil&&this.clearVerifyEmailCooldownTimer()},1e3)}clearVerifyEmailCooldownTimer(){this.verifyEmailCooldownTimer&&(clearInterval(this.verifyEmailCooldownTimer),this.verifyEmailCooldownTimer=null)}bind(e){return i=>{this[e]=i.target.value}}render(){if(!this.auth.configured)return
|
|
1601
|
+
`}},I.AuthUISignIn.styles=[...Ce.styles,Do],he([F({type:String})],I.AuthUISignIn.prototype,"view",2),he([F({type:Boolean})],I.AuthUISignIn.prototype,"embedded",2),he([N()],I.AuthUISignIn.prototype,"step",2),he([N()],I.AuthUISignIn.prototype,"busy",2),he([N()],I.AuthUISignIn.prototype,"error",2),he([N()],I.AuthUISignIn.prototype,"notice",2),he([N()],I.AuthUISignIn.prototype,"showPassword",2),he([N()],I.AuthUISignIn.prototype,"showPasswordConfirm",2),he([N()],I.AuthUISignIn.prototype,"expandedOAuth",2),he([N()],I.AuthUISignIn.prototype,"token",2),he([N()],I.AuthUISignIn.prototype,"resendCooldownUntil",2),he([N()],I.AuthUISignIn.prototype,"challenge",2),he([N()],I.AuthUISignIn.prototype,"recovery",2),he([Ht("form input:not([type=hidden])")],I.AuthUISignIn.prototype,"firstInput",2),he([N()],I.AuthUISignIn.prototype,"password",2),he([N()],I.AuthUISignIn.prototype,"passwordConfirm",2),he([N()],I.AuthUISignIn.prototype,"legalAccepted",2),he([N()],I.AuthUISignIn.prototype,"legalErrorFromOAuth",2),I.AuthUISignIn=he([Ye("authui-sign-in")],I.AuthUISignIn);var Vo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,O=(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&&Vo(e,i,o),o};I.AuthUIAccount=class extends Ce{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.showOldPassword=!1,this.showNewPassword=!1,this.showNewPasswordConfirm=!1,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.verifyEmailCooldownTimer=null,this.verifyPhoneCooldownUntil=0,this.verifyPhoneCooldownTimer=null,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",()=>E.updateName(this.nameInput),this.t("nameUpdated"))},this.onUpdateEmail=e=>{e.preventDefault(),this.requireValid(e)&&this.run("email",async()=>{await E.updateEmail(this.emailInput,this.emailPassword),this.emailPassword=""},this.t("emailUpdated"))},this.onUpdatePhone=e=>{e.preventDefault(),this.requireValid(e)&&this.run("phone",async()=>{await E.updatePhone(this.phoneInput,this.phonePassword),this.phonePassword=""},this.t("phoneUpdated"))},this.onConvertGuest=e=>{e.preventDefault(),this.requireValid(e)&&this.run("guest",async()=>{await E.convertGuest(this.emailInput,this.emailPassword,this.guestName),this.emailPassword=""},this.t("accountConverted"))},this.onSendVerification=()=>{Date.now()<this.verifyEmailCooldownUntil||this.run("verify",async()=>{await E.sendEmailVerification(),this.startVerifyEmailCooldown()},this.t("verificationSent"))},this.onSendPhoneVerification=()=>{Date.now()<this.verifyPhoneCooldownUntil||this.run("verify-phone",async()=>{await E.sendPhoneVerification(),this.phoneCodeSent=!0,this.startVerifyPhoneCooldown()})},this.onConfirmPhoneVerification=e=>{e.preventDefault(),this.requireValid(e)&&this.run("verify-phone-code",async()=>{await E.confirmPhoneVerification(this.phoneCode),this.phoneCode="",this.phoneCodeSent=!1,this.verifyPhoneCooldownUntil=0,this.clearVerifyPhoneCooldownTimer()},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 E.updatePassword(this.newPassword,this.oldPassword),this.oldPassword=this.newPassword=this.newPasswordConfirm=""},this.t("passwordChanged"))}},this.onToggleMfa=()=>{const e=!this.user?.mfa;this.run("mfa",async()=>{await E.setMfaEnabled(e),await this.loadFactors()})},this.onAddAuthenticator=()=>{this.run("authenticator",async()=>{this.authenticator=await E.addAuthenticator(),this.authenticatorCode=""})},this.onVerifyAuthenticator=e=>{e.preventDefault(),this.requireValid(e)&&this.run("authenticator-code",async()=>{await E.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 E.removeAuthenticator(),await this.loadFactors()})},this.onRecoveryCodes=()=>{this.run("recovery",async()=>{try{this.recoveryCodes=await E.createRecoveryCodes()}catch(e){if(!ut(e,ee.recoveryCodesExist))throw e;this.recoveryCodes=await E.getRecoveryCodes()}await this.loadFactors()})},this.onRegenerateRecoveryCodes=()=>{if(!this.confirmRegenerate){this.confirmRegenerate=!0;return}this.confirmRegenerate=!1,this.run("recovery",async()=>{this.recoveryCodes=await E.regenerateRecoveryCodes()})},this.onCopyCodes=async()=>{if(this.recoveryCodes)try{await navigator.clipboard.writeText(this.recoveryCodes.join(`
|
|
1602
|
+
`)),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 E.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&&(async()=>{let t=!1;await this.run("stepup-code",async()=>{await E.completeMfaChallenge(i.challenge.id,this.stepUpCode,{signIn:!1}),this.stepUp=null,this.stepUpCode="",t=!0}),t&&await i.retry()})()},this.onDeleteSession=e=>{this.run(`session-${e}`,async()=>{if((this.sessions??[]).some(t=>t.$id===e&&t.current)){await E.signOut(),this.sessions=[];return}await E.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",()=>E.signOutEverywhere())},this.onDeleteIdentity=e=>{if(this.confirmDisconnectId!==e){this.confirmDisconnectId=e;return}this.confirmDisconnectId=null,this.run(`identity-${e}`,async()=>{await E.deleteIdentity(e),this.identities=(this.identities??[]).filter(i=>i.$id!==e)})},this.onDeleteAccount=()=>{this.run("delete",()=>E.deleteAccount())}}connectedCallback(){super.connectedCallback(),this.active=this.tab,this.hydrate()}disconnectedCallback(){super.disconnectedCallback(),this.clearVerifyEmailCooldownTimer(),this.clearVerifyPhoneCooldownTimer(),this.noticeTimer&&(clearTimeout(this.noticeTimer),this.noticeTimer=null)}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 t=this.renderRoot.querySelector('.tab[aria-selected="true"]');t&&typeof t.scrollIntoView=="function"&&t.scrollIntoView({inline:"nearest",block:"nearest",behavior:"smooth"})}),(e.has("confirmDelete")&&this.confirmDelete||e.has("confirmSignOutAll")&&this.confirmSignOutAll||e.has("confirmDisconnectId")&&this.confirmDisconnectId!==null||e.has("confirmRegenerate")&&this.confirmRegenerate||e.has("confirmRemoveAuthenticator")&&this.confirmRemoveAuthenticator)&&requestAnimationFrame(()=>{this.renderRoot.querySelector(".card-footer [autofocus], .row-actions [autofocus], .inline [autofocus], .card-footer .btn-outline, .row-actions .btn-outline, .inline .btn-outline")?.focus({preventScroll:!0})})}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){ut(o,ee.challengeRequired)?this.stepUp={retry:()=>this.run(e,i,t)}:this.errors={...this.errors,[e]:pt(o,this.strings,e.includes("code")?"code":e==="password"?"password":"link")}}finally{this.busy=""}}}async loadSessions(){await this.run("sessions",async()=>{this.sessions=await E.listSessions()})}async loadIdentities(){await this.run("identities",async()=>{this.identities=await E.listIdentities()})}async probeLogsSupport(){if(!this.logsProbeStarted){this.logsProbeStarted=!0;try{this.logs=await E.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 E.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 E.listMfaFactors()}catch{this.factors={totp:!1,phone:!1,email:!1,recoveryCode:!1,custom:!1}}finally{this.factorsLoading=!1}}}startVerifyEmailCooldown(){this.verifyEmailCooldownUntil=Date.now()+45e3,this.clearVerifyEmailCooldownTimer(),this.verifyEmailCooldownTimer=setInterval(()=>{this.requestUpdate(),Date.now()>=this.verifyEmailCooldownUntil&&this.clearVerifyEmailCooldownTimer()},1e3)}clearVerifyEmailCooldownTimer(){this.verifyEmailCooldownTimer&&(clearInterval(this.verifyEmailCooldownTimer),this.verifyEmailCooldownTimer=null)}startVerifyPhoneCooldown(){this.verifyPhoneCooldownUntil=Date.now()+45e3,this.clearVerifyPhoneCooldownTimer(),this.verifyPhoneCooldownTimer=setInterval(()=>{this.requestUpdate(),Date.now()>=this.verifyPhoneCooldownUntil&&this.clearVerifyPhoneCooldownTimer()},1e3)}clearVerifyPhoneCooldownTimer(){this.verifyPhoneCooldownTimer&&(clearInterval(this.verifyPhoneCooldownTimer),this.verifyPhoneCooldownTimer=null)}bind(e){return i=>{this[e]=i.target.value}}render(){if(!this.auth.configured)return w`<div class="alert alert-error" role="alert">
|
|
1603
1603
|
${_.alert}
|
|
1604
1604
|
<div class="alert-body">${this.t("errorNotConfigured")}</div>
|
|
1605
|
-
</div>`;if(this.auth.status==="loading")return
|
|
1605
|
+
</div>`;if(this.auth.status==="loading")return w`<div class="panel ${this.embedded?"embedded":""}" part="panel">
|
|
1606
1606
|
<div class="empty"><span class="spinner"></span></div>
|
|
1607
|
-
</div>`;if(!this.user)return
|
|
1607
|
+
</div>`;if(!this.user)return w`<div class="panel ${this.embedded?"embedded":""}">
|
|
1608
1608
|
<authui-sign-in embedded></authui-sign-in>
|
|
1609
|
-
</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
|
|
1609
|
+
</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 w`
|
|
1610
1610
|
<div class="panel ${this.embedded?"embedded":""}" part="panel">
|
|
1611
1611
|
${this.renderIdentity()}
|
|
1612
1612
|
<div class="tabs" role="tablist" @keydown=${this.onTabsKeydown}>
|
|
1613
|
-
${e.map(i=>
|
|
1613
|
+
${e.map(i=>w`<button
|
|
1614
1614
|
class="tab"
|
|
1615
1615
|
role="tab"
|
|
1616
1616
|
id=${`authui-tab-${i.id}`}
|
|
@@ -1622,7 +1622,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1622
1622
|
${i.label}
|
|
1623
1623
|
</button>`)}
|
|
1624
1624
|
</div>
|
|
1625
|
-
${this.notice?
|
|
1625
|
+
${this.notice?w`<div class="alert alert-${this.notice.tone}" role="status">
|
|
1626
1626
|
${this.notice.tone==="success"?_.checkCircle:_.info}
|
|
1627
1627
|
<div class="alert-body">${this.notice.message}</div>
|
|
1628
1628
|
<button
|
|
@@ -1633,7 +1633,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1633
1633
|
${_.x}
|
|
1634
1634
|
</button>
|
|
1635
1635
|
</div>`:x}
|
|
1636
|
-
${this.stepUp?this.renderStepUp():
|
|
1636
|
+
${this.stepUp?this.renderStepUp():w`<div
|
|
1637
1637
|
class="tabpanel"
|
|
1638
1638
|
role="tabpanel"
|
|
1639
1639
|
id=${`authui-panel-${this.active}`}
|
|
@@ -1642,34 +1642,34 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1642
1642
|
${this.renderTab()}
|
|
1643
1643
|
</div>`}
|
|
1644
1644
|
</div>
|
|
1645
|
-
`}renderIdentity(){const e=this.user,i=e.name||e.email||e.phone||this.t("guestAccount");return
|
|
1645
|
+
`}renderIdentity(){const e=this.user,i=e.name||e.email||e.phone||this.t("guestAccount");return w`
|
|
1646
1646
|
<div class="between">
|
|
1647
1647
|
<div class="identity">
|
|
1648
1648
|
<span class="avatar">${fi(i)}</span>
|
|
1649
1649
|
<div class="row-main">
|
|
1650
1650
|
<span class="row-title" title=${i}>
|
|
1651
1651
|
${i}
|
|
1652
|
-
${e.mfa?
|
|
1653
|
-
${E.isPreview?
|
|
1652
|
+
${e.mfa?w`<span class="badge badge-success">${_.shieldCheck} ${this.t("mfaBadge")}</span>`:x}
|
|
1653
|
+
${E.isPreview?w`<span class="badge badge-info">${this.t("preview")}</span>`:x}
|
|
1654
1654
|
</span>
|
|
1655
|
-
${e.email&&e.name?
|
|
1655
|
+
${e.email&&e.name?w`<span class="row-sub" title=${e.email}>${e.email}</span>`:x}
|
|
1656
1656
|
</div>
|
|
1657
1657
|
</div>
|
|
1658
1658
|
<button class="btn btn-outline btn-sm" @click=${()=>E.signOut()}>
|
|
1659
1659
|
${_.logOut} ${this.t("signOut")}
|
|
1660
1660
|
</button>
|
|
1661
1661
|
</div>
|
|
1662
|
-
`}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?
|
|
1662
|
+
`}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?w`<div class="alert alert-error" role="alert">
|
|
1663
1663
|
${_.alert}
|
|
1664
1664
|
<div class="alert-body">${i}</div>
|
|
1665
|
-
</div>`:x}spinner(e){return this.busy===e?
|
|
1665
|
+
</div>`:x}spinner(e){return this.busy===e?w`<span class="spinner" aria-hidden="true"></span>`:x}card(e,i,t,o,a=!1){return w`<section class="card ${a?"card-danger":""}">
|
|
1666
1666
|
<div class="card-header">
|
|
1667
1667
|
<h3 class="card-title">${e}</h3>
|
|
1668
|
-
${i?
|
|
1668
|
+
${i?w`<p class="card-description">${i}</p>`:x}
|
|
1669
1669
|
</div>
|
|
1670
|
-
${t!==x?
|
|
1671
|
-
${o?
|
|
1672
|
-
</section>`}confirmFooter(e,i,t,o){return
|
|
1670
|
+
${t!==x?w`<div class="card-body">${t}</div>`:x}
|
|
1671
|
+
${o?w`<div class="card-footer">${o}</div>`:x}
|
|
1672
|
+
</section>`}confirmFooter(e,i,t,o){return w`
|
|
1673
1673
|
<button
|
|
1674
1674
|
type="button"
|
|
1675
1675
|
class="btn btn-outline btn-sm"
|
|
@@ -1687,12 +1687,12 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1687
1687
|
>
|
|
1688
1688
|
${o?this.spinner(o):x} ${t}
|
|
1689
1689
|
</button>
|
|
1690
|
-
`}emptyState(e,i,t){return
|
|
1690
|
+
`}emptyState(e,i,t){return w`<div class="empty empty-well">
|
|
1691
1691
|
<div class="empty-icon" aria-hidden="true">${e}</div>
|
|
1692
1692
|
<p class="empty-title">${i}</p>
|
|
1693
1693
|
<p class="empty-desc">${t}</p>
|
|
1694
|
-
</div>`}verifiedBadge(e){return e?
|
|
1695
|
-
${this.card(this.t("guestAccount"),this.t("guestAccountDescription"),
|
|
1694
|
+
</div>`}verifiedBadge(e){return e?w`<span class="badge badge-success">${_.check} ${this.t("verified")}</span>`:w`<span class="badge badge-warning">${this.t("unverified")}</span>`}renderProfile(){const e=this.user;return this.isGuest?w`<div class="section">
|
|
1695
|
+
${this.card(this.t("guestAccount"),this.t("guestAccountDescription"),w`<form class="form" id="guest-form" @submit=${this.onConvertGuest} novalidate>
|
|
1696
1696
|
<div class="field">
|
|
1697
1697
|
<label class="label" for="guest-name">${this.t("name")}</label>
|
|
1698
1698
|
<input
|
|
@@ -1727,7 +1727,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1727
1727
|
@input=${this.bind("emailPassword")}
|
|
1728
1728
|
autocomplete="new-password"
|
|
1729
1729
|
/>
|
|
1730
|
-
${this.emailPassword?(()=>{const i=Ut(this.emailPassword);return
|
|
1730
|
+
${this.emailPassword?(()=>{const i=Ut(this.emailPassword);return w`<div class="strength" aria-live="polite">
|
|
1731
1731
|
<div
|
|
1732
1732
|
class="strength-meter"
|
|
1733
1733
|
data-level=${String(i.level)}
|
|
@@ -1741,10 +1741,10 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1741
1741
|
<span></span><span></span><span></span><span></span>
|
|
1742
1742
|
</div>
|
|
1743
1743
|
<p class="strength-label">${this.t(i.labelKey)}</p>
|
|
1744
|
-
</div>`})():
|
|
1744
|
+
</div>`})():w`<p class="hint">${this.t("passwordHint")}</p>`}
|
|
1745
1745
|
</div>
|
|
1746
1746
|
${this.error("guest")}
|
|
1747
|
-
</form>`,
|
|
1747
|
+
</form>`,w`<button
|
|
1748
1748
|
class="btn btn-primary btn-sm"
|
|
1749
1749
|
type="submit"
|
|
1750
1750
|
form="guest-form"
|
|
@@ -1752,8 +1752,8 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1752
1752
|
>
|
|
1753
1753
|
${this.spinner("guest")} ${this.t("createAccount")}
|
|
1754
1754
|
</button>`)}
|
|
1755
|
-
</div>`:
|
|
1756
|
-
${this.card(this.t("name"),void 0,
|
|
1755
|
+
</div>`:w`<div class="section">
|
|
1756
|
+
${this.card(this.t("name"),void 0,w`<form class="form" id="name-form" @submit=${this.onUpdateName} novalidate>
|
|
1757
1757
|
<div class="field">
|
|
1758
1758
|
<label class="label" for="acc-name">${this.t("name")}</label>
|
|
1759
1759
|
<input
|
|
@@ -1766,7 +1766,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1766
1766
|
/>
|
|
1767
1767
|
</div>
|
|
1768
1768
|
${this.error("name")}
|
|
1769
|
-
</form>`,
|
|
1769
|
+
</form>`,w`<button
|
|
1770
1770
|
class="btn btn-primary btn-sm"
|
|
1771
1771
|
type="submit"
|
|
1772
1772
|
form="name-form"
|
|
@@ -1774,7 +1774,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1774
1774
|
>
|
|
1775
1775
|
${this.spinner("name")} ${this.t("update")}
|
|
1776
1776
|
</button>`)}
|
|
1777
|
-
${this.card(this.t("email"),void 0,
|
|
1777
|
+
${this.card(this.t("email"),void 0,w`<form class="form" id="email-form" @submit=${this.onUpdateEmail} novalidate>
|
|
1778
1778
|
<div class="field">
|
|
1779
1779
|
<label class="label" for="acc-email"
|
|
1780
1780
|
>${this.t("email")}
|
|
@@ -1790,7 +1790,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1790
1790
|
required
|
|
1791
1791
|
/>
|
|
1792
1792
|
</div>
|
|
1793
|
-
${this.emailInput!==e.email?
|
|
1793
|
+
${this.emailInput!==e.email?w`<div class="field">
|
|
1794
1794
|
<label class="label" for="acc-email-password"
|
|
1795
1795
|
>${e.passwordUpdate?this.t("currentPassword"):this.t("createPassword")}</label
|
|
1796
1796
|
>
|
|
@@ -1803,11 +1803,11 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1803
1803
|
autocomplete=${e.passwordUpdate?"current-password":"new-password"}
|
|
1804
1804
|
required
|
|
1805
1805
|
/>
|
|
1806
|
-
${e.passwordUpdate?x:
|
|
1806
|
+
${e.passwordUpdate?x:w`<p class="hint">${this.t("createPasswordHint")}</p>`}
|
|
1807
1807
|
</div>`:x}
|
|
1808
1808
|
${this.error("email")} ${this.error("verify")}
|
|
1809
|
-
</form>`,
|
|
1810
|
-
${e.email&&!e.emailVerification?
|
|
1809
|
+
</form>`,w`
|
|
1810
|
+
${e.email&&!e.emailVerification?w`<button
|
|
1811
1811
|
class="btn btn-outline btn-sm"
|
|
1812
1812
|
type="button"
|
|
1813
1813
|
@click=${this.onSendVerification}
|
|
@@ -1825,7 +1825,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1825
1825
|
${this.spinner("email")} ${this.t("update")}
|
|
1826
1826
|
</button>
|
|
1827
1827
|
`)}
|
|
1828
|
-
${this.card(this.t("phone"),void 0,
|
|
1828
|
+
${this.card(this.t("phone"),void 0,w`<form class="form" id="phone-form" @submit=${this.onUpdatePhone} novalidate>
|
|
1829
1829
|
<div class="field">
|
|
1830
1830
|
<label class="label" for="acc-phone"
|
|
1831
1831
|
>${this.t("phone")}
|
|
@@ -1841,7 +1841,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1841
1841
|
autocomplete="tel"
|
|
1842
1842
|
/>
|
|
1843
1843
|
</div>
|
|
1844
|
-
${this.phoneInput!==e.phone?
|
|
1844
|
+
${this.phoneInput!==e.phone?w`<div class="field">
|
|
1845
1845
|
<label class="label" for="acc-phone-password"
|
|
1846
1846
|
>${e.passwordUpdate?this.t("currentPassword"):this.t("createPassword")}</label
|
|
1847
1847
|
>
|
|
@@ -1854,9 +1854,9 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1854
1854
|
autocomplete=${e.passwordUpdate?"current-password":"new-password"}
|
|
1855
1855
|
required
|
|
1856
1856
|
/>
|
|
1857
|
-
${e.passwordUpdate?x:
|
|
1857
|
+
${e.passwordUpdate?x:w`<p class="hint">${this.t("createPasswordHint")}</p>`}
|
|
1858
1858
|
</div>`:x}
|
|
1859
|
-
${this.phoneCodeSent?
|
|
1859
|
+
${this.phoneCodeSent?w`<div class="field">
|
|
1860
1860
|
<label class="label" for="acc-phone-code">${this.t("code")}</label>
|
|
1861
1861
|
<input
|
|
1862
1862
|
class="input input-otp"
|
|
@@ -1872,8 +1872,8 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1872
1872
|
/>
|
|
1873
1873
|
</div>`:x}
|
|
1874
1874
|
${this.error("phone")} ${this.error("verify-phone")} ${this.error("verify-phone-code")}
|
|
1875
|
-
</form>`,
|
|
1876
|
-
${e.phone&&!e.phoneVerification&&!this.phoneCodeSent?
|
|
1875
|
+
</form>`,w`
|
|
1876
|
+
${e.phone&&!e.phoneVerification&&!this.phoneCodeSent?w`<button
|
|
1877
1877
|
class="btn btn-outline btn-sm"
|
|
1878
1878
|
type="button"
|
|
1879
1879
|
@click=${this.onSendPhoneVerification}
|
|
@@ -1881,14 +1881,23 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1881
1881
|
>
|
|
1882
1882
|
${this.spinner("verify-phone")} ${this.t("sendCode")}
|
|
1883
1883
|
</button>`:x}
|
|
1884
|
-
${this.phoneCodeSent?
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1884
|
+
${this.phoneCodeSent?w`<button
|
|
1885
|
+
class="btn btn-outline btn-sm"
|
|
1886
|
+
type="button"
|
|
1887
|
+
@click=${this.onSendPhoneVerification}
|
|
1888
|
+
?disabled=${!!this.busy||Date.now()<this.verifyPhoneCooldownUntil}
|
|
1889
|
+
>
|
|
1890
|
+
${this.spinner("verify-phone")}
|
|
1891
|
+
${Date.now()<this.verifyPhoneCooldownUntil?this.t("verificationResendIn",{seconds:Math.max(1,Math.ceil((this.verifyPhoneCooldownUntil-Date.now())/1e3))}):this.t("resendCode")}
|
|
1892
|
+
</button>
|
|
1893
|
+
<button
|
|
1894
|
+
class="btn btn-outline btn-sm"
|
|
1895
|
+
type="button"
|
|
1896
|
+
@click=${this.onConfirmPhoneVerification}
|
|
1897
|
+
?disabled=${!!this.busy}
|
|
1898
|
+
>
|
|
1899
|
+
${this.spinner("verify-phone-code")} ${this.t("verifyCode")}
|
|
1900
|
+
</button>`:x}
|
|
1892
1901
|
<button
|
|
1893
1902
|
class="btn btn-primary btn-sm"
|
|
1894
1903
|
type="submit"
|
|
@@ -1899,43 +1908,63 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1899
1908
|
</button>
|
|
1900
1909
|
`)}
|
|
1901
1910
|
${this.renderDanger()}
|
|
1902
|
-
</div>`}renderDanger(){return this.card(this.t("deleteAccount"),this.t("deleteAccountDescription"),this.confirmDelete?this.error("delete"):
|
|
1911
|
+
</div>`}renderDanger(){return this.card(this.t("deleteAccount"),this.t("deleteAccountDescription"),this.confirmDelete?this.error("delete"):w`${this.error("delete")}
|
|
1903
1912
|
<button class="btn btn-outline btn-sm warn" @click=${()=>this.confirmDelete=!0}>
|
|
1904
1913
|
${_.userX} ${this.t("deleteAccount")}
|
|
1905
|
-
</button>`,this.confirmDelete?this.confirmFooter(()=>{this.confirmDelete=!1},()=>{this.onDeleteAccount()},this.t("deleteAccountConfirm"),"delete"):void 0,!0)}renderSecurity(){const e=this.user,i=this.config?.mfa!==!1;return
|
|
1906
|
-
${this.isGuest?x:this.card(this.t("changePassword"),void 0,
|
|
1914
|
+
</button>`,this.confirmDelete?this.confirmFooter(()=>{this.confirmDelete=!1},()=>{this.onDeleteAccount()},this.t("deleteAccountConfirm"),"delete"):void 0,!0)}renderSecurity(){const e=this.user,i=this.config?.mfa!==!1;return w`<div class="section">
|
|
1915
|
+
${this.isGuest?x:this.card(this.t("changePassword"),void 0,w`<form
|
|
1907
1916
|
class="form"
|
|
1908
1917
|
id="password-form"
|
|
1909
1918
|
@submit=${this.onChangePassword}
|
|
1910
1919
|
novalidate
|
|
1911
1920
|
>
|
|
1912
|
-
${e.passwordUpdate?
|
|
1921
|
+
${e.passwordUpdate?w`<div class="field">
|
|
1913
1922
|
<label class="label" for="acc-old-password"
|
|
1914
1923
|
>${this.t("currentPassword")}</label
|
|
1915
1924
|
>
|
|
1916
|
-
<input
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
+
<div class="input-wrap">
|
|
1926
|
+
<input
|
|
1927
|
+
class="input"
|
|
1928
|
+
id="acc-old-password"
|
|
1929
|
+
type=${this.showOldPassword?"text":"password"}
|
|
1930
|
+
.value=${this.oldPassword}
|
|
1931
|
+
@input=${this.bind("oldPassword")}
|
|
1932
|
+
autocomplete="current-password"
|
|
1933
|
+
required
|
|
1934
|
+
/>
|
|
1935
|
+
<button
|
|
1936
|
+
type="button"
|
|
1937
|
+
class="btn btn-ghost btn-icon"
|
|
1938
|
+
@click=${()=>this.showOldPassword=!this.showOldPassword}
|
|
1939
|
+
aria-label=${this.showOldPassword?this.t("hidePassword"):this.t("showPassword")}
|
|
1940
|
+
>
|
|
1941
|
+
${this.showOldPassword?_.eyeOff:_.eye}
|
|
1942
|
+
</button>
|
|
1943
|
+
</div>
|
|
1925
1944
|
</div>`:x}
|
|
1926
1945
|
<div class="field">
|
|
1927
1946
|
<label class="label" for="acc-new-password">${this.t("newPassword")}</label>
|
|
1928
|
-
<input
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1947
|
+
<div class="input-wrap">
|
|
1948
|
+
<input
|
|
1949
|
+
class="input"
|
|
1950
|
+
id="acc-new-password"
|
|
1951
|
+
type=${this.showNewPassword?"text":"password"}
|
|
1952
|
+
required
|
|
1953
|
+
minlength="8"
|
|
1954
|
+
.value=${this.newPassword}
|
|
1955
|
+
@input=${this.bind("newPassword")}
|
|
1956
|
+
autocomplete="new-password"
|
|
1957
|
+
/>
|
|
1958
|
+
<button
|
|
1959
|
+
type="button"
|
|
1960
|
+
class="btn btn-ghost btn-icon"
|
|
1961
|
+
@click=${()=>this.showNewPassword=!this.showNewPassword}
|
|
1962
|
+
aria-label=${this.showNewPassword?this.t("hidePassword"):this.t("showPassword")}
|
|
1963
|
+
>
|
|
1964
|
+
${this.showNewPassword?_.eyeOff:_.eye}
|
|
1965
|
+
</button>
|
|
1966
|
+
</div>
|
|
1967
|
+
${this.newPassword?(()=>{const t=Ut(this.newPassword);return w`<div class="strength" aria-live="polite">
|
|
1939
1968
|
<div
|
|
1940
1969
|
class="strength-meter"
|
|
1941
1970
|
data-level=${String(t.level)}
|
|
@@ -1949,25 +1978,35 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1949
1978
|
<span></span><span></span><span></span><span></span>
|
|
1950
1979
|
</div>
|
|
1951
1980
|
<p class="strength-label">${this.t(t.labelKey)}</p>
|
|
1952
|
-
</div>`})():
|
|
1981
|
+
</div>`})():w`<p class="hint">${this.t("passwordHint")}</p>`}
|
|
1953
1982
|
</div>
|
|
1954
1983
|
<div class="field">
|
|
1955
1984
|
<label class="label" for="acc-new-password-confirm"
|
|
1956
1985
|
>${this.t("confirmPassword")}</label
|
|
1957
1986
|
>
|
|
1958
|
-
<input
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1987
|
+
<div class="input-wrap">
|
|
1988
|
+
<input
|
|
1989
|
+
class="input"
|
|
1990
|
+
id="acc-new-password-confirm"
|
|
1991
|
+
type=${this.showNewPasswordConfirm?"text":"password"}
|
|
1992
|
+
required
|
|
1993
|
+
minlength="8"
|
|
1994
|
+
.value=${this.newPasswordConfirm}
|
|
1995
|
+
@input=${this.bind("newPasswordConfirm")}
|
|
1996
|
+
autocomplete="new-password"
|
|
1997
|
+
/>
|
|
1998
|
+
<button
|
|
1999
|
+
type="button"
|
|
2000
|
+
class="btn btn-ghost btn-icon"
|
|
2001
|
+
@click=${()=>this.showNewPasswordConfirm=!this.showNewPasswordConfirm}
|
|
2002
|
+
aria-label=${this.showNewPasswordConfirm?this.t("hidePassword"):this.t("showPassword")}
|
|
2003
|
+
>
|
|
2004
|
+
${this.showNewPasswordConfirm?_.eyeOff:_.eye}
|
|
2005
|
+
</button>
|
|
2006
|
+
</div>
|
|
1968
2007
|
</div>
|
|
1969
2008
|
${this.error("password")}
|
|
1970
|
-
</form>`,
|
|
2009
|
+
</form>`,w`<button
|
|
1971
2010
|
class="btn btn-primary btn-sm"
|
|
1972
2011
|
type="submit"
|
|
1973
2012
|
form="password-form"
|
|
@@ -1977,7 +2016,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1977
2016
|
</button>`)}
|
|
1978
2017
|
${i?this.renderMfaCard():x}
|
|
1979
2018
|
${i?this.renderRecoveryCard():x}
|
|
1980
|
-
</div>`}renderMfaCard(){const e=this.user,i=this.factors?.totp??!1,t=this.authenticator?E.isPreview?ko(this.authenticator.uri):new Gi(E.getClient()).getQR(this.authenticator.uri,400,1).toString():"";return this.card(this.t("twoFactor"),this.t("twoFactorDescription"),
|
|
2019
|
+
</div>`}renderMfaCard(){const e=this.user,i=this.factors?.totp??!1,t=this.authenticator?E.isPreview?ko(this.authenticator.uri):new Gi(E.getClient()).getQR(this.authenticator.uri,400,1).toString():"";return this.card(this.t("twoFactor"),this.t("twoFactorDescription"),w`<div class="kv">
|
|
1981
2020
|
<div class="toggle-row">
|
|
1982
2021
|
<div class="row-main">
|
|
1983
2022
|
<span class="row-title">${this.t("twoFactor")}</span>
|
|
@@ -1992,11 +2031,11 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
1992
2031
|
aria-label=${this.t("twoFactor")}
|
|
1993
2032
|
></button>
|
|
1994
2033
|
</div>
|
|
1995
|
-
${e.mfa&&!(this.factors?.totp||e.emailVerification||e.phoneVerification)?
|
|
2034
|
+
${e.mfa&&!(this.factors?.totp||e.emailVerification||e.phoneVerification)?w`<div class="alert alert-warning" role="status">
|
|
1996
2035
|
${_.alert}
|
|
1997
2036
|
<div class="alert-body">
|
|
1998
2037
|
${this.t("mfaNoFactorWarning")}
|
|
1999
|
-
${this.factors?.totp?x:
|
|
2038
|
+
${this.factors?.totp?x:w`<div class="links">
|
|
2000
2039
|
<button
|
|
2001
2040
|
type="button"
|
|
2002
2041
|
class="btn btn-link"
|
|
@@ -2017,27 +2056,31 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2017
2056
|
${i?this.verifiedBadge(!0):x}</span
|
|
2018
2057
|
>
|
|
2019
2058
|
</div>
|
|
2020
|
-
${i?this.confirmRemoveAuthenticator?
|
|
2059
|
+
${i?this.confirmRemoveAuthenticator?w`<div class="inline">
|
|
2021
2060
|
<button
|
|
2022
|
-
|
|
2023
|
-
|
|
2061
|
+
type="button"
|
|
2062
|
+
class="btn btn-outline btn-sm"
|
|
2063
|
+
autofocus
|
|
2024
2064
|
?disabled=${!!this.busy}
|
|
2065
|
+
@click=${()=>this.confirmRemoveAuthenticator=!1}
|
|
2025
2066
|
>
|
|
2026
|
-
${this.
|
|
2067
|
+
${this.t("cancel")}
|
|
2027
2068
|
</button>
|
|
2028
2069
|
<button
|
|
2029
|
-
|
|
2030
|
-
|
|
2070
|
+
type="button"
|
|
2071
|
+
class="btn btn-destructive btn-sm"
|
|
2072
|
+
@click=${this.onRemoveAuthenticator}
|
|
2073
|
+
?disabled=${!!this.busy}
|
|
2031
2074
|
>
|
|
2032
|
-
${this.t("
|
|
2075
|
+
${this.spinner("remove-authenticator")} ${this.t("remove")}
|
|
2033
2076
|
</button>
|
|
2034
|
-
</div>`:
|
|
2077
|
+
</div>`:w`<button
|
|
2035
2078
|
class="btn btn-outline btn-sm"
|
|
2036
2079
|
@click=${this.onRemoveAuthenticator}
|
|
2037
2080
|
?disabled=${!!this.busy}
|
|
2038
2081
|
>
|
|
2039
2082
|
${this.spinner("remove-authenticator")} ${this.t("remove")}
|
|
2040
|
-
</button>`:this.authenticator?x:
|
|
2083
|
+
</button>`:this.authenticator?x:w`<button
|
|
2041
2084
|
class="btn btn-outline btn-sm"
|
|
2042
2085
|
@click=${this.onAddAuthenticator}
|
|
2043
2086
|
?disabled=${!!this.busy}
|
|
@@ -2046,7 +2089,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2046
2089
|
</button>`}
|
|
2047
2090
|
</div>
|
|
2048
2091
|
${this.error("authenticator")} ${this.error("remove-authenticator")}
|
|
2049
|
-
${this.authenticator?
|
|
2092
|
+
${this.authenticator?w`<form class="form" @submit=${this.onVerifyAuthenticator} novalidate>
|
|
2050
2093
|
<p class="hint">${this.t("authenticatorScan")}</p>
|
|
2051
2094
|
<img class="qr" src=${t} alt=${this.t("qrCodeAlt")} />
|
|
2052
2095
|
<p class="hint center">${this.t("authenticatorManual")}</p>
|
|
@@ -2091,13 +2134,13 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2091
2134
|
</button>
|
|
2092
2135
|
</div>
|
|
2093
2136
|
</form>`:x}
|
|
2094
|
-
</div>`)}renderRecoveryCard(){const e=this.factors?.recoveryCode??!1;return this.card(this.t("recoveryCodes"),this.t("recoveryCodesDescription")+" "+this.t("recoveryCodesOnceHint"),
|
|
2095
|
-
${this.recoveryCodes?
|
|
2137
|
+
</div>`)}renderRecoveryCard(){const e=this.factors?.recoveryCode??!1;return this.card(this.t("recoveryCodes"),this.t("recoveryCodesDescription")+" "+this.t("recoveryCodesOnceHint"),w`<div class="kv">
|
|
2138
|
+
${this.recoveryCodes?w`<div class="alert alert-warning">
|
|
2096
2139
|
${_.alert}
|
|
2097
2140
|
<div class="alert-body">${this.t("recoveryCodesWarning")}</div>
|
|
2098
2141
|
</div>
|
|
2099
2142
|
<div class="codes">
|
|
2100
|
-
${this.recoveryCodes.map(i=>
|
|
2143
|
+
${this.recoveryCodes.map(i=>w`<span class="code">${i}</span>`)}
|
|
2101
2144
|
</div>
|
|
2102
2145
|
<div class="inline">
|
|
2103
2146
|
<button class="btn btn-outline btn-sm" @click=${this.onCopyCodes}>
|
|
@@ -2107,7 +2150,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2107
2150
|
<button class="btn btn-ghost btn-sm" @click=${()=>this.recoveryCodes=null}>
|
|
2108
2151
|
${this.t("done")}
|
|
2109
2152
|
</button>
|
|
2110
|
-
</div>`:
|
|
2153
|
+
</div>`:w`<div class="inline">
|
|
2111
2154
|
<button
|
|
2112
2155
|
class="btn btn-outline btn-sm"
|
|
2113
2156
|
@click=${this.onRecoveryCodes}
|
|
@@ -2116,21 +2159,26 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2116
2159
|
${this.spinner("recovery")} ${_.key}
|
|
2117
2160
|
${e?this.t("viewRecoveryCodes"):this.t("generateRecoveryCodes")}
|
|
2118
2161
|
</button>
|
|
2119
|
-
${e?this.confirmRegenerate?
|
|
2162
|
+
${e?this.confirmRegenerate?w`<div class="inline">
|
|
2120
2163
|
<button
|
|
2121
|
-
|
|
2122
|
-
|
|
2164
|
+
type="button"
|
|
2165
|
+
class="btn btn-outline btn-sm"
|
|
2166
|
+
autofocus
|
|
2123
2167
|
?disabled=${!!this.busy}
|
|
2168
|
+
@click=${()=>this.confirmRegenerate=!1}
|
|
2124
2169
|
>
|
|
2125
|
-
${
|
|
2170
|
+
${this.t("cancel")}
|
|
2126
2171
|
</button>
|
|
2127
2172
|
<button
|
|
2128
|
-
|
|
2129
|
-
|
|
2173
|
+
type="button"
|
|
2174
|
+
class="btn btn-destructive btn-sm"
|
|
2175
|
+
@click=${this.onRegenerateRecoveryCodes}
|
|
2176
|
+
?disabled=${!!this.busy}
|
|
2130
2177
|
>
|
|
2131
|
-
${this.
|
|
2178
|
+
${this.spinner("recovery")} ${_.refresh}
|
|
2179
|
+
${this.t("regenerateRecoveryCodes")}
|
|
2132
2180
|
</button>
|
|
2133
|
-
</div>`:
|
|
2181
|
+
</div>`:w`<button
|
|
2134
2182
|
class="btn btn-ghost btn-sm"
|
|
2135
2183
|
@click=${this.onRegenerateRecoveryCodes}
|
|
2136
2184
|
?disabled=${!!this.busy}
|
|
@@ -2139,8 +2187,8 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2139
2187
|
</button>`:x}
|
|
2140
2188
|
</div>`}
|
|
2141
2189
|
${this.error("recovery")}
|
|
2142
|
-
</div>`)}renderStepUp(){const e=this.stepUp,i=this.factors,t=[{factor:"totp",icon:_.smartphone,label:this.t("mfaUseAuthenticator"),available:i?.totp??!0},{factor:"email",icon:_.mail,label:this.t("mfaUseEmail"),available:i?.email??!0},{factor:"phone",icon:_.phone,label:this.t("mfaUsePhone"),available:i?.phone??!0},{factor:"recoverycode",icon:_.key,label:this.t("mfaUseRecoveryCode"),available:i?.recoveryCode??!0}];return this.card(this.t("mfaTitle"),this.t("errorChallengeRequired"),
|
|
2143
|
-
${e.challenge?
|
|
2190
|
+
</div>`)}renderStepUp(){const e=this.stepUp,i=this.factors,t=[{factor:"totp",icon:_.smartphone,label:this.t("mfaUseAuthenticator"),available:i?.totp??!0},{factor:"email",icon:_.mail,label:this.t("mfaUseEmail"),available:i?.email??!0},{factor:"phone",icon:_.phone,label:this.t("mfaUsePhone"),available:i?.phone??!0},{factor:"recoverycode",icon:_.key,label:this.t("mfaUseRecoveryCode"),available:i?.recoveryCode??!0}];return this.card(this.t("mfaTitle"),this.t("errorChallengeRequired"),w`<div class="kv">
|
|
2191
|
+
${e.challenge?w`<form class="form" @submit=${this.onStepUpVerify} novalidate>
|
|
2144
2192
|
<div class="field">
|
|
2145
2193
|
<label class="label" for="acc-stepup"
|
|
2146
2194
|
>${e.challenge.factor==="recoverycode"?this.t("recoveryCode"):this.t("code")}</label
|
|
@@ -2160,8 +2208,8 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2160
2208
|
<button class="btn btn-primary btn-sm" type="submit" ?disabled=${!!this.busy}>
|
|
2161
2209
|
${this.spinner("stepup-code")} ${this.t("verifyCode")}
|
|
2162
2210
|
</button>
|
|
2163
|
-
</form>`:
|
|
2164
|
-
${t.filter(o=>o.available).map(o=>
|
|
2211
|
+
</form>`:w`<div class="stack-sm">
|
|
2212
|
+
${t.filter(o=>o.available).map(o=>w`<button
|
|
2165
2213
|
type="button"
|
|
2166
2214
|
class="choice"
|
|
2167
2215
|
@click=${()=>this.onStepUpFactor(o.factor)}
|
|
@@ -2171,18 +2219,18 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2171
2219
|
</button>`)}
|
|
2172
2220
|
</div>`}
|
|
2173
2221
|
${this.error("stepup")} ${this.error("stepup-code")}
|
|
2174
|
-
</div>`,
|
|
2222
|
+
</div>`,w`<button class="btn btn-ghost btn-sm" @click=${()=>this.stepUp=null}>
|
|
2175
2223
|
${this.t("cancel")}
|
|
2176
|
-
</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)?_.smartphone:/desktop|browser/.test(i)||/mac|windows|linux|chrome os/.test(t)?_.monitor:_.globe}renderSessions(){const e=this.sessions;return
|
|
2177
|
-
${this.card(this.t("sessions"),void 0,
|
|
2178
|
-
${e===null?
|
|
2224
|
+
</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)?_.smartphone:/desktop|browser/.test(i)||/mac|windows|linux|chrome os/.test(t)?_.monitor:_.globe}renderSessions(){const e=this.sessions;return w`<div class="section">
|
|
2225
|
+
${this.card(this.t("sessions"),void 0,w`${this.error("sessions")}
|
|
2226
|
+
${e===null?w`<div class="empty"><span class="spinner"></span></div>`:e.length===0?this.emptyState(_.monitor,this.t("noSessions"),this.t("noSessionsDescription")):e.map(i=>w`<div class="row">
|
|
2179
2227
|
<div class="inline">
|
|
2180
2228
|
<span class="device">${this.deviceIcon(i)}</span>
|
|
2181
2229
|
<div class="row-main">
|
|
2182
2230
|
<span class="row-title">
|
|
2183
2231
|
${i.clientName||i.provider}
|
|
2184
|
-
${i.clientVersion?
|
|
2185
|
-
${i.current?
|
|
2232
|
+
${i.clientVersion?w`<span class="muted small">${i.clientVersion}</span>`:x}
|
|
2233
|
+
${i.current?w`<span class="badge badge-info">${this.t("currentSession")}</span>`:x}
|
|
2186
2234
|
</span>
|
|
2187
2235
|
<span class="row-sub"
|
|
2188
2236
|
>${[i.osName,i.countryName||i.countryCode,i.ip].filter(Boolean).join(" · ")}</span
|
|
@@ -2190,7 +2238,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2190
2238
|
</div>
|
|
2191
2239
|
</div>
|
|
2192
2240
|
<div class="row-actions">
|
|
2193
|
-
${this.busy===`session-${i.$id}`?
|
|
2241
|
+
${this.busy===`session-${i.$id}`?w`<span class="spinner"></span>`:x}
|
|
2194
2242
|
<button
|
|
2195
2243
|
class="btn btn-ghost btn-sm"
|
|
2196
2244
|
@click=${()=>this.onDeleteSession(i.$id)}
|
|
@@ -2201,7 +2249,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2201
2249
|
</button>
|
|
2202
2250
|
</div>
|
|
2203
2251
|
</div>`)}`)}
|
|
2204
|
-
${this.card(this.t("signOutAllSessions"),this.t("signOutAllSessionsDescription"),this.confirmSignOutAll?this.error("sessions-all"):
|
|
2252
|
+
${this.card(this.t("signOutAllSessions"),this.t("signOutAllSessionsDescription"),this.confirmSignOutAll?this.error("sessions-all"):w`${this.error("sessions-all")}
|
|
2205
2253
|
<button
|
|
2206
2254
|
class="btn btn-outline btn-sm warn"
|
|
2207
2255
|
@click=${this.onSignOutAll}
|
|
@@ -2209,9 +2257,9 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2209
2257
|
>
|
|
2210
2258
|
${this.spinner("sessions-all")} ${_.logOut} ${this.t("signOutAllSessions")}
|
|
2211
2259
|
</button>`,this.confirmSignOutAll?this.confirmFooter(()=>{this.confirmSignOutAll=!1},()=>{this.onSignOutAll()},this.t("signOutAllSessions"),"sessions-all"):void 0,!0)}
|
|
2212
|
-
</div>`}renderConnections(){const e=this.identities,i=this.config?.methods?.oauth??[];return
|
|
2213
|
-
${this.card(this.t("connections"),void 0,
|
|
2214
|
-
${e===null?
|
|
2260
|
+
</div>`}renderConnections(){const e=this.identities,i=this.config?.methods?.oauth??[];return w`<div class="section">
|
|
2261
|
+
${this.card(this.t("connections"),void 0,w`${this.error("identities")}
|
|
2262
|
+
${e===null?w`<div class="empty"><span class="spinner"></span></div>`:e.length===0?this.emptyState(_.link,this.t("noConnections"),this.t("noConnectionsDescription")):e.map(t=>w`<div class="row">
|
|
2215
2263
|
<div class="inline">
|
|
2216
2264
|
<span class="device">${ht(t.provider)}</span>
|
|
2217
2265
|
<div class="row-main">
|
|
@@ -2220,7 +2268,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2220
2268
|
</div>
|
|
2221
2269
|
</div>
|
|
2222
2270
|
<div class="row-actions">
|
|
2223
|
-
${this.confirmDisconnectId===t.$id?
|
|
2271
|
+
${this.confirmDisconnectId===t.$id?w`<div class="inline">
|
|
2224
2272
|
<button
|
|
2225
2273
|
type="button"
|
|
2226
2274
|
class="btn btn-outline btn-sm"
|
|
@@ -2236,19 +2284,19 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2236
2284
|
@click=${()=>this.onDeleteIdentity(t.$id)}
|
|
2237
2285
|
?disabled=${!!this.busy}
|
|
2238
2286
|
>
|
|
2239
|
-
${this.busy===`identity-${t.$id}`?
|
|
2287
|
+
${this.busy===`identity-${t.$id}`?w`<span class="spinner"></span>`:x}
|
|
2240
2288
|
${this.t("disconnect")}
|
|
2241
2289
|
</button>
|
|
2242
|
-
</div>`:
|
|
2290
|
+
</div>`:w`<button
|
|
2243
2291
|
class="btn btn-ghost btn-sm"
|
|
2244
2292
|
@click=${()=>this.onDeleteIdentity(t.$id)}
|
|
2245
2293
|
?disabled=${!!this.busy}
|
|
2246
2294
|
>
|
|
2247
|
-
${this.busy===`identity-${t.$id}`?
|
|
2295
|
+
${this.busy===`identity-${t.$id}`?w`<span class="spinner"></span>`:x}
|
|
2248
2296
|
${this.t("disconnect")}
|
|
2249
2297
|
</button>`}
|
|
2250
2298
|
</div>
|
|
2251
|
-
</div>`)}`,i.length>0?
|
|
2299
|
+
</div>`)}`,i.length>0?w`${i.filter(t=>!(e??[]).some(o=>o.provider===t)).map(t=>w`<button
|
|
2252
2300
|
class="btn btn-outline btn-sm"
|
|
2253
2301
|
@click=${()=>{this.run(`connect-${t}`,()=>E.signInWithOAuth(t))}}
|
|
2254
2302
|
?disabled=${!!this.busy}
|
|
@@ -2256,8 +2304,8 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2256
2304
|
${this.spinner(`connect-${t}`)} ${ht(t)}
|
|
2257
2305
|
${this.t("connectProvider",{provider:tt(t)})}
|
|
2258
2306
|
</button>`)}`:void 0)}
|
|
2259
|
-
</div>`}renderActivity(){const e=this.logs;return
|
|
2260
|
-
${this.card(this.t("activity"),void 0,
|
|
2307
|
+
</div>`}renderActivity(){const e=this.logs;return w`<div class="section">
|
|
2308
|
+
${this.card(this.t("activity"),void 0,w`${e===null?w`<div class="empty"><span class="spinner"></span></div>`:e.length===0?this.emptyState(_.activity,this.t("noActivity"),this.t("noActivityDescription")):e.map(i=>w`<div class="row">
|
|
2261
2309
|
<div class="row-main">
|
|
2262
2310
|
<span class="row-title">${i.event}</span>
|
|
2263
2311
|
<span class="row-sub"
|
|
@@ -2266,7 +2314,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2266
2314
|
</div>
|
|
2267
2315
|
<span class="log-time">${new Date(i.time).toLocaleString()}</span>
|
|
2268
2316
|
</div>`)}`)}
|
|
2269
|
-
</div>`}},
|
|
2317
|
+
</div>`}},I.AuthUIAccount.styles=[...Ce.styles,Ne`
|
|
2270
2318
|
:host {
|
|
2271
2319
|
display: block;
|
|
2272
2320
|
width: 100%;
|
|
@@ -2360,7 +2408,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2360
2408
|
.warn {
|
|
2361
2409
|
color: var(--authui-destructive-foreground);
|
|
2362
2410
|
}
|
|
2363
|
-
`],
|
|
2411
|
+
`],O([F({type:Boolean})],I.AuthUIAccount.prototype,"embedded",2),O([F({type:String})],I.AuthUIAccount.prototype,"tab",2),O([N()],I.AuthUIAccount.prototype,"active",2),O([N()],I.AuthUIAccount.prototype,"busy",2),O([N()],I.AuthUIAccount.prototype,"notice",2),O([N()],I.AuthUIAccount.prototype,"errors",2),O([N()],I.AuthUIAccount.prototype,"nameInput",2),O([N()],I.AuthUIAccount.prototype,"emailInput",2),O([N()],I.AuthUIAccount.prototype,"emailPassword",2),O([N()],I.AuthUIAccount.prototype,"phoneInput",2),O([N()],I.AuthUIAccount.prototype,"phonePassword",2),O([N()],I.AuthUIAccount.prototype,"phoneCode",2),O([N()],I.AuthUIAccount.prototype,"phoneCodeSent",2),O([N()],I.AuthUIAccount.prototype,"guestName",2),O([N()],I.AuthUIAccount.prototype,"oldPassword",2),O([N()],I.AuthUIAccount.prototype,"newPassword",2),O([N()],I.AuthUIAccount.prototype,"newPasswordConfirm",2),O([N()],I.AuthUIAccount.prototype,"showOldPassword",2),O([N()],I.AuthUIAccount.prototype,"showNewPassword",2),O([N()],I.AuthUIAccount.prototype,"showNewPasswordConfirm",2),O([N()],I.AuthUIAccount.prototype,"authenticator",2),O([N()],I.AuthUIAccount.prototype,"authenticatorCode",2),O([N()],I.AuthUIAccount.prototype,"factors",2),O([N()],I.AuthUIAccount.prototype,"recoveryCodes",2),O([N()],I.AuthUIAccount.prototype,"stepUp",2),O([N()],I.AuthUIAccount.prototype,"stepUpCode",2),O([N()],I.AuthUIAccount.prototype,"copied",2),O([N()],I.AuthUIAccount.prototype,"sessions",2),O([N()],I.AuthUIAccount.prototype,"identities",2),O([N()],I.AuthUIAccount.prototype,"logs",2),O([N()],I.AuthUIAccount.prototype,"logsSupported",2),O([N()],I.AuthUIAccount.prototype,"confirmDelete",2),O([N()],I.AuthUIAccount.prototype,"confirmRegenerate",2),O([N()],I.AuthUIAccount.prototype,"confirmRemoveAuthenticator",2),O([N()],I.AuthUIAccount.prototype,"confirmSignOutAll",2),O([N()],I.AuthUIAccount.prototype,"confirmDisconnectId",2),O([N()],I.AuthUIAccount.prototype,"verifyEmailCooldownUntil",2),O([N()],I.AuthUIAccount.prototype,"verifyPhoneCooldownUntil",2),I.AuthUIAccount=O([Ye("authui-account")],I.AuthUIAccount);var Go=Object.defineProperty,Ko=Object.getOwnPropertyDescriptor,Be=(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&&Go(e,i,o),o};I.AuthUIModal=class extends Ce{constructor(){super(...arguments),this.open=!1,this.view="sign-in",this.closeOnSuccess=!0,this.handledPending=null,this.scrollCue=!1,this.bodyResizeObserver=null,this.onOpenEvent=e=>{const i=e.detail??{};this.show(i.view)},this.onCloseEvent=()=>this.hide(),this.syncScrollCue=()=>{const e=this.bodyEl;if(!e){this.scrollCue=!1;return}const i=e.scrollHeight>e.clientHeight+1,t=e.scrollTop+e.clientHeight>=e.scrollHeight-4,o=i&&!t;o!==this.scrollCue&&(this.scrollCue=o)},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),this.bodyResizeObserver?.disconnect(),this.bodyResizeObserver=null}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}observeBody(){this.bodyResizeObserver?.disconnect(),this.bodyResizeObserver=null;const e=this.bodyEl;if(!e||typeof ResizeObserver>"u"){this.syncScrollCue();return}this.bodyResizeObserver=new ResizeObserver(()=>this.syncScrollCue()),this.bodyResizeObserver.observe(e),e.firstElementChild&&this.bodyResizeObserver.observe(e.firstElementChild),this.syncScrollCue()}updated(e){if(e.has("open")&&this.dialog&&(this.open&&!this.dialog.open&&(this.dialog.showModal(),requestAnimationFrame(()=>{this.focusPrimary(),this.observeBody()})),!this.open&&this.dialog.open&&this.dialog.close(),this.open||(this.scrollCue=!1,this.bodyResizeObserver?.disconnect(),this.bodyResizeObserver=null)),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")}this.open&&(e.has("view")||e.has("auth")||e.has("open"))&&requestAnimationFrame(()=>this.observeBody())}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 w`
|
|
2364
2412
|
<dialog
|
|
2365
2413
|
class=${i?"wide":""}
|
|
2366
2414
|
aria-label=${i?this.t("dialogAccount"):this.t("dialogSignIn")}
|
|
@@ -2381,7 +2429,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2381
2429
|
</button>
|
|
2382
2430
|
</div>
|
|
2383
2431
|
<div class="body" @scroll=${this.syncScrollCue}>
|
|
2384
|
-
${this.open?i?
|
|
2432
|
+
${this.open?i?w`<authui-account embedded></authui-account>`:w`<authui-sign-in
|
|
2385
2433
|
embedded
|
|
2386
2434
|
.view=${this.view==="account"?"sign-in":this.view}
|
|
2387
2435
|
></authui-sign-in>`:x}
|
|
@@ -2389,7 +2437,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2389
2437
|
<div class="scroll-fade ${this.scrollCue?"show":""}" aria-hidden="true"></div>
|
|
2390
2438
|
</div>
|
|
2391
2439
|
</dialog>
|
|
2392
|
-
`}},
|
|
2440
|
+
`}},I.AuthUIModal.styles=[...Ce.styles,Ne`
|
|
2393
2441
|
:host {
|
|
2394
2442
|
display: contents;
|
|
2395
2443
|
}
|
|
@@ -2475,7 +2523,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2475
2523
|
authui-account {
|
|
2476
2524
|
max-width: none;
|
|
2477
2525
|
}
|
|
2478
|
-
`],Be([
|
|
2526
|
+
`],Be([F({type:Boolean,reflect:!0})],I.AuthUIModal.prototype,"open",2),Be([F({type:String})],I.AuthUIModal.prototype,"view",2),Be([F({attribute:"close-on-success",reflect:!0,converter:{fromAttribute(n){if(n===null)return!0;const e=n.trim().toLowerCase();return!(e==="false"||e==="0"||e==="off"||e==="no")},toAttribute(n){return n?null:"false"}}})],I.AuthUIModal.prototype,"closeOnSuccess",2),Be([N()],I.AuthUIModal.prototype,"handledPending",2),Be([N()],I.AuthUIModal.prototype,"scrollCue",2),Be([Ht("dialog")],I.AuthUIModal.prototype,"dialog",2),Be([Ht(".body")],I.AuthUIModal.prototype,"bodyEl",2),I.AuthUIModal=Be([Ye("authui-modal")],I.AuthUIModal);var Yo=Object.defineProperty,Jo=Object.getOwnPropertyDescriptor,xt=(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&&Yo(e,i,o),o};I.AuthUIButton=class extends Ce{constructor(){super(...arguments),this.view="sign-in",this.variant="primary",this.size="md"}render(){const e=this.size==="md"?"":`btn-${this.size}`;return w`<button
|
|
2479
2527
|
class="btn btn-${this.variant} ${e}"
|
|
2480
2528
|
@click=${()=>nt(this.view)}
|
|
2481
2529
|
part="button"
|
|
@@ -2483,16 +2531,16 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2483
2531
|
<slot
|
|
2484
2532
|
>${this.view==="sign-up"?this.t("signUp"):this.view==="account"?this.t("manageAccount"):this.t("signIn")}</slot
|
|
2485
2533
|
>
|
|
2486
|
-
</button>`}},
|
|
2534
|
+
</button>`}},I.AuthUIButton.styles=[...Ce.styles,Ne`
|
|
2487
2535
|
:host {
|
|
2488
2536
|
display: inline-block;
|
|
2489
2537
|
}
|
|
2490
2538
|
.btn {
|
|
2491
2539
|
width: 100%;
|
|
2492
2540
|
}
|
|
2493
|
-
`],xt([
|
|
2541
|
+
`],xt([F({type:String})],I.AuthUIButton.prototype,"view",2),xt([F({type:String})],I.AuthUIButton.prototype,"variant",2),xt([F({type:String})],I.AuthUIButton.prototype,"size",2),I.AuthUIButton=xt([Ye("authui-button")],I.AuthUIButton);var Zo=Object.defineProperty,Qo=Object.getOwnPropertyDescriptor,Ee=(n,e,i,t)=>{for(var o=t>1?void 0:t?Qo(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&&Zo(e,i,o),o};I.AuthUIUserButton=class extends Ce{constructor(){super(...arguments),this.showTeams=!1,this.menuItems=[],this.src="",this.menuOpen=!1,this.menuAbove=!1,this.teams=[],this.teamsLoading=!1,this.activeTeamId=null,this.onReposition=()=>{this.menuOpen&&this.placeMenu()},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))},this.toggleMenu=()=>{this.menuOpen=!this.menuOpen,this.menuOpen&&this.showTeams&&this.loadTeams()},this.selectTeam=e=>{E.setActiveTeam({$id:e.$id,name:e.name}),this.activeTeamId=e.$id,this.dispatchEvent(new CustomEvent("authui-active-team",{detail:{teamId:e.$id,team:e},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.onDocumentClick,!0),document.addEventListener("keydown",this.onKeydown),this.addEventListener("keydown",this.onKeydown),window.addEventListener("resize",this.onReposition),window.addEventListener("scroll",this.onReposition,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.onDocumentClick,!0),document.removeEventListener("keydown",this.onKeydown),this.removeEventListener("keydown",this.onKeydown),window.removeEventListener("resize",this.onReposition),window.removeEventListener("scroll",this.onReposition,!0)}placeMenu(){const e=this.renderRoot?.querySelector(".trigger"),i=this.renderRoot?.querySelector(".menu");if(!e||!i)return;const t=e.getBoundingClientRect(),o=6,a=8;i.style.maxHeight="";const s=i.offsetHeight+o,r=window.innerHeight-t.bottom,d=t.top,c=r<s&&d>r;c!==this.menuAbove&&(this.menuAbove=c);const l=Math.max(80,(c?d:r)-o-a);i.style.maxHeight=`${l}px`}focusMenuItem(e){[...this.renderRoot?.querySelectorAll('[role="menuitem"]')??[]][e]?.focus()}updated(e){e.has("menuOpen")&&(this.menuOpen?(this.showTeams&&this.loadTeams(),requestAnimationFrame(()=>{this.placeMenu(),this.focusMenuItem(0)})):this.menuAbove=!1),this.menuOpen&&(e.has("teams")||e.has("teamsLoading"))&&requestAnimationFrame(()=>this.placeMenu())}async loadTeams(){this.teamsLoading=!0,this.activeTeamId=E.getActiveTeamId();try{this.teams=await E.listTeams(),this.activeTeamId&&!this.teams.some(e=>e.$id===this.activeTeamId)&&(this.activeTeamId=null,E.setActiveTeam(null))}catch{this.teams=[]}finally{this.teamsLoading=!1}}render(){const{status:e,user:i,configured:t}=this.auth;if(e==="loading"&&t)return w`<span class="avatar"><span class="spinner"></span></span>`;if(e!=="signed-in"||!i)return w`<button class="btn btn-primary btn-sm" @click=${()=>nt("sign-in")}>
|
|
2494
2542
|
<slot>${this.t("signIn")}</slot>
|
|
2495
|
-
</button>`;const o=i.name||i.email||i.phone||this.t("guestAccount");return
|
|
2543
|
+
</button>`;const o=i.name||i.email||i.phone||this.t("guestAccount");return w`
|
|
2496
2544
|
<button
|
|
2497
2545
|
class="trigger"
|
|
2498
2546
|
aria-haspopup="menu"
|
|
@@ -2501,19 +2549,19 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2501
2549
|
aria-label=${o}
|
|
2502
2550
|
>
|
|
2503
2551
|
<span class="avatar"
|
|
2504
|
-
>${this.src?
|
|
2552
|
+
>${this.src?w`<img src=${this.src} alt="" />`:fi(o)}</span
|
|
2505
2553
|
>
|
|
2506
2554
|
</button>
|
|
2507
|
-
${this.menuOpen?
|
|
2555
|
+
${this.menuOpen?w`<div class="menu ${this.menuAbove?"above":""}" role="menu">
|
|
2508
2556
|
<div class="menu-header">
|
|
2509
2557
|
<span class="row-title" title=${o}>${o}</span>
|
|
2510
|
-
${i.email&&i.name?
|
|
2558
|
+
${i.email&&i.name?w`<span class="row-sub" title=${i.email}>${i.email}</span>`:x}
|
|
2511
2559
|
</div>
|
|
2512
|
-
${this.showTeams?
|
|
2560
|
+
${this.showTeams?w`<div class="menu-section">
|
|
2513
2561
|
<div class="menu-section-label">${this.t("teamsLabel")}</div>
|
|
2514
|
-
${this.teamsLoading?
|
|
2562
|
+
${this.teamsLoading?w`<div class="menu-item" aria-busy="true">
|
|
2515
2563
|
<span class="spinner"></span>
|
|
2516
|
-
</div>`:this.teams.length===0?
|
|
2564
|
+
</div>`:this.teams.length===0?w`<div class="menu-item" role="note">${this.t("noTeams")}</div>`:this.teams.map(a=>w`<button
|
|
2517
2565
|
class="menu-item ${a.$id===this.activeTeamId?"active":""}"
|
|
2518
2566
|
role="menuitemradio"
|
|
2519
2567
|
aria-checked=${a.$id===this.activeTeamId?"true":"false"}
|
|
@@ -2521,7 +2569,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2521
2569
|
>
|
|
2522
2570
|
${_.users}
|
|
2523
2571
|
<span title=${a.name}>${a.name}</span>
|
|
2524
|
-
${a.$id===this.activeTeamId?
|
|
2572
|
+
${a.$id===this.activeTeamId?w`<span class="check">${_.check}</span>`:x}
|
|
2525
2573
|
</button>`)}
|
|
2526
2574
|
</div>`:x}
|
|
2527
2575
|
${this.renderCustomMenuItems()}
|
|
@@ -2541,7 +2589,7 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2541
2589
|
${_.logOut} ${this.t("signOut")}
|
|
2542
2590
|
</button>
|
|
2543
2591
|
</div>`:x}
|
|
2544
|
-
`}renderCustomMenuItems(){return this.menuItems?.length?this.menuItems.map(e=>{if(e.href){const t=e.target;return
|
|
2592
|
+
`}renderCustomMenuItems(){return this.menuItems?.length?this.menuItems.map(e=>{if(e.href){const t=e.target;return w`<a
|
|
2545
2593
|
class="menu-item"
|
|
2546
2594
|
role="menuitem"
|
|
2547
2595
|
href=${e.href}
|
|
@@ -2550,14 +2598,14 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2550
2598
|
@click=${()=>{this.menuOpen=!1}}
|
|
2551
2599
|
>
|
|
2552
2600
|
${e.label}
|
|
2553
|
-
</a>`}const i=e.actionId;return
|
|
2601
|
+
</a>`}const i=e.actionId;return w`<button
|
|
2554
2602
|
class="menu-item"
|
|
2555
2603
|
role="menuitem"
|
|
2556
2604
|
type="button"
|
|
2557
2605
|
@click=${()=>{this.menuOpen=!1,i&&this.dispatchEvent(new CustomEvent("authui-menu-action",{detail:{actionId:i},bubbles:!0,composed:!0}))}}
|
|
2558
2606
|
>
|
|
2559
2607
|
${e.label}
|
|
2560
|
-
</button>`}):x}},
|
|
2608
|
+
</button>`}):x}},I.AuthUIUserButton.styles=[...Ce.styles,Ne`
|
|
2561
2609
|
:host {
|
|
2562
2610
|
display: inline-block;
|
|
2563
2611
|
position: relative;
|
|
@@ -2675,4 +2723,4 @@ var AuthUI=(function(A){"use strict";var qe;const yt=globalThis,Rt=yt.ShadowRoot
|
|
|
2675
2723
|
height: 32px;
|
|
2676
2724
|
font-size: 13px;
|
|
2677
2725
|
}
|
|
2678
|
-
`],Ee([
|
|
2726
|
+
`],Ee([F({type:Boolean,attribute:"show-teams"})],I.AuthUIUserButton.prototype,"showTeams",2),Ee([F({attribute:!1})],I.AuthUIUserButton.prototype,"menuItems",2),Ee([F({type:String})],I.AuthUIUserButton.prototype,"src",2),Ee([N()],I.AuthUIUserButton.prototype,"menuOpen",2),Ee([N()],I.AuthUIUserButton.prototype,"menuAbove",2),Ee([N()],I.AuthUIUserButton.prototype,"teams",2),Ee([N()],I.AuthUIUserButton.prototype,"teamsLoading",2),Ee([N()],I.AuthUIUserButton.prototype,"activeTeamId",2),I.AuthUIUserButton=Ee([Ye("authui-user-button")],I.AuthUIUserButton);function cn(n){return E.configure(n),wn}function dn(n){nt(n)}function ln(){rn()}function un(){return E.signOut()}function pn(){return E.user}function hn(){return E.getState()}function fn(){return E.getClient()}function gn(){return E.getAccount()}function yn(){return E.previewSignIn()}function mn(n,e){return E.on(n,e)}const wn={init:cn,open:dn,close:ln,signOut:un,getUser:pn,getState:hn,getClient:fn,getAccount:gn,on:mn,previewSignIn:yn,store:E};return I.AuthStore=tn,I.AuthUI=wn,I.AuthUIElement=Ce,I.CRITICAL_FOUC_CSS=qo,I.ErrorTypes=ee,I.FOUC_CSS=pi,I.PreviewAccount=Qi,I.appwrite=bo,I.authStore=E,I.clearLastMethod=So,I.clearPendingOAuth=li,I.close=ln,I.closeModal=rn,I.defaultStrings=Yi,I.describeError=pt,I.getAccount=gn,I.getClient=fn,I.getLastMethod=Qe,I.getState=hn,I.getStoredActiveTeamId=ri,I.getUser=pn,I.init=cn,I.isConfigError=Ti,I.on=mn,I.open=dn,I.openModal=nt,I.previewSignIn=yn,I.providerLabel=tt,I.rememberLastMethod=Ze,I.rememberPendingOAuth=di,I.scorePassword=Ut,I.setStoredActiveTeamId=zi,I.signOut=un,I.stashPendingOAuth=Oi,I.toAuthUIError=Je,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),I})({});
|