Plugin Directory

Changeset 3244882


Ignore:
Timestamp:
02/22/2025 01:25:10 PM (14 months ago)
Author:
xmic
Message:

Update to version 1.12.0 from GitHub

Location:
timestamps
Files:
228 edited
1 copied

Legend:

Unmodified
Added
Removed
  • timestamps/tags/1.12.0/assets/js/timestamp-post/editor/plugins/timestamp-post.js

    r3048002 r3244882  
    4040
    4141    const postId = useSelect((select) => select('core/editor').getCurrentPostId(), []);
     42    const postPermalink = useSelect((select) => select('core/editor').getPermalink(), []);
    4243
    4344    // Check if it is a new post by checking if the post status is 'auto-draft'.
     
    5657        try {
    5758            const url = `${PUBLIC_API_URL}/create-certificate`;
     59            const { userAgent } = navigator;
    5860
    5961            const headers = new Headers({
    6062                Authorization: `Bearer ${apiKey}`,
     63                'User-Agent': userAgent,
     64                'X-ScoreDetect-Referer': `${postPermalink}`,
    6165            });
    6266
  • timestamps/tags/1.12.0/dist/js/timestamp-post.asset.php

    r3129719 r3244882  
    1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '178adef6765c05b70b7a');
     1<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '13b70cf2d524d8b92a21');
  • timestamps/tags/1.12.0/dist/js/timestamp-post.js

    r3129719 r3244882  
    1 !function(){"use strict";var e={907:function(e,t,s){s.r(t),s.d(t,{Headers:function(){return n},Request:function(){return o},Response:function(){return a},fetch:function(){return i}});var r=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof s.g)return s.g;throw new Error("unable to locate global object")}();const i=r.fetch;t.default=r.fetch.bind(r);const n=r.Headers,o=r.Request,a=r.Response}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,s),n.exports}s.m=e,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},function(){var e,t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};s.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var n=Object.create(null);s.r(n);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((function(e){o[e]=function(){return r[e]}}));return o.default=function(){return r},s.d(n,o),n}}(),s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce((function(t,r){return s.f[r](e,t),t}),[]))},s.u=function(e){return"js/"+e+".7e61fd99a8c41da8c843.chunk.js"},s.miniCssF=function(e){},s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={},t="timestamps-plugin:";s.l=function(r,i,n,o){if(e[r])e[r].push(i);else{var a,c;if(void 0!==n)for(var h=document.getElementsByTagName("script"),l=0;l<h.length;l++){var u=h[l];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+n){a=u;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",t+n),a.src=r),e[r]=[i];var d=function(t,s){a.onerror=a.onload=null,clearTimeout(f);var i=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((function(e){return e(s)})),t)return t(s)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}}}(),s.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e+"../"}(),function(){var e={948:0};s.f.j=function(t,r){var i=s.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise((function(s,r){i=e[t]=[s,r]}));r.push(i[2]=n);var o=s.p+s.u(t),a=new Error;s.l(o,(function(r){if(s.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",a.name="ChunkLoadError",a.type=n,a.request=o,i[1](a)}}),"chunk-"+t,t)}};var t=function(t,r){var i,n,o=r[0],a=r[1],c=r[2],h=0;if(o.some((function(t){return 0!==e[t]}))){for(i in a)s.o(a,i)&&(s.m[i]=a[i]);if(c)c(s)}for(t&&t(r);h<o.length;h++)n=o[h],s.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=self.webpackChunktimestamps_plugin=self.webpackChunktimestamps_plugin||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}(),function(){var e=window.wp.plugins,t=window.wp.element,r=window.wp.components,i=window.wp.data,n=window.wp.editPost,o=window.wp.i18n,a=window.wp.apiFetch,c=s.n(a);class h extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class l extends h{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class u extends h{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class d extends h{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var f=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class p{constructor(e,{headers:t={},customFetch:r}={}){this.url=e,this.headers=t,this.fetch=(e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)})(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s;return f(this,void 0,void 0,(function*(){try{const{headers:r,method:i,body:n}=t;let o,a={};n&&(r&&!Object.prototype.hasOwnProperty.call(r,"Content-Type")||!r)&&("undefined"!==typeof Blob&&n instanceof Blob||n instanceof ArrayBuffer?(a["Content-Type"]="application/octet-stream",o=n):"string"===typeof n?(a["Content-Type"]="text/plain",o=n):"undefined"!==typeof FormData&&n instanceof FormData?o=n:(a["Content-Type"]="application/json",o=JSON.stringify(n)));const c=yield this.fetch(`${this.url}/${e}`,{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},a),this.headers),r),body:o}).catch((e=>{throw new l(e)})),h=c.headers.get("x-relay-error");if(h&&"true"===h)throw new u(c);if(!c.ok)throw new d(c);let f,p=(null!==(s=c.headers.get("Content-Type"))&&void 0!==s?s:"text/plain").split(";")[0].trim();return f="application/json"===p?yield c.json():"application/octet-stream"===p?yield c.blob():"multipart/form-data"===p?yield c.formData():yield c.text(),{data:f,error:null}}catch(e){return{data:null,error:e}}}))}}var g=s(907);class v extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}class m{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:"undefined"===typeof fetch?this.fetch=g.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let s=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then((async e=>{var t,s,r;let i=null,n=null,o=null,a=e.status,c=e.statusText;if(e.ok){if("HEAD"!==this.method){const t=await e.text();""===t||(n="text/csv"===this.headers.Accept||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}const r=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),h=null===(s=e.headers.get("content-range"))||void 0===s?void 0:s.split("/");r&&h&&h.length>1&&(o=parseInt(h[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(n)&&(n.length>1?(i={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,o=null,a=406,c="Not Acceptable"):n=1===n.length?n[0]:null)}else{const t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(n=[],i=null,a=200,c="OK")}catch(s){404===e.status&&""===t?(a=204,c="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null===(r=null===i||void 0===i?void 0:i.details)||void 0===r?void 0:r.includes("0 rows"))&&(i=null,a=200,c="OK"),i&&this.shouldThrowOnError)throw new v(i)}return{error:i,data:n,count:o,status:a,statusText:c}}));return this.shouldThrowOnError||(s=s.catch((e=>{var t,s,r;return{error:{message:`${null!==(t=null===e||void 0===e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null===e||void 0===e?void 0:e.message}`,details:`${null!==(s=null===e||void 0===e?void 0:e.stack)&&void 0!==s?s:""}`,hint:"",code:`${null!==(r=null===e||void 0===e?void 0:e.code)&&void 0!==r?r:""}`},data:null,count:null,status:0,statusText:""}}))),s.then(e,t)}}class y extends m{select(e){let t=!1;const s=(null!==e&&void 0!==e?e:"*").split("").map((e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e))).join("");return this.url.searchParams.set("select",s),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:r,referencedTable:i=r}={}){const n=i?`${i}.order`:"order",o=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${void 0===s?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const r="undefined"===typeof s?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:r=s}={}){const i="undefined"===typeof r?"offset":`${r}.offset`,n="undefined"===typeof r?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(n,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return"GET"===this.method?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:s=!1,buffers:r=!1,wal:i=!1,format:n="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,s?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=null!==(o=this.headers.Accept)&&void 0!==o?o:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${n}; for="${c}"; options=${a};`,this}rollback(){var e;return(null!==(e=this.headers.Prefer)&&void 0!==e?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class w extends y{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const s=t.map((e=>"string"===typeof e&&new RegExp("[,()]").test(e)?`"${e}"`:`${e}`)).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}contains(e,t){return"string"===typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"===typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"===typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:r}={}){let i="";"plain"===r?i="pl":"phrase"===r?i="ph":"websearch"===r&&(i="w");const n=void 0===s?"":`(${s})`;return this.url.searchParams.append(e,`${i}fts${n}.${t}`),this}match(e){return Object.entries(e).forEach((([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)})),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}}class _{constructor(e,{headers:t={},schema:s,fetch:r}){this.url=e,this.headers=t,this.schema=s,this.fetch=r}select(e,{head:t=!1,count:s}={}){const r=t?"HEAD":"GET";let i=!1;const n=(null!==e&&void 0!==e?e:"*").split("").map((e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e))).join("");return this.url.searchParams.set("select",n),s&&(this.headers.Prefer=`count=${s}`),new w({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:s=!0}={}){const r=[];if(this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push(`count=${t}`),s||r.push("missing=default"),this.headers.Prefer=r.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new w({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:r,defaultToNull:i=!0}={}){const n=[`resolution=${s?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&n.push(this.headers.Prefer),r&&n.push(`count=${r}`),i||n.push("missing=default"),this.headers.Prefer=n.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new w({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){const s=[];return this.headers.Prefer&&s.push(this.headers.Prefer),t&&s.push(`count=${t}`),this.headers.Prefer=s.join(","),new w({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const t=[];return e&&t.push(`count=${e}`),this.headers.Prefer&&t.unshift(this.headers.Prefer),this.headers.Prefer=t.join(","),new w({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const b={"X-Client-Info":"postgrest-js/1.9.2"};class k{constructor(e,{headers:t={},schema:s,fetch:r}={}){this.url=e,this.headers=Object.assign(Object.assign({},b),t),this.schemaName=s,this.fetch=r}from(e){const t=new URL(`${this.url}/${e}`);return new _(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new k(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:s=!1,count:r}={}){let i;const n=new URL(`${this.url}/rpc/${e}`);let o;s?(i="HEAD",Object.entries(t).forEach((([e,t])=>{n.searchParams.append(e,`${t}`)}))):(i="POST",o=t);const a=Object.assign({},this.headers);return r&&(a.Prefer=`count=${r}`),new w({method:i,url:n,headers:a,schema:this.schemaName,body:o,fetch:this.fetch,allowEmpty:!1})}}const S={"X-Client-Info":"realtime-js/2.9.3"};var T,j,E,O,P,$,C;!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(T||(T={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(j||(j={})),function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"}(E||(E={})),function(e){e.websocket="websocket"}(O||(O={})),function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"}(P||(P={}));class R{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}}class A{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t("string"===typeof e?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,t,s)}_decodeBroadcast(e,t,s){const r=t.getUint8(1),i=t.getUint8(2);let n=this.HEADER_LENGTH+2;const o=s.decode(e.slice(n,n+r));n+=r;const a=s.decode(e.slice(n,n+i));n+=i;return{ref:null,topic:o,event:a,payload:JSON.parse(s.decode(e.slice(n,e.byteLength)))}}}class x{constructor(e,t,s={},r=1e4){this.channel=e,this.event=t,this.payload=s,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var s;return this._hasReceived(e)&&t(null===(s=this.receivedResp)||void 0===s?void 0:s.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);this.channel._on(this.refEvent,{},(e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}!function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"}($||($={}));class I{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(null===t||void 0===t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},(e=>{const{onJoin:t,onLeave:s,onSync:r}=this.caller;this.joinRef=this.channel._joinRef(),this.state=I.syncState(this.state,e,t,s),this.pendingDiffs.forEach((e=>{this.state=I.syncDiff(this.state,e,t,s)})),this.pendingDiffs=[],r()})),this.channel._on(s.diff,{},(e=>{const{onJoin:t,onLeave:s,onSync:r}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=I.syncDiff(this.state,e,t,s),r())})),this.onJoin(((e,t,s)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:s})})),this.onLeave(((e,t,s)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:s})})),this.onSync((()=>{this.channel._trigger("presence",{event:"sync"})}))}static syncState(e,t,s,r){const i=this.cloneDeep(e),n=this.transformState(t),o={},a={};return this.map(i,((e,t)=>{n[e]||(a[e]=t)})),this.map(n,((e,t)=>{const s=i[e];if(s){const r=t.map((e=>e.presence_ref)),i=s.map((e=>e.presence_ref)),n=t.filter((e=>i.indexOf(e.presence_ref)<0)),c=s.filter((e=>r.indexOf(e.presence_ref)<0));n.length>0&&(o[e]=n),c.length>0&&(a[e]=c)}else o[e]=t})),this.syncDiff(i,{joins:o,leaves:a},s,r)}static syncDiff(e,t,s,r){const{joins:i,leaves:n}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return s||(s=()=>{}),r||(r=()=>{}),this.map(i,((t,r)=>{var i;const n=null!==(i=e[t])&&void 0!==i?i:[];if(e[t]=this.cloneDeep(r),n.length>0){const s=e[t].map((e=>e.presence_ref)),r=n.filter((e=>s.indexOf(e.presence_ref)<0));e[t].unshift(...r)}s(t,n,r)})),this.map(n,((t,s)=>{let i=e[t];if(!i)return;const n=s.map((e=>e.presence_ref));i=i.filter((e=>n.indexOf(e.presence_ref)<0)),e[t]=i,r(t,i,s),0===i.length&&delete e[t]})),e}static map(e,t){return Object.getOwnPropertyNames(e).map((s=>t(s,e[s])))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce(((t,s)=>{const r=e[s];return t[s]="metas"in r?r.metas.map((e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))):r,t}),{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}!function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"}(C||(C={}));const L=(e,t,s={})=>{var r;const i=null!==(r=s.skipTypes)&&void 0!==r?r:[];return Object.keys(t).reduce(((s,r)=>(s[r]=U(r,e,t,i),s)),{})},U=(e,t,s,r)=>{const i=t.find((t=>t.name===e)),n=null===i||void 0===i?void 0:i.type,o=s[e];return n&&!r.includes(n)?N(n,o):D(o)},N=(e,t)=>{if("_"===e.charAt(0)){const s=e.slice(1,e.length);return z(t,s)}switch(e){case C.bool:return F(t);case C.float4:case C.float8:case C.int2:case C.int4:case C.int8:case C.numeric:case C.oid:return q(t);case C.json:case C.jsonb:return J(t);case C.timestamp:return B(t);case C.abstime:case C.date:case C.daterange:case C.int4range:case C.int8range:case C.money:case C.reltime:case C.text:case C.time:case C.timestamptz:case C.timetz:case C.tsrange:case C.tstzrange:default:return D(t)}},D=e=>e,F=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},q=e=>{if("string"===typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},J=e=>{if("string"===typeof e)try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},z=(e,t)=>{if("string"!==typeof e)return e;const s=e.length-1,r=e[s];if("{"===e[0]&&"}"===r){let r;const i=e.slice(1,s);try{r=JSON.parse("["+i+"]")}catch(e){r=i?i.split(","):[]}return r.map((e=>N(t,e)))}return e},B=e=>"string"===typeof e?e.replace(" ","T"):e;var M,K,G;!function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(M||(M={})),function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes"}(K||(K={})),function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"}(G||(G={}));class H{constructor(e,t={config:{}},s){this.topic=e,this.params=t,this.socket=s,this.bindings={},this.state=j.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},t.config),this.timeout=this.socket.timeout,this.joinPush=new x(this,E.join,this.params,this.timeout),this.rejoinTimer=new R((()=>this._rejoinUntilConnected()),this.socket.reconnectAfterMs),this.joinPush.receive("ok",(()=>{this.state=j.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this._onClose((()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=j.closed,this.socket._remove(this)})),this._onError((e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=j.errored,this.rejoinTimer.scheduleTimeout())})),this.joinPush.receive("timeout",(()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=j.errored,this.rejoinTimer.scheduleTimeout())})),this._on(E.reply,{},((e,t)=>{this._trigger(this._replyEventName(t),e)})),this.presence=new I(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(e,t=this.timeout){var s,r;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:i,presence:n}}=this.params;this._onError((t=>e&&e("CHANNEL_ERROR",t))),this._onClose((()=>e&&e("CLOSED")));const o={},a={broadcast:i,presence:n,postgres_changes:null!==(r=null===(s=this.bindings.postgres_changes)||void 0===s?void 0:s.map((e=>e.filter)))&&void 0!==r?r:[]};this.socket.accessToken&&(o.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:a},o)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",(({postgres_changes:t})=>{var s;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),void 0!==t){const r=this.bindings.postgres_changes,i=null!==(s=null===r||void 0===r?void 0:r.length)&&void 0!==s?s:0,n=[];for(let s=0;s<i;s++){const i=r[s],{filter:{event:o,schema:a,table:c,filter:h}}=i,l=t&&t[s];if(!l||l.event!==o||l.schema!==a||l.table!==c||l.filter!==h)return this.unsubscribe(),void(e&&e("CHANNEL_ERROR",new Error("mismatch between server and client bindings for postgres changes")));n.push(Object.assign(Object.assign({},i),{id:l.id}))}return this.bindings.postgres_changes=n,void(e&&e("SUBSCRIBED"))}e&&e("SUBSCRIBED")})).receive("error",(t=>{e&&e("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(t).join(", ")||"error")))})).receive("timeout",(()=>{e&&e("TIMED_OUT")}))}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,s){return this._on(e,t,s)}async send(e,t={}){var s,r;if(this._canPush()||"broadcast"!==e.type)return new Promise((s=>{var r,i,n;const o=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(n=null===(i=null===(r=this.params)||void 0===r?void 0:r.config)||void 0===i?void 0:i.broadcast)||void 0===n?void 0:n.ack)||s("ok"),o.receive("ok",(()=>s("ok"))),o.receive("timeout",(()=>s("timed out")))}));{const{event:i,payload:n}=e,o={method:"POST",headers:{apikey:null!==(s=this.socket.apiKey)&&void 0!==s?s:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:n}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,o,null!==(r=t.timeout)&&void 0!==r?r:this.timeout)).ok?"ok":"error"}catch(e){return"AbortError"===e.name?"timed out":"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=j.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(E.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise((s=>{const r=new x(this,E.leave,{},e);r.receive("ok",(()=>{t(),s("ok")})).receive("timeout",(()=>{t(),s("timed out")})).receive("error",(()=>{s("error")})),r.send(),this._canPush()||r.trigger("ok",{})}))}_broadcastEndpointURL(){let e=this.socket.endPoint;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(e,t,s){const r=new AbortController,i=setTimeout((()=>r.abort()),s),n=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(i),n}_push(e,t,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new x(this,e,t,s);return this._canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}_onMessage(e,t,s){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,s){var r,i;const n=e.toLocaleLowerCase(),{close:o,error:a,leave:c,join:h}=E;if(s&&[o,a,c,h].indexOf(n)>=0&&s!==this._joinRef())return;let l=this._onMessage(n,t,s);if(t&&!l)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(n)?null===(r=this.bindings.postgres_changes)||void 0===r||r.filter((e=>{var t,s,r;return"*"===(null===(t=e.filter)||void 0===t?void 0:t.event)||(null===(r=null===(s=e.filter)||void 0===s?void 0:s.event)||void 0===r?void 0:r.toLocaleLowerCase())===n})).map((e=>e.callback(l,s))):null===(i=this.bindings[n])||void 0===i||i.filter((e=>{var s,r,i,o,a,c;if(["broadcast","presence","postgres_changes"].includes(n)){if("id"in e){const n=e.id,o=null===(s=e.filter)||void 0===s?void 0:s.event;return n&&(null===(r=t.ids)||void 0===r?void 0:r.includes(n))&&("*"===o||(null===o||void 0===o?void 0:o.toLocaleLowerCase())===(null===(i=t.data)||void 0===i?void 0:i.type.toLocaleLowerCase()))}{const s=null===(a=null===(o=null===e||void 0===e?void 0:e.filter)||void 0===o?void 0:o.event)||void 0===a?void 0:a.toLocaleLowerCase();return"*"===s||s===(null===(c=null===t||void 0===t?void 0:t.event)||void 0===c?void 0:c.toLocaleLowerCase())}}return e.type.toLocaleLowerCase()===n})).map((e=>{if("object"===typeof l&&"ids"in l){const e=l.data,{schema:t,table:s,commit_timestamp:r,type:i,errors:n}=e,o={schema:t,table:s,commit_timestamp:r,eventType:i,new:{},old:{},errors:n};l=Object.assign(Object.assign({},o),this._getPayloadRecords(e))}e.callback(l,s)}))}_isClosed(){return this.state===j.closed}_isJoined(){return this.state===j.joined}_isJoining(){return this.state===j.joining}_isLeaving(){return this.state===j.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,s){const r=e.toLocaleLowerCase(),i={type:r,filter:t,callback:s};return this.bindings[r]?this.bindings[r].push(i):this.bindings[r]=[i],this}_off(e,t){const s=e.toLocaleLowerCase();return this.bindings[s]=this.bindings[s].filter((e=>{var r;return!((null===(r=e.type)||void 0===r?void 0:r.toLocaleLowerCase())===s&&H.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(E.close,{},e)}_onError(e){this._on(E.error,{},(t=>e(t)))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=j.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return"INSERT"!==e.type&&"UPDATE"!==e.type||(t.new=L(e.columns,e.record)),"UPDATE"!==e.type&&"DELETE"!==e.type||(t.old=L(e.columns,e.old_record)),t}}const V=()=>{},W="undefined"!==typeof WebSocket;class Y{constructor(e,t){var r;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.headers=S,this.params={},this.timeout=1e4,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=V,this.conn=null,this.sendBuffer=[],this.serializer=new A,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},this.endPoint=`${e}/${O.websocket}`,(null===t||void 0===t?void 0:t.transport)?this.transport=t.transport:this.transport=null,(null===t||void 0===t?void 0:t.params)&&(this.params=t.params),(null===t||void 0===t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),(null===t||void 0===t?void 0:t.timeout)&&(this.timeout=t.timeout),(null===t||void 0===t?void 0:t.logger)&&(this.logger=t.logger),(null===t||void 0===t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);const i=null===(r=null===t||void 0===t?void 0:t.params)||void 0===r?void 0:r.apikey;i&&(this.accessToken=i,this.apiKey=i),this.reconnectAfterMs=(null===t||void 0===t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null===t||void 0===t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null===t||void 0===t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new R((async()=>{this.disconnect(),this.connect()}),this.reconnectAfterMs),this.fetch=this._resolveFetch(null===t||void 0===t?void 0:t.fetch)}connect(){if(!this.conn)if(this.transport)this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});else{if(W)return this.conn=new WebSocket(this._endPointURL()),void this.setupConnection();this.conn=new X(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),s.e(591).then(s.t.bind(s,1591,23)).then((({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()}))}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!==t&&void 0!==t?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map((e=>e.unsubscribe())));return this.disconnect(),e}log(e,t,s){this.logger(e,t,s)}connectionState(){switch(this.conn&&this.conn.readyState){case T.connecting:return P.Connecting;case T.open:return P.Open;case T.closing:return P.Closing;default:return P.Closed}}isConnected(){return this.connectionState()===P.Open}channel(e,t={config:{}}){const s=new H(`realtime:${e}`,t,this);return this.channels.push(s),s}push(e){const{topic:t,event:s,payload:r,ref:i}=e,n=()=>{this.encode(e,(e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)}))};this.log("push",`${t} ${s} (${i})`,r),this.isConnected()?n():this.sendBuffer.push(n)}setAuth(e){this.accessToken=e,this.channels.forEach((t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(E.access_token,{access_token:e})}))}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t._isJoined()||t._isJoining())));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter((t=>t._joinRef()!==e._joinRef()))}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}_onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:s,payload:r,ref:i}=e;(i&&i===this.pendingHeartbeatRef||s===(null===r||void 0===r?void 0:r.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${r.status||""} ${t} ${s} ${i&&"("+i+")"||""}`,r),this.channels.filter((e=>e._isMember(t))).forEach((e=>e._trigger(s,r,i))),this.stateChangeCallbacks.message.forEach((t=>t(e)))}))}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval((()=>this._sendHeartbeat()),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach((e=>e()))}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((t=>t(e)))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach((t=>t(e)))}_triggerChanError(){this.channels.forEach((e=>e._trigger(E.error)))}_appendParams(e,t){if(0===Object.keys(t).length)return e;const s=e.match(/\?/)?"&":"?";return`${e}${s}${new URLSearchParams(t)}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void(null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout"));this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class X{constructor(e,t,s){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=T.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=s.close}}class Q extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Z(e){return"object"===typeof e&&null!==e&&"__isStorageError"in e}class ee extends Q{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class te extends Q{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var se=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const re=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)};var ie=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const ne=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),oe=(e,t)=>ie(void 0,void 0,void 0,(function*(){const r=yield se(void 0,void 0,void 0,(function*(){return"undefined"===typeof Response?(yield Promise.resolve().then(s.bind(s,907))).Response:Response}));e instanceof r?e.json().then((s=>{t(new ee(ne(s),e.status||500))})).catch((e=>{t(new te(ne(e),e))})):t(new te(ne(e),e))})),ae=(e,t,s,r)=>{const i={method:e,headers:(null===t||void 0===t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json"},null===t||void 0===t?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),s))};function ce(e,t,s,r,i,n){return ie(this,void 0,void 0,(function*(){return new Promise(((o,a)=>{e(s,ae(t,r,i,n)).then((e=>{if(!e.ok)throw e;return(null===r||void 0===r?void 0:r.noResolveJson)?e:e.json()})).then((e=>o(e))).catch((e=>oe(e,a)))}))}))}function he(e,t,s,r){return ie(this,void 0,void 0,(function*(){return ce(e,"GET",t,s,r)}))}function le(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"POST",t,r,i,s)}))}function ue(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"DELETE",t,r,i,s)}))}var de=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const fe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},pe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ge{constructor(e,t={},s,r){this.url=e,this.headers=t,this.bucketId=s,this.fetch=re(r)}uploadOrUpdate(e,t,s,r){return de(this,void 0,void 0,(function*(){try{let i;const n=Object.assign(Object.assign({},pe),r),o=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)});"undefined"!==typeof Blob&&s instanceof Blob?(i=new FormData,i.append("cacheControl",n.cacheControl),i.append("",s)):"undefined"!==typeof FormData&&s instanceof FormData?(i=s,i.append("cacheControl",n.cacheControl)):(i=s,o["cache-control"]=`max-age=${n.cacheControl}`,o["content-type"]=n.contentType);const a=this._removeEmptyFolders(t),c=this._getFinalPath(a),h=yield this.fetch(`${this.url}/object/${c}`,Object.assign({method:e,body:i,headers:o},(null===n||void 0===n?void 0:n.duplex)?{duplex:n.duplex}:{})),l=yield h.json();if(h.ok)return{data:{path:a,id:l.Id,fullPath:l.Key},error:null};return{data:null,error:l}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}upload(e,t,s){return de(this,void 0,void 0,(function*(){return this.uploadOrUpdate("POST",e,t,s)}))}uploadToSignedUrl(e,t,s,r){return de(this,void 0,void 0,(function*(){const i=this._removeEmptyFolders(e),n=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${n}`);o.searchParams.set("token",t);try{let e;const t=Object.assign({upsert:pe.upsert},r),n=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!==typeof Blob&&s instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),e.append("",s)):"undefined"!==typeof FormData&&s instanceof FormData?(e=s,e.append("cacheControl",t.cacheControl)):(e=s,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType);const a=yield this.fetch(o.toString(),{method:"PUT",body:e,headers:n}),c=yield a.json();if(a.ok)return{data:{path:i,fullPath:c.Key},error:null};return{data:null,error:c}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUploadUrl(e){return de(this,void 0,void 0,(function*(){try{let t=this._getFinalPath(e);const s=yield le(this.fetch,`${this.url}/object/upload/sign/${t}`,{},{headers:this.headers}),r=new URL(this.url+s.url),i=r.searchParams.get("token");if(!i)throw new Q("No token returned by API");return{data:{signedUrl:r.toString(),path:e,token:i},error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}update(e,t,s){return de(this,void 0,void 0,(function*(){return this.uploadOrUpdate("PUT",e,t,s)}))}move(e,t){return de(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}copy(e,t){return de(this,void 0,void 0,(function*(){try{return{data:{path:(yield le(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers})).Key},error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUrl(e,t,s){return de(this,void 0,void 0,(function*(){try{let r=this._getFinalPath(e),i=yield le(this.fetch,`${this.url}/object/sign/${r}`,Object.assign({expiresIn:t},(null===s||void 0===s?void 0:s.transform)?{transform:s.transform}:{}),{headers:this.headers});const n=(null===s||void 0===s?void 0:s.download)?`&download=${!0===s.download?"":s.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${n}`)},{data:i,error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUrls(e,t,s){return de(this,void 0,void 0,(function*(){try{const r=yield le(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=(null===s||void 0===s?void 0:s.download)?`&download=${!0===s.download?"":s.download}`:"";return{data:r.map((e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null}))),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}download(e,t){return de(this,void 0,void 0,(function*(){const s="undefined"!==typeof(null===t||void 0===t?void 0:t.transform)?"render/image/authenticated":"object",r=this.transformOptsToQueryString((null===t||void 0===t?void 0:t.transform)||{}),i=r?`?${r}`:"";try{const t=this._getFinalPath(e),r=yield he(this.fetch,`${this.url}/${s}/${t}${i}`,{headers:this.headers,noResolveJson:!0});return{data:yield r.blob(),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}getPublicUrl(e,t){const s=this._getFinalPath(e),r=[],i=(null===t||void 0===t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&r.push(i);const n="undefined"!==typeof(null===t||void 0===t?void 0:t.transform)?"render/image":"object",o=this.transformOptsToQueryString((null===t||void 0===t?void 0:t.transform)||{});""!==o&&r.push(o);let a=r.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${n}/public/${s}${a}`)}}}remove(e){return de(this,void 0,void 0,(function*(){try{return{data:yield ue(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}list(e,t,s){return de(this,void 0,void 0,(function*(){try{const r=Object.assign(Object.assign(Object.assign({},fe),t),{prefix:e||""});return{data:yield le(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},s),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const ve={"X-Client-Info":"storage-js/2.5.5"};var me=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class ye{constructor(e,t={},s){this.url=e,this.headers=Object.assign(Object.assign({},ve),t),this.fetch=re(s)}listBuckets(){return me(this,void 0,void 0,(function*(){try{return{data:yield he(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}getBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield he(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createBucket(e,t={public:!1}){return me(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}updateBucket(e,t){return me(this,void 0,void 0,(function*(){try{const s=yield function(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"PUT",t,r,i,s)}))}(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers});return{data:s,error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}emptyBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}deleteBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield ue(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}}class we extends ye{constructor(e,t={},s){super(e,t,s)}from(e){return new ge(this.url,this.headers,e,this.fetch)}}let _e="";_e="undefined"!==typeof Deno?"deno":"undefined"!==typeof document?"web":"undefined"!==typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";const be={headers:{"X-Client-Info":`supabase-js-${_e}/2.39.7`}},ke={schema:"public"},Se={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Te={};var je=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const Ee=e=>{let t;return t=e||("undefined"===typeof fetch?g.default:fetch),(...e)=>t(...e)},Oe=(e,t,s)=>{const r=Ee(s),i="undefined"===typeof Headers?g.Headers:Headers;return(s,n)=>je(void 0,void 0,void 0,(function*(){var o;const a=null!==(o=yield t())&&void 0!==o?o:e;let c=new i(null===n||void 0===n?void 0:n.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${a}`),r(s,Object.assign(Object.assign({},n),{headers:c}))}))};const Pe=()=>"undefined"!==typeof document,$e={tested:!1,writable:!1},Ce=()=>{if(!Pe())return!1;try{if("object"!==typeof globalThis.localStorage)return!1}catch(e){return!1}if($e.tested)return $e.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),$e.tested=!0,$e.writable=!0}catch(e){$e.tested=!0,$e.writable=!1}return $e.writable};function Re(e){const t={},s=new URL(e);if(s.hash&&"#"===s.hash[0])try{new URLSearchParams(s.hash.substring(1)).forEach(((e,s)=>{t[s]=e}))}catch(e){}return s.searchParams.forEach(((e,s)=>{t[s]=e})),t}const Ae=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},xe=e=>"object"===typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"===typeof e.json,Ie=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},Le=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch(e){return s}},Ue=async(e,t)=>{await e.removeItem(t)};class Ne{constructor(){this.promise=new Ne.promiseConstructor(((e,t)=>{this.resolve=e,this.reject=t}))}}function De(e){const t=e.split(".");if(3!==t.length)throw new Error("JWT is not valid: not a JWT structure");if(!/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i.test(t[1]))throw new Error("JWT is not valid: payload is not in base64url format");const s=t[1];return JSON.parse(function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s,r,i,n,o,a,c,h="",l=0;for(e=e.replace("-","+").replace("_","/");l<e.length;)n=t.indexOf(e.charAt(l++)),o=t.indexOf(e.charAt(l++)),a=t.indexOf(e.charAt(l++)),c=t.indexOf(e.charAt(l++)),s=n<<2|o>>4,r=(15&o)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(s),64!=a&&0!=r&&(h+=String.fromCharCode(r)),64!=c&&0!=i&&(h+=String.fromCharCode(i));return h}(s))}function Fe(e){return("0"+e.toString(16)).substr(-2)}function qe(){const e=new Uint32Array(56);if("undefined"===typeof crypto){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length;let s="";for(let r=0;r<56;r++)s+=e.charAt(Math.floor(Math.random()*t));return s}return crypto.getRandomValues(e),Array.from(e,Fe).join("")}async function Je(e){if(!("undefined"!==typeof crypto&&"undefined"!==typeof crypto.subtle&&"undefined"!==typeof TextEncoder))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const t=await async function(e){const t=(new TextEncoder).encode(e),s=await crypto.subtle.digest("SHA-256",t),r=new Uint8Array(s);return Array.from(r).map((e=>String.fromCharCode(e))).join("")}(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}Ne.promiseConstructor=Promise;class ze extends Error{constructor(e,t){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t}}function Be(e){return"object"===typeof e&&null!==e&&"__isAuthError"in e}class Me extends ze{constructor(e,t){super(e,t),this.name="AuthApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Ke extends ze{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Ge extends ze{constructor(e,t,s){super(e),this.name=t,this.status=s}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class He extends Ge{constructor(){super("Auth session missing!","AuthSessionMissingError",400)}}class Ve extends Ge{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500)}}class We extends Ge{constructor(e){super(e,"AuthInvalidCredentialsError",400)}}class Ye extends Ge{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Xe extends Ge{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Qe extends Ge{constructor(e,t){super(e,"AuthRetryableFetchError",t)}}function Ze(e){return Be(e)&&"AuthRetryableFetchError"===e.name}class et extends Ge{constructor(e,t,s){super(e,"AuthWeakPasswordError",t),this.reasons=s}}var tt=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s};const st=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rt=[502,503,504];async function it(e){if(!xe(e))throw new Qe(st(e),0);if(rt.includes(e.status))throw new Qe(st(e),e.status);let t;try{t=await e.json()}catch(e){throw new Ke(st(e),e)}if("object"===typeof t&&t&&"object"===typeof t.weak_password&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce(((e,t)=>e&&"string"===typeof t),!0))throw new et(st(t),e.status,t.weak_password.reasons);throw new Me(st(t),e.status||500)}const nt=(e,t,s,r)=>{const i={method:e,headers:(null===t||void 0===t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null===t||void 0===t?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),s))};async function ot(e,t,s,r){var i;const n=Object.assign({},null===r||void 0===r?void 0:r.headers);(null===r||void 0===r?void 0:r.jwt)&&(n.Authorization=`Bearer ${r.jwt}`);const o=null!==(i=null===r||void 0===r?void 0:r.query)&&void 0!==i?i:{};(null===r||void 0===r?void 0:r.redirectTo)&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await async function(e,t,s,r,i,n){const o=nt(t,r,i,n);let a;try{a=await e(s,o)}catch(e){throw console.error(e),new Qe(st(e),0)}a.ok||await it(a);if(null===r||void 0===r?void 0:r.noResolveJson)return a;try{return await a.json()}catch(e){await it(e)}}(e,t,s+a,{headers:n,noResolveJson:null===r||void 0===r?void 0:r.noResolveJson},{},null===r||void 0===r?void 0:r.body);return(null===r||void 0===r?void 0:r.xform)?null===r||void 0===r?void 0:r.xform(c):{data:Object.assign({},c),error:null}}function at(e){var t;let s=null;var r;(function(e){return e.access_token&&e.refresh_token&&e.expires_in})(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:s,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function ct(e){const t=at(e);return!t.error&&e.weak_password&&"object"===typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"===typeof e.weak_password.message&&e.weak_password.reasons.reduce(((e,t)=>e&&"string"===typeof t),!0)&&(t.data.weak_password=e.weak_password),t}function ht(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function lt(e){return{data:e,error:null}}function ut(e){const{action_link:t,email_otp:s,hashed_token:r,redirect_to:i,verification_type:n}=e,o=tt(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]);return{data:{properties:{action_link:t,email_otp:s,hashed_token:r,redirect_to:i,verification_type:n},user:Object.assign({},o)},error:null}}function dt(e){return e}var ft=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s};class pt{constructor({url:e="",headers:t={},fetch:s}){this.url=e,this.headers=t,this.fetch=Ae(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await ot(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await ot(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{const{options:t}=e,s=ft(e,["options"]),r=Object.assign(Object.assign({},s),t);return"newEmail"in s&&(r.new_email=null===s||void 0===s?void 0:s.newEmail,delete r.newEmail),await ot(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:ut,redirectTo:null===t||void 0===t?void 0:t.redirectTo})}catch(e){if(Be(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await ot(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,s,r,i,n,o,a;try{const c={nextPage:null,lastPage:0,total:0},h=await ot(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(s=null===(t=null===e||void 0===e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==s?s:"",per_page:null!==(i=null===(r=null===e||void 0===e?void 0:e.perPage)||void 0===r?void 0:r.toString())&&void 0!==i?i:""},xform:dt});if(h.error)throw h.error;const l=await h.json(),u=null!==(n=h.headers.get("x-total-count"))&&void 0!==n?n:0,d=null!==(a=null===(o=h.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return d.length>0&&(d.forEach((e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),s=JSON.parse(e.split(";")[1].split("=")[1]);c[`${s}Page`]=t})),c.total=parseInt(u)),{data:Object.assign(Object.assign({},l),c),error:null}}catch(e){if(Be(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await ot(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await ot(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){try{return await ot(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{const{data:t,error:s}=await ot(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:s}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{return{data:await ot(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}}const gt="0.0.0",vt={"X-Client-Info":`gotrue-js/${gt}`},mt={getItem:e=>Ce()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{Ce()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{Ce()&&globalThis.localStorage.removeItem(e)}};function yt(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const wt=!!(globalThis&&Ce()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"));class _t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class bt extends _t{}async function kt(e,t,s){wt&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout((()=>{r.abort(),wt&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)}),t),await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},(async r=>{if(!r){if(0===t)throw wt&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new bt(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(wt)try{const e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null,"  "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await s()}wt&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,r.name);try{return await s()}finally{wt&&console.log("@supabase/gotrue-js: navigatorLock: released",e,r.name)}}))}!function(){if("object"!==typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!==typeof self&&(self.globalThis=self)}}();const St={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vt,flowType:"implicit",debug:!1},Tt=3e4;async function jt(e,t,s){return await s()}class Et{constructor(e){var t,s;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Et.nextInstanceID,Et.nextInstanceID+=1,this.instanceID>0&&Pe()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},St),e);if(this.logDebugMessages=!!r.debug,"function"===typeof r.debug&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new pt({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=Ae(r.fetch),this.lock=r.lock||jt,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,r.lock?this.lock=r.lock:Pe()&&(null===(t=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.locks)?this.lock=kt:this.lock=jt,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:Ce()?this.storage=mt:(this.memoryStorage={},this.storage=yt(this.memoryStorage)):(this.memoryStorage={},this.storage=yt(this.memoryStorage)),Pe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null===(s=this.broadcastChannel)||void 0===s||s.addEventListener("message",(async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}))}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${gt}) ${(new Date).toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,(async()=>await this._initialize())))()),await this.initializePromise}async _initialize(){try{const e=!!Pe()&&await this._isPKCEFlow();if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:t,error:s}=await this._getSessionFromURL(e);if(s)return this._debug("#_initialize()","error detecting session from URL",s),"Identity is already linked"===(null===s||void 0===s?void 0:s.message)||"Identity is already linked to another user"===(null===s||void 0===s?void 0:s.message)||await this._removeSession(),{error:s};const{session:r,redirectType:i}=t;return this._debug("#_initialize()","detected session in URL",r,"redirect type",i),await this._saveSession(r),setTimeout((async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",r):await this._notifyAllSubscribers("SIGNED_IN",r)}),0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return Be(e)?{error:e}:{error:new Ke("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signUp(e){var t,s,r;try{let i;if(await this._removeSession(),"email"in e){const{email:s,password:r,options:n}=e;let o=null,a=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),o=await Je(e),a=e===o?"plain":"s256"}i=await ot(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null===n||void 0===n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null===n||void 0===n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null===n||void 0===n?void 0:n.captchaToken},code_challenge:o,code_challenge_method:a},xform:at})}else{if(!("phone"in e))throw new We("You must provide either an email or phone number and a password");{const{phone:t,password:n,options:o}=e;i=await ot(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null===o||void 0===o?void 0:o.data)&&void 0!==s?s:{},channel:null!==(r=null===o||void 0===o?void 0:o.channel)&&void 0!==r?r:"sms",gotrue_meta_security:{captcha_token:null===o||void 0===o?void 0:o.captchaToken}},xform:at})}}const{data:n,error:o}=i;if(o||!n)return{data:{user:null,session:null},error:o};const a=n.session,c=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if(await this._removeSession(),"email"in e){const{email:s,password:r,options:i}=e;t=await ot(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},xform:ct})}else{if(!("phone"in e))throw new We("You must provide either an email or phone number and a password");{const{phone:s,password:r,options:i}=e;t=await ot(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},xform:ct})}}const{data:s,error:r}=t;return r?{data:{user:null,session:null},error:r}:s&&s.session&&s.user?(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r}):{data:{user:null,session:null},error:new Ve}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,(async()=>this._exchangeCodeForSession(e)))}async _exchangeCodeForSession(e){const t=await Le(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!==t&&void 0!==t?t:"").split("/"),{data:i,error:n}=await ot(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:at});return await Ue(this.storage,`${this.storageKey}-code-verifier`),n?{data:{user:null,session:null,redirectType:null},error:n}:i&&i.session&&i.user?(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:null!==r&&void 0!==r?r:null}),error:n}):{data:{user:null,session:null,redirectType:null},error:new Ve}}async signInWithIdToken(e){await this._removeSession();try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,o=await ot(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null===t||void 0===t?void 0:t.captchaToken}},xform:at}),{data:a,error:c}=o;return c?{data:{user:null,session:null},error:c}:a&&a.session&&a.user?(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:c}):{data:{user:null,session:null},error:new Ve}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if(await this._removeSession(),"email"in e){const{email:r,options:i}=e;let n=null,o=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),n=await Je(e),o=e===n?"plain":"s256"}const{error:a}=await ot(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null===i||void 0===i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null===i||void 0===i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:o},redirectTo:null===i||void 0===i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:a}}if("phone"in e){const{phone:t,options:s}=e,{data:o,error:a}=await ot(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null===s||void 0===s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null===s||void 0===s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null===s||void 0===s?void 0:s.captchaToken},channel:null!==(n=null===s||void 0===s?void 0:s.channel)&&void 0!==n?n:"sms"}});return{data:{user:null,session:null,messageId:null===o||void 0===o?void 0:o.message_id},error:a}}throw new We("You must provide either an email or phone number.")}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,s;try{let r,i;"email_change"!==e.type&&"phone_change"!==e.type&&await this._removeSession(),"options"in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:o}=await ot(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:at});if(o)throw o;if(!n)throw new Error("An error occurred on token verification.");const a=n.session,c=n.user;return(null===a||void 0===a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,s,r;try{await this._removeSession();let i=null,n=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),i=await Je(e),n=e===i?"plain":"s256"}return await ot(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null===e||void 0===e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:n}),headers:this.headers,xform:lt})}catch(e){if(Be(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._reauthenticate()))}async _reauthenticate(){try{return await this._useSession((async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new He;const{error:r}=await ot(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:r}}))}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{"email_change"!=e.type&&"phone_change"!=e.type&&await this._removeSession();const t=`${this.url}/resend`;if("email"in e){const{email:s,type:r,options:i}=e,{error:n}=await ot(this.fetch,"POST",t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},redirectTo:null===i||void 0===i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:n}}if("phone"in e){const{phone:s,type:r,options:i}=e,{data:n,error:o}=await ot(this.fetch,"POST",t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null===n||void 0===n?void 0:n.message_id},error:o}}throw new We("You must provide either an email or phone number and a type")}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,this._acquireLock(-1,(async()=>this._useSession((async e=>e))))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,(async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}}))}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",(new Error).stack);try{let e=null;const t=await Le(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&e.expires_at<=Date.now()/1e3;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s)return{data:{session:e},error:null};const{session:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,this._acquireLock(-1,(async()=>await this._getUser())))}async _getUser(e){try{return e?await ot(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ht}):await this._useSession((async e=>{var t,s;const{data:r,error:i}=e;if(i)throw i;return await ot(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(s=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==s?s:void 0,xform:ht})}))}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._updateUser(e,t)))}async _updateUser(e,t={}){try{return await this._useSession((async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new He;const n=r.session;let o=null,a=null;if("pkce"===this.flowType&&null!=e.email){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),o=await Je(e),a=e===o?"plain":"s256"}const{data:c,error:h}=await ot(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null===t||void 0===t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:a}),jwt:n.access_token,xform:ht});if(h)throw h;return n.user=c.user,await this._saveSession(n),await this._notifyAllSubscribers("USER_UPDATED",n),{data:{user:n.user},error:null}}))}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return De(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._setSession(e)))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new He;const t=Date.now()/1e3;let s=t,r=!0,i=null;const n=De(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{session:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return{data:{user:null,session:null},error:s};if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)throw n;i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:"bearer",expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(Be(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._refreshSession(e)))}async _refreshSession(e){try{return await this._useSession((async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null===e||void 0===e?void 0:e.refresh_token))throw new He;const{session:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:r?{data:{user:r.user,session:r},error:null}:{data:{user:null,session:null},error:null}}))}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!Pe())throw new Ye("No browser detected.");if("implicit"===this.flowType&&!this._isImplicitGrantFlow())throw new Ye("Not a valid implicit grant flow url.");if("pkce"==this.flowType&&!e)throw new Xe("Not a valid PKCE flow url.");const t=Re(window.location.href);if(e){if(!t.code)throw new Xe("No code detected.");const{data:e,error:s}=await this._exchangeCodeForSession(t.code);if(s)throw s;const r=new URL(window.location.href);return r.searchParams.delete("code"),window.history.replaceState(window.history.state,"",r.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new Ye(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});const{provider_token:s,provider_refresh_token:r,access_token:i,refresh_token:n,expires_in:o,expires_at:a,token_type:c}=t;if(!i||!o||!n||!c)throw new Ye("No session defined in URL");const h=Math.round(Date.now()/1e3),l=parseInt(o);let u=h+l;a&&(u=parseInt(a));const d=u-h;1e3*d<=Tt&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${l}s`);const f=u-l;h-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,u,h):h-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",f,u,h);const{data:p,error:g}=await this._getUser(i);if(g)throw g;const v={provider_token:s,provider_refresh_token:r,access_token:i,expires_in:l,expires_at:u,refresh_token:n,token_type:c,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:v,redirectType:t.type},error:null}}catch(e){if(Be(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){const e=Re(window.location.href);return!(!Pe()||!e.access_token&&!e.error_description)}async _isPKCEFlow(){const e=Re(window.location.href),t=await Le(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._signOut(e)))}async _signOut({scope:e}={scope:"global"}){return await this._useSession((async t=>{var s;const{data:r,error:i}=t;if(i)return{error:i};const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!function(e){return Be(e)&&"AuthApiError"===e.name}(t)||404!==t.status&&401!==t.status))return{error:t}}return"others"!==e&&(await this._removeSession(),await Ue(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}}))}onAuthStateChange(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),s={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,await this._acquireLock(-1,(async()=>{this._emitInitialSession(t)}))})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession((async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback("INITIAL_SESSION",r)),this._debug("INITIAL_SESSION","callback id",e,"session",r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}}))}async resetPasswordForEmail(e,t={}){let s=null,r=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,`${e}/PASSWORD_RECOVERY`),s=await Je(e),r=e===s?"plain":"s256"}try{return await ot(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(Be(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return{data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{const{data:s,error:r}=await this._useSession((async t=>{var s,r,i,n,o;const{data:a,error:c}=t;if(c)throw c;const h=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await ot(this.fetch,"GET",h,{headers:this.headers,jwt:null!==(o=null===(n=a.session)||void 0===n?void 0:n.access_token)&&void 0!==o?o:void 0})}));if(r)throw r;return Pe()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null===s||void 0===s?void 0:s.url),{data:{provider:e.provider,url:null===s||void 0===s?void 0:s.url},error:null}}catch(t){if(Be(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession((async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await ot(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const i=Date.now();return await(s=async s=>(await async function(e){return await new Promise((t=>{setTimeout((()=>t(null)),e)}))}(200*s),this._debug(t,"refreshing attempt",s),await ot(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:at})),r=(e,t,s)=>s&&s.error&&Ze(s.error)&&Date.now()+200*(e+1)-i<Tt,new Promise(((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{const t=await s(i);if(!r(i,null,t))return void e(t)}catch(e){if(!r(i,e))return void t(e)}})()})))}catch(e){if(this._debug(t,"error",e),Be(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}var s,r}_isValidSession(e){return"object"===typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const s=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",s),Pe()&&!t.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e;const t="#_recoverAndRefresh()";this._debug(t,"begin");try{const s=await Le(this.storage,this.storageKey);if(this._debug(t,"session from storage",s),!this._isValidSession(s))return this._debug(t,"session is not valid"),void(null!==s&&await this._removeSession());const r=Math.round(Date.now()/1e3),i=(null!==(e=s.expires_at)&&void 0!==e?e:1/0)<r+10;if(this._debug(t,`session has${i?"":" not"} expired with margin of 10s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:e}=await this._callRefreshToken(s.refresh_token);e&&(console.error(e),Ze(e)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(e){return this._debug(t,"error",e),void console.error(e)}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,s;if(!e)throw new He;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new Ne;const{data:t,error:s}=await this._refreshAccessToken(e);if(s)throw s;if(!t.session)throw new He;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);const r={session:t.session,error:null};return this.refreshingDeferred.resolve(r),r}catch(e){if(this._debug(r,"error",e),Be(e)){const s={session:null,error:e};return Ze(e)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(e),e}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,"begin",t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map((async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}}));if(await Promise.all(i),r.length>0){for(let e=0;e<r.length;e+=1)console.error(r[e]);throw r[0]}}finally{this._debug(r,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),await Ie(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await Ue(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Pe()&&(null===window||void 0===window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval((()=>this._autoRefreshTokenTick()),Tt);this.autoRefreshTicker=e,e&&"object"===typeof e&&"function"===typeof e.unref?e.unref():"undefined"!==typeof Deno&&"function"===typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout((async()=>{await this.initializePromise,await this._autoRefreshTokenTick()}),0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,(async()=>{try{const e=Date.now();try{return await this._useSession((async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");const r=Math.floor((1e3*s.expires_at-e)/Tt);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(s.refresh_token)}))}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}))}catch(e){if(!(e.isAcquireTimeout||e instanceof _t))throw e;this._debug("auto refresh token tick lock not available")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Pe()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null===window||void 0===window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,(async()=>{"visible"===document.visibilityState?await this._recoverAndRefresh():this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting")})))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null===s||void 0===s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null===s||void 0===s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),"pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e);const t=await Je(e),s=e===t?"plain":"s256";this._debug("PKCE","code verifier",`${e.substring(0,5)}...`,"code challenge",t,"method",s);const i=new URLSearchParams({code_challenge:`${encodeURIComponent(t)}`,code_challenge_method:`${encodeURIComponent(s)}`});r.push(i.toString())}if(null===s||void 0===s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null===s||void 0===s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;return i?{data:null,error:i}:await ot(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession((async t=>{var s,r;const{data:i,error:n}=t;if(n)return{data:null,error:n};const{data:o,error:a}=await ot(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:null===(s=null===i||void 0===i?void 0:i.session)||void 0===s?void 0:s.access_token});return a?{data:null,error:a}:((null===(r=null===o||void 0===o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,(async()=>{try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;if(i)return{data:null,error:i};const{data:n,error:o}=await ot(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+n.expires_in},n)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",n),{data:n,error:o})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}))}async _challenge(e){return this._acquireLock(-1,(async()=>{try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;return i?{data:null,error:i}:await ot(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}))}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const s=(null===e||void 0===e?void 0:e.factors)||[],r=s.filter((e=>"totp"===e.factor_type&&"verified"===e.status));return{data:{all:s,totp:r},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,(async()=>await this._useSession((async e=>{var t,s;const{data:{session:r},error:i}=e;if(i)return{data:null,error:i};if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const n=this._decodeJWT(r.access_token);let o=null;n.aal&&(o=n.aal);let a=o;(null!==(s=null===(t=r.user.factors)||void 0===t?void 0:t.filter((e=>"verified"===e.status)))&&void 0!==s?s:[]).length>0&&(a="aal2");return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:n.amr||[]},error:null}}))))}}Et.nextInstanceID=0;class Ot extends Et{constructor(e){super(e)}}var Pt=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class $t{constructor(e,t,s){var r,i,n,o,a,c,h,l;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const u=e.replace(/\/$/,"");this.realtimeUrl=`${u}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${u}/auth/v1`,this.storageUrl=`${u}/storage/v1`,this.functionsUrl=`${u}/functions/v1`;const d=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,f=function(e,t){const{db:s,auth:r,realtime:i,global:n}=e,{db:o,auth:a,realtime:c,global:h}=t;return{db:Object.assign(Object.assign({},o),s),auth:Object.assign(Object.assign({},a),r),realtime:Object.assign(Object.assign({},c),i),global:Object.assign(Object.assign({},h),n)}}(null!==s&&void 0!==s?s:{},{db:ke,realtime:Te,auth:Object.assign(Object.assign({},Se),{storageKey:d}),global:be});this.storageKey=null!==(i=null===(r=f.auth)||void 0===r?void 0:r.storageKey)&&void 0!==i?i:"",this.headers=null!==(o=null===(n=f.global)||void 0===n?void 0:n.headers)&&void 0!==o?o:{},this.auth=this._initSupabaseAuthClient(null!==(a=f.auth)&&void 0!==a?a:{},this.headers,null===(c=f.global)||void 0===c?void 0:c.fetch),this.fetch=Oe(t,this._getAccessToken.bind(this),null===(h=f.global)||void 0===h?void 0:h.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},f.realtime)),this.rest=new k(`${u}/rest/v1`,{headers:this.headers,schema:null===(l=f.db)||void 0===l?void 0:l.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new p(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new we(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},s={}){return this.rest.rpc(e,t,s)}channel(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 Pt(this,void 0,void 0,(function*(){const{data:s}=yield this.auth.getSession();return null!==(t=null===(e=s.session)||void 0===e?void 0:e.access_token)&&void 0!==t?t:null}))}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,storageKey:i,flowType:n,debug:o},a,c){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Ot({url:this.authUrl,headers:Object.assign(Object.assign({},h),a),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,flowType:n,debug:o,fetch:c})}_initRealtimeClient(e){return new Y(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null===e||void 0===e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange(((e,t)=>{this._handleTokenChanged(e,"CLIENT",null===t||void 0===t?void 0:t.access_token)}))}_handleTokenChanged(e,t,s){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===s?"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.realtime.setAuth(null!==s&&void 0!==s?s:null),this.changedAccessToken=s)}}const Ct="https://api.scoredetect.com";new $t("https://jtiipfmpqosvwdjjbhnc.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imp0aWlwZm1wcW9zdndkampiaG5jIiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODQ5Mjk5ODMsImV4cCI6MjAwMDUwNTk4M30.QZjkBzpsnEctknl3GkX4uH-2HJ0Rh81VI8O840O-Jjs",{auth:{persistSession:!1}});(0,e.registerPlugin)("timestamp-post",{render:()=>{const e=(()=>{const[e,s]=(0,t.useState)(!1),r=(0,t.useRef)(!1),{isSavingPost:n,isAutosavingPost:o}=(0,i.useSelect)((e=>({isSavingPost:e("core/editor").isSavingPost(),isAutosavingPost:e("core/editor").isAutosavingPost()})));return(0,t.useEffect)((()=>{!n&&!o||r.current||(s(!1),r.current=!0),n||o||!r.current||(s(!0),r.current=!1)}),[n,o]),e})(),{editPost:s}=(0,i.useDispatch)("core/editor"),{createNotice:a}=(0,i.useDispatch)("core/notices"),h=(0,i.useSelect)((e=>e("core/editor").getCurrentPostType()),[]),l=(0,i.useSelect)((e=>{const t=e("core").getEntityRecord("root","site");return t?.sdcom_timestamps})),{sdcom_timestamp_post:u=!1,sdcom_previous_certificate_id:d="",...f}=(0,i.useSelect)((e=>e("core/editor").getEditedPostAttribute("meta")||{})),p=(0,i.useSelect)((e=>e("core/editor").getEditedPostContent()),[]),g=(0,i.useSelect)((e=>e("core").getPostType(h)),[h]),v=(0,i.useSelect)((e=>e("core/editor").getCurrentPostId()),[]),m=(0,i.useSelect)((e=>"auto-draft"===e("core/editor").getEditedPostAttribute("status"))),y=`/${g?.rest_namespace}/${g?.rest_base}/${v}`;return(0,t.useEffect)((()=>{if(!m)return;const e="true"===l?.default_timestamps_enabled;e!==u&&s({meta:{...f,sdcom_timestamp_post:e}})}),[l]),(0,t.useEffect)((()=>{(async()=>{if(e&&u)try{if(p.length<0)throw new Error("postContent is empty.");const e={certificateType:"plain_text_upload",displayCreatedBy:!!l?.display_created_by,username:l?.username&&"true"===l?.display_created_by?l?.username:"anonymous"},t=new FormData;t.append("file",p),t.append("username",e.username),t.append("previous_certificate_id",d);const s=await(async({apiKey:e,formData:t})=>{try{const s=`${Ct}/create-certificate`,r=new Headers({Authorization:`Bearer ${e}`}),i=await fetch(s,{method:"POST",headers:r,body:t});if(!i.ok)throw console.log("Error in postData",{url:s,res:i}),Error(i.statusText);return i.json()}catch(e){throw console.error(e),e}})({apiKey:l.api_key,formData:t}),r=s?.certificate?.id;await(async({apiKey:e,certificateId:t,metadata:s})=>{try{const r=`${Ct}/update-certificate`,i=new Headers({Authorization:`Bearer ${e}`,"Content-Type":"application/json"}),n=await fetch(r,{method:"PATCH",headers:i,body:JSON.stringify({certificateId:t,metadata:s})});if(!n.ok)throw console.log("Error in postData",{url:r,res:n}),Error(n.statusText);return n.json()}catch(e){throw console.error(e),e}})({apiKey:l.api_key,certificateId:r,metadata:e}),c()({path:y,method:"POST",data:{meta:{...f,sdcom_previous_certificate_id:r}}}).catch((e=>{console.error("Error updating post meta:",e)})),a("success",(0,o.__)("Certificate created successfully.","timestamps"),{isDismissible:!0})}catch(e){console.error(e)}})()}),[e]),(0,t.createElement)(n.PluginPostStatusInfo,null,(0,t.createElement)(r.CheckboxControl,{label:(0,o.sprintf)((0,o.__)("Enable timestamps for this %s","timestamps"),h),help:(0,o.__)("Timestamps prove that you keep your content regularly up-to-date.","timestamps"),checked:u,onChange:e=>{s({meta:{...f,sdcom_timestamp_post:e}})}}))},icon:null})}()}();
     1!function(){"use strict";var e={907:function(e,t,s){s.r(t),s.d(t,{Headers:function(){return n},Request:function(){return o},Response:function(){return a},fetch:function(){return i}});var r=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof s.g)return s.g;throw new Error("unable to locate global object")}();const i=r.fetch;t.default=r.fetch.bind(r);const n=r.Headers,o=r.Request,a=r.Response}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,s),n.exports}s.m=e,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},function(){var e,t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};s.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var n=Object.create(null);s.r(n);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((function(e){o[e]=function(){return r[e]}}));return o.default=function(){return r},s.d(n,o),n}}(),s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce((function(t,r){return s.f[r](e,t),t}),[]))},s.u=function(e){return"js/"+e+".7e61fd99a8c41da8c843.chunk.js"},s.miniCssF=function(e){},s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={},t="timestamps-plugin:";s.l=function(r,i,n,o){if(e[r])e[r].push(i);else{var a,c;if(void 0!==n)for(var h=document.getElementsByTagName("script"),l=0;l<h.length;l++){var u=h[l];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+n){a=u;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",t+n),a.src=r),e[r]=[i];var d=function(t,s){a.onerror=a.onload=null,clearTimeout(f);var i=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((function(e){return e(s)})),t)return t(s)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}}}(),s.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e+"../"}(),function(){var e={948:0};s.f.j=function(t,r){var i=s.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise((function(s,r){i=e[t]=[s,r]}));r.push(i[2]=n);var o=s.p+s.u(t),a=new Error;s.l(o,(function(r){if(s.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",a.name="ChunkLoadError",a.type=n,a.request=o,i[1](a)}}),"chunk-"+t,t)}};var t=function(t,r){var i,n,o=r[0],a=r[1],c=r[2],h=0;if(o.some((function(t){return 0!==e[t]}))){for(i in a)s.o(a,i)&&(s.m[i]=a[i]);if(c)c(s)}for(t&&t(r);h<o.length;h++)n=o[h],s.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=self.webpackChunktimestamps_plugin=self.webpackChunktimestamps_plugin||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}(),function(){var e=window.wp.plugins,t=window.wp.element,r=window.wp.components,i=window.wp.data,n=window.wp.editPost,o=window.wp.i18n,a=window.wp.apiFetch,c=s.n(a);class h extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class l extends h{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class u extends h{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class d extends h{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var f=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class p{constructor(e,{headers:t={},customFetch:r}={}){this.url=e,this.headers=t,this.fetch=(e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)})(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s;return f(this,void 0,void 0,(function*(){try{const{headers:r,method:i,body:n}=t;let o,a={};n&&(r&&!Object.prototype.hasOwnProperty.call(r,"Content-Type")||!r)&&("undefined"!==typeof Blob&&n instanceof Blob||n instanceof ArrayBuffer?(a["Content-Type"]="application/octet-stream",o=n):"string"===typeof n?(a["Content-Type"]="text/plain",o=n):"undefined"!==typeof FormData&&n instanceof FormData?o=n:(a["Content-Type"]="application/json",o=JSON.stringify(n)));const c=yield this.fetch(`${this.url}/${e}`,{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},a),this.headers),r),body:o}).catch((e=>{throw new l(e)})),h=c.headers.get("x-relay-error");if(h&&"true"===h)throw new u(c);if(!c.ok)throw new d(c);let f,p=(null!==(s=c.headers.get("Content-Type"))&&void 0!==s?s:"text/plain").split(";")[0].trim();return f="application/json"===p?yield c.json():"application/octet-stream"===p?yield c.blob():"multipart/form-data"===p?yield c.formData():yield c.text(),{data:f,error:null}}catch(e){return{data:null,error:e}}}))}}var g=s(907);class v extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}class m{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:"undefined"===typeof fetch?this.fetch=g.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let s=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then((async e=>{var t,s,r;let i=null,n=null,o=null,a=e.status,c=e.statusText;if(e.ok){if("HEAD"!==this.method){const t=await e.text();""===t||(n="text/csv"===this.headers.Accept||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}const r=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),h=null===(s=e.headers.get("content-range"))||void 0===s?void 0:s.split("/");r&&h&&h.length>1&&(o=parseInt(h[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(n)&&(n.length>1?(i={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,o=null,a=406,c="Not Acceptable"):n=1===n.length?n[0]:null)}else{const t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(n=[],i=null,a=200,c="OK")}catch(s){404===e.status&&""===t?(a=204,c="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null===(r=null===i||void 0===i?void 0:i.details)||void 0===r?void 0:r.includes("0 rows"))&&(i=null,a=200,c="OK"),i&&this.shouldThrowOnError)throw new v(i)}return{error:i,data:n,count:o,status:a,statusText:c}}));return this.shouldThrowOnError||(s=s.catch((e=>{var t,s,r;return{error:{message:`${null!==(t=null===e||void 0===e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null===e||void 0===e?void 0:e.message}`,details:`${null!==(s=null===e||void 0===e?void 0:e.stack)&&void 0!==s?s:""}`,hint:"",code:`${null!==(r=null===e||void 0===e?void 0:e.code)&&void 0!==r?r:""}`},data:null,count:null,status:0,statusText:""}}))),s.then(e,t)}}class y extends m{select(e){let t=!1;const s=(null!==e&&void 0!==e?e:"*").split("").map((e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e))).join("");return this.url.searchParams.set("select",s),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:r,referencedTable:i=r}={}){const n=i?`${i}.order`:"order",o=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${void 0===s?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const r="undefined"===typeof s?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:r=s}={}){const i="undefined"===typeof r?"offset":`${r}.offset`,n="undefined"===typeof r?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(n,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return"GET"===this.method?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:s=!1,buffers:r=!1,wal:i=!1,format:n="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,s?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=null!==(o=this.headers.Accept)&&void 0!==o?o:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${n}; for="${c}"; options=${a};`,this}rollback(){var e;return(null!==(e=this.headers.Prefer)&&void 0!==e?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class w extends y{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const s=t.map((e=>"string"===typeof e&&new RegExp("[,()]").test(e)?`"${e}"`:`${e}`)).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}contains(e,t){return"string"===typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"===typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"===typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:r}={}){let i="";"plain"===r?i="pl":"phrase"===r?i="ph":"websearch"===r&&(i="w");const n=void 0===s?"":`(${s})`;return this.url.searchParams.append(e,`${i}fts${n}.${t}`),this}match(e){return Object.entries(e).forEach((([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)})),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}}class _{constructor(e,{headers:t={},schema:s,fetch:r}){this.url=e,this.headers=t,this.schema=s,this.fetch=r}select(e,{head:t=!1,count:s}={}){const r=t?"HEAD":"GET";let i=!1;const n=(null!==e&&void 0!==e?e:"*").split("").map((e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e))).join("");return this.url.searchParams.set("select",n),s&&(this.headers.Prefer=`count=${s}`),new w({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:s=!0}={}){const r=[];if(this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push(`count=${t}`),s||r.push("missing=default"),this.headers.Prefer=r.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new w({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:r,defaultToNull:i=!0}={}){const n=[`resolution=${s?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&n.push(this.headers.Prefer),r&&n.push(`count=${r}`),i||n.push("missing=default"),this.headers.Prefer=n.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new w({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){const s=[];return this.headers.Prefer&&s.push(this.headers.Prefer),t&&s.push(`count=${t}`),this.headers.Prefer=s.join(","),new w({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const t=[];return e&&t.push(`count=${e}`),this.headers.Prefer&&t.unshift(this.headers.Prefer),this.headers.Prefer=t.join(","),new w({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const b={"X-Client-Info":"postgrest-js/1.9.2"};class k{constructor(e,{headers:t={},schema:s,fetch:r}={}){this.url=e,this.headers=Object.assign(Object.assign({},b),t),this.schemaName=s,this.fetch=r}from(e){const t=new URL(`${this.url}/${e}`);return new _(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new k(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:s=!1,count:r}={}){let i;const n=new URL(`${this.url}/rpc/${e}`);let o;s?(i="HEAD",Object.entries(t).forEach((([e,t])=>{n.searchParams.append(e,`${t}`)}))):(i="POST",o=t);const a=Object.assign({},this.headers);return r&&(a.Prefer=`count=${r}`),new w({method:i,url:n,headers:a,schema:this.schemaName,body:o,fetch:this.fetch,allowEmpty:!1})}}const S={"X-Client-Info":"realtime-js/2.9.3"};var T,j,E,O,P,$,C;!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(T||(T={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(j||(j={})),function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"}(E||(E={})),function(e){e.websocket="websocket"}(O||(O={})),function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"}(P||(P={}));class R{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}}class A{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t("string"===typeof e?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,t,s)}_decodeBroadcast(e,t,s){const r=t.getUint8(1),i=t.getUint8(2);let n=this.HEADER_LENGTH+2;const o=s.decode(e.slice(n,n+r));n+=r;const a=s.decode(e.slice(n,n+i));n+=i;return{ref:null,topic:o,event:a,payload:JSON.parse(s.decode(e.slice(n,e.byteLength)))}}}class x{constructor(e,t,s={},r=1e4){this.channel=e,this.event=t,this.payload=s,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var s;return this._hasReceived(e)&&t(null===(s=this.receivedResp)||void 0===s?void 0:s.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);this.channel._on(this.refEvent,{},(e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}!function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"}($||($={}));class I{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(null===t||void 0===t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},(e=>{const{onJoin:t,onLeave:s,onSync:r}=this.caller;this.joinRef=this.channel._joinRef(),this.state=I.syncState(this.state,e,t,s),this.pendingDiffs.forEach((e=>{this.state=I.syncDiff(this.state,e,t,s)})),this.pendingDiffs=[],r()})),this.channel._on(s.diff,{},(e=>{const{onJoin:t,onLeave:s,onSync:r}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=I.syncDiff(this.state,e,t,s),r())})),this.onJoin(((e,t,s)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:s})})),this.onLeave(((e,t,s)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:s})})),this.onSync((()=>{this.channel._trigger("presence",{event:"sync"})}))}static syncState(e,t,s,r){const i=this.cloneDeep(e),n=this.transformState(t),o={},a={};return this.map(i,((e,t)=>{n[e]||(a[e]=t)})),this.map(n,((e,t)=>{const s=i[e];if(s){const r=t.map((e=>e.presence_ref)),i=s.map((e=>e.presence_ref)),n=t.filter((e=>i.indexOf(e.presence_ref)<0)),c=s.filter((e=>r.indexOf(e.presence_ref)<0));n.length>0&&(o[e]=n),c.length>0&&(a[e]=c)}else o[e]=t})),this.syncDiff(i,{joins:o,leaves:a},s,r)}static syncDiff(e,t,s,r){const{joins:i,leaves:n}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return s||(s=()=>{}),r||(r=()=>{}),this.map(i,((t,r)=>{var i;const n=null!==(i=e[t])&&void 0!==i?i:[];if(e[t]=this.cloneDeep(r),n.length>0){const s=e[t].map((e=>e.presence_ref)),r=n.filter((e=>s.indexOf(e.presence_ref)<0));e[t].unshift(...r)}s(t,n,r)})),this.map(n,((t,s)=>{let i=e[t];if(!i)return;const n=s.map((e=>e.presence_ref));i=i.filter((e=>n.indexOf(e.presence_ref)<0)),e[t]=i,r(t,i,s),0===i.length&&delete e[t]})),e}static map(e,t){return Object.getOwnPropertyNames(e).map((s=>t(s,e[s])))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce(((t,s)=>{const r=e[s];return t[s]="metas"in r?r.metas.map((e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))):r,t}),{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}!function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"}(C||(C={}));const L=(e,t,s={})=>{var r;const i=null!==(r=s.skipTypes)&&void 0!==r?r:[];return Object.keys(t).reduce(((s,r)=>(s[r]=U(r,e,t,i),s)),{})},U=(e,t,s,r)=>{const i=t.find((t=>t.name===e)),n=null===i||void 0===i?void 0:i.type,o=s[e];return n&&!r.includes(n)?D(n,o):N(o)},D=(e,t)=>{if("_"===e.charAt(0)){const s=e.slice(1,e.length);return z(t,s)}switch(e){case C.bool:return F(t);case C.float4:case C.float8:case C.int2:case C.int4:case C.int8:case C.numeric:case C.oid:return q(t);case C.json:case C.jsonb:return J(t);case C.timestamp:return B(t);case C.abstime:case C.date:case C.daterange:case C.int4range:case C.int8range:case C.money:case C.reltime:case C.text:case C.time:case C.timestamptz:case C.timetz:case C.tsrange:case C.tstzrange:default:return N(t)}},N=e=>e,F=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},q=e=>{if("string"===typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},J=e=>{if("string"===typeof e)try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},z=(e,t)=>{if("string"!==typeof e)return e;const s=e.length-1,r=e[s];if("{"===e[0]&&"}"===r){let r;const i=e.slice(1,s);try{r=JSON.parse("["+i+"]")}catch(e){r=i?i.split(","):[]}return r.map((e=>D(t,e)))}return e},B=e=>"string"===typeof e?e.replace(" ","T"):e;var M,K,G;!function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(M||(M={})),function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes"}(K||(K={})),function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"}(G||(G={}));class H{constructor(e,t={config:{}},s){this.topic=e,this.params=t,this.socket=s,this.bindings={},this.state=j.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},t.config),this.timeout=this.socket.timeout,this.joinPush=new x(this,E.join,this.params,this.timeout),this.rejoinTimer=new R((()=>this._rejoinUntilConnected()),this.socket.reconnectAfterMs),this.joinPush.receive("ok",(()=>{this.state=j.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this._onClose((()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=j.closed,this.socket._remove(this)})),this._onError((e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=j.errored,this.rejoinTimer.scheduleTimeout())})),this.joinPush.receive("timeout",(()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=j.errored,this.rejoinTimer.scheduleTimeout())})),this._on(E.reply,{},((e,t)=>{this._trigger(this._replyEventName(t),e)})),this.presence=new I(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(e,t=this.timeout){var s,r;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:i,presence:n}}=this.params;this._onError((t=>e&&e("CHANNEL_ERROR",t))),this._onClose((()=>e&&e("CLOSED")));const o={},a={broadcast:i,presence:n,postgres_changes:null!==(r=null===(s=this.bindings.postgres_changes)||void 0===s?void 0:s.map((e=>e.filter)))&&void 0!==r?r:[]};this.socket.accessToken&&(o.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:a},o)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",(({postgres_changes:t})=>{var s;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),void 0!==t){const r=this.bindings.postgres_changes,i=null!==(s=null===r||void 0===r?void 0:r.length)&&void 0!==s?s:0,n=[];for(let s=0;s<i;s++){const i=r[s],{filter:{event:o,schema:a,table:c,filter:h}}=i,l=t&&t[s];if(!l||l.event!==o||l.schema!==a||l.table!==c||l.filter!==h)return this.unsubscribe(),void(e&&e("CHANNEL_ERROR",new Error("mismatch between server and client bindings for postgres changes")));n.push(Object.assign(Object.assign({},i),{id:l.id}))}return this.bindings.postgres_changes=n,void(e&&e("SUBSCRIBED"))}e&&e("SUBSCRIBED")})).receive("error",(t=>{e&&e("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(t).join(", ")||"error")))})).receive("timeout",(()=>{e&&e("TIMED_OUT")}))}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,s){return this._on(e,t,s)}async send(e,t={}){var s,r;if(this._canPush()||"broadcast"!==e.type)return new Promise((s=>{var r,i,n;const o=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(n=null===(i=null===(r=this.params)||void 0===r?void 0:r.config)||void 0===i?void 0:i.broadcast)||void 0===n?void 0:n.ack)||s("ok"),o.receive("ok",(()=>s("ok"))),o.receive("timeout",(()=>s("timed out")))}));{const{event:i,payload:n}=e,o={method:"POST",headers:{apikey:null!==(s=this.socket.apiKey)&&void 0!==s?s:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:n}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,o,null!==(r=t.timeout)&&void 0!==r?r:this.timeout)).ok?"ok":"error"}catch(e){return"AbortError"===e.name?"timed out":"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=j.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(E.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise((s=>{const r=new x(this,E.leave,{},e);r.receive("ok",(()=>{t(),s("ok")})).receive("timeout",(()=>{t(),s("timed out")})).receive("error",(()=>{s("error")})),r.send(),this._canPush()||r.trigger("ok",{})}))}_broadcastEndpointURL(){let e=this.socket.endPoint;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(e,t,s){const r=new AbortController,i=setTimeout((()=>r.abort()),s),n=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(i),n}_push(e,t,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new x(this,e,t,s);return this._canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}_onMessage(e,t,s){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,s){var r,i;const n=e.toLocaleLowerCase(),{close:o,error:a,leave:c,join:h}=E;if(s&&[o,a,c,h].indexOf(n)>=0&&s!==this._joinRef())return;let l=this._onMessage(n,t,s);if(t&&!l)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(n)?null===(r=this.bindings.postgres_changes)||void 0===r||r.filter((e=>{var t,s,r;return"*"===(null===(t=e.filter)||void 0===t?void 0:t.event)||(null===(r=null===(s=e.filter)||void 0===s?void 0:s.event)||void 0===r?void 0:r.toLocaleLowerCase())===n})).map((e=>e.callback(l,s))):null===(i=this.bindings[n])||void 0===i||i.filter((e=>{var s,r,i,o,a,c;if(["broadcast","presence","postgres_changes"].includes(n)){if("id"in e){const n=e.id,o=null===(s=e.filter)||void 0===s?void 0:s.event;return n&&(null===(r=t.ids)||void 0===r?void 0:r.includes(n))&&("*"===o||(null===o||void 0===o?void 0:o.toLocaleLowerCase())===(null===(i=t.data)||void 0===i?void 0:i.type.toLocaleLowerCase()))}{const s=null===(a=null===(o=null===e||void 0===e?void 0:e.filter)||void 0===o?void 0:o.event)||void 0===a?void 0:a.toLocaleLowerCase();return"*"===s||s===(null===(c=null===t||void 0===t?void 0:t.event)||void 0===c?void 0:c.toLocaleLowerCase())}}return e.type.toLocaleLowerCase()===n})).map((e=>{if("object"===typeof l&&"ids"in l){const e=l.data,{schema:t,table:s,commit_timestamp:r,type:i,errors:n}=e,o={schema:t,table:s,commit_timestamp:r,eventType:i,new:{},old:{},errors:n};l=Object.assign(Object.assign({},o),this._getPayloadRecords(e))}e.callback(l,s)}))}_isClosed(){return this.state===j.closed}_isJoined(){return this.state===j.joined}_isJoining(){return this.state===j.joining}_isLeaving(){return this.state===j.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,s){const r=e.toLocaleLowerCase(),i={type:r,filter:t,callback:s};return this.bindings[r]?this.bindings[r].push(i):this.bindings[r]=[i],this}_off(e,t){const s=e.toLocaleLowerCase();return this.bindings[s]=this.bindings[s].filter((e=>{var r;return!((null===(r=e.type)||void 0===r?void 0:r.toLocaleLowerCase())===s&&H.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(E.close,{},e)}_onError(e){this._on(E.error,{},(t=>e(t)))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=j.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return"INSERT"!==e.type&&"UPDATE"!==e.type||(t.new=L(e.columns,e.record)),"UPDATE"!==e.type&&"DELETE"!==e.type||(t.old=L(e.columns,e.old_record)),t}}const V=()=>{},W="undefined"!==typeof WebSocket;class X{constructor(e,t){var r;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.headers=S,this.params={},this.timeout=1e4,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=V,this.conn=null,this.sendBuffer=[],this.serializer=new A,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},this.endPoint=`${e}/${O.websocket}`,(null===t||void 0===t?void 0:t.transport)?this.transport=t.transport:this.transport=null,(null===t||void 0===t?void 0:t.params)&&(this.params=t.params),(null===t||void 0===t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),(null===t||void 0===t?void 0:t.timeout)&&(this.timeout=t.timeout),(null===t||void 0===t?void 0:t.logger)&&(this.logger=t.logger),(null===t||void 0===t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);const i=null===(r=null===t||void 0===t?void 0:t.params)||void 0===r?void 0:r.apikey;i&&(this.accessToken=i,this.apiKey=i),this.reconnectAfterMs=(null===t||void 0===t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null===t||void 0===t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null===t||void 0===t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new R((async()=>{this.disconnect(),this.connect()}),this.reconnectAfterMs),this.fetch=this._resolveFetch(null===t||void 0===t?void 0:t.fetch)}connect(){if(!this.conn)if(this.transport)this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});else{if(W)return this.conn=new WebSocket(this._endPointURL()),void this.setupConnection();this.conn=new Y(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),s.e(591).then(s.t.bind(s,1591,23)).then((({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()}))}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!==t&&void 0!==t?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map((e=>e.unsubscribe())));return this.disconnect(),e}log(e,t,s){this.logger(e,t,s)}connectionState(){switch(this.conn&&this.conn.readyState){case T.connecting:return P.Connecting;case T.open:return P.Open;case T.closing:return P.Closing;default:return P.Closed}}isConnected(){return this.connectionState()===P.Open}channel(e,t={config:{}}){const s=new H(`realtime:${e}`,t,this);return this.channels.push(s),s}push(e){const{topic:t,event:s,payload:r,ref:i}=e,n=()=>{this.encode(e,(e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)}))};this.log("push",`${t} ${s} (${i})`,r),this.isConnected()?n():this.sendBuffer.push(n)}setAuth(e){this.accessToken=e,this.channels.forEach((t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(E.access_token,{access_token:e})}))}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t._isJoined()||t._isJoining())));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter((t=>t._joinRef()!==e._joinRef()))}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}_onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:s,payload:r,ref:i}=e;(i&&i===this.pendingHeartbeatRef||s===(null===r||void 0===r?void 0:r.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${r.status||""} ${t} ${s} ${i&&"("+i+")"||""}`,r),this.channels.filter((e=>e._isMember(t))).forEach((e=>e._trigger(s,r,i))),this.stateChangeCallbacks.message.forEach((t=>t(e)))}))}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval((()=>this._sendHeartbeat()),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach((e=>e()))}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((t=>t(e)))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach((t=>t(e)))}_triggerChanError(){this.channels.forEach((e=>e._trigger(E.error)))}_appendParams(e,t){if(0===Object.keys(t).length)return e;const s=e.match(/\?/)?"&":"?";return`${e}${s}${new URLSearchParams(t)}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void(null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout"));this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class Y{constructor(e,t,s){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=T.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=s.close}}class Q extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Z(e){return"object"===typeof e&&null!==e&&"__isStorageError"in e}class ee extends Q{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class te extends Q{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var se=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const re=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)};var ie=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const ne=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),oe=(e,t)=>ie(void 0,void 0,void 0,(function*(){const r=yield se(void 0,void 0,void 0,(function*(){return"undefined"===typeof Response?(yield Promise.resolve().then(s.bind(s,907))).Response:Response}));e instanceof r?e.json().then((s=>{t(new ee(ne(s),e.status||500))})).catch((e=>{t(new te(ne(e),e))})):t(new te(ne(e),e))})),ae=(e,t,s,r)=>{const i={method:e,headers:(null===t||void 0===t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json"},null===t||void 0===t?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),s))};function ce(e,t,s,r,i,n){return ie(this,void 0,void 0,(function*(){return new Promise(((o,a)=>{e(s,ae(t,r,i,n)).then((e=>{if(!e.ok)throw e;return(null===r||void 0===r?void 0:r.noResolveJson)?e:e.json()})).then((e=>o(e))).catch((e=>oe(e,a)))}))}))}function he(e,t,s,r){return ie(this,void 0,void 0,(function*(){return ce(e,"GET",t,s,r)}))}function le(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"POST",t,r,i,s)}))}function ue(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"DELETE",t,r,i,s)}))}var de=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const fe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},pe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ge{constructor(e,t={},s,r){this.url=e,this.headers=t,this.bucketId=s,this.fetch=re(r)}uploadOrUpdate(e,t,s,r){return de(this,void 0,void 0,(function*(){try{let i;const n=Object.assign(Object.assign({},pe),r),o=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)});"undefined"!==typeof Blob&&s instanceof Blob?(i=new FormData,i.append("cacheControl",n.cacheControl),i.append("",s)):"undefined"!==typeof FormData&&s instanceof FormData?(i=s,i.append("cacheControl",n.cacheControl)):(i=s,o["cache-control"]=`max-age=${n.cacheControl}`,o["content-type"]=n.contentType);const a=this._removeEmptyFolders(t),c=this._getFinalPath(a),h=yield this.fetch(`${this.url}/object/${c}`,Object.assign({method:e,body:i,headers:o},(null===n||void 0===n?void 0:n.duplex)?{duplex:n.duplex}:{})),l=yield h.json();if(h.ok)return{data:{path:a,id:l.Id,fullPath:l.Key},error:null};return{data:null,error:l}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}upload(e,t,s){return de(this,void 0,void 0,(function*(){return this.uploadOrUpdate("POST",e,t,s)}))}uploadToSignedUrl(e,t,s,r){return de(this,void 0,void 0,(function*(){const i=this._removeEmptyFolders(e),n=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${n}`);o.searchParams.set("token",t);try{let e;const t=Object.assign({upsert:pe.upsert},r),n=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!==typeof Blob&&s instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),e.append("",s)):"undefined"!==typeof FormData&&s instanceof FormData?(e=s,e.append("cacheControl",t.cacheControl)):(e=s,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType);const a=yield this.fetch(o.toString(),{method:"PUT",body:e,headers:n}),c=yield a.json();if(a.ok)return{data:{path:i,fullPath:c.Key},error:null};return{data:null,error:c}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUploadUrl(e){return de(this,void 0,void 0,(function*(){try{let t=this._getFinalPath(e);const s=yield le(this.fetch,`${this.url}/object/upload/sign/${t}`,{},{headers:this.headers}),r=new URL(this.url+s.url),i=r.searchParams.get("token");if(!i)throw new Q("No token returned by API");return{data:{signedUrl:r.toString(),path:e,token:i},error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}update(e,t,s){return de(this,void 0,void 0,(function*(){return this.uploadOrUpdate("PUT",e,t,s)}))}move(e,t){return de(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}copy(e,t){return de(this,void 0,void 0,(function*(){try{return{data:{path:(yield le(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers})).Key},error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUrl(e,t,s){return de(this,void 0,void 0,(function*(){try{let r=this._getFinalPath(e),i=yield le(this.fetch,`${this.url}/object/sign/${r}`,Object.assign({expiresIn:t},(null===s||void 0===s?void 0:s.transform)?{transform:s.transform}:{}),{headers:this.headers});const n=(null===s||void 0===s?void 0:s.download)?`&download=${!0===s.download?"":s.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${n}`)},{data:i,error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUrls(e,t,s){return de(this,void 0,void 0,(function*(){try{const r=yield le(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=(null===s||void 0===s?void 0:s.download)?`&download=${!0===s.download?"":s.download}`:"";return{data:r.map((e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null}))),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}download(e,t){return de(this,void 0,void 0,(function*(){const s="undefined"!==typeof(null===t||void 0===t?void 0:t.transform)?"render/image/authenticated":"object",r=this.transformOptsToQueryString((null===t||void 0===t?void 0:t.transform)||{}),i=r?`?${r}`:"";try{const t=this._getFinalPath(e),r=yield he(this.fetch,`${this.url}/${s}/${t}${i}`,{headers:this.headers,noResolveJson:!0});return{data:yield r.blob(),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}getPublicUrl(e,t){const s=this._getFinalPath(e),r=[],i=(null===t||void 0===t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&r.push(i);const n="undefined"!==typeof(null===t||void 0===t?void 0:t.transform)?"render/image":"object",o=this.transformOptsToQueryString((null===t||void 0===t?void 0:t.transform)||{});""!==o&&r.push(o);let a=r.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${n}/public/${s}${a}`)}}}remove(e){return de(this,void 0,void 0,(function*(){try{return{data:yield ue(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}list(e,t,s){return de(this,void 0,void 0,(function*(){try{const r=Object.assign(Object.assign(Object.assign({},fe),t),{prefix:e||""});return{data:yield le(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},s),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const ve={"X-Client-Info":"storage-js/2.5.5"};var me=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class ye{constructor(e,t={},s){this.url=e,this.headers=Object.assign(Object.assign({},ve),t),this.fetch=re(s)}listBuckets(){return me(this,void 0,void 0,(function*(){try{return{data:yield he(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}getBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield he(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createBucket(e,t={public:!1}){return me(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}updateBucket(e,t){return me(this,void 0,void 0,(function*(){try{const s=yield function(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"PUT",t,r,i,s)}))}(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers});return{data:s,error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}emptyBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}deleteBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield ue(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}}class we extends ye{constructor(e,t={},s){super(e,t,s)}from(e){return new ge(this.url,this.headers,e,this.fetch)}}let _e="";_e="undefined"!==typeof Deno?"deno":"undefined"!==typeof document?"web":"undefined"!==typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";const be={headers:{"X-Client-Info":`supabase-js-${_e}/2.39.7`}},ke={schema:"public"},Se={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Te={};var je=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const Ee=e=>{let t;return t=e||("undefined"===typeof fetch?g.default:fetch),(...e)=>t(...e)},Oe=(e,t,s)=>{const r=Ee(s),i="undefined"===typeof Headers?g.Headers:Headers;return(s,n)=>je(void 0,void 0,void 0,(function*(){var o;const a=null!==(o=yield t())&&void 0!==o?o:e;let c=new i(null===n||void 0===n?void 0:n.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${a}`),r(s,Object.assign(Object.assign({},n),{headers:c}))}))};const Pe=()=>"undefined"!==typeof document,$e={tested:!1,writable:!1},Ce=()=>{if(!Pe())return!1;try{if("object"!==typeof globalThis.localStorage)return!1}catch(e){return!1}if($e.tested)return $e.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),$e.tested=!0,$e.writable=!0}catch(e){$e.tested=!0,$e.writable=!1}return $e.writable};function Re(e){const t={},s=new URL(e);if(s.hash&&"#"===s.hash[0])try{new URLSearchParams(s.hash.substring(1)).forEach(((e,s)=>{t[s]=e}))}catch(e){}return s.searchParams.forEach(((e,s)=>{t[s]=e})),t}const Ae=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},xe=e=>"object"===typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"===typeof e.json,Ie=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},Le=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch(e){return s}},Ue=async(e,t)=>{await e.removeItem(t)};class De{constructor(){this.promise=new De.promiseConstructor(((e,t)=>{this.resolve=e,this.reject=t}))}}function Ne(e){const t=e.split(".");if(3!==t.length)throw new Error("JWT is not valid: not a JWT structure");if(!/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i.test(t[1]))throw new Error("JWT is not valid: payload is not in base64url format");const s=t[1];return JSON.parse(function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s,r,i,n,o,a,c,h="",l=0;for(e=e.replace("-","+").replace("_","/");l<e.length;)n=t.indexOf(e.charAt(l++)),o=t.indexOf(e.charAt(l++)),a=t.indexOf(e.charAt(l++)),c=t.indexOf(e.charAt(l++)),s=n<<2|o>>4,r=(15&o)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(s),64!=a&&0!=r&&(h+=String.fromCharCode(r)),64!=c&&0!=i&&(h+=String.fromCharCode(i));return h}(s))}function Fe(e){return("0"+e.toString(16)).substr(-2)}function qe(){const e=new Uint32Array(56);if("undefined"===typeof crypto){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length;let s="";for(let r=0;r<56;r++)s+=e.charAt(Math.floor(Math.random()*t));return s}return crypto.getRandomValues(e),Array.from(e,Fe).join("")}async function Je(e){if(!("undefined"!==typeof crypto&&"undefined"!==typeof crypto.subtle&&"undefined"!==typeof TextEncoder))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const t=await async function(e){const t=(new TextEncoder).encode(e),s=await crypto.subtle.digest("SHA-256",t),r=new Uint8Array(s);return Array.from(r).map((e=>String.fromCharCode(e))).join("")}(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}De.promiseConstructor=Promise;class ze extends Error{constructor(e,t){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t}}function Be(e){return"object"===typeof e&&null!==e&&"__isAuthError"in e}class Me extends ze{constructor(e,t){super(e,t),this.name="AuthApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Ke extends ze{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Ge extends ze{constructor(e,t,s){super(e),this.name=t,this.status=s}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class He extends Ge{constructor(){super("Auth session missing!","AuthSessionMissingError",400)}}class Ve extends Ge{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500)}}class We extends Ge{constructor(e){super(e,"AuthInvalidCredentialsError",400)}}class Xe extends Ge{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ye extends Ge{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Qe extends Ge{constructor(e,t){super(e,"AuthRetryableFetchError",t)}}function Ze(e){return Be(e)&&"AuthRetryableFetchError"===e.name}class et extends Ge{constructor(e,t,s){super(e,"AuthWeakPasswordError",t),this.reasons=s}}var tt=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s};const st=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rt=[502,503,504];async function it(e){if(!xe(e))throw new Qe(st(e),0);if(rt.includes(e.status))throw new Qe(st(e),e.status);let t;try{t=await e.json()}catch(e){throw new Ke(st(e),e)}if("object"===typeof t&&t&&"object"===typeof t.weak_password&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce(((e,t)=>e&&"string"===typeof t),!0))throw new et(st(t),e.status,t.weak_password.reasons);throw new Me(st(t),e.status||500)}const nt=(e,t,s,r)=>{const i={method:e,headers:(null===t||void 0===t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null===t||void 0===t?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),s))};async function ot(e,t,s,r){var i;const n=Object.assign({},null===r||void 0===r?void 0:r.headers);(null===r||void 0===r?void 0:r.jwt)&&(n.Authorization=`Bearer ${r.jwt}`);const o=null!==(i=null===r||void 0===r?void 0:r.query)&&void 0!==i?i:{};(null===r||void 0===r?void 0:r.redirectTo)&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await async function(e,t,s,r,i,n){const o=nt(t,r,i,n);let a;try{a=await e(s,o)}catch(e){throw console.error(e),new Qe(st(e),0)}a.ok||await it(a);if(null===r||void 0===r?void 0:r.noResolveJson)return a;try{return await a.json()}catch(e){await it(e)}}(e,t,s+a,{headers:n,noResolveJson:null===r||void 0===r?void 0:r.noResolveJson},{},null===r||void 0===r?void 0:r.body);return(null===r||void 0===r?void 0:r.xform)?null===r||void 0===r?void 0:r.xform(c):{data:Object.assign({},c),error:null}}function at(e){var t;let s=null;var r;(function(e){return e.access_token&&e.refresh_token&&e.expires_in})(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:s,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function ct(e){const t=at(e);return!t.error&&e.weak_password&&"object"===typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"===typeof e.weak_password.message&&e.weak_password.reasons.reduce(((e,t)=>e&&"string"===typeof t),!0)&&(t.data.weak_password=e.weak_password),t}function ht(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function lt(e){return{data:e,error:null}}function ut(e){const{action_link:t,email_otp:s,hashed_token:r,redirect_to:i,verification_type:n}=e,o=tt(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]);return{data:{properties:{action_link:t,email_otp:s,hashed_token:r,redirect_to:i,verification_type:n},user:Object.assign({},o)},error:null}}function dt(e){return e}var ft=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s};class pt{constructor({url:e="",headers:t={},fetch:s}){this.url=e,this.headers=t,this.fetch=Ae(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await ot(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await ot(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{const{options:t}=e,s=ft(e,["options"]),r=Object.assign(Object.assign({},s),t);return"newEmail"in s&&(r.new_email=null===s||void 0===s?void 0:s.newEmail,delete r.newEmail),await ot(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:ut,redirectTo:null===t||void 0===t?void 0:t.redirectTo})}catch(e){if(Be(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await ot(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,s,r,i,n,o,a;try{const c={nextPage:null,lastPage:0,total:0},h=await ot(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(s=null===(t=null===e||void 0===e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==s?s:"",per_page:null!==(i=null===(r=null===e||void 0===e?void 0:e.perPage)||void 0===r?void 0:r.toString())&&void 0!==i?i:""},xform:dt});if(h.error)throw h.error;const l=await h.json(),u=null!==(n=h.headers.get("x-total-count"))&&void 0!==n?n:0,d=null!==(a=null===(o=h.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return d.length>0&&(d.forEach((e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),s=JSON.parse(e.split(";")[1].split("=")[1]);c[`${s}Page`]=t})),c.total=parseInt(u)),{data:Object.assign(Object.assign({},l),c),error:null}}catch(e){if(Be(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await ot(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await ot(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){try{return await ot(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{const{data:t,error:s}=await ot(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:s}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{return{data:await ot(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}}const gt="0.0.0",vt={"X-Client-Info":`gotrue-js/${gt}`},mt={getItem:e=>Ce()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{Ce()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{Ce()&&globalThis.localStorage.removeItem(e)}};function yt(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const wt=!!(globalThis&&Ce()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"));class _t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class bt extends _t{}async function kt(e,t,s){wt&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout((()=>{r.abort(),wt&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)}),t),await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},(async r=>{if(!r){if(0===t)throw wt&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new bt(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(wt)try{const e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null,"  "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await s()}wt&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,r.name);try{return await s()}finally{wt&&console.log("@supabase/gotrue-js: navigatorLock: released",e,r.name)}}))}!function(){if("object"!==typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!==typeof self&&(self.globalThis=self)}}();const St={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vt,flowType:"implicit",debug:!1},Tt=3e4;async function jt(e,t,s){return await s()}class Et{constructor(e){var t,s;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Et.nextInstanceID,Et.nextInstanceID+=1,this.instanceID>0&&Pe()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},St),e);if(this.logDebugMessages=!!r.debug,"function"===typeof r.debug&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new pt({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=Ae(r.fetch),this.lock=r.lock||jt,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,r.lock?this.lock=r.lock:Pe()&&(null===(t=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.locks)?this.lock=kt:this.lock=jt,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:Ce()?this.storage=mt:(this.memoryStorage={},this.storage=yt(this.memoryStorage)):(this.memoryStorage={},this.storage=yt(this.memoryStorage)),Pe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null===(s=this.broadcastChannel)||void 0===s||s.addEventListener("message",(async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}))}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${gt}) ${(new Date).toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,(async()=>await this._initialize())))()),await this.initializePromise}async _initialize(){try{const e=!!Pe()&&await this._isPKCEFlow();if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:t,error:s}=await this._getSessionFromURL(e);if(s)return this._debug("#_initialize()","error detecting session from URL",s),"Identity is already linked"===(null===s||void 0===s?void 0:s.message)||"Identity is already linked to another user"===(null===s||void 0===s?void 0:s.message)||await this._removeSession(),{error:s};const{session:r,redirectType:i}=t;return this._debug("#_initialize()","detected session in URL",r,"redirect type",i),await this._saveSession(r),setTimeout((async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",r):await this._notifyAllSubscribers("SIGNED_IN",r)}),0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return Be(e)?{error:e}:{error:new Ke("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signUp(e){var t,s,r;try{let i;if(await this._removeSession(),"email"in e){const{email:s,password:r,options:n}=e;let o=null,a=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),o=await Je(e),a=e===o?"plain":"s256"}i=await ot(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null===n||void 0===n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null===n||void 0===n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null===n||void 0===n?void 0:n.captchaToken},code_challenge:o,code_challenge_method:a},xform:at})}else{if(!("phone"in e))throw new We("You must provide either an email or phone number and a password");{const{phone:t,password:n,options:o}=e;i=await ot(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null===o||void 0===o?void 0:o.data)&&void 0!==s?s:{},channel:null!==(r=null===o||void 0===o?void 0:o.channel)&&void 0!==r?r:"sms",gotrue_meta_security:{captcha_token:null===o||void 0===o?void 0:o.captchaToken}},xform:at})}}const{data:n,error:o}=i;if(o||!n)return{data:{user:null,session:null},error:o};const a=n.session,c=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if(await this._removeSession(),"email"in e){const{email:s,password:r,options:i}=e;t=await ot(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},xform:ct})}else{if(!("phone"in e))throw new We("You must provide either an email or phone number and a password");{const{phone:s,password:r,options:i}=e;t=await ot(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},xform:ct})}}const{data:s,error:r}=t;return r?{data:{user:null,session:null},error:r}:s&&s.session&&s.user?(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r}):{data:{user:null,session:null},error:new Ve}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,(async()=>this._exchangeCodeForSession(e)))}async _exchangeCodeForSession(e){const t=await Le(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!==t&&void 0!==t?t:"").split("/"),{data:i,error:n}=await ot(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:at});return await Ue(this.storage,`${this.storageKey}-code-verifier`),n?{data:{user:null,session:null,redirectType:null},error:n}:i&&i.session&&i.user?(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:null!==r&&void 0!==r?r:null}),error:n}):{data:{user:null,session:null,redirectType:null},error:new Ve}}async signInWithIdToken(e){await this._removeSession();try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,o=await ot(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null===t||void 0===t?void 0:t.captchaToken}},xform:at}),{data:a,error:c}=o;return c?{data:{user:null,session:null},error:c}:a&&a.session&&a.user?(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:c}):{data:{user:null,session:null},error:new Ve}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if(await this._removeSession(),"email"in e){const{email:r,options:i}=e;let n=null,o=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),n=await Je(e),o=e===n?"plain":"s256"}const{error:a}=await ot(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null===i||void 0===i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null===i||void 0===i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:o},redirectTo:null===i||void 0===i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:a}}if("phone"in e){const{phone:t,options:s}=e,{data:o,error:a}=await ot(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null===s||void 0===s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null===s||void 0===s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null===s||void 0===s?void 0:s.captchaToken},channel:null!==(n=null===s||void 0===s?void 0:s.channel)&&void 0!==n?n:"sms"}});return{data:{user:null,session:null,messageId:null===o||void 0===o?void 0:o.message_id},error:a}}throw new We("You must provide either an email or phone number.")}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,s;try{let r,i;"email_change"!==e.type&&"phone_change"!==e.type&&await this._removeSession(),"options"in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:o}=await ot(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:at});if(o)throw o;if(!n)throw new Error("An error occurred on token verification.");const a=n.session,c=n.user;return(null===a||void 0===a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,s,r;try{await this._removeSession();let i=null,n=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),i=await Je(e),n=e===i?"plain":"s256"}return await ot(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null===e||void 0===e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:n}),headers:this.headers,xform:lt})}catch(e){if(Be(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._reauthenticate()))}async _reauthenticate(){try{return await this._useSession((async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new He;const{error:r}=await ot(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:r}}))}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{"email_change"!=e.type&&"phone_change"!=e.type&&await this._removeSession();const t=`${this.url}/resend`;if("email"in e){const{email:s,type:r,options:i}=e,{error:n}=await ot(this.fetch,"POST",t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},redirectTo:null===i||void 0===i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:n}}if("phone"in e){const{phone:s,type:r,options:i}=e,{data:n,error:o}=await ot(this.fetch,"POST",t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null===n||void 0===n?void 0:n.message_id},error:o}}throw new We("You must provide either an email or phone number and a type")}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,this._acquireLock(-1,(async()=>this._useSession((async e=>e))))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,(async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}}))}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",(new Error).stack);try{let e=null;const t=await Le(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&e.expires_at<=Date.now()/1e3;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s)return{data:{session:e},error:null};const{session:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,this._acquireLock(-1,(async()=>await this._getUser())))}async _getUser(e){try{return e?await ot(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ht}):await this._useSession((async e=>{var t,s;const{data:r,error:i}=e;if(i)throw i;return await ot(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(s=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==s?s:void 0,xform:ht})}))}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._updateUser(e,t)))}async _updateUser(e,t={}){try{return await this._useSession((async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new He;const n=r.session;let o=null,a=null;if("pkce"===this.flowType&&null!=e.email){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),o=await Je(e),a=e===o?"plain":"s256"}const{data:c,error:h}=await ot(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null===t||void 0===t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:a}),jwt:n.access_token,xform:ht});if(h)throw h;return n.user=c.user,await this._saveSession(n),await this._notifyAllSubscribers("USER_UPDATED",n),{data:{user:n.user},error:null}}))}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return Ne(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._setSession(e)))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new He;const t=Date.now()/1e3;let s=t,r=!0,i=null;const n=Ne(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{session:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return{data:{user:null,session:null},error:s};if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)throw n;i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:"bearer",expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(Be(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._refreshSession(e)))}async _refreshSession(e){try{return await this._useSession((async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null===e||void 0===e?void 0:e.refresh_token))throw new He;const{session:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:r?{data:{user:r.user,session:r},error:null}:{data:{user:null,session:null},error:null}}))}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!Pe())throw new Xe("No browser detected.");if("implicit"===this.flowType&&!this._isImplicitGrantFlow())throw new Xe("Not a valid implicit grant flow url.");if("pkce"==this.flowType&&!e)throw new Ye("Not a valid PKCE flow url.");const t=Re(window.location.href);if(e){if(!t.code)throw new Ye("No code detected.");const{data:e,error:s}=await this._exchangeCodeForSession(t.code);if(s)throw s;const r=new URL(window.location.href);return r.searchParams.delete("code"),window.history.replaceState(window.history.state,"",r.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new Xe(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});const{provider_token:s,provider_refresh_token:r,access_token:i,refresh_token:n,expires_in:o,expires_at:a,token_type:c}=t;if(!i||!o||!n||!c)throw new Xe("No session defined in URL");const h=Math.round(Date.now()/1e3),l=parseInt(o);let u=h+l;a&&(u=parseInt(a));const d=u-h;1e3*d<=Tt&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${l}s`);const f=u-l;h-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,u,h):h-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",f,u,h);const{data:p,error:g}=await this._getUser(i);if(g)throw g;const v={provider_token:s,provider_refresh_token:r,access_token:i,expires_in:l,expires_at:u,refresh_token:n,token_type:c,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:v,redirectType:t.type},error:null}}catch(e){if(Be(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){const e=Re(window.location.href);return!(!Pe()||!e.access_token&&!e.error_description)}async _isPKCEFlow(){const e=Re(window.location.href),t=await Le(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._signOut(e)))}async _signOut({scope:e}={scope:"global"}){return await this._useSession((async t=>{var s;const{data:r,error:i}=t;if(i)return{error:i};const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!function(e){return Be(e)&&"AuthApiError"===e.name}(t)||404!==t.status&&401!==t.status))return{error:t}}return"others"!==e&&(await this._removeSession(),await Ue(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}}))}onAuthStateChange(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),s={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,await this._acquireLock(-1,(async()=>{this._emitInitialSession(t)}))})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession((async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback("INITIAL_SESSION",r)),this._debug("INITIAL_SESSION","callback id",e,"session",r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}}))}async resetPasswordForEmail(e,t={}){let s=null,r=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,`${e}/PASSWORD_RECOVERY`),s=await Je(e),r=e===s?"plain":"s256"}try{return await ot(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(Be(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return{data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{const{data:s,error:r}=await this._useSession((async t=>{var s,r,i,n,o;const{data:a,error:c}=t;if(c)throw c;const h=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await ot(this.fetch,"GET",h,{headers:this.headers,jwt:null!==(o=null===(n=a.session)||void 0===n?void 0:n.access_token)&&void 0!==o?o:void 0})}));if(r)throw r;return Pe()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null===s||void 0===s?void 0:s.url),{data:{provider:e.provider,url:null===s||void 0===s?void 0:s.url},error:null}}catch(t){if(Be(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession((async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await ot(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const i=Date.now();return await(s=async s=>(await async function(e){return await new Promise((t=>{setTimeout((()=>t(null)),e)}))}(200*s),this._debug(t,"refreshing attempt",s),await ot(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:at})),r=(e,t,s)=>s&&s.error&&Ze(s.error)&&Date.now()+200*(e+1)-i<Tt,new Promise(((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{const t=await s(i);if(!r(i,null,t))return void e(t)}catch(e){if(!r(i,e))return void t(e)}})()})))}catch(e){if(this._debug(t,"error",e),Be(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}var s,r}_isValidSession(e){return"object"===typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const s=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",s),Pe()&&!t.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e;const t="#_recoverAndRefresh()";this._debug(t,"begin");try{const s=await Le(this.storage,this.storageKey);if(this._debug(t,"session from storage",s),!this._isValidSession(s))return this._debug(t,"session is not valid"),void(null!==s&&await this._removeSession());const r=Math.round(Date.now()/1e3),i=(null!==(e=s.expires_at)&&void 0!==e?e:1/0)<r+10;if(this._debug(t,`session has${i?"":" not"} expired with margin of 10s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:e}=await this._callRefreshToken(s.refresh_token);e&&(console.error(e),Ze(e)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(e){return this._debug(t,"error",e),void console.error(e)}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,s;if(!e)throw new He;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new De;const{data:t,error:s}=await this._refreshAccessToken(e);if(s)throw s;if(!t.session)throw new He;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);const r={session:t.session,error:null};return this.refreshingDeferred.resolve(r),r}catch(e){if(this._debug(r,"error",e),Be(e)){const s={session:null,error:e};return Ze(e)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(e),e}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,"begin",t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map((async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}}));if(await Promise.all(i),r.length>0){for(let e=0;e<r.length;e+=1)console.error(r[e]);throw r[0]}}finally{this._debug(r,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),await Ie(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await Ue(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Pe()&&(null===window||void 0===window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval((()=>this._autoRefreshTokenTick()),Tt);this.autoRefreshTicker=e,e&&"object"===typeof e&&"function"===typeof e.unref?e.unref():"undefined"!==typeof Deno&&"function"===typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout((async()=>{await this.initializePromise,await this._autoRefreshTokenTick()}),0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,(async()=>{try{const e=Date.now();try{return await this._useSession((async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");const r=Math.floor((1e3*s.expires_at-e)/Tt);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(s.refresh_token)}))}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}))}catch(e){if(!(e.isAcquireTimeout||e instanceof _t))throw e;this._debug("auto refresh token tick lock not available")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Pe()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null===window||void 0===window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,(async()=>{"visible"===document.visibilityState?await this._recoverAndRefresh():this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting")})))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null===s||void 0===s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null===s||void 0===s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),"pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e);const t=await Je(e),s=e===t?"plain":"s256";this._debug("PKCE","code verifier",`${e.substring(0,5)}...`,"code challenge",t,"method",s);const i=new URLSearchParams({code_challenge:`${encodeURIComponent(t)}`,code_challenge_method:`${encodeURIComponent(s)}`});r.push(i.toString())}if(null===s||void 0===s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null===s||void 0===s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;return i?{data:null,error:i}:await ot(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession((async t=>{var s,r;const{data:i,error:n}=t;if(n)return{data:null,error:n};const{data:o,error:a}=await ot(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:null===(s=null===i||void 0===i?void 0:i.session)||void 0===s?void 0:s.access_token});return a?{data:null,error:a}:((null===(r=null===o||void 0===o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,(async()=>{try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;if(i)return{data:null,error:i};const{data:n,error:o}=await ot(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+n.expires_in},n)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",n),{data:n,error:o})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}))}async _challenge(e){return this._acquireLock(-1,(async()=>{try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;return i?{data:null,error:i}:await ot(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}))}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const s=(null===e||void 0===e?void 0:e.factors)||[],r=s.filter((e=>"totp"===e.factor_type&&"verified"===e.status));return{data:{all:s,totp:r},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,(async()=>await this._useSession((async e=>{var t,s;const{data:{session:r},error:i}=e;if(i)return{data:null,error:i};if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const n=this._decodeJWT(r.access_token);let o=null;n.aal&&(o=n.aal);let a=o;(null!==(s=null===(t=r.user.factors)||void 0===t?void 0:t.filter((e=>"verified"===e.status)))&&void 0!==s?s:[]).length>0&&(a="aal2");return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:n.amr||[]},error:null}}))))}}Et.nextInstanceID=0;class Ot extends Et{constructor(e){super(e)}}var Pt=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class $t{constructor(e,t,s){var r,i,n,o,a,c,h,l;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const u=e.replace(/\/$/,"");this.realtimeUrl=`${u}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${u}/auth/v1`,this.storageUrl=`${u}/storage/v1`,this.functionsUrl=`${u}/functions/v1`;const d=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,f=function(e,t){const{db:s,auth:r,realtime:i,global:n}=e,{db:o,auth:a,realtime:c,global:h}=t;return{db:Object.assign(Object.assign({},o),s),auth:Object.assign(Object.assign({},a),r),realtime:Object.assign(Object.assign({},c),i),global:Object.assign(Object.assign({},h),n)}}(null!==s&&void 0!==s?s:{},{db:ke,realtime:Te,auth:Object.assign(Object.assign({},Se),{storageKey:d}),global:be});this.storageKey=null!==(i=null===(r=f.auth)||void 0===r?void 0:r.storageKey)&&void 0!==i?i:"",this.headers=null!==(o=null===(n=f.global)||void 0===n?void 0:n.headers)&&void 0!==o?o:{},this.auth=this._initSupabaseAuthClient(null!==(a=f.auth)&&void 0!==a?a:{},this.headers,null===(c=f.global)||void 0===c?void 0:c.fetch),this.fetch=Oe(t,this._getAccessToken.bind(this),null===(h=f.global)||void 0===h?void 0:h.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},f.realtime)),this.rest=new k(`${u}/rest/v1`,{headers:this.headers,schema:null===(l=f.db)||void 0===l?void 0:l.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new p(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new we(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},s={}){return this.rest.rpc(e,t,s)}channel(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 Pt(this,void 0,void 0,(function*(){const{data:s}=yield this.auth.getSession();return null!==(t=null===(e=s.session)||void 0===e?void 0:e.access_token)&&void 0!==t?t:null}))}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,storageKey:i,flowType:n,debug:o},a,c){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Ot({url:this.authUrl,headers:Object.assign(Object.assign({},h),a),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,flowType:n,debug:o,fetch:c})}_initRealtimeClient(e){return new X(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null===e||void 0===e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange(((e,t)=>{this._handleTokenChanged(e,"CLIENT",null===t||void 0===t?void 0:t.access_token)}))}_handleTokenChanged(e,t,s){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===s?"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.realtime.setAuth(null!==s&&void 0!==s?s:null),this.changedAccessToken=s)}}const Ct="https://api.scoredetect.com";new $t("https://jtiipfmpqosvwdjjbhnc.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imp0aWlwZm1wcW9zdndkampiaG5jIiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODQ5Mjk5ODMsImV4cCI6MjAwMDUwNTk4M30.QZjkBzpsnEctknl3GkX4uH-2HJ0Rh81VI8O840O-Jjs",{auth:{persistSession:!1}});(0,e.registerPlugin)("timestamp-post",{render:()=>{const e=(()=>{const[e,s]=(0,t.useState)(!1),r=(0,t.useRef)(!1),{isSavingPost:n,isAutosavingPost:o}=(0,i.useSelect)((e=>({isSavingPost:e("core/editor").isSavingPost(),isAutosavingPost:e("core/editor").isAutosavingPost()})));return(0,t.useEffect)((()=>{!n&&!o||r.current||(s(!1),r.current=!0),n||o||!r.current||(s(!0),r.current=!1)}),[n,o]),e})(),{editPost:s}=(0,i.useDispatch)("core/editor"),{createNotice:a}=(0,i.useDispatch)("core/notices"),h=(0,i.useSelect)((e=>e("core/editor").getCurrentPostType()),[]),l=(0,i.useSelect)((e=>{const t=e("core").getEntityRecord("root","site");return t?.sdcom_timestamps})),{sdcom_timestamp_post:u=!1,sdcom_previous_certificate_id:d="",...f}=(0,i.useSelect)((e=>e("core/editor").getEditedPostAttribute("meta")||{})),p=(0,i.useSelect)((e=>e("core/editor").getEditedPostContent()),[]),g=(0,i.useSelect)((e=>e("core").getPostType(h)),[h]),v=(0,i.useSelect)((e=>e("core/editor").getCurrentPostId()),[]),m=(0,i.useSelect)((e=>e("core/editor").getPermalink()),[]),y=(0,i.useSelect)((e=>"auto-draft"===e("core/editor").getEditedPostAttribute("status"))),w=`/${g?.rest_namespace}/${g?.rest_base}/${v}`;return(0,t.useEffect)((()=>{if(!y)return;const e="true"===l?.default_timestamps_enabled;e!==u&&s({meta:{...f,sdcom_timestamp_post:e}})}),[l]),(0,t.useEffect)((()=>{(async()=>{if(e&&u)try{if(p.length<0)throw new Error("postContent is empty.");const e={certificateType:"plain_text_upload",displayCreatedBy:!!l?.display_created_by,username:l?.username&&"true"===l?.display_created_by?l?.username:"anonymous"},t=new FormData;t.append("file",p),t.append("username",e.username),t.append("previous_certificate_id",d);const s=await(async({apiKey:e,formData:t})=>{try{const s=`${Ct}/create-certificate`,{userAgent:r}=navigator,i=new Headers({Authorization:`Bearer ${e}`,"User-Agent":r,"X-ScoreDetect-Referer":`${m}`}),n=await fetch(s,{method:"POST",headers:i,body:t});if(!n.ok)throw console.log("Error in postData",{url:s,res:n}),Error(n.statusText);return n.json()}catch(e){throw console.error(e),e}})({apiKey:l.api_key,formData:t}),r=s?.certificate?.id;await(async({apiKey:e,certificateId:t,metadata:s})=>{try{const r=`${Ct}/update-certificate`,i=new Headers({Authorization:`Bearer ${e}`,"Content-Type":"application/json"}),n=await fetch(r,{method:"PATCH",headers:i,body:JSON.stringify({certificateId:t,metadata:s})});if(!n.ok)throw console.log("Error in postData",{url:r,res:n}),Error(n.statusText);return n.json()}catch(e){throw console.error(e),e}})({apiKey:l.api_key,certificateId:r,metadata:e}),c()({path:w,method:"POST",data:{meta:{...f,sdcom_previous_certificate_id:r}}}).catch((e=>{console.error("Error updating post meta:",e)})),a("success",(0,o.__)("Certificate created successfully.","timestamps"),{isDismissible:!0})}catch(e){console.error(e)}})()}),[e]),(0,t.createElement)(n.PluginPostStatusInfo,null,(0,t.createElement)(r.CheckboxControl,{label:(0,o.sprintf)((0,o.__)("Enable timestamps for this %s","timestamps"),h),help:(0,o.__)("Timestamps prove that you keep your content regularly up-to-date.","timestamps"),checked:u,onChange:e=>{s({meta:{...f,sdcom_timestamp_post:e}})}}))},icon:null})}()}();
  • timestamps/tags/1.12.0/includes/classes/Feature/Timestamp/Screenshot.php

    r3179723 r3244882  
    288288            }
    289289
    290             $url = 'https://api.scoredetect.com/create-certificate';
     290            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/create-certificate';
    291291
    292292            $metadata = array(
     
    384384            }
    385385
    386             $url = 'https://api.scoredetect.com/generate-certificate-id';
     386            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/generate-certificate-id';
    387387
    388388            $client = new Client();
     
    460460            }
    461461
    462             $url = 'https://api.scoredetect.com/update-certificate';
     462            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/update-certificate';
    463463
    464464            $metadata = array(
     
    549549            }
    550550
    551             $url = 'https://api.scoredetect.com/get-certificate/?id=' . $certificate_id;
     551            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/get-certificate/?id=' . $certificate_id;
    552552
    553553            $request = wp_remote_get(
  • timestamps/tags/1.12.0/includes/classes/Feature/Timestamp/Timestamp.php

    r3214331 r3244882  
    590590            $sdcom_timestamps              = get_option( SDCOM_TIMESTAMPS_OPTIONS );
    591591            $sdcom_previous_certificate_id = get_post_meta( $post_id, 'sdcom_previous_certificate_id', true );
     592            $post_permalink                = get_permalink( $post_id );
     593            $user_agent                    = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : '';
    592594
    593595            // Bail early if the options are empty.
     
    614616            }
    615617
    616             $url = 'https://api.scoredetect.com/create-certificate';
     618            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/create-certificate';
    617619
    618620            $metadata = array(
     
    631633            }
    632634
     635            $headers = [
     636                'Authorization' => 'Bearer ' . $sdcom_timestamps_api_key,
     637            ];
     638
     639            if ( ! empty( $user_agent ) ) {
     640                $headers['User-Agent'] = $user_agent;
     641            }
     642
     643            if ( ! empty( $post_permalink ) ) {
     644                $headers['X-ScoreDetect-Referer'] = $post_permalink;
     645            }
     646
    633647            $request = wp_remote_post(
    634648                $url,
    635649                array(
    636650                    'timeout' => 30,
    637                     'headers' => array(
    638                         'Authorization' => 'Bearer ' . $sdcom_timestamps_api_key,
    639                     ),
     651                    'headers' => $headers,
    640652                    'body'    => $form_data,
    641653                )
     
    717729            }
    718730
    719             $url = 'https://api.scoredetect.com/update-certificate';
     731            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/update-certificate';
    720732
    721733            $metadata = array(
  • timestamps/tags/1.12.0/includes/classes/Feature/WooCommerce/Orders.php

    r3168100 r3244882  
    341341            }
    342342
    343             $url = 'https://api.scoredetect.com/create-certificate';
     343            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/create-certificate';
    344344
    345345            $metadata = array(
     
    463463            }
    464464
    465             $url = 'https://api.scoredetect.com/update-certificate';
     465            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/update-certificate';
    466466
    467467            $metadata = array(
     
    727727            }
    728728
    729             $url = 'https://api.scoredetect.com/certificates/batch-delete';
     729            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/certificates/batch-delete';
    730730
    731731            $body = wp_json_encode(
  • timestamps/tags/1.12.0/includes/classes/TimestampHelper.php

    r3168100 r3244882  
    3232     *                               points to a non-existent post returns `null`. Defaults to global $post.
    3333     * @return object|false          The data returned by the API on success, or false on failure.
    34      * @throws \Throwable            If an exception occurs during the process.
    3534     * @throws \Exception            If the options, post content, or API key is empty.
    3635     */
     
    127126            $post_id                       = $post->ID;
    128127            $post_content                  = $post->post_content;
     128            $post_permalink                = get_permalink( $post_id );
     129            $user_agent                    = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : '';
    129130            $sdcom_timestamps              = get_option( SDCOM_TIMESTAMPS_OPTIONS );
    130131            $sdcom_previous_certificate_id = get_post_meta( $post_id, 'sdcom_previous_certificate_id', true );
     
    153154            }
    154155
    155             $url = 'https://api.scoredetect.com/create-certificate';
     156            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/create-certificate';
    156157
    157158            $metadata = array(
     
    170171            }
    171172
     173            $headers = [
     174                'Authorization' => 'Bearer ' . $sdcom_timestamps_api_key,
     175            ];
     176
     177            if ( ! empty( $user_agent ) ) {
     178                $headers['User-Agent'] = $user_agent;
     179            }
     180
     181            if ( ! empty( $post_permalink ) ) {
     182                $headers['X-ScoreDetect-Referer'] = $post_permalink;
     183            }
     184
    172185            $request = wp_remote_post(
    173186                $url,
    174187                array(
    175188                    'timeout' => 30,
    176                     'headers' => array(
    177                         'Authorization' => 'Bearer ' . $sdcom_timestamps_api_key,
    178                     ),
     189                    'headers' => $headers,
    179190                    'body'    => $form_data,
    180191                )
     
    267278            }
    268279
    269             $url = 'https://api.scoredetect.com/update-certificate';
     280            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/update-certificate';
    270281
    271282            $metadata = array(
  • timestamps/tags/1.12.0/package.json

    r3214331 r3244882  
    11{
    22  "name": "timestamps-plugin",
    3   "version": "1.11.0",
     3  "version": "1.12.0",
    44  "description": "Timestamp your WordPress content to empower your content authenticity and increase user trust with our blockchain timestamping solution.",
    55  "homepage": "https://www.scoredetect.com/",
  • timestamps/tags/1.12.0/readme.txt

    r3214331 r3244882  
    11=== Timestamps – SEO-friendly Blockchain Integration for WordPress ===
    22Contributors: scoredetect, xmic
    3 Tags: timestamp, blockchain, content, authenticity, copyright
     3Tags: timestamp, seo, blockchain, content, authenticity
    44Requires at least: 6.0.0
    5 Tested up to: 6.7.1
     5Tested up to: 6.7.2
    66Requires PHP: 7.4
    7 Stable tag: 1.11.0
     7Stable tag: 1.12.0
    88License: AGPL-3.0-only
    99License URI: https://spdx.org/licenses/AGPL-3.0-only.html
  • timestamps/tags/1.12.0/timestamps.php

    r3214331 r3244882  
    99 *
    1010 * @link              https://www.scoredetect.com/
    11  * @since             1.11.0
     11 * @since             1.12.0
    1212 * @package           SDCOM_Timestamps
    1313 *
     
    1515 * Plugin Name:       Timestamps
    1616 * Description:       Timestamp your WordPress content to empower your content authenticity and increase user trust. No blockchain skills needed.
    17  * Version:           1.11.0
     17 * Version:           1.12.0
    1818 * Author:            ScoreDetect.com
    1919 * Author URI:        https://www.scoredetect.com/
     
    3434
    3535// Useful global constants.
    36 define( 'SDCOM_TIMESTAMPS_VERSION', '1.11.0' );
     36define( 'SDCOM_TIMESTAMPS_VERSION', '1.12.0' );
    3737define( 'SDCOM_TIMESTAMPS_OPTIONS', 'sdcom_timestamps' );
    3838define( 'SDCOM_TIMESTAMPS_URL', plugin_dir_url( __FILE__ ) );
     
    4141define( 'SDCOM_TIMESTAMPS_DIST_URL', SDCOM_TIMESTAMPS_URL . 'dist/' );
    4242define( 'SDCOM_TIMESTAMPS_DIST_PATH', SDCOM_TIMESTAMPS_PATH . 'dist/' );
     43define( 'SDCOM_TIMESTAMPS_PUBLIC_API_URL', 'https://api.scoredetect.com' );
    4344
    4445$is_local_env = in_array( wp_get_environment_type(), array( 'local', 'development' ), true );
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/BodySummarizer.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/BodySummarizerInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Client.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/ClientInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/ClientTrait.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/CookieJar.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/SetCookie.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/BadResponseException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/ClientException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/ConnectException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/GuzzleException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/RequestException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/ServerException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Exception/TransferException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlFactory.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlHandler.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/EasyHandle.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/MockHandler.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/Proxy.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/HandlerStack.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/MessageFormatter.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/MessageFormatterInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Middleware.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Pool.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/RedirectMiddleware.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/RequestOptions.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/RetryMiddleware.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/TransferStats.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/Utils.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/guzzle/src/functions.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/AggregateException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/CancellationException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/Coroutine.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/Create.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/Each.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/EachPromise.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/FulfilledPromise.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/Is.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/Promise.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/PromiseInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/PromisorInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/RejectedPromise.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/RejectionException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/TaskQueue.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/TaskQueueInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/promises/src/Utils.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/AppendStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/BufferStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/CachingStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/DroppingStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Exception/MalformedUriException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/FnStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Header.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/HttpFactory.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/InflateStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/LazyOpenStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/LimitStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Message.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/MessageTrait.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/MimeType.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/MultipartStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/NoSeekStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/PumpStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Query.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Request.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Response.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Rfc7230.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/ServerRequest.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Stream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/StreamDecoratorTrait.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/StreamWrapper.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/UploadedFile.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Uri.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/UriComparator.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/UriNormalizer.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/UriResolver.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/guzzlehttp/psr7/src/Utils.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-client/src/ClientExceptionInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-client/src/ClientInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-client/src/NetworkExceptionInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-client/src/RequestExceptionInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-factory/src/RequestFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-factory/src/ResponseFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-factory/src/ServerRequestFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-factory/src/StreamFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-factory/src/UploadedFileFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-factory/src/UriFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-message/src/MessageInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-message/src/RequestInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-message/src/ResponseInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-message/src/ServerRequestInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-message/src/StreamInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-message/src/UploadedFileInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/tags/1.12.0/vendor-prefixed/psr/http-message/src/UriInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/assets/js/timestamp-post/editor/plugins/timestamp-post.js

    r3048002 r3244882  
    4040
    4141    const postId = useSelect((select) => select('core/editor').getCurrentPostId(), []);
     42    const postPermalink = useSelect((select) => select('core/editor').getPermalink(), []);
    4243
    4344    // Check if it is a new post by checking if the post status is 'auto-draft'.
     
    5657        try {
    5758            const url = `${PUBLIC_API_URL}/create-certificate`;
     59            const { userAgent } = navigator;
    5860
    5961            const headers = new Headers({
    6062                Authorization: `Bearer ${apiKey}`,
     63                'User-Agent': userAgent,
     64                'X-ScoreDetect-Referer': `${postPermalink}`,
    6165            });
    6266
  • timestamps/trunk/dist/js/timestamp-post.asset.php

    r3129719 r3244882  
    1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '178adef6765c05b70b7a');
     1<?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '13b70cf2d524d8b92a21');
  • timestamps/trunk/dist/js/timestamp-post.js

    r3129719 r3244882  
    1 !function(){"use strict";var e={907:function(e,t,s){s.r(t),s.d(t,{Headers:function(){return n},Request:function(){return o},Response:function(){return a},fetch:function(){return i}});var r=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof s.g)return s.g;throw new Error("unable to locate global object")}();const i=r.fetch;t.default=r.fetch.bind(r);const n=r.Headers,o=r.Request,a=r.Response}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,s),n.exports}s.m=e,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},function(){var e,t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};s.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var n=Object.create(null);s.r(n);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((function(e){o[e]=function(){return r[e]}}));return o.default=function(){return r},s.d(n,o),n}}(),s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce((function(t,r){return s.f[r](e,t),t}),[]))},s.u=function(e){return"js/"+e+".7e61fd99a8c41da8c843.chunk.js"},s.miniCssF=function(e){},s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={},t="timestamps-plugin:";s.l=function(r,i,n,o){if(e[r])e[r].push(i);else{var a,c;if(void 0!==n)for(var h=document.getElementsByTagName("script"),l=0;l<h.length;l++){var u=h[l];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+n){a=u;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",t+n),a.src=r),e[r]=[i];var d=function(t,s){a.onerror=a.onload=null,clearTimeout(f);var i=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((function(e){return e(s)})),t)return t(s)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}}}(),s.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e+"../"}(),function(){var e={948:0};s.f.j=function(t,r){var i=s.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise((function(s,r){i=e[t]=[s,r]}));r.push(i[2]=n);var o=s.p+s.u(t),a=new Error;s.l(o,(function(r){if(s.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",a.name="ChunkLoadError",a.type=n,a.request=o,i[1](a)}}),"chunk-"+t,t)}};var t=function(t,r){var i,n,o=r[0],a=r[1],c=r[2],h=0;if(o.some((function(t){return 0!==e[t]}))){for(i in a)s.o(a,i)&&(s.m[i]=a[i]);if(c)c(s)}for(t&&t(r);h<o.length;h++)n=o[h],s.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=self.webpackChunktimestamps_plugin=self.webpackChunktimestamps_plugin||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}(),function(){var e=window.wp.plugins,t=window.wp.element,r=window.wp.components,i=window.wp.data,n=window.wp.editPost,o=window.wp.i18n,a=window.wp.apiFetch,c=s.n(a);class h extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class l extends h{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class u extends h{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class d extends h{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var f=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class p{constructor(e,{headers:t={},customFetch:r}={}){this.url=e,this.headers=t,this.fetch=(e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)})(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s;return f(this,void 0,void 0,(function*(){try{const{headers:r,method:i,body:n}=t;let o,a={};n&&(r&&!Object.prototype.hasOwnProperty.call(r,"Content-Type")||!r)&&("undefined"!==typeof Blob&&n instanceof Blob||n instanceof ArrayBuffer?(a["Content-Type"]="application/octet-stream",o=n):"string"===typeof n?(a["Content-Type"]="text/plain",o=n):"undefined"!==typeof FormData&&n instanceof FormData?o=n:(a["Content-Type"]="application/json",o=JSON.stringify(n)));const c=yield this.fetch(`${this.url}/${e}`,{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},a),this.headers),r),body:o}).catch((e=>{throw new l(e)})),h=c.headers.get("x-relay-error");if(h&&"true"===h)throw new u(c);if(!c.ok)throw new d(c);let f,p=(null!==(s=c.headers.get("Content-Type"))&&void 0!==s?s:"text/plain").split(";")[0].trim();return f="application/json"===p?yield c.json():"application/octet-stream"===p?yield c.blob():"multipart/form-data"===p?yield c.formData():yield c.text(),{data:f,error:null}}catch(e){return{data:null,error:e}}}))}}var g=s(907);class v extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}class m{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:"undefined"===typeof fetch?this.fetch=g.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let s=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then((async e=>{var t,s,r;let i=null,n=null,o=null,a=e.status,c=e.statusText;if(e.ok){if("HEAD"!==this.method){const t=await e.text();""===t||(n="text/csv"===this.headers.Accept||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}const r=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),h=null===(s=e.headers.get("content-range"))||void 0===s?void 0:s.split("/");r&&h&&h.length>1&&(o=parseInt(h[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(n)&&(n.length>1?(i={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,o=null,a=406,c="Not Acceptable"):n=1===n.length?n[0]:null)}else{const t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(n=[],i=null,a=200,c="OK")}catch(s){404===e.status&&""===t?(a=204,c="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null===(r=null===i||void 0===i?void 0:i.details)||void 0===r?void 0:r.includes("0 rows"))&&(i=null,a=200,c="OK"),i&&this.shouldThrowOnError)throw new v(i)}return{error:i,data:n,count:o,status:a,statusText:c}}));return this.shouldThrowOnError||(s=s.catch((e=>{var t,s,r;return{error:{message:`${null!==(t=null===e||void 0===e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null===e||void 0===e?void 0:e.message}`,details:`${null!==(s=null===e||void 0===e?void 0:e.stack)&&void 0!==s?s:""}`,hint:"",code:`${null!==(r=null===e||void 0===e?void 0:e.code)&&void 0!==r?r:""}`},data:null,count:null,status:0,statusText:""}}))),s.then(e,t)}}class y extends m{select(e){let t=!1;const s=(null!==e&&void 0!==e?e:"*").split("").map((e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e))).join("");return this.url.searchParams.set("select",s),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:r,referencedTable:i=r}={}){const n=i?`${i}.order`:"order",o=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${void 0===s?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const r="undefined"===typeof s?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:r=s}={}){const i="undefined"===typeof r?"offset":`${r}.offset`,n="undefined"===typeof r?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(n,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return"GET"===this.method?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:s=!1,buffers:r=!1,wal:i=!1,format:n="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,s?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=null!==(o=this.headers.Accept)&&void 0!==o?o:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${n}; for="${c}"; options=${a};`,this}rollback(){var e;return(null!==(e=this.headers.Prefer)&&void 0!==e?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class w extends y{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const s=t.map((e=>"string"===typeof e&&new RegExp("[,()]").test(e)?`"${e}"`:`${e}`)).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}contains(e,t){return"string"===typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"===typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"===typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:r}={}){let i="";"plain"===r?i="pl":"phrase"===r?i="ph":"websearch"===r&&(i="w");const n=void 0===s?"":`(${s})`;return this.url.searchParams.append(e,`${i}fts${n}.${t}`),this}match(e){return Object.entries(e).forEach((([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)})),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}}class _{constructor(e,{headers:t={},schema:s,fetch:r}){this.url=e,this.headers=t,this.schema=s,this.fetch=r}select(e,{head:t=!1,count:s}={}){const r=t?"HEAD":"GET";let i=!1;const n=(null!==e&&void 0!==e?e:"*").split("").map((e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e))).join("");return this.url.searchParams.set("select",n),s&&(this.headers.Prefer=`count=${s}`),new w({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:s=!0}={}){const r=[];if(this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push(`count=${t}`),s||r.push("missing=default"),this.headers.Prefer=r.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new w({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:r,defaultToNull:i=!0}={}){const n=[`resolution=${s?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&n.push(this.headers.Prefer),r&&n.push(`count=${r}`),i||n.push("missing=default"),this.headers.Prefer=n.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new w({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){const s=[];return this.headers.Prefer&&s.push(this.headers.Prefer),t&&s.push(`count=${t}`),this.headers.Prefer=s.join(","),new w({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const t=[];return e&&t.push(`count=${e}`),this.headers.Prefer&&t.unshift(this.headers.Prefer),this.headers.Prefer=t.join(","),new w({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const b={"X-Client-Info":"postgrest-js/1.9.2"};class k{constructor(e,{headers:t={},schema:s,fetch:r}={}){this.url=e,this.headers=Object.assign(Object.assign({},b),t),this.schemaName=s,this.fetch=r}from(e){const t=new URL(`${this.url}/${e}`);return new _(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new k(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:s=!1,count:r}={}){let i;const n=new URL(`${this.url}/rpc/${e}`);let o;s?(i="HEAD",Object.entries(t).forEach((([e,t])=>{n.searchParams.append(e,`${t}`)}))):(i="POST",o=t);const a=Object.assign({},this.headers);return r&&(a.Prefer=`count=${r}`),new w({method:i,url:n,headers:a,schema:this.schemaName,body:o,fetch:this.fetch,allowEmpty:!1})}}const S={"X-Client-Info":"realtime-js/2.9.3"};var T,j,E,O,P,$,C;!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(T||(T={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(j||(j={})),function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"}(E||(E={})),function(e){e.websocket="websocket"}(O||(O={})),function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"}(P||(P={}));class R{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}}class A{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t("string"===typeof e?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,t,s)}_decodeBroadcast(e,t,s){const r=t.getUint8(1),i=t.getUint8(2);let n=this.HEADER_LENGTH+2;const o=s.decode(e.slice(n,n+r));n+=r;const a=s.decode(e.slice(n,n+i));n+=i;return{ref:null,topic:o,event:a,payload:JSON.parse(s.decode(e.slice(n,e.byteLength)))}}}class x{constructor(e,t,s={},r=1e4){this.channel=e,this.event=t,this.payload=s,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var s;return this._hasReceived(e)&&t(null===(s=this.receivedResp)||void 0===s?void 0:s.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);this.channel._on(this.refEvent,{},(e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}!function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"}($||($={}));class I{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(null===t||void 0===t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},(e=>{const{onJoin:t,onLeave:s,onSync:r}=this.caller;this.joinRef=this.channel._joinRef(),this.state=I.syncState(this.state,e,t,s),this.pendingDiffs.forEach((e=>{this.state=I.syncDiff(this.state,e,t,s)})),this.pendingDiffs=[],r()})),this.channel._on(s.diff,{},(e=>{const{onJoin:t,onLeave:s,onSync:r}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=I.syncDiff(this.state,e,t,s),r())})),this.onJoin(((e,t,s)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:s})})),this.onLeave(((e,t,s)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:s})})),this.onSync((()=>{this.channel._trigger("presence",{event:"sync"})}))}static syncState(e,t,s,r){const i=this.cloneDeep(e),n=this.transformState(t),o={},a={};return this.map(i,((e,t)=>{n[e]||(a[e]=t)})),this.map(n,((e,t)=>{const s=i[e];if(s){const r=t.map((e=>e.presence_ref)),i=s.map((e=>e.presence_ref)),n=t.filter((e=>i.indexOf(e.presence_ref)<0)),c=s.filter((e=>r.indexOf(e.presence_ref)<0));n.length>0&&(o[e]=n),c.length>0&&(a[e]=c)}else o[e]=t})),this.syncDiff(i,{joins:o,leaves:a},s,r)}static syncDiff(e,t,s,r){const{joins:i,leaves:n}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return s||(s=()=>{}),r||(r=()=>{}),this.map(i,((t,r)=>{var i;const n=null!==(i=e[t])&&void 0!==i?i:[];if(e[t]=this.cloneDeep(r),n.length>0){const s=e[t].map((e=>e.presence_ref)),r=n.filter((e=>s.indexOf(e.presence_ref)<0));e[t].unshift(...r)}s(t,n,r)})),this.map(n,((t,s)=>{let i=e[t];if(!i)return;const n=s.map((e=>e.presence_ref));i=i.filter((e=>n.indexOf(e.presence_ref)<0)),e[t]=i,r(t,i,s),0===i.length&&delete e[t]})),e}static map(e,t){return Object.getOwnPropertyNames(e).map((s=>t(s,e[s])))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce(((t,s)=>{const r=e[s];return t[s]="metas"in r?r.metas.map((e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))):r,t}),{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}!function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"}(C||(C={}));const L=(e,t,s={})=>{var r;const i=null!==(r=s.skipTypes)&&void 0!==r?r:[];return Object.keys(t).reduce(((s,r)=>(s[r]=U(r,e,t,i),s)),{})},U=(e,t,s,r)=>{const i=t.find((t=>t.name===e)),n=null===i||void 0===i?void 0:i.type,o=s[e];return n&&!r.includes(n)?N(n,o):D(o)},N=(e,t)=>{if("_"===e.charAt(0)){const s=e.slice(1,e.length);return z(t,s)}switch(e){case C.bool:return F(t);case C.float4:case C.float8:case C.int2:case C.int4:case C.int8:case C.numeric:case C.oid:return q(t);case C.json:case C.jsonb:return J(t);case C.timestamp:return B(t);case C.abstime:case C.date:case C.daterange:case C.int4range:case C.int8range:case C.money:case C.reltime:case C.text:case C.time:case C.timestamptz:case C.timetz:case C.tsrange:case C.tstzrange:default:return D(t)}},D=e=>e,F=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},q=e=>{if("string"===typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},J=e=>{if("string"===typeof e)try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},z=(e,t)=>{if("string"!==typeof e)return e;const s=e.length-1,r=e[s];if("{"===e[0]&&"}"===r){let r;const i=e.slice(1,s);try{r=JSON.parse("["+i+"]")}catch(e){r=i?i.split(","):[]}return r.map((e=>N(t,e)))}return e},B=e=>"string"===typeof e?e.replace(" ","T"):e;var M,K,G;!function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(M||(M={})),function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes"}(K||(K={})),function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"}(G||(G={}));class H{constructor(e,t={config:{}},s){this.topic=e,this.params=t,this.socket=s,this.bindings={},this.state=j.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},t.config),this.timeout=this.socket.timeout,this.joinPush=new x(this,E.join,this.params,this.timeout),this.rejoinTimer=new R((()=>this._rejoinUntilConnected()),this.socket.reconnectAfterMs),this.joinPush.receive("ok",(()=>{this.state=j.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this._onClose((()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=j.closed,this.socket._remove(this)})),this._onError((e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=j.errored,this.rejoinTimer.scheduleTimeout())})),this.joinPush.receive("timeout",(()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=j.errored,this.rejoinTimer.scheduleTimeout())})),this._on(E.reply,{},((e,t)=>{this._trigger(this._replyEventName(t),e)})),this.presence=new I(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(e,t=this.timeout){var s,r;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:i,presence:n}}=this.params;this._onError((t=>e&&e("CHANNEL_ERROR",t))),this._onClose((()=>e&&e("CLOSED")));const o={},a={broadcast:i,presence:n,postgres_changes:null!==(r=null===(s=this.bindings.postgres_changes)||void 0===s?void 0:s.map((e=>e.filter)))&&void 0!==r?r:[]};this.socket.accessToken&&(o.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:a},o)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",(({postgres_changes:t})=>{var s;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),void 0!==t){const r=this.bindings.postgres_changes,i=null!==(s=null===r||void 0===r?void 0:r.length)&&void 0!==s?s:0,n=[];for(let s=0;s<i;s++){const i=r[s],{filter:{event:o,schema:a,table:c,filter:h}}=i,l=t&&t[s];if(!l||l.event!==o||l.schema!==a||l.table!==c||l.filter!==h)return this.unsubscribe(),void(e&&e("CHANNEL_ERROR",new Error("mismatch between server and client bindings for postgres changes")));n.push(Object.assign(Object.assign({},i),{id:l.id}))}return this.bindings.postgres_changes=n,void(e&&e("SUBSCRIBED"))}e&&e("SUBSCRIBED")})).receive("error",(t=>{e&&e("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(t).join(", ")||"error")))})).receive("timeout",(()=>{e&&e("TIMED_OUT")}))}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,s){return this._on(e,t,s)}async send(e,t={}){var s,r;if(this._canPush()||"broadcast"!==e.type)return new Promise((s=>{var r,i,n;const o=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(n=null===(i=null===(r=this.params)||void 0===r?void 0:r.config)||void 0===i?void 0:i.broadcast)||void 0===n?void 0:n.ack)||s("ok"),o.receive("ok",(()=>s("ok"))),o.receive("timeout",(()=>s("timed out")))}));{const{event:i,payload:n}=e,o={method:"POST",headers:{apikey:null!==(s=this.socket.apiKey)&&void 0!==s?s:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:n}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,o,null!==(r=t.timeout)&&void 0!==r?r:this.timeout)).ok?"ok":"error"}catch(e){return"AbortError"===e.name?"timed out":"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=j.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(E.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise((s=>{const r=new x(this,E.leave,{},e);r.receive("ok",(()=>{t(),s("ok")})).receive("timeout",(()=>{t(),s("timed out")})).receive("error",(()=>{s("error")})),r.send(),this._canPush()||r.trigger("ok",{})}))}_broadcastEndpointURL(){let e=this.socket.endPoint;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(e,t,s){const r=new AbortController,i=setTimeout((()=>r.abort()),s),n=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(i),n}_push(e,t,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new x(this,e,t,s);return this._canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}_onMessage(e,t,s){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,s){var r,i;const n=e.toLocaleLowerCase(),{close:o,error:a,leave:c,join:h}=E;if(s&&[o,a,c,h].indexOf(n)>=0&&s!==this._joinRef())return;let l=this._onMessage(n,t,s);if(t&&!l)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(n)?null===(r=this.bindings.postgres_changes)||void 0===r||r.filter((e=>{var t,s,r;return"*"===(null===(t=e.filter)||void 0===t?void 0:t.event)||(null===(r=null===(s=e.filter)||void 0===s?void 0:s.event)||void 0===r?void 0:r.toLocaleLowerCase())===n})).map((e=>e.callback(l,s))):null===(i=this.bindings[n])||void 0===i||i.filter((e=>{var s,r,i,o,a,c;if(["broadcast","presence","postgres_changes"].includes(n)){if("id"in e){const n=e.id,o=null===(s=e.filter)||void 0===s?void 0:s.event;return n&&(null===(r=t.ids)||void 0===r?void 0:r.includes(n))&&("*"===o||(null===o||void 0===o?void 0:o.toLocaleLowerCase())===(null===(i=t.data)||void 0===i?void 0:i.type.toLocaleLowerCase()))}{const s=null===(a=null===(o=null===e||void 0===e?void 0:e.filter)||void 0===o?void 0:o.event)||void 0===a?void 0:a.toLocaleLowerCase();return"*"===s||s===(null===(c=null===t||void 0===t?void 0:t.event)||void 0===c?void 0:c.toLocaleLowerCase())}}return e.type.toLocaleLowerCase()===n})).map((e=>{if("object"===typeof l&&"ids"in l){const e=l.data,{schema:t,table:s,commit_timestamp:r,type:i,errors:n}=e,o={schema:t,table:s,commit_timestamp:r,eventType:i,new:{},old:{},errors:n};l=Object.assign(Object.assign({},o),this._getPayloadRecords(e))}e.callback(l,s)}))}_isClosed(){return this.state===j.closed}_isJoined(){return this.state===j.joined}_isJoining(){return this.state===j.joining}_isLeaving(){return this.state===j.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,s){const r=e.toLocaleLowerCase(),i={type:r,filter:t,callback:s};return this.bindings[r]?this.bindings[r].push(i):this.bindings[r]=[i],this}_off(e,t){const s=e.toLocaleLowerCase();return this.bindings[s]=this.bindings[s].filter((e=>{var r;return!((null===(r=e.type)||void 0===r?void 0:r.toLocaleLowerCase())===s&&H.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(E.close,{},e)}_onError(e){this._on(E.error,{},(t=>e(t)))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=j.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return"INSERT"!==e.type&&"UPDATE"!==e.type||(t.new=L(e.columns,e.record)),"UPDATE"!==e.type&&"DELETE"!==e.type||(t.old=L(e.columns,e.old_record)),t}}const V=()=>{},W="undefined"!==typeof WebSocket;class Y{constructor(e,t){var r;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.headers=S,this.params={},this.timeout=1e4,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=V,this.conn=null,this.sendBuffer=[],this.serializer=new A,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},this.endPoint=`${e}/${O.websocket}`,(null===t||void 0===t?void 0:t.transport)?this.transport=t.transport:this.transport=null,(null===t||void 0===t?void 0:t.params)&&(this.params=t.params),(null===t||void 0===t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),(null===t||void 0===t?void 0:t.timeout)&&(this.timeout=t.timeout),(null===t||void 0===t?void 0:t.logger)&&(this.logger=t.logger),(null===t||void 0===t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);const i=null===(r=null===t||void 0===t?void 0:t.params)||void 0===r?void 0:r.apikey;i&&(this.accessToken=i,this.apiKey=i),this.reconnectAfterMs=(null===t||void 0===t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null===t||void 0===t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null===t||void 0===t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new R((async()=>{this.disconnect(),this.connect()}),this.reconnectAfterMs),this.fetch=this._resolveFetch(null===t||void 0===t?void 0:t.fetch)}connect(){if(!this.conn)if(this.transport)this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});else{if(W)return this.conn=new WebSocket(this._endPointURL()),void this.setupConnection();this.conn=new X(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),s.e(591).then(s.t.bind(s,1591,23)).then((({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()}))}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!==t&&void 0!==t?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map((e=>e.unsubscribe())));return this.disconnect(),e}log(e,t,s){this.logger(e,t,s)}connectionState(){switch(this.conn&&this.conn.readyState){case T.connecting:return P.Connecting;case T.open:return P.Open;case T.closing:return P.Closing;default:return P.Closed}}isConnected(){return this.connectionState()===P.Open}channel(e,t={config:{}}){const s=new H(`realtime:${e}`,t,this);return this.channels.push(s),s}push(e){const{topic:t,event:s,payload:r,ref:i}=e,n=()=>{this.encode(e,(e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)}))};this.log("push",`${t} ${s} (${i})`,r),this.isConnected()?n():this.sendBuffer.push(n)}setAuth(e){this.accessToken=e,this.channels.forEach((t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(E.access_token,{access_token:e})}))}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t._isJoined()||t._isJoining())));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter((t=>t._joinRef()!==e._joinRef()))}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}_onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:s,payload:r,ref:i}=e;(i&&i===this.pendingHeartbeatRef||s===(null===r||void 0===r?void 0:r.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${r.status||""} ${t} ${s} ${i&&"("+i+")"||""}`,r),this.channels.filter((e=>e._isMember(t))).forEach((e=>e._trigger(s,r,i))),this.stateChangeCallbacks.message.forEach((t=>t(e)))}))}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval((()=>this._sendHeartbeat()),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach((e=>e()))}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((t=>t(e)))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach((t=>t(e)))}_triggerChanError(){this.channels.forEach((e=>e._trigger(E.error)))}_appendParams(e,t){if(0===Object.keys(t).length)return e;const s=e.match(/\?/)?"&":"?";return`${e}${s}${new URLSearchParams(t)}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void(null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout"));this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class X{constructor(e,t,s){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=T.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=s.close}}class Q extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Z(e){return"object"===typeof e&&null!==e&&"__isStorageError"in e}class ee extends Q{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class te extends Q{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var se=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const re=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)};var ie=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const ne=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),oe=(e,t)=>ie(void 0,void 0,void 0,(function*(){const r=yield se(void 0,void 0,void 0,(function*(){return"undefined"===typeof Response?(yield Promise.resolve().then(s.bind(s,907))).Response:Response}));e instanceof r?e.json().then((s=>{t(new ee(ne(s),e.status||500))})).catch((e=>{t(new te(ne(e),e))})):t(new te(ne(e),e))})),ae=(e,t,s,r)=>{const i={method:e,headers:(null===t||void 0===t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json"},null===t||void 0===t?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),s))};function ce(e,t,s,r,i,n){return ie(this,void 0,void 0,(function*(){return new Promise(((o,a)=>{e(s,ae(t,r,i,n)).then((e=>{if(!e.ok)throw e;return(null===r||void 0===r?void 0:r.noResolveJson)?e:e.json()})).then((e=>o(e))).catch((e=>oe(e,a)))}))}))}function he(e,t,s,r){return ie(this,void 0,void 0,(function*(){return ce(e,"GET",t,s,r)}))}function le(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"POST",t,r,i,s)}))}function ue(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"DELETE",t,r,i,s)}))}var de=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const fe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},pe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ge{constructor(e,t={},s,r){this.url=e,this.headers=t,this.bucketId=s,this.fetch=re(r)}uploadOrUpdate(e,t,s,r){return de(this,void 0,void 0,(function*(){try{let i;const n=Object.assign(Object.assign({},pe),r),o=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)});"undefined"!==typeof Blob&&s instanceof Blob?(i=new FormData,i.append("cacheControl",n.cacheControl),i.append("",s)):"undefined"!==typeof FormData&&s instanceof FormData?(i=s,i.append("cacheControl",n.cacheControl)):(i=s,o["cache-control"]=`max-age=${n.cacheControl}`,o["content-type"]=n.contentType);const a=this._removeEmptyFolders(t),c=this._getFinalPath(a),h=yield this.fetch(`${this.url}/object/${c}`,Object.assign({method:e,body:i,headers:o},(null===n||void 0===n?void 0:n.duplex)?{duplex:n.duplex}:{})),l=yield h.json();if(h.ok)return{data:{path:a,id:l.Id,fullPath:l.Key},error:null};return{data:null,error:l}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}upload(e,t,s){return de(this,void 0,void 0,(function*(){return this.uploadOrUpdate("POST",e,t,s)}))}uploadToSignedUrl(e,t,s,r){return de(this,void 0,void 0,(function*(){const i=this._removeEmptyFolders(e),n=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${n}`);o.searchParams.set("token",t);try{let e;const t=Object.assign({upsert:pe.upsert},r),n=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!==typeof Blob&&s instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),e.append("",s)):"undefined"!==typeof FormData&&s instanceof FormData?(e=s,e.append("cacheControl",t.cacheControl)):(e=s,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType);const a=yield this.fetch(o.toString(),{method:"PUT",body:e,headers:n}),c=yield a.json();if(a.ok)return{data:{path:i,fullPath:c.Key},error:null};return{data:null,error:c}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUploadUrl(e){return de(this,void 0,void 0,(function*(){try{let t=this._getFinalPath(e);const s=yield le(this.fetch,`${this.url}/object/upload/sign/${t}`,{},{headers:this.headers}),r=new URL(this.url+s.url),i=r.searchParams.get("token");if(!i)throw new Q("No token returned by API");return{data:{signedUrl:r.toString(),path:e,token:i},error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}update(e,t,s){return de(this,void 0,void 0,(function*(){return this.uploadOrUpdate("PUT",e,t,s)}))}move(e,t){return de(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}copy(e,t){return de(this,void 0,void 0,(function*(){try{return{data:{path:(yield le(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers})).Key},error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUrl(e,t,s){return de(this,void 0,void 0,(function*(){try{let r=this._getFinalPath(e),i=yield le(this.fetch,`${this.url}/object/sign/${r}`,Object.assign({expiresIn:t},(null===s||void 0===s?void 0:s.transform)?{transform:s.transform}:{}),{headers:this.headers});const n=(null===s||void 0===s?void 0:s.download)?`&download=${!0===s.download?"":s.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${n}`)},{data:i,error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUrls(e,t,s){return de(this,void 0,void 0,(function*(){try{const r=yield le(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=(null===s||void 0===s?void 0:s.download)?`&download=${!0===s.download?"":s.download}`:"";return{data:r.map((e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null}))),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}download(e,t){return de(this,void 0,void 0,(function*(){const s="undefined"!==typeof(null===t||void 0===t?void 0:t.transform)?"render/image/authenticated":"object",r=this.transformOptsToQueryString((null===t||void 0===t?void 0:t.transform)||{}),i=r?`?${r}`:"";try{const t=this._getFinalPath(e),r=yield he(this.fetch,`${this.url}/${s}/${t}${i}`,{headers:this.headers,noResolveJson:!0});return{data:yield r.blob(),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}getPublicUrl(e,t){const s=this._getFinalPath(e),r=[],i=(null===t||void 0===t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&r.push(i);const n="undefined"!==typeof(null===t||void 0===t?void 0:t.transform)?"render/image":"object",o=this.transformOptsToQueryString((null===t||void 0===t?void 0:t.transform)||{});""!==o&&r.push(o);let a=r.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${n}/public/${s}${a}`)}}}remove(e){return de(this,void 0,void 0,(function*(){try{return{data:yield ue(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}list(e,t,s){return de(this,void 0,void 0,(function*(){try{const r=Object.assign(Object.assign(Object.assign({},fe),t),{prefix:e||""});return{data:yield le(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},s),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const ve={"X-Client-Info":"storage-js/2.5.5"};var me=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class ye{constructor(e,t={},s){this.url=e,this.headers=Object.assign(Object.assign({},ve),t),this.fetch=re(s)}listBuckets(){return me(this,void 0,void 0,(function*(){try{return{data:yield he(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}getBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield he(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createBucket(e,t={public:!1}){return me(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}updateBucket(e,t){return me(this,void 0,void 0,(function*(){try{const s=yield function(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"PUT",t,r,i,s)}))}(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers});return{data:s,error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}emptyBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}deleteBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield ue(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}}class we extends ye{constructor(e,t={},s){super(e,t,s)}from(e){return new ge(this.url,this.headers,e,this.fetch)}}let _e="";_e="undefined"!==typeof Deno?"deno":"undefined"!==typeof document?"web":"undefined"!==typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";const be={headers:{"X-Client-Info":`supabase-js-${_e}/2.39.7`}},ke={schema:"public"},Se={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Te={};var je=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const Ee=e=>{let t;return t=e||("undefined"===typeof fetch?g.default:fetch),(...e)=>t(...e)},Oe=(e,t,s)=>{const r=Ee(s),i="undefined"===typeof Headers?g.Headers:Headers;return(s,n)=>je(void 0,void 0,void 0,(function*(){var o;const a=null!==(o=yield t())&&void 0!==o?o:e;let c=new i(null===n||void 0===n?void 0:n.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${a}`),r(s,Object.assign(Object.assign({},n),{headers:c}))}))};const Pe=()=>"undefined"!==typeof document,$e={tested:!1,writable:!1},Ce=()=>{if(!Pe())return!1;try{if("object"!==typeof globalThis.localStorage)return!1}catch(e){return!1}if($e.tested)return $e.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),$e.tested=!0,$e.writable=!0}catch(e){$e.tested=!0,$e.writable=!1}return $e.writable};function Re(e){const t={},s=new URL(e);if(s.hash&&"#"===s.hash[0])try{new URLSearchParams(s.hash.substring(1)).forEach(((e,s)=>{t[s]=e}))}catch(e){}return s.searchParams.forEach(((e,s)=>{t[s]=e})),t}const Ae=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},xe=e=>"object"===typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"===typeof e.json,Ie=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},Le=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch(e){return s}},Ue=async(e,t)=>{await e.removeItem(t)};class Ne{constructor(){this.promise=new Ne.promiseConstructor(((e,t)=>{this.resolve=e,this.reject=t}))}}function De(e){const t=e.split(".");if(3!==t.length)throw new Error("JWT is not valid: not a JWT structure");if(!/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i.test(t[1]))throw new Error("JWT is not valid: payload is not in base64url format");const s=t[1];return JSON.parse(function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s,r,i,n,o,a,c,h="",l=0;for(e=e.replace("-","+").replace("_","/");l<e.length;)n=t.indexOf(e.charAt(l++)),o=t.indexOf(e.charAt(l++)),a=t.indexOf(e.charAt(l++)),c=t.indexOf(e.charAt(l++)),s=n<<2|o>>4,r=(15&o)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(s),64!=a&&0!=r&&(h+=String.fromCharCode(r)),64!=c&&0!=i&&(h+=String.fromCharCode(i));return h}(s))}function Fe(e){return("0"+e.toString(16)).substr(-2)}function qe(){const e=new Uint32Array(56);if("undefined"===typeof crypto){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length;let s="";for(let r=0;r<56;r++)s+=e.charAt(Math.floor(Math.random()*t));return s}return crypto.getRandomValues(e),Array.from(e,Fe).join("")}async function Je(e){if(!("undefined"!==typeof crypto&&"undefined"!==typeof crypto.subtle&&"undefined"!==typeof TextEncoder))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const t=await async function(e){const t=(new TextEncoder).encode(e),s=await crypto.subtle.digest("SHA-256",t),r=new Uint8Array(s);return Array.from(r).map((e=>String.fromCharCode(e))).join("")}(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}Ne.promiseConstructor=Promise;class ze extends Error{constructor(e,t){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t}}function Be(e){return"object"===typeof e&&null!==e&&"__isAuthError"in e}class Me extends ze{constructor(e,t){super(e,t),this.name="AuthApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Ke extends ze{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Ge extends ze{constructor(e,t,s){super(e),this.name=t,this.status=s}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class He extends Ge{constructor(){super("Auth session missing!","AuthSessionMissingError",400)}}class Ve extends Ge{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500)}}class We extends Ge{constructor(e){super(e,"AuthInvalidCredentialsError",400)}}class Ye extends Ge{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Xe extends Ge{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Qe extends Ge{constructor(e,t){super(e,"AuthRetryableFetchError",t)}}function Ze(e){return Be(e)&&"AuthRetryableFetchError"===e.name}class et extends Ge{constructor(e,t,s){super(e,"AuthWeakPasswordError",t),this.reasons=s}}var tt=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s};const st=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rt=[502,503,504];async function it(e){if(!xe(e))throw new Qe(st(e),0);if(rt.includes(e.status))throw new Qe(st(e),e.status);let t;try{t=await e.json()}catch(e){throw new Ke(st(e),e)}if("object"===typeof t&&t&&"object"===typeof t.weak_password&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce(((e,t)=>e&&"string"===typeof t),!0))throw new et(st(t),e.status,t.weak_password.reasons);throw new Me(st(t),e.status||500)}const nt=(e,t,s,r)=>{const i={method:e,headers:(null===t||void 0===t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null===t||void 0===t?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),s))};async function ot(e,t,s,r){var i;const n=Object.assign({},null===r||void 0===r?void 0:r.headers);(null===r||void 0===r?void 0:r.jwt)&&(n.Authorization=`Bearer ${r.jwt}`);const o=null!==(i=null===r||void 0===r?void 0:r.query)&&void 0!==i?i:{};(null===r||void 0===r?void 0:r.redirectTo)&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await async function(e,t,s,r,i,n){const o=nt(t,r,i,n);let a;try{a=await e(s,o)}catch(e){throw console.error(e),new Qe(st(e),0)}a.ok||await it(a);if(null===r||void 0===r?void 0:r.noResolveJson)return a;try{return await a.json()}catch(e){await it(e)}}(e,t,s+a,{headers:n,noResolveJson:null===r||void 0===r?void 0:r.noResolveJson},{},null===r||void 0===r?void 0:r.body);return(null===r||void 0===r?void 0:r.xform)?null===r||void 0===r?void 0:r.xform(c):{data:Object.assign({},c),error:null}}function at(e){var t;let s=null;var r;(function(e){return e.access_token&&e.refresh_token&&e.expires_in})(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:s,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function ct(e){const t=at(e);return!t.error&&e.weak_password&&"object"===typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"===typeof e.weak_password.message&&e.weak_password.reasons.reduce(((e,t)=>e&&"string"===typeof t),!0)&&(t.data.weak_password=e.weak_password),t}function ht(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function lt(e){return{data:e,error:null}}function ut(e){const{action_link:t,email_otp:s,hashed_token:r,redirect_to:i,verification_type:n}=e,o=tt(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]);return{data:{properties:{action_link:t,email_otp:s,hashed_token:r,redirect_to:i,verification_type:n},user:Object.assign({},o)},error:null}}function dt(e){return e}var ft=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s};class pt{constructor({url:e="",headers:t={},fetch:s}){this.url=e,this.headers=t,this.fetch=Ae(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await ot(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await ot(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{const{options:t}=e,s=ft(e,["options"]),r=Object.assign(Object.assign({},s),t);return"newEmail"in s&&(r.new_email=null===s||void 0===s?void 0:s.newEmail,delete r.newEmail),await ot(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:ut,redirectTo:null===t||void 0===t?void 0:t.redirectTo})}catch(e){if(Be(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await ot(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,s,r,i,n,o,a;try{const c={nextPage:null,lastPage:0,total:0},h=await ot(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(s=null===(t=null===e||void 0===e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==s?s:"",per_page:null!==(i=null===(r=null===e||void 0===e?void 0:e.perPage)||void 0===r?void 0:r.toString())&&void 0!==i?i:""},xform:dt});if(h.error)throw h.error;const l=await h.json(),u=null!==(n=h.headers.get("x-total-count"))&&void 0!==n?n:0,d=null!==(a=null===(o=h.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return d.length>0&&(d.forEach((e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),s=JSON.parse(e.split(";")[1].split("=")[1]);c[`${s}Page`]=t})),c.total=parseInt(u)),{data:Object.assign(Object.assign({},l),c),error:null}}catch(e){if(Be(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await ot(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await ot(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){try{return await ot(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{const{data:t,error:s}=await ot(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:s}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{return{data:await ot(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}}const gt="0.0.0",vt={"X-Client-Info":`gotrue-js/${gt}`},mt={getItem:e=>Ce()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{Ce()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{Ce()&&globalThis.localStorage.removeItem(e)}};function yt(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const wt=!!(globalThis&&Ce()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"));class _t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class bt extends _t{}async function kt(e,t,s){wt&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout((()=>{r.abort(),wt&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)}),t),await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},(async r=>{if(!r){if(0===t)throw wt&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new bt(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(wt)try{const e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null,"  "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await s()}wt&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,r.name);try{return await s()}finally{wt&&console.log("@supabase/gotrue-js: navigatorLock: released",e,r.name)}}))}!function(){if("object"!==typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!==typeof self&&(self.globalThis=self)}}();const St={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vt,flowType:"implicit",debug:!1},Tt=3e4;async function jt(e,t,s){return await s()}class Et{constructor(e){var t,s;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Et.nextInstanceID,Et.nextInstanceID+=1,this.instanceID>0&&Pe()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},St),e);if(this.logDebugMessages=!!r.debug,"function"===typeof r.debug&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new pt({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=Ae(r.fetch),this.lock=r.lock||jt,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,r.lock?this.lock=r.lock:Pe()&&(null===(t=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.locks)?this.lock=kt:this.lock=jt,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:Ce()?this.storage=mt:(this.memoryStorage={},this.storage=yt(this.memoryStorage)):(this.memoryStorage={},this.storage=yt(this.memoryStorage)),Pe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null===(s=this.broadcastChannel)||void 0===s||s.addEventListener("message",(async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}))}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${gt}) ${(new Date).toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,(async()=>await this._initialize())))()),await this.initializePromise}async _initialize(){try{const e=!!Pe()&&await this._isPKCEFlow();if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:t,error:s}=await this._getSessionFromURL(e);if(s)return this._debug("#_initialize()","error detecting session from URL",s),"Identity is already linked"===(null===s||void 0===s?void 0:s.message)||"Identity is already linked to another user"===(null===s||void 0===s?void 0:s.message)||await this._removeSession(),{error:s};const{session:r,redirectType:i}=t;return this._debug("#_initialize()","detected session in URL",r,"redirect type",i),await this._saveSession(r),setTimeout((async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",r):await this._notifyAllSubscribers("SIGNED_IN",r)}),0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return Be(e)?{error:e}:{error:new Ke("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signUp(e){var t,s,r;try{let i;if(await this._removeSession(),"email"in e){const{email:s,password:r,options:n}=e;let o=null,a=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),o=await Je(e),a=e===o?"plain":"s256"}i=await ot(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null===n||void 0===n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null===n||void 0===n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null===n||void 0===n?void 0:n.captchaToken},code_challenge:o,code_challenge_method:a},xform:at})}else{if(!("phone"in e))throw new We("You must provide either an email or phone number and a password");{const{phone:t,password:n,options:o}=e;i=await ot(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null===o||void 0===o?void 0:o.data)&&void 0!==s?s:{},channel:null!==(r=null===o||void 0===o?void 0:o.channel)&&void 0!==r?r:"sms",gotrue_meta_security:{captcha_token:null===o||void 0===o?void 0:o.captchaToken}},xform:at})}}const{data:n,error:o}=i;if(o||!n)return{data:{user:null,session:null},error:o};const a=n.session,c=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if(await this._removeSession(),"email"in e){const{email:s,password:r,options:i}=e;t=await ot(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},xform:ct})}else{if(!("phone"in e))throw new We("You must provide either an email or phone number and a password");{const{phone:s,password:r,options:i}=e;t=await ot(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},xform:ct})}}const{data:s,error:r}=t;return r?{data:{user:null,session:null},error:r}:s&&s.session&&s.user?(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r}):{data:{user:null,session:null},error:new Ve}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,(async()=>this._exchangeCodeForSession(e)))}async _exchangeCodeForSession(e){const t=await Le(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!==t&&void 0!==t?t:"").split("/"),{data:i,error:n}=await ot(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:at});return await Ue(this.storage,`${this.storageKey}-code-verifier`),n?{data:{user:null,session:null,redirectType:null},error:n}:i&&i.session&&i.user?(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:null!==r&&void 0!==r?r:null}),error:n}):{data:{user:null,session:null,redirectType:null},error:new Ve}}async signInWithIdToken(e){await this._removeSession();try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,o=await ot(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null===t||void 0===t?void 0:t.captchaToken}},xform:at}),{data:a,error:c}=o;return c?{data:{user:null,session:null},error:c}:a&&a.session&&a.user?(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:c}):{data:{user:null,session:null},error:new Ve}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if(await this._removeSession(),"email"in e){const{email:r,options:i}=e;let n=null,o=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),n=await Je(e),o=e===n?"plain":"s256"}const{error:a}=await ot(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null===i||void 0===i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null===i||void 0===i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:o},redirectTo:null===i||void 0===i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:a}}if("phone"in e){const{phone:t,options:s}=e,{data:o,error:a}=await ot(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null===s||void 0===s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null===s||void 0===s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null===s||void 0===s?void 0:s.captchaToken},channel:null!==(n=null===s||void 0===s?void 0:s.channel)&&void 0!==n?n:"sms"}});return{data:{user:null,session:null,messageId:null===o||void 0===o?void 0:o.message_id},error:a}}throw new We("You must provide either an email or phone number.")}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,s;try{let r,i;"email_change"!==e.type&&"phone_change"!==e.type&&await this._removeSession(),"options"in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:o}=await ot(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:at});if(o)throw o;if(!n)throw new Error("An error occurred on token verification.");const a=n.session,c=n.user;return(null===a||void 0===a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,s,r;try{await this._removeSession();let i=null,n=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),i=await Je(e),n=e===i?"plain":"s256"}return await ot(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null===e||void 0===e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:n}),headers:this.headers,xform:lt})}catch(e){if(Be(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._reauthenticate()))}async _reauthenticate(){try{return await this._useSession((async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new He;const{error:r}=await ot(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:r}}))}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{"email_change"!=e.type&&"phone_change"!=e.type&&await this._removeSession();const t=`${this.url}/resend`;if("email"in e){const{email:s,type:r,options:i}=e,{error:n}=await ot(this.fetch,"POST",t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},redirectTo:null===i||void 0===i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:n}}if("phone"in e){const{phone:s,type:r,options:i}=e,{data:n,error:o}=await ot(this.fetch,"POST",t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null===n||void 0===n?void 0:n.message_id},error:o}}throw new We("You must provide either an email or phone number and a type")}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,this._acquireLock(-1,(async()=>this._useSession((async e=>e))))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,(async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}}))}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",(new Error).stack);try{let e=null;const t=await Le(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&e.expires_at<=Date.now()/1e3;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s)return{data:{session:e},error:null};const{session:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,this._acquireLock(-1,(async()=>await this._getUser())))}async _getUser(e){try{return e?await ot(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ht}):await this._useSession((async e=>{var t,s;const{data:r,error:i}=e;if(i)throw i;return await ot(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(s=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==s?s:void 0,xform:ht})}))}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._updateUser(e,t)))}async _updateUser(e,t={}){try{return await this._useSession((async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new He;const n=r.session;let o=null,a=null;if("pkce"===this.flowType&&null!=e.email){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),o=await Je(e),a=e===o?"plain":"s256"}const{data:c,error:h}=await ot(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null===t||void 0===t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:a}),jwt:n.access_token,xform:ht});if(h)throw h;return n.user=c.user,await this._saveSession(n),await this._notifyAllSubscribers("USER_UPDATED",n),{data:{user:n.user},error:null}}))}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return De(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._setSession(e)))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new He;const t=Date.now()/1e3;let s=t,r=!0,i=null;const n=De(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{session:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return{data:{user:null,session:null},error:s};if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)throw n;i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:"bearer",expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(Be(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._refreshSession(e)))}async _refreshSession(e){try{return await this._useSession((async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null===e||void 0===e?void 0:e.refresh_token))throw new He;const{session:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:r?{data:{user:r.user,session:r},error:null}:{data:{user:null,session:null},error:null}}))}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!Pe())throw new Ye("No browser detected.");if("implicit"===this.flowType&&!this._isImplicitGrantFlow())throw new Ye("Not a valid implicit grant flow url.");if("pkce"==this.flowType&&!e)throw new Xe("Not a valid PKCE flow url.");const t=Re(window.location.href);if(e){if(!t.code)throw new Xe("No code detected.");const{data:e,error:s}=await this._exchangeCodeForSession(t.code);if(s)throw s;const r=new URL(window.location.href);return r.searchParams.delete("code"),window.history.replaceState(window.history.state,"",r.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new Ye(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});const{provider_token:s,provider_refresh_token:r,access_token:i,refresh_token:n,expires_in:o,expires_at:a,token_type:c}=t;if(!i||!o||!n||!c)throw new Ye("No session defined in URL");const h=Math.round(Date.now()/1e3),l=parseInt(o);let u=h+l;a&&(u=parseInt(a));const d=u-h;1e3*d<=Tt&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${l}s`);const f=u-l;h-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,u,h):h-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",f,u,h);const{data:p,error:g}=await this._getUser(i);if(g)throw g;const v={provider_token:s,provider_refresh_token:r,access_token:i,expires_in:l,expires_at:u,refresh_token:n,token_type:c,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:v,redirectType:t.type},error:null}}catch(e){if(Be(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){const e=Re(window.location.href);return!(!Pe()||!e.access_token&&!e.error_description)}async _isPKCEFlow(){const e=Re(window.location.href),t=await Le(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._signOut(e)))}async _signOut({scope:e}={scope:"global"}){return await this._useSession((async t=>{var s;const{data:r,error:i}=t;if(i)return{error:i};const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!function(e){return Be(e)&&"AuthApiError"===e.name}(t)||404!==t.status&&401!==t.status))return{error:t}}return"others"!==e&&(await this._removeSession(),await Ue(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}}))}onAuthStateChange(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),s={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,await this._acquireLock(-1,(async()=>{this._emitInitialSession(t)}))})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession((async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback("INITIAL_SESSION",r)),this._debug("INITIAL_SESSION","callback id",e,"session",r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}}))}async resetPasswordForEmail(e,t={}){let s=null,r=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,`${e}/PASSWORD_RECOVERY`),s=await Je(e),r=e===s?"plain":"s256"}try{return await ot(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(Be(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return{data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{const{data:s,error:r}=await this._useSession((async t=>{var s,r,i,n,o;const{data:a,error:c}=t;if(c)throw c;const h=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await ot(this.fetch,"GET",h,{headers:this.headers,jwt:null!==(o=null===(n=a.session)||void 0===n?void 0:n.access_token)&&void 0!==o?o:void 0})}));if(r)throw r;return Pe()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null===s||void 0===s?void 0:s.url),{data:{provider:e.provider,url:null===s||void 0===s?void 0:s.url},error:null}}catch(t){if(Be(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession((async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await ot(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const i=Date.now();return await(s=async s=>(await async function(e){return await new Promise((t=>{setTimeout((()=>t(null)),e)}))}(200*s),this._debug(t,"refreshing attempt",s),await ot(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:at})),r=(e,t,s)=>s&&s.error&&Ze(s.error)&&Date.now()+200*(e+1)-i<Tt,new Promise(((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{const t=await s(i);if(!r(i,null,t))return void e(t)}catch(e){if(!r(i,e))return void t(e)}})()})))}catch(e){if(this._debug(t,"error",e),Be(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}var s,r}_isValidSession(e){return"object"===typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const s=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",s),Pe()&&!t.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e;const t="#_recoverAndRefresh()";this._debug(t,"begin");try{const s=await Le(this.storage,this.storageKey);if(this._debug(t,"session from storage",s),!this._isValidSession(s))return this._debug(t,"session is not valid"),void(null!==s&&await this._removeSession());const r=Math.round(Date.now()/1e3),i=(null!==(e=s.expires_at)&&void 0!==e?e:1/0)<r+10;if(this._debug(t,`session has${i?"":" not"} expired with margin of 10s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:e}=await this._callRefreshToken(s.refresh_token);e&&(console.error(e),Ze(e)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(e){return this._debug(t,"error",e),void console.error(e)}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,s;if(!e)throw new He;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new Ne;const{data:t,error:s}=await this._refreshAccessToken(e);if(s)throw s;if(!t.session)throw new He;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);const r={session:t.session,error:null};return this.refreshingDeferred.resolve(r),r}catch(e){if(this._debug(r,"error",e),Be(e)){const s={session:null,error:e};return Ze(e)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(e),e}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,"begin",t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map((async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}}));if(await Promise.all(i),r.length>0){for(let e=0;e<r.length;e+=1)console.error(r[e]);throw r[0]}}finally{this._debug(r,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),await Ie(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await Ue(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Pe()&&(null===window||void 0===window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval((()=>this._autoRefreshTokenTick()),Tt);this.autoRefreshTicker=e,e&&"object"===typeof e&&"function"===typeof e.unref?e.unref():"undefined"!==typeof Deno&&"function"===typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout((async()=>{await this.initializePromise,await this._autoRefreshTokenTick()}),0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,(async()=>{try{const e=Date.now();try{return await this._useSession((async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");const r=Math.floor((1e3*s.expires_at-e)/Tt);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(s.refresh_token)}))}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}))}catch(e){if(!(e.isAcquireTimeout||e instanceof _t))throw e;this._debug("auto refresh token tick lock not available")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Pe()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null===window||void 0===window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,(async()=>{"visible"===document.visibilityState?await this._recoverAndRefresh():this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting")})))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null===s||void 0===s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null===s||void 0===s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),"pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e);const t=await Je(e),s=e===t?"plain":"s256";this._debug("PKCE","code verifier",`${e.substring(0,5)}...`,"code challenge",t,"method",s);const i=new URLSearchParams({code_challenge:`${encodeURIComponent(t)}`,code_challenge_method:`${encodeURIComponent(s)}`});r.push(i.toString())}if(null===s||void 0===s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null===s||void 0===s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;return i?{data:null,error:i}:await ot(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession((async t=>{var s,r;const{data:i,error:n}=t;if(n)return{data:null,error:n};const{data:o,error:a}=await ot(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:null===(s=null===i||void 0===i?void 0:i.session)||void 0===s?void 0:s.access_token});return a?{data:null,error:a}:((null===(r=null===o||void 0===o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,(async()=>{try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;if(i)return{data:null,error:i};const{data:n,error:o}=await ot(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+n.expires_in},n)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",n),{data:n,error:o})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}))}async _challenge(e){return this._acquireLock(-1,(async()=>{try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;return i?{data:null,error:i}:await ot(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}))}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const s=(null===e||void 0===e?void 0:e.factors)||[],r=s.filter((e=>"totp"===e.factor_type&&"verified"===e.status));return{data:{all:s,totp:r},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,(async()=>await this._useSession((async e=>{var t,s;const{data:{session:r},error:i}=e;if(i)return{data:null,error:i};if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const n=this._decodeJWT(r.access_token);let o=null;n.aal&&(o=n.aal);let a=o;(null!==(s=null===(t=r.user.factors)||void 0===t?void 0:t.filter((e=>"verified"===e.status)))&&void 0!==s?s:[]).length>0&&(a="aal2");return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:n.amr||[]},error:null}}))))}}Et.nextInstanceID=0;class Ot extends Et{constructor(e){super(e)}}var Pt=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class $t{constructor(e,t,s){var r,i,n,o,a,c,h,l;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const u=e.replace(/\/$/,"");this.realtimeUrl=`${u}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${u}/auth/v1`,this.storageUrl=`${u}/storage/v1`,this.functionsUrl=`${u}/functions/v1`;const d=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,f=function(e,t){const{db:s,auth:r,realtime:i,global:n}=e,{db:o,auth:a,realtime:c,global:h}=t;return{db:Object.assign(Object.assign({},o),s),auth:Object.assign(Object.assign({},a),r),realtime:Object.assign(Object.assign({},c),i),global:Object.assign(Object.assign({},h),n)}}(null!==s&&void 0!==s?s:{},{db:ke,realtime:Te,auth:Object.assign(Object.assign({},Se),{storageKey:d}),global:be});this.storageKey=null!==(i=null===(r=f.auth)||void 0===r?void 0:r.storageKey)&&void 0!==i?i:"",this.headers=null!==(o=null===(n=f.global)||void 0===n?void 0:n.headers)&&void 0!==o?o:{},this.auth=this._initSupabaseAuthClient(null!==(a=f.auth)&&void 0!==a?a:{},this.headers,null===(c=f.global)||void 0===c?void 0:c.fetch),this.fetch=Oe(t,this._getAccessToken.bind(this),null===(h=f.global)||void 0===h?void 0:h.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},f.realtime)),this.rest=new k(`${u}/rest/v1`,{headers:this.headers,schema:null===(l=f.db)||void 0===l?void 0:l.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new p(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new we(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},s={}){return this.rest.rpc(e,t,s)}channel(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 Pt(this,void 0,void 0,(function*(){const{data:s}=yield this.auth.getSession();return null!==(t=null===(e=s.session)||void 0===e?void 0:e.access_token)&&void 0!==t?t:null}))}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,storageKey:i,flowType:n,debug:o},a,c){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Ot({url:this.authUrl,headers:Object.assign(Object.assign({},h),a),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,flowType:n,debug:o,fetch:c})}_initRealtimeClient(e){return new Y(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null===e||void 0===e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange(((e,t)=>{this._handleTokenChanged(e,"CLIENT",null===t||void 0===t?void 0:t.access_token)}))}_handleTokenChanged(e,t,s){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===s?"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.realtime.setAuth(null!==s&&void 0!==s?s:null),this.changedAccessToken=s)}}const Ct="https://api.scoredetect.com";new $t("https://jtiipfmpqosvwdjjbhnc.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imp0aWlwZm1wcW9zdndkampiaG5jIiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODQ5Mjk5ODMsImV4cCI6MjAwMDUwNTk4M30.QZjkBzpsnEctknl3GkX4uH-2HJ0Rh81VI8O840O-Jjs",{auth:{persistSession:!1}});(0,e.registerPlugin)("timestamp-post",{render:()=>{const e=(()=>{const[e,s]=(0,t.useState)(!1),r=(0,t.useRef)(!1),{isSavingPost:n,isAutosavingPost:o}=(0,i.useSelect)((e=>({isSavingPost:e("core/editor").isSavingPost(),isAutosavingPost:e("core/editor").isAutosavingPost()})));return(0,t.useEffect)((()=>{!n&&!o||r.current||(s(!1),r.current=!0),n||o||!r.current||(s(!0),r.current=!1)}),[n,o]),e})(),{editPost:s}=(0,i.useDispatch)("core/editor"),{createNotice:a}=(0,i.useDispatch)("core/notices"),h=(0,i.useSelect)((e=>e("core/editor").getCurrentPostType()),[]),l=(0,i.useSelect)((e=>{const t=e("core").getEntityRecord("root","site");return t?.sdcom_timestamps})),{sdcom_timestamp_post:u=!1,sdcom_previous_certificate_id:d="",...f}=(0,i.useSelect)((e=>e("core/editor").getEditedPostAttribute("meta")||{})),p=(0,i.useSelect)((e=>e("core/editor").getEditedPostContent()),[]),g=(0,i.useSelect)((e=>e("core").getPostType(h)),[h]),v=(0,i.useSelect)((e=>e("core/editor").getCurrentPostId()),[]),m=(0,i.useSelect)((e=>"auto-draft"===e("core/editor").getEditedPostAttribute("status"))),y=`/${g?.rest_namespace}/${g?.rest_base}/${v}`;return(0,t.useEffect)((()=>{if(!m)return;const e="true"===l?.default_timestamps_enabled;e!==u&&s({meta:{...f,sdcom_timestamp_post:e}})}),[l]),(0,t.useEffect)((()=>{(async()=>{if(e&&u)try{if(p.length<0)throw new Error("postContent is empty.");const e={certificateType:"plain_text_upload",displayCreatedBy:!!l?.display_created_by,username:l?.username&&"true"===l?.display_created_by?l?.username:"anonymous"},t=new FormData;t.append("file",p),t.append("username",e.username),t.append("previous_certificate_id",d);const s=await(async({apiKey:e,formData:t})=>{try{const s=`${Ct}/create-certificate`,r=new Headers({Authorization:`Bearer ${e}`}),i=await fetch(s,{method:"POST",headers:r,body:t});if(!i.ok)throw console.log("Error in postData",{url:s,res:i}),Error(i.statusText);return i.json()}catch(e){throw console.error(e),e}})({apiKey:l.api_key,formData:t}),r=s?.certificate?.id;await(async({apiKey:e,certificateId:t,metadata:s})=>{try{const r=`${Ct}/update-certificate`,i=new Headers({Authorization:`Bearer ${e}`,"Content-Type":"application/json"}),n=await fetch(r,{method:"PATCH",headers:i,body:JSON.stringify({certificateId:t,metadata:s})});if(!n.ok)throw console.log("Error in postData",{url:r,res:n}),Error(n.statusText);return n.json()}catch(e){throw console.error(e),e}})({apiKey:l.api_key,certificateId:r,metadata:e}),c()({path:y,method:"POST",data:{meta:{...f,sdcom_previous_certificate_id:r}}}).catch((e=>{console.error("Error updating post meta:",e)})),a("success",(0,o.__)("Certificate created successfully.","timestamps"),{isDismissible:!0})}catch(e){console.error(e)}})()}),[e]),(0,t.createElement)(n.PluginPostStatusInfo,null,(0,t.createElement)(r.CheckboxControl,{label:(0,o.sprintf)((0,o.__)("Enable timestamps for this %s","timestamps"),h),help:(0,o.__)("Timestamps prove that you keep your content regularly up-to-date.","timestamps"),checked:u,onChange:e=>{s({meta:{...f,sdcom_timestamp_post:e}})}}))},icon:null})}()}();
     1!function(){"use strict";var e={907:function(e,t,s){s.r(t),s.d(t,{Headers:function(){return n},Request:function(){return o},Response:function(){return a},fetch:function(){return i}});var r=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof s.g)return s.g;throw new Error("unable to locate global object")}();const i=r.fetch;t.default=r.fetch.bind(r);const n=r.Headers,o=r.Request,a=r.Response}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,s),n.exports}s.m=e,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},function(){var e,t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};s.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var n=Object.create(null);s.r(n);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((function(e){o[e]=function(){return r[e]}}));return o.default=function(){return r},s.d(n,o),n}}(),s.d=function(e,t){for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce((function(t,r){return s.f[r](e,t),t}),[]))},s.u=function(e){return"js/"+e+".7e61fd99a8c41da8c843.chunk.js"},s.miniCssF=function(e){},s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={},t="timestamps-plugin:";s.l=function(r,i,n,o){if(e[r])e[r].push(i);else{var a,c;if(void 0!==n)for(var h=document.getElementsByTagName("script"),l=0;l<h.length;l++){var u=h[l];if(u.getAttribute("src")==r||u.getAttribute("data-webpack")==t+n){a=u;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",t+n),a.src=r),e[r]=[i];var d=function(t,s){a.onerror=a.onload=null,clearTimeout(f);var i=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((function(e){return e(s)})),t)return t(s)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}}}(),s.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e+"../"}(),function(){var e={948:0};s.f.j=function(t,r){var i=s.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var n=new Promise((function(s,r){i=e[t]=[s,r]}));r.push(i[2]=n);var o=s.p+s.u(t),a=new Error;s.l(o,(function(r){if(s.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var n=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",a.name="ChunkLoadError",a.type=n,a.request=o,i[1](a)}}),"chunk-"+t,t)}};var t=function(t,r){var i,n,o=r[0],a=r[1],c=r[2],h=0;if(o.some((function(t){return 0!==e[t]}))){for(i in a)s.o(a,i)&&(s.m[i]=a[i]);if(c)c(s)}for(t&&t(r);h<o.length;h++)n=o[h],s.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=self.webpackChunktimestamps_plugin=self.webpackChunktimestamps_plugin||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))}(),function(){var e=window.wp.plugins,t=window.wp.element,r=window.wp.components,i=window.wp.data,n=window.wp.editPost,o=window.wp.i18n,a=window.wp.apiFetch,c=s.n(a);class h extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class l extends h{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class u extends h{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class d extends h{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var f=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class p{constructor(e,{headers:t={},customFetch:r}={}){this.url=e,this.headers=t,this.fetch=(e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)})(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s;return f(this,void 0,void 0,(function*(){try{const{headers:r,method:i,body:n}=t;let o,a={};n&&(r&&!Object.prototype.hasOwnProperty.call(r,"Content-Type")||!r)&&("undefined"!==typeof Blob&&n instanceof Blob||n instanceof ArrayBuffer?(a["Content-Type"]="application/octet-stream",o=n):"string"===typeof n?(a["Content-Type"]="text/plain",o=n):"undefined"!==typeof FormData&&n instanceof FormData?o=n:(a["Content-Type"]="application/json",o=JSON.stringify(n)));const c=yield this.fetch(`${this.url}/${e}`,{method:i||"POST",headers:Object.assign(Object.assign(Object.assign({},a),this.headers),r),body:o}).catch((e=>{throw new l(e)})),h=c.headers.get("x-relay-error");if(h&&"true"===h)throw new u(c);if(!c.ok)throw new d(c);let f,p=(null!==(s=c.headers.get("Content-Type"))&&void 0!==s?s:"text/plain").split(";")[0].trim();return f="application/json"===p?yield c.json():"application/octet-stream"===p?yield c.blob():"multipart/form-data"===p?yield c.formData():yield c.text(),{data:f,error:null}}catch(e){return{data:null,error:e}}}))}}var g=s(907);class v extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}class m{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:"undefined"===typeof fetch?this.fetch=g.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let s=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then((async e=>{var t,s,r;let i=null,n=null,o=null,a=e.status,c=e.statusText;if(e.ok){if("HEAD"!==this.method){const t=await e.text();""===t||(n="text/csv"===this.headers.Accept||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}const r=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),h=null===(s=e.headers.get("content-range"))||void 0===s?void 0:s.split("/");r&&h&&h.length>1&&(o=parseInt(h[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(n)&&(n.length>1?(i={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,o=null,a=406,c="Not Acceptable"):n=1===n.length?n[0]:null)}else{const t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(n=[],i=null,a=200,c="OK")}catch(s){404===e.status&&""===t?(a=204,c="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null===(r=null===i||void 0===i?void 0:i.details)||void 0===r?void 0:r.includes("0 rows"))&&(i=null,a=200,c="OK"),i&&this.shouldThrowOnError)throw new v(i)}return{error:i,data:n,count:o,status:a,statusText:c}}));return this.shouldThrowOnError||(s=s.catch((e=>{var t,s,r;return{error:{message:`${null!==(t=null===e||void 0===e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null===e||void 0===e?void 0:e.message}`,details:`${null!==(s=null===e||void 0===e?void 0:e.stack)&&void 0!==s?s:""}`,hint:"",code:`${null!==(r=null===e||void 0===e?void 0:e.code)&&void 0!==r?r:""}`},data:null,count:null,status:0,statusText:""}}))),s.then(e,t)}}class y extends m{select(e){let t=!1;const s=(null!==e&&void 0!==e?e:"*").split("").map((e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e))).join("");return this.url.searchParams.set("select",s),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:r,referencedTable:i=r}={}){const n=i?`${i}.order`:"order",o=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${void 0===s?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const r="undefined"===typeof s?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:r=s}={}){const i="undefined"===typeof r?"offset":`${r}.offset`,n="undefined"===typeof r?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(n,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return"GET"===this.method?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:s=!1,buffers:r=!1,wal:i=!1,format:n="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,s?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=null!==(o=this.headers.Accept)&&void 0!==o?o:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${n}; for="${c}"; options=${a};`,this}rollback(){var e;return(null!==(e=this.headers.Prefer)&&void 0!==e?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class w extends y{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const s=t.map((e=>"string"===typeof e&&new RegExp("[,()]").test(e)?`"${e}"`:`${e}`)).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}contains(e,t){return"string"===typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"===typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"===typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:r}={}){let i="";"plain"===r?i="pl":"phrase"===r?i="ph":"websearch"===r&&(i="w");const n=void 0===s?"":`(${s})`;return this.url.searchParams.append(e,`${i}fts${n}.${t}`),this}match(e){return Object.entries(e).forEach((([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)})),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}}class _{constructor(e,{headers:t={},schema:s,fetch:r}){this.url=e,this.headers=t,this.schema=s,this.fetch=r}select(e,{head:t=!1,count:s}={}){const r=t?"HEAD":"GET";let i=!1;const n=(null!==e&&void 0!==e?e:"*").split("").map((e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e))).join("");return this.url.searchParams.set("select",n),s&&(this.headers.Prefer=`count=${s}`),new w({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:s=!0}={}){const r=[];if(this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push(`count=${t}`),s||r.push("missing=default"),this.headers.Prefer=r.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new w({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:r,defaultToNull:i=!0}={}){const n=[`resolution=${s?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&n.push(this.headers.Prefer),r&&n.push(`count=${r}`),i||n.push("missing=default"),this.headers.Prefer=n.join(","),Array.isArray(e)){const t=e.reduce(((e,t)=>e.concat(Object.keys(t))),[]);if(t.length>0){const e=[...new Set(t)].map((e=>`"${e}"`));this.url.searchParams.set("columns",e.join(","))}}return new w({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){const s=[];return this.headers.Prefer&&s.push(this.headers.Prefer),t&&s.push(`count=${t}`),this.headers.Prefer=s.join(","),new w({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const t=[];return e&&t.push(`count=${e}`),this.headers.Prefer&&t.unshift(this.headers.Prefer),this.headers.Prefer=t.join(","),new w({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const b={"X-Client-Info":"postgrest-js/1.9.2"};class k{constructor(e,{headers:t={},schema:s,fetch:r}={}){this.url=e,this.headers=Object.assign(Object.assign({},b),t),this.schemaName=s,this.fetch=r}from(e){const t=new URL(`${this.url}/${e}`);return new _(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new k(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:s=!1,count:r}={}){let i;const n=new URL(`${this.url}/rpc/${e}`);let o;s?(i="HEAD",Object.entries(t).forEach((([e,t])=>{n.searchParams.append(e,`${t}`)}))):(i="POST",o=t);const a=Object.assign({},this.headers);return r&&(a.Prefer=`count=${r}`),new w({method:i,url:n,headers:a,schema:this.schemaName,body:o,fetch:this.fetch,allowEmpty:!1})}}const S={"X-Client-Info":"realtime-js/2.9.3"};var T,j,E,O,P,$,C;!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(T||(T={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(j||(j={})),function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"}(E||(E={})),function(e){e.websocket="websocket"}(O||(O={})),function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"}(P||(P={}));class R{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}}class A{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t("string"===typeof e?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,t,s)}_decodeBroadcast(e,t,s){const r=t.getUint8(1),i=t.getUint8(2);let n=this.HEADER_LENGTH+2;const o=s.decode(e.slice(n,n+r));n+=r;const a=s.decode(e.slice(n,n+i));n+=i;return{ref:null,topic:o,event:a,payload:JSON.parse(s.decode(e.slice(n,e.byteLength)))}}}class x{constructor(e,t,s={},r=1e4){this.channel=e,this.event=t,this.payload=s,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var s;return this._hasReceived(e)&&t(null===(s=this.receivedResp)||void 0===s?void 0:s.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);this.channel._on(this.refEvent,{},(e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}!function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"}($||($={}));class I{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(null===t||void 0===t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},(e=>{const{onJoin:t,onLeave:s,onSync:r}=this.caller;this.joinRef=this.channel._joinRef(),this.state=I.syncState(this.state,e,t,s),this.pendingDiffs.forEach((e=>{this.state=I.syncDiff(this.state,e,t,s)})),this.pendingDiffs=[],r()})),this.channel._on(s.diff,{},(e=>{const{onJoin:t,onLeave:s,onSync:r}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=I.syncDiff(this.state,e,t,s),r())})),this.onJoin(((e,t,s)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:s})})),this.onLeave(((e,t,s)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:s})})),this.onSync((()=>{this.channel._trigger("presence",{event:"sync"})}))}static syncState(e,t,s,r){const i=this.cloneDeep(e),n=this.transformState(t),o={},a={};return this.map(i,((e,t)=>{n[e]||(a[e]=t)})),this.map(n,((e,t)=>{const s=i[e];if(s){const r=t.map((e=>e.presence_ref)),i=s.map((e=>e.presence_ref)),n=t.filter((e=>i.indexOf(e.presence_ref)<0)),c=s.filter((e=>r.indexOf(e.presence_ref)<0));n.length>0&&(o[e]=n),c.length>0&&(a[e]=c)}else o[e]=t})),this.syncDiff(i,{joins:o,leaves:a},s,r)}static syncDiff(e,t,s,r){const{joins:i,leaves:n}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return s||(s=()=>{}),r||(r=()=>{}),this.map(i,((t,r)=>{var i;const n=null!==(i=e[t])&&void 0!==i?i:[];if(e[t]=this.cloneDeep(r),n.length>0){const s=e[t].map((e=>e.presence_ref)),r=n.filter((e=>s.indexOf(e.presence_ref)<0));e[t].unshift(...r)}s(t,n,r)})),this.map(n,((t,s)=>{let i=e[t];if(!i)return;const n=s.map((e=>e.presence_ref));i=i.filter((e=>n.indexOf(e.presence_ref)<0)),e[t]=i,r(t,i,s),0===i.length&&delete e[t]})),e}static map(e,t){return Object.getOwnPropertyNames(e).map((s=>t(s,e[s])))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce(((t,s)=>{const r=e[s];return t[s]="metas"in r?r.metas.map((e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))):r,t}),{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}!function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"}(C||(C={}));const L=(e,t,s={})=>{var r;const i=null!==(r=s.skipTypes)&&void 0!==r?r:[];return Object.keys(t).reduce(((s,r)=>(s[r]=U(r,e,t,i),s)),{})},U=(e,t,s,r)=>{const i=t.find((t=>t.name===e)),n=null===i||void 0===i?void 0:i.type,o=s[e];return n&&!r.includes(n)?D(n,o):N(o)},D=(e,t)=>{if("_"===e.charAt(0)){const s=e.slice(1,e.length);return z(t,s)}switch(e){case C.bool:return F(t);case C.float4:case C.float8:case C.int2:case C.int4:case C.int8:case C.numeric:case C.oid:return q(t);case C.json:case C.jsonb:return J(t);case C.timestamp:return B(t);case C.abstime:case C.date:case C.daterange:case C.int4range:case C.int8range:case C.money:case C.reltime:case C.text:case C.time:case C.timestamptz:case C.timetz:case C.tsrange:case C.tstzrange:default:return N(t)}},N=e=>e,F=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},q=e=>{if("string"===typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},J=e=>{if("string"===typeof e)try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},z=(e,t)=>{if("string"!==typeof e)return e;const s=e.length-1,r=e[s];if("{"===e[0]&&"}"===r){let r;const i=e.slice(1,s);try{r=JSON.parse("["+i+"]")}catch(e){r=i?i.split(","):[]}return r.map((e=>D(t,e)))}return e},B=e=>"string"===typeof e?e.replace(" ","T"):e;var M,K,G;!function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(M||(M={})),function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes"}(K||(K={})),function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"}(G||(G={}));class H{constructor(e,t={config:{}},s){this.topic=e,this.params=t,this.socket=s,this.bindings={},this.state=j.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},t.config),this.timeout=this.socket.timeout,this.joinPush=new x(this,E.join,this.params,this.timeout),this.rejoinTimer=new R((()=>this._rejoinUntilConnected()),this.socket.reconnectAfterMs),this.joinPush.receive("ok",(()=>{this.state=j.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this._onClose((()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=j.closed,this.socket._remove(this)})),this._onError((e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=j.errored,this.rejoinTimer.scheduleTimeout())})),this.joinPush.receive("timeout",(()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=j.errored,this.rejoinTimer.scheduleTimeout())})),this._on(E.reply,{},((e,t)=>{this._trigger(this._replyEventName(t),e)})),this.presence=new I(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(e,t=this.timeout){var s,r;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:i,presence:n}}=this.params;this._onError((t=>e&&e("CHANNEL_ERROR",t))),this._onClose((()=>e&&e("CLOSED")));const o={},a={broadcast:i,presence:n,postgres_changes:null!==(r=null===(s=this.bindings.postgres_changes)||void 0===s?void 0:s.map((e=>e.filter)))&&void 0!==r?r:[]};this.socket.accessToken&&(o.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:a},o)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",(({postgres_changes:t})=>{var s;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),void 0!==t){const r=this.bindings.postgres_changes,i=null!==(s=null===r||void 0===r?void 0:r.length)&&void 0!==s?s:0,n=[];for(let s=0;s<i;s++){const i=r[s],{filter:{event:o,schema:a,table:c,filter:h}}=i,l=t&&t[s];if(!l||l.event!==o||l.schema!==a||l.table!==c||l.filter!==h)return this.unsubscribe(),void(e&&e("CHANNEL_ERROR",new Error("mismatch between server and client bindings for postgres changes")));n.push(Object.assign(Object.assign({},i),{id:l.id}))}return this.bindings.postgres_changes=n,void(e&&e("SUBSCRIBED"))}e&&e("SUBSCRIBED")})).receive("error",(t=>{e&&e("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(t).join(", ")||"error")))})).receive("timeout",(()=>{e&&e("TIMED_OUT")}))}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,s){return this._on(e,t,s)}async send(e,t={}){var s,r;if(this._canPush()||"broadcast"!==e.type)return new Promise((s=>{var r,i,n;const o=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(n=null===(i=null===(r=this.params)||void 0===r?void 0:r.config)||void 0===i?void 0:i.broadcast)||void 0===n?void 0:n.ack)||s("ok"),o.receive("ok",(()=>s("ok"))),o.receive("timeout",(()=>s("timed out")))}));{const{event:i,payload:n}=e,o={method:"POST",headers:{apikey:null!==(s=this.socket.apiKey)&&void 0!==s?s:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:n}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,o,null!==(r=t.timeout)&&void 0!==r?r:this.timeout)).ok?"ok":"error"}catch(e){return"AbortError"===e.name?"timed out":"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=j.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(E.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise((s=>{const r=new x(this,E.leave,{},e);r.receive("ok",(()=>{t(),s("ok")})).receive("timeout",(()=>{t(),s("timed out")})).receive("error",(()=>{s("error")})),r.send(),this._canPush()||r.trigger("ok",{})}))}_broadcastEndpointURL(){let e=this.socket.endPoint;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(e,t,s){const r=new AbortController,i=setTimeout((()=>r.abort()),s),n=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(i),n}_push(e,t,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new x(this,e,t,s);return this._canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}_onMessage(e,t,s){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,s){var r,i;const n=e.toLocaleLowerCase(),{close:o,error:a,leave:c,join:h}=E;if(s&&[o,a,c,h].indexOf(n)>=0&&s!==this._joinRef())return;let l=this._onMessage(n,t,s);if(t&&!l)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(n)?null===(r=this.bindings.postgres_changes)||void 0===r||r.filter((e=>{var t,s,r;return"*"===(null===(t=e.filter)||void 0===t?void 0:t.event)||(null===(r=null===(s=e.filter)||void 0===s?void 0:s.event)||void 0===r?void 0:r.toLocaleLowerCase())===n})).map((e=>e.callback(l,s))):null===(i=this.bindings[n])||void 0===i||i.filter((e=>{var s,r,i,o,a,c;if(["broadcast","presence","postgres_changes"].includes(n)){if("id"in e){const n=e.id,o=null===(s=e.filter)||void 0===s?void 0:s.event;return n&&(null===(r=t.ids)||void 0===r?void 0:r.includes(n))&&("*"===o||(null===o||void 0===o?void 0:o.toLocaleLowerCase())===(null===(i=t.data)||void 0===i?void 0:i.type.toLocaleLowerCase()))}{const s=null===(a=null===(o=null===e||void 0===e?void 0:e.filter)||void 0===o?void 0:o.event)||void 0===a?void 0:a.toLocaleLowerCase();return"*"===s||s===(null===(c=null===t||void 0===t?void 0:t.event)||void 0===c?void 0:c.toLocaleLowerCase())}}return e.type.toLocaleLowerCase()===n})).map((e=>{if("object"===typeof l&&"ids"in l){const e=l.data,{schema:t,table:s,commit_timestamp:r,type:i,errors:n}=e,o={schema:t,table:s,commit_timestamp:r,eventType:i,new:{},old:{},errors:n};l=Object.assign(Object.assign({},o),this._getPayloadRecords(e))}e.callback(l,s)}))}_isClosed(){return this.state===j.closed}_isJoined(){return this.state===j.joined}_isJoining(){return this.state===j.joining}_isLeaving(){return this.state===j.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,s){const r=e.toLocaleLowerCase(),i={type:r,filter:t,callback:s};return this.bindings[r]?this.bindings[r].push(i):this.bindings[r]=[i],this}_off(e,t){const s=e.toLocaleLowerCase();return this.bindings[s]=this.bindings[s].filter((e=>{var r;return!((null===(r=e.type)||void 0===r?void 0:r.toLocaleLowerCase())===s&&H.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(E.close,{},e)}_onError(e){this._on(E.error,{},(t=>e(t)))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=j.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return"INSERT"!==e.type&&"UPDATE"!==e.type||(t.new=L(e.columns,e.record)),"UPDATE"!==e.type&&"DELETE"!==e.type||(t.old=L(e.columns,e.old_record)),t}}const V=()=>{},W="undefined"!==typeof WebSocket;class X{constructor(e,t){var r;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.headers=S,this.params={},this.timeout=1e4,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=V,this.conn=null,this.sendBuffer=[],this.serializer=new A,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},this.endPoint=`${e}/${O.websocket}`,(null===t||void 0===t?void 0:t.transport)?this.transport=t.transport:this.transport=null,(null===t||void 0===t?void 0:t.params)&&(this.params=t.params),(null===t||void 0===t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),(null===t||void 0===t?void 0:t.timeout)&&(this.timeout=t.timeout),(null===t||void 0===t?void 0:t.logger)&&(this.logger=t.logger),(null===t||void 0===t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);const i=null===(r=null===t||void 0===t?void 0:t.params)||void 0===r?void 0:r.apikey;i&&(this.accessToken=i,this.apiKey=i),this.reconnectAfterMs=(null===t||void 0===t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null===t||void 0===t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null===t||void 0===t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new R((async()=>{this.disconnect(),this.connect()}),this.reconnectAfterMs),this.fetch=this._resolveFetch(null===t||void 0===t?void 0:t.fetch)}connect(){if(!this.conn)if(this.transport)this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});else{if(W)return this.conn=new WebSocket(this._endPointURL()),void this.setupConnection();this.conn=new Y(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),s.e(591).then(s.t.bind(s,1591,23)).then((({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()}))}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!==t&&void 0!==t?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map((e=>e.unsubscribe())));return this.disconnect(),e}log(e,t,s){this.logger(e,t,s)}connectionState(){switch(this.conn&&this.conn.readyState){case T.connecting:return P.Connecting;case T.open:return P.Open;case T.closing:return P.Closing;default:return P.Closed}}isConnected(){return this.connectionState()===P.Open}channel(e,t={config:{}}){const s=new H(`realtime:${e}`,t,this);return this.channels.push(s),s}push(e){const{topic:t,event:s,payload:r,ref:i}=e,n=()=>{this.encode(e,(e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)}))};this.log("push",`${t} ${s} (${i})`,r),this.isConnected()?n():this.sendBuffer.push(n)}setAuth(e){this.accessToken=e,this.channels.forEach((t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(E.access_token,{access_token:e})}))}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t._isJoined()||t._isJoining())));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter((t=>t._joinRef()!==e._joinRef()))}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}_onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:s,payload:r,ref:i}=e;(i&&i===this.pendingHeartbeatRef||s===(null===r||void 0===r?void 0:r.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${r.status||""} ${t} ${s} ${i&&"("+i+")"||""}`,r),this.channels.filter((e=>e._isMember(t))).forEach((e=>e._trigger(s,r,i))),this.stateChangeCallbacks.message.forEach((t=>t(e)))}))}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval((()=>this._sendHeartbeat()),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach((e=>e()))}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((t=>t(e)))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach((t=>t(e)))}_triggerChanError(){this.channels.forEach((e=>e._trigger(E.error)))}_appendParams(e,t){if(0===Object.keys(t).length)return e;const s=e.match(/\?/)?"&":"?";return`${e}${s}${new URLSearchParams(t)}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef)return this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),void(null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout"));this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class Y{constructor(e,t,s){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=T.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=s.close}}class Q extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Z(e){return"object"===typeof e&&null!==e&&"__isStorageError"in e}class ee extends Q{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class te extends Q{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var se=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const re=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)};var ie=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const ne=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),oe=(e,t)=>ie(void 0,void 0,void 0,(function*(){const r=yield se(void 0,void 0,void 0,(function*(){return"undefined"===typeof Response?(yield Promise.resolve().then(s.bind(s,907))).Response:Response}));e instanceof r?e.json().then((s=>{t(new ee(ne(s),e.status||500))})).catch((e=>{t(new te(ne(e),e))})):t(new te(ne(e),e))})),ae=(e,t,s,r)=>{const i={method:e,headers:(null===t||void 0===t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json"},null===t||void 0===t?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),s))};function ce(e,t,s,r,i,n){return ie(this,void 0,void 0,(function*(){return new Promise(((o,a)=>{e(s,ae(t,r,i,n)).then((e=>{if(!e.ok)throw e;return(null===r||void 0===r?void 0:r.noResolveJson)?e:e.json()})).then((e=>o(e))).catch((e=>oe(e,a)))}))}))}function he(e,t,s,r){return ie(this,void 0,void 0,(function*(){return ce(e,"GET",t,s,r)}))}function le(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"POST",t,r,i,s)}))}function ue(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"DELETE",t,r,i,s)}))}var de=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const fe={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},pe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ge{constructor(e,t={},s,r){this.url=e,this.headers=t,this.bucketId=s,this.fetch=re(r)}uploadOrUpdate(e,t,s,r){return de(this,void 0,void 0,(function*(){try{let i;const n=Object.assign(Object.assign({},pe),r),o=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)});"undefined"!==typeof Blob&&s instanceof Blob?(i=new FormData,i.append("cacheControl",n.cacheControl),i.append("",s)):"undefined"!==typeof FormData&&s instanceof FormData?(i=s,i.append("cacheControl",n.cacheControl)):(i=s,o["cache-control"]=`max-age=${n.cacheControl}`,o["content-type"]=n.contentType);const a=this._removeEmptyFolders(t),c=this._getFinalPath(a),h=yield this.fetch(`${this.url}/object/${c}`,Object.assign({method:e,body:i,headers:o},(null===n||void 0===n?void 0:n.duplex)?{duplex:n.duplex}:{})),l=yield h.json();if(h.ok)return{data:{path:a,id:l.Id,fullPath:l.Key},error:null};return{data:null,error:l}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}upload(e,t,s){return de(this,void 0,void 0,(function*(){return this.uploadOrUpdate("POST",e,t,s)}))}uploadToSignedUrl(e,t,s,r){return de(this,void 0,void 0,(function*(){const i=this._removeEmptyFolders(e),n=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${n}`);o.searchParams.set("token",t);try{let e;const t=Object.assign({upsert:pe.upsert},r),n=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!==typeof Blob&&s instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),e.append("",s)):"undefined"!==typeof FormData&&s instanceof FormData?(e=s,e.append("cacheControl",t.cacheControl)):(e=s,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType);const a=yield this.fetch(o.toString(),{method:"PUT",body:e,headers:n}),c=yield a.json();if(a.ok)return{data:{path:i,fullPath:c.Key},error:null};return{data:null,error:c}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUploadUrl(e){return de(this,void 0,void 0,(function*(){try{let t=this._getFinalPath(e);const s=yield le(this.fetch,`${this.url}/object/upload/sign/${t}`,{},{headers:this.headers}),r=new URL(this.url+s.url),i=r.searchParams.get("token");if(!i)throw new Q("No token returned by API");return{data:{signedUrl:r.toString(),path:e,token:i},error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}update(e,t,s){return de(this,void 0,void 0,(function*(){return this.uploadOrUpdate("PUT",e,t,s)}))}move(e,t){return de(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}copy(e,t){return de(this,void 0,void 0,(function*(){try{return{data:{path:(yield le(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers})).Key},error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUrl(e,t,s){return de(this,void 0,void 0,(function*(){try{let r=this._getFinalPath(e),i=yield le(this.fetch,`${this.url}/object/sign/${r}`,Object.assign({expiresIn:t},(null===s||void 0===s?void 0:s.transform)?{transform:s.transform}:{}),{headers:this.headers});const n=(null===s||void 0===s?void 0:s.download)?`&download=${!0===s.download?"":s.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${n}`)},{data:i,error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createSignedUrls(e,t,s){return de(this,void 0,void 0,(function*(){try{const r=yield le(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=(null===s||void 0===s?void 0:s.download)?`&download=${!0===s.download?"":s.download}`:"";return{data:r.map((e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null}))),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}download(e,t){return de(this,void 0,void 0,(function*(){const s="undefined"!==typeof(null===t||void 0===t?void 0:t.transform)?"render/image/authenticated":"object",r=this.transformOptsToQueryString((null===t||void 0===t?void 0:t.transform)||{}),i=r?`?${r}`:"";try{const t=this._getFinalPath(e),r=yield he(this.fetch,`${this.url}/${s}/${t}${i}`,{headers:this.headers,noResolveJson:!0});return{data:yield r.blob(),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}getPublicUrl(e,t){const s=this._getFinalPath(e),r=[],i=(null===t||void 0===t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&r.push(i);const n="undefined"!==typeof(null===t||void 0===t?void 0:t.transform)?"render/image":"object",o=this.transformOptsToQueryString((null===t||void 0===t?void 0:t.transform)||{});""!==o&&r.push(o);let a=r.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${n}/public/${s}${a}`)}}}remove(e){return de(this,void 0,void 0,(function*(){try{return{data:yield ue(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}list(e,t,s){return de(this,void 0,void 0,(function*(){try{const r=Object.assign(Object.assign(Object.assign({},fe),t),{prefix:e||""});return{data:yield le(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},s),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const ve={"X-Client-Info":"storage-js/2.5.5"};var me=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class ye{constructor(e,t={},s){this.url=e,this.headers=Object.assign(Object.assign({},ve),t),this.fetch=re(s)}listBuckets(){return me(this,void 0,void 0,(function*(){try{return{data:yield he(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}getBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield he(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}createBucket(e,t={public:!1}){return me(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}updateBucket(e,t){return me(this,void 0,void 0,(function*(){try{const s=yield function(e,t,s,r,i){return ie(this,void 0,void 0,(function*(){return ce(e,"PUT",t,r,i,s)}))}(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers});return{data:s,error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}emptyBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield le(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}deleteBucket(e){return me(this,void 0,void 0,(function*(){try{return{data:yield ue(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(Z(e))return{data:null,error:e};throw e}}))}}class we extends ye{constructor(e,t={},s){super(e,t,s)}from(e){return new ge(this.url,this.headers,e,this.fetch)}}let _e="";_e="undefined"!==typeof Deno?"deno":"undefined"!==typeof document?"web":"undefined"!==typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";const be={headers:{"X-Client-Info":`supabase-js-${_e}/2.39.7`}},ke={schema:"public"},Se={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Te={};var je=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const Ee=e=>{let t;return t=e||("undefined"===typeof fetch?g.default:fetch),(...e)=>t(...e)},Oe=(e,t,s)=>{const r=Ee(s),i="undefined"===typeof Headers?g.Headers:Headers;return(s,n)=>je(void 0,void 0,void 0,(function*(){var o;const a=null!==(o=yield t())&&void 0!==o?o:e;let c=new i(null===n||void 0===n?void 0:n.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${a}`),r(s,Object.assign(Object.assign({},n),{headers:c}))}))};const Pe=()=>"undefined"!==typeof document,$e={tested:!1,writable:!1},Ce=()=>{if(!Pe())return!1;try{if("object"!==typeof globalThis.localStorage)return!1}catch(e){return!1}if($e.tested)return $e.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),$e.tested=!0,$e.writable=!0}catch(e){$e.tested=!0,$e.writable=!1}return $e.writable};function Re(e){const t={},s=new URL(e);if(s.hash&&"#"===s.hash[0])try{new URLSearchParams(s.hash.substring(1)).forEach(((e,s)=>{t[s]=e}))}catch(e){}return s.searchParams.forEach(((e,s)=>{t[s]=e})),t}const Ae=e=>{let t;return t=e||("undefined"===typeof fetch?(...e)=>Promise.resolve().then(s.bind(s,907)).then((({default:t})=>t(...e))):fetch),(...e)=>t(...e)},xe=e=>"object"===typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"===typeof e.json,Ie=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},Le=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch(e){return s}},Ue=async(e,t)=>{await e.removeItem(t)};class De{constructor(){this.promise=new De.promiseConstructor(((e,t)=>{this.resolve=e,this.reject=t}))}}function Ne(e){const t=e.split(".");if(3!==t.length)throw new Error("JWT is not valid: not a JWT structure");if(!/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i.test(t[1]))throw new Error("JWT is not valid: payload is not in base64url format");const s=t[1];return JSON.parse(function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s,r,i,n,o,a,c,h="",l=0;for(e=e.replace("-","+").replace("_","/");l<e.length;)n=t.indexOf(e.charAt(l++)),o=t.indexOf(e.charAt(l++)),a=t.indexOf(e.charAt(l++)),c=t.indexOf(e.charAt(l++)),s=n<<2|o>>4,r=(15&o)<<4|a>>2,i=(3&a)<<6|c,h+=String.fromCharCode(s),64!=a&&0!=r&&(h+=String.fromCharCode(r)),64!=c&&0!=i&&(h+=String.fromCharCode(i));return h}(s))}function Fe(e){return("0"+e.toString(16)).substr(-2)}function qe(){const e=new Uint32Array(56);if("undefined"===typeof crypto){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length;let s="";for(let r=0;r<56;r++)s+=e.charAt(Math.floor(Math.random()*t));return s}return crypto.getRandomValues(e),Array.from(e,Fe).join("")}async function Je(e){if(!("undefined"!==typeof crypto&&"undefined"!==typeof crypto.subtle&&"undefined"!==typeof TextEncoder))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const t=await async function(e){const t=(new TextEncoder).encode(e),s=await crypto.subtle.digest("SHA-256",t),r=new Uint8Array(s);return Array.from(r).map((e=>String.fromCharCode(e))).join("")}(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}De.promiseConstructor=Promise;class ze extends Error{constructor(e,t){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t}}function Be(e){return"object"===typeof e&&null!==e&&"__isAuthError"in e}class Me extends ze{constructor(e,t){super(e,t),this.name="AuthApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Ke extends ze{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Ge extends ze{constructor(e,t,s){super(e),this.name=t,this.status=s}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class He extends Ge{constructor(){super("Auth session missing!","AuthSessionMissingError",400)}}class Ve extends Ge{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500)}}class We extends Ge{constructor(e){super(e,"AuthInvalidCredentialsError",400)}}class Xe extends Ge{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ye extends Ge{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Qe extends Ge{constructor(e,t){super(e,"AuthRetryableFetchError",t)}}function Ze(e){return Be(e)&&"AuthRetryableFetchError"===e.name}class et extends Ge{constructor(e,t,s){super(e,"AuthWeakPasswordError",t),this.reasons=s}}var tt=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s};const st=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rt=[502,503,504];async function it(e){if(!xe(e))throw new Qe(st(e),0);if(rt.includes(e.status))throw new Qe(st(e),e.status);let t;try{t=await e.json()}catch(e){throw new Ke(st(e),e)}if("object"===typeof t&&t&&"object"===typeof t.weak_password&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce(((e,t)=>e&&"string"===typeof t),!0))throw new et(st(t),e.status,t.weak_password.reasons);throw new Me(st(t),e.status||500)}const nt=(e,t,s,r)=>{const i={method:e,headers:(null===t||void 0===t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null===t||void 0===t?void 0:t.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),s))};async function ot(e,t,s,r){var i;const n=Object.assign({},null===r||void 0===r?void 0:r.headers);(null===r||void 0===r?void 0:r.jwt)&&(n.Authorization=`Bearer ${r.jwt}`);const o=null!==(i=null===r||void 0===r?void 0:r.query)&&void 0!==i?i:{};(null===r||void 0===r?void 0:r.redirectTo)&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await async function(e,t,s,r,i,n){const o=nt(t,r,i,n);let a;try{a=await e(s,o)}catch(e){throw console.error(e),new Qe(st(e),0)}a.ok||await it(a);if(null===r||void 0===r?void 0:r.noResolveJson)return a;try{return await a.json()}catch(e){await it(e)}}(e,t,s+a,{headers:n,noResolveJson:null===r||void 0===r?void 0:r.noResolveJson},{},null===r||void 0===r?void 0:r.body);return(null===r||void 0===r?void 0:r.xform)?null===r||void 0===r?void 0:r.xform(c):{data:Object.assign({},c),error:null}}function at(e){var t;let s=null;var r;(function(e){return e.access_token&&e.refresh_token&&e.expires_in})(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:s,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function ct(e){const t=at(e);return!t.error&&e.weak_password&&"object"===typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"===typeof e.weak_password.message&&e.weak_password.reasons.reduce(((e,t)=>e&&"string"===typeof t),!0)&&(t.data.weak_password=e.weak_password),t}function ht(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function lt(e){return{data:e,error:null}}function ut(e){const{action_link:t,email_otp:s,hashed_token:r,redirect_to:i,verification_type:n}=e,o=tt(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]);return{data:{properties:{action_link:t,email_otp:s,hashed_token:r,redirect_to:i,verification_type:n},user:Object.assign({},o)},error:null}}function dt(e){return e}var ft=function(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]])}return s};class pt{constructor({url:e="",headers:t={},fetch:s}){this.url=e,this.headers=t,this.fetch=Ae(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await ot(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await ot(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{const{options:t}=e,s=ft(e,["options"]),r=Object.assign(Object.assign({},s),t);return"newEmail"in s&&(r.new_email=null===s||void 0===s?void 0:s.newEmail,delete r.newEmail),await ot(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:ut,redirectTo:null===t||void 0===t?void 0:t.redirectTo})}catch(e){if(Be(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await ot(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,s,r,i,n,o,a;try{const c={nextPage:null,lastPage:0,total:0},h=await ot(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(s=null===(t=null===e||void 0===e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==s?s:"",per_page:null!==(i=null===(r=null===e||void 0===e?void 0:e.perPage)||void 0===r?void 0:r.toString())&&void 0!==i?i:""},xform:dt});if(h.error)throw h.error;const l=await h.json(),u=null!==(n=h.headers.get("x-total-count"))&&void 0!==n?n:0,d=null!==(a=null===(o=h.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return d.length>0&&(d.forEach((e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),s=JSON.parse(e.split(";")[1].split("=")[1]);c[`${s}Page`]=t})),c.total=parseInt(u)),{data:Object.assign(Object.assign({},l),c),error:null}}catch(e){if(Be(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await ot(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await ot(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){try{return await ot(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:ht})}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{const{data:t,error:s}=await ot(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:s}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{return{data:await ot(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}}const gt="0.0.0",vt={"X-Client-Info":`gotrue-js/${gt}`},mt={getItem:e=>Ce()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{Ce()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{Ce()&&globalThis.localStorage.removeItem(e)}};function yt(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const wt=!!(globalThis&&Ce()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"));class _t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class bt extends _t{}async function kt(e,t,s){wt&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;return t>0&&setTimeout((()=>{r.abort(),wt&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)}),t),await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},(async r=>{if(!r){if(0===t)throw wt&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new bt(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(wt)try{const e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null,"  "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await s()}wt&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,r.name);try{return await s()}finally{wt&&console.log("@supabase/gotrue-js: navigatorLock: released",e,r.name)}}))}!function(){if("object"!==typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!==typeof self&&(self.globalThis=self)}}();const St={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vt,flowType:"implicit",debug:!1},Tt=3e4;async function jt(e,t,s){return await s()}class Et{constructor(e){var t,s;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=Et.nextInstanceID,Et.nextInstanceID+=1,this.instanceID>0&&Pe()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},St),e);if(this.logDebugMessages=!!r.debug,"function"===typeof r.debug&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new pt({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=Ae(r.fetch),this.lock=r.lock||jt,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,r.lock?this.lock=r.lock:Pe()&&(null===(t=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.locks)?this.lock=kt:this.lock=jt,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:Ce()?this.storage=mt:(this.memoryStorage={},this.storage=yt(this.memoryStorage)):(this.memoryStorage={},this.storage=yt(this.memoryStorage)),Pe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null===(s=this.broadcastChannel)||void 0===s||s.addEventListener("message",(async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}))}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${gt}) ${(new Date).toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,(async()=>await this._initialize())))()),await this.initializePromise}async _initialize(){try{const e=!!Pe()&&await this._isPKCEFlow();if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:t,error:s}=await this._getSessionFromURL(e);if(s)return this._debug("#_initialize()","error detecting session from URL",s),"Identity is already linked"===(null===s||void 0===s?void 0:s.message)||"Identity is already linked to another user"===(null===s||void 0===s?void 0:s.message)||await this._removeSession(),{error:s};const{session:r,redirectType:i}=t;return this._debug("#_initialize()","detected session in URL",r,"redirect type",i),await this._saveSession(r),setTimeout((async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",r):await this._notifyAllSubscribers("SIGNED_IN",r)}),0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return Be(e)?{error:e}:{error:new Ke("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signUp(e){var t,s,r;try{let i;if(await this._removeSession(),"email"in e){const{email:s,password:r,options:n}=e;let o=null,a=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),o=await Je(e),a=e===o?"plain":"s256"}i=await ot(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null===n||void 0===n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null===n||void 0===n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null===n||void 0===n?void 0:n.captchaToken},code_challenge:o,code_challenge_method:a},xform:at})}else{if(!("phone"in e))throw new We("You must provide either an email or phone number and a password");{const{phone:t,password:n,options:o}=e;i=await ot(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null===o||void 0===o?void 0:o.data)&&void 0!==s?s:{},channel:null!==(r=null===o||void 0===o?void 0:o.channel)&&void 0!==r?r:"sms",gotrue_meta_security:{captcha_token:null===o||void 0===o?void 0:o.captchaToken}},xform:at})}}const{data:n,error:o}=i;if(o||!n)return{data:{user:null,session:null},error:o};const a=n.session,c=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if(await this._removeSession(),"email"in e){const{email:s,password:r,options:i}=e;t=await ot(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},xform:ct})}else{if(!("phone"in e))throw new We("You must provide either an email or phone number and a password");{const{phone:s,password:r,options:i}=e;t=await ot(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},xform:ct})}}const{data:s,error:r}=t;return r?{data:{user:null,session:null},error:r}:s&&s.session&&s.user?(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r}):{data:{user:null,session:null},error:new Ve}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,(async()=>this._exchangeCodeForSession(e)))}async _exchangeCodeForSession(e){const t=await Le(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!==t&&void 0!==t?t:"").split("/"),{data:i,error:n}=await ot(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:at});return await Ue(this.storage,`${this.storageKey}-code-verifier`),n?{data:{user:null,session:null,redirectType:null},error:n}:i&&i.session&&i.user?(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:null!==r&&void 0!==r?r:null}),error:n}):{data:{user:null,session:null,redirectType:null},error:new Ve}}async signInWithIdToken(e){await this._removeSession();try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,o=await ot(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null===t||void 0===t?void 0:t.captchaToken}},xform:at}),{data:a,error:c}=o;return c?{data:{user:null,session:null},error:c}:a&&a.session&&a.user?(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:c}):{data:{user:null,session:null},error:new Ve}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if(await this._removeSession(),"email"in e){const{email:r,options:i}=e;let n=null,o=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),n=await Je(e),o=e===n?"plain":"s256"}const{error:a}=await ot(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null===i||void 0===i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null===i||void 0===i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:o},redirectTo:null===i||void 0===i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:a}}if("phone"in e){const{phone:t,options:s}=e,{data:o,error:a}=await ot(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null===s||void 0===s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null===s||void 0===s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null===s||void 0===s?void 0:s.captchaToken},channel:null!==(n=null===s||void 0===s?void 0:s.channel)&&void 0!==n?n:"sms"}});return{data:{user:null,session:null,messageId:null===o||void 0===o?void 0:o.message_id},error:a}}throw new We("You must provide either an email or phone number.")}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,s;try{let r,i;"email_change"!==e.type&&"phone_change"!==e.type&&await this._removeSession(),"options"in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:o}=await ot(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:at});if(o)throw o;if(!n)throw new Error("An error occurred on token verification.");const a=n.session,c=n.user;return(null===a||void 0===a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),{data:{user:c,session:a},error:null}}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,s,r;try{await this._removeSession();let i=null,n=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),i=await Je(e),n=e===i?"plain":"s256"}return await ot(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null===e||void 0===e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:n}),headers:this.headers,xform:lt})}catch(e){if(Be(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._reauthenticate()))}async _reauthenticate(){try{return await this._useSession((async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new He;const{error:r}=await ot(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:r}}))}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{"email_change"!=e.type&&"phone_change"!=e.type&&await this._removeSession();const t=`${this.url}/resend`;if("email"in e){const{email:s,type:r,options:i}=e,{error:n}=await ot(this.fetch,"POST",t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}},redirectTo:null===i||void 0===i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:n}}if("phone"in e){const{phone:s,type:r,options:i}=e,{data:n,error:o}=await ot(this.fetch,"POST",t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null===i||void 0===i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null===n||void 0===n?void 0:n.message_id},error:o}}throw new We("You must provide either an email or phone number and a type")}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,this._acquireLock(-1,(async()=>this._useSession((async e=>e))))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,(async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}}))}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",(new Error).stack);try{let e=null;const t=await Le(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&e.expires_at<=Date.now()/1e3;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s)return{data:{session:e},error:null};const{session:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{session:null},error:i}:{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,this._acquireLock(-1,(async()=>await this._getUser())))}async _getUser(e){try{return e?await ot(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ht}):await this._useSession((async e=>{var t,s;const{data:r,error:i}=e;if(i)throw i;return await ot(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(s=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==s?s:void 0,xform:ht})}))}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._updateUser(e,t)))}async _updateUser(e,t={}){try{return await this._useSession((async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new He;const n=r.session;let o=null,a=null;if("pkce"===this.flowType&&null!=e.email){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e),o=await Je(e),a=e===o?"plain":"s256"}const{data:c,error:h}=await ot(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null===t||void 0===t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:a}),jwt:n.access_token,xform:ht});if(h)throw h;return n.user=c.user,await this._saveSession(n),await this._notifyAllSubscribers("USER_UPDATED",n),{data:{user:n.user},error:null}}))}catch(e){if(Be(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return Ne(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._setSession(e)))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new He;const t=Date.now()/1e3;let s=t,r=!0,i=null;const n=Ne(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{session:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return{data:{user:null,session:null},error:s};if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)throw n;i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:"bearer",expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(Be(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._refreshSession(e)))}async _refreshSession(e){try{return await this._useSession((async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null===e||void 0===e?void 0:e.refresh_token))throw new He;const{session:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:r?{data:{user:r.user,session:r},error:null}:{data:{user:null,session:null},error:null}}))}catch(e){if(Be(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!Pe())throw new Xe("No browser detected.");if("implicit"===this.flowType&&!this._isImplicitGrantFlow())throw new Xe("Not a valid implicit grant flow url.");if("pkce"==this.flowType&&!e)throw new Ye("Not a valid PKCE flow url.");const t=Re(window.location.href);if(e){if(!t.code)throw new Ye("No code detected.");const{data:e,error:s}=await this._exchangeCodeForSession(t.code);if(s)throw s;const r=new URL(window.location.href);return r.searchParams.delete("code"),window.history.replaceState(window.history.state,"",r.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new Xe(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});const{provider_token:s,provider_refresh_token:r,access_token:i,refresh_token:n,expires_in:o,expires_at:a,token_type:c}=t;if(!i||!o||!n||!c)throw new Xe("No session defined in URL");const h=Math.round(Date.now()/1e3),l=parseInt(o);let u=h+l;a&&(u=parseInt(a));const d=u-h;1e3*d<=Tt&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${l}s`);const f=u-l;h-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,u,h):h-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",f,u,h);const{data:p,error:g}=await this._getUser(i);if(g)throw g;const v={provider_token:s,provider_refresh_token:r,access_token:i,expires_in:l,expires_at:u,refresh_token:n,token_type:c,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:v,redirectType:t.type},error:null}}catch(e){if(Be(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){const e=Re(window.location.href);return!(!Pe()||!e.access_token&&!e.error_description)}async _isPKCEFlow(){const e=Re(window.location.href),t=await Le(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,(async()=>await this._signOut(e)))}async _signOut({scope:e}={scope:"global"}){return await this._useSession((async t=>{var s;const{data:r,error:i}=t;if(i)return{error:i};const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!function(e){return Be(e)&&"AuthApiError"===e.name}(t)||404!==t.status&&401!==t.status))return{error:t}}return"others"!==e&&(await this._removeSession(),await Ue(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}}))}onAuthStateChange(e){const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),s={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,await this._acquireLock(-1,(async()=>{this._emitInitialSession(t)}))})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession((async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback("INITIAL_SESSION",r)),this._debug("INITIAL_SESSION","callback id",e,"session",r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}}))}async resetPasswordForEmail(e,t={}){let s=null,r=null;if("pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,`${e}/PASSWORD_RECOVERY`),s=await Je(e),r=e===s?"plain":"s256"}try{return await ot(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(Be(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return{data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null}}catch(e){if(Be(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{const{data:s,error:r}=await this._useSession((async t=>{var s,r,i,n,o;const{data:a,error:c}=t;if(c)throw c;const h=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await ot(this.fetch,"GET",h,{headers:this.headers,jwt:null!==(o=null===(n=a.session)||void 0===n?void 0:n.access_token)&&void 0!==o?o:void 0})}));if(r)throw r;return Pe()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null===s||void 0===s?void 0:s.url),{data:{provider:e.provider,url:null===s||void 0===s?void 0:s.url},error:null}}catch(t){if(Be(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession((async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await ot(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const i=Date.now();return await(s=async s=>(await async function(e){return await new Promise((t=>{setTimeout((()=>t(null)),e)}))}(200*s),this._debug(t,"refreshing attempt",s),await ot(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:at})),r=(e,t,s)=>s&&s.error&&Ze(s.error)&&Date.now()+200*(e+1)-i<Tt,new Promise(((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{const t=await s(i);if(!r(i,null,t))return void e(t)}catch(e){if(!r(i,e))return void t(e)}})()})))}catch(e){if(this._debug(t,"error",e),Be(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}var s,r}_isValidSession(e){return"object"===typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const s=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",s),Pe()&&!t.skipBrowserRedirect&&window.location.assign(s),{data:{provider:e,url:s},error:null}}async _recoverAndRefresh(){var e;const t="#_recoverAndRefresh()";this._debug(t,"begin");try{const s=await Le(this.storage,this.storageKey);if(this._debug(t,"session from storage",s),!this._isValidSession(s))return this._debug(t,"session is not valid"),void(null!==s&&await this._removeSession());const r=Math.round(Date.now()/1e3),i=(null!==(e=s.expires_at)&&void 0!==e?e:1/0)<r+10;if(this._debug(t,`session has${i?"":" not"} expired with margin of 10s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:e}=await this._callRefreshToken(s.refresh_token);e&&(console.error(e),Ze(e)||(this._debug(t,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(e){return this._debug(t,"error",e),void console.error(e)}finally{this._debug(t,"end")}}async _callRefreshToken(e){var t,s;if(!e)throw new He;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new De;const{data:t,error:s}=await this._refreshAccessToken(e);if(s)throw s;if(!t.session)throw new He;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);const r={session:t.session,error:null};return this.refreshingDeferred.resolve(r),r}catch(e){if(this._debug(r,"error",e),Be(e)){const s={session:null,error:e};return Ze(e)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(e),e}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,"begin",t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map((async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}}));if(await Promise.all(i),r.length>0){for(let e=0;e<r.length;e+=1)console.error(r[e]);throw r[0]}}finally{this._debug(r,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),await Ie(this.storage,this.storageKey,e)}async _removeSession(){this._debug("#_removeSession()"),await Ue(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Pe()&&(null===window||void 0===window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval((()=>this._autoRefreshTokenTick()),Tt);this.autoRefreshTicker=e,e&&"object"===typeof e&&"function"===typeof e.unref?e.unref():"undefined"!==typeof Deno&&"function"===typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout((async()=>{await this.initializePromise,await this._autoRefreshTokenTick()}),0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,(async()=>{try{const e=Date.now();try{return await this._useSession((async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");const r=Math.floor((1e3*s.expires_at-e)/Tt);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(s.refresh_token)}))}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}))}catch(e){if(!(e.isAcquireTimeout||e instanceof _t))throw e;this._debug("auto refresh token tick lock not available")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Pe()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null===window||void 0===window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,(async()=>{"visible"===document.visibilityState?await this._recoverAndRefresh():this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting")})))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null===s||void 0===s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null===s||void 0===s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),"pkce"===this.flowType){const e=qe();await Ie(this.storage,`${this.storageKey}-code-verifier`,e);const t=await Je(e),s=e===t?"plain":"s256";this._debug("PKCE","code verifier",`${e.substring(0,5)}...`,"code challenge",t,"method",s);const i=new URLSearchParams({code_challenge:`${encodeURIComponent(t)}`,code_challenge_method:`${encodeURIComponent(s)}`});r.push(i.toString())}if(null===s||void 0===s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null===s||void 0===s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;return i?{data:null,error:i}:await ot(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession((async t=>{var s,r;const{data:i,error:n}=t;if(n)return{data:null,error:n};const{data:o,error:a}=await ot(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:null===(s=null===i||void 0===i?void 0:i.session)||void 0===s?void 0:s.access_token});return a?{data:null,error:a}:((null===(r=null===o||void 0===o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,(async()=>{try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;if(i)return{data:null,error:i};const{data:n,error:o}=await ot(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+n.expires_in},n)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",n),{data:n,error:o})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}))}async _challenge(e){return this._acquireLock(-1,(async()=>{try{return await this._useSession((async t=>{var s;const{data:r,error:i}=t;return i?{data:null,error:i}:await ot(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:null===(s=null===r||void 0===r?void 0:r.session)||void 0===s?void 0:s.access_token})}))}catch(e){if(Be(e))return{data:null,error:e};throw e}}))}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const s=(null===e||void 0===e?void 0:e.factors)||[],r=s.filter((e=>"totp"===e.factor_type&&"verified"===e.status));return{data:{all:s,totp:r},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,(async()=>await this._useSession((async e=>{var t,s;const{data:{session:r},error:i}=e;if(i)return{data:null,error:i};if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const n=this._decodeJWT(r.access_token);let o=null;n.aal&&(o=n.aal);let a=o;(null!==(s=null===(t=r.user.factors)||void 0===t?void 0:t.filter((e=>"verified"===e.status)))&&void 0!==s?s:[]).length>0&&(a="aal2");return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:n.amr||[]},error:null}}))))}}Et.nextInstanceID=0;class Ot extends Et{constructor(e){super(e)}}var Pt=function(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(e){n(e)}}function a(e){try{c(r.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class $t{constructor(e,t,s){var r,i,n,o,a,c,h,l;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const u=e.replace(/\/$/,"");this.realtimeUrl=`${u}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${u}/auth/v1`,this.storageUrl=`${u}/storage/v1`,this.functionsUrl=`${u}/functions/v1`;const d=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,f=function(e,t){const{db:s,auth:r,realtime:i,global:n}=e,{db:o,auth:a,realtime:c,global:h}=t;return{db:Object.assign(Object.assign({},o),s),auth:Object.assign(Object.assign({},a),r),realtime:Object.assign(Object.assign({},c),i),global:Object.assign(Object.assign({},h),n)}}(null!==s&&void 0!==s?s:{},{db:ke,realtime:Te,auth:Object.assign(Object.assign({},Se),{storageKey:d}),global:be});this.storageKey=null!==(i=null===(r=f.auth)||void 0===r?void 0:r.storageKey)&&void 0!==i?i:"",this.headers=null!==(o=null===(n=f.global)||void 0===n?void 0:n.headers)&&void 0!==o?o:{},this.auth=this._initSupabaseAuthClient(null!==(a=f.auth)&&void 0!==a?a:{},this.headers,null===(c=f.global)||void 0===c?void 0:c.fetch),this.fetch=Oe(t,this._getAccessToken.bind(this),null===(h=f.global)||void 0===h?void 0:h.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},f.realtime)),this.rest=new k(`${u}/rest/v1`,{headers:this.headers,schema:null===(l=f.db)||void 0===l?void 0:l.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new p(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new we(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},s={}){return this.rest.rpc(e,t,s)}channel(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 Pt(this,void 0,void 0,(function*(){const{data:s}=yield this.auth.getSession();return null!==(t=null===(e=s.session)||void 0===e?void 0:e.access_token)&&void 0!==t?t:null}))}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,storageKey:i,flowType:n,debug:o},a,c){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Ot({url:this.authUrl,headers:Object.assign(Object.assign({},h),a),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,flowType:n,debug:o,fetch:c})}_initRealtimeClient(e){return new X(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null===e||void 0===e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange(((e,t)=>{this._handleTokenChanged(e,"CLIENT",null===t||void 0===t?void 0:t.access_token)}))}_handleTokenChanged(e,t,s){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===s?"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.realtime.setAuth(null!==s&&void 0!==s?s:null),this.changedAccessToken=s)}}const Ct="https://api.scoredetect.com";new $t("https://jtiipfmpqosvwdjjbhnc.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imp0aWlwZm1wcW9zdndkampiaG5jIiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODQ5Mjk5ODMsImV4cCI6MjAwMDUwNTk4M30.QZjkBzpsnEctknl3GkX4uH-2HJ0Rh81VI8O840O-Jjs",{auth:{persistSession:!1}});(0,e.registerPlugin)("timestamp-post",{render:()=>{const e=(()=>{const[e,s]=(0,t.useState)(!1),r=(0,t.useRef)(!1),{isSavingPost:n,isAutosavingPost:o}=(0,i.useSelect)((e=>({isSavingPost:e("core/editor").isSavingPost(),isAutosavingPost:e("core/editor").isAutosavingPost()})));return(0,t.useEffect)((()=>{!n&&!o||r.current||(s(!1),r.current=!0),n||o||!r.current||(s(!0),r.current=!1)}),[n,o]),e})(),{editPost:s}=(0,i.useDispatch)("core/editor"),{createNotice:a}=(0,i.useDispatch)("core/notices"),h=(0,i.useSelect)((e=>e("core/editor").getCurrentPostType()),[]),l=(0,i.useSelect)((e=>{const t=e("core").getEntityRecord("root","site");return t?.sdcom_timestamps})),{sdcom_timestamp_post:u=!1,sdcom_previous_certificate_id:d="",...f}=(0,i.useSelect)((e=>e("core/editor").getEditedPostAttribute("meta")||{})),p=(0,i.useSelect)((e=>e("core/editor").getEditedPostContent()),[]),g=(0,i.useSelect)((e=>e("core").getPostType(h)),[h]),v=(0,i.useSelect)((e=>e("core/editor").getCurrentPostId()),[]),m=(0,i.useSelect)((e=>e("core/editor").getPermalink()),[]),y=(0,i.useSelect)((e=>"auto-draft"===e("core/editor").getEditedPostAttribute("status"))),w=`/${g?.rest_namespace}/${g?.rest_base}/${v}`;return(0,t.useEffect)((()=>{if(!y)return;const e="true"===l?.default_timestamps_enabled;e!==u&&s({meta:{...f,sdcom_timestamp_post:e}})}),[l]),(0,t.useEffect)((()=>{(async()=>{if(e&&u)try{if(p.length<0)throw new Error("postContent is empty.");const e={certificateType:"plain_text_upload",displayCreatedBy:!!l?.display_created_by,username:l?.username&&"true"===l?.display_created_by?l?.username:"anonymous"},t=new FormData;t.append("file",p),t.append("username",e.username),t.append("previous_certificate_id",d);const s=await(async({apiKey:e,formData:t})=>{try{const s=`${Ct}/create-certificate`,{userAgent:r}=navigator,i=new Headers({Authorization:`Bearer ${e}`,"User-Agent":r,"X-ScoreDetect-Referer":`${m}`}),n=await fetch(s,{method:"POST",headers:i,body:t});if(!n.ok)throw console.log("Error in postData",{url:s,res:n}),Error(n.statusText);return n.json()}catch(e){throw console.error(e),e}})({apiKey:l.api_key,formData:t}),r=s?.certificate?.id;await(async({apiKey:e,certificateId:t,metadata:s})=>{try{const r=`${Ct}/update-certificate`,i=new Headers({Authorization:`Bearer ${e}`,"Content-Type":"application/json"}),n=await fetch(r,{method:"PATCH",headers:i,body:JSON.stringify({certificateId:t,metadata:s})});if(!n.ok)throw console.log("Error in postData",{url:r,res:n}),Error(n.statusText);return n.json()}catch(e){throw console.error(e),e}})({apiKey:l.api_key,certificateId:r,metadata:e}),c()({path:w,method:"POST",data:{meta:{...f,sdcom_previous_certificate_id:r}}}).catch((e=>{console.error("Error updating post meta:",e)})),a("success",(0,o.__)("Certificate created successfully.","timestamps"),{isDismissible:!0})}catch(e){console.error(e)}})()}),[e]),(0,t.createElement)(n.PluginPostStatusInfo,null,(0,t.createElement)(r.CheckboxControl,{label:(0,o.sprintf)((0,o.__)("Enable timestamps for this %s","timestamps"),h),help:(0,o.__)("Timestamps prove that you keep your content regularly up-to-date.","timestamps"),checked:u,onChange:e=>{s({meta:{...f,sdcom_timestamp_post:e}})}}))},icon:null})}()}();
  • timestamps/trunk/includes/classes/Feature/Timestamp/Screenshot.php

    r3179723 r3244882  
    288288            }
    289289
    290             $url = 'https://api.scoredetect.com/create-certificate';
     290            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/create-certificate';
    291291
    292292            $metadata = array(
     
    384384            }
    385385
    386             $url = 'https://api.scoredetect.com/generate-certificate-id';
     386            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/generate-certificate-id';
    387387
    388388            $client = new Client();
     
    460460            }
    461461
    462             $url = 'https://api.scoredetect.com/update-certificate';
     462            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/update-certificate';
    463463
    464464            $metadata = array(
     
    549549            }
    550550
    551             $url = 'https://api.scoredetect.com/get-certificate/?id=' . $certificate_id;
     551            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/get-certificate/?id=' . $certificate_id;
    552552
    553553            $request = wp_remote_get(
  • timestamps/trunk/includes/classes/Feature/Timestamp/Timestamp.php

    r3214331 r3244882  
    590590            $sdcom_timestamps              = get_option( SDCOM_TIMESTAMPS_OPTIONS );
    591591            $sdcom_previous_certificate_id = get_post_meta( $post_id, 'sdcom_previous_certificate_id', true );
     592            $post_permalink                = get_permalink( $post_id );
     593            $user_agent                    = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : '';
    592594
    593595            // Bail early if the options are empty.
     
    614616            }
    615617
    616             $url = 'https://api.scoredetect.com/create-certificate';
     618            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/create-certificate';
    617619
    618620            $metadata = array(
     
    631633            }
    632634
     635            $headers = [
     636                'Authorization' => 'Bearer ' . $sdcom_timestamps_api_key,
     637            ];
     638
     639            if ( ! empty( $user_agent ) ) {
     640                $headers['User-Agent'] = $user_agent;
     641            }
     642
     643            if ( ! empty( $post_permalink ) ) {
     644                $headers['X-ScoreDetect-Referer'] = $post_permalink;
     645            }
     646
    633647            $request = wp_remote_post(
    634648                $url,
    635649                array(
    636650                    'timeout' => 30,
    637                     'headers' => array(
    638                         'Authorization' => 'Bearer ' . $sdcom_timestamps_api_key,
    639                     ),
     651                    'headers' => $headers,
    640652                    'body'    => $form_data,
    641653                )
     
    717729            }
    718730
    719             $url = 'https://api.scoredetect.com/update-certificate';
     731            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/update-certificate';
    720732
    721733            $metadata = array(
  • timestamps/trunk/includes/classes/Feature/WooCommerce/Orders.php

    r3168100 r3244882  
    341341            }
    342342
    343             $url = 'https://api.scoredetect.com/create-certificate';
     343            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/create-certificate';
    344344
    345345            $metadata = array(
     
    463463            }
    464464
    465             $url = 'https://api.scoredetect.com/update-certificate';
     465            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/update-certificate';
    466466
    467467            $metadata = array(
     
    727727            }
    728728
    729             $url = 'https://api.scoredetect.com/certificates/batch-delete';
     729            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/certificates/batch-delete';
    730730
    731731            $body = wp_json_encode(
  • timestamps/trunk/includes/classes/TimestampHelper.php

    r3168100 r3244882  
    3232     *                               points to a non-existent post returns `null`. Defaults to global $post.
    3333     * @return object|false          The data returned by the API on success, or false on failure.
    34      * @throws \Throwable            If an exception occurs during the process.
    3534     * @throws \Exception            If the options, post content, or API key is empty.
    3635     */
     
    127126            $post_id                       = $post->ID;
    128127            $post_content                  = $post->post_content;
     128            $post_permalink                = get_permalink( $post_id );
     129            $user_agent                    = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : '';
    129130            $sdcom_timestamps              = get_option( SDCOM_TIMESTAMPS_OPTIONS );
    130131            $sdcom_previous_certificate_id = get_post_meta( $post_id, 'sdcom_previous_certificate_id', true );
     
    153154            }
    154155
    155             $url = 'https://api.scoredetect.com/create-certificate';
     156            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/create-certificate';
    156157
    157158            $metadata = array(
     
    170171            }
    171172
     173            $headers = [
     174                'Authorization' => 'Bearer ' . $sdcom_timestamps_api_key,
     175            ];
     176
     177            if ( ! empty( $user_agent ) ) {
     178                $headers['User-Agent'] = $user_agent;
     179            }
     180
     181            if ( ! empty( $post_permalink ) ) {
     182                $headers['X-ScoreDetect-Referer'] = $post_permalink;
     183            }
     184
    172185            $request = wp_remote_post(
    173186                $url,
    174187                array(
    175188                    'timeout' => 30,
    176                     'headers' => array(
    177                         'Authorization' => 'Bearer ' . $sdcom_timestamps_api_key,
    178                     ),
     189                    'headers' => $headers,
    179190                    'body'    => $form_data,
    180191                )
     
    267278            }
    268279
    269             $url = 'https://api.scoredetect.com/update-certificate';
     280            $url = SDCOM_TIMESTAMPS_PUBLIC_API_URL . '/update-certificate';
    270281
    271282            $metadata = array(
  • timestamps/trunk/package.json

    r3214331 r3244882  
    11{
    22  "name": "timestamps-plugin",
    3   "version": "1.11.0",
     3  "version": "1.12.0",
    44  "description": "Timestamp your WordPress content to empower your content authenticity and increase user trust with our blockchain timestamping solution.",
    55  "homepage": "https://www.scoredetect.com/",
  • timestamps/trunk/readme.txt

    r3214331 r3244882  
    11=== Timestamps – SEO-friendly Blockchain Integration for WordPress ===
    22Contributors: scoredetect, xmic
    3 Tags: timestamp, blockchain, content, authenticity, copyright
     3Tags: timestamp, seo, blockchain, content, authenticity
    44Requires at least: 6.0.0
    5 Tested up to: 6.7.1
     5Tested up to: 6.7.2
    66Requires PHP: 7.4
    7 Stable tag: 1.11.0
     7Stable tag: 1.12.0
    88License: AGPL-3.0-only
    99License URI: https://spdx.org/licenses/AGPL-3.0-only.html
  • timestamps/trunk/timestamps.php

    r3214331 r3244882  
    99 *
    1010 * @link              https://www.scoredetect.com/
    11  * @since             1.11.0
     11 * @since             1.12.0
    1212 * @package           SDCOM_Timestamps
    1313 *
     
    1515 * Plugin Name:       Timestamps
    1616 * Description:       Timestamp your WordPress content to empower your content authenticity and increase user trust. No blockchain skills needed.
    17  * Version:           1.11.0
     17 * Version:           1.12.0
    1818 * Author:            ScoreDetect.com
    1919 * Author URI:        https://www.scoredetect.com/
     
    3434
    3535// Useful global constants.
    36 define( 'SDCOM_TIMESTAMPS_VERSION', '1.11.0' );
     36define( 'SDCOM_TIMESTAMPS_VERSION', '1.12.0' );
    3737define( 'SDCOM_TIMESTAMPS_OPTIONS', 'sdcom_timestamps' );
    3838define( 'SDCOM_TIMESTAMPS_URL', plugin_dir_url( __FILE__ ) );
     
    4141define( 'SDCOM_TIMESTAMPS_DIST_URL', SDCOM_TIMESTAMPS_URL . 'dist/' );
    4242define( 'SDCOM_TIMESTAMPS_DIST_PATH', SDCOM_TIMESTAMPS_PATH . 'dist/' );
     43define( 'SDCOM_TIMESTAMPS_PUBLIC_API_URL', 'https://api.scoredetect.com' );
    4344
    4445$is_local_env = in_array( wp_get_environment_type(), array( 'local', 'development' ), true );
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/BodySummarizer.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/BodySummarizerInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Client.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/ClientInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/ClientTrait.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/CookieJar.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Cookie/SetCookie.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/BadResponseException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/ClientException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/ConnectException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/GuzzleException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/RequestException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/ServerException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Exception/TransferException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlFactory.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlHandler.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/EasyHandle.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/MockHandler.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/Proxy.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/HandlerStack.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/MessageFormatter.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/MessageFormatterInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Middleware.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Pool.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/RedirectMiddleware.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/RequestOptions.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/RetryMiddleware.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/TransferStats.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/Utils.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/guzzle/src/functions.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/AggregateException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/CancellationException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/Coroutine.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/Create.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/Each.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/EachPromise.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/FulfilledPromise.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/Is.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/Promise.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/PromiseInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/PromisorInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/RejectedPromise.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/RejectionException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/TaskQueue.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/TaskQueueInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/promises/src/Utils.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/AppendStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/BufferStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/CachingStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/DroppingStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Exception/MalformedUriException.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/FnStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Header.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/HttpFactory.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/InflateStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/LazyOpenStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/LimitStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Message.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/MessageTrait.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/MimeType.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/MultipartStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/NoSeekStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/PumpStream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Query.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Request.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Response.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Rfc7230.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/ServerRequest.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Stream.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/StreamDecoratorTrait.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/StreamWrapper.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/UploadedFile.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Uri.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/UriComparator.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/UriNormalizer.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/UriResolver.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/guzzlehttp/psr7/src/Utils.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-client/src/ClientExceptionInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-client/src/ClientInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-client/src/NetworkExceptionInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-client/src/RequestExceptionInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-factory/src/RequestFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-factory/src/ResponseFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-factory/src/ServerRequestFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-factory/src/StreamFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-factory/src/UploadedFileFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-factory/src/UriFactoryInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-message/src/MessageInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-message/src/RequestInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-message/src/ResponseInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-message/src/ServerRequestInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-message/src/StreamInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-message/src/UploadedFileInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
  • timestamps/trunk/vendor-prefixed/psr/http-message/src/UriInterface.php

    r3179723 r3244882  
    33 * @license MIT
    44 *
    5  * Modified by ScoreDetect on 31-October-2024 using Strauss.
     5 * Modified by ScoreDetect on 22-February-2025 using Strauss.
    66 * @see https://github.com/BrianHenryIE/strauss
    77 */
Note: See TracChangeset for help on using the changeset viewer.