@fluxlay/cli 0.1.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import e,{stdout as t,stdin as n}from"node:process";import*as r from"node:readline";import{ReadStream as s}from"node:tty";import i from"node:fs";import o from"node:path";import{promisify as a}from"node:util";import c from"node:events";import l,{execFile as u}from"node:child_process";import{build as d,createServer as h}from"vite";import{createRequire as g}from"node:module";import{fileURLToPath as m}from"node:url";import p from"node:os";import f from"fs";import y from"constants";import b from"stream";import I from"util";import w from"assert";import v from"path";import G from"os";import A from"crypto";import*as C from"node:zlib";import*as S from"node:http";import Z from"node:http";import*as V from"node:https";import*as E from"node:http2";import X from"node:net";import B,{constants as x}from"node:fs/promises";import{Buffer as R}from"node:buffer";import W from"node:crypto";var N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function J(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _,k={exports:{}};function F(){if(_)return k.exports;_=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e,blackBright:e,redBright:e,greenBright:e,yellowBright:e,blueBright:e,magentaBright:e,cyanBright:e,whiteBright:e,bgBlackBright:e,bgRedBright:e,bgGreenBright:e,bgYellowBright:e,bgBlueBright:e,bgMagentaBright:e,bgCyanBright:e,bgWhiteBright:e}};return k.exports=t(),k.exports.createColors=t,k.exports}const Y=/* @__PURE__ */J(/* @__PURE__ */F());var L,O;var T=function(){if(O)return L;O=1;const e="[",t={to:(t,n)=>n?`${e}${n+1};${t+1}H`:`${e}${t+1}G`,move(t,n){let r="";return t<0?r+=`${e}${-t}D`:t>0&&(r+=`${e}${t}C`),n<0?r+=`${e}${-n}A`:n>0&&(r+=`${e}${n}B`),r},up:(t=1)=>`${e}${t}A`,down:(t=1)=>`${e}${t}B`,forward:(t=1)=>`${e}${t}C`,backward:(t=1)=>`${e}${t}D`,nextLine:(t=1)=>`${e}E`.repeat(t),prevLine:(t=1)=>`${e}F`.repeat(t),left:`${e}G`,hide:`${e}?25l`,show:`${e}?25h`,save:"7",restore:"8"},n={up:(t=1)=>`${e}S`.repeat(t),down:(t=1)=>`${e}T`.repeat(t)},r={screen:`${e}2J`,up:(t=1)=>`${e}1J`.repeat(t),down:(t=1)=>`${e}J`.repeat(t),line:`${e}2K`,lineEnd:`${e}K`,lineStart:`${e}1K`,lines(e){let n="";for(let r=0;r<e;r++)n+=this.line+(r<e-1?t.up():"");return e&&(n+=t.left),n}};return L={cursor:t,scroll:n,erase:r,beep:""}}();const H={actions:new Set(["up","down","left","right","space","enter","cancel"]),aliases:/* @__PURE__ */new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0};function M(e,t){if("string"==typeof e)return H.aliases.get(e)===t;for(const n of e)if(void 0!==n&&M(n,t))return!0;return!1}const K=globalThis.process.platform.startsWith("win");function z({input:e=n,output:i=t,overwrite:o=!0,hideCursor:a=!0}={}){const c=r.createInterface({input:e,output:i,prompt:"",tabSize:1});r.emitKeypressEvents(e,c),e instanceof s&&e.isTTY&&e.setRawMode(!0);const l=(t,{name:n,sequence:s})=>{if(M([String(t),n,s],"cancel"))return a&&i.write(T.cursor.show),void process.exit(0);if(!o)return;const c="return"===n?0:-1,u="return"===n?-1:0;r.moveCursor(i,c,u,()=>{r.clearLine(i,1,()=>{e.once("keypress",l)})})};return a&&i.write(T.cursor.hide),e.once("keypress",l),()=>{e.off("keypress",l),a&&i.write(T.cursor.show),e instanceof s&&e.isTTY&&!K&&e.setRawMode(!1),c.terminal=!1,c.close()}}const D=e=>"columns"in e&&"number"==typeof e.columns?e.columns:80;const U="win32"!==e.platform?"linux"!==e.env.TERM:!!e.env.CI||!!e.env.WT_SESSION||!!e.env.TERMINUS_SUBLIME||"{cmd::Cmder}"===e.env.ConEmuTask||"Terminus-Sublime"===e.env.TERM_PROGRAM||"vscode"===e.env.TERM_PROGRAM||"xterm-256color"===e.env.TERM||"alacritty"===e.env.TERM||"JetBrains-JediTerm"===e.env.TERMINAL_EMULATOR,P=(e,t)=>U?e:t,j=P("■","x"),Q=P("▲","x"),$=P("◇","o"),q=P("┌","T"),ee=P("│","|"),te=P("└","—"),ne=P("─","-"),re=P("╮","+"),se=P("├","+"),ie=P("╯","+"),oe=P("●","•"),ae=P("◆","*"),ce=P("▲","!"),le=P("■","x"),ue=e=>161===e||164===e||167===e||168===e||170===e||173===e||174===e||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||198===e||208===e||215===e||216===e||e>=222&&e<=225||230===e||e>=232&&e<=234||236===e||237===e||240===e||242===e||243===e||e>=247&&e<=250||252===e||254===e||257===e||273===e||275===e||283===e||294===e||295===e||299===e||e>=305&&e<=307||312===e||e>=319&&e<=322||324===e||e>=328&&e<=331||333===e||338===e||339===e||358===e||359===e||363===e||462===e||464===e||466===e||468===e||470===e||472===e||474===e||476===e||593===e||609===e||708===e||711===e||e>=713&&e<=715||717===e||720===e||e>=728&&e<=731||733===e||735===e||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||1025===e||e>=1040&&e<=1103||1105===e||8208===e||e>=8211&&e<=8214||8216===e||8217===e||8220===e||8221===e||e>=8224&&e<=8226||e>=8228&&e<=8231||8240===e||8242===e||8243===e||8245===e||8251===e||8254===e||8308===e||8319===e||e>=8321&&e<=8324||8364===e||8451===e||8453===e||8457===e||8467===e||8470===e||8481===e||8482===e||8486===e||8491===e||8531===e||8532===e||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||8585===e||e>=8592&&e<=8601||8632===e||8633===e||8658===e||8660===e||8679===e||8704===e||8706===e||8707===e||8711===e||8712===e||8715===e||8719===e||8721===e||8725===e||8730===e||e>=8733&&e<=8736||8739===e||8741===e||e>=8743&&e<=8748||8750===e||e>=8756&&e<=8759||8764===e||8765===e||8776===e||8780===e||8786===e||8800===e||8801===e||e>=8804&&e<=8807||8810===e||8811===e||8814===e||8815===e||8834===e||8835===e||8838===e||8839===e||8853===e||8857===e||8869===e||8895===e||8978===e||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||9632===e||9633===e||e>=9635&&e<=9641||9650===e||9651===e||9654===e||9655===e||9660===e||9661===e||9664===e||9665===e||e>=9670&&e<=9672||9675===e||e>=9678&&e<=9681||e>=9698&&e<=9701||9711===e||9733===e||9734===e||9737===e||9742===e||9743===e||9756===e||9758===e||9792===e||9794===e||9824===e||9825===e||e>=9827&&e<=9829||e>=9831&&e<=9834||9836===e||9837===e||9839===e||9886===e||9887===e||9919===e||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||9955===e||9960===e||9961===e||e>=9963&&e<=9969||9972===e||e>=9974&&e<=9977||9979===e||9980===e||9982===e||9983===e||10045===e||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||65533===e||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||127375===e||127376===e||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,de=e=>12288===e||e>=65281&&e<=65376||e>=65504&&e<=65510,he=e=>e>=4352&&e<=4447||8986===e||8987===e||9001===e||9002===e||e>=9193&&e<=9196||9200===e||9203===e||9725===e||9726===e||9748===e||9749===e||e>=9800&&e<=9811||9855===e||9875===e||9889===e||9898===e||9899===e||9917===e||9918===e||9924===e||9925===e||9934===e||9940===e||9962===e||9970===e||9971===e||9973===e||9978===e||9981===e||9989===e||9994===e||9995===e||10024===e||10060===e||10062===e||e>=10067&&e<=10069||10071===e||e>=10133&&e<=10135||10160===e||10175===e||11035===e||11036===e||11088===e||11093===e||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||94192===e||94193===e||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||110589===e||110590===e||e>=110592&&e<=110882||110898===e||e>=110928&&e<=110930||110933===e||e>=110948&&e<=110951||e>=110960&&e<=111355||126980===e||127183===e||127374===e||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||127568===e||127569===e||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||127988===e||e>=127992&&e<=128062||128064===e||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||128378===e||128405===e||128406===e||128420===e||e>=128507&&e<=128591||e>=128640&&e<=128709||128716===e||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||128747===e||128748===e||e>=128756&&e<=128764||e>=128992&&e<=129003||129008===e||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,ge=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,me=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,pe=/\t{1,1000}/y,fe=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),ye=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,be=new RegExp("\\p{M}+","gu"),Ie={limit:1/0,ellipsis:""},we=(e,t={},n={})=>{const r=t.limit??1/0,s=t.ellipsis??"",i=t?.ellipsisWidth??(s?we(s,Ie,n).width:0),o=n.ansiWidth??0,a=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,h=n.regularWidth??1,g=n.wideWidth??2;let m=0,p=0,f=e.length,y=0,b=!1,I=f,w=Math.max(0,r-i),v=0,G=0,A=0,C=0;e:for(;;){if(G>v||p>=f&&p>m){const t=e.slice(v,G)||e.slice(m,p);y=0;for(const e of t.replaceAll(be,"")){const t=e.codePointAt(0)||0;if(C=de(t)?d:he(t)?g:l!==h&&ue(t)?l:h,A+C>w&&(I=Math.min(I,Math.max(v,m)+y)),A+C>r){b=!0;break e}y+=e.length,A+=C}v=G=0}if(p>=f)break;if(ye.lastIndex=p,ye.test(e)){if(y=ye.lastIndex-p,C=y*h,A+C>w&&(I=Math.min(I,p+Math.floor((w-A)/h))),A+C>r){b=!0;break}A+=C,v=m,G=p,p=m=ye.lastIndex}else if(ge.lastIndex=p,ge.test(e)){if(A+o>w&&(I=Math.min(I,p)),A+o>r){b=!0;break}A+=o,v=m,G=p,p=m=ge.lastIndex}else if(me.lastIndex=p,me.test(e)){if(y=me.lastIndex-p,C=y*a,A+C>w&&(I=Math.min(I,p+Math.floor((w-A)/a))),A+C>r){b=!0;break}A+=C,v=m,G=p,p=m=me.lastIndex}else if(pe.lastIndex=p,pe.test(e)){if(y=pe.lastIndex-p,C=y*c,A+C>w&&(I=Math.min(I,p+Math.floor((w-A)/c))),A+C>r){b=!0;break}A+=C,v=m,G=p,p=m=pe.lastIndex}else if(fe.lastIndex=p,fe.test(e)){if(A+u>w&&(I=Math.min(I,p)),A+u>r){b=!0;break}A+=u,v=m,G=p,p=m=fe.lastIndex}else p+=1}return{width:b?w:A,index:b?I:f,truncated:b,ellipsed:b&&r>=i}},ve={limit:1/0,ellipsis:"",ellipsisWidth:0},Ge=(e,t={})=>we(e,ve,t).width,Ae="",Ce="]8;;",Se=new RegExp(`(?:\\[(?<code>\\d+)m|\\${Ce}(?<uri>.*))`,"y"),Ze=e=>e>=30&&e<=37||e>=90&&e<=97?39:e>=40&&e<=47||e>=100&&e<=107?49:1===e||2===e?22:3===e?23:4===e?24:7===e?27:8===e?28:9===e?29:0===e?0:void 0,Ve=e=>`${Ae}[${e}m`,Ee=e=>`${Ae}${Ce}${e}`,Xe=(e,t,n)=>{const r=t[Symbol.iterator]();let s=!1,i=!1,o=e.at(-1),a=void 0===o?0:Ge(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){const o=c.value,d=Ge(o);a+d<=n?e[e.length-1]+=o:(e.push(o),a=0),(o===Ae||""===o)&&(s=!0,i=t.startsWith(Ce,u+1)),s?i?""===o&&(s=!1,i=!1):"m"===o&&(s=!1):(a+=d,a===n&&!l.done&&(e.push(""),a=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!a&&void 0!==o&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Be=(e,t,n={})=>{if(!1!==n.trim&&""===e.trim())return"";let r,s,i="";const o=e.split(" "),a=(e=>e.map(e=>Ge(e)))(o);let c=[""];for(const[m,p]of o.entries()){!1!==n.trim&&(c[c.length-1]=(c.at(-1)??"").trimStart());let e=Ge(c.at(-1)??"");if(0!==m&&(e>=t&&(!1===n.wordWrap||!1===n.trim)&&(c.push(""),e=0),(e>0||!1===n.trim)&&(c[c.length-1]+=" ",e++)),n.hard&&a[m]>t){const n=t-e,r=1+Math.floor((a[m]-n-1)/t);Math.floor((a[m]-1)/t)<r&&c.push(""),Xe(c,p,t);continue}if(e+a[m]>t&&e>0&&a[m]>0){if(!1===n.wordWrap&&e<t){Xe(c,p,t);continue}c.push("")}e+a[m]>t&&!1===n.wordWrap?Xe(c,p,t):c[c.length-1]+=p}!1!==n.trim&&(c=c.map(e=>(e=>{const t=e.split(" ");let n=t.length;for(;n>0&&!(Ge(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")})(e)));const l=c.join("\n"),u=l[Symbol.iterator]();let d=u.next(),h=u.next(),g=0;for(;!d.done;){const e=d.value,t=h.value;if(i+=e,e===Ae||""===e){Se.lastIndex=g+1;const e=Se.exec(l)?.groups;if(void 0!==e?.code){const t=Number.parseFloat(e.code);r=39===t?void 0:t}else void 0!==e?.uri&&(s=0===e.uri.length?void 0:e.uri)}const n=r?Ze(r):void 0;"\n"===t?(s&&(i+=Ee("")),r&&n&&(i+=Ve(n))):"\n"===e&&(r&&n&&(i+=Ve(r)),s&&(i+=Ee(s))),g+=e.length,d=h,h=u.next()}return i};function xe(e,t,n){return String(e).normalize().replaceAll("\r\n","\n").split("\n").map(e=>Be(e,t,n)).join("\n")}const Re={message:(e=[],{symbol:t=Y.gray(ee),secondarySymbol:n=Y.gray(ee),output:r=process.stdout,spacing:s=1,withGuide:i}={})=>{const o=[],a=i??H.withGuide,c=a?n:"",l=a?`${t} `:"",u=a?`${n} `:"";for(let h=0;h<s;h++)o.push(c);const d=Array.isArray(e)?e:e.split("\n");if(d.length>0){const[e,...r]=d;e.length>0?o.push(`${l}${e}`):o.push(a?t:"");for(const t of r)t.length>0?o.push(`${u}${t}`):o.push(a?n:"")}r.write(`${o.join("\n")}\n`)},info:(e,t)=>{Re.message(e,{...t,symbol:Y.blue(oe)})},success:(e,t)=>{Re.message(e,{...t,symbol:Y.green(ae)})},step:(e,t)=>{Re.message(e,{...t,symbol:Y.green($)})},warn:(e,t)=>{Re.message(e,{...t,symbol:Y.yellow(ce)})},warning:(e,t)=>{Re.warn(e,t)},error:(e,t)=>{Re.message(e,{...t,symbol:Y.red(le)})}},We=(e="",t)=>{process.stdout.write(`${Y.gray(te)} ${Y.red(e)}\n\n`)},Ne=(e="",t)=>{process.stdout.write(`${Y.gray(q)} ${e}\n`)},Je=(e="",t)=>{process.stdout.write(`${Y.gray(ee)}\n${Y.gray(te)} ${e}\n\n`)},_e=e=>Y.dim(e),ke=(e,t,n)=>{const r={hard:!0,trim:!1},s=xe(e,t,r).split("\n"),i=s.reduce((e,t)=>Math.max(Ge(t),e),0);return xe(e,t-(s.map(n).reduce((e,t)=>Math.max(Ge(t),e),0)-i),r)},Fe=(t="",n="",r)=>{const s=e.stdout,i=_e,o=["",...ke(t,D(s)-6,i).split("\n").map(i),""],a=Ge(n),c=Math.max(o.reduce((e,t)=>{const n=Ge(t);return n>e?n:e},0),a)+2,l=o.map(e=>`${Y.gray(ee)} ${e}${" ".repeat(c-Ge(e))}${Y.gray(ee)}`).join("\n"),u=`${Y.gray(ee)}\n`,d=se;s.write(`${u}${Y.green($)} ${Y.reset(n)} ${Y.gray(ne.repeat(Math.max(c-a-1,1))+re)}\n${l}\n${Y.gray(d+ne.repeat(c+2)+ie)}\n`)},Ye=Y.magenta,Le=({indicator:e="dots",onCancel:t,output:n=process.stdout,cancelMessage:r,errorMessage:s,frames:i=(U?["◒","◐","◓","◑"]:["•","o","O","0"]),delay:o=(U?80:120),signal:a,...c}={})=>{const l="true"===process.env.CI;let u,d,h,g=!1,m=!1,p="",f=performance.now();const y=D(n),b=c?.styleFrame??Ye,I=e=>{const n=e>1?s??H.messages.error:r??H.messages.cancel;m=1===e,g&&(Z(n,e),m&&"function"==typeof t&&t())},w=()=>I(2),v=()=>I(1),G=()=>{if(void 0===h)return;l&&n.write("\n");const e=xe(h,y,{hard:!0,trim:!1}).split("\n");e.length>1&&n.write(T.cursor.up(e.length-1)),n.write(T.cursor.to(0)),n.write(T.erase.down())},A=e=>e.replace(/\.+$/,""),C=e=>{const t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},S=c.withGuide??H.withGuide,Z=(t="",r=0,s=!1)=>{if(!g)return;g=!1,clearInterval(d),G();const i=0===r?Y.green($):1===r?Y.red(j):Y.red(Q);p=t??p,s||("timer"===e?n.write(`${i} ${p} ${C(f)}\n`):n.write(`${i} ${p}\n`)),process.removeListener("uncaughtExceptionMonitor",w),process.removeListener("unhandledRejection",w),process.removeListener("SIGINT",v),process.removeListener("SIGTERM",v),process.removeListener("exit",I),a&&a.removeEventListener("abort",v),u()};return{start:(t="")=>{g=!0,u=z({output:n}),p=A(t),f=performance.now(),S&&n.write(`${Y.gray(ee)}\n`);let r=0,s=0;process.on("uncaughtExceptionMonitor",w),process.on("unhandledRejection",w),process.on("SIGINT",v),process.on("SIGTERM",v),process.on("exit",I),a&&a.addEventListener("abort",v),d=setInterval(()=>{if(l&&p===h)return;G(),h=p;const t=b(i[r]);let o;if(l)o=`${t} ${p}...`;else if("timer"===e)o=`${t} ${p} ${C(f)}`;else{const e=".".repeat(Math.floor(s)).slice(0,3);o=`${t} ${p}${e}`}const a=xe(o,y,{hard:!0,trim:!1});n.write(a),r=r+1<i.length?r+1:0,s=s<4?s+.125:0},o)},stop:(e="")=>Z(e,0),message:(e="")=>{p=A(e??p)},cancel:(e="")=>Z(e,1),error:(e="")=>Z(e,2),clear:()=>Z("",0,!0),get isCancelled(){return m}}};Y.gray(ee);const Oe=(e=0)=>t=>`[${t+e}m`,Te=(e=0)=>t=>`[${38+e};5;${t}m`,He=(e=0)=>(t,n,r)=>`[${38+e};2;${t};${n};${r}m`,Me={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(Me.modifier);Object.keys(Me.color),Object.keys(Me.bgColor);const Ke=function(){const e=/* @__PURE__ */new Map;for(const[t,n]of Object.entries(Me)){for(const[t,r]of Object.entries(n))Me[t]={open:`[${r[0]}m`,close:`[${r[1]}m`},n[t]=Me[t],e.set(r[0],r[1]);Object.defineProperty(Me,t,{value:n,enumerable:!1})}return Object.defineProperty(Me,"codes",{value:e,enumerable:!1}),Me.color.close="[39m",Me.bgColor.close="[49m",Me.color.ansi=Oe(),Me.color.ansi256=Te(),Me.color.ansi16m=He(),Me.bgColor.ansi=Oe(10),Me.bgColor.ansi256=Te(10),Me.bgColor.ansi16m=He(10),Object.defineProperties(Me,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;3===n.length&&(n=[...n].map(e=>e+e).join(""));const r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},enumerable:!1},hexToAnsi256:{value:e=>Me.rgbToAnsi256(...Me.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,n,r;if(e>=232)t=(10*(e-232)+8)/255,n=t,r=t;else{const s=(e-=16)%36;t=Math.floor(e/36)/5,n=Math.floor(s/6)/5,r=s%6/5}const s=2*Math.max(t,n,r);if(0===s)return 30;let i=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return 2===s&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>Me.ansi256ToAnsi(Me.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>Me.ansi256ToAnsi(Me.hexToAnsi256(e)),enumerable:!1}}),Me}(),ze=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),De=0!==ze&&{level:ze},Ue={stdout:De,stderr:De};function Pe(e,t,n){let r=e.indexOf(t);if(-1===r)return e;const s=t.length;let i=0,o="";do{o+=e.slice(i,r)+t+n,i=r+s,r=e.indexOf(t,i)}while(-1!==r);return o+=e.slice(i),o}const{stdout:je,stderr:Qe}=Ue,$e=/* @__PURE__ */Symbol("GENERATOR"),qe=/* @__PURE__ */Symbol("STYLER"),et=/* @__PURE__ */Symbol("IS_EMPTY"),tt=["ansi","ansi","ansi256","ansi16m"],nt=/* @__PURE__ */Object.create(null),rt=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=je?je.level:0;e.level=void 0===t.level?n:t.level})(t,e),Object.setPrototypeOf(t,st.prototype),t};function st(e){return rt(e)}Object.setPrototypeOf(st.prototype,Function.prototype);for(const[ay,cy]of Object.entries(Ke))nt[ay]={get(){const e=lt(this,ct(cy.open,cy.close,this[qe]),this[et]);return Object.defineProperty(this,ay,{value:e}),e}};nt.visible={get(){const e=lt(this,this[qe],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const it=(e,t,n,...r)=>"rgb"===e?"ansi16m"===t?Ke[n].ansi16m(...r):"ansi256"===t?Ke[n].ansi256(Ke.rgbToAnsi256(...r)):Ke[n].ansi(Ke.rgbToAnsi(...r)):"hex"===e?it("rgb",t,n,...Ke.hexToRgb(...r)):Ke[n][e](...r),ot=["rgb","hex","ansi256"];for(const ay of ot){nt[ay]={get(){const{level:e}=this;return function(...t){const n=ct(it(ay,tt[e],"color",...t),Ke.color.close,this[qe]);return lt(this,n,this[et])}}};nt["bg"+ay[0].toUpperCase()+ay.slice(1)]={get(){const{level:e}=this;return function(...t){const n=ct(it(ay,tt[e],"bgColor",...t),Ke.bgColor.close,this[qe]);return lt(this,n,this[et])}}}}const at=Object.defineProperties(()=>{},{...nt,level:{enumerable:!0,get(){return this[$e].level},set(e){this[$e].level=e}}}),ct=(e,t,n)=>{let r,s;return void 0===n?(r=e,s=t):(r=n.openAll+e,s=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:s,parent:n}},lt=(e,t,n)=>{const r=(...e)=>ut(r,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(r,at),r[$e]=e,r[qe]=t,r[et]=n,r},ut=(e,t)=>{if(e.level<=0||!t)return e[et]?"":t;let n=e[qe];if(void 0===n)return t;const{openAll:r,closeAll:s}=n;if(t.includes(""))for(;void 0!==n;)t=Pe(t,n.close,n.open),n=n.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,n,r){let s=0,i="";do{const o="\r"===e[r-1];i+=e.slice(s,o?r-1:r)+t+(o?"\r\n":"\n")+n,s=r+1,r=e.indexOf("\n",s)}while(-1!==r);return i+=e.slice(s),i}(t,s,r,i)),r+t+s};Object.defineProperties(st.prototype,nt);const dt=st();st({level:Qe?Qe.level:0});var ht,gt,mt={},pt={},ft={};function yt(){if(ht)return ft;ht=1;class e extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}return ft.CommanderError=e,ft.InvalidArgumentError=class extends e{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}},ft}function bt(){if(gt)return pt;gt=1;const{InvalidArgumentError:e}=yt();return pt.Argument=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new e(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},pt.humanReadableArgName=function(e){const t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"},pt}var It,wt={},vt={};function Gt(){if(It)return vt;It=1;const{humanReadableArgName:e}=bt();return vt.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){const t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){const n=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){const t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){const r=n.short&&e._findOption(n.short),s=n.long&&e._findOption(n.long);r||s?n.long&&!s?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description)):t.push(n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let n=e.parent;n;n=n.parent){const e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(t){const n=t.registeredArguments.map(t=>e(t)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let r=e.parent;r;r=r.parent)n=r.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue){(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}return void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){const n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){const n=t.padWidth(e,t),r=t.helpWidth||80;function s(e,s){if(s){const i=`${e.padEnd(n+2)}${s}`;return t.wrap(i,r-2,n+2)}return e}function i(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let o=[`Usage: ${t.commandUsage(e)}`,""];const a=t.commandDescription(e);a.length>0&&(o=o.concat([t.wrap(a,r,0),""]));const c=t.visibleArguments(e).map(e=>s(t.argumentTerm(e),t.argumentDescription(e)));c.length>0&&(o=o.concat(["Arguments:",i(c),""]));const l=t.visibleOptions(e).map(e=>s(t.optionTerm(e),t.optionDescription(e)));if(l.length>0&&(o=o.concat(["Options:",i(l),""])),this.showGlobalOptions){const n=t.visibleGlobalOptions(e).map(e=>s(t.optionTerm(e),t.optionDescription(e)));n.length>0&&(o=o.concat(["Global Options:",i(n),""]))}const u=t.visibleCommands(e).map(e=>s(t.subcommandTerm(e),t.subcommandDescription(e)));return u.length>0&&(o=o.concat(["Commands:",i(u),""])),o.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,n,r=40){const s=new RegExp("[\\n][ \\f\\t\\v - \ufeff]+");if(e.match(s))return e;const i=t-n;if(i<r)return e;const o=e.slice(0,n),a=e.slice(n).replace("\r\n","\n"),c=" ".repeat(n),l="\\s",u=new RegExp(`\n|.{1,${i-1}}([${l}]|$)|[^${l}]+?([${l}]|$)`,"g");return o+(a.match(u)||[]).map((e,t)=>"\n"===e?"":(t>0?c:"")+e.trimEnd()).join("\n")}},vt}var At,Ct={};function St(){if(At)return Ct;At=1;const{InvalidArgumentError:e}=yt();return Ct.Option=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;const n=function(e){let t,n;const r=e.split(/[ |,]+/);r.length>1&&!/^[[<]/.test(r[1])&&(t=r.shift());n=r.shift(),!t&&/^-[^-]$/.test(n)&&(t=n,n=void 0);return{shortFlag:t,longFlag:n}}(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return"string"==typeof e&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}choices(t){return this.argChoices=t.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new e(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ct.DualOptions=class{constructor(e){this.positiveOptions=/* @__PURE__ */new Map,this.negativeOptions=/* @__PURE__ */new Map,this.dualOptions=/* @__PURE__ */new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){const n=t.attributeName();if(!this.dualOptions.has(n))return!0;const r=this.negativeOptions.get(n).presetArg,s=void 0!==r&&r;return t.negate===(s===e)}},Ct}var Zt,Vt,Et,Xt={};function Bt(){if(Zt)return Xt;Zt=1;return Xt.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));const n=e.startsWith("--");n&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let r=[],s=3;return t.forEach(t=>{if(t.length<=1)return;const n=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);const n=[];for(let r=0;r<=e.length;r++)n[r]=[r];for(let r=0;r<=t.length;r++)n[0][r]=r;for(let r=1;r<=t.length;r++)for(let s=1;s<=e.length;s++){let i=1;i=e[s-1]===t[r-1]?0:1,n[s][r]=Math.min(n[s-1][r]+1,n[s][r-1]+1,n[s-1][r-1]+i),s>1&&r>1&&e[s-1]===t[r-2]&&e[s-2]===t[r-1]&&(n[s][r]=Math.min(n[s][r],n[s-2][r-2]+1))}return n[e.length][t.length]}(e,t),i=Math.max(e.length,t.length);(i-n)/i>.4&&(n<s?(s=n,r=[t]):n===s&&r.push(t))}),r.sort((e,t)=>e.localeCompare(t)),n&&(r=r.map(e=>`--${e}`)),r.length>1?`\n(Did you mean one of ${r.join(", ")}?)`:1===r.length?`\n(Did you mean ${r[0]}?)`:""},Xt}var xt=function(){if(Et)return mt;Et=1;const{Argument:t}=bt(),{Command:n}=function(){if(Vt)return wt;Vt=1;const t=c.EventEmitter,n=l,r=o,s=i,a=e,{Argument:u,humanReadableArgName:d}=bt(),{CommanderError:h}=yt(),{Help:g}=Gt(),{Option:m,DualOptions:p}=St(),{suggestSimilar:f}=Bt();class y extends t{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,outputError:(e,t)=>t(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,s=n;"object"==typeof r&&null!==r&&(s=r,r=null),s=s||{};const[,i,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(i);return r&&(a.description(r),a._executableHandler=!0),s.isDefault&&(this._defaultCommandName=a._name),a._hidden=!(!s.noHelp&&!s.hidden),a._executableFile=s.executableFile||null,o&&a.arguments(o),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),r?this:a}createCommand(e){return new y(e)}createHelp(){return Object.assign(new g,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new u(e,t)}argument(e,t,n,r){const s=this.createArgument(e,t);return"function"==typeof n?s.default(r).argParser(n):s.default(n),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if("boolean"==typeof e)return this._addImplicitHelpCommand=e,this;e=e??"help [command]";const[,n,r]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",i=this.createCommand(n);return i.helpOption(!1),r&&i.arguments(r),s&&i.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=i,this}addHelpCommand(e,t){return"object"!=typeof e?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){const n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if("commander.executeSubCommandAsync"!==e.code)throw e}),this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new h(e,t,n)),a.exit(e)}action(e){return this._actionHandler=t=>{const n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)},this}createOption(e,t){return new m(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(s){if("commander.invalidArgument"===s.code){const e=`${r} ${s.message}`;this.error(e,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'\n- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){const t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){const r=t(this._findCommand(n)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${r}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);const t=e.name(),n=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(n,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(n,e.defaultValue,"default");const r=(t,r,s)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const i=this.getOptionValue(n);null!==t&&e.parseArg?t=this._callParseArg(e,t,i,r):null!==t&&e.variadic&&(t=e._concatValue(t,i)),null==t&&(t=!e.negate&&(!(!e.isBoolean()&&!e.optional)||"")),this.setOptionValueWithSource(n,t,s)};return this.on("option:"+t,t=>{const n=`error: option '${e.flags}' argument '${t}' is invalid.`;r(t,n,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{const n=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;r(t,n,"env")}),this}_optionEx(e,t,n,r,s){if("object"==typeof t&&t instanceof m)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const i=this.createOption(t,n);if(i.makeOptionMandatory(!!e.mandatory),"function"==typeof r)i.default(s).argParser(r);else if(r instanceof RegExp){const e=r;r=(t,n)=>{const r=e.exec(t);return r?r[0]:n},i.default(s).argParser(r)}else i.default(r);return this.addOption(i)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{void 0!==n.getOptionValueSource(e)&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},void 0===e&&void 0===t.from){a.versions?.electron&&(t.from="electron");const e=a.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}let n;switch(void 0===e&&(e=a.argv),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":a.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){const n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){const n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_executeSubCommand(e,t){t=t.slice();let i=!1;const o=[".js",".ts",".tsx",".mjs",".cjs"];function c(e,t){const n=r.resolve(e,t);if(s.existsSync(n))return n;if(o.includes(r.extname(t)))return;const i=o.find(e=>s.existsSync(`${n}${e}`));return i?`${n}${i}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let l,u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||"";if(this._scriptPath){let e;try{e=s.realpathSync(this._scriptPath)}catch(m){e=this._scriptPath}d=r.resolve(r.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){const n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}i=o.includes(r.extname(u)),"win32"!==a.platform?i?(t.unshift(u),t=b(a.execArgv).concat(t),l=n.spawn(a.argv[0],t,{stdio:"inherit"})):l=n.spawn(u,t,{stdio:"inherit"}):(t.unshift(u),t=b(a.execArgv).concat(t),l=n.spawn(a.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{a.on(e,()=>{!1===l.killed&&null===l.exitCode&&l.kill(e)})});const g=this._exitCallback;l.on("close",e=>{e=e??1,g?g(new h(e,"commander.executeSubCommandAsync","(close)")):a.exit(e)}),l.on("error",t=>{if("ENOENT"===t.code){const t=d?`searched for local subcommand relative to directory '${d}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",n=`'${u}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(n)}if("EACCES"===t.code)throw new Error(`'${u}' not executable`);if(g){const e=new h(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,g(e)}else a.exit(1)}),this.runningCommand=l}_dispatchSubcommand(e,t,n){const r=this._findCommand(e);let s;return r||this.help({error:!0}),s=this._chainOrCallSubCommandHook(s,r,"preSubcommand"),s=this._chainOrCall(s,()=>{if(!r._executableHandler)return r._parseCommand(t,n);this._executeSubCommand(r,t.concat(n))}),s}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const e=(e,t,n)=>{let r=t;if(null!==t&&e.parseArg){const s=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,s)}return r};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach((n,r)=>{let s=n.defaultValue;n.variadic?r<this.args.length?(s=this.args.slice(r),n.parseArg&&(s=s.reduce((t,r)=>e(n,r,t),n.defaultValue))):void 0===s&&(s=[]):r<this.args.length&&(s=this.args[r],n.parseArg&&(s=e(n,s,n.defaultValue))),t[r]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e;const r=[];return this._getCommandAndAncestors().reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),"postAction"===t&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return void 0!==this._lifeCycleHooks[n]&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){const n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){let n;return r(),this._processArguments(),n=this._chainOrCallHooks(n,"preAction"),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(s,e,t)})),n=this._chainOrCallHooks(n,"postAction"),n}if(this.parent&&this.parent.listenerCount(s))r(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){const e=this.options.filter(e=>{const t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{const n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){const t=[],n=[];let r=t;const s=e.slice();function i(e){return e.length>1&&"-"===e[0]}let o=null;for(;s.length;){const e=s.shift();if("--"===e){r===n&&r.push(e),r.push(...s);break}if(!o||i(e)){if(o=null,i(e)){const t=this._findOption(e);if(t){if(t.required){const e=s.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;s.length>0&&!i(s[0])&&(e=s.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){const t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),s.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("="),n=this._findOption(e.slice(0,t));if(n&&(n.required||n.optional)){this.emit(`option:${n.name()}`,e.slice(t+1));continue}}if(i(e)&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===n.length){if(this._findCommand(e)){t.push(e),s.length>0&&n.push(...s);break}if(this._getHelpCommand()&&e===this._getHelpCommand().name()){t.push(e),s.length>0&&t.push(...s);break}if(this._defaultCommandName){n.push(e),s.length>0&&n.push(...s);break}}if(this._passThroughOptions){r.push(e),s.length>0&&r.push(...s);break}r.push(e)}else this.emit(`option:${o.name()}`,e)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let n=0;n<t;n++){const t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const n=t||{},r=n.exitCode||1,s=n.code||"commander.error";this._exit(r,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){const t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){const e=new p(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(n=>void 0!==n.implied&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")})})}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const n=e=>{const t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),s=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(void 0===r.presetArg&&!1===n||void 0!==r.presetArg&&n===r.presetArg)?r:s||e},r=e=>{const t=n(e),r=t.attributeName();return"env"===this.getOptionValueSource(r)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},s=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],r=this;do{const e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=f(e,n)}const n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.length,n=1===t?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=f(e,n)}const n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";const r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");const n=this.parent?._findCommand(e);if(n){const t=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;const e=this.registeredArguments.map(e=>d(e));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=r.basename(e,r.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){const t={error:!!(e=e||{}).error};let n;return n=t.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),t.write=e.write||n,t.command=this,t}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const n=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(e=>e.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let r=this.helpInformation(n);if(t&&(r=t(r),"string"!=typeof r&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(e=>e.emit("afterAllHelp",n))}helpOption(e,t){return"boolean"==typeof e?(this._helpOption=e?this._helpOption??void 0:null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=a.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${n.join("', '")}'`);const r=`${e}Help`;return this.on(r,e=>{let n;n="function"==typeof t?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function b(e){return e.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n,r="127.0.0.1",s="9229";return null!==(n=e.match(/^(--inspect(-brk)?)$/))?t=n[1]:null!==(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=n[1],/^\d+$/.test(n[3])?s=n[3]:r=n[3]):null!==(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=n[1],r=n[3],s=n[4]),t&&"0"!==s?`${t}=${r}:${parseInt(s)+1}`:e})}return wt.Command=y,wt}(),{CommanderError:r,InvalidArgumentError:s}=yt(),{Help:a}=Gt(),{Option:u}=St();return mt.program=new n,mt.createCommand=e=>new n(e),mt.createOption=(e,t)=>new u(e,t),mt.createArgument=(e,n)=>new t(e,n),mt.Command=n,mt.Option=u,mt.Argument=t,mt.Help=a,mt.CommanderError=r,mt.InvalidArgumentError=s,mt.InvalidOptionArgumentError=s,mt}();const Rt=/* @__PURE__ */J(xt),{program:Wt,createCommand:Nt,createArgument:Jt,createOption:_t,CommanderError:kt,InvalidArgumentError:Ft,InvalidOptionArgumentError:Yt,Command:Lt,Argument:Ot,Option:Tt,Help:Ht}=Rt,Mt=g(import.meta.url),Kt=o.dirname(m(import.meta.url)),zt=Mt("production"===process.env.NODE_ENV?o.resolve(Kt,"./native/loader.cjs"):"@fluxlay/core"),{getDeveloperKey:Dt,setDeveloperKey:Ut,validateManifest:Pt,packContent:jt,unpackContent:Qt,getContentKey:$t,setContentKey:qt}=zt;function en(e){if("string"!=typeof e)throw new TypeError("Expected a string");if(!function(e){if("string"!=typeof e)return!1;const t=e.trim();return""!==t&&"."!==t&&".."!==t&&!e.includes("/")&&!e.includes("\\")&&!e.includes("\0")}(e))throw new Error(`Unsafe filename: ${JSON.stringify(e)}`)}const tn=p.homedir(),nn=p.tmpdir(),{env:rn}=e;var sn,on,an,cn,ln,un,dn,hn,gn,mn,pn={},fn={};function yn(){return sn||(sn=1,fn.fromCallback=function(e){return Object.defineProperty(function(...t){if("function"!=typeof t[t.length-1])return new Promise((n,r)=>{t.push((e,t)=>null!=e?r(e):n(t)),e.apply(this,t)});e.apply(this,t)},"name",{value:e.name})},fn.fromPromise=function(e){return Object.defineProperty(function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);t.pop(),e.apply(this,t).then(e=>n(null,e),n)},"name",{value:e.name})}),fn}function bn(){if(gn)return hn;gn=1;var e,t,n=f,r=function(){if(an)return on;an=1;var e=y,t=process.cwd,n=null,r=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return n||(n=t.call(process)),n};try{process.cwd()}catch(i){}if("function"==typeof process.chdir){var s=process.chdir;process.chdir=function(e){n=null,s.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,s)}return on=function(t){var n;function s(e){return e?function(n,r,s){return e.call(t,n,r,function(e){d(e)&&(e=null),s&&s.apply(this,arguments)})}:e}function o(e){return e?function(n,r){try{return e.call(t,n,r)}catch(i){if(!d(i))throw i}}:e}function a(e){return e?function(n,r,s,i){return e.call(t,n,r,s,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}:e}function c(e){return e?function(n,r,s){try{return e.call(t,n,r,s)}catch(i){if(!d(i))throw i}}:e}function l(e){return e?function(n,r,s){function i(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),s&&s.apply(this,arguments)}return"function"==typeof r&&(s=r,r=null),r?e.call(t,n,r,i):e.call(t,n,i)}:e}function u(e){return e?function(n,r){var s=r?e.call(t,n,r):e.call(t,n);return s&&(s.uid<0&&(s.uid+=4294967296),s.gid<0&&(s.gid+=4294967296)),s}:e}function d(e){return!e||"ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code)}e.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&((n=t).lchmod=function(t,r,s){n.open(t,e.O_WRONLY|e.O_SYMLINK,r,function(e,t){e?s&&s(e):n.fchmod(t,r,function(e){n.close(t,function(t){s&&s(e||t)})})})},n.lchmodSync=function(t,r){var s,o=n.openSync(t,e.O_WRONLY|e.O_SYMLINK,r),a=!0;try{s=n.fchmodSync(o,r),a=!1}finally{if(a)try{n.closeSync(o)}catch(i){}else n.closeSync(o)}return s}),t.lutimes||function(t){e.hasOwnProperty("O_SYMLINK")&&t.futimes?(t.lutimes=function(n,r,s,i){t.open(n,e.O_SYMLINK,function(e,n){e?i&&i(e):t.futimes(n,r,s,function(e){t.close(n,function(t){i&&i(e||t)})})})},t.lutimesSync=function(n,r,s){var o,a=t.openSync(n,e.O_SYMLINK),c=!0;try{o=t.futimesSync(a,r,s),c=!1}finally{if(c)try{t.closeSync(a)}catch(i){}else t.closeSync(a)}return o}):t.futimes&&(t.lutimes=function(e,t,n,r){r&&process.nextTick(r)},t.lutimesSync=function(){})}(t),t.chown=a(t.chown),t.fchown=a(t.fchown),t.lchown=a(t.lchown),t.chmod=s(t.chmod),t.fchmod=s(t.fchmod),t.lchmod=s(t.lchmod),t.chownSync=c(t.chownSync),t.fchownSync=c(t.fchownSync),t.lchownSync=c(t.lchownSync),t.chmodSync=o(t.chmodSync),t.fchmodSync=o(t.fchmodSync),t.lchmodSync=o(t.lchmodSync),t.stat=l(t.stat),t.fstat=l(t.fstat),t.lstat=l(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(e,t,n){n&&process.nextTick(n)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(e,t,n,r){r&&process.nextTick(r)},t.lchownSync=function(){}),"win32"===r&&(t.rename="function"!=typeof t.rename?t.rename:function(e){function n(n,r,s){var i=Date.now(),o=0;e(n,r,function a(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-i<6e4)return setTimeout(function(){t.stat(r,function(t,i){t&&"ENOENT"===t.code?e(n,r,a):s(c)})},o),void(o<100&&(o+=10));s&&s(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,e),n}(t.rename)),t.read="function"!=typeof t.read?t.read:function(e){function n(n,r,s,i,o,a){var c;if(a&&"function"==typeof a){var l=0;c=function(u,d,h){if(u&&"EAGAIN"===u.code&&l<10)return l++,e.call(t,n,r,s,i,o,c);a.apply(this,arguments)}}return e.call(t,n,r,s,i,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,e),n}(t.read),t.readSync="function"!=typeof t.readSync?t.readSync:/* @__PURE__ */function(e){return function(n,r,s,o,a){for(var c=0;;)try{return e.call(t,n,r,s,o,a)}catch(i){if("EAGAIN"===i.code&&c<10){c++;continue}throw i}}}(t.readSync)},on}(),s=function(){if(ln)return cn;ln=1;var e=b.Stream;return cn=function(t){return{ReadStream:function n(r,s){if(!(this instanceof n))return new n(r,s);e.call(this);var i=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,s=s||{};for(var o=Object.keys(s),a=0,c=o.length;a<c;a++){var l=o[a];this[l]=s[l]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?t.open(this.path,this.flags,this.mode,function(e,t){if(e)return i.emit("error",e),void(i.readable=!1);i.fd=t,i.emit("open",t),i._read()}):process.nextTick(function(){i._read()})},WriteStream:function n(r,s){if(!(this instanceof n))return new n(r,s);e.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,s=s||{};for(var i=Object.keys(s),o=0,a=i.length;o<a;o++){var c=i[o];this[c]=s[c]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}}}(),i=function(){if(dn)return un;dn=1,un=function(t){if(null===t||"object"!=typeof t)return t;if(t instanceof Object)var n={__proto__:e(t)};else n=/* @__PURE__ */Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}),n};var e=Object.getPrototypeOf||function(e){return e.__proto__};return un}(),o=I;function a(t,n){Object.defineProperty(t,e,{get:function(){return n}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(e=/* @__PURE__ */Symbol.for("graceful-fs.queue"),t=/* @__PURE__ */Symbol.for("graceful-fs.previous")):(e="___graceful-fs.queue",t="___graceful-fs.previous");var c,l=function(){};if(o.debuglog?l=o.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(l=function(){var e=o.format.apply(o,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!n[e]){var u=N[e]||[];a(n,u),n.close=function(e){function r(t,r){return e.call(n,t,function(e){e||g(),"function"==typeof r&&r.apply(this,arguments)})}return Object.defineProperty(r,t,{value:e}),r}(n.close),n.closeSync=function(e){function r(t){e.apply(n,arguments),g()}return Object.defineProperty(r,t,{value:e}),r}(n.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){l(n[e]),w.equal(n[e].length,0)})}function d(e){r(e),e.gracefulify=d,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,s,i){return t(n,r,function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof s&&s.apply(this,arguments):h([e,[n,r,s],t,i||Date.now(),Date.now()])})}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,s){"function"==typeof r&&(s=r,r=null);return function e(t,r,s,i,o){return n(t,r,s,function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof i&&i.apply(this,arguments):h([e,[t,r,s,i],n,o||Date.now(),Date.now()])})}(e,t,r,s)};var i=e.appendFile;i&&(e.appendFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=null);return function e(t,n,r,s,o){return i(t,n,r,function(i){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof s&&s.apply(this,arguments):h([e,[t,n,r,s],i,o||Date.now(),Date.now()])})}(e,t,n,r)});var o=e.copyFile;o&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,s,i){return o(t,n,r,function(o){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof s&&s.apply(this,arguments):h([e,[t,n,r,s],o,i||Date.now(),Date.now()])})}(e,t,n,r)});var a=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=c.test(process.version)?function(e,t,n,r){return a(e,s(e,t,n,r))}:function(e,t,n,r){return a(e,t,s(e,t,n,r))};return r(e,t,n);function s(e,t,n,s){return function(i,o){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?(o&&o.sort&&o.sort(),"function"==typeof n&&n.call(this,i,o)):h([r,[e,t,n],i,s||Date.now(),Date.now()])}}};var c=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var l=s(e);f=l.ReadStream,y=l.WriteStream}var u=e.ReadStream;u&&(f.prototype=Object.create(u.prototype),f.prototype.open=function(){var e=this;I(e.path,e.flags,e.mode,function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())})});var g=e.WriteStream;g&&(y.prototype=Object.create(g.prototype),y.prototype.open=function(){var e=this;I(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))})}),Object.defineProperty(e,"ReadStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var m=f;Object.defineProperty(e,"FileReadStream",{get:function(){return m},set:function(e){m=e},enumerable:!0,configurable:!0});var p=y;function f(e,t){return this instanceof f?(u.apply(this,arguments),this):f.apply(Object.create(f.prototype),arguments)}function y(e,t){return this instanceof y?(g.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return p},set:function(e){p=e},enumerable:!0,configurable:!0});var b=e.open;function I(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,s,i){return b(t,n,r,function(o,a){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof s&&s.apply(this,arguments):h([e,[t,n,r,s],o,i||Date.now(),Date.now()])})}(e,t,n,r)}return e.open=I,e}function h(t){l("ENQUEUE",t[0].name,t[1]),n[e].push(t),m()}function g(){for(var t=Date.now(),r=0;r<n[e].length;++r)n[e][r].length>2&&(n[e][r][3]=t,n[e][r][4]=t);m()}function m(){if(clearTimeout(c),c=void 0,0!==n[e].length){var t=n[e].shift(),r=t[0],s=t[1],i=t[2],o=t[3],a=t[4];if(void 0===o)l("RETRY",r.name,s),r.apply(null,s);else if(Date.now()-o>=6e4){l("TIMEOUT",r.name,s);var u=s.pop();"function"==typeof u&&u.call(null,i)}else{var d=Date.now()-a,h=Math.max(a-o,1);d>=Math.min(1.2*h,100)?(l("RETRY",r.name,s),r.apply(null,s.concat([o]))):n[e].push(t)}void 0===c&&(c=setTimeout(m,0))}}return N[e]||a(N,n[e]),hn=d(i(n)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!n.__patched&&(hn=d(n),n.__patched=!0),hn}function In(){return mn||(mn=1,function(e){const t=yn().fromCallback,n=bn(),r=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(e=>"function"==typeof n[e]);Object.assign(e,n),r.forEach(r=>{e[r]=t(n[r])}),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise(t=>n.exists(e,t))},e.read=function(e,t,r,s,i,o){return"function"==typeof o?n.read(e,t,r,s,i,o):new Promise((o,a)=>{n.read(e,t,r,s,i,(e,t,n)=>{if(e)return a(e);o({bytesRead:t,buffer:n})})})},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise((s,i)=>{n.write(e,t,...r,(e,t,n)=>{if(e)return i(e);s({bytesWritten:t,buffer:n})})})},e.readv=function(e,t,...r){return"function"==typeof r[r.length-1]?n.readv(e,t,...r):new Promise((s,i)=>{n.readv(e,t,...r,(e,t,n)=>{if(e)return i(e);s({bytesRead:t,buffers:n})})})},e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise((s,i)=>{n.writev(e,t,...r,(e,t,n)=>{if(e)return i(e);s({bytesWritten:t,buffers:n})})})},"function"==typeof n.realpath.native?e.realpath.native=t(n.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(pn)),pn}var wn,vn,Gn,An,Cn,Sn,Zn,Vn,En,Xn,Bn,xn,Rn,Wn,Nn,Jn,_n,kn,Fn,Yn,Ln,On,Tn,Hn,Mn,Kn,zn,Dn,Un,Pn,jn,Qn,$n,qn,er,tr,nr,rr,sr,ir,or,ar,cr,lr,ur,dr,hr,gr,mr,pr,fr,yr,br,Ir,wr,vr,Gr={},Ar={};function Cr(){if(wn)return Ar;wn=1;const e=v;return Ar.checkPath=function(t){if("win32"===process.platform){if(/[<>:"|?*]/.test(t.replace(e.parse(t).root,""))){const e=new Error(`Path contains invalid characters: ${t}`);throw e.code="EINVAL",e}}},Ar}function Sr(){if(vn)return Gr;vn=1;const e=/* @__PURE__ */In(),{checkPath:t}=/* @__PURE__ */Cr(),n=e=>"number"==typeof e?e:{mode:511,...e}.mode;return Gr.makeDir=async(r,s)=>(t(r),e.mkdir(r,{mode:n(s),recursive:!0})),Gr.makeDirSync=(r,s)=>(t(r),e.mkdirSync(r,{mode:n(s),recursive:!0})),Gr}function Zr(){if(An)return Gn;An=1;const e=yn().fromPromise,{makeDir:t,makeDirSync:n}=/* @__PURE__ */Sr(),r=e(t);return Gn={mkdirs:r,mkdirsSync:n,mkdirp:r,mkdirpSync:n,ensureDir:r,ensureDirSync:n}}function Vr(){if(Sn)return Cn;Sn=1;const e=yn().fromPromise,t=/* @__PURE__ */In();return Cn={pathExists:e(function(e){return t.access(e).then(()=>!0).catch(()=>!1)}),pathExistsSync:t.existsSync}}function Er(){if(Vn)return Zn;Vn=1;const e=/* @__PURE__ */In(),t=yn().fromPromise;return Zn={utimesMillis:t(async function(t,n,r){const s=await e.open(t,"r+");let i=null;try{await e.futimes(s,n,r)}finally{try{await e.close(s)}catch(o){i=o}}if(i)throw i}),utimesMillisSync:function(t,n,r){const s=e.openSync(t,"r+");return e.futimesSync(s,n,r),e.closeSync(s)}}}function Xr(){if(Xn)return En;Xn=1;const e=/* @__PURE__ */In(),t=v,n=yn().fromPromise;function r(e,t){return void 0!==t.ino&&void 0!==t.dev&&t.ino===e.ino&&t.dev===e.dev}function s(e,n){const r=t.resolve(e).split(t.sep).filter(e=>e),s=t.resolve(n).split(t.sep).filter(e=>e);return r.every((e,t)=>s[t]===e)}function i(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}return En={checkPaths:n(async function(n,o,a,c){const{srcStat:l,destStat:u}=await function(t,n,r){const s=r.dereference?t=>e.stat(t,{bigint:!0}):t=>e.lstat(t,{bigint:!0});return Promise.all([s(t),s(n).catch(e=>{if("ENOENT"===e.code)return null;throw e})]).then(([e,t])=>({srcStat:e,destStat:t}))}(n,o,c);if(u){if(r(l,u)){const e=t.basename(n),r=t.basename(o);if("move"===a&&e!==r&&e.toLowerCase()===r.toLowerCase())return{srcStat:l,destStat:u,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(l.isDirectory()&&!u.isDirectory())throw new Error(`Cannot overwrite non-directory '${o}' with directory '${n}'.`);if(!l.isDirectory()&&u.isDirectory())throw new Error(`Cannot overwrite directory '${o}' with non-directory '${n}'.`)}if(l.isDirectory()&&s(n,o))throw new Error(i(n,o,a));return{srcStat:l,destStat:u}}),checkPathsSync:function(n,o,a,c){const{srcStat:l,destStat:u}=function(t,n,r){let s;const i=r.dereference?t=>e.statSync(t,{bigint:!0}):t=>e.lstatSync(t,{bigint:!0}),o=i(t);try{s=i(n)}catch(a){if("ENOENT"===a.code)return{srcStat:o,destStat:null};throw a}return{srcStat:o,destStat:s}}(n,o,c);if(u){if(r(l,u)){const e=t.basename(n),r=t.basename(o);if("move"===a&&e!==r&&e.toLowerCase()===r.toLowerCase())return{srcStat:l,destStat:u,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(l.isDirectory()&&!u.isDirectory())throw new Error(`Cannot overwrite non-directory '${o}' with directory '${n}'.`);if(!l.isDirectory()&&u.isDirectory())throw new Error(`Cannot overwrite directory '${o}' with non-directory '${n}'.`)}if(l.isDirectory()&&s(n,o))throw new Error(i(n,o,a));return{srcStat:l,destStat:u}},checkParentPaths:n(async function n(s,o,a,c){const l=t.resolve(t.dirname(s)),u=t.resolve(t.dirname(a));if(u===l||u===t.parse(u).root)return;let d;try{d=await e.stat(u,{bigint:!0})}catch(h){if("ENOENT"===h.code)return;throw h}if(r(o,d))throw new Error(i(s,a,c));return n(s,o,u,c)}),checkParentPathsSync:function n(s,o,a,c){const l=t.resolve(t.dirname(s)),u=t.resolve(t.dirname(a));if(u===l||u===t.parse(u).root)return;let d;try{d=e.statSync(u,{bigint:!0})}catch(h){if("ENOENT"===h.code)return;throw h}if(r(o,d))throw new Error(i(s,a,c));return n(s,o,u,c)},isSrcSubdir:s,areIdentical:r},En}function Br(){if(xn)return Bn;return xn=1,Bn={asyncIteratorConcurrentProcess:async function(e,t){const n=[];for await(const r of e)n.push(t(r).then(()=>null,e=>e??new Error("unknown error")));await Promise.all(n.map(e=>e.then(e=>{if(null!==e)throw e})))}}}function xr(){if(Wn)return Rn;Wn=1;const e=/* @__PURE__ */In(),t=v,{mkdirs:n}=/* @__PURE__ */Zr(),{pathExists:r}=/* @__PURE__ */Vr(),{utimesMillis:s}=/* @__PURE__ */Er(),i=/* @__PURE__ */Xr(),{asyncIteratorConcurrentProcess:o}=/* @__PURE__ */Br();async function a(e,t,n){return!n.filter||n.filter(e,t)}async function c(n,r,s,u){const d=u.dereference?e.stat:e.lstat,h=await d(r);if(h.isDirectory())return async function(n,r,s,l,u){r||await e.mkdir(l);await o(await e.opendir(s),async e=>{const n=t.join(s,e.name),r=t.join(l,e.name);if(await a(n,r,u)){const{destStat:e}=await i.checkPaths(n,r,"copy",u);await c(e,n,r,u)}}),r||await e.chmod(l,n.mode)}(h,n,r,s,u);if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())return async function(t,n,r,s,i){if(!n)return l(t,r,s,i);if(i.overwrite)return await e.unlink(s),l(t,r,s,i);if(i.errorOnExist)throw new Error(`'${s}' already exists`)}(h,n,r,s,u);if(h.isSymbolicLink())return async function(n,r,s,o){let a=await e.readlink(r);o.dereference&&(a=t.resolve(process.cwd(),a));if(!n)return e.symlink(a,s);let c=null;try{c=await e.readlink(s)}catch(l){if("EINVAL"===l.code||"UNKNOWN"===l.code)return e.symlink(a,s);throw l}o.dereference&&(c=t.resolve(process.cwd(),c));if(a!==c){if(i.isSrcSubdir(a,c))throw new Error(`Cannot copy '${a}' to a subdirectory of itself, '${c}'.`);if(i.isSrcSubdir(c,a))throw new Error(`Cannot overwrite '${c}' with '${a}'.`)}return await e.unlink(s),e.symlink(a,s)}(n,r,s,u);if(h.isSocket())throw new Error(`Cannot copy a socket file: ${r}`);if(h.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${r}`);throw new Error(`Unknown file: ${r}`)}async function l(t,n,r,i){if(await e.copyFile(n,r),i.preserveTimestamps){128&t.mode||await function(t,n){return e.chmod(t,128|n)}(r,t.mode);const i=await e.stat(n);await s(r,i.atime,i.mtime)}return e.chmod(r,t.mode)}return Rn=async function(e,s,o={}){"function"==typeof o&&(o={filter:o}),o.clobber=!("clobber"in o)||!!o.clobber,o.overwrite="overwrite"in o?!!o.overwrite:o.clobber,o.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001");const{srcStat:l,destStat:u}=await i.checkPaths(e,s,"copy",o);if(await i.checkParentPaths(e,l,s,"copy"),!(await a(e,s,o)))return;const d=t.dirname(s);await r(d)||await n(d),await c(u,e,s,o)}}function Rr(){if(Jn)return Nn;Jn=1;const e=bn(),t=v,n=Zr().mkdirsSync,r=Er().utimesMillisSync,s=/* @__PURE__ */Xr();function i(n,r,i,l){const u=(l.dereference?e.statSync:e.lstatSync)(r);if(u.isDirectory())return function(t,n,r,s,i){return n?c(r,s,i):function(t,n,r,s){return e.mkdirSync(r),c(n,r,s),a(r,t)}(t.mode,r,s,i)}(u,n,r,i,l);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(t,n,r,s,i){return n?function(t,n,r,s){if(s.overwrite)return e.unlinkSync(r),o(t,n,r,s);if(s.errorOnExist)throw new Error(`'${r}' already exists`)}(t,r,s,i):o(t,r,s,i)}(u,n,r,i,l);if(u.isSymbolicLink())return function(n,r,i,o){let a=e.readlinkSync(r);o.dereference&&(a=t.resolve(process.cwd(),a));if(n){let n;try{n=e.readlinkSync(i)}catch(c){if("EINVAL"===c.code||"UNKNOWN"===c.code)return e.symlinkSync(a,i);throw c}if(o.dereference&&(n=t.resolve(process.cwd(),n)),a!==n){if(s.isSrcSubdir(a,n))throw new Error(`Cannot copy '${a}' to a subdirectory of itself, '${n}'.`);if(s.isSrcSubdir(n,a))throw new Error(`Cannot overwrite '${n}' with '${a}'.`)}return function(t,n){return e.unlinkSync(n),e.symlinkSync(t,n)}(a,i)}return e.symlinkSync(a,i)}(n,r,i,l);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${r}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${r}`);throw new Error(`Unknown file: ${r}`)}function o(t,n,s,i){return e.copyFileSync(n,s),i.preserveTimestamps&&function(t,n,s){(function(e){return!(128&e)})(t)&&function(e,t){a(e,128|t)}(s,t);(function(t,n){const s=e.statSync(t);r(n,s.atime,s.mtime)})(n,s)}(t.mode,n,s),a(s,t.mode)}function a(t,n){return e.chmodSync(t,n)}function c(t,n,r){const s=e.opendirSync(t);try{let e;for(;null!==(e=s.readSync());)l(e.name,t,n,r)}finally{s.closeSync()}}function l(e,n,r,o){const a=t.join(n,e),c=t.join(r,e);if(o.filter&&!o.filter(a,c))return;const{destStat:l}=s.checkPathsSync(a,c,"copy",o);return i(l,a,c,o)}return Nn=function(r,o,a){"function"==typeof a&&(a={filter:a}),(a=a||{}).clobber=!("clobber"in a)||!!a.clobber,a.overwrite="overwrite"in a?!!a.overwrite:a.clobber,a.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002");const{srcStat:c,destStat:l}=s.checkPathsSync(r,o,"copy",a);if(s.checkParentPathsSync(r,c,o,"copy"),a.filter&&!a.filter(r,o))return;const u=t.dirname(o);return e.existsSync(u)||n(u),i(l,r,o,a)}}function Wr(){if(kn)return _n;kn=1;const e=yn().fromPromise;return _n={copy:e(/* @__PURE__ */xr()),copySync:/* @__PURE__ */Rr()}}function Nr(){if(Yn)return Fn;Yn=1;const e=bn(),t=yn().fromCallback;return Fn={remove:t(function(t,n){e.rm(t,{recursive:!0,force:!0},n)}),removeSync:function(t){e.rmSync(t,{recursive:!0,force:!0})}}}function Jr(){if(On)return Ln;On=1;const e=yn().fromPromise,t=/* @__PURE__ */In(),n=v,r=/* @__PURE__ */Zr(),s=/* @__PURE__ */Nr(),i=e(async function(e){let i;try{i=await t.readdir(e)}catch{return r.mkdirs(e)}return Promise.all(i.map(t=>s.remove(n.join(e,t))))});function o(e){let i;try{i=t.readdirSync(e)}catch{return r.mkdirsSync(e)}i.forEach(t=>{t=n.join(e,t),s.removeSync(t)})}return Ln={emptyDirSync:o,emptydirSync:o,emptyDir:i,emptydir:i}}function _r(){if(Hn)return Tn;Hn=1;const e=yn().fromPromise,t=v,n=/* @__PURE__ */In(),r=/* @__PURE__ */Zr();return Tn={createFile:e(async function(e){let s;try{s=await n.stat(e)}catch{}if(s&&s.isFile())return;const i=t.dirname(e);let o=null;try{o=await n.stat(i)}catch(a){if("ENOENT"===a.code)return await r.mkdirs(i),void(await n.writeFile(e,""));throw a}o.isDirectory()?await n.writeFile(e,""):await n.readdir(i)}),createFileSync:function(e){let s;try{s=n.statSync(e)}catch{}if(s&&s.isFile())return;const i=t.dirname(e);try{n.statSync(i).isDirectory()||n.readdirSync(i)}catch(o){if(!o||"ENOENT"!==o.code)throw o;r.mkdirsSync(i)}n.writeFileSync(e,"")}}}function kr(){if(Kn)return Mn;Kn=1;const e=yn().fromPromise,t=v,n=/* @__PURE__ */In(),r=/* @__PURE__ */Zr(),{pathExists:s}=/* @__PURE__ */Vr(),{areIdentical:i}=/* @__PURE__ */Xr();return Mn={createLink:e(async function(e,o){let a,c;try{a=await n.lstat(o)}catch{}try{c=await n.lstat(e)}catch(u){throw u.message=u.message.replace("lstat","ensureLink"),u}if(a&&i(c,a))return;const l=t.dirname(o);await s(l)||await r.mkdirs(l),await n.link(e,o)}),createLinkSync:function(e,s){let o;try{o=n.lstatSync(s)}catch{}try{const t=n.lstatSync(e);if(o&&i(t,o))return}catch(c){throw c.message=c.message.replace("lstat","ensureLink"),c}const a=t.dirname(s);return n.existsSync(a)||r.mkdirsSync(a),n.linkSync(e,s)}}}function Fr(){if(Dn)return zn;Dn=1;const e=v,t=/* @__PURE__ */In(),{pathExists:n}=/* @__PURE__ */Vr(),r=yn().fromPromise;return zn={symlinkPaths:r(async function(r,s){if(e.isAbsolute(r)){try{await t.lstat(r)}catch(a){throw a.message=a.message.replace("lstat","ensureSymlink"),a}return{toCwd:r,toDst:r}}const i=e.dirname(s),o=e.join(i,r);if(await n(o))return{toCwd:o,toDst:r};try{await t.lstat(r)}catch(a){throw a.message=a.message.replace("lstat","ensureSymlink"),a}return{toCwd:r,toDst:e.relative(i,r)}}),symlinkPathsSync:function(n,r){if(e.isAbsolute(n)){if(!t.existsSync(n))throw new Error("absolute srcpath does not exist");return{toCwd:n,toDst:n}}const s=e.dirname(r),i=e.join(s,n);if(t.existsSync(i))return{toCwd:i,toDst:n};if(!t.existsSync(n))throw new Error("relative srcpath does not exist");return{toCwd:n,toDst:e.relative(s,n)}}}}function Yr(){if(Pn)return Un;Pn=1;const e=/* @__PURE__ */In(),t=yn().fromPromise;return Un={symlinkType:t(async function(t,n){if(n)return n;let r;try{r=await e.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}),symlinkTypeSync:function(t,n){if(n)return n;let r;try{r=e.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}}}function Lr(){if(Qn)return jn;Qn=1;const e=yn().fromPromise,t=v,n=/* @__PURE__ */In(),{mkdirs:r,mkdirsSync:s}=/* @__PURE__ */Zr(),{symlinkPaths:i,symlinkPathsSync:o}=/* @__PURE__ */Fr(),{symlinkType:a,symlinkTypeSync:c}=/* @__PURE__ */Yr(),{pathExists:l}=/* @__PURE__ */Vr(),{areIdentical:u}=/* @__PURE__ */Xr();return jn={createSymlink:e(async function(e,s,o){let c;try{c=await n.lstat(s)}catch{}if(c&&c.isSymbolicLink()){const[t,r]=await Promise.all([n.stat(e),n.stat(s)]);if(u(t,r))return}const d=await i(e,s);e=d.toDst;const h=await a(d.toCwd,o),g=t.dirname(s);return await l(g)||await r(g),n.symlink(e,s,h)}),createSymlinkSync:function(e,r,i){let a;try{a=n.lstatSync(r)}catch{}if(a&&a.isSymbolicLink()){const t=n.statSync(e),s=n.statSync(r);if(u(t,s))return}const l=o(e,r);e=l.toDst,i=c(l.toCwd,i);const d=t.dirname(r);return n.existsSync(d)||s(d),n.symlinkSync(e,r,i)}}}function Or(){if(qn)return $n;qn=1;const{createFile:e,createFileSync:t}=/* @__PURE__ */_r(),{createLink:n,createLinkSync:r}=/* @__PURE__ */kr(),{createSymlink:s,createSymlinkSync:i}=/* @__PURE__ */Lr();return $n={createFile:e,createFileSync:t,ensureFile:e,ensureFileSync:t,createLink:n,createLinkSync:r,ensureLink:n,ensureLinkSync:r,createSymlink:s,createSymlinkSync:i,ensureSymlink:s,ensureSymlinkSync:i}}function Tr(){if(tr)return er;return tr=1,er={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:s}={}){const i=n?t:"";return JSON.stringify(e,r,s).replace(/\n/g,t)+i},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}}}function Hr(){if(ir)return sr;ir=1;const e=function(){if(rr)return nr;let e;rr=1;try{e=bn()}catch(o){e=f}const t=yn(),{stringify:n,stripBom:r}=Tr(),s=t.fromPromise(async function(n,s={}){"string"==typeof s&&(s={encoding:s});const i=s.fs||e,o=!("throws"in s)||s.throws;let a,c=await t.fromCallback(i.readFile)(n,s);c=r(c);try{a=JSON.parse(c,s?s.reviver:null)}catch(l){if(o)throw l.message=`${n}: ${l.message}`,l;return null}return a}),i=t.fromPromise(async function(r,s,i={}){const o=i.fs||e,a=n(s,i);await t.fromCallback(o.writeFile)(r,a,i)});return nr={readFile:s,readFileSync:function(t,n={}){"string"==typeof n&&(n={encoding:n});const s=n.fs||e,i=!("throws"in n)||n.throws;try{let e=s.readFileSync(t,n);return e=r(e),JSON.parse(e,n.reviver)}catch(o){if(i)throw o.message=`${t}: ${o.message}`,o;return null}},writeFile:i,writeFileSync:function(t,r,s={}){const i=s.fs||e,o=n(r,s);return i.writeFileSync(t,o,s)}}}();return sr={readJson:e.readFile,readJsonSync:e.readFileSync,writeJson:e.writeFile,writeJsonSync:e.writeFileSync}}function Mr(){if(ar)return or;ar=1;const e=yn().fromPromise,t=/* @__PURE__ */In(),n=v,r=/* @__PURE__ */Zr(),s=Vr().pathExists;return or={outputFile:e(async function(e,i,o="utf-8"){const a=n.dirname(e);return await s(a)||await r.mkdirs(a),t.writeFile(e,i,o)}),outputFileSync:function(e,...s){const i=n.dirname(e);t.existsSync(i)||r.mkdirsSync(i),t.writeFileSync(e,...s)}}}function Kr(){if(lr)return cr;lr=1;const{stringify:e}=Tr(),{outputFile:t}=/* @__PURE__ */Mr();return cr=async function(n,r,s={}){const i=e(r,s);await t(n,i,s)}}function zr(){if(dr)return ur;dr=1;const{stringify:e}=Tr(),{outputFileSync:t}=/* @__PURE__ */Mr();return ur=function(n,r,s){const i=e(r,s);t(n,i,s)}}function Dr(){if(gr)return hr;gr=1;const e=yn().fromPromise,t=/* @__PURE__ */Hr();return t.outputJson=e(/* @__PURE__ */Kr()),t.outputJsonSync=/* @__PURE__ */zr(),t.outputJSON=t.outputJson,t.outputJSONSync=t.outputJsonSync,t.writeJSON=t.writeJson,t.writeJSONSync=t.writeJsonSync,t.readJSON=t.readJson,t.readJSONSync=t.readJsonSync,hr=t}function Ur(){if(pr)return mr;pr=1;const e=/* @__PURE__ */In(),t=v,{copy:n}=/* @__PURE__ */Wr(),{remove:r}=/* @__PURE__ */Nr(),{mkdirp:s}=/* @__PURE__ */Zr(),{pathExists:i}=/* @__PURE__ */Vr(),o=/* @__PURE__ */Xr();return mr=async function(a,c,l={}){const u=l.overwrite||l.clobber||!1,{srcStat:d,isChangingCase:h=!1}=await o.checkPaths(a,c,"move",l);await o.checkParentPaths(a,d,c,"move");const g=t.dirname(c);return t.parse(g).root!==g&&await s(g),async function(t,s,o,a){if(!a)if(o)await r(s);else if(await i(s))throw new Error("dest already exists.");try{await e.rename(t,s)}catch(c){if("EXDEV"!==c.code)throw c;await async function(e,t,s){const i={overwrite:s,errorOnExist:!0,preserveTimestamps:!0};return await n(e,t,i),r(e)}(t,s,o)}}(a,c,u,h)}}function Pr(){if(yr)return fr;yr=1;const e=bn(),t=v,n=Wr().copySync,r=Nr().removeSync,s=Zr().mkdirpSync,i=/* @__PURE__ */Xr();function o(t,s,i){try{e.renameSync(t,s)}catch(o){if("EXDEV"!==o.code)throw o;return function(e,t,s){const i={overwrite:s,errorOnExist:!0,preserveTimestamps:!0};return n(e,t,i),r(e)}(t,s,i)}}return fr=function(n,a,c){const l=(c=c||{}).overwrite||c.clobber||!1,{srcStat:u,isChangingCase:d=!1}=i.checkPathsSync(n,a,"move",c);return i.checkParentPathsSync(n,u,a,"move"),function(e){const n=t.dirname(e);return t.parse(n).root===n}(a)||s(t.dirname(a)),function(t,n,s,i){if(i)return o(t,n,s);if(s)return r(n),o(t,n,s);if(e.existsSync(n))throw new Error("dest already exists.");return o(t,n,s)}(n,a,l,d)}}function jr(){if(Ir)return br;Ir=1;const e=yn().fromPromise;return br={move:e(/* @__PURE__ */Ur()),moveSync:/* @__PURE__ */Pr()}}function Qr(){return vr?wr:(vr=1,wr={.../* @__PURE__ */In(),.../* @__PURE__ */Wr(),.../* @__PURE__ */Jr(),.../* @__PURE__ */Or(),.../* @__PURE__ */Dr(),.../* @__PURE__ */Zr(),.../* @__PURE__ */jr(),.../* @__PURE__ */Mr(),.../* @__PURE__ */Vr(),.../* @__PURE__ */Nr()})}const $r=/* @__PURE__ */J(/* @__PURE__ */Qr()),qr=function(t,{suffix:n="nodejs"}={}){return en(t),n&&(t+=`-${n}`),en(t),"darwin"===e.platform?(e=>{const t=o.join(tn,"Library");return{data:o.join(t,"Application Support",e),config:o.join(t,"Preferences",e),cache:o.join(t,"Caches",e),log:o.join(t,"Logs",e),temp:o.join(nn,e)}})(t):"win32"===e.platform?(e=>{const t=rn.APPDATA||o.join(tn,"AppData","Roaming"),n=rn.LOCALAPPDATA||o.join(tn,"AppData","Local");return{data:o.join(n,e,"Data"),config:o.join(t,e,"Config"),cache:o.join(n,e,"Cache"),log:o.join(n,e,"Log"),temp:o.join(nn,e)}})(t):(e=>{const t=o.basename(tn);return{data:o.join(rn.XDG_DATA_HOME||o.join(tn,".local","share"),e),config:o.join(rn.XDG_CONFIG_HOME||o.join(tn,".config"),e),cache:o.join(rn.XDG_CACHE_HOME||o.join(tn,".cache"),e),log:o.join(rn.XDG_STATE_HOME||o.join(tn,".local","state"),e),temp:o.join(nn,t,e)}})(t)}("fluxlay",{suffix:""});class es{static filePath=o.join(qr.data,"auth.json");static async saveSession(e){await $r.ensureDir(qr.data),await $r.writeJson(es.filePath,e,{spaces:2}),await $r.chmod(es.filePath,384)}static async getSession(){if(!(await $r.pathExists(es.filePath)))return null;try{return await $r.readJson(es.filePath)}catch(e){return null}}static async clearSession(){await $r.pathExists(es.filePath)&&await $r.remove(es.filePath)}}var ts,ns,rs,ss;function is(e,t){return!(null===e||"object"!=typeof e||!("$typeName"in e)||"string"!=typeof e.$typeName)&&(void 0===t||t.typeName===e.$typeName)}function os(){let e=0,t=0;for(let r=0;r<28;r+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<r,!(128&n))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,!(128&n))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<r,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function as(e,t,n){for(let i=0;i<28;i+=7){const r=e>>>i,s=!(r>>>7==0&&0==t),o=255&(s?128|r:r);if(n.push(o),!s)return}const r=e>>>28&15|(7&t)<<4,s=!!(t>>3);if(n.push(255&(s?128|r:r)),s){for(let e=3;e<31;e+=7){const r=t>>>e,s=!(r>>>7==0),i=255&(s?128|r:r);if(n.push(i),!s)return}n.push(t>>>31&1)}}(ns=ts||(ts={}))[ns.Canceled=1]="Canceled",ns[ns.Unknown=2]="Unknown",ns[ns.InvalidArgument=3]="InvalidArgument",ns[ns.DeadlineExceeded=4]="DeadlineExceeded",ns[ns.NotFound=5]="NotFound",ns[ns.AlreadyExists=6]="AlreadyExists",ns[ns.PermissionDenied=7]="PermissionDenied",ns[ns.ResourceExhausted=8]="ResourceExhausted",ns[ns.FailedPrecondition=9]="FailedPrecondition",ns[ns.Aborted=10]="Aborted",ns[ns.OutOfRange=11]="OutOfRange",ns[ns.Unimplemented=12]="Unimplemented",ns[ns.Internal=13]="Internal",ns[ns.Unavailable=14]="Unavailable",ns[ns.DataLoss=15]="DataLoss",ns[ns.Unauthenticated=16]="Unauthenticated",(ss=rs||(rs={}))[ss.DOUBLE=1]="DOUBLE",ss[ss.FLOAT=2]="FLOAT",ss[ss.INT64=3]="INT64",ss[ss.UINT64=4]="UINT64",ss[ss.INT32=5]="INT32",ss[ss.FIXED64=6]="FIXED64",ss[ss.FIXED32=7]="FIXED32",ss[ss.BOOL=8]="BOOL",ss[ss.STRING=9]="STRING",ss[ss.BYTES=12]="BYTES",ss[ss.UINT32=13]="UINT32",ss[ss.SFIXED32=15]="SFIXED32",ss[ss.SFIXED64=16]="SFIXED64",ss[ss.SINT32=17]="SINT32",ss[ss.SINT64=18]="SINT64";const cs=4294967296;function ls(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let r=0,s=0;function i(t,i){const o=Number(e.slice(t,i));s*=n,r=r*n+o,r>=cs&&(s+=r/cs|0,r%=cs)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?hs(r,s):ds(r,s)}function us(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(cs*t+e);const n=16777215&(e>>>24|t<<8),r=t>>16&65535;let s=(16777215&e)+6777216*n+6710656*r,i=n+8147497*r,o=2*r;const a=1e7;return s>=a&&(i+=Math.floor(s/a),s%=a),i>=a&&(o+=Math.floor(i/a),i%=a),o.toString()+gs(i)+gs(s)}function ds(e,t){return{lo:0|e,hi:0|t}}function hs(e,t){return t=~t,e?e=1+~e:t+=1,ds(e,t)}const gs=e=>{const t=String(e);return"0000000".slice(t.length)+t};function ms(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function ps(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let n=5;128&e&&n<10;n++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const fs=/* @__PURE__ */ys();function ys(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&(!!globalThis.Deno||"object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),r=BigInt("0"),s=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const r="bigint"==typeof e?e:BigInt(e);if(r>n||r<t)throw new Error(`invalid int64: ${e}`);return r},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>s||t<r)throw new Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),bs(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),Is(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),bs(e),ls(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),Is(e),ls(e)),dec:(e,t)=>function(e,t){let n=ds(e,t);const r=2147483648&n.hi;r&&(n=hs(n.lo,n.hi));const s=us(n.lo,n.hi);return r?"-"+s:s}(e,t),uDec:(e,t)=>us(e,t)}}function bs(e){if(!/^-?[0-9]+$/.test(e))throw new Error("invalid int64: "+e)}function Is(e){if(!/^[0-9]+$/.test(e))throw new Error("invalid uint64: "+e)}function ws(e,t){switch(e){case rs.STRING:return"";case rs.BOOL:return!1;case rs.DOUBLE:case rs.FLOAT:return 0;case rs.INT64:case rs.UINT64:case rs.SFIXED64:case rs.FIXED64:case rs.SINT64:return t?"0":fs.zero;case rs.BYTES:return new Uint8Array(0);default:return 0}}const vs=/* @__PURE__ */Symbol.for("reflect unsafe local");function Gs(e,t){const n=e[t.localName].case;return void 0===n?n:t.fields.find(e=>e.localName===n)}function As(e,t){const n=t.localName;if(t.oneof)return e[t.oneof.localName].case===n;if(2!=t.presence)return void 0!==e[n]&&Object.prototype.hasOwnProperty.call(e,n);switch(t.fieldKind){case"list":return e[n].length>0;case"map":return Object.keys(e[n]).length>0;case"scalar":return!function(e,t){switch(e){case rs.BOOL:return!1===t;case rs.STRING:return""===t;case rs.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(t.scalar,e[n]);case"enum":return e[n]!==t.enum.values[0].number}throw new Error("message field with implicit presence")}function Cs(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&void 0!==e[t]}function Ss(e,t){if(t.oneof){const n=e[t.oneof.localName];return n.case===t.localName?n.value:void 0}return e[t.localName]}function Zs(e,t,n){t.oneof?e[t.oneof.localName]={case:t.localName,value:n}:e[t.localName]=n}function Vs(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Es(e,t){var n,r,s,i;if(Vs(e)&&vs in e&&"add"in e&&"field"in e&&"function"==typeof e.field){if(void 0!==t){const o=t,a=e.field();return o.listKind==a.listKind&&o.scalar===a.scalar&&(null===(n=o.message)||void 0===n?void 0:n.typeName)===(null===(r=a.message)||void 0===r?void 0:r.typeName)&&(null===(s=o.enum)||void 0===s?void 0:s.typeName)===(null===(i=a.enum)||void 0===i?void 0:i.typeName)}return!0}return!1}function Xs(e,t){var n,r,s,i;if(Vs(e)&&vs in e&&"has"in e&&"field"in e&&"function"==typeof e.field){if(void 0!==t){const o=t,a=e.field();return o.mapKey===a.mapKey&&o.mapKind==a.mapKind&&o.scalar===a.scalar&&(null===(n=o.message)||void 0===n?void 0:n.typeName)===(null===(r=a.message)||void 0===r?void 0:r.typeName)&&(null===(s=o.enum)||void 0===s?void 0:s.typeName)===(null===(i=a.enum)||void 0===i?void 0:i.typeName)}return!0}return!1}function Bs(e,t){return Vs(e)&&vs in e&&"desc"in e&&Vs(e.desc)&&"message"===e.desc.kind&&(void 0===t||e.desc.typeName==t.typeName)}function xs(e){const t=e.fields[0];return Rs(e.typeName)&&void 0!==t&&"scalar"==t.fieldKind&&"value"==t.name&&1==t.number}function Rs(e){return e.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(e.substring(16))}function Ws(e,t){if(is(t,e))return t;const n=function(e){let t;if(function(e){switch(e.file.edition){case 999:return!1;case 998:return!0;default:return e.fields.some(e=>2!=e.presence&&"message"!=e.fieldKind&&!e.oneof)}}(e)){const n=Os.get(e);let r,s;if(n)({prototype:r,members:s}=n);else{r={},s=/* @__PURE__ */new Set;for(const t of e.members)"oneof"!=t.kind&&("scalar"!=t.fieldKind&&"enum"!=t.fieldKind||2!=t.presence&&(s.add(t),r[t.localName]=Ts(t)));Os.set(e,{prototype:r,members:s})}t=Object.create(r),t.$typeName=e.typeName;for(const i of e.members)if(!s.has(i)){if("field"==i.kind){if("message"==i.fieldKind)continue;if(("scalar"==i.fieldKind||"enum"==i.fieldKind)&&2!=i.presence)continue}t[i.localName]=Ts(i)}}else{t={$typeName:e.typeName};for(const n of e.members)"oneof"!=n.kind&&2!=n.presence||(t[n.localName]=Ts(n))}return t}(e);return void 0!==t&&function(e,t,n){for(const r of e.members){let e,s=n[r.localName];if(null!=s){if("oneof"==r.kind){const t=Gs(n,r);if(!t)continue;e=t,s=Ss(n,t)}else e=r;switch(e.fieldKind){case"message":s=ks(e,s);break;case"scalar":s=Ns(e,s);break;case"list":s=_s(e,s);break;case"map":s=Js(e,s)}Zs(t,e,s)}}}(e,n,t),n}function Ns(e,t){return e.scalar==rs.BYTES?Fs(t):t}function Js(e,t){if(Vs(t)){if(e.scalar==rs.BYTES)return Ys(t,Fs);if("message"==e.mapKind)return Ys(t,t=>ks(e,t))}return t}function _s(e,t){if(Array.isArray(t)){if(e.scalar==rs.BYTES)return t.map(Fs);if("message"==e.listKind)return t.map(t=>ks(e,t))}return t}function ks(e,t){if("message"==e.fieldKind&&!e.oneof&&xs(e.message))return Ns(e.message.fields[0],t);if(Vs(t)){if("google.protobuf.Struct"==e.message.typeName&&"google.protobuf.Value"!==e.parent.typeName)return t;if(!is(t,e.message))return Ws(e.message,t)}return t}function Fs(e){return Array.isArray(e)?new Uint8Array(e):e}function Ys(e,t){const n={};for(const r of Object.entries(e))n[r[0]]=t(r[1]);return n}const Ls=/* @__PURE__ */Symbol(),Os=/* @__PURE__ */new WeakMap;function Ts(e){if("oneof"==e.kind)return{case:void 0};if("list"==e.fieldKind)return[];if("map"==e.fieldKind)return{};if("message"==e.fieldKind)return Ls;const t=e.getDefaultValue();return void 0!==t?"scalar"==e.fieldKind&&e.longAsString?t.toString():t:"scalar"==e.fieldKind?ws(e.scalar,e.longAsString):e.enum.values[0].number}const Hs=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"];class Ms extends Error{constructor(e,t,n="FieldValueInvalidError"){super(t),this.name=n,this.field=()=>e}}const Ks=/* @__PURE__ */Symbol.for("@bufbuild/protobuf/text-encoding");function zs(){if(null==globalThis[Ks]){const e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[Ks]={encodeUtf8:t=>e.encode(t),decodeUtf8:e=>t.decode(e),checkUtf8(e){try{return encodeURIComponent(e),!0}catch(t){return!1}}}}return globalThis[Ks]}var Ds,Us;(Us=Ds||(Ds={}))[Us.Varint=0]="Varint",Us[Us.Bit64=1]="Bit64",Us[Us.LengthDelimited=2]="LengthDelimited",Us[Us.StartGroup=3]="StartGroup",Us[Us.EndGroup=4]="EndGroup",Us[Us.Bit32=5]="Bit32";const Ps=34028234663852886e22,js=-34028234663852886e22,Qs=4294967295,$s=2147483647,qs=-2147483648;class ei{constructor(e=zs().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let r=0;r<this.chunks.length;r++)e+=this.chunks[r].length;let t=new Uint8Array(e),n=0;for(let r=0;r<this.chunks.length;r++)t.set(this.chunks[r],n),n+=this.chunks[r].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(ri(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return ni(e),ms(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){!function(e){if("string"==typeof e){const t=e;if(e=Number(e),Number.isNaN(e)&&"NaN"!==t)throw new Error("invalid float32: "+t)}else if("number"!=typeof e)throw new Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>Ps||e<js))throw new Error("invalid float32: "+e)}(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){ri(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){ni(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return ni(e),ms(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=fs.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=fs.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=fs.enc(e);return as(t.lo,t.hi,this.buf),this}sint64(e){const t=fs.enc(e),n=t.hi>>31;return as(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){const t=fs.uEnc(e);return as(t.lo,t.hi,this.buf),this}}class ti{constructor(e,t=zs().decodeUtf8){this.decodeUtf8=t,this.varint64=os,this.uint32=ps,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case Ds.Varint:for(;128&this.buf[this.pos++];);break;case Ds.Bit64:this.pos+=4;case Ds.Bit32:this.pos+=4;break;case Ds.LengthDelimited:let n=this.uint32();this.pos+=n;break;case Ds.StartGroup:for(;;){const[e,n]=this.tag();if(n===Ds.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(n,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return fs.dec(...this.varint64())}uint64(){return fs.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,fs.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return fs.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return fs.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.decodeUtf8(this.bytes())}}function ni(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>$s||e<qs)throw new Error("invalid int32: "+e)}function ri(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw new Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>Qs||e<0)throw new Error("invalid uint32: "+e)}function si(e,t){const n="list"==e.fieldKind?Es(t,e):"map"==e.fieldKind?Xs(t,e):oi(e,t);if(!0===n)return;let r;switch(e.fieldKind){case"list":r=`expected ${di(e)}, got ${li(t)}`;break;case"map":r=`expected ${hi(e)}, got ${li(t)}`;break;default:r=ci(e,t,n)}return new Ms(e,r)}function ii(e,t,n){const r=oi(e,n);if(!0!==r)return new Ms(e,`list item #${t+1}: ${ci(e,n,r)}`)}function oi(e,t){return void 0!==e.scalar?ai(t,e.scalar):void 0!==e.enum?e.enum.open?Number.isInteger(t):e.enum.values.some(e=>e.number===t):Bs(t,e.message)}function ai(e,t){switch(t){case rs.DOUBLE:return"number"==typeof e;case rs.FLOAT:return"number"==typeof e&&(!(!Number.isNaN(e)&&Number.isFinite(e))||(!(e>Ps||e<js)||`${e.toFixed()} out of range`));case rs.INT32:case rs.SFIXED32:case rs.SINT32:return!("number"!=typeof e||!Number.isInteger(e))&&(!(e>$s||e<qs)||`${e.toFixed()} out of range`);case rs.FIXED32:case rs.UINT32:return!("number"!=typeof e||!Number.isInteger(e))&&(!(e>Qs||e<0)||`${e.toFixed()} out of range`);case rs.BOOL:return"boolean"==typeof e;case rs.STRING:return"string"==typeof e&&(zs().checkUtf8(e)||"invalid UTF8");case rs.BYTES:return e instanceof Uint8Array;case rs.INT64:case rs.SFIXED64:case rs.SINT64:if("bigint"==typeof e||"number"==typeof e||"string"==typeof e&&e.length>0)try{return fs.parse(e),!0}catch(n){return`${e} out of range`}return!1;case rs.FIXED64:case rs.UINT64:if("bigint"==typeof e||"number"==typeof e||"string"==typeof e&&e.length>0)try{return fs.uParse(e),!0}catch(n){return`${e} out of range`}return!1}}function ci(e,t,n){return n="string"==typeof n?`: ${n}`:`, got ${li(t)}`,void 0!==e.scalar?`expected ${function(e){switch(e){case rs.STRING:return"string";case rs.BOOL:return"boolean";case rs.INT64:case rs.SINT64:case rs.SFIXED64:return"bigint (int64)";case rs.UINT64:case rs.FIXED64:return"bigint (uint64)";case rs.BYTES:return"Uint8Array";case rs.DOUBLE:return"number (float64)";case rs.FLOAT:return"number (float32)";case rs.FIXED32:case rs.UINT32:return"number (uint32)";case rs.INT32:case rs.SFIXED32:case rs.SINT32:return"number (int32)"}}(e.scalar)}`+n:void 0!==e.enum?`expected ${e.enum.toString()}`+n:`expected ${ui(e.message)}`+n}function li(e){switch(typeof e){case"object":return null===e?"null":e instanceof Uint8Array?`Uint8Array(${e.length})`:Array.isArray(e)?`Array(${e.length})`:Es(e)?di(e.field()):Xs(e)?hi(e.field()):Bs(e)?ui(e.desc):is(e)?`message ${e.$typeName}`:"object";case"string":return e.length>30?"string":`"${e.split('"').join('\\"')}"`;case"boolean":case"number":return String(e);case"bigint":return String(e)+"n";default:return typeof e}}function ui(e){return`ReflectMessage (${e.typeName})`}function di(e){switch(e.listKind){case"message":return`ReflectList (${e.message.toString()})`;case"enum":return`ReflectList (${e.enum.toString()})`;case"scalar":return`ReflectList (${rs[e.scalar]})`}}function hi(e){switch(e.mapKind){case"message":return`ReflectMap (${rs[e.mapKey]}, ${e.message.toString()})`;case"enum":return`ReflectMap (${rs[e.mapKey]}, ${e.enum.toString()})`;case"scalar":return`ReflectMap (${rs[e.mapKey]}, ${rs[e.scalar]})`}}function gi(e,t,n=!0){return new pi(e,t,n)}const mi=/* @__PURE__ */new WeakMap;class pi{get sortedFields(){const e=mi.get(this.desc);if(e)return e;const t=this.desc.fields.concat().sort((e,t)=>e.number-t.number);return mi.set(this.desc,t),t}constructor(e,t,n=!0){this.lists=/* @__PURE__ */new Map,this.maps=/* @__PURE__ */new Map,this.check=n,this.desc=e,this.message=this[vs]=null!=t?t:Ws(e),this.fields=e.fields,this.oneofs=e.oneofs,this.members=e.members}findNumber(e){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(e=>[e.number,e]))),this._fieldsByNumber.get(e)}oneofCase(e){return fi(this.message,e),Gs(this.message,e)}isSet(e){return fi(this.message,e),As(this.message,e)}clear(e){fi(this.message,e),function(e,t){const n=t.localName;if(t.oneof){const r=t.oneof.localName;e[r].case===n&&(e[r]={case:void 0})}else if(2!=t.presence)delete e[n];else switch(t.fieldKind){case"map":e[n]={};break;case"list":e[n]=[];break;case"enum":e[n]=t.enum.values[0].number;break;case"scalar":e[n]=ws(t.scalar,t.longAsString)}}(this.message,e)}get(e){fi(this.message,e);const t=Ss(this.message,e);switch(e.fieldKind){case"list":let n=this.lists.get(e);return n&&n[vs]===t||this.lists.set(e,n=new yi(e,t,this.check)),n;case"map":let r=this.maps.get(e);return r&&r[vs]===t||this.maps.set(e,r=new bi(e,t,this.check)),r;case"message":return wi(e,t,this.check);case"scalar":return void 0===t?ws(e.scalar,!1):Zi(e,t);case"enum":return null!=t?t:e.enum.values[0].number}}set(e,t){if(fi(this.message,e),this.check){const n=si(e,t);if(n)throw n}let n;n="message"==e.fieldKind?Ii(e,t):Xs(t)||Es(t)?t[vs]:Vi(e,t),Zs(this.message,e,n)}getUnknown(){return this.message.$unknown}setUnknown(e){this.message.$unknown=e}}function fi(e,t){if(t.parent.typeName!==e.$typeName)throw new Ms(t,`cannot use ${t.toString()} with message ${e.$typeName}`,"ForeignFieldError")}class yi{field(){return this._field}get size(){return this._arr.length}constructor(e,t,n){this._field=e,this._arr=this[vs]=t,this.check=n}get(e){const t=this._arr[e];return void 0===t?void 0:Gi(this._field,t,this.check)}set(e,t){if(e<0||e>=this._arr.length)throw new Ms(this._field,`list item #${e+1}: out of range`);if(this.check){const n=ii(this._field,e,t);if(n)throw n}this._arr[e]=vi(this._field,t)}add(e){if(this.check){const t=ii(this._field,this._arr.length,e);if(t)throw t}this._arr.push(vi(this._field,e))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(const e of this._arr)yield Gi(this._field,e,this.check)}*entries(){for(let e=0;e<this._arr.length;e++)yield[e,Gi(this._field,this._arr[e],this.check)]}}class bi{constructor(e,t,n=!0){this.obj=this[vs]=null!=t?t:{},this.check=n,this._field=e}field(){return this._field}set(e,t){if(this.check){const n=function(e,t,n){const r=ai(t,e.mapKey);if(!0!==r)return new Ms(e,`invalid map key: ${ci({scalar:e.mapKey},t,r)}`);const s=oi(e,n);return!0!==s?new Ms(e,`map entry ${li(t)}: ${ci(e,n,s)}`):void 0}(this._field,e,t);if(n)throw n}return this.obj[Ci(e)]=function(e,t){if("message"==e.mapKind)return Ii(e,t);return Vi(e,t)}(this._field,t),this}delete(e){const t=Ci(e),n=Object.prototype.hasOwnProperty.call(this.obj,t);return n&&delete this.obj[t],n}clear(){for(const e of Object.keys(this.obj))delete this.obj[e]}get(e){let t=this.obj[Ci(e)];return void 0!==t&&(t=Ai(this._field,t,this.check)),t}has(e){return Object.prototype.hasOwnProperty.call(this.obj,Ci(e))}*keys(){for(const e of Object.keys(this.obj))yield Si(e,this._field.mapKey)}*entries(){for(const e of Object.entries(this.obj))yield[Si(e[0],this._field.mapKey),Ai(this._field,e[1],this.check)]}[Symbol.iterator](){return this.entries()}get size(){return Object.keys(this.obj).length}*values(){for(const e of Object.values(this.obj))yield Ai(this._field,e,this.check)}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}}function Ii(e,t){return Bs(t)?Rs(t.message.$typeName)&&!e.oneof&&"message"==e.fieldKind?t.message.value:"google.protobuf.Struct"==t.desc.typeName&&"google.protobuf.Value"!=e.parent.typeName?Xi(t.message):t.message:t}function wi(e,t,n){return void 0!==t&&(xs(e.message)&&!e.oneof&&"message"==e.fieldKind?t={$typeName:e.message.typeName,value:Zi(e.message.fields[0],t)}:"google.protobuf.Struct"==e.message.typeName&&"google.protobuf.Value"!=e.parent.typeName&&Vs(t)&&(t=Ei(t))),new pi(e.message,t,n)}function vi(e,t){return"message"==e.listKind?Ii(e,t):Vi(e,t)}function Gi(e,t,n){return"message"==e.listKind?wi(e,t,n):Zi(e,t)}function Ai(e,t,n){return"message"==e.mapKind?wi(e,t,n):t}function Ci(e){return"string"==typeof e||"number"==typeof e?e:String(e)}function Si(e,t){switch(t){case rs.STRING:return e;case rs.INT32:case rs.FIXED32:case rs.UINT32:case rs.SFIXED32:case rs.SINT32:{const t=Number.parseInt(e);if(Number.isFinite(t))return t;break}case rs.BOOL:switch(e){case"true":return!0;case"false":return!1}break;case rs.UINT64:case rs.FIXED64:try{return fs.uParse(e)}catch(n){}break;default:try{return fs.parse(e)}catch(r){}}return e}function Zi(e,t){switch(e.scalar){case rs.INT64:case rs.SFIXED64:case rs.SINT64:"longAsString"in e&&e.longAsString&&"string"==typeof t&&(t=fs.parse(t));break;case rs.FIXED64:case rs.UINT64:"longAsString"in e&&e.longAsString&&"string"==typeof t&&(t=fs.uParse(t))}return t}function Vi(e,t){switch(e.scalar){case rs.INT64:case rs.SFIXED64:case rs.SINT64:"longAsString"in e&&e.longAsString?t=String(t):"string"!=typeof t&&"number"!=typeof t||(t=fs.parse(t));break;case rs.FIXED64:case rs.UINT64:"longAsString"in e&&e.longAsString?t=String(t):"string"!=typeof t&&"number"!=typeof t||(t=fs.uParse(t))}return t}function Ei(e){const t={$typeName:"google.protobuf.Struct",fields:{}};if(Vs(e))for(const[n,r]of Object.entries(e))t.fields[n]=xi(r);return t}function Xi(e){const t={};for(const[n,r]of Object.entries(e.fields))t[n]=Bi(r);return t}function Bi(e){switch(e.kind.case){case"structValue":return Xi(e.kind.value);case"listValue":return e.kind.value.values.map(Bi);case"nullValue":case void 0:return null;default:return e.kind.value}}function xi(e){const t={$typeName:"google.protobuf.Value",kind:{case:void 0}};switch(typeof e){case"number":t.kind={case:"numberValue",value:e};break;case"string":t.kind={case:"stringValue",value:e};break;case"boolean":t.kind={case:"boolValue",value:e};break;case"object":if(null===e){const e=0;t.kind={case:"nullValue",value:e}}else if(Array.isArray(e)){const n={$typeName:"google.protobuf.ListValue",values:[]};if(Array.isArray(e))for(const t of e)n.values.push(xi(t));t.kind={case:"listValue",value:n}}else t.kind={case:"structValue",value:Ei(e)}}return t}function Ri(e){const t=function(){if(!_i){_i=[];const e=ki("std");for(let t=0;t<e.length;t++)_i[e[t].charCodeAt(0)]=t;_i["-".charCodeAt(0)]=e.indexOf("+"),_i["_".charCodeAt(0)]=e.indexOf("/")}return _i}();let n=3*e.length/4;"="==e[e.length-2]?n-=2:"="==e[e.length-1]&&(n-=1);let r,s=new Uint8Array(n),i=0,o=0,a=0;for(let c=0;c<e.length;c++){if(r=t[e.charCodeAt(c)],void 0===r)switch(e[c]){case"=":o=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string")}switch(o){case 0:a=r,o=1;break;case 1:s[i++]=a<<2|(48&r)>>4,a=r,o=2;break;case 2:s[i++]=(15&a)<<4|(60&r)>>2,a=r,o=3;break;case 3:s[i++]=(3&a)<<6|r,o=0}}if(1==o)throw Error("invalid base64 string");return s.subarray(0,i)}function Wi(e,t="std"){const n=ki(t),r="std"==t;let s,i="",o=0,a=0;for(let c=0;c<e.length;c++)switch(s=e[c],o){case 0:i+=n[s>>2],a=(3&s)<<4,o=1;break;case 1:i+=n[a|s>>4],a=(15&s)<<2,o=2;break;case 2:i+=n[a|s>>6],i+=n[63&s],o=0}return o&&(i+=n[a],r&&(i+="=",1==o&&(i+="="))),i}let Ni,Ji,_i;function ki(e){return Ni||(Ni="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ji=Ni.slice(0,-2).concat("-","_")),"url"==e?Ji:Ni}function Fi(e){let t=!1;const n=[];for(let r=0;r<e.length;r++){let s=e.charAt(r);switch(s){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(s),t=!1;break;default:t&&(t=!1,s=s.toUpperCase()),n.push(s)}}return n.join("")}function Yi(e){return e.replace(/[A-Z]/g,e=>"_"+e.toLowerCase())}const Li=/* @__PURE__ */new Set(["constructor","toString","toJSON","valueOf"]);function Oi(e){return Li.has(e)?e+"$":e}function Ti(e){for(const t of e.field)Cs(t,"jsonName")||(t.jsonName=Fi(t.name));e.nestedType.forEach(Ti)}function Hi(e,t){switch(e){case rs.STRING:return t;case rs.BYTES:{const n=function(e){const t=[],n={tail:e,c:"",next(){return 0!=this.tail.length&&(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(e){if(this.tail.length>=e){const t=this.tail.substring(0,e);return this.tail=this.tail.substring(e),t}return!1}};for(;n.next();)if("\\"===n.c){if(n.next())switch(n.c){case"\\":t.push(n.c.charCodeAt(0));break;case"b":t.push(8);break;case"f":t.push(12);break;case"n":t.push(10);break;case"r":t.push(13);break;case"t":t.push(9);break;case"v":t.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{const e=n.c,r=n.take(2);if(!1===r)return!1;const s=parseInt(e+r,8);if(Number.isNaN(s))return!1;t.push(s);break}case"x":{const e=n.c,r=n.take(2);if(!1===r)return!1;const s=parseInt(e+r,16);if(Number.isNaN(s))return!1;t.push(s);break}case"u":{const e=n.c,r=n.take(4);if(!1===r)return!1;const s=parseInt(e+r,16);if(Number.isNaN(s))return!1;const i=new Uint8Array(4);new DataView(i.buffer).setInt32(0,s,!0),t.push(i[0],i[1],i[2],i[3]);break}case"U":{const e=n.c,r=n.take(8);if(!1===r)return!1;const s=fs.uEnc(e+r),i=new Uint8Array(8),o=new DataView(i.buffer);o.setInt32(0,s.lo,!0),o.setInt32(4,s.hi,!0),t.push(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7]);break}}}else t.push(n.c.charCodeAt(0));return new Uint8Array(t)}(t);if(!1===n)throw new Error(`cannot parse ${rs[e]} default value: ${t}`);return n}case rs.INT64:case rs.SFIXED64:case rs.SINT64:return fs.parse(t);case rs.UINT64:case rs.FIXED64:return fs.uParse(t);case rs.DOUBLE:case rs.FLOAT:switch(t){case"inf":return Number.POSITIVE_INFINITY;case"-inf":return Number.NEGATIVE_INFINITY;case"nan":return Number.NaN;default:return parseFloat(t)}case rs.BOOL:return"true"===t;case rs.INT32:case rs.UINT32:case rs.SINT32:case rs.FIXED32:case rs.SFIXED32:return parseInt(t,10)}}function*Mi(e){switch(e.kind){case"file":for(const t of e.messages)yield t,yield*Mi(t);yield*e.enums,yield*e.services,yield*e.extensions;break;case"message":for(const t of e.nestedMessages)yield t,yield*Mi(t);yield*e.nestedEnums,yield*e.nestedExtensions}}function Ki(...e){const t=function(){const e=/* @__PURE__ */new Map,t=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;return{kind:"registry",types:e,extendees:t,[Symbol.iterator]:()=>e.values(),get files(){return n.values()},addFile(e,t,r){if(n.set(e.proto.name,e),!t)for(const n of Mi(e))this.add(n);if(r)for(const n of e.dependencies)this.addFile(n,t,r)},add(n){if("extension"==n.kind){let e=t.get(n.extendee.typeName);e||t.set(n.extendee.typeName,e=/* @__PURE__ */new Map),e.set(n.number,n)}e.set(n.typeName,n)},get:t=>e.get(t),getFile:e=>n.get(e),getMessage(t){const n=e.get(t);return"message"==(null==n?void 0:n.kind)?n:void 0},getEnum(t){const n=e.get(t);return"enum"==(null==n?void 0:n.kind)?n:void 0},getExtension(t){const n=e.get(t);return"extension"==(null==n?void 0:n.kind)?n:void 0},getExtensionFor(e,n){var r;return null===(r=t.get(e.typeName))||void 0===r?void 0:r.get(n)},getService(t){const n=e.get(t);return"service"==(null==n?void 0:n.kind)?n:void 0}}}();if(!e.length)return t;if("$typeName"in e[0]&&"google.protobuf.FileDescriptorSet"==e[0].$typeName){for(const n of e[0].file)uo(n,t);return t}if("$typeName"in e[0]){let n=function(e){const r=[];for(const n of e.dependency){if(null!=t.getFile(n))continue;if(i.has(n))continue;const o=s(n);if(!o)throw new Error(`Unable to resolve ${n}, imported by ${e.name}`);"kind"in o?t.addFile(o,!1,!0):(i.add(o.name),r.push(o))}return r.concat(...r.map(n))};const r=e[0],s=e[1],i=/* @__PURE__ */new Set;for(const e of[r,...n(r)].reverse())uo(e,t)}else for(const n of e)for(const e of n.files)t.addFile(e);return t}const zi=998,Di=999,Ui=9,Pi=10,ji=11,Qi=12,$i=14,qi=3,eo=2,to=1,no=0,ro=1,so=2,io=3,oo=1,ao=2,co=1,lo={998:{fieldPresence:1,enumType:2,repeatedFieldEncoding:2,utf8Validation:3,messageEncoding:1,jsonFormat:2,enforceNamingStyle:2,defaultSymbolVisibility:1},999:{fieldPresence:2,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1e3:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:2,defaultSymbolVisibility:1},1001:{fieldPresence:1,enumType:1,repeatedFieldEncoding:1,utf8Validation:2,messageEncoding:1,jsonFormat:1,enforceNamingStyle:1,defaultSymbolVisibility:2}};function uo(e,t){var n,r;const s={kind:"file",proto:e,deprecated:null!==(r=null===(n=e.options)||void 0===n?void 0:n.deprecated)&&void 0!==r&&r,edition:Io(e),name:e.name.replace(/\.proto$/,""),dependencies:wo(e,t),enums:[],messages:[],extensions:[],services:[],toString:()=>`file ${e.name}`},i=/* @__PURE__ */new Map,o={get:e=>i.get(e),add(e){var t;Vo(!0===(null===(t=e.proto.options)||void 0===t?void 0:t.mapEntry)),i.set(e.typeName,e)}};for(const a of e.enumType)mo(a,s,void 0,t);for(const a of e.messageType)po(a,s,void 0,t,o);for(const a of e.service)fo(a,s,t);ho(s,t);for(const a of i.values())go(a,t,o);for(const a of s.messages)go(a,t,o),ho(a,t);t.addFile(s,!0)}function ho(e,t){switch(e.kind){case"file":for(const n of e.proto.extension){const r=bo(n,e,t);e.extensions.push(r),t.add(r)}break;case"message":for(const n of e.proto.extension){const r=bo(n,e,t);e.nestedExtensions.push(r),t.add(r)}for(const n of e.nestedMessages)ho(n,t)}}function go(e,t,n){const r=e.proto.oneofDecl.map(t=>function(e,t){return{kind:"oneof",proto:e,deprecated:!1,parent:t,fields:[],name:e.name,localName:Oi(Fi(e.name)),toString(){return`oneof ${t.typeName}.${this.name}`}}}(t,e)),s=/* @__PURE__ */new Set;for(const i of e.proto.field){const o=Ao(i,r),a=bo(i,e,t,o,n);e.fields.push(a),e.field[a.localName]=a,void 0===o?e.members.push(a):(o.fields.push(a),s.has(o)||(s.add(o),e.members.push(o)))}for(const i of r.filter(e=>s.has(e)))e.oneofs.push(i);for(const i of e.nestedMessages)go(i,t,n)}function mo(e,t,n,r){var s,i,o,a,c;const l=function(e,t){const n=(r=e,(r.substring(0,1)+r.substring(1).replace(/[A-Z]/g,e=>"_"+e)).toLowerCase()+"_");var r;for(const s of t){if(!s.name.toLowerCase().startsWith(n))return;const e=s.name.substring(n.length);if(0==e.length)return;if(/^\d/.test(e))return}return n}(e.name,e.value),u={kind:"enum",proto:e,deprecated:null!==(i=null===(s=e.options)||void 0===s?void 0:s.deprecated)&&void 0!==i&&i,file:t,parent:n,open:!0,name:e.name,typeName:vo(e,n,t),value:{},values:[],sharedPrefix:l,toString(){return`enum ${this.typeName}`}};u.open=function(e){var t;return co==Zo("enumType",{proto:e.proto,parent:null!==(t=e.parent)&&void 0!==t?t:e.file})}(u),r.add(u);for(const d of e.value){const e=d.name;u.values.push(u.value[d.number]={kind:"enum_value",proto:d,deprecated:null!==(a=null===(o=d.options)||void 0===o?void 0:o.deprecated)&&void 0!==a&&a,parent:u,name:e,localName:Oi(null==l?e:e.substring(l.length)),number:d.number,toString:()=>`enum value ${u.typeName}.${e}`})}(null!==(c=null==n?void 0:n.nestedEnums)&&void 0!==c?c:t.enums).push(u)}function po(e,t,n,r,s){var i,o,a,c;const l={kind:"message",proto:e,deprecated:null!==(o=null===(i=e.options)||void 0===i?void 0:i.deprecated)&&void 0!==o&&o,file:t,parent:n,name:e.name,typeName:vo(e,n,t),fields:[],field:{},oneofs:[],members:[],nestedEnums:[],nestedMessages:[],nestedExtensions:[],toString(){return`message ${this.typeName}`}};!0===(null===(a=e.options)||void 0===a?void 0:a.mapEntry)?s.add(l):((null!==(c=null==n?void 0:n.nestedMessages)&&void 0!==c?c:t.messages).push(l),r.add(l));for(const u of e.enumType)mo(u,t,l,r);for(const u of e.nestedType)po(u,t,l,r,s)}function fo(e,t,n){var r,s;const i={kind:"service",proto:e,deprecated:null!==(s=null===(r=e.options)||void 0===r?void 0:r.deprecated)&&void 0!==s&&s,file:t,name:e.name,typeName:vo(e,void 0,t),methods:[],method:{},toString(){return`service ${this.typeName}`}};t.services.push(i),n.add(i);for(const o of e.method){const e=yo(o,i,n);i.methods.push(e),i.method[e.localName]=e}}function yo(e,t,n){var r,s,i,o;let a;a=e.clientStreaming&&e.serverStreaming?"bidi_streaming":e.clientStreaming?"client_streaming":e.serverStreaming?"server_streaming":"unary";const c=n.getMessage(Go(e.inputType)),l=n.getMessage(Go(e.outputType));Vo(c,`invalid MethodDescriptorProto: input_type ${e.inputType} not found`),Vo(l,`invalid MethodDescriptorProto: output_type ${e.inputType} not found`);const u=e.name;return{kind:"rpc",proto:e,deprecated:null!==(s=null===(r=e.options)||void 0===r?void 0:r.deprecated)&&void 0!==s&&s,parent:t,name:u,localName:Oi(u.length?Oi(u[0].toLowerCase()+u.substring(1)):u),methodKind:a,input:c,output:l,idempotency:null!==(o=null===(i=e.options)||void 0===i?void 0:i.idempotencyLevel)&&void 0!==o?o:no,toString:()=>`rpc ${t.typeName}.${u}`}}function bo(e,t,n,r,s){var i,o,a;const c=void 0===s,l={kind:"field",proto:e,deprecated:null!==(o=null===(i=e.options)||void 0===i?void 0:i.deprecated)&&void 0!==o&&o,name:e.name,number:e.number,scalar:void 0,message:void 0,enum:void 0,presence:Co(e,r,c,t),listKind:void 0,mapKind:void 0,mapKey:void 0,delimitedEncoding:void 0,packed:void 0,longAsString:!1,getDefaultValue:void 0};if(c){const r="file"==t.kind?t:t.file,s="file"==t.kind?void 0:t,i=vo(e,s,r);l.kind="extension",l.file=r,l.parent=s,l.oneof=void 0,l.typeName=i,l.jsonName=`[${i}]`,l.toString=()=>`extension ${i}`;const o=n.getMessage(Go(e.extendee));Vo(o,`invalid FieldDescriptorProto: extendee ${e.extendee} not found`),l.extendee=o}else{const n=t;Vo("message"==n.kind),l.parent=n,l.oneof=r,l.localName=r?Fi(e.name):Oi(Fi(e.name)),l.jsonName=e.jsonName,l.toString=()=>`field ${n.typeName}.${e.name}`}const u=e.label,d=e.type,h=null===(a=e.options)||void 0===a?void 0:a.jstype;if(u===qi){const r=d==ji?null==s?void 0:s.get(Go(e.typeName)):void 0;if(r){l.fieldKind="map";const{key:e,value:t}=function(e){const t=e.fields.find(e=>1===e.number),n=e.fields.find(e=>2===e.number);return Vo(t&&"scalar"==t.fieldKind&&t.scalar!=rs.BYTES&&t.scalar!=rs.FLOAT&&t.scalar!=rs.DOUBLE&&n&&"list"!=n.fieldKind&&"map"!=n.fieldKind),{key:t,value:n}}(r);return l.mapKey=e.scalar,l.mapKind=t.fieldKind,l.message=t.message,l.delimitedEncoding=!1,l.enum=t.enum,l.scalar=t.scalar,l}switch(l.fieldKind="list",d){case ji:case Pi:l.listKind="message",l.message=n.getMessage(Go(e.typeName)),Vo(l.message),l.delimitedEncoding=So(e,t);break;case $i:l.listKind="enum",l.enum=n.getEnum(Go(e.typeName)),Vo(l.enum);break;default:l.listKind="scalar",l.scalar=d,l.longAsString=h==to}return l.packed=function(e,t){if(e.label!=qi)return!1;switch(e.type){case Ui:case Qi:case Pi:case ji:return!1}const n=e.options;if(n&&Cs(n,"packed"))return n.packed;return oo==Zo("repeatedFieldEncoding",{proto:e,parent:t})}(e,t),l}switch(d){case ji:case Pi:l.fieldKind="message",l.message=n.getMessage(Go(e.typeName)),Vo(l.message,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),l.delimitedEncoding=So(e,t),l.getDefaultValue=()=>{};break;case $i:{const t=n.getEnum(Go(e.typeName));Vo(void 0!==t,`invalid FieldDescriptorProto: type_name ${e.typeName} not found`),l.fieldKind="enum",l.enum=n.getEnum(Go(e.typeName)),l.getDefaultValue=()=>Cs(e,"defaultValue")?function(e,t){const n=e.values.find(e=>e.name===t);if(!n)throw new Error(`cannot parse ${e} default value: ${t}`);return n.number}(t,e.defaultValue):void 0;break}default:l.fieldKind="scalar",l.scalar=d,l.longAsString=h==to,l.getDefaultValue=()=>Cs(e,"defaultValue")?Hi(d,e.defaultValue):void 0}return l}function Io(e){switch(e.syntax){case"":case"proto2":return zi;case"proto3":return Di;case"editions":if(e.edition in lo)return e.edition;throw new Error(`${e.name}: unsupported edition`);default:throw new Error(`${e.name}: unsupported syntax "${e.syntax}"`)}}function wo(e,t){return e.dependency.map(n=>{const r=t.getFile(n);if(!r)throw new Error(`Cannot find ${n}, imported by ${e.name}`);return r})}function vo(e,t,n){let r;return r=t?`${t.typeName}.${e.name}`:n.proto.package.length>0?`${n.proto.package}.${e.name}`:`${e.name}`,r}function Go(e){return e.startsWith(".")?e.substring(1):e}function Ao(e,t){if(!Cs(e,"oneofIndex"))return;if(e.proto3Optional)return;const n=t[e.oneofIndex];return Vo(n,`invalid FieldDescriptorProto: oneof #${e.oneofIndex} for field #${e.number} not found`),n}function Co(e,t,n,r){if(e.label==eo)return io;if(e.label==qi)return so;if(t||e.proto3Optional)return ro;if(n)return ro;const s=Zo("fieldPresence",{proto:e,parent:r});return s!=so||e.type!=ji&&e.type!=Pi?s:ro}function So(e,t){return e.type==Pi||ao==Zo("messageEncoding",{proto:e,parent:t})}function Zo(e,t){var n,r;const s=null===(n=t.proto.options)||void 0===n?void 0:n.features;if(s){const t=s[e];if(0!=t)return t}if("kind"in t){if("message"==t.kind)return Zo(e,null!==(r=t.parent)&&void 0!==r?r:t.file);const n=lo[t.edition];if(!n)throw new Error(`feature default for edition ${t.edition} not found`);return n[e]}return Zo(e,t.parent)}function Vo(e,t){if(!e)throw new Error(t)}function Eo(e){const t=function(e){const t=/* @__PURE__ */Object.create({syntax:"",edition:0});return Object.assign(t,Object.assign(Object.assign({$typeName:"google.protobuf.FileDescriptorProto",dependency:[],publicDependency:[],weakDependency:[],optionDependency:[],service:[],extension:[]},e),{messageType:e.messageType.map(Xo),enumType:e.enumType.map(Ro)}))}(e);t.messageType.forEach(Ti);return Ki(t,()=>{}).getFile(t.name)}function Xo(e){var t,n,r,s,i,o,a,c;const l=/* @__PURE__ */Object.create({visibility:0});return Object.assign(l,{$typeName:"google.protobuf.DescriptorProto",name:e.name,field:null!==(n=null===(t=e.field)||void 0===t?void 0:t.map(Bo))&&void 0!==n?n:[],extension:[],nestedType:null!==(s=null===(r=e.nestedType)||void 0===r?void 0:r.map(Xo))&&void 0!==s?s:[],enumType:null!==(o=null===(i=e.enumType)||void 0===i?void 0:i.map(Ro))&&void 0!==o?o:[],extensionRange:null!==(c=null===(a=e.extensionRange)||void 0===a?void 0:a.map(e=>Object.assign({$typeName:"google.protobuf.DescriptorProto.ExtensionRange"},e)))&&void 0!==c?c:[],oneofDecl:[],reservedRange:[],reservedName:[]})}function Bo(e){const t=/* @__PURE__ */Object.create({label:1,typeName:"",extendee:"",defaultValue:"",oneofIndex:0,jsonName:"",proto3Optional:!1});return Object.assign(t,Object.assign(Object.assign({$typeName:"google.protobuf.FieldDescriptorProto"},e),{options:e.options?xo(e.options):void 0}))}function xo(e){var t,n,r;const s=/* @__PURE__ */Object.create({ctype:0,packed:!1,jstype:0,lazy:!1,unverifiedLazy:!1,deprecated:!1,weak:!1,debugRedact:!1,retention:0});return Object.assign(s,Object.assign(Object.assign({$typeName:"google.protobuf.FieldOptions"},e),{targets:null!==(t=e.targets)&&void 0!==t?t:[],editionDefaults:null!==(r=null===(n=e.editionDefaults)||void 0===n?void 0:n.map(e=>Object.assign({$typeName:"google.protobuf.FieldOptions.EditionDefault"},e)))&&void 0!==r?r:[],uninterpretedOption:[]}))}function Ro(e){const t=/* @__PURE__ */Object.create({visibility:0});return Object.assign(t,{$typeName:"google.protobuf.EnumDescriptorProto",name:e.name,reservedName:[],reservedRange:[],value:e.value.map(e=>Object.assign({$typeName:"google.protobuf.EnumValueDescriptorProto"},e))})}function Wo(e,t,...n){return n.reduce((e,t)=>e.nestedMessages[t],e.messages[t])}const No=/* @__PURE__ */Eo({name:"google/protobuf/descriptor.proto",package:"google.protobuf",messageType:[{name:"FileDescriptorSet",field:[{name:"file",number:1,type:11,label:3,typeName:".google.protobuf.FileDescriptorProto"}],extensionRange:[{start:536e6,end:536000001}]},{name:"FileDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"package",number:2,type:9,label:1},{name:"dependency",number:3,type:9,label:3},{name:"public_dependency",number:10,type:5,label:3},{name:"weak_dependency",number:11,type:5,label:3},{name:"option_dependency",number:15,type:9,label:3},{name:"message_type",number:4,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:5,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"service",number:6,type:11,label:3,typeName:".google.protobuf.ServiceDescriptorProto"},{name:"extension",number:7,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FileOptions"},{name:"source_code_info",number:9,type:11,label:1,typeName:".google.protobuf.SourceCodeInfo"},{name:"syntax",number:12,type:9,label:1},{name:"edition",number:14,type:14,label:1,typeName:".google.protobuf.Edition"}]},{name:"DescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"field",number:2,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"extension",number:6,type:11,label:3,typeName:".google.protobuf.FieldDescriptorProto"},{name:"nested_type",number:3,type:11,label:3,typeName:".google.protobuf.DescriptorProto"},{name:"enum_type",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto"},{name:"extension_range",number:5,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ExtensionRange"},{name:"oneof_decl",number:8,type:11,label:3,typeName:".google.protobuf.OneofDescriptorProto"},{name:"options",number:7,type:11,label:1,typeName:".google.protobuf.MessageOptions"},{name:"reserved_range",number:9,type:11,label:3,typeName:".google.protobuf.DescriptorProto.ReservedRange"},{name:"reserved_name",number:10,type:9,label:3},{name:"visibility",number:11,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"ExtensionRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ExtensionRangeOptions"}]},{name:"ReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"ExtensionRangeOptions",field:[{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"},{name:"declaration",number:2,type:11,label:3,typeName:".google.protobuf.ExtensionRangeOptions.Declaration",options:{retention:2}},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"verification",number:3,type:14,label:1,typeName:".google.protobuf.ExtensionRangeOptions.VerificationState",defaultValue:"UNVERIFIED",options:{retention:2}}],nestedType:[{name:"Declaration",field:[{name:"number",number:1,type:5,label:1},{name:"full_name",number:2,type:9,label:1},{name:"type",number:3,type:9,label:1},{name:"reserved",number:5,type:8,label:1},{name:"repeated",number:6,type:8,label:1}]}],enumType:[{name:"VerificationState",value:[{name:"DECLARATION",number:0},{name:"UNVERIFIED",number:1}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:3,type:5,label:1},{name:"label",number:4,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Label"},{name:"type",number:5,type:14,label:1,typeName:".google.protobuf.FieldDescriptorProto.Type"},{name:"type_name",number:6,type:9,label:1},{name:"extendee",number:2,type:9,label:1},{name:"default_value",number:7,type:9,label:1},{name:"oneof_index",number:9,type:5,label:1},{name:"json_name",number:10,type:9,label:1},{name:"options",number:8,type:11,label:1,typeName:".google.protobuf.FieldOptions"},{name:"proto3_optional",number:17,type:8,label:1}],enumType:[{name:"Type",value:[{name:"TYPE_DOUBLE",number:1},{name:"TYPE_FLOAT",number:2},{name:"TYPE_INT64",number:3},{name:"TYPE_UINT64",number:4},{name:"TYPE_INT32",number:5},{name:"TYPE_FIXED64",number:6},{name:"TYPE_FIXED32",number:7},{name:"TYPE_BOOL",number:8},{name:"TYPE_STRING",number:9},{name:"TYPE_GROUP",number:10},{name:"TYPE_MESSAGE",number:11},{name:"TYPE_BYTES",number:12},{name:"TYPE_UINT32",number:13},{name:"TYPE_ENUM",number:14},{name:"TYPE_SFIXED32",number:15},{name:"TYPE_SFIXED64",number:16},{name:"TYPE_SINT32",number:17},{name:"TYPE_SINT64",number:18}]},{name:"Label",value:[{name:"LABEL_OPTIONAL",number:1},{name:"LABEL_REPEATED",number:3},{name:"LABEL_REQUIRED",number:2}]}]},{name:"OneofDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"options",number:2,type:11,label:1,typeName:".google.protobuf.OneofOptions"}]},{name:"EnumDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"value",number:2,type:11,label:3,typeName:".google.protobuf.EnumValueDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumOptions"},{name:"reserved_range",number:4,type:11,label:3,typeName:".google.protobuf.EnumDescriptorProto.EnumReservedRange"},{name:"reserved_name",number:5,type:9,label:3},{name:"visibility",number:6,type:14,label:1,typeName:".google.protobuf.SymbolVisibility"}],nestedType:[{name:"EnumReservedRange",field:[{name:"start",number:1,type:5,label:1},{name:"end",number:2,type:5,label:1}]}]},{name:"EnumValueDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"number",number:2,type:5,label:1},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.EnumValueOptions"}]},{name:"ServiceDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"method",number:2,type:11,label:3,typeName:".google.protobuf.MethodDescriptorProto"},{name:"options",number:3,type:11,label:1,typeName:".google.protobuf.ServiceOptions"}]},{name:"MethodDescriptorProto",field:[{name:"name",number:1,type:9,label:1},{name:"input_type",number:2,type:9,label:1},{name:"output_type",number:3,type:9,label:1},{name:"options",number:4,type:11,label:1,typeName:".google.protobuf.MethodOptions"},{name:"client_streaming",number:5,type:8,label:1,defaultValue:"false"},{name:"server_streaming",number:6,type:8,label:1,defaultValue:"false"}]},{name:"FileOptions",field:[{name:"java_package",number:1,type:9,label:1},{name:"java_outer_classname",number:8,type:9,label:1},{name:"java_multiple_files",number:10,type:8,label:1,defaultValue:"false"},{name:"java_generate_equals_and_hash",number:20,type:8,label:1,options:{deprecated:!0}},{name:"java_string_check_utf8",number:27,type:8,label:1,defaultValue:"false"},{name:"optimize_for",number:9,type:14,label:1,typeName:".google.protobuf.FileOptions.OptimizeMode",defaultValue:"SPEED"},{name:"go_package",number:11,type:9,label:1},{name:"cc_generic_services",number:16,type:8,label:1,defaultValue:"false"},{name:"java_generic_services",number:17,type:8,label:1,defaultValue:"false"},{name:"py_generic_services",number:18,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:23,type:8,label:1,defaultValue:"false"},{name:"cc_enable_arenas",number:31,type:8,label:1,defaultValue:"true"},{name:"objc_class_prefix",number:36,type:9,label:1},{name:"csharp_namespace",number:37,type:9,label:1},{name:"swift_prefix",number:39,type:9,label:1},{name:"php_class_prefix",number:40,type:9,label:1},{name:"php_namespace",number:41,type:9,label:1},{name:"php_metadata_namespace",number:44,type:9,label:1},{name:"ruby_package",number:45,type:9,label:1},{name:"features",number:50,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"OptimizeMode",value:[{name:"SPEED",number:1},{name:"CODE_SIZE",number:2},{name:"LITE_RUNTIME",number:3}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"MessageOptions",field:[{name:"message_set_wire_format",number:1,type:8,label:1,defaultValue:"false"},{name:"no_standard_descriptor_accessor",number:2,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"map_entry",number:7,type:8,label:1},{name:"deprecated_legacy_json_field_conflicts",number:11,type:8,label:1,options:{deprecated:!0}},{name:"features",number:12,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"FieldOptions",field:[{name:"ctype",number:1,type:14,label:1,typeName:".google.protobuf.FieldOptions.CType",defaultValue:"STRING"},{name:"packed",number:2,type:8,label:1},{name:"jstype",number:6,type:14,label:1,typeName:".google.protobuf.FieldOptions.JSType",defaultValue:"JS_NORMAL"},{name:"lazy",number:5,type:8,label:1,defaultValue:"false"},{name:"unverified_lazy",number:15,type:8,label:1,defaultValue:"false"},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"weak",number:10,type:8,label:1,defaultValue:"false",options:{deprecated:!0}},{name:"debug_redact",number:16,type:8,label:1,defaultValue:"false"},{name:"retention",number:17,type:14,label:1,typeName:".google.protobuf.FieldOptions.OptionRetention"},{name:"targets",number:19,type:14,label:3,typeName:".google.protobuf.FieldOptions.OptionTargetType"},{name:"edition_defaults",number:20,type:11,label:3,typeName:".google.protobuf.FieldOptions.EditionDefault"},{name:"features",number:21,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"feature_support",number:22,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],nestedType:[{name:"EditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"value",number:2,type:9,label:1}]},{name:"FeatureSupport",field:[{name:"edition_introduced",number:1,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"edition_deprecated",number:2,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"deprecation_warning",number:3,type:9,label:1},{name:"edition_removed",number:4,type:14,label:1,typeName:".google.protobuf.Edition"}]}],enumType:[{name:"CType",value:[{name:"STRING",number:0},{name:"CORD",number:1},{name:"STRING_PIECE",number:2}]},{name:"JSType",value:[{name:"JS_NORMAL",number:0},{name:"JS_STRING",number:1},{name:"JS_NUMBER",number:2}]},{name:"OptionRetention",value:[{name:"RETENTION_UNKNOWN",number:0},{name:"RETENTION_RUNTIME",number:1},{name:"RETENTION_SOURCE",number:2}]},{name:"OptionTargetType",value:[{name:"TARGET_TYPE_UNKNOWN",number:0},{name:"TARGET_TYPE_FILE",number:1},{name:"TARGET_TYPE_EXTENSION_RANGE",number:2},{name:"TARGET_TYPE_MESSAGE",number:3},{name:"TARGET_TYPE_FIELD",number:4},{name:"TARGET_TYPE_ONEOF",number:5},{name:"TARGET_TYPE_ENUM",number:6},{name:"TARGET_TYPE_ENUM_ENTRY",number:7},{name:"TARGET_TYPE_SERVICE",number:8},{name:"TARGET_TYPE_METHOD",number:9}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"OneofOptions",field:[{name:"features",number:1,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"EnumOptions",field:[{name:"allow_alias",number:2,type:8,label:1},{name:"deprecated",number:3,type:8,label:1,defaultValue:"false"},{name:"deprecated_legacy_json_field_conflicts",number:6,type:8,label:1,options:{deprecated:!0}},{name:"features",number:7,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"EnumValueOptions",field:[{name:"deprecated",number:1,type:8,label:1,defaultValue:"false"},{name:"features",number:2,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"debug_redact",number:3,type:8,label:1,defaultValue:"false"},{name:"feature_support",number:4,type:11,label:1,typeName:".google.protobuf.FieldOptions.FeatureSupport"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"ServiceOptions",field:[{name:"features",number:34,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],extensionRange:[{start:1e3,end:536870912}]},{name:"MethodOptions",field:[{name:"deprecated",number:33,type:8,label:1,defaultValue:"false"},{name:"idempotency_level",number:34,type:14,label:1,typeName:".google.protobuf.MethodOptions.IdempotencyLevel",defaultValue:"IDEMPOTENCY_UNKNOWN"},{name:"features",number:35,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"uninterpreted_option",number:999,type:11,label:3,typeName:".google.protobuf.UninterpretedOption"}],enumType:[{name:"IdempotencyLevel",value:[{name:"IDEMPOTENCY_UNKNOWN",number:0},{name:"NO_SIDE_EFFECTS",number:1},{name:"IDEMPOTENT",number:2}]}],extensionRange:[{start:1e3,end:536870912}]},{name:"UninterpretedOption",field:[{name:"name",number:2,type:11,label:3,typeName:".google.protobuf.UninterpretedOption.NamePart"},{name:"identifier_value",number:3,type:9,label:1},{name:"positive_int_value",number:4,type:4,label:1},{name:"negative_int_value",number:5,type:3,label:1},{name:"double_value",number:6,type:1,label:1},{name:"string_value",number:7,type:12,label:1},{name:"aggregate_value",number:8,type:9,label:1}],nestedType:[{name:"NamePart",field:[{name:"name_part",number:1,type:9,label:2},{name:"is_extension",number:2,type:8,label:2}]}]},{name:"FeatureSet",field:[{name:"field_presence",number:1,type:14,label:1,typeName:".google.protobuf.FeatureSet.FieldPresence",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPLICIT",edition:900},{value:"IMPLICIT",edition:999},{value:"EXPLICIT",edition:1e3}]}},{name:"enum_type",number:2,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnumType",options:{retention:1,targets:[6,1],editionDefaults:[{value:"CLOSED",edition:900},{value:"OPEN",edition:999}]}},{name:"repeated_field_encoding",number:3,type:14,label:1,typeName:".google.protobuf.FeatureSet.RepeatedFieldEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"EXPANDED",edition:900},{value:"PACKED",edition:999}]}},{name:"utf8_validation",number:4,type:14,label:1,typeName:".google.protobuf.FeatureSet.Utf8Validation",options:{retention:1,targets:[4,1],editionDefaults:[{value:"NONE",edition:900},{value:"VERIFY",edition:999}]}},{name:"message_encoding",number:5,type:14,label:1,typeName:".google.protobuf.FeatureSet.MessageEncoding",options:{retention:1,targets:[4,1],editionDefaults:[{value:"LENGTH_PREFIXED",edition:900}]}},{name:"json_format",number:6,type:14,label:1,typeName:".google.protobuf.FeatureSet.JsonFormat",options:{retention:1,targets:[3,6,1],editionDefaults:[{value:"LEGACY_BEST_EFFORT",edition:900},{value:"ALLOW",edition:999}]}},{name:"enforce_naming_style",number:7,type:14,label:1,typeName:".google.protobuf.FeatureSet.EnforceNamingStyle",options:{retention:2,targets:[1,2,3,4,5,6,7,8,9],editionDefaults:[{value:"STYLE_LEGACY",edition:900},{value:"STYLE2024",edition:1001}]}},{name:"default_symbol_visibility",number:8,type:14,label:1,typeName:".google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility",options:{retention:2,targets:[1],editionDefaults:[{value:"EXPORT_ALL",edition:900},{value:"EXPORT_TOP_LEVEL",edition:1001}]}}],nestedType:[{name:"VisibilityFeature",enumType:[{name:"DefaultSymbolVisibility",value:[{name:"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN",number:0},{name:"EXPORT_ALL",number:1},{name:"EXPORT_TOP_LEVEL",number:2},{name:"LOCAL_ALL",number:3},{name:"STRICT",number:4}]}]}],enumType:[{name:"FieldPresence",value:[{name:"FIELD_PRESENCE_UNKNOWN",number:0},{name:"EXPLICIT",number:1},{name:"IMPLICIT",number:2},{name:"LEGACY_REQUIRED",number:3}]},{name:"EnumType",value:[{name:"ENUM_TYPE_UNKNOWN",number:0},{name:"OPEN",number:1},{name:"CLOSED",number:2}]},{name:"RepeatedFieldEncoding",value:[{name:"REPEATED_FIELD_ENCODING_UNKNOWN",number:0},{name:"PACKED",number:1},{name:"EXPANDED",number:2}]},{name:"Utf8Validation",value:[{name:"UTF8_VALIDATION_UNKNOWN",number:0},{name:"VERIFY",number:2},{name:"NONE",number:3}]},{name:"MessageEncoding",value:[{name:"MESSAGE_ENCODING_UNKNOWN",number:0},{name:"LENGTH_PREFIXED",number:1},{name:"DELIMITED",number:2}]},{name:"JsonFormat",value:[{name:"JSON_FORMAT_UNKNOWN",number:0},{name:"ALLOW",number:1},{name:"LEGACY_BEST_EFFORT",number:2}]},{name:"EnforceNamingStyle",value:[{name:"ENFORCE_NAMING_STYLE_UNKNOWN",number:0},{name:"STYLE2024",number:1},{name:"STYLE_LEGACY",number:2}]}],extensionRange:[{start:1e3,end:9995},{start:9995,end:1e4},{start:1e4,end:10001}]},{name:"FeatureSetDefaults",field:[{name:"defaults",number:1,type:11,label:3,typeName:".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"},{name:"minimum_edition",number:4,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"maximum_edition",number:5,type:14,label:1,typeName:".google.protobuf.Edition"}],nestedType:[{name:"FeatureSetEditionDefault",field:[{name:"edition",number:3,type:14,label:1,typeName:".google.protobuf.Edition"},{name:"overridable_features",number:4,type:11,label:1,typeName:".google.protobuf.FeatureSet"},{name:"fixed_features",number:5,type:11,label:1,typeName:".google.protobuf.FeatureSet"}]}]},{name:"SourceCodeInfo",field:[{name:"location",number:1,type:11,label:3,typeName:".google.protobuf.SourceCodeInfo.Location"}],nestedType:[{name:"Location",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"span",number:2,type:5,label:3,options:{packed:!0}},{name:"leading_comments",number:3,type:9,label:1},{name:"trailing_comments",number:4,type:9,label:1},{name:"leading_detached_comments",number:6,type:9,label:3}]}],extensionRange:[{start:536e6,end:536000001}]},{name:"GeneratedCodeInfo",field:[{name:"annotation",number:1,type:11,label:3,typeName:".google.protobuf.GeneratedCodeInfo.Annotation"}],nestedType:[{name:"Annotation",field:[{name:"path",number:1,type:5,label:3,options:{packed:!0}},{name:"source_file",number:2,type:9,label:1},{name:"begin",number:3,type:5,label:1},{name:"end",number:4,type:5,label:1},{name:"semantic",number:5,type:14,label:1,typeName:".google.protobuf.GeneratedCodeInfo.Annotation.Semantic"}],enumType:[{name:"Semantic",value:[{name:"NONE",number:0},{name:"SET",number:1},{name:"ALIAS",number:2}]}]}]}],enumType:[{name:"Edition",value:[{name:"EDITION_UNKNOWN",number:0},{name:"EDITION_LEGACY",number:900},{name:"EDITION_PROTO2",number:998},{name:"EDITION_PROTO3",number:999},{name:"EDITION_2023",number:1e3},{name:"EDITION_2024",number:1001},{name:"EDITION_UNSTABLE",number:9999},{name:"EDITION_1_TEST_ONLY",number:1},{name:"EDITION_2_TEST_ONLY",number:2},{name:"EDITION_99997_TEST_ONLY",number:99997},{name:"EDITION_99998_TEST_ONLY",number:99998},{name:"EDITION_99999_TEST_ONLY",number:99999},{name:"EDITION_MAX",number:2147483647}]},{name:"SymbolVisibility",value:[{name:"VISIBILITY_UNSET",number:0},{name:"VISIBILITY_LOCAL",number:1},{name:"VISIBILITY_EXPORT",number:2}]}]}),Jo=/* @__PURE__ */Wo(No,1);var _o,ko,Fo,Yo,Lo,Oo,To,Ho,Mo,Ko,zo,Do,Uo,Po,jo,Qo,$o,qo,ea,ta,na,ra,sa,ia,oa,aa,ca,la,ua,da,ha,ga,ma,pa,fa,ya,ba,Ia,wa,va;(ko=_o||(_o={}))[ko.DECLARATION=0]="DECLARATION",ko[ko.UNVERIFIED=1]="UNVERIFIED",(Yo=Fo||(Fo={}))[Yo.DOUBLE=1]="DOUBLE",Yo[Yo.FLOAT=2]="FLOAT",Yo[Yo.INT64=3]="INT64",Yo[Yo.UINT64=4]="UINT64",Yo[Yo.INT32=5]="INT32",Yo[Yo.FIXED64=6]="FIXED64",Yo[Yo.FIXED32=7]="FIXED32",Yo[Yo.BOOL=8]="BOOL",Yo[Yo.STRING=9]="STRING",Yo[Yo.GROUP=10]="GROUP",Yo[Yo.MESSAGE=11]="MESSAGE",Yo[Yo.BYTES=12]="BYTES",Yo[Yo.UINT32=13]="UINT32",Yo[Yo.ENUM=14]="ENUM",Yo[Yo.SFIXED32=15]="SFIXED32",Yo[Yo.SFIXED64=16]="SFIXED64",Yo[Yo.SINT32=17]="SINT32",Yo[Yo.SINT64=18]="SINT64",(Oo=Lo||(Lo={}))[Oo.OPTIONAL=1]="OPTIONAL",Oo[Oo.REPEATED=3]="REPEATED",Oo[Oo.REQUIRED=2]="REQUIRED",(Ho=To||(To={}))[Ho.SPEED=1]="SPEED",Ho[Ho.CODE_SIZE=2]="CODE_SIZE",Ho[Ho.LITE_RUNTIME=3]="LITE_RUNTIME",(Ko=Mo||(Mo={}))[Ko.STRING=0]="STRING",Ko[Ko.CORD=1]="CORD",Ko[Ko.STRING_PIECE=2]="STRING_PIECE",(Do=zo||(zo={}))[Do.JS_NORMAL=0]="JS_NORMAL",Do[Do.JS_STRING=1]="JS_STRING",Do[Do.JS_NUMBER=2]="JS_NUMBER",(Po=Uo||(Uo={}))[Po.RETENTION_UNKNOWN=0]="RETENTION_UNKNOWN",Po[Po.RETENTION_RUNTIME=1]="RETENTION_RUNTIME",Po[Po.RETENTION_SOURCE=2]="RETENTION_SOURCE",(Qo=jo||(jo={}))[Qo.TARGET_TYPE_UNKNOWN=0]="TARGET_TYPE_UNKNOWN",Qo[Qo.TARGET_TYPE_FILE=1]="TARGET_TYPE_FILE",Qo[Qo.TARGET_TYPE_EXTENSION_RANGE=2]="TARGET_TYPE_EXTENSION_RANGE",Qo[Qo.TARGET_TYPE_MESSAGE=3]="TARGET_TYPE_MESSAGE",Qo[Qo.TARGET_TYPE_FIELD=4]="TARGET_TYPE_FIELD",Qo[Qo.TARGET_TYPE_ONEOF=5]="TARGET_TYPE_ONEOF",Qo[Qo.TARGET_TYPE_ENUM=6]="TARGET_TYPE_ENUM",Qo[Qo.TARGET_TYPE_ENUM_ENTRY=7]="TARGET_TYPE_ENUM_ENTRY",Qo[Qo.TARGET_TYPE_SERVICE=8]="TARGET_TYPE_SERVICE",Qo[Qo.TARGET_TYPE_METHOD=9]="TARGET_TYPE_METHOD",(qo=$o||($o={}))[qo.IDEMPOTENCY_UNKNOWN=0]="IDEMPOTENCY_UNKNOWN",qo[qo.NO_SIDE_EFFECTS=1]="NO_SIDE_EFFECTS",qo[qo.IDEMPOTENT=2]="IDEMPOTENT",(ta=ea||(ea={}))[ta.DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0]="DEFAULT_SYMBOL_VISIBILITY_UNKNOWN",ta[ta.EXPORT_ALL=1]="EXPORT_ALL",ta[ta.EXPORT_TOP_LEVEL=2]="EXPORT_TOP_LEVEL",ta[ta.LOCAL_ALL=3]="LOCAL_ALL",ta[ta.STRICT=4]="STRICT",(ra=na||(na={}))[ra.FIELD_PRESENCE_UNKNOWN=0]="FIELD_PRESENCE_UNKNOWN",ra[ra.EXPLICIT=1]="EXPLICIT",ra[ra.IMPLICIT=2]="IMPLICIT",ra[ra.LEGACY_REQUIRED=3]="LEGACY_REQUIRED",(ia=sa||(sa={}))[ia.ENUM_TYPE_UNKNOWN=0]="ENUM_TYPE_UNKNOWN",ia[ia.OPEN=1]="OPEN",ia[ia.CLOSED=2]="CLOSED",(aa=oa||(oa={}))[aa.REPEATED_FIELD_ENCODING_UNKNOWN=0]="REPEATED_FIELD_ENCODING_UNKNOWN",aa[aa.PACKED=1]="PACKED",aa[aa.EXPANDED=2]="EXPANDED",(la=ca||(ca={}))[la.UTF8_VALIDATION_UNKNOWN=0]="UTF8_VALIDATION_UNKNOWN",la[la.VERIFY=2]="VERIFY",la[la.NONE=3]="NONE",(da=ua||(ua={}))[da.MESSAGE_ENCODING_UNKNOWN=0]="MESSAGE_ENCODING_UNKNOWN",da[da.LENGTH_PREFIXED=1]="LENGTH_PREFIXED",da[da.DELIMITED=2]="DELIMITED",(ga=ha||(ha={}))[ga.JSON_FORMAT_UNKNOWN=0]="JSON_FORMAT_UNKNOWN",ga[ga.ALLOW=1]="ALLOW",ga[ga.LEGACY_BEST_EFFORT=2]="LEGACY_BEST_EFFORT",(pa=ma||(ma={}))[pa.ENFORCE_NAMING_STYLE_UNKNOWN=0]="ENFORCE_NAMING_STYLE_UNKNOWN",pa[pa.STYLE2024=1]="STYLE2024",pa[pa.STYLE_LEGACY=2]="STYLE_LEGACY",(ya=fa||(fa={}))[ya.NONE=0]="NONE",ya[ya.SET=1]="SET",ya[ya.ALIAS=2]="ALIAS",(Ia=ba||(ba={}))[Ia.EDITION_UNKNOWN=0]="EDITION_UNKNOWN",Ia[Ia.EDITION_LEGACY=900]="EDITION_LEGACY",Ia[Ia.EDITION_PROTO2=998]="EDITION_PROTO2",Ia[Ia.EDITION_PROTO3=999]="EDITION_PROTO3",Ia[Ia.EDITION_2023=1e3]="EDITION_2023",Ia[Ia.EDITION_2024=1001]="EDITION_2024",Ia[Ia.EDITION_UNSTABLE=9999]="EDITION_UNSTABLE",Ia[Ia.EDITION_1_TEST_ONLY=1]="EDITION_1_TEST_ONLY",Ia[Ia.EDITION_2_TEST_ONLY=2]="EDITION_2_TEST_ONLY",Ia[Ia.EDITION_99997_TEST_ONLY=99997]="EDITION_99997_TEST_ONLY",Ia[Ia.EDITION_99998_TEST_ONLY=99998]="EDITION_99998_TEST_ONLY",Ia[Ia.EDITION_99999_TEST_ONLY=99999]="EDITION_99999_TEST_ONLY",Ia[Ia.EDITION_MAX=2147483647]="EDITION_MAX",(va=wa||(wa={}))[va.VISIBILITY_UNSET=0]="VISIBILITY_UNSET",va[va.VISIBILITY_LOCAL=1]="VISIBILITY_LOCAL",va[va.VISIBILITY_EXPORT=2]="VISIBILITY_EXPORT";const Ga={readUnknownFields:!0};function Aa(e,t,n){const r=gi(e,void 0,!1);return Ca(r,new ti(t),function(e){return e?Object.assign(Object.assign({},Ga),e):Ga}(n),!1,t.byteLength),r.message}function Ca(e,t,n,r,s){var i;const o=r?t.len:t.pos+s;let a,c;const l=null!==(i=e.getUnknown())&&void 0!==i?i:[];for(;t.pos<o&&([a,c]=t.tag(),!r||c!=Ds.EndGroup);){const r=e.findNumber(a);if(!r){const e=t.skip(c,a);n.readUnknownFields&&l.push({no:a,wireType:c,data:e});continue}Sa(e,t,r,c,n)}if(r&&(c!=Ds.EndGroup||a!==s))throw new Error("invalid end group tag");l.length>0&&e.setUnknown(l)}function Sa(e,t,n,r,s){var i;switch(n.fieldKind){case"scalar":e.set(n,Va(t,n.scalar));break;case"enum":const o=Va(t,rs.INT32);if(n.enum.open)e.set(n,o);else{if(n.enum.values.some(e=>e.number===o))e.set(n,o);else if(s.readUnknownFields){const t=[];ms(o,t);const s=null!==(i=e.getUnknown())&&void 0!==i?i:[];s.push({no:n.number,wireType:r,data:new Uint8Array(t)}),e.setUnknown(s)}}break;case"message":e.set(n,Za(t,s,n,e.get(n)));break;case"list":!function(e,t,n,r){var s;const i=n.field();if("message"===i.listKind)return void n.add(Za(e,r,i));const o=null!==(s=i.scalar)&&void 0!==s?s:rs.INT32,a=t==Ds.LengthDelimited&&o!=rs.STRING&&o!=rs.BYTES;if(!a)return void n.add(Va(e,o));const c=e.uint32()+e.pos;for(;e.pos<c;)n.add(Va(e,o))}(t,r,e.get(n),s);break;case"map":!function(e,t,n){const r=t.field();let s,i;const o=e.uint32(),a=e.pos+o;for(;e.pos<a;){const[t]=e.tag();switch(t){case 1:s=Va(e,r.mapKey);break;case 2:switch(r.mapKind){case"scalar":i=Va(e,r.scalar);break;case"enum":i=e.int32();break;case"message":i=Za(e,n,r)}}}void 0===s&&(s=ws(r.mapKey,!1));if(void 0===i)switch(r.mapKind){case"scalar":i=ws(r.scalar,!1);break;case"enum":i=r.enum.values[0].number;break;case"message":i=gi(r.message,void 0,!1)}t.set(s,i)}(t,e.get(n),s)}}function Za(e,t,n,r){const s=n.delimitedEncoding,i=null!=r?r:gi(n.message,void 0,!1);return Ca(i,e,t,s,s?n.number:e.uint32()),i}function Va(e,t){switch(t){case rs.STRING:return e.string();case rs.BOOL:return e.bool();case rs.DOUBLE:return e.double();case rs.FLOAT:return e.float();case rs.INT32:return e.int32();case rs.INT64:return e.int64();case rs.UINT64:return e.uint64();case rs.FIXED64:return e.fixed64();case rs.BYTES:return e.bytes();case rs.FIXED32:return e.fixed32();case rs.SFIXED32:return e.sfixed32();case rs.SFIXED64:return e.sfixed64();case rs.SINT64:return e.sint64();case rs.UINT32:return e.uint32();case rs.SINT32:return e.sint32()}}function Ea(e,t){var n;const r=Aa(Jo,Ri(e));r.messageType.forEach(Ti),r.dependency=null!==(n=null==t?void 0:t.map(e=>e.proto.name))&&void 0!==n?n:[];return Ki(r,e=>null==t?void 0:t.find(t=>t.proto.name===e)).getFile(r.name)}const Xa=/* @__PURE__ */Ea("Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJvdG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MYAiABKAVChQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3RvUAFaMmdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3RpbWVzdGFtcHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM"),Ba=/* @__PURE__ */Ea("Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIgASgFQoMBChNjb20uZ29vZ2xlLnByb3RvYnVmQg1EdXJhdGlvblByb3RvUAFaMWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2R1cmF0aW9ucGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw"),xa=/* @__PURE__ */Wo(/* @__PURE__ */Ea("Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYiJgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnYKE2NvbS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaLGdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL2FueXBiogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM"),0),Ra={writeUnknownFields:!0};function Wa(e,t,n){return Na(new ei,function(e){return e?Object.assign(Object.assign({},Ra),e):Ra}(n),gi(e,t)).finish()}function Na(e,t,n){var r;for(const s of n.sortedFields)if(n.isSet(s))Ja(e,t,n,s);else if(3==s.presence)throw new Error(`cannot encode ${s} to binary: required field not set`);if(t.writeUnknownFields)for(const{no:s,wireType:i,data:o}of null!==(r=n.getUnknown())&&void 0!==r?r:[])e.tag(s,i).raw(o);return e}function Ja(e,t,n,r){var s;switch(r.fieldKind){case"scalar":case"enum":_a(e,n.desc.typeName,r.name,null!==(s=r.scalar)&&void 0!==s?s:rs.INT32,r.number,n.get(r));break;case"list":!function(e,t,n,r){var s;if("message"==n.listKind){for(const s of r)ka(e,t,n,s);return}const i=null!==(s=n.scalar)&&void 0!==s?s:rs.INT32;if(n.packed){if(!r.size)return;e.tag(n.number,Ds.LengthDelimited).fork();for(const t of r)Ya(e,n.parent.typeName,n.name,i,t);return void e.join()}for(const o of r)_a(e,n.parent.typeName,n.name,i,n.number,o)}(e,t,r,n.get(r));break;case"message":ka(e,t,r,n.get(r));break;case"map":for(const[s,i]of n.get(r))Fa(e,t,r,s,i)}}function _a(e,t,n,r,s,i){Ya(e.tag(s,function(e){switch(e){case rs.BYTES:case rs.STRING:return Ds.LengthDelimited;case rs.DOUBLE:case rs.FIXED64:case rs.SFIXED64:return Ds.Bit64;case rs.FIXED32:case rs.SFIXED32:case rs.FLOAT:return Ds.Bit32;default:return Ds.Varint}}(r)),t,n,r,i)}function ka(e,t,n,r){n.delimitedEncoding?Na(e.tag(n.number,Ds.StartGroup),t,r).tag(n.number,Ds.EndGroup):Na(e.tag(n.number,Ds.LengthDelimited).fork(),t,r).join()}function Fa(e,t,n,r,s){var i;switch(e.tag(n.number,Ds.LengthDelimited).fork(),_a(e,n.parent.typeName,n.name,n.mapKey,1,r),n.mapKind){case"scalar":case"enum":_a(e,n.parent.typeName,n.name,null!==(i=n.scalar)&&void 0!==i?i:rs.INT32,2,s);break;case"message":Na(e.tag(2,Ds.LengthDelimited).fork(),t,s).join()}e.join()}function Ya(e,t,n,r,s){try{switch(r){case rs.STRING:e.string(s);break;case rs.BOOL:e.bool(s);break;case rs.DOUBLE:e.double(s);break;case rs.FLOAT:e.float(s);break;case rs.INT32:e.int32(s);break;case rs.INT64:e.int64(s);break;case rs.UINT64:e.uint64(s);break;case rs.FIXED64:e.fixed64(s);break;case rs.BYTES:e.bytes(s);break;case rs.FIXED32:e.fixed32(s);break;case rs.SFIXED32:e.sfixed32(s);break;case rs.SFIXED64:e.sfixed64(s);break;case rs.SINT64:e.sint64(s);break;case rs.UINT32:e.uint32(s);break;case rs.SINT32:e.sint32(s)}}catch(i){if(i instanceof Error)throw new Error(`cannot encode field ${t}.${n} to binary: ${i.message}`);throw i}}function La(e,t){if(""===e.typeUrl)return;const n="message"==t.kind?t:t.getMessage(Oa(e.typeUrl));return n&&function(e,t){return""!==e.typeUrl&&("string"==typeof t?t:t.typeName)===Oa(e.typeUrl)}(e,n)?Aa(n,e.value):void 0}function Oa(e){const t=e.lastIndexOf("/"),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b29nbGUucHJvdG9idWZCC1N0cnVjdFByb3RvUAFaL2dvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3N0cnVjdHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM"),Ma=/* @__PURE__ */Wo(Ha,0),Ka=/* @__PURE__ */Wo(Ha,1),za=/* @__PURE__ */Wo(Ha,2);var Da,Ua;function Pa(e,t){$a(t,e);const n=function(e,t){if(void 0===e)return[];if("enum"===t.fieldKind||"scalar"===t.fieldKind){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.number)return[e[n]];return[]}return e.filter(e=>e.no===t.number)}(e.$unknown,t),[r,s,i]=Qa(t);for(const o of n)Sa(r,new ti(o.data),s,o.wireType,{readUnknownFields:!0});return i()}function ja(e,t,n){var r;$a(t,e);const s=(null!==(r=e.$unknown)&&void 0!==r?r:[]).filter(e=>e.no!==t.number),[i,o]=Qa(t,n),a=new ei;Ja(a,{writeUnknownFields:!0},i,o);const c=new ti(a.finish());for(;c.pos<c.len;){const[e,t]=c.tag(),n=c.skip(t,e);s.push({no:e,wireType:t,data:n})}e.$unknown=s}function Qa(e,t){const n=e.typeName,r=Object.assign(Object.assign({},e),{kind:"field",parent:e.extendee,localName:n}),s=Object.assign(Object.assign({},e.extendee),{fields:[r],members:[r],oneofs:[]}),i=Ws(s,void 0!==t?{[n]:t}:void 0);return[gi(s,i),r,()=>{const t=i[n];if(void 0===t){const t=e.message;return xs(t)?ws(t.fields[0].scalar,t.fields[0].longAsString):Ws(t)}return t}]}function $a(e,t){if(e.extendee.typeName!=t.$typeName)throw new Error(`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}(Ua=Da||(Da={}))[Ua.NULL_VALUE=0]="NULL_VALUE";const qa={alwaysEmitImplicit:!1,enumAsInteger:!1,useProtoFieldName:!1};function ec(e,t,n){return tc(gi(e,t),function(e){return e?Object.assign(Object.assign({},qa),e):qa}(n))}function tc(e,t){var n;const r=function(e,t){if(!e.desc.typeName.startsWith("google.protobuf."))return;switch(e.desc.typeName){case"google.protobuf.Any":return function(e,t){if(""===e.typeUrl)return{};const{registry:n}=t;let r,s;n&&(r=La(e,n),r&&(s=n.getMessage(r.$typeName)));if(!s||!r)throw new Error(`cannot encode message ${e.$typeName} to JSON: "${e.typeUrl}" is not in the type registry`);let i=tc(gi(s,r),t);(s.typeName.startsWith("google.protobuf.")||null===i||Array.isArray(i)||"object"!=typeof i)&&(i={value:i});return i["@type"]=e.typeUrl,i}(e.message,t);case"google.protobuf.Timestamp":return function(e){const t=1e3*Number(e.seconds);if(t<Date.parse("0001-01-01T00:00:00Z")||t>Date.parse("9999-12-31T23:59:59Z"))throw new Error(`cannot encode message ${e.$typeName} to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);if(e.nanos<0)throw new Error(`cannot encode message ${e.$typeName} to JSON: nanos must not be negative`);if(e.nanos>999999999)throw new Error(`cannot encode message ${e.$typeName} to JSON: nanos must not be greater than 99999999`);let n="Z";if(e.nanos>0){const t=(e.nanos+1e9).toString().substring(1);n="000000"===t.substring(3)?"."+t.substring(0,3)+"Z":"000"===t.substring(6)?"."+t.substring(0,6)+"Z":"."+t+"Z"}return new Date(t).toISOString().replace(".000Z",n)}(e.message);case"google.protobuf.Duration":return function(e){const t=Number(e.seconds),n=e.nanos;if(t>315576e6||t<-315576e6)throw new Error(`cannot encode message ${e.$typeName} to JSON: value out of range`);if(t>0&&n<0||t<0&&n>0)throw new Error(`cannot encode message ${e.$typeName} to JSON: nanos sign must match seconds sign`);let r=e.seconds.toString();if(0!==n){let e=Math.abs(n).toString();e="0".repeat(9-e.length)+e,"000000"===e.substring(3)?e=e.substring(0,3):"000"===e.substring(6)&&(e=e.substring(0,6)),r+="."+e,n<0&&0==t&&(r="-"+r)}return r+"s"}(e.message);case"google.protobuf.FieldMask":return(n=e.message).paths.map(e=>{if(Yi(Fi(e))!==e)throw new Error(`cannot encode message ${n.$typeName} to JSON: lowerCamelCase of path name "${e}" is irreversible`);return Fi(e)}).join(",");case"google.protobuf.Struct":return oc(e.message);case"google.protobuf.Value":return ac(e.message);case"google.protobuf.ListValue":return cc(e.message);default:if(xs(e.desc)){const t=e.desc.fields[0];return sc(t,e.get(t))}return}var n}(e,t);if(void 0!==r)return r;const s={};for(const i of e.sortedFields){if(!e.isSet(i)){if(3==i.presence)throw new Error(`cannot encode ${i} to JSON: required field not set`);if(!t.alwaysEmitImplicit||2!==i.presence)continue}const n=nc(i,e.get(i),t);void 0!==n&&(s[ic(i,t)]=n)}if(t.registry){const r=/* @__PURE__ */new Set;for(const{no:i}of null!==(n=e.getUnknown())&&void 0!==n?n:[])if(!r.has(i)){r.add(i);const n=t.registry.getExtensionFor(e.desc,i);if(!n)continue;const o=Pa(e.message,n),[a,c]=Qa(n,o),l=nc(c,a.get(c),t);void 0!==l&&(s[n.jsonName]=l)}}return s}function nc(e,t,n){switch(e.fieldKind){case"scalar":return sc(e,t);case"message":return tc(t,n);case"enum":return rc(e.enum,t,n.enumAsInteger);case"list":return function(e,t){const n=e.field(),r=[];switch(n.listKind){case"scalar":for(const t of e)r.push(sc(n,t));break;case"enum":for(const s of e)r.push(rc(n.enum,s,t.enumAsInteger));break;case"message":for(const n of e)r.push(tc(n,t))}return t.alwaysEmitImplicit||r.length>0?r:void 0}(t,n);case"map":return function(e,t){const n=e.field(),r={};switch(n.mapKind){case"scalar":for(const[t,s]of e)r[t]=sc(n,s);break;case"message":for(const[n,s]of e)r[n]=tc(s,t);break;case"enum":for(const[s,i]of e)r[s]=rc(n.enum,i,t.enumAsInteger)}return t.alwaysEmitImplicit||e.size>0?r:void 0}(t,n)}}function rc(e,t,n){var r;if("number"!=typeof t)throw new Error(`cannot encode ${e} to JSON: expected number, got ${li(t)}`);if("google.protobuf.NullValue"==e.typeName)return null;if(n)return t;const s=e.value[t];return null!==(r=null==s?void 0:s.name)&&void 0!==r?r:t}function sc(e,t){var n,r,s,i,o,a;switch(e.scalar){case rs.INT32:case rs.SFIXED32:case rs.SINT32:case rs.FIXED32:case rs.UINT32:if("number"!=typeof t)throw new Error(`cannot encode ${e} to JSON: ${null===(n=si(e,t))||void 0===n?void 0:n.message}`);return t;case rs.FLOAT:case rs.DOUBLE:if("number"!=typeof t)throw new Error(`cannot encode ${e} to JSON: ${null===(r=si(e,t))||void 0===r?void 0:r.message}`);return Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case rs.STRING:if("string"!=typeof t)throw new Error(`cannot encode ${e} to JSON: ${null===(s=si(e,t))||void 0===s?void 0:s.message}`);return t;case rs.BOOL:if("boolean"!=typeof t)throw new Error(`cannot encode ${e} to JSON: ${null===(i=si(e,t))||void 0===i?void 0:i.message}`);return t;case rs.UINT64:case rs.FIXED64:case rs.INT64:case rs.SFIXED64:case rs.SINT64:if("bigint"!=typeof t&&"string"!=typeof t)throw new Error(`cannot encode ${e} to JSON: ${null===(o=si(e,t))||void 0===o?void 0:o.message}`);return t.toString();case rs.BYTES:if(t instanceof Uint8Array)return Wi(t);throw new Error(`cannot encode ${e} to JSON: ${null===(a=si(e,t))||void 0===a?void 0:a.message}`)}}function ic(e,t){return t.useProtoFieldName?e.name:e.jsonName}function oc(e){const t={};for(const[n,r]of Object.entries(e.fields))t[n]=ac(r);return t}function ac(e){switch(e.kind.case){case"nullValue":return null;case"numberValue":if(!Number.isFinite(e.kind.value))throw new Error(`${e.$typeName} cannot be NaN or Infinity`);return e.kind.value;case"boolValue":case"stringValue":return e.kind.value;case"structValue":return oc(e.kind.value);case"listValue":return cc(e.kind.value);default:throw new Error(`${e.$typeName} must have a value`)}}function cc(e){return e.values.map(ac)}const lc={ignoreUnknownFields:!1};function uc(e,t,n){return function(e,t,n){const r=gi(e);try{gc(r,t,function(e){return e?Object.assign(Object.assign({},lc),e):lc}(n))}catch(i){if((s=i)instanceof Error&&Hs.includes(s.name)&&"field"in s&&"function"==typeof s.field)throw new Error(`cannot decode ${i.field()} from JSON: ${i.message}`,{cause:i});throw i}var s;return r.message}(e,function(e,t){try{return JSON.parse(e)}catch(n){const e=n instanceof Error?n.message:String(n);throw new Error(`cannot decode message ${t} from JSON: ${e}`,{cause:n})}}(t,e.typeName),n)}const dc=/* @__PURE__ */new WeakMap;function hc(e,t){var n;if(!dc.has(e)){const t=/* @__PURE__ */new Map;for(const n of e.fields)t.set(n.name,n).set(n.jsonName,n);dc.set(e,t)}return null===(n=dc.get(e))||void 0===n?void 0:n.get(t)}function gc(e,t,n){var r;if(function(e,t,n){if(!e.desc.typeName.startsWith("google.protobuf."))return!1;switch(e.desc.typeName){case"google.protobuf.Any":return function(e,t,n){var r;if(null===t||Array.isArray(t)||"object"!=typeof t)throw new Error(`cannot decode message ${e.$typeName} from JSON: expected object but got ${li(t)}`);if(0==Object.keys(t).length)return;const s=t["@type"];if("string"!=typeof s||""==s)throw new Error(`cannot decode message ${e.$typeName} from JSON: "@type" is empty`);const i=s.includes("/")?s.substring(s.lastIndexOf("/")+1):s;if(!i.length)throw new Error(`cannot decode message ${e.$typeName} from JSON: "@type" is invalid`);const o=null===(r=n.registry)||void 0===r?void 0:r.getMessage(i);if(!o)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${s} is not in the type registry`);const a=gi(o);if(i.startsWith("google.protobuf.")&&Object.prototype.hasOwnProperty.call(t,"value")){gc(a,t.value,n)}else{const e=Object.assign({},t);delete e["@type"],gc(a,e,n)}!function(e,t,n){let r=!1;n||(n=Ws(xa),r=!0),n.value=Wa(e,t),n.typeUrl=`type.googleapis.com/${t.$typeName}`}(a.desc,a.message,e)}(e.message,t,n),!0;case"google.protobuf.Timestamp":return function(e,t){if("string"!=typeof t)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${li(t)}`);const n=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,9}))?(?:Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error(`cannot decode message ${e.$typeName} from JSON: invalid RFC 3339 string`);const r=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(r))throw new Error(`cannot decode message ${e.$typeName} from JSON: invalid RFC 3339 string`);if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error(`cannot decode message ${e.$typeName} from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);e.seconds=fs.parse(r/1e3),e.nanos=0,n[7]&&(e.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9)}(e.message,t),!0;case"google.protobuf.Duration":return function(e,t){if("string"!=typeof t)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${li(t)}`);const n=t.match(/^(-?[0-9]+)(?:\.([0-9]+))?s/);if(null===n)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${li(t)}`);const r=Number(n[1]);if(r>315576e6||r<-315576e6)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${li(t)}`);if(e.seconds=fs.parse(r),"string"!=typeof n[2])return;const s=n[2]+"0".repeat(9-n[2].length);e.nanos=parseInt(s),(r<0||Object.is(r,-0))&&(e.nanos=-e.nanos)}(e.message,t),!0;case"google.protobuf.FieldMask":return function(e,t){if("string"!=typeof t)throw new Error(`cannot decode message ${e.$typeName} from JSON: ${li(t)}`);if(""===t)return;e.paths=t.split(",").map(t=>{if(t.includes("_"))throw new Error(`cannot decode message ${e.$typeName} from JSON: path names must be lowerCamelCase`);return Yi(t)})}(e.message,t),!0;case"google.protobuf.Struct":return Gc(e.message,t),!0;case"google.protobuf.Value":return Ac(e.message,t),!0;case"google.protobuf.ListValue":return Cc(e.message,t),!0;default:if(xs(e.desc)){const n=e.desc.fields[0];return null===t?e.clear(n):e.set(n,Ic(n,t)),!0}return!1}}(e,t,n))return;if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error(`cannot decode ${e.desc} from JSON: ${li(t)}`);const s=/* @__PURE__ */new Map;for(const[i,o]of Object.entries(t)){const t=hc(e.desc,i);if(t){if(t.oneof){if(null===o&&"scalar"==t.fieldKind)continue;const e=s.get(t.oneof);if(void 0!==e)throw new Ms(t.oneof,`oneof set multiple times by ${e.name} and ${t.name}`);s.set(t.oneof,t)}mc(e,t,o,n)}else{let t;if(i.startsWith("[")&&i.endsWith("]")&&(t=null===(r=n.registry)||void 0===r?void 0:r.getExtension(i.substring(1,i.length-1)))&&t.extendee.typeName===e.desc.typeName){const[r,s,i]=Qa(t);mc(r,s,o,n),ja(e.message,t,i())}if(!t&&!n.ignoreUnknownFields)throw new Error(`cannot decode ${e.desc} from JSON: key "${i}" is unknown`)}}}function mc(e,t,n,r){switch(t.fieldKind){case"scalar":!function(e,t,n){null===n?e.clear(t):e.set(t,Ic(t,n))}(e,t,n);break;case"enum":!function(e,t,n,r){if(fc(t,n))return void e.clear(t);const s=bc(t.enum,n,r.ignoreUnknownFields);s!==yc&&e.set(t,s)}(e,t,n,r);break;case"message":!function(e,t,n,r){if(fc(t,n))return void e.clear(t);const s=e.isSet(t)?e.get(t):gi(t.message);gc(s,n,r),e.set(t,s)}(e,t,n,r);break;case"list":!function(e,t,n){if(null===t)return;const r=e.field();if(!Array.isArray(t))throw new Ms(r,"expected Array, got "+li(t));for(const s of t){const t=pc(r,s,n);t!==yc&&e.add(t)}}(e.get(t),n,r);break;case"map":!function(e,t,n){if(null===t)return;const r=e.field();if("object"!=typeof t||Array.isArray(t))throw new Ms(r,"expected object, got "+li(t));for(const[s,i]of Object.entries(t)){const t=wc(r.mapKey,s),o=pc(r,i,n);o!==yc&&e.set(t,o)}}(e.get(t),n,r)}}function pc(e,t,n){if(e.scalar&&null!==t)return Ic(e,t);if(e.message&&!fc(e,t)){const r=gi(e.message);return gc(r,t,n),r}if(e.enum&&!fc(e,t))return bc(e.enum,t,n.ignoreUnknownFields);throw new Ms(e,("list"===e.fieldKind?"list item":"map value")+" must not be null")}function fc(e,t){var n,r;return null===t&&"google.protobuf.Value"!=(null===(n=e.message)||void 0===n?void 0:n.typeName)&&"google.protobuf.NullValue"!=(null===(r=e.enum)||void 0===r?void 0:r.typeName)}const yc=/* @__PURE__ */Symbol();function bc(e,t,n){if(null===t)return e.values[0].number;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const r=e.values.find(e=>e.name===t);if(void 0!==r)return r.number;if(n)return yc}throw new Error(`cannot decode ${e} from JSON: ${li(t)}`)}function Ic(e,t){switch(e.scalar){case rs.DOUBLE:case rs.FLOAT:if("NaN"===t)return NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if("number"==typeof t){if(Number.isNaN(t))throw new Ms(e,"unexpected NaN number");if(!Number.isFinite(t))throw new Ms(e,"unexpected infinite number");break}if("string"==typeof t){if(""===t)break;if(t.trim().length!==t.length)break;const e=Number(t);if(!Number.isFinite(e))break;return e}break;case rs.INT32:case rs.FIXED32:case rs.SFIXED32:case rs.SINT32:case rs.UINT32:return vc(t);case rs.BYTES:if("string"==typeof t){if(""===t)return new Uint8Array(0);try{return Ri(t)}catch(n){const t=n instanceof Error?n.message:String(n);throw new Ms(e,t)}}}return t}function wc(e,t){switch(e){case rs.BOOL:switch(t){case"true":return!0;case"false":return!1}return t;case rs.INT32:case rs.FIXED32:case rs.UINT32:case rs.SFIXED32:case rs.SINT32:return vc(t);default:return t}}function vc(e){if("string"==typeof e){if(""===e)return e;if(e.trim().length!==e.length)return e;const t=Number(e);return Number.isNaN(t)?e:t}return e}function Gc(e,t){if("object"!=typeof t||null==t||Array.isArray(t))throw new Error(`cannot decode message ${e.$typeName} from JSON ${li(t)}`);for(const[n,r]of Object.entries(t)){const t=Ws(Ka);Ac(t,r),e.fields[n]=t}}function Ac(e,t){switch(typeof t){case"number":e.kind={case:"numberValue",value:t};break;case"string":e.kind={case:"stringValue",value:t};break;case"boolean":e.kind={case:"boolValue",value:t};break;case"object":if(null===t)e.kind={case:"nullValue",value:Da.NULL_VALUE};else if(Array.isArray(t)){const n=Ws(za);Cc(n,t),e.kind={case:"listValue",value:n}}else{const n=Ws(Ma);Gc(n,t),e.kind={case:"structValue",value:n}}break;default:throw new Error(`cannot decode message ${e.$typeName} from JSON ${li(t)}`)}return e}function Cc(e,t){if(!Array.isArray(t))throw new Error(`cannot decode message ${e.$typeName} from JSON ${li(t)}`);for(const n of t){const t=Ws(Ka);Ac(t,n),e.values.push(t)}}function Sc(e){const t=ts[e];return"string"!=typeof t?e.toString():t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,e=>"_"+e.toLowerCase())}let Zc;class Vc extends Error{constructor(e,t=ts.Unknown,n,r,s){super(function(e,t){return e.length?`[${Sc(t)}] ${e}`:`[${Sc(t)}]`}(e,t)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=t,this.metadata=new Headers(null!=n?n:{}),this.details=null!=r?r:[],this.cause=s}static from(e,t=ts.Unknown){return e instanceof Vc?e:e instanceof Error?"AbortError"==e.name||"TimeoutError"==e.name?new Vc(e.message,ts.Canceled):new Vc(e.message,t,void 0,void 0,e):new Vc(String(e),t,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error&&(Object.getPrototypeOf(e)===Vc.prototype||"ConnectError"===e.name&&"code"in e&&"number"==typeof e.code&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&"string"==typeof e.rawMessage&&"cause"in e)}findDetails(e){const t="message"===e.kind?{getMessage:t=>t===e.typeName?e:void 0}:e,n=[];for(const s of this.details){if("desc"in s){t.getMessage(s.desc.typeName)&&n.push(Ws(s.desc,s.value));continue}const e=t.getMessage(s.type);if(e)try{n.push(Aa(e,s.value))}catch(r){}}return n}}function Ec(...e){const t=new Headers;for(const n of e)n.forEach((e,n)=>{t.append(n,e)});return t}const Xc=4294967295,Bc=Xc;function xc(e,t,n=!1){if(t>e){let r=`message size is larger than configured readMaxBytes ${e}`;throw n&&(r=`message size ${t} is larger than configured readMaxBytes ${e}`),new Vc(r,ts.ResourceExhausted)}}class Rc{constructor(e){this.readMaxBytes=e,this.header=new Uint8Array(5),this.headerView=new DataView(this.header.buffer),this.buf=[]}get byteLength(){return this.buf.reduce((e,t)=>e+t.byteLength,0)}decode(e){this.buf.push(e);const t=[];for(;;){let e=this.pop();if(!e)break;t.push(e)}return t}pop(){if((this.env||(this.env=this.head(),this.env))&&this.cons(this.env.data)){const e=this.env;return this.env=void 0,e}}head(){if(!this.cons(this.header))return;const e=this.headerView.getUint8(0),t=this.headerView.getUint32(1);return xc(this.readMaxBytes,t,!0),{flags:e,data:new Uint8Array(t)}}cons(e){const t=e.byteLength;if(this.byteLength<t)return!1;let n=0;for(;n<t;){const r=this.buf.shift();r.byteLength>t-n?(e.set(r.subarray(0,t-n),n),this.buf.unshift(r.subarray(t-n)),n+=t-n):(e.set(r,n),n+=r.byteLength)}return!0}}async function Wc(e,t,n){let{flags:r,data:s}=e;if(!(1&~r))throw new Vc("invalid envelope, already compressed",ts.Internal);return t&&s.byteLength>=n&&(s=await t.compress(s),r|=1),{data:s,flags:r}}async function Nc(e,t,n){let{flags:r,data:s}=e;if(!(1&~r)){if(!t)throw new Vc("received compressed envelope, but do not know how to decompress",ts.Internal);s=await t.decompress(s,n),r^=1}return{data:s,flags:r}}function Jc(e,t){const n=new Uint8Array(t.length+5);n.set(t,5);const r=new DataView(n.buffer,n.byteOffset,n.byteLength);return r.setUint8(0,e),r.setUint32(1,t.length),n}var _c=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,s){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,s,(t=e[n](t)).done,t.value)})}}},kc=function(e){return this instanceof kc?(this.v=e,this):new kc(e)},Fc=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,s=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){s[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=s[e](t)).value instanceof kc?Promise.resolve(n.value.v).then(c,l):u(i[0][2],n)}catch(r){u(i[0][3],r)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}};function Yc(e,t){return async n=>await async function(e,t,n){var r,s,i,o,a,c,l,u;const[d,h]=function(e){if(null==e)return[!1,0];const t="string"==typeof e?parseInt(e,10):e;if(!Number.isSafeInteger(t)||t<0)return[!1,t];return[!0,t]}(n);if(d){h>t&&xc(t,h,!0);const n=new Uint8Array(h);let a=0;try{for(var g,m=!0,p=_c(e);!(r=(g=await p.next()).done);m=!0){o=g.value,m=!1;const e=o;if(a+e.byteLength>h)throw new Vc(`protocol error: promised ${h} bytes, received ${a+e.byteLength}`,ts.InvalidArgument);n.set(e,a),a+=e.byteLength}}catch(A){s={error:A}}finally{try{m||r||!(i=p.return)||await i.call(p)}finally{if(s)throw s.error}}if(a<h)throw new Vc(`protocol error: promised ${h} bytes, received ${a}`,ts.InvalidArgument);return n}const f=[];let y=0;try{for(var b,I=!0,w=_c(e);!(a=(b=await w.next()).done);I=!0){u=b.value,I=!1;const e=u;y+=e.byteLength,xc(t,y),f.push(e)}}catch(C){c={error:C}}finally{try{I||a||!(l=w.return)||await l.call(w)}finally{if(c)throw c.error}}const v=new Uint8Array(y);let G=0;for(let S=f.shift();S;S=f.shift())v.set(S,G),G+=S.byteLength;return v}(n,e,t)}function Lc(e,...t){return Fc(this,arguments,function*(){var n;const[r,s]=function(e){let t;"function"!=typeof e[e.length-1]&&(t=e.pop());return[e,t]}(t);let i;const o=e[Symbol.asyncIterator]();let a={[Symbol.asyncIterator]:()=>o};!0===(null==s?void 0:s.propagateDownStreamError)&&(a=i=zc(a));for(const e of r)a=e(a);const c=a[Symbol.asyncIterator]();try{for(;;){const e=yield kc(c.next());if(!0===e.done)break;if(i)try{yield yield kc(e.value)}catch(l){throw yield kc(i.abort(l)),l}else yield yield kc(e.value)}}finally{!0===(null==s?void 0:s.propagateDownStreamError)&&(null===(n=o.return)||void 0===n||n.call(o).catch(()=>{}))}})}function Oc(e,t,n){return function(t){return Fc(this,arguments,function*(){var n,r,s,i;try{for(var o,a=!0,c=_c(t);!(n=(o=yield kc(c.next())).done);a=!0){i=o.value,a=!1;const t=i,n=e.serialize(t);yield yield kc({flags:0,data:n})}}catch(l){r={error:l}}finally{try{a||n||!(s=c.return)||(yield kc(s.call(c)))}finally{if(r)throw r.error}}})}}function Tc(e,t,n){return n&&void 0!==t?function(r){return Fc(this,arguments,function*(){var s,i,o,a;try{for(var c,l=!0,u=_c(r);!(s=(c=yield kc(u.next())).done);l=!0){a=c.value,l=!1;const{flags:r,data:s}=a;(r&t)===t?yield yield kc({value:n.parse(s),end:!0}):yield yield kc({value:e.parse(s),end:!1})}}catch(d){i={error:d}}finally{try{l||s||!(o=u.return)||(yield kc(o.call(u)))}finally{if(i)throw i.error}}})}:function(r){return Fc(this,arguments,function*(){var s,i,o,a;try{for(var c,l=!0,u=_c(r);!(s=(c=yield kc(u.next())).done);l=!0){a=c.value,l=!1;const{flags:r,data:s}=a;if(void 0===t||(r&t)!==t)yield yield kc(e.parse(s));else if(null===n)throw new Vc("unexpected end flag",ts.InvalidArgument)}}catch(d){i={error:d}}finally{try{l||s||!(o=u.return)||(yield kc(o.call(u)))}finally{if(i)throw i.error}}})}}function Hc(e,t){return function(n){return Fc(this,arguments,function*(){var r,s,i,o;try{for(var a,c=!0,l=_c(n);!(r=(a=yield kc(l.next())).done);c=!0){o=a.value,c=!1;const n=o;yield yield kc(yield kc(Wc(n,e,t)))}}catch(u){s={error:u}}finally{try{c||r||!(i=l.return)||(yield kc(i.call(l)))}finally{if(s)throw s.error}}})}}function Mc(e,t){return function(n){return Fc(this,arguments,function*(){var r,s,i,o;try{for(var a,c=!0,l=_c(n);!(r=(a=yield kc(l.next())).done);c=!0){o=a.value,c=!1;const n=o;yield yield kc(yield kc(Nc(n,e,t)))}}catch(u){s={error:u}}finally{try{c||r||!(i=l.return)||(yield kc(i.call(l)))}finally{if(s)throw s.error}}})}}function Kc(e){return function(t){return Fc(this,arguments,function*(){var n,r,s,i;const o=function(e){return new Rc(e)}(e);try{for(var a,c=!0,l=_c(t);!(n=(a=yield kc(l.next())).done);c=!0){i=a.value,c=!1;const e=i;for(const t of o.decode(e))yield yield kc(t)}}catch(u){r={error:u}}finally{try{c||n||!(s=l.return)||(yield kc(s.call(l)))}finally{if(r)throw r.error}}if(o.byteLength>0)throw new Vc("protocol error: incomplete envelope",ts.InvalidArgument)})}}function zc(e){const t=e[Symbol.asyncIterator]();if(void 0===t.throw)throw new Error("AsyncIterable does not implement throw");const n=t;let r,s,i={next:()=>(s=n.next().finally(()=>{s=void 0}),s),throw:e=>n.throw(e)};void 0!==t.return&&(i=Object.assign(Object.assign({},i),{return:e=>n.return(e)}));let o=!1;return{abort(e){if(r)return r.state;const t=()=>n.throw(e).then(e=>!0===e.done?"completed":"caught",()=>"rethrown");return s?(r={reason:e,state:s.then(t,t)},r.state):(r={reason:e,state:t()},r.state)},[Symbol.asyncIterator](){if(o)throw new Error("AsyncIterable cannot be re-used");return o=!0,i}}}function Dc(e){return Fc(this,arguments,function*(){yield kc(yield*function(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,s){t[r]=e[r]?function(t){return(n=!n)?{value:kc(e[r](t)),done:!1}:s?s(t):t}:s}}(_c(e)))})}var Uc=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,s){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,s,(t=e[n](t)).done,t.value)})}}},Pc=function(e){return this instanceof Pc?(this.v=e,this):new Pc(e)},jc=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,s=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){s[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=s[e](t)).value instanceof Pc?Promise.resolve(n.value.v).then(c,l):u(i[0][2],n)}catch(r){u(i[0][3],r)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}};function Qc(e,t){const n=function(){return jc(this,arguments,function*(){var n,r;const s=yield Pc(e);null===(n=null==t?void 0:t.onHeader)||void 0===n||n.call(t,s.header),yield Pc(yield*function(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,s){t[r]=e[r]?function(t){return(n=!n)?{value:Pc(e[r](t)),done:!1}:s?s(t):t}:s}}(Uc(s.message))),null===(r=null==t?void 0:t.onTrailer)||void 0===r||r.call(t,s.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function $c(e){if(!e.aborted)return;if(void 0!==e.reason)return e.reason;const t=new Error("This operation was aborted");return t.name="AbortError",t}function qc(){return{get(e){return e.id in this?this[e.id]:e.defaultValue},set(e,t){return this[e.id]=t,this},delete(e){return delete this[e.id],this}}}function el(e,t,...n){if(n.length>0)throw new Error;return e.services[t]}function tl(e,t){return e.toString().replace(/\/?$/,`/${t.parent.typeName}/${t.name}`)}function nl(e,t){return Ws(e,t)}function rl(e,t){function n(t){return!0===t.done?t:{done:t.done,value:nl(e,t.value)}}return{[Symbol.asyncIterator](){const e=t[Symbol.asyncIterator](),r={next:()=>e.next().then(n)};return void 0!==e.throw&&(r.throw=t=>e.throw(t).then(n)),void 0!==e.return&&(r.return=t=>e.return(t).then(n)),r}}}function sl(e,t){if(!t)return e;for(const n of t.concat().reverse())e=n(e);return e}function il(e,t,n,r){const s=ol(al(e.input,t),r),i=ol(cl(e.input,n),r),o=ol(al(e.output,t),r),a=ol(cl(e.output,n),r);return{getI:e=>e?s:i,getO:e=>e?o:a}}function ol(e,t){return{serialize(n){const r=e.serialize(n);return function(e,t){if(t>e)throw new Vc(`message size ${t} is larger than configured writeMaxBytes ${e}`,ts.ResourceExhausted)}(t.writeMaxBytes,r.byteLength),r},parse:n=>(xc(t.readMaxBytes,n.byteLength,!0),e.parse(n))}}function al(e,t){return{parse(n){try{return Aa(e,n,t)}catch(r){const e=r instanceof Error?r.message:String(r);throw new Vc(`parse binary: ${e}`,ts.Internal)}},serialize(n){try{return Wa(e,n,t)}catch(r){const e=r instanceof Error?r.message:String(r);throw new Vc(`serialize binary: ${e}`,ts.Internal)}}}}function cl(e,t){var n,r;const s=null!==(n=null==t?void 0:t.textEncoder)&&void 0!==n?n:new TextEncoder,i=null!==(r=null==t?void 0:t.textDecoder)&&void 0!==r?r:new TextDecoder,o=function(e){var t;const n=Object.assign({},e);return null!==(t=n.ignoreUnknownFields)&&void 0!==t||(n.ignoreUnknownFields=!0),n}(t);return{parse(t){try{const n=i.decode(t);return uc(e,n,o)}catch(n){throw Vc.from(n,ts.InvalidArgument)}},serialize(t){try{const n=function(e,t,n){var r;const s=ec(e,t,n);return JSON.stringify(s,null,null!==(r=null==n?void 0:n.prettySpaces)&&void 0!==r?r:0)}(e,t,o);return s.encode(n)}catch(n){throw Vc.from(n,ts.Internal)}}}}const ll=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;function ul(e,t,n){var r;if(t&&new Headers(t).forEach((e,t)=>n.metadata.append(t,e)),"object"!=typeof e||null==e||Array.isArray(e))throw n;let s=n.code;"code"in e&&"string"==typeof e.code&&(s=null!==(r=function(e){if(!Zc){Zc={};for(const e of Object.values(ts))"string"!=typeof e&&(Zc[Sc(e)]=e)}return Zc[e]}(e.code))&&void 0!==r?r:s);const i=e.message;if(null!=i&&"string"!=typeof i)throw n;const o=new Vc(null!=i?i:"",s,t);if("details"in e&&Array.isArray(e.details))for(const c of e.details){if(null===c||"object"!=typeof c||Array.isArray(c)||"string"!=typeof c.type||"string"!=typeof c.value)throw n;try{o.details.push({type:c.type,value:Ri(c.value),debug:c.debug})}catch(a){throw n}}return o}function dl(e,t){const n={code:Sc(e.code)};return e.rawMessage.length>0&&(n.message=e.rawMessage),e.details.length>0&&(n.details=e.details.map(e=>{if("desc"in e){const r=Ws(e.desc,e.value),s={type:e.desc.typeName,value:Wa(e.desc,r)};try{s.debug=ec(e.desc,r,t)}catch(n){}return s}return e}).map(e=>{var{value:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}(e,["value"]);return Object.assign(Object.assign({},n),{value:Wi(t,"std_raw")})})),n}function hl(e){const t=new TextEncoder;return{serialize(n){try{const r=function(e,t,n){const r={};void 0!==t&&(r.error=dl(t,n),e=Ec(e,t.metadata));let s=!1;const i={};return e.forEach((e,t)=>{s=!0,i[t]=[e]}),s&&(r.metadata=i),r}(n.metadata,n.error,e),s=JSON.stringify(r);return t.encode(s)}catch(r){const e=r instanceof Error?r.message:String(r);throw new Vc(`failed to serialize EndStreamResponse: ${e}`,ts.Internal)}},parse(e){try{return function(e){const t=new Vc("invalid end stream",ts.Unknown);let n;try{n=JSON.parse("string"==typeof e?e:(new TextDecoder).decode(e))}catch(s){throw t}if("object"!=typeof n||null==n||Array.isArray(n))throw t;const r=new Headers;if("metadata"in n){if("object"!=typeof n.metadata||null==n.metadata||Array.isArray(n.metadata))throw t;for(const[e,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(e=>"string"!=typeof e))throw t;for(const t of s)r.append(e,t)}}return{metadata:r,error:"error"in n&&null!=n.error?ul(n.error,r,t):void 0}}(e)}catch(t){const e=t instanceof Error?t.message:String(t);throw new Vc(`failed to parse EndStreamResponse: ${e}`,ts.InvalidArgument)}}}}const gl="Content-Type",ml="Content-Length",pl="Content-Encoding",fl="Connect-Content-Encoding",yl="Accept-Encoding",bl="Connect-Protocol-Version",Il="User-Agent";function wl(e,t,n,r,s,i,o){const a=function(e,t,n,r,s){const i=new Headers(null!=r?r:{});return void 0!==n&&i.set("Connect-Timeout-Ms",`${n}`),i.set(gl,"unary"==e?t?"application/proto":"application/json":t?"application/connect+proto":"application/connect+json"),i.set(bl,"1"),!i.has(Il)&&s&&i.set(Il,"connect-es/2.1.1"),i}(e,t,n,r,o);if(null!=i){const t="unary"==e?pl:fl;a.set(t,i.name)}if(s.length>0){const t="unary"==e?yl:"Connect-Accept-Encoding";a.set(t,s.map(e=>e.name).join(","))}return a}function vl(e,t,n,r){const s=r.get(gl),i=function(e){const t=null==e?void 0:e.match(ll);if(!t)return;return{stream:!!t[1],binary:!!t[3]}}(s);if(200!==n){const t=new Vc(`HTTP ${n}`,function(e){switch(e){case 400:return ts.Internal;case 401:return ts.Unauthenticated;case 403:return ts.PermissionDenied;case 404:return ts.Unimplemented;case 429:case 502:case 503:case 504:return ts.Unavailable;default:return ts.Unknown}}(n),r);if("unary"==e&&i&&!i.binary)return{isUnaryError:!0,unaryError:t};throw t}const o=t,a="unary"!==e;if((null==i?void 0:i.binary)!==o||i.stream!==a)throw new Vc(`unsupported content type ${s}`,void 0===i?ts.Unknown:ts.Internal,r);return{isUnaryError:!1}}function Gl(e,t,n,r,s){let i;const o=s.get("unary"==e?pl:fl);if(null!=o&&"identity"!==o.toLowerCase()&&(i=t.find(e=>e.name===o),!i))throw new Vc(`unsupported response encoding "${o}"`,ts.Internal,s);return Object.assign({compression:i},vl(e,n,r,s))}const Al="application/";function Cl(e,t,n){let r="?connect=v1";const s=e.header.get(gl);0===(null==s?void 0:s.indexOf(Al))&&(r+="&encoding="+encodeURIComponent(s.slice(12)));const i=e.header.get(pl);null!==i&&"identity"!==i&&(r+="&compression="+encodeURIComponent(i),n=!0),n&&(r+="&base64=1"),r+="&message="+function(e,t){return t?Wi(e,"url"):encodeURIComponent((new TextDecoder).decode(e))}(t,n);const o=e.url+r,a=new Headers(e.header);for(const c of[bl,gl,ml,pl,yl])a.delete(c);return Object.assign(Object.assign({},e),{requestMethod:"GET",url:o,header:a})}function Sl(e){const{signal:t,cleanup:n}=function(e){const t=new AbortController,n=()=>{t.abort(new Vc("the operation timed out",ts.DeadlineExceeded))};let r;return void 0!==e&&(e<=0?n():r=setTimeout(n,e)),{signal:t.signal,cleanup:()=>clearTimeout(r)}}(e.timeoutMs),r=function(...e){const t=new AbortController,n=e.filter(e=>void 0!==e).concat(t.signal);for(const s of n){if(s.aborted){r.apply(s);break}s.addEventListener("abort",r)}function r(){t.signal.aborted||t.abort($c(this));for(const e of n)e.removeEventListener("abort",r)}return t}(e.signal,t);return[r.signal,function(e){const s=Vc.from(t.aborted?$c(t):e);return r.abort(s),n(),Promise.reject(s)},function(){n(),r.abort()}]}var Zl,Vl,El=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,s){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,s,(t=e[n](t)).done,t.value)})}}},Xl=function(e){return this instanceof Xl?(this.v=e,this):new Xl(e)},Bl=function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,s=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){s[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=s[e](t)).value instanceof Xl?Promise.resolve(n.value.v).then(c,l):u(i[0][2],n)}catch(r){u(i[0][3],r)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}};function xl(e){return{async unary(t,n,r,s,i,o){const a=il(t,e.binaryOptions,e.jsonOptions,e);return r=void 0===r?e.defaultTimeoutMs:r<=0?void 0:r,await function(e){const t=sl(e.next,e.interceptors),[n,r,s]=Sl(e);return t(Object.assign(Object.assign({},e.req),{message:nl(e.req.method.input,e.req.message),signal:n})).then(e=>(s(),e),r)}({interceptors:e.interceptors,signal:n,timeoutMs:r,req:{stream:!1,service:t.parent,method:t,requestMethod:"POST",url:tl(e.baseUrl,t),header:wl(t.methodKind,e.useBinaryFormat,r,s,e.acceptCompression,e.sendCompression,!0),contextValues:null!=o?o:qc(),message:i},next:async n=>{let r=a.getI(e.useBinaryFormat).serialize(n.message);e.sendCompression&&r.byteLength>e.compressMinBytes?(r=await e.sendCompression.compress(r),n.header.set(pl,e.sendCompression.name)):n.header.delete(pl);let s;!0===e.useHttpGet&&t.idempotency===$o.NO_SIDE_EFFECTS?n=Cl(n,r,e.useBinaryFormat):s=Dc([r]);const i=await e.httpClient({url:n.url,method:n.requestMethod,header:n.header,signal:n.signal,body:s}),{compression:o,isUnaryError:c,unaryError:l}=Gl(t.methodKind,e.acceptCompression,e.useBinaryFormat,i.status,i.header),[u,d]=function(e){const t=new Headers,n=new Headers;return e.forEach((e,r)=>{r.toLowerCase().startsWith("trailer-")?n.append(r.substring(8),e):t.append(r,e)}),[t,n]}(i.header);let h=await function(e,...t){const[n,r,s]=function(e){let t;"function"!=typeof e[e.length-1]&&(t=e.pop());const n=e.pop();return[e,n,t]}(t);let i,o=e;return!0===(null==s?void 0:s.propagateDownStreamError)&&(o=i=zc(o)),o=Lc(o,...n,{propagateDownStreamError:!1}),r(o).catch(e=>i?i.abort(e).then(()=>Promise.reject(e)):Promise.reject(e))}(i.body,Yc(e.readMaxBytes,i.header.get(ml)),{propagateDownStreamError:!1});if(o&&(h=await o.decompress(h,e.readMaxBytes)),c)throw function(e,t,n){let r;try{r=JSON.parse((new TextDecoder).decode(e))}catch(s){throw n}return ul(r,t,n)}(h,Ec(u,d),l);return{stream:!1,service:t.parent,method:t,header:u,message:a.getO(e.useBinaryFormat).parse(h),trailer:d}}})},async stream(t,n,r,s,i,o){const a=il(t,e.binaryOptions,e.jsonOptions,e),c=hl(e.jsonOptions);return r=void 0===r?e.defaultTimeoutMs:r<=0?void 0:r,function(e){const t=sl(e.next,e.interceptors),[n,r,s]=Sl(e),i=Object.assign(Object.assign({},e.req),{message:rl(e.req.method.input,e.req.message),signal:n});let o=!1;return n.addEventListener("abort",function(){var t,n;const r=e.req.message[Symbol.asyncIterator]();o||null===(t=r.throw)||void 0===t||t.call(r,this.reason).catch(()=>{}),null===(n=r.return)||void 0===n||n.call(r).catch(()=>{})}),t(i).then(e=>Object.assign(Object.assign({},e),{message:{[Symbol.asyncIterator](){const t=e.message[Symbol.asyncIterator]();return{next:()=>t.next().then(e=>(1==e.done&&(o=!0,s()),e),r)}}}}),r)}({interceptors:e.interceptors,signal:n,timeoutMs:r,req:{stream:!0,service:t.parent,method:t,requestMethod:"POST",url:tl(e.baseUrl,t),header:wl(t.methodKind,e.useBinaryFormat,r,s,e.acceptCompression,e.sendCompression,!0),contextValues:null!=o?o:qc(),message:i},next:async n=>{const r=await e.httpClient({url:n.url,method:"POST",header:n.header,signal:n.signal,body:Lc(n.message,Oc(a.getI(e.useBinaryFormat)),Hc(e.sendCompression,e.compressMinBytes),function(e){return Fc(this,arguments,function*(){var t,n,r,s;try{for(var i,o=!0,a=_c(e);!(t=(i=yield kc(a.next())).done);o=!0){s=i.value,o=!1;const{flags:e,data:t}=s;yield yield kc(Jc(e,t))}}catch(c){n={error:c}}finally{try{o||t||!(r=a.return)||(yield kc(r.call(a)))}finally{if(n)throw n.error}}})},{propagateDownStreamError:!0})}),{compression:s}=Gl(t.methodKind,e.acceptCompression,e.useBinaryFormat,r.status,r.header),i=Object.assign(Object.assign({},n),{header:r.header,trailer:new Headers,message:Lc(r.body,Kc(e.readMaxBytes),Mc(null!=s?s:null,e.readMaxBytes),Tc(a.getO(e.useBinaryFormat),2,c),function(e){return Bl(this,arguments,function*(){var t,n,s,o;let a=!1;try{for(var c,l=!0,u=El(e);!(t=(c=yield Xl(u.next())).done);l=!0){o=c.value,l=!1;const e=o;if(e.end){if(a)throw new Vc("protocol error: received extra EndStreamResponse",ts.InvalidArgument);if(a=!0,e.value.error){const t=e.value.error;throw r.header.forEach((e,n)=>{t.metadata.append(n,e)}),t}e.value.metadata.forEach((e,t)=>i.trailer.set(t,e))}else{if(a)throw new Vc("protocol error: received extra message after EndStreamResponse",ts.InvalidArgument);yield yield Xl(e.value)}}}catch(d){n={error:d}}finally{try{l||t||!(s=u.return)||(yield Xl(s.call(u)))}finally{if(n)throw n.error}}if(!a)throw new Vc("protocol error: missing EndStreamResponse",ts.InvalidArgument)})},{propagateDownStreamError:!0})});return i}})}}}function Rl(e){let t=ts.Internal;const n=Wl(e).map(Nl);n.some(e=>"ERR_STREAM_WRITE_AFTER_END"==e.code)||n.some(e=>"ERR_STREAM_DESTROYED"==e.code||"ERR_HTTP2_INVALID_STREAM"==e.code||"ECONNRESET"==e.code)?t=ts.Aborted:n.some(e=>"ETIMEDOUT"==e.code||"ENOTFOUND"==e.code||"EAI_AGAIN"==e.code||"ECONNREFUSED"==e.code)&&(t=ts.Unavailable);const r=Vc.from(e,t);return r!==e&&(r.cause=e),r}function Wl(e){const t=[];for(;e instanceof Error&&!t.includes(e)&&(t.push(e),"cause"in e);)e=e.cause;return t}function Nl(e){const t={};return e instanceof Error&&("code"in e&&"string"==typeof e.code&&(t.code=e.code),"syscall"in e&&"string"==typeof e.syscall&&(t.syscall=e.syscall)),t}(Vl=Zl||(Zl={}))[Vl.PROTOCOL_ERROR=1]="PROTOCOL_ERROR",Vl[Vl.INTERNAL_ERROR=2]="INTERNAL_ERROR",Vl[Vl.FLOW_CONTROL_ERROR=3]="FLOW_CONTROL_ERROR",Vl[Vl.SETTINGS_TIMEOUT=4]="SETTINGS_TIMEOUT",Vl[Vl.STREAM_CLOSED=5]="STREAM_CLOSED",Vl[Vl.FRAME_SIZE_ERROR=6]="FRAME_SIZE_ERROR",Vl[Vl.REFUSED_STREAM=7]="REFUSED_STREAM",Vl[Vl.CANCEL=8]="CANCEL",Vl[Vl.COMPRESSION_ERROR=9]="COMPRESSION_ERROR",Vl[Vl.CONNECT_ERROR=10]="CONNECT_ERROR",Vl[Vl.ENHANCE_YOUR_CALM=11]="ENHANCE_YOUR_CALM",Vl[Vl.INADEQUATE_SECURITY=12]="INADEQUATE_SECURITY",Vl[Vl.HTTP_1_1_REQUIRED=13]="HTTP_1_1_REQUIRED";const Jl=a(C.gzip),_l=a(C.gunzip),kl=a(C.brotliCompress),Fl=a(C.brotliDecompress),Yl={name:"gzip",compress:e=>Ol(Jl(e,{})),decompress:(e,t)=>0==e.length?Promise.resolve(new Uint8Array(0)):Ol(Tl(_l(e,{maxOutputLength:t}),t))},Ll={name:"br",compress:e=>Ol(kl(e,{})),decompress:(e,t)=>0==e.length?Promise.resolve(new Uint8Array(0)):Ol(Tl(Fl(e,{maxOutputLength:t}),t))};function Ol(e){return e.then(e=>e.buffer instanceof ArrayBuffer?e:new Uint8Array(e))}function Tl(e,t){return e.catch(e=>{var n;const r=Nl(e);let s=ts.Internal,i="decompression failed";switch(r.code){case"ERR_BUFFER_TOO_LARGE":s=ts.ResourceExhausted,i=`message is larger than configured readMaxBytes ${t} after decompression`;break;case"Z_DATA_ERROR":case"ERR_PADDING_2":s=ts.InvalidArgument;break;default:(null===(n=r.code)||void 0===n?void 0:n.startsWith("ERR__ERROR_FORMAT_"))&&(s=ts.InvalidArgument)}return Promise.reject(new Vc(i,s,void 0,void 0,e))})}function Hl(e){const t=new Headers;for(const[n,r]of Object.entries(e))if(!n.startsWith(":")&&void 0!==r)if("string"==typeof r)t.append(n,r);else if("number"==typeof r)t.append(n,String(r));else for(const e of r)t.append(n,e);return t}function Ml(e,t){if(void 0===e&&void 0===t)return;const n=/* @__PURE__ */Object.create(null);if(void 0!==t)if(Array.isArray(t))for(let r=0;r+1<t.length;r+=2){const e=t[r],s=t[r+1];Array.isArray(n[e])?n[e].push(s):"string"==typeof n[e]?n[e]=[n[e],s]:n[e]=s}else for(const[r,s]of Object.entries(t))Array.isArray(s)?n[r]=s.concat():void 0!==s&&(n[r]=s);if(void 0!==e)if(Array.isArray(e))for(const[r,s]of e)Kl(n,r,s);else if("forEach"in e)"function"==typeof e.forEach&&e.forEach((e,t)=>{Kl(n,t,e)});else for(const[r,s]of Object.entries(e))Kl(n,r,s);return n}function Kl(e,t,n){const r=e[t=t.toLowerCase()];Array.isArray(r)?r.push(n):e[t]=void 0===r?n:[r.toString(),n]}class zl{state(){return"ready"==this.s.t?void 0!==this.verifying?"verifying":this.s.streamCount()>0?"open":"idle":this.s.t}error(){if("error"==this.s.t)return this.s.reason}constructor(e,t,n){var r,s,i,o;this.s={t:"closed"},this.shuttingDown=[],this.authority=new URL(e).origin,this.http2SessionOptions=n,this.options={pingIntervalMs:null!==(r=null==t?void 0:t.pingIntervalMs)&&void 0!==r?r:Number.POSITIVE_INFINITY,pingTimeoutMs:null!==(s=null==t?void 0:t.pingTimeoutMs)&&void 0!==s?s:15e3,pingIdleConnection:null!==(i=null==t?void 0:t.pingIdleConnection)&&void 0!==i&&i,idleConnectionTimeoutMs:null!==(o=null==t?void 0:t.idleConnectionTimeoutMs)&&void 0!==o?o:9e5}}async connect(){try{return(await this.gotoReady()).streamCount()>0?"open":"idle"}catch(e){return"error"}}async request(e,t,n,r){for(;;){const i=await this.gotoReady();try{const s=i.conn.request(Object.assign(Object.assign({},n),{":method":e,":path":t}),r);return i.registerRequest(s),s}catch(s){if(i.conn.closed||i.conn.destroyed)continue;throw s}}}notifyResponseByteRead(e){"ready"==this.s.t&&this.s.responseByteRead(e);for(const t of this.shuttingDown)t.responseByteRead(e)}abort(e){var t,n,r;const s=null!=e?e:new Vc("connection aborted",ts.Canceled);null===(n=(t=this.s).abort)||void 0===n||n.call(t,s);for(const i of this.shuttingDown)null===(r=i.abort)||void 0===r||r.call(i,s);this.setState(Dl(s))}async gotoReady(){for("ready"==this.s.t?this.s.isShuttingDown()||this.s.conn.closed||this.s.conn.destroyed?this.setState(Ul(this.authority,this.http2SessionOptions)):this.s.requiresVerify()&&await this.verify(this.s):"closed"!=this.s.t&&"error"!=this.s.t||this.setState(Ul(this.authority,this.http2SessionOptions));"ready"!==this.s.t;){if("error"===this.s.t)throw this.s.reason;"connecting"===this.s.t&&await this.s.conn}return this.s}setState(e){var t,n;if(null===(n=(t=this.s).onExitState)||void 0===n||n.call(t),"ready"==this.s.t&&this.s.isShuttingDown()){const e=this.s;this.shuttingDown.push(e),e.onClose=e.onError=()=>{const t=this.shuttingDown.indexOf(e);-1!==t&&this.shuttingDown.splice(t,1)}}switch(e.t){case"connecting":e.conn.then(e=>{this.setState(function(e,t){(function(e){if(e.connecting)throw new Vc("expected open session, but it is connecting",ts.Internal);if(e.destroyed)throw new Vc("expected open session, but it is destroyed",ts.Internal);if(e.closed)throw new Vc("expected open session, but it is closed",ts.Internal)})(e),e.unref();let n,r,s,i=Date.now(),o=0,a=!1,c=!1;p();const l={t:"ready",conn:e,streamCount:()=>o,requiresVerify:()=>Date.now()-i>t.pingIntervalMs,isShuttingDown:()=>a,onClose:void 0,onError:void 0,registerRequest(t){o++,1==o&&(e.ref(),u(),m()),t.once("response",()=>{i=Date.now(),u()}),t.once("close",()=>{o--,0==o&&(e.unref(),u(),p())})},responseByteRead(t){t.session===e&&(e.closed||e.destroyed||o<=0||(i=Date.now(),u()))},verify:()=>(e.ref(),new Promise(t=>{const n=()=>{t(!1)};g(()=>{0==o&&e.unref(),e.off("error",n),t(!0)}),e.once("error",n)})),abort(t){e.destroyed||(e.once("error",()=>{}),e.destroy(t,E.constants.NGHTTP2_CANCEL))},onExitState(){l.isShuttingDown()||(w(),this.onError=void 0,this.onClose=void 0)}};function u(){d(),(o>0||t.pingIdleConnection)&&(n=Pl(h,t.pingIntervalMs))}function d(){clearTimeout(n),clearTimeout(r)}function h(){g(u)}function g(n){clearTimeout(r),r=Pl(()=>{e.destroy(new Vc("PING timed out",ts.Unavailable),E.constants.NGHTTP2_CANCEL)},t.pingTimeoutMs),e.ping((s,o)=>{clearTimeout(r),null===s&&(o>t.pingTimeoutMs?e.destroy(new Vc("PING timed out",ts.Unavailable),E.constants.NGHTTP2_CANCEL):(i=Date.now(),n()))})}function m(){clearTimeout(s)}function p(){s=Pl(f,t.idleConnectionTimeoutMs)}function f(){e.close(),b()}function y(n,r,s){if(n===E.constants.NGHTTP2_NO_ERROR&&0===o)return void e.destroy(new Vc("received GOAWAY without any open streams",ts.Canceled),E.constants.NGHTTP2_NO_ERROR);a=!0;const i=Buffer.from("too_many_pings","ascii");(null==s?void 0:s.equals(i))&&(t.pingIntervalMs=2*t.pingIntervalMs,c=!0)}function b(){var e;w(),null===(e=l.onClose)||void 0===e||e.call(l)}function I(e){var t,n;if(w(),c){const e=new Vc(`http/2 connection closed with error code ENHANCE_YOUR_CALM (0x${E.constants.NGHTTP2_ENHANCE_YOUR_CALM.toString(16)}), too_many_pings, doubled the interval`,ts.ResourceExhausted);null===(t=l.onError)||void 0===t||t.call(l,e)}else null===(n=l.onError)||void 0===n||n.call(l,Rl(e))}function w(){d(),m(),e.off("error",I),e.off("close",b),e.off("goaway",y)}return e.on("error",I),e.on("close",b),e.on("goaway",y),l}(e,this.options))},e=>{this.setState(Dl(e))});break;case"ready":e.onClose=()=>this.setState({t:"closed"}),e.onError=e=>this.setState(Dl(e))}this.s=e}verify(e){return void 0!==this.verifying||(this.verifying=e.verify().then(e=>{e||this.setState(Ul(this.authority,this.http2SessionOptions))},e=>{this.setState(Dl(e))}).finally(()=>{this.verifying=void 0})),this.verifying}}function Dl(e){return e instanceof Vc&&Vc.from(e).code==ts.Canceled?{t:"closed"}:function(e){return{t:"error",reason:e}}(e)}function Ul(e,t){let n,r;const s=new Promise((e,t)=>{n=e,r=t}),i=E.connect(e,t);function o(){null==n||n(i),c()}function a(e){null==r||r(Rl(e)),c()}function c(){i.off("connect",o),i.off("error",a)}return i.on("connect",o),i.on("error",a),{t:"connecting",conn:s,abort(e){i.destroyed||i.destroy(void 0,E.constants.NGHTTP2_CANCEL),null==r||r(e)},onExitState(){c()}}}function Pl(e,t){if(!(t>2147483647))return setTimeout(e,t).unref()}function jl(e){var t,n;if("1.1"==e.httpVersion)return n=e.nodeOptions,async function(e){const t=tu(e.signal);return new Promise((r,s)=>{t.onError(e=>{s(e)}),function(e,t,n,r){let s;s=new URL(t).protocol.startsWith("https")?V.request(t,n):S.request(t,n),e.onError(e=>s.destroy(e)),s.flushHeaders(),s.on("error",e.error),s.on("socket",function(e){function t(){e.off("connect",t),r(s)}"open"===e.readyState?r(s):e.on("connect",t)})}(t,e.url,Object.assign(Object.assign({},n),{headers:Ml(e.header,null==n?void 0:n.headers),method:e.method}),n=>{eu(e,n,t),n.on("response",e=>{var n;e.on("error",t.error),t.onError(t=>e.destroy(t));const s=new Headers;r({status:null!==(n=e.statusCode)&&void 0!==n?n:0,header:Hl(e.headers),body:Ql(t,e,s),trailer:s})})})})};return function(e){return function(t){const n=tu(t.signal),r=e(t.url);return new Promise((e,s)=>{n.onError(e=>{s(e)}),function(e,t,n,r,s,i,o){const a=new URL(n);if(a.origin!==t.authority){const n=`cannot make a request to ${a.origin}: the http2 session is connected to ${t.authority}`;return void e.error(new Vc(n,ts.Internal))}t.request(r,a.pathname+a.search,s,{}).then(t=>{e.onError(e=>{if(t.closed)return;const n=e.code==ts.Canceled?Zl.CANCEL:Zl.INTERNAL_ERROR;return new Promise(e=>t.close(n,e))}),t.on("error",function(n){t.writableEnded&&Wl(n).map(Nl).some(e=>"ERR_STREAM_WRITE_AFTER_END"==e.code)||e.error(n)}),t.on("close",function(){const n=function(e){switch(e){case Zl.PROTOCOL_ERROR:case Zl.INTERNAL_ERROR:case Zl.FLOW_CONTROL_ERROR:case Zl.SETTINGS_TIMEOUT:case Zl.FRAME_SIZE_ERROR:case Zl.COMPRESSION_ERROR:case Zl.CONNECT_ERROR:return new Vc(`http/2 stream closed with error code ${Zl[e]} (0x${e.toString(16)})`,ts.Internal);case Zl.REFUSED_STREAM:return new Vc(`http/2 stream closed with error code ${Zl[e]} (0x${e.toString(16)})`,ts.Unavailable);case Zl.CANCEL:return new Vc(`http/2 stream closed with error code ${Zl[e]} (0x${e.toString(16)})`,ts.Canceled);case Zl.ENHANCE_YOUR_CALM:return new Vc(`http/2 stream closed with error code ${Zl[e]} (0x${e.toString(16)})`,ts.ResourceExhausted);case Zl.INADEQUATE_SECURITY:case Zl.HTTP_1_1_REQUIRED:return new Vc(`http/2 stream closed with error code ${Zl[e]} (0x${e.toString(16)})`,ts.PermissionDenied)}}(t.rstCode);n&&e.error(n)}),o(t)},t=>{e.error(t)})}(n,r,t.url,t.method,Ml(t.header),0,s=>{eu(t,s,n),s.on("response",t=>{var i;const o={status:null!==(i=t[":status"])&&void 0!==i?i:0,header:Hl(t),body:ql(n,s,r),trailer:$l(s)};e(o)})})})}}(null!==(t=e.sessionProvider)&&void 0!==t?t:e=>new zl(e))}function Ql(e,t,n){const r=t[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({async next(){const s=await e.race(r.next());return!0===s.done&&(Hl(t.trailers).forEach((e,t)=>{n.set(t,e)}),e.close()),s},throw(t){throw e.error(t),t}})}}function $l(e){const t=new Headers;return e.on("trailers",e=>{Hl(e).forEach((e,n)=>{t.set(n,e)})}),t}function ql(e,t,n){const r=t[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({async next(){const s=await e.race(r.next());return!0===s.done&&e.close(),null==n||n.notifyResponseByteRead(t),s},throw(t){throw e.error(t),t}})}}async function eu(e,t,n){if(void 0===e.body)return void(await new Promise(e=>t.end(e)));const r=e.body[Symbol.asyncIterator]();return new Promise(e=>{!function s(){if(n.isClosed())return;r.next().then(i=>{!0!==i.done?t.write(i.value,"binary",e=>{null!=e?(void 0!==r.throw&&r.throw(Rl(e)).catch(()=>{}),t.writableEnded&&Wl(e).map(Nl).some(e=>"ERR_STREAM_WRITE_AFTER_END"==e.code)||n.error(e)):s()}):t.end(e)},e=>{n.error(e)})}()})}function tu(e){let t,n,r=!1,s=[];const i={error(e){if(!r){r=!0,n=e instanceof Vc?e:Rl(e),null==t||t(n);for(const e of s)e(n);o()}},close(){r||(r=!0,t&&t(new Vc("sentinel completed early",ts.Internal)),o())},isClosed:()=>r,onError(e){r?void 0!==n&&e(n):s.push(e)},race(e){let s;const i=new Promise((e,n)=>{s=e,t=n});return e.then(e=>{null==s||s(e)},e=>{null==t||t(e)}),r&&(null==t||t(null!=n?n:new Vc("sentinel completed early",ts.Internal))),i}};function o(){e&&e.removeEventListener("abort",a),s=[],t=void 0}function a(){i.error($c(this))}return e&&(e.addEventListener("abort",a),e.aborted&&i.error($c(e))),i}function nu(e){var t,n,r,s;let i;if("2"==e.httpVersion){let t;t=e.sessionManager?e.sessionManager:new zl(e.baseUrl,{pingIntervalMs:e.pingIntervalMs,pingIdleConnection:e.pingIdleConnection,pingTimeoutMs:e.pingTimeoutMs,idleConnectionTimeoutMs:e.idleConnectionTimeoutMs},e.nodeOptions),i=jl({httpVersion:"2",sessionProvider:()=>t})}else i=jl({httpVersion:"1.1",nodeOptions:e.nodeOptions});return Object.assign(Object.assign(Object.assign({},e),{httpClient:i,useBinaryFormat:null===(t=e.useBinaryFormat)||void 0===t||t,interceptors:null!==(n=e.interceptors)&&void 0!==n?n:[],sendCompression:null!==(r=e.sendCompression)&&void 0!==r?r:null,acceptCompression:null!==(s=e.acceptCompression)&&void 0!==s?s:[Yl,Ll]}),function(e,t,n){if(null!=t||(t=Bc),null!=e||(e=Xc),null!=n||(n=1024),t<1||t>Bc)throw new Vc(`writeMaxBytes ${t} must be >= 1 and <= 4294967295`,ts.Internal);if(e<1||e>Xc)throw new Vc(`readMaxBytes ${e} must be >= 1 and <= 4294967295`,ts.Internal);return{readMaxBytes:e,writeMaxBytes:t,compressMinBytes:n}}(e.readMaxBytes,e.writeMaxBytes,e.compressMinBytes))}const ru=/* @__PURE__ */Ea("ChtidWYvdmFsaWRhdGUvdmFsaWRhdGUucHJvdG8SDGJ1Zi52YWxpZGF0ZSI3CgRSdWxlEgoKAmlkGAEgASgJEg8KB21lc3NhZ2UYAiABKAkSEgoKZXhwcmVzc2lvbhgDIAEoCSKGAQoMTWVzc2FnZVJ1bGVzEhYKDmNlbF9leHByZXNzaW9uGAUgAygJEh8KA2NlbBgDIAMoCzISLmJ1Zi52YWxpZGF0ZS5SdWxlEi0KBW9uZW9mGAQgAygLMh4uYnVmLnZhbGlkYXRlLk1lc3NhZ2VPbmVvZlJ1bGVKBAgBEAJSCGRpc2FibGVkIjQKEE1lc3NhZ2VPbmVvZlJ1bGUSDgoGZmllbGRzGA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XJcVjHiAiBGbHV4bGF5XFdhbGxwYXBlclxWMVxHUEJNZXRhZGF0YeoCFkZsdXhsYXk6OldhbGxwYXBlcjo6VjFiBnByb3RvMw",[ru,/* @__PURE__ */Ea("Chtjb3JlL3YxL2J1Y2tldF9vYmplY3QucHJvdG8SB2NvcmUudjEiegoMQnVja2V0T2JqZWN0EhMKC29iamVjdF90eXBlGAEgASgJEhQKDGNvbnRlbnRfdHlwZRgCIAEoCRIKCgJpZBgDIAEoCRIMCgRuYW1lGAQgASgJEiUKBG1ldGEYBSABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0QowBCgtjb20uY29yZS52MUIRQnVja2V0T2JqZWN0UHJvdG9QAVotZ2l0aHViLmNvbS9rZW4xMDkvcHJvdG8vZ2VuL2dvL2NvcmUvdjE7Y29yZXYxogIDQ1hYqgIHQ29yZS5WMcoCB0NvcmVcVjHiAhNDb3JlXFYxXEdQQk1ldGFkYXRh6gIIQ29yZTo6VjFiBnByb3RvMw",[Ha]),Xa])]),1);function iu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}function ou(e,t,n,r){return new(n||(n=Promise))(function(s,i){function o(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}c((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class au extends Error{constructor(e,t="FunctionsError",n){super(e),this.name=t,this.context=n}}class cu extends au{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class lu extends au{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class uu extends au{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var du,hu;(hu=du||(du={})).Any="any",hu.ApNortheast1="ap-northeast-1",hu.ApNortheast2="ap-northeast-2",hu.ApSouth1="ap-south-1",hu.ApSoutheast1="ap-southeast-1",hu.ApSoutheast2="ap-southeast-2",hu.CaCentral1="ca-central-1",hu.EuCentral1="eu-central-1",hu.EuWest1="eu-west-1",hu.EuWest2="eu-west-2",hu.EuWest3="eu-west-3",hu.SaEast1="sa-east-1",hu.UsEast1="us-east-1",hu.UsWest1="us-west-1",hu.UsWest2="us-west-2";class gu{constructor(e,{headers:t={},customFetch:n,region:r=du.Any}={}){this.url=e,this.headers=t,this.region=r,this.fetch=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return ou(this,arguments,void 0,function*(e,t={}){var n;let r,s;try{const{headers:i,method:o,body:a,signal:c,timeout:l}=t;let u={},{region:d}=t;d||(d=this.region);const h=new URL(`${this.url}/${e}`);let g;d&&"any"!==d&&(u["x-region"]=d,h.searchParams.set("forceFunctionRegion",d)),a&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)?"undefined"!=typeof Blob&&a instanceof Blob||a instanceof ArrayBuffer?(u["Content-Type"]="application/octet-stream",g=a):"string"==typeof a?(u["Content-Type"]="text/plain",g=a):"undefined"!=typeof FormData&&a instanceof FormData?g=a:(u["Content-Type"]="application/json",g=JSON.stringify(a)):g=!a||"string"==typeof a||"undefined"!=typeof Blob&&a instanceof Blob||a instanceof ArrayBuffer||"undefined"!=typeof FormData&&a instanceof FormData?a:JSON.stringify(a);let m=c;l&&(s=new AbortController,r=setTimeout(()=>s.abort(),l),c?(m=s.signal,c.addEventListener("abort",()=>s.abort())):m=s.signal);const p=yield this.fetch(h.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},u),this.headers),i),body:g,signal:m}).catch(e=>{throw new cu(e)}),f=p.headers.get("x-relay-error");if(f&&"true"===f)throw new lu(p);if(!p.ok)throw new uu(p);let y,b=(null!==(n=p.headers.get("Content-Type"))&&void 0!==n?n:"text/plain").split(";")[0].trim();return y="application/json"===b?yield p.json():"application/octet-stream"===b||"application/pdf"===b?yield p.blob():"text/event-stream"===b?p:"multipart/form-data"===b?yield p.formData():yield p.text(),{data:y,error:null,response:p}}catch(i){return{data:null,error:i,response:i instanceof uu||i instanceof lu?i.context:void 0}}finally{r&&clearTimeout(r)}})}}var mu=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}},pu=class{constructor(e){var t,n,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(n=e.isMaybeSingle)&&void 0!==n&&n,this.urlLengthLimit=null!==(r=e.urlLengthLimit)&&void 0!==r?r:8e3,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){var n=this;void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("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=>{let t=null,r=null,s=null,i=e.status,o=e.statusText;if(e.ok){var a,c;if("HEAD"!==n.method){var l;const t=await e.text();""===t||(r="text/csv"===n.headers.get("Accept")||n.headers.get("Accept")&&(null===(l=n.headers.get("Accept"))||void 0===l?void 0:l.includes("application/vnd.pgrst.plan+text"))?t:JSON.parse(t))}const u=null===(a=n.headers.get("Prefer"))||void 0===a?void 0:a.match(/count=(exact|planned|estimated)/),d=null===(c=e.headers.get("content-range"))||void 0===c?void 0:c.split("/");u&&d&&d.length>1&&(s=parseInt(d[1])),n.isMaybeSingle&&"GET"===n.method&&Array.isArray(r)&&(r.length>1?(t={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,s=null,i=406,o="Not Acceptable"):r=1===r.length?r[0]:null)}else{var u;const s=await e.text();try{t=JSON.parse(s),Array.isArray(t)&&404===e.status&&(r=[],t=null,i=200,o="OK")}catch(d){404===e.status&&""===s?(i=204,o="No Content"):t={message:s}}if(t&&n.isMaybeSingle&&(null==t||null===(u=t.details)||void 0===u?void 0:u.includes("0 rows"))&&(t=null,i=200,o="OK"),t&&n.shouldThrowOnError)throw new mu(t)}return{error:t,data:r,count:s,status:i,statusText:o}});return this.shouldThrowOnError||(r=r.catch(e=>{var t;let n="",r="",s="";const i=null==e?void 0:e.cause;if(i){var o,a,c,l;const t=null!==(o=null==i?void 0:i.message)&&void 0!==o?o:"",r=null!==(a=null==i?void 0:i.code)&&void 0!==a?a:"";n=`${null!==(c=null==e?void 0:e.name)&&void 0!==c?c:"FetchError"}: ${null==e?void 0:e.message}`,n+=`\n\nCaused by: ${null!==(l=null==i?void 0:i.name)&&void 0!==l?l:"Error"}: ${t}`,r&&(n+=` (${r})`),(null==i?void 0:i.stack)&&(n+=`\n${i.stack}`)}else{var u;n=null!==(u=null==e?void 0:e.stack)&&void 0!==u?u:""}const d=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(s="",r="Request was aborted (timeout or manual cancellation)",d>this.urlLengthLimit&&(r+=`. Note: Your request URL is ${d} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(s="",r="HTTP headers exceeded server limits (typically 16KB)",d>this.urlLengthLimit&&(r+=`. Your request URL is ${d} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:n,hint:r,code:s},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}returns(){return this}overrideTypes(){return this}},fu=class extends pu{select(e){let t=!1;const n=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:s=r}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${void 0===n?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=void 0===n?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const s=void 0===r?"offset":`${r}.offset`,i=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return"GET"===this.method?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:s=!1,format:i="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=null!==(o=this.headers.get("Accept"))&&void 0!==o?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${c}"; options=${a};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const yu=/* @__PURE__ */new RegExp("[,()]");var bu=class extends fu{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}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(e=>"string"==typeof e&&yu.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(e=>"string"==typeof e&&yu.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),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:n,type:r}={}){let s="";"plain"===r?s="pl":"phrase"===r?s="ph":"websearch"===r&&(s="w");const i=void 0===n?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},Iu=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:s=8e3}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=s}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=null!=t?t:{},s=n?"HEAD":"GET";let i=!1;const o=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":('"'===e&&(i=!i),e)).join(""),{url:a,headers:c}=this.cloneRequestState();return a.searchParams.set("select",o),r&&c.append("Prefer",`count=${r}`),new bu({method:s,url:a,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const{url:s,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),n||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);s.searchParams.set("columns",e.join(","))}}return new bu({method:"POST",url:s,headers:i,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:s=!0}={}){var i;const{url:o,headers:a}=this.cloneRequestState();if(a.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),void 0!==t&&o.searchParams.set("on_conflict",t),r&&a.append("Prefer",`count=${r}`),s||a.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);o.searchParams.set("columns",e.join(","))}}return new bu({method:"POST",url:o,headers:a,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit})}update(e,{count:t}={}){var n;const{url:r,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new bu({method:"PATCH",url:r,headers:s,schema:this.schema,body:e,fetch:null!==(n=this.fetch)&&void 0!==n?n:fetch,urlLengthLimit:this.urlLengthLimit})}delete({count:e}={}){var t;const{url:n,headers:r}=this.cloneRequestState();return e&&r.append("Prefer",`count=${e}`),new bu({method:"DELETE",url:n,headers:r,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit})}};function wu(e){return(wu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function vu(e){var t=function(e,t){if("object"!=wu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=wu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==wu(t)?t:t+""}function Gu(e,t,n){return(t=vu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(t){Gu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Su=class e{constructor(e,{headers:t={},schema:n,fetch:r,timeout:s,urlLengthLimit:i=8e3}={}){this.url=e,this.headers=new Headers(t),this.schemaName=n,this.urlLengthLimit=i;const o=null!=r?r:globalThis.fetch;this.fetch=void 0!==s&&s>0?(e,t)=>{const n=new AbortController,r=setTimeout(()=>n.abort(),s),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(r),o(e,t);const s=()=>{clearTimeout(r),n.abort()};return i.addEventListener("abort",s,{once:!0}),o(e,Cu(Cu({},t),{},{signal:n.signal})).finally(()=>{clearTimeout(r),i.removeEventListener("abort",s)})}return o(e,Cu(Cu({},t),{},{signal:n.signal})).finally(()=>clearTimeout(r))}:o}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new Iu(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit})}rpc(e,t={},{head:n=!1,get:r=!1,count:s}={}){var i;let o;const a=new URL(`${this.url}/rpc/${e}`);let c;const l=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(l)),u=n&&Object.values(t).some(l);u?(o="POST",c=t):n||r?(o=n?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{a.searchParams.append(e,t)})):(o="POST",c=t);const d=new Headers(this.headers);return u?d.set("Prefer",s?`count=${s},return=minimal`:"return=minimal"):s&&d.set("Prefer",`count=${s}`),new bu({method:o,url:a,headers:d,schema:this.schemaName,body:c,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit})}};class Zu{constructor(){}static detectEnvironment(){var e;if("undefined"!=typeof WebSocket)return{type:"native",constructor:WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocket)return{type:"native",constructor:globalThis.WebSocket};if("undefined"!=typeof global&&void 0!==global.WebSocket)return{type:"native",constructor:global.WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocketPair&&void 0===globalThis.WebSocket)return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if("undefined"!=typeof globalThis&&globalThis.EdgeRuntime||"undefined"!=typeof navigator&&(null===(e=navigator.userAgent)||void 0===e?void 0:e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const t=globalThis.process;if(t){const e=t.versions;if(e&&e.node){const t=e.node,n=parseInt(t.replace(/^v/,"").split(".")[0]);return n>=22?void 0!==globalThis.WebSocket?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${n} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${n} detected without native WebSocket support.`,workaround:'For Node.js < 22, install "ws" package and provide it via the transport option:\nimport ws from "ws"\nnew RealtimeClient(url, { transport: ws })'}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=`\n\nSuggested solution: ${e.workaround}`),new Error(t)}static createWebSocket(e,t){return new(this.getWebSocketConstructor())(e,t)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}}const Vu="2.0.0",Eu=Vu,Xu=1e4;var Bu,xu,Ru,Wu,Nu,Ju,_u,ku,Fu,Yu,Lu;(xu=Bu||(Bu={}))[xu.connecting=0]="connecting",xu[xu.open=1]="open",xu[xu.closing=2]="closing",xu[xu.closed=3]="closed",(Wu=Ru||(Ru={})).closed="closed",Wu.errored="errored",Wu.joined="joined",Wu.joining="joining",Wu.leaving="leaving",(Ju=Nu||(Nu={})).close="phx_close",Ju.error="phx_error",Ju.join="phx_join",Ju.reply="phx_reply",Ju.leave="phx_leave",Ju.access_token="access_token",(_u||(_u={})).websocket="websocket",(Fu=ku||(ku={})).Connecting="connecting",Fu.Open="open",Fu.Closing="closing",Fu.Closed="closed";class Ou{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=e?e:[]}encode(e,t){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&"string"==typeof e.payload.event)return t(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var t;return this._isArrayBuffer(null===(t=e.payload)||void 0===t?void 0:t.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var t,n;const r=null!==(n=null===(t=e.payload)||void 0===t?void 0:t.payload)&&void 0!==n?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(e){var t,n;const r=null!==(n=null===(t=e.payload)||void 0===t?void 0:t.payload)&&void 0!==n?n:{},s=(new TextEncoder).encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,s)}_encodeUserBroadcastPush(e,t,n){var r,s;const i=e.topic,o=null!==(r=e.ref)&&void 0!==r?r:"",a=null!==(s=e.join_ref)&&void 0!==s?s:"",c=e.payload.event,l=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},u=0===Object.keys(l).length?"":JSON.stringify(l);if(a.length>255)throw new Error(`joinRef length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(i.length>255)throw new Error(`topic length ${i.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`metadata length ${u.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+a.length+o.length+i.length+c.length+u.length,h=new ArrayBuffer(this.HEADER_LENGTH+d);let g=new DataView(h),m=0;g.setUint8(m++,this.KINDS.userBroadcastPush),g.setUint8(m++,a.length),g.setUint8(m++,o.length),g.setUint8(m++,i.length),g.setUint8(m++,c.length),g.setUint8(m++,u.length),g.setUint8(m++,t),Array.from(a,e=>g.setUint8(m++,e.charCodeAt(0))),Array.from(o,e=>g.setUint8(m++,e.charCodeAt(0))),Array.from(i,e=>g.setUint8(m++,e.charCodeAt(0))),Array.from(c,e=>g.setUint8(m++,e.charCodeAt(0))),Array.from(u,e=>g.setUint8(m++,e.charCodeAt(0)));var p=new Uint8Array(h.byteLength+n.byteLength);return p.set(new Uint8Array(h),0),p.set(new Uint8Array(n),h.byteLength),p.buffer}decode(e,t){if(this._isArrayBuffer(e)){return t(this._binaryDecode(e))}if("string"==typeof e){const n=JSON.parse(e),[r,s,i,o,a]=n;return t({join_ref:r,ref:s,topic:i,event:o,payload:a})}return t({})}_binaryDecode(e){const t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;if(n===this.KINDS.userBroadcast)return this._decodeUserBroadcast(e,t,r)}_decodeUserBroadcast(e,t,n){const r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4);let a=this.HEADER_LENGTH+4;const c=n.decode(e.slice(a,a+r));a+=r;const l=n.decode(e.slice(a,a+s));a+=s;const u=n.decode(e.slice(a,a+i));a+=i;const d=e.slice(a,e.byteLength),h=o===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,g={type:this.BROADCAST_EVENT,event:l,payload:h};return i>0&&(g.meta=JSON.parse(u)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(e){var t;return e instanceof ArrayBuffer||"ArrayBuffer"===(null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.name)}_pick(e,t){return e&&"object"==typeof e?Object.fromEntries(Object.entries(e).filter(([e])=>t.includes(e))):{}}}class Tu{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}(Lu=Yu||(Yu={})).abstime="abstime",Lu.bool="bool",Lu.date="date",Lu.daterange="daterange",Lu.float4="float4",Lu.float8="float8",Lu.int2="int2",Lu.int4="int4",Lu.int4range="int4range",Lu.int8="int8",Lu.int8range="int8range",Lu.json="json",Lu.jsonb="jsonb",Lu.money="money",Lu.numeric="numeric",Lu.oid="oid",Lu.reltime="reltime",Lu.text="text",Lu.time="time",Lu.timestamp="timestamp",Lu.timestamptz="timestamptz",Lu.timetz="timetz",Lu.tsrange="tsrange",Lu.tstzrange="tstzrange";const Hu=(e,t,n={})=>{var r;const s=null!==(r=n.skipTypes)&&void 0!==r?r:[];return t?Object.keys(t).reduce((n,r)=>(n[r]=Mu(r,e,t,s),n),{}):{}},Mu=(e,t,n,r)=>{const s=t.find(t=>t.name===e),i=null==s?void 0:s.type,o=n[e];return i&&!r.includes(i)?Ku(i,o):zu(o)},Ku=(e,t)=>{if("_"===e.charAt(0)){const n=e.slice(1,e.length);return ju(t,n)}switch(e){case Yu.bool:return Du(t);case Yu.float4:case Yu.float8:case Yu.int2:case Yu.int4:case Yu.int8:case Yu.numeric:case Yu.oid:return Uu(t);case Yu.json:case Yu.jsonb:return Pu(t);case Yu.timestamp:return Qu(t);case Yu.abstime:case Yu.date:case Yu.daterange:case Yu.int4range:case Yu.int8range:case Yu.money:case Yu.reltime:case Yu.text:case Yu.time:case Yu.timestamptz:case Yu.timetz:case Yu.tsrange:case Yu.tstzrange:default:return zu(t)}},zu=e=>e,Du=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Uu=e=>{if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Pu=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}return e},ju=(e,t)=>{if("string"!=typeof e)return e;const n=e.length-1,r=e[n];if("{"===e[0]&&"}"===r){let r;const i=e.slice(1,n);try{r=JSON.parse("["+i+"]")}catch(s){r=i?i.split(","):[]}return r.map(e=>Ku(t,e))}return e},Qu=e=>"string"==typeof e?e.replace(" ","T"):e,$u=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),""===t.pathname||"/"===t.pathname?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class qu{constructor(e,t,n={},r=1e4){this.channel=e,this.event=t,this.payload=n,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var n;return this._hasReceived(e)&&t(null===(n=this.receivedResp)||void 0===n?void 0:n.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);this.channel._on(this.refEvent,{},e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var ed,td,nd,rd,sd,id,od,ad;(td=ed||(ed={})).SYNC="sync",td.JOIN="join",td.LEAVE="leave";class cd{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const n=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},e=>{const{onJoin:t,onLeave:n,onSync:r}=this.caller;this.joinRef=this.channel._joinRef(),this.state=cd.syncState(this.state,e,t,n),this.pendingDiffs.forEach(e=>{this.state=cd.syncDiff(this.state,e,t,n)}),this.pendingDiffs=[],r()}),this.channel._on(n.diff,{},e=>{const{onJoin:t,onLeave:n,onSync:r}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=cd.syncDiff(this.state,e,t,n),r())}),this.onJoin((e,t,n)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:n})}),this.onLeave((e,t,n)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:n})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,n,r){const s=this.cloneDeep(e),i=this.transformState(t),o={},a={};return this.map(s,(e,t)=>{i[e]||(a[e]=t)}),this.map(i,(e,t)=>{const n=s[e];if(n){const r=t.map(e=>e.presence_ref),s=n.map(e=>e.presence_ref),i=t.filter(e=>s.indexOf(e.presence_ref)<0),c=n.filter(e=>r.indexOf(e.presence_ref)<0);i.length>0&&(o[e]=i),c.length>0&&(a[e]=c)}else o[e]=t}),this.syncDiff(s,{joins:o,leaves:a},n,r)}static syncDiff(e,t,n,r){const{joins:s,leaves:i}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return n||(n=()=>{}),r||(r=()=>{}),this.map(s,(t,r)=>{var s;const i=null!==(s=e[t])&&void 0!==s?s:[];if(e[t]=this.cloneDeep(r),i.length>0){const n=e[t].map(e=>e.presence_ref),r=i.filter(e=>n.indexOf(e.presence_ref)<0);e[t].unshift(...r)}n(t,i,r)}),this.map(i,(t,n)=>{let s=e[t];if(!s)return;const i=n.map(e=>e.presence_ref);s=s.filter(e=>i.indexOf(e.presence_ref)<0),e[t]=s,r(t,s,n),0===s.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(n=>t(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,n)=>{const r=e[n];return t[n]="metas"in r?r.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):r,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}(rd=nd||(nd={})).ALL="*",rd.INSERT="INSERT",rd.UPDATE="UPDATE",rd.DELETE="DELETE",(id=sd||(sd={})).BROADCAST="broadcast",id.PRESENCE="presence",id.POSTGRES_CHANGES="postgres_changes",id.SYSTEM="system",(ad=od||(od={})).SUBSCRIBED="SUBSCRIBED",ad.TIMED_OUT="TIMED_OUT",ad.CLOSED="CLOSED",ad.CHANNEL_ERROR="CHANNEL_ERROR";class ld{constructor(e,t={config:{}},n){var r,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.state=Ru.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new qu(this,Nu.join,this.params,this.timeout),this.rejoinTimer=new Tu(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ru.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=Ru.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=Ru.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ru.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=Ru.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Nu.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new cd(this),this.broadcastEndpointURL=$u(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(r=this.params.config)||void 0===r?void 0:r.broadcast)||void 0===s?void 0:s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var n,r,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Ru.closed){const{config:{broadcast:i,presence:o,private:a}}=this.params,c=null!==(r=null===(n=this.bindings.postgres_changes)||void 0===n?void 0:n.map(e=>e.filter))&&void 0!==r?r:[],l=!!this.bindings[sd.PRESENCE]&&this.bindings[sd.PRESENCE].length>0||!0===(null===(s=this.params.config.presence)||void 0===s?void 0:s.enabled),u={},d={broadcast:i,presence:Object.assign(Object.assign({},o),{enabled:l}),postgres_changes:c,private:a};this.socket.accessTokenValue&&(u.access_token=this.socket.accessTokenValue),this._onError(t=>null==e?void 0:e(od.CHANNEL_ERROR,t)),this._onClose(()=>null==e?void 0:e(od.CLOSED)),this.updateJoinPayload(Object.assign({config:d},u)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:t})=>{var n;if(this.socket._isManualToken()||this.socket.setAuth(),void 0!==t){const r=this.bindings.postgres_changes,s=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,i=[];for(let n=0;n<s;n++){const s=r[n],{filter:{event:o,schema:a,table:c,filter:l}}=s,u=t&&t[n];if(!(u&&u.event===o&&ld.isFilterValueEqual(u.schema,a)&&ld.isFilterValueEqual(u.table,c)&&ld.isFilterValueEqual(u.filter,l)))return this.unsubscribe(),this.state=Ru.errored,void(null==e||e(od.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes")));i.push(Object.assign(Object.assign({},s),{id:u.id}))}return this.bindings.postgres_changes=i,void(e&&e(od.SUBSCRIBED))}null==e||e(od.SUBSCRIBED)}).receive("error",t=>{this.state=Ru.errored,null==e||e(od.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{null==e||e(od.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,n){return this.state===Ru.joined&&e===sd.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,t,n)}async httpSend(e,t,n={}){var r;if(null==t)return Promise.reject("Payload is required for httpSend()");const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const i={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,i,null!==(r=n.timeout)&&void 0!==r?r:this.timeout);if(202===o.status)return{success:!0};let a=o.statusText;try{const e=await o.json();a=e.error||e.message||a}catch(c){}return Promise.reject(new Error(a))}async send(e,t={}){var n,r;if(this._canPush()||"broadcast"!==e.type)return new Promise(n=>{var r,s,i;const o=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null===(i=null===(s=null===(r=this.params)||void 0===r?void 0:r.config)||void 0===s?void 0:s.broadcast)||void 0===i?void 0:i.ack)||n("ok"),o.receive("ok",()=>n("ok")),o.receive("error",()=>n("error")),o.receive("timeout",()=>n("timed out"))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(r=e.body)||void 0===r?void 0:r.cancel()),e.ok?"ok":"error"}catch(s){return"AbortError"===s.name?"timed out":"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ru.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Nu.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(r=>{n=new qu(this,Nu.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",{})}).finally(()=>{null==n||n.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ru.closed,this.bindings={}}async _fetchWithTimeout(e,t,n){const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(s),i}_push(e,t,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new qu(this,e,t,n);return this._canPush()?r.send():this._addToPushBuffer(r),r}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>100){const e=this.pushBuffer.shift();e&&(e.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload))}}_onMessage(e,t,n){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,n){var r,s;const i=e.toLocaleLowerCase(),{close:o,error:a,leave:c,join:l}=Nu;if(n&&[o,a,c,l].indexOf(i)>=0&&n!==this._joinRef())return;let u=this._onMessage(i,t,n);if(t&&!u)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(i)?null===(r=this.bindings.postgres_changes)||void 0===r||r.filter(e=>{var t,n,r;return"*"===(null===(t=e.filter)||void 0===t?void 0:t.event)||(null===(r=null===(n=e.filter)||void 0===n?void 0:n.event)||void 0===r?void 0:r.toLocaleLowerCase())===i}).map(e=>e.callback(u,n)):null===(s=this.bindings[i])||void 0===s||s.filter(e=>{var n,r,s,o,a,c;if(["broadcast","presence","postgres_changes"].includes(i)){if("id"in e){const i=e.id,o=null===(n=e.filter)||void 0===n?void 0:n.event;return i&&(null===(r=t.ids)||void 0===r?void 0:r.includes(i))&&("*"===o||(null==o?void 0:o.toLocaleLowerCase())===(null===(s=t.data)||void 0===s?void 0:s.type.toLocaleLowerCase()))}{const n=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"*"===n||n===(null===(c=null==t?void 0:t.event)||void 0===c?void 0:c.toLocaleLowerCase())}}return e.type.toLocaleLowerCase()===i}).map(e=>{if("object"==typeof u&&"ids"in u){const e=u.data,{schema:t,table:n,commit_timestamp:r,type:s,errors:i}=e,o={schema:t,table:n,commit_timestamp:r,eventType:s,new:{},old:{},errors:i};u=Object.assign(Object.assign({},o),this._getPayloadRecords(e))}e.callback(u,n)})}_isClosed(){return this.state===Ru.closed}_isJoined(){return this.state===Ru.joined}_isJoining(){return this.state===Ru.joining}_isLeaving(){return this.state===Ru.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,n){const r=e.toLocaleLowerCase(),s={type:r,filter:t,callback:n};return this.bindings[r]?this.bindings[r].push(s):this.bindings[r]=[s],this}_off(e,t){const n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(e=>{var r;return!((null===(r=e.type)||void 0===r?void 0:r.toLocaleLowerCase())===n&&ld.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Nu.close,{},e)}_onError(e){this._on(Nu.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ru.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return"INSERT"!==e.type&&"UPDATE"!==e.type||(t.new=Hu(e.columns,e.record)),"UPDATE"!==e.type&&"DELETE"!==e.type||(t.old=Hu(e.columns,e.old_record)),t}}const ud=()=>{},dd=25e3,hd=10,gd=100,md=[1e3,2e3,5e3,1e4];class pd{constructor(e,t){var n;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Xu,this.transport=null,this.heartbeatIntervalMs=dd,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=ud,this.ref=0,this.reconnectTimer=null,this.vsn=Eu,this.logger=ud,this.conn=null,this.sendBuffer=[],this.serializer=new Ou,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${_u.websocket}`,this.httpEndpoint=$u(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||null!==this.conn&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Zu.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const t=e.message;if(t.includes("Node.js"))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},"function"==typeof this.conn.close&&(e?this.conn.close(e,null!=t?t:""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,n){this.logger(e,t,n)}connectionState(){switch(this.conn&&this.conn.readyState){case Bu.connecting:return ku.Connecting;case Bu.open:return ku.Open;case Bu.closing:return ku.Closing;default:return ku.Closed}}isConnected(){return this.connectionState()===ku.Open}isConnecting(){return"connecting"===this._connectionState}isDisconnecting(){return"disconnecting"===this._connectionState}channel(e,t={config:{}}){const n=`realtime:${e}`,r=this.getChannels().find(e=>e.topic===n);if(r)return r;{const n=new ld(`realtime:${e}`,t,this);return this.channels.push(n),n}}push(e){const{topic:t,event:n,payload:r,ref:s}=e,i=()=>{this.encode(e,e=>{var t;null===(t=this.conn)||void 0===t||t.send(e)})};this.log("push",`${t} ${n} (${s})`,r),this.isConnected()?i():this.sendBuffer.push(i)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}return this._wasManualDisconnect=!1,null===(e=this.conn)||void 0===e||e.close(1e3,"heartbeat timeout"),void setTimeout(()=>{var e;this.isConnected()||null===(e=this.reconnectTimer)||void 0===e||e.scheduleTimeout()},gd)}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this._setAuthSafely("heartbeat")}else try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,e=>{if("phoenix"===e.topic&&"phx_reply"===e.event&&e.ref&&e.ref===this.pendingHeartbeatRef){const t=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback("ok"===e.payload.status?"ok":"error",t)}catch(a){this.log("error","error in heartbeat callback",a)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:t,event:n,payload:r,ref:s}=e,i=s?`(${s})`:"",o=r.status||"";this.log("receive",`${o} ${t} ${n} ${i}`.trim(),r),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(n,r,s)),this._triggerStateCallbacks("message",e)})}_clearTimer(e){var t;"heartbeat"===e&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):"reconnect"===e&&(null===(t=this.reconnectTimer)||void 0===t||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===Bu.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Bu.open||this.conn.readyState===Bu.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`);(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(e=>{this.log("error","error waiting for auth on connect",e),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this._terminateWorker()},this.workerRef.onmessage=e=>{"keepAlive"===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||null===(t=this.reconnectTimer)||void 0===t||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e);try{this.heartbeatCallback("error")}catch(t){this.log("error","error in heartbeat callback",t)}}_triggerChanError(){this.channels.forEach(e=>e._trigger(Nu.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;const n=e.match(/\?/)?"&":"?";return`${e}${n}${new URLSearchParams(t)}`}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(['\n addEventListener("message", (e) => {\n if (e.data.event === "start") {\n setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);\n }\n });'],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_setConnectionState(e,t=!1){this._connectionState=e,"connecting"===e?this._wasManualDisconnect=!1:"disconnecting"===e&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t,n=!1;if(e)t=e,n=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(r){this.log("error","Error fetching access token from callback",r),t=this.accessTokenValue}else t=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const n={access_token:t,version:"realtime-js/2.97.0"};t&&e.updateJoinPayload(n),e.joinedOnce&&e._isJoined()&&e._push(Nu.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log("error",`Error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(t)}catch(r){this.log("error",`error in ${e} callback`,r)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new Tu(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},hd)},this.reconnectAfterMs)}_initializeOptions(e){var t,n,r,s,i,o,a,c,l,u,d,h;switch(this.transport=null!==(t=null==e?void 0:e.transport)&&void 0!==t?t:null,this.timeout=null!==(n=null==e?void 0:e.timeout)&&void 0!==n?n:Xu,this.heartbeatIntervalMs=null!==(r=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==r?r:dd,this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(i=null==e?void 0:e.accessToken)&&void 0!==i?i:null,this.heartbeatCallback=null!==(o=null==e?void 0:e.heartbeatCallback)&&void 0!==o?o:ud,this.vsn=null!==(a=null==e?void 0:e.vsn)&&void 0!==a?a:Eu,(null==e?void 0:e.params)&&(this.params=e.params),(null==e?void 0:e.logger)&&(this.logger=e.logger),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=null!==(c=null==e?void 0:e.reconnectAfterMs)&&void 0!==c?c:e=>md[e-1]||1e4,this.vsn){case"1.0.0":this.encode=null!==(l=null==e?void 0:e.encode)&&void 0!==l?l:(e,t)=>t(JSON.stringify(e)),this.decode=null!==(u=null==e?void 0:e.decode)&&void 0!==u?u:(e,t)=>t(JSON.parse(e));break;case Vu:this.encode=null!==(d=null==e?void 0:e.encode)&&void 0!==d?d:this.serializer.encode.bind(this.serializer),this.decode=null!==(h=null==e?void 0:e.decode)&&void 0!==h?h:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if("undefined"!=typeof window&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl}}}var fd=class extends Error{constructor(e,t){super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown="CommitStateUnknownException"===t.icebergType||[500,502,504].includes(t.status)&&!0===t.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function yd(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:i,headers:o}){const a=function(e,t,n){const r=new URL(t,e);if(n)for(const[s,i]of Object.entries(n))void 0!==i&&r.searchParams.set(s,i);return r.toString()}(e.baseUrl,r,s),c=await async function(e){return e&&"none"!==e.type?"bearer"===e.type?{Authorization:`Bearer ${e.token}`}:"header"===e.type?{[e.name]:e.value}:"custom"===e.type?await e.getHeaders():{}:{}}(e.auth),l=await t(a,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...c,...o},body:i?JSON.stringify(i):void 0}),u=await l.text(),d=(l.headers.get("content-type")||"").includes("application/json"),h=d&&u?JSON.parse(u):u;if(!l.ok){const e=d?h:void 0,t=e?.error;throw new fd(t?.message??`Request failed with status ${l.status}`,{status:l.status,icebergType:t?.type,icebergCode:t?.code,details:e})}return{status:l.status,headers:l.headers,data:h}}}}function bd(e){return e.join("")}var Id=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:bd(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(e=>({namespace:e}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${bd(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${bd(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${bd(e.namespace)}`}),!0}catch(t){if(t instanceof fd&&404===t.status)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof fd&&409===n.status)return;throw n}}};function wd(e){return e.join("")}var vd=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${wd(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${wd(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${wd(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${wd(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${wd(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${wd(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof fd&&404===n.status)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof fd&&409===n.status)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Gd=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=yd({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new Id(this.client,t),this.tableOps=new vd(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}},Ad=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name="vectors"===t?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}};function Cd(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}var Sd=class extends Ad{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name="vectors"===r?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Zd=class extends Ad{constructor(e,t,n="storage"){super(e,n),this.name="vectors"===n?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};const Vd=e=>{if(Array.isArray(e))return e.map(e=>Vd(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,n])=>{const r=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[r]=Vd(n)}),t};function Ed(e){return(Ed="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Xd(e){var t=function(e,t){if("object"!=Ed(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=Ed(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Ed(t)?t:t+""}function Bd(e,t,n){return(t=Xd(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xd(Object(n),!0).forEach(function(t){Bd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const Wd=e=>{var t;return e.msg||e.message||e.error_description||("string"==typeof e.error?e.error:null===(t=e.error)||void 0===t?void 0:t.message)||JSON.stringify(e)},Nd=(e,t,n,r)=>{const s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&"HEAD"!==e&&r?((e=>{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)})(r)?(s.headers=Rd({"Content-Type":"application/json"},null==t?void 0:t.headers),s.body=JSON.stringify(r)):s.body=r,(null==t?void 0:t.duplex)&&(s.duplex=t.duplex),Rd(Rd({},s),n)):Rd(Rd({},s),n)};async function Jd(e,t,n,r,s,i,o){return new Promise((a,c)=>{e(n,Nd(t,r,s,i)).then(e=>{if(!e.ok)throw e;if(null==r?void 0:r.noResolveJson)return e;if("vectors"===o){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>a(e)).catch(e=>(async(e,t,n,r)=>{if(e&&"object"==typeof e&&"status"in e&&"ok"in e&&"number"==typeof e.status&&!(null==n?void 0:n.noResolveJson)){const n=e,s=n.status||500;if("function"==typeof n.json)n.json().then(e=>{const n=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||s+"";t(new Sd(Wd(e),s,n,r))}).catch(()=>{if("vectors"===r){const e=s+"";t(new Sd(n.statusText||`HTTP ${s} error`,s,e,r))}else{const e=s+"";t(new Sd(n.statusText||`HTTP ${s} error`,s,e,r))}});else{const e=s+"";t(new Sd(n.statusText||`HTTP ${s} error`,s,e,r))}}else t(new Zd(Wd(e),e,r))})(e,c,r,o))})}function _d(e="storage"){return{get:async(t,n,r,s)=>Jd(t,"GET",n,r,s,void 0,e),post:async(t,n,r,s,i)=>Jd(t,"POST",n,s,i,r,e),put:async(t,n,r,s,i)=>Jd(t,"PUT",n,s,i,r,e),head:async(t,n,r,s)=>Jd(t,"HEAD",n,Rd(Rd({},r),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,n,r,s,i)=>Jd(t,"DELETE",n,s,i,r,e)}}const kd=_d("storage"),{get:Fd,post:Yd,put:Ld,head:Od,remove:Td}=kd,Hd=_d("vectors");var Md=class{constructor(e,t={},n,r="storage"){var s;this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.fetch=(s=n)?(...e)=>s(...e):(...e)=>fetch(...e),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Rd(Rd({},this.headers),{},{[e]:t}),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Cd(t))return{data:null,error:t};throw t}}},Kd=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Cd(e))return{data:null,error:e};throw e}}};let zd;zd=Symbol.toStringTag;var Dd=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[zd]="BlobDownloadBuilder",this.promise=null}asStream(){return new Kd(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Cd(e))return{data:null,error:e};throw e}}};const Ud={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Pd={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var jd=class extends Md{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var s=this;return s.handleOperation(async()=>{let i;const o=Rd(Rd({},Pd),r);let a=Rd(Rd({},s.headers),"POST"===e&&{"x-upsert":String(o.upsert)});const c=o.metadata;"undefined"!=typeof Blob&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),c&&i.append("metadata",s.encodeMetadata(c)),i.append("",n)):"undefined"!=typeof FormData&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),c&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(c))):(i=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,c&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(c))),("undefined"!=typeof ReadableStream&&i instanceof ReadableStream||i&&"object"==typeof i&&"pipe"in i&&"function"==typeof i.pipe)&&!o.duplex&&(o.duplex="half")),(null==r?void 0:r.headers)&&(a=Rd(Rd({},a),r.headers));const l=s._removeEmptyFolders(t),u=s._getFinalPath(l),d=await("PUT"==e?Ld:Yd)(s.fetch,`${s.url}/object/${u}`,i,Rd({headers:a},(null==o?void 0:o.duplex)?{duplex:o.duplex}:{}));return{path:l,id:d.Id,fullPath:d.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var s=this;const i=s._removeEmptyFolders(e),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",t),s.handleOperation(async()=>{let e;const t=Rd({upsert:Pd.upsert},r),o=Rd(Rd({},s.headers),{"x-upsert":String(t.upsert)});return"undefined"!=typeof Blob&&n instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),e.append("",n)):"undefined"!=typeof FormData&&n instanceof FormData?(e=n,e.append("cacheControl",t.cacheControl)):(e=n,o["cache-control"]=`max-age=${t.cacheControl}`,o["content-type"]=t.contentType),{path:i,fullPath:(await Ld(s.fetch,a.toString(),e,{headers:o})).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const s=Rd({},n.headers);(null==t?void 0:t.upsert)&&(s["x-upsert"]="true");const i=await Yd(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(n.url+i.url),a=o.searchParams.get("token");if(!a)throw new Ad("No token returned by API");return{signedUrl:o.toString(),path:e,token:a}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await Yd(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==n?void 0:n.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await Yd(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==n?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e),i=await Yd(r.fetch,`${r.url}/object/sign/${s}`,Rd({expiresIn:t},(null==n?void 0:n.transform)?{transform:n.transform}:{}),{headers:r.headers});const o=(null==n?void 0:n.download)?`&download=${!0===n.download?"":n.download}`:"";return{signedUrl:encodeURI(`${r.url}${i.signedURL}${o}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const s=await Yd(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),i=(null==n?void 0:n.download)?`&download=${!0===n.download?"":n.download}`:"";return s.map(e=>Rd(Rd({},e),{},{signedUrl:e.signedURL?encodeURI(`${r.url}${e.signedURL}${i}`):null}))})}download(e,t,n){const r=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",s=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),i=s?`?${s}`:"",o=this._getFinalPath(e);return new Dd(()=>Fd(this.fetch,`${this.url}/${r}/${o}${i}`,{headers:this.headers,noResolveJson:!0},n),this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>Vd(await Fd(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await Od(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(Cd(r)&&r instanceof Zd){const e=r.originalError;if([400,404].includes(null==e?void 0:e.status))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=[],s=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==s&&r.push(s);const i=void 0!==(null==t?void 0:t.transform)?"render/image":"object",o=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==o&&r.push(o);let a=r.join("&");return""!==a&&(a=`?${a}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}${a}`)}}}async remove(e){var t=this;return t.handleOperation(async()=>await Td(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const s=Rd(Rd(Rd({},Ud),t),{},{prefix:e||""});return await Yd(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=Rd({},e);return await Yd(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}};const Qd={"X-Client-Info":"storage-js/2.97.0"};var $d=class extends Md{constructor(e,t={},n,r){const s=new URL(e);(null==r?void 0:r.useNewHostname)&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));super(s.href.replace(/\/$/,""),Rd(Rd({},Qd),t),n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await Fd(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Fd(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await Yd(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await Ld(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await Yd(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Td(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},qd=class extends Md{constructor(e,t={},n){super(e.replace(/\/$/,""),Rd(Rd({},Qd),t),n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Yd(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&n.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&n.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&n.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&n.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&n.set("search",e.search);const r=n.toString(),s=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await Fd(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Td(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!(e=>!(!e||"string"!=typeof e)&&!(0===e.length||e.length>100)&&e.trim()===e&&!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e))(e))throw new Ad("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new Gd({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const n=e[t];return"function"!=typeof n?n:async(...t)=>{try{return{data:await n.apply(e,t),error:null}}catch(s){if(r)throw s;return{data:null,error:s}}}}})}},eh=class extends Md{constructor(e,t={},n){super(e.replace(/\/$/,""),Rd(Rd({},Qd),{},{"Content-Type":"application/json"},t),n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await Hd.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await Hd.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},th=class extends Md{constructor(e,t={},n){super(e.replace(/\/$/,""),Rd(Rd({},Qd),{},{"Content-Type":"application/json"},t),n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},nh=class extends Md{constructor(e,t={},n){super(e.replace(/\/$/,""),Rd(Rd({},Qd),{},{"Content-Type":"application/json"},t),n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Hd.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},rh=class extends nh{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new sh(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},sh=class extends eh{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){return(()=>super.createIndex)().call(this,Rd(Rd({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,Rd(Rd({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new ih(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},ih=class extends th{constructor(e,t,n,r,s){super(e,t,s),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,Rd(Rd({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,Rd(Rd({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,Rd(Rd({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,Rd(Rd({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,Rd(Rd({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},oh=class extends $d{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new jd(this.url,this.headers,e,this.fetch)}get vectors(){return new rh(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new qd(this.url+"/iceberg",this.headers,this.fetch)}};const ah="2.97.0",ch=3e4,lh=9e4,uh={"X-Client-Info":`gotrue-js/${ah}`},dh="X-Supabase-Api-Version",hh={timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"},gh=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;class mh extends Error{constructor(e,t,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=n}}function ph(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class fh extends mh{constructor(e,t,n){super(e,t,n),this.name="AuthApiError",this.status=t,this.code=n}}class yh extends mh{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class bh extends mh{constructor(e,t,n,r){super(e,n,r),this.name=t,this.status=n}}class Ih extends bh{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function wh(e){return ph(e)&&"AuthSessionMissingError"===e.name}class vh extends bh{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Gh extends bh{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Ah extends bh{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 Ch extends bh{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 Sh extends bh{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Zh extends bh{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function Vh(e){return ph(e)&&"AuthRetryableFetchError"===e.name}class Eh extends bh{constructor(e,t,n){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=n}}class Xh extends bh{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Bh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),xh=" \t\n\r=".split(""),Rh=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<xh.length;t+=1)e[xh[t].charCodeAt(0)]=-2;for(let t=0;t<Bh.length;t+=1)e[Bh[t].charCodeAt(0)]=t;return e})();function Wh(e,t,n){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const e=t.queue>>t.queuedBits-6&63;n(Bh[e]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const e=t.queue>>t.queuedBits-6&63;n(Bh[e]),t.queuedBits-=6}}function Nh(e,t,n){const r=Rh[e];if(!(r>-1)){if(-2===r)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8}function Jh(e){const t=[],n=e=>{t.push(String.fromCodePoint(e))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=e=>{!function(e,t,n){if(0===t.utf8seq){if(e<=127)return void n(e);for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else{if(4!==t.utf8seq)throw new Error("Invalid UTF-8 sequence");t.codepoint=7&e}t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&n(t.codepoint)}}(e,r,n)};for(let o=0;o<e.length;o+=1)Nh(e.charCodeAt(o),s,i);return t.join("")}function _h(e,t){if(!(e<=127)){if(e<=2047)return t(192|e>>6),void t(128|63&e);if(e<=65535)return t(224|e>>12),t(128|e>>6&63),void t(128|63&e);if(e<=1114111)return t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),void t(128|63&e);throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}t(e)}function kh(e){const t=[],n={queue:0,queuedBits:0},r=e=>{t.push(e)};for(let s=0;s<e.length;s+=1)Nh(e.charCodeAt(s),n,r);return new Uint8Array(t)}function Fh(e){const t=[];return function(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const t=1024*(r-55296)&65535;r=65536+(e.charCodeAt(n+1)-56320&65535|t),n+=1}_h(r,t)}}(e,e=>t.push(e)),new Uint8Array(t)}function Yh(e){const t=[],n={queue:0,queuedBits:0},r=e=>{t.push(e)};return e.forEach(e=>Wh(e,n,r)),Wh(null,n,r),t.join("")}const Lh=()=>"undefined"!=typeof window&&"undefined"!=typeof document,Oh={tested:!1,writable:!1},Th=()=>{if(!Lh())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(t){return!1}if(Oh.tested)return Oh.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Oh.tested=!0,Oh.writable=!0}catch(t){Oh.tested=!0,Oh.writable=!1}return Oh.writable};const Hh=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),Mh=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Kh=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(r){return n}},zh=async(e,t)=>{await e.removeItem(t)};class Dh{constructor(){this.promise=new Dh.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function Uh(e){const t=e.split(".");if(3!==t.length)throw new Xh("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!gh.test(t[n]))throw new Xh("JWT not in base64url format");return{header:JSON.parse(Jh(t[0])),payload:JSON.parse(Jh(t[1])),signature:kh(t[2]),raw:{header:t[0],payload:t[1]}}}function Ph(e){return("0"+e.toString(16)).substr(-2)}async function jh(e){if(!("undefined"!=typeof crypto&&void 0!==crypto.subtle&&"undefined"!=typeof TextEncoder))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const t=await async function(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest("SHA-256",t),r=new Uint8Array(n);return Array.from(r).map(e=>String.fromCharCode(e)).join("")}(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Qh(e,t,n=!1){const r=function(){const e=new Uint32Array(56);if("undefined"==typeof crypto){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length;let n="";for(let r=0;r<56;r++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,Ph).join("")}();let s=r;n&&(s+="/PASSWORD_RECOVERY"),await Mh(e,`${t}-code-verifier`,s);const i=await jh(r);return[i,r===i?"plain":"s256"]}Dh.promiseConstructor=Promise;const $h=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const qh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function eg(e){if(!qh.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function tg(){return new Proxy({},{get:(e,t)=>{if("__isUserNotAvailableProxy"===t)return!0;if("symbol"==typeof t){const e=t.toString();if("Symbol(Symbol.toPrimitive)"===e||"Symbol(Symbol.toStringTag)"===e||"Symbol(util.inspect.custom)"===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function ng(e){return JSON.parse(JSON.stringify(e))}const rg=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),sg=[502,503,504];async function ig(e){var t,n;if(!("object"==typeof(n=e)&&null!==n&&"status"in n&&"ok"in n&&"json"in n&&"function"==typeof n.json))throw new Zh(rg(e),0);if(sg.includes(e.status))throw new Zh(rg(e),e.status);let r,s;try{r=await e.json()}catch(o){throw new yh(rg(o),o)}const i=function(e){const t=e.headers.get(dh);if(!t)return null;if(!t.match($h))return null;try{/* @__PURE__ */
|
|
3
|
-
return new Date(`${t}T00:00:00.0Z`)}catch(o){return null}}(e);if(i&&i.getTime()>=hh.timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?s=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(s=r.error_code),s){if("weak_password"===s)throw new Eh(rg(r),e.status,(null===(t=r.weak_password)||void 0===t?void 0:t.reasons)||[]);if("session_not_found"===s)throw new Ih}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 Eh(rg(r),e.status,r.weak_password.reasons);throw new fh(rg(r),e.status||500,s)}async function og(e,t,n,r){var s;const i=Object.assign({},null==r?void 0:r.headers);i[dh]||(i[dh]=hh.name),(null==r?void 0:r.jwt)&&(i.Authorization=`Bearer ${r.jwt}`);const o=null!==(s=null==r?void 0:r.query)&&void 0!==s?s:{};(null==r?void 0:r.redirectTo)&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await async function(e,t,n,r,s,i){const o=((e,t,n,r)=>{const s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))})(t,r,s,i);let a;try{a=await e(n,Object.assign({},o))}catch(c){throw console.error(c),new Zh(rg(c),0)}a.ok||await ig(a);if(null==r?void 0:r.noResolveJson)return a;try{return await a.json()}catch(c){await ig(c)}}(e,t,n+a,{headers:i,noResolveJson:null==r?void 0:r.noResolveJson},{},null==r?void 0:r.body);return(null==r?void 0:r.xform)?null==r?void 0:r.xform(c):{data:Object.assign({},c),error:null}}function ag(e){var t;let n=null;var r;(function(e){return e.access_token&&e.refresh_token&&e.expires_in})(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:n,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function cg(e){const t=ag(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 lg(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function ug(e){return{data:e,error:null}}function dg(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=e,o=iu(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]);return{data:{properties:{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},user:Object.assign({},o)},error:null}}function hg(e){return e}const gg=["global","local","others"];class mg{constructor({url:e="",headers:t={},fetch:n}){this.url=e,this.headers=t,this.fetch=Hh(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,t=gg[0]){if(gg.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${gg.join(", ")}`);try{return await og(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ph(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,t={}){try{return await og(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:lg})}catch(n){if(ph(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:t}=e,n=iu(e,["options"]),r=Object.assign(Object.assign({},n),t);return"newEmail"in n&&(r.new_email=null==n?void 0:n.newEmail,delete r.newEmail),await og(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:dg,redirectTo:null==t?void 0:t.redirectTo})}catch(t){if(ph(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await og(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:lg})}catch(t){if(ph(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,n,r,s,i,o,a;try{const c={nextPage:null,lastPage:0,total:0},l=await og(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(n=null===(t=null==e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",per_page:null!==(s=null===(r=null==e?void 0:e.perPage)||void 0===r?void 0:r.toString())&&void 0!==s?s:""},xform:hg});if(l.error)throw l.error;const u=await l.json(),d=null!==(i=l.headers.get("x-total-count"))&&void 0!==i?i:0,h=null!==(a=null===(o=l.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return h.length>0&&(h.forEach(e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),n=JSON.parse(e.split(";")[1].split("=")[1]);c[`${n}Page`]=t}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},u),c),error:null}}catch(c){if(ph(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){eg(e);try{return await og(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:lg})}catch(t){if(ph(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){eg(e);try{return await og(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:lg})}catch(n){if(ph(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,t=!1){eg(e);try{return await og(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:lg})}catch(n){if(ph(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){eg(e.userId);try{const{data:t,error:n}=await og(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:n}}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _deleteFactor(e){eg(e.userId),eg(e.id);try{return{data:await og(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _listOAuthClients(e){var t,n,r,s,i,o,a;try{const c={nextPage:null,lastPage:0,total:0},l=await og(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(n=null===(t=null==e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",per_page:null!==(s=null===(r=null==e?void 0:e.perPage)||void 0===r?void 0:r.toString())&&void 0!==s?s:""},xform:hg});if(l.error)throw l.error;const u=await l.json(),d=null!==(i=l.headers.get("x-total-count"))&&void 0!==i?i:0,h=null!==(a=null===(o=l.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return h.length>0&&(h.forEach(e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),n=JSON.parse(e.split(";")[1].split("=")[1]);c[`${n}Page`]=t}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},u),c),error:null}}catch(c){if(ph(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await og(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _getOAuthClient(e){try{return await og(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _updateOAuthClient(e,t){try{return await og(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(n){if(ph(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await og(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(e){try{return await og(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(ph(t))return{data:null,error:t};throw t}}}function pg(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const fg=!!(globalThis&&Th()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"));class yg extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class bg extends yg{}async function Ig(e,t,n){fg&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;t>0&&setTimeout(()=>{r.abort(),fg&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async r=>{if(!r){if(0===t)throw fg&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new bg(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(fg)try{const e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null," "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}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 n()}fg&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,r.name);try{return await n()}finally{fg&&console.log("@supabase/gotrue-js: navigatorLock: released",e,r.name)}})}catch(s){if("AbortError"===(null==s?void 0:s.name))throw new bg(`Acquiring an exclusive Navigator LockManager lock "${e}" timed out waiting ${t}ms`);throw s}}function wg(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function vg(e){const t=(new TextEncoder).encode(e);return"0x"+Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}class Gg extends Error{constructor({message:e,code:t,cause:n,name:r}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=null!==(s=null!=r?r:n instanceof Error?n.name:void 0)&&void 0!==s?s:"Unknown Error",this.code=t}}class Ag extends Gg{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}function Cg({error:e,options:t}){var n,r,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new Gg({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if(!0===(null===(n=i.authenticatorSelection)||void 0===n?void 0:n.requireResidentKey))return new Gg({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if("conditional"===t.mediation&&"required"===(null===(r=i.authenticatorSelection)||void 0===r?void 0:r.userVerification))return new Gg({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if("required"===(null===(s=i.authenticatorSelection)||void 0===s?void 0:s.userVerification))return new Gg({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if("InvalidStateError"===e.name)return new Gg({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if("NotAllowedError"===e.name)return new Gg({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("NotSupportedError"===e.name){return 0===i.pubKeyCredParams.filter(e=>"public-key"===e.type).length?new Gg({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Gg({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e})}if("SecurityError"===e.name){const t=window.location.hostname;if(!xg(t))return new Gg({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(i.rp.id!==t)return new Gg({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Gg({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new Gg({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Gg({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Sg({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new Gg({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if("NotAllowedError"===e.name)return new Gg({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("SecurityError"===e.name){const t=window.location.hostname;if(!xg(t))return new Gg({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(n.rpId!==t)return new Gg({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new Gg({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Gg({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}const Zg=new class{createNewAbortSignal(){if(this.controller){const e=new Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};function Vg(e){if(!e)throw new Error("Credential creation options are required");if("undefined"!=typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,s=iu(e,["challenge","user","excludeCredentials"]),i=kh(t).buffer,o=Object.assign(Object.assign({},n),{id:kh(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let e=0;e<r.length;e++){const t=r[e];a.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:kh(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return a}function Eg(e){if(!e)throw new Error("Credential request options are required");if("undefined"!=typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=iu(e,["challenge","allowCredentials"]),s=kh(t).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let e=0;e<n.length;e++){const t=n[e];i.allowCredentials[e]=Object.assign(Object.assign({},t),{id:kh(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return i}function Xg(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:Yh(new Uint8Array(e.response.attestationObject)),clientDataJSON:Yh(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:null!==(t=n.authenticatorAttachment)&&void 0!==t?t:void 0}}function Bg(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Yh(new Uint8Array(s.authenticatorData)),clientDataJSON:Yh(new Uint8Array(s.clientDataJSON)),signature:Yh(new Uint8Array(s.signature)),userHandle:s.userHandle?Yh(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!==(t=n.authenticatorAttachment)&&void 0!==t?t:void 0}}function xg(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Rg(){var e,t;return!!(Lh()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null===(e=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===e?void 0:e.create)&&"function"==typeof(null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.get))}const Wg={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Ng={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Jg(...e){const t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),r={};for(const s of e)if(s)for(const e in s){const i=s[e];if(void 0!==i)if(Array.isArray(i))r[e]=i;else if(n(i))r[e]=i;else if(t(i)){const n=r[e];t(n)?r[e]=Jg(n,i):r[e]=Jg(i)}else r[e]=i}return r}class _g{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:n,signal:r},s){var i;try{const{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!o)return{data:null,error:a};const c=null!=r?r:Zg.createNewAbortSignal();if("create"===o.webauthn.type){const{user:e}=o.webauthn.credential_options.publicKey;if(!e.name){const t=n;if(t)e.name=`${e.id}:${t}`;else{const t=(await this.client.getUser()).data.user,n=(null===(i=null==t?void 0:t.user_metadata)||void 0===i?void 0:i.name)||(null==t?void 0:t.email)||(null==t?void 0:t.id)||"User";e.name=`${e.id}:${n}`}}e.displayName||(e.displayName=e.name)}switch(o.webauthn.type){case"create":{const t=function(e,t){return Jg(Wg,e,t||{})}(o.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:n,error:r}=await async function(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Ag("Browser returned unexpected credential type",t)}:{data:null,error:new Ag("Empty credential response",t)}}catch(t){return{data:null,error:Cg({error:t,options:e})}}}({publicKey:t,signal:c});return n?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:n}},error:null}:{data:null,error:r}}case"request":{const t=function(e,t){return Jg(Ng,e,t||{})}(o.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:n,error:r}=await async function(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Ag("Browser returned unexpected credential type",t)}:{data:null,error:new Ag("Empty credential response",t)}}catch(t){return{data:null,error:Sg({error:t,options:e})}}}(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:t,signal:c}));return n?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:n}},error:null}:{data:null,error:r}}}}catch(o){return ph(o)?{data:null,error:o}:{data:null,error:new yh("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:t,webauthn:n}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:t=("undefined"!=typeof window?window.location.hostname:void 0),rpOrigins:n=("undefined"!=typeof window?[window.location.origin]:void 0),signal:r}={}},s){if(!t)return{data:null,error:new mh("rpId is required for WebAuthn authentication")};try{if(!Rg())return{data:null,error:new yh("Browser does not support WebAuthn",null)};const{data:i,error:o}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:n},signal:r},{request:s});if(!i)return{data:null,error:o};const{webauthn:a}=i;return this._verify({factorId:e,challengeId:i.challengeId,webauthn:{type:a.type,rpId:t,rpOrigins:n,credential_response:a.credential_response}})}catch(i){return ph(i)?{data:null,error:i}:{data:null,error:new yh("Unexpected error in authenticate",i)}}}async _register({friendlyName:e,webauthn:{rpId:t=("undefined"!=typeof window?window.location.hostname:void 0),rpOrigins:n=("undefined"!=typeof window?[window.location.origin]:void 0),signal:r}={}},s){if(!t)return{data:null,error:new mh("rpId is required for WebAuthn registration")};try{if(!Rg())return{data:null,error:new yh("Browser does not support WebAuthn",null)};const{data:i,error:o}=await this._enroll({friendlyName:e});if(!i)return await this.client.mfa.listFactors().then(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n.all.find(t=>"webauthn"===t.factor_type&&t.friendly_name===e&&"unverified"!==t.status)}).then(e=>e?this.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0),{data:null,error:o};const{data:a,error:c}=await this._challenge({factorId:i.id,friendlyName:i.friendly_name,webauthn:{rpId:t,rpOrigins:n},signal:r},{create:s});return a?this._verify({factorId:i.id,challengeId:a.challengeId,webauthn:{rpId:t,rpOrigins:n,type:a.webauthn.type,credential_response:a.webauthn.credential_response}}):{data:null,error:c}}catch(i){return ph(i)?{data:null,error:i}:{data:null,error:new yh("Unexpected error in register",i)}}}}!function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}}();const kg={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:uh,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4,skipAutoInitialize:!1};async function Fg(e,t,n){return await n()}const Yg={};class Lg{get jwks(){var e,t;return null!==(t=null===(e=Yg[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){Yg[this.storageKey]=Object.assign(Object.assign({},Yg[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=Yg[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Yg[this.storageKey]=Object.assign(Object.assign({},Yg[this.storageKey]),{cachedAt:e})}constructor(e){var t,n,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=/* @__PURE__ */new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=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;const s=Object.assign(Object.assign({},kg),e);if(this.storageKey=s.storageKey,this.instanceID=null!==(t=Lg.nextInstanceID[this.storageKey])&&void 0!==t?t:0,Lg.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,"function"==typeof s.debug&&(this.logger=s.debug),this.instanceID>0&&Lh()){const e=`${this._logPrefix()} 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.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new mg({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=Hh(s.fetch),this.lock=s.lock||Fg,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,s.lock?this.lock=s.lock:this.persistSession&&Lh()&&(null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===n?void 0:n.locks)?this.lock=Ig:this.lock=Fg,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new _g(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:Th()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=pg(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=pg(this.memoryStorage)),Lh()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(t){this._debug("#broadcastChannel","error",t)}})}s.skipAutoInitialize||this.initialize().catch(e=>{this._debug("#initialize()","error",e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${ah}) ${/* @__PURE__ */(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){var e;try{let t={},n="none";if(Lh()&&(t=function(e){const t={},n=new URL(e);if(n.hash&&"#"===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(r){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t}(window.location.href),this._isImplicitGrantCallback(t)?n="implicit":await this._isPKCECallback(t)&&(n="pkce")),Lh()&&this.detectSessionInUrl&&"none"!==n){const{data:r,error:s}=await this._getSessionFromURL(t,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),function(e){return ph(e)&&"AuthImplicitGrantRedirectError"===e.name}(s)){const t=null===(e=s.details)||void 0===e?void 0:e.code;if("identity_already_exists"===t||"identity_not_found"===t||"single_identity_not_deletable"===t)return{error:s}}return{error:s}}const{session:i,redirectType:o}=r;return this._debug("#_initialize()","detected session in URL",i,"redirect type",o),await this._saveSession(i),setTimeout(async()=>{"recovery"===o?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return ph(t)?this._returnResult({error:t}):this._returnResult({error:new yh("Unexpected error during initialization",t)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,n,r;try{const s=await og(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!==(n=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==n?n:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:ag}),{data:i,error:o}=s;if(o||!i)return this._returnResult({data:{user:null,session:null},error:o});const a=i.session,c=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",a)),this._returnResult({data:{user:c,session:a},error:null})}catch(s){if(ph(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var t,n,r;try{let s;if("email"in e){const{email:n,password:r,options:i}=e;let o=null,a=null;"pkce"===this.flowType&&([o,a]=await Qh(this.storage,this.storageKey)),s=await og(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==i?void 0:i.emailRedirectTo,body:{email:n,password:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:o,code_challenge_method:a},xform:ag})}else{if(!("phone"in e))throw new Gh("You must provide either an email or phone number and a password");{const{phone:t,password:i,options:o}=e;s=await og(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:i,data:null!==(n=null==o?void 0:o.data)&&void 0!==n?n:{},channel:null!==(r=null==o?void 0:o.channel)&&void 0!==r?r:"sms",gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}},xform:ag})}}const{data:i,error:o}=s;if(o||!i)return await zh(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const a=i.session,c=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",a)),this._returnResult({data:{user:c,session:a},error:null})}catch(s){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let t;if("email"in e){const{email:n,password:r,options:s}=e;t=await og(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:n,password:r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:cg})}else{if(!("phone"in e))throw new Gh("You must provide either an email or phone number and a password");{const{phone:n,password:r,options:s}=e;t=await og(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:n,password:r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:cg})}}const{data:n,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!n||!n.session||!n.user){const e=new vh;return this._returnResult({data:{user:null,session:null},error:e})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:r})}catch(t){if(ph(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOAuth(e){var t,n,r,s;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(n=e.options)||void 0===n?void 0:n.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(s=e.options)||void 0===s?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,n,r,s,i,o,a,c,l,u,d;let h,g;if("message"in e)h=e.message,g=e.signature;else{const{chain:u,wallet:d,statement:m,options:p}=e;let f;if(Lh())if("object"==typeof d)f=d;else{const e=window;if(!("ethereum"in e)||"object"!=typeof e.ethereum||!("request"in e.ethereum)||"function"!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if("object"!=typeof d||!(null==p?void 0:p.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");f=d}const y=new URL(null!==(t=null==p?void 0:p.url)&&void 0!==t?t:window.location.href),b=await f.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const I=wg(b[0]);let w=null===(n=null==p?void 0:p.signInWithEthereum)||void 0===n?void 0:n.chainId;if(!w){const e=await f.request({method:"eth_chainId"});w=parseInt(e,16)}h=function(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=/* @__PURE__ */new Date,nonce:o,notBefore:a,requestId:c,resources:l,scheme:u,uri:d,version:h}=e;if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==h)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(null===(t=e.statement)||void 0===t?void 0:t.includes("\n"))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);const g=`${u?`${u}://${r}`:r} wants you to sign in with your Ethereum account:\n${wg(e.address)}\n\n${e.statement?`${e.statement}\n`:""}`;let m=`URI: ${d}\nVersion: ${h}\nChain ID: ${n}${o?`\nNonce: ${o}`:""}\nIssued At: ${i.toISOString()}`;if(s&&(m+=`\nExpiration Time: ${s.toISOString()}`),a&&(m+=`\nNot Before: ${a.toISOString()}`),c&&(m+=`\nRequest ID: ${c}`),l){let e="\nResources:";for(const t of l){if(!t||"string"!=typeof t)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=`\n- ${t}`}m+=e}return`${g}\n${m}`}({domain:y.host,address:I,statement:m,uri:y.href,version:"1",chainId:w,nonce:null===(r=null==p?void 0:p.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(i=null===(s=null==p?void 0:p.signInWithEthereum)||void 0===s?void 0:s.issuedAt)&&void 0!==i?i:/* @__PURE__ */new Date,expirationTime:null===(o=null==p?void 0:p.signInWithEthereum)||void 0===o?void 0:o.expirationTime,notBefore:null===(a=null==p?void 0:p.signInWithEthereum)||void 0===a?void 0:a.notBefore,requestId:null===(c=null==p?void 0:p.signInWithEthereum)||void 0===c?void 0:c.requestId,resources:null===(l=null==p?void 0:p.signInWithEthereum)||void 0===l?void 0:l.resources}),g=await f.request({method:"personal_sign",params:[vg(h),I]})}try{const{data:t,error:n}=await og(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:g},(null===(u=e.options)||void 0===u?void 0:u.captchaToken)?{gotrue_meta_security:{captcha_token:null===(d=e.options)||void 0===d?void 0:d.captchaToken}}:null),xform:ag});if(n)throw n;if(!t||!t.session||!t.user){const e=new vh;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:n})}catch(m){if(ph(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(e){var t,n,r,s,i,o,a,c,l,u,d,h;let g,m;if("message"in e)g=e.message,m=e.signature;else{const{chain:d,wallet:h,statement:p,options:f}=e;let y;if(Lh())if("object"==typeof h)y=h;else{const e=window;if(!("solana"in e)||"object"!=typeof e.solana||!("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");y=e.solana}else{if("object"!=typeof h||!(null==f?void 0:f.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");y=h}const b=new URL(null!==(t=null==f?void 0:f.url)&&void 0!==t?t:window.location.href);if("signIn"in y&&y.signIn){const e=await y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:/* @__PURE__ */(new Date).toISOString()},null==f?void 0:f.signInWithSolana),{version:"1",domain:b.host,uri:b.href}),p?{statement:p}:null));let t;if(Array.isArray(e)&&e[0]&&"object"==typeof e[0])t=e[0];else{if(!(e&&"object"==typeof e&&"signedMessage"in e&&"signature"in e))throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");t=e}if(!("signedMessage"in t&&"signature"in t&&("string"==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields");g="string"==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),m=t.signature}else{if(!("signMessage"in y&&"function"==typeof y.signMessage&&"publicKey"in y&&"object"==typeof y&&y.publicKey&&"toBase58"in y.publicKey&&"function"==typeof y.publicKey.toBase58))throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${b.host} wants you to sign in with your Solana account:`,y.publicKey.toBase58(),...p?["",p,""]:[""],"Version: 1",`URI: ${b.href}`,`Issued At: ${null!==(r=null===(n=null==f?void 0:f.signInWithSolana)||void 0===n?void 0:n.issuedAt)&&void 0!==r?r:/* @__PURE__ */(new Date).toISOString()}`,...(null===(s=null==f?void 0:f.signInWithSolana)||void 0===s?void 0:s.notBefore)?[`Not Before: ${f.signInWithSolana.notBefore}`]:[],...(null===(i=null==f?void 0:f.signInWithSolana)||void 0===i?void 0:i.expirationTime)?[`Expiration Time: ${f.signInWithSolana.expirationTime}`]:[],...(null===(o=null==f?void 0:f.signInWithSolana)||void 0===o?void 0:o.chainId)?[`Chain ID: ${f.signInWithSolana.chainId}`]:[],...(null===(a=null==f?void 0:f.signInWithSolana)||void 0===a?void 0:a.nonce)?[`Nonce: ${f.signInWithSolana.nonce}`]:[],...(null===(c=null==f?void 0:f.signInWithSolana)||void 0===c?void 0:c.requestId)?[`Request ID: ${f.signInWithSolana.requestId}`]:[],...(null===(u=null===(l=null==f?void 0:f.signInWithSolana)||void 0===l?void 0:l.resources)||void 0===u?void 0:u.length)?["Resources",...f.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");const e=await y.signMessage((new TextEncoder).encode(g),"utf8");if(!(e&&e instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=e}}try{const{data:t,error:n}=await og(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:Yh(m)},(null===(d=e.options)||void 0===d?void 0:d.captchaToken)?{gotrue_meta_security:{captcha_token:null===(h=e.options)||void 0===h?void 0:h.captchaToken}}:null),xform:ag});if(n)throw n;if(!t||!t.session||!t.user){const e=new vh;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:n})}catch(p){if(ph(p))return this._returnResult({data:{user:null,session:null},error:p});throw p}}async _exchangeCodeForSession(e){const t=await Kh(this.storage,`${this.storageKey}-code-verifier`),[n,r]=(null!=t?t:"").split("/");try{if(!n&&"pkce"===this.flowType)throw new Sh;const{data:t,error:s}=await og(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ag});if(await zh(this.storage,`${this.storageKey}-code-verifier`),s)throw s;if(!t||!t.session||!t.user){const e=new vh;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:s})}catch(s){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:t,provider:n,token:r,access_token:s,nonce:i}=e,o=await og(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:s,nonce:i,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:ag}),{data:a,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!a||!a.session||!a.user){const e=new vh;return this._returnResult({data:{user:null,session:null},error:e})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:a,error:c})}catch(t){if(ph(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOtp(e){var t,n,r,s,i;try{if("email"in e){const{email:r,options:s}=e;let i=null,o=null;"pkce"===this.flowType&&([i,o]=await Qh(this.storage,this.storageKey));const{error:a}=await og(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==s?void 0:s.data)&&void 0!==t?t:{},create_user:null===(n=null==s?void 0:s.shouldCreateUser)||void 0===n||n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:i,code_challenge_method:o},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}if("phone"in e){const{phone:t,options:n}=e,{data:o,error:a}=await og(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==n?void 0:n.data)&&void 0!==r?r:{},create_user:null===(s=null==n?void 0:n.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},channel:null!==(i=null==n?void 0:n.channel)&&void 0!==i?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==o?void 0:o.message_id},error:a})}throw new Gh("You must provide either an email or phone number.")}catch(o){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var t,n;try{let r,s;"options"in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,s=null===(n=e.options)||void 0===n?void 0:n.captchaToken);const{data:i,error:o}=await og(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:r,xform:ag});if(o)throw o;if(!i){throw new Error("An error occurred on token verification.")}const a=i.session,c=i.user;return(null==a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),this._returnResult({data:{user:c,session:a},error:null})}catch(r){if(ph(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(e){var t,n,r,s,i;try{let o=null,a=null;"pkce"===this.flowType&&([o,a]=await Qh(this.storage,this.storageKey));const c=await og(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!==(n=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==n?n:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:a}),headers:this.headers,xform:ug});return(null===(s=c.data)||void 0===s?void 0:s.url)&&Lh()&&!(null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:n}=e;if(n)throw n;if(!t)throw new Ih;const{error:r}=await og(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if(ph(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:n,type:r,options:s}=e,{error:i}=await og(this.fetch,"POST",t,{headers:this.headers,body:{email:n,type:r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}if("phone"in e){const{phone:n,type:r,options:s}=e,{data:i,error:o}=await og(this.fetch,"POST",t,{headers:this.headers,body:{phone:n,type:r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==i?void 0:i.message_id},error:o})}throw new Gh("You must provide either an email or phone number and a type")}catch(t){if(ph(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async getSession(){await this.initializePromise;return await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await n}catch(e){}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(t){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",(new Error).stack);try{let e=null;const t=await Kh(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=!!e.expires_at&&1e3*e.expires_at-Date.now()<lh;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const t=await Kh(this.userStorage,this.storageKey+"-user");(null==t?void 0:t.user)?e.user=t.user:e.user=tg()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const t={value:this.suppressGetSessionWarning};e.user=function(e,t){return new Proxy(e,{get:(e,n,r)=>{if("__isInsecureUserWarningProxy"===n)return!0;if("symbol"==typeof n){const t=n.toString();if("Symbol(Symbol.toPrimitive)"===t||"Symbol(Symbol.toStringTag)"===t||"Symbol(util.inspect.custom)"===t||"Symbol(nodejs.util.inspect.custom)"===t)return Reflect.get(e,n,r)}return t.value||"string"!=typeof n||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(e,n,r)}})}(e.user,t),t.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:r},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await og(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:lg}):await this._useSession(async e=>{var t,n,r;const{data:s,error:i}=e;if(i)throw i;return(null===(t=s.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await og(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(n=s.session)||void 0===n?void 0:n.access_token)&&void 0!==r?r:void 0,xform:lg}):{data:{user:null},error:new Ih}})}catch(t){if(ph(t))return wh(t)&&(await this._removeSession(),await zh(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:t});throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async n=>{const{data:r,error:s}=n;if(s)throw s;if(!r.session)throw new Ih;const i=r.session;let o=null,a=null;"pkce"===this.flowType&&null!=e.email&&([o,a]=await Qh(this.storage,this.storageKey));const{data:c,error:l}=await og(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:i.access_token,xform:lg});if(l)throw l;return i.user=c.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(n){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Ih;const t=Date.now()/1e3;let n=t,r=!0,s=null;const{payload:i}=Uh(e.access_token);if(i.exp&&(n=i.exp,r=n<=t),r){const{data:t,error:n}=await this._callRefreshToken(e.refresh_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!t)return{data:{user:null,session:null},error:null};s=t}else{const{data:r,error:i}=await this._getUser(e.access_token);if(i)return this._returnResult({data:{user:null,session:null},error:i});s={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:"bearer",expires_in:n-t,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(t){if(ph(t))return this._returnResult({data:{session:null,user:null},error:t});throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){const{data:r,error:s}=t;if(s)throw s;e=null!==(n=r.session)&&void 0!==n?n:void 0}if(!(null==e?void 0:e.refresh_token))throw new Ih;const{data:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(t){if(ph(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async _getSessionFromURL(e,t){try{if(!Lh())throw new Ah("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Ah(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new Ch("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new Ah("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Ch("No code detected.");const{data:t,error:n}=await this._exchangeCodeForSession(e.code);if(n)throw n;const r=new URL(window.location.href);return r.searchParams.delete("code"),window.history.replaceState(window.history.state,"",r.toString()),{data:{session:t.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:r,access_token:s,refresh_token:i,expires_in:o,expires_at:a,token_type:c}=e;if(!(s&&o&&i&&c))throw new Ah("No session defined in URL");const l=Math.round(Date.now()/1e3),u=parseInt(o);let d=l+u;a&&(d=parseInt(a));const h=d-l;1e3*h<=ch&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${u}s`);const g=d-u;l-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,d,l):l-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,d,l);const{data:m,error:p}=await this._getUser(s);if(p)throw p;const f={provider_token:n,provider_refresh_token:r,access_token:s,expires_in:u,expires_at:d,refresh_token:i,token_type:c,user:m.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:f,redirectType:e.type},error:null})}catch(n){if(ph(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Kh(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var n;const{data:r,error:s}=t;if(s&&!wh(s))return this._returnResult({error:s});const i=null===(n=r.session)||void 0===n?void 0:n.access_token;if(i){const{error:t}=await this.admin.signOut(i,e);if(t&&(!function(e){return ph(e)&&"AuthApiError"===e.name}(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!wh(t))return this._returnResult({error:t})}return"others"!==e&&(await this._removeSession(),await zh(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=/* @__PURE__ */Symbol("auth-callback"),n={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,n),(async()=>{await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{var n,r;try{const{data:{session:r},error:s}=t;if(s)throw s;await(null===(n=this.stateChangeEmitters.get(e))||void 0===n?void 0:n.callback("INITIAL_SESSION",r)),this._debug("INITIAL_SESSION","callback id",e,"session",r)}catch(s){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,t={}){let n=null,r=null;"pkce"===this.flowType&&([n,r]=await Qh(this.storage,this.storageKey,!0));try{return await og(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(s){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:t,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:n,error:r}=await this._useSession(async t=>{var n,r,s,i,o;const{data:a,error:c}=t;if(c)throw c;const l=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(n=e.options)||void 0===n?void 0:n.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(s=e.options)||void 0===s?void 0:s.queryParams,skipBrowserRedirect:!0});return await og(this.fetch,"GET",l,{headers:this.headers,jwt:null!==(o=null===(i=a.session)||void 0===i?void 0:i.access_token)&&void 0!==o?o:void 0})});if(r)throw r;return Lh()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==n?void 0:n.url),this._returnResult({data:{provider:e.provider,url:null==n?void 0:n.url},error:null})}catch(n){if(ph(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var n;try{const{error:r,data:{session:s}}=t;if(r)throw r;const{options:i,provider:o,token:a,access_token:c,nonce:l}=e,u=await og(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(n=null==s?void 0:s.access_token)&&void 0!==n?n:void 0,body:{provider:o,id_token:a,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:ag}),{data:d,error:h}=u;return h?this._returnResult({data:{user:null,session:null},error:h}):d&&d.session&&d.user?(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:h})):this._returnResult({data:{user:null,session:null},error:new vh})}catch(r){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,r;const{data:s,error:i}=t;if(i)throw i;return await og(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(n=s.session)||void 0===n?void 0:n.access_token)&&void 0!==r?r:void 0})})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const s=Date.now();return await(n=async n=>(n>0&&await async function(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}(200*Math.pow(2,n-1)),this._debug(t,"refreshing attempt",n),await og(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ag})),r=(e,t)=>{const n=200*Math.pow(2,e);return t&&Vh(t)&&Date.now()+n-s<ch},new Promise((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{const t=await n(i);if(!r(i,null,t))return void e(t)}catch(s){if(!r(i,s))return void t(s)}})()}))}catch(s){if(this._debug(t,"error",s),ph(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}finally{this._debug(t,"end")}var n,r}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const n=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",n),Lh()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,t;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await Kh(this.storage,this.storageKey);if(s&&this.userStorage){let t=await Kh(this.userStorage,this.storageKey+"-user");this.storage.isServer||!Object.is(this.storage,this.userStorage)||t||(t={user:s.user},await Mh(this.userStorage,this.storageKey+"-user",t)),s.user=null!==(e=null==t?void 0:t.user)&&void 0!==e?e:tg()}else if(s&&!s.user&&!s.user){const e=await Kh(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(s.user=e.user,await zh(this.storage,this.storageKey+"-user"),await Mh(this.storage,this.storageKey,s)):s.user=tg()}if(this._debug(n,"session from storage",s),!this._isValidSession(s))return this._debug(n,"session is not valid"),void(null!==s&&await this._removeSession());const i=1e3*(null!==(t=s.expires_at)&&void 0!==t?t:1/0)-Date.now()<lh;if(this._debug(n,`session has${i?"":" not"} expired with margin of 90000s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:e}=await this._callRefreshToken(s.refresh_token);e&&(console.error(e),Vh(e)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(s.user&&!0===s.user.__isUserNotAvailableProxy)try{const{data:e,error:t}=await this._getUser(s.access_token);!t&&(null==e?void 0:e.user)?(s.user=e.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(r){console.error("Error getting user data:",r),this._debug(n,"error getting user data, skipping SIGNED_IN notification",r)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){return this._debug(n,"error",s),void console.error(s)}finally{this._debug(n,"end")}}async _callRefreshToken(e){var t,n;if(!e)throw new Ih;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new Dh;const{data:t,error:n}=await this._refreshAccessToken(e);if(n)throw n;if(!t.session)throw new Ih;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);const r={data:t.session,error:null};return this.refreshingDeferred.resolve(r),r}catch(s){if(this._debug(r,"error",s),ph(s)){const e={data:null,error:s};return Vh(s)||await this._removeSession(),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(e),e}throw null===(n=this.refreshingDeferred)||void 0===n||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(e,t,n=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,"begin",t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],s=Array.from(this.stateChangeEmitters.values()).map(async n=>{try{await n.callback(e,t)}catch(s){r.push(s)}});if(await Promise.all(s),r.length>0){for(let e=0;e<r.length;e+=1)console.error(r[e]);throw r[0]}}finally{this._debug(r,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await zh(this.storage,`${this.storageKey}-code-verifier`);const t=Object.assign({},e),n=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!n&&t.user&&await Mh(this.userStorage,this.storageKey+"-user",{user:t.user});const e=Object.assign({},t);delete e.user;const r=ng(e);await Mh(this.storage,this.storageKey,r)}else{const e=ng(t);await Mh(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await zh(this.storage,this.storageKey),await zh(this.storage,this.storageKey+"-code-verifier"),await zh(this.storage,this.storageKey+"-user"),this.userStorage&&await zh(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Lh()&&(null===window||void 0===window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ch);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&"object"==typeof t&&"function"==typeof t.unref?t.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async e=>{const{data:{session:n}}=e;if(!n||!n.refresh_token||!n.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");const r=Math.floor((1e3*n.expires_at-t)/ch);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(n.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 yg))throw e;this._debug("auto refresh token tick lock not available")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Lh()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},null===window||void 0===window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{"visible"===document.visibilityState?await this._recoverAndRefresh():this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting")}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,n){const r=[`provider=${encodeURIComponent(t)}`];if((null==n?void 0:n.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),(null==n?void 0:n.scopes)&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),"pkce"===this.flowType){const[e,t]=await Qh(this.storage,this.storageKey),n=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(n.toString())}if(null==n?void 0:n.queryParams){const e=new URLSearchParams(n.queryParams);r.push(e.toString())}return(null==n?void 0:n.skipBrowserRedirect)&&r.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var n;const{data:r,error:s}=t;return s?this._returnResult({data:null,error:s}):await og(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(n=null==r?void 0:r.session)||void 0===n?void 0:n.access_token})})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async _enroll(e){try{return await this._useSession(async t=>{var n,r;const{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:a,error:c}=await og(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:null===(n=null==s?void 0:s.session)||void 0===n?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):("totp"===e.factorType&&"totp"===a.type&&(null===(r=null==a?void 0:a.totp)||void 0===r?void 0:r.qr_code)&&(a.totp.qr_code=`data:image/svg+xml;utf-8,${a.totp.qr_code}`),this._returnResult({data:a,error:null}))})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;const{data:r,error:s}=t;if(s)return this._returnResult({data:null,error:s});const i=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?Xg(e.webauthn.credential_response):Bg(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:a}=await og(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:i,headers:this.headers,jwt:null===(n=null==r?void 0:r.session)||void 0===n?void 0:n.access_token});return a?this._returnResult({data:null,error:a}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:a}))})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;const{data:r,error:s}=t;if(s)return this._returnResult({data:null,error:s});const i=await og(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(n=null==r?void 0:r.session)||void 0===n?void 0:n.access_token});if(i.error)return i;const{data:o}=i;if("webauthn"!==o.type)return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Vg(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Eg(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}})}async _challengeAndVerify(e){const{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:n}=await this.getUser();if(n)return{data:null,error:n};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),"verified"===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,n,r,s;if(e)try{const{payload:r}=Uh(e);let s=null;r.aal&&(s=r.aal);let i=s;const{data:{user:o},error:a}=await this.getUser(e);if(a)return this._returnResult({data:null,error:a});(null!==(n=null===(t=null==o?void 0:o.factors)||void 0===t?void 0:t.filter(e=>"verified"===e.status))&&void 0!==n?n:[]).length>0&&(i="aal2");return{data:{currentLevel:s,nextLevel:i,currentAuthenticationMethods:r.amr||[]},error:null}}catch(u){if(ph(u))return this._returnResult({data:null,error:u});throw u}const{data:{session:i},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:a}=Uh(i.access_token);let c=null;a.aal&&(c=a.aal);let l=c;(null!==(s=null===(r=i.user.factors)||void 0===r?void 0:r.filter(e=>"verified"===e.status))&&void 0!==s?s:[]).length>0&&(l="aal2");return{data:{currentLevel:c,nextLevel:l,currentAuthenticationMethods:a.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await og(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new Ih})})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async _approveAuthorization(e,t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Ih});const i=await og(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return i.data&&i.data.redirect_url&&Lh()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(n){if(ph(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Ih});const i=await og(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return i.data&&i.data.redirect_url&&Lh()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(n){if(ph(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:n}=e;return n?this._returnResult({data:null,error:n}):t?await og(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new Ih})})}catch(e){if(ph(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?(await og(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Ih})})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async fetchJwk(e,t={keys:[]}){let n=t.keys.find(t=>t.kid===e);if(n)return n;const r=Date.now();if(n=this.jwks.keys.find(t=>t.kid===e),n&&this.jwks_cached_at+6e5>r)return n;const{data:s,error:i}=await og(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return s.keys&&0!==s.keys.length?(this.jwks=s,this.jwks_cached_at=r,n=s.keys.find(t=>t.kid===e),n||null):null}async getClaims(e,t={}){try{let n=e;if(!n){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});n=e.session.access_token}const{header:r,payload:s,signature:i,raw:{header:o,payload:a}}=Uh(n);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw new Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw new Error("JWT has expired")}(s.exp);const c=r.alg&&!r.alg.startsWith("HS")&&r.kid&&"crypto"in globalThis&&"subtle"in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!c){const{error:e}=await this.getUser(n);if(e)throw e;return{data:{claims:s,header:r,signature:i},error:null}}const l=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}(r.alg),u=await crypto.subtle.importKey("jwk",c,l,!0,["verify"]);if(!(await crypto.subtle.verify(l,u,i,Fh(`${o}.${a}`))))throw new Xh("Invalid JWT signature");return{data:{claims:s,header:r,signature:i},error:null}}catch(n){if(ph(n))return this._returnResult({data:null,error:n});throw n}}}Lg.nextInstanceID={};const Og=Lg;let Tg="";Tg="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";const Hg={headers:{"X-Client-Info":`supabase-js-${Tg}/2.97.0`}},Mg={schema:"public"},Kg={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},zg={};function Dg(e){return(Dg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ug(e){var t=function(e,t){if("object"!=Dg(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=Dg(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Dg(t)?t:t+""}function Pg(e,t,n){return(t=Ug(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jg(Object(n),!0).forEach(function(t){Pg(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const $g=(e,t,n)=>{const r=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(n),s=Headers;return async(n,i)=>{var o;const a=null!==(o=await t())&&void 0!==o?o:e;let c=new s(null==i?void 0:i.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${a}`),r(n,Qg(Qg({},i),{},{headers:c}))}};var qg=class extends Og{constructor(e){super(e)}},em=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const i=function(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(r){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a=function(e,t){var n,r;const{db:s,auth:i,realtime:o,global:a}=e,{db:c,auth:l,realtime:u,global:d}=t,h={db:Qg(Qg({},c),s),auth:Qg(Qg({},l),i),realtime:Qg(Qg({},u),o),storage:{},global:Qg(Qg(Qg({},d),a),{},{headers:Qg(Qg({},null!==(n=null==d?void 0:d.headers)&&void 0!==n?n:{}),null!==(r=null==a?void 0:a.headers)&&void 0!==r?r:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}(null!=n?n:{},{db:Mg,realtime:zg,auth:Qg(Qg({},Kg),{},{storageKey:o}),global:Hg});var c;(this.storageKey=null!==(r=a.auth.storageKey)&&void 0!==r?r:"",this.headers=null!==(s=a.global.headers)&&void 0!==s?s:{},a.accessToken)?(this.accessToken=a.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new 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!==(c=a.auth)&&void 0!==c?c:{},this.headers,a.global.fetch);this.fetch=$g(t,this._getAccessToken.bind(this),a.global.fetch),this.realtime=this._initRealtimeClient(Qg({headers:this.headers,accessToken:this._getAccessToken.bind(this)},a.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new Su(new URL("rest/v1",i).href,{headers:this.headers,schema:a.db.schema,fetch:this.fetch,timeout:a.db.timeout,urlLengthLimit:a.db.urlLengthLimit}),this.storage=new oh(this.storageUrl.href,this.headers,this.fetch,null==n?void 0:n.storage),a.accessToken||this._listenForAuthEvents()}get functions(){return new gu(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}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()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:i,flowType:o,lock:a,debug:c,throwOnError:l},u,d){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new qg({url:this.authUrl.href,headers:Qg(Qg({},h),u),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:o,lock:a,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new pd(this.realtimeUrl.href,Qg(Qg({},e),{},{params:Qg(Qg({},{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,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var tm={exports:{}};const nm={version:"17.3.1"};var rm,sm,im,om,am,cm;function lm(){if(rm)return tm.exports;rm=1;const e=f,t=v,n=G,r=A,s=nm.version,i=["🔐 encrypt with Dotenvx: https://dotenvx.com","🔐 prevent committing .env to code: https://dotenvx.com/precommit","🔐 prevent building .env in docker: https://dotenvx.com/prebuild","🤖 agentic secret storage: https://dotenvx.com/as2","⚡️ secrets for agents: https://dotenvx.com/as2","🛡️ auth for agents: https://vestauth.com","🛠️ run anywhere with `dotenvx run -- yourcommand`","⚙️ specify custom .env file path with { path: '/custom/path/.env' }","⚙️ enable debug logging with { debug: true }","⚙️ override existing env vars with { override: true }","⚙️ suppress all logs with { quiet: true }","⚙️ write to custom object with { processEnv: myObject }","⚙️ load multiple .env files with { path: ['.env.local', '.env'] }"];function o(e){return"string"==typeof e?!["false","0","no","off",""].includes(e.toLowerCase()):Boolean(e)}function a(e){return process.stdout.isTTY?`[2m${e}[0m`:e}const c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function l(e){console.log(`[dotenv@${s}][DEBUG] ${e}`)}function u(e){console.log(`[dotenv@${s}] ${e}`)}function d(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function h(e,t){let n;try{n=new URL(t)}catch(a){if("ERR_INVALID_URL"===a.code){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw a}const r=n.password;if(!r){const e=new Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}const s=n.searchParams.get("environment");if(!s){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}const i=`DOTENV_VAULT_${s.toUpperCase()}`,o=e.parsed[i];if(!o){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${i} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:o,key:r}}function g(n){let r=null;if(n&&n.path&&n.path.length>0)if(Array.isArray(n.path))for(const t of n.path)e.existsSync(t)&&(r=t.endsWith(".vault")?t:`${t}.vault`);else r=n.path.endsWith(".vault")?n.path:`${n.path}.vault`;else r=t.resolve(process.cwd(),".env.vault");return e.existsSync(r)?r:null}function m(e){return"~"===e[0]?t.join(n.homedir(),e.slice(1)):e}const p={configDotenv:function(n){const r=t.resolve(process.cwd(),".env");let s="utf8",c=process.env;n&&null!=n.processEnv&&(c=n.processEnv);let d=o(c.DOTENV_CONFIG_DEBUG||n&&n.debug),h=o(c.DOTENV_CONFIG_QUIET||n&&n.quiet);n&&n.encoding?s=n.encoding:d&&l("No encoding is specified. UTF-8 is used by default");let g,f=[r];if(n&&n.path)if(Array.isArray(n.path)){f=[];for(const e of n.path)f.push(m(e))}else f=[m(n.path)];const y={};for(const t of f)try{const r=p.parse(e.readFileSync(t,{encoding:s}));p.populate(y,r,n)}catch(I){d&&l(`Failed to load ${t} ${I.message}`),g=I}const b=p.populate(c,y,n);if(d=o(c.DOTENV_CONFIG_DEBUG||d),h=o(c.DOTENV_CONFIG_QUIET||h),d||!h){const e=Object.keys(b).length,n=[];for(const r of f)try{const e=t.relative(process.cwd(),r);n.push(e)}catch(I){d&&l(`Failed to load ${r} ${I.message}`),g=I}u(`injecting env (${e}) from ${n.join(",")} ${a(`-- tip: ${i[Math.floor(Math.random()*i.length)]}`)}`)}return g?{parsed:y,error:g}:{parsed:y}},_configVault:function(e){const t=o(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),n=o(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);!t&&n||u("Loading env from encrypted .env.vault");const r=p._parseVault(e);let s=process.env;return e&&null!=e.processEnv&&(s=e.processEnv),p.populate(s,r,e),{parsed:r}},_parseVault:function(e){const t=g(e=e||{});e.path=t;const n=p.configDotenv(e);if(!n.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code="MISSING_DATA",e}const r=d(e).split(","),s=r.length;let i;for(let a=0;a<s;a++)try{const e=h(n,r[a].trim());i=p.decrypt(e.ciphertext,e.key);break}catch(o){if(a+1>=s)throw o}return p.parse(i)},config:function(e){if(0===d(e).length)return p.configDotenv(e);const t=g(e);return t?p._configVault(e):(n=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.error(`[dotenv@${s}][WARN] ${n}`),p.configDotenv(e));var n},decrypt:function(e,t){const n=Buffer.from(t.slice(-64),"hex");let s=Buffer.from(e,"base64");const i=s.subarray(0,12),o=s.subarray(-16);s=s.subarray(12,-16);try{const e=r.createDecipheriv("aes-256-gcm",n,i);return e.setAuthTag(o),`${e.update(s)}${e.final()}`}catch(a){const e=a instanceof RangeError,t="Invalid key length"===a.message,n="Unsupported state or unable to authenticate data"===a.message;if(e||t){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(n){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw a}},parse:function(e){const t={};let n,r=e.toString();for(r=r.replace(/\r\n?/gm,"\n");null!=(n=c.exec(r));){const e=n[1];let r=n[2]||"";r=r.trim();const s=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===s&&(r=r.replace(/\\n/g,"\n"),r=r.replace(/\\r/g,"\r")),t[e]=r}return t},populate:function(e,t,n={}){const r=Boolean(n&&n.debug),s=Boolean(n&&n.override),i={};if("object"!=typeof t){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(const o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(!0===s&&(e[o]=t[o],i[o]=t[o]),r&&l(!0===s?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(e[o]=t[o],i[o]=t[o]);return i}};return tm.exports.configDotenv=p.configDotenv,tm.exports._configVault=p._configVault,tm.exports._parseVault=p._parseVault,tm.exports.config=p.config,tm.exports.decrypt=p.decrypt,tm.exports.parse=p.parse,tm.exports.populate=p.populate,tm.exports=p,tm.exports}cm||(cm=1,lm().config(Object.assign({},function(){if(im)return sm;im=1;const e={};return null!=process.env.DOTENV_CONFIG_ENCODING&&(e.encoding=process.env.DOTENV_CONFIG_ENCODING),null!=process.env.DOTENV_CONFIG_PATH&&(e.path=process.env.DOTENV_CONFIG_PATH),null!=process.env.DOTENV_CONFIG_QUIET&&(e.quiet=process.env.DOTENV_CONFIG_QUIET),null!=process.env.DOTENV_CONFIG_DEBUG&&(e.debug=process.env.DOTENV_CONFIG_DEBUG),null!=process.env.DOTENV_CONFIG_OVERRIDE&&(e.override=process.env.DOTENV_CONFIG_OVERRIDE),null!=process.env.DOTENV_CONFIG_DOTENV_KEY&&(e.DOTENV_KEY=process.env.DOTENV_CONFIG_DOTENV_KEY),sm=e}(),function(){if(am)return om;am=1;const e=/^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;return om=function(t){const n=t.reduce(function(t,n){const r=n.match(e);return r&&(t[r[1]]=r[2]),t},{});return"quiet"in n||(n.quiet="true"),n}}()(process.argv))));const um=async()=>{const e=await es.getSession(),t=new em("https://bfyrfypcnrfqiqtnhksg.supabase.co","sb_publishable_UE64XbixbCKCdNP20YLmqg_S1_Zchd6",{auth:{persistSession:!1,autoRefreshToken:!0,detectSessionInUrl:!1}});if(e){const{error:n}=await t.auth.setSession({access_token:e.access_token,refresh_token:e.refresh_token});n&&console.error("[Fluxlay] Error setting session:",n.message)}return t},dm=process.env.FLUXLAY_API_URL||"http://localhost:8080",hm=xl(nu({baseUrl:dm,httpVersion:"1.1",interceptors:[e=>async t=>{const n=await um(),{data:{session:r}}=await n.auth.getSession();return r?.access_token&&(await es.saveSession(r),t.header.set("Authorization",`Bearer ${r.access_token}`)),e(t)}]}));const gm=(mm=hm,function(e,t){const n={};for(const r of e.methods){const e=t(r);null!=e&&(n[r.localName]=e)}return n}(su,e=>{switch(e.methodKind){case"unary":return function(e,t){return async(n,r)=>{var s,i;const o=await e.unary(t,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,n,null==r?void 0:r.contextValues);return null===(s=null==r?void 0:r.onHeader)||void 0===s||s.call(r,o.header),null===(i=null==r?void 0:r.onTrailer)||void 0===i||i.call(r,o.trailer),o.message}}(mm,e);case"server_streaming":return function(e,t){return(n,r)=>Qc(e.stream(t,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,Dc([n]),null==r?void 0:r.contextValues),r)}(mm,e);case"client_streaming":return function(e,t){return async(n,r)=>{var s,i,o,a,c,l;const u=await e.stream(t,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,n,null==r?void 0:r.contextValues);let d;null===(c=null==r?void 0:r.onHeader)||void 0===c||c.call(r,u.header);let h=0;try{for(var g,m=!0,p=Uc(u.message);!(s=(g=await p.next()).done);m=!0)a=g.value,m=!1,d=a,h++}catch(f){i={error:f}}finally{try{m||s||!(o=p.return)||await o.call(p)}finally{if(i)throw i.error}}if(!d)throw new Vc("protocol error: missing response message",ts.Unimplemented);if(h>1)throw new Vc("protocol error: received extra messages for client streaming method",ts.Unimplemented);return null===(l=null==r?void 0:r.onTrailer)||void 0===l||l.call(r,u.trailer),d}}(mm,e);case"bidi_streaming":return function(e,t){return(n,r)=>Qc(e.stream(t,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,n,null==r?void 0:r.contextValues),r)}(mm,e);default:return null}}));var mm;class pm{static async saveDeveloperKey(e){Ut(e)}static async getDeveloperKey(){try{return await Dt()||null}catch(e){return console.error(`[KeyStore] Error getting developer key: ${e}`),null}}}function fm(){let e=Date.now();return{name:"fluxlay-dev-server",configureServer(t){t.watcher.on("change",()=>{e=Date.now()}),t.middlewares.use("/version",(t,n)=>{n.setHeader("Content-Type","application/json"),n.setHeader("Access-Control-Allow-Origin","*"),n.end(JSON.stringify({version:e}))})}}}async function ym(e){const t=o.resolve(process.cwd(),e),n=o.join(t,"fluxlay.yaml");i.existsSync(n)||(Re.error(dt.red("fluxlay.yaml is required in the project root.")),process.exit(1));try{const e=i.readFileSync(n,"utf-8");Pt(e)}catch(g){Re.error(`Manifest Validation Error: ${g.message}`),process.exit(1)}const r=await bm(3e3),s=Le();s.start(dt.yellow(`Starting server on port ${r}...`));const a=await h({root:t,configFile:o.resolve(t,"vite.config.ts"),plugins:[fm()],server:{port:r,strictPort:!0,cors:!0,host:"127.0.0.1"},logLevel:"error"});await a.listen(),s.stop(`${dt.green("✔")} Server started on port ${r}.`);const c=`http://127.0.0.1:${r}`;Re.info(`Wallpaper server running at ${dt.underline.cyan(c)}`);const l=function(){const e=p.homedir();switch(p.platform()){case"darwin":return o.join(e,"Library","Application Support","com.fluxlay.manager");case"win32":return o.join(process.env.APPDATA||o.join(e,"AppData","Roaming"),"com.fluxlay.manager");default:return o.join(e,".config","com.fluxlay.manager")}}(),u=o.join(l,"dev.json"),d=()=>{if(i.existsSync(u))try{i.unlinkSync(u)}catch(g){}};i.existsSync(l)||i.mkdirSync(l,{recursive:!0}),i.writeFileSync(u,JSON.stringify({url:c,root:t},null,2)),process.on("SIGINT",()=>{d(),process.exit()}),process.on("SIGTERM",()=>{d(),process.exit()}),process.on("exit",d),Fe(`Root: ${dt.gray(t)}\nWatching for changes...`,"Dev Server Active")}async function bm(e){return new Promise((t,n)=>{const r=X.createServer();r.unref(),r.on("error",r=>{"EADDRINUSE"===r.code?t(bm(e+1)):n(r)}),r.listen(e,()=>{r.close(()=>t(e))})})}let Im,wm;function vm(){return void 0===Im&&(Im=function(){try{return i.statSync("/.dockerenv"),!0}catch{return!1}}()||function(){try{return i.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}()),Im}function Gm(){return void 0===wm&&(wm=(()=>{try{return i.statSync("/run/.containerenv"),!0}catch{return!1}})()||vm()),wm}const Am=()=>{if("linux"!==e.platform)return!1;if(p.release().toLowerCase().includes("microsoft"))return!Gm();try{if(i.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!Gm()}catch{}return!(!i.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")&&!i.existsSync("/run/WSL"))&&!Gm()},Cm=e.env.__IS_WSL_TEST__?Am:Am(),Sm=a(l.execFile),Zm=()=>`${e.env.SYSTEMROOT||e.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,Vm=async(e,t={})=>{const{powerShellPath:n,...r}=t,s=Vm.encodeCommand(e);return Sm(n??Zm(),[...Vm.argumentsPrefix,s],{encoding:"utf8",...r})};Vm.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],Vm.encodeCommand=e=>R.from(e,"utf16le").toString("base64"),Vm.escapeArgument=e=>`'${String(e).replaceAll("'","''")}'`;const Em=a(l.execFile),Xm=/* @__PURE__ */(()=>{const e="/mnt/";let t;return async function(){if(t)return t;const n="/etc/wsl.conf";let r=!1;try{await B.access(n,x.F_OK),r=!0}catch{}if(!r)return e;const s=function(e){for(const t of e.split("\n")){if(/^\s*#/.test(t))continue;const e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}(await B.readFile(n,{encoding:"utf8"}));return void 0===s?e:(t=s,t=t.endsWith("/")?t:`${t}/`,t)}})(),Bm=Cm?async()=>`${await Xm()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:Zm;let xm;function Rm(e,t,n){const r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=n();return r(e),e},set(e){r(e)}}),e}const Wm=a(u);const Nm=a(u);async function Jm(t){return async function(t,{humanReadableOutput:n=!0,signal:r}={}){if("darwin"!==e.platform)throw new Error("macOS only");const s=n?[]:["-ss"],i={};r&&(i.signal=r);const{stdout:o}=await Nm("osascript",["-e",t,s],i);return o.trim()}(`tell application "Finder" to set app_path to application file id "${t}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const _m=a(u),km={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Fm=new Map(Object.entries(km));class Ym extends Error{}const Lm=a(u);async function Om(){if("darwin"===e.platform){const t=await async function(){if("darwin"!==e.platform)throw new Error("macOS only");const{stdout:t}=await Wm("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),n=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t),r=n?.groups.id??"com.apple.Safari";return"com.apple.safari"===r?"com.apple.Safari":r}();return{name:await Jm(t),id:t}}if("linux"===e.platform){const{stdout:e}=await Lm("xdg-mime",["query","default","x-scheme-handler/http"]),t=e.trim();return{name:t.replace(/.desktop$/,"").replace("-"," ").toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),id:t}}if("win32"===e.platform)return async function(e=_m){const{stdout:t}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new Ym(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);const{id:r}=n.groups,s=r.lastIndexOf("."),i=r.lastIndexOf("-"),o=-1===s?void 0:r.slice(0,s),a=-1===i?void 0:r.slice(0,i);return km[r]??km[o]??km[a]??{name:r,id:r}}();throw new Error("Only macOS, Linux, and Windows are supported")}const Tm=Boolean(e.env.SSH_CONNECTION||e.env.SSH_CLIENT||e.env.SSH_TTY),Hm=/* @__PURE__ */Symbol("fallbackAttempt"),Mm=import.meta.url?o.dirname(m(import.meta.url)):"",Km=o.join(Mm,"xdg-open"),{platform:zm,arch:Dm}=e,Um=async(e,t)=>{if(0===e.length)return;const n=[];for(const s of e)try{return await t(s)}catch(r){n.push(r)}throw new AggregateError(n,"Failed to open in all supported apps")},Pm=async t=>{const n=!0===(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t})[Hm];if(delete t[Hm],Array.isArray(t.app))return Um(t.app,e=>Pm({...t,app:e,[Hm]:!0}));let r,{name:s,arguments:i=[]}=t.app??{};if(i=[...i],Array.isArray(s))return Um(s,e=>Pm({...t,app:{name:e,arguments:i},[Hm]:!0}));if("browser"===s||"browserPrivate"===s){const e={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},n={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"};let r;if(Cm){const e=await(async()=>{const e=await Bm(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:n}=await Vm(t,{powerShellPath:e});return n.trim()})();r=Fm.get(e)??{}}else r=await Om();if(r.id in e){const o=e[r.id.toLowerCase()];if("browserPrivate"===s){if("safari"===o)throw new Error("Safari doesn't support opening in private mode via command line");i.push(n[o])}return Pm({...t,app:{name:$m[o],arguments:i}})}throw new Error(`${r.name} is not supported as a default browser`)}const o=[],a={};let c=!1;if(!Cm||Gm()||Tm||s||(c=await(async()=>(xm??=(async()=>{try{const e=await Bm();return await B.access(e,x.X_OK),!0}catch{return!1}})(),xm))()),"darwin"===zm)r="open",t.wait&&o.push("--wait-apps"),t.background&&o.push("--background"),t.newInstance&&o.push("--new"),s&&o.push("-a",s);else if("win32"===zm||c){r=await Bm(),o.push(...Vm.argumentsPrefix),Cm||(a.windowsVerbatimArguments=!0),Cm&&t.target&&(t.target=await(async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{const{stdout:t}=await Em("wslpath",["-aw",e],{encoding:"utf8"});return t.trim()}catch{return e}})(t.target));const e=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&e.push("-Wait"),s?(e.push(Vm.escapeArgument(s)),t.target&&i.push(t.target)):t.target&&e.push(Vm.escapeArgument(t.target)),i.length>0&&(i=i.map(e=>Vm.escapeArgument(e)),e.push("-ArgumentList",i.join(","))),t.target=Vm.encodeCommand(e.join(" ")),t.wait||(a.stdio="ignore")}else{if(s)r=s;else{const t=!Mm||"/"===Mm;let n=!1;try{await B.access(Km,x.X_OK),n=!0}catch{}r=e.versions.electron??("android"===zm||t||!n)?"xdg-open":Km}i.length>0&&o.push(...i),t.wait||(a.stdio="ignore",a.detached=!0)}"darwin"===zm&&i.length>0&&o.push("--args",...i),t.target&&o.push(t.target);const u=l.spawn(r,o,a);return t.wait?new Promise((e,n)=>{u.once("error",n),u.once("close",r=>{t.allowNonzeroExitCode||0===r?e(u):n(new Error(`Exited with code ${r}`))})}):n?new Promise((e,t)=>{u.once("error",t),u.once("spawn",()=>{u.once("close",n=>{u.off("error",t),0===n?(u.unref(),e(u)):t(new Error(`Exited with code ${n}`))})})}):(u.unref(),new Promise((e,t)=>{u.once("error",t),u.once("spawn",()=>{u.off("error",t),e(u)})}))};function jm(e){if("string"==typeof e||Array.isArray(e))return e;const{[Dm]:t}=e;if(!t)throw new Error(`${Dm} is not supported`);return t}function Qm({[zm]:e},{wsl:t}={}){if(t&&Cm)return jm(t);if(!e)throw new Error(`${zm} is not supported`);return jm(e)}const $m={browser:"browser",browserPrivate:"browserPrivate"};Rm($m,"chrome",()=>Qm({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}})),Rm($m,"brave",()=>Qm({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}})),Rm($m,"firefox",()=>Qm({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"})),Rm($m,"edge",()=>Qm({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"})),Rm($m,"safari",()=>Qm({darwin:"Safari"}));const qm=async()=>{const e="https://fluxlay.com",t=`${e}/sign-in?next=${encodeURIComponent("http://127.0.0.1:9999/callback")}`;Re.step(`Opening browser for authentication via: ${dt.underline.cyan(e)}`),await((e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a `target`");return Pm({...t,target:e})})(t);const n=Le();n.start(dt.yellow("Waiting for authentication..."));try{const{session:e}=await(e=>new Promise((t,n)=>{const r=Z.createServer((n,s)=>{if(s.setHeader("Access-Control-Allow-Origin","*"),s.setHeader("Access-Control-Allow-Methods","GET, POST, OPTIONS"),s.setHeader("Access-Control-Allow-Headers","Content-Type"),"OPTIONS"===n.method)return s.writeHead(204),void s.end();const i=n.headers["x-forwarded-proto"]||"http",o=n.headers.host||`localhost:${e}`,a=new URL(n.url||"",`${i}://${o}`),c=a.searchParams;if("POST"===n.method){let e="";return n.on("data",t=>{e+=t.toString()}),void n.on("end",()=>{try{const n=JSON.parse(e);n.session&&(s.writeHead(200,{"Content-Type":"application/json"}),s.end(JSON.stringify({status:"success"})),r.close(),t({session:n.session}))}catch(n){s.writeHead(400),s.end("Invalid JSON")}})}const l=c.get("session");if(l)try{const e=JSON.parse(l);s.writeHead(302,{Location:"https://fluxlay.com/auth/success"}),s.end(),r.close(),t({session:e})}catch(u){s.writeHead(400),s.end("Invalid session data")}else"/callback"===a.pathname&&(s.writeHead(400),s.end("No authentication data found."))});r.listen(e,()=>{console.log(`Waiting for authentication callback on port ${e}...`)}),r.on("error",e=>{n(e)})}))(9999);e?(await es.saveSession(e),n.stop(`${dt.green("✔")} Successfully logged in as ${dt.cyan(e.user.email)}`)):(n.stop(dt.red("Authentication failed: No session received")),process.exit(1))}catch(r){n.stop(dt.red("Authentication failed")),Re.error(r instanceof Error?r.message:String(r)),process.exit(1)}};function ep(e){return null==e}var tp={isNothing:ep,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:ep(e)?[]:[e]},repeat:function(e,t){var n,r="";for(n=0;n<t;n+=1)r+=e;return r},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,r,s,i;if(t)for(n=0,r=(i=Object.keys(t)).length;n<r;n+=1)e[s=i[n]]=t[s];return e}};function np(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),r+" "+n):r}function rp(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=np(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}rp.prototype=Object.create(Error.prototype),rp.prototype.constructor=rp,rp.prototype.toString=function(e){return this.name+": "+np(this,e)};var sp=rp;function ip(e,t,n,r,s){var i="",o="",a=Math.floor(s/2)-1;return r-t>a&&(t=r-a+(i=" ... ").length),n-r>a&&(n=r+a-(o=" ...").length),{str:i+e.slice(t,n).replace(/\t/g,"→")+o,pos:r-t+i.length}}function op(e,t){return tp.repeat(" ",t-e.length)+e}var ap=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,r=/\r?\n|\r|\0/g,s=[0],i=[],o=-1;n=r.exec(e.buffer);)i.push(n.index),s.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=s.length-2);o<0&&(o=s.length-1);var a,c,l="",u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(a=1;a<=t.linesBefore&&!(o-a<0);a++)c=ip(e.buffer,s[o-a],i[o-a],e.position-(s[o]-s[o-a]),d),l=tp.repeat(" ",t.indent)+op((e.line-a+1).toString(),u)+" | "+c.str+"\n"+l;for(c=ip(e.buffer,s[o],i[o],e.position,d),l+=tp.repeat(" ",t.indent)+op((e.line+1).toString(),u)+" | "+c.str+"\n",l+=tp.repeat("-",t.indent+u+3+c.pos)+"^\n",a=1;a<=t.linesAfter&&!(o+a>=i.length);a++)c=ip(e.buffer,s[o+a],i[o+a],e.position-(s[o]-s[o+a]),d),l+=tp.repeat(" ",t.indent)+op((e.line+a+1).toString(),u)+" | "+c.str+"\n";return l.replace(/\n$/,"")},cp=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],lp=["scalar","sequence","mapping"];var up=function(e,t){var n,r;if(t=t||{},Object.keys(t).forEach(function(t){if(-1===cp.indexOf(t))throw new sp('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=(n=t.styleAliases||null,r={},null!==n&&Object.keys(n).forEach(function(e){n[e].forEach(function(t){r[String(t)]=e})}),r),-1===lp.indexOf(this.kind))throw new sp('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function dp(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function hp(e){return this.extend(e)}hp.prototype.extend=function(e){var t=[],n=[];if(e instanceof up)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new sp("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach(function(e){if(!(e instanceof up))throw new sp("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new sp("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new sp("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(e){if(!(e instanceof up))throw new sp("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(hp.prototype);return r.implicit=(this.implicit||[]).concat(t),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=dp(r,"implicit"),r.compiledExplicit=dp(r,"explicit"),r.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function r(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return n}(r.compiledImplicit,r.compiledExplicit),r};var gp=hp,mp=new up("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),pp=new up("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),fp=new up("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),yp=new gp({explicit:[mp,pp,fp]});var bp=new up("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var Ip=new up("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function wp(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function vp(e){return 48<=e&&e<=55}function Gp(e){return 48<=e&&e<=57}var Ap=new up("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n=e.length,r=0,s=!1;if(!n)return!1;if("-"!==(t=e[r])&&"+"!==t||(t=e[++r]),"0"===t){if(r+1===n)return!0;if("b"===(t=e[++r])){for(r++;r<n;r++)if("_"!==(t=e[r])){if("0"!==t&&"1"!==t)return!1;s=!0}return s&&"_"!==t}if("x"===t){for(r++;r<n;r++)if("_"!==(t=e[r])){if(!wp(e.charCodeAt(r)))return!1;s=!0}return s&&"_"!==t}if("o"===t){for(r++;r<n;r++)if("_"!==(t=e[r])){if(!vp(e.charCodeAt(r)))return!1;s=!0}return s&&"_"!==t}}if("_"===t)return!1;for(;r<n;r++)if("_"!==(t=e[r])){if(!Gp(e.charCodeAt(r)))return!1;s=!0}return!(!s||"_"===t)},construct:function(e){var t,n=e,r=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(r=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return r*parseInt(n.slice(2),2);if("x"===n[1])return r*parseInt(n.slice(2),16);if("o"===n[1])return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!tp.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Cp=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var Sp=/^[-+]?[0-9]+e/;var Zp=new up("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!Cp.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||tp.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(tp.isNegativeZero(e))return"-0.0";return n=e.toString(10),Sp.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),Vp=yp.extend({implicit:[bp,Ip,Ap,Zp]}),Ep=Vp,Xp=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Bp=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var xp=new up("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==Xp.exec(e)||null!==Bp.exec(e))},construct:function(e){var t,n,r,s,i,o,a,c,l=0,u=null;if(null===(t=Xp.exec(e))&&(t=Bp.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,r,s));if(i=+t[4],o=+t[5],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,r,s,i,o,a,l)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var Rp=new up("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Wp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var Np=new up("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,s=e.length,i=Wp;for(n=0;n<s;n++)if(!((t=i.indexOf(e.charAt(n)))>64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=Wp,o=0,a=[];for(t=0;t<s;t++)t%4==0&&t&&(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)),o=o<<6|i.indexOf(r.charAt(t));return 0===(n=s%4*6)?(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)):18===n?(a.push(o>>10&255),a.push(o>>2&255)):12===n&&a.push(o>>4&255),new Uint8Array(a)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,r="",s=0,i=e.length,o=Wp;for(t=0;t<i;t++)t%3==0&&t&&(r+=o[s>>18&63],r+=o[s>>12&63],r+=o[s>>6&63],r+=o[63&s]),s=(s<<8)+e[t];return 0===(n=i%3)?(r+=o[s>>18&63],r+=o[s>>12&63],r+=o[s>>6&63],r+=o[63&s]):2===n?(r+=o[s>>10&63],r+=o[s>>4&63],r+=o[s<<2&63],r+=o[64]):1===n&&(r+=o[s>>2&63],r+=o[s<<4&63],r+=o[64],r+=o[64]),r}}),Jp=Object.prototype.hasOwnProperty,_p=Object.prototype.toString;var kp=new up("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,s,i,o=[],a=e;for(t=0,n=a.length;t<n;t+=1){if(r=a[t],i=!1,"[object Object]"!==_p.call(r))return!1;for(s in r)if(Jp.call(r,s)){if(i)return!1;i=!0}if(!i)return!1;if(-1!==o.indexOf(s))return!1;o.push(s)}return!0},construct:function(e){return null!==e?e:[]}}),Fp=Object.prototype.toString;var Yp=new up("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,s,i,o=e;for(i=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(r=o[t],"[object Object]"!==Fp.call(r))return!1;if(1!==(s=Object.keys(r)).length)return!1;i[t]=[s[0],r[s[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,r,s,i,o=e;for(i=new Array(o.length),t=0,n=o.length;t<n;t+=1)r=o[t],s=Object.keys(r),i[t]=[s[0],r[s[0]]];return i}}),Lp=Object.prototype.hasOwnProperty;var Op=new up("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(Lp.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),Tp=Ep.extend({implicit:[xp,Rp],explicit:[Np,kp,Yp,Op]}),Hp=Object.prototype.hasOwnProperty,Mp=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Kp=/[\x85\u2028\u2029]/,zp=/[,\[\]\{\}]/,Dp=/^(?:!|!!|![a-z\-]+!)$/i,Up=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Pp(e){return Object.prototype.toString.call(e)}function jp(e){return 10===e||13===e}function Qp(e){return 9===e||32===e}function $p(e){return 9===e||32===e||10===e||13===e}function qp(e){return 44===e||91===e||93===e||123===e||125===e}function ef(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function tf(e){return 120===e?2:117===e?4:85===e?8:0}function nf(e){return 48<=e&&e<=57?e-48:-1}function rf(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function sf(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}function of(e,t,n){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var af=new Array(256),cf=new Array(256),lf=0;lf<256;lf++)af[lf]=rf(lf)?1:0,cf[lf]=rf(lf);function uf(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Tp,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function df(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=ap(n),new sp(t,n)}function hf(e,t){throw df(e,t)}function gf(e,t){e.onWarning&&e.onWarning.call(null,df(e,t))}var mf={YAML:function(e,t,n){var r,s,i;null!==e.version&&hf(e,"duplication of %YAML directive"),1!==n.length&&hf(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&hf(e,"ill-formed argument of the YAML directive"),s=parseInt(r[1],10),i=parseInt(r[2],10),1!==s&&hf(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&gf(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,s;2!==n.length&&hf(e,"TAG directive accepts exactly two arguments"),r=n[0],s=n[1],Dp.test(r)||hf(e,"ill-formed tag handle (first argument) of the TAG directive"),Hp.call(e.tagMap,r)&&hf(e,'there is a previously declared suffix for "'+r+'" tag handle'),Up.test(s)||hf(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch(i){hf(e,"tag prefix is malformed: "+s)}e.tagMap[r]=s}};function pf(e,t,n,r){var s,i,o,a;if(t<n){if(a=e.input.slice(t,n),r)for(s=0,i=a.length;s<i;s+=1)9===(o=a.charCodeAt(s))||32<=o&&o<=1114111||hf(e,"expected valid JSON character");else Mp.test(a)&&hf(e,"the stream contains non-printable characters");e.result+=a}}function ff(e,t,n,r){var s,i,o,a;for(tp.isObject(n)||hf(e,"cannot merge mappings; the provided source object is unacceptable"),o=0,a=(s=Object.keys(n)).length;o<a;o+=1)i=s[o],Hp.call(t,i)||(of(t,i,n[i]),r[i]=!0)}function yf(e,t,n,r,s,i,o,a,c){var l,u;if(Array.isArray(s))for(l=0,u=(s=Array.prototype.slice.call(s)).length;l<u;l+=1)Array.isArray(s[l])&&hf(e,"nested arrays are not supported inside keys"),"object"==typeof s&&"[object Object]"===Pp(s[l])&&(s[l]="[object Object]");if("object"==typeof s&&"[object Object]"===Pp(s)&&(s="[object Object]"),s=String(s),null===t&&(t={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(i))for(l=0,u=i.length;l<u;l+=1)ff(e,t,i[l],n);else ff(e,t,i,n);else e.json||Hp.call(n,s)||!Hp.call(t,s)||(e.line=o||e.line,e.lineStart=a||e.lineStart,e.position=c||e.position,hf(e,"duplicated mapping key")),of(t,s,i),delete n[s];return t}function bf(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):hf(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function If(e,t,n){for(var r=0,s=e.input.charCodeAt(e.position);0!==s;){for(;Qp(s);)9===s&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(t&&35===s)do{s=e.input.charCodeAt(++e.position)}while(10!==s&&13!==s&&0!==s);if(!jp(s))break;for(bf(e),s=e.input.charCodeAt(e.position),r++,e.lineIndent=0;32===s;)e.lineIndent++,s=e.input.charCodeAt(++e.position)}return-1!==n&&0!==r&&e.lineIndent<n&&gf(e,"deficient indentation"),r}function wf(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!$p(t)))}function vf(e,t){1===t?e.result+=" ":t>1&&(e.result+=tp.repeat("\n",t-1))}function Gf(e,t){var n,r,s=e.tag,i=e.anchor,o=[],a=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),r=e.input.charCodeAt(e.position);0!==r&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,hf(e,"tab characters must not be used in indentation")),45===r)&&$p(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,If(e,!0,-1)&&e.lineIndent<=t)o.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,Sf(e,t,3,!1,!0),o.push(e.result),If(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)hf(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=s,e.anchor=i,e.kind="sequence",e.result=o,!0)}function Af(e){var t,n,r,s,i=!1,o=!1;if(33!==(s=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&hf(e,"duplication of a tag property"),60===(s=e.input.charCodeAt(++e.position))?(i=!0,s=e.input.charCodeAt(++e.position)):33===s?(o=!0,n="!!",s=e.input.charCodeAt(++e.position)):n="!",t=e.position,i){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&62!==s);e.position<e.length?(r=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):hf(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==s&&!$p(s);)33===s&&(o?hf(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),Dp.test(n)||hf(e,"named tag handle cannot contain such characters"),o=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);r=e.input.slice(t,e.position),zp.test(r)&&hf(e,"tag suffix cannot contain flow indicator characters")}r&&!Up.test(r)&&hf(e,"tag name cannot contain such characters: "+r);try{r=decodeURIComponent(r)}catch(a){hf(e,"tag name is malformed: "+r)}return i?e.tag=r:Hp.call(e.tagMap,n)?e.tag=e.tagMap[n]+r:"!"===n?e.tag="!"+r:"!!"===n?e.tag="tag:yaml.org,2002:"+r:hf(e,'undeclared tag handle "'+n+'"'),!0}function Cf(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&hf(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!$p(n)&&!qp(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&hf(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Sf(e,t,n,r,s){var i,o,a,c,l,u,d,h,g,m=1,p=!1,f=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=o=a=4===n||3===n,r&&If(e,!0,-1)&&(p=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),1===m)for(;Af(e)||Cf(e);)If(e,!0,-1)?(p=!0,a=i,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):a=!1;if(a&&(a=p||s),1!==m&&4!==n||(h=1===n||2===n?t:t+1,g=e.position-e.lineStart,1===m?a&&(Gf(e,g)||function(e,t,n){var r,s,i,o,a,c,l,u=e.tag,d=e.anchor,h={},g=/* @__PURE__ */Object.create(null),m=null,p=null,f=null,y=!1,b=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=h),l=e.input.charCodeAt(e.position);0!==l;){if(y||-1===e.firstTabInLine||(e.position=e.firstTabInLine,hf(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,63!==l&&58!==l||!$p(r)){if(o=e.line,a=e.lineStart,c=e.position,!Sf(e,n,2,!1,!0))break;if(e.line===i){for(l=e.input.charCodeAt(e.position);Qp(l);)l=e.input.charCodeAt(++e.position);if(58===l)$p(l=e.input.charCodeAt(++e.position))||hf(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(yf(e,h,g,m,p,null,o,a,c),m=p=f=null),b=!0,y=!1,s=!1,m=e.tag,p=e.result;else{if(!b)return e.tag=u,e.anchor=d,!0;hf(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!b)return e.tag=u,e.anchor=d,!0;hf(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(y&&(yf(e,h,g,m,p,null,o,a,c),m=p=f=null),b=!0,y=!0,s=!0):y?(y=!1,s=!0):hf(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,l=r;if((e.line===i||e.lineIndent>t)&&(y&&(o=e.line,a=e.lineStart,c=e.position),Sf(e,t,4,!0,s)&&(y?p=e.result:f=e.result),y||(yf(e,h,g,m,p,f,o,a,c),m=p=f=null),If(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==l)hf(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return y&&yf(e,h,g,m,p,null,o,a,c),b&&(e.tag=u,e.anchor=d,e.kind="mapping",e.result=h),b}(e,g,h))||function(e,t){var n,r,s,i,o,a,c,l,u,d,h,g,m=!0,p=e.tag,f=e.anchor,y=/* @__PURE__ */Object.create(null);if(91===(g=e.input.charCodeAt(e.position)))o=93,l=!1,i=[];else{if(123!==g)return!1;o=125,l=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),g=e.input.charCodeAt(++e.position);0!==g;){if(If(e,!0,t),(g=e.input.charCodeAt(e.position))===o)return e.position++,e.tag=p,e.anchor=f,e.kind=l?"mapping":"sequence",e.result=i,!0;m?44===g&&hf(e,"expected the node content, but found ','"):hf(e,"missed comma between flow collection entries"),h=null,a=c=!1,63===g&&$p(e.input.charCodeAt(e.position+1))&&(a=c=!0,e.position++,If(e,!0,t)),n=e.line,r=e.lineStart,s=e.position,Sf(e,t,1,!1,!0),d=e.tag,u=e.result,If(e,!0,t),g=e.input.charCodeAt(e.position),!c&&e.line!==n||58!==g||(a=!0,g=e.input.charCodeAt(++e.position),If(e,!0,t),Sf(e,t,1,!1,!0),h=e.result),l?yf(e,i,y,d,u,h,n,r,s):a?i.push(yf(e,null,y,d,u,h,n,r,s)):i.push(u),If(e,!0,t),44===(g=e.input.charCodeAt(e.position))?(m=!0,g=e.input.charCodeAt(++e.position)):m=!1}hf(e,"unexpected end of the stream within a flow collection")}(e,h)?f=!0:(o&&function(e,t){var n,r,s,i,o=1,a=!1,c=!1,l=t,u=0,d=!1;if(124===(i=e.input.charCodeAt(e.position)))r=!1;else{if(62!==i)return!1;r=!0}for(e.kind="scalar",e.result="";0!==i;)if(43===(i=e.input.charCodeAt(++e.position))||45===i)1===o?o=43===i?3:2:hf(e,"repeat of a chomping mode identifier");else{if(!((s=nf(i))>=0))break;0===s?hf(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?hf(e,"repeat of an indentation width identifier"):(l=t+s-1,c=!0)}if(Qp(i)){do{i=e.input.charCodeAt(++e.position)}while(Qp(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!jp(i)&&0!==i)}for(;0!==i;){for(bf(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!c||e.lineIndent<l)&&32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>l&&(l=e.lineIndent),jp(i))u++;else{if(e.lineIndent<l){3===o?e.result+=tp.repeat("\n",a?1+u:u):1===o&&a&&(e.result+="\n");break}for(r?Qp(i)?(d=!0,e.result+=tp.repeat("\n",a?1+u:u)):d?(d=!1,e.result+=tp.repeat("\n",u+1)):0===u?a&&(e.result+=" "):e.result+=tp.repeat("\n",u):e.result+=tp.repeat("\n",a?1+u:u),a=!0,c=!0,u=0,n=e.position;!jp(i)&&0!==i;)i=e.input.charCodeAt(++e.position);pf(e,n,e.position,!1)}}return!0}(e,h)||function(e,t){var n,r,s;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=s=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(pf(e,r,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;r=e.position,e.position++,s=e.position}else jp(n)?(pf(e,r,s,!0),vf(e,If(e,!1,t)),r=s=e.position):e.position===e.lineStart&&wf(e)?hf(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);hf(e,"unexpected end of the stream within a single quoted scalar")}(e,h)||function(e,t){var n,r,s,i,o,a;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return pf(e,n,e.position,!0),e.position++,!0;if(92===a){if(pf(e,n,e.position,!0),jp(a=e.input.charCodeAt(++e.position)))If(e,!1,t);else if(a<256&&af[a])e.result+=cf[a],e.position++;else if((o=tf(a))>0){for(s=o,i=0;s>0;s--)(o=ef(a=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+o:hf(e,"expected hexadecimal character");e.result+=sf(i),e.position++}else hf(e,"unknown escape sequence");n=r=e.position}else jp(a)?(pf(e,n,r,!0),vf(e,If(e,!1,t)),n=r=e.position):e.position===e.lineStart&&wf(e)?hf(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}hf(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!$p(r)&&!qp(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&hf(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Hp.call(e.anchorMap,n)||hf(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],If(e,!0,-1),!0}(e)?function(e,t,n){var r,s,i,o,a,c,l,u,d=e.kind,h=e.result;if($p(u=e.input.charCodeAt(e.position))||qp(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&($p(r=e.input.charCodeAt(e.position+1))||n&&qp(r)))return!1;for(e.kind="scalar",e.result="",s=i=e.position,o=!1;0!==u;){if(58===u){if($p(r=e.input.charCodeAt(e.position+1))||n&&qp(r))break}else if(35===u){if($p(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&wf(e)||n&&qp(u))break;if(jp(u)){if(a=e.line,c=e.lineStart,l=e.lineIndent,If(e,!1,-1),e.lineIndent>=t){o=!0,u=e.input.charCodeAt(e.position);continue}e.position=i,e.line=a,e.lineStart=c,e.lineIndent=l;break}}o&&(pf(e,s,i,!1),vf(e,e.line-a),s=i=e.position,o=!1),Qp(u)||(i=e.position+1),u=e.input.charCodeAt(++e.position)}return pf(e,s,i,!1),!!e.result||(e.kind=d,e.result=h,!1)}(e,h,1===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||hf(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=a&&Gf(e,g))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&hf(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c<l;c+=1)if((d=e.implicitTypes[c]).resolve(e.result)){e.result=d.construct(e.result),e.tag=d.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(Hp.call(e.typeMap[e.kind||"fallback"],e.tag))d=e.typeMap[e.kind||"fallback"][e.tag];else for(d=null,c=0,l=(u=e.typeMap.multi[e.kind||"fallback"]).length;c<l;c+=1)if(e.tag.slice(0,u[c].tag.length)===u[c].tag){d=u[c];break}d||hf(e,"unknown tag !<"+e.tag+">"),null!==e.result&&d.kind!==e.kind&&hf(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+d.kind+'", not "'+e.kind+'"'),d.resolve(e.result,e.tag)?(e.result=d.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):hf(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function Zf(e){var t,n,r,s,i=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=/* @__PURE__ */Object.create(null),e.anchorMap=/* @__PURE__ */Object.create(null);0!==(s=e.input.charCodeAt(e.position))&&(If(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(o=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!$p(s);)s=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&hf(e,"directive name must not be less than one character in length");0!==s;){for(;Qp(s);)s=e.input.charCodeAt(++e.position);if(35===s){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&!jp(s));break}if(jp(s))break;for(t=e.position;0!==s&&!$p(s);)s=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==s&&bf(e),Hp.call(mf,n)?mf[n](e,n,r):gf(e,'unknown document directive "'+n+'"')}If(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,If(e,!0,-1)):o&&hf(e,"directives end mark is expected"),Sf(e,e.lineIndent-1,4,!1,!0),If(e,!0,-1),e.checkLineBreaks&&Kp.test(e.input.slice(i,e.position))&&gf(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&wf(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,If(e,!0,-1)):e.position<e.length-1&&hf(e,"end of the stream or a document separator is expected")}function Vf(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new uf(e,t),r=e.indexOf("\0");for(-1!==r&&(n.position=r,hf(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Zf(n);return n.documents}var Ef=function(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null);var r=Vf(e,n);if("function"!=typeof t)return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])},Xf=function(e,t){var n=Vf(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new sp("expected a single document in the stream, but found more")}},Bf={loadAll:Ef,load:Xf},xf=Object.prototype.toString,Rf=Object.prototype.hasOwnProperty,Wf=65279,Nf={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},Jf=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],_f=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function kf(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else{if(!(e<=4294967295))throw new sp("code point within a string may not be greater than 0xFFFFFFFF");n="U",r=8}return"\\"+n+tp.repeat("0",r-t.length)+t}function Ff(e){this.schema=e.schema||Tp,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=tp.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,r,s,i,o,a,c;if(null===t)return{};for(n={},s=0,i=(r=Object.keys(t)).length;s<i;s+=1)o=r[s],a=String(t[o]),"!!"===o.slice(0,2)&&(o="tag:yaml.org,2002:"+o.slice(2)),(c=e.compiledTypeMap.fallback[o])&&Rf.call(c.styleAliases,a)&&(a=c.styleAliases[a]),n[o]=a;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?2:1,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Yf(e,t){for(var n,r=tp.repeat(" ",t),s=0,i=-1,o="",a=e.length;s<a;)-1===(i=e.indexOf("\n",s))?(n=e.slice(s),s=a):(n=e.slice(s,i+1),s=i+1),n.length&&"\n"!==n&&(o+=r),o+=n;return o}function Lf(e,t){return"\n"+tp.repeat(" ",e.indent*t)}function Of(e){return 32===e||9===e}function Tf(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&e!==Wf||65536<=e&&e<=1114111}function Hf(e){return Tf(e)&&e!==Wf&&13!==e&&10!==e}function Mf(e,t,n){var r=Hf(e),s=r&&!Of(e);return(n?r:r&&44!==e&&91!==e&&93!==e&&123!==e&&125!==e)&&35!==e&&!(58===t&&!s)||Hf(t)&&!Of(t)&&35===e||58===t&&s}function Kf(e,t){var n,r=e.charCodeAt(t);return r>=55296&&r<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1))>=56320&&n<=57343?1024*(r-55296)+n-56320+65536:r}function zf(e){return/^\n* /.test(e)}function Df(e,t,n,r,s,i,o,a){var c,l,u=0,d=null,h=!1,g=!1,m=-1!==r,p=-1,f=Tf(l=Kf(e,0))&&l!==Wf&&!Of(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&function(e){return!Of(e)&&58!==e}(Kf(e,e.length-1));if(t||o)for(c=0;c<e.length;u>=65536?c+=2:c++){if(!Tf(u=Kf(e,c)))return 5;f=f&&Mf(u,d,a),d=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(10===(u=Kf(e,c)))h=!0,m&&(g=g||c-p-1>r&&" "!==e[p+1],p=c);else if(!Tf(u))return 5;f=f&&Mf(u,d,a),d=u}g=g||m&&c-p-1>r&&" "!==e[p+1]}return h||g?n>9&&zf(e)?5:o?2===i?5:2:g?4:3:!f||o||s(e)?2===i?5:2:1}function Uf(e,t,n,r,s){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Jf.indexOf(t)||_f.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),a=r||e.flowLevel>-1&&n>=e.flowLevel;switch(Df(t,a,e.indent,o,function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(e,t)},e.quotingType,e.forceQuotes&&!r,s)){case 1:return t;case 2:return"'"+t.replace(/'/g,"''")+"'";case 3:return"|"+Pf(t,e.indent)+jf(Yf(t,i));case 4:return">"+Pf(t,e.indent)+jf(Yf(function(e,t){var n,r,s=/(\n+)([^\n]*)/g,i=(a=e.indexOf("\n"),a=-1!==a?a:e.length,s.lastIndex=a,Qf(e.slice(0,a),t)),o="\n"===e[0]||" "===e[0];var a;for(;r=s.exec(e);){var c=r[1],l=r[2];n=" "===l[0],i+=c+(o||n||""===l?"":"\n")+Qf(l,t),o=n}return i}(t,o),i));case 5:return'"'+function(e){for(var t,n="",r=0,s=0;s<e.length;r>=65536?s+=2:s++)r=Kf(e,s),!(t=Nf[r])&&Tf(r)?(n+=e[s],r>=65536&&(n+=e[s+1])):n+=t||kf(r);return n}(t)+'"';default:throw new sp("impossible error: invalid scalar style")}}()}function Pf(e,t){var n=zf(e)?String(t):"",r="\n"===e[e.length-1];return n+(r&&("\n"===e[e.length-2]||"\n"===e)?"+":r?"":"-")+"\n"}function jf(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Qf(e,t){if(""===e||" "===e[0])return e;for(var n,r,s=/ [^ ]/g,i=0,o=0,a=0,c="";n=s.exec(e);)(a=n.index)-i>t&&(r=o>i?o:a,c+="\n"+e.slice(i,r),i=r+1),o=a;return c+="\n",e.length-i>t&&o>i?c+=e.slice(i,o)+"\n"+e.slice(o+1):c+=e.slice(i),c.slice(1)}function $f(e,t,n,r){var s,i,o,a="",c=e.tag;for(s=0,i=n.length;s<i;s+=1)o=n[s],e.replacer&&(o=e.replacer.call(n,String(s),o)),(ey(e,t+1,o,!0,!0,!1,!0)||void 0===o&&ey(e,t+1,null,!0,!0,!1,!0))&&(r&&""===a||(a+=Lf(e,t)),e.dump&&10===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=c,e.dump=a||"[]"}function qf(e,t,n){var r,s,i,o,a,c;for(i=0,o=(s=n?e.explicitTypes:e.implicitTypes).length;i<o;i+=1)if(((a=s[i]).instanceOf||a.predicate)&&(!a.instanceOf||"object"==typeof t&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(n?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(c=e.styleMap[a.tag]||a.defaultStyle,"[object Function]"===xf.call(a.represent))r=a.represent(t,c);else{if(!Rf.call(a.represent,c))throw new sp("!<"+a.tag+'> tag resolver accepts not "'+c+'" style');r=a.represent[c](t,c)}e.dump=r}return!0}return!1}function ey(e,t,n,r,s,i,o){e.tag=null,e.dump=n,qf(e,n,!1)||qf(e,n,!0);var a,c=xf.call(e.dump),l=r;r&&(r=e.flowLevel<0||e.flowLevel>t);var u,d,h="[object Object]"===c||"[object Array]"===c;if(h&&(d=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||d||2!==e.indent&&t>0)&&(s=!1),d&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(h&&d&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===c)r&&0!==Object.keys(e.dump).length?(!function(e,t,n,r){var s,i,o,a,c,l,u="",d=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new sp("sortKeys must be a boolean or a function");for(s=0,i=h.length;s<i;s+=1)l="",r&&""===u||(l+=Lf(e,t)),a=n[o=h[s]],e.replacer&&(a=e.replacer.call(n,o,a)),ey(e,t+1,o,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&10===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=Lf(e,t)),ey(e,t+1,a,!0,c)&&(e.dump&&10===e.dump.charCodeAt(0)?l+=":":l+=": ",u+=l+=e.dump));e.tag=d,e.dump=u||"{}"}(e,t,e.dump,s),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var r,s,i,o,a,c="",l=e.tag,u=Object.keys(n);for(r=0,s=u.length;r<s;r+=1)a="",""!==c&&(a+=", "),e.condenseFlow&&(a+='"'),o=n[i=u[r]],e.replacer&&(o=e.replacer.call(n,i,o)),ey(e,t,i,!1,!1)&&(e.dump.length>1024&&(a+="? "),a+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ey(e,t,o,!1,!1)&&(c+=a+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===c)r&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?$f(e,t-1,e.dump,s):$f(e,t,e.dump,s),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var r,s,i,o="",a=e.tag;for(r=0,s=n.length;r<s;r+=1)i=n[r],e.replacer&&(i=e.replacer.call(n,String(r),i)),(ey(e,t,i,!1,!1)||void 0===i&&ey(e,t,null,!1,!1))&&(""!==o&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=a,e.dump="["+o+"]"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else{if("[object String]"!==c){if("[object Undefined]"===c)return!1;if(e.skipInvalid)return!1;throw new sp("unacceptable kind of an object to dump "+c)}"?"!==e.tag&&Uf(e,e.dump,t,i,l)}null!==e.tag&&"?"!==e.tag&&(a=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),a="!"===e.tag[0]?"!"+a:"tag:yaml.org,2002:"===a.slice(0,18)?"!!"+a.slice(18):"!<"+a+">",e.dump=a+" "+e.dump)}return!0}function ty(e,t){var n,r,s=[],i=[];for(ny(e,s,i),n=0,r=i.length;n<r;n+=1)t.duplicates.push(s[i[n]]);t.usedDuplicates=new Array(r)}function ny(e,t,n){var r,s,i;if(null!==e&&"object"==typeof e)if(-1!==(s=t.indexOf(e)))-1===n.indexOf(s)&&n.push(s);else if(t.push(e),Array.isArray(e))for(s=0,i=e.length;s<i;s+=1)ny(e[s],t,n);else for(s=0,i=(r=Object.keys(e)).length;s<i;s+=1)ny(e[r[s]],t,n)}var ry=function(e,t){var n=new Ff(t=t||{});n.noRefs||ty(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),ey(n,0,r,!0,!0)?n.dump+"\n":""};function sy(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var iy={Type:up,Schema:gp,FAILSAFE_SCHEMA:yp,JSON_SCHEMA:Vp,CORE_SCHEMA:Ep,DEFAULT_SCHEMA:Tp,load:Bf.load,loadAll:Bf.loadAll,dump:{dump:ry}.dump,YAMLException:sp,types:{binary:Np,float:Zp,map:fp,null:bp,pairs:Yp,set:Op,timestamp:xp,bool:Ip,int:Ap,merge:Rp,omap:kp,seq:pp,str:mp},safeLoad:sy("safeLoad","load"),safeLoadAll:sy("safeLoadAll","loadAll"),safeDump:sy("safeDump","dump")};const oy=new Lt;oy.name("fluxlay").description("Fluxlay CLI for building and managing wallpapers").version("0.1.0"),oy.command("login").description("Login to Supabase").action(async()=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await qm(),Je(dt.green("Login process completed."))}catch(e){We(dt.red(`Login failed: ${e}`)),process.exit(1)}}),oy.command("logout").description("Logout from Supabase").action(async()=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await(async()=>{await es.clearSession(),Re.success(dt.green("Logged out successfully."))})(),Je(dt.green("Logged out successfully."))}catch(e){We(dt.red(`Logout failed: ${e}`)),process.exit(1)}}),oy.command("whoami").description("Show current logged in user").action(async()=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await(async()=>{const e=await um(),{data:{user:t},error:n}=await e.auth.getUser();if(n||!t)return n&&Re.error(`Auth error: ${n.message}`),void Re.warn("Not logged in.");Re.info(`Logged in as: ${dt.green(t.email??"unknown")}`)})(),Je(dt.green("Done."))}catch(e){We(dt.red(`Failed to get user info: ${e}`)),process.exit(1)}}),oy.command("build").description("Build a Fluxlay wallpaper").argument("[dir]","Directory to build",".").option("-o, --output <name>","Output filename","wallpaper.fluxlay").action(async(e,t)=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await async function(e,t){await es.getSession()||(Re.error(dt.red("You must be logged in to build. Run `fluxlay login`.")),process.exit(1));const n=o.resolve(process.cwd(),e),r=o.join(n,"fluxlay.yaml");i.existsSync(r)||(Re.error(dt.red("fluxlay.yaml is required in the project root.")),process.exit(1));const s=Le();s.start(dt.yellow("Validating manifest..."));try{const e=i.readFileSync(r,"utf-8");Pt(e),s.stop(`${dt.green("✔")} Manifest validated.`)}catch(u){s.stop(dt.red("Manifest validation failed")),Re.error(u.message),process.exit(1)}const a=o.join(n,"dist"),c=o.resolve(n,t.output);s.start(`Building component in ${dt.cyan(n)}...`);try{await d({root:n,configFile:o.resolve(n,"vite.config.ts"),build:{outDir:"dist"},logLevel:"error"}),s.stop(`${dt.green("✔")} Component built.`)}catch(u){s.stop(dt.red("Build failed")),Re.error(u.message),process.exit(1)}let l;s.start(dt.yellow("Fetching developer key..."));try{const e=await pm.getDeveloperKey();if(e)l=Buffer.from(e).toString("hex"),s.stop(`${dt.green("✔")} Using cached developer key.`);else{const{developerKey:e}=await gm.getDeveloperKey({});l=Buffer.from(e).toString("hex"),await pm.saveDeveloperKey(e),s.stop(`${dt.green("✔")} Developer key fetched from API.`)}}catch(u){s.stop(dt.red("Failed to fetch developer key")),Re.error(u.message),process.exit(1)}s.start(dt.yellow("Packaging with DRM..."));try{await jt(a,c,l,0),s.stop(`${dt.green("✔")} Packaging completed.`)}catch(u){s.stop(dt.red("Packaging failed")),Re.error(u.message),process.exit(1)}Fe(`Output: ${dt.underline.cyan(c)}`,"Success!")}(e,t),Je(dt.green("Build completed."))}catch(n){We(dt.red(`Build failed: ${n}`)),process.exit(1)}}),oy.command("publish").description("Publish a Fluxlay wallpaper to the store").argument("[dir]","Directory to publish",".").action(async e=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await async function(e){await es.getSession()||(Re.error(dt.red("You must be logged in to publish. Run `fluxlay login`.")),process.exit(1));const t=o.resolve(process.cwd(),e),n=o.join(t,"fluxlay.yaml");i.existsSync(n)||(Re.error(dt.red("fluxlay.yaml is required in the project root.")),process.exit(1));const r=Le();let s;r.start(dt.yellow("Validating manifest..."));try{const e=i.readFileSync(n,"utf-8");Pt(e),s=iy.load(e),r.stop(`${dt.green("✔")} Manifest validated: ${dt.cyan(s.name)} (v${s.version})`)}catch(m){r.stop(dt.red("Manifest validation failed")),Re.error(m.message),process.exit(1)}const a=W.randomBytes(32),c=a.toString("hex");let l,u;r.start(dt.yellow("Registering wallpaper with API..."));try{const e=await gm.registerWallpaper({slug:s.slug,name:s.name,version:s.version,contentKey:a});l=e.versionId,u=e.uploadUrl,r.stop(`${dt.green("✔")} Wallpaper registered.`)}catch(m){r.stop(dt.red("Registration failed")),Re.error(m.message),process.exit(1)}const h=o.join(t,"dist"),g=o.join(t,`.fluxlay-${l}.tmp`);try{r.start(dt.yellow("Building component with Vite...")),await d({root:t,configFile:o.resolve(t,"vite.config.ts"),build:{outDir:"dist"},logLevel:"error"}),r.stop(`${dt.green("✔")} Component built.`),r.start(dt.yellow("Packaging with Content Key...")),await jt(h,g,c,1),r.stop(`${dt.green("✔")} Package created.`),r.start(dt.yellow("Uploading to storage..."));const e=i.readFileSync(g),n=await fetch(u,{method:"PUT",body:e,headers:{"Content-Type":"application/octet-stream"}});if(!n.ok)throw new Error(`Upload failed: ${n.statusText}`);r.stop(`${dt.green("✔")} Upload completed.`),r.start(dt.yellow("Confirming upload with API...")),await gm.confirmUpload({versionId:l}),r.stop(`${dt.green("✔")} Upload confirmed.`),Fe(`Wallpaper ID: ${dt.cyan(l)}`,"Success!")}catch(m){r.stop(dt.red("Publishing process failed")),Re.error(m.message),Re.warn(dt.yellow("Cancelling upload..."));try{await gm.cancelUpload({versionId:l})}catch(p){Re.error(`Failed to cancel upload: ${p.message}`)}process.exit(1)}finally{i.existsSync(g)&&i.unlinkSync(g)}}(e),Je(dt.green("Published successfully."))}catch(t){We(dt.red(`Publish failed: ${t}`)),process.exit(1)}}),oy.command("dev").description("Start development server for a Fluxlay wallpaper").argument("[dir]","Directory to watch",".").action(async e=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await ym(e)}catch(t){We(dt.red(`Dev server failed: ${t}`)),process.exit(1)}}),oy.parse();
|
|
3
|
+
return new Date(`${t}T00:00:00.0Z`)}catch(o){return null}}(e);if(i&&i.getTime()>=hh.timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?s=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(s=r.error_code),s){if("weak_password"===s)throw new Eh(rg(r),e.status,(null===(t=r.weak_password)||void 0===t?void 0:t.reasons)||[]);if("session_not_found"===s)throw new Ih}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 Eh(rg(r),e.status,r.weak_password.reasons);throw new fh(rg(r),e.status||500,s)}async function og(e,t,n,r){var s;const i=Object.assign({},null==r?void 0:r.headers);i[dh]||(i[dh]=hh.name),(null==r?void 0:r.jwt)&&(i.Authorization=`Bearer ${r.jwt}`);const o=null!==(s=null==r?void 0:r.query)&&void 0!==s?s:{};(null==r?void 0:r.redirectTo)&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await async function(e,t,n,r,s,i){const o=((e,t,n,r)=>{const s={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))})(t,r,s,i);let a;try{a=await e(n,Object.assign({},o))}catch(c){throw console.error(c),new Zh(rg(c),0)}a.ok||await ig(a);if(null==r?void 0:r.noResolveJson)return a;try{return await a.json()}catch(c){await ig(c)}}(e,t,n+a,{headers:i,noResolveJson:null==r?void 0:r.noResolveJson},{},null==r?void 0:r.body);return(null==r?void 0:r.xform)?null==r?void 0:r.xform(c):{data:Object.assign({},c),error:null}}function ag(e){var t;let n=null;var r;(function(e){return e.access_token&&e.refresh_token&&e.expires_in})(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:n,user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function cg(e){const t=ag(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 lg(e){var t;return{data:{user:null!==(t=e.user)&&void 0!==t?t:e},error:null}}function ug(e){return{data:e,error:null}}function dg(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=e,o=iu(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]);return{data:{properties:{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},user:Object.assign({},o)},error:null}}function hg(e){return e}const gg=["global","local","others"];class mg{constructor({url:e="",headers:t={},fetch:n}){this.url=e,this.headers=t,this.fetch=Hh(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,t=gg[0]){if(gg.indexOf(t)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${gg.join(", ")}`);try{return await og(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ph(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,t={}){try{return await og(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:lg})}catch(n){if(ph(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:t}=e,n=iu(e,["options"]),r=Object.assign(Object.assign({},n),t);return"newEmail"in n&&(r.new_email=null==n?void 0:n.newEmail,delete r.newEmail),await og(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:dg,redirectTo:null==t?void 0:t.redirectTo})}catch(t){if(ph(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(e){try{return await og(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:lg})}catch(t){if(ph(t))return{data:{user:null},error:t};throw t}}async listUsers(e){var t,n,r,s,i,o,a;try{const c={nextPage:null,lastPage:0,total:0},l=await og(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(n=null===(t=null==e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",per_page:null!==(s=null===(r=null==e?void 0:e.perPage)||void 0===r?void 0:r.toString())&&void 0!==s?s:""},xform:hg});if(l.error)throw l.error;const u=await l.json(),d=null!==(i=l.headers.get("x-total-count"))&&void 0!==i?i:0,h=null!==(a=null===(o=l.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return h.length>0&&(h.forEach(e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),n=JSON.parse(e.split(";")[1].split("=")[1]);c[`${n}Page`]=t}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},u),c),error:null}}catch(c){if(ph(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){eg(e);try{return await og(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:lg})}catch(t){if(ph(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){eg(e);try{return await og(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:lg})}catch(n){if(ph(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,t=!1){eg(e);try{return await og(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:lg})}catch(n){if(ph(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){eg(e.userId);try{const{data:t,error:n}=await og(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:n}}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _deleteFactor(e){eg(e.userId),eg(e.id);try{return{data:await og(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _listOAuthClients(e){var t,n,r,s,i,o,a;try{const c={nextPage:null,lastPage:0,total:0},l=await og(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(n=null===(t=null==e?void 0:e.page)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",per_page:null!==(s=null===(r=null==e?void 0:e.perPage)||void 0===r?void 0:r.toString())&&void 0!==s?s:""},xform:hg});if(l.error)throw l.error;const u=await l.json(),d=null!==(i=l.headers.get("x-total-count"))&&void 0!==i?i:0,h=null!==(a=null===(o=l.headers.get("link"))||void 0===o?void 0:o.split(","))&&void 0!==a?a:[];return h.length>0&&(h.forEach(e=>{const t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),n=JSON.parse(e.split(";")[1].split("=")[1]);c[`${n}Page`]=t}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},u),c),error:null}}catch(c){if(ph(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await og(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _getOAuthClient(e){try{return await og(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _updateOAuthClient(e,t){try{return await og(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(n){if(ph(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await og(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if(ph(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(e){try{return await og(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(t){if(ph(t))return{data:null,error:t};throw t}}}function pg(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const fg=!!(globalThis&&Th()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"));class yg extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class bg extends yg{}async function Ig(e,t,n){fg&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;t>0&&setTimeout(()=>{r.abort(),fg&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async r=>{if(!r){if(0===t)throw fg&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new bg(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(fg)try{const e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null," "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}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 n()}fg&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,r.name);try{return await n()}finally{fg&&console.log("@supabase/gotrue-js: navigatorLock: released",e,r.name)}})}catch(s){if("AbortError"===(null==s?void 0:s.name))throw new bg(`Acquiring an exclusive Navigator LockManager lock "${e}" timed out waiting ${t}ms`);throw s}}function wg(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function vg(e){const t=(new TextEncoder).encode(e);return"0x"+Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}class Gg extends Error{constructor({message:e,code:t,cause:n,name:r}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=null!==(s=null!=r?r:n instanceof Error?n.name:void 0)&&void 0!==s?s:"Unknown Error",this.code=t}}class Ag extends Gg{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}function Cg({error:e,options:t}){var n,r,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new Gg({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if(!0===(null===(n=i.authenticatorSelection)||void 0===n?void 0:n.requireResidentKey))return new Gg({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if("conditional"===t.mediation&&"required"===(null===(r=i.authenticatorSelection)||void 0===r?void 0:r.userVerification))return new Gg({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if("required"===(null===(s=i.authenticatorSelection)||void 0===s?void 0:s.userVerification))return new Gg({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if("InvalidStateError"===e.name)return new Gg({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if("NotAllowedError"===e.name)return new Gg({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("NotSupportedError"===e.name){return 0===i.pubKeyCredParams.filter(e=>"public-key"===e.type).length?new Gg({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Gg({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e})}if("SecurityError"===e.name){const t=window.location.hostname;if(!xg(t))return new Gg({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(i.rp.id!==t)return new Gg({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Gg({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new Gg({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Gg({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Sg({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new Gg({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if("NotAllowedError"===e.name)return new Gg({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if("SecurityError"===e.name){const t=window.location.hostname;if(!xg(t))return new Gg({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(n.rpId!==t)return new Gg({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new Gg({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Gg({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}const Zg=new class{createNewAbortSignal(){if(this.controller){const e=new Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};function Vg(e){if(!e)throw new Error("Credential creation options are required");if("undefined"!=typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,s=iu(e,["challenge","user","excludeCredentials"]),i=kh(t).buffer,o=Object.assign(Object.assign({},n),{id:kh(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let e=0;e<r.length;e++){const t=r[e];a.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:kh(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return a}function Eg(e){if(!e)throw new Error("Credential request options are required");if("undefined"!=typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=iu(e,["challenge","allowCredentials"]),s=kh(t).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let e=0;e<n.length;e++){const t=n[e];i.allowCredentials[e]=Object.assign(Object.assign({},t),{id:kh(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return i}function Xg(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:Yh(new Uint8Array(e.response.attestationObject)),clientDataJSON:Yh(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:null!==(t=n.authenticatorAttachment)&&void 0!==t?t:void 0}}function Bg(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Yh(new Uint8Array(s.authenticatorData)),clientDataJSON:Yh(new Uint8Array(s.clientDataJSON)),signature:Yh(new Uint8Array(s.signature)),userHandle:s.userHandle?Yh(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!==(t=n.authenticatorAttachment)&&void 0!==t?t:void 0}}function xg(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Rg(){var e,t;return!!(Lh()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null===(e=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===e?void 0:e.create)&&"function"==typeof(null===(t=null===navigator||void 0===navigator?void 0:navigator.credentials)||void 0===t?void 0:t.get))}const Wg={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Ng={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Jg(...e){const t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),r={};for(const s of e)if(s)for(const e in s){const i=s[e];if(void 0!==i)if(Array.isArray(i))r[e]=i;else if(n(i))r[e]=i;else if(t(i)){const n=r[e];t(n)?r[e]=Jg(n,i):r[e]=Jg(i)}else r[e]=i}return r}class _g{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:n,signal:r},s){var i;try{const{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!o)return{data:null,error:a};const c=null!=r?r:Zg.createNewAbortSignal();if("create"===o.webauthn.type){const{user:e}=o.webauthn.credential_options.publicKey;if(!e.name){const t=n;if(t)e.name=`${e.id}:${t}`;else{const t=(await this.client.getUser()).data.user,n=(null===(i=null==t?void 0:t.user_metadata)||void 0===i?void 0:i.name)||(null==t?void 0:t.email)||(null==t?void 0:t.id)||"User";e.name=`${e.id}:${n}`}}e.displayName||(e.displayName=e.name)}switch(o.webauthn.type){case"create":{const t=function(e,t){return Jg(Wg,e,t||{})}(o.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:n,error:r}=await async function(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Ag("Browser returned unexpected credential type",t)}:{data:null,error:new Ag("Empty credential response",t)}}catch(t){return{data:null,error:Cg({error:t,options:e})}}}({publicKey:t,signal:c});return n?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:n}},error:null}:{data:null,error:r}}case"request":{const t=function(e,t){return Jg(Ng,e,t||{})}(o.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:n,error:r}=await async function(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Ag("Browser returned unexpected credential type",t)}:{data:null,error:new Ag("Empty credential response",t)}}catch(t){return{data:null,error:Sg({error:t,options:e})}}}(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:t,signal:c}));return n?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:n}},error:null}:{data:null,error:r}}}}catch(o){return ph(o)?{data:null,error:o}:{data:null,error:new yh("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:t,webauthn:n}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:t=("undefined"!=typeof window?window.location.hostname:void 0),rpOrigins:n=("undefined"!=typeof window?[window.location.origin]:void 0),signal:r}={}},s){if(!t)return{data:null,error:new mh("rpId is required for WebAuthn authentication")};try{if(!Rg())return{data:null,error:new yh("Browser does not support WebAuthn",null)};const{data:i,error:o}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:n},signal:r},{request:s});if(!i)return{data:null,error:o};const{webauthn:a}=i;return this._verify({factorId:e,challengeId:i.challengeId,webauthn:{type:a.type,rpId:t,rpOrigins:n,credential_response:a.credential_response}})}catch(i){return ph(i)?{data:null,error:i}:{data:null,error:new yh("Unexpected error in authenticate",i)}}}async _register({friendlyName:e,webauthn:{rpId:t=("undefined"!=typeof window?window.location.hostname:void 0),rpOrigins:n=("undefined"!=typeof window?[window.location.origin]:void 0),signal:r}={}},s){if(!t)return{data:null,error:new mh("rpId is required for WebAuthn registration")};try{if(!Rg())return{data:null,error:new yh("Browser does not support WebAuthn",null)};const{data:i,error:o}=await this._enroll({friendlyName:e});if(!i)return await this.client.mfa.listFactors().then(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n.all.find(t=>"webauthn"===t.factor_type&&t.friendly_name===e&&"unverified"!==t.status)}).then(e=>e?this.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0),{data:null,error:o};const{data:a,error:c}=await this._challenge({factorId:i.id,friendlyName:i.friendly_name,webauthn:{rpId:t,rpOrigins:n},signal:r},{create:s});return a?this._verify({factorId:i.id,challengeId:a.challengeId,webauthn:{rpId:t,rpOrigins:n,type:a.webauthn.type,credential_response:a.webauthn.credential_response}}):{data:null,error:c}}catch(i){return ph(i)?{data:null,error:i}:{data:null,error:new yh("Unexpected error in register",i)}}}}!function(){if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}}();const kg={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:uh,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4,skipAutoInitialize:!1};async function Fg(e,t,n){return await n()}const Yg={};class Lg{get jwks(){var e,t;return null!==(t=null===(e=Yg[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){Yg[this.storageKey]=Object.assign(Object.assign({},Yg[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=Yg[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Yg[this.storageKey]=Object.assign(Object.assign({},Yg[this.storageKey]),{cachedAt:e})}constructor(e){var t,n,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=/* @__PURE__ */new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=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;const s=Object.assign(Object.assign({},kg),e);if(this.storageKey=s.storageKey,this.instanceID=null!==(t=Lg.nextInstanceID[this.storageKey])&&void 0!==t?t:0,Lg.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,"function"==typeof s.debug&&(this.logger=s.debug),this.instanceID>0&&Lh()){const e=`${this._logPrefix()} 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.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new mg({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=Hh(s.fetch),this.lock=s.lock||Fg,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,this.lockAcquireTimeout=s.lockAcquireTimeout,s.lock?this.lock=s.lock:this.persistSession&&Lh()&&(null===(n=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===n?void 0:n.locks)?this.lock=Ig:this.lock=Fg,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new _g(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:Th()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=pg(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=pg(this.memoryStorage)),Lh()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(i){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",i)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(t){this._debug("#broadcastChannel","error",t)}})}s.skipAutoInitialize||this.initialize().catch(e=>{this._debug("#initialize()","error",e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${ah}) ${/* @__PURE__ */(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){var e;try{let t={},n="none";if(Lh()&&(t=function(e){const t={},n=new URL(e);if(n.hash&&"#"===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(r){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t}(window.location.href),this._isImplicitGrantCallback(t)?n="implicit":await this._isPKCECallback(t)&&(n="pkce")),Lh()&&this.detectSessionInUrl&&"none"!==n){const{data:r,error:s}=await this._getSessionFromURL(t,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),function(e){return ph(e)&&"AuthImplicitGrantRedirectError"===e.name}(s)){const t=null===(e=s.details)||void 0===e?void 0:e.code;if("identity_already_exists"===t||"identity_not_found"===t||"single_identity_not_deletable"===t)return{error:s}}return{error:s}}const{session:i,redirectType:o}=r;return this._debug("#_initialize()","detected session in URL",i,"redirect type",o),await this._saveSession(i),setTimeout(async()=>{"recovery"===o?await this._notifyAllSubscribers("PASSWORD_RECOVERY",i):await this._notifyAllSubscribers("SIGNED_IN",i)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return ph(t)?this._returnResult({error:t}):this._returnResult({error:new yh("Unexpected error during initialization",t)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,n,r;try{const s=await og(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!==(n=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==n?n:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:ag}),{data:i,error:o}=s;if(o||!i)return this._returnResult({data:{user:null,session:null},error:o});const a=i.session,c=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",a)),this._returnResult({data:{user:c,session:a},error:null})}catch(s){if(ph(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var t,n,r;try{let s;if("email"in e){const{email:n,password:r,options:i}=e;let o=null,a=null;"pkce"===this.flowType&&([o,a]=await Qh(this.storage,this.storageKey)),s=await og(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==i?void 0:i.emailRedirectTo,body:{email:n,password:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:o,code_challenge_method:a},xform:ag})}else{if(!("phone"in e))throw new Gh("You must provide either an email or phone number and a password");{const{phone:t,password:i,options:o}=e;s=await og(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:i,data:null!==(n=null==o?void 0:o.data)&&void 0!==n?n:{},channel:null!==(r=null==o?void 0:o.channel)&&void 0!==r?r:"sms",gotrue_meta_security:{captcha_token:null==o?void 0:o.captchaToken}},xform:ag})}}const{data:i,error:o}=s;if(o||!i)return await zh(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const a=i.session,c=i.user;return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",a)),this._returnResult({data:{user:c,session:a},error:null})}catch(s){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let t;if("email"in e){const{email:n,password:r,options:s}=e;t=await og(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:n,password:r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:cg})}else{if(!("phone"in e))throw new Gh("You must provide either an email or phone number and a password");{const{phone:n,password:r,options:s}=e;t=await og(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:n,password:r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:cg})}}const{data:n,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!n||!n.session||!n.user){const e=new vh;return this._returnResult({data:{user:null,session:null},error:e})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:r})}catch(t){if(ph(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOAuth(e){var t,n,r,s;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(n=e.options)||void 0===n?void 0:n.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(s=e.options)||void 0===s?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,n,r,s,i,o,a,c,l,u,d;let h,g;if("message"in e)h=e.message,g=e.signature;else{const{chain:u,wallet:d,statement:m,options:p}=e;let f;if(Lh())if("object"==typeof d)f=d;else{const e=window;if(!("ethereum"in e)||"object"!=typeof e.ethereum||!("request"in e.ethereum)||"function"!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if("object"!=typeof d||!(null==p?void 0:p.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");f=d}const y=new URL(null!==(t=null==p?void 0:p.url)&&void 0!==t?t:window.location.href),b=await f.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const I=wg(b[0]);let w=null===(n=null==p?void 0:p.signInWithEthereum)||void 0===n?void 0:n.chainId;if(!w){const e=await f.request({method:"eth_chainId"});w=parseInt(e,16)}h=function(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=/* @__PURE__ */new Date,nonce:o,notBefore:a,requestId:c,resources:l,scheme:u,uri:d,version:h}=e;if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==h)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);if(null===(t=e.statement)||void 0===t?void 0:t.includes("\n"))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);const g=`${u?`${u}://${r}`:r} wants you to sign in with your Ethereum account:\n${wg(e.address)}\n\n${e.statement?`${e.statement}\n`:""}`;let m=`URI: ${d}\nVersion: ${h}\nChain ID: ${n}${o?`\nNonce: ${o}`:""}\nIssued At: ${i.toISOString()}`;if(s&&(m+=`\nExpiration Time: ${s.toISOString()}`),a&&(m+=`\nNot Before: ${a.toISOString()}`),c&&(m+=`\nRequest ID: ${c}`),l){let e="\nResources:";for(const t of l){if(!t||"string"!=typeof t)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=`\n- ${t}`}m+=e}return`${g}\n${m}`}({domain:y.host,address:I,statement:m,uri:y.href,version:"1",chainId:w,nonce:null===(r=null==p?void 0:p.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(i=null===(s=null==p?void 0:p.signInWithEthereum)||void 0===s?void 0:s.issuedAt)&&void 0!==i?i:/* @__PURE__ */new Date,expirationTime:null===(o=null==p?void 0:p.signInWithEthereum)||void 0===o?void 0:o.expirationTime,notBefore:null===(a=null==p?void 0:p.signInWithEthereum)||void 0===a?void 0:a.notBefore,requestId:null===(c=null==p?void 0:p.signInWithEthereum)||void 0===c?void 0:c.requestId,resources:null===(l=null==p?void 0:p.signInWithEthereum)||void 0===l?void 0:l.resources}),g=await f.request({method:"personal_sign",params:[vg(h),I]})}try{const{data:t,error:n}=await og(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:g},(null===(u=e.options)||void 0===u?void 0:u.captchaToken)?{gotrue_meta_security:{captcha_token:null===(d=e.options)||void 0===d?void 0:d.captchaToken}}:null),xform:ag});if(n)throw n;if(!t||!t.session||!t.user){const e=new vh;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:n})}catch(m){if(ph(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(e){var t,n,r,s,i,o,a,c,l,u,d,h;let g,m;if("message"in e)g=e.message,m=e.signature;else{const{chain:d,wallet:h,statement:p,options:f}=e;let y;if(Lh())if("object"==typeof h)y=h;else{const e=window;if(!("solana"in e)||"object"!=typeof e.solana||!("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");y=e.solana}else{if("object"!=typeof h||!(null==f?void 0:f.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");y=h}const b=new URL(null!==(t=null==f?void 0:f.url)&&void 0!==t?t:window.location.href);if("signIn"in y&&y.signIn){const e=await y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:/* @__PURE__ */(new Date).toISOString()},null==f?void 0:f.signInWithSolana),{version:"1",domain:b.host,uri:b.href}),p?{statement:p}:null));let t;if(Array.isArray(e)&&e[0]&&"object"==typeof e[0])t=e[0];else{if(!(e&&"object"==typeof e&&"signedMessage"in e&&"signature"in e))throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");t=e}if(!("signedMessage"in t&&"signature"in t&&("string"==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields");g="string"==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),m=t.signature}else{if(!("signMessage"in y&&"function"==typeof y.signMessage&&"publicKey"in y&&"object"==typeof y&&y.publicKey&&"toBase58"in y.publicKey&&"function"==typeof y.publicKey.toBase58))throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${b.host} wants you to sign in with your Solana account:`,y.publicKey.toBase58(),...p?["",p,""]:[""],"Version: 1",`URI: ${b.href}`,`Issued At: ${null!==(r=null===(n=null==f?void 0:f.signInWithSolana)||void 0===n?void 0:n.issuedAt)&&void 0!==r?r:/* @__PURE__ */(new Date).toISOString()}`,...(null===(s=null==f?void 0:f.signInWithSolana)||void 0===s?void 0:s.notBefore)?[`Not Before: ${f.signInWithSolana.notBefore}`]:[],...(null===(i=null==f?void 0:f.signInWithSolana)||void 0===i?void 0:i.expirationTime)?[`Expiration Time: ${f.signInWithSolana.expirationTime}`]:[],...(null===(o=null==f?void 0:f.signInWithSolana)||void 0===o?void 0:o.chainId)?[`Chain ID: ${f.signInWithSolana.chainId}`]:[],...(null===(a=null==f?void 0:f.signInWithSolana)||void 0===a?void 0:a.nonce)?[`Nonce: ${f.signInWithSolana.nonce}`]:[],...(null===(c=null==f?void 0:f.signInWithSolana)||void 0===c?void 0:c.requestId)?[`Request ID: ${f.signInWithSolana.requestId}`]:[],...(null===(u=null===(l=null==f?void 0:f.signInWithSolana)||void 0===l?void 0:l.resources)||void 0===u?void 0:u.length)?["Resources",...f.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");const e=await y.signMessage((new TextEncoder).encode(g),"utf8");if(!(e&&e instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=e}}try{const{data:t,error:n}=await og(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:Yh(m)},(null===(d=e.options)||void 0===d?void 0:d.captchaToken)?{gotrue_meta_security:{captcha_token:null===(h=e.options)||void 0===h?void 0:h.captchaToken}}:null),xform:ag});if(n)throw n;if(!t||!t.session||!t.user){const e=new vh;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign({},t),error:n})}catch(p){if(ph(p))return this._returnResult({data:{user:null,session:null},error:p});throw p}}async _exchangeCodeForSession(e){const t=await Kh(this.storage,`${this.storageKey}-code-verifier`),[n,r]=(null!=t?t:"").split("/");try{if(!n&&"pkce"===this.flowType)throw new Sh;const{data:t,error:s}=await og(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ag});if(await zh(this.storage,`${this.storageKey}-code-verifier`),s)throw s;if(!t||!t.session||!t.user){const e=new vh;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:s})}catch(s){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:t,provider:n,token:r,access_token:s,nonce:i}=e,o=await og(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:s,nonce:i,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:ag}),{data:a,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!a||!a.session||!a.user){const e=new vh;return this._returnResult({data:{user:null,session:null},error:e})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:a,error:c})}catch(t){if(ph(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async signInWithOtp(e){var t,n,r,s,i;try{if("email"in e){const{email:r,options:s}=e;let i=null,o=null;"pkce"===this.flowType&&([i,o]=await Qh(this.storage,this.storageKey));const{error:a}=await og(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==s?void 0:s.data)&&void 0!==t?t:{},create_user:null===(n=null==s?void 0:s.shouldCreateUser)||void 0===n||n,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:i,code_challenge_method:o},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}if("phone"in e){const{phone:t,options:n}=e,{data:o,error:a}=await og(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==n?void 0:n.data)&&void 0!==r?r:{},create_user:null===(s=null==n?void 0:n.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},channel:null!==(i=null==n?void 0:n.channel)&&void 0!==i?i:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==o?void 0:o.message_id},error:a})}throw new Gh("You must provide either an email or phone number.")}catch(o){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var t,n;try{let r,s;"options"in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,s=null===(n=e.options)||void 0===n?void 0:n.captchaToken);const{data:i,error:o}=await og(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:r,xform:ag});if(o)throw o;if(!i){throw new Error("An error occurred on token verification.")}const a=i.session,c=i.user;return(null==a?void 0:a.access_token)&&(await this._saveSession(a),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",a)),this._returnResult({data:{user:c,session:a},error:null})}catch(r){if(ph(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(e){var t,n,r,s,i;try{let o=null,a=null;"pkce"===this.flowType&&([o,a]=await Qh(this.storage,this.storageKey));const c=await og(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!==(n=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==n?n:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:a}),headers:this.headers,xform:ug});return(null===(s=c.data)||void 0===s?void 0:s.url)&&Lh()&&!(null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:n}=e;if(n)throw n;if(!t)throw new Ih;const{error:r}=await og(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if(ph(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if("email"in e){const{email:n,type:r,options:s}=e,{error:i}=await og(this.fetch,"POST",t,{headers:this.headers,body:{email:n,type:r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},redirectTo:null==s?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:i})}if("phone"in e){const{phone:n,type:r,options:s}=e,{data:i,error:o}=await og(this.fetch,"POST",t,{headers:this.headers,body:{phone:n,type:r,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==i?void 0:i.message_id},error:o})}throw new Gh("You must provide either an email or phone number and a type")}catch(t){if(ph(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async getSession(){await this.initializePromise;return await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await n}catch(e){}})()),n}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(t){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",(new Error).stack);try{let e=null;const t=await Kh(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),null!==t&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=!!e.expires_at&&1e3*e.expires_at-Date.now()<lh;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const t=await Kh(this.userStorage,this.storageKey+"-user");(null==t?void 0:t.user)?e.user=t.user:e.user=tg()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const t={value:this.suppressGetSessionWarning};e.user=function(e,t){return new Proxy(e,{get:(e,n,r)=>{if("__isInsecureUserWarningProxy"===n)return!0;if("symbol"==typeof n){const t=n.toString();if("Symbol(Symbol.toPrimitive)"===t||"Symbol(Symbol.toStringTag)"===t||"Symbol(util.inspect.custom)"===t||"Symbol(nodejs.util.inspect.custom)"===t)return Reflect.get(e,n,r)}return t.value||"string"!=typeof n||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(e,n,r)}})}(e.user,t),t.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:r},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const t=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await og(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:lg}):await this._useSession(async e=>{var t,n,r;const{data:s,error:i}=e;if(i)throw i;return(null===(t=s.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await og(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(n=s.session)||void 0===n?void 0:n.access_token)&&void 0!==r?r:void 0,xform:lg}):{data:{user:null},error:new Ih}})}catch(t){if(ph(t))return wh(t)&&(await this._removeSession(),await zh(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:t});throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async n=>{const{data:r,error:s}=n;if(s)throw s;if(!r.session)throw new Ih;const i=r.session;let o=null,a=null;"pkce"===this.flowType&&null!=e.email&&([o,a]=await Qh(this.storage,this.storageKey));const{data:c,error:l}=await og(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:i.access_token,xform:lg});if(l)throw l;return i.user=c.user,await this._saveSession(i),await this._notifyAllSubscribers("USER_UPDATED",i),this._returnResult({data:{user:i.user},error:null})})}catch(n){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Ih;const t=Date.now()/1e3;let n=t,r=!0,s=null;const{payload:i}=Uh(e.access_token);if(i.exp&&(n=i.exp,r=n<=t),r){const{data:t,error:n}=await this._callRefreshToken(e.refresh_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!t)return{data:{user:null,session:null},error:null};s=t}else{const{data:r,error:i}=await this._getUser(e.access_token);if(i)return this._returnResult({data:{user:null,session:null},error:i});s={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:"bearer",expires_in:n-t,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(t){if(ph(t))return this._returnResult({data:{session:null,user:null},error:t});throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var n;if(!e){const{data:r,error:s}=t;if(s)throw s;e=null!==(n=r.session)&&void 0!==n?n:void 0}if(!(null==e?void 0:e.refresh_token))throw new Ih;const{data:r,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(t){if(ph(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async _getSessionFromURL(e,t){try{if(!Lh())throw new Ah("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Ah(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new Ch("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new Ah("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new Ch("No code detected.");const{data:t,error:n}=await this._exchangeCodeForSession(e.code);if(n)throw n;const r=new URL(window.location.href);return r.searchParams.delete("code"),window.history.replaceState(window.history.state,"",r.toString()),{data:{session:t.session,redirectType:null},error:null}}const{provider_token:n,provider_refresh_token:r,access_token:s,refresh_token:i,expires_in:o,expires_at:a,token_type:c}=e;if(!(s&&o&&i&&c))throw new Ah("No session defined in URL");const l=Math.round(Date.now()/1e3),u=parseInt(o);let d=l+u;a&&(d=parseInt(a));const h=d-l;1e3*h<=ch&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${h}s, should have been closer to ${u}s`);const g=d-u;l-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,d,l):l-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,d,l);const{data:m,error:p}=await this._getUser(s);if(p)throw p;const f={provider_token:n,provider_refresh_token:r,access_token:s,expires_in:u,expires_at:d,refresh_token:i,token_type:c,user:m.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:f,redirectType:e.type},error:null})}catch(n){if(ph(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error_description)}async _isPKCECallback(e){const t=await Kh(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var n;const{data:r,error:s}=t;if(s&&!wh(s))return this._returnResult({error:s});const i=null===(n=r.session)||void 0===n?void 0:n.access_token;if(i){const{error:t}=await this.admin.signOut(i,e);if(t&&(!function(e){return ph(e)&&"AuthApiError"===e.name}(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!wh(t))return this._returnResult({error:t})}return"others"!==e&&(await this._removeSession(),await zh(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=/* @__PURE__ */Symbol("auth-callback"),n={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,n),(async()=>{await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async t=>{var n,r;try{const{data:{session:r},error:s}=t;if(s)throw s;await(null===(n=this.stateChangeEmitters.get(e))||void 0===n?void 0:n.callback("INITIAL_SESSION",r)),this._debug("INITIAL_SESSION","callback id",e,"session",r)}catch(s){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,t={}){let n=null,r=null;"pkce"===this.flowType&&([n,r]=await Qh(this.storage,this.storageKey,!0));try{return await og(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(s){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:t,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:n,error:r}=await this._useSession(async t=>{var n,r,s,i,o;const{data:a,error:c}=t;if(c)throw c;const l=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(n=e.options)||void 0===n?void 0:n.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(s=e.options)||void 0===s?void 0:s.queryParams,skipBrowserRedirect:!0});return await og(this.fetch,"GET",l,{headers:this.headers,jwt:null!==(o=null===(i=a.session)||void 0===i?void 0:i.access_token)&&void 0!==o?o:void 0})});if(r)throw r;return Lh()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==n?void 0:n.url),this._returnResult({data:{provider:e.provider,url:null==n?void 0:n.url},error:null})}catch(n){if(ph(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var n;try{const{error:r,data:{session:s}}=t;if(r)throw r;const{options:i,provider:o,token:a,access_token:c,nonce:l}=e,u=await og(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(n=null==s?void 0:s.access_token)&&void 0!==n?n:void 0,body:{provider:o,id_token:a,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:ag}),{data:d,error:h}=u;return h?this._returnResult({data:{user:null,session:null},error:h}):d&&d.session&&d.user?(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:h})):this._returnResult({data:{user:null,session:null},error:new vh})}catch(r){if(await zh(this.storage,`${this.storageKey}-code-verifier`),ph(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var n,r;const{data:s,error:i}=t;if(i)throw i;return await og(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(n=s.session)||void 0===n?void 0:n.access_token)&&void 0!==r?r:void 0})})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const s=Date.now();return await(n=async n=>(n>0&&await async function(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}(200*Math.pow(2,n-1)),this._debug(t,"refreshing attempt",n),await og(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ag})),r=(e,t)=>{const n=200*Math.pow(2,e);return t&&Vh(t)&&Date.now()+n-s<ch},new Promise((e,t)=>{(async()=>{for(let i=0;i<1/0;i++)try{const t=await n(i);if(!r(i,null,t))return void e(t)}catch(s){if(!r(i,s))return void t(s)}})()}))}catch(s){if(this._debug(t,"error",s),ph(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}finally{this._debug(t,"end")}var n,r}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){const n=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",n),Lh()&&!t.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,t;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await Kh(this.storage,this.storageKey);if(s&&this.userStorage){let t=await Kh(this.userStorage,this.storageKey+"-user");this.storage.isServer||!Object.is(this.storage,this.userStorage)||t||(t={user:s.user},await Mh(this.userStorage,this.storageKey+"-user",t)),s.user=null!==(e=null==t?void 0:t.user)&&void 0!==e?e:tg()}else if(s&&!s.user&&!s.user){const e=await Kh(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(s.user=e.user,await zh(this.storage,this.storageKey+"-user"),await Mh(this.storage,this.storageKey,s)):s.user=tg()}if(this._debug(n,"session from storage",s),!this._isValidSession(s))return this._debug(n,"session is not valid"),void(null!==s&&await this._removeSession());const i=1e3*(null!==(t=s.expires_at)&&void 0!==t?t:1/0)-Date.now()<lh;if(this._debug(n,`session has${i?"":" not"} expired with margin of 90000s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:e}=await this._callRefreshToken(s.refresh_token);e&&(console.error(e),Vh(e)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(s.user&&!0===s.user.__isUserNotAvailableProxy)try{const{data:e,error:t}=await this._getUser(s.access_token);!t&&(null==e?void 0:e.user)?(s.user=e.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(r){console.error("Error getting user data:",r),this._debug(n,"error getting user data, skipping SIGNED_IN notification",r)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){return this._debug(n,"error",s),void console.error(s)}finally{this._debug(n,"end")}}async _callRefreshToken(e){var t,n;if(!e)throw new Ih;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new Dh;const{data:t,error:n}=await this._refreshAccessToken(e);if(n)throw n;if(!t.session)throw new Ih;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);const r={data:t.session,error:null};return this.refreshingDeferred.resolve(r),r}catch(s){if(this._debug(r,"error",s),ph(s)){const e={data:null,error:s};return Vh(s)||await this._removeSession(),null===(t=this.refreshingDeferred)||void 0===t||t.resolve(e),e}throw null===(n=this.refreshingDeferred)||void 0===n||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(e,t,n=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,"begin",t,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],s=Array.from(this.stateChangeEmitters.values()).map(async n=>{try{await n.callback(e,t)}catch(s){r.push(s)}});if(await Promise.all(s),r.length>0){for(let e=0;e<r.length;e+=1)console.error(r[e]);throw r[0]}}finally{this._debug(r,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await zh(this.storage,`${this.storageKey}-code-verifier`);const t=Object.assign({},e),n=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!n&&t.user&&await Mh(this.userStorage,this.storageKey+"-user",{user:t.user});const e=Object.assign({},t);delete e.user;const r=ng(e);await Mh(this.storage,this.storageKey,r)}else{const e=ng(t);await Mh(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await zh(this.storage,this.storageKey),await zh(this.storage,this.storageKey+"-code-verifier"),await zh(this.storage,this.storageKey+"-user"),this.userStorage&&await zh(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Lh()&&(null===window||void 0===window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(t){console.error("removing visibilitychange callback failed",t)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),ch);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&"object"==typeof t&&"function"==typeof t.unref?t.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async e=>{const{data:{session:n}}=e;if(!n||!n.refresh_token||!n.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");const r=Math.floor((1e3*n.expires_at-t)/ch);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),r<=3&&await this._callRefreshToken(n.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 yg))throw e;this._debug("auto refresh token tick lock not available")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Lh()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},null===window||void 0===window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{"visible"===document.visibilityState?await this._recoverAndRefresh():this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting")}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,n){const r=[`provider=${encodeURIComponent(t)}`];if((null==n?void 0:n.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),(null==n?void 0:n.scopes)&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),"pkce"===this.flowType){const[e,t]=await Qh(this.storage,this.storageKey),n=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(n.toString())}if(null==n?void 0:n.queryParams){const e=new URLSearchParams(n.queryParams);r.push(e.toString())}return(null==n?void 0:n.skipBrowserRedirect)&&r.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var n;const{data:r,error:s}=t;return s?this._returnResult({data:null,error:s}):await og(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(n=null==r?void 0:r.session)||void 0===n?void 0:n.access_token})})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async _enroll(e){try{return await this._useSession(async t=>{var n,r;const{data:s,error:i}=t;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:a,error:c}=await og(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:null===(n=null==s?void 0:s.session)||void 0===n?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):("totp"===e.factorType&&"totp"===a.type&&(null===(r=null==a?void 0:a.totp)||void 0===r?void 0:r.qr_code)&&(a.totp.qr_code=`data:image/svg+xml;utf-8,${a.totp.qr_code}`),this._returnResult({data:a,error:null}))})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;const{data:r,error:s}=t;if(s)return this._returnResult({data:null,error:s});const i=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?Xg(e.webauthn.credential_response):Bg(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:a}=await og(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:i,headers:this.headers,jwt:null===(n=null==r?void 0:r.session)||void 0===n?void 0:n.access_token});return a?this._returnResult({data:null,error:a}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:a}))})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async t=>{var n;const{data:r,error:s}=t;if(s)return this._returnResult({data:null,error:s});const i=await og(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(n=null==r?void 0:r.session)||void 0===n?void 0:n.access_token});if(i.error)return i;const{data:o}=i;if("webauthn"!==o.type)return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Vg(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:Eg(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}})}async _challengeAndVerify(e){const{data:t,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:n}=await this.getUser();if(n)return{data:null,error:n};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),"verified"===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,n,r,s;if(e)try{const{payload:r}=Uh(e);let s=null;r.aal&&(s=r.aal);let i=s;const{data:{user:o},error:a}=await this.getUser(e);if(a)return this._returnResult({data:null,error:a});(null!==(n=null===(t=null==o?void 0:o.factors)||void 0===t?void 0:t.filter(e=>"verified"===e.status))&&void 0!==n?n:[]).length>0&&(i="aal2");return{data:{currentLevel:s,nextLevel:i,currentAuthenticationMethods:r.amr||[]},error:null}}catch(u){if(ph(u))return this._returnResult({data:null,error:u});throw u}const{data:{session:i},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!i)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:a}=Uh(i.access_token);let c=null;a.aal&&(c=a.aal);let l=c;(null!==(s=null===(r=i.user.factors)||void 0===r?void 0:r.filter(e=>"verified"===e.status))&&void 0!==s?s:[]).length>0&&(l="aal2");return{data:{currentLevel:c,nextLevel:l,currentAuthenticationMethods:a.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await og(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new Ih})})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async _approveAuthorization(e,t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Ih});const i=await og(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return i.data&&i.data.redirect_url&&Lh()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(n){if(ph(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new Ih});const i=await og(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return i.data&&i.data.redirect_url&&Lh()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(i.data.redirect_url),i})}catch(n){if(ph(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:n}=e;return n?this._returnResult({data:null,error:n}):t?await og(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new Ih})})}catch(e){if(ph(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?(await og(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Ih})})}catch(t){if(ph(t))return this._returnResult({data:null,error:t});throw t}}async fetchJwk(e,t={keys:[]}){let n=t.keys.find(t=>t.kid===e);if(n)return n;const r=Date.now();if(n=this.jwks.keys.find(t=>t.kid===e),n&&this.jwks_cached_at+6e5>r)return n;const{data:s,error:i}=await og(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(i)throw i;return s.keys&&0!==s.keys.length?(this.jwks=s,this.jwks_cached_at=r,n=s.keys.find(t=>t.kid===e),n||null):null}async getClaims(e,t={}){try{let n=e;if(!n){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});n=e.session.access_token}const{header:r,payload:s,signature:i,raw:{header:o,payload:a}}=Uh(n);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw new Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw new Error("JWT has expired")}(s.exp);const c=r.alg&&!r.alg.startsWith("HS")&&r.kid&&"crypto"in globalThis&&"subtle"in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!c){const{error:e}=await this.getUser(n);if(e)throw e;return{data:{claims:s,header:r,signature:i},error:null}}const l=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}(r.alg),u=await crypto.subtle.importKey("jwk",c,l,!0,["verify"]);if(!(await crypto.subtle.verify(l,u,i,Fh(`${o}.${a}`))))throw new Xh("Invalid JWT signature");return{data:{claims:s,header:r,signature:i},error:null}}catch(n){if(ph(n))return this._returnResult({data:null,error:n});throw n}}}Lg.nextInstanceID={};const Og=Lg;let Tg="";Tg="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";const Hg={headers:{"X-Client-Info":`supabase-js-${Tg}/2.97.0`}},Mg={schema:"public"},Kg={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},zg={};function Dg(e){return(Dg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ug(e){var t=function(e,t){if("object"!=Dg(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=Dg(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Dg(t)?t:t+""}function Pg(e,t,n){return(t=Ug(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jg(Object(n),!0).forEach(function(t){Pg(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const $g=(e,t,n)=>{const r=(e=>e?(...t)=>e(...t):(...e)=>fetch(...e))(n),s=Headers;return async(n,i)=>{var o;const a=null!==(o=await t())&&void 0!==o?o:e;let c=new s(null==i?void 0:i.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${a}`),r(n,Qg(Qg({},i),{},{headers:c}))}};var qg=class extends Og{constructor(e){super(e)}},em=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const i=function(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(r){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a=function(e,t){var n,r;const{db:s,auth:i,realtime:o,global:a}=e,{db:c,auth:l,realtime:u,global:d}=t,h={db:Qg(Qg({},c),s),auth:Qg(Qg({},l),i),realtime:Qg(Qg({},u),o),storage:{},global:Qg(Qg(Qg({},d),a),{},{headers:Qg(Qg({},null!==(n=null==d?void 0:d.headers)&&void 0!==n?n:{}),null!==(r=null==a?void 0:a.headers)&&void 0!==r?r:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}(null!=n?n:{},{db:Mg,realtime:zg,auth:Qg(Qg({},Kg),{},{storageKey:o}),global:Hg});var c;(this.storageKey=null!==(r=a.auth.storageKey)&&void 0!==r?r:"",this.headers=null!==(s=a.global.headers)&&void 0!==s?s:{},a.accessToken)?(this.accessToken=a.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new 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!==(c=a.auth)&&void 0!==c?c:{},this.headers,a.global.fetch);this.fetch=$g(t,this._getAccessToken.bind(this),a.global.fetch),this.realtime=this._initRealtimeClient(Qg({headers:this.headers,accessToken:this._getAccessToken.bind(this)},a.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new Su(new URL("rest/v1",i).href,{headers:this.headers,schema:a.db.schema,fetch:this.fetch,timeout:a.db.timeout,urlLengthLimit:a.db.urlLengthLimit}),this.storage=new oh(this.storageUrl.href,this.headers,this.fetch,null==n?void 0:n.storage),a.accessToken||this._listenForAuthEvents()}get functions(){return new gu(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}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()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:i,flowType:o,lock:a,debug:c,throwOnError:l},u,d){const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new qg({url:this.authUrl.href,headers:Qg(Qg({},h),u),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:o,lock:a,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new pd(this.realtimeUrl.href,Qg(Qg({},e),{},{params:Qg(Qg({},{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,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");var tm={exports:{}};const nm={version:"17.3.1"};var rm,sm,im,om,am,cm;function lm(){if(rm)return tm.exports;rm=1;const e=f,t=v,n=G,r=A,s=nm.version,i=["🔐 encrypt with Dotenvx: https://dotenvx.com","🔐 prevent committing .env to code: https://dotenvx.com/precommit","🔐 prevent building .env in docker: https://dotenvx.com/prebuild","🤖 agentic secret storage: https://dotenvx.com/as2","⚡️ secrets for agents: https://dotenvx.com/as2","🛡️ auth for agents: https://vestauth.com","🛠️ run anywhere with `dotenvx run -- yourcommand`","⚙️ specify custom .env file path with { path: '/custom/path/.env' }","⚙️ enable debug logging with { debug: true }","⚙️ override existing env vars with { override: true }","⚙️ suppress all logs with { quiet: true }","⚙️ write to custom object with { processEnv: myObject }","⚙️ load multiple .env files with { path: ['.env.local', '.env'] }"];function o(e){return"string"==typeof e?!["false","0","no","off",""].includes(e.toLowerCase()):Boolean(e)}function a(e){return process.stdout.isTTY?`[2m${e}[0m`:e}const c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function l(e){console.log(`[dotenv@${s}][DEBUG] ${e}`)}function u(e){console.log(`[dotenv@${s}] ${e}`)}function d(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function h(e,t){let n;try{n=new URL(t)}catch(a){if("ERR_INVALID_URL"===a.code){const e=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw a}const r=n.password;if(!r){const e=new Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}const s=n.searchParams.get("environment");if(!s){const e=new Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}const i=`DOTENV_VAULT_${s.toUpperCase()}`,o=e.parsed[i];if(!o){const e=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${i} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:o,key:r}}function g(n){let r=null;if(n&&n.path&&n.path.length>0)if(Array.isArray(n.path))for(const t of n.path)e.existsSync(t)&&(r=t.endsWith(".vault")?t:`${t}.vault`);else r=n.path.endsWith(".vault")?n.path:`${n.path}.vault`;else r=t.resolve(process.cwd(),".env.vault");return e.existsSync(r)?r:null}function m(e){return"~"===e[0]?t.join(n.homedir(),e.slice(1)):e}const p={configDotenv:function(n){const r=t.resolve(process.cwd(),".env");let s="utf8",c=process.env;n&&null!=n.processEnv&&(c=n.processEnv);let d=o(c.DOTENV_CONFIG_DEBUG||n&&n.debug),h=o(c.DOTENV_CONFIG_QUIET||n&&n.quiet);n&&n.encoding?s=n.encoding:d&&l("No encoding is specified. UTF-8 is used by default");let g,f=[r];if(n&&n.path)if(Array.isArray(n.path)){f=[];for(const e of n.path)f.push(m(e))}else f=[m(n.path)];const y={};for(const t of f)try{const r=p.parse(e.readFileSync(t,{encoding:s}));p.populate(y,r,n)}catch(I){d&&l(`Failed to load ${t} ${I.message}`),g=I}const b=p.populate(c,y,n);if(d=o(c.DOTENV_CONFIG_DEBUG||d),h=o(c.DOTENV_CONFIG_QUIET||h),d||!h){const e=Object.keys(b).length,n=[];for(const r of f)try{const e=t.relative(process.cwd(),r);n.push(e)}catch(I){d&&l(`Failed to load ${r} ${I.message}`),g=I}u(`injecting env (${e}) from ${n.join(",")} ${a(`-- tip: ${i[Math.floor(Math.random()*i.length)]}`)}`)}return g?{parsed:y,error:g}:{parsed:y}},_configVault:function(e){const t=o(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),n=o(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);!t&&n||u("Loading env from encrypted .env.vault");const r=p._parseVault(e);let s=process.env;return e&&null!=e.processEnv&&(s=e.processEnv),p.populate(s,r,e),{parsed:r}},_parseVault:function(e){const t=g(e=e||{});e.path=t;const n=p.configDotenv(e);if(!n.parsed){const e=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code="MISSING_DATA",e}const r=d(e).split(","),s=r.length;let i;for(let a=0;a<s;a++)try{const e=h(n,r[a].trim());i=p.decrypt(e.ciphertext,e.key);break}catch(o){if(a+1>=s)throw o}return p.parse(i)},config:function(e){if(0===d(e).length)return p.configDotenv(e);const t=g(e);return t?p._configVault(e):(n=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.error(`[dotenv@${s}][WARN] ${n}`),p.configDotenv(e));var n},decrypt:function(e,t){const n=Buffer.from(t.slice(-64),"hex");let s=Buffer.from(e,"base64");const i=s.subarray(0,12),o=s.subarray(-16);s=s.subarray(12,-16);try{const e=r.createDecipheriv("aes-256-gcm",n,i);return e.setAuthTag(o),`${e.update(s)}${e.final()}`}catch(a){const e=a instanceof RangeError,t="Invalid key length"===a.message,n="Unsupported state or unable to authenticate data"===a.message;if(e||t){const e=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(n){const e=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw a}},parse:function(e){const t={};let n,r=e.toString();for(r=r.replace(/\r\n?/gm,"\n");null!=(n=c.exec(r));){const e=n[1];let r=n[2]||"";r=r.trim();const s=r[0];r=r.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),'"'===s&&(r=r.replace(/\\n/g,"\n"),r=r.replace(/\\r/g,"\r")),t[e]=r}return t},populate:function(e,t,n={}){const r=Boolean(n&&n.debug),s=Boolean(n&&n.override),i={};if("object"!=typeof t){const e=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(const o of Object.keys(t))Object.prototype.hasOwnProperty.call(e,o)?(!0===s&&(e[o]=t[o],i[o]=t[o]),r&&l(!0===s?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(e[o]=t[o],i[o]=t[o]);return i}};return tm.exports.configDotenv=p.configDotenv,tm.exports._configVault=p._configVault,tm.exports._parseVault=p._parseVault,tm.exports.config=p.config,tm.exports.decrypt=p.decrypt,tm.exports.parse=p.parse,tm.exports.populate=p.populate,tm.exports=p,tm.exports}cm||(cm=1,lm().config(Object.assign({},function(){if(im)return sm;im=1;const e={};return null!=process.env.DOTENV_CONFIG_ENCODING&&(e.encoding=process.env.DOTENV_CONFIG_ENCODING),null!=process.env.DOTENV_CONFIG_PATH&&(e.path=process.env.DOTENV_CONFIG_PATH),null!=process.env.DOTENV_CONFIG_QUIET&&(e.quiet=process.env.DOTENV_CONFIG_QUIET),null!=process.env.DOTENV_CONFIG_DEBUG&&(e.debug=process.env.DOTENV_CONFIG_DEBUG),null!=process.env.DOTENV_CONFIG_OVERRIDE&&(e.override=process.env.DOTENV_CONFIG_OVERRIDE),null!=process.env.DOTENV_CONFIG_DOTENV_KEY&&(e.DOTENV_KEY=process.env.DOTENV_CONFIG_DOTENV_KEY),sm=e}(),function(){if(am)return om;am=1;const e=/^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;return om=function(t){const n=t.reduce(function(t,n){const r=n.match(e);return r&&(t[r[1]]=r[2]),t},{});return"quiet"in n||(n.quiet="true"),n}}()(process.argv))));const um=async()=>{const e=await es.getSession(),t=new em("https://your-project.supabase.co","your-anon-key",{auth:{persistSession:!1,autoRefreshToken:!0,detectSessionInUrl:!1}});if(e){const{error:n}=await t.auth.setSession({access_token:e.access_token,refresh_token:e.refresh_token});n&&console.error("[Fluxlay] Error setting session:",n.message)}return t},dm=process.env.FLUXLAY_API_URL||"http://localhost:8080",hm=xl(nu({baseUrl:dm,httpVersion:"1.1",interceptors:[e=>async t=>{const n=await um(),{data:{session:r}}=await n.auth.getSession();return r?.access_token&&(await es.saveSession(r),t.header.set("Authorization",`Bearer ${r.access_token}`)),e(t)}]}));const gm=(mm=hm,function(e,t){const n={};for(const r of e.methods){const e=t(r);null!=e&&(n[r.localName]=e)}return n}(su,e=>{switch(e.methodKind){case"unary":return function(e,t){return async(n,r)=>{var s,i;const o=await e.unary(t,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,n,null==r?void 0:r.contextValues);return null===(s=null==r?void 0:r.onHeader)||void 0===s||s.call(r,o.header),null===(i=null==r?void 0:r.onTrailer)||void 0===i||i.call(r,o.trailer),o.message}}(mm,e);case"server_streaming":return function(e,t){return(n,r)=>Qc(e.stream(t,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,Dc([n]),null==r?void 0:r.contextValues),r)}(mm,e);case"client_streaming":return function(e,t){return async(n,r)=>{var s,i,o,a,c,l;const u=await e.stream(t,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,n,null==r?void 0:r.contextValues);let d;null===(c=null==r?void 0:r.onHeader)||void 0===c||c.call(r,u.header);let h=0;try{for(var g,m=!0,p=Uc(u.message);!(s=(g=await p.next()).done);m=!0)a=g.value,m=!1,d=a,h++}catch(f){i={error:f}}finally{try{m||s||!(o=p.return)||await o.call(p)}finally{if(i)throw i.error}}if(!d)throw new Vc("protocol error: missing response message",ts.Unimplemented);if(h>1)throw new Vc("protocol error: received extra messages for client streaming method",ts.Unimplemented);return null===(l=null==r?void 0:r.onTrailer)||void 0===l||l.call(r,u.trailer),d}}(mm,e);case"bidi_streaming":return function(e,t){return(n,r)=>Qc(e.stream(t,null==r?void 0:r.signal,null==r?void 0:r.timeoutMs,null==r?void 0:r.headers,n,null==r?void 0:r.contextValues),r)}(mm,e);default:return null}}));var mm;class pm{static async saveDeveloperKey(e){Ut(e)}static async getDeveloperKey(){try{return await Dt()||null}catch(e){return console.error(`[KeyStore] Error getting developer key: ${e}`),null}}}function fm(){let e=Date.now();return{name:"fluxlay-dev-server",configureServer(t){t.watcher.on("change",()=>{e=Date.now()}),t.middlewares.use("/version",(t,n)=>{n.setHeader("Content-Type","application/json"),n.setHeader("Access-Control-Allow-Origin","*"),n.end(JSON.stringify({version:e}))})}}}async function ym(e){const t=o.resolve(process.cwd(),e),n=o.join(t,"fluxlay.yaml");i.existsSync(n)||(Re.error(dt.red("fluxlay.yaml is required in the project root.")),process.exit(1));try{const e=i.readFileSync(n,"utf-8");Pt(e)}catch(g){Re.error(`Manifest Validation Error: ${g.message}`),process.exit(1)}const r=await bm(3e3),s=Le();s.start(dt.yellow(`Starting server on port ${r}...`));const a=await h({root:t,configFile:o.resolve(t,"vite.config.ts"),plugins:[fm()],server:{port:r,strictPort:!0,cors:!0,host:"127.0.0.1"},logLevel:"error"});await a.listen(),s.stop(`${dt.green("✔")} Server started on port ${r}.`);const c=`http://127.0.0.1:${r}`;Re.info(`Wallpaper server running at ${dt.underline.cyan(c)}`);const l=function(){const e=p.homedir();switch(p.platform()){case"darwin":return o.join(e,"Library","Application Support","com.fluxlay.manager");case"win32":return o.join(process.env.APPDATA||o.join(e,"AppData","Roaming"),"com.fluxlay.manager");default:return o.join(e,".config","com.fluxlay.manager")}}(),u=o.join(l,"dev.json"),d=()=>{if(i.existsSync(u))try{i.unlinkSync(u)}catch(g){}};i.existsSync(l)||i.mkdirSync(l,{recursive:!0}),i.writeFileSync(u,JSON.stringify({url:c,root:t},null,2)),process.on("SIGINT",()=>{d(),process.exit()}),process.on("SIGTERM",()=>{d(),process.exit()}),process.on("exit",d),Fe(`Root: ${dt.gray(t)}\nWatching for changes...`,"Dev Server Active")}async function bm(e){return new Promise((t,n)=>{const r=X.createServer();r.unref(),r.on("error",r=>{"EADDRINUSE"===r.code?t(bm(e+1)):n(r)}),r.listen(e,()=>{r.close(()=>t(e))})})}let Im,wm;function vm(){return void 0===Im&&(Im=function(){try{return i.statSync("/.dockerenv"),!0}catch{return!1}}()||function(){try{return i.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}()),Im}function Gm(){return void 0===wm&&(wm=(()=>{try{return i.statSync("/run/.containerenv"),!0}catch{return!1}})()||vm()),wm}const Am=()=>{if("linux"!==e.platform)return!1;if(p.release().toLowerCase().includes("microsoft"))return!Gm();try{if(i.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!Gm()}catch{}return!(!i.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")&&!i.existsSync("/run/WSL"))&&!Gm()},Cm=e.env.__IS_WSL_TEST__?Am:Am(),Sm=a(l.execFile),Zm=()=>`${e.env.SYSTEMROOT||e.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,Vm=async(e,t={})=>{const{powerShellPath:n,...r}=t,s=Vm.encodeCommand(e);return Sm(n??Zm(),[...Vm.argumentsPrefix,s],{encoding:"utf8",...r})};Vm.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],Vm.encodeCommand=e=>R.from(e,"utf16le").toString("base64"),Vm.escapeArgument=e=>`'${String(e).replaceAll("'","''")}'`;const Em=a(l.execFile),Xm=/* @__PURE__ */(()=>{const e="/mnt/";let t;return async function(){if(t)return t;const n="/etc/wsl.conf";let r=!1;try{await B.access(n,x.F_OK),r=!0}catch{}if(!r)return e;const s=function(e){for(const t of e.split("\n")){if(/^\s*#/.test(t))continue;const e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}(await B.readFile(n,{encoding:"utf8"}));return void 0===s?e:(t=s,t=t.endsWith("/")?t:`${t}/`,t)}})(),Bm=Cm?async()=>`${await Xm()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:Zm;let xm;function Rm(e,t,n){const r=n=>Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=n();return r(e),e},set(e){r(e)}}),e}const Wm=a(u);const Nm=a(u);async function Jm(t){return async function(t,{humanReadableOutput:n=!0,signal:r}={}){if("darwin"!==e.platform)throw new Error("macOS only");const s=n?[]:["-ss"],i={};r&&(i.signal=r);const{stdout:o}=await Nm("osascript",["-e",t,s],i);return o.trim()}(`tell application "Finder" to set app_path to application file id "${t}" as string\ntell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}const _m=a(u),km={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Fm=new Map(Object.entries(km));class Ym extends Error{}const Lm=a(u);async function Om(){if("darwin"===e.platform){const t=await async function(){if("darwin"!==e.platform)throw new Error("macOS only");const{stdout:t}=await Wm("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),n=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t),r=n?.groups.id??"com.apple.Safari";return"com.apple.safari"===r?"com.apple.Safari":r}();return{name:await Jm(t),id:t}}if("linux"===e.platform){const{stdout:e}=await Lm("xdg-mime",["query","default","x-scheme-handler/http"]),t=e.trim();return{name:t.replace(/.desktop$/,"").replace("-"," ").toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),id:t}}if("win32"===e.platform)return async function(e=_m){const{stdout:t}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new Ym(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);const{id:r}=n.groups,s=r.lastIndexOf("."),i=r.lastIndexOf("-"),o=-1===s?void 0:r.slice(0,s),a=-1===i?void 0:r.slice(0,i);return km[r]??km[o]??km[a]??{name:r,id:r}}();throw new Error("Only macOS, Linux, and Windows are supported")}const Tm=Boolean(e.env.SSH_CONNECTION||e.env.SSH_CLIENT||e.env.SSH_TTY),Hm=/* @__PURE__ */Symbol("fallbackAttempt"),Mm=import.meta.url?o.dirname(m(import.meta.url)):"",Km=o.join(Mm,"xdg-open"),{platform:zm,arch:Dm}=e,Um=async(e,t)=>{if(0===e.length)return;const n=[];for(const s of e)try{return await t(s)}catch(r){n.push(r)}throw new AggregateError(n,"Failed to open in all supported apps")},Pm=async t=>{const n=!0===(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t})[Hm];if(delete t[Hm],Array.isArray(t.app))return Um(t.app,e=>Pm({...t,app:e,[Hm]:!0}));let r,{name:s,arguments:i=[]}=t.app??{};if(i=[...i],Array.isArray(s))return Um(s,e=>Pm({...t,app:{name:e,arguments:i},[Hm]:!0}));if("browser"===s||"browserPrivate"===s){const e={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},n={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"};let r;if(Cm){const e=await(async()=>{const e=await Bm(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:n}=await Vm(t,{powerShellPath:e});return n.trim()})();r=Fm.get(e)??{}}else r=await Om();if(r.id in e){const o=e[r.id.toLowerCase()];if("browserPrivate"===s){if("safari"===o)throw new Error("Safari doesn't support opening in private mode via command line");i.push(n[o])}return Pm({...t,app:{name:$m[o],arguments:i}})}throw new Error(`${r.name} is not supported as a default browser`)}const o=[],a={};let c=!1;if(!Cm||Gm()||Tm||s||(c=await(async()=>(xm??=(async()=>{try{const e=await Bm();return await B.access(e,x.X_OK),!0}catch{return!1}})(),xm))()),"darwin"===zm)r="open",t.wait&&o.push("--wait-apps"),t.background&&o.push("--background"),t.newInstance&&o.push("--new"),s&&o.push("-a",s);else if("win32"===zm||c){r=await Bm(),o.push(...Vm.argumentsPrefix),Cm||(a.windowsVerbatimArguments=!0),Cm&&t.target&&(t.target=await(async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{const{stdout:t}=await Em("wslpath",["-aw",e],{encoding:"utf8"});return t.trim()}catch{return e}})(t.target));const e=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&e.push("-Wait"),s?(e.push(Vm.escapeArgument(s)),t.target&&i.push(t.target)):t.target&&e.push(Vm.escapeArgument(t.target)),i.length>0&&(i=i.map(e=>Vm.escapeArgument(e)),e.push("-ArgumentList",i.join(","))),t.target=Vm.encodeCommand(e.join(" ")),t.wait||(a.stdio="ignore")}else{if(s)r=s;else{const t=!Mm||"/"===Mm;let n=!1;try{await B.access(Km,x.X_OK),n=!0}catch{}r=e.versions.electron??("android"===zm||t||!n)?"xdg-open":Km}i.length>0&&o.push(...i),t.wait||(a.stdio="ignore",a.detached=!0)}"darwin"===zm&&i.length>0&&o.push("--args",...i),t.target&&o.push(t.target);const u=l.spawn(r,o,a);return t.wait?new Promise((e,n)=>{u.once("error",n),u.once("close",r=>{t.allowNonzeroExitCode||0===r?e(u):n(new Error(`Exited with code ${r}`))})}):n?new Promise((e,t)=>{u.once("error",t),u.once("spawn",()=>{u.once("close",n=>{u.off("error",t),0===n?(u.unref(),e(u)):t(new Error(`Exited with code ${n}`))})})}):(u.unref(),new Promise((e,t)=>{u.once("error",t),u.once("spawn",()=>{u.off("error",t),e(u)})}))};function jm(e){if("string"==typeof e||Array.isArray(e))return e;const{[Dm]:t}=e;if(!t)throw new Error(`${Dm} is not supported`);return t}function Qm({[zm]:e},{wsl:t}={}){if(t&&Cm)return jm(t);if(!e)throw new Error(`${zm} is not supported`);return jm(e)}const $m={browser:"browser",browserPrivate:"browserPrivate"};Rm($m,"chrome",()=>Qm({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}})),Rm($m,"brave",()=>Qm({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}})),Rm($m,"firefox",()=>Qm({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"})),Rm($m,"edge",()=>Qm({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"})),Rm($m,"safari",()=>Qm({darwin:"Safari"}));const qm=async()=>{const e="http://127.0.0.1:3000";Re.step(`Opening browser for authentication via: ${dt.underline.cyan(e)}`);const t=Le();t.start(dt.yellow("Waiting for authentication..."));try{const{session:r}=await(n=t=>{((e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a `target`");Pm({...t,target:e})})(`${e}/sign-in?next=${encodeURIComponent(`http://127.0.0.1:${t}/callback`)}`)},new Promise((e,t)=>{const r=Z.createServer((t,n)=>{if(n.setHeader("Access-Control-Allow-Origin","*"),n.setHeader("Access-Control-Allow-Methods","GET, POST, OPTIONS"),n.setHeader("Access-Control-Allow-Headers","Content-Type"),"OPTIONS"===t.method)return n.writeHead(204),void n.end();const s=t.headers["x-forwarded-proto"]||"http",i=r.address().port,o=t.headers.host||`localhost:${i}`,a=new URL(t.url||"",`${s}://${o}`),c=a.searchParams;if("POST"===t.method){let s="";return t.on("data",e=>{s+=e.toString()}),void t.on("end",()=>{try{const t=JSON.parse(s);t.session&&(n.writeHead(200,{"Content-Type":"application/json"}),n.end(JSON.stringify({status:"success"})),r.close(),e({session:t.session}))}catch(t){n.writeHead(400),n.end("Invalid JSON")}})}const l=c.get("session");if(l)try{const t=JSON.parse(l);n.writeHead(302,{Location:"http://localhost:3000/auth/success"}),n.end(),r.close(),e({session:t})}catch(u){n.writeHead(400),n.end("Invalid session data")}else"/callback"===a.pathname&&(n.writeHead(400),n.end("No authentication data found."))});r.listen(0,()=>{const e=r.address().port;console.log(`Waiting for authentication callback on port ${e}...`),n(e)}),r.on("error",e=>{t(e)})}));r?(await es.saveSession(r),t.stop(`${dt.green("✔")} Successfully logged in as ${dt.cyan(r.user.email)}`)):(t.stop(dt.red("Authentication failed: No session received")),process.exit(1))}catch(r){t.stop(dt.red("Authentication failed")),Re.error(r instanceof Error?r.message:String(r)),process.exit(1)}var n};function ep(e){return null==e}var tp={isNothing:ep,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:ep(e)?[]:[e]},repeat:function(e,t){var n,r="";for(n=0;n<t;n+=1)r+=e;return r},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,r,s,i;if(t)for(n=0,r=(i=Object.keys(t)).length;n<r;n+=1)e[s=i[n]]=t[s];return e}};function np(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),r+" "+n):r}function rp(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=np(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}rp.prototype=Object.create(Error.prototype),rp.prototype.constructor=rp,rp.prototype.toString=function(e){return this.name+": "+np(this,e)};var sp=rp;function ip(e,t,n,r,s){var i="",o="",a=Math.floor(s/2)-1;return r-t>a&&(t=r-a+(i=" ... ").length),n-r>a&&(n=r+a-(o=" ...").length),{str:i+e.slice(t,n).replace(/\t/g,"→")+o,pos:r-t+i.length}}function op(e,t){return tp.repeat(" ",t-e.length)+e}var ap=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,r=/\r?\n|\r|\0/g,s=[0],i=[],o=-1;n=r.exec(e.buffer);)i.push(n.index),s.push(n.index+n[0].length),e.position<=n.index&&o<0&&(o=s.length-2);o<0&&(o=s.length-1);var a,c,l="",u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(a=1;a<=t.linesBefore&&!(o-a<0);a++)c=ip(e.buffer,s[o-a],i[o-a],e.position-(s[o]-s[o-a]),d),l=tp.repeat(" ",t.indent)+op((e.line-a+1).toString(),u)+" | "+c.str+"\n"+l;for(c=ip(e.buffer,s[o],i[o],e.position,d),l+=tp.repeat(" ",t.indent)+op((e.line+1).toString(),u)+" | "+c.str+"\n",l+=tp.repeat("-",t.indent+u+3+c.pos)+"^\n",a=1;a<=t.linesAfter&&!(o+a>=i.length);a++)c=ip(e.buffer,s[o+a],i[o+a],e.position-(s[o]-s[o+a]),d),l+=tp.repeat(" ",t.indent)+op((e.line+a+1).toString(),u)+" | "+c.str+"\n";return l.replace(/\n$/,"")},cp=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],lp=["scalar","sequence","mapping"];var up=function(e,t){var n,r;if(t=t||{},Object.keys(t).forEach(function(t){if(-1===cp.indexOf(t))throw new sp('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=(n=t.styleAliases||null,r={},null!==n&&Object.keys(n).forEach(function(e){n[e].forEach(function(t){r[String(t)]=e})}),r),-1===lp.indexOf(this.kind))throw new sp('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function dp(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,r){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=r)}),n[t]=e}),n}function hp(e){return this.extend(e)}hp.prototype.extend=function(e){var t=[],n=[];if(e instanceof up)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new sp("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach(function(e){if(!(e instanceof up))throw new sp("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new sp("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new sp("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(e){if(!(e instanceof up))throw new sp("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(hp.prototype);return r.implicit=(this.implicit||[]).concat(t),r.explicit=(this.explicit||[]).concat(n),r.compiledImplicit=dp(r,"implicit"),r.compiledExplicit=dp(r,"explicit"),r.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function r(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(r);return n}(r.compiledImplicit,r.compiledExplicit),r};var gp=hp,mp=new up("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),pp=new up("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),fp=new up("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),yp=new gp({explicit:[mp,pp,fp]});var bp=new up("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var Ip=new up("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function wp(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function vp(e){return 48<=e&&e<=55}function Gp(e){return 48<=e&&e<=57}var Ap=new up("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n=e.length,r=0,s=!1;if(!n)return!1;if("-"!==(t=e[r])&&"+"!==t||(t=e[++r]),"0"===t){if(r+1===n)return!0;if("b"===(t=e[++r])){for(r++;r<n;r++)if("_"!==(t=e[r])){if("0"!==t&&"1"!==t)return!1;s=!0}return s&&"_"!==t}if("x"===t){for(r++;r<n;r++)if("_"!==(t=e[r])){if(!wp(e.charCodeAt(r)))return!1;s=!0}return s&&"_"!==t}if("o"===t){for(r++;r<n;r++)if("_"!==(t=e[r])){if(!vp(e.charCodeAt(r)))return!1;s=!0}return s&&"_"!==t}}if("_"===t)return!1;for(;r<n;r++)if("_"!==(t=e[r])){if(!Gp(e.charCodeAt(r)))return!1;s=!0}return!(!s||"_"===t)},construct:function(e){var t,n=e,r=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(r=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return r*parseInt(n.slice(2),2);if("x"===n[1])return r*parseInt(n.slice(2),16);if("o"===n[1])return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!tp.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Cp=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var Sp=/^[-+]?[0-9]+e/;var Zp=new up("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!Cp.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||tp.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(tp.isNegativeZero(e))return"-0.0";return n=e.toString(10),Sp.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),Vp=yp.extend({implicit:[bp,Ip,Ap,Zp]}),Ep=Vp,Xp=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Bp=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var xp=new up("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==Xp.exec(e)||null!==Bp.exec(e))},construct:function(e){var t,n,r,s,i,o,a,c,l=0,u=null;if(null===(t=Xp.exec(e))&&(t=Bp.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,r,s));if(i=+t[4],o=+t[5],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,r,s,i,o,a,l)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var Rp=new up("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),Wp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var Np=new up("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,r=0,s=e.length,i=Wp;for(n=0;n<s;n++)if(!((t=i.indexOf(e.charAt(n)))>64)){if(t<0)return!1;r+=6}return r%8==0},construct:function(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=Wp,o=0,a=[];for(t=0;t<s;t++)t%4==0&&t&&(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)),o=o<<6|i.indexOf(r.charAt(t));return 0===(n=s%4*6)?(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)):18===n?(a.push(o>>10&255),a.push(o>>2&255)):12===n&&a.push(o>>4&255),new Uint8Array(a)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,r="",s=0,i=e.length,o=Wp;for(t=0;t<i;t++)t%3==0&&t&&(r+=o[s>>18&63],r+=o[s>>12&63],r+=o[s>>6&63],r+=o[63&s]),s=(s<<8)+e[t];return 0===(n=i%3)?(r+=o[s>>18&63],r+=o[s>>12&63],r+=o[s>>6&63],r+=o[63&s]):2===n?(r+=o[s>>10&63],r+=o[s>>4&63],r+=o[s<<2&63],r+=o[64]):1===n&&(r+=o[s>>2&63],r+=o[s<<4&63],r+=o[64],r+=o[64]),r}}),Jp=Object.prototype.hasOwnProperty,_p=Object.prototype.toString;var kp=new up("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,s,i,o=[],a=e;for(t=0,n=a.length;t<n;t+=1){if(r=a[t],i=!1,"[object Object]"!==_p.call(r))return!1;for(s in r)if(Jp.call(r,s)){if(i)return!1;i=!0}if(!i)return!1;if(-1!==o.indexOf(s))return!1;o.push(s)}return!0},construct:function(e){return null!==e?e:[]}}),Fp=Object.prototype.toString;var Yp=new up("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,r,s,i,o=e;for(i=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(r=o[t],"[object Object]"!==Fp.call(r))return!1;if(1!==(s=Object.keys(r)).length)return!1;i[t]=[s[0],r[s[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,r,s,i,o=e;for(i=new Array(o.length),t=0,n=o.length;t<n;t+=1)r=o[t],s=Object.keys(r),i[t]=[s[0],r[s[0]]];return i}}),Lp=Object.prototype.hasOwnProperty;var Op=new up("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(Lp.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),Tp=Ep.extend({implicit:[xp,Rp],explicit:[Np,kp,Yp,Op]}),Hp=Object.prototype.hasOwnProperty,Mp=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Kp=/[\x85\u2028\u2029]/,zp=/[,\[\]\{\}]/,Dp=/^(?:!|!!|![a-z\-]+!)$/i,Up=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Pp(e){return Object.prototype.toString.call(e)}function jp(e){return 10===e||13===e}function Qp(e){return 9===e||32===e}function $p(e){return 9===e||32===e||10===e||13===e}function qp(e){return 44===e||91===e||93===e||123===e||125===e}function ef(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function tf(e){return 120===e?2:117===e?4:85===e?8:0}function nf(e){return 48<=e&&e<=57?e-48:-1}function rf(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function sf(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}function of(e,t,n){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var af=new Array(256),cf=new Array(256),lf=0;lf<256;lf++)af[lf]=rf(lf)?1:0,cf[lf]=rf(lf);function uf(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Tp,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function df(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=ap(n),new sp(t,n)}function hf(e,t){throw df(e,t)}function gf(e,t){e.onWarning&&e.onWarning.call(null,df(e,t))}var mf={YAML:function(e,t,n){var r,s,i;null!==e.version&&hf(e,"duplication of %YAML directive"),1!==n.length&&hf(e,"YAML directive accepts exactly one argument"),null===(r=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&hf(e,"ill-formed argument of the YAML directive"),s=parseInt(r[1],10),i=parseInt(r[2],10),1!==s&&hf(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&gf(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var r,s;2!==n.length&&hf(e,"TAG directive accepts exactly two arguments"),r=n[0],s=n[1],Dp.test(r)||hf(e,"ill-formed tag handle (first argument) of the TAG directive"),Hp.call(e.tagMap,r)&&hf(e,'there is a previously declared suffix for "'+r+'" tag handle'),Up.test(s)||hf(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch(i){hf(e,"tag prefix is malformed: "+s)}e.tagMap[r]=s}};function pf(e,t,n,r){var s,i,o,a;if(t<n){if(a=e.input.slice(t,n),r)for(s=0,i=a.length;s<i;s+=1)9===(o=a.charCodeAt(s))||32<=o&&o<=1114111||hf(e,"expected valid JSON character");else Mp.test(a)&&hf(e,"the stream contains non-printable characters");e.result+=a}}function ff(e,t,n,r){var s,i,o,a;for(tp.isObject(n)||hf(e,"cannot merge mappings; the provided source object is unacceptable"),o=0,a=(s=Object.keys(n)).length;o<a;o+=1)i=s[o],Hp.call(t,i)||(of(t,i,n[i]),r[i]=!0)}function yf(e,t,n,r,s,i,o,a,c){var l,u;if(Array.isArray(s))for(l=0,u=(s=Array.prototype.slice.call(s)).length;l<u;l+=1)Array.isArray(s[l])&&hf(e,"nested arrays are not supported inside keys"),"object"==typeof s&&"[object Object]"===Pp(s[l])&&(s[l]="[object Object]");if("object"==typeof s&&"[object Object]"===Pp(s)&&(s="[object Object]"),s=String(s),null===t&&(t={}),"tag:yaml.org,2002:merge"===r)if(Array.isArray(i))for(l=0,u=i.length;l<u;l+=1)ff(e,t,i[l],n);else ff(e,t,i,n);else e.json||Hp.call(n,s)||!Hp.call(t,s)||(e.line=o||e.line,e.lineStart=a||e.lineStart,e.position=c||e.position,hf(e,"duplicated mapping key")),of(t,s,i),delete n[s];return t}function bf(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):hf(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function If(e,t,n){for(var r=0,s=e.input.charCodeAt(e.position);0!==s;){for(;Qp(s);)9===s&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(t&&35===s)do{s=e.input.charCodeAt(++e.position)}while(10!==s&&13!==s&&0!==s);if(!jp(s))break;for(bf(e),s=e.input.charCodeAt(e.position),r++,e.lineIndent=0;32===s;)e.lineIndent++,s=e.input.charCodeAt(++e.position)}return-1!==n&&0!==r&&e.lineIndent<n&&gf(e,"deficient indentation"),r}function wf(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!$p(t)))}function vf(e,t){1===t?e.result+=" ":t>1&&(e.result+=tp.repeat("\n",t-1))}function Gf(e,t){var n,r,s=e.tag,i=e.anchor,o=[],a=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),r=e.input.charCodeAt(e.position);0!==r&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,hf(e,"tab characters must not be used in indentation")),45===r)&&$p(e.input.charCodeAt(e.position+1));)if(a=!0,e.position++,If(e,!0,-1)&&e.lineIndent<=t)o.push(null),r=e.input.charCodeAt(e.position);else if(n=e.line,Sf(e,t,3,!1,!0),o.push(e.result),If(e,!0,-1),r=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==r)hf(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!a&&(e.tag=s,e.anchor=i,e.kind="sequence",e.result=o,!0)}function Af(e){var t,n,r,s,i=!1,o=!1;if(33!==(s=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&hf(e,"duplication of a tag property"),60===(s=e.input.charCodeAt(++e.position))?(i=!0,s=e.input.charCodeAt(++e.position)):33===s?(o=!0,n="!!",s=e.input.charCodeAt(++e.position)):n="!",t=e.position,i){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&62!==s);e.position<e.length?(r=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):hf(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==s&&!$p(s);)33===s&&(o?hf(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),Dp.test(n)||hf(e,"named tag handle cannot contain such characters"),o=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);r=e.input.slice(t,e.position),zp.test(r)&&hf(e,"tag suffix cannot contain flow indicator characters")}r&&!Up.test(r)&&hf(e,"tag name cannot contain such characters: "+r);try{r=decodeURIComponent(r)}catch(a){hf(e,"tag name is malformed: "+r)}return i?e.tag=r:Hp.call(e.tagMap,n)?e.tag=e.tagMap[n]+r:"!"===n?e.tag="!"+r:"!!"===n?e.tag="tag:yaml.org,2002:"+r:hf(e,'undeclared tag handle "'+n+'"'),!0}function Cf(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&hf(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!$p(n)&&!qp(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&hf(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Sf(e,t,n,r,s){var i,o,a,c,l,u,d,h,g,m=1,p=!1,f=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=o=a=4===n||3===n,r&&If(e,!0,-1)&&(p=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),1===m)for(;Af(e)||Cf(e);)If(e,!0,-1)?(p=!0,a=i,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):a=!1;if(a&&(a=p||s),1!==m&&4!==n||(h=1===n||2===n?t:t+1,g=e.position-e.lineStart,1===m?a&&(Gf(e,g)||function(e,t,n){var r,s,i,o,a,c,l,u=e.tag,d=e.anchor,h={},g=/* @__PURE__ */Object.create(null),m=null,p=null,f=null,y=!1,b=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=h),l=e.input.charCodeAt(e.position);0!==l;){if(y||-1===e.firstTabInLine||(e.position=e.firstTabInLine,hf(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,63!==l&&58!==l||!$p(r)){if(o=e.line,a=e.lineStart,c=e.position,!Sf(e,n,2,!1,!0))break;if(e.line===i){for(l=e.input.charCodeAt(e.position);Qp(l);)l=e.input.charCodeAt(++e.position);if(58===l)$p(l=e.input.charCodeAt(++e.position))||hf(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(yf(e,h,g,m,p,null,o,a,c),m=p=f=null),b=!0,y=!1,s=!1,m=e.tag,p=e.result;else{if(!b)return e.tag=u,e.anchor=d,!0;hf(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!b)return e.tag=u,e.anchor=d,!0;hf(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(y&&(yf(e,h,g,m,p,null,o,a,c),m=p=f=null),b=!0,y=!0,s=!0):y?(y=!1,s=!0):hf(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,l=r;if((e.line===i||e.lineIndent>t)&&(y&&(o=e.line,a=e.lineStart,c=e.position),Sf(e,t,4,!0,s)&&(y?p=e.result:f=e.result),y||(yf(e,h,g,m,p,f,o,a,c),m=p=f=null),If(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==l)hf(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return y&&yf(e,h,g,m,p,null,o,a,c),b&&(e.tag=u,e.anchor=d,e.kind="mapping",e.result=h),b}(e,g,h))||function(e,t){var n,r,s,i,o,a,c,l,u,d,h,g,m=!0,p=e.tag,f=e.anchor,y=/* @__PURE__ */Object.create(null);if(91===(g=e.input.charCodeAt(e.position)))o=93,l=!1,i=[];else{if(123!==g)return!1;o=125,l=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),g=e.input.charCodeAt(++e.position);0!==g;){if(If(e,!0,t),(g=e.input.charCodeAt(e.position))===o)return e.position++,e.tag=p,e.anchor=f,e.kind=l?"mapping":"sequence",e.result=i,!0;m?44===g&&hf(e,"expected the node content, but found ','"):hf(e,"missed comma between flow collection entries"),h=null,a=c=!1,63===g&&$p(e.input.charCodeAt(e.position+1))&&(a=c=!0,e.position++,If(e,!0,t)),n=e.line,r=e.lineStart,s=e.position,Sf(e,t,1,!1,!0),d=e.tag,u=e.result,If(e,!0,t),g=e.input.charCodeAt(e.position),!c&&e.line!==n||58!==g||(a=!0,g=e.input.charCodeAt(++e.position),If(e,!0,t),Sf(e,t,1,!1,!0),h=e.result),l?yf(e,i,y,d,u,h,n,r,s):a?i.push(yf(e,null,y,d,u,h,n,r,s)):i.push(u),If(e,!0,t),44===(g=e.input.charCodeAt(e.position))?(m=!0,g=e.input.charCodeAt(++e.position)):m=!1}hf(e,"unexpected end of the stream within a flow collection")}(e,h)?f=!0:(o&&function(e,t){var n,r,s,i,o=1,a=!1,c=!1,l=t,u=0,d=!1;if(124===(i=e.input.charCodeAt(e.position)))r=!1;else{if(62!==i)return!1;r=!0}for(e.kind="scalar",e.result="";0!==i;)if(43===(i=e.input.charCodeAt(++e.position))||45===i)1===o?o=43===i?3:2:hf(e,"repeat of a chomping mode identifier");else{if(!((s=nf(i))>=0))break;0===s?hf(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?hf(e,"repeat of an indentation width identifier"):(l=t+s-1,c=!0)}if(Qp(i)){do{i=e.input.charCodeAt(++e.position)}while(Qp(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!jp(i)&&0!==i)}for(;0!==i;){for(bf(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!c||e.lineIndent<l)&&32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>l&&(l=e.lineIndent),jp(i))u++;else{if(e.lineIndent<l){3===o?e.result+=tp.repeat("\n",a?1+u:u):1===o&&a&&(e.result+="\n");break}for(r?Qp(i)?(d=!0,e.result+=tp.repeat("\n",a?1+u:u)):d?(d=!1,e.result+=tp.repeat("\n",u+1)):0===u?a&&(e.result+=" "):e.result+=tp.repeat("\n",u):e.result+=tp.repeat("\n",a?1+u:u),a=!0,c=!0,u=0,n=e.position;!jp(i)&&0!==i;)i=e.input.charCodeAt(++e.position);pf(e,n,e.position,!1)}}return!0}(e,h)||function(e,t){var n,r,s;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,r=s=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(pf(e,r,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;r=e.position,e.position++,s=e.position}else jp(n)?(pf(e,r,s,!0),vf(e,If(e,!1,t)),r=s=e.position):e.position===e.lineStart&&wf(e)?hf(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);hf(e,"unexpected end of the stream within a single quoted scalar")}(e,h)||function(e,t){var n,r,s,i,o,a;if(34!==(a=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;0!==(a=e.input.charCodeAt(e.position));){if(34===a)return pf(e,n,e.position,!0),e.position++,!0;if(92===a){if(pf(e,n,e.position,!0),jp(a=e.input.charCodeAt(++e.position)))If(e,!1,t);else if(a<256&&af[a])e.result+=cf[a],e.position++;else if((o=tf(a))>0){for(s=o,i=0;s>0;s--)(o=ef(a=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+o:hf(e,"expected hexadecimal character");e.result+=sf(i),e.position++}else hf(e,"unknown escape sequence");n=r=e.position}else jp(a)?(pf(e,n,r,!0),vf(e,If(e,!1,t)),n=r=e.position):e.position===e.lineStart&&wf(e)?hf(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}hf(e,"unexpected end of the stream within a double quoted scalar")}(e,h)?f=!0:!function(e){var t,n,r;if(42!==(r=e.input.charCodeAt(e.position)))return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!$p(r)&&!qp(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&hf(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Hp.call(e.anchorMap,n)||hf(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],If(e,!0,-1),!0}(e)?function(e,t,n){var r,s,i,o,a,c,l,u,d=e.kind,h=e.result;if($p(u=e.input.charCodeAt(e.position))||qp(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&($p(r=e.input.charCodeAt(e.position+1))||n&&qp(r)))return!1;for(e.kind="scalar",e.result="",s=i=e.position,o=!1;0!==u;){if(58===u){if($p(r=e.input.charCodeAt(e.position+1))||n&&qp(r))break}else if(35===u){if($p(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&wf(e)||n&&qp(u))break;if(jp(u)){if(a=e.line,c=e.lineStart,l=e.lineIndent,If(e,!1,-1),e.lineIndent>=t){o=!0,u=e.input.charCodeAt(e.position);continue}e.position=i,e.line=a,e.lineStart=c,e.lineIndent=l;break}}o&&(pf(e,s,i,!1),vf(e,e.line-a),s=i=e.position,o=!1),Qp(u)||(i=e.position+1),u=e.input.charCodeAt(++e.position)}return pf(e,s,i,!1),!!e.result||(e.kind=d,e.result=h,!1)}(e,h,1===n)&&(f=!0,null===e.tag&&(e.tag="?")):(f=!0,null===e.tag&&null===e.anchor||hf(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(f=a&&Gf(e,g))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&hf(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,l=e.implicitTypes.length;c<l;c+=1)if((d=e.implicitTypes[c]).resolve(e.result)){e.result=d.construct(e.result),e.tag=d.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(Hp.call(e.typeMap[e.kind||"fallback"],e.tag))d=e.typeMap[e.kind||"fallback"][e.tag];else for(d=null,c=0,l=(u=e.typeMap.multi[e.kind||"fallback"]).length;c<l;c+=1)if(e.tag.slice(0,u[c].tag.length)===u[c].tag){d=u[c];break}d||hf(e,"unknown tag !<"+e.tag+">"),null!==e.result&&d.kind!==e.kind&&hf(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+d.kind+'", not "'+e.kind+'"'),d.resolve(e.result,e.tag)?(e.result=d.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):hf(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||f}function Zf(e){var t,n,r,s,i=e.position,o=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=/* @__PURE__ */Object.create(null),e.anchorMap=/* @__PURE__ */Object.create(null);0!==(s=e.input.charCodeAt(e.position))&&(If(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(o=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!$p(s);)s=e.input.charCodeAt(++e.position);for(r=[],(n=e.input.slice(t,e.position)).length<1&&hf(e,"directive name must not be less than one character in length");0!==s;){for(;Qp(s);)s=e.input.charCodeAt(++e.position);if(35===s){do{s=e.input.charCodeAt(++e.position)}while(0!==s&&!jp(s));break}if(jp(s))break;for(t=e.position;0!==s&&!$p(s);)s=e.input.charCodeAt(++e.position);r.push(e.input.slice(t,e.position))}0!==s&&bf(e),Hp.call(mf,n)?mf[n](e,n,r):gf(e,'unknown document directive "'+n+'"')}If(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,If(e,!0,-1)):o&&hf(e,"directives end mark is expected"),Sf(e,e.lineIndent-1,4,!1,!0),If(e,!0,-1),e.checkLineBreaks&&Kp.test(e.input.slice(i,e.position))&&gf(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&wf(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,If(e,!0,-1)):e.position<e.length-1&&hf(e,"end of the stream or a document separator is expected")}function Vf(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new uf(e,t),r=e.indexOf("\0");for(-1!==r&&(n.position=r,hf(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)Zf(n);return n.documents}var Ef=function(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null);var r=Vf(e,n);if("function"!=typeof t)return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])},Xf=function(e,t){var n=Vf(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new sp("expected a single document in the stream, but found more")}},Bf={loadAll:Ef,load:Xf},xf=Object.prototype.toString,Rf=Object.prototype.hasOwnProperty,Wf=65279,Nf={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},Jf=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],_f=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function kf(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else{if(!(e<=4294967295))throw new sp("code point within a string may not be greater than 0xFFFFFFFF");n="U",r=8}return"\\"+n+tp.repeat("0",r-t.length)+t}function Ff(e){this.schema=e.schema||Tp,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=tp.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,r,s,i,o,a,c;if(null===t)return{};for(n={},s=0,i=(r=Object.keys(t)).length;s<i;s+=1)o=r[s],a=String(t[o]),"!!"===o.slice(0,2)&&(o="tag:yaml.org,2002:"+o.slice(2)),(c=e.compiledTypeMap.fallback[o])&&Rf.call(c.styleAliases,a)&&(a=c.styleAliases[a]),n[o]=a;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?2:1,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Yf(e,t){for(var n,r=tp.repeat(" ",t),s=0,i=-1,o="",a=e.length;s<a;)-1===(i=e.indexOf("\n",s))?(n=e.slice(s),s=a):(n=e.slice(s,i+1),s=i+1),n.length&&"\n"!==n&&(o+=r),o+=n;return o}function Lf(e,t){return"\n"+tp.repeat(" ",e.indent*t)}function Of(e){return 32===e||9===e}function Tf(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&e!==Wf||65536<=e&&e<=1114111}function Hf(e){return Tf(e)&&e!==Wf&&13!==e&&10!==e}function Mf(e,t,n){var r=Hf(e),s=r&&!Of(e);return(n?r:r&&44!==e&&91!==e&&93!==e&&123!==e&&125!==e)&&35!==e&&!(58===t&&!s)||Hf(t)&&!Of(t)&&35===e||58===t&&s}function Kf(e,t){var n,r=e.charCodeAt(t);return r>=55296&&r<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1))>=56320&&n<=57343?1024*(r-55296)+n-56320+65536:r}function zf(e){return/^\n* /.test(e)}function Df(e,t,n,r,s,i,o,a){var c,l,u=0,d=null,h=!1,g=!1,m=-1!==r,p=-1,f=Tf(l=Kf(e,0))&&l!==Wf&&!Of(l)&&45!==l&&63!==l&&58!==l&&44!==l&&91!==l&&93!==l&&123!==l&&125!==l&&35!==l&&38!==l&&42!==l&&33!==l&&124!==l&&61!==l&&62!==l&&39!==l&&34!==l&&37!==l&&64!==l&&96!==l&&function(e){return!Of(e)&&58!==e}(Kf(e,e.length-1));if(t||o)for(c=0;c<e.length;u>=65536?c+=2:c++){if(!Tf(u=Kf(e,c)))return 5;f=f&&Mf(u,d,a),d=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(10===(u=Kf(e,c)))h=!0,m&&(g=g||c-p-1>r&&" "!==e[p+1],p=c);else if(!Tf(u))return 5;f=f&&Mf(u,d,a),d=u}g=g||m&&c-p-1>r&&" "!==e[p+1]}return h||g?n>9&&zf(e)?5:o?2===i?5:2:g?4:3:!f||o||s(e)?2===i?5:2:1}function Uf(e,t,n,r,s){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Jf.indexOf(t)||_f.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),o=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),a=r||e.flowLevel>-1&&n>=e.flowLevel;switch(Df(t,a,e.indent,o,function(t){return function(e,t){var n,r;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(e,t)},e.quotingType,e.forceQuotes&&!r,s)){case 1:return t;case 2:return"'"+t.replace(/'/g,"''")+"'";case 3:return"|"+Pf(t,e.indent)+jf(Yf(t,i));case 4:return">"+Pf(t,e.indent)+jf(Yf(function(e,t){var n,r,s=/(\n+)([^\n]*)/g,i=(a=e.indexOf("\n"),a=-1!==a?a:e.length,s.lastIndex=a,Qf(e.slice(0,a),t)),o="\n"===e[0]||" "===e[0];var a;for(;r=s.exec(e);){var c=r[1],l=r[2];n=" "===l[0],i+=c+(o||n||""===l?"":"\n")+Qf(l,t),o=n}return i}(t,o),i));case 5:return'"'+function(e){for(var t,n="",r=0,s=0;s<e.length;r>=65536?s+=2:s++)r=Kf(e,s),!(t=Nf[r])&&Tf(r)?(n+=e[s],r>=65536&&(n+=e[s+1])):n+=t||kf(r);return n}(t)+'"';default:throw new sp("impossible error: invalid scalar style")}}()}function Pf(e,t){var n=zf(e)?String(t):"",r="\n"===e[e.length-1];return n+(r&&("\n"===e[e.length-2]||"\n"===e)?"+":r?"":"-")+"\n"}function jf(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Qf(e,t){if(""===e||" "===e[0])return e;for(var n,r,s=/ [^ ]/g,i=0,o=0,a=0,c="";n=s.exec(e);)(a=n.index)-i>t&&(r=o>i?o:a,c+="\n"+e.slice(i,r),i=r+1),o=a;return c+="\n",e.length-i>t&&o>i?c+=e.slice(i,o)+"\n"+e.slice(o+1):c+=e.slice(i),c.slice(1)}function $f(e,t,n,r){var s,i,o,a="",c=e.tag;for(s=0,i=n.length;s<i;s+=1)o=n[s],e.replacer&&(o=e.replacer.call(n,String(s),o)),(ey(e,t+1,o,!0,!0,!1,!0)||void 0===o&&ey(e,t+1,null,!0,!0,!1,!0))&&(r&&""===a||(a+=Lf(e,t)),e.dump&&10===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=c,e.dump=a||"[]"}function qf(e,t,n){var r,s,i,o,a,c;for(i=0,o=(s=n?e.explicitTypes:e.implicitTypes).length;i<o;i+=1)if(((a=s[i]).instanceOf||a.predicate)&&(!a.instanceOf||"object"==typeof t&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(n?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(c=e.styleMap[a.tag]||a.defaultStyle,"[object Function]"===xf.call(a.represent))r=a.represent(t,c);else{if(!Rf.call(a.represent,c))throw new sp("!<"+a.tag+'> tag resolver accepts not "'+c+'" style');r=a.represent[c](t,c)}e.dump=r}return!0}return!1}function ey(e,t,n,r,s,i,o){e.tag=null,e.dump=n,qf(e,n,!1)||qf(e,n,!0);var a,c=xf.call(e.dump),l=r;r&&(r=e.flowLevel<0||e.flowLevel>t);var u,d,h="[object Object]"===c||"[object Array]"===c;if(h&&(d=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||d||2!==e.indent&&t>0)&&(s=!1),d&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(h&&d&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===c)r&&0!==Object.keys(e.dump).length?(!function(e,t,n,r){var s,i,o,a,c,l,u="",d=e.tag,h=Object.keys(n);if(!0===e.sortKeys)h.sort();else if("function"==typeof e.sortKeys)h.sort(e.sortKeys);else if(e.sortKeys)throw new sp("sortKeys must be a boolean or a function");for(s=0,i=h.length;s<i;s+=1)l="",r&&""===u||(l+=Lf(e,t)),a=n[o=h[s]],e.replacer&&(a=e.replacer.call(n,o,a)),ey(e,t+1,o,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&10===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,c&&(l+=Lf(e,t)),ey(e,t+1,a,!0,c)&&(e.dump&&10===e.dump.charCodeAt(0)?l+=":":l+=": ",u+=l+=e.dump));e.tag=d,e.dump=u||"{}"}(e,t,e.dump,s),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var r,s,i,o,a,c="",l=e.tag,u=Object.keys(n);for(r=0,s=u.length;r<s;r+=1)a="",""!==c&&(a+=", "),e.condenseFlow&&(a+='"'),o=n[i=u[r]],e.replacer&&(o=e.replacer.call(n,i,o)),ey(e,t,i,!1,!1)&&(e.dump.length>1024&&(a+="? "),a+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ey(e,t,o,!1,!1)&&(c+=a+=e.dump));e.tag=l,e.dump="{"+c+"}"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===c)r&&0!==e.dump.length?(e.noArrayIndent&&!o&&t>0?$f(e,t-1,e.dump,s):$f(e,t,e.dump,s),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var r,s,i,o="",a=e.tag;for(r=0,s=n.length;r<s;r+=1)i=n[r],e.replacer&&(i=e.replacer.call(n,String(r),i)),(ey(e,t,i,!1,!1)||void 0===i&&ey(e,t,null,!1,!1))&&(""!==o&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=a,e.dump="["+o+"]"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else{if("[object String]"!==c){if("[object Undefined]"===c)return!1;if(e.skipInvalid)return!1;throw new sp("unacceptable kind of an object to dump "+c)}"?"!==e.tag&&Uf(e,e.dump,t,i,l)}null!==e.tag&&"?"!==e.tag&&(a=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),a="!"===e.tag[0]?"!"+a:"tag:yaml.org,2002:"===a.slice(0,18)?"!!"+a.slice(18):"!<"+a+">",e.dump=a+" "+e.dump)}return!0}function ty(e,t){var n,r,s=[],i=[];for(ny(e,s,i),n=0,r=i.length;n<r;n+=1)t.duplicates.push(s[i[n]]);t.usedDuplicates=new Array(r)}function ny(e,t,n){var r,s,i;if(null!==e&&"object"==typeof e)if(-1!==(s=t.indexOf(e)))-1===n.indexOf(s)&&n.push(s);else if(t.push(e),Array.isArray(e))for(s=0,i=e.length;s<i;s+=1)ny(e[s],t,n);else for(s=0,i=(r=Object.keys(e)).length;s<i;s+=1)ny(e[r[s]],t,n)}var ry=function(e,t){var n=new Ff(t=t||{});n.noRefs||ty(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),ey(n,0,r,!0,!0)?n.dump+"\n":""};function sy(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var iy={Type:up,Schema:gp,FAILSAFE_SCHEMA:yp,JSON_SCHEMA:Vp,CORE_SCHEMA:Ep,DEFAULT_SCHEMA:Tp,load:Bf.load,loadAll:Bf.loadAll,dump:{dump:ry}.dump,YAMLException:sp,types:{binary:Np,float:Zp,map:fp,null:bp,pairs:Yp,set:Op,timestamp:xp,bool:Ip,int:Ap,merge:Rp,omap:kp,seq:pp,str:mp},safeLoad:sy("safeLoad","load"),safeLoadAll:sy("safeLoadAll","loadAll"),safeDump:sy("safeDump","dump")};const oy=new Lt;oy.name("fluxlay").description("Fluxlay CLI for building and managing wallpapers").version("0.1.0"),oy.command("login").description("Login to Supabase").action(async()=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await qm(),Je(dt.green("Login process completed."))}catch(e){We(dt.red(`Login failed: ${e}`)),process.exit(1)}}),oy.command("logout").description("Logout from Supabase").action(async()=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await(async()=>{await es.clearSession(),Re.success(dt.green("Logged out successfully."))})(),Je(dt.green("Logged out successfully."))}catch(e){We(dt.red(`Logout failed: ${e}`)),process.exit(1)}}),oy.command("whoami").description("Show current logged in user").action(async()=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await(async()=>{const e=await um(),{data:{user:t},error:n}=await e.auth.getUser();if(n||!t)return n&&Re.error(`Auth error: ${n.message}`),void Re.warn("Not logged in.");Re.info(`Logged in as: ${dt.green(t.email??"unknown")}`)})(),Je(dt.green("Done."))}catch(e){We(dt.red(`Failed to get user info: ${e}`)),process.exit(1)}}),oy.command("build").description("Build a Fluxlay wallpaper").argument("[dir]","Directory to build",".").option("-o, --output <name>","Output filename","wallpaper.fluxlay").action(async(e,t)=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await async function(e,t){await es.getSession()||(Re.error(dt.red("You must be logged in to build. Run `fluxlay login`.")),process.exit(1));const n=o.resolve(process.cwd(),e),r=o.join(n,"fluxlay.yaml");i.existsSync(r)||(Re.error(dt.red("fluxlay.yaml is required in the project root.")),process.exit(1));const s=Le();s.start(dt.yellow("Validating manifest..."));try{const e=i.readFileSync(r,"utf-8");Pt(e),s.stop(`${dt.green("✔")} Manifest validated.`)}catch(u){s.stop(dt.red("Manifest validation failed")),Re.error(u.message),process.exit(1)}const a=o.join(n,"dist"),c=o.resolve(n,t.output);s.start(`Building component in ${dt.cyan(n)}...`);try{await d({root:n,configFile:o.resolve(n,"vite.config.ts"),build:{outDir:"dist"},logLevel:"error"}),s.stop(`${dt.green("✔")} Component built.`)}catch(u){s.stop(dt.red("Build failed")),Re.error(u.message),process.exit(1)}let l;s.start(dt.yellow("Fetching developer key..."));try{const e=await pm.getDeveloperKey();if(e)l=Buffer.from(e).toString("hex"),s.stop(`${dt.green("✔")} Using cached developer key.`);else{const{developerKey:e}=await gm.getDeveloperKey({});l=Buffer.from(e).toString("hex"),await pm.saveDeveloperKey(e),s.stop(`${dt.green("✔")} Developer key fetched from API.`)}}catch(u){s.stop(dt.red("Failed to fetch developer key")),Re.error(u.message),process.exit(1)}s.start(dt.yellow("Packaging with DRM..."));try{await jt(a,c,l,0),s.stop(`${dt.green("✔")} Packaging completed.`)}catch(u){s.stop(dt.red("Packaging failed")),Re.error(u.message),process.exit(1)}Fe(`Output: ${dt.underline.cyan(c)}`,"Success!")}(e,t),Je(dt.green("Build completed."))}catch(n){We(dt.red(`Build failed: ${n}`)),process.exit(1)}}),oy.command("publish").description("Publish a Fluxlay wallpaper to the store").argument("[dir]","Directory to publish",".").action(async e=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await async function(e){await es.getSession()||(Re.error(dt.red("You must be logged in to publish. Run `fluxlay login`.")),process.exit(1));const t=o.resolve(process.cwd(),e),n=o.join(t,"fluxlay.yaml");i.existsSync(n)||(Re.error(dt.red("fluxlay.yaml is required in the project root.")),process.exit(1));const r=Le();let s;r.start(dt.yellow("Validating manifest..."));try{const e=i.readFileSync(n,"utf-8");Pt(e),s=iy.load(e),r.stop(`${dt.green("✔")} Manifest validated: ${dt.cyan(s.name)} (v${s.version})`)}catch(m){r.stop(dt.red("Manifest validation failed")),Re.error(m.message),process.exit(1)}const a=W.randomBytes(32),c=a.toString("hex");let l,u;r.start(dt.yellow("Registering wallpaper with API..."));try{const e=await gm.registerWallpaper({slug:s.slug,name:s.name,version:s.version,contentKey:a});l=e.versionId,u=e.uploadUrl,r.stop(`${dt.green("✔")} Wallpaper registered.`)}catch(m){r.stop(dt.red("Registration failed")),Re.error(m.message),process.exit(1)}const h=o.join(t,"dist"),g=o.join(t,`.fluxlay-${l}.tmp`);try{r.start(dt.yellow("Building component with Vite...")),await d({root:t,configFile:o.resolve(t,"vite.config.ts"),build:{outDir:"dist"},logLevel:"error"}),r.stop(`${dt.green("✔")} Component built.`),r.start(dt.yellow("Packaging with Content Key...")),await jt(h,g,c,1),r.stop(`${dt.green("✔")} Package created.`),r.start(dt.yellow("Uploading to storage..."));const e=i.readFileSync(g),n=await fetch(u,{method:"PUT",body:e,headers:{"Content-Type":"application/octet-stream"}});if(!n.ok)throw new Error(`Upload failed: ${n.statusText}`);r.stop(`${dt.green("✔")} Upload completed.`),r.start(dt.yellow("Confirming upload with API...")),await gm.confirmUpload({versionId:l}),r.stop(`${dt.green("✔")} Upload confirmed.`),Fe(`Wallpaper ID: ${dt.cyan(l)}`,"Success!")}catch(m){r.stop(dt.red("Publishing process failed")),Re.error(m.message),Re.warn(dt.yellow("Cancelling upload..."));try{await gm.cancelUpload({versionId:l})}catch(p){Re.error(`Failed to cancel upload: ${p.message}`)}process.exit(1)}finally{i.existsSync(g)&&i.unlinkSync(g)}}(e),Je(dt.green("Published successfully."))}catch(t){We(dt.red(`Publish failed: ${t}`)),process.exit(1)}}),oy.command("dev").description("Start development server for a Fluxlay wallpaper").argument("[dir]","Directory to watch",".").action(async e=>{Ne(dt.bgCyan.black.bold(" Fluxlay CLI "));try{await ym(e)}catch(t){We(dt.red(`Dev server failed: ${t}`)),process.exit(1)}}),oy.parse();
|