(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[970],{14307:function(e,t,r){"use strict";r.r(t),r.d(t,{Headers:function(){return s},Request:function(){return o},Response:function(){return a},fetch:function(){return i}});var n=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 i=n.fetch;t.default=n.fetch.bind(n);let s=n.Headers,o=n.Request,a=n.Response},56781:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=n(r(14307)),s=n(r(47960));class o{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=i.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),"GET"!==this.method&&"HEAD"!==this.method&&(this.headers["Content-Type"]="application/json");let 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,n;let i=null,o=null,a=null,l=e.status,u=e.statusText;if(e.ok){if("HEAD"!==this.method){let t=await e.text();""===t||(o="text/csv"===this.headers.Accept?t:this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?t:JSON.parse(t))}let n=null===(t=this.headers.Prefer)||void 0===t?void 0:t.match(/count=(exact|planned|estimated)/),s=null===(r=e.headers.get("content-range"))||void 0===r?void 0:r.split("/");n&&s&&s.length>1&&(a=parseInt(s[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(o)&&(o.length>1?(i={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,a=null,l=406,u="Not Acceptable"):o=1===o.length?o[0]:null)}else{let t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(o=[],i=null,l=200,u="OK")}catch(r){404===e.status&&""===t?(l=204,u="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null===(n=null==i?void 0:i.details)||void 0===n?void 0:n.includes("0 rows"))&&(i=null,l=200,u="OK"),i&&this.shouldThrowOnError)throw new s.default(i)}return{error:i,data:o,count:a,status:l,statusText:u}});return this.shouldThrowOnError||(r=r.catch(e=>{var t,r,n;return{error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:`${null!==(r=null==e?void 0:e.stack)&&void 0!==r?r:""}`,hint:"",code:`${null!==(n=null==e?void 0:e.code)&&void 0!==n?n:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}}t.default=o},18895:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=n(r(69660)),s=n(r(83287)),o=r(31395);class a{constructor(e,{headers:t={},schema:r,fetch:n}={}){this.url=e,this.headers=Object.assign(Object.assign({},o.DEFAULT_HEADERS),t),this.schemaName=r,this.fetch=n}from(e){let t=new URL(`${this.url}/${e}`);return new i.default(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new a(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:n=!1,count:i}={}){let o,a;let l=new URL(`${this.url}/rpc/${e}`);r||n?(o=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)})):(o="POST",a=t);let u=Object.assign({},this.headers);return i&&(u.Prefer=`count=${i}`),new s.default({method:o,url:l,headers:u,schema:this.schemaName,body:a,fetch:this.fetch,allowEmpty:!1})}}t.default=a},47960:function(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.code=e.code}}t.default=r},83287:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=n(r(43432));class s extends i.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:n}={}){let i="";"plain"===n?i="pl":"phrase"===n?i="ph":"websearch"===n&&(i="w");let s=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${i}fts${s}.${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 n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}}t.default=s},69660:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=n(r(83287));class s{constructor(e,{headers:t={},schema:r,fetch:n}){this.url=e,this.headers=t,this.schema=r,this.fetch=n}select(e,{head:t=!1,count:r}={}){let n=!1,s=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!n?"":('"'===e&&(n=!n),e)).join("");return this.url.searchParams.set("select",s),r&&(this.headers.Prefer=`count=${r}`),new i.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 n=[];if(this.headers.Prefer&&n.push(this.headers.Prefer),t&&n.push(`count=${t}`),r||n.push("missing=default"),this.headers.Prefer=n.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 i.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:n,defaultToNull:s=!0}={}){let o=[`resolution=${r?"ignore":"merge"}-duplicates`];if(void 0!==t&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&o.push(this.headers.Prefer),n&&o.push(`count=${n}`),s||o.push("missing=default"),this.headers.Prefer=o.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 i.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 i.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 i.default({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}t.default=s},43432:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});let i=n(r(56781));class s extends i.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:n,referencedTable:i=n}={}){let s=i?`${i}.order`:"order",o=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let n=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){let i=void 0===n?"offset":`${n}.offset`,s=void 0===n?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(s,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return"GET"===this.method?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:s="text"}={}){var o;let a=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=null!==(o=this.headers.Accept)&&void 0!==o?o:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${s}; for="${l}"; options=${a};`,this}rollback(){var e;return(null!==(e=this.headers.Prefer)&&void 0!==e?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}t.default=s},31395:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_HEADERS=void 0;let n=r(14373);t.DEFAULT_HEADERS={"X-Client-Info":`postgrest-js/${n.version}`}},68292:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;let i=n(r(18895));t.PostgrestClient=i.default;let s=n(r(69660));t.PostgrestQueryBuilder=s.default;let o=n(r(83287));t.PostgrestFilterBuilder=o.default;let a=n(r(43432));t.PostgrestTransformBuilder=a.default;let l=n(r(56781));t.PostgrestBuilder=l.default,t.default={PostgrestClient:i.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:o.default,PostgrestTransformBuilder:a.default,PostgrestBuilder:l.default}},14373:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="0.0.0-automated"},84593:function(e,t,r){"use strict";r.d(t,{eI:function(){return tP}});let n=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,14307)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)};class 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 o 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)}}(F=z||(z={})).Any="any",F.ApNortheast1="ap-northeast-1",F.ApNortheast2="ap-northeast-2",F.ApSouth1="ap-south-1",F.ApSoutheast1="ap-southeast-1",F.ApSoutheast2="ap-southeast-2",F.CaCentral1="ca-central-1",F.EuCentral1="eu-central-1",F.EuWest1="eu-west-1",F.EuWest2="eu-west-2",F.EuWest3="eu-west-3",F.SaEast1="sa-east-1",F.UsEast1="us-east-1",F.UsWest1="us-west-1",F.UsWest2="us-west-2";class l{constructor(e,{headers:t={},customFetch:r,region:i=z.Any}={}){this.url=e,this.headers=t,this.region=i,this.fetch=n(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var r,n,i,l,u;return n=this,i=void 0,l=void 0,u=function*(){try{let n;let{headers:i,method:l,body:u}=t,c={},{region:h}=t;h||(h=this.region),h&&"any"!==h&&(c["x-region"]=h),u&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)&&("undefined"!=typeof Blob&&u instanceof Blob||u instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",n=u):"string"==typeof u?(c["Content-Type"]="text/plain",n=u):"undefined"!=typeof FormData&&u instanceof FormData?n=u:(c["Content-Type"]="application/json",n=JSON.stringify(u)));let d=yield this.fetch(`${this.url}/${e}`,{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:n}).catch(e=>{throw new s(e)}),f=d.headers.get("x-relay-error");if(f&&"true"===f)throw new o(d);if(!d.ok)throw new a(d);let p=(null!==(r=d.headers.get("Content-Type"))&&void 0!==r?r:"text/plain").split(";")[0].trim();return{data:"application/json"===p?yield d.json():"application/octet-stream"===p?yield d.blob():"text/event-stream"===p?d:"multipart/form-data"===p?yield d.formData():yield d.text(),error:null}}catch(e){return{data:null,error:e}}},new(l||(l=Promise))(function(e,t){function r(e){try{o(u.next(e))}catch(e){t(e)}}function s(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var n;t.done?e(t.value):((n=t.value)instanceof l?n:new l(function(e){e(n)})).then(r,s)}o((u=u.apply(n,i||[])).next())})}}let{PostgrestClient:u,PostgrestQueryBuilder:c,PostgrestFilterBuilder:h,PostgrestTransformBuilder:d,PostgrestBuilder:f}=r(68292),p={"X-Client-Info":"realtime-js/2.10.2"};(Q=W||(W={}))[Q.connecting=0]="connecting",Q[Q.open=1]="open",Q[Q.closing=2]="closing",Q[Q.closed=3]="closed",(ee=H||(H={})).closed="closed",ee.errored="errored",ee.joined="joined",ee.joining="joining",ee.leaving="leaving",(et=q||(q={})).close="phx_close",et.error="phx_error",et.join="phx_join",et.reply="phx_reply",et.leave="phx_leave",et.access_token="access_token",(K||(K={})).websocket="websocket",(er=J||(J={})).Connecting="connecting",er.Open="open",er.Closing="closing",er.Closed="closed";class g{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):"string"==typeof e?t(JSON.parse(e)):t({})}_binaryDecode(e){let t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){let n=t.getUint8(1),i=t.getUint8(2),s=this.HEADER_LENGTH+2,o=r.decode(e.slice(s,s+n));s+=n;let a=r.decode(e.slice(s,s+i));return s+=i,{ref:null,topic:o,event:a,payload:JSON.parse(r.decode(e.slice(s,e.byteLength)))}}}class y{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}(en=V||(V={})).abstime="abstime",en.bool="bool",en.date="date",en.daterange="daterange",en.float4="float4",en.float8="float8",en.int2="int2",en.int4="int4",en.int4range="int4range",en.int8="int8",en.int8range="int8range",en.json="json",en.jsonb="jsonb",en.money="money",en.numeric="numeric",en.oid="oid",en.reltime="reltime",en.text="text",en.time="time",en.timestamp="timestamp",en.timestamptz="timestamptz",en.timetz="timetz",en.tsrange="tsrange",en.tstzrange="tstzrange";let v=(e,t,r={})=>{var n;let i=null!==(n=r.skipTypes)&&void 0!==n?n:[];return Object.keys(t).reduce((r,n)=>(r[n]=m(n,e,t,i),r),{})},m=(e,t,r,n)=>{let i=t.find(t=>t.name===e),s=null==i?void 0:i.type,o=r[e];return s&&!n.includes(s)?w(s,o):b(o)},w=(e,t)=>{if("_"===e.charAt(0))return x(t,e.slice(1,e.length));switch(e){case V.bool:return _(t);case V.float4:case V.float8:case V.int2:case V.int4:case V.int8:case V.numeric:case V.oid:return k(t);case V.json:case V.jsonb:return E(t);case V.timestamp:return T(t);case V.abstime:case V.date:case V.daterange:case V.int4range:case V.int8range:case V.money:case V.reltime:case V.text:case V.time:case V.timestamptz:case V.timetz:case V.tsrange:case V.tstzrange:default:return b(t)}},b=e=>e,_=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},k=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},E=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log(`JSON parse error: ${e}`)}return e},x=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,n=e[r];if("{"===e[0]&&"}"===n){let n;let i=e.slice(1,r);try{n=JSON.parse("["+i+"]")}catch(e){n=i?i.split(","):[]}return n.map(e=>w(t,e))}return e},T=e=>"string"==typeof e?e.replace(" ","T"):e,S=e=>{let t=e;return(t=(t=t.replace(/^ws/i,"http")).replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,"")).replace(/\/+$/,"")};class A{constructor(e,t,r={},n=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=n,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?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){this.timeoutTimer||(this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref),this.channel._on(this.refEvent,{},e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout))}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}(ei=G||(G={})).SYNC="sync",ei.JOIN="join",ei.LEAVE="leave";class j{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,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:n}=this.caller;this.joinRef=this.channel._joinRef(),this.state=j.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=j.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],n()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=j.syncDiff(this.state,e,t,r),n())}),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,n){let i=this.cloneDeep(e),s=this.transformState(t),o={},a={};return this.map(i,(e,t)=>{s[e]||(a[e]=t)}),this.map(s,(e,t)=>{let r=i[e];if(r){let n=t.map(e=>e.presence_ref),i=r.map(e=>e.presence_ref),s=t.filter(e=>0>i.indexOf(e.presence_ref)),l=r.filter(e=>0>n.indexOf(e.presence_ref));s.length>0&&(o[e]=s),l.length>0&&(a[e]=l)}else o[e]=t}),this.syncDiff(i,{joins:o,leaves:a},r,n)}static syncDiff(e,t,r,n){let{joins:i,leaves:s}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),n||(n=()=>{}),this.map(i,(t,n)=>{var i;let s=null!==(i=e[t])&&void 0!==i?i:[];if(e[t]=this.cloneDeep(n),s.length>0){let r=e[t].map(e=>e.presence_ref),n=s.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...n)}r(t,s,n)}),this.map(s,(t,r)=>{let i=e[t];if(!i)return;let s=r.map(e=>e.presence_ref);i=i.filter(e=>0>s.indexOf(e.presence_ref)),e[t]=i,n(t,i,r),0===i.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 n=e[r];return"metas"in n?t[r]=n.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=n,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()}}(es=Y||(Y={})).ALL="*",es.INSERT="INSERT",es.UPDATE="UPDATE",es.DELETE="DELETE",(eo=X||(X={})).BROADCAST="broadcast",eo.PRESENCE="presence",eo.POSTGRES_CHANGES="postgres_changes",(ea=Z||(Z={})).SUBSCRIBED="SUBSCRIBED",ea.TIMED_OUT="TIMED_OUT",ea.CLOSED="CLOSED",ea.CHANNEL_ERROR="CHANNEL_ERROR";class O{constructor(e,t={config:{}},r){this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=H.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new A(this,q.join,this.params,this.timeout),this.rejoinTimer=new y(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=H.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=H.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=H.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=H.errored,this.rejoinTimer.scheduleTimeout())}),this._on(q.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new j(this),this.broadcastEndpointURL=S(this.socket.endPoint)+"/api/broadcast"}subscribe(e,t=this.timeout){var r,n;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{let{config:{broadcast:i,presence:s,private:o}}=this.params;this._onError(t=>e&&e("CHANNEL_ERROR",t)),this._onClose(()=>e&&e("CLOSED"));let a={},l={broadcast:i,presence:s,postgres_changes:null!==(n=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==n?n:[],private:o};this.socket.accessToken&&(a.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:l},a)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",({postgres_changes:t})=>{var r;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),void 0===t){e&&e("SUBSCRIBED");return}{let n=this.bindings.postgres_changes,i=null!==(r=null==n?void 0:n.length)&&void 0!==r?r:0,s=[];for(let r=0;r{e&&e("CHANNEL_ERROR",Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{e&&e("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this._on(e,t,r)}async send(e,t={}){var r,n;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var n,i,s;let o=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(s=null===(i=null===(n=this.params)||void 0===n?void 0:n.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.ack)||r("ok"),o.receive("ok",()=>r("ok")),o.receive("error",()=>r("error")),o.receive("timeout",()=>r("timed out"))});{let{event:i,payload:s}=e,o={method:"POST",headers:{Authorization:this.socket.accessToken?`Bearer ${this.socket.accessToken}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:s}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,o,null!==(r=t.timeout)&&void 0!==r?r:this.timeout);return await (null===(n=e.body)||void 0===n?void 0:n.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=H.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(q.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(r=>{let n=new A(this,q.leave,{},e);n.receive("ok",()=>{t(),r("ok")}).receive("timeout",()=>{t(),r("timed out")}).receive("error",()=>{r("error")}),n.send(),this._canPush()||n.trigger("ok",{})})}async _fetchWithTimeout(e,t,r){let n=new AbortController,i=setTimeout(()=>n.abort(),r),s=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:n.signal}));return clearTimeout(i),s}_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 n=new A(this,e,t,r);return this._canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var n,i;let s=e.toLocaleLowerCase(),{close:o,error:a,leave:l,join:u}=q;if(r&&[o,a,l,u].indexOf(s)>=0&&r!==this._joinRef())return;let c=this._onMessage(s,t,r);if(t&&!c)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(s)?null===(n=this.bindings.postgres_changes)||void 0===n||n.filter(e=>{var t,r,n;return(null===(t=e.filter)||void 0===t?void 0:t.event)==="*"||(null===(n=null===(r=e.filter)||void 0===r?void 0:r.event)||void 0===n?void 0:n.toLocaleLowerCase())===s}).map(e=>e.callback(c,r)):null===(i=this.bindings[s])||void 0===i||i.filter(e=>{var r,n,i,o,a,l;if(!["broadcast","presence","postgres_changes"].includes(s))return e.type.toLocaleLowerCase()===s;if("id"in e){let s=e.id,o=null===(r=e.filter)||void 0===r?void 0:r.event;return s&&(null===(n=t.ids)||void 0===n?void 0:n.includes(s))&&("*"===o||(null==o?void 0:o.toLocaleLowerCase())===(null===(i=t.data)||void 0===i?void 0:i.type.toLocaleLowerCase()))}{let r=null===(a=null===(o=null==e?void 0:e.filter)||void 0===o?void 0:o.event)||void 0===a?void 0:a.toLocaleLowerCase();return"*"===r||r===(null===(l=null==t?void 0:t.event)||void 0===l?void 0:l.toLocaleLowerCase())}}).map(e=>{if("object"==typeof c&&"ids"in c){let e=c.data,{schema:t,table:r,commit_timestamp:n,type:i,errors:s}=e;c=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:n,eventType:i,new:{},old:{},errors:s}),this._getPayloadRecords(e))}e.callback(c,r)})}_isClosed(){return this.state===H.closed}_isJoined(){return this.state===H.joined}_isJoining(){return this.state===H.joining}_isLeaving(){return this.state===H.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let n=e.toLocaleLowerCase(),i={type:n,filter:t,callback:r};return this.bindings[n]?this.bindings[n].push(i):this.bindings[n]=[i],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]=this.bindings[r].filter(e=>{var n;return!((null===(n=e.type)||void 0===n?void 0:n.toLocaleLowerCase())===r&&O.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(q.close,{},e)}_onError(e){this._on(q.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=H.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=v(e.columns,e.record)),("UPDATE"===e.type||"DELETE"===e.type)&&(t.old=v(e.columns,e.old_record)),t}}let C=()=>{},P="undefined"!=typeof WebSocket;class R{constructor(e,t){var n;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=p,this.params={},this.timeout=1e4,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=C,this.conn=null,this.sendBuffer=[],this.serializer=new g,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,14307)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)},this.endPoint=`${e}/${K.websocket}`,this.httpEndpoint=S(e),(null==t?void 0:t.transport)?this.transport=t.transport:this.transport=null,(null==t?void 0:t.params)&&(this.params=t.params),(null==t?void 0:t.headers)&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),(null==t?void 0:t.timeout)&&(this.timeout=t.timeout),(null==t?void 0:t.logger)&&(this.logger=t.logger),(null==t?void 0:t.heartbeatIntervalMs)&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);let i=null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey;i&&(this.accessToken=i,this.apiKey=i),this.reconnectAfterMs=(null==t?void 0:t.reconnectAfterMs)?t.reconnectAfterMs:e=>[1e3,2e3,5e3,1e4][e-1]||1e4,this.encode=(null==t?void 0:t.encode)?t.encode:(e,t)=>t(JSON.stringify(e)),this.decode=(null==t?void 0:t.decode)?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new y(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(P){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new I(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),r.e(35).then(r.t.bind(r,7035,23)).then(({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}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.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case W.connecting:return J.Connecting;case W.open:return J.Open;case W.closing:return J.Closing;default:return J.Closed}}isConnected(){return this.connectionState()===J.Open}channel(e,t={config:{}}){let r=new O(`realtime:${e}`,t,this);return this.channels.push(r),r}push(e){let{topic:t,event:r,payload:n,ref:i}=e,s=()=>{this.encode(e,e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)})};this.log("push",`${t} ${r} (${i})`,n),this.isConnected()?s():this.sendBuffer.push(s)}setAuth(e){this.accessToken=e,this.channels.forEach(t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(q.access_token,{access_token:e})})}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t._joinRef()!==e._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}_onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:r,payload:n,ref:i}=e;(i&&i===this.pendingHeartbeatRef||r===(null==n?void 0:n.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${n.status||""} ${t} ${r} ${i&&"("+i+")"||""}`,n),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,n,i)),this.stateChangeCallbacks.message.forEach(t=>t(e))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(t=>t(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(t=>t(e))}_triggerChanError(){this.channels.forEach(e=>e._trigger(q.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",n=new URLSearchParams(t);return`${e}${r}${n}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),null===(e=this.conn)||void 0===e||e.close(1e3,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class I{constructor(e,t,r){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=W.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=r.close}}class L extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function $(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class D extends L{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class M extends L{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}let U=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,14307)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)},N=()=>{var e,t,n,i;return e=void 0,t=void 0,n=void 0,i=function*(){return"undefined"==typeof Response?(yield Promise.resolve().then(r.bind(r,14307))).Response:Response},new(n||(n=Promise))(function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})},B=e=>{if(Array.isArray(e))return e.map(e=>B(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,""))]=B(r)}),t};var F,z,W,H,q,K,J,V,G,Y,X,Z,Q,ee,et,er,en,ei,es,eo,ea,el=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};let eu=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),ec=(e,t,r)=>el(void 0,void 0,void 0,function*(){e instanceof(yield N())&&!(null==r?void 0:r.noResolveJson)?e.json().then(r=>{t(new D(eu(r),e.status||500))}).catch(e=>{t(new M(eu(e),e))}):t(new M(eu(e),e))}),eh=(e,t,r,n)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n&&(i.body=JSON.stringify(n)),Object.assign(Object.assign({},i),r))};function ed(e,t,r,n,i,s){return el(this,void 0,void 0,function*(){return new Promise((o,a)=>{e(r,eh(t,n,i,s)).then(e=>{if(!e.ok)throw e;return(null==n?void 0:n.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>ec(e,a,n))})})}function ef(e,t,r,n){return el(this,void 0,void 0,function*(){return ed(e,"GET",t,r,n)})}function ep(e,t,r,n,i){return el(this,void 0,void 0,function*(){return ed(e,"POST",t,n,i,r)})}function eg(e,t,r,n,i){return el(this,void 0,void 0,function*(){return ed(e,"DELETE",t,n,i,r)})}var ey=r(86300).Buffer,ev=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};let em={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ew={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class eb{constructor(e,t={},r,n){this.url=e,this.headers=t,this.bucketId=r,this.fetch=U(n)}uploadOrUpdate(e,t,r,n){return ev(this,void 0,void 0,function*(){try{let i;let s=Object.assign(Object.assign({},ew),n),o=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(s.upsert)}),a=s.metadata;"undefined"!=typeof Blob&&r instanceof Blob?((i=new FormData).append("cacheControl",s.cacheControl),i.append("",r),a&&i.append("metadata",this.encodeMetadata(a))):"undefined"!=typeof FormData&&r instanceof FormData?((i=r).append("cacheControl",s.cacheControl),a&&i.append("metadata",this.encodeMetadata(a))):(i=r,o["cache-control"]=`max-age=${s.cacheControl}`,o["content-type"]=s.contentType,a&&(o["x-metadata"]=this.toBase64(this.encodeMetadata(a)))),(null==n?void 0:n.headers)&&(o=Object.assign(Object.assign({},o),n.headers));let l=this._removeEmptyFolders(t),u=this._getFinalPath(l),c=yield this.fetch(`${this.url}/object/${u}`,Object.assign({method:e,body:i,headers:o},(null==s?void 0:s.duplex)?{duplex:s.duplex}:{})),h=yield c.json();if(c.ok)return{data:{path:l,id:h.Id,fullPath:h.Key},error:null};return{data:null,error:h}}catch(e){if($(e))return{data:null,error:e};throw e}})}upload(e,t,r){return ev(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,n){return ev(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),s=this._getFinalPath(i),o=new URL(this.url+`/object/upload/sign/${s}`);o.searchParams.set("token",t);try{let e;let t=Object.assign({upsert:ew.upsert},n),s=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,s["cache-control"]=`max-age=${t.cacheControl}`,s["content-type"]=t.contentType);let a=yield this.fetch(o.toString(),{method:"PUT",body:e,headers:s}),l=yield a.json();if(a.ok)return{data:{path:i,fullPath:l.Key},error:null};return{data:null,error:l}}catch(e){if($(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return ev(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),n=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(n["x-upsert"]="true");let i=yield ep(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:n}),s=new URL(this.url+i.url),o=s.searchParams.get("token");if(!o)throw new L("No token returned by API");return{data:{signedUrl:s.toString(),path:e,token:o},error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}update(e,t,r){return ev(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return ev(this,void 0,void 0,function*(){try{return{data:yield ep(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}copy(e,t,r){return ev(this,void 0,void 0,function*(){try{return{data:{path:(yield ep(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($(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return ev(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=yield ep(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),s=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:i={signedUrl:encodeURI(`${this.url}${i.signedURL}${s}`)},error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return ev(this,void 0,void 0,function*(){try{let n=yield ep(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),i=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:n.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${i}`):null})),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}download(e,t){return ev(this,void 0,void 0,function*(){let r=void 0!==(null==t?void 0:t.transform),n=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),i=n?`?${n}`:"";try{let t=this._getFinalPath(e),n=yield ef(this.fetch,`${this.url}/${r?"render/image/authenticated":"object"}/${t}${i}`,{headers:this.headers,noResolveJson:!0});return{data:yield n.blob(),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}info(e){return ev(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let e=yield ef(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:B(e),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}exists(e){return ev(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield function(e,t,r,n){return el(this,void 0,void 0,function*(){return ed(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($(e)&&e instanceof M){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),n=[],i=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==i&&n.push(i);let s=void 0!==(null==t?void 0:t.transform),o=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==o&&n.push(o);let a=n.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${s?"render/image":"object"}/public/${r}${a}`)}}}remove(e){return ev(this,void 0,void 0,function*(){try{return{data:yield eg(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}list(e,t,r){return ev(this,void 0,void 0,function*(){try{let n=Object.assign(Object.assign(Object.assign({},em),t),{prefix:e||""});return{data:yield ep(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==ey?ey.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e}`}_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 e_={"X-Client-Info":"storage-js/2.7.0"};var ek=function(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})};class eE{constructor(e,t={},r){this.url=e,this.headers=Object.assign(Object.assign({},e_),t),this.fetch=U(r)}listBuckets(){return ek(this,void 0,void 0,function*(){try{return{data:yield ef(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}getBucket(e){return ek(this,void 0,void 0,function*(){try{return{data:yield ef(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}createBucket(e,t={public:!1}){return ek(this,void 0,void 0,function*(){try{return{data:yield ep(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return ek(this,void 0,void 0,function*(){try{return{data:yield function(e,t,r,n,i){return el(this,void 0,void 0,function*(){return ed(e,"PUT",t,n,void 0,r)})}(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($(e))return{data:null,error:e};throw e}})}emptyBucket(e){return ek(this,void 0,void 0,function*(){try{return{data:yield ep(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}deleteBucket(e){return ek(this,void 0,void 0,function*(){try{return{data:yield eg(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if($(e))return{data:null,error:e};throw e}})}}class ex extends eE{constructor(e,t={},r){super(e,t,r)}from(e){return new eb(this.url,this.headers,e,this.fetch)}}let eT="";"undefined"!=typeof Deno?eT="deno":"undefined"!=typeof document?eT="web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?eT="react-native":eT="node";let eS={headers:{"X-Client-Info":`supabase-js-${eT}/2.45.2`}},eA={schema:"public"},ej={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},eO={};var eC=r(14307);let eP=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=eC.default:t=fetch,(...e)=>t(...e)},eR=()=>"undefined"==typeof Headers?eC.Headers:Headers,eI=(e,t,r)=>{let n=eP(r),i=eR();return(r,s)=>{var o,a,l,u;return o=void 0,a=void 0,l=void 0,u=function*(){var o;let a=null!==(o=yield t())&&void 0!==o?o:e,l=new i(null==s?void 0:s.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${a}`),n(r,Object.assign(Object.assign({},s),{headers:l}))},new(l||(l=Promise))(function(e,t){function r(e){try{i(u.next(e))}catch(e){t(e)}}function n(e){try{i(u.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):((i=t.value)instanceof l?i:new l(function(e){e(i)})).then(r,n)}i((u=u.apply(o,a||[])).next())})}},eL="2.64.4",e$={"X-Client-Info":`gotrue-js/${eL}`},eD="X-Supabase-Api-Version",eM={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eU=()=>"undefined"!=typeof document,eN={tested:!1,writable:!1},eB=()=>{if(!eU())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(eN.tested)return eN.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),eN.tested=!0,eN.writable=!0}catch(e){eN.tested=!0,eN.writable=!1}return eN.writable};function eF(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEach((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}let ez=e=>{let t;return e?t=e:"undefined"==typeof fetch?t=(...e)=>Promise.resolve().then(r.bind(r,14307)).then(({default:t})=>t(...e)):t=fetch,(...e)=>t(...e)},eW=e=>"object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json,eH=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}},eK=async(e,t)=>{await e.removeItem(t)};class eJ{constructor(){this.promise=new eJ.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function eV(e){let t=e.split(".");if(3!==t.length)throw Error("JWT is not valid: not a JWT structure");if(!/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i.test(t[1]))throw Error("JWT is not valid: payload is not in base64url format");return JSON.parse(function(e){let t,r,n,i,s,o,a;let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",c=0;for(e=e.replace("-","+").replace("_","/");c>4,r=(15&s)<<4|o>>2,n=(3&o)<<6|a,u+=String.fromCharCode(t),64!=o&&0!=r&&(u+=String.fromCharCode(r)),64!=a&&0!=n&&(u+=String.fromCharCode(n));return u}(t[1]))}async function eG(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function eY(e){return("0"+e.toString(16)).substr(-2)}async function eX(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 eZ(e){return"undefined"!=typeof crypto&&void 0!==crypto.subtle&&"undefined"!=typeof TextEncoder?btoa(await eX(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):(console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e)}async function eQ(e,t,r=!1){let n=function(){let e=new Uint32Array(56);if("undefined"==typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let n=0;n<56;n++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,eY).join("")}(),i=n;r&&(i+="/PASSWORD_RECOVERY"),await eH(e,`${t}-code-verifier`,i);let s=await eZ(n),o=n===s?"plain":"s256";return[s,o]}eJ.promiseConstructor=Promise;let e0=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;class e1 extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function e2(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class e5 extends e1{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class e3 extends e1{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class e4 extends e1{constructor(e,t,r,n){super(e,r,n),this.name=t,this.status=r}}class e8 extends e4{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class e6 extends e4{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class e7 extends e4{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class e9 extends e4{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 te extends e4{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 tt extends e4{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function tr(e){return e2(e)&&"AuthRetryableFetchError"===e.name}class tn extends e4{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}var ti=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};let ts=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),to=[502,503,504];async function ta(e){var t;let r,n;if(!eW(e))throw new tt(ts(e),0);if(to.includes(e.status))throw new tt(ts(e),e.status);try{r=await e.json()}catch(e){throw new e3(ts(e),e)}let i=function(e){let t=e.headers.get(eD);if(!t||!t.match(e0))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(i&&i.getTime()>=eM["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?n=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(n=r.error_code),n){if("weak_password"===n)throw new tn(ts(r),e.status,(null===(t=r.weak_password)||void 0===t?void 0:t.reasons)||[])}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 tn(ts(r),e.status,r.weak_password.reasons);throw new e5(ts(r),e.status||500,n)}let tl=(e,t,r,n)=>{let i={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))};async function tu(e,t,r,n){var i;let s=Object.assign({},null==n?void 0:n.headers);s[eD]||(s[eD]=eM["2024-01-01"].name),(null==n?void 0:n.jwt)&&(s.Authorization=`Bearer ${n.jwt}`);let o=null!==(i=null==n?void 0:n.query)&&void 0!==i?i:{};(null==n?void 0:n.redirectTo)&&(o.redirect_to=n.redirectTo);let a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await tc(e,t,r+a,{headers:s,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function tc(e,t,r,n,i,s){let o;let a=tl(t,n,i,s);try{o=await e(r,Object.assign({},a))}catch(e){throw console.error(e),new tt(ts(e),0)}if(o.ok||await ta(o),null==n?void 0:n.noResolveJson)return o;try{return await o.json()}catch(e){await ta(e)}}function th(e){var t,r;let n=null;return e.access_token&&e.refresh_token&&e.expires_in&&(n=Object.assign({},e),!e.expires_at)&&(n.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)),{data:{session:n,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function td(e){let t=th(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 tf(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function tp(e){return{data:e,error:null}}function tg(e){let{action_link:t,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s},user:Object.assign({},ti(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function ty(e){return e}var tv=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};class tm{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=ez(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(e,t="global"){try{return await tu(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await tu(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=tv(e,["options"]),n=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(n.new_email=null==r?void 0:r.newEmail,delete n.newEmail),await tu(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:tg,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(e2(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await tu(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,n,i,s,o,a;try{let l={nextPage:null,lastPage:0,total:0},u=await tu(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?void 0:t.toString())&&void 0!==r?r:"",per_page:null!==(i=null===(n=null==e?void 0:e.perPage)||void 0===n?void 0:n.toString())&&void 0!==i?i:""},xform:ty});if(u.error)throw u.error;let c=await u.json(),h=null!==(s=u.headers.get("x-total-count"))&&void 0!==s?s:0,d=null!==(a=null===(o=u.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];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(e2(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){try{return await tu(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){try{return await tu(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){try{return await tu(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:tf})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){try{let{data:t,error:r}=await tu(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(e2(e))return{data:null,error:e};throw e}}async _deleteFactor(e){try{return{data:await tu(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}}let tw={getItem:e=>eB()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{eB()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{eB()&&globalThis.localStorage.removeItem(e)}};function tb(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let t_={debug:!!(globalThis&&eB()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class tk extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class tE extends tk{}async function tx(e,t,r){t_.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let n=new globalThis.AbortController;return t>0&&setTimeout(()=>{n.abort(),t_.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async n=>{if(n){t_.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,n.name);try{return await r()}finally{t_.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,n.name)}}else{if(0===t)throw t_.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new tE(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(t_.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()}})}!function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}}();let tT={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:e$,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function tS(e,t,r){return await r()}class tA{constructor(e){var t,r;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=tA.nextInstanceID,tA.nextInstanceID+=1,this.instanceID>0&&eU()&&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 n=Object.assign(Object.assign({},tT),e);if(this.logDebugMessages=!!n.debug,"function"==typeof n.debug&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new tm({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=ez(n.fetch),this.lock=n.lock||tS,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:eU()&&(null===(t=null==globalThis?void 0:globalThis.navigator)||void 0===t?void 0:t.locks)?this.lock=tx:this.lock=tS,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?n.storage?this.storage=n.storage:eB()?this.storage=tw:(this.memoryStorage={},this.storage=tb(this.memoryStorage)):(this.memoryStorage={},this.storage=tb(this.memoryStorage)),eU()&&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)||void 0===r||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()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${eL}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){try{let e=!!eU()&&await this._isPKCEFlow();if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){let{data:t,error:r}=await this._getSessionFromURL(e);if(r){if(this._debug("#_initialize()","error detecting session from URL",r),(null==r?void 0:r.message)==="Identity is already linked"||(null==r?void 0:r.message)==="Identity is already linked to another user")return{error:r};return await this._removeSession(),{error:r}}let{session:n,redirectType:i}=t;return this._debug("#_initialize()","detected session in URL",n,"redirect type",i),await this._saveSession(n),setTimeout(async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",n):await this._notifyAllSubscribers("SIGNED_IN",n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(e2(e))return{error:e};return{error:new e3("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,n;try{let{data:i,error:s}=await tu(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!==(r=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==r?r:{},gotrue_meta_security:{captcha_token:null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.captchaToken}},xform:th});if(s||!i)return{data:{user:null,session:null},error:s};let o=i.session,a=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",o)),{data:{user:a,session:o},error:null}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signUp(e){var t,r,n;try{let i;if("email"in e){let{email:r,password:n,options:s}=e,o=null,a=null;"pkce"===this.flowType&&([o,a]=await eQ(this.storage,this.storageKey)),i=await tu(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==s?void 0:s.emailRedirectTo,body:{email:r,password:n,data:null!==(t=null==s?void 0:s.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:o,code_challenge_method:a},xform:th})}else if("phone"in e){let{phone:t,password:s,options:o}=e;i=await tu(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:s,data:null!==(r=null==o?void 0:o.data)&&void 0!==r?r:{},channel:null!==(n=null==o?void 0:o.channel)&&void 0!==n?n:"sms",gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}},xform:th})}else throw new e7("You must provide either an email or phone number and a password");let{data:s,error:o}=i;if(o||!s)return{data:{user:null,session:null},error:o};let a=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",a)),{data:{user:l,session:a},error:null}}catch(e){if(e2(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:n,options:i}=e;t=await tu(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:td})}else if("phone"in e){let{phone:r,password:n,options:i}=e;t=await tu(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:td})}else throw new e7("You must provide either an email or phone number and a password");let{data:r,error:n}=t;if(n)return{data:{user:null,session:null},error:n};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new e6};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:n}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(n=e.options)||void 0===n?void 0:n.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){let t=await eq(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(null!=t?t:"").split("/"),{data:i,error:s}=await tu(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:th});return(await eK(this.storage,`${this.storageKey}-code-verifier`),s)?{data:{user:null,session:null,redirectType:null},error:s}:i&&i.session&&i.user?(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign(Object.assign({},i),{redirectType:null!=n?n:null}),error:s}):{data:{user:null,session:null,redirectType:null},error:new e6}}async signInWithIdToken(e){try{let{options:t,provider:r,token:n,access_token:i,nonce:s}=e,{data:o,error:a}=await tu(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:i,nonce:s,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:th});if(a)return{data:{user:null,session:null},error:a};if(!o||!o.session||!o.user)return{data:{user:null,session:null},error:new e6};return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:o,error:a}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,n,i,s;try{if("email"in e){let{email:n,options:i}=e,s=null,o=null;"pkce"===this.flowType&&([s,o]=await eQ(this.storage,this.storageKey));let{error:a}=await tu(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:n,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(r=null==i?void 0:i.shouldCreateUser)||void 0===r||r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:s,code_challenge_method:o},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:a}}if("phone"in e){let{phone:t,options:r}=e,{data:o,error:a}=await tu(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(n=null==r?void 0:r.data)&&void 0!==n?n:{},create_user:null===(i=null==r?void 0:r.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!==(s=null==r?void 0:r.channel)&&void 0!==s?s:"sms"}});return{data:{user:null,session:null,messageId:null==o?void 0:o.message_id},error:a}}throw new e7("You must provide either an email or phone number.")}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let n,i;"options"in e&&(n=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(r=e.options)||void 0===r?void 0:r.captchaToken);let{data:s,error:o}=await tu(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:th});if(o)throw o;if(!s)throw Error("An error occurred on token verification.");let a=s.session,l=s.user;return(null==a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),{data:{user:l,session:a},error:null}}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,n;try{let i=null,s=null;return"pkce"===this.flowType&&([i,s]=await eQ(this.storage,this.storageKey)),await tu(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?void 0:t.redirectTo)&&void 0!==r?r:void 0}),(null===(n=null==e?void 0:e.options)||void 0===n?void 0:n.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:i,code_challenge_method:s}),headers:this.headers,xform:tp})}catch(e){if(e2(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 e8;let{error:n}=await tu(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:n}})}catch(e){if(e2(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:n,options:i}=e,{error:s}=await tu(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},redirectTo:null==i?void 0:i.emailRedirectTo});return{data:{user:null,session:null},error:s}}if("phone"in e){let{phone:r,type:n,options:i}=e,{data:s,error:o}=await tu(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return{data:{user:null,session:null,messageId:null==s?void 0:s.message_id},error:o}}throw new e7("You must provide either an email or phone number and a type")}catch(e){if(e2(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 valid"),await this._removeSession())),!e)return{data:{session:null},error:null};let r=!!e.expires_at&&e.expires_at<=Date.now()/1e3;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.storage.isServer){let t=this.suppressGetSessionWarning;e=new Proxy(e,{get:(e,r,n)=>(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 many 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,n))})}return{data:{session:e},error:null}}let{session:n,error:i}=await this._callRefreshToken(e.refresh_token);if(i)return{data:{session:null},error:i};return{data:{session:n},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 tu(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:tf});return await this._useSession(async e=>{var t,r,n;let{data:i,error:s}=e;if(s)throw s;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await tu(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(n=null===(r=i.session)||void 0===r?void 0:r.access_token)&&void 0!==n?n:void 0,xform:tf}):{data:{user:null},error:new e8}})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:n,error:i}=r;if(i)throw i;if(!n.session)throw new e8;let s=n.session,o=null,a=null;"pkce"===this.flowType&&null!=e.email&&([o,a]=await eQ(this.storage,this.storageKey));let{data:l,error:u}=await tu(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:a}),jwt:s.access_token,xform:tf});if(u)throw u;return s.user=l.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(e){if(e2(e))return{data:{user:null},error:e};throw e}}_decodeJWT(e){return eV(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 e8;let t=Date.now()/1e3,r=t,n=!0,i=null,s=eV(e.access_token);if(s.exp&&(n=(r=s.exp)<=t),n){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};i=t}else{let{data:n,error:s}=await this._getUser(e.access_token);if(s)throw s;i={access_token:e.access_token,refresh_token:e.refresh_token,user:n.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return{data:{user:i.user,session:i},error:null}}catch(e){if(e2(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:n,error:i}=t;if(i)throw i;e=null!==(r=n.session)&&void 0!==r?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new e8;let{session:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?{data:{user:null,session:null},error:i}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(e2(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e){try{if(!eU())throw new e9("No browser detected.");if("implicit"!==this.flowType||this._isImplicitGrantFlow()){if("pkce"==this.flowType&&!e)throw new te("Not a valid PKCE flow url.")}else throw new e9("Not a valid implicit grant flow url.");let t=eF(window.location.href);if(e){if(!t.code)throw new te("No code detected.");let{data:e,error:r}=await this._exchangeCodeForSession(t.code);if(r)throw r;let n=new URL(window.location.href);return n.searchParams.delete("code"),window.history.replaceState(window.history.state,"",n.toString()),{data:{session:e.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new e9(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});let{provider_token:r,provider_refresh_token:n,access_token:i,refresh_token:s,expires_in:o,expires_at:a,token_type:l}=t;if(!i||!o||!s||!l)throw new e9("No session defined in URL");let u=Math.round(Date.now()/1e3),c=parseInt(o),h=u+c;a&&(h=parseInt(a));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 clok for skew",f,h,u);let{data:p,error:g}=await this._getUser(i);if(g)throw g;let y={provider_token:r,provider_refresh_token:n,access_token:i,expires_in:c,expires_at:h,refresh_token:s,token_type:l,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:t.type},error:null}}catch(e){if(e2(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantFlow(){let e=eF(window.location.href);return!!(eU()&&(e.access_token||e.error_description))}async _isPKCEFlow(){let e=eF(window.location.href),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:n,error:i}=t;if(i)return{error:i};let s=null===(r=n.session)||void 0===r?void 0:r.access_token;if(s){let{error:t}=await this.admin.signOut(s,e);if(t&&!(e2(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await eK(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{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,n;try{let{data:{session:n},error:i}=t;if(i)throw i;await (null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",n)),this._debug("INITIAL_SESSION","callback id",e,"session",n)}catch(t){await (null===(n=this.stateChangeEmitters.get(e))||void 0===n?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,n=null;"pkce"===this.flowType&&([r,n]=await eQ(this.storage,this.storageKey,!0));try{return await tu(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(e2(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)&&void 0!==e?e:[]},error:null}}catch(e){if(e2(e))return{data:null,error:e};throw e}}async linkIdentity(e){var t;try{let{data:r,error:n}=await this._useSession(async t=>{var r,n,i,s,o;let{data:a,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?void 0:r.redirectTo,scopes:null===(n=e.options)||void 0===n?void 0:n.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await tu(this.fetch,"GET",u,{headers:this.headers,jwt:null!==(o=null===(s=a.session)||void 0===s?void 0:s.access_token)&&void 0!==o?o:void 0})});if(n)throw n;return!eU()||(null===(t=e.options)||void 0===t?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(e2(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,n;let{data:i,error:s}=t;if(s)throw s;return await tu(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(n=null===(r=i.session)||void 0===r?void 0:r.access_token)&&void 0!==n?n:void 0})})}catch(e){if(e2(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,n;let i=Date.now();return await (r=async r=>(r>0&&await eG(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await tu(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:th})),n=(e,t)=>t&&tr(t)&&Date.now()+200*Math.pow(2,e)-i<3e4,new Promise((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{let t=await r(i);if(!n(i,null,t)){e(t);return}}catch(e){if(!n(i,e)){t(e);return}}})()}))}catch(e){if(this._debug(t,"error",e),e2(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),eU()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e;let t="#_recoverAndRefresh()";this._debug(t,"begin");try{let r=await eq(this.storage,this.storageKey);if(this._debug(t,"session from storage",r),!this._isValidSession(r)){this._debug(t,"session is not valid"),null!==r&&await this._removeSession();return}let n=Math.round(Date.now()/1e3),i=(null!==(e=r.expires_at)&&void 0!==e?e:1/0){try{await r.callback(e,t)}catch(e){n.push(e)}});if(await Promise.all(i),n.length>0){for(let e=0;ethis._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){this._debug("#_autoRefreshTokenTick()","no session");return}let n=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),n<=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 tk)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!eU()||!(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){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let n=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await eQ(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});n.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);n.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:n,error:i}=t;return i?{data:null,error:i}:await tu(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token})})}catch(e){if(e2(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,n;let{data:i,error:s}=t;if(s)return{data:null,error:s};let{data:o,error:a}=await tu(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:null===(r=null==i?void 0:i.session)||void 0===r?void 0:r.access_token});return a?{data:null,error:a}:((null===(n=null==o?void 0:o.totp)||void 0===n?void 0:n.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(e){if(e2(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:n,error:i}=t;if(i)return{data:null,error:i};let{data:s,error:o}=await tu(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",s),{data:s,error:o})})}catch(e){if(e2(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:n,error:i}=t;return i?{data:null,error:i}:await tu(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:null===(r=null==n?void 0:n.session)||void 0===r?void 0:r.access_token})})}catch(e){if(e2(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)||[],n=r.filter(e=>"totp"===e.factor_type&&"verified"===e.status);return{data:{all:r,totp:n},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,r;let{data:{session:n},error:i}=e;if(i)return{data:null,error:i};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let s=this._decodeJWT(n.access_token),o=null;s.aal&&(o=s.aal);let a=o;return(null!==(r=null===(t=n.user.factors)||void 0===t?void 0:t.filter(e=>"verified"===e.status))&&void 0!==r?r:[]).length>0&&(a="aal2"),{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:s.amr||[]},error:null}}))}}tA.nextInstanceID=0;var tj=tA;class tO extends tj{constructor(e){super(e)}}class tC{constructor(e,t,r){var n,i,s;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw Error("supabaseUrl is required.");if(!t)throw Error("supabaseKey is required.");let o=e.replace(/\/$/,"");this.realtimeUrl=`${o}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${o}/auth/v1`,this.storageUrl=`${o}/storage/v1`,this.functionsUrl=`${o}/functions/v1`;let a=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,l=function(e,t){let{db:r,auth:n,realtime:i,global:s}=e,{db:o,auth:a,realtime:l,global:u}=t,c={db:Object.assign(Object.assign({},o),r),auth:Object.assign(Object.assign({},a),n),realtime:Object.assign(Object.assign({},l),i),global:Object.assign(Object.assign({},u),s),accessToken:()=>{var e,t,r,n;return e=this,t=void 0,n=function*(){return""},new(r=void 0,r=Promise)(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})}};return e.accessToken?c.accessToken=e.accessToken:delete c.accessToken,c}(null!=r?r:{},{db:eA,realtime:eO,auth:Object.assign(Object.assign({},ej),{storageKey:a}),global:eS});this.storageKey=null!==(n=l.auth.storageKey)&&void 0!==n?n:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken?(this.accessToken=l.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!==(s=l.auth)&&void 0!==s?s:{},this.headers,l.global.fetch),this.fetch=eI(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},l.realtime)),this.rest=new u(`${o}/rest/v1`,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),l.accessToken||this._listenForAuthEvents()}get functions(){return new l(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new ex(this.storageUrl,this.headers,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)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t,r,n,i,s;return r=this,n=void 0,i=void 0,s=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?void 0:e.access_token)&&void 0!==t?t:null},new(i||(i=Promise))(function(e,t){function o(e){try{l(s.next(e))}catch(e){t(e)}}function a(e){try{l(s.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):((r=t.value)instanceof i?r:new i(function(e){e(r)})).then(o,a)}l((s=s.apply(r,n||[])).next())})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,storageKey:i,flowType:s,lock:o,debug:a},l,u){var c;let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new tO({url:this.authUrl,headers:Object.assign(Object.assign({},h),l),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,flowType:s,lock:o,debug:a,fetch:u,hasCustomAuthorizationHeader:"Authorization"in this.headers})}_initRealtimeClient(e){return new R(this.realtimeUrl,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.realtime.setAuth(null!=r?r:null),this.changedAccessToken=r):"SIGNED_OUT"===e&&(this.realtime.setAuth(this.supabaseKey),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}}let tP=(e,t,r)=>new tC(e,t,r)},78369:function(e,t,r){"use strict";r.d(t,{Ry:function(){return u}});var n=new WeakMap,i=new WeakMap,s={},o=0,a=function(e){return e&&(e.host||a(e.parentNode))},l=function(e,t,r,l){var u=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=a(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});s[r]||(s[r]=new WeakMap);var c=s[r],h=[],d=new Set,f=new Set(u),p=function(e){!e||d.has(e)||(d.add(e),p(e.parentNode))};u.forEach(p);var g=function(e){!e||f.has(e)||Array.prototype.forEach.call(e.children,function(e){if(d.has(e))g(e);else try{var t=e.getAttribute(l),s=null!==t&&"false"!==t,o=(n.get(e)||0)+1,a=(c.get(e)||0)+1;n.set(e,o),c.set(e,a),h.push(e),1===o&&s&&i.set(e,!0),1===a&&e.setAttribute(r,"true"),s||e.setAttribute(l,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return g(t),d.clear(),o++,function(){h.forEach(function(e){var t=n.get(e)-1,s=c.get(e)-1;n.set(e,t),c.set(e,s),t||(i.has(e)||e.removeAttribute(l),i.delete(e)),s||e.removeAttribute(r)}),--o||(n=new WeakMap,n=new WeakMap,i=new WeakMap,s={})}},u=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),i=t||("undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),l(n,i,r,"aria-hidden")):function(){return null}}},25944:function(e,t,r){"use strict";function n(e,t,r,n){return!1}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDomainLocale",{enumerable:!0,get:function(){return n}}),r(18157),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},231:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return b}});let n=r(99920),i=r(57437),s=n._(r(2265)),o=r(98016),a=r(18029),l=r(41142),u=r(43461),c=r(844),h=r(60291),d=r(44467),f=r(53106),p=r(25944),g=r(4897),y=r(51507),v=new Set;function m(e,t,r,n,i,s){if("undefined"!=typeof window&&(s||(0,a.isLocalURL)(t))){if(!n.bypassPrefetchedCheck){let i=t+"%"+r+"%"+(void 0!==n.locale?n.locale:"locale"in e?e.locale:void 0);if(v.has(i))return;v.add(i)}(async()=>s?e.prefetch(t,i):e.prefetch(t,r,n))().catch(e=>{})}}function w(e){return"string"==typeof e?e:(0,l.formatUrl)(e)}let b=s.default.forwardRef(function(e,t){let r,n;let{href:l,as:v,children:b,prefetch:_=null,passHref:k,replace:E,shallow:x,scroll:T,locale:S,onClick:A,onMouseEnter:j,onTouchStart:O,legacyBehavior:C=!1,...P}=e;r=b,C&&("string"==typeof r||"number"==typeof r)&&(r=(0,i.jsx)("a",{children:r}));let R=s.default.useContext(h.RouterContext),I=s.default.useContext(d.AppRouterContext),L=null!=R?R:I,$=!R,D=!1!==_,M=null===_?y.PrefetchKind.AUTO:y.PrefetchKind.FULL,{href:U,as:N}=s.default.useMemo(()=>{if(!R){let e=w(l);return{href:e,as:v?w(v):e}}let[e,t]=(0,o.resolveHref)(R,l,!0);return{href:e,as:v?(0,o.resolveHref)(R,v):t||e}},[R,l,v]),B=s.default.useRef(U),F=s.default.useRef(N);C&&(n=s.default.Children.only(r));let z=C?n&&"object"==typeof n&&n.ref:t,[W,H,q]=(0,f.useIntersection)({rootMargin:"200px"}),K=s.default.useCallback(e=>{(F.current!==N||B.current!==U)&&(q(),F.current=N,B.current=U),W(e),z&&("function"==typeof z?z(e):"object"==typeof z&&(z.current=e))},[N,z,U,q,W]);s.default.useEffect(()=>{L&&H&&D&&m(L,U,N,{locale:S},{kind:M},$)},[N,U,H,S,D,null==R?void 0:R.locale,L,$,M]);let J={ref:K,onClick(e){C||"function"!=typeof A||A(e),C&&n.props&&"function"==typeof n.props.onClick&&n.props.onClick(e),L&&!e.defaultPrevented&&function(e,t,r,n,i,o,l,u,c){let{nodeName:h}=e.currentTarget;if("A"===h.toUpperCase()&&(function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||!c&&!(0,a.isLocalURL)(r)))return;e.preventDefault();let d=()=>{let e=null==l||l;"beforePopState"in t?t[i?"replace":"push"](r,n,{shallow:o,locale:u,scroll:e}):t[i?"replace":"push"](n||r,{scroll:e})};c?s.default.startTransition(d):d()}(e,L,U,N,E,x,T,S,$)},onMouseEnter(e){C||"function"!=typeof j||j(e),C&&n.props&&"function"==typeof n.props.onMouseEnter&&n.props.onMouseEnter(e),L&&(D||!$)&&m(L,U,N,{locale:S,priority:!0,bypassPrefetchedCheck:!0},{kind:M},$)},onTouchStart:function(e){C||"function"!=typeof O||O(e),C&&n.props&&"function"==typeof n.props.onTouchStart&&n.props.onTouchStart(e),L&&(D||!$)&&m(L,U,N,{locale:S,priority:!0,bypassPrefetchedCheck:!0},{kind:M},$)}};if((0,u.isAbsoluteUrl)(N))J.href=N;else if(!C||k||"a"===n.type&&!("href"in n.props)){let e=void 0!==S?S:null==R?void 0:R.locale,t=(null==R?void 0:R.isLocaleDomain)&&(0,p.getDomainLocale)(N,e,null==R?void 0:R.locales,null==R?void 0:R.domainLocales);J.href=t||(0,g.addBasePath)((0,c.addLocale)(N,e,null==R?void 0:R.defaultLocale))}return C?s.default.cloneElement(n,J):(0,i.jsx)("a",{...P,...J,children:r})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},53106:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useIntersection",{enumerable:!0,get:function(){return l}});let n=r(2265),i=r(49189),s="function"==typeof IntersectionObserver,o=new Map,a=[];function l(e){let{rootRef:t,rootMargin:r,disabled:l}=e,u=l||!s,[c,h]=(0,n.useState)(!1),d=(0,n.useRef)(null),f=(0,n.useCallback)(e=>{d.current=e},[]);return(0,n.useEffect)(()=>{if(s){if(u||c)return;let e=d.current;if(e&&e.tagName)return function(e,t,r){let{id:n,observer:i,elements:s}=function(e){let t;let r={root:e.root||null,margin:e.rootMargin||""},n=a.find(e=>e.root===r.root&&e.margin===r.margin);if(n&&(t=o.get(n)))return t;let i=new Map;return t={id:r,observer:new IntersectionObserver(e=>{e.forEach(e=>{let t=i.get(e.target),r=e.isIntersecting||e.intersectionRatio>0;t&&r&&t(r)})},e),elements:i},a.push(r),o.set(r,t),t}(r);return s.set(e,t),i.observe(e),function(){if(s.delete(e),i.unobserve(e),0===s.size){i.disconnect(),o.delete(n);let e=a.findIndex(e=>e.root===n.root&&e.margin===n.margin);e>-1&&a.splice(e,1)}}}(e,e=>e&&h(e),{root:null==t?void 0:t.current,rootMargin:r})}else if(!c){let e=(0,i.requestIdleCallback)(()=>h(!0));return()=>(0,i.cancelIdleCallback)(e)}},[u,r,t,c,d.current]),[f,c,(0,n.useCallback)(()=>{h(!1)},[])]}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},86300:function(e){!function(){var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,s=l(e),o=s[0],a=s[1],u=new i((o+a)*3/4-a),c=0,h=a>0?o-4:o;for(r=0;r>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=0,a=n-i;o>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},72:function(e,t,r){"use strict";/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */var n=r(675),i=r(783),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(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)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!a.isEncoding(t))throw TypeError("Unknown encoding: "+t);var r=0|f(e,t),n=o(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);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 n;if(t<0||e.byteLength=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(a.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,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return T(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return A(e).length;default:if(i)return n?-1:T(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){var i,s,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 n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(s=r=+r)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var s,o=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;o=2,a/=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(s=r;sa&&(r=a-l),s=r;s>=0;s--){for(var h=!0,d=0;d239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],o=e[i+2],(192&s)==128&&(192&o)==128&&(l=(15&u)<<12|(63&s)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],(192&s)==128&&(192&o)==128&&(192&a)==128&&(l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;nr)throw RangeError("Trying to access beyond buffer length")}function b(e,t,r,n,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function _(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,s){return t=+t,r>>>=0,s||_(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function E(e,t,r,n,s){return t=+t,r>>>=0,s||_(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,a.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}}(),a.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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(O(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),O(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.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,n=t.length,i=0,s=Math.min(r,n);ir&&(e+=" ... "),""},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(O(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.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===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,o=r-t,l=Math.min(s,o),u=this.slice(n,i),c=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,s,o,a,l,u,c,h,d,f,p,g,y=this.length-t;if((void 0===r||r>y)&&(r=y),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var v=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;n>s/2&&(n=s/2);for(var o=0;o>8,i.push(r%256),i.push(n);return i}(e,this.length-p),this,p,g);default:if(v)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),v=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.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>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,s=0;++s>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=this[e],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||w(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var s=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var s=r-1,o=1;for(this[t+s]=255&e;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var s=r-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return E(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return E(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===n&&s<128||"latin1"===n)&&(e=s)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function S(e){for(var t=[],r=0;r=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function O(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var C=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},783:function(e,t){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-c)-1,f>>=-c,c+=a;c>0;s=256*s+e[t+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+e[t+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,l,u=8*s-i-1,c=(1<>1,d=23===i?5960464477539062e-23:0,f=n?0:s-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+h>=1?t+=d/l:t+=d*Math.pow(2,1-h),t*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(t*l-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(o=o<0;e[r+f]=255&o,f+=p,o/=256,u-=8);e[r+f-p]|=128*g}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var s=r[e]={exports:{}},o=!0;try{t[e](s,s.exports,n),o=!1}finally{o&&delete r[e]}return s.exports}n.ab="//";var i=n(72);e.exports=i}()},49418:function(e,t,r){"use strict";r.d(t,{Z:function(){return Y}});var n,i,s,o,a,l,u,c=function(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;rt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);it.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}"function"==typeof SuppressedError&&SuppressedError;var d=r(2265),f="right-scroll-bar-position",p="width-before-scroll-bar";function g(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var y="undefined"!=typeof window?d.useLayoutEffect:d.useEffect,v=new WeakMap,m=(void 0===i&&(i={}),(void 0===s&&(s=function(e){return e}),o=[],a=!1,l={read:function(){if(a)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return o.length?o[o.length-1]:null},useMedium:function(e){var t=s(e,a);return o.push(t),function(){o=o.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(a=!0;o.length;){var t=o;o=[],t.forEach(e)}o={push:function(t){return e(t)},filter:function(){return o}}},assignMedium:function(e){a=!0;var t=[];if(o.length){var r=o;o=[],r.forEach(e),t=o}var n=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(n)};i(),o={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),o}}}}).options=c({async:!0,ssr:!1},i),l),w=function(){},b=d.forwardRef(function(e,t){var r,n,i,s,o=d.useRef(null),a=d.useState({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:w}),l=a[0],u=a[1],f=e.forwardProps,p=e.children,b=e.className,_=e.removeScrollBar,k=e.enabled,E=e.shards,x=e.sideCar,T=e.noIsolation,S=e.inert,A=e.allowPinchZoom,j=e.as,O=e.gapMode,C=h(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=(r=[o,t],n=function(e){return r.forEach(function(t){return g(t,e)})},(i=(0,d.useState)(function(){return{value:null,callback:n,facade:{get current(){return i.value},set current(value){var e=i.value;e!==value&&(i.value=value,i.callback(value,e))}}}})[0]).callback=n,s=i.facade,y(function(){var e=v.get(s);if(e){var t=new Set(e),n=new Set(r),i=s.current;t.forEach(function(e){n.has(e)||g(e,null)}),n.forEach(function(e){t.has(e)||g(e,i)})}v.set(s,r)},[r]),s),R=c(c({},C),l);return d.createElement(d.Fragment,null,k&&d.createElement(x,{sideCar:m,removeScrollBar:_,shards:E,noIsolation:T,inert:S,setCallbacks:u,allowPinchZoom:!!A,lockRef:o,gapMode:O}),f?d.cloneElement(d.Children.only(p),c(c({},R),{ref:P})):d.createElement(void 0===j?"div":j,c({},R,{className:b,ref:P}),p))});b.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},b.classNames={fullWidth:p,zeroRight:f};var _=function(e){var t=e.sideCar,r=h(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return d.createElement(n,c({},r))};_.isSideCarExport=!0;var k=function(){var e=0,t=null;return{add:function(i){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=n||r.nc;return t&&e.setAttribute("nonce",t),e}())){var s,o;(s=t).styleSheet?s.styleSheet.cssText=i:s.appendChild(document.createTextNode(i)),o=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(o)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},E=function(){var e=k();return function(t,r){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},x=function(){var e=E();return function(t){return e(t.styles,t.dynamic),null}},T={left:0,top:0,right:0,gap:0},S=function(e){return parseInt(e||"",10)||0},A=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],i=t["padding"===e?"paddingRight":"marginRight"];return[S(r),S(n),S(i)]},j=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return T;var t=A(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},O=x(),C="data-scroll-locked",P=function(e,t,r,n){var i=e.left,s=e.top,o=e.right,a=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(a,"px ").concat(n,";\n }\n body[").concat(C,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(i,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(a,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(a,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(f," {\n right: ").concat(a,"px ").concat(n,";\n }\n \n .").concat(p," {\n margin-right: ").concat(a,"px ").concat(n,";\n }\n \n .").concat(f," .").concat(f," {\n right: 0 ").concat(n,";\n }\n \n .").concat(p," .").concat(p," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(C,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(a,"px;\n }\n")},R=function(){var e=parseInt(document.body.getAttribute(C)||"0",10);return isFinite(e)?e:0},I=function(){d.useEffect(function(){return document.body.setAttribute(C,(R()+1).toString()),function(){var e=R()-1;e<=0?document.body.removeAttribute(C):document.body.setAttribute(C,e.toString())}},[])},L=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=void 0===n?"margin":n;I();var s=d.useMemo(function(){return j(i)},[i]);return d.createElement(O,{styles:P(s,!t,i,r?"":"!important")})},$=!1;if("undefined"!=typeof window)try{var D=Object.defineProperty({},"passive",{get:function(){return $=!0,!0}});window.addEventListener("test",D,D),window.removeEventListener("test",D,D)}catch(e){$=!1}var M=!!$&&{passive:!1},U=function(e,t){var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&"TEXTAREA"!==e.tagName&&"visible"===r[t])},N=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),B(e,n)){var i=F(e,n);if(i[1]>i[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},B=function(e,t){return"v"===e?U(t,"overflowY"):U(t,"overflowX")},F=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},z=function(e,t,r,n,i){var s,o=(s=window.getComputedStyle(t).direction,"h"===e&&"rtl"===s?-1:1),a=o*n,l=r.target,u=t.contains(l),c=!1,h=a>0,d=0,f=0;do{var p=F(e,l),g=p[0],y=p[1]-p[2]-o*g;(g||y)&&B(e,l)&&(d+=y,f+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return h&&(i&&1>Math.abs(d)||!i&&a>d)?c=!0:!h&&(i&&1>Math.abs(f)||!i&&-a>f)&&(c=!0),c},W=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},H=function(e){return[e.deltaX,e.deltaY]},q=function(e){return e&&"current"in e?e.current:e},K=0,J=[],V=(u=function(e){var t=d.useRef([]),r=d.useRef([0,0]),n=d.useRef(),i=d.useState(K++)[0],s=d.useState(x)[0],o=d.useRef(e);d.useEffect(function(){o.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(function(e,t,r){if(r||2==arguments.length)for(var n,i=0,s=t.length;iMath.abs(u)?"h":"v";if("touches"in e&&"h"===h&&"range"===c.type)return!1;var d=N(h,c);if(!d)return!0;if(d?i=h:(i="v"===h?"h":"v",d=N(h,c)),!d)return!1;if(!n.current&&"changedTouches"in e&&(l||u)&&(n.current=i),!i)return!0;var f=n.current||i;return z(f,t,e,"h"===f?l:u,!0)},[]),l=d.useCallback(function(e){if(J.length&&J[J.length-1]===s){var r="deltaY"in e?H(e):W(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta)[0]===r[0]&&n[1]===r[1]})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var i=(o.current.shards||[]).map(q).filter(Boolean).filter(function(t){return t.contains(e.target)});(i.length>0?a(e,i[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),u=d.useCallback(function(e,r,n,i){var s={name:e,delta:r,target:n,should:i,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),c=d.useCallback(function(e){r.current=W(e),n.current=void 0},[]),h=d.useCallback(function(t){u(t.type,H(t),t.target,a(t,e.lockRef.current))},[]),f=d.useCallback(function(t){u(t.type,W(t),t.target,a(t,e.lockRef.current))},[]);d.useEffect(function(){return J.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",l,M),document.addEventListener("touchmove",l,M),document.addEventListener("touchstart",c,M),function(){J=J.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,M),document.removeEventListener("touchmove",l,M),document.removeEventListener("touchstart",c,M)}},[]);var p=e.removeScrollBar,g=e.inert;return d.createElement(d.Fragment,null,g?d.createElement(s,{styles:"\n .block-interactivity-".concat(i," {pointer-events: none;}\n .allow-interactivity-").concat(i," {pointer-events: all;}\n")}):null,p?d.createElement(L,{gapMode:e.gapMode}):null)},m.useMedium(u),_),G=d.forwardRef(function(e,t){return d.createElement(b,c({},e,{ref:t,sideCar:V}))});G.classNames=b.classNames;var Y=G},13304:function(e,t,r){"use strict";r.d(t,{Dx:function(){return er},VY:function(){return et},aV:function(){return ee},dk:function(){return en},fC:function(){return X},h_:function(){return Q},jm:function(){return J},p8:function(){return _},x8:function(){return ei},xz:function(){return Z}});var n=r(2265),i=r(78149),s=r(1584),o=r(98324),a=r(53201),l=r(91715),u=r(53938),c=r(80467),h=r(7715),d=r(31383),f=r(25171),p=r(20589),g=r(49418),y=r(78369),v=r(71538),m=r(57437),w="Dialog",[b,_]=(0,o.b)(w),[k,E]=b(w),x=e=>{let{__scopeDialog:t,children:r,open:i,defaultOpen:s,onOpenChange:o,modal:u=!0}=e,c=n.useRef(null),h=n.useRef(null),[d=!1,f]=(0,l.T)({prop:i,defaultProp:s,onChange:o});return(0,m.jsx)(k,{scope:t,triggerRef:c,contentRef:h,contentId:(0,a.M)(),titleId:(0,a.M)(),descriptionId:(0,a.M)(),open:d,onOpenChange:f,onOpenToggle:n.useCallback(()=>f(e=>!e),[f]),modal:u,children:r})};x.displayName=w;var T="DialogTrigger",S=n.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,o=E(T,r),a=(0,s.e)(t,o.triggerRef);return(0,m.jsx)(f.WV.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":q(o.open),...n,ref:a,onClick:(0,i.M)(e.onClick,o.onOpenToggle)})});S.displayName=T;var A="DialogPortal",[j,O]=b(A,{forceMount:void 0}),C=e=>{let{__scopeDialog:t,forceMount:r,children:i,container:s}=e,o=E(A,t);return(0,m.jsx)(j,{scope:t,forceMount:r,children:n.Children.map(i,e=>(0,m.jsx)(d.z,{present:r||o.open,children:(0,m.jsx)(h.h,{asChild:!0,container:s,children:e})}))})};C.displayName=A;var P="DialogOverlay",R=n.forwardRef((e,t)=>{let r=O(P,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,s=E(P,e.__scopeDialog);return s.modal?(0,m.jsx)(d.z,{present:n||s.open,children:(0,m.jsx)(I,{...i,ref:t})}):null});R.displayName=P;var I=n.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=E(P,r);return(0,m.jsx)(g.Z,{as:v.g7,allowPinchZoom:!0,shards:[i.contentRef],children:(0,m.jsx)(f.WV.div,{"data-state":q(i.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),L="DialogContent",$=n.forwardRef((e,t)=>{let r=O(L,e.__scopeDialog),{forceMount:n=r.forceMount,...i}=e,s=E(L,e.__scopeDialog);return(0,m.jsx)(d.z,{present:n||s.open,children:s.modal?(0,m.jsx)(D,{...i,ref:t}):(0,m.jsx)(M,{...i,ref:t})})});$.displayName=L;var D=n.forwardRef((e,t)=>{let r=E(L,e.__scopeDialog),o=n.useRef(null),a=(0,s.e)(t,r.contentRef,o);return n.useEffect(()=>{let e=o.current;if(e)return(0,y.Ry)(e)},[]),(0,m.jsx)(U,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,i.M)(e.onCloseAutoFocus,e=>{var t;e.preventDefault(),null===(t=r.triggerRef.current)||void 0===t||t.focus()}),onPointerDownOutside:(0,i.M)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,i.M)(e.onFocusOutside,e=>e.preventDefault())})}),M=n.forwardRef((e,t)=>{let r=E(L,e.__scopeDialog),i=n.useRef(!1),s=n.useRef(!1);return(0,m.jsx)(U,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var n,o;null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,t),t.defaultPrevented||(i.current||null===(o=r.triggerRef.current)||void 0===o||o.focus(),t.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:t=>{var n,o;null===(n=e.onInteractOutside)||void 0===n||n.call(e,t),t.defaultPrevented||(i.current=!0,"pointerdown"!==t.detail.originalEvent.type||(s.current=!0));let a=t.target;(null===(o=r.triggerRef.current)||void 0===o?void 0:o.contains(a))&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),U=n.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:a,...l}=e,h=E(L,r),d=n.useRef(null),f=(0,s.e)(t,d);return(0,p.EW)(),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(c.M,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:a,children:(0,m.jsx)(u.XB,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":q(h.open),...l,ref:f,onDismiss:()=>h.onOpenChange(!1)})}),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(G,{titleId:h.titleId}),(0,m.jsx)(Y,{contentRef:d,descriptionId:h.descriptionId})]})]})}),N="DialogTitle",B=n.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=E(N,r);return(0,m.jsx)(f.WV.h2,{id:i.titleId,...n,ref:t})});B.displayName=N;var F="DialogDescription",z=n.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,i=E(F,r);return(0,m.jsx)(f.WV.p,{id:i.descriptionId,...n,ref:t})});z.displayName=F;var W="DialogClose",H=n.forwardRef((e,t)=>{let{__scopeDialog:r,...n}=e,s=E(W,r);return(0,m.jsx)(f.WV.button,{type:"button",...n,ref:t,onClick:(0,i.M)(e.onClick,()=>s.onOpenChange(!1))})});function q(e){return e?"open":"closed"}H.displayName=W;var K="DialogTitleWarning",[J,V]=(0,o.k)(K,{contentName:L,titleName:N,docsSlug:"dialog"}),G=e=>{let{titleId:t}=e,r=V(K),i="`".concat(r.contentName,"` requires a `").concat(r.titleName,"` for the component to be accessible for screen reader users.\n\nIf you want to hide the `").concat(r.titleName,"`, you can wrap it with our VisuallyHidden component.\n\nFor more information, see https://radix-ui.com/primitives/docs/components/").concat(r.docsSlug);return n.useEffect(()=>{t&&!document.getElementById(t)&&console.error(i)},[i,t]),null},Y=e=>{let{contentRef:t,descriptionId:r}=e,i=V("DialogDescriptionWarning"),s="Warning: Missing `Description` or `aria-describedby={undefined}` for {".concat(i.contentName,"}.");return n.useEffect(()=>{var e;let n=null===(e=t.current)||void 0===e?void 0:e.getAttribute("aria-describedby");r&&n&&!document.getElementById(r)&&console.warn(s)},[s,t,r]),null},X=x,Z=S,Q=C,ee=R,et=$,er=B,en=z,ei=H},87513:function(e,t,r){"use strict";r.d(t,{gm:function(){return s}});var n=r(2265);r(57437);var i=n.createContext(void 0);function s(e){let t=n.useContext(i);return e||t||"ltr"}},20589:function(e,t,r){"use strict";r.d(t,{EW:function(){return s}});var n=r(2265),i=0;function s(){n.useEffect(()=>{var e,t;let r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",null!==(e=r[0])&&void 0!==e?e:o()),document.body.insertAdjacentElement("beforeend",null!==(t=r[1])&&void 0!==t?t:o()),i++,()=>{1===i&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),i--}},[])}function o(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}},80467:function(e,t,r){"use strict";let n;r.d(t,{M:function(){return d}});var i=r(2265),s=r(1584),o=r(25171),a=r(75137),l=r(57437),u="focusScope.autoFocusOnMount",c="focusScope.autoFocusOnUnmount",h={bubbles:!1,cancelable:!0},d=i.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:d,onUnmountAutoFocus:v,...m}=e,[w,b]=i.useState(null),_=(0,a.W)(d),k=(0,a.W)(v),E=i.useRef(null),x=(0,s.e)(t,e=>b(e)),T=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(n){let e=function(e){if(T.paused||!w)return;let t=e.target;w.contains(t)?E.current=t:g(E.current,{select:!0})},t=function(e){if(T.paused||!w)return;let t=e.relatedTarget;null===t||w.contains(t)||g(E.current,{select:!0})};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&g(w)});return w&&r.observe(w,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,w,T.paused]),i.useEffect(()=>{if(w){y.add(T);let e=document.activeElement;if(!w.contains(e)){let t=new CustomEvent(u,h);w.addEventListener(u,_),w.dispatchEvent(t),t.defaultPrevented||(function(e){let{select:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.activeElement;for(let n of e)if(g(n,{select:t}),document.activeElement!==r)return}(f(w).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&g(w))}return()=>{w.removeEventListener(u,_),setTimeout(()=>{let t=new CustomEvent(c,h);w.addEventListener(c,k),w.dispatchEvent(t),t.defaultPrevented||g(null!=e?e:document.body,{select:!0}),w.removeEventListener(c,k),y.remove(T)},0)}}},[w,_,k,T]);let S=i.useCallback(e=>{if(!r&&!n||T.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[n,s]=function(e){let t=f(e);return[p(t,e),p(t.reverse(),e)]}(t);n&&s?e.shiftKey||i!==s?e.shiftKey&&i===n&&(e.preventDefault(),r&&g(s,{select:!0})):(e.preventDefault(),r&&g(n,{select:!0})):i===t&&e.preventDefault()}},[r,n,T.paused]);return(0,l.jsx)(o.WV.div,{tabIndex:-1,...m,ref:x,onKeyDown:S})});function f(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function p(e,t){for(let r of e)if(!function(e,t){let{upTo:r}=t;if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===r||e!==r);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function g(e){let{select:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}d.displayName="FocusScope";var y=(n=[],{add(e){let t=n[0];e!==t&&(null==t||t.pause()),(n=v(n,e)).unshift(e)},remove(e){var t;null===(t=(n=v(n,e))[0])||void 0===t||t.resume()}});function v(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}},53201:function(e,t,r){"use strict";r.d(t,{M:function(){return l}});var n,i=r(2265),s=r(1336),o=(n||(n=r.t(i,2)))["useId".toString()]||(()=>void 0),a=0;function l(e){let[t,r]=i.useState(o());return(0,s.b)(()=>{e||r(e=>e??String(a++))},[e]),e||(t?`radix-${t}`:"")}},25510:function(e,t,r){"use strict";r.d(t,{ee:function(){return eJ},Eh:function(){return eG},VY:function(){return eV},fC:function(){return eK},D7:function(){return eC}});var n=r(2265);let i=["top","right","bottom","left"],s=Math.min,o=Math.max,a=Math.round,l=Math.floor,u=e=>({x:e,y:e}),c={left:"right",right:"left",bottom:"top",top:"bottom"},h={start:"end",end:"start"};function d(e,t){return"function"==typeof e?e(t):e}function f(e){return e.split("-")[0]}function p(e){return e.split("-")[1]}function g(e){return"x"===e?"y":"x"}function y(e){return"y"===e?"height":"width"}function v(e){return["top","bottom"].includes(f(e))?"y":"x"}function m(e){return e.replace(/start|end/g,e=>h[e])}function w(e){return e.replace(/left|right|bottom|top/g,e=>c[e])}function b(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function _(e){let{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function k(e,t,r){let n,{reference:i,floating:s}=e,o=v(t),a=g(v(t)),l=y(a),u=f(t),c="y"===o,h=i.x+i.width/2-s.width/2,d=i.y+i.height/2-s.height/2,m=i[l]/2-s[l]/2;switch(u){case"top":n={x:h,y:i.y-s.height};break;case"bottom":n={x:h,y:i.y+i.height};break;case"right":n={x:i.x+i.width,y:d};break;case"left":n={x:i.x-s.width,y:d};break;default:n={x:i.x,y:i.y}}switch(p(t)){case"start":n[a]-=m*(r&&c?-1:1);break;case"end":n[a]+=m*(r&&c?-1:1)}return n}let E=async(e,t,r)=>{let{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:o}=r,a=s.filter(Boolean),l=await (null==o.isRTL?void 0:o.isRTL(t)),u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:c,y:h}=k(u,n,l),d=n,f={},p=0;for(let r=0;re[t]>=0)}async function A(e,t){let{placement:r,platform:n,elements:i}=e,s=await (null==n.isRTL?void 0:n.isRTL(i.floating)),o=f(r),a=p(r),l="y"===v(r),u=["left","top"].includes(o)?-1:1,c=s&&l?-1:1,h=d(t,e),{mainAxis:g,crossAxis:y,alignmentAxis:m}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return a&&"number"==typeof m&&(y="end"===a?-1*m:m),l?{x:y*c,y:g*u}:{x:g*u,y:y*c}}function j(e){return P(e)?(e.nodeName||"").toLowerCase():"#document"}function O(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function C(e){var t;return null==(t=(P(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function P(e){return e instanceof Node||e instanceof O(e).Node}function R(e){return e instanceof Element||e instanceof O(e).Element}function I(e){return e instanceof HTMLElement||e instanceof O(e).HTMLElement}function L(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof O(e).ShadowRoot)}function $(e){let{overflow:t,overflowX:r,overflowY:n,display:i}=B(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function D(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(e){return!1}})}function M(e){let t=U(),r=R(e)?B(e):e;return"none"!==r.transform||"none"!==r.perspective||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||["transform","perspective","filter"].some(e=>(r.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(r.contain||"").includes(e))}function U(){return"undefined"!=typeof CSS&&!!CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")}function N(e){return["html","body","#document"].includes(j(e))}function B(e){return O(e).getComputedStyle(e)}function F(e){return R(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function z(e){if("html"===j(e))return e;let t=e.assignedSlot||e.parentNode||L(e)&&e.host||C(e);return L(t)?t.host:t}function W(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let i=function e(t){let r=z(t);return N(r)?t.ownerDocument?t.ownerDocument.body:t.body:I(r)&&$(r)?r:e(r)}(e),s=i===(null==(n=e.ownerDocument)?void 0:n.body),o=O(i);if(s){let e=H(o);return t.concat(o,o.visualViewport||[],$(i)?i:[],e&&r?W(e):[])}return t.concat(i,W(i,[],r))}function H(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function q(e){let t=B(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,i=I(e),s=i?e.offsetWidth:r,o=i?e.offsetHeight:n,l=a(r)!==s||a(n)!==o;return l&&(r=s,n=o),{width:r,height:n,$:l}}function K(e){return R(e)?e:e.contextElement}function J(e){let t=K(e);if(!I(t))return u(1);let r=t.getBoundingClientRect(),{width:n,height:i,$:s}=q(t),o=(s?a(r.width):r.width)/n,l=(s?a(r.height):r.height)/i;return o&&Number.isFinite(o)||(o=1),l&&Number.isFinite(l)||(l=1),{x:o,y:l}}let V=u(0);function G(e){let t=O(e);return U()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:V}function Y(e,t,r,n){var i;void 0===t&&(t=!1),void 0===r&&(r=!1);let s=e.getBoundingClientRect(),o=K(e),a=u(1);t&&(n?R(n)&&(a=J(n)):a=J(e));let l=(void 0===(i=r)&&(i=!1),n&&(!i||n===O(o))&&i)?G(o):u(0),c=(s.left+l.x)/a.x,h=(s.top+l.y)/a.y,d=s.width/a.x,f=s.height/a.y;if(o){let e=O(o),t=n&&R(n)?O(n):n,r=e,i=H(r);for(;i&&n&&t!==r;){let e=J(i),t=i.getBoundingClientRect(),n=B(i),s=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;c*=e.x,h*=e.y,d*=e.x,f*=e.y,c+=s,h+=o,i=H(r=O(i))}}return _({width:d,height:f,x:c,y:h})}function X(e){return Y(C(e)).left+F(e).scrollLeft}function Z(e,t,r){let n;if("viewport"===t)n=function(e,t){let r=O(e),n=C(e),i=r.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;let e=U();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}(e,r);else if("document"===t)n=function(e){let t=C(e),r=F(e),n=e.ownerDocument.body,i=o(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=o(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),a=-r.scrollLeft+X(e),l=-r.scrollTop;return"rtl"===B(n).direction&&(a+=o(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:a,y:l}}(C(e));else if(R(t))n=function(e,t){let r=Y(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,s=I(e)?J(e):u(1),o=e.clientWidth*s.x;return{width:o,height:e.clientHeight*s.y,x:i*s.x,y:n*s.y}}(t,r);else{let r=G(e);n={...t,x:t.x-r.x,y:t.y-r.y}}return _(n)}function Q(e){return"static"===B(e).position}function ee(e,t){return I(e)&&"fixed"!==B(e).position?t?t(e):e.offsetParent:null}function et(e,t){let r=O(e);if(D(e))return r;if(!I(e)){let t=z(e);for(;t&&!N(t);){if(R(t)&&!Q(t))return t;t=z(t)}return r}let n=ee(e,t);for(;n&&["table","td","th"].includes(j(n))&&Q(n);)n=ee(n,t);return n&&N(n)&&Q(n)&&!M(n)?r:n||function(e){let t=z(e);for(;I(t)&&!N(t);){if(M(t))return t;if(D(t))break;t=z(t)}return null}(e)||r}let er=async function(e){let t=this.getOffsetParent||et,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=I(t),i=C(t),s="fixed"===r,o=Y(e,!0,s,t),a={scrollLeft:0,scrollTop:0},l=u(0);if(n||!n&&!s){if(("body"!==j(t)||$(i))&&(a=F(t)),n){let e=Y(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=X(i))}return{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},en={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e,s="fixed"===i,o=C(n),a=!!t&&D(t.floating);if(n===o||a&&s)return r;let l={scrollLeft:0,scrollTop:0},c=u(1),h=u(0),d=I(n);if((d||!d&&!s)&&(("body"!==j(n)||$(o))&&(l=F(n)),I(n))){let e=Y(n);c=J(n),h.x=e.x+n.clientLeft,h.y=e.y+n.clientTop}return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+h.x,y:r.y*c.y-l.scrollTop*c.y+h.y}},getDocumentElement:C,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e,a=[..."clippingAncestors"===r?D(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=W(e,[],!1).filter(e=>R(e)&&"body"!==j(e)),i=null,s="fixed"===B(e).position,o=s?z(e):e;for(;R(o)&&!N(o);){let t=B(o),r=M(o);r||"fixed"!==t.position||(i=null),(s?!r&&!i:!r&&"static"===t.position&&!!i&&["absolute","fixed"].includes(i.position)||$(o)&&!r&&function e(t,r){let n=z(t);return!(n===r||!R(n)||N(n))&&("fixed"===B(n).position||e(n,r))}(e,o))?n=n.filter(e=>e!==o):i=t,o=z(o)}return t.set(e,n),n}(t,this._c):[].concat(r),n],l=a[0],u=a.reduce((e,r)=>{let n=Z(t,r,i);return e.top=o(n.top,e.top),e.right=s(n.right,e.right),e.bottom=s(n.bottom,e.bottom),e.left=o(n.left,e.left),e},Z(t,l,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:et,getElementRects:er,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=q(e);return{width:t,height:r}},getScale:J,isElement:R,isRTL:function(e){return"rtl"===B(e).direction}},ei=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:i,rects:a,platform:l,elements:u,middlewareData:c}=t,{element:h,padding:f=0}=d(e,t)||{};if(null==h)return{};let m=b(f),w={x:r,y:n},_=g(v(i)),k=y(_),E=await l.getDimensions(h),x="y"===_,T=x?"clientHeight":"clientWidth",S=a.reference[k]+a.reference[_]-w[_]-a.floating[k],A=w[_]-a.reference[_],j=await (null==l.getOffsetParent?void 0:l.getOffsetParent(h)),O=j?j[T]:0;O&&await (null==l.isElement?void 0:l.isElement(j))||(O=u.floating[T]||a.floating[k]);let C=O/2-E[k]/2-1,P=s(m[x?"top":"left"],C),R=s(m[x?"bottom":"right"],C),I=O-E[k]-R,L=O/2-E[k]/2+(S/2-A/2),$=o(P,s(L,I)),D=!c.arrow&&null!=p(i)&&L!==$&&a.reference[k]/2-(L{let n=new Map,i={platform:en,...r},s={...i.platform,_c:n};return E(e,t,{...i,platform:s})};var eo=r(54887),ea="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function el(e,t){let r,n,i;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!el(e[n],t[n]))return!1;return!0}if((r=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,i[n]))return!1;for(n=r;0!=n--;){let r=i[n];if(("_owner"!==r||!e.$$typeof)&&!el(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function eu(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ec(e,t){let r=eu(e);return Math.round(t*r)/r}function eh(e){let t=n.useRef(e);return ea(()=>{t.current=e}),t}let ed=e=>({name:"arrow",options:e,fn(t){let{element:r,padding:n}="function"==typeof e?e(t):e;return r&&({}).hasOwnProperty.call(r,"current")?null!=r.current?ei({element:r.current,padding:n}).fn(t):{}:r?ei({element:r,padding:n}).fn(t):{}}}),ef=(e,t)=>{var r;return{...(void 0===(r=e)&&(r=0),{name:"offset",options:r,async fn(e){var t,n;let{x:i,y:s,placement:o,middlewareData:a}=e,l=await A(e,r);return o===(null==(t=a.offset)?void 0:t.placement)&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}),options:[e,t]}},ep=(e,t)=>{var r;return{...(void 0===(r=e)&&(r={}),{name:"shift",options:r,async fn(e){let{x:t,y:n,placement:i}=e,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...c}=d(r,e),h={x:t,y:n},p=await x(e,c),y=v(f(i)),m=g(y),w=h[m],b=h[y];if(a){let e="y"===m?"top":"left",t="y"===m?"bottom":"right",r=w+p[e],n=w-p[t];w=o(r,s(w,n))}if(l){let e="y"===y?"top":"left",t="y"===y?"bottom":"right",r=b+p[e],n=b-p[t];b=o(r,s(b,n))}let _=u.fn({...e,[m]:w,[y]:b});return{..._,data:{x:_.x-t,y:_.y-n}}}}),options:[e,t]}},eg=(e,t)=>{var r;return{...(void 0===(r=e)&&(r={}),{options:r,fn(e){let{x:t,y:n,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=d(r,e),c={x:t,y:n},h=v(i),p=g(h),y=c[p],m=c[h],w=d(a,e),b="number"==typeof w?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(l){let e="y"===p?"height":"width",t=s.reference[p]-s.floating[e]+b.mainAxis,r=s.reference[p]+s.reference[e]-b.mainAxis;yr&&(y=r)}if(u){var _,k;let e="y"===p?"width":"height",t=["top","left"].includes(f(i)),r=s.reference[h]-s.floating[e]+(t&&(null==(_=o.offset)?void 0:_[h])||0)+(t?0:b.crossAxis),n=s.reference[h]+s.reference[e]+(t?0:(null==(k=o.offset)?void 0:k[h])||0)-(t?b.crossAxis:0);mn&&(m=n)}return{[p]:y,[h]:m}}}),options:[e,t]}},ey=(e,t)=>{var r;return{...(void 0===(r=e)&&(r={}),{name:"flip",options:r,async fn(e){var t,n,i,s,o;let{placement:a,middlewareData:l,rects:u,initialPlacement:c,platform:h,elements:b}=e,{mainAxis:_=!0,crossAxis:k=!0,fallbackPlacements:E,fallbackStrategy:T="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:A=!0,...j}=d(r,e);if(null!=(t=l.arrow)&&t.alignmentOffset)return{};let O=f(a),C=v(c),P=f(c)===c,R=await (null==h.isRTL?void 0:h.isRTL(b.floating)),I=E||(P||!A?[w(c)]:function(e){let t=w(e);return[m(e),t,m(t)]}(c)),L="none"!==S;!E&&L&&I.push(...function(e,t,r,n){let i=p(e),s=function(e,t,r){let n=["left","right"],i=["right","left"];switch(e){case"top":case"bottom":if(r)return t?i:n;return t?n:i;case"left":case"right":return t?["top","bottom"]:["bottom","top"];default:return[]}}(f(e),"start"===r,n);return i&&(s=s.map(e=>e+"-"+i),t&&(s=s.concat(s.map(m)))),s}(c,A,S,R));let $=[c,...I],D=await x(e,j),M=[],U=(null==(n=l.flip)?void 0:n.overflows)||[];if(_&&M.push(D[O]),k){let e=function(e,t,r){void 0===r&&(r=!1);let n=p(e),i=g(v(e)),s=y(i),o="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=w(o)),[o,w(o)]}(a,u,R);M.push(D[e[0]],D[e[1]])}if(U=[...U,{placement:a,overflows:M}],!M.every(e=>e<=0)){let e=((null==(i=l.flip)?void 0:i.index)||0)+1,t=$[e];if(t)return{data:{index:e,overflows:U},reset:{placement:t}};let r=null==(s=U.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:s.placement;if(!r)switch(T){case"bestFit":{let e=null==(o=U.filter(e=>{if(L){let t=v(e.placement);return t===C||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:o[0];e&&(r=e);break}case"initialPlacement":r=c}if(a!==r)return{reset:{placement:r}}}return{}}}),options:[e,t]}},ev=(e,t)=>{var r;return{...(void 0===(r=e)&&(r={}),{name:"size",options:r,async fn(e){let t,n;let{placement:i,rects:a,platform:l,elements:u}=e,{apply:c=()=>{},...h}=d(r,e),g=await x(e,h),y=f(i),m=p(i),w="y"===v(i),{width:b,height:_}=a.floating;"top"===y||"bottom"===y?(t=y,n=m===(await (null==l.isRTL?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(n=y,t="end"===m?"top":"bottom");let k=_-g.top-g.bottom,E=b-g.left-g.right,T=s(_-g[t],k),S=s(b-g[n],E),A=!e.middlewareData.shift,j=T,O=S;if(w?O=m||A?s(S,E):E:j=m||A?s(T,k):k,A&&!m){let e=o(g.left,0),t=o(g.right,0),r=o(g.top,0),n=o(g.bottom,0);w?O=b-2*(0!==e||0!==t?e+t:o(g.left,g.right)):j=_-2*(0!==r||0!==n?r+n:o(g.top,g.bottom))}await c({...e,availableWidth:O,availableHeight:j});let C=await l.getDimensions(u.floating);return b!==C.width||_!==C.height?{reset:{rects:!0}}:{}}}),options:[e,t]}},em=(e,t)=>{var r;return{...(void 0===(r=e)&&(r={}),{name:"hide",options:r,async fn(e){let{rects:t}=e,{strategy:n="referenceHidden",...i}=d(r,e);switch(n){case"referenceHidden":{let r=T(await x(e,{...i,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:r,referenceHidden:S(r)}}}case"escaped":{let r=T(await x(e,{...i,altBoundary:!0}),t.floating);return{data:{escapedOffsets:r,escaped:S(r)}}}default:return{}}}}),options:[e,t]}},ew=(e,t)=>({...ed(e),options:[e,t]});var eb=r(25171),e_=r(57437),ek=n.forwardRef((e,t)=>{let{children:r,width:n=10,height:i=5,...s}=e;return(0,e_.jsx)(eb.WV.svg,{...s,ref:t,width:n,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,e_.jsx)("polygon",{points:"0,0 30,0 15,10"})})});ek.displayName="Arrow";var eE=r(1584),ex=r(98324),eT=r(75137),eS=r(1336),eA=r(75238),ej="Popper",[eO,eC]=(0,ex.b)(ej),[eP,eR]=eO(ej),eI=e=>{let{__scopePopper:t,children:r}=e,[i,s]=n.useState(null);return(0,e_.jsx)(eP,{scope:t,anchor:i,onAnchorChange:s,children:r})};eI.displayName=ej;var eL="PopperAnchor",e$=n.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:i,...s}=e,o=eR(eL,r),a=n.useRef(null),l=(0,eE.e)(t,a);return n.useEffect(()=>{o.onAnchorChange((null==i?void 0:i.current)||a.current)}),i?null:(0,e_.jsx)(eb.WV.div,{...s,ref:l})});e$.displayName=eL;var eD="PopperContent",[eM,eU]=eO(eD),eN=n.forwardRef((e,t)=>{var r,i,a,u,c,h,d,f;let{__scopePopper:p,side:g="bottom",sideOffset:y=0,align:v="center",alignOffset:m=0,arrowPadding:w=0,avoidCollisions:b=!0,collisionBoundary:_=[],collisionPadding:k=0,sticky:E="partial",hideWhenDetached:x=!1,updatePositionStrategy:T="optimized",onPlaced:S,...A}=e,j=eR(eD,p),[O,P]=n.useState(null),R=(0,eE.e)(t,e=>P(e)),[I,L]=n.useState(null),$=(0,eA.t)(I),D=null!==(d=null==$?void 0:$.width)&&void 0!==d?d:0,M=null!==(f=null==$?void 0:$.height)&&void 0!==f?f:0,U="number"==typeof k?k:{top:0,right:0,bottom:0,left:0,...k},N=Array.isArray(_)?_:[_],B=N.length>0,F={padding:U,boundary:N.filter(eW),altBoundary:B},{refs:z,floatingStyles:H,placement:q,isPositioned:J,middlewareData:V}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:s,elements:{reference:o,floating:a}={},transform:l=!0,whileElementsMounted:u,open:c}=e,[h,d]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=n.useState(i);el(f,i)||p(i);let[g,y]=n.useState(null),[v,m]=n.useState(null),w=n.useCallback(e=>{e!==E.current&&(E.current=e,y(e))},[]),b=n.useCallback(e=>{e!==x.current&&(x.current=e,m(e))},[]),_=o||g,k=a||v,E=n.useRef(null),x=n.useRef(null),T=n.useRef(h),S=null!=u,A=eh(u),j=eh(s),O=n.useCallback(()=>{if(!E.current||!x.current)return;let e={placement:t,strategy:r,middleware:f};j.current&&(e.platform=j.current),es(E.current,x.current,e).then(e=>{let t={...e,isPositioned:!0};C.current&&!el(T.current,t)&&(T.current=t,eo.flushSync(()=>{d(t)}))})},[f,t,r,j]);ea(()=>{!1===c&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);let C=n.useRef(!1);ea(()=>(C.current=!0,()=>{C.current=!1}),[]),ea(()=>{if(_&&(E.current=_),k&&(x.current=k),_&&k){if(A.current)return A.current(_,k,O);O()}},[_,k,O,A,S]);let P=n.useMemo(()=>({reference:E,floating:x,setReference:w,setFloating:b}),[w,b]),R=n.useMemo(()=>({reference:_,floating:k}),[_,k]),I=n.useMemo(()=>{let e={position:r,left:0,top:0};if(!R.floating)return e;let t=ec(R.floating,h.x),n=ec(R.floating,h.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...eu(R.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,R.floating,h.x,h.y]);return n.useMemo(()=>({...h,update:O,refs:P,elements:R,floatingStyles:I}),[h,O,P,R,I])}({strategy:"fixed",placement:g+("center"!==v?"-"+v:""),whileElementsMounted:function(){for(var e=arguments.length,t=Array(e),r=0;r{a&&e.addEventListener("scroll",r,{passive:!0}),u&&e.addEventListener("resize",r)});let g=f&&h?function(e,t){let r,n=null,i=C(e);function a(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function u(c,h){void 0===c&&(c=!1),void 0===h&&(h=1),a();let{left:d,top:f,width:p,height:g}=e.getBoundingClientRect();if(c||t(),!p||!g)return;let y=l(f),v=l(i.clientWidth-(d+p)),m={rootMargin:-y+"px "+-v+"px "+-l(i.clientHeight-(f+g))+"px "+-l(d)+"px",threshold:o(0,s(1,h))||1},w=!0;function b(e){let t=e[0].intersectionRatio;if(t!==h){if(!w)return u();t?u(!1,t):r=setTimeout(()=>{u(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(b,{...m,root:i.ownerDocument})}catch(e){n=new IntersectionObserver(b,m)}n.observe(e)}(!0),a}(f,r):null,y=-1,v=null;c&&(v=new ResizeObserver(e=>{let[n]=e;n&&n.target===f&&v&&(v.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var e;null==(e=v)||e.observe(t)})),r()}),f&&!d&&v.observe(f),v.observe(t));let m=d?Y(e):null;return d&&function t(){let n=Y(e);m&&(n.x!==m.x||n.y!==m.y||n.width!==m.width||n.height!==m.height)&&r(),m=n,i=requestAnimationFrame(t)}(),r(),()=>{var e;p.forEach(e=>{a&&e.removeEventListener("scroll",r),u&&e.removeEventListener("resize",r)}),null==g||g(),null==(e=v)||e.disconnect(),v=null,d&&cancelAnimationFrame(i)}}(...t,{animationFrame:"always"===T})},elements:{reference:j.anchor},middleware:[ef({mainAxis:y+M,alignmentAxis:m}),b&&ep({mainAxis:!0,crossAxis:!1,limiter:"partial"===E?eg():void 0,...F}),b&&ey({...F}),ev({...F,apply:e=>{let{elements:t,rects:r,availableWidth:n,availableHeight:i}=e,{width:s,height:o}=r.reference,a=t.floating.style;a.setProperty("--radix-popper-available-width","".concat(n,"px")),a.setProperty("--radix-popper-available-height","".concat(i,"px")),a.setProperty("--radix-popper-anchor-width","".concat(s,"px")),a.setProperty("--radix-popper-anchor-height","".concat(o,"px"))}}),I&&ew({element:I,padding:w}),eH({arrowWidth:D,arrowHeight:M}),x&&em({strategy:"referenceHidden",...F})]}),[G,X]=eq(q),Z=(0,eT.W)(S);(0,eS.b)(()=>{J&&(null==Z||Z())},[J,Z]);let Q=null===(r=V.arrow)||void 0===r?void 0:r.x,ee=null===(i=V.arrow)||void 0===i?void 0:i.y,et=(null===(a=V.arrow)||void 0===a?void 0:a.centerOffset)!==0,[er,en]=n.useState();return(0,eS.b)(()=>{O&&en(window.getComputedStyle(O).zIndex)},[O]),(0,e_.jsx)("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:J?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:er,"--radix-popper-transform-origin":[null===(u=V.transformOrigin)||void 0===u?void 0:u.x,null===(c=V.transformOrigin)||void 0===c?void 0:c.y].join(" "),...(null===(h=V.hide)||void 0===h?void 0:h.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,e_.jsx)(eM,{scope:p,placedSide:G,onArrowChange:L,arrowX:Q,arrowY:ee,shouldHideArrow:et,children:(0,e_.jsx)(eb.WV.div,{"data-side":G,"data-align":X,...A,ref:R,style:{...A.style,animation:J?void 0:"none"}})})})});eN.displayName=eD;var eB="PopperArrow",eF={top:"bottom",right:"left",bottom:"top",left:"right"},ez=n.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,i=eU(eB,r),s=eF[i.placedSide];return(0,e_.jsx)("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:(0,e_.jsx)(ek,{...n,ref:t,style:{...n.style,display:"block"}})})});function eW(e){return null!==e}ez.displayName=eB;var eH=e=>({name:"transformOrigin",options:e,fn(t){var r,n,i,s,o;let{placement:a,rects:l,middlewareData:u}=t,c=(null===(r=u.arrow)||void 0===r?void 0:r.centerOffset)!==0,h=c?0:e.arrowWidth,d=c?0:e.arrowHeight,[f,p]=eq(a),g={start:"0%",center:"50%",end:"100%"}[p],y=(null!==(s=null===(n=u.arrow)||void 0===n?void 0:n.x)&&void 0!==s?s:0)+h/2,v=(null!==(o=null===(i=u.arrow)||void 0===i?void 0:i.y)&&void 0!==o?o:0)+d/2,m="",w="";return"bottom"===f?(m=c?g:"".concat(y,"px"),w="".concat(-d,"px")):"top"===f?(m=c?g:"".concat(y,"px"),w="".concat(l.floating.height+d,"px")):"right"===f?(m="".concat(-d,"px"),w=c?g:"".concat(v,"px")):"left"===f&&(m="".concat(l.floating.width+d,"px"),w=c?g:"".concat(v,"px")),{data:{x:m,y:w}}}});function eq(e){let[t,r="center"]=e.split("-");return[t,r]}var eK=eI,eJ=e$,eV=eN,eG=ez},53398:function(e,t,r){"use strict";r.d(t,{Pc:function(){return _},ck:function(){return P},fC:function(){return C}});var n=r(2265),i=r(78149),s=r(90976),o=r(1584),a=r(98324),l=r(53201),u=r(25171),c=r(75137),h=r(91715),d=r(87513),f=r(57437),p="rovingFocusGroup.onEntryFocus",g={bubbles:!1,cancelable:!0},y="RovingFocusGroup",[v,m,w]=(0,s.B)(y),[b,_]=(0,a.b)(y,[w]),[k,E]=b(y),x=n.forwardRef((e,t)=>(0,f.jsx)(v.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,f.jsx)(v.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,f.jsx)(T,{...e,ref:t})})}));x.displayName=y;var T=n.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:s,loop:a=!1,dir:l,currentTabStopId:y,defaultCurrentTabStopId:v,onCurrentTabStopIdChange:w,onEntryFocus:b,preventScrollOnEntryFocus:_=!1,...E}=e,x=n.useRef(null),T=(0,o.e)(t,x),S=(0,d.gm)(l),[A=null,j]=(0,h.T)({prop:y,defaultProp:v,onChange:w}),[C,P]=n.useState(!1),R=(0,c.W)(b),I=m(r),L=n.useRef(!1),[$,D]=n.useState(0);return n.useEffect(()=>{let e=x.current;if(e)return e.addEventListener(p,R),()=>e.removeEventListener(p,R)},[R]),(0,f.jsx)(k,{scope:r,orientation:s,dir:S,loop:a,currentTabStopId:A,onItemFocus:n.useCallback(e=>j(e),[j]),onItemShiftTab:n.useCallback(()=>P(!0),[]),onFocusableItemAdd:n.useCallback(()=>D(e=>e+1),[]),onFocusableItemRemove:n.useCallback(()=>D(e=>e-1),[]),children:(0,f.jsx)(u.WV.div,{tabIndex:C||0===$?-1:0,"data-orientation":s,...E,ref:T,style:{outline:"none",...e.style},onMouseDown:(0,i.M)(e.onMouseDown,()=>{L.current=!0}),onFocus:(0,i.M)(e.onFocus,e=>{let t=!L.current;if(e.target===e.currentTarget&&t&&!C){let t=new CustomEvent(p,g);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=I().filter(e=>e.focusable);O([e.find(e=>e.active),e.find(e=>e.id===A),...e].filter(Boolean).map(e=>e.ref.current),_)}}L.current=!1}),onBlur:(0,i.M)(e.onBlur,()=>P(!1))})})}),S="RovingFocusGroupItem",A=n.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:s=!0,active:o=!1,tabStopId:a,...c}=e,h=(0,l.M)(),d=a||h,p=E(S,r),g=p.currentTabStopId===d,y=m(r),{onFocusableItemAdd:w,onFocusableItemRemove:b}=p;return n.useEffect(()=>{if(s)return w(),()=>b()},[s,w,b]),(0,f.jsx)(v.ItemSlot,{scope:r,id:d,focusable:s,active:o,children:(0,f.jsx)(u.WV.span,{tabIndex:g?0:-1,"data-orientation":p.orientation,...c,ref:t,onMouseDown:(0,i.M)(e.onMouseDown,e=>{s?p.onItemFocus(d):e.preventDefault()}),onFocus:(0,i.M)(e.onFocus,()=>p.onItemFocus(d)),onKeyDown:(0,i.M)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey){p.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let i=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(i))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(i)))return j[i]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let i=y().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)i.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&i.reverse();let s=i.indexOf(e.currentTarget);i=p.loop?(r=i,n=s+1,r.map((e,t)=>r[(n+t)%r.length])):i.slice(s+1)}setTimeout(()=>O(i))}})})})});A.displayName=S;var j={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function O(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var C=x,P=A},27071:function(e,t,r){"use strict";r.d(t,{VY:function(){return z},fC:function(){return B},xz:function(){return F},zt:function(){return N}});var n=r(2265),i=r(78149),s=r(1584),o=r(98324),a=r(53938),l=r(53201),u=r(25510),c=(r(7715),r(31383)),h=r(25171),d=r(71538),f=r(91715),p=r(31725),g=r(57437),[y,v]=(0,o.b)("Tooltip",[u.D7]),m=(0,u.D7)(),w="TooltipProvider",b="tooltip.open",[_,k]=y(w),E=e=>{let{__scopeTooltip:t,delayDuration:r=700,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:o}=e,[a,l]=n.useState(!0),u=n.useRef(!1),c=n.useRef(0);return n.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,g.jsx)(_,{scope:t,isOpenDelayed:a,delayDuration:r,onOpen:n.useCallback(()=>{window.clearTimeout(c.current),l(!1)},[]),onClose:n.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>l(!0),i)},[i]),isPointerInTransitRef:u,onPointerInTransitChange:n.useCallback(e=>{u.current=e},[]),disableHoverableContent:s,children:o})};E.displayName=w;var x="Tooltip",[T,S]=y(x),A=e=>{let{__scopeTooltip:t,children:r,open:i,defaultOpen:s=!1,onOpenChange:o,disableHoverableContent:a,delayDuration:c}=e,h=k(x,e.__scopeTooltip),d=m(t),[p,y]=n.useState(null),v=(0,l.M)(),w=n.useRef(0),_=null!=a?a:h.disableHoverableContent,E=null!=c?c:h.delayDuration,S=n.useRef(!1),[A=!1,j]=(0,f.T)({prop:i,defaultProp:s,onChange:e=>{e?(h.onOpen(),document.dispatchEvent(new CustomEvent(b))):h.onClose(),null==o||o(e)}}),O=n.useMemo(()=>A?S.current?"delayed-open":"instant-open":"closed",[A]),C=n.useCallback(()=>{window.clearTimeout(w.current),S.current=!1,j(!0)},[j]),P=n.useCallback(()=>{window.clearTimeout(w.current),j(!1)},[j]),R=n.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{S.current=!0,j(!0)},E)},[E,j]);return n.useEffect(()=>()=>window.clearTimeout(w.current),[]),(0,g.jsx)(u.fC,{...d,children:(0,g.jsx)(T,{scope:t,contentId:v,open:A,stateAttribute:O,trigger:p,onTriggerChange:y,onTriggerEnter:n.useCallback(()=>{h.isOpenDelayed?R():C()},[h.isOpenDelayed,R,C]),onTriggerLeave:n.useCallback(()=>{_?P():window.clearTimeout(w.current)},[P,_]),onOpen:C,onClose:P,disableHoverableContent:_,children:r})})};A.displayName=x;var j="TooltipTrigger",O=n.forwardRef((e,t)=>{let{__scopeTooltip:r,...o}=e,a=S(j,r),l=k(j,r),c=m(r),d=n.useRef(null),f=(0,s.e)(t,d,a.onTriggerChange),p=n.useRef(!1),y=n.useRef(!1),v=n.useCallback(()=>p.current=!1,[]);return n.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),(0,g.jsx)(u.ee,{asChild:!0,...c,children:(0,g.jsx)(h.WV.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...o,ref:f,onPointerMove:(0,i.M)(e.onPointerMove,e=>{"touch"===e.pointerType||y.current||l.isPointerInTransitRef.current||(a.onTriggerEnter(),y.current=!0)}),onPointerLeave:(0,i.M)(e.onPointerLeave,()=>{a.onTriggerLeave(),y.current=!1}),onPointerDown:(0,i.M)(e.onPointerDown,()=>{p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:(0,i.M)(e.onFocus,()=>{p.current||a.onOpen()}),onBlur:(0,i.M)(e.onBlur,a.onClose),onClick:(0,i.M)(e.onClick,a.onClose)})})});O.displayName=j;var[C,P]=y("TooltipPortal",{forceMount:void 0}),R="TooltipContent",I=n.forwardRef((e,t)=>{let r=P(R,e.__scopeTooltip),{forceMount:n=r.forceMount,side:i="top",...s}=e,o=S(R,e.__scopeTooltip);return(0,g.jsx)(c.z,{present:n||o.open,children:o.disableHoverableContent?(0,g.jsx)(M,{side:i,...s,ref:t}):(0,g.jsx)(L,{side:i,...s,ref:t})})}),L=n.forwardRef((e,t)=>{let r=S(R,e.__scopeTooltip),i=k(R,e.__scopeTooltip),o=n.useRef(null),a=(0,s.e)(t,o),[l,u]=n.useState(null),{trigger:c,onClose:h}=r,d=o.current,{onPointerInTransitChange:f}=i,p=n.useCallback(()=>{u(null),f(!1)},[f]),y=n.useCallback((e,t)=>{let r=e.currentTarget,n={x:e.clientX,y:e.clientY},i=function(e,t){let r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,n,i,s)){case s:return"left";case i:return"right";case r:return"top";case n:return"bottom";default:throw Error("unreachable")}}(n,r.getBoundingClientRect());u(function(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y?1:0),function(e){if(e.length<=1)return e.slice();let t=[];for(let r=0;r=2;){let e=t[t.length-1],r=t[t.length-2];if((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x))t.pop();else break}t.push(n)}t.pop();let r=[];for(let t=e.length-1;t>=0;t--){let n=e[t];for(;r.length>=2;){let e=r[r.length-1],t=r[r.length-2];if((e.x-t.x)*(n.y-t.y)>=(e.y-t.y)*(n.x-t.x))r.pop();else break}r.push(n)}return(r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y)?t:t.concat(r)}(t)}([...function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return n}(n,i),...function(e){let{top:t,right:r,bottom:n,left:i}=e;return[{x:i,y:t},{x:r,y:t},{x:r,y:n},{x:i,y:n}]}(t.getBoundingClientRect())])),f(!0)},[f]);return n.useEffect(()=>()=>p(),[p]),n.useEffect(()=>{if(c&&d){let e=e=>y(e,d),t=e=>y(e,c);return c.addEventListener("pointerleave",e),d.addEventListener("pointerleave",t),()=>{c.removeEventListener("pointerleave",e),d.removeEventListener("pointerleave",t)}}},[c,d,y,p]),n.useEffect(()=>{if(l){let e=e=>{let t=e.target,r={x:e.clientX,y:e.clientY},n=(null==c?void 0:c.contains(t))||(null==d?void 0:d.contains(t)),i=!function(e,t){let{x:r,y:n}=e,i=!1;for(let e=0,s=t.length-1;en!=u>n&&r<(l-o)*(n-a)/(u-a)+o&&(i=!i)}return i}(r,l);n?p():i&&(p(),h())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[c,d,l,h,p]),(0,g.jsx)(M,{...e,ref:a})}),[$,D]=y(x,{isInside:!1}),M=n.forwardRef((e,t)=>{let{__scopeTooltip:r,children:i,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:l,...c}=e,h=S(R,r),f=m(r),{onClose:y}=h;return n.useEffect(()=>(document.addEventListener(b,y),()=>document.removeEventListener(b,y)),[y]),n.useEffect(()=>{if(h.trigger){let e=e=>{let t=e.target;(null==t?void 0:t.contains(h.trigger))&&y()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[h.trigger,y]),(0,g.jsx)(a.XB,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:y,children:(0,g.jsxs)(u.VY,{"data-state":h.stateAttribute,...f,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,g.jsx)(d.A4,{children:i}),(0,g.jsx)($,{scope:r,isInside:!0,children:(0,g.jsx)(p.f,{id:h.contentId,role:"tooltip",children:s||i})})]})})});I.displayName=R;var U="TooltipArrow";n.forwardRef((e,t)=>{let{__scopeTooltip:r,...n}=e,i=m(r);return D(U,r).isInside?null:(0,g.jsx)(u.Eh,{...i,...n,ref:t})}).displayName=U;var N=E,B=A,F=O,z=I},75238:function(e,t,r){"use strict";r.d(t,{t:function(){return s}});var n=r(2265),i=r(1336);function s(e){let[t,r]=n.useState(void 0);return(0,i.b)(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,i;if(!Array.isArray(t)||!t.length)return;let s=t[0];if("borderBoxSize"in s){let e=s.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,i=t.blockSize}else n=e.offsetWidth,i=e.offsetHeight;r({width:n,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}}}]);