/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/appwrite@15.0.0/dist/iife/sdk.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(e){"use strict";function t(e,t,i,n){return new(i||(i=Promise))((function(o,r){function s(e){try{c(n.next(e))}catch(e){r(e)}}function a(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))}class i{constructor(e){this.client=e}static flatten(e,t=""){let n={};for(const[o,r]of Object.entries(e)){let e=t?t+"["+o+"]":o;Array.isArray(r)?n=Object.assign(Object.assign({},n),i.flatten(r,e)):n[e]=r}return n}}i.CHUNK_SIZE=5242880;class n{constructor(e,t,i){this.method=e,this.attribute=t,void 0!==i&&(Array.isArray(i)?this.values=i:this.values=[i])}toString(){return JSON.stringify({method:this.method,attribute:this.attribute,values:this.values})}}n.equal=(e,t)=>new n("equal",e,t).toString(),n.notEqual=(e,t)=>new n("notEqual",e,t).toString(),n.lessThan=(e,t)=>new n("lessThan",e,t).toString(),n.lessThanEqual=(e,t)=>new n("lessThanEqual",e,t).toString(),n.greaterThan=(e,t)=>new n("greaterThan",e,t).toString(),n.greaterThanEqual=(e,t)=>new n("greaterThanEqual",e,t).toString(),n.isNull=e=>new n("isNull",e).toString(),n.isNotNull=e=>new n("isNotNull",e).toString(),n.between=(e,t,i)=>new n("between",e,[t,i]).toString(),n.startsWith=(e,t)=>new n("startsWith",e,t).toString(),n.endsWith=(e,t)=>new n("endsWith",e,t).toString(),n.select=e=>new n("select",void 0,e).toString(),n.search=(e,t)=>new n("search",e,t).toString(),n.orderDesc=e=>new n("orderDesc",e).toString(),n.orderAsc=e=>new n("orderAsc",e).toString(),n.cursorAfter=e=>new n("cursorAfter",void 0,e).toString(),n.cursorBefore=e=>new n("cursorBefore",void 0,e).toString(),n.limit=e=>new n("limit",void 0,e).toString(),n.offset=e=>new n("offset",void 0,e).toString(),n.contains=(e,t)=>new n("contains",e,t).toString(),n.or=e=>new n("or",void 0,e.map((e=>JSON.parse(e)))).toString(),n.and=e=>new n("and",void 0,e.map((e=>JSON.parse(e)))).toString();class o extends Error{constructor(e,t=0,i="",n=""){super(e),this.name="AppwriteException",this.message=e,this.code=t,this.type=i,this.response=n}}class r{}r.read=e=>`read("${e}")`,r.write=e=>`write("${e}")`,r.create=e=>`create("${e}")`,r.update=e=>`update("${e}")`,r.delete=e=>`delete("${e}")`;var s,a,c,d,l,p,u,h,f,v;class m{static custom(e){return e}static unique(e=7){const t=function(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}(m,s,"m",a).call(m);let i="";for(let t=0;t<e;t++){i+=Math.floor(16*Math.random()).toString(16)}return t+i}}s=m,a=function(){const e=new Date,t=Math.floor(e.getTime()/1e3),i=e.getMilliseconds();return t.toString(16)+i.toString(16).padStart(5,"0")},e.AuthenticatorType=void 0,(e.AuthenticatorType||(e.AuthenticatorType={})).Totp="totp",e.AuthenticationFactor=void 0,(c=e.AuthenticationFactor||(e.AuthenticationFactor={})).Email="email",c.Phone="phone",c.Totp="totp",c.Recoverycode="recoverycode",e.OAuthProvider=void 0,(d=e.OAuthProvider||(e.OAuthProvider={})).Amazon="amazon",d.Apple="apple",d.Auth0="auth0",d.Authentik="authentik",d.Autodesk="autodesk",d.Bitbucket="bitbucket",d.Bitly="bitly",d.Box="box",d.Dailymotion="dailymotion",d.Discord="discord",d.Disqus="disqus",d.Dropbox="dropbox",d.Etsy="etsy",d.Facebook="facebook",d.Github="github",d.Gitlab="gitlab",d.Google="google",d.Linkedin="linkedin",d.Microsoft="microsoft",d.Notion="notion",d.Oidc="oidc",d.Okta="okta",d.Paypal="paypal",d.PaypalSandbox="paypalSandbox",d.Podio="podio",d.Salesforce="salesforce",d.Slack="slack",d.Spotify="spotify",d.Stripe="stripe",d.Tradeshift="tradeshift",d.TradeshiftBox="tradeshiftBox",d.Twitch="twitch",d.Wordpress="wordpress",d.Yahoo="yahoo",d.Yammer="yammer",d.Yandex="yandex",d.Zoho="zoho",d.Zoom="zoom",d.Mock="mock",e.Browser=void 0,(l=e.Browser||(e.Browser={})).AvantBrowser="aa",l.AndroidWebViewBeta="an",l.GoogleChrome="ch",l.GoogleChromeIOS="ci",l.GoogleChromeMobile="cm",l.Chromium="cr",l.MozillaFirefox="ff",l.Safari="sf",l.MobileSafari="mf",l.MicrosoftEdge="ps",l.MicrosoftEdgeIOS="oi",l.OperaMini="om",l.Opera="op",l.OperaNext="on",e.CreditCard=void 0,(p=e.CreditCard||(e.CreditCard={})).AmericanExpress="amex",p.Argencard="argencard",p.Cabal="cabal",p.Cencosud="cencosud",p.DinersClub="diners",p.Discover="discover",p.Elo="elo",p.Hipercard="hipercard",p.JCB="jcb",p.Mastercard="mastercard",p.Naranja="naranja",p.TarjetaShopping="targeta-shopping",p.UnionChinaPay="union-china-pay",p.Visa="visa",p.MIR="mir",p.Maestro="maestro",e.Flag=void 0,(u=e.Flag||(e.Flag={})).Afghanistan="af",u.Angola="ao",u.Albania="al",u.Andorra="ad",u.UnitedArabEmirates="ae",u.Argentina="ar",u.Armenia="am",u.AntiguaAndBarbuda="ag",u.Australia="au",u.Austria="at",u.Azerbaijan="az",u.Burundi="bi",u.Belgium="be",u.Benin="bj",u.BurkinaFaso="bf",u.Bangladesh="bd",u.Bulgaria="bg",u.Bahrain="bh",u.Bahamas="bs",u.BosniaAndHerzegovina="ba",u.Belarus="by",u.Belize="bz",u.Bolivia="bo",u.Brazil="br",u.Barbados="bb",u.BruneiDarussalam="bn",u.Bhutan="bt",u.Botswana="bw",u.CentralAfricanRepublic="cf",u.Canada="ca",u.Switzerland="ch",u.Chile="cl",u.China="cn",u.CoteDIvoire="ci",u.Cameroon="cm",u.DemocraticRepublicOfTheCongo="cd",u.RepublicOfTheCongo="cg",u.Colombia="co",u.Comoros="km",u.CapeVerde="cv",u.CostaRica="cr",u.Cuba="cu",u.Cyprus="cy",u.CzechRepublic="cz",u.Germany="de",u.Djibouti="dj",u.Dominica="dm",u.Denmark="dk",u.DominicanRepublic="do",u.Algeria="dz",u.Ecuador="ec",u.Egypt="eg",u.Eritrea="er",u.Spain="es",u.Estonia="ee",u.Ethiopia="et",u.Finland="fi",u.Fiji="fj",u.France="fr",u.MicronesiaFederatedStatesOf="fm",u.Gabon="ga",u.UnitedKingdom="gb",u.Georgia="ge",u.Ghana="gh",u.Guinea="gn",u.Gambia="gm",u.GuineaBissau="gw",u.EquatorialGuinea="gq",u.Greece="gr",u.Grenada="gd",u.Guatemala="gt",u.Guyana="gy",u.Honduras="hn",u.Croatia="hr",u.Haiti="ht",u.Hungary="hu",u.Indonesia="id",u.India="in",u.Ireland="ie",u.IranIslamicRepublicOf="ir",u.Iraq="iq",u.Iceland="is",u.Israel="il",u.Italy="it",u.Jamaica="jm",u.Jordan="jo",u.Japan="jp",u.Kazakhstan="kz",u.Kenya="ke",u.Kyrgyzstan="kg",u.Cambodia="kh",u.Kiribati="ki",u.SaintKittsAndNevis="kn",u.SouthKorea="kr",u.Kuwait="kw",u.LaoPeopleSDemocraticRepublic="la",u.Lebanon="lb",u.Liberia="lr",u.Libya="ly",u.SaintLucia="lc",u.Liechtenstein="li",u.SriLanka="lk",u.Lesotho="ls",u.Lithuania="lt",u.Luxembourg="lu",u.Latvia="lv",u.Morocco="ma",u.Monaco="mc",u.Moldova="md",u.Madagascar="mg",u.Maldives="mv",u.Mexico="mx",u.MarshallIslands="mh",u.NorthMacedonia="mk",u.Mali="ml",u.Malta="mt",u.Myanmar="mm",u.Montenegro="me",u.Mongolia="mn",u.Mozambique="mz",u.Mauritania="mr",u.Mauritius="mu",u.Malawi="mw",u.Malaysia="my",u.Namibia="na",u.Niger="ne",u.Nigeria="ng",u.Nicaragua="ni",u.Netherlands="nl",u.Norway="no",u.Nepal="np",u.Nauru="nr",u.NewZealand="nz",u.Oman="om",u.Pakistan="pk",u.Panama="pa",u.Peru="pe",u.Philippines="ph",u.Palau="pw",u.PapuaNewGuinea="pg",u.Poland="pl",u.FrenchPolynesia="pf",u.NorthKorea="kp",u.Portugal="pt",u.Paraguay="py",u.Qatar="qa",u.Romania="ro",u.Russia="ru",u.Rwanda="rw",u.SaudiArabia="sa",u.Sudan="sd",u.Senegal="sn",u.Singapore="sg",u.SolomonIslands="sb",u.SierraLeone="sl",u.ElSalvador="sv",u.SanMarino="sm",u.Somalia="so",u.Serbia="rs",u.SouthSudan="ss",u.SaoTomeAndPrincipe="st",u.Suriname="sr",u.Slovakia="sk",u.Slovenia="si",u.Sweden="se",u.Eswatini="sz",u.Seychelles="sc",u.Syria="sy",u.Chad="td",u.Togo="tg",u.Thailand="th",u.Tajikistan="tj",u.Turkmenistan="tm",u.TimorLeste="tl",u.Tonga="to",u.TrinidadAndTobago="tt",u.Tunisia="tn",u.Turkey="tr",u.Tuvalu="tv",u.Tanzania="tz",u.Uganda="ug",u.Ukraine="ua",u.Uruguay="uy",u.UnitedStates="us",u.Uzbekistan="uz",u.VaticanCity="va",u.SaintVincentAndTheGrenadines="vc",u.Venezuela="ve",u.Vietnam="vn",u.Vanuatu="vu",u.Samoa="ws",u.Yemen="ye",u.SouthAfrica="za",u.Zambia="zm",u.Zimbabwe="zw",e.ExecutionMethod=void 0,(h=e.ExecutionMethod||(e.ExecutionMethod={})).GET="GET",h.POST="POST",h.PUT="PUT",h.PATCH="PATCH",h.DELETE="DELETE",h.OPTIONS="OPTIONS",e.ImageGravity=void 0,(f=e.ImageGravity||(e.ImageGravity={})).Center="center",f.Topleft="top-left",f.Top="top",f.Topright="top-right",f.Left="left",f.Right="right",f.Bottomleft="bottom-left",f.Bottom="bottom",f.Bottomright="bottom-right",e.ImageFormat=void 0,(v=e.ImageFormat||(e.ImageFormat={})).Jpg="jpg",v.Jpeg="jpeg",v.Gif="gif",v.Png="png",v.Webp="webp",e.Account=class extends i{constructor(e){super(e)}get(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}create(e,i,n,r){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "email"');if(void 0===n)throw new o('Missing required parameter: "password"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.email=i),void 0!==n&&(t.password=n),void 0!==r&&(t.name=r);const s=new URL(this.client.config.endpoint+"/account");return yield this.client.call("post",s,{"content-type":"application/json"},t)}))}updateEmail(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "email"');if(void 0===i)throw new o('Missing required parameter: "password"');const t={};void 0!==e&&(t.email=e),void 0!==i&&(t.password=i);const n=new URL(this.client.config.endpoint+"/account/email");return yield this.client.call("patch",n,{"content-type":"application/json"},t)}))}listIdentities(e){return t(this,void 0,void 0,(function*(){const t={};void 0!==e&&(t.queries=e);const i=new URL(this.client.config.endpoint+"/account/identities");return yield this.client.call("get",i,{"content-type":"application/json"},t)}))}deleteIdentity(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "identityId"');const t="/account/identities/{identityId}".replace("{identityId}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",i,{"content-type":"application/json"},{})}))}createJWT(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/jwt");return yield this.client.call("post",e,{"content-type":"application/json"},{})}))}listLogs(e){return t(this,void 0,void 0,(function*(){const t={};void 0!==e&&(t.queries=e);const i=new URL(this.client.config.endpoint+"/account/logs");return yield this.client.call("get",i,{"content-type":"application/json"},t)}))}updateMFA(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "mfa"');const t={};void 0!==e&&(t.mfa=e);const i=new URL(this.client.config.endpoint+"/account/mfa");return yield this.client.call("patch",i,{"content-type":"application/json"},t)}))}createMfaAuthenticator(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "type"');const t="/account/mfa/authenticators/{type}".replace("{type}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("post",i,{"content-type":"application/json"},{})}))}updateMfaAuthenticator(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "type"');if(void 0===i)throw new o('Missing required parameter: "otp"');const t="/account/mfa/authenticators/{type}".replace("{type}",e),n={};void 0!==i&&(n.otp=i);const r=new URL(this.client.config.endpoint+t);return yield this.client.call("put",r,{"content-type":"application/json"},n)}))}deleteMfaAuthenticator(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "type"');if(void 0===i)throw new o('Missing required parameter: "otp"');const t="/account/mfa/authenticators/{type}".replace("{type}",e),n={};void 0!==i&&(n.otp=i);const r=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",r,{"content-type":"application/json"},n)}))}createMfaChallenge(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "factor"');const t={};void 0!==e&&(t.factor=e);const i=new URL(this.client.config.endpoint+"/account/mfa/challenge");return yield this.client.call("post",i,{"content-type":"application/json"},t)}))}updateMfaChallenge(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "challengeId"');if(void 0===i)throw new o('Missing required parameter: "otp"');const t={};void 0!==e&&(t.challengeId=e),void 0!==i&&(t.otp=i);const n=new URL(this.client.config.endpoint+"/account/mfa/challenge");return yield this.client.call("put",n,{"content-type":"application/json"},t)}))}listMfaFactors(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/mfa/factors");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}getMfaRecoveryCodes(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/mfa/recovery-codes");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}createMfaRecoveryCodes(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/mfa/recovery-codes");return yield this.client.call("post",e,{"content-type":"application/json"},{})}))}updateMfaRecoveryCodes(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/mfa/recovery-codes");return yield this.client.call("patch",e,{"content-type":"application/json"},{})}))}updateName(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "name"');const t={};void 0!==e&&(t.name=e);const i=new URL(this.client.config.endpoint+"/account/name");return yield this.client.call("patch",i,{"content-type":"application/json"},t)}))}updatePassword(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "password"');const t={};void 0!==e&&(t.password=e),void 0!==i&&(t.oldPassword=i);const n=new URL(this.client.config.endpoint+"/account/password");return yield this.client.call("patch",n,{"content-type":"application/json"},t)}))}updatePhone(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "phone"');if(void 0===i)throw new o('Missing required parameter: "password"');const t={};void 0!==e&&(t.phone=e),void 0!==i&&(t.password=i);const n=new URL(this.client.config.endpoint+"/account/phone");return yield this.client.call("patch",n,{"content-type":"application/json"},t)}))}getPrefs(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/prefs");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}updatePrefs(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "prefs"');const t={};void 0!==e&&(t.prefs=e);const i=new URL(this.client.config.endpoint+"/account/prefs");return yield this.client.call("patch",i,{"content-type":"application/json"},t)}))}createRecovery(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "email"');if(void 0===i)throw new o('Missing required parameter: "url"');const t={};void 0!==e&&(t.email=e),void 0!==i&&(t.url=i);const n=new URL(this.client.config.endpoint+"/account/recovery");return yield this.client.call("post",n,{"content-type":"application/json"},t)}))}updateRecovery(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "secret"');if(void 0===n)throw new o('Missing required parameter: "password"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.secret=i),void 0!==n&&(t.password=n);const r=new URL(this.client.config.endpoint+"/account/recovery");return yield this.client.call("put",r,{"content-type":"application/json"},t)}))}listSessions(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/sessions");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}deleteSessions(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/sessions");return yield this.client.call("delete",e,{"content-type":"application/json"},{})}))}createAnonymousSession(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/sessions/anonymous");return yield this.client.call("post",e,{"content-type":"application/json"},{})}))}createEmailPasswordSession(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "email"');if(void 0===i)throw new o('Missing required parameter: "password"');const t={};void 0!==e&&(t.email=e),void 0!==i&&(t.password=i);const n=new URL(this.client.config.endpoint+"/account/sessions/email");return yield this.client.call("post",n,{"content-type":"application/json"},t)}))}updateMagicURLSession(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "secret"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.secret=i);const n=new URL(this.client.config.endpoint+"/account/sessions/magic-url");return yield this.client.call("put",n,{"content-type":"application/json"},t)}))}createOAuth2Session(e,t,n,r){if(void 0===e)throw new o('Missing required parameter: "provider"');const s="/account/sessions/oauth2/{provider}".replace("{provider}",e),a={};void 0!==t&&(a.success=t),void 0!==n&&(a.failure=n),void 0!==r&&(a.scopes=r);const c=new URL(this.client.config.endpoint+s);a.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(a)))c.searchParams.append(e,t);if("undefined"==typeof window||!(null===window||void 0===window?void 0:window.location))return c;window.location.href=c.toString()}updatePhoneSession(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "secret"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.secret=i);const n=new URL(this.client.config.endpoint+"/account/sessions/phone");return yield this.client.call("put",n,{"content-type":"application/json"},t)}))}createSession(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "secret"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.secret=i);const n=new URL(this.client.config.endpoint+"/account/sessions/token");return yield this.client.call("post",n,{"content-type":"application/json"},t)}))}getSession(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "sessionId"');const t="/account/sessions/{sessionId}".replace("{sessionId}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("get",i,{"content-type":"application/json"},{})}))}updateSession(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "sessionId"');const t="/account/sessions/{sessionId}".replace("{sessionId}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("patch",i,{"content-type":"application/json"},{})}))}deleteSession(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "sessionId"');const t="/account/sessions/{sessionId}".replace("{sessionId}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",i,{"content-type":"application/json"},{})}))}updateStatus(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/status");return yield this.client.call("patch",e,{"content-type":"application/json"},{})}))}createPushTarget(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "targetId"');if(void 0===i)throw new o('Missing required parameter: "identifier"');const t={};void 0!==e&&(t.targetId=e),void 0!==i&&(t.identifier=i),void 0!==n&&(t.providerId=n);const r=new URL(this.client.config.endpoint+"/account/targets/push");return yield this.client.call("post",r,{"content-type":"application/json"},t)}))}updatePushTarget(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "targetId"');if(void 0===i)throw new o('Missing required parameter: "identifier"');const t="/account/targets/{targetId}/push".replace("{targetId}",e),n={};void 0!==i&&(n.identifier=i);const r=new URL(this.client.config.endpoint+t);return yield this.client.call("put",r,{"content-type":"application/json"},n)}))}deletePushTarget(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "targetId"');const t="/account/targets/{targetId}/push".replace("{targetId}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",i,{"content-type":"application/json"},{})}))}createEmailToken(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "email"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.email=i),void 0!==n&&(t.phrase=n);const r=new URL(this.client.config.endpoint+"/account/tokens/email");return yield this.client.call("post",r,{"content-type":"application/json"},t)}))}createMagicURLToken(e,i,n,r){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "email"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.email=i),void 0!==n&&(t.url=n),void 0!==r&&(t.phrase=r);const s=new URL(this.client.config.endpoint+"/account/tokens/magic-url");return yield this.client.call("post",s,{"content-type":"application/json"},t)}))}createOAuth2Token(e,t,n,r){if(void 0===e)throw new o('Missing required parameter: "provider"');const s="/account/tokens/oauth2/{provider}".replace("{provider}",e),a={};void 0!==t&&(a.success=t),void 0!==n&&(a.failure=n),void 0!==r&&(a.scopes=r);const c=new URL(this.client.config.endpoint+s);a.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(a)))c.searchParams.append(e,t);if("undefined"==typeof window||!(null===window||void 0===window?void 0:window.location))return c;window.location.href=c.toString()}createPhoneToken(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "phone"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.phone=i);const n=new URL(this.client.config.endpoint+"/account/tokens/phone");return yield this.client.call("post",n,{"content-type":"application/json"},t)}))}createVerification(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "url"');const t={};void 0!==e&&(t.url=e);const i=new URL(this.client.config.endpoint+"/account/verification");return yield this.client.call("post",i,{"content-type":"application/json"},t)}))}updateVerification(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "secret"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.secret=i);const n=new URL(this.client.config.endpoint+"/account/verification");return yield this.client.call("put",n,{"content-type":"application/json"},t)}))}createPhoneVerification(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/account/verification/phone");return yield this.client.call("post",e,{"content-type":"application/json"},{})}))}updatePhoneVerification(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "userId"');if(void 0===i)throw new o('Missing required parameter: "secret"');const t={};void 0!==e&&(t.userId=e),void 0!==i&&(t.secret=i);const n=new URL(this.client.config.endpoint+"/account/verification/phone");return yield this.client.call("put",n,{"content-type":"application/json"},t)}))}},e.AppwriteException=o,e.Avatars=class extends i{constructor(e){super(e)}getBrowser(e,t,n,r){if(void 0===e)throw new o('Missing required parameter: "code"');const s="/avatars/browsers/{code}".replace("{code}",e),a={};void 0!==t&&(a.width=t),void 0!==n&&(a.height=n),void 0!==r&&(a.quality=r);const c=new URL(this.client.config.endpoint+s);a.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(a)))c.searchParams.append(e,t);return c}getCreditCard(e,t,n,r){if(void 0===e)throw new o('Missing required parameter: "code"');const s="/avatars/credit-cards/{code}".replace("{code}",e),a={};void 0!==t&&(a.width=t),void 0!==n&&(a.height=n),void 0!==r&&(a.quality=r);const c=new URL(this.client.config.endpoint+s);a.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(a)))c.searchParams.append(e,t);return c}getFavicon(e){if(void 0===e)throw new o('Missing required parameter: "url"');const t={};void 0!==e&&(t.url=e);const n=new URL(this.client.config.endpoint+"/avatars/favicon");t.project=this.client.config.project;for(const[e,o]of Object.entries(i.flatten(t)))n.searchParams.append(e,o);return n}getFlag(e,t,n,r){if(void 0===e)throw new o('Missing required parameter: "code"');const s="/avatars/flags/{code}".replace("{code}",e),a={};void 0!==t&&(a.width=t),void 0!==n&&(a.height=n),void 0!==r&&(a.quality=r);const c=new URL(this.client.config.endpoint+s);a.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(a)))c.searchParams.append(e,t);return c}getImage(e,t,n){if(void 0===e)throw new o('Missing required parameter: "url"');const r={};void 0!==e&&(r.url=e),void 0!==t&&(r.width=t),void 0!==n&&(r.height=n);const s=new URL(this.client.config.endpoint+"/avatars/image");r.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(r)))s.searchParams.append(e,t);return s}getInitials(e,t,n,o){const r={};void 0!==e&&(r.name=e),void 0!==t&&(r.width=t),void 0!==n&&(r.height=n),void 0!==o&&(r.background=o);const s=new URL(this.client.config.endpoint+"/avatars/initials");r.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(r)))s.searchParams.append(e,t);return s}getQR(e,t,n,r){if(void 0===e)throw new o('Missing required parameter: "text"');const s={};void 0!==e&&(s.text=e),void 0!==t&&(s.size=t),void 0!==n&&(s.margin=n),void 0!==r&&(s.download=r);const a=new URL(this.client.config.endpoint+"/avatars/qr");s.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(s)))a.searchParams.append(e,t);return a}},e.Client=class{constructor(){this.config={endpoint:"https://cloud.appwrite.io/v1",endpointRealtime:"",project:"",jwt:"",locale:"",session:""},this.headers={"x-sdk-name":"Web","x-sdk-platform":"client","x-sdk-language":"web","x-sdk-version":"15.0.0","X-Appwrite-Response-Format":"1.5.0"},this.realtime={socket:void 0,timeout:void 0,url:"",channels:new Set,subscriptions:new Map,subscriptionsCounter:0,reconnect:!0,reconnectAttempts:0,lastMessage:void 0,connect:()=>{clearTimeout(this.realtime.timeout),this.realtime.timeout=null===window||void 0===window?void 0: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}},createSocket:()=>{var e,t,i;if(this.realtime.channels.size<1)return this.realtime.reconnect=!1,void(null===(e=this.realtime.socket)||void 0===e||e.close());const n=new URLSearchParams;n.set("project",this.config.project),this.realtime.channels.forEach((e=>{n.append("channels[]",e)}));const o=this.config.endpointRealtime+"/realtime?"+n.toString();(o!==this.realtime.url||!this.realtime.socket||(null===(t=this.realtime.socket)||void 0===t?void 0:t.readyState)>WebSocket.OPEN)&&(this.realtime.socket&&(null===(i=this.realtime.socket)||void 0===i?void 0:i.readyState)<WebSocket.CLOSING&&(this.realtime.reconnect=!1,this.realtime.socket.close()),this.realtime.url=o,this.realtime.socket=new WebSocket(o),this.realtime.socket.addEventListener("message",this.realtime.onMessage),this.realtime.socket.addEventListener("open",(e=>{this.realtime.reconnectAttempts=0})),this.realtime.socket.addEventListener("close",(e=>{var t,i,n;if(!this.realtime.reconnect||"error"===(null===(i=null===(t=this.realtime)||void 0===t?void 0:t.lastMessage)||void 0===i?void 0:i.type)&&1008===(null===(n=this.realtime)||void 0===n?void 0:n.lastMessage.data).code)return void(this.realtime.reconnect=!0);const o=this.realtime.getTimeout();console.error(`Realtime got disconnected. Reconnect will be attempted in ${o/1e3} seconds.`,e.reason),setTimeout((()=>{this.realtime.reconnectAttempts++,this.realtime.createSocket()}),o)})))},onMessage:e=>{var t,i;try{const n=JSON.parse(e.data);switch(this.realtime.lastMessage=n,n.type){case"connected":const e=JSON.parse(null!==(t=window.localStorage.getItem("cookieFallback"))&&void 0!==t?t:"{}"),o=null==e?void 0:e[`a_session_${this.config.project}`],r=n.data;o&&!r.user&&(null===(i=this.realtime.socket)||void 0===i||i.send(JSON.stringify({type:"authentication",data:{session:o}})));break;case"event":let s=n.data;if(null==s?void 0:s.channels){if(!s.channels.some((e=>this.realtime.channels.has(e))))return;this.realtime.subscriptions.forEach((e=>{s.channels.some((t=>e.channels.includes(t)))&&setTimeout((()=>e.callback(s)))}))}break;case"error":throw n.data}}catch(e){console.error(e)}},cleanUp:e=>{this.realtime.channels.forEach((t=>{if(e.includes(t)){Array.from(this.realtime.subscriptions).some((([e,i])=>i.channels.includes(t)))||this.realtime.channels.delete(t)}}))}}}setEndpoint(e){return this.config.endpoint=e,this.config.endpointRealtime=this.config.endpointRealtime||this.config.endpoint.replace("https://","wss://").replace("http://","ws://"),this}setEndpointRealtime(e){return this.config.endpointRealtime=e,this}setProject(e){return this.headers["X-Appwrite-Project"]=e,this.config.project=e,this}setJWT(e){return this.headers["X-Appwrite-JWT"]=e,this.config.jwt=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}subscribe(e,t){let i="string"==typeof e?[e]:e;i.forEach((e=>this.realtime.channels.add(e)));const n=this.realtime.subscriptionsCounter++;return this.realtime.subscriptions.set(n,{channels:i,callback:t}),this.realtime.connect(),()=>{this.realtime.subscriptions.delete(n),this.realtime.cleanUp(i),this.realtime.connect()}}call(e,n,r={},s={}){var a;return t(this,void 0,void 0,(function*(){e=e.toUpperCase(),r=Object.assign({},this.headers,r);let t={method:e,headers:r,credentials:"include"};if("undefined"!=typeof window&&window.localStorage){const e=window.localStorage.getItem("cookieFallback");e&&(r["X-Fallback-Cookies"]=e)}if("GET"===e)for(const[e,t]of Object.entries(i.flatten(s)))n.searchParams.append(e,t);else switch(r["content-type"]){case"application/json":t.body=JSON.stringify(s);break;case"multipart/form-data":let e=new FormData;for(const t in s)Array.isArray(s[t])?s[t].forEach((i=>{e.append(t+"[]",i)})):e.append(t,s[t]);t.body=e,delete r["content-type"]}try{let e=null;const i=yield fetch(n.toString(),t);if(e=(null===(a=i.headers.get("content-type"))||void 0===a?void 0:a.includes("application/json"))?yield i.json():{message:yield i.text()},400<=i.status)throw new o(null==e?void 0:e.message,i.status,null==e?void 0:e.type,e);const r=i.headers.get("X-Fallback-Cookies");return"undefined"!=typeof window&&window.localStorage&&r&&(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",r)),e}catch(e){if(e instanceof o)throw e;throw new o(e.message)}}))}},e.Databases=class extends i{constructor(e){super(e)}listDocuments(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "databaseId"');if(void 0===i)throw new o('Missing required parameter: "collectionId"');const t="/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",e).replace("{collectionId}",i),r={};void 0!==n&&(r.queries=n);const s=new URL(this.client.config.endpoint+t);return yield this.client.call("get",s,{"content-type":"application/json"},r)}))}createDocument(e,i,n,r,s){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "databaseId"');if(void 0===i)throw new o('Missing required parameter: "collectionId"');if(void 0===n)throw new o('Missing required parameter: "documentId"');if(void 0===r)throw new o('Missing required parameter: "data"');const t="/databases/{databaseId}/collections/{collectionId}/documents".replace("{databaseId}",e).replace("{collectionId}",i),a={};void 0!==n&&(a.documentId=n),void 0!==r&&(a.data=r),void 0!==s&&(a.permissions=s);const c=new URL(this.client.config.endpoint+t);return yield this.client.call("post",c,{"content-type":"application/json"},a)}))}getDocument(e,i,n,r){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "databaseId"');if(void 0===i)throw new o('Missing required parameter: "collectionId"');if(void 0===n)throw new o('Missing required parameter: "documentId"');const t="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",e).replace("{collectionId}",i).replace("{documentId}",n),s={};void 0!==r&&(s.queries=r);const a=new URL(this.client.config.endpoint+t);return yield this.client.call("get",a,{"content-type":"application/json"},s)}))}updateDocument(e,i,n,r,s){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "databaseId"');if(void 0===i)throw new o('Missing required parameter: "collectionId"');if(void 0===n)throw new o('Missing required parameter: "documentId"');const t="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",e).replace("{collectionId}",i).replace("{documentId}",n),a={};void 0!==r&&(a.data=r),void 0!==s&&(a.permissions=s);const c=new URL(this.client.config.endpoint+t);return yield this.client.call("patch",c,{"content-type":"application/json"},a)}))}deleteDocument(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "databaseId"');if(void 0===i)throw new o('Missing required parameter: "collectionId"');if(void 0===n)throw new o('Missing required parameter: "documentId"');const t="/databases/{databaseId}/collections/{collectionId}/documents/{documentId}".replace("{databaseId}",e).replace("{collectionId}",i).replace("{documentId}",n),r=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",r,{"content-type":"application/json"},{})}))}},e.Functions=class extends i{constructor(e){super(e)}listExecutions(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "functionId"');const t="/functions/{functionId}/executions".replace("{functionId}",e),r={};void 0!==i&&(r.queries=i),void 0!==n&&(r.search=n);const s=new URL(this.client.config.endpoint+t);return yield this.client.call("get",s,{"content-type":"application/json"},r)}))}createExecution(e,i,n,r,s,a){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "functionId"');const t="/functions/{functionId}/executions".replace("{functionId}",e),c={};void 0!==i&&(c.body=i),void 0!==n&&(c.async=n),void 0!==r&&(c.path=r),void 0!==s&&(c.method=s),void 0!==a&&(c.headers=a);const d=new URL(this.client.config.endpoint+t);return yield this.client.call("post",d,{"content-type":"application/json"},c)}))}getExecution(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "functionId"');if(void 0===i)throw new o('Missing required parameter: "executionId"');const t="/functions/{functionId}/executions/{executionId}".replace("{functionId}",e).replace("{executionId}",i),n=new URL(this.client.config.endpoint+t);return yield this.client.call("get",n,{"content-type":"application/json"},{})}))}},e.Graphql=class extends i{constructor(e){super(e)}query(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "query"');const t={};void 0!==e&&(t.query=e);const i=new URL(this.client.config.endpoint+"/graphql");return yield this.client.call("post",i,{"x-sdk-graphql":"true","content-type":"application/json"},t)}))}mutation(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "query"');const t={};void 0!==e&&(t.query=e);const i=new URL(this.client.config.endpoint+"/graphql/mutation");return yield this.client.call("post",i,{"x-sdk-graphql":"true","content-type":"application/json"},t)}))}},e.ID=m,e.Locale=class extends i{constructor(e){super(e)}get(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/locale");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}listCodes(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/locale/codes");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}listContinents(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/locale/continents");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}listCountries(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/locale/countries");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}listCountriesEU(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/locale/countries/eu");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}listCountriesPhones(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/locale/countries/phones");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}listCurrencies(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/locale/currencies");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}listLanguages(){return t(this,void 0,void 0,(function*(){const e=new URL(this.client.config.endpoint+"/locale/languages");return yield this.client.call("get",e,{"content-type":"application/json"},{})}))}},e.Messaging=class extends i{constructor(e){super(e)}createSubscriber(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "topicId"');if(void 0===i)throw new o('Missing required parameter: "subscriberId"');if(void 0===n)throw new o('Missing required parameter: "targetId"');const t="/messaging/topics/{topicId}/subscribers".replace("{topicId}",e),r={};void 0!==i&&(r.subscriberId=i),void 0!==n&&(r.targetId=n);const s=new URL(this.client.config.endpoint+t);return yield this.client.call("post",s,{"content-type":"application/json"},r)}))}deleteSubscriber(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "topicId"');if(void 0===i)throw new o('Missing required parameter: "subscriberId"');const t="/messaging/topics/{topicId}/subscribers/{subscriberId}".replace("{topicId}",e).replace("{subscriberId}",i),n=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",n,{"content-type":"application/json"},{})}))}},e.Permission=r,e.Query=n,e.Role=class{static any(){return"any"}static user(e,t=""){return""===t?`user:${e}`:`user:${e}/${t}`}static users(e=""){return""===e?"users":`users/${e}`}static guests(){return"guests"}static team(e,t=""){return""===t?`team:${e}`:`team:${e}/${t}`}static member(e){return`member:${e}`}static label(e){return`label:${e}`}},e.Storage=class extends i{constructor(e){super(e)}listFiles(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "bucketId"');const t="/storage/buckets/{bucketId}/files".replace("{bucketId}",e),r={};void 0!==i&&(r.queries=i),void 0!==n&&(r.search=n);const s=new URL(this.client.config.endpoint+t);return yield this.client.call("get",s,{"content-type":"application/json"},r)}))}createFile(e,n,r,s,a=e=>{}){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "bucketId"');if(void 0===n)throw new o('Missing required parameter: "fileId"');if(void 0===r)throw new o('Missing required parameter: "file"');const t="/storage/buckets/{bucketId}/files".replace("{bucketId}",e),c={};void 0!==n&&(c.fileId=n),void 0!==r&&(c.file=r),void 0!==s&&(c.permissions=s);const d=new URL(this.client.config.endpoint+t);if(!(r instanceof File))throw new o('Parameter "file" has to be a File.');const l=r.size;if(l<=i.CHUNK_SIZE)return yield this.client.call("post",d,{"content-type":"multipart/form-data"},c);const p={"content-type":"multipart/form-data"};let u,h=0;if("unique()"!=n)try{u=yield this.client.call("GET",new URL(this.client.config.endpoint+t+"/"+n),p),h=u.chunksUploaded*i.CHUNK_SIZE}catch(e){}for(;h<l;){let e=Math.min(h+i.CHUNK_SIZE-1,l-1);p["content-range"]="bytes "+h+"-"+e+"/"+l,u&&u.$id&&(p["x-appwrite-id"]=u.$id);const t=r.slice(h,e+1);c.file=new File([t],r.name),u=yield this.client.call("post",d,p,c),a&&a({$id:u.$id,progress:h/l*100,sizeUploaded:h,chunksTotal:u.chunksTotal,chunksUploaded:u.chunksUploaded}),h+=i.CHUNK_SIZE}return u}))}getFile(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "bucketId"');if(void 0===i)throw new o('Missing required parameter: "fileId"');const t="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",e).replace("{fileId}",i),n=new URL(this.client.config.endpoint+t);return yield this.client.call("get",n,{"content-type":"application/json"},{})}))}updateFile(e,i,n,r){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "bucketId"');if(void 0===i)throw new o('Missing required parameter: "fileId"');const t="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",e).replace("{fileId}",i),s={};void 0!==n&&(s.name=n),void 0!==r&&(s.permissions=r);const a=new URL(this.client.config.endpoint+t);return yield this.client.call("put",a,{"content-type":"application/json"},s)}))}deleteFile(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "bucketId"');if(void 0===i)throw new o('Missing required parameter: "fileId"');const t="/storage/buckets/{bucketId}/files/{fileId}".replace("{bucketId}",e).replace("{fileId}",i),n=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",n,{"content-type":"application/json"},{})}))}getFileDownload(e,t){if(void 0===e)throw new o('Missing required parameter: "bucketId"');if(void 0===t)throw new o('Missing required parameter: "fileId"');const n="/storage/buckets/{bucketId}/files/{fileId}/download".replace("{bucketId}",e).replace("{fileId}",t),r={},s=new URL(this.client.config.endpoint+n);r.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(r)))s.searchParams.append(e,t);return s}getFilePreview(e,t,n,r,s,a,c,d,l,p,u,h,f){if(void 0===e)throw new o('Missing required parameter: "bucketId"');if(void 0===t)throw new o('Missing required parameter: "fileId"');const v="/storage/buckets/{bucketId}/files/{fileId}/preview".replace("{bucketId}",e).replace("{fileId}",t),m={};void 0!==n&&(m.width=n),void 0!==r&&(m.height=r),void 0!==s&&(m.gravity=s),void 0!==a&&(m.quality=a),void 0!==c&&(m.borderWidth=c),void 0!==d&&(m.borderColor=d),void 0!==l&&(m.borderRadius=l),void 0!==p&&(m.opacity=p),void 0!==u&&(m.rotation=u),void 0!==h&&(m.background=h),void 0!==f&&(m.output=f);const g=new URL(this.client.config.endpoint+v);m.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(m)))g.searchParams.append(e,t);return g}getFileView(e,t){if(void 0===e)throw new o('Missing required parameter: "bucketId"');if(void 0===t)throw new o('Missing required parameter: "fileId"');const n="/storage/buckets/{bucketId}/files/{fileId}/view".replace("{bucketId}",e).replace("{fileId}",t),r={},s=new URL(this.client.config.endpoint+n);r.project=this.client.config.project;for(const[e,t]of Object.entries(i.flatten(r)))s.searchParams.append(e,t);return s}},e.Teams=class extends i{constructor(e){super(e)}list(e,i){return t(this,void 0,void 0,(function*(){const t={};void 0!==e&&(t.queries=e),void 0!==i&&(t.search=i);const n=new URL(this.client.config.endpoint+"/teams");return yield this.client.call("get",n,{"content-type":"application/json"},t)}))}create(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');if(void 0===i)throw new o('Missing required parameter: "name"');const t={};void 0!==e&&(t.teamId=e),void 0!==i&&(t.name=i),void 0!==n&&(t.roles=n);const r=new URL(this.client.config.endpoint+"/teams");return yield this.client.call("post",r,{"content-type":"application/json"},t)}))}get(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');const t="/teams/{teamId}".replace("{teamId}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("get",i,{"content-type":"application/json"},{})}))}updateName(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');if(void 0===i)throw new o('Missing required parameter: "name"');const t="/teams/{teamId}".replace("{teamId}",e),n={};void 0!==i&&(n.name=i);const r=new URL(this.client.config.endpoint+t);return yield this.client.call("put",r,{"content-type":"application/json"},n)}))}delete(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');const t="/teams/{teamId}".replace("{teamId}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",i,{"content-type":"application/json"},{})}))}listMemberships(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');const t="/teams/{teamId}/memberships".replace("{teamId}",e),r={};void 0!==i&&(r.queries=i),void 0!==n&&(r.search=n);const s=new URL(this.client.config.endpoint+t);return yield this.client.call("get",s,{"content-type":"application/json"},r)}))}createMembership(e,i,n,r,s,a,c){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');if(void 0===i)throw new o('Missing required parameter: "roles"');const t="/teams/{teamId}/memberships".replace("{teamId}",e),d={};void 0!==n&&(d.email=n),void 0!==r&&(d.userId=r),void 0!==s&&(d.phone=s),void 0!==i&&(d.roles=i),void 0!==a&&(d.url=a),void 0!==c&&(d.name=c);const l=new URL(this.client.config.endpoint+t);return yield this.client.call("post",l,{"content-type":"application/json"},d)}))}getMembership(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');if(void 0===i)throw new o('Missing required parameter: "membershipId"');const t="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",e).replace("{membershipId}",i),n=new URL(this.client.config.endpoint+t);return yield this.client.call("get",n,{"content-type":"application/json"},{})}))}updateMembership(e,i,n){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');if(void 0===i)throw new o('Missing required parameter: "membershipId"');if(void 0===n)throw new o('Missing required parameter: "roles"');const t="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",e).replace("{membershipId}",i),r={};void 0!==n&&(r.roles=n);const s=new URL(this.client.config.endpoint+t);return yield this.client.call("patch",s,{"content-type":"application/json"},r)}))}deleteMembership(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');if(void 0===i)throw new o('Missing required parameter: "membershipId"');const t="/teams/{teamId}/memberships/{membershipId}".replace("{teamId}",e).replace("{membershipId}",i),n=new URL(this.client.config.endpoint+t);return yield this.client.call("delete",n,{"content-type":"application/json"},{})}))}updateMembershipStatus(e,i,n,r){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');if(void 0===i)throw new o('Missing required parameter: "membershipId"');if(void 0===n)throw new o('Missing required parameter: "userId"');if(void 0===r)throw new o('Missing required parameter: "secret"');const t="/teams/{teamId}/memberships/{membershipId}/status".replace("{teamId}",e).replace("{membershipId}",i),s={};void 0!==n&&(s.userId=n),void 0!==r&&(s.secret=r);const a=new URL(this.client.config.endpoint+t);return yield this.client.call("patch",a,{"content-type":"application/json"},s)}))}getPrefs(e){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');const t="/teams/{teamId}/prefs".replace("{teamId}",e),i=new URL(this.client.config.endpoint+t);return yield this.client.call("get",i,{"content-type":"application/json"},{})}))}updatePrefs(e,i){return t(this,void 0,void 0,(function*(){if(void 0===e)throw new o('Missing required parameter: "teamId"');if(void 0===i)throw new o('Missing required parameter: "prefs"');const t="/teams/{teamId}/prefs".replace("{teamId}",e),n={};void 0!==i&&(n.prefs=i);const r=new URL(this.client.config.endpoint+t);return yield this.client.call("put",r,{"content-type":"application/json"},n)}))}},Object.defineProperty(e,"__esModule",{value:!0})}(this.Appwrite=this.Appwrite||{});
//# sourceMappingURL=/sm/0709de8cf707c2934a1bcff459079beef0d253996381674c36360246dfd6dacf.map