1import{P as _}from"./vendor-supabase-postgrest-js-DkQ4Kc3X.js";import{R as g}from"./vendor-supabase-realtime-js-D5xTsTm9.js";import{H as p,n as m}from"./vendor-supabase-node-fetch-DEdSQ7Yg.js";import{A as T}from"./vendor-supabase-auth-js-EYZZg6KD.js";import{F as v}from"./vendor-supabase-functions-js-DtAiOJE2.js";import{S as O}from"./vendor-supabase-storage-js-DjYuKfbi.js";const A="2.50.0";let d="";typeof Deno<"u"?d="deno":typeof document<"u"?d="web":typeof navigator<"u"&&navigator.product==="ReactNative"?d="react-native":d="node";const w={"X-Client-Info":`supabase-js-${d}/${A}`},U={headers:w},y={schema:"public"},E={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},S={};var k=function(o,e,t,n){function l(a){return a instanceof t?a:new t(function(r){r(a)})}return new(t||(t=Promise))(function(a,r){function h(s){try{c(n.next(s))}catch(i){r(i)}}function u(s){try{c(n.throw(s))}catch(i){r(i)}}function c(s){s.done?a(s.value):l(s.value).then(h,u)}c((n=n.apply(o,e||[])).next())})};const C=o=>{let e;return o?e=o:typeof fetch>"u"?e=m:e=fetch,(...t)=>e(...t)},j=()=>typeof Headers>"u"?p:Headers,L=(o,e,t)=>{const n=C(t),l=j();return(a,r)=>k(void 0,void 0,void 0,function*(){var h;const u=(h=yield e())!==null&&h!==void 0?h:o;let c=new l(r==null?void 0:r.headers);return c.has("apikey")||c.set("apikey",o),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(a,Object.assign(Object.assign({},r),{headers:c}))})};var D=function(o,e,t,n){function l(a){return a instanceof t?a:new t(function(r){r(a)})}return new(t||(t=Promise))(function(a,r){function h(s){try{c(n.next(s))}catch(i){r(i)}}function u(s){try{c(n.throw(s))}catch(i){r(i)}}function c(s){s.done?a(s.value):l(s.value).then(h,u)}c((n=n.apply(o,e||[])).next())})};function R(o){return o.endsWith("/")?o:o+"/"}function F(o,e){var t,n;const{db:l,auth:a,realtime:r,global:h}=o,{db:u,auth:c,realtime:s,global:i}=e,f={db:Object.assign(Object.assign({},u),l),auth:Object.assign(Object.assign({},c),a),realtime:Object.assign(Object.assign({},s),r),global:Object.assign(Object.assign(Object.assign({},i),h),{headers:Object.assign(Object.assign({},(t=i==null?void 0:i.headers)!==null&&t!==void 0?t:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),accessToken:()=>D(this,void 0,void 0,function*(){return""})};return o.accessToken?f.accessToken=o.accessToken:delete f.accessToken,f}class I extends T{constructor(e){super(e)}}var N=function(o,e,t,n){function l(a){return a instanceof t?a:new t(function(r){r(a)})}return new(t||(t=Promise))(function(a,r){function h(s){try{c(n.next(s))}catch(i){r(i)}}function u(s){try{c(n.throw(s))}catch(i){r(i)}}function c(s){s.done?a(s.value):l(s.value).then(h,u)}c((n=n.apply(o,e||[])).next())})};class H{constructor(e,t,n){var l,a,r;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const h=R(e),u=new URL(h);this.realtimeUrl=new URL("realtime/v1",u),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",u),this.storageUrl=new URL("storage/v1",u),this.functionsUrl=new URL("functions/v1",u);const c=`sb-${u.hostname.split(".")[0]}-auth-token`,s={db:y,realtime:S,auth:Object.assign(Object.assign({},E),{storageKey:c}),global:U},i=F(n??{},s);this.storageKey=(l=i.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(a=i.global.headers)!==null&&a!==void 0?a:{},i.accessToken?(this.accessToken=i.accessToken,this.auth=new Proxy({},{get:(f,b)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((r=i.auth)!==null&&r!==void 0?r:{},this.headers,i.global.fetch),this.fetch=L(t,this._getAccessToken.bind(this),i.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},i.realtime)),this.rest=new _(new URL("rest/v1",u).href,{headers:this.headers,schema:i.db.schema,fetch:this.fetch}),i.accessToken||this._listenForAuthEvents()}get functions(){return new v(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}get storage(){return new O(this.storageUrl.href,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={}){return this.rest.rpc(e,t,n)}
1channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return N(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();const{data:n}=yield this.auth.getSession();return(t=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:null})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:l,storageKey:a,flowType:r,lock:h,debug:u},c,s){const i={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new I({url:this.authUrl.href,headers:Object.assign(Object.assign({},i),c),storageKey:a,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:l,flowType:r,lock:h,debug:u,fetch:s,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new g(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,n)=>{this._handleTokenChanged(t,"CLIENT",n==null?void 0:n.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?this.changedAccessToken=n:e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const P=(o,e,t)=>new H(o,e,t);export{P as c}; 2//# sourceMappingURL=vendor-supabase-supabase-js-Bt3vyUv1.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.