1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6457],{3913:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let s=i(r(93537)),n=i(r(5732));class a{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=s.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Object.assign({},this.headers),this.headers[e]=t,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 r=(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,r,i;let s=null,a=null,o=null,l=e.status,u=e.statusText;if(e.ok){if("HEAD"!==this.method){let t=await e.text();""===t||(a="text/csv"===this.headers.Accept||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}let i=null==(t=this.headers.Prefer)?void 0:t.match(/count=(exact|planned|estimated)/),n=null==(r=e.headers.get("content-range"))?void 0:r.split("/");i&&n&&n.length>1&&(o=parseInt(n[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(a)&&(a.length>1?(s={code:"PGRST116",details:`Results contain ${a.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},a=null,o=null,l=406,u="Not Acceptable"):a=1===a.length?a[0]:null)}else{let t=await e.text();try{s=JSON.parse(t),Array.isArray(s)&&404===e.status&&(a=[],s=null,l=200,u="OK")}catch(r){404===e.status&&""===t?(l=204,u="No Content"):s={message:t}}if(s&&this.isMaybeSingle&&(null==(i=null==s?void 0:s.details)?void 0:i.includes("0 rows"))&&(s=null,l=200,u="OK"),s&&this.shouldThrowOnError)throw new n.default(s)}return{error:s,data:a,count:o,status:l,statusText:u}});return this.shouldThrowOnError||(r=r.catch(e=>{var t,r,i;return{error:{message:`${null!=(t=null==e?void 0:e.name)?t:"FetchError"}: ${null==e?void 0:e.message}`,details:`${null!=(r=null==e?void 0:e.stack)?r:""}`,hint:"",code:`${null!=(i=null==e?void 0:e.code)?i:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}returns(){return this}overrideTypes(){return this}}t.default=a},5426:(e,t,r)=>{"use strict";function i(e,t,r){function i(r,i){var s;for(let n in Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(s=r._zod).traits??(s.traits=new Set),r._zod.traits.add(e),t(r,i),a.prototype)n in r||Object.defineProperty(r,n,{value:a.prototype[n].bind(r)});r._zod.constr=a,r._zod.def=i}let s=r?.Parent??Object;class n extends s{}function a(e){var t;let s=r?.Parent?new n:this;for(let r of(i(s,e),(t=s._zod).deferred??(t.deferred=[]),s._zod.deferred))r();return s}return Object.defineProperty(n,"name",{value:e}),Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}r.d(t,{$W:()=>a,GT:()=>s,cr:()=>n,xI:()=>i}),Object.freeze({status:"aborted"}),Symbol("zod_brand");class s extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}let n={};function a(e){return e&&Object.assign(n,e),n}},5732:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
1de=e.code}}t.default=r},10489:(e,t,r)=>{"use strict";r.d(t,{b:()=>o});var i=r(12115),s=r(97602),n=r(95155),a=i.forwardRef((e,t)=>(0,n.jsx)(s.sG.label,{...e,ref:t,onMouseDown:t=>{var r;t.target.closest("button, input, select, textarea")||(null==(r=e.onMouseDown)||r.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));a.displayName="Label";var o=a},15376:e=>{!function(){var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],i=t[1];return(r+i)*3/4-i},t.toByteArray=function(e){var t,r,n=l(e),a=n[0],o=n[1],u=new s((a+o)*3/4-o),c=0,h=o>0?a-4:a;for(r=0;r<h;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===o&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===o&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,i=e.length,s=i%3,n=[],a=0,o=i-s;a<o;a+=16383)n.push(function(e,t,i){for(var s,n=[],a=t;a<i;a+=3)s=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),n.push(r[s>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return n.join("")}(e,a,a+16383>o?o:a+16383));return 1===s?n.push(r[(t=e[i-1])>>2]+r[t<<4&63]+"=="):2===s&&n.push(r[(t=(e[i-2]<<8)+e[i-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),n.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=n.length;a<o;++a)r[a]=n[a],i[n.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var i=r===t?0:4-r%4;return[r,i]}i[45]=62,i[95]=63},72:function(e,t,r){"use strict";var i=r(675),s=r(783),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var i=e,s=t;if(("string"!=typeof s||""===s)&&(s="utf8"),!o.isEncoding(s))throw TypeError("Unknown encoding: "+s);var n=0|f(i,s),l=a(n),u=l.write(i,s);return u!==n&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return h(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(O(e,SharedArrayBuffer)||e&&O(e.buffer,SharedArrayBuffer)))return function(e,t,r){var i;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),o.prototype),i}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return o.from(c,t,r);var p=function(e){if(o.isBuffer(e)){var t=0|d(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(p)return p;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|d(e))}function h(e){for(var t=e.length<0?0:0|d(e.length),r=a(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)}
vendor: 16,190 bytes, line 1
1,t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)};function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return A(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return T(e).length;default:if(s)return i?-1:A(e).length;t=(""+t).toLowerCase(),s=!0}}function p(e,t,r){var s,n,a,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var s="",n=t;n<r;++n)s+=$[e[n]];return s}(this,t,r);case"utf8":case"utf-8":return v(this,t,r);case"ascii":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var s=t;s<r;++s)i+=String.fromCharCode(127&e[s]);return i}(this,t,r);case"latin1":case"binary":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var s=t;s<r;++s)i+=String.fromCharCode(e[s]);return i}(this,t,r);case"base64":return s=this,n=t,a=r,0===n&&a===s.length?i.fromByteArray(s):i.fromByteArray(s.slice(n,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var i=e.slice(t,r),s="",n=0;n<i.length;n+=2)s+=String.fromCharCode(i[n]+256*i[n+1]);return s}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function g(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function y(e,t,r,i,s){var n;if(0===e.length)return -1;if("string"==typeof r?(i=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(n=r*=1)!=n&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(s)return -1;else r=e.length-1;else if(r<0)if(!s)return -1;else r=0;if("string"==typeof t&&(t=o.from(t,i)),o.isBuffer(t))return 0===t.length?-1:m(e,t,r,i,s);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(s)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return m(e,[t],r,i,s)}throw TypeError("val must be string, number or Buffer")}function m(e,t,r,i,s){var n,a=1,o=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;a=2,o/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(s){var c=-1;for(n=r;n<o;n++)if(u(e,n)===u(t,-1===c?0:n-c)){if(-1===c&&(c=n),n-c+1===l)return c*a}else -1!==c&&(n-=n-c),c=-1}else for(r+l>o&&(r=o-l),n=r;n>=0;n--){for(var h=!0,d=0;d<l;d++)if(u(e,n+d)!==u(t,d)){h=!1;break}if(h)return n}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(O(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),O(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,i=t.length,s=0,n=Math.min(r,i);s<n;++s)if(e[s]!==t[s]){r=e[s],i=t[s];break}return r<i?-1:+(i<r)},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,i=o.allocUnsafe(t),s=0;for(r=0;r<e.length;++r){var n=e[r];if(O(n,Uint8Array)&&(n=o.from(n)),!o.isBuffer(n))throw TypeError('"list" argument must be an Array of Buffers');n.copy(i,s),s+=n.length}return i},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?v(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(e,t,r,i,s){if(O(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===s&&(s=this.length),t<0||r>e.length||i<0||s>this.length)throw RangeError("out of range index");if(i>=s&&t>=r)return 0;if(i>=s)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var n=s-i,a=r-t,l=Math.min(n,a),u=this.slice(i,s),c=e.slice(t,r),h=0;h<l;++h)if(u[h]!==c[h]){n=u[h],a=c[h];break}return n<a?-1:+(a<n)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)};function v(e,t,r){r=Math.min(e.length,r);for(var i=[],s=t;s<r;){var n,a,o,l,u=e[s],c=null,h=u>239?4:u>223?3:u>191?2:1;if(s+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:(192&(n=e[s+1]))==128&&(l=(31&u)<<6|63&n)>127&&(c=l);break;case 3:n=e[s+1],a=e[s+2],(192&n)==128&&(192&a)==128&&(l=(15&u)<<12|(63&n)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:n=e[s+1],a=e[s+2],o=e[s+3],(192&n)==128&&(192&a)==128&&(192&o)==128&&(l=(15&u)<<18|(63&n)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),s+=h}var d=i,f=d.length;if(f<=4096)return String.fromCharCode.apply(String,d);for(var p="",g=0;g<f;)p+=String.fromCharCode.apply(String,d.slice(g,g+=4096));return p}function b(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function _(e,t,r,i,s,n){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<n)throw RangeError('"value" argument is out of bounds');if(r+i>e.length)throw RangeError("Index out of range")}function w(e,t,r,i,s,n){if(r+i>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,i,n){return t*=1,r>>>=0,n||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),s.write(e,t,r,i,23,4),r+4}function S(e,t,r,i,n){return t*=1,r>>>=0,n||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),s.write(e,t,r,i,52,8),r+8}o.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s,n,a,o,l,u,c,h,d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var f=!1;;)switch(i){case"hex":return function(e,t,r,i){r=Number(r)||0;var s=e.length-r;i?(i=Number(i))>s&&(i=s):i=s;var n=t.length;i>n/2&&(i=n/2);for(var a=0;a<i;++a){var o,l=parseInt(t.substr(2*a,2),16);if((o=l)!=o)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return s=t,n=r,j(A(e,this.length-s),this,s,n);case"ascii":return a=t,o=r,j(x(e),this,a,o);case"latin1":case"binary":return function(e,t,r,i){return j(x(t),e,r,i)}(this,e,t,r);case"base64":return l=t,u=r,j(T(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,h=r,j(function(e,t){for(var r,i,s=[],n=0;n<e.length&&!((t-=2)<0);++n)i=(r=e.charCodeAt(n))>>8,s.push(r%256),s.push(i);return s}(e,this.length-c),this,c,h);default:if(f)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),f=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var i=this.subarray(e,t);return Object.setPrototypeOf(i,o.prototype),i},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var i=this[e],s=1,n=0;++n<t&&(s*=256);)i+=this[e+n]*s;return i},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var i=this[e+--t],s=1;t>0&&(s*=256);)i+=this[e+--t]*s;return i},o.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var i=this[e],s=1,n=0;++n<t&&(s*=256);)i+=this[e+n]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*t)),i},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var i=t,s=1,n=this[e+--i];i>0&&(s*=256);)n+=this[e+--i]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),s.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),s.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),s.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),s.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,i){if(e*=1,t>>>=0,r>>>=0,!i){var s=Math.pow(2,8*r)-1;_(this,e,t,r,s,0)}var n=1,a=0;for(this[t]=255&e;++a<r&&(n*=256);)this[t+a]=e/n&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,i){if(e*=1,t>>>=0,r>>>=0,!i){var s=Math.pow(2,8*r)-1;_(this,e,t,r,s,0)}var n=r-1,a=1;for(this[t+n]=255&e;--n>=0&&(a*=256);)this[t+n]=e/a&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,i){if(e*=1,t>>>=0,!i){var s=Math.pow(2,8*r-1);_(this,e,t,r,s-1,-s)}var n=0,a=1,o=0;for(this[t]=255&e;++n<r&&(a*=256);)e<0&&0===o&&0!==this[t+n-1]&&(o=1),this[t+n]=(e/a|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,i){if(e*=1,t>>>=0,!i){var s=Math.pow(2,8*r-1);_(this,e,t,r,s-1,-s)}var n=r-1,a=1,o=0;for(this[t+n]=255&e;--n>=0&&(a*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/a|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||_(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,i){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var s=i-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,i);else if(this===e&&r<t&&t<i)for(var n=s-1;n>=0;--n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return s},o.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!o.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===e.length){var s,n=e.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(e=n)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;
1else{var a=o.isBuffer(e)?e:o.from(e,i),l=a.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=a[s%l]}return this};var E=/[^+/0-9A-Za-z-_]/g;function A(e,t){t=t||1/0;for(var r,i=e.length,s=null,n=[],a=0;a<i;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!s){if(r>56319||a+1===i){(t-=3)>-1&&n.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&n.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&(t-=3)>-1&&n.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;n.push(r)}else if(r<2048){if((t-=2)<0)break;n.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;n.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;n.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return n}function x(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function T(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(E,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,i){for(var s=0;s<i&&!(s+r>=t.length)&&!(s>=e.length);++s)t[s+r]=e[s];return s}function O(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var $=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var i=16*r,s=0;s<16;++s)t[i+s]=e[r]+e[s];return t}()},783:function(e,t){t.read=function(e,t,r,i,s){var n,a,o=8*s-i-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?s-1:0,d=r?-1:1,f=e[t+h];for(h+=d,n=f&(1<<-c)-1,f>>=-c,c+=o;c>0;n=256*n+e[t+h],h+=d,c-=8);for(a=n&(1<<-c)-1,n>>=-c,c+=i;c>0;a=256*a+e[t+h],h+=d,c-=8);if(0===n)n=1-u;else{if(n===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),n-=u}return(f?-1:1)*a*Math.pow(2,n-i)},t.write=function(e,t,r,i,s,n){var a,o,l,u=8*n-s-1,c=(1<<u)-1,h=c>>1,d=5960464477539062e-23*(23===s),f=i?0:n-1,p=i?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?t+=d/l:t+=d*Math.pow(2,1-h),t*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(t*l-1)*Math.pow(2,s),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,s),a=0));s>=8;e[r+f]=255&o,f+=p,o/=256,s-=8);for(a=a<<s|o,u+=s;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*g}}},r={};function i(e){var s=r[e];if(void 0!==s)return s.exports;var n=r[e]={exports:{}},a=!0;try{t[e](n,n.exports,i),a=!1}finally{a&&delete r[e]}return n.exports}i.ab="//",e.exports=i(72)}()},22544:(e,t,r)=>{"use strict";r.d(t,{Gb:()=>O,Jt:()=>g,Op:()=>k,hZ:()=>y,mN:()=>ea,xI:()=>j,xW:()=>w});var i=r(12115),s=e=>e instanceof Date,n=e=>null==e,a=e=>!n(e)&&!Array.isArray(e)&&"object"==typeof e&&!s(e),o=e=>a(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,l=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),u="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function c(e){let t,r=Array.isArray(e),i="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(!(!(u&&(e instanceof Blob||i))&&(r||a(e))))return e;else if(t=r?[]:Object.create(Object.getPrototypeOf(e)),r||(e=>{let t=e.constructor&&e.constructor.prototype;return a(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(let r in e)e.hasOwnProperty(r)&&(t[r]=c(e[r]));else t=e;return t}var h=e=>/^\w*$/.test(e),d=e=>void 0===e,f=e=>Array.isArray(e)?e.filter(Boolean):[],p=e=>f(e.replace(/["|']|\]/g,"").split(/\.|\[/)),g=(e,t,r)=>{if(!t||!a(e))return r;let i=(h(t)?[t]:p(t)).reduce((e,t)=>n(e)?e:e[t],e);return d(i)||i===e?d(e[t])?r:e[t]:i},y=(e,t,r)=>{let i=-1,s=h(t)?[t]:p(t),n=s.length,o=n-1;for(;++i<n;){let t=s[i],n=r;if(i!==o){let r=e[t];n=a(r)||Array.isArray(r)?r:isNaN(+s[i+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=n,e=e[t]}};let m={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},v={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},b={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},_=i.createContext(null);_.displayName="HookFormContext";let w=()=>i.useContext(_),k=e=>{let{children:t,...r}=e;return i.createElement(_.Provider,{value:r},t)};var S=(e,t,r,i=!0)=>{let s={defaultValues:t._defaultValues};for(let n in e)Object.defineProperty(s,n,{get:()=>(t._proxyFormState[n]!==v.all&&(t._proxyFormState[n]=!i||v.all),r&&(r[n]=!0),e[n])});return s};let E="undefined"!=typeof window?i.useLayoutEffect:i.useEffect;var A=(e,t,r,i,s)=>"string"==typeof e?(i&&t.watch.add(e),g(r,e,s)):Array.isArray(e)?e.map(e=>(i&&t.watch.add(e),g(r,e))):(i&&(t.watchAll=!0),r),x=e=>n(e)||"object"!=typeof e;function T(e,t,r=new WeakSet){if(x(e)||x(t))return e===t;if(s(e)&&s(t))return e.getTime()===t.getTime();let i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;if(r.has(e)||r.has(t))return!0;for(let o of(r.add(e),r.add(t),i)){let i=e[o];if(!n.includes(o))return!1;if("ref"!==o){let e=t[o];if(s(i)&&s(e)||a(i)&&a(e)||Array.isArray(i)&&Array.isArray(e)?!T(i,e,r):i!==e)return!1}}return!0}let j=e=>e.render(function(e){let t=w(),{name:r,disabled:s,control:n=t.control,shouldUnregister:a,defaultValue:u}=e,h=l(n._names.array,r),f=i.useMemo(()=>g(n._formValues,r,g(n._defaultValues,r,u)),[n,r,u]),p=function(e){let t=w(),{control:r=t.control,name:s,defaultValue:n,disabled:a,exact:o,c
1ompute:l}=e||{},u=i.useRef(n),c=i.useRef(l),h=i.useRef(void 0);c.current=l;let d=i.useMemo(()=>r._getWatch(s,u.current),[r,s]),[f,p]=i.useState(c.current?c.current(d):d);return E(()=>r._subscribe({name:s,formState:{values:!0},exact:o,callback:e=>{if(!a){let t=A(s,r._names,e.values||r._formValues,!1,u.current);if(c.current){let e=c.current(t);T(e,h.current)||(p(e),h.current=e)}else p(t)}}}),[r,a,s,o]),i.useEffect(()=>r._removeUnmounted()),f}({control:n,name:r,defaultValue:f,exact:!0}),v=function(e){let t=w(),{control:r=t.control,disabled:s,name:n,exact:a}=e||{},[o,l]=i.useState(r._formState),u=i.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return E(()=>r._subscribe({name:n,formState:u.current,exact:a,callback:e=>{s||l({...r._formState,...e})}}),[n,s,a]),i.useEffect(()=>{u.current.isValid&&r._setValid(!0)},[r]),i.useMemo(()=>S(o,r,u.current,!1),[o,r])}({control:n,name:r,exact:!0}),b=i.useRef(e),_=i.useRef(n.register(r,{...e.rules,value:p,..."boolean"==typeof e.disabled?{disabled:e.disabled}:{}}));b.current=e;let k=i.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!g(v.errors,r)},isDirty:{enumerable:!0,get:()=>!!g(v.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!g(v.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!g(v.validatingFields,r)},error:{enumerable:!0,get:()=>g(v.errors,r)}}),[v,r]),x=i.useCallback(e=>_.current.onChange({target:{value:o(e),name:r},type:m.CHANGE}),[r]),j=i.useCallback(()=>_.current.onBlur({target:{value:g(n._formValues,r),name:r},type:m.BLUR}),[r,n._formValues]),O=i.useCallback(e=>{let t=g(n._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[n._fields,r]),$=i.useMemo(()=>({name:r,value:p,..."boolean"==typeof s||v.disabled?{disabled:v.disabled||s}:{},onChange:x,onBlur:j,ref:O}),[r,s,v.disabled,x,j,O,p]);return i.useEffect(()=>{let e=n._options.shouldUnregister||a;n.register(r,{...b.current.rules,..."boolean"==typeof b.current.disabled?{disabled:b.current.disabled}:{}});let t=(e,t)=>{let r=g(n._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){let e=c(g(n._options.defaultValues,r));y(n._defaultValues,r,e),d(g(n._formValues,r))&&y(n._formValues,r,e)}return h||n.register(r),()=>{(h?e&&!n._state.action:e)?n.unregister(r):t(r,!1)}},[r,n,h,a]),i.useEffect(()=>{n._setDisabledField({disabled:s,name:r})},[s,r,n]),i.useMemo(()=>({field:$,formState:v,fieldState:k}),[$,v,k])}(e));var O=(e,t,r,i,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:s||!0}}:{},$=e=>Array.isArray(e)?e:[e],I=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},P=e=>a(e)&&!Object.keys(e).length,C=e=>"function"==typeof e,R=e=>{if(!u)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},z=e=>R(e)&&e.isConnected;function U(e,t){let r=Array.isArray(t)?t:h(t)?[t]:p(t),i=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,i=0;for(;i<r;)e=d(e)?i++:e[t[i++]];return e}(e,r),s=r.length-1,n=r[s];return i&&delete i[n],0!==s&&(a(i)&&P(i)||Array.isArray(i)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!d(e[t]))return!1;return!0}(i))&&U(e,r.slice(0,-1)),e}var L=e=>{for(let t in e)if(C(e[t]))return!0;return!1};function N(e,t={}){let r=Array.isArray(e);if(a(e)||r)for(let r in e)Array.isArray(e[r])||a(e[r])&&!L(e[r])?(t[r]=Array.isArray(e[r])?[]:{},N(e[r],t[r])):n(e[r])||(t[r]=!0);return t}var D=(e,t)=>(function e(t,r,i){let s=Array.isArray(t);if(a(t)||s)for(let s in t)Array.isArray(t[s])||a(t[s])&&!L(t[s])?d(r)||x(i[s])?i[s]=Array.isArray(t[s])?N(t[s],[]):{...N(t[s])}:e(t[s],n(r)?{}:r[s],i[s]):i[s]=!T(t[s],r[s]);return i})(e,t,N(t));let B={value:!1,isValid:!1},F={value:!0,isValid:!0};var V=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!d(e[0].attributes.value)?d(e[0].value)||""===e[0].value?F:{value:e[0].value,isValid:!0}:F:B}return B},M=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:i})=>d(e)?e:t?""===e?NaN:e?+e:e:r&&"string"==typeof e?new Date(e):i?i(e):e;let Z={isValid:!1,value:null};var q=e=>Array.isArray(e)?e.reduce((e,t)=>
1t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,Z):Z;function W(e){let t=e.ref;return"file"===t.type?t.files:"radio"===t.type?q(e.refs).value:"select-multiple"===t.type?[...t.selectedOptions].map(({value:e})=>e):"checkbox"===t.type?V(e.refs).value:M(d(t.value)?e.ref.value:t.value,e)}var J=e=>d(e)?e:e instanceof RegExp?e.source:a(e)?e.value instanceof RegExp?e.value.source:e.value:e,K=e=>({isOnSubmit:!e||e===v.onSubmit,isOnBlur:e===v.onBlur,isOnChange:e===v.onChange,isOnAll:e===v.all,isOnTouch:e===v.onTouched});let H="AsyncFunction";var G=e=>!!e&&!!e.validate&&!!(C(e.validate)&&e.validate.constructor.name===H||a(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===H)),Q=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let Y=(e,t,r,i)=>{for(let s of r||Object.keys(e)){let r=g(e,s);if(r){let{_f:e,...n}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],s)&&!i)return!0;else if(e.ref&&t(e.ref,e.name)&&!i)return!0;else if(Y(n,t))break}else if(a(n)&&Y(n,t))break}}};function X(e,t,r){let i=g(e,r);if(i||h(r))return{error:i,name:r};let s=r.split(".");for(;s.length;){let i=s.join("."),n=g(t,i),a=g(e,i);if(n&&!Array.isArray(n)&&r!==i)break;if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};s.pop()}return{name:r}}var ee=(e,t,r)=>{let i=$(g(e,r));return y(i,"root",t[r]),y(e,r,i),e},et=e=>"string"==typeof e;function er(e,t,r="validate"){if(et(e)||Array.isArray(e)&&e.every(et)||"boolean"==typeof e&&!e)return{type:r,message:et(e)?e:"",ref:t}}var ei=e=>!a(e)||e instanceof RegExp?{value:e,message:""}:e,es=async(e,t,r,i,s,o)=>{let{ref:l,refs:u,required:c,maxLength:h,minLength:f,min:p,max:y,pattern:m,validate:v,name:_,valueAsNumber:w,mount:k}=e._f,S=g(r,_);if(!k||t.has(_))return{};let E=u?u[0]:l,A=e=>{s&&E.reportValidity&&(E.setCustomValidity("boolean"==typeof e?"":e||""),E.reportValidity())},x={},T="radio"===l.type,j="checkbox"===l.type,$=(w||"file"===l.type)&&d(l.value)&&d(S)||R(l)&&""===l.value||""===S||Array.isArray(S)&&!S.length,I=O.bind(null,_,i,x),z=(e,t,r,i=b.maxLength,s=b.minLength)=>{let n=e?t:r;x[_]={type:e?i:s,message:n,ref:l,...I(e?i:s,n)}};if(o?!Array.isArray(S)||!S.length:c&&(!(T||j)&&($||n(S))||"boolean"==typeof S&&!S||j&&!V(u).isValid||T&&!q(u).isValid)){let{value:e,message:t}=et(c)?{value:!!c,message:c}:ei(c);if(e&&(x[_]={type:b.required,message:t,ref:E,...I(b.required,t)},!i))return A(t),x}if(!$&&(!n(p)||!n(y))){let e,t,r=ei(y),s=ei(p);if(n(S)||isNaN(S)){let i=l.valueAsDate||new Date(S),n=e=>new Date(new Date().toDateString()+" "+e),a="time"==l.type,o="week"==l.type;"string"==typeof r.value&&S&&(e=a?n(S)>n(r.value):o?S>r.value:i>new Date(r.value)),"string"==typeof s.value&&S&&(t=a?n(S)<n(s.value):o?S<s.value:i<new Date(s.value))}else{let i=l.valueAsNumber||(S?+S:S);n(r.value)||(e=i>r.value),n(s.value)||(t=i<s.value)}if((e||t)&&(z(!!e,r.message,s.message,b.max,b.min),!i))return A(x[_].message),x}if((h||f)&&!$&&("string"==typeof S||o&&Array.isArray(S))){let e=ei(h),t=ei(f),r=!n(e.value)&&S.length>+e.value,s=!n(t.value)&&S.length<+t.value;if((r||s)&&(z(r,e.message,t.message),!i))return A(x[_].message),x}if(m&&!$&&"string"==typeof S){let{value:e,message:t}=ei(m);if(e instanceof RegExp&&!S.match(e)&&(x[_]={type:b.pattern,message:t,ref:l,...I(b.pattern,t)},!i))return A(t),x}if(v){if(C(v)){let e=er(await v(S,r),E);if(e&&(x[_]={...e,...I(b.validate,e.message)},!i))return A(e.message),x}else if(a(v)){let e={};for(let t in v){if(!P(e)&&!i)break;let s=er(await v[t](S,r),E,t);s&&(e={...s,...I(t,s.message)},A(s.message),i&&(x[_]=e))}if(!P(e)&&(x[_]={ref:E,...e},!i))return x}}return A(!0),x};let en={mode:v.onSubmit,reValidateMode:v.onChange,shouldFocusError:!0};function ea(e={}){let t=i.useRef(void 0),r=i.useRef(void 0),[h,p]=i.useState({isDirty:!1,isValidating:!1,isLoading:C(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:C(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:h},e.defaultValues&&!C(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:r,...i}=function(e={}){let t,r={...en,...e},i={submitCount:0,isDirty:!1,isReady:!1,isLoading:C(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},h={},p=(a(r.defaultValues)||a(r.values))&&c(r.defaultValues||r.values)||{},b=r.shouldUnregister?{}:c(p),_={action:!1,mount:!1,watch:!1},w={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},k=0,S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},E={...S},x={array:I(),state:I()},j=r.criteriaMode===v.all,O=async e=>{if(!r.disabled&&(S.isValid||E.isValid||e)){let e=r.resolver?P((await F()).errors):await Z(h,!0);e!==i.isValid&&x.state.next({isValid:e})}},L=(e,t)=>{!r.disabled&&(S.isValidating||S.validatingFields||E.isValidating||E.validatingFields)&&((e||Array.from(w.mount)).forEac
1h(e=>{e&&(t?y(i.validatingFields,e,t):U(i.validatingFields,e))}),x.state.next({validatingFields:i.validatingFields,isValidating:!P(i.validatingFields)}))},N=(e,t,r,i)=>{let s=g(h,e);if(s){let n=g(b,e,d(r)?g(p,e):r);d(n)||i&&i.defaultChecked||t?y(b,e,t?n:W(s._f)):et(e,n),_.mount&&O()}},B=(e,t,s,n,a)=>{let o=!1,l=!1,u={name:e};if(!r.disabled){if(!s||n){(S.isDirty||E.isDirty)&&(l=i.isDirty,i.isDirty=u.isDirty=q(),o=l!==u.isDirty);let r=T(g(p,e),t);l=!!g(i.dirtyFields,e),r?U(i.dirtyFields,e):y(i.dirtyFields,e,!0),u.dirtyFields=i.dirtyFields,o=o||(S.dirtyFields||E.dirtyFields)&&!r!==l}if(s){let t=g(i.touchedFields,e);t||(y(i.touchedFields,e,s),u.touchedFields=i.touchedFields,o=o||(S.touchedFields||E.touchedFields)&&t!==s)}o&&a&&x.state.next(u)}return o?u:{}},F=async e=>{L(e,!0);let t=await r.resolver(b,r.context,((e,t,r,i)=>{let s={};for(let r of e){let e=g(t,r);e&&y(s,r,e._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:i}})(e||w.mount,h,r.criteriaMode,r.shouldUseNativeValidation));return L(e),t},V=async e=>{let{errors:t}=await F(e);if(e)for(let r of e){let e=g(t,r);e?y(i.errors,r,e):U(i.errors,r)}else i.errors=t;return t},Z=async(e,t,s={valid:!0})=>{for(let n in e){let a=e[n];if(a){let{_f:e,...o}=a;if(e){let o=w.array.has(e.name),l=a._f&&G(a._f);l&&S.validatingFields&&L([n],!0);let u=await es(a,w.disabled,b,j,r.shouldUseNativeValidation&&!t,o);if(l&&S.validatingFields&&L([n]),u[e.name]&&(s.valid=!1,t))break;t||(g(u,e.name)?o?ee(i.errors,u,e.name):y(i.errors,e.name,u[e.name]):U(i.errors,e.name))}P(o)||await Z(o,t,s)}}return s.valid},q=(e,t)=>!r.disabled&&(e&&t&&y(b,e,t),!T(eu(),p)),H=(e,t,r)=>A(e,w,{..._.mount?b:d(t)?p:"string"==typeof e?{[e]:t}:t},r,t),et=(e,t,r={})=>{let i=g(h,e),s=t;if(i){let r=i._f;r&&(r.disabled||y(b,e,M(t,r)),s=R(r.ref)&&n(t)?"":t,"select-multiple"===r.ref.type?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?"checkbox"===r.ref.type?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):"file"===r.ref.type?r.ref.value="":(r.ref.value=s,r.ref.type||x.state.next({name:e,values:c(b)})))}(r.shouldDirty||r.shouldTouch)&&B(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&el(e)},er=(e,t,r)=>{for(let i in t){if(!t.hasOwnProperty(i))return;let n=t[i],o=e+"."+i,l=g(h,o);(w.array.has(e)||a(n)||l&&!l._f)&&!s(n)?er(o,n,r):et(o,n,r)}},ei=(e,t,r={})=>{let s=g(h,e),a=w.array.has(e),o=c(t);y(b,e,o),a?(x.array.next({name:e,values:c(b)}),(S.isDirty||S.dirtyFields||E.isDirty||E.dirtyFields)&&r.shouldDirty&&x.state.next({name:e,dirtyFields:D(p,b),isDirty:q(e,o)})):!s||s._f||n(o)?et(e,o,r):er(e,o,r),Q(e,w)&&x.state.next({...i,name:e}),x.state.next({name:_.mount?e:void 0,values:c(b)})},ea=async e=>{_.mount=!0;let n=e.target,a=n.name,l=!0,u=g(h,a),d=e=>{l=Number.isNaN(e)||s(e)&&isNaN(e.getTime())||T(e,g(b,a,e))},f=K(r.mode),p=K(r.reValidateMode);if(u){let s,_,D,V=n.type?W(u._f):o(e),M=e.type===m.BLUR||e.type===m.FOCUS_OUT,q=!((D=u._f).mount&&(D.required||D.min||D.max||D.maxLength||D.minLength||D.pattern||D.validate))&&!r.resolver&&!g(i.errors,a)&&!u._f.deps||(v=M,A=g(i.touchedFields,a),$=i.isSubmitted,I=p,!(C=f).isOnAll&&(!$&&C.isOnTouch?!(A||v):($?I.isOnBlur:C.isOnBlur)?!v:($?!I.isOnChange:!C.isOnChange)||v)),J=Q(a,w,M);y(b,a,V),M?n&&n.readOnly||(u._f.onBlur&&u._f.onBlur(e),t&&t(0)):u._f.onChange&&u._f.onChange(e);let K=B(a,V,M),H=!P(K)||J;if(M||x.state.next({name:a,type:e.type,values:c(b)}),q)return(S.isValid||E.isValid)&&("onBlur"===r.mode?M&&O():M||O()),H&&x.state.next({name:a,...J?{}:K});if(!M&&J&&x.state.next({...i}),r.resolver){let{errors:e}=await F([a]);if(d(V),l){let t=X(i.errors,h,a),r=X(e,h,t.name||a);s=r.error,a=r.name,_=P(e)}}else L([a],!0),s=(await es(u,w.disabled,b,j,r.shouldUseNativeValidation))[a],L([a]),d(V),l&&(s?_=!1:(S.isValid||E.isValid)&&(_=await Z(h,!0)));if(l){u._f.deps&&el(u._f.deps);var v,A,$,I,C,R=a,z=_,N=s;let e=g(i.errors,R),n=(S.isValid||E.isValid)&&"boolean"==typeof z&&i.isValid!==z;if(r.delayError&&N){let e;e=()=>{y(i.errors,R,N),x.state.next({errors:i.errors})},(t=t=>{clearTimeout(k),k=setTimeout(e,t)})(r.delayError)}else clearTimeout(k),t=null,N?y(i.errors,R,N):U(i.errors,R);if((N?!T(e,N):e)||!P(K)||n){let e={...K,...n&&"boolean"==typeof z?{isValid:z}:{},errors:i.errors,name:R};i={...i,...e},x.state.next(e)}}}},eo=(e,t)=>{if(g(i.errors,t)&&e.focus)return e.focus(),1},el=async(e,t={})=>{let s,n,a=$(e);if(r.resolver){let t=await V(d(e)?e:a);s=P(t),n=e?!a.some(e=>g(t,e)):s}else e?((n=(await Promise.all(a.map(async e=>{let t=g(h,e);return await Z(t&&t._f?{[e]:t}:t)}))).every(Boolean))||i.isValid)&&O():n=s=await Z(h);return x.state.next({..."string"!=typeof e||(S.isValid||E.isValid)&&s!==i.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:i.errors}),t.shouldFocus&&!n&&Y(h,eo,e?a:w.mount),n},eu=e=>{let t={..._.mount?b:p};return d(e)?t:"string"==typeof e?g(t,e):e.map(e=>g(t,e))},ec=(e,t)=>({invalid:!!g((t||i).errors,e),isDirty:!!g((t||i).dirtyFields,e),error:g((t||i).errors,e),isValidating:!!g(i.validatingFields,e),isTouched:!!g((t||i).touchedFields,e)}),eh=(e,t,r)=>{let s=(g(h,e,{_f:{}})._f||{}).ref,{ref:n,message:a,type:o,...l}=g(i.errors,e)||{};y(i.errors,e,{...l,...t,ref:s}),x.state.next({name:e,errors:i.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},ed=e=>x.state.subscribe({next:t=>{let r,s,n;r=e.name,s=t.name,n=e.exact,(!r||!s||r===s||$(r).some(e=>e&&(n?e===s:e.startsWith(s)||s.startsWith(e))))&&((e,t,r,i)=>{r(e);let{name:s,...n}=e;return P(n)||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find(e=>t[e]===(!i||v.all))})(t,e.formState||S,e_,e.reRenderRoot)&&e.callback({values:{...b},...i,...t,defaultValues:p})}}).unsubscribe,ef=(e,t={})=>{for(let s of e?$(e):w.mount)w.mount.delete(s),w.array.delete(s),t.keepValue||(U(h,s),U(b,s)),t.keepError||U(i.errors,s),t.keepDirty||U(i.dirtyFields,s),t.keepTouched||U(i.touchedFields,s),t.keepIsValidating||U(i.validatingFields,s),r.shouldUnregister||t.keepDefaultValue||U(p,s);x.state.next({values:c(b)}),x.state.next({...i,...!t.keepDirty?{}:{isDirty:q()}}),t.keepIsValid||O()},ep=({disabled:e,name:t})=>{("boolean"==typeof e&&_.mount||e||w.disabled.has(t))&&(e?w.disabled.add(t):w.disabled.delete(t))},eg=(e,t={})=>{let i=g(h,e),s="boolean"==typeof t.disabled||"boolean"==typeof r.disabled;return(y(h,e,{...i||{},_f:{...i&&i._f?i._f:{ref:{name:e}},name:e,mount:!0,...t}}),w.mount.add(e),i)?ep({disabled:"boolean"==typeof t.disabled?t.disabled:r.disabled,name:e}):N(e,!0,t.value),{...s?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:J(t.min),max:J(t.max),minLength:J(t.minLength),maxLength:J(t.maxLength),pattern:J(t.pattern)}:{}
1,name:e,onChange:ea,onBlur:ea,ref:s=>{if(s){let r;eg(e,t),i=g(h,e);let n=d(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,a="radio"===(r=n).type||"checkbox"===r.type,o=i._f.refs||[];(a?o.find(e=>e===n):n===i._f.ref)||(y(h,e,{_f:{...i._f,...a?{refs:[...o.filter(z),n,...Array.isArray(g(p,e))?[{}]:[]],ref:{type:n.type,name:e}}:{ref:n}}}),N(e,!1,void 0,n))}else(i=g(h,e,{}))._f&&(i._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&!(l(w.array,e)&&_.action)&&w.unMount.add(e)}}},ey=()=>r.shouldFocusError&&Y(h,eo,w.mount),em=(e,t)=>async s=>{let n;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let a=c(b);if(x.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await F();i.errors=e,a=c(t)}else await Z(h);if(w.disabled.size)for(let e of w.disabled)U(a,e);if(U(i.errors,"root"),P(i.errors)){x.state.next({errors:{}});try{await e(a,s)}catch(e){n=e}}else t&&await t({...i.errors},s),ey(),setTimeout(ey);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:P(i.errors)&&!n,submitCount:i.submitCount+1,errors:i.errors}),n)throw n},ev=(e,t={})=>{let s=e?c(e):p,n=c(s),a=P(e),o=a?p:n;if(t.keepDefaultValues||(p=s),!t.keepValues){if(t.keepDirtyValues)for(let e of Array.from(new Set([...w.mount,...Object.keys(D(p,b))])))g(i.dirtyFields,e)?y(o,e,g(b,e)):ei(e,g(o,e));else{if(u&&d(e))for(let e of w.mount){let t=g(h,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(R(e)){let t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(let e of w.mount)ei(e,g(o,e));else h={}}b=r.shouldUnregister?t.keepDefaultValues?c(p):{}:c(o),x.array.next({values:{...o}}),x.state.next({values:{...o}})}w={mount:t.keepDirtyValues?w.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},_.mount=!S.isValid||!!t.keepIsValid||!!t.keepDirtyValues,_.watch=!!r.shouldUnregister,x.state.next({submitCount:t.keepSubmitCount?i.submitCount:0,isDirty:!a&&(t.keepDirty?i.isDirty:!!(t.keepDefaultValues&&!T(e,p))),isSubmitted:!!t.keepIsSubmitted&&i.isSubmitted,dirtyFields:a?{}:t.keepDirtyValues?t.keepDefaultValues&&b?D(p,b):i.dirtyFields:t.keepDefaultValues&&e?D(p,e):t.keepDirty?i.dirtyFields:{},touchedFields:t.keepTouched?i.touchedFields:{},errors:t.keepErrors?i.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&i.isSubmitSuccessful,isSubmitting:!1,defaultValues:p})},eb=(e,t)=>ev(C(e)?e(b):e,t),e_=e=>{i={...i,...e}},ew={control:{register:eg,unregister:ef,getFieldState:ec,handleSubmit:em,setError:eh,_subscribe:ed,_runSchema:F,_focusError:ey,_getWatch:H,_getDirty:q,_setValid:O,_setFieldArray:(e,t=[],s,n,a=!0,o=!0)=>{if(n&&s&&!r.disabled){if(_.action=!0,o&&Array.isArray(g(h,e))){let t=s(g(h,e),n.argA,n.argB);a&&y(h,e,t)}if(o&&Array.isArray(g(i.errors,e))){let t,r=s(g(i.errors,e),n.argA,n.argB);a&&y(i.errors,e,r),f(g(t=i.errors,e)).length||U(t,e)}if((S.touchedFields||E.touchedFields)&&o&&Array.isArray(g(i.touchedFields,e))){let t=s(g(i.touchedFields,e),n.argA,n.argB);a&&y(i.touchedFields,e,t)}(S.dirtyFields||E.dirtyFields)&&(i.dirtyFields=D(p,b)),x.state.next({name:e,isDirty:q(e,t),dirtyFields:i.dirtyFields,errors:i.errors,isValid:i.isValid})}else y(b,e,t)},_setDisabledField:ep,_setErrors:e=>{i.errors=e,x.state.next({errors:i.errors,isValid:!1})},_getFieldArray:e=>f(g(_.mount?b:p,e,r.shouldUnregister?g(p,e,[]):[])),_reset:ev,_resetDefaultValues:()=>C(r.defaultValues)&&r.defaultValues().then(e=>{eb(e,r.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(let e of w.unMount){let t=g(h,e);t&&(t._f.refs?t._f.refs.every(e=>!z(e)):!z(t._f.ref))&&ef(e)}w.unMount=new Set},_disableForm:e=>{"boolean"==typeof e&&(x.state.next({disabled:e}),Y(h,(t,r)=>{let i=g(h,r);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},_subjects:x,_proxyFormState:S,get _fields(){return h},get _formValues(){return b},get _state(){return _},set _state(value){_=value},get _defaultValues(){return p},get _names(){return w},set _names(value){w=value},get _formState(){return i},get _options(){return r},set _options(value){r={...r,...value}}},subscribe:e=>(_.mount=!0,E={...E,...e.formState},ed({...e,formState:E})),trigger:el,register:eg,handleSubmit:em,watch:(e,t)=>C(e)?x.state.subscribe({next:r=>"values"in r&&e(H(void 0,t),r)}):H(e,t,!0),setValue:ei,getValues:eu,reset:eb,resetField:(e,t={})=>{g(h,e)&&(d(t.defaultValue)?ei(e,c(g(p,e))):(ei(e,t.defaultValue),y(p,e,c(t.defaultValue))),t.keepTouched||U(i.touchedFields,e),t.keepDirty||(U(i.dirtyFields,e),i.isDirty=t.defaultValue?q(e,c(g(p,e))):q()),!t.keepError&&(U(i.errors,e),S.isValid&&O()),x.state.next({...i}))},clearErrors:e=>
1{e&&$(e).forEach(e=>U(i.errors,e)),x.state.next({errors:e?i.errors:{}})},unregister:ef,setError:eh,setFocus:(e,t={})=>{let r=g(h,e),i=r&&r._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&(e.focus(),t.shouldSelect&&C(e.select)&&e.select())}},getFieldState:ec};return{...ew,formControl:ew}}(e);t.current={...i,formState:h}}let b=t.current.control;return b._options=e,E(()=>{let e=b._subscribe({formState:b._proxyFormState,callback:()=>p({...b._formState}),reRenderRoot:!0});return p(e=>({...e,isReady:!0})),b._formState.isReady=!0,e},[b]),i.useEffect(()=>b._disableForm(e.disabled),[b,e.disabled]),i.useEffect(()=>{e.mode&&(b._options.mode=e.mode),e.reValidateMode&&(b._options.reValidateMode=e.reValidateMode)},[b,e.mode,e.reValidateMode]),i.useEffect(()=>{e.errors&&(b._setErrors(e.errors),b._focusError())},[b,e.errors]),i.useEffect(()=>{e.shouldUnregister&&b._subjects.state.next({values:b._getWatch()})},[b,e.shouldUnregister]),i.useEffect(()=>{if(b._proxyFormState.isDirty){let e=b._getDirty();e!==h.isDirty&&b._subjects.state.next({isDirty:e})}},[b,h.isDirty]),i.useEffect(()=>{e.values&&!T(e.values,r.current)?(b._reset(e.values,{keepFieldsRef:!0,...b._options.resetOptions}),r.current=e.values,p(e=>({...e}))):b._resetDefaultValues()},[b,e.values]),i.useEffect(()=>{b._state.mount||(b._setValid(),b._state.mount=!0),b._state.watch&&(b._state.watch=!1,b._subjects.state.next({...b._formState})),b._removeUnmounted()}),t.current.formState=S(h,b),t.current}},26713:(e,t,r)=>{"use strict";function i(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function s(e,t){return"bigint"==typeof t?t.toString():t}function n(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function a(e){return null==e}function o(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function l(e,t){let r=(e.toString().split(".")[1]||"").length,i=t.toString(),s=(i.split(".")[1]||"").length;if(0===s&&/\d?e-\d?/.test(i)){let e=i.match(/\d?e-(\d?)/);e?.[1]&&(s=Number.parseInt(e[1]))}let n=r>s?r:s;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}r.d(t,{$f:()=>w,A2:()=>S,Gv:()=>y,LG:()=>l,NM:()=>E,OH:()=>$,PO:()=>n,QH:()=>P,Qd:()=>v,Rc:()=>U,UQ:()=>p,Up:()=>x,Vy:()=>d,X$:()=>j,ZV:()=>h,cJ:()=>T,cl:()=>a,gJ:()=>c,gx:()=>g,h1:()=>O,hI:()=>m,iR:()=>z,k8:()=>s,lQ:()=>C,mw:()=>I,o8:()=>k,p6:()=>o,qQ:()=>_,sn:()=>L,w5:()=>i,yG:()=>b,zH:()=>A});let u=Symbol("evaluating");function c(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==u)return void 0===i&&(i=u,i=r()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function h(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function d(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function f(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function p(e){return JSON.stringify(e)}let g="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function y(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let m=n(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function v(e){if(!1===y(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!1!==y(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function b(e){return v(e)?{...e}:e}let _=new Set(["string","number","symbol"]);function w(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k(e,t,r){let i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function S(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function E(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}let A={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function x(e,t){let r=e._zod.def,i=f(e._zod.def,{get shape(){let e={};for(let i in t){if(!(i in r.shape))throw Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=r.shape[i])}return d(this,"shape",e),e},checks:[]});return k(e,i)}function T(e,t){let r=e._zod.def,i=f(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return d(this,"shape",i),i},checks:[]});return k(e,i)}function j(e,t){if(!v(t))throw Error("Invalid input to extend: expected a plain object");let r=f(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return d(this,"shape",r),r},checks:[]});return k(e,r)}function O(e,t){let r=f(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return d(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return k(e,r)}function $(e,t,r){let i=f(t._zod.def,{get shape(){let i=t._zod.def.shape,s={...i};if(r)for(let t in r){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);r[t]&&(s[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(let t in i)s[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return d(this,"shape",s),s},checks:[]});return k(t,i)}function I(e,t,r){let i=f(t._zod.def,{get shape(){let i=t._zod.def.shape,s={...i};if(r)for(let t in r){if(!(t in s))throw Error(`Unrecognized key: "${t}"`);r[t]&&(s[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(let t in i)s[t]=new e({type:"nonoptional",innerType:i[t]});return d(this,"shape",s),s},checks:[]});return k(t,i)}function P(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function C(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function R(e){return"string"==typeof e?e:e?.message}function z(e,t,r){let i={...e,path:e.path??[]};return e.message||(i.message=R(e.inst?._zod.def?.error?.(e))??R(t?.error?.(e))??R(r.customError?.(e))??R(r.localeError?.(e))??"Invalid input"),delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function U(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function L(...e){let[t,r,i]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:i}:{...t}}},29826:(e,t,r)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;let i=r(49692);t.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${i.version}`}},37977:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let s=i(r(72901)),n=i(r(54419)),a=r(29826);class o{constructor(e,{headers:t={},schema:r,fetch:i}={}){this.url=e,this.headers=Object.assign(Object.assign({},a.DEFAULT_HEADERS),t),this.schemaName=r,this.fetch=i}from(e){let t=new URL(`${this.url}/${e}`);return new s.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new o(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:i=!1,count:s}={}){let a,o,l=new URL(`${this.url}/rpc/${e}`);r||i?(a=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{l.searchParams.append(e,t)})):(a="POST",o=t);let u=Object.assign({},this.headers);return s&&(u.Prefer=`count=${s}`),new n.default({method:a,url:l,headers:u,schema:this.schemaName,body:o,fetch:this.fetch,allowEmpty:!1})}}t.default=o},41954:(e,t,r)=>{"use strict";r.d(t,{JM:()=>l,Kd:()=>o,Wk:()=>u,a$:()=>a});var i=r(5426),s=r(26713);let n=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,s.k8,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},a=(0,i.xI)("$ZodError",n),o=(0,i.xI)("$ZodError",n,{Parent:Error});function l(e,t=e=>e.message){let r={},i=[];for(let s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):i.push(t(s));return{formErrors:i,fieldErrors:r}}function u(e,t){let r=t||function(e){return e.message},i={_errors:[]},s=e=>{for(let t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>s({issues:e}));else if("invalid_key"===t.code)s({issues:t.issues});else if("invalid_element"===t.code)s({issues:t.issues});else if(0===t.path.length)i._errors.push(r(t));else{let e=i,s=0;for(;s<t.path.length;){let i=t.path[s];s===t.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(r(t))):e[i]=e[i]||{_errors:[]},e=e[i],s++}}};return s(e),i}},48956:(e,t,r)=>{"use strict";r.d(t,{EJ:()=>u,Od:()=>c,Rb:()=>l,Tj:()=>a,bp:()=>f,qg:()=>o,wG:()=>d,xL:()=>h});var i=r(5426),s=r(41954),n=r(26713);let a=e=>(t,r,s,a)=>{let o=s?Object.assign(s,{async:!1}):{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new i.GT;if(l.issues.length){let t=new(a?.Err??e)(l.issues.map(e=>n.iR(e,o,i.$W())));throw n.gx(t,a?.callee),t}return l.value},o=a(s.Kd),l=e=>async(t,r,s,a)=>{let o=s?Object.assign(s,{async:!0}):{async:!0},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise&&(l=await l),l.issues.length){let t=new(a?.Err??e)(l.issues.map(e=>n.iR(e,o,i.$W())));throw n.gx(t,a?.callee),t}return l.value},u=l(s.Kd),c=e=>(t,r,a)=>{let o=a?{...a,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new i.GT;return l.issues.length?{success:!1,error:new(e??s.a$)(l.issues.map(e=>n.iR(e,o,i.$W())))}:{success:!0,data:l.value}},h=c(s.Kd),d=e=>async(t,r,s)=>{let a=s?Object.assign(s,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>n.iR(e,a,i.$W())))}:{success:!0,data:o.value}},f=d(s.Kd)},49692:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0-automated"},54419:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let s=i(r(76373));class n extends s.default{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){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&RegExp("[,()]").test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),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:r,type:i}={}){let s="";"plain"===i?s="pl":"phrase"===i?s="ph":"websearch"===i&&(s="w");let n=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${s}fts${n}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let i=r?`${r}.or`:"or";return this.url.searchParams.append(i,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}}t.default=n},65040:(e,t,r)=>{"use strict";r.d(t,{UU:()=>tO});
1class i extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class s extends i{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class n extends i{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class a extends i{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}!function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"}(p||(p={}));class o{constructor(e,{headers:t={},customFetch:i,region:s=p.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=(e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)})(i)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var r,i,o,l,u;return i=this,o=void 0,l=void 0,u=function*(){try{let i,{headers:o,method:l,body:u}=t,c={},{region:h}=t;h||(h=this.region);let d=new URL(`${this.url}/${e}`);h&&"any"!==h&&(c["x-region"]=h,d.searchParams.set("forceFunctionRegion",h)),u&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)&&("undefined"!=typeof Blob&&u instanceof Blob||u instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",i=u):"string"==typeof u?(c["Content-Type"]="text/plain",i=u):"undefined"!=typeof FormData&&u instanceof FormData?i=u:(c["Content-Type"]="application/json",i=JSON.stringify(u)));let f=yield this.fetch(d.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),o),body:i}).catch(e=>{throw new s(e)}),p=f.headers.get("x-relay-error");if(p&&"true"===p)throw new n(f);if(!f.ok)throw new a(f);let g=(null!=(r=f.headers.get("Content-Type"))?r:"text/plain").split(";")[0].trim();return{data:"application/json"===g?yield f.json():"application/octet-stream"===g?yield f.blob():"text/event-stream"===g?f:"multipart/form-data"===g?yield f.formData():yield f.text(),error:null,response:f}}catch(e){return{data:null,error:e,response:e instanceof a||e instanceof n?e.context:void 0}}},new(l||(l=Promise))(function(e,t){function r(e){try{n(u.next(e))}catch(e){t(e)}}function s(e){try{n(u.throw(e))}catch(e){t(e)}}function n(t){var i;t.done?e(t.value):((i=t.value)instanceof l?i:new l(function(e){e(i)})).then(r,s)}n((u=u.apply(i,o||[])).next())})}}let{PostgrestClient:l,PostgrestQueryBuilder:u,PostgrestFilterBuilder:c,PostgrestTransformBuilder:h,PostgrestBuilder:d,PostgrestError:f}=r(87843);var p,g,y,m,v,b,_,w,k,S,E,A=r(95704);class x{static detectEnvironment(){var e;if("undefined"!=typeof WebSocket)return{type:"native",constructor:WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocket)return{type:"native",constructor:globalThis.WebSocket};if(void 0!==r.g&&void 0!==r.g.WebSocket)return{type:"native",constructor:r.g.WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocketPair&&void 0===globalThis.WebSocket)return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if("undefined"!=typeof globalThis&&globalThis.EdgeRuntime||"undefined"!=typeof navigator&&(null==(e=navigator.userAgent)?void 0:e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(void 0!==A&&A.versions&&A.versions.node){let e=parseInt(A.versions.node.split(".")[0]);return e>=22?void 0!==globalThis.WebSocket?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${e} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${e} detected without native WebSocket support.`,workaround:'For Node.js < 22, install "ws" package and provide it via the transport option:\nimport ws from "ws"\nnew RealtimeClient(url, { transport: ws })'}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=` 2 3Suggested solution: ${e.workaround}`),Error(t)}static createWebSocket(e,t){return new(this.getWebSocketConstructor())(e,t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}}!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(g||(g={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(y||(y={})),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"}(m||(m={})),(v||(v={})).websocket="websocket",function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"}(b||(b={}));class T{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):"string"==typeof e?t(JSON.parse(e)):t({})}
3_binaryDecode(e){let t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){let i=t.getUint8(1),s=t.getUint8(2),n=this.HEADER_LENGTH+2,a=r.decode(e.slice(n,n+i));n+=i;let o=r.decode(e.slice(n,n+s));return n+=s,{ref:null,topic:a,event:o,payload:JSON.parse(r.decode(e.slice(n,e.byteLength)))}}}class j{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),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}!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"}(_||(_={}));let O=(e,t,r={})=>{var i;let s=null!=(i=r.skipTypes)?i:[];return Object.keys(t).reduce((r,i)=>(r[i]=$(i,e,t,s),r),{})},$=(e,t,r,i)=>{let s=t.find(t=>t.name===e),n=null==s?void 0:s.type,a=r[e];return n&&!i.includes(n)?I(n,a):P(a)},I=(e,t)=>{if("_"===e.charAt(0))return U(t,e.slice(1,e.length));switch(e){case _.bool:return C(t);case _.float4:case _.float8:case _.int2:case _.int4:case _.int8:case _.numeric:case _.oid:return R(t);case _.json:case _.jsonb:return z(t);case _.timestamp:return L(t);case _.abstime:case _.date:case _.daterange:case _.int4range:case _.int8range:case _.money:case _.reltime:case _.text:case _.time:case _.timestamptz:case _.timetz:case _.tsrange:case _.tstzrange:default:return P(t)}},P=e=>e,C=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},R=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},z=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log(`JSON parse error: ${e}`)}return e},U=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,i=e[r];if("{"===e[0]&&"}"===i){let i,s=e.slice(1,r);try{i=JSON.parse("["+s+"]")}catch(e){i=s?s.split(","):[]}return i.map(e=>I(t,e))}return e},L=e=>"string"==typeof e?e.replace(" ","T"):e,N=e=>{let t=e;return(t=(t=t.replace(/^ws/i,"http")).replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,"")).replace(/\/+$/,"")+"/api/broadcast"};class D{constructor(e,t,r={},i=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=i,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 r;return this._hasReceived(e)&&t(null==(r=this.receivedResp)?void 0:r.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);let e=e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)};this.channel._on(this.refEvent,{},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"}(w||(w={}));class B{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{let{onJoin:t,onLeave:r,onSync:i}=this.caller;this.joinRef=this.channel._joinRef(),this.state=B.syncState(this.state,e,t,r),this.pendingDiffs.forEac
3h(e=>{this.state=B.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],i()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=B.syncDiff(this.state,e,t,r),i())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,i){let s=this.cloneDeep(e),n=this.transformState(t),a={},o={};return this.map(s,(e,t)=>{n[e]||(o[e]=t)}),this.map(n,(e,t)=>{let r=s[e];if(r){let i=t.map(e=>e.presence_ref),s=r.map(e=>e.presence_ref),n=t.filter(e=>0>s.indexOf(e.presence_ref)),l=r.filter(e=>0>i.indexOf(e.presence_ref));n.length>0&&(a[e]=n),l.length>0&&(o[e]=l)}else a[e]=t}),this.syncDiff(s,{joins:a,leaves:o},r,i)}static syncDiff(e,t,r,i){let{joins:s,leaves:n}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(s,(t,i)=>{var s;let n=null!=(s=e[t])?s:[];if(e[t]=this.cloneDeep(i),n.length>0){let r=e[t].map(e=>e.presence_ref),i=n.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...i)}r(t,n,i)}),this.map(n,(t,r)=>{let s=e[t];if(!s)return;let n=r.map(e=>e.presence_ref);s=s.filter(e=>0>n.indexOf(e.presence_ref)),e[t]=s,i(t,s,r),0===s.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let i=e[r];return"metas"in i?t[r]=i.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=i,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.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(k||(k={})),function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"}(S||(S={})),function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"}(E||(E={}));class F{constructor(e,t={config:{}},r){this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=y.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new D(this,m.join,this.params,this.timeout),this.rejoinTimer=new j(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=y.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=y.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=y.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=y.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=y.errored,this.rejoinTimer.scheduleTimeout())}),this._on(m.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new B(this),this.broadcastEndpointURL=N(this.socket.endPoint),this.private=this.params.config.private||!1}subscribe(e,t=this.timeout){var r,i;if(this.socket.isConnected()||this.socket.connect(),this.state==y.closed){let{config:{broadcast:s,presence:n,private:a}}=this.params,o=null!=(i=null==(r=this.bindings.postgres_changes)?void 0:r.map(e=>e.filter))?i:[],l=!!this.bindings[S.PRESENCE]&&this.bindings[S.PRESENCE].length>0,u={},c={broadcast:s,presence:Object.assign(Object.assign({},n),{enabled:l}),postgres_changes:o,private:a};this.socket.accessTokenValue&&(u.access_token=this.socket.accessTokenValue),this._onError(t=>null==e?void 0:e(E.CHANNEL_ERROR,t)),this._onClose(()=>null==e?void 0:e(E.CLOSED)),this.updateJoinPayload(Object.assign({config:c},u)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:t})=>{var r;if(this.socket.setAuth(),void 0===t){null==e||e(E.SUBSCRIBED);return}{let i=this.bindings.postgres_changes,s=null!=(r=null==i?void 0:i.length)?r:0,n=[];for(let r=0;r<s;r++){let s=i[r],{filter:{event:a,schema:o,table:l,filter:u}}=s,c=t&&t[r];if(c&&c.event===a&&c.schema===o&&c.table===l&&c.filter===u)n.push(Object.assign(Object.assign({},s),{id:c.id}));else{this.unsubscribe(),this.state=y.errored,null==e||e(E.CHANNEL_ERROR,Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=n,e&&e(E.SUBSCRIBED);return}}).receive("error",t=>{this.state=y.errored,null==e||e(E.CHANNEL_ERROR,Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{null==e||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,r){return this.state===y.joined&&e===S.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,t,r)}async send(e,t={}){var r,i;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var i,s,n;let a=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null==(n=null==(s=null==(i=this.params)?void 0:i.config)?void 0:s.broadcast)?void 0:n.ack)||r("ok"),a.receive("ok",()=>r("ok")),a.receive("error",()=>r("error")),a.receive("timeout",()=>r("timed out"))});{let{event:s,payload:n}=e,a={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:n,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,a,null!=(r=t.timeout)?r:this.timeout);return await (null==(i=e.body)?void 0:i.cancel()),e.ok?"ok":"error"}catch(e){if("AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=y.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(m.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(i=>{(r=new D(this,m.leave,{},e)).receive("ok",()=>{t(),i("ok")}).receive("timeout",()=>{t(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{null==r||r.destroy()})}
3teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=y.closed,this.bindings={}}async _fetchWithTimeout(e,t,r){let i=new AbortController,s=setTimeout(()=>i.abort(),r),n=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),n}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new D(this,e,t,r);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>100){let e=this.pushBuffer.shift();e&&(e.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload))}}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var i,s;let n=e.toLocaleLowerCase(),{close:a,error:o,leave:l,join:u}=m;if(r&&[a,o,l,u].indexOf(n)>=0&&r!==this._joinRef())return;let c=this._onMessage(n,t,r);if(t&&!c)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(n)?null==(i=this.bindings.postgres_changes)||i.filter(e=>{var t,r,i;return(null==(t=e.filter)?void 0:t.event)==="*"||(null==(i=null==(r=e.filter)?void 0:r.event)?void 0:i.toLocaleLowerCase())===n}).map(e=>e.callback(c,r)):null==(s=this.bindings[n])||s.filter(e=>{var r,i,s,a,o,l;if(!["broadcast","presence","postgres_changes"].includes(n))return e.type.toLocaleLowerCase()===n;if("id"in e){let n=e.id,a=null==(r=e.filter)?void 0:r.event;return n&&(null==(i=t.ids)?void 0:i.includes(n))&&("*"===a||(null==a?void 0:a.toLocaleLowerCase())===(null==(s=t.data)?void 0:s.type.toLocaleLowerCase()))}{let r=null==(o=null==(a=null==e?void 0:e.filter)?void 0:a.event)?void 0:o.toLocaleLowerCase();return"*"===r||r===(null==(l=null==t?void 0:t.event)?void 0:l.toLocaleLowerCase())}}).map(e=>{if("object"==typeof c&&"ids"in c){let e=c.data,{schema:t,table:r,commit_timestamp:i,type:s,errors:n}=e;c=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:i,eventType:s,new:{},old:{},errors:n}),this._getPayloadRecords(e))}e.callback(c,r)})}_isClosed(){return this.state===y.closed}_isJoined(){return this.state===y.joined}_isJoining(){return this.state===y.joining}_isLeaving(){return this.state===y.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let i=e.toLocaleLowerCase(),s={type:i,filter:t,callback:r};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(e=>{var i;return!((null==(i=e.type)?void 0:i.toLocaleLowerCase())===r&&F.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(m.close,{},e)}_onError(e){this._on(m.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=y.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=O(e.columns,e.record)),("UPDATE"===e.type||"DELETE"===e.type)&&(t.old=O(e.columns,e.old_record)),t}}let V=()=>{},M={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Z=[1e3,2e3,5e3,1e4],q=` 4 addEventListener("message", (e) => { 5 if (e.data.event === "start") { 6 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 7 } 8 });`;class W{constructor(e,t){var i;if(this.accessTokenValue=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=1e4,this.transport=null,this.heartbeatIntervalMs=M.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=V,this.ref=0,this.reconnectTimer=null,this.logger=V,this.conn=null,this.sendBuffer=[],this.serializer
8=new T,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)).catch(e=>{throw Error(`Failed to load @supabase/node-fetch: ${e.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):fetch),(...e)=>t(...e)},!(null==(i=null==t?void 0:t.params)?void 0:i.apikey))throw Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${v.websocket}`,this.httpEndpoint=N(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||null!==this.conn&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=x.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");let e=t.message;if(e.includes("Node.js"))throw Error(`${e} 9 10To use Realtime in Node.js, you need to provide a WebSocket implementation: 11 12Option 1: Use Node.js 22+ which has native WebSocket support 13Option 2: Install and provide the "ws" package: 14 15 npm install ws 16 17 import ws from "ws" 18 const client = new RealtimeClient(url, { 19 ...options, 20 transport: ws 21 })`);throw Error(`WebSocket not available: ${e}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){let e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case g.connecting:return b.Connecting;case g.open:return b.Open;case g.closing:return b.Closing;default:return b.Closed}}isConnected(){return this.connectionState()===b.Open}isConnecting(){return"connecting"===this._connectionState}isDisconnecting(){return"disconnecting"===this._connectionState}channel(e,t={config:{}}){let r=`realtime:${e}`,i=this.getChannels().find(e=>e.topic===r);if(i)return i;{let r=new F(`realtime:${e}`,t,this);return this.channels.push(r),r}}push(e){let{topic:t,event:r,payload:i,ref:s}=e,n=()=>{this.encode(e,e=>{var t;null==(t=this.conn)||t.send(e)})};this.log("push",`${t} ${r} (${s})`,i),this.isConnected()?n():this.sendBuffer.push(n)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected())return void this.heartbeatCallback("disconnected");if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.heartbeatCallback("timeout"),this._wasManualDisconnect=!1,null==(e=this.conn)||e.close(1e3,"heartbeat timeout"),setTimeout(()=>{var e;this.isConnected()||null==(e=this.reconnectTimer)||e.scheduleTimeout()},M.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatCallback("sent"),this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_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.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,e=>{"phoenix"===e.topic&&"phx_reply"===e.event&&this.heartbeatCallback("ok"===e.payload.status?"ok":"error"),e.ref&&e.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:t,event:r,payload:i,ref:s}=e,n=s?`(${s})`:"",a=i.status||"";this.log("receive",`${a} ${t} ${r} ${n}`.trim(),i),this.channels.filter(e=>
21e._isMember(t)).forEach(e=>e._trigger(r,i,s)),this._triggerStateCallbacks("message",e)})}_clearTimer(e){var t;"heartbeat"===e&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):"reconnect"===e&&(null==(t=this.reconnectTimer)||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in 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))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this.workerRef.terminate()},this.workerRef.onmessage=e=>{"keepAlive"===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||null==(t=this.reconnectTimer)||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(m.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",i=new URLSearchParams(t);return`${e}${r}${i}`}_workerObjectUrl(e){let t;if(e)t=e;else{let e=new Blob([q],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_setConnectionState(e,t=!1){this._connectionState=e,"connecting"===e?this._wasManualDisconnect=!1:"disconnecting"===e&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;t=e||(this.accessToken?await this.accessToken():this.accessTokenValue),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{t&&e.updateJoinPayload({access_token:t,version:"realtime-js/2.15.1"}),e.joinedOnce&&e._isJoined()&&e._push(m.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}_setupReconnectionTimer(){this.reconnectTimer=new j(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},M.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,r,i,s,n,a,o,l;if(this.transport=null!=(t=null==e?void 0:e.transport)?t:null,this.timeout=null!=(r=null==e?void 0:e.timeout)?r:1e4,this.heartbeatIntervalMs=null!=(i=null==e?void 0:e.heartbeatIntervalMs)?i:M.HEARTBEAT_INTERVAL,this.worker=null!=(s=null==e?void 0:e.worker)&&s,this.accessToken=null!=(n=null==e?void 0:e.accessToken)?n:null,(null==e?void 0:e.params)&&(this.params=e.params),(null==e?void 0:e.logger)&&(this.logger=e.logger),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=null!=(a=null==e?void 0:e.reconnectAfterMs)?a:e=>Z[e-1]||1e4,this.encode=null!=(o=null==e?void 0:e.encode)?o:(e,t)=>t(JSON.stringify(e)),this.decode=null!=(l=null==e?void 0:e.decode)?l:this.serializer.decode.bind(this.serializer),this.worker){if("undefined"!=typeof window&&!window.Worker)throw Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl}}}
21class J extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function K(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class H extends J{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class G extends J{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}let Q=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},Y=e=>{if(Array.isArray(e))return e.map(e=>Y(e));if("function"==typeof e||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,r])=>{t[e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""))]=Y(r)}),t};var X=function(e,t,r,i){return new(r||(r=Promise))(function(s,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function o(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};let ee=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function et(e,t,i,s,n,a){return X(this,void 0,void 0,function*(){return new Promise((o,l)=>{e(i,((e,t,r,i)=>{let s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&i?((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(i)?(s.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),s.body=JSON.stringify(i)):s.body=i,(null==t?void 0:t.duplex)&&(s.duplex=t.duplex),Object.assign(Object.assign({},s),r)):s})(t,s,n,a)).then(e=>{if(!e.ok)throw e;return(null==s?void 0:s.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>X(void 0,void 0,void 0,function*(){var t,i,n,a;let o=yield(t=void 0,i=void 0,n=void 0,a=function*(){return"undefined"==typeof Response?(yield Promise.resolve().then(r.bind(r,93537))).Response:Response},new(n||(n=Promise))(function(e,r){function s(e){try{l(a.next(e))}catch(e){r(e)}}function o(e){try{l(a.throw(e))}catch(e){r(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n(function(e){e(r)})).then(s,o)}l((a=a.apply(t,i||[])).next())}));e instanceof o&&!(null==s?void 0:s.noResolveJson)?e.json().then(t=>{let r=e.status||500,i=(null==t?void 0:t.statusCode)||r+"";l(new H(ee(t),r,i))}).catch(e=>{l(new G(ee(e),e))}):l(new G(ee(e),e))}))})})}function er(e,t,r,i){return X(this,void 0,void 0,function*(){return et(e,"GET",t,r,i)})}function ei(e,t,r,i,s){return X(this,void 0,void 0,function*(){return et(e,"POST",t,i,s,r)})}function es(e,t,r,i,s){return X(this,void 0,void 0,function*(){return et(e,"PUT",t,i,s,r)})}function en(e,t,r,i,s){return X(this,void 0,void 0,function*(){return et(e,"DELETE",t,i,s,r)})}var ea=r(15376).Buffer,eo=function(e,t,r,i){return new(r||(r=Promise))(function(s,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function o(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};let el={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},eu={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class ec{constructor(e,t={},r,i){this.url=e,this.headers=t,this.bucketId=r,this.fetch=Q(i)}uploadOrUpdate(e,t,r,i){return eo(this,void 0,void 0,function*(){try{let s,n=Object.assign(Object.assign({},eu),i),a=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(n.upsert)}),o=n.metadata;"undefined"!=typeof Blob&&r instanceof Blob?((s=new FormData).append("cacheControl",n.cacheControl),o&&s.append("metadata",this.encodeMetadata(o)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?((s=r).append("cacheControl",n.cacheControl),o&&s.append("metadata",this.encodeMetadata(o))):(s=r,a["cache-control"]=`max-age=${n.cacheControl}`,a["content-type"]=n.contentType,o&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(o)))),(null==i?void 0:i.headers)&&(a=Object.assign(Object.assign({},a),i.headers));let l=this._removeEmptyFolders(t),u=this._getFinalPath(l),c=yield("PUT"==e?es:ei)(this.fetch,`${this.url}/object/${u}`,s,Object.assign({headers:a},(null==n?void 0:n.duplex)?{duplex:n.duplex}:{}));return{data:{path:l,id:c.Id,fullPath:c.Key},error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}upload(e,t,r){return eo(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}
21uploadToSignedUrl(e,t,r,i){return eo(this,void 0,void 0,function*(){let s=this._removeEmptyFolders(e),n=this._getFinalPath(s),a=new URL(this.url+`/object/upload/sign/${n}`);a.searchParams.set("token",t);try{let e,t=Object.assign({upsert:eu.upsert},i),n=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r).append("cacheControl",t.cacheControl):(e=r,n["cache-control"]=`max-age=${t.cacheControl}`,n["content-type"]=t.contentType);let o=yield es(this.fetch,a.toString(),e,{headers:n});return{data:{path:s,fullPath:o.Key},error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return eo(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),i=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(i["x-upsert"]="true");let s=yield ei(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:i}),n=new URL(this.url+s.url),a=n.searchParams.get("token");if(!a)throw new J("No token returned by API");return{data:{signedUrl:n.toString(),path:e,token:a},error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}update(e,t,r){return eo(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return eo(this,void 0,void 0,function*(){try{return{data:yield ei(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
21stinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}copy(e,t,r){return eo(this,void 0,void 0,function*(){try{return{data:{path:(yield ei(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return eo(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),s=yield ei(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:s={signedUrl:encodeURI(`${this.url}${s.signedURL}${n}`)},error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return eo(this,void 0,void 0,function*(){try{let i=yield ei(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),s=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:i.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${s}`):null})),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}download(e,t){return eo(this,void 0,void 0,function*(){let r=void 0!==(null==t?void 0:t.transform),i=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),s=i?`?${i}`:"";try{let t=this._getFinalPath(e),i=yield er(this.fetch,`${this.url}/${r?"render/image/authenticated":"object"}/${t}${s}`,{headers:this.headers,noResolveJson:!0});return{data:yield i.blob(),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}info(e){return eo(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let e=yield er(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:Y(e),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}exists(e){return eo(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield function(e,t,r,i){return X(this,void 0,void 0,function*(){return et(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),void 0)})}(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(K(e)&&e instanceof G){let t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}})}getPublicUrl(e,t){let r=this._getFinalPath(e),i=[],s=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==s&&i.push(s);let n=void 0!==(null==t?void 0:t.transform),a=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==a&&i.push(a);let o=i.join("&");return""!==o&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${n?"render/image":"object"}/public/${r}${o}`)}}}remove(e){return eo(this,void 0,void 0,function*(){try{return{data:yield en(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}list(e,t,r){return eo(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},el),t),{prefix:e||""});return{data:yield ei(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},r),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}listV2(e,t){return eo(this,void 0,void 0,function*(){try{let r=Object.assign({},e);return{data:yield ei(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},t),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==ea?ea.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let 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("&")}}let eh={"X-Client-Info":"storage-js/2.11.0"};var ed=function(e,t,r,i){return new(r||(r=Promise))(function(s,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function o(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})};class ef{constructor(e,t={},r,i){let s=new URL(e);(null==i?void 0:i.useNewHostname)&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href,this.headers=Object.assign(Object.assign({},eh),t),this.fetch=Q(r)}listBuckets(){return ed(this,void 0,void 0,function*(){try{return{data:yield er(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}getBucket(e){return ed(this,void 0,void 0,function*(){try{return{data:yield er(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}createBucket(e,t={public:!1}){return ed(this,void 0,void 0,function*(){try{return{data:yield ei(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return ed(this,void 0,void 0,function*(){try{return{data:yield es(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}),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}emptyBucket(e){return ed(this,void 0,void 0,function*(){try{return{data:yield ei(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}deleteBucket(e){return ed(this,void 0,void 0,function*(){try{return{data:yield en(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(K(e))return{data:null,error:e};throw e}})}}class ep extends ef{constructor(e,t={}
21,r,i){super(e,t,r,i)}from(e){return new ec(this.url,this.headers,e,this.fetch)}}let eg="";eg="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let ey={headers:{"X-Client-Info":`supabase-js-${eg}/2.55.0`}},em={schema:"public"},ev={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},eb={};var e_=r(93537);let ew="2.71.1",ek={"X-Client-Info":`gotrue-js/${ew}`},eS="X-Supabase-Api-Version",eE={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eA=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;class ex extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function eT(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class ej extends ex{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class eO extends ex{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}
21class e$ extends ex{constructor(e,t,r,i){super(e,r,i),this.name=t,this.status=r}}class eI extends e${constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class eP extends e${constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class eC extends e${constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class eR extends e${constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class ez extends e${constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class eU extends e${constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function eL(e){return eT(e)&&"AuthRetryableFetchError"===e.name}class eN extends e${constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}class eD extends e${constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}let eB="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),eF=" \n\r=".split(""),eV=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<eF.length;t+=1)e[eF[t].charCodeAt(0)]=-2;for(let t=0;t<eB.length;t+=1)e[eB[t].charCodeAt(0)]=t;return e})();function eM(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)r(eB[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)r(eB[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function eZ(e,t,r){let i=eV[e];if(i>-1)for(t.queue=t.queue<<6|i,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(-2===i)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function eq(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},i={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},n=e=>{!function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}}(e,i,r)};for(let t=0;t<e.length;t+=1)eZ(e.charCodeAt(t),s,n);return t.join("")}let eW=()=>"undefined"!=typeof window&&"undefined"!=typeof document,eJ={tested:!1,writable:!1},eK=()=>{if(!eW())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(eJ.tested)return eJ.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),eJ.tested=!0,eJ.writable=!0}catch(e){eJ.tested=!0,eJ.writable=!1}return eJ.writable},eH=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},eG=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},eQ=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},eY=async(e,t)=>{await e.removeItem(t)};class eX{constructor(){this.promise=new eX.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function e0(e){let t=e.split(".");if(3!==t.length)throw new eD("Invalid JWT structure");for(let e=0;e<t.length;e++)if(!eA.test(t[e]))throw new eD("JWT not in base64url format");return{header:JSON.parse(eq(t[0])),payload:JSON.parse(eq(t[1])),signature:function(e){let t=[],r={queue:0,queuedBits:0},i=e=>{t.push(e)};for(let t=0;t<e.length;t+=1)eZ(e.charCodeAt(t),r,i);return new Uint8Array(t)}(t[2]),raw:{header:t[0],payload:t[1]}}}async function e1(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function e2(e){return("0"+e.toString(16)).substr(-2)}async function e6(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>String.fromCharCode(e)).join("")}async function e5(e){return"undefined"==typeof crypto||void 0===crypto.subtle||"undefined"==typeof TextEncoder?(console.warn("WebCrypto API is not supported. Code
21challenge method will default to use plain instead of sha256."),e):btoa(await e6(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function e4(e,t,r=!1){let i=function(){let e=new Uint32Array(56);if("undefined"==typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let i=0;i<56;i++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,e2).join("")}(),s=i;r&&(s+="/PASSWORD_RECOVERY"),await eG(e,`${t}-code-verifier`,s);let n=await e5(i),a=i===n?"plain":"s256";return[n,a]}eX.promiseConstructor=Promise;let e8=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i,e3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function e9(e){if(!e3.test(e))throw Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function e7(){return new Proxy({},{get:(e,t)=>{if("__isUserNotAvailableProxy"===t)return!0;if("symbol"==typeof t){let e=t.toString();if("Symbol(Symbol.toPrimitive)"===e||"Symbol(Symbol.toStringTag)"===e||"Symbol(util.inspect.custom)"===e)return}throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function te(e){return JSON.parse(JSON.stringify(e))}var tt=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)0>t.indexOf(i[s])&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r};let tr=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),ti=[502,503,504];async function ts(e){var t;let r,i;if(!("object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json))throw new eU(tr(e),0);if(ti.includes(e.status))throw new eU(tr(e),e.status);try{r=await e.json()}catch(e){throw new eO(tr(e),e)}let s=function(e){let t=e.headers.get(eS);if(!t||!t.match(e8))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(s&&s.getTime()>=eE["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?i=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(i=r.error_code),i){if("weak_password"===i)throw new eN(tr(r),e.status,(null==(t=r.weak_password)?void 0:t.reasons)||[]);else if("session_not_found"===i)throw new eI}else if("object"==typeof r&&r&&"object"==typeof r.weak_password&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0))throw new eN(tr(r),e.status,r.weak_password.reasons);throw new ej(tr(r),e.status||500,i)}async function tn(e,t,r,i){var s;let n=Object.assign({},null==i?void 0:i.headers);n[eS]||(n[eS]=eE["2024-01-01"].name),(null==i?void 0:i.jwt)&&(n.Authorization=`Bearer ${i.jwt}`);let a=null!=(s=null==i?void 0:i.query)?s:{};(null==i?void 0:i.redirectTo)&&(a.redirect_to=i.redirectTo);let o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await ta(e,t,r+o,{headers:n,noResolveJson:null==i?void 0:i.noResolveJson},{},null==i?void 0:i.body);return(null==i?void 0:i.xform)?null==i?void 0:i.xform(l):{data:Object.assign({},l),error:null}}async function ta(e,t,r,i,s,n){let a,o=((e,t,r,i)=>{let s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"}
21,null==t?void 0:t.headers),s.body=JSON.stringify(i),Object.assign(Object.assign({},s),r))})(t,i,s,n);try{a=await e(r,Object.assign({},o))}catch(e){throw console.error(e),new eU(tr(e),0)}if(a.ok||await ts(a),null==i?void 0:i.noResolveJson)return a;try{return await a.json()}catch(e){await ts(e)}}function to(e){var t,r,i;let s=null;(i=e).access_token&&i.refresh_token&&i.expires_in&&(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)?t:e},error:null}}function tl(e){let t=to(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 tu(e){var t;return{data:{user:null!=(t=e.user)?t:e},error:null}}function tc(e){return{data:e,error:null}}function th(e){let{action_link:t,email_otp:r,hashed_token:i,redirect_to:s,verification_type:n}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:i,redirect_to:s,verification_type:n},user:Object.assign({},tt(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function td(e){return e}let tf=["global","local","others"];var tp=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)0>t.indexOf(i[s])&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r};class tg{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=eH(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t=tf[0]){if(0>tf.indexOf(t))throw Error(`@supabase/auth-js: Parameter scope must be one of ${tf.join(", ")}`);try{return await tn(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(eT(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await tn(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tu})}catch(e){if(eT(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=tp(e,["options"]),i=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(i.new_email=null==r?void 0:r.newEmail,delete i.newEmail),await tn(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:th,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(eT(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await tn(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:tu})}catch(e){if(eT(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,i,s,n,a,o;try{let l={nextPage:null,lastPage:0,total:0},u=await tn(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(s=null==(i=null==e?void 0:e.perPage)?void 0:i.toString())?s:""},xform:td});if(u.error)throw u.error;let c=await u.json(),h=null!=(n=u.headers.get("x-total-count"))?n:0,d=null!=(o=null==(a=u.headers.get("link"))?void 0:a.split(","))?o:[];return d.length>0&&(d.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(h)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(eT(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){e9(e);try{return await tn(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:tu})}catch(e){if(eT(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){e9(e);try{return await tn(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:tu})}catch(e){if(eT(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){e9(e);
21try{return await tn(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:tu})}catch(e){if(eT(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){e9(e.userId);try{let{data:t,error:r}=await tn(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(e){if(eT(e))return{data:null,error:e};throw e}}async _deleteFactor(e){e9(e.userId),e9(e.id);try{return{data:await tn(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(eT(e))return{data:null,error:e};throw e}}}function ty(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let tm={debug:!!(globalThis&&eK()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class tv extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class tb extends tv{}async function t_(e,t,r){tm.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let i=new globalThis.AbortController;return t>0&&setTimeout(()=>{i.abort(),tm.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async i=>{if(i){tm.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await r()}finally{tm.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}if(0===t)throw tm.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new tb(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(tm.debug)try{let 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 r()}))}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)}let tw={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ek,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function tk(e,t,r){return await r()}let tS={};class tE{constructor(e){var t,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=tE.nextInstanceID,tE.nextInstanceID+=1,this.instanceID>0&&eW()&&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.");let i=Object.assign(Object.assign({},tw),e);if(this.logDebugMessages=!!i.debug,"function"==typeof i.debug&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new tg({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=eH(i.fetch),this.lock=i.lock||tk,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:eW()&&(null==(t=null==globalThis?void 0:globalThis.navigator)?void 0:t.locks)?this.lock=t_:this.lock=tk,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),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?(i.storage?this.storage=i.storage:eK()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ty(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=ty(this.memoryStorage)),eW()&&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==(r=this.broadcastChannel)||r.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()}get jwks(){var e,t;return null!=(t=null==(e=tS[this.storageKey])?void 0:e.jwks)?t:{keys:[]}}set jwks(e){tS[this.storageKey]=Object.assign(Object.assign({},tS[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!=(t=null==(e=tS[this.storageKey])?void 0:e.cachedAt)?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){tS[this.storageKey]=Object.assign(Object.assign({},tS[this.storageKey]),{cachedAt:e})}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${ew}) ${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(){var e;try{let t=function(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEac
21h((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}(window.location.href),r="none";if(this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce"),eW()&&this.detectSessionInUrl&&"none"!==r){let{data:i,error:s}=await this._getSessionFromURL(t,r);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),eT(s)&&"AuthImplicitGrantRedirectError"===s.name){let t=null==(e=s.details)?void 0:e.code;if("identity_already_exists"===t||"identity_not_found"===t||"single_identity_not_deletable"===t)return{error:s}}return await this._removeSession(),{error:s}}let{session:n,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",n,"redirect type",a),await this._saveSession(n),setTimeout(async()=>{"recovery"===a?await this._notifyAllSubscribers("PASSWORD_RECOVERY",n):await this._notifyAllSubscribers("SIGNED_IN",n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(eT(e))return{error:e};return{error:new eO("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,i;try{let{data:s,error:n}=await tn(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.data)?r:{},gotrue_meta_security:{captcha_token:null==(i=null==e?void 0:e.options)?void 0:i.captchaToken}},xform:to});if(n||!s)return{data:{user:null,session:null},error:n};let a=s.session,o=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:o,session:a},error:null}}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async signUp(e){var t,r,i;try{let s;if("email"in e){let{email:r,password:i,options:n}=e,a=null,o=null;"pkce"===this.flowType&&([a,o]=await e4(this.storage,this.storageKey)),s=await tn(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:r,password:i,data:null!=(t=null==n?void 0:n.data)?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:to})}else if("phone"in e){let{phone:t,password:n,options:a}=e;s=await tn(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!=(r=null==a?void 0:a.data)?r:{},channel:null!=(i=null==a?void 0:a.channel)?i:"sms",gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:to})}else throw new eC("You must provide either an email or phone number and a password");let{data:n,error:a}=s;
21if(a||!n)return{data:{user:null,session:null},error:a};let o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if("email"in e){let{email:r,password:i,options:s}=e;t=await tn(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:tl})}else if("phone"in e){let{phone:r,password:i,options:s}=e;t=await tn(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:tl})}else throw new eC("You must provide either an email or phone number and a password");let{data:r,error:i}=t;if(i)return{data:{user:null,session:null},error:i};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new eP};return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:i}}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:null==(t=e.options)?void 0:t.redirectTo,scopes:null==(r=e.options)?void 0:r.scopes,queryParams:null==(i=e.options)?void 0:i.queryParams,skipBrowserRedirect:null==(s=e.options)?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:t}=e;if("solana"===t)return await this.signInWithSolana(e);throw Error(`@supabase/auth-js: Unsupported chain "${t}"`)}async signInWithSolana(e){var t,r,i,s,n,a,o,l,u,c,h,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{let h,{chain:d,wallet:g,statement:y,options:m}=e;if(eW())if("object"==typeof g)h=g;else{let e=window;if("solana"in e&&"object"==typeof e.solana&&("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))h=e.solana;else throw Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof g||!(null==m?void 0:m.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");h=g}let v=new URL(null!=(t=null==m?void 0:m.url)?t:window.location.href);if("signIn"in h&&h.signIn){let e,t=await h.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==m?void 0:m.signInWithSolana),{version:"1",domain:v.host,uri:v.href}),y?{statement:y}:null));if(Array.isArray(t)&&t[0]&&"object"==typeof t[0])e=t[0];else if(t&&"object"==typeof t&&"signedMessage"in t&&"signature"in t)e=t;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in e&&"signature"in e&&("string"==typeof e.signedMessage||e.signedMessage instanceof Uint8Array)&&e.signature instanceof Uint8Array)f="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),p=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in h)||"function"!=typeof h.signMessage||!("publicKey"in h)||"object"!=typeof h||!h.publicKey||!("toBase58"in h.publicKey)||"function"!=typeof h.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");f=[`${v.host} wants you to sign in with your Solana account:`,h.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${v.href}`,`Issued At: ${null!=(i=null==(r=null==m?void 0:m.signInWithSolana)?void 0:r.issuedAt)?i:new Date().toISOString()}`,...(null==(s=null==m?void 0:m.signInWithSolana)?void 0:s.notBefore)?[`Not Before: ${m.signInWithSolana.notBefore}`]:[],...(null==(n=null==m?void 0:m.signInWithSolana)?void 0:n.expirationTime)?[`Expiration Time: ${m.signInWithSolana.expirationTime}`]:[],...(null==(a=null==m?void 0:m.signInWithSolana)?void 0:a.chainId)?[`Chain ID: ${m.signInWithSolana.chainId}`]:[],...(null==(o=null==m?void 0:m.signInWithSolana)?void 0:o.nonce)?[`Nonce: ${m.signInWithSolana.nonce}`]:[],...(null==(l=null==m?void 0:m.signInWithSolana)?void 0:l.requestId)?[`Request ID: ${m.signInWithSolana.requestId}`]:[],...(null==(c=null==(u=null==m?void 0:m.signInWithSolana)?void 0:u.resources)?void 0:c.length)?["Resources",...m.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await h.signMessage(new TextEncoder().encode(f),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");p=e}}try{let{data:t,error:r}=await tn(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:f,signature:function(e){let t=[],r={queue:0,queuedBits:0},i=e=>{t.push(e)};
21return e.forEach(e=>eM(e,r,i)),eM(null,r,i),t.join("")}(p)},(null==(h=e.options)?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:to});if(r)throw r;if(!t||!t.session||!t.user)return{data:{user:null,session:null},error:new eP};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign({},t),error:r}}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async _exchangeCodeForSession(e){let t=await eQ(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(null!=t?t:"").split("/");try{let{data:t,error:s}=await tn(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:to});if(await eY(this.storage,`${this.storageKey}-code-verifier`),s)throw s;if(!t||!t.session||!t.user)return{data:{user:null,session:null,redirectType:null},error:new eP};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign(Object.assign({},t),{redirectType:null!=i?i:null}),error:s}}catch(e){if(eT(e))return{data:{user:null,session:null,redirectType:null},error:e};throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:i,access_token:s,nonce:n}=e,{data:a,error:o}=await tn(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:s,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:to});if(o)return{data:{user:null,session:null},error:o};if(!a||!a.session||!a.user)return{data:{user:null,session:null},error:new eP};return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:a,error:o}}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,i,s,n;try{if("email"in e){let{email:i,options:s}=e,n=null,a=null;"pkce"===this.flowType&&([n,a]=await e4(this.storage,this.storageKey));let{error:o}=await tn(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:null!=(t=null==s?void 0:s.data)?t:{},create_user:null==(r=null==s?void 0:s.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==s?void 0:s.emailRedirectTo});return{data:{user:null,session:null},error:o}}if("phone"in e){let{phone:t,options:r}=e,{data:a,error:o}=await tn(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(i=null==r?void 0:r.data)?i:{},create_user:null==(s=null==r?void 0:r.shouldCreateUser)||s,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(n=null==r?void 0:r.channel)?n:"sms"}});return{data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o}}throw new eC("You must provide either an email or phone number.")}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let i,s;"options"in e&&(i=null==(t=e.options)?void 0:t.redirectTo,s=null==(r=e.options)?void 0:r.captchaToken);let{data:n,error:a}=await tn(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:to});if(a)throw a;if(!n)throw Error("An error occurred on token verification.");let o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,i;try{let s=null,n=null;return"pkce"===this.flowType&&([s,n]=await e4(this.storage,this.storageKey)),await tn(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!=(r=null==(t=e.options)?void 0:t.redirectTo)?r:void 0}),(null==(i=null==e?void 0:e.options)?void 0:i.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:n}),headers:this.headers,xform:tc})}catch(e){if(eT(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=>{let{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new eI;let{error:i}=await tn(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:i}})}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:r,type:i,options:s}=e,{error:n}=await tn(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},redirectTo:null==s?void 0:s.emailRedirectTo});return{data:{user:null,session:null},error:n}}if("phone"in e){let{phone:r,type:i,options:s}=e,{data:n,error:a}=await tn(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}}});return{data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a}}throw new eC("You must provide either an email or phone number and a type")}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let 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{let 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!",Error().stack);try{let e=null,t=await eQ(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 val
21id"),await this._removeSession())),!e)return{data:{session:null},error:null};let r=!!e.expires_at&&1e3*e.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){let t=await eQ(this.userStorage,this.storageKey+"-user");(null==t?void 0:t.user)?e.user=t.user:e.user=e7()}if(this.storage.isServer&&e.user){let t=this.suppressGetSessionWarning;e=new Proxy(e,{get:(e,r,i)=>(t||"user"!==r||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t=!0,this.suppressGetSessionWarning=!0),Reflect.get(e,r,i))})}return{data:{session:e},error:null}}let{session:i,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return{data:{session:null},error:s};return{data:{session:i},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{if(e)return await tn(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:tu});return await this._useSession(async e=>{var t,r,i;let{data:s,error:n}=e;if(n)throw n;return(null==(t=s.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await tn(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(i=null==(r=s.session)?void 0:r.access_token)?i:void 0,xform:tu}):{data:{user:null},error:new eI}})}catch(e){if(eT(e))return eT(e)&&"AuthSessionMissingError"===e.name&&(await this._removeSession(),await eY(this.storage,`${this.storageKey}-code-verifier`)),{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 r=>{let{data:i,error:s}=r;if(s)throw s;if(!i.session)throw new eI;let n=i.session,a=null,o=null;"pkce"===this.flowType&&null!=e.email&&([a,o]=await e4(this.storage,this.storageKey));let{data:l,error:u}=await tn(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:tu});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers("USER_UPDATED",n),{data:{user:n.user},error:null}})}catch(e){if(eT(e))return{data:{user:null},error:e};throw 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 eI;let t=Date.now()/1e3,r=t,i=!0,s=null,{payload:n}=e0(e.access_token);if(n.exp&&(i=(r=n.exp)<=t),i){let{session:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return{data:{user:null,session:null},error:r};if(!t)return{data:{user:null,session:null},error:null};s=t}else{let{data:i,error:n}=await this._getUser(e.access_token);if(n)throw n;s={access_token:e.access_token,refresh_token:e.refresh_token,user:i.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return{data:{user:s.user,session:s},error:null}}catch(e){if(eT(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 r;if(!e){let{data:i,error:s}=t;if(s)throw s;e=null!=(r=i.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new eI;let{session:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?{data:{user:null,session:null},error:s}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(eT(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e,t){try{if(!eW())throw new eR("No browser detected.");
21if(e.error||e.error_description||e.error_code)throw new eR(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new ez("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new eR("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new ez("No code detected.");let{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;let i=new URL(window.location.href);return i.searchParams.delete("code"),window.history.replaceState(window.history.state,"",i.toString()),{data:{session:t.session,redirectType:null},error:null}}let{provider_token:r,provider_refresh_token:i,access_token:s,refresh_token:n,expires_in:a,expires_at:o,token_type:l}=e;if(!s||!a||!n||!l)throw new eR("No session defined in URL");let u=Math.round(Date.now()/1e3),c=parseInt(a),h=u+c;o&&(h=parseInt(o));let d=h-u;1e3*d<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${d}s, should have been closer to ${c}s`);let f=h-c;u-f>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",f,h,u):u-f<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",f,h,u);let{data:p,error:g}=await this._getUser(s);if(g)throw g;let y={provider_token:r,provider_refresh_token:i,access_token:s,expires_in:c,expires_at:h,refresh_token:n,token_type:l,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:e.type},error:null}}catch(e){if(eT(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await eQ(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 r;let{data:i,error:s}=t;if(s)return{error:s};let n=null==(r=i.session)?void 0:r.access_token;if(n){let{error:t}=await this.admin.signOut(n,e);if(t&&!(eT(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await eY(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){let t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),r={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,r),(async()=>{await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,i;try{let{data:{session:i},error:s}=t;if(s)throw s;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(t){await (null==(i=this.stateChangeEmitters.get(e))?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,i=null;"pkce"===this.flowType&&([r,i]=await e4(this.storage,this.storageKey,!0));try{return await tn(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(eT(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return{data:{identities:null!=(e=t.user.identities)?e:[]},error:null}}catch(e){if(eT(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{let{data:r,error:i}=await this._useSession(async t=>{var r,i,s,n,a;let{data:o,error:l}=t;if(l)throw l;let u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null==(r=e.options)?void 0:r.redirectTo,scopes:null==(i=e.options)?void 0:i.scopes,queryParams:null==(s=e.options)?void 0:s.queryParams,skipBrowserRedirect:!0});return await tn(this.fetch,"GET",u,{headers:this.headers,jwt:null!=(a=null==(n=o.session)?void 0:n.access_token)?a:void 0})});if(i)throw i;return!eW()||(null==(t=e.options)?void 0:t.skipBrowserRedirect)||window.location.assign(null==r?void 0:r.url),{data:{provider:e.provider,url:null==r?void 0:r.url},error:null}}catch(t){if(eT(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,i;let{data:s,error:n}=t;if(n)throw n;
21return await tn(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(i=null==(r=s.session)?void 0:r.access_token)?i:void 0})})}catch(e){if(eT(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{var r,i;let s=Date.now();return await (r=async r=>(r>0&&await e1(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await tn(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:to})),i=(e,t)=>{let r=200*Math.pow(2,e);return t&&eL(t)&&Date.now()+r-s<3e4},new Promise((e,t)=>{(async()=>{for(let s=0;s<1/0;s++)try{let t=await r(s);if(!i(s,null,t))return void e(t)}catch(e){if(!i(s,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),eT(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let r=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",r),eW()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let i=await eQ(this.storage,this.storageKey);if(i&&this.userStorage){let t=await eQ(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:i.user},await eG(this.userStorage,this.storageKey+"-user",t)),i.user=null!=(e=null==t?void 0:t.user)?e:e7()}else if(i&&!i.user&&!i.user){let e=await eQ(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(i.user=e.user,await eY(this.storage,this.storageKey+"-user"),await eG(this.storage,this.storageKey,i)):i.user=e7()}if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),null!==i&&await this._removeSession();return}let s=(null!=(t=i.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${s?"":" not"} expired with margin of 90000s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:e}=await this._callRefreshToken(i.refresh_token);e&&(console.error(e),eL(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(i.user&&!0===i.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(i.access_token);!t&&(null==e?void 0:e.user)?(i.user=e.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(e){console.error("Error getting user data:",e),this._debug(r,"error getting user data, skipping SIGNED_IN notification",e)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(e){this._debug(r,"error",e),console.error(e);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new eI;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new eX;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new eI;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let i={session:t.session,error:null};return this.refreshingDeferred.resolve(i),i}catch(e){if(this._debug(i,"error",e),eT(e)){let r={session:null,error:e};return eL(e)||await this._removeSession(),null==(t=this.refreshingDeferred)||t.resolve(r),r}throw null==(r=this.refreshingDeferred)||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,t,r=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let i=[],s=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){i.push(e)}});if(await Promise.all(s),i.length>0){for(let e=0;e<i.length;e+=1)console.error(i[e]);throw i[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await eG(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let i=te(e);await eG(this.storage,this.storageKey,i)}else{let e=te(t);await eG(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),await eY(this.storage,this.storageKey),await eY(this.storage,this.storageKey+"-code-verifier"),await eY(this.storage,this.storageKey+"-user"),this.userStorage&&await eY(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&eW()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
21catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);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()");let 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{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let i=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),i<=3&&await this._callRefreshToken(r.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 tv)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!eW()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let 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()=>{if("visible"!==document.visibilityState)return void this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let i=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&i.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&i.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await e4(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});i.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);i.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&i.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:i,error:s}=t;return s?{data:null,error:s}:await tn(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==i?void 0:i.session)?void 0:r.access_token})})}catch(e){if(eT(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,i;let{data:s,error:n}=t;if(n)return{data:null,error:n};let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:{issuer:e.issuer}),{data:o,error:l}=await tn(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:null==(r=null==s?void 0:s.session)?void 0:r.access_token});return l?{data:null,error:l}:("totp"===e.factorType&&(null==(i=null==o?void 0:o.totp)?void 0:i.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(e){if(eT(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:i,error:s}=t;if(s)return{data:null,error:s};let{data:n,error:a}=await tn(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null==(r=null==i?void 0:i.session)?void 0:r.access_token});return a?{data:null,error:a}:(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:a})})}catch(e){if(eT(e))return{data:null,error:e};throw e}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:i,error:s}=t;return s?{data:null,error:s}:await tn(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:{channel:e.channel},headers:this.headers,jwt:null==(r=null==i?void 0:i.session)?void 0:r.access_token})})}catch(e){if(eT(e))return{data:null,error:e};throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){let{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};let r=(null==e?void 0:e.factors)||[],i=r.filter(e=>"totp"===e.factor_type&&"verified"===e.status),s=r.filter(e=>"phone"===e.factor_type&&"verified"===e.status);return{data:{all:r,totp:i,phone:s},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,r;let{data:{session:i},error:s}=e;if(s)return{data:null,error:s};if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:n}=e0(i.access_token),a=null;n.aal&&(a=n.aal);let o=a;return(null!=(r=null==(t=i.user.factors)?void 0:t.filter(e=>"verified"===e.status))?r:[]).length>0&&(o="aal2"),{data:{currentLevel:a,nextLevel:o,currentAuthenticationMethods:n.amr||[]},error:null}}))}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;let i=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>i)return r;let{data:s,error:n}=await tn(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return s.keys&&0!==s.keys.length&&(this.jwks=s,this.jwks_cached_at=i,r=s.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{let r=e;if(!r){let{data:e,error:t}
21=await this.getSession();if(t||!e.session)return{data:null,error:t};r=e.session.access_token}let{header:i,payload:s,signature:n,raw:{header:a,payload:o}}=e0(r);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(s.exp);let l=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!l){let{error:e}=await this.getUser(r);if(e)throw e;return{data:{claims:s,header:i,signature:n},error:null}}let u=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(i.alg),c=await crypto.subtle.importKey("jwk",l,u,!0,["verify"]);if(!await crypto.subtle.verify(u,c,n,function(e){let t=[];return!function(e,t){for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i>55295&&i<=56319){let t=(i-55296)*1024&65535;i=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(i,t)}}(e,e=>t.push(e)),new Uint8Array(t)}(`${a}.${o}`)))throw new eD("Invalid JWT signature");return{data:{claims:s,header:i,signature:n},error:null}}catch(e){if(eT(e))return{data:null,error:e};throw e}}}tE.nextInstanceID=0;let tA=tE;class tx extends tA{constructor(e){super(e)}}class tT{constructor(e,t,r){var i,s,n;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw Error("supabaseUrl is required.");if(!t)throw Error("supabaseKey is required.");let a=new URL(function(e){return e.endsWith("/")?e:e+"/"}(e));this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let o=`sb-${a.hostname.split(".")[0]}-auth-token`,u=function(e,t){var r,i;let{db:s,auth:n,realtime:a,global:o}=e,{db:l,auth:u,realtime:c,global:h}=t,d={db:Object.assign(Object.assign({},l),s),auth:Object.assign(Object.assign({},u),n),realtime:Object.assign(Object.assign({},c),a),storage:{},global:Object.assign(Object.assign(Object.assign({},h),o),{headers:Object.assign(Object.assign({},null!=(r=null==h?void 0:h.headers)?r:{}),null!=(i=null==o?void 0:o.headers)?i:{})}),accessToken:()=>{var e,t,r,i;return e=this,t=void 0,i=function*(){return""},new(r=void 0,r=Promise)(function(s,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function o(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})}};return e.accessToken?d.accessToken=e.accessToken:delete d.accessToken,d}(null!=r?r:{},{db:em,realtime:eb,auth:Object.assign(Object.assign({},ev),{storageKey:o}),global:ey});this.storageKey=null!=(i=u.auth.storageKey)?i:"",this.headers=null!=(s=u.global.headers)?s:{},u.accessToken?(this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(n=u.auth)?n:{},this.headers,u.global.fetch),this.fetch=((e,t,r)=>{let i=(e=>{let t;return t=e||("undefined"==typeof fetch?e_.default:fetch),(...e)=>t(...e)})(r),s="undefined"==typeof Headers?e_.Headers:Headers;return(r,n)=>(function(e,t,r,i){return new(r||(r=Promise))(function(s,n){function a(e){try{l(i.next(e))}catch(e){n(e)}}function o(e){try{l(i.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?s(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,o)}l((i=i.apply(e,t||[])).next())})})(void 0,void 0,void 0,function*(){var a;let o=null!=(a=yield t())?a:e,l=new s(null==n?void 0:n.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${o}`),i(r,Object.assign(Object.assign({},n),{headers:l}))})})(t,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},u.realtime)),this.rest=new l(new URL("rest/v1",a).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this.storage=new ep(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new o(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={}){return this.rest.rpc(e,t,r)}
21channel(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,r,i,s,n;return r=this,i=void 0,s=void 0,n=function*(){if(this.accessToken)return yield this.accessToken();let{data:r}=yield this.auth.getSession();return null!=(t=null==(e=r.session)?void 0:e.access_token)?t:this.supabaseKey},new(s||(s=Promise))(function(e,t){function a(e){try{l(n.next(e))}catch(e){t(e)}}function o(e){try{l(n.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof s?r:new s(function(e){e(r)})).then(a,o)}l((n=n.apply(r,i||[])).next())})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:i,storageKey:s,flowType:n,lock:a,debug:o},l,u){let c={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new tx({url:this.authUrl.href,headers:Object.assign(Object.assign({},c),l),storageKey:s,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:i,flowType:n,lock:a,debug:o,fetch:u,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new W(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e)&&this.changedAccessToken!==r?this.changedAccessToken=r:"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}}var tj=r(95704);let tO=(e,t,r)=>new tT(e,t,r);(function(){if("undefined"!=typeof window||void 0===tj)return!1;let e=tj.version;if(null==e)return!1;let t=e.match(/^v(\d+)\./);return!!t&&18>=parseInt(t[1],10)})()&&console.warn(`â ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217`)},66942:(e,t,r)=>{"use strict";r.d(t,{u:()=>d});var i=r(22544);let s=(e,t,r)=>{if(e&&"reportValidity"in e){let s=(0,i.Jt)(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},n=(e,t)=>{for(let r in t.fields){let i=t.fields[r];i&&i.ref&&"reportValidity"in i.ref?s(i.ref,r,e):i&&i.refs&&i.refs.forEach(t=>s(t,r,e))}},a=(e,t)=>{t.shouldUseNativeValidation&&n(e,t);let r={};for(let s in e){let n=(0,i.Jt)(t.fields,s),a=Object.assign(e[s]||{},{ref:n&&n.ref});if(o(t.names||Object.keys(e),s)){let e=Object.assign({},(0,i.Jt)(r,s));(0,i.hZ)(e,"root",a),(0,i.hZ)(r,s,e)}else(0,i.hZ)(r,s,a)}return r},o=(e,t)=>{let r=l(t);return e.some(e=>l(e).match(`^${r}\\.\\d+`))};function l(e){return e.replace(/\]|\[/g,"")}var u=r(48956),c=r(41954);function h(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}function d(e,t,r){if(void 0===r&&(r={}),"_def"in e&&"object"==typeof e._def&&"typeName"in e._def)return function(s,o,l){try{return Promise.resolve(h(function(){return Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](s,t)).then(function(e){return l.shouldUseNativeValidation&&n({},l),{errors:{},values:r.raw?Object.assign({},s):e}})},function(e){if(Array.isArray(null==e?void 0:e.issues))return{values:{},errors:a(function(e,t){for(var r={};e.length;){var s=e[0],n=s.code,a=s.message,o=s.path.join(".");if(!r[o])if("unionErrors"in s){var l=s.unionErrors[0].errors[0];r[o]={message:l.message,type:l.code}}else r[o]={message:a,type:n};if("unionErrors"in s&&s.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var u=r[o].types,c=u&&u[s.code];r[o]=(0,i.Gb)(o,t,r,n,c?[].concat(c,s.message):s.message)}e.shift()}return r}(e.errors,!l.shouldUseNativeValidation&&"all"===l.criteriaMode),l)};throw e}))}catch(e){return Promise.reject(e)}};if("_zod"in e&&"object"==typeof e._zod)return function(s,o,l){try{return Promise.resolve(h(function(){return Promise.resolve(("sync"===r.mode?u.qg:u.EJ)(e,s,t)).then(function(e){return l.shouldUseNativeValidation&&n({},l),{errors:{},values:r.raw?Object.assign({},s):e}})},function(e){if(e instanceof c.a$)return{values:{},errors:a(function(e,t){for(var r={};e.length;){var s=e[0],n=s.code,a=s.message,o=s.path.join(".");
21if(!r[o])if("invalid_union"===s.code&&s.errors.length>0){var l=s.errors[0][0];r[o]={message:l.message,type:l.code}}else r[o]={message:a,type:n};if("invalid_union"===s.code&&s.errors.forEach(function(t){return t.forEach(function(t){return e.push(t)})}),t){var u=r[o].types,c=u&&u[s.code];r[o]=(0,i.Gb)(o,t,r,n,c?[].concat(c,s.message):s.message)}e.shift()}return r}(e.issues,!l.shouldUseNativeValidation&&"all"===l.criteriaMode),l)};throw e}))}catch(e){return Promise.reject(e)}};throw Error("Invalid input: not a Zod schema")}},71847:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var i=r(12115);let s=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},n=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let o=(0,i.forwardRef)((e,t)=>{let{color:r="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:l,className:u="",children:c,iconNode:h,...d}=e;return(0,i.createElement)("svg",{ref:t,...a,width:s,height:s,stroke:r,strokeWidth:l?24*Number(o)/Number(s):o,className:n("lucide",u),...!c&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(d)&&{"aria-hidden":"true"},...d},[...h.map(e=>{let[t,r]=e;return(0,i.createElement)(t,r)}),...Array.isArray(c)?c:[c]])}),l=(e,t)=>{let r=(0,i.forwardRef)((r,a)=>{let{className:l,...u}=r;return(0,i.createElement)(o,{ref:a,iconNode:t,className:n("lucide-".concat(s(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),"lucide-".concat(e),l),...u})});return r.displayName=s(e),r}},72377:(e,t,r)=>{"use strict";r.d(t,{EB:()=>tg,ai:()=>tU,Ik:()=>tZ,Yj:()=>tp});var i=r(5426);let s=/^[cC][^\s-]{8,}$/,n=/^[0-9a-z]+$/,a=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,o=/^[0-9a-vA-V]{20}$/,l=/^[A-Za-z0-9]{27}$/,u=/^[a-zA-Z0-9_-]{21}$/,c=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,h=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,d=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,f=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,p=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,g=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,y=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,m=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,v=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,b=/^[A-Za-z0-9_-]*$/,_=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,w=/^\+(?:[0-9]){6,14}[0-9]$/,k="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",S=RegExp(`^${k}$`);function E(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let A=/^\d+$/,x=/^-?\d+(?:\.\d+)?/i,T=/^[^A-Z]*$/,j=/^[^a-z]*$/;var O=r(26713);let $=i.xI("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),I={number:"number",bigint:"bigint",object:"date"},P=i.xI("$ZodCheckLessThan",(e,t)=>{$.init(e,t);let r=I[typeof t.value];e._zod.onattach.push(e=>
21{let r=e._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<i&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:r,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),C=i.xI("$ZodCheckGreaterThan",(e,t)=>{$.init(e,t);let r=I[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>i&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),R=i.xI("$ZodCheckMultipleOf",(e,t)=>{$.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===O.LG(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),z=i.xI("$ZodCheckNumberFormat",(e,t)=>{$.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),i=r?"int":"number",[s,n]=O.zH[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=s,i.maximum=n,r&&(i.pattern=A)}),e._zod.check=a=>{let o=a.value;if(r){if(!Number.isInteger(o))return void a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?a.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}))}o<s&&a.issues.push({origin:"number",input:o,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),o>n&&a.issues.push({origin:"number",input:o,code:"too_big",maximum:n,inst:e})}}),U=i.xI("$ZodCheckMaxLength",(e,t)=>{var r;$.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!O.cl(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let i=r.value;if(i.length<=t.maximum)return;let s=O.Rc(i);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),L=i.xI("$ZodCheckMinLength",(e,t)=>{var r;$.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!O.cl(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let i=r.value;if(i.length>=t.minimum)return;let s=O.Rc(i);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),N=i.xI("$ZodCheckLengthEquals",(e,t)=>{var r;$.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return!O.cl(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let i=r.value,s=i.length;if(s===t.length)return;let n=O.Rc(i),a=s>t.length;r.issues.push({origin:n,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),D=i.xI("$ZodCheckStringFormat",(e,t)=>{var r,i;$.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),B=i.xI("$ZodCheckRegex",(e,t)=>{D.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),F=i.xI("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=T),D.init(e,t)}),V=i.xI("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=j),D.init(e,t)}),M=i.xI("$ZodCheckIncludes",(e,t)=>{$.init(e,t);let r=O.$f(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input
21:r.value,inst:e,continue:!t.abort})}}),Z=i.xI("$ZodCheckStartsWith",(e,t)=>{$.init(e,t);let r=RegExp(`^${O.$f(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),q=i.xI("$ZodCheckEndsWith",(e,t)=>{$.init(e,t);let r=RegExp(`.*${O.$f(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),W=i.xI("$ZodCheckOverwrite",(e,t)=>{$.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class J{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}var K=r(48956);let H={major:4,minor:0,patch:17},G=i.xI("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=H;let s=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&s.unshift(e),s))for(let r of t._zod.onattach)r(e);if(0===s.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let s,n=O.QH(e);for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(n)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&r?.async===!1)throw new i.GT;if(s||o instanceof Promise)s=(s??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(n||(n=O.QH(e,t)))});else{if(e.issues.length===t)continue;n||(n=O.QH(e,t))}}return s?s.then(()=>e):e};e._zod.run=(r,n)=>{let a=e._zod.parse(r,n);if(a instanceof Promise){if(!1===n.async)throw new i.GT;return a.then(e=>t(e,s,n))}return t(a,s,n)}}e["~standard"]={validate:t=>{try{let r=(0,K.xL)(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return(0,K.bp)(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Q=i.xI("$ZodString",(e,t)=>{G.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return RegExp(`^${t}$`)})(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Y=i.xI("$ZodStringFormat",(e,t)=>{D.init(e,t),Q.init(e,t)}),X=i.xI("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=h),Y.init(e,t)}),ee=i.xI("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=d(e))}else t.pattern??(t.pattern=d());Y.init(e,t)}),et=i.xI("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=f),Y.init(e,t)}),er=i.xI("$ZodURL",(e,t)=>{Y.init(e,t),e._zod.check=r=>{try{let i=r.value.trim(),s=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:_.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=s.href:r.value=i;return}catch(i){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ei=i.xI("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Y.init(e,t)}),es=i.xI("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=u),Y.init(e,t)}),en=i.xI("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=s),Y.init(e,t)}),ea=i.xI("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=n),Y.init(e,t)}),eo=i.xI("$ZodULID",(e,t)=>{t.pattern??(t.pattern=a),Y.init(e,t)}),el=i.xI("$ZodXID",(e,t)=>{t.pattern??(t.pattern=o),Y.init(e,t)}),eu=i.xI("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=l),Y.init(e,t)}),ec=i.xI("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){let t=E({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${r.join("|")})`;return RegExp(`^${k}T(?:${i})$`)}(t)),Y.init(e,t)}),eh=i.xI("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=S),Y.init(e,t)}),ed=i.xI("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${E(t)}$`)),Y.init(e,t)}),ef=i.xI("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=c),Y.init(e,t)}),ep=i.xI("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=p),Y.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),eg=i.xI("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=g),Y.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),ey=i.xI("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=y),Y.init(e,t)}),em=i.xI("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=m),Y.init(e,t),e._zod.check=r=>{let[i,s]=r.value.split("/");try{if(!s)throw Error();let e=Number(s);if(`${e}`!==s||e<0||e>128)throw Error();new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function ev(e){if(""===e)return!0;
21if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let eb=i.xI("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=v),Y.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{ev(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),e_=i.xI("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=b),Y.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{!function(e){if(!b.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return ev(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ew=i.xI("$ZodE164",(e,t)=>{t.pattern??(t.pattern=w),Y.init(e,t)}),ek=i.xI("$ZodJWT",(e,t)=>{Y.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[i]=r;if(!i)return!1;let s=JSON.parse(atob(i));if("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),eS=i.xI("$ZodNumber",(e,t)=>{G.init(e,t),e._zod.pattern=e._zod.bag.pattern??x,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let s=r.value;if("number"==typeof s&&!Number.isNaN(s)&&Number.isFinite(s))return r;let n="number"==typeof s?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...n?{received:n}:{}}),r}}),eE=i.xI("$ZodNumber",(e,t)=>{z.init(e,t),eS.init(e,t)}),eA=i.xI("$ZodUnknown",(e,t)=>{G.init(e,t),e._zod.parse=e=>e}),ex=i.xI("$ZodNever",(e,t)=>{G.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function eT(e,t,r){e.issues.length&&t.issues.push(...O.lQ(r,e.issues)),t.value[r]=e.value}let ej=i.xI("$ZodArray",(e,t)=>{G.init(e,t),e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let n=[];for(let e=0;e<s.length;e++){let a=s[e],o=t.element._zod.run({value:a,issues:[]},i);o instanceof Promise?n.push(o.then(t=>eT(t,r,e))):eT(o,r,e)}return n.length?Promise.all(n).then(()=>r):r}});function eO(e,t,r,i){e.issues.length&&t.issues.push(...O.lQ(r,e.issues)),void 0===e.value?r in i&&(t.value[r]=void 0):t.value[r]=e.value}let e$=i.xI("$ZodObject",(e,t)=>{let r,s;G.init(e,t);let n=O.PO(()=>{let e=Object.keys(t.shape);for(let r of e)if(!t.shape[r]._zod.traits.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let r=O.NM(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}});O.gJ(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let i=e[t]._zod;if(i.values)for(let e of(r[t]??(r[t]=new Set),i.values))r[t].add(e)}return r});let a=O.Gv,o=!i.cr.jitless,l=O.hI,u=o&&l.value,c=t.catchall;e._zod.parse=(i,l)=>{s??(s=n.value);let h=i.value;if(!a(h))return i.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),i;let d=[];if(o&&u&&l?.async===!1&&!0!==l.jitless)r||(r=(e=>{let t=new J(["shape","payload","ctx"]),r=n.value,i=e=>{let t=O.UQ(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let s=Object.create(null),a=0;for(let e of r.keys)s[e]=`key_${a++}`;for(let e of(t.write("const newResult = {}"),r.keys)){let r=s[e],n=O.UQ(e);t.write(`const ${r} = ${i(e)};`),t.write(` 22 if (${r}.issues.length) { 23 payload.issues = payload.issues.concat(${r}.issues.map(iss => ({ 24 ...iss, 25 path: iss.path ? [${n}, ...iss.path] : [${n}] 26 }))); 27 } 28 29 if (${r}.value === undefined) { 30 if (${n} in input) { 31 newResult[${n}] = undefined; 32 } 33 } else { 34 newResult[${n}] = ${r}.value; 35 } 36 `)}t.write("payload.value = newResult;"),t.write("return payload;");let o=t.compile();return(t,r)=>o(e,t,r)})(t.shape)),i=r(i,l);else{i.value={};let e=s.shape;for(let t of s.keys){let r=e[t]._zod.run({value:h[t],issues:[]},l);r instanceof Promise?d.push(r.then(e=>eO(e,i,t,h))):eO(r,i,t,h)}}if(!c)return d.length?Promise.all(d).then(()=>i):i;let f=[],p=s.keySet,g=c._zod,y=g.def.type;for(let e of Object.keys(h)){if(p.has(e))continue;if("never"===y){f.push(e);continue}let t=g.run({value:h[e],issues:[]},l);t instanceof Promise?d.push(t.then(t=>eO(t,i,e,h))):eO(t,i,e,h)}return(f.length&&i.issues.push({code:"unrecognized_keys",keys:f,input:h,inst:e}),d.length)?Promise.all(d).then(()=>i):i}});function eI(e,t,r,s){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let n=e.filter(e=>!O.QH(e));return 1===n.length?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>O.iR(e,s,i.$W())))}),t)}let eP=i.xI("$ZodUnion",(e,t)=>{G.init(e,t),O.gJ(e._zod,"optin",()=>t.options.some(e=>
36"optional"===e._zod.optin)?"optional":void 0),O.gJ(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),O.gJ(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),O.gJ(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>O.p6(e.source)).join("|")})$`)}});let r=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(s,n)=>{if(r)return i(s,n);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:s.value,issues:[]},n);if(t instanceof Promise)o.push(t),a=!0;else{if(0===t.issues.length)return t;o.push(t)}}return a?Promise.all(o).then(t=>eI(t,s,e,n)):eI(o,s,e,n)}}),eC=i.xI("$ZodIntersection",(e,t)=>{G.init(e,t),e._zod.parse=(e,r)=>{let i=e.value,s=t.left._zod.run({value:i,issues:[]},r),n=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||n instanceof Promise?Promise.all([s,n]).then(([t,r])=>eR(e,t,r)):eR(e,s,n)}});function eR(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),O.QH(e))return e;let i=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(O.Qd(t)&&O.Qd(r)){let i=Object.keys(r),s=Object.keys(t).filter(e=>-1!==i.indexOf(e)),n={...t,...r};for(let i of s){let s=e(t[i],r[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let s=0;s<t.length;s++){let n=e(t[s],r[s]);if(!n.valid)return{valid:!1,mergeErrorPath:[s,...n.mergeErrorPath]};i.push(n.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}let ez=i.xI("$ZodEnum",(e,t)=>{G.init(e,t);let r=O.w5(t.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=RegExp(`^(${r.filter(e=>O.qQ.has(typeof e)).map(e=>"string"==typeof e?O.$f(e):e.toString()).join("|")})$`),e._zod.parse=(t,s)=>{let n=t.value;return i.has(n)||t.issues.push({code:"invalid_value",values:r,input:n,inst:e}),t}}),eU=i.xI("$ZodTransform",(e,t)=>{G.init(e,t),e._zod.parse=(e,r)=>{let s=t.transform(e.value,e);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(t=>(e.value=t,e));if(s instanceof Promise)throw new i.GT;return e.value=s,e}});function eL(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}let eN=i.xI("$ZodOptional",(e,t)=>{G.init(e,t),e._zod.optin="optional",e._zod.optout="optional",O.gJ(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),O.gJ(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${O.p6(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(t=>eL(t,e.value)):eL(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),eD=i.xI("$ZodNullable",(e,t)=>{G.init(e,t),O.gJ(e._zod,"optin",()=>t.innerType._zod.optin),O.gJ(e._zod,"optout",()=>t.innerType._zod.optout),O.gJ(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${O.p6(e.source)}|null)$`):void 0}),O.gJ(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),eB=i.xI("$ZodDefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",O.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if(void 0===e.value)return e.value=t.defaultValue,e;let i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>eF(e,t)):eF(i,t)}});function eF(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let eV=i.xI("$ZodPrefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",O.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>(void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),eM=i.xI("$ZodNonOptional",(e,t)=>{G.init(e,t),O.gJ(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,i)=>{let s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(t=>eZ(t,e)):eZ(s,e)}});function eZ(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let eq=i.xI("$ZodCatch",(e,t)=>{G.init(e,t),O.gJ(e._zod,"optin",()=>t.innerType._zod.optin),O.gJ(e._zod,"optout",()=>t.innerType._zod.optout),O.gJ(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{let s=t.innerType._zod.run(e,r);return s instanceof Promise?s.then(s=>(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>O.iR(e,r,i.$W()))},input:e.value}),e.issues=[]),e)):(e.value=s.value,s.issues.length&&(e.value=t.catchValue({...e,error:{issues:s.issues.map(e=>O.iR(e,r,i.$W()))},input:e.value}),e.issues=[]),e)}}),eW=i.xI("$ZodPipe",(e,t)=>{G.init(e,t),O.gJ(e._zod,"values",()=>t.in._zod.values),O.gJ(e._zod,"optin",()=>t.in._zod.optin),O.gJ(e._zod,"optout",()=>t.out._zod.optout),O.gJ(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{let i=t.in._zod.run(e,r);return i instanceof Promise?i.then(e=>eJ(e,t,r)):eJ(i,t,r)}});function eJ(e,t,r){return e.issues.length?e:t.out._zod.run({value:e.value,issues:e.issues},r)}let eK=i.xI("$ZodReadonly",(e,t)=>{G.init(e,t),O.gJ(e._zod,"propValues",()=>t.innerType._zod.propValues),O.gJ(e._zod,"values",()=>t.innerType._zod.values),O.gJ(e._zod,"optin",()=>t.innerType._zod.optin),O.gJ(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,r)=>{let i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(eH):eH(i)}});function eH(e){return e.value=Object.freeze(e.value),e}let eG=i.xI("$ZodCustom",(e,t)=>{$.init(e,t),G.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let i=r.value,s=t.fn(i);if(s instanceof Promise)return s.then(t=>eQ(t,r,i,e));eQ(s,r,i,e)}});function eQ(e,t,r,i){if(!e){let e={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(O.sn(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class eY{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}let eX=new eY;function e0(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O.A2(t)})}function e1(e,t){return new P({check:"less_than",...O.A2(t),value:e,inclusive:!1})}function e2(e,t){return new P({check:"less_than",...O.A2(t),value:e,inclusive:!0})}function e6(e,t){return new C({check:"greater_than",...O.A2(t),value:e,inclusive:!1})}function e5(e,t){return new C({check:"greater_than",...O.A2(t),value:e,inclusive:!0})}function e4(e,t){return new R({check:"multiple_of",...O.A2(t),value:e})}function e8(e,t){return new U({check:"max_length",...O.A2(t),maximum:e})}function e3(e,t){return new L({check:"min_length",...O.A2(t),minimum:e})}function e9(e,t){return new N({check:"length_equals",...O.A2(t),length:e})}function e7(e){return new W({check:"overwrite",tx:e})}let te=i.xI("ZodISODateTime",(e,t)=>{ec.init(e,t),tg.init(e,t)}),tt=i.xI("ZodISODate",(e,t)=>{eh.init(e,t),tg.init(e,t)}),tr=i.xI("ZodISOTime",(e,t)=>{ed.init(e,t),tg.init(e,t)}),ti=i.xI("ZodISODuration",(e,t)=>{ef.init(e,t),tg.init(e,t)});var ts=r(41954);let tn=(e,t)=>{ts.a$.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>ts.Wk(e,t)},flatten:{value:t=>ts.JM(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,O.k8,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,O.k8,2)}},isEmpty:{get:()=>0===e.issues.length}})};i.xI("ZodError",tn);let ta=i.xI("ZodError",tn,{Parent:Error}),to=K.Tj(ta),tl=K.Rb(ta),tu=K.Od(ta),tc=K.wG(ta),th=i.xI("ZodType",(e,t)=>(G.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,r)=>O.o8(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>to(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>tu(e,t,r),e.parseAsync=async(t,r)=>tl(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>tc(e,t,r),e.spa=e.safeParseAsync,e.refine=(t,r)=>e.check(function(e,t={}){return new t8({type:"custom",check:"custom",fn:e,...O.A2(t)})}(t,r)),e.superRefine=t=>e.check(function(e){let t=function(e,t){let r=new $({check:"custom",...O.A2(void 0)});return r._zod.check=e,r}(r=>(r.addIssue=e=>{"string"==typeof e?r.issues.push(O.sn(e,r.value,t._zod.def)):(e.fatal&&(e.continue=!1),e.code??(e.code="custom"),e.input??(e.input=r.value),e.inst??(e.inst=t),e.continue??(e.continue=!t._zod.def.abort),r.issues.push(O.sn(e)))},e(r.value,r)));return t}(t)),e.overwrite=t=>
36e.check(e7(t)),e.optional=()=>tG(e),e.nullable=()=>tY(e),e.nullish=()=>tG(tY(e)),e.nonoptional=t=>{var r,i;return r=e,i=t,new t1({type:"nonoptional",innerType:r,...O.A2(i)})},e.array=()=>(function(e,t){return new tV({type:"array",element:e,...O.A2(t)})})(e),e.or=t=>new tq({type:"union",options:[e,t],...O.A2(void 0)}),e.and=t=>new tW({type:"intersection",left:e,right:t}),e.transform=t=>t5(e,new tK({type:"transform",transform:t})),e.default=t=>(function(e,t){return new tX({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():O.yG(t)}})})(e,t),e.prefault=t=>(function(e,t){return new t0({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():O.yG(t)}})})(e,t),e.catch=t=>(function(e,t){return new t2({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})})(e,t),e.pipe=t=>t5(e,t),e.readonly=()=>new t4({type:"readonly",innerType:e}),e.describe=t=>{let r=e.clone();return eX.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>eX.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return eX.get(e);let r=e.clone();return eX.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),td=i.xI("_ZodString",(e,t)=>{Q.init(e,t),th.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new B({check:"string_format",format:"regex",...O.A2(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new M({check:"string_format",format:"includes",...O.A2(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Z({check:"string_format",format:"starts_with",...O.A2(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new q({check:"string_format",format:"ends_with",...O.A2(t),suffix:e})}(...t)),e.min=(...t)=>e.check(e3(...t)),e.max=(...t)=>e.check(e8(...t)),e.length=(...t)=>e.check(e9(...t)),e.nonempty=(...t)=>e.check(e3(1,...t)),e.lowercase=t=>e.check(new F({check:"string_format",format:"lowercase",...O.A2(t)})),e.uppercase=t=>e.check(new V({check:"string_format",format:"uppercase",...O.A2(t)})),e.trim=()=>e.check(e7(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return e7(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(e7(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(e7(e=>e.toUpperCase()))}),tf=i.xI("ZodString",(e,t)=>{Q.init(e,t),td.init(e,t),e.email=t=>e.check(new ty({type:"string",format:"email",check:"string_format",abort:!1,...O.A2(t)})),e.url=t=>e.check(new tb({type:"string",format:"url",check:"string_format",abort:!1,...O.A2(t)})),e.jwt=t=>e.check(new tR({type:"string",format:"jwt",check:"string_format",abort:!1,...O.A2(t)})),e.emoji=t=>e.check(new t_({type:"string",format:"emoji",check:"string_format",abort:!1,...O.A2(t)})),e.guid=t=>e.check(e0(tm,t)),e.uuid=t=>e.check(new tv({type:"string",format:"uuid",check:"string_format",abort:!1,...O.A2(t)})),e.uuidv4=t=>e.check(new tv({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O.A2(t)})),e.uuidv6=t=>e.check(new tv({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O.A2(t)})),e.uuidv7=t=>e.check(new tv({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O.A2(t)})),e.nanoid=t=>e.check(new tw({type:"string",format:"nanoid",check:"string_format",abort:!1,...O.A2(t)})),e.guid=t=>e.check(e0(tm,t)),e.cuid=t=>e.check(new tk({type:"string",format:"cuid",check:"string_format",abort:!1,...O.A2(t)})),e.cuid2=t=>e.check(new tS({type:"string",format:"cuid2",check:"string_format",abort:!1,...O.A2(t)})),e.ulid=t=>e.check(new tE({type:"string",format:"ulid",check:"string_format",abort:!1,...O.A2(t)})),e.base64=t=>e.check(new tI({type:"string",format:"base64",check:"string_format",abort:!1,...O.A2(t)})),e.base64url=t=>e.check(new tP({type:"string",format:"base64url",check:"string_format",abort:!1,...O.A2(t)})),e.xid=t=>e.check(new tA({type:"string",format:"xid",check:"string_format",abort:!1,...O.A2(t)})),e.ksuid=t=>e.check(new tx({type:"string",format:"ksuid",check:"string_format",abort:!1,...O.A2(t)})),e.ipv4=t=>e.check(new tT({type:"string",format:"ipv4",check:"string_format",abort:!1,...O.A2(t)})),e.ipv6=t=>e.check(new tj({type:"string",format:"ipv6",check:"string_format",abort:!1,...O.A2(t)})),e.cidrv4=t=>e.check(new tO({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O.A2(t)})),e.cidrv6=t=>e.check(new t$({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O.A2(t)})),e.e164=t=>e.check(new tC({type:"string",format:"e164",check:"string_format",abort:!1,...O.A2(t)})),e.datetime=t=>e.check(function(e){return new te({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O.A2(e)})}(t)),e.date=t=>e.check(function(e){return new tt({type:"string",format:"date",check:"string_format",...O.A2(e)})}(t)),e.time=t=>e.check(function(e){return new tr({type:"string",format:"time",check:"string_format",precision:null,...O.A2(e)})}(t)),e.duration=t=>e.check(function(e){return new ti({type:"string",format:"duration",check:"string_format",...O.A2(e)})}(t))});function tp(e){return new tf({type:"string",...O.A2(e)})}let tg=i.xI("ZodStringFormat",(e,t)=>{Y.init(e,t),td.init(e,t)}),ty=i.xI("ZodEmail",(e,t)=>{et.init(e,t),tg.init(e,t)}),tm=i.xI("ZodGUID",(e,t)=>{X.init(e,t),tg.init(e,t)}),tv=i.xI("ZodUUID",(e,t)=>{ee.init(e,t),tg.init(e,t)}),tb=i.xI("ZodURL",(e,t)=>{er.init(e,t),tg.init(e,t)}),t_=i.xI("ZodEmoji",(e,t)=>{ei.init(e,t),tg.init(e,t)}),tw=i.xI("ZodNanoID",(e,t)=>{es.init(e,t),tg.init(e,t)}),tk=i.xI("ZodCUID",(e,t)=>{en.init(e,t),tg.init(e,t)}),tS=i.xI("ZodCUID2",(e,t)=>{ea.init(e,t),tg.init(e,t)}),tE=i.xI("ZodULID",(e,t)=>{eo.init(e,t),tg.init(e,t)}),tA=i.xI("ZodXID",(e,t)=>{el.init(e,t),tg.init(e,t)}),tx=i.xI("ZodKSUID",(e,t)=>{eu.init(e,t),tg.init(e,t)}),tT=i.xI("ZodIPv4",(e,t)=>{ep.init(e,t),tg.init(e,t)}),tj=i.xI("ZodIPv6",(e,t)=>{eg.init(e,t),tg.init(e,t)}),tO=i.xI("ZodCIDRv4",(e,t)=>{ey.init(e,t),tg.init(e,t)}),t$=i.xI("ZodCIDRv6",(e,t)=>{em.init(e,t),tg.init(e,t)}),tI=i.xI("ZodBase64",(e,t)=>{eb.init(e,t),tg.init(e,t)}
36),tP=i.xI("ZodBase64URL",(e,t)=>{e_.init(e,t),tg.init(e,t)}),tC=i.xI("ZodE164",(e,t)=>{ew.init(e,t),tg.init(e,t)}),tR=i.xI("ZodJWT",(e,t)=>{ek.init(e,t),tg.init(e,t)}),tz=i.xI("ZodNumber",(e,t)=>{eS.init(e,t),th.init(e,t),e.gt=(t,r)=>e.check(e6(t,r)),e.gte=(t,r)=>e.check(e5(t,r)),e.min=(t,r)=>e.check(e5(t,r)),e.lt=(t,r)=>e.check(e1(t,r)),e.lte=(t,r)=>e.check(e2(t,r)),e.max=(t,r)=>e.check(e2(t,r)),e.int=t=>e.check(tN(t)),e.safe=t=>e.check(tN(t)),e.positive=t=>e.check(e6(0,t)),e.nonnegative=t=>e.check(e5(0,t)),e.negative=t=>e.check(e1(0,t)),e.nonpositive=t=>e.check(e2(0,t)),e.multipleOf=(t,r)=>e.check(e4(t,r)),e.step=(t,r)=>e.check(e4(t,r)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function tU(e){return new tz({type:"number",checks:[],...O.A2(e)})}let tL=i.xI("ZodNumberFormat",(e,t)=>{eE.init(e,t),tz.init(e,t)});function tN(e){return new tL({type:"number",check:"number_format",abort:!1,format:"safeint",...O.A2(e)})}let tD=i.xI("ZodUnknown",(e,t)=>{eA.init(e,t),th.init(e,t)});function tB(){return new tD({type:"unknown"})}let tF=i.xI("ZodNever",(e,t)=>{ex.init(e,t),th.init(e,t)}),tV=i.xI("ZodArray",(e,t)=>{ej.init(e,t),th.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(e3(t,r)),e.nonempty=t=>e.check(e3(1,t)),e.max=(t,r)=>e.check(e8(t,r)),e.length=(t,r)=>e.check(e9(t,r)),e.unwrap=()=>e.element}),tM=i.xI("ZodObject",(e,t)=>{e$.init(e,t),th.init(e,t),O.gJ(e,"shape",()=>t.shape),e.keyof=()=>(function(e,t){return new tJ({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O.A2(void 0)})})(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:tB()}),e.loose=()=>e.clone({...e._zod.def,catchall:tB()}),e.strict=()=>e.clone({...e._zod.def,catchall:function(e){var t;return t=void 0,new tF({type:"never",...O.A2(t)})}()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>O.X$(e,t),e.merge=t=>O.h1(e,t),e.pick=t=>O.Up(e,t),e.omit=t=>O.cJ(e,t),e.partial=(...t)=>O.OH(tH,e,t[0]),e.required=(...t)=>O.mw(t1,e,t[0])});function tZ(e,t){return new tM({type:"object",get shape(){return O.Vy(this,"shape",e?O.ZV(e):{}),this.shape},...O.A2(t)})}let tq=i.xI("ZodUnion",(e,t)=>{eP.init(e,t),th.init(e,t),e.options=t.options}),tW=i.xI("ZodIntersection",(e,t)=>{eC.init(e,t),th.init(e,t)}),tJ=i.xI("ZodEnum",(e,t)=>{ez.init(e,t),th.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,i)=>{let s={};for(let i of e)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);
36return new tJ({...t,checks:[],...O.A2(i),entries:s})},e.exclude=(e,i)=>{let s={...t.entries};for(let t of e)if(r.has(t))delete s[t];else throw Error(`Key ${t} not found in enum`);return new tJ({...t,checks:[],...O.A2(i),entries:s})}}),tK=i.xI("ZodTransform",(e,t)=>{eU.init(e,t),th.init(e,t),e._zod.parse=(r,i)=>{r.addIssue=i=>{"string"==typeof i?r.issues.push(O.sn(i,r.value,t)):(i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(O.sn(i)))};let s=t.transform(r.value,r);return s instanceof Promise?s.then(e=>(r.value=e,r)):(r.value=s,r)}}),tH=i.xI("ZodOptional",(e,t)=>{eN.init(e,t),th.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tG(e){return new tH({type:"optional",innerType:e})}let tQ=i.xI("ZodNullable",(e,t)=>{eD.init(e,t),th.init(e,t),e.unwrap=()=>e._zod.def.innerType});function tY(e){return new tQ({type:"nullable",innerType:e})}let tX=i.xI("ZodDefault",(e,t)=>{eB.init(e,t),th.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),t0=i.xI("ZodPrefault",(e,t)=>{eV.init(e,t),th.init(e,t),e.unwrap=()=>e._zod.def.innerType}),t1=i.xI("ZodNonOptional",(e,t)=>{eM.init(e,t),th.init(e,t),e.unwrap=()=>e._zod.def.innerType}),t2=i.xI("ZodCatch",(e,t)=>{eq.init(e,t),th.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),t6=i.xI("ZodPipe",(e,t)=>{eW.init(e,t),th.init(e,t),e.in=t.in,e.out=t.out});function t5(e,t){return new t6({type:"pipe",in:e,out:t})}let t4=i.xI("ZodReadonly",(e,t)=>{eK.init(e,t),th.init(e,t),e.unwrap=()=>e._zod.def.innerType}),t8=i.xI("ZodCustom",(e,t)=>{eG.init(e,t),th.init(e,t)})},72901:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let s=i(r(54419));class n{constructor(e,{headers:t={},schema:r,fetch:i}){this.url=e,this.headers=t,this.schema=r,this.fetch=i}select(e,{head:t=!1,count:r}={}){let i=!1,n=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e)).join("");return this.url.searchParams.set("select",n),r&&(this.headers.Prefer=`count=${r}`),new s.default({method:t?"HEAD":"GET",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:r=!0}={}){let i=[];if(this.headers.Prefer&&i.push(this.headers.Prefer),t&&i.push(`count=${t}`),r||i.push("missing=default"),this.headers.Prefer=i.join(","),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new s.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:i,defaultToNull:n=!0}={}){let a=[`resolution=${r?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&a.push(this.headers.Prefer),i&&a.push(`count=${i}`),n||a.push("missing=default"),this.headers.Prefer=a.join(","),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new s.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){let r=[];return this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push(`count=${t}`),this.headers.Prefer=r.join(","),new s.default({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){let t=[];return e&&t.push(`count=${e}`),this.headers.Prefer&&t.unshift(this.headers.Prefer),this.headers.Prefer=t.join(","),new s.default({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}t.default=n},76373:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let s=i(r(3913));class n extends s.default{select(e){let t=!1,r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:i,referencedTable:s=i}={}){let n=s?`${s}.order`:"order",a=this.url.searchParams.get(n);return this.url.searchParams.set(n,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let i=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:i=r}={}){let s=void 0===i?"offset":`${i}.offset`,n=void 0===i?"limit":`${i}.limit`;return this.url.searchParams.set(s,`${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}
36explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:i=!1,wal:s=!1,format:n="text"}={}){var a;let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,i?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=null!=(a=this.headers.Accept)?a:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${n}; for="${l}"; options=${o};`,this}rollback(){var e;return(null!=(e=this.headers.Prefer)?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}t.default=n},87843:function(e,t,r){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;let s=i(r(37977));t.PostgrestClient=s.default;let n=i(r(72901));t.PostgrestQueryBuilder=n.default;let a=i(r(54419));t.PostgrestFilterBuilder=a.default;let o=i(r(76373));t.PostgrestTransformBuilder=o.default;let l=i(r(3913));t.PostgrestBuilder=l.default;let u=i(r(5732));t.PostgrestError=u.default,t.default={PostgrestClient:s.default,PostgrestQueryBuilder:n.default,PostgrestFilterBuilder:a.default,PostgrestTransformBuilder:o.default,PostgrestBuilder:l.default,PostgrestError:u.default}},93537:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Headers:()=>a,Request:()=>o,Response:()=>l,default:()=>n,fetch:()=>s});var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw Error("unable to locate global object")}();let s=i.fetch,n=i.fetch.bind(i),a=i.Headers,o=i.Request,l=i.Response}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.