localesy 0.0.1-rc.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +113 -0
  3. package/dist/index.js +231 -0
  4. package/package.json +69 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Localesy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # Localesy CLI
2
+
3
+ Command-line interface for [Localesy](https://localesy.com) - AI-powered translation management for developers.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npx localesy@latest <command>
9
+ ```
10
+
11
+ Or install globally:
12
+
13
+ ```bash
14
+ npm install -g localesy
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```bash
20
+ # Initialize a project by scanning your translation files
21
+ npx localesy init
22
+
23
+ # Check translation status
24
+ npx localesy status
25
+
26
+ # Sync translations between local files and Localesy
27
+ npx localesy sync
28
+
29
+ # Translate changes on your branch to all languages
30
+ npx localesy translate
31
+ ```
32
+
33
+ ## Commands
34
+
35
+ | Command | Description |
36
+ | ----------- | ----------------------------------------------------- |
37
+ | `config` | View or update project configuration |
38
+ | `init` | Initialize Localesy by scanning for translation files |
39
+ | `login` | Authenticate with Localesy |
40
+ | `logout` | Clear stored credentials |
41
+ | `new` | Create a new language, project, or organization |
42
+ | `open` | Open the project in your browser |
43
+ | `status` | Show translation stats and sync status |
44
+ | `sync` | Sync translations between local files and Localesy |
45
+ | `translate` | Translate source changes to target languages |
46
+
47
+ ## Workflow
48
+
49
+ ### 1. Initialize your project
50
+
51
+ ```bash
52
+ npx localesy init --path ./src/locales
53
+ ```
54
+
55
+ The CLI will scan your translation files (JSON, YAML, PO), detect languages, and create a project on Localesy.
56
+
57
+ ### 2. Keep translations in sync
58
+
59
+ ```bash
60
+ # Push local changes and pull remote updates
61
+ npx localesy sync
62
+
63
+ # Push only (upload local changes)
64
+ npx localesy sync --push-only
65
+
66
+ # Pull only (download remote changes)
67
+ npx localesy sync --pull-only
68
+ ```
69
+
70
+ ### 3. Translate missing keys
71
+
72
+ When your source files have keys that target languages are missing:
73
+
74
+ ```bash
75
+ npx localesy translate
76
+ ```
77
+
78
+ This analyzes your local files against Localesy, identifies missing keys, and generates translations for the target languages you select. The translated files are written to your local translation files — run `git diff` to review the changes.
79
+
80
+ ### 4. Add new languages
81
+
82
+ ```bash
83
+ npx localesy new
84
+ # Select "New language" and choose from available locales
85
+ ```
86
+
87
+ ## Authentication
88
+
89
+ The CLI uses browser-based authentication. Run any command and you'll be prompted to log in via your browser. Credentials are stored locally at `~/.localesy/auth.json`.
90
+
91
+ ## Configuration
92
+
93
+ Project configuration is stored locally and linked to your working directory. View or update it with:
94
+
95
+ ```bash
96
+ npx localesy config
97
+ ```
98
+
99
+ ## Environment Variables
100
+
101
+ | Variable | Description |
102
+ | ------------------ | ----------------------------- |
103
+ | `LOCALESY_API_URL` | Override the Localesy API URL |
104
+ | `LOCALESY_APP_URL` | Override the Localesy app URL |
105
+
106
+ ## Requirements
107
+
108
+ - Node.js 18+
109
+ - Git (optional - used to detect your default branch during `init`)
110
+
111
+ ## License
112
+
113
+ MIT
package/dist/index.js ADDED
@@ -0,0 +1,231 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var rp=Object.create;var qs=Object.defineProperty;var ip=Object.getOwnPropertyDescriptor;var sp=Object.getOwnPropertyNames;var np=Object.getPrototypeOf,op=Object.prototype.hasOwnProperty;var x=(t,e)=>()=>(t&&(e=t(t=0)),e);var Q=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Mt=(t,e)=>{for(var r in e)qs(t,r,{get:e[r],enumerable:!0})},ap=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of sp(e))!op.call(t,s)&&s!==r&&qs(t,s,{get:()=>e[s],enumerable:!(i=ip(e,s))||i.enumerable});return t};var G=(t,e,r)=>(r=t!=null?rp(np(t)):{},ap(e||!t||!t.__esModule?qs(r,"default",{value:t,enumerable:!0}):r,t));var ot=Q((R0,Gs)=>{"use strict";var oi=process||{},Fo=oi.argv||[],ni=oi.env||{},lp=!(ni.NO_COLOR||Fo.includes("--no-color"))&&(!!ni.FORCE_COLOR||Fo.includes("--color")||oi.platform==="win32"||(oi.stdout||{}).isTTY&&ni.TERM!=="dumb"||!!ni.CI),up=(t,e,r=t)=>i=>{let s=""+i,n=s.indexOf(e,t.length);return~n?t+cp(s,e,r,n)+e:t+s+e},cp=(t,e,r,i)=>{let s="",n=0;do s+=t.substring(n,i)+r,n=i+e.length,i=t.indexOf(e,n);while(~i);return s+t.substring(n)},$o=(t=lp)=>{let e=t?up:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Gs.exports=$o();Gs.exports.createColors=$o});var Hs=Q((k0,Po)=>{"use strict";var Ks={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},hp={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},pp={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?Ks.up():"");return t&&(e+=Ks.left),e}};Po.exports={cursor:Ks,scroll:hp,erase:pp,beep:"\x07"}});function ko(t,e,r){return String(t).normalize().replaceAll(`\r
3
+ `,`
4
+ `).split(`
5
+ `).map(i=>Sp(i,e,r)).join(`
6
+ `)}function rn(t,e){if(typeof t=="string")return be.aliases.get(t)===e;for(let r of t)if(r!==void 0&&rn(r,e))return!0;return!1}function Fp(t,e){if(t===e)return;let r=t.split(`
7
+ `),i=e.split(`
8
+ `),s=[];for(let n=0;n<Math.max(r.length,i.length);n++)r[n]!==i[n]&&s.push(n);return s}function _(t){return t===Xs}function ci(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function Bo({input:t=Ye.stdin,output:e=Ye.stdout,overwrite:r=!0,hideCursor:i=!0}={}){let s=ve.createInterface({input:t,output:e,prompt:"",tabSize:1});ve.emitKeypressEvents(t,s),t instanceof Zs.ReadStream&&t.isTTY&&t.setRawMode(!0);let n=(o,{name:a,sequence:l})=>{let u=String(o);if(rn([u,a,l],"cancel")){i&&e.write(bt.cursor.show),process.exit(0);return}if(!r)return;ve.moveCursor(e,a==="return"?0:-1,a==="return"?-1:0,()=>{ve.clearLine(e,1,()=>{t.once("keypress",n)})})};return i&&e.write(bt.cursor.hide),t.once("keypress",n),()=>{t.off("keypress",n),i&&e.write(bt.cursor.show),t instanceof Zs.ReadStream&&t.isTTY&&!$p&&t.setRawMode(!1),s.terminal=!1,s.close()}}function Pp(t,e){if(t===void 0||e.length===0)return 0;let r=e.findIndex(i=>i.value===t);return r!==-1?r:0}function Ap(t,e){return(e.label??String(e.value)).toLowerCase().includes(t.toLowerCase())}function Tp(t,e){if(e)return t?e:e[0]}function je(t,e,r){let i=t+e,s=Math.max(r.length-1,0),n=i<0?s:i>s?0:i;return r[n].disabled?je(n,e<0?-1:1,r):n}var mr,Ye,ve,_o,bt,Zs,fp,dp,mp,Ys,ai,li,Js,ui,gp,yp,Oo,Dp,gr,mi,jo,wp,tn,Io,bp,Lo,en,Ao,vp,To,Ro,Cp,Qs,Ep,Sp,xp,be,$p,Xs,gi,Mo,Ie,hi,No,pi,fi,di,sn=x(()=>{"use strict";mr=G(ot(),1),Ye=require("process"),ve=G(require("readline"),1),_o=G(require("readline"),1),bt=G(Hs(),1),Zs=require("tty"),fp=t=>t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109,dp=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,mp=t=>t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9800&&t<=9811||t===9855||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=19968&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101632&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129672||t>=129680&&t<=129725||t>=129727&&t<=129733||t>=129742&&t<=129755||t>=129760&&t<=129768||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141,Ys=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,ai=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,li=/\t{1,1000}/y,Js=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"),ui=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,gp=new RegExp("\\p{M}+","gu"),yp={limit:1/0,ellipsis:""},Oo=(t,e={},r={})=>{let i=e.limit??1/0,s=e.ellipsis??"",n=e?.ellipsisWidth??(s?Oo(s,yp,r).width:0),o=r.ansiWidth??0,a=r.controlWidth??0,l=r.tabWidth??8,u=r.ambiguousWidth??1,c=r.emojiWidth??2,p=r.fullWidthWidth??2,m=r.regularWidth??1,f=r.wideWidth??2,h=0,d=0,y=t.length,g=0,D=!1,v=y,b=Math.max(0,i-n),C=0,F=0,E=0,S=0;t:for(;;){if(F>C||d>=y&&d>h){let k=t.slice(C,F)||t.slice(h,d);g=0;for(let z of k.replaceAll(gp,"")){let N=z.codePointAt(0)||0;if(dp(N)?S=p:mp(N)?S=f:u!==m&&fp(N)?S=u:S=m,E+S>b&&(v=Math.min(v,Math.max(C,h)+g)),E+S>i){D=!0;break t}g+=z.length,E+=S}C=F=0}if(d>=y)break;if(ui.lastIndex=d,ui.test(t)){if(g=ui.lastIndex-d,S=g*m,E+S>b&&(v=Math.min(v,d+Math.floor((b-E)/m))),E+S>i){D=!0;break}E+=S,C=h,F=d,d=h=ui.lastIndex;continue}if(Ys.lastIndex=d,Ys.test(t)){if(E+o>b&&(v=Math.min(v,d)),E+o>i){D=!0;break}E+=o,C=h,F=d,d=h=Ys.lastIndex;continue}if(ai.lastIndex=d,ai.test(t)){if(g=ai.lastIndex-d,S=g*a,E+S>b&&(v=Math.min(v,d+Math.floor((b-E)/a))),E+S>i){D=!0;break}E+=S,C=h,F=d,d=h=ai.lastIndex;continue}if(li.lastIndex=d,li.test(t)){if(g=li.lastIndex-d,S=g*l,E+S>b&&(v=Math.min(v,d+Math.floor((b-E)/l))),E+S>i){D=!0;break}E+=S,C=h,F=d,d=h=li.lastIndex;continue}if(Js.lastIndex=d,Js.test(t)){if(E+c>b&&(v=Math.min(v,d)),E+c>i){D=!0;break}E+=c,C=h,F=d,d=h=Js.lastIndex;continue}d+=1}return{width:D?b:E,index:D?v:y,truncated:D,ellipsed:D&&i>=n}},Dp={limit:1/0,ellipsis:"",ellipsisWidth:0},gr=(t,e={})=>Oo(t,Dp,e).width,mi="\x1B",jo="\x9B",wp=39,tn="\x07",Io="[",bp="]",Lo="m",en=`${bp}8;;`,Ao=new RegExp(`(?:\\${Io}(?<code>\\d+)m|\\${en}(?<uri>.*)${tn})`,"y"),vp=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},To=t=>`${mi}${Io}${t}${Lo}`,Ro=t=>`${mi}${en}${t}${tn}`,Cp=t=>t.map(e=>gr(e)),Qs=(t,e,r)=>{let i=e[Symbol.iterator](),s=!1,n=!1,o=t.at(-1),a=o===void 0?0:gr(o),l=i.next(),u=i.next(),c=0;for(;!l.done;){let p=l.value,m=gr(p);a+m<=r?t[t.length-1]+=p:(t.push(p),a=0),(p===mi||p===jo)&&(s=!0,n=e.startsWith(en,c+1)),s?n?p===tn&&(s=!1,n=!1):p===Lo&&(s=!1):(a+=m,a===r&&!u.done&&(t.push(""),a=0)),l=u,u=i.next(),c+=p.length}o=t.at(-1),!a&&o!==void 0&&o.length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Ep=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(gr(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Sp=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let i="",s,n,o=t.split(" "),a=Cp(o),l=[""];for(let[h,d]of o.entries()){r.trim!==!1&&(l[l.length-1]=(l.at(-1)??"").trimStart());let y=gr(l.at(-1)??"");if(h!==0&&(y>=e&&(r.wordWrap===!1||r.trim===!1)&&(l.push(""),y=0),(y>0||r.trim===!1)&&(l[l.length-1]+=" ",y++)),r.hard&&a[h]>e){let g=e-y,D=1+Math.floor((a[h]-g-1)/e);Math.floor((a[h]-1)/e)<D&&l.push(""),Qs(l,d,e);continue}if(y+a[h]>e&&y>0&&a[h]>0){if(r.wordWrap===!1&&y<e){Qs(l,d,e);continue}l.push("")}if(y+a[h]>e&&r.wordWrap===!1){Qs(l,d,e);continue}l[l.length-1]+=d}r.trim!==!1&&(l=l.map(h=>Ep(h)));let u=l.join(`
9
+ `),c=u[Symbol.iterator](),p=c.next(),m=c.next(),f=0;for(;!p.done;){let h=p.value,d=m.value;if(i+=h,h===mi||h===jo){Ao.lastIndex=f+1;let g=Ao.exec(u)?.groups;if(g?.code!==void 0){let D=Number.parseFloat(g.code);s=D===wp?void 0:D}else g?.uri!==void 0&&(n=g.uri.length===0?void 0:g.uri)}let y=s?vp(s):void 0;d===`
10
+ `?(n&&(i+=Ro("")),s&&y&&(i+=To(y))):h===`
11
+ `&&(s&&y&&(i+=To(s)),n&&(i+=Ro(n))),f+=h.length,p=m,m=c.next()}return i};xp=["up","down","left","right","space","enter","cancel"],be={actions:new Set(xp),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};$p=globalThis.process.platform.startsWith("win"),Xs=Symbol("clack:cancel");gi=t=>"columns"in t&&typeof t.columns=="number"?t.columns:80,Mo=t=>"rows"in t&&typeof t.rows=="number"?t.rows:20,Ie=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,r=!0){let{input:i=Ye.stdin,output:s=Ye.stdout,render:n,signal:o,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=r,this._abortSignal=o,this.input=i,this.output=s}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let i=this._subscribers.get(e)??[];i.push(r),this._subscribers.set(e,i)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let i=this._subscribers.get(e)??[],s=[];for(let n of i)n.cb(...r),n.once&&s.push(()=>i.splice(i.indexOf(n),1));for(let n of s)n()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Xs);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=_o.default.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),ci(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(bt.cursor.show),this.output.off("resize",this.render),ci(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(bt.cursor.show),this.output.off("resize",this.render),ci(this.input,!1),e(Xs)})})}_isActionKey(e,r){return e===" "}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,r){this.userInput=e??"",this.emit("userInput",this.userInput),r&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,r){if(this._track&&r.name!=="return"&&(r.name&&this._isActionKey(e,r)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&be.aliases.has(r.name)&&this.emit("cursor",be.aliases.get(r.name)),be.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),r),r?.name==="return"){if(this.opts.validate){let i=this.opts.validate(this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}rn([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
12
+ `),ci(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=ko(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
13
+ `).length-1;this.output.write(bt.cursor.move(-999,e*-1))}render(){let e=ko(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(bt.cursor.hide);else{let r=Fp(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let i=r[0];this.output.write(bt.cursor.move(0,i)),this.output.write(bt.erase.lines(1));let s=e.split(`
14
+ `);this.output.write(s[i]),this._prevFrame=e,this.output.write(bt.cursor.move(0,s.length-i-1));return}if(r&&r?.length>1){let i=r[0];this.output.write(bt.cursor.move(0,i)),this.output.write(bt.erase.down());let s=e.split(`
15
+ `).slice(i);this.output.write(s.join(`
16
+ `)),this._prevFrame=e;return}this.output.write(bt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};hi=class extends Ie{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#t=0;#e="";#n;#i;get cursor(){return this.#t}get userInputWithCursor(){if(!this.userInput)return mr.default.inverse(mr.default.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let e=this.userInput.slice(0,this._cursor),[r,...i]=this.userInput.slice(this._cursor);return`${e}${mr.default.inverse(r)}${i.join("")}`}get options(){return typeof this.#i=="function"?this.#i():this.#i}constructor(e){super(e),this.#i=e.options;let r=this.options;this.filteredOptions=[...r],this.multiple=e.multiple===!0,this.#n=e.filter??Ap;let i;if(e.initialValue&&Array.isArray(e.initialValue)?this.multiple?i=e.initialValue:i=e.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(i=[this.options[0].value]),i)for(let s of i){let n=r.findIndex(o=>o.value===s);n!==-1&&(this.toggleSelected(s),this.#t=n)}this.focusedValue=this.options[this.#t]?.value,this.on("key",(s,n)=>this.#o(s,n)),this.on("userInput",s=>this.#y(s))}_isActionKey(e,r){return e===" "||this.multiple&&this.isNavigating&&r.name==="space"&&e!==void 0&&e!==""}#o(e,r){let i=r.name==="up",s=r.name==="down",n=r.name==="return";i||s?(this.#t=Math.max(0,Math.min(this.#t+(i?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):n?this.value=Tp(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(r.name==="tab"||this.isNavigating&&r.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(e){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(e)?this.selectedValues=this.selectedValues.filter(r=>r!==e):this.selectedValues=[...this.selectedValues,e]:this.selectedValues=[e])}#y(e){if(e!==this.#e){this.#e=e;let r=this.options;e?this.filteredOptions=r.filter(i=>this.#n(e,i)):this.filteredOptions=[...r],this.#t=Pp(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#t]?.value,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}},No=class extends Ie{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",e=>{this.output.write(bt.cursor.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};pi=class extends Ie{options;cursor=0;get _value(){return this.options[this.cursor].value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,r=this.value!==void 0&&this.value.length===e.length;this.value=r?[]:e.map(i=>i.value)}toggleInvert(){let e=this.value;if(!e)return;let r=this._enabledOptions.filter(i=>!e.includes(i.value));this.value=r.map(i=>i.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter(r=>r!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let r=Math.max(this.options.findIndex(({value:i})=>i===e.cursorAt),0);this.cursor=this.options[r].disabled?je(r,1,this.options):r,this.on("key",i=>{i==="a"&&this.toggleAll(),i==="i"&&this.toggleInvert()}),this.on("cursor",i=>{switch(i){case"left":case"up":this.cursor=je(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=je(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}},fi=class extends Ie{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;let r=this.options.findIndex(({value:s})=>s===e.initialValue),i=r===-1?0:r;this.cursor=this.options[i].disabled?je(i,1,this.options):i,this.changeValue(),this.on("cursor",s=>{switch(s){case"left":case"up":this.cursor=je(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=je(this.cursor,1,this.options);break}this.changeValue()})}},di=class extends Ie{get userInputWithCursor(){if(this.state==="submit")return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let r=e.slice(0,this.cursor),[i,...s]=e.slice(this.cursor);return`${r}${mr.default.inverse(i)}${s.join("")}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=e.defaultValue),this.value===void 0&&(this.value="")})}}});function kp(){return kt.default.platform!=="win32"?kt.default.env.TERM!=="linux":!!kt.default.env.CI||!!kt.default.env.WT_SESSION||!!kt.default.env.TERMINUS_SUBLIME||kt.default.env.ConEmuTask==="{cmd::Cmder}"||kt.default.env.TERM_PROGRAM==="Terminus-Sublime"||kt.default.env.TERM_PROGRAM==="vscode"||kt.default.env.TERM==="xterm-256color"||kt.default.env.TERM==="alacritty"||kt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function wr(t,e,r){return String(t).normalize().replaceAll(`\r
17
+ `,`
18
+ `).split(`
19
+ `).map(i=>ef(i,e,r)).join(`
20
+ `)}function Ko(t){return t.label??String(t.value??"")}function sf(t,e){if(!t)return!0;let r=(e.label??String(e.value??"")).toLowerCase(),i=(e.hint??"").toLowerCase(),s=String(e.value).toLowerCase(),n=t.toLowerCase();return r.includes(n)||i.includes(n)||s.includes(n)}function nf(t,e){let r=[];for(let i of e)t.includes(i.value)&&r.push(i);return r}var w,kt,un,Ho,yr,Rp,ln,_p,K,Op,Yo,Jo,Ci,jp,I,ce,N0,W0,bi,Dr,Ip,Wo,zo,z0,Uo,Lp,Bp,Mp,U0,V0,Np,Wp,zp,Up,br,Vp,qp,Gp,nn,yi,Di,on,wi,Kp,Hp,Qo,Yp,Zt,Ei,Zo,Jp,cn,Xo,Qp,ta,hn,Vo,Zp,qo,Go,Xp,an,tf,ef,rf,vi,pn,pt,R,Xt,Si,L,Ce,of,af,O,lf,M,q0,Et,G0,Nt,ct=x(()=>{"use strict";sn();sn();w=G(ot(),1),kt=G(require("process"),1),un=require("fs"),Ho=require("path"),yr=G(Hs(),1),Rp=require("util");ln=kp(),_p=()=>process.env.CI==="true",K=(t,e)=>ln?t:e,Op=K("\u25C6","*"),Yo=K("\u25A0","x"),Jo=K("\u25B2","x"),Ci=K("\u25C7","o"),jp=K("\u250C","T"),I=K("\u2502","|"),ce=K("\u2514","\u2014"),N0=K("\u2510","T"),W0=K("\u2518","\u2014"),bi=K("\u25CF",">"),Dr=K("\u25CB"," "),Ip=K("\u25FB","[\u2022]"),Wo=K("\u25FC","[+]"),zo=K("\u25FB","[ ]"),z0=K("\u25AA","\u2022"),Uo=K("\u2500","-"),Lp=K("\u256E","+"),Bp=K("\u251C","+"),Mp=K("\u256F","+"),U0=K("\u2570","+"),V0=K("\u256D","+"),Np=K("\u25CF","\u2022"),Wp=K("\u25C6","*"),zp=K("\u25B2","!"),Up=K("\u25A0","x"),br=t=>{switch(t){case"initial":case"active":return w.default.cyan(Op);case"cancel":return w.default.red(Yo);case"error":return w.default.yellow(Jo);case"submit":return w.default.green(Ci)}},Vp=t=>t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109,qp=t=>t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510,Gp=t=>t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9800&&t<=9811||t===9855||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12771||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=19903||t>=19968&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t===94192||t===94193||t>=94208&&t<=100343||t>=100352&&t<=101589||t>=101632&&t<=101640||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128727||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129672||t>=129680&&t<=129725||t>=129727&&t<=129733||t>=129742&&t<=129755||t>=129760&&t<=129768||t>=129776&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141,nn=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,yi=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Di=/\t{1,1000}/y,on=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"),wi=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Kp=new RegExp("\\p{M}+","gu"),Hp={limit:1/0,ellipsis:""},Qo=(t,e={},r={})=>{let i=e.limit??1/0,s=e.ellipsis??"",n=e?.ellipsisWidth??(s?Qo(s,Hp,r).width:0),o=r.ansiWidth??0,a=r.controlWidth??0,l=r.tabWidth??8,u=r.ambiguousWidth??1,c=r.emojiWidth??2,p=r.fullWidthWidth??2,m=r.regularWidth??1,f=r.wideWidth??2,h=0,d=0,y=t.length,g=0,D=!1,v=y,b=Math.max(0,i-n),C=0,F=0,E=0,S=0;t:for(;;){if(F>C||d>=y&&d>h){let k=t.slice(C,F)||t.slice(h,d);g=0;for(let z of k.replaceAll(Kp,"")){let N=z.codePointAt(0)||0;if(qp(N)?S=p:Gp(N)?S=f:u!==m&&Vp(N)?S=u:S=m,E+S>b&&(v=Math.min(v,Math.max(C,h)+g)),E+S>i){D=!0;break t}g+=z.length,E+=S}C=F=0}if(d>=y)break;if(wi.lastIndex=d,wi.test(t)){if(g=wi.lastIndex-d,S=g*m,E+S>b&&(v=Math.min(v,d+Math.floor((b-E)/m))),E+S>i){D=!0;break}E+=S,C=h,F=d,d=h=wi.lastIndex;continue}if(nn.lastIndex=d,nn.test(t)){if(E+o>b&&(v=Math.min(v,d)),E+o>i){D=!0;break}E+=o,C=h,F=d,d=h=nn.lastIndex;continue}if(yi.lastIndex=d,yi.test(t)){if(g=yi.lastIndex-d,S=g*a,E+S>b&&(v=Math.min(v,d+Math.floor((b-E)/a))),E+S>i){D=!0;break}E+=S,C=h,F=d,d=h=yi.lastIndex;continue}if(Di.lastIndex=d,Di.test(t)){if(g=Di.lastIndex-d,S=g*l,E+S>b&&(v=Math.min(v,d+Math.floor((b-E)/l))),E+S>i){D=!0;break}E+=S,C=h,F=d,d=h=Di.lastIndex;continue}if(on.lastIndex=d,on.test(t)){if(E+c>b&&(v=Math.min(v,d)),E+c>i){D=!0;break}E+=c,C=h,F=d,d=h=on.lastIndex;continue}d+=1}return{width:D?b:E,index:D?v:y,truncated:D,ellipsed:D&&i>=n}},Yp={limit:1/0,ellipsis:"",ellipsisWidth:0},Zt=(t,e={})=>Qo(t,Yp,e).width,Ei="\x1B",Zo="\x9B",Jp=39,cn="\x07",Xo="[",Qp="]",ta="m",hn=`${Qp}8;;`,Vo=new RegExp(`(?:\\${Xo}(?<code>\\d+)m|\\${hn}(?<uri>.*)${cn})`,"y"),Zp=t=>{if(t>=30&&t<=37||t>=90&&t<=97)return 39;if(t>=40&&t<=47||t>=100&&t<=107)return 49;if(t===1||t===2)return 22;if(t===3)return 23;if(t===4)return 24;if(t===7)return 27;if(t===8)return 28;if(t===9)return 29;if(t===0)return 0},qo=t=>`${Ei}${Xo}${t}${ta}`,Go=t=>`${Ei}${hn}${t}${cn}`,Xp=t=>t.map(e=>Zt(e)),an=(t,e,r)=>{let i=e[Symbol.iterator](),s=!1,n=!1,o=t.at(-1),a=o===void 0?0:Zt(o),l=i.next(),u=i.next(),c=0;for(;!l.done;){let p=l.value,m=Zt(p);a+m<=r?t[t.length-1]+=p:(t.push(p),a=0),(p===Ei||p===Zo)&&(s=!0,n=e.startsWith(hn,c+1)),s?n?p===cn&&(s=!1,n=!1):p===ta&&(s=!1):(a+=m,a===r&&!u.done&&(t.push(""),a=0)),l=u,u=i.next(),c+=p.length}o=t.at(-1),!a&&o!==void 0&&o.length>0&&t.length>1&&(t[t.length-2]+=t.pop())},tf=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Zt(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},ef=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let i="",s,n,o=t.split(" "),a=Xp(o),l=[""];for(let[h,d]of o.entries()){r.trim!==!1&&(l[l.length-1]=(l.at(-1)??"").trimStart());let y=Zt(l.at(-1)??"");if(h!==0&&(y>=e&&(r.wordWrap===!1||r.trim===!1)&&(l.push(""),y=0),(y>0||r.trim===!1)&&(l[l.length-1]+=" ",y++)),r.hard&&a[h]>e){let g=e-y,D=1+Math.floor((a[h]-g-1)/e);Math.floor((a[h]-1)/e)<D&&l.push(""),an(l,d,e);continue}if(y+a[h]>e&&y>0&&a[h]>0){if(r.wordWrap===!1&&y<e){an(l,d,e);continue}l.push("")}if(y+a[h]>e&&r.wordWrap===!1){an(l,d,e);continue}l[l.length-1]+=d}r.trim!==!1&&(l=l.map(h=>tf(h)));let u=l.join(`
21
+ `),c=u[Symbol.iterator](),p=c.next(),m=c.next(),f=0;for(;!p.done;){let h=p.value,d=m.value;if(i+=h,h===Ei||h===Zo){Vo.lastIndex=f+1;let g=Vo.exec(u)?.groups;if(g?.code!==void 0){let D=Number.parseFloat(g.code);s=D===Jp?void 0:D}else g?.uri!==void 0&&(n=g.uri.length===0?void 0:g.uri)}let y=s?Zp(s):void 0;d===`
22
+ `?(n&&(i+=Go("")),s&&y&&(i+=qo(y))):h===`
23
+ `&&(s&&y&&(i+=qo(s)),n&&(i+=Go(n))),f+=h.length,p=m,m=c.next()}return i};rf=(t,e,r,i,s)=>{let n=e,o=0;for(let a=r;a<i;a++){let l=t[a];if(n=n-l.length,o++,n<=s)break}return{lineCount:n,removals:o}},vi=t=>{let{cursor:e,options:r,style:i}=t,s=t.output??process.stdout,n=gi(s),o=t.columnPadding??0,a=t.rowPadding??4,l=n-o,u=Mo(s),c=w.default.dim("..."),p=t.maxItems??Number.POSITIVE_INFINITY,m=Math.max(u-a,0),f=Math.max(Math.min(p,m),5),h=0;e>=f-3&&(h=Math.max(Math.min(e-f+3,r.length-f),0));let d=f<r.length&&h>0,y=f<r.length&&h+f<r.length,g=Math.min(h+f,r.length),D=[],v=0;d&&v++,y&&v++;let b=h+(d?1:0),C=g-(y?1:0);for(let E=b;E<C;E++){let S=wr(i(r[E],E===e),l,{hard:!0,trim:!1}).split(`
24
+ `);D.push(S),v+=S.length}if(v>m){let E=0,S=0,k=v,z=e-b,N=(Z,W)=>rf(D,k,Z,W,m);d?({lineCount:k,removals:E}=N(0,z),k>m&&({lineCount:k,removals:S}=N(z+1,D.length))):({lineCount:k,removals:S}=N(z+1,D.length),k>m&&({lineCount:k,removals:E}=N(0,z))),E>0&&(d=!0,D.splice(0,E)),S>0&&(y=!0,D.splice(D.length-S,S))}let F=[];d&&F.push(c);for(let E of D)for(let S of E)F.push(S);return y&&F.push(c),F};pn=t=>new hi({options:t.options,initialValue:t.initialValue?[t.initialValue]:void 0,initialUserInput:t.initialUserInput,filter:(e,r)=>sf(e,r),signal:t.signal,input:t.input,output:t.output,validate:t.validate,render(){let e=[`${w.default.gray(I)}`,`${br(this.state)} ${t.message}`],r=this.userInput,i=String(this.value??""),s=this.options,n=t.placeholder,o=i===""&&n!==void 0;switch(this.state){case"submit":{let a=nf(this.selectedValues,s),l=a.length>0?` ${w.default.dim(a.map(Ko).join(", "))}`:"";return`${e.join(`
25
+ `)}
26
+ ${w.default.gray(I)}${l}`}case"cancel":{let a=r?` ${w.default.strikethrough(w.default.dim(r))}`:"";return`${e.join(`
27
+ `)}
28
+ ${w.default.gray(I)}${a}`}default:{let a="";if(this.isNavigating||o){let h=o?n:r;a=h!==""?` ${w.default.dim(h)}`:""}else a=` ${this.userInputWithCursor}`;let l=this.filteredOptions.length!==s.length?w.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",u=this.filteredOptions.length===0&&r?[`${w.default.cyan(I)} ${w.default.yellow("No matches found")}`]:[],c=this.state==="error"?[`${w.default.yellow(I)} ${w.default.yellow(this.error)}`]:[];e.push(`${w.default.cyan(I)}`,`${w.default.cyan(I)} ${w.default.dim("Search:")}${a}${l}`,...u,...c);let p=[`${w.default.dim("\u2191/\u2193")} to select`,`${w.default.dim("Enter:")} confirm`,`${w.default.dim("Type:")} to search`],m=[`${w.default.cyan(I)} ${w.default.dim(p.join(" \u2022 "))}`,`${w.default.cyan(ce)}`],f=this.filteredOptions.length===0?[]:vi({cursor:this.cursor,options:this.filteredOptions,columnPadding:3,rowPadding:e.length+m.length,style:(h,d)=>{let y=Ko(h),g=h.hint&&h.value===this.focusedValue?w.default.dim(` (${h.hint})`):"";return d?`${w.default.green(bi)} ${y}${g}`:`${w.default.dim(Dr)} ${w.default.dim(y)}${g}`},maxItems:t.maxItems,output:t.output});return[...e,...f.map(h=>`${w.default.cyan(I)} ${h}`),...m].join(`
29
+ `)}}}}).prompt(),pt=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new No({active:e,inactive:r,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue??!0,render(){let i=`${w.default.gray(I)}
30
+ ${br(this.state)} ${t.message}
31
+ `,s=this.value?e:r;switch(this.state){case"submit":return`${i}${w.default.gray(I)} ${w.default.dim(s)}`;case"cancel":return`${i}${w.default.gray(I)} ${w.default.strikethrough(w.default.dim(s))}
32
+ ${w.default.gray(I)}`;default:return`${i}${w.default.cyan(I)} ${this.value?`${w.default.green(bi)} ${e}`:`${w.default.dim(Dr)} ${w.default.dim(e)}`} ${w.default.dim("/")} ${this.value?`${w.default.dim(Dr)} ${w.default.dim(r)}`:`${w.default.green(bi)} ${r}`}
33
+ ${w.default.cyan(ce)}
34
+ `}}}).prompt()},R={message:(t=[],{symbol:e=w.default.gray(I),secondarySymbol:r=w.default.gray(I),output:i=process.stdout,spacing:s=1}={})=>{let n=[];for(let a=0;a<s;a++)n.push(`${r}`);let o=Array.isArray(t)?t:t.split(`
35
+ `);if(o.length>0){let[a,...l]=o;a.length>0?n.push(`${e} ${a}`):n.push(e);for(let u of l)u.length>0?n.push(`${r} ${u}`):n.push(r)}i.write(`${n.join(`
36
+ `)}
37
+ `)},info:(t,e)=>{R.message(t,{...e,symbol:w.default.blue(Np)})},success:(t,e)=>{R.message(t,{...e,symbol:w.default.green(Wp)})},step:(t,e)=>{R.message(t,{...e,symbol:w.default.green(Ci)})},warn:(t,e)=>{R.message(t,{...e,symbol:w.default.yellow(zp)})},warning:(t,e)=>{R.warn(t,e)},error:(t,e)=>{R.message(t,{...e,symbol:w.default.red(Up)})}},Xt=(t="",e)=>{(e?.output??process.stdout).write(`${w.default.gray(ce)} ${w.default.red(t)}
38
+
39
+ `)},Si=(t="",e)=>{(e?.output??process.stdout).write(`${w.default.gray(jp)} ${t}
40
+ `)},L=(t="",e)=>{(e?.output??process.stdout).write(`${w.default.gray(I)}
41
+ ${w.default.gray(ce)} ${t}
42
+
43
+ `)},Ce=t=>{let e=(i,s)=>{let n=i.label??String(i.value);return s==="disabled"?`${w.default.gray(zo)} ${w.default.gray(n)}${i.hint?` ${w.default.dim(`(${i.hint??"disabled"})`)}`:""}`:s==="active"?`${w.default.cyan(Ip)} ${n}${i.hint?` ${w.default.dim(`(${i.hint})`)}`:""}`:s==="selected"?`${w.default.green(Wo)} ${w.default.dim(n)}${i.hint?` ${w.default.dim(`(${i.hint})`)}`:""}`:s==="cancelled"?`${w.default.strikethrough(w.default.dim(n))}`:s==="active-selected"?`${w.default.green(Wo)} ${n}${i.hint?` ${w.default.dim(`(${i.hint})`)}`:""}`:s==="submitted"?`${w.default.dim(n)}`:`${w.default.dim(zo)} ${w.default.dim(n)}`},r=t.required??!0;return new pi({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValues:t.initialValues,required:r,cursorAt:t.cursorAt,validate(i){if(r&&(i===void 0||i.length===0))return`Please select at least one option.
44
+ ${w.default.reset(w.default.dim(`Press ${w.default.gray(w.default.bgWhite(w.default.inverse(" space ")))} to select, ${w.default.gray(w.default.bgWhite(w.default.inverse(" enter ")))} to submit`))}`},render(){let i=`${w.default.gray(I)}
45
+ ${br(this.state)} ${t.message}
46
+ `,s=this.value??[],n=(o,a)=>{if(o.disabled)return e(o,"disabled");let l=s.includes(o.value);return a&&l?e(o,"active-selected"):l?e(o,"selected"):e(o,a?"active":"inactive")};switch(this.state){case"submit":return`${i}${w.default.gray(I)} ${this.options.filter(({value:o})=>s.includes(o)).map(o=>e(o,"submitted")).join(w.default.dim(", "))||w.default.dim("none")}`;case"cancel":{let o=this.options.filter(({value:a})=>s.includes(a)).map(a=>e(a,"cancelled")).join(w.default.dim(", "));return`${i}${w.default.gray(I)}${o.trim()?` ${o}
47
+ ${w.default.gray(I)}`:""}`}case"error":{let o=`${w.default.yellow(I)} `,a=this.error.split(`
48
+ `).map((l,u)=>u===0?`${w.default.yellow(ce)} ${w.default.yellow(l)}`:` ${l}`).join(`
49
+ `);return`${i}${o}${vi({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:o.length,style:n}).join(`
50
+ ${o}`)}
51
+ ${a}
52
+ `}default:{let o=`${w.default.cyan(I)} `;return`${i}${o}${vi({output:t.output,options:this.options,cursor:this.cursor,maxItems:t.maxItems,columnPadding:o.length,style:n}).join(`
53
+ ${o}`)}
54
+ ${w.default.cyan(ce)}
55
+ `}}}}).prompt()},of=t=>w.default.dim(t),af=(t,e,r)=>{let i={hard:!0,trim:!1},s=wr(t,e,i).split(`
56
+ `),n=s.reduce((l,u)=>Math.max(Zt(u),l),0),o=s.map(r).reduce((l,u)=>Math.max(Zt(u),l),0),a=e-(o-n);return wr(t,a,i)},O=(t="",e="",r)=>{let i=r?.output??kt.default.stdout,s=r?.format??of,n=["",...af(t,gi(i)-6,s).split(`
57
+ `).map(s),""],o=Zt(e),a=Math.max(n.reduce((u,c)=>{let p=Zt(c);return p>u?p:u},0),o)+2,l=n.map(u=>`${w.default.gray(I)} ${u}${" ".repeat(a-Zt(u))}${w.default.gray(I)}`).join(`
58
+ `);i.write(`${w.default.gray(I)}
59
+ ${w.default.green(Ci)} ${w.default.reset(e)} ${w.default.gray(Uo.repeat(Math.max(a-o-1,1))+Lp)}
60
+ ${l}
61
+ ${w.default.gray(Bp+Uo.repeat(a+2)+Mp)}
62
+ `)},lf=w.default.magenta,M=({indicator:t="dots",onCancel:e,output:r=process.stdout,cancelMessage:i,errorMessage:s,frames:n=ln?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:o=ln?80:120,signal:a,...l}={})=>{let u=_p(),c,p,m=!1,f=!1,h="",d,y=performance.now(),g=gi(r),D=l?.styleFrame??lf,v=W=>{let it=W>1?s??be.messages.error:i??be.messages.cancel;f=W===1,m&&(Z(it,W),f&&typeof e=="function"&&e())},b=()=>v(2),C=()=>v(1),F=()=>{process.on("uncaughtExceptionMonitor",b),process.on("unhandledRejection",b),process.on("SIGINT",C),process.on("SIGTERM",C),process.on("exit",v),a&&a.addEventListener("abort",C)},E=()=>{process.removeListener("uncaughtExceptionMonitor",b),process.removeListener("unhandledRejection",b),process.removeListener("SIGINT",C),process.removeListener("SIGTERM",C),process.removeListener("exit",v),a&&a.removeEventListener("abort",C)},S=()=>{if(d===void 0)return;u&&r.write(`
63
+ `);let W=wr(d,g,{hard:!0,trim:!1}).split(`
64
+ `);W.length>1&&r.write(yr.cursor.up(W.length-1)),r.write(yr.cursor.to(0)),r.write(yr.erase.down())},k=W=>W.replace(/\.+$/,""),z=W=>{let it=(performance.now()-W)/1e3,T=Math.floor(it/60),J=Math.floor(it%60);return T>0?`[${T}m ${J}s]`:`[${J}s]`},N=(W="")=>{m=!0,c=Bo({output:r}),h=k(W),y=performance.now(),r.write(`${w.default.gray(I)}
65
+ `);let it=0,T=0;F(),p=setInterval(()=>{if(u&&h===d)return;S(),d=h;let J=D(n[it]),st;if(u)st=`${J} ${h}...`;else if(t==="timer")st=`${J} ${h} ${z(y)}`;else{let q=".".repeat(Math.floor(T)).slice(0,3);st=`${J} ${h}${q}`}let A=wr(st,g,{hard:!0,trim:!1});r.write(A),it=it+1<n.length?it+1:0,T=T<4?T+.125:0},o)},Z=(W="",it=0)=>{if(!m)return;m=!1,clearInterval(p),S();let T=it===0?w.default.green(Ci):it===1?w.default.red(Yo):w.default.red(Jo);h=W??h,t==="timer"?r.write(`${T} ${h} ${z(y)}
66
+ `):r.write(`${T} ${h}
67
+ `),E(),c()};return{start:N,stop:Z,message:(W="")=>{h=k(W??h)},get isCancelled(){return f}}},q0={light:K("\u2500","-"),heavy:K("\u2501","="),block:K("\u2588","#")},Et=t=>{let e=(r,i)=>{let s=r.label??String(r.value);switch(i){case"disabled":return`${w.default.gray(Dr)} ${w.default.gray(s)}${r.hint?` ${w.default.dim(`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${w.default.dim(s)}`;case"active":return`${w.default.green(bi)} ${s}${r.hint?` ${w.default.dim(`(${r.hint})`)}`:""}`;case"cancelled":return`${w.default.strikethrough(w.default.dim(s))}`;default:return`${w.default.dim(Dr)} ${w.default.dim(s)}`}};return new fi({options:t.options,signal:t.signal,input:t.input,output:t.output,initialValue:t.initialValue,render(){let r=`${w.default.gray(I)}
68
+ ${br(this.state)} ${t.message}
69
+ `;switch(this.state){case"submit":return`${r}${w.default.gray(I)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${w.default.gray(I)} ${e(this.options[this.cursor],"cancelled")}
70
+ ${w.default.gray(I)}`;default:{let i=`${w.default.cyan(I)} `;return`${r}${i}${vi({output:t.output,cursor:this.cursor,options:this.options,maxItems:t.maxItems,columnPadding:i.length,style:(s,n)=>e(s,s.disabled?"disabled":n?"active":"inactive")}).join(`
71
+ ${i}`)}
72
+ ${w.default.cyan(ce)}
73
+ `}}}}).prompt()},G0=`${w.default.gray(I)} `,Nt=t=>new di({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,output:t.output,signal:t.signal,input:t.input,render(){let e=`${w.default.gray(I)}
74
+ ${br(this.state)} ${t.message}
75
+ `,r=t.placeholder?w.default.inverse(t.placeholder[0])+w.default.dim(t.placeholder.slice(1)):w.default.inverse(w.default.hidden("_")),i=this.userInput?this.userInputWithCursor:r,s=this.value??"";switch(this.state){case"error":{let n=this.error?` ${w.default.yellow(this.error)}`:"";return`${e.trim()}
76
+ ${w.default.yellow(I)} ${i}
77
+ ${w.default.yellow(ce)}${n}
78
+ `}case"submit":{let n=s?` ${w.default.dim(s)}`:"";return`${e}${w.default.gray(I)}${n}`}case"cancel":{let n=s?` ${w.default.strikethrough(w.default.dim(s))}`:"";return`${e}${w.default.gray(I)}${n}${s.trim()?`
79
+ ${w.default.gray(I)}`:""}`}default:return`${e}${w.default.cyan(I)} ${i}
80
+ ${w.default.cyan(ce)}
81
+ `}}}).prompt()});function xi(t){ea=t}function ra(){return ea}function ia(t){return t.endsWith("/")?t.slice(0,-1):t}function uf(){return process.env.LOCALESY_APP_URL?ia(process.env.LOCALESY_APP_URL):"https://localesy.com"}function tt(){let t=uf();return t.endsWith("/app")?t:`${t}/app`}function fn(){return process.env.LOCALESY_API_URL?ia(process.env.LOCALESY_API_URL):`${tt()}/trpc`}var ea,_t=x(()=>{"use strict";ea="production"});var $,Y,At=x(()=>{"use strict";$=class extends Error{exitCode;constructor(e,r=1){super(e),this.name="CliError",this.exitCode=r}},Y=class extends ${constructor(e="Operation cancelled"){super(e,0),this.name="CancelledError"}}});var na={};Mt(na,{run:()=>hf});function hf(){let t="https://docs.localesy.com";Si(`${Le.default.magenta("Localesy CLI")} - ${Le.default.white(t)}`);let e=[];for(let r of cf){let i=r.aliases?.length?Le.default.white(` (${r.aliases.join(", ")})`):"";e.push(`${Le.default.cyan(r.name)}${i} ${r.description}`);for(let s of r.options)e.push(` ${Le.default.white(s)}`);r.options.length>0&&e.push("")}O(e.join(`
82
+ `),"Commands"),L(`Full guide: ${Le.default.cyan(t)}`)}var Le,cf,oa=x(()=>{"use strict";ct();Le=G(ot()),cf=[{name:"init",description:"Initialize Localesy configuration by scanning for translation files",options:["--path <path> Path to the root of your project","--env, -e Environment"]},{name:"sync",description:"Sync translation files between local and Localesy",options:["--push-only Only push local changes","--pull-only Only pull changes","--env, -e Environment"]},{name:"push",description:"Push local translations to Localesy (alias for sync --push-only)",options:["--force, -f Force push","--env, -e Environment"]},{name:"pull",description:"Pull translations from Localesy (alias for sync --pull-only)",options:["--env, -e Environment"]},{name:"translate",description:"Translate missing keys in your local translation files",options:["--local, -l Write translated files locally without pushing to Localesy","--env, -e Environment"]},{name:"new",description:"Create a new language, project, or organization",options:["--env, -e Environment"]},{name:"status",description:"Show translation stats for a project",options:["--env, -e Environment"]},{name:"config",description:"View or update local project configuration",options:["set <key> <value> Set a configuration value","path Show the config file path"]},{name:"login",description:"Authenticate with Localesy",options:["--env, -e Environment"],aliases:["auth"]},{name:"logout",description:"Clear saved authentication",options:["--env, -e Environment"]},{name:"open",description:"Open the project in your browser",options:["--env, -e Environment"]},{name:"help",description:"Show available commands and usage info",options:[]}]});var Fi=Q((Z0,la)=>{"use strict";var dn=[],aa=0,vt=(t,e)=>{aa>=e&&dn.push(t)};vt.WARN=1;vt.INFO=2;vt.DEBUG=3;vt.reset=()=>{dn=[]};vt.setDebugLevel=t=>{aa=t};vt.warn=t=>vt(t,vt.WARN);vt.info=t=>vt(t,vt.INFO);vt.debug=t=>vt(t,vt.DEBUG);vt.debugMessages=()=>dn;la.exports=vt});var ca=Q((X0,ua)=>{"use strict";ua.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var pa=Q((ty,ha)=>{"use strict";var pf=ca();ha.exports=t=>typeof t=="string"?t.replace(pf(),""):t});var da=Q((ey,mn)=>{"use strict";var fa=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);mn.exports=fa;mn.exports.default=fa});var ga=Q((ry,ma)=>{"use strict";ma.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var Da=Q((iy,gn)=>{"use strict";var ff=pa(),df=da(),mf=ga(),ya=t=>{if(typeof t!="string"||t.length===0||(t=ff(t),t.length===0))return 0;t=t.replace(mf()," ");let e=0;for(let r=0;r<t.length;r++){let i=t.codePointAt(r);i<=31||i>=127&&i<=159||i>=768&&i<=879||(i>65535&&r++,e+=df(i)?2:1)}return e};gn.exports=ya;gn.exports.default=ya});var yn=Q((sy,Ca)=>{"use strict";var wa=Da();function $i(t){return t?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function te(t){let e=$i();return(""+t).replace(e,"").split(`
83
+ `).reduce(function(s,n){return wa(n)>s?wa(n):s},0)}function vr(t,e){return Array(e+1).join(t)}function gf(t,e,r,i){let s=te(t);if(e+1>=s){let n=e-s;switch(i){case"right":{t=vr(r,n)+t;break}case"center":{let o=Math.ceil(n/2),a=n-o;t=vr(r,a)+t+vr(r,o);break}default:{t=t+vr(r,n);break}}}return t}var Je={};function Cr(t,e,r){e="\x1B["+e+"m",r="\x1B["+r+"m",Je[e]={set:t,to:!0},Je[r]={set:t,to:!1},Je[t]={on:e,off:r}}Cr("bold",1,22);Cr("italics",3,23);Cr("underline",4,24);Cr("inverse",7,27);Cr("strikethrough",9,29);function ba(t,e){let r=e[1]?parseInt(e[1].split(";")[0]):0;if(r>=30&&r<=39||r>=90&&r<=97){t.lastForegroundAdded=e[0];return}if(r>=40&&r<=49||r>=100&&r<=107){t.lastBackgroundAdded=e[0];return}if(r===0){for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&delete t[s];return}let i=Je[e[0]];i&&(t[i.set]=i.to)}function yf(t){let e=$i(!0),r=e.exec(t),i={};for(;r!==null;)ba(i,r),r=e.exec(t);return i}function va(t,e){let r=t.lastBackgroundAdded,i=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(s){t[s]&&(e+=Je[s].off)}),r&&r!="\x1B[49m"&&(e+="\x1B[49m"),i&&i!="\x1B[39m"&&(e+="\x1B[39m"),e}function Df(t,e){let r=t.lastBackgroundAdded,i=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(s){t[s]&&(e=Je[s].on+e)}),r&&r!="\x1B[49m"&&(e=r+e),i&&i!="\x1B[39m"&&(e=i+e),e}function wf(t,e){if(t.length===te(t))return t.substr(0,e);for(;te(t)>e;)t=t.slice(0,-1);return t}function bf(t,e){let r=$i(!0),i=t.split($i()),s=0,n=0,o="",a,l={};for(;n<e;){a=r.exec(t);let u=i[s];if(s++,n+te(u)>e&&(u=wf(u,e-n)),o+=u,n+=te(u),n<e){if(!a)break;o+=a[0],ba(l,a)}}return va(l,o)}function vf(t,e,r){if(r=r||"\u2026",te(t)<=e)return t;e-=te(r);let s=bf(t,e);s+=r;let n="\x1B]8;;\x07";return t.includes(n)&&!s.includes(n)&&(s+=n),s}function Cf(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function Ef(t,e){t=t||{},e=e||Cf();let r=Object.assign({},e,t);return r.chars=Object.assign({},e.chars,t.chars),r.style=Object.assign({},e.style,t.style),r}function Sf(t,e){let r=[],i=e.split(/(\s+)/g),s=[],n=0,o;for(let a=0;a<i.length;a+=2){let l=i[a],u=n+te(l);n>0&&o&&(u+=o.length),u>t?(n!==0&&r.push(s.join("")),s=[l],n=te(l)):(s.push(o||"",l),n=u),o=i[a+1]}return n&&r.push(s.join("")),r}function xf(t,e){let r=[],i="";function s(o,a){for(i.length&&a&&(i+=a),i+=o;i.length>t;)r.push(i.slice(0,t)),i=i.slice(t)}let n=e.split(/(\s+)/g);for(let o=0;o<n.length;o+=2)s(n[o],o&&n[o-1]);return i.length&&r.push(i),r}function Ff(t,e,r=!0){let i=[];e=e.split(`
84
+ `);let s=r?Sf:xf;for(let n=0;n<e.length;n++)i.push.apply(i,s(t,e[n]));return i}function $f(t){let e={},r=[];for(let i=0;i<t.length;i++){let s=Df(e,t[i]);e=yf(s);let n=Object.assign({},e);r.push(va(n,s))}return r}function Pf(t,e){return["\x1B]","8",";",";",t||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}Ca.exports={strlen:te,repeat:vr,pad:gf,truncate:vf,mergeOptions:Ef,wordWrap:Ff,colorizeLines:$f,hyperlink:Pf}});var Fa=Q((ny,xa)=>{"use strict";var Sa={};xa.exports=Sa;var Ea={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(Ea).forEach(function(t){var e=Ea[t],r=Sa[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var Pa=Q((oy,$a)=>{"use strict";$a.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),i=/^-{1,2}/.test(t)?"":"--",s=e.indexOf(i+t);return s!==-1&&(r===-1?!0:s<r)}});var Ta=Q((ay,Aa)=>{"use strict";var Af=require("os"),qt=Pa(),St=process.env,Qe=void 0;qt("no-color")||qt("no-colors")||qt("color=false")?Qe=!1:(qt("color")||qt("colors")||qt("color=true")||qt("color=always"))&&(Qe=!0);"FORCE_COLOR"in St&&(Qe=St.FORCE_COLOR.length===0||parseInt(St.FORCE_COLOR,10)!==0);function Tf(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Rf(t){if(Qe===!1)return 0;if(qt("color=16m")||qt("color=full")||qt("color=truecolor"))return 3;if(qt("color=256"))return 2;if(t&&!t.isTTY&&Qe!==!0)return 0;var e=Qe?1:0;if(process.platform==="win32"){var r=Af.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in St)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(s){return s in St})||St.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in St)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(St.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in St){var i=parseInt((St.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(St.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(St.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(St.TERM)||"COLORTERM"in St?1:(St.TERM==="dumb",e)}function Dn(t){var e=Rf(t);return Tf(e)}Aa.exports={supportsColor:Dn,stdout:Dn(process.stdout),stderr:Dn(process.stderr)}});var ka=Q((ly,Ra)=>{"use strict";Ra.exports=function(e,r){var i="";e=e||"Run the trap, drop the bass",e=e.split("");var s={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(n){n=n.toLowerCase();var o=s[n]||[" "],a=Math.floor(Math.random()*o.length);typeof s[n]<"u"?i+=s[n][a]:i+=n}),i}});var Oa=Q((uy,_a)=>{"use strict";_a.exports=function(e,r){e=e||" he is here ";var i={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},s=[].concat(i.up,i.down,i.mid);function n(l){var u=Math.floor(Math.random()*l);return u}function o(l){var u=!1;return s.filter(function(c){u=c===l}),u}function a(l,u){var c="",p,m;u=u||{},u.up=typeof u.up<"u"?u.up:!0,u.mid=typeof u.mid<"u"?u.mid:!0,u.down=typeof u.down<"u"?u.down:!0,u.size=typeof u.size<"u"?u.size:"maxi",l=l.split("");for(m in l)if(!o(m)){switch(c=c+l[m],p={up:0,down:0,mid:0},u.size){case"mini":p.up=n(8),p.mid=n(2),p.down=n(8);break;case"maxi":p.up=n(16)+3,p.mid=n(4)+1,p.down=n(64)+3;break;default:p.up=n(8)+1,p.mid=n(6)/2,p.down=n(8)+1;break}var f=["up","mid","down"];for(var h in f)for(var d=f[h],y=0;y<=p[d];y++)u[d]&&(c=c+i[d][n(i[d].length)])}return c}return a(e,r)}});var Ia=Q((cy,ja)=>{"use strict";ja.exports=function(t){return function(e,r,i){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var Ba=Q((hy,La)=>{"use strict";La.exports=function(t){return function(e,r,i){return r%2===0?e:t.inverse(e)}}});var Na=Q((py,Ma)=>{"use strict";Ma.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,i,s){return r===" "?r:t[e[i++%e.length]](r)}}});var za=Q((fy,Wa)=>{"use strict";Wa.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,i,s){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var Ha=Q((my,Ka)=>{"use strict";var B={};Ka.exports=B;B.themes={};var kf=require("util"),Be=B.styles=Fa(),Va=Object.defineProperties,_f=new RegExp(/[\r\n]+/g);B.supportsColor=Ta().supportsColor;typeof B.enabled>"u"&&(B.enabled=B.supportsColor()!==!1);B.enable=function(){B.enabled=!0};B.disable=function(){B.enabled=!1};B.stripColors=B.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var dy=B.stylize=function(e,r){if(!B.enabled)return e+"";var i=Be[r];return!i&&r in B?B[r](e):i.open+e+i.close},Of=/[|\\{}()[\]^$+*?.]/g,jf=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(Of,"\\$&")};function qa(t){var e=function r(){return Lf.apply(r,arguments)};return e._styles=t,e.__proto__=If,e}var Ga=(function(){var t={};return Be.grey=Be.gray,Object.keys(Be).forEach(function(e){Be[e].closeRe=new RegExp(jf(Be[e].close),"g"),t[e]={get:function(){return qa(this._styles.concat(e))}}}),t})(),If=Va(function(){},Ga);function Lf(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:kf.inspect(o)}).join(" ");if(!B.enabled||!e)return e;for(var r=e.indexOf(`
85
+ `)!=-1,i=this._styles,s=i.length;s--;){var n=Be[i[s]];e=n.open+e.replace(n.closeRe,n.open)+n.close,r&&(e=e.replace(_f,function(o){return n.close+o+n.open}))}return e}B.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){B[r]=function(i){if(typeof t[r]=="object"){var s=i;for(var n in t[r])s=B[t[r][n]](s);return s}return B[t[r]](i)}})(e)};function Bf(){var t={};return Object.keys(Ga).forEach(function(e){t[e]={get:function(){return qa([e])}}}),t}var Mf=function(e,r){var i=r.split("");return i=i.map(e),i.join("")};B.trap=ka();B.zalgo=Oa();B.maps={};B.maps.america=Ia()(B);B.maps.zebra=Ba()(B);B.maps.rainbow=Na()(B);B.maps.random=za()(B);for(Ua in B.maps)(function(t){B[t]=function(e){return Mf(B.maps[t],e)}})(Ua);var Ua;Va(B,Bf())});var Ja=Q((gy,Ya)=>{"use strict";var Nf=Ha();Ya.exports=Nf});var tl=Q((yy,Pi)=>{"use strict";var{info:Wf,debug:Xa}=Fi(),Ot=yn(),bn=class t{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","bigint","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let r=e.content;if(["boolean","number","bigint","string"].indexOf(typeof r)!==-1)this.content=String(r);else if(!r)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof r);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,r){this.cells=r;let i=this.options.chars||{},s=e.chars,n=this.chars={};Uf.forEach(function(l){wn(i,s,l,n)}),this.truncate=this.options.truncate||e.truncate;let o=this.options.style=this.options.style||{},a=e.style;wn(o,a,"padding-left",this),wn(o,a,"padding-right",this),this.head=o.head||a.head,this.border=o.border||a.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=Ot.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){let r=e.wordWrap||e.textWrap,{wordWrap:i=r}=this.options;if(this.fixedWidth&&i){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let o=1;for(;o<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+o],o++}let{wrapOnWordBoundary:s=!0}=e,{wrapOnWordBoundary:n=s}=this.options;return this.wrapLines(Ot.wordWrap(this.fixedWidth,this.content,n))}return this.wrapLines(this.content.split(`
86
+ `))}wrapLines(e){let r=Ot.colorizeLines(e);return this.href?r.map(i=>Ot.hyperlink(this.href,i)):r}init(e){let r=this.x,i=this.y;this.widths=e.colWidths.slice(r,r+this.colSpan),this.heights=e.rowHeights.slice(i,i+this.rowSpan),this.width=this.widths.reduce(Za,-1),this.height=this.heights.reduce(Za,-1),this.hAlign=this.options.hAlign||e.colAligns[r],this.vAlign=this.options.vAlign||e.rowAligns[i],this.drawRight=r+this.colSpan==e.colWidths.length}draw(e,r){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let i=Ot.truncate(this.content,10,this.truncate);e||Wf(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${i}`);let s=Math.max(this.height-this.lines.length,0),n;switch(this.vAlign){case"center":n=Math.ceil(s/2);break;case"bottom":n=s;break;default:n=0}if(e<n||e>=n+this.lines.length)return this.drawEmpty(this.drawRight,r);let o=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-n,this.drawRight,o,r)}drawTop(e){let r=[];return this.cells?this.widths.forEach(function(i,s){r.push(this._topLeftChar(s)),r.push(Ot.repeat(this.chars[this.y==0?"top":"mid"],i))},this):(r.push(this._topLeftChar(0)),r.push(Ot.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&r.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",r.join(""))}_topLeftChar(e){let r=this.x+e,i;if(this.y==0)i=r==0?"topLeft":e==0?"topMid":"top";else if(r==0)i="leftMid";else if(i=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][r]instanceof t.ColSpanCell&&(i=e==0?"topMid":"mid"),e==0)){let n=1;for(;this.cells[this.y][r-n]instanceof t.ColSpanCell;)n++;this.cells[this.y][r-n]instanceof t.RowSpanCell&&(i="leftMid")}return this.chars[i]}wrapWithStyleColors(e,r){if(this[e]&&this[e].length)try{let i=Ja();for(let s=this[e].length-1;s>=0;s--)i=i[this[e][s]];return i(r)}catch{return r}else return r}drawLine(e,r,i,s){let n=this.chars[this.x==0?"left":"middle"];if(this.x&&s&&this.cells){let m=this.cells[this.y+s][this.x-1];for(;m instanceof Er;)m=this.cells[m.y][m.x-1];m instanceof Sr||(n=this.chars.rightMid)}let o=Ot.repeat(" ",this.paddingLeft),a=r?this.chars.right:"",l=Ot.repeat(" ",this.paddingRight),u=this.lines[e],c=this.width-(this.paddingLeft+this.paddingRight);i&&(u+=this.truncate||"\u2026");let p=Ot.truncate(u,c,this.truncate);return p=Ot.pad(p,c," ",this.hAlign),p=o+p+l,this.stylizeLine(n,p,a)}stylizeLine(e,r,i){return e=this.wrapWithStyleColors("border",e),i=this.wrapWithStyleColors("border",i),this.y===0&&(r=this.wrapWithStyleColors("head",r)),e+r+i}drawBottom(e){let r=this.chars[this.x==0?"bottomLeft":"bottomMid"],i=Ot.repeat(this.chars.bottom,this.width),s=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",r+i+s)}drawEmpty(e,r){let i=this.chars[this.x==0?"left":"middle"];if(this.x&&r&&this.cells){let o=this.cells[this.y+r][this.x-1];for(;o instanceof Er;)o=this.cells[o.y][o.x-1];o instanceof Sr||(i=this.chars.rightMid)}let s=e?this.chars.right:"",n=Ot.repeat(" ",this.width);return this.stylizeLine(i,n,s)}},Er=class{constructor(){}draw(e){return typeof e=="number"&&Xa(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},Sr=class{constructor(e){this.originalCell=e}init(e){let r=this.y,i=this.originalCell.y;this.cellOffset=r-i,this.offset=zf(e.rowHeights,i,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(Xa(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}};function Qa(...t){return t.filter(e=>e!=null).shift()}function wn(t,e,r,i){let s=r.split("-");s.length>1?(s[1]=s[1].charAt(0).toUpperCase()+s[1].substr(1),s=s.join(""),i[s]=Qa(t[s],t[r],e[s],e[r])):i[r]=Qa(t[r],e[r])}function zf(t,e,r){let i=t[e];for(let s=1;s<r;s++)i+=1+t[e+s];return i}function Za(t,e){return t+e+1}var Uf=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];Pi.exports=bn;Pi.exports.ColSpanCell=Er;Pi.exports.RowSpanCell=Sr});var il=Q((Dy,rl)=>{"use strict";var{warn:Vf,debug:qf}=Fi(),vn=tl(),{ColSpanCell:Gf,RowSpanCell:Kf}=vn;(function(){function t(f,h){return f[h]>0?t(f,h+1):h}function e(f){let h={};f.forEach(function(d,y){let g=0;d.forEach(function(D){D.y=y,D.x=y?t(h,g):g;let v=D.rowSpan||1,b=D.colSpan||1;if(v>1)for(let C=0;C<b;C++)h[D.x+C]=v;g=D.x+b}),Object.keys(h).forEach(D=>{h[D]--,h[D]<1&&delete h[D]})})}function r(f){let h=0;return f.forEach(function(d){d.forEach(function(y){h=Math.max(h,y.x+(y.colSpan||1))})}),h}function i(f){return f.length}function s(f,h){let d=f.y,y=f.y-1+(f.rowSpan||1),g=h.y,D=h.y-1+(h.rowSpan||1),v=!(d>D||g>y),b=f.x,C=f.x-1+(f.colSpan||1),F=h.x,E=h.x-1+(h.colSpan||1),S=!(b>E||F>C);return v&&S}function n(f,h,d){let y=Math.min(f.length-1,d),g={x:h,y:d};for(let D=0;D<=y;D++){let v=f[D];for(let b=0;b<v.length;b++)if(s(g,v[b]))return!0}return!1}function o(f,h,d,y){for(let g=d;g<y;g++)if(n(f,g,h))return!1;return!0}function a(f){f.forEach(function(h,d){h.forEach(function(y){for(let g=1;g<y.rowSpan;g++){let D=new Kf(y);D.x=y.x,D.y=y.y+g,D.colSpan=y.colSpan,u(D,f[d+g])}})})}function l(f){for(let h=f.length-1;h>=0;h--){let d=f[h];for(let y=0;y<d.length;y++){let g=d[y];for(let D=1;D<g.colSpan;D++){let v=new Gf;v.x=g.x+D,v.y=g.y,d.splice(y+1,0,v)}}}}function u(f,h){let d=0;for(;d<h.length&&h[d].x<f.x;)d++;h.splice(d,0,f)}function c(f){let h=i(f),d=r(f);qf(`Max rows: ${h}; Max cols: ${d}`);for(let y=0;y<h;y++)for(let g=0;g<d;g++)if(!n(f,g,y)){let D={x:g,y,colSpan:1,rowSpan:1};for(g++;g<d&&!n(f,g,y);)D.colSpan++,g++;let v=y+1;for(;v<h&&o(f,v,D.x,D.x+D.colSpan);)D.rowSpan++,v++;let b=new vn(D);b.x=D.x,b.y=D.y,Vf(`Missing cell at ${b.y}-${b.x}.`),u(b,f[y])}}function p(f){return f.map(function(h){if(!Array.isArray(h)){let d=Object.keys(h)[0];h=h[d],Array.isArray(h)?(h=h.slice(),h.unshift(d)):h=[d,h]}return h.map(function(d){return new vn(d)})})}function m(f){let h=p(f);return e(h),c(h),a(h),l(h),h}rl.exports={makeTableLayout:m,layoutTable:e,addRowSpanCells:a,maxWidth:r,fillInTable:c,computeWidths:el("colSpan","desiredWidth","x",1),computeHeights:el("rowSpan","desiredHeight","y",1)}})();function el(t,e,r,i){return function(s,n){let o=[],a=[],l={};n.forEach(function(u){u.forEach(function(c){(c[t]||1)>1?a.push(c):o[c[r]]=Math.max(o[c[r]]||0,c[e]||0,i)})}),s.forEach(function(u,c){typeof u=="number"&&(o[c]=u)});for(let u=a.length-1;u>=0;u--){let c=a[u],p=c[t],m=c[r],f=o[m],h=typeof s[m]=="number"?0:1;if(typeof f=="number")for(let d=1;d<p;d++)f+=1+o[m+d],typeof s[m+d]!="number"&&h++;else f=e==="desiredWidth"?c.desiredWidth-1:1,(!l[m]||l[m]<f)&&(l[m]=f);if(c[e]>f){let d=0;for(;h>0&&c[e]>f;){if(typeof s[m+d]!="number"){let y=Math.round((c[e]-f)/h);f+=y,o[m+d]+=y,h--}d++}}}Object.assign(s,o,l);for(let u=0;u<s.length;u++)s[u]=Math.max(i,s[u]||0)}}});var nl=Q((wy,sl)=>{"use strict";var he=Fi(),Hf=yn(),Cn=il(),Ai=class extends Array{constructor(e){super();let r=Hf.mergeOptions(e);if(Object.defineProperty(this,"options",{value:r,enumerable:r.debug}),r.debug){switch(typeof r.debug){case"boolean":he.setDebugLevel(he.WARN);break;case"number":he.setDebugLevel(r.debug);break;case"string":he.setDebugLevel(parseInt(r.debug,10));break;default:he.setDebugLevel(he.WARN),he.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof r.debug}`)}Object.defineProperty(this,"messages",{get(){return he.debugMessages()}})}}toString(){let e=this,r=this.options.head&&this.options.head.length;r?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let i=Cn.makeTableLayout(e);i.forEach(function(n){n.forEach(function(o){o.mergeTableOptions(this.options,i)},this)},this),Cn.computeWidths(this.options.colWidths,i),Cn.computeHeights(this.options.rowHeights,i),i.forEach(function(n){n.forEach(function(o){o.init(this.options)},this)},this);let s=[];for(let n=0;n<i.length;n++){let o=i[n],a=this.options.rowHeights[n];(n===0||!this.options.style.compact||n==1&&r)&&En(o,"top",s);for(let l=0;l<a;l++)En(o,l,s);n+1==i.length&&En(o,"bottom",s)}return s.join(`
87
+ `)}get width(){return this.toString().split(`
88
+ `)[0].length}};Ai.reset=()=>he.reset();function En(t,e,r){let i=[];t.forEach(function(n){i.push(n.draw(e))});let s=i.join("");s.length&&r.push(s)}sl.exports=Ai});var Ti=Q((by,ol)=>{"use strict";ol.exports=nl()});function xr(){let t=process.env.HOME??process.env.USERPROFILE??"";return(0,al.join)(t,".localesy")}var al,Sn=x(()=>{"use strict";al=require("path")});function Jf(t){return t.replaceAll("/","-")}function ul(t){let e=(0,Me.resolve)(t??process.cwd()),r=Jf(e);return(0,Me.join)(xr(),"projects",r)}function xn(t){return(0,Me.join)(ul(t),"config.json")}function Fr(t){return(0,Me.join)((0,Me.resolve)(t??process.cwd()),Yf)}function cl(t){return(0,jt.existsSync)(Fr(t))}function Tt(t){let e=Fr(t);if((0,jt.existsSync)(e))try{let i=(0,jt.readFileSync)(e,"utf-8");return JSON.parse(i)}catch{}let r=xn(t);if(!(0,jt.existsSync)(r))return null;try{let i=(0,jt.readFileSync)(r,"utf-8");return JSON.parse(i)}catch{return null}}function pe(t,e){if(cl(e)){let i={$schema:ll,...t};(0,jt.writeFileSync)(Fr(e),JSON.stringify(i,null,2),"utf-8");return}let r=ul(e);(0,jt.mkdirSync)(r,{recursive:!0}),(0,jt.writeFileSync)(xn(e),JSON.stringify(t,null,2),"utf-8")}function hl(t,e){let r={$schema:ll,...t};(0,jt.writeFileSync)(Fr(e),JSON.stringify(r,null,2),"utf-8")}function Fn(t){return cl(t)?Fr(t):xn(t)}var jt,Me,Yf,ll,Ze=x(()=>{"use strict";jt=require("fs"),Me=require("path");Sn();Yf=".localesy.json",ll="https://localesy.com/schema/config.json"});function Qf(t){let r=new Date().getTime()-t.getTime(),i=Math.floor(r/1e3),s=Math.floor(i/60),n=Math.floor(s/60),o=Math.floor(n/24);return o>0?`${o}d ago`:n>0?`${n}h ago`:s>0?`${s}m ago`:"just now"}async function Pr(t,e){let r=await M();r.start("Fetching your organizations...");try{let s=(await t.users.getCurrent.query())?.organizations??[];if(r.stop("Organizations loaded!"),s.length===0)throw new $(`No organizations found. Please create an organization first at ${tt()}`);if(e?.cachedOrgId){let l=s.find(u=>u?.id===e.cachedOrgId);if(l)return R.info(`Using saved organization: ${$r.default.cyan(l.name??`#${l.id}`)}`),{organizationId:l.id,organization:l};R.warn(`Saved organization #${e.cachedOrgId} not found in your organizations, please select one:`)}let n=await Et({message:e?.message??"Select an organization:",options:s.map(l=>({value:l?.id??"",label:l?.name??`Organization ${l?.id}`}))});if(_(n))throw new Y;let o=n,a=s.find(l=>l?.id===o);return O(`Selected organization: ${$r.default.green(a?.name)}`),{organizationId:o,organization:a}}catch(i){throw r.stop("Failed to fetch organizations"),i instanceof $?i:new $(`Failed to fetch organizations: ${i}`)}}async function Zf(t,e,r){let i=await M();i.start("Fetching projects...");try{let s=await t.projects.listByOrganization.query({organizationId:e});if(i.stop("Projects loaded!"),s.length===0)throw new $("No projects found in this organization.");if(r?.cachedProjectId){let l=s.find(u=>u.id===r.cachedProjectId);if(l)return R.info(`Using saved project: ${$r.default.cyan(l.name??`#${l.id}`)}`),{projectId:l.id,project:l};R.warn(`Saved project #${r.cachedProjectId} not found in this organization, please select one:`)}let n=await Et({message:r?.message??"Select a project:",options:s.map(l=>{let u=l.updatedAt?new Date(l.updatedAt):null,c=u?Qf(u):"never";return{value:l.id,label:l.name,hint:`#${l.id} \xB7 updated ${c}`}})});if(_(n))throw new Y;let o=n,a=s.find(l=>l.id===o);return{projectId:o,project:a}}catch(s){throw i.stop("Failed to fetch projects"),s instanceof $?s:new $(`Failed to fetch projects: ${s}`)}}async function ee(t,e){let r=Tt(),{organizationId:i}=await Pr(t,{cachedOrgId:r?.organizationId}),{projectId:s}=await Zf(t,i,{cachedProjectId:r?.projectId}),n;if(e?.withRootPath)if(r?.rootPath)R.info(`Using saved root path: ${$r.default.cyan(r.rootPath)}`),n=r.rootPath;else{let o=await Nt({message:"Where are your local translation files?",initialValue:process.cwd()});if(_(o))throw new Y;n=o}return pe({...r,organizationId:i,projectId:s,...n?{rootPath:n}:{}}),{organizationId:i,projectId:s,...n?{rootPath:n}:{}}}var $r,Ne=x(()=>{"use strict";ct();$r=G(ot());_t();Ze();At()});var Xf,pl,td,fl,ed,rd,Gt,id,H,dl,sd,nd,re,dt,Ee=x(()=>{"use strict";Xf=Object.create,pl=Object.defineProperty,td=Object.getOwnPropertyDescriptor,fl=Object.getOwnPropertyNames,ed=Object.getPrototypeOf,rd=Object.prototype.hasOwnProperty,Gt=(t,e)=>function(){return e||(0,t[fl(t)[0]])((e={exports:{}}).exports,e),e.exports},id=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var s=fl(e),n=0,o=s.length,a;n<o;n++)a=s[n],!rd.call(t,a)&&a!==r&&pl(t,a,{get:(l=>e[l]).bind(null,a),enumerable:!(i=td(e,a))||i.enumerable});return t},H=(t,e,r)=>(r=t!=null?Xf(ed(t)):{},id(e||!t||!t.__esModule?pl(r,"default",{value:t,enumerable:!0}):r,t)),dl=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(i){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},e.exports.__esModule=!0,e.exports.default=e.exports,r(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),sd=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=dl().default;function i(s,n){if(r(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var a=o.call(s,n||"default");if(r(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(s)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),nd=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=dl().default,i=sd();function s(n){var o=i(n,"string");return r(o)=="symbol"?o:o+""}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),re=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=nd();function i(s,n,o){return(n=r(n))in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o,s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),dt=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=re();function i(n,o){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);o&&(l=l.filter(function(u){return Object.getOwnPropertyDescriptor(n,u).enumerable})),a.push.apply(a,l)}return a}function s(n){for(var o=1;o<arguments.length;o++){var a=arguments[o]!=null?arguments[o]:{};o%2?i(Object(a),!0).forEach(function(l){r(n,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(a,l))})}return n}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}})});function ie(t){let e={subscribe(r){let i=null,s=!1,n=!1,o=!1;function a(){if(i===null){o=!0;return}n||(n=!0,typeof i=="function"?i():i&&i.unsubscribe())}return i=t({next(l){var u;s||(u=r.next)===null||u===void 0||u.call(r,l)},error(l){var u;s||(s=!0,(u=r.error)===null||u===void 0||u.call(r,l),a())},complete(){var l;s||(s=!0,(l=r.complete)===null||l===void 0||l.call(r),a())}}),o&&a(),{unsubscribe:a}},pipe(...r){return r.reduce(od,e)}};return e}function od(t,e){return e(t)}function $n(t){let e=new AbortController;return new Promise((i,s)=>{let n=!1;function o(){n||(n=!0,a.unsubscribe())}e.signal.addEventListener("abort",()=>{s(e.signal.reason)});let a=t.subscribe({next(l){n=!0,i(l),o()},error(l){s(l)},complete(){e.abort(),o()}})})}var Pn=x(()=>{"use strict"});function An(t){return e=>{let r=0,i=null,s=[];function n(){i||(i=e.subscribe({next(a){for(let u of s){var l;(l=u.next)===null||l===void 0||l.call(u,a)}},error(a){for(let u of s){var l;(l=u.error)===null||l===void 0||l.call(u,a)}},complete(){for(let l of s){var a;(a=l.complete)===null||a===void 0||a.call(l)}}}))}function o(){if(r===0&&i){let a=i;i=null,a.unsubscribe()}}return ie(a=>(r++,s.push(a),n(),{unsubscribe(){r--,o();let l=s.findIndex(u=>u===a);l>-1&&s.splice(l,1)}}))}}function Ri(t){let e=t,r=[],i=o=>{e!==void 0&&o.next(e),r.push(o)},s=o=>{r.splice(r.indexOf(o),1)},n=ie(o=>(i(o),()=>{s(o)}));return n.next=o=>{if(e!==o){e=o;for(let a of r)a.next(o)}},n.get=()=>e,n}var ml=x(()=>{"use strict";Pn()});var Ar=x(()=>{"use strict";Pn();ml()});function gl(t){return ie(e=>{function r(s=0,n=t.op){let o=t.links[s];if(!o)throw new Error("No more links to execute - did you forget to add an ending link?");return o({op:n,next(l){return r(s+1,l)}})}return r().subscribe(e)})}var yl=x(()=>{"use strict";Ar()});function fe(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}function ki(){return Object.create(null)}var Xe,Dl,_i=x(()=>{"use strict";Xe={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099},Dl=[Xe.BAD_GATEWAY,Xe.SERVICE_UNAVAILABLE,Xe.GATEWAY_TIMEOUT,Xe.INTERNAL_SERVER_ERROR]});function El(t,e,r){var i;let s=e.join(".");return(i=r[s])!==null&&i!==void 0||(r[s]=new Proxy(Cl,{get(n,o){if(!(typeof o!="string"||o==="then"))return El(t,[...e,o],r)},apply(n,o,a){let l=e[e.length-1],u={args:a,path:e};return l==="call"?u={args:a.length>=2?[a[1]]:[],path:e.slice(0,-1)}:l==="apply"&&(u={args:a.length>=2?a[1]:[],path:e.slice(0,-1)}),wl(u.args),wl(u.path),t(u)}})),r[s]}var ld,bl,ud,vl,cd,hd,Tr,pd,Rr,Cl,wl,Oi,Tn,Sl,fd,dd,Rn,ji,qy,kn=x(()=>{"use strict";_i();ld=Object.create,bl=Object.defineProperty,ud=Object.getOwnPropertyDescriptor,vl=Object.getOwnPropertyNames,cd=Object.getPrototypeOf,hd=Object.prototype.hasOwnProperty,Tr=(t,e)=>function(){return e||(0,t[vl(t)[0]])((e={exports:{}}).exports,e),e.exports},pd=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var s=vl(e),n=0,o=s.length,a;n<o;n++)a=s[n],!hd.call(t,a)&&a!==r&&bl(t,a,{get:(l=>e[l]).bind(null,a),enumerable:!(i=ud(e,a))||i.enumerable});return t},Rr=(t,e,r)=>(r=t!=null?ld(cd(t)):{},pd(e||!t||!t.__esModule?bl(r,"default",{value:t,enumerable:!0}):r,t)),Cl=()=>{},wl=t=>{Object.freeze&&Object.freeze(t)};Oi=t=>El(t,[],ki()),Tn=t=>new Proxy(Cl,{get(e,r){if(r!=="then")return t(r)}}),Sl=Tr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function r(i){"@babel/helpers - typeof";return e.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},e.exports.__esModule=!0,e.exports.default=e.exports,r(i)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),fd=Tr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var r=Sl().default;function i(s,n){if(r(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var a=o.call(s,n||"default");if(r(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(s)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),dd=Tr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var r=Sl().default,i=fd();function s(n){var o=i(n,"string");return r(o)=="symbol"?o:o+""}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),Rn=Tr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var r=dd();function i(s,n,o){return(n=r(n))in s?Object.defineProperty(s,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):s[n]=o,s}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),ji=Tr({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var r=Rn();function i(n,o){var a=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);o&&(l=l.filter(function(u){return Object.getOwnPropertyDescriptor(n,u).enumerable})),a.push.apply(a,l)}return a}function s(n){for(var o=1;o<arguments.length;o++){var a=arguments[o]!=null?arguments[o]:{};o%2?i(Object(a),!0).forEach(function(l){r(n,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(a,l))})}return n}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),qy=Rr(ji(),1)});function yd(t,e){if("error"in t){let i=e.deserialize(t.error);return{ok:!1,error:(0,Ii.default)((0,Ii.default)({},t),{},{error:i})}}return{ok:!0,result:(0,Ii.default)((0,Ii.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}function On(t,e){let r;try{r=yd(t,e)}catch{throw new _n}if(!r.ok&&(!fe(r.error.error)||typeof r.error.error.code!="number"))throw new _n;if(r.ok&&!fe(r.result))throw new _n;return r}var Yy,Ii,_n,Jy,xl=x(()=>{"use strict";kn();_i();Yy=Rr(Rn(),1),Ii=Rr(ji(),1);_n=class extends Error{constructor(){super("Unable to transform response from server")}};Jy=Rr(ji(),1)});var Li=x(()=>{"use strict";kn();_i();xl()});function Fl(t){return t instanceof Se}function vd(t){return fe(t)&&fe(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function Cd(t,e){return typeof t=="string"?t:fe(t)&&typeof t.message=="string"?t.message:e}var Bi,tr,Se,kr=x(()=>{"use strict";Ee();Li();Bi=H(re(),1),tr=H(dt(),1);Se=class Mi extends Error{constructor(e,r){var i,s;let n=r?.cause;super(e,{cause:n}),(0,Bi.default)(this,"cause",void 0),(0,Bi.default)(this,"shape",void 0),(0,Bi.default)(this,"data",void 0),(0,Bi.default)(this,"meta",void 0),this.meta=r?.meta,this.cause=n,this.shape=r==null||(i=r.result)===null||i===void 0?void 0:i.error,this.data=r==null||(s=r.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Mi.prototype)}static from(e,r={}){let i=e;return Fl(i)?(r.meta&&(i.meta=(0,tr.default)((0,tr.default)({},i.meta),r.meta)),i):vd(i)?new Mi(i.error.message,(0,tr.default)((0,tr.default)({},r),{},{result:i})):new Mi(Cd(i,"Unknown error"),(0,tr.default)((0,tr.default)({},r),{},{cause:i}))}}});function Ni(t){let e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:r=>r,deserialize:r=>r},output:{serialize:r=>r,deserialize:r=>r}}}var Wi=x(()=>{"use strict"});function Pl(t){if(t)return t;if(typeof window<"u"&&$l(window.fetch))return window.fetch;if(typeof globalThis<"u"&&$l(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function zi(t){return{url:t.url.toString(),fetch:t.fetch,transformer:Ni(t.transformer),methodOverride:t.methodOverride}}function Ed(t){let e={};for(let r=0;r<t.length;r++){let i=t[r];e[r]=i}return e}function Al(t){return"input"in t?t.transformer.input.serialize(t.input):Ed(t.inputs.map(e=>t.transformer.input.serialize(e)))}async function Rl(t){var e;Fd(t.signal);let r=t.getUrl(t),i=t.getBody(t),s=(e=t.methodOverride)!==null&&e!==void 0?e:Sd[t.type],n=await(async()=>{let a=await t.headers();return Symbol.iterator in a?Object.fromEntries(a):a})(),o=(0,_r.default)((0,_r.default)((0,_r.default)({},t.contentTypeHeader&&s!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),n);return Pl(t.fetch)(r,{method:s,signal:t.signal,body:i,headers:o})}async function Ui(t){let e={},r=await Rl(t);e.response=r;let i=await r.json();return e.responseJSON=i,{json:i,meta:e}}var $l,_r,Sd,er,Tl,jn,xd,Fd,Vi=x(()=>{"use strict";Ee();Wi();$l=t=>typeof t=="function";_r=H(dt(),1);Sd={query:"GET",mutation:"POST",subscription:"PATCH"};er=t=>{let e=t.url.split("?"),i=e[0].replace(/\/$/,"")+"/"+t.path,s=[];if(e[1]&&s.push(e[1]),"inputs"in t&&s.push("batch=1"),t.type==="query"||t.type==="subscription"){let n=Al(t);n!==void 0&&t.methodOverride!=="POST"&&s.push(`input=${encodeURIComponent(JSON.stringify(n))}`)}return s.length&&(i+="?"+s.join("&")),i},Tl=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;let e=Al(t);return e!==void 0?JSON.stringify(e):void 0},jn=t=>Ui((0,_r.default)((0,_r.default)({},t),{},{contentTypeHeader:"application/json",getUrl:er,getBody:Tl})),xd=class extends Error{constructor(){let t="AbortError";super(t),this.name=t,this.message=t}},Fd=t=>{var e;if(t?.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new xd}});function kl(t){return t instanceof Uint8Array||t instanceof Blob}function _l(t){return t instanceof FormData}function qi(t){let e=zi(t);return()=>r=>{let{op:i}=r;return ie(s=>{let{path:n,input:o,type:a}=i;if(a==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");let l=$d((0,rr.default)((0,rr.default)({},e),{},{type:a,path:n,input:o,signal:i.signal,headers(){return t.headers?typeof t.headers=="function"?t.headers({op:i}):t.headers:{}}})),u;return l.then(c=>{u=c.meta;let p=On(c.json,e.transformer.output);if(!p.ok){s.error(Se.from(p.error,{meta:u}));return}s.next({context:c.meta,result:p.result}),s.complete()}).catch(c=>{s.error(Se.from(c,{meta:u}))}),()=>{}})}}var rr,$d,Ol=x(()=>{"use strict";Ee();kr();Vi();Ar();Li();rr=H(dt(),1),$d=t=>{if("input"in t){let{input:e}=t;if(_l(e)){if(t.type!=="mutation"&&t.methodOverride!=="POST")throw new Error("FormData is only supported for mutations");return Ui((0,rr.default)((0,rr.default)({},t),{},{contentTypeHeader:void 0,getUrl:er,getBody:()=>e}))}if(kl(e)){if(t.type!=="mutation"&&t.methodOverride!=="POST")throw new Error("Octet type input is only supported for mutations");return Ui((0,rr.default)((0,rr.default)({},t),{},{contentTypeHeader:"application/octet-stream",getUrl:er,getBody:()=>e}))}}return jn(t)}});var KD,jl=x(()=>{"use strict";Ee();kr();Vi();KD=H(dt(),1)});var JD,Il=x(()=>{"use strict";Ee();JD=H(dt(),1)});function Pd(){let t,e;return{promise:new Promise((i,s)=>{t=i,e=s}),resolve:t,reject:e}}async function Ad(t){let e=await Ln(t.url);if(!t.connectionParams)return e;let i=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+i}async function Td(t){let e={method:"connectionParams",data:await Ln(t)};return JSON.stringify(e)}function Rd(t){let{promise:e,resolve:r,reject:i}=Pd();return t.addEventListener("open",()=>{t.removeEventListener("error",i),r()}),t.addEventListener("error",i),e}function kd(t,{intervalMs:e,pongTimeoutMs:r}){let i,s;function n(){i=setTimeout(()=>{t.send("PING"),s=setTimeout(()=>{t.close()},r)},e)}function o(){clearTimeout(i),n()}function a(){clearTimeout(s),o()}t.addEventListener("open",n),t.addEventListener("message",({data:l})=>{clearTimeout(i),n(),l==="PONG"&&a()}),t.addEventListener("close",()=>{clearTimeout(i),clearTimeout(s)})}var Ln,rw,iw,We,_d,sw,nw,Ll=x(()=>{"use strict";Ee();kr();Wi();Ar();Ln=(t,...e)=>typeof t=="function"?t(...e):t,rw=H(re(),1);iw=H(re(),1),We=H(re(),1);_d=class In{constructor(e){var r;if((0,We.default)(this,"id",++In.connectCount),(0,We.default)(this,"WebSocketPonyfill",void 0),(0,We.default)(this,"urlOptions",void 0),(0,We.default)(this,"keepAliveOpts",void 0),(0,We.default)(this,"wsObservable",Ri(null)),(0,We.default)(this,"openPromise",null),this.WebSocketPonyfill=(r=e.WebSocketPonyfill)!==null&&r!==void 0?r:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++In.connectCount;let r=Ad(e.urlOptions).then(i=>new e.WebSocketPonyfill(i));e.openPromise=r.then(async i=>{e.ws=i,i.addEventListener("message",function({data:s}){s==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&kd(i,e.keepAliveOpts),i.addEventListener("close",()=>{e.ws===i&&(e.ws=null)}),await Rd(i),e.urlOptions.connectionParams&&i.send(await Td(e.urlOptions.connectionParams))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var r;(r=e.ws)===null||r===void 0||r.close()}}};(0,We.default)(_d,"connectCount",0);sw=H(re(),1),nw=H(dt(),1)});function Bd(t){let e=Oi(({path:r,args:i})=>{let s=[...r],n=Ld(s.pop()),o=s.join(".");return t[n](o,...i)});return Tn(r=>r===jd?t:e[r])}function Mn(t){let e=new Od(t);return Bd(e)}var Bn,Bl,Od,jd,Id,Ld,_w,Ow,Md,jw,Iw,Nd,Ml,Wd,zd,Lw,Bw,Mw,Nw,Nl=x(()=>{"use strict";Ee();yl();kr();Vi();Ol();jl();Wi();Il();Ll();Ar();Li();Bn=H(re(),1),Bl=H(dt(),1),Od=class{constructor(t){(0,Bn.default)(this,"links",void 0),(0,Bn.default)(this,"runtime",void 0),(0,Bn.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return gl({links:this.links,op:(0,Bl.default)((0,Bl.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(An())}async requestAsPromise(t){var e=this;try{let r=e.$request(t);return(await $n(r)).result.data}catch(r){throw Se.from(r)}}query(t,e,r){return this.requestAsPromise({type:"query",path:t,input:e,context:r?.context,signal:r?.signal})}mutation(t,e,r){return this.requestAsPromise({type:"mutation",path:t,input:e,context:r?.context,signal:r?.signal})}subscription(t,e,r){return this.$request({type:"subscription",path:t,input:e,context:r.context,signal:r.signal}).subscribe({next(s){switch(s.result.type){case"state":{var n;(n=r.onConnectionStateChange)===null||n===void 0||n.call(r,s.result);break}case"started":{var o;(o=r.onStarted)===null||o===void 0||o.call(r,{context:s.context});break}case"stopped":{var a;(a=r.onStopped)===null||a===void 0||a.call(r);break}case"data":case void 0:{var l;(l=r.onData)===null||l===void 0||l.call(r,s.result.data);break}}},error(s){var n;(n=r.onError)===null||n===void 0||n.call(r,s)},complete(){var s;(s=r.onComplete)===null||s===void 0||s.call(r)}})}},jd=Symbol.for("trpc_untypedClient"),Id={query:"query",mutate:"mutation",subscribe:"subscription"},Ld=t=>Id[t];_w=H(dt(),1),Ow=H(dt(),1),Md=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function r(s){var n,o,a,l=2;for(typeof Symbol<"u"&&(o=Symbol.asyncIterator,a=Symbol.iterator);l--;){if(o&&(n=s[o])!=null)return n.call(s);if(a&&(n=s[a])!=null)return new i(n.call(s));o="@@asyncIterator",a="@@iterator"}throw new TypeError("Object is not async iterable")}function i(s){function n(o){if(Object(o)!==o)return Promise.reject(new TypeError(o+" is not an object."));var a=o.done;return Promise.resolve(o.value).then(function(l){return{value:l,done:a}})}return i=function(a){this.s=a,this.n=a.next},i.prototype={s:null,n:null,next:function(){return n(this.n.apply(this.s,arguments))},return:function(a){var l=this.s.return;return l===void 0?Promise.resolve({value:a,done:!0}):n(l.apply(this.s,arguments))},throw:function(a){var l=this.s.return;return l===void 0?Promise.reject(a):n(l.apply(this.s,arguments))}},new i(s)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),jw=H(Md(),1),Iw=H(dt(),1),Nd=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function r(){var i=typeof SuppressedError=="function"?SuppressedError:function(a,l){var u=Error();return u.name="SuppressedError",u.error=a,u.suppressed=l,u},s={},n=[];function o(a,l){if(l!=null){if(Object(l)!==l)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(a)var u=l[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(u===void 0&&(u=l[Symbol.dispose||Symbol.for("Symbol.dispose")],a))var c=u;if(typeof u!="function")throw new TypeError("Object is not disposable.");c&&(u=function(){try{c.call(l)}catch(m){return Promise.reject(m)}}),n.push({v:l,d:u,a})}else a&&n.push({d:l,a});return l}return{e:s,u:o.bind(null,!1),a:o.bind(null,!0),d:function(){var l,u=this.e,c=0;function p(){for(;l=n.pop();)try{if(!l.a&&c===1)return c=0,n.push(l),Promise.resolve().then(p);if(l.d){var f=l.d.call(l.v);if(l.a)return c|=2,Promise.resolve(f).then(p,m)}else c|=1}catch(h){return m(h)}if(c===1)return u!==s?Promise.reject(u):Promise.resolve();if(u!==s)throw u}function m(f){return u=u!==s?new i(f,u):f,p()}return p()}}}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ml=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function r(i,s){this.v=i,this.k=s}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Wd=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var r=Ml();function i(s){return new r(s,0)}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),zd=Gt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var r=Ml();function i(n){return function(){return new s(n.apply(this,arguments))}}function s(n){var o,a;function l(c,p){try{var m=n[c](p),f=m.value,h=f instanceof r;Promise.resolve(h?f.v:f).then(function(d){if(h){var y=c==="return"?"return":"next";if(!f.k||d.done)return l(y,d);d=n[y](d).value}u(m.done?"return":"normal",d)},function(d){l("throw",d)})}catch(d){u("throw",d)}}function u(c,p){switch(c){case"return":o.resolve({value:p,done:!0});break;case"throw":o.reject(p);break;default:o.resolve({value:p,done:!1})}(o=o.next)?l(o.key,o.arg):a=null}this._invoke=function(c,p){return new Promise(function(m,f){var h={key:c,arg:p,resolve:m,reject:f,next:null};a?a=a.next=h:(o=a=h,l(c,p))})},typeof n.return!="function"&&(this.return=void 0)}s.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},s.prototype.next=function(n){return this._invoke("next",n)},s.prototype.throw=function(n){return this._invoke("throw",n)},s.prototype.return=function(n){return this._invoke("return",n)},e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),Lw=H(Nd(),1),Bw=H(Wd(),1),Mw=H(zd(),1),Nw=H(dt(),1)});var Gi,Wl=x(()=>{"use strict";Gi=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,r){this.keyToValue.set(e,r),this.valueToKey.set(r,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}});var ir,Nn=x(()=>{"use strict";Wl();ir=class{constructor(e){this.generateIdentifier=e,this.kv=new Gi}register(e,r){this.kv.getByValue(e)||(r||(r=this.generateIdentifier(e)),this.kv.set(r,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}}});var Ki,zl=x(()=>{"use strict";Nn();Ki=class extends ir{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,r){typeof r=="object"?(r.allowProps&&this.classToAllowedProps.set(e,r.allowProps),super.register(e,r.identifier)):super.register(e,r)}getAllowedProps(e){return this.classToAllowedProps.get(e)}}});function Ud(t){if("values"in Object)return Object.values(t);let e=[];for(let r in t)t.hasOwnProperty(r)&&e.push(t[r]);return e}function Ul(t,e){let r=Ud(t);if("find"in r)return r.find(e);let i=r;for(let s=0;s<i.length;s++){let n=i[s];if(e(n))return n}}function ze(t,e){Object.entries(t).forEach(([r,i])=>e(i,r))}function sr(t,e){return t.indexOf(e)!==-1}function Wn(t,e){for(let r=0;r<t.length;r++){let i=t[r];if(e(i))return i}}var Or=x(()=>{"use strict"});var Hi,Vl=x(()=>{"use strict";Or();Hi=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Ul(this.transfomers,r=>r.isApplicable(e))}findByName(e){return this.transfomers[e]}}});var Vd,zn,qd,Ue,Yi,Kt,Gd,Kd,Hd,ql,xe,Fe,Un,Gl,Ji,Vn,Kl,Hl,Yl,Jl,Ql,Qi=x(()=>{"use strict";Vd=t=>Object.prototype.toString.call(t).slice(8,-1),zn=t=>typeof t>"u",qd=t=>t===null,Ue=t=>typeof t!="object"||t===null||t===Object.prototype?!1:Object.getPrototypeOf(t)===null?!0:Object.getPrototypeOf(t)===Object.prototype,Yi=t=>Ue(t)&&Object.keys(t).length===0,Kt=t=>Array.isArray(t),Gd=t=>typeof t=="string",Kd=t=>typeof t=="number"&&!isNaN(t),Hd=t=>typeof t=="boolean",ql=t=>t instanceof RegExp,xe=t=>t instanceof Map,Fe=t=>t instanceof Set,Un=t=>Vd(t)==="Symbol",Gl=t=>t instanceof Date&&!isNaN(t.valueOf()),Ji=t=>t instanceof Error,Vn=t=>typeof t=="number"&&isNaN(t),Kl=t=>Hd(t)||qd(t)||zn(t)||Kd(t)||Gd(t)||Un(t),Hl=t=>typeof t=="bigint",Yl=t=>t===1/0||t===-1/0,Jl=t=>ArrayBuffer.isView(t)&&!(t instanceof DataView),Ql=t=>t instanceof URL});var Zi,Xi,nr,qn=x(()=>{"use strict";Zi=t=>t.replace(/\\/g,"\\\\").replace(/\./g,"\\."),Xi=t=>t.map(String).map(Zi).join("."),nr=(t,e)=>{let r=[],i="";for(let n=0;n<t.length;n++){let o=t.charAt(n);if(!e&&o==="\\"){let u=t.charAt(n+1);if(u==="\\"){i+="\\",n++;continue}else if(u!==".")throw Error("invalid path")}if(o==="\\"&&t.charAt(n+1)==="."){i+=".",n++;continue}if(o==="."){r.push(i),i="";continue}i+=o}let s=i;return r.push(s),r}});function se(t,e,r,i){return{isApplicable:t,annotation:e,transform:r,untransform:i}}function ts(t,e,r,i){return{isApplicable:t,annotation:e,transform:r,untransform:i}}function Gn(t,e){return t?.constructor?!!e.classRegistry.getIdentifier(t.constructor):!1}var Zl,Xl,Yd,tu,eu,ru,Jd,Kn,iu,su,nu=x(()=>{"use strict";Qi();Or();Zl=[se(zn,"undefined",()=>null,()=>{}),se(Hl,"bigint",t=>t.toString(),t=>typeof BigInt<"u"?BigInt(t):(console.error("Please add a BigInt polyfill."),t)),se(Gl,"Date",t=>t.toISOString(),t=>new Date(t)),se(Ji,"Error",(t,e)=>{let r={name:t.name,message:t.message};return"cause"in t&&(r.cause=t.cause),e.allowedErrorProps.forEach(i=>{r[i]=t[i]}),r},(t,e)=>{let r=new Error(t.message,{cause:t.cause});return r.name=t.name,r.stack=t.stack,e.allowedErrorProps.forEach(i=>{r[i]=t[i]}),r}),se(ql,"regexp",t=>""+t,t=>{let e=t.slice(1,t.lastIndexOf("/")),r=t.slice(t.lastIndexOf("/")+1);return new RegExp(e,r)}),se(Fe,"set",t=>[...t.values()],t=>new Set(t)),se(xe,"map",t=>[...t.entries()],t=>new Map(t)),se(t=>Vn(t)||Yl(t),"number",t=>Vn(t)?"NaN":t>0?"Infinity":"-Infinity",Number),se(t=>t===0&&1/t===-1/0,"number",()=>"-0",Number),se(Ql,"URL",t=>t.toString(),t=>new URL(t))];Xl=ts((t,e)=>Un(t)?!!e.symbolRegistry.getIdentifier(t):!1,(t,e)=>["symbol",e.symbolRegistry.getIdentifier(t)],t=>t.description,(t,e,r)=>{let i=r.symbolRegistry.getValue(e[1]);if(!i)throw new Error("Trying to deserialize unknown symbol");return i}),Yd=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((t,e)=>(t[e.name]=e,t),{}),tu=ts(Jl,t=>["typed-array",t.constructor.name],t=>[...t],(t,e)=>{let r=Yd[e[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(t)});eu=ts(Gn,(t,e)=>["class",e.classRegistry.getIdentifier(t.constructor)],(t,e)=>{let r=e.classRegistry.getAllowedProps(t.constructor);if(!r)return{...t};let i={};return r.forEach(s=>{i[s]=t[s]}),i},(t,e,r)=>{let i=r.classRegistry.getValue(e[1]);if(!i)throw new Error(`Trying to deserialize unknown class '${e[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(i.prototype),t)}),ru=ts((t,e)=>!!e.customTransformerRegistry.findApplicable(t),(t,e)=>["custom",e.customTransformerRegistry.findApplicable(t).name],(t,e)=>e.customTransformerRegistry.findApplicable(t).serialize(t),(t,e,r)=>{let i=r.customTransformerRegistry.findByName(e[1]);if(!i)throw new Error("Trying to deserialize unknown custom value");return i.deserialize(t)}),Jd=[eu,Xl,ru,tu],Kn=(t,e)=>{let r=Wn(Jd,s=>s.isApplicable(t,e));if(r)return{value:r.transform(t,e),type:r.annotation(t,e)};let i=Wn(Zl,s=>s.isApplicable(t,e));if(i)return{value:i.transform(t,e),type:i.annotation}},iu={};Zl.forEach(t=>{iu[t.annotation]=t});su=(t,e,r)=>{if(Kt(e))switch(e[0]){case"symbol":return Xl.untransform(t,e,r);case"class":return eu.untransform(t,e,r);case"custom":return ru.untransform(t,e,r);case"typed-array":return tu.untransform(t,e,r);default:throw new Error("Unknown transformation: "+e)}else{let i=iu[e];if(!i)throw new Error("Unknown transformation: "+e);return i.untransform(t,r)}}});function ou(t){if(sr(t,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(sr(t,"prototype"))throw new Error("prototype is not allowed as a property");if(sr(t,"constructor"))throw new Error("constructor is not allowed as a property")}var or,au,es,lu=x(()=>{"use strict";Qi();Or();or=(t,e)=>{if(e>t.size)throw new Error("index out of bounds");let r=t.keys();for(;e>0;)r.next(),e--;return r.next().value};au=(t,e)=>{ou(e);for(let r=0;r<e.length;r++){let i=e[r];if(Fe(t))t=or(t,+i);else if(xe(t)){let s=+i,n=+e[++r]==0?"key":"value",o=or(t,s);switch(n){case"key":t=o;break;case"value":t=t.get(o);break}}else t=t[i]}return t},es=(t,e,r)=>{if(ou(e),e.length===0)return r(t);let i=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(Kt(i)){let a=+o;i=i[a]}else if(Ue(i))i=i[o];else if(Fe(i)){let a=+o;i=or(i,a)}else if(xe(i)){if(n===e.length-2)break;let l=+o,u=+e[++n]==0?"key":"value",c=or(i,l);switch(u){case"key":i=c;break;case"value":i=i.get(c);break}}}let s=e[e.length-1];if(Kt(i)?i[+s]=r(i[+s]):Ue(i)&&(i[s]=r(i[s])),Fe(i)){let n=or(i,+s),o=r(n);n!==o&&(i.delete(n),i.add(o))}if(xe(i)){let n=+e[e.length-2],o=or(i,n);switch(+s==0?"key":"value"){case"key":{let l=r(o);i.set(l,i.get(o)),l!==o&&i.delete(o);break}case"value":{i.set(o,r(i.get(o)));break}}}return t}});function Hn(t,e,r,i=[]){if(!t)return;let s=uu(r);if(!Kt(t)){ze(t,(a,l)=>Hn(a,e,r,[...i,...nr(l,s)]));return}let[n,o]=t;o&&ze(o,(a,l)=>{Hn(a,e,r,[...i,...nr(l,s)])}),e(n,i)}function cu(t,e,r,i){return Hn(e,(s,n)=>{t=es(t,n,o=>su(o,s,i))},r),t}function hu(t,e,r){let i=uu(r);function s(n,o){let a=au(t,nr(o,i));n.map(l=>nr(l,i)).forEach(l=>{t=es(t,l,()=>a)})}if(Kt(e)){let[n,o]=e;n.forEach(a=>{t=es(t,nr(a,i),()=>t)}),o&&ze(o,s)}else ze(e,s);return t}function Zd(t,e,r){let i=r.get(t);i?i.push(e):r.set(t,[e])}function pu(t,e){let r={},i;return t.forEach(s=>{if(s.length<=1)return;e||(s=s.map(a=>a.map(String)).sort((a,l)=>a.length-l.length));let[n,...o]=s;n.length===0?i=o.map(Xi):r[Xi(n)]=o.map(Xi)}),i?Yi(r)?[i]:[i,r]:Yi(r)?void 0:r}var uu,Qd,Yn,fu=x(()=>{"use strict";Qi();qn();nu();Or();qn();lu();uu=t=>t<1;Qd=(t,e)=>Ue(t)||Kt(t)||xe(t)||Fe(t)||Ji(t)||Gn(t,e);Yn=(t,e,r,i,s=[],n=[],o=new Map)=>{let a=Kl(t);if(!a){Zd(t,s,e);let f=o.get(t);if(f)return i?{transformedValue:null}:f}if(!Qd(t,r)){let f=Kn(t,r),h=f?{transformedValue:f.value,annotations:[f.type]}:{transformedValue:t};return a||o.set(t,h),h}if(sr(n,t))return{transformedValue:null};let l=Kn(t,r),u=l?.value??t,c=Kt(u)?[]:{},p={};ze(u,(f,h)=>{if(h==="__proto__"||h==="constructor"||h==="prototype")throw new Error(`Detected property ${h}. This is a prototype pollution risk, please remove it from your object.`);let d=Yn(f,e,r,i,[...s,h],[...n,t],o);c[h]=d.transformedValue,Kt(d.annotations)?p[Zi(h)]=d.annotations:Ue(d.annotations)&&ze(d.annotations,(y,g)=>{p[Zi(h)+"."+g]=y})});let m=Yi(p)?{transformedValue:c,annotations:l?[l.type]:void 0}:{transformedValue:c,annotations:l?[l.type,p]:p};return a||o.set(t,m),m}});function rs(t){return Object.prototype.toString.call(t).slice(8,-1)}var Jn=x(()=>{"use strict"});function is(t){return rs(t)==="Array"}var du=x(()=>{"use strict";Jn()});function Qn(t){if(rs(t)!=="Object")return!1;let e=Object.getPrototypeOf(t);return!!e&&e.constructor===Object&&e===Object.prototype}var mu=x(()=>{"use strict";Jn()});var gu=x(()=>{"use strict";du();mu()});function Xd(t,e,r,i,s){let n={}.propertyIsEnumerable.call(i,e)?"enumerable":"nonenumerable";n==="enumerable"&&(t[e]=r),s&&n==="nonenumerable"&&Object.defineProperty(t,e,{value:r,enumerable:!1,writable:!0,configurable:!0})}function ss(t,e={}){if(is(t))return t.map(s=>ss(s,e));if(!Qn(t))return t;let r=Object.getOwnPropertyNames(t),i=Object.getOwnPropertySymbols(t);return[...r,...i].reduce((s,n)=>{if(n==="__proto__"||is(e.props)&&!e.props.includes(n))return s;let o=t[n],a=ss(o,e);return Xd(s,n,a,t,e.nonenumerable),s},{})}var yu=x(()=>{"use strict";gu()});var j,$b,Pb,Ab,Tb,Rb,kb,_b,Ob,Du=x(()=>{"use strict";zl();Nn();Vl();fu();yu();j=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Ki,this.symbolRegistry=new ir(r=>r.description??""),this.customTransformerRegistry=new Hi,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let r=new Map,i=Yn(e,r,this,this.dedupe),s={json:i.transformedValue};i.annotations&&(s.meta={...s.meta,values:i.annotations});let n=pu(r,this.dedupe);return n&&(s.meta={...s.meta,referentialEqualities:n}),s.meta&&(s.meta.v=1),s}deserialize(e,r){let{json:i,meta:s}=e,n=r?.inPlace?i:ss(i);return s?.values&&(n=cu(n,s.values,s.v??0,this)),s?.referentialEqualities&&(n=hu(n,s.referentialEqualities,s.v??0)),n}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,r){this.classRegistry.register(e,r)}registerSymbol(e,r){this.symbolRegistry.register(e,r)}registerCustom(e,r){this.customTransformerRegistry.register({name:r,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};j.defaultInstance=new j;j.serialize=j.defaultInstance.serialize.bind(j.defaultInstance);j.deserialize=j.defaultInstance.deserialize.bind(j.defaultInstance);j.stringify=j.defaultInstance.stringify.bind(j.defaultInstance);j.parse=j.defaultInstance.parse.bind(j.defaultInstance);j.registerClass=j.defaultInstance.registerClass.bind(j.defaultInstance);j.registerSymbol=j.defaultInstance.registerSymbol.bind(j.defaultInstance);j.registerCustom=j.defaultInstance.registerCustom.bind(j.defaultInstance);j.allowErrorProps=j.defaultInstance.allowErrorProps.bind(j.defaultInstance);$b=j.serialize,Pb=j.deserialize,Ab=j.stringify,Tb=j.parse,Rb=j.registerClass,kb=j.registerCustom,_b=j.registerSymbol,Ob=j.allowErrorProps});function Zn(){return(0,ns.randomBytes)(32).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function wu(){return Zn()}function bu(t){return(0,ns.createHash)("sha256").update(t).digest("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function vu(t,e){let r=new URLSearchParams({code_challenge:e.codeChallenge,redirect_uri:e.redirectUri});return e.provider&&r.set("provider",e.provider),e.state&&r.set("state",e.state),`${t.appUrl}/auth/cli/start?${r.toString()}`}function Cu(t){let e=t?.access_token,r=t?.refresh_token,i=t?.expires_at;if(typeof e!="string"||typeof r!="string")throw new $("Token response was malformed (missing tokens).");let s=(()=>{if(typeof i=="number")return i;let n=t?.expires_in;return typeof n=="number"?Math.floor(Date.now()/1e3)+n:Math.floor(Date.now()/1e3)+3600})();return{access_token:e,refresh_token:r,expires_at:s}}async function Eu(t,e,r){let i=await fetch(`${t.appUrl}/auth/cli/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,code_verifier:r})});if(!i.ok){let s=await i.text().catch(()=>"");throw new $(`PKCE exchange failed (${i.status}): ${s||"no response body"}`)}return Cu(await i.json())}async function Su(t,e){let r=await fetch(`${t.appUrl}/auth/cli/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})});if(!r.ok){let i=await r.text().catch(()=>"");throw new $(`Token refresh failed (${r.status}): ${i||"no response body"}`)}return Cu(await r.json())}var ns,Xn=x(()=>{"use strict";ns=require("crypto");At()});function os(){let t=ra(),e=t==="production"?"auth.json":`auth.${t}.json`;return(0,xu.join)(xr(),e)}function tm(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.access_token=="string"&&typeof e.refresh_token=="string"&&typeof e.expires_at=="number"}function $e(){let t=os();if(!(0,xt.existsSync)(t))return null;try{let e=(0,xt.readFileSync)(t,"utf-8").trim();if(!e)return null;let r=JSON.parse(e);return tm(r)?r:null}catch{return null}}function as(t){let e=xr();(0,xt.mkdirSync)(e,{recursive:!0,mode:448});let r=os(),i=`${r}.tmp`;(0,xt.writeFileSync)(i,JSON.stringify(t),{encoding:"utf-8",mode:384}),(0,xt.renameSync)(i,r),(0,xt.chmodSync)(r,384)}function de(){let t=os();(0,xt.existsSync)(t)&&(0,xt.unlinkSync)(t)}function ls(){return os()}var xt,xu,jr=x(()=>{"use strict";xt=require("fs"),xu=require("path");_t();Sn()});function em(){return{appUrl:tt()}}function $u(t){return us||(us=Su(em(),t.refresh_token).then(e=>(as(e),e)).catch(e=>{throw de(),e}).finally(()=>{us=null})),us}async function rm(t){let e=$e();if(!e)return t;let r=Math.floor(Date.now()/1e3);return e.expires_at>r+60?e.access_token:(await $u(e)).access_token}async function im(){let t=$e();if(!t?.refresh_token)return null;try{return(await $u(t)).access_token}catch{return null}}function sm(t,e){if(t===401)return new $("Session expired. Run `localesy login` to re-authenticate.");if(t===403)return new $("Access denied. You may not have permission for this operation.");if(t===429)return new $("Rate limited. Please wait a moment and try again.");if(t>=500)return new $("Localesy server error. Please try again later.");let r=(()=>{if(typeof e=="object"&&e!==null){let i=e;if(typeof i?.message=="string")return i.message;let s=i?.error;if(typeof s?.message=="string")return s.message}return`Request failed with status ${t}`})();return new $(r)}function Fu(t,e){let i={...(()=>{let s=t?.headers;return s?s instanceof Headers?Object.fromEntries(s.entries()):Array.isArray(s)?Object.fromEntries(s):{...s}:{}})()};return e&&(i.Authorization=`Bearer ${e}`),{...t??{},headers:i}}function Ir(t){return Mn({links:[qi({url:fn(),headers:()=>({"Content-Type":"application/json"}),fetch:(async(e,r)=>{let i=await rm(t),s=await to(e,Fu(r,i));if(s.status===401&&$e()){let n=await im();n&&(s=await to(e,Fu(r,n)))}return Au(s)}),transformer:j})]})}function Pu(){return Mn({links:[qi({url:fn(),headers:()=>({"Content-Type":"application/json"}),fetch:(async(t,e)=>{let r=await to(t,e??{});return Au(r)}),transformer:j})]})}async function to(t,e){try{return await globalThis.fetch(t,e)}catch(r){if(r instanceof DOMException&&r.name==="AbortError")throw r;let i=r instanceof TypeError?"Could not connect to Localesy. Check your internet connection.":`Network error: ${r instanceof Error?r.message:String(r)}`;throw new $(i)}}async function Au(t){let e=await t.text(),r;try{r=JSON.parse(e)}catch{if(!t.ok)throw sm(t.status,null);return new Response(e,{status:t.status,headers:t.headers})}return new Response(JSON.stringify(r),{status:t.status,headers:t.headers})}var us,cs=x(()=>{"use strict";Nl();Du();_t();At();Xn();jr();us=null});function hs(t){if(process.env.LOCALESY_NO_BROWSER||process.env.CI)return;let e=process.platform,r=e==="darwin"?"open":e==="win32"?"start":"xdg-open",i=e==="win32"?["",t]:[t];try{let s=(0,Tu.spawn)(r,i,{detached:!0,stdio:"ignore",shell:e==="win32"});s.on("error",()=>{}),s.unref()}catch{}}var Tu,eo=x(()=>{"use strict";Tu=require("child_process")});function nm(t,e){return`\x1B]8;;${e}\x1B\\${t}\x1B]8;;\x1B\\`}async function om(t){let e,r,i,s,n=new Promise((a,l)=>{e=a,r=l});i=(0,Ru.createServer)((a,l)=>{if(!a.url||!a.method){l.writeHead(400),l.end("Bad request");return}let u=new URL(a.url,"http://localhost");if(a.method!=="GET"||u.pathname!=="/callback"){l.writeHead(404),l.end("Not found");return}let c=u.searchParams.get("code"),p=u.searchParams.get("error_description")??u.searchParams.get("error");if(p){let f=new URL(`${tt()}/cli-success`);f.searchParams.set("status","error"),f.searchParams.set("message",p),l.writeHead(302,{Location:f.toString()}),l.end(),clearTimeout(s),r(new Error(p)),i.close();return}if(!c){l.writeHead(400),l.end("Missing code parameter");return}if(u.searchParams.get("state")!==t){l.writeHead(400),l.end("Invalid state parameter"),clearTimeout(s),r(new Error("State mismatch (possible CSRF). Please run `localesy login` again.")),i.close();return}clearTimeout(s),e(c),l.writeHead(302,{Location:`${tt()}/cli-success`}),l.end(),i.close()});let o=await new Promise(a=>{i.listen(0,"127.0.0.1",()=>{let l=i.address(),u=typeof l=="object"?l?.port:0;a(`http://127.0.0.1:${u}/callback`)})});return s=setTimeout(()=>{i.close(),r(new Error("Authentication timeout"))},600*1e3),{redirectUrl:o,codePromise:n}}async function am(){let t={appUrl:tt()},e=Zn(),r=bu(e),i=wu(),s,n;try{let m=await om(i);s=m.redirectUrl,n=m.codePromise}catch(m){throw new $(`Failed to start local auth server: ${m}`)}let o=vu(t,{codeChallenge:r,redirectUri:s,provider:"github",state:i}),a=`${t.appUrl}/auth/cli/start`,l=nm(ku.default.cyan(a),o);O(`Opening this URL in your browser:
89
+
90
+ ${l}
91
+
92
+ If it doesn't open automatically, click the link above.`,"Authentication"),hs(o);let u=await M();u.start("Waiting for browser sign-in...");let c;try{c=await n}catch(m){throw u.stop("Authentication failed"),new $(`Authentication failed: ${m instanceof Error?m.message:m}`)}let p;try{p=await Eu(t,c,e)}catch(m){throw u.stop("Authentication failed"),m instanceof $?m:new $(`Authentication failed: ${m instanceof Error?m.message:m}`)}return u.stop("Authentication successful!"),as(p),p}async function mt(){let t=$e();if(t){let s=Ir(t.access_token);try{return await s.users.getCurrent.query(),{authToken:t.access_token,client:s}}catch{O("Your session has expired. Please log in again.","Session Expired"),de()}}O(`You need to authenticate to continue.
93
+
94
+ This will open a browser window.`,"Authentication Required");let e=await pt({message:"Ready to authenticate?",initialValue:!0});if(!e||_(e))throw new Y;let r=await am(),i=Ir(r.access_token);return{authToken:r.access_token,client:i}}var Ru,ku,me=x(()=>{"use strict";Ru=require("http");ct();ku=G(ot());_t();At();eo();cs();Xn();jr()});async function _u(t){try{let{stdout:e}=await lm("git",t);return{stdout:e,exitCode:0}}catch(e){let r=e;return{stdout:r.stdout??"",exitCode:r.code??1}}}async function Iu(){let t=await _u(["symbolic-ref","refs/remotes/origin/HEAD"]);if(t.exitCode===0)return t.stdout.trim().replace("refs/remotes/origin/","");let e=await _u(["remote","show","origin"]);if(e.exitCode===0){let r=e.stdout.match(/HEAD branch:\s*(.+)/);if(r?.[1])return r[1].trim()}return null}var Ou,ju,lm,Lu=x(()=>{"use strict";Ou=require("child_process"),ju=require("util"),lm=(0,ju.promisify)(Ou.execFile)});function ro(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function vm(t){return t.replace(mm,ac).replace(gm,lc).replace(ym,ho).replace(Dm,uc).replace(wm,cc)}function Cm(t){return t.replace(cm,"\\").replace(hm,"{").replace(pm,"}").replace(fm,",").replace(dm,".")}function hc(t){if(!t)return[""];let e=[],r=oc("{","}",t);if(!r)return t.split(",");let{pre:i,body:s,post:n}=r,o=i.split(",");o[o.length-1]+="{"+s+"}";let a=hc(n);return n.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Em(t,e={}){if(!t)return[];let{max:r=bm}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),Ur(vm(t),r,!0).map(Cm)}function Sm(t){return"{"+t+"}"}function xm(t){return/^-?0\d/.test(t)}function Fm(t,e){return t<=e}function $m(t,e){return t>=e}function Ur(t,e,r){let i=[],s=oc("{","}",t);if(!s)return[t];let n=s.pre,o=s.post.length?Ur(s.post,e,!1):[""];if(/\$$/.test(s.pre))for(let a=0;a<o.length&&a<e;a++){let l=n+"{"+s.body+"}"+o[a];i.push(l)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),u=a||l,c=s.body.indexOf(",")>=0;if(!u&&!c)return s.post.match(/,(?!,).*\}/)?(t=s.pre+"{"+s.body+ho+s.post,Ur(t,e,!0)):[t];let p;if(u)p=s.body.split(/\.\./);else if(p=hc(s.body),p.length===1&&p[0]!==void 0&&(p=Ur(p[0],e,!1).map(Sm),p.length===1))return o.map(f=>s.pre+p[0]+f);let m;if(u&&p[0]!==void 0&&p[1]!==void 0){let f=ro(p[0]),h=ro(p[1]),d=Math.max(p[0].length,p[1].length),y=p.length===3&&p[2]!==void 0?Math.abs(ro(p[2])):1,g=Fm;h<f&&(y*=-1,g=$m);let D=p.some(xm);m=[];for(let v=f;g(v,h);v+=y){let b;if(l)b=String.fromCharCode(v),b==="\\"&&(b="");else if(b=String(v),D){let C=d-b.length;if(C>0){let F=new Array(C+1).join("0");v<0?b="-"+F+b.slice(1):b=F+b}}m.push(b)}}else{m=[];for(let f=0;f<p.length;f++)m.push.apply(m,Ur(p[f],e,!1))}for(let f=0;f<m.length;f++)for(let h=0;h<o.length&&i.length<e;h++){let d=n+m[f]+o[h];(!r||u||d)&&i.push(d)}}return i}function Ps(t,e={}){return new Ge(t,e).streamSync()}function qc(t,e={}){return new Ge(t,e).stream()}function Gc(t,e={}){return new Ge(t,e).walkSync()}async function nc(t,e={}){return new Ge(t,e).walk()}function As(t,e={}){return new Ge(t,e).iterateSync()}function Kc(t,e={}){return new Ge(t,e).iterate()}var Dc,cr,Ec,ae,dg,Re,$s,fo,Sc,oc,Bu,um,ac,lc,ho,uc,cc,cm,hm,pm,fm,dm,mm,gm,ym,Dm,wm,bm,Cs,Pm,Lr,Am,Mu,Tm,ur,Rm,Nu,km,ps,_m,Om,jm,Im,po,Wu,zu,pc,fc,Pt,Lm,Bm,Mm,Nm,Wm,zm,Um,Vm,qm,Gm,Km,Hm,Ym,Jm,Qm,Zm,Xm,tg,dc,mc,gc,Uu,eg,$t,rg,ig,sg,ng,og,Wt,ag,yc,lg,ug,Vu,cg,Te,hg,wc,co,bc,Es,qu,pg,Ae,vc,bs,fg,Fs,Gu,mg,gg,yg,ge,ye,Pe,fs,Br,ds,Ku,ms,Hu,Ht,ar,gt,Mr,lr,yt,Ft,Dt,io,gs,Ct,rt,so,no,Yu,oo,ne,ao,ys,Nr,Ve,It,Wr,Dg,wg,bg,vg,xc,Cg,Eg,Sg,Ss,xg,qr,Fc,$c,Fg,$g,Ut,Pc,Ac,oe,Tc,Rc,qe,kc,zt,zr,lo,Ju,Gr,Yt,Ds,vs,Qu,Pg,uo,Zu,Kr,Xu,ws,tc,Ag,_c,Rt,Oc,Ic,Bc,mo,go,Mc,i1,Tg,Rg,kg,_g,Nc,Og,ec,jg,Ig,Lg,rc,Bg,Vc,ic,sc,Mg,Ge,Ng,Wg,zg,Ug,Vg,qg,xs,Hc=x(()=>{"use strict";Dc=require("url"),cr=require("path"),Ec=require("url"),ae=require("fs"),dg=G(require("fs"),1),Re=require("fs/promises"),$s=require("events"),fo=G(require("stream"),1),Sc=require("string_decoder"),oc=(t,e,r)=>{let i=t instanceof RegExp?Bu(t,r):t,s=e instanceof RegExp?Bu(e,r):e,n=i!==null&&s!=null&&um(i,s,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+i.length,n[1]),post:r.slice(n[1]+s.length)}},Bu=(t,e)=>{let r=e.match(t);return r?r[0]:null},um=(t,e,r)=>{let i,s,n,o,a,l=r.indexOf(t),u=r.indexOf(e,l+1),c=l;if(l>=0&&u>0){if(t===e)return[l,u];for(i=[],n=r.length;c>=0&&!a;){if(c===l)i.push(c),l=r.indexOf(t,c+1);else if(i.length===1){let p=i.pop();p!==void 0&&(a=[p,u])}else s=i.pop(),s!==void 0&&s<n&&(n=s,o=u),u=r.indexOf(e,c+1);c=l<u&&l>=0?l:u}i.length&&o!==void 0&&(a=[n,o])}return a},ac="\0SLASH"+Math.random()+"\0",lc="\0OPEN"+Math.random()+"\0",ho="\0CLOSE"+Math.random()+"\0",uc="\0COMMA"+Math.random()+"\0",cc="\0PERIOD"+Math.random()+"\0",cm=new RegExp(ac,"g"),hm=new RegExp(lc,"g"),pm=new RegExp(ho,"g"),fm=new RegExp(uc,"g"),dm=new RegExp(cc,"g"),mm=/\\\\/g,gm=/\\{/g,ym=/\\}/g,Dm=/\\,/g,wm=/\\./g,bm=1e5;Cs=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")},Pm={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Lr=t=>t.replace(/[[\]\\-]/g,"\\$&"),Am=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Mu=t=>t.join(""),Tm=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let i=[],s=[],n=r+1,o=!1,a=!1,l=!1,u=!1,c=r,p="";t:for(;n<t.length;){let h=t.charAt(n);if((h==="!"||h==="^")&&n===r+1){u=!0,n++;continue}if(h==="]"&&o&&!l){c=n+1;break}if(o=!0,h==="\\"&&!l){l=!0,n++;continue}if(h==="["&&!l){for(let[d,[y,g,D]]of Object.entries(Pm))if(t.startsWith(d,n)){if(p)return["$.",!1,t.length-r,!0];n+=d.length,D?s.push(y):i.push(y),a=a||g;continue t}}if(l=!1,p){h>p?i.push(Lr(p)+"-"+Lr(h)):h===p&&i.push(Lr(h)),p="",n++;continue}if(t.startsWith("-]",n+1)){i.push(Lr(h+"-")),n+=2;continue}if(t.startsWith("-",n+1)){p=h,n+=2;continue}i.push(Lr(h)),n++}if(c<n)return["",!1,0,!1];if(!i.length&&!s.length)return["$.",!1,t.length-r,!0];if(s.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!u){let h=i[0].length===2?i[0].slice(-1):i[0];return[Am(h),!1,c-r,!1]}let m="["+(u?"^":"")+Mu(i)+"]",f="["+(u?"":"^")+Mu(s)+"]";return[i.length&&s.length?"("+m+"|"+f+")":i.length?m:f,a,c-r,!0]},ur=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),Rm=new Set(["!","?","+","*","@"]),Nu=t=>Rm.has(t),km="(?!(?:^|/)\\.\\.?(?:$|/))",ps="(?!\\.)",_m=new Set(["[","."]),Om=new Set(["..","."]),jm=new Set("().*{}+?[]^$\\!"),Im=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),po="[^/]",Wu=po+"*?",zu=po+"+?",pc=class Lt{type;#t;#e;#n=!1;#i=[];#o;#y;#D;#c=!1;#a;#p;#h=!1;constructor(e,r,i={}){this.type=e,e&&(this.#e=!0),this.#o=r,this.#t=this.#o?this.#o.#t:this,this.#a=this.#t===this?i:this.#t.#a,this.#D=this.#t===this?[]:this.#t.#D,e==="!"&&!this.#t.#c&&this.#D.push(this),this.#y=this.#o?this.#o.#i.length:0}get hasMagic(){if(this.#e!==void 0)return this.#e;for(let e of this.#i)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#e=!0;return this.#e}toString(){return this.#p!==void 0?this.#p:this.type?this.#p=this.type+"("+this.#i.map(e=>String(e)).join("|")+")":this.#p=this.#i.map(e=>String(e)).join("")}#l(){if(this!==this.#t)throw new Error("should only call on root");if(this.#c)return this;this.toString(),this.#c=!0;let e;for(;e=this.#D.pop();){if(e.type!=="!")continue;let r=e,i=r.#o;for(;i;){for(let s=r.#y+1;!i.type&&s<i.#i.length;s++)for(let n of e.#i){if(typeof n=="string")throw new Error("string part in extglob AST??");n.copyIn(i.#i[s])}r=i,i=r.#o}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof Lt&&r.#o===this))throw new Error("invalid part: "+r);this.#i.push(r)}}toJSON(){let e=this.type===null?this.#i.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#i.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#c&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#y===0)return!0;let e=this.#o;for(let r=0;r<this.#y;r++){let i=e.#i[r];if(!(i instanceof Lt&&i.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#i.length:0;return this.#y===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new Lt(this.type,e);for(let i of this.#i)r.copyIn(i);return r}static#s(e,r,i,s){let n=!1,o=!1,a=-1,l=!1;if(r.type===null){let f=i,h="";for(;f<e.length;){let d=e.charAt(f++);if(n||d==="\\"){n=!n,h+=d;continue}if(o){f===a+1?(d==="^"||d==="!")&&(l=!0):d==="]"&&!(f===a+2&&l)&&(o=!1),h+=d;continue}else if(d==="["){o=!0,a=f,l=!1,h+=d;continue}if(!s.noext&&Nu(d)&&e.charAt(f)==="("){r.push(h),h="";let y=new Lt(d,r);f=Lt.#s(e,y,f,s),r.push(y);continue}h+=d}return r.push(h),f}let u=i+1,c=new Lt(null,r),p=[],m="";for(;u<e.length;){let f=e.charAt(u++);if(n||f==="\\"){n=!n,m+=f;continue}if(o){u===a+1?(f==="^"||f==="!")&&(l=!0):f==="]"&&!(u===a+2&&l)&&(o=!1),m+=f;continue}else if(f==="["){o=!0,a=u,l=!1,m+=f;continue}if(Nu(f)&&e.charAt(u)==="("){c.push(m),m="";let h=new Lt(f,c);c.push(h),u=Lt.#s(e,h,u,s);continue}if(f==="|"){c.push(m),m="",p.push(c),c=new Lt(null,r);continue}if(f===")")return m===""&&r.#i.length===0&&(r.#h=!0),c.push(m),m="",r.push(...p,c),u;m+=f}return r.type=null,r.#e=void 0,r.#i=[e.substring(i-1)],u}static fromGlob(e,r={}){let i=new Lt(null,void 0,r);return Lt.#s(e,i,0,r),i}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let e=this.toString(),[r,i,s,n]=this.toRegExpSource();if(!(s||this.#e||this.#a.nocase&&!this.#a.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return i;let o=(this.#a.nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${r}$`,o),{_src:r,_glob:e})}get options(){return this.#a}toRegExpSource(e){let r=e??!!this.#a.dot;if(this.#t===this&&this.#l(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#i.some(m=>typeof m!="string"),u=this.#i.map(m=>{let[f,h,d,y]=typeof m=="string"?Lt.#v(m,this.#e,l):m.toRegExpSource(e);return this.#e=this.#e||d,this.#n=this.#n||y,f}).join(""),c="";if(this.isStart()&&typeof this.#i[0]=="string"&&!(this.#i.length===1&&Om.has(this.#i[0]))){let m=_m,f=r&&m.has(u.charAt(0))||u.startsWith("\\.")&&m.has(u.charAt(2))||u.startsWith("\\.\\.")&&m.has(u.charAt(4)),h=!r&&!e&&m.has(u.charAt(0));c=f?km:h?ps:""}let p="";return this.isEnd()&&this.#t.#c&&this.#o?.type==="!"&&(p="(?:$|\\/)"),[c+u+p,ur(u),this.#e=!!this.#e,this.#n]}let i=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",n=this.#f(r);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let l=this.toString();return this.#i=[l],this.type=null,this.#e=void 0,[l,ur(this.toString()),!1,!1]}let o=!i||e||r||!ps?"":this.#f(!0);o===n&&(o=""),o&&(n=`(?:${n})(?:${o})*?`);let a="";if(this.type==="!"&&this.#h)a=(this.isStart()&&!r?ps:"")+zu;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!e?ps:"")+Wu+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=s+n+l}return[a,ur(n),this.#e=!!this.#e,this.#n]}#f(e){return this.#i.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[i,s,n,o]=r.toRegExpSource(e);return this.#n=this.#n||o,i}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#v(e,r,i=!1){let s=!1,n="",o=!1,a=!1;for(let l=0;l<e.length;l++){let u=e.charAt(l);if(s){s=!1,n+=(jm.has(u)?"\\":"")+u;continue}if(u==="*"){if(a)continue;a=!0,n+=i&&/^[*]+$/.test(e)?zu:Wu,r=!0;continue}else a=!1;if(u==="\\"){l===e.length-1?n+="\\\\":s=!0;continue}if(u==="["){let[c,p,m,f]=Tm(e,l);if(m){n+=c,o=o||p,l+=m-1,r=r||f;continue}}if(u==="?"){n+=po,r=!0;continue}n+=Im(u)}return[n,ur(e),!!r,o]}},fc=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&"),Pt=(t,e,r={})=>(Cs(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Te(e,r).match(t)),Lm=/^\*+([^+@!?\*\[\(]*)$/,Bm=t=>e=>!e.startsWith(".")&&e.endsWith(t),Mm=t=>e=>e.endsWith(t),Nm=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Wm=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),zm=/^\*+\.\*+$/,Um=t=>!t.startsWith(".")&&t.includes("."),Vm=t=>t!=="."&&t!==".."&&t.includes("."),qm=/^\.\*+$/,Gm=t=>t!=="."&&t!==".."&&t.startsWith("."),Km=/^\*+$/,Hm=t=>t.length!==0&&!t.startsWith("."),Ym=t=>t.length!==0&&t!=="."&&t!=="..",Jm=/^\?+([^+@!?\*\[\(]*)?$/,Qm=([t,e=""])=>{let r=dc([t]);return e?(e=e.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(e)):r},Zm=([t,e=""])=>{let r=mc([t]);return e?(e=e.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(e)):r},Xm=([t,e=""])=>{let r=mc([t]);return e?i=>r(i)&&i.endsWith(e):r},tg=([t,e=""])=>{let r=dc([t]);return e?i=>r(i)&&i.endsWith(e):r},dc=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},mc=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},gc=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Uu={win32:{sep:"\\"},posix:{sep:"/"}},eg=gc==="win32"?Uu.win32.sep:Uu.posix.sep;Pt.sep=eg;$t=Symbol("globstar **");Pt.GLOBSTAR=$t;rg="[^/]",ig=rg+"*?",sg="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ng="(?:(?!(?:\\/|^)\\.).)*?",og=(t,e={})=>r=>Pt(r,t,e);Pt.filter=og;Wt=(t,e={})=>Object.assign({},t,e),ag=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Pt;let e=Pt;return Object.assign((r,i,s={})=>e(r,i,Wt(t,s)),{Minimatch:class extends e.Minimatch{constructor(r,i={}){super(r,Wt(t,i))}static defaults(r){return e.defaults(Wt(t,r)).Minimatch}},AST:class extends e.AST{constructor(r,i,s={}){super(r,i,Wt(t,s))}static fromGlob(r,i={}){return e.AST.fromGlob(r,Wt(t,i))}},unescape:(r,i={})=>e.unescape(r,Wt(t,i)),escape:(r,i={})=>e.escape(r,Wt(t,i)),filter:(r,i={})=>e.filter(r,Wt(t,i)),defaults:r=>e.defaults(Wt(t,r)),makeRe:(r,i={})=>e.makeRe(r,Wt(t,i)),braceExpand:(r,i={})=>e.braceExpand(r,Wt(t,i)),match:(r,i,s={})=>e.match(r,i,Wt(t,s)),sep:e.sep,GLOBSTAR:$t})};Pt.defaults=ag;yc=(t,e={})=>(Cs(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Em(t,{max:e.braceExpandMax}));Pt.braceExpand=yc;lg=(t,e={})=>new Te(t,e).makeRe();Pt.makeRe=lg;ug=(t,e,r={})=>{let i=new Te(e,r);return t=t.filter(s=>i.match(s)),i.options.nonull&&!t.length&&t.push(e),t};Pt.match=ug;Vu=/[?*]|[+@!]\(.*?\)|\[|\]/,cg=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Te=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){Cs(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||gc,this.isWindows=this.platform==="win32";let r="allowWindowsEscape";this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e[r]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let r=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(r),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,n,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let a=s[0]===""&&s[1]===""&&(s[2]==="?"||!Vu.test(s[2]))&&!Vu.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(a)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(l)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(a=>this.parse(a))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let n=this.set[s];n[0]===""&&n[1]===""&&this.globParts[s][2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3])&&(n[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let r=0;r<t.length;r++)for(let i=0;i<t[r].length;i++)t[r][i]==="**"&&(t[r][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let r=-1;for(;(r=e.indexOf("**",r+1))!==-1;){let i=r;for(;e[i+1]==="**";)i++;i!==r&&e.splice(r,i-r)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((r,i)=>{let s=r[r.length-1];return i==="**"&&s==="**"?r:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(r.pop(),r):(r.push(i),r)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];i===1&&s===""&&t[0]===""||(s==="."||s==="")&&(e=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let r=0;for(;(r=t.indexOf("..",r+1))!==-1;){let i=t[r-1];i&&i!=="."&&i!==".."&&i!=="**"&&(e=!0,t.splice(r-1,2),r-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let r of t){let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let n=i;for(;r[n+1]==="**";)n++;n>i&&r.splice(i+1,n-i);let o=r[i+1],a=r[i+2],l=r[i+3];if(o!==".."||!a||a==="."||a===".."||!l||l==="."||l==="..")continue;e=!0,r.splice(i,1);let u=r.slice(0);u[i]="**",t.push(u),i--}if(!this.preserveMultipleSlashes){for(let n=1;n<r.length-1;n++){let o=r[n];n===1&&o===""&&r[0]===""||(o==="."||o==="")&&(e=!0,r.splice(n,1),n--)}r[0]==="."&&r.length===2&&(r[1]==="."||r[1]==="")&&(e=!0,r.pop())}let s=0;for(;(s=r.indexOf("..",s+1))!==-1;){let n=r[s-1];if(n&&n!=="."&&n!==".."&&n!=="**"){e=!0;let o=s===1&&r[s+1]==="**"?["."]:[];r.splice(s-1,2,...o),r.length===0&&r.push(""),s-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let r=e+1;r<t.length;r++){let i=this.partsMatch(t[e],t[r],!this.preserveMultipleSlashes);if(i){t[e]=[],t[r]=i;break}}return t.filter(e=>e.length)}partsMatch(t,e,r=!1){let i=0,s=0,n=[],o="";for(;i<t.length&&s<e.length;)if(t[i]===e[s])n.push(o==="b"?e[s]:t[i]),i++,s++;else if(r&&t[i]==="**"&&e[s]===t[i+1])n.push(t[i]),i++;else if(r&&e[s]==="**"&&t[i]===e[s+1])n.push(e[s]),s++;else if(t[i]==="*"&&e[s]&&(this.options.dot||!e[s].startsWith("."))&&e[s]!=="**"){if(o==="b")return!1;o="a",n.push(t[i]),i++,s++}else if(e[s]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(o==="a")return!1;o="b",n.push(e[s]),i++,s++}else return!1;return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,r=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)e=!e,r++;r&&(this.pattern=t.slice(r)),this.negate=e}matchOne(t,e,r=!1){let i=this.options;if(this.isWindows){let h=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),d=!h&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),y=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),g=!y&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),D=d?3:h?0:void 0,v=g?3:y?0:void 0;if(typeof D=="number"&&typeof v=="number"){let[b,C]=[t[D],e[v]];b.toLowerCase()===C.toLowerCase()&&(e[v]=b,v>D?e=e.slice(v):D>v&&(t=t.slice(D)))}}let{optimizationLevel:s=1}=this.options;s>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var n=0,o=0,a=t.length,l=e.length;n<a&&o<l;n++,o++){this.debug("matchOne loop");var u=e[o],c=t[n];if(this.debug(e,u,c),u===!1)return!1;if(u===$t){this.debug("GLOBSTAR",[e,u,c]);var p=n,m=o+1;if(m===l){for(this.debug("** at the end");n<a;n++)if(t[n]==="."||t[n]===".."||!i.dot&&t[n].charAt(0)===".")return!1;return!0}for(;p<a;){var f=t[p];if(this.debug(`
95
+ globstar while`,t,p,e,m,f),this.matchOne(t.slice(p),e.slice(m),r))return this.debug("globstar found match!",p,a,f),!0;if(f==="."||f===".."||!i.dot&&f.charAt(0)==="."){this.debug("dot detected!",t,p,e,m);break}this.debug("globstar swallow a segment, and continue"),p++}return!!(r&&(this.debug(`
96
+ >>> no match, partial?`,t,p,e,m),p===a))}let h;if(typeof u=="string"?(h=c===u,this.debug("string match",u,c,h)):(h=u.test(c),this.debug("pattern match",u,c,h)),!h)return!1}if(n===a&&o===l)return!0;if(n===a)return r;if(o===l)return n===a-1&&t[n]==="";throw new Error("wtf?")}braceExpand(){return yc(this.pattern,this.options)}parse(t){Cs(t);let e=this.options;if(t==="**")return $t;if(t==="")return"";let r,i=null;(r=t.match(Km))?i=e.dot?Ym:Hm:(r=t.match(Lm))?i=(e.nocase?e.dot?Wm:Nm:e.dot?Mm:Bm)(r[1]):(r=t.match(Jm))?i=(e.nocase?e.dot?Zm:Qm:e.dot?Xm:tg)(r):(r=t.match(zm))?i=e.dot?Vm:Um:(r=t.match(qm))&&(i=Gm);let s=pc.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,r=e.noglobstar?ig:e.dot?sg:ng,i=new Set(e.nocase?["i"]:[]),s=t.map(a=>{let l=a.map(c=>{if(c instanceof RegExp)for(let p of c.flags.split(""))i.add(p);return typeof c=="string"?cg(c):c===$t?$t:c._src});l.forEach((c,p)=>{let m=l[p+1],f=l[p-1];c!==$t||f===$t||(f===void 0?m!==void 0&&m!==$t?l[p+1]="(?:\\/|"+r+"\\/)?"+m:l[p]=r:m===void 0?l[p-1]=f+"(?:\\/|\\/"+r+")?":m!==$t&&(l[p-1]=f+"(?:\\/|\\/"+r+"\\/)"+m,l[p+1]=$t))});let u=l.filter(c=>c!==$t);if(this.partial&&u.length>=1){let c=[];for(let p=1;p<=u.length;p++)c.push(u.slice(0,p).join("/"));return"(?:"+c.join("|")+")"}return u.join("/")}).join("|"),[n,o]=t.length>1?["(?:",")"]:["",""];s="^"+n+s+o+"$",this.partial&&(s="^(?:\\/|"+n+s.slice(1,-1)+o+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let r=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let n=i[i.length-1];if(!n)for(let o=i.length-2;!n&&o>=0;o--)n=i[o];for(let o=0;o<s.length;o++){let a=s[o],l=i;if(r.matchBase&&a.length===1&&(l=[n]),this.matchOne(l,a,e))return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}static defaults(t){return Pt.defaults(t).Minimatch}};Pt.AST=pc;Pt.Minimatch=Te;Pt.escape=fc;Pt.unescape=ur;hg=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,wc=new Set,co=typeof process=="object"&&process?process:{},bc=(t,e,r,i)=>{typeof co.emitWarning=="function"?co.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},Es=globalThis.AbortController,qu=globalThis.AbortSignal;if(typeof Es>"u"){qu=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(r,i){this._onabort.push(i)}},Es=class{constructor(){e()}signal=new qu;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r)}}};let t=co.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,bc("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}pg=t=>!wc.has(t),Ae=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),vc=t=>Ae(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?bs:null:null,bs=class extends Array{constructor(t){super(t),this.fill(0)}},fg=class Vr{heap;length;static#t=!1;static create(e){let r=vc(e);if(!r)return[];Vr.#t=!0;let i=new Vr(e,r);return Vr.#t=!1,i}constructor(e,r){if(!Vr.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},Fs=class Cc{#t;#e;#n;#i;#o;#y;#D;#c;get perf(){return this.#c}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#p;#h;#l;#s;#f;#v;#b;#d;#P;#m;#S;#x;#g;#w;#C;#F;#r;#O;static unsafeExposeInternals(e){return{starts:e.#x,ttls:e.#g,autopurgeTimers:e.#w,sizes:e.#S,keyMap:e.#h,keyList:e.#l,valList:e.#s,next:e.#f,prev:e.#v,get head(){return e.#b},get tail(){return e.#d},free:e.#P,isBackgroundFetch:r=>e.#u(r),backgroundFetch:(r,i,s,n)=>e.#z(r,i,s,n),moveToTail:r=>e.#I(r),indexes:r=>e.#T(r),rindexes:r=>e.#R(r),isStale:r=>e.#E(r)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#p}get size(){return this.#a}get fetchMethod(){return this.#y}get memoMethod(){return this.#D}get dispose(){return this.#n}get onInsert(){return this.#i}get disposeAfter(){return this.#o}constructor(e){let{max:r=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:l,dispose:u,onInsert:c,disposeAfter:p,noDisposeOnSet:m,noUpdateTTL:f,maxSize:h=0,maxEntrySize:d=0,sizeCalculation:y,fetchMethod:g,memoMethod:D,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:C,allowStaleOnFetchAbort:F,ignoreFetchAbort:E,perf:S}=e;if(S!==void 0&&typeof S?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#c=S??hg,r!==0&&!Ae(r))throw new TypeError("max option must be a nonnegative integer");let k=r?vc(r):Array;if(!k)throw new Error("invalid max value: "+r);if(this.#t=r,this.#e=h,this.maxEntrySize=d||this.#e,this.sizeCalculation=y,this.sizeCalculation){if(!this.#e&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(D!==void 0&&typeof D!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#D=D,g!==void 0&&typeof g!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#y=g,this.#F=!!g,this.#h=new Map,this.#l=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#f=new k(r),this.#v=new k(r),this.#b=0,this.#d=0,this.#P=fg.create(r),this.#a=0,this.#p=0,typeof u=="function"&&(this.#n=u),typeof c=="function"&&(this.#i=c),typeof p=="function"?(this.#o=p,this.#m=[]):(this.#o=void 0,this.#m=void 0),this.#C=!!this.#n,this.#O=!!this.#i,this.#r=!!this.#o,this.noDisposeOnSet=!!m,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!C,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(this.#e!==0&&!Ae(this.#e))throw new TypeError("maxSize must be a positive integer if specified");if(!Ae(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=Ae(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!Ae(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#k()}if(this.#t===0&&this.ttl===0&&this.#e===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let z="LRU_CACHE_UNBOUNDED";pg(z)&&(wc.add(z),bc("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",z,Cc))}}getRemainingTTL(e){return this.#h.has(e)?1/0:0}#k(){let e=new bs(this.#t),r=new bs(this.#t);this.#g=e,this.#x=r;let i=this.ttlAutopurge?new Array(this.#t):void 0;this.#w=i,this.#B=(o,a,l=this.#c.now())=>{if(r[o]=a!==0?l:0,e[o]=a,i?.[o]&&(clearTimeout(i[o]),i[o]=void 0),a!==0&&i){let u=setTimeout(()=>{this.#E(o)&&this.#A(this.#l[o],"expire")},a+1);u.unref&&u.unref(),i[o]=u}},this.#$=o=>{r[o]=e[o]!==0?this.#c.now():0},this.#_=(o,a)=>{if(e[a]){let l=e[a],u=r[a];if(!l||!u)return;o.ttl=l,o.start=u,o.now=s||n();let c=o.now-u;o.remainingTTL=l-c}};let s=0,n=()=>{let o=this.#c.now();if(this.ttlResolution>0){s=o;let a=setTimeout(()=>s=0,this.ttlResolution);a.unref&&a.unref()}return o};this.getRemainingTTL=o=>{let a=this.#h.get(o);if(a===void 0)return 0;let l=e[a],u=r[a];if(!l||!u)return 1/0;let c=(s||n())-u;return l-c},this.#E=o=>{let a=r[o],l=e[o];return!!l&&!!a&&(s||n())-a>l}}#$=()=>{};#_=()=>{};#B=()=>{};#E=()=>!1;#V(){let e=new bs(this.#t);this.#p=0,this.#S=e,this.#L=r=>{this.#p-=e[r],e[r]=0},this.#M=(r,i,s,n)=>{if(this.#u(i))return 0;if(!Ae(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,r),!Ae(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#j=(r,i,s)=>{if(e[r]=i,this.#e){let n=this.#e-e[r];for(;this.#p>n;)this.#W(!0)}this.#p+=e[r],s&&(s.entrySize=i,s.totalCalculatedSize=this.#p)}}#L=e=>{};#j=(e,r,i)=>{};#M=(e,r,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#d;!(!this.#N(r)||((e||!this.#E(r))&&(yield r),r===this.#b));)r=this.#v[r]}*#R({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#b;!(!this.#N(r)||((e||!this.#E(r))&&(yield r),r===this.#d));)r=this.#f[r]}#N(e){return e!==void 0&&this.#h.get(this.#l[e])===e}*entries(){for(let e of this.#T())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*rentries(){for(let e of this.#R())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*keys(){for(let e of this.#T()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*rkeys(){for(let e of this.#R()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*values(){for(let e of this.#T())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}*rvalues(){for(let e of this.#R())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let i of this.#T()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;if(n!==void 0&&e(n,this.#l[i],this))return this.get(this.#l[i],r)}}forEach(e,r=this){for(let i of this.#T()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(r,n,this.#l[i],this)}}rforEach(e,r=this){for(let i of this.#R()){let s=this.#s[i],n=this.#u(s)?s.__staleWhileFetching:s;n!==void 0&&e.call(r,n,this.#l[i],this)}}purgeStale(){let e=!1;for(let r of this.#R({allowStale:!0}))this.#E(r)&&(this.#A(this.#l[r],"expire"),e=!0);return e}info(e){let r=this.#h.get(e);if(r===void 0)return;let i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#g&&this.#x){let o=this.#g[r],a=this.#x[r];if(o&&a){let l=o-(this.#c.now()-a);n.ttl=l,n.start=Date.now()}}return this.#S&&(n.size=this.#S[r]),n}dump(){let e=[];for(let r of this.#T({allowStale:!0})){let i=this.#l[r],s=this.#s[r],n=this.#u(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let o={value:n};if(this.#g&&this.#x){o.ttl=this.#g[r];let a=this.#c.now()-this.#x[r];o.start=Math.floor(Date.now()-a)}this.#S&&(o.size=this.#S[r]),e.unshift([i,o])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let s=Date.now()-i.start;i.start=this.#c.now()-s}this.set(r,i.value,i)}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:u=this.noUpdateTTL}=i,c=this.#M(e,r,i.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let p=this.#a===0?void 0:this.#h.get(e);if(p===void 0)p=this.#a===0?this.#d:this.#P.length!==0?this.#P.pop():this.#a===this.#t?this.#W(!1):this.#a,this.#l[p]=e,this.#s[p]=r,this.#h.set(e,p),this.#f[this.#d]=p,this.#v[p]=this.#d,this.#d=p,this.#a++,this.#j(p,c,l),l&&(l.set="add"),u=!1,this.#O&&this.#i?.(r,e,"add");else{this.#I(p);let m=this.#s[p];if(r!==m){if(this.#F&&this.#u(m)){m.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=m;f!==void 0&&!o&&(this.#C&&this.#n?.(f,e,"set"),this.#r&&this.#m?.push([f,e,"set"]))}else o||(this.#C&&this.#n?.(m,e,"set"),this.#r&&this.#m?.push([m,e,"set"]));if(this.#L(p),this.#j(p,c,l),this.#s[p]=r,l){l.set="replace";let f=m&&this.#u(m)?m.__staleWhileFetching:m;f!==void 0&&(l.oldValue=f)}}else l&&(l.set="update");this.#O&&this.onInsert?.(r,e,r===m?"update":"replace")}if(s!==0&&!this.#g&&this.#k(),this.#g&&(u||this.#B(p,s,n),l&&this.#_(l,p)),!o&&this.#r&&this.#m){let m=this.#m,f;for(;f=m?.shift();)this.#o?.(...f)}return this}pop(){try{for(;this.#a;){let e=this.#s[this.#b];if(this.#W(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#r&&this.#m){let e=this.#m,r;for(;r=e?.shift();)this.#o?.(...r)}}}#W(e){let r=this.#b,i=this.#l[r],s=this.#s[r];return this.#F&&this.#u(s)?s.__abortController.abort(new Error("evicted")):(this.#C||this.#r)&&(this.#C&&this.#n?.(s,i,"evict"),this.#r&&this.#m?.push([s,i,"evict"])),this.#L(r),this.#w?.[r]&&(clearTimeout(this.#w[r]),this.#w[r]=void 0),e&&(this.#l[r]=void 0,this.#s[r]=void 0,this.#P.push(r)),this.#a===1?(this.#b=this.#d=0,this.#P.length=0):this.#b=this.#f[r],this.#h.delete(i),this.#a--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=r,n=this.#h.get(e);if(n!==void 0){let o=this.#s[n];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#E(n))s&&(s.has="stale",this.#_(s,n));else return i&&this.#$(n),s&&(s.has="hit",this.#_(s,n)),!0}else s&&(s.has="miss");return!1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,s=this.#h.get(e);if(s===void 0||!i&&this.#E(s))return;let n=this.#s[s];return this.#u(n)?n.__staleWhileFetching:n}#z(e,r,i,s){let n=r===void 0?void 0:this.#s[r];if(this.#u(n))return n;let o=new Es,{signal:a}=i;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let l={signal:o.signal,options:i,context:s},u=(d,y=!1)=>{let{aborted:g}=o.signal,D=i.ignoreFetchAbort&&d!==void 0,v=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&d!==void 0);if(i.status&&(g&&!y?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,D&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),g&&!D&&!y)return p(o.signal.reason,v);let b=f,C=this.#s[r];return(C===f||D&&y&&C===void 0)&&(d===void 0?b.__staleWhileFetching!==void 0?this.#s[r]=b.__staleWhileFetching:this.#A(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(e,d,l.options))),d},c=d=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=d),p(d,!1)),p=(d,y)=>{let{aborted:g}=o.signal,D=g&&i.allowStaleOnFetchAbort,v=D||i.allowStaleOnFetchRejection,b=v||i.noDeleteOnFetchRejection,C=f;if(this.#s[r]===f&&(!b||!y&&C.__staleWhileFetching===void 0?this.#A(e,"fetch"):D||(this.#s[r]=C.__staleWhileFetching)),v)return i.status&&C.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),C.__staleWhileFetching;if(C.__returned===C)throw d},m=(d,y)=>{let g=this.#y?.(e,n,l);g&&g instanceof Promise&&g.then(D=>d(D===void 0?void 0:D),y),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(d(void 0),i.allowStaleOnFetchAbort&&(d=D=>u(D,!0)))})};i.status&&(i.status.fetchDispatched=!0);let f=new Promise(m).then(u,c),h=Object.assign(f,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return r===void 0?(this.set(e,h,{...l.options,status:void 0}),r=this.#h.get(e)):this.#s[r]=h,h}#u(e){if(!this.#F)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Es}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:d,forceRefresh:y=!1,status:g,signal:D}=r;if(!this.#F)return g&&(g.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:g});let v={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:a,size:l,sizeCalculation:u,noUpdateTTL:c,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:h,ignoreFetchAbort:f,status:g,signal:D},b=this.#h.get(e);if(b===void 0){g&&(g.fetch="miss");let C=this.#z(e,b,v,d);return C.__returned=C}else{let C=this.#s[b];if(this.#u(C)){let k=i&&C.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",k&&(g.returnedStale=!0)),k?C.__staleWhileFetching:C.__returned=C}let F=this.#E(b);if(!y&&!F)return g&&(g.fetch="hit"),this.#I(b),s&&this.#$(b),g&&this.#_(g,b),C;let E=this.#z(e,b,v,d),S=E.__staleWhileFetching!==void 0&&i;return g&&(g.fetch=F?"stale":"refresh",S&&F&&(g.returnedStale=!0)),S?E.__staleWhileFetching:E.__returned=E}}async forceFetch(e,r={}){let i=await this.fetch(e,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,r={}){let i=this.#D;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...o}=r,a=this.get(e,o);if(!n&&a!==void 0)return a;let l=i(e,a,{options:o,context:s});return this.set(e,l,o),l}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=r,a=this.#h.get(e);if(a!==void 0){let l=this.#s[a],u=this.#u(l);return o&&this.#_(o,a),this.#E(a)?(o&&(o.get="stale"),u?(o&&i&&l.__staleWhileFetching!==void 0&&(o.returnedStale=!0),i?l.__staleWhileFetching:void 0):(n||this.#A(e,"expire"),o&&i&&(o.returnedStale=!0),i?l:void 0)):(o&&(o.get="hit"),u?l.__staleWhileFetching:(this.#I(a),s&&this.#$(a),l))}else o&&(o.get="miss")}#U(e,r){this.#v[r]=e,this.#f[e]=r}#I(e){e!==this.#d&&(e===this.#b?this.#b=this.#f[e]:this.#U(this.#v[e],this.#f[e]),this.#U(this.#d,e),this.#d=e)}delete(e){return this.#A(e,"delete")}#A(e,r){let i=!1;if(this.#a!==0){let s=this.#h.get(e);if(s!==void 0)if(this.#w?.[s]&&(clearTimeout(this.#w?.[s]),this.#w[s]=void 0),i=!0,this.#a===1)this.#q(r);else{this.#L(s);let n=this.#s[s];if(this.#u(n)?n.__abortController.abort(new Error("deleted")):(this.#C||this.#r)&&(this.#C&&this.#n?.(n,e,r),this.#r&&this.#m?.push([n,e,r])),this.#h.delete(e),this.#l[s]=void 0,this.#s[s]=void 0,s===this.#d)this.#d=this.#v[s];else if(s===this.#b)this.#b=this.#f[s];else{let o=this.#v[s];this.#f[o]=this.#f[s];let a=this.#f[s];this.#v[a]=this.#v[s]}this.#a--,this.#P.push(s)}}if(this.#r&&this.#m?.length){let s=this.#m,n;for(;n=s?.shift();)this.#o?.(...n)}return i}clear(){return this.#q("delete")}#q(e){for(let r of this.#R({allowStale:!0})){let i=this.#s[r];if(this.#u(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#l[r];this.#C&&this.#n?.(i,s,e),this.#r&&this.#m?.push([i,s,e])}}if(this.#h.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#g&&this.#x){this.#g.fill(0),this.#x.fill(0);for(let r of this.#w??[])r!==void 0&&clearTimeout(r);this.#w?.fill(void 0)}if(this.#S&&this.#S.fill(0),this.#b=0,this.#d=0,this.#P.length=0,this.#p=0,this.#a=0,this.#r&&this.#m){let r=this.#m,i;for(;i=r?.shift();)this.#o?.(...i)}}},Gu=typeof process=="object"&&process?process:{stdout:null,stderr:null},mg=t=>!!t&&typeof t=="object"&&(t instanceof Ss||t instanceof fo.default||gg(t)||yg(t)),gg=t=>!!t&&typeof t=="object"&&t instanceof $s.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==fo.default.Writable.prototype.pipe,yg=t=>!!t&&typeof t=="object"&&t instanceof $s.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",ge=Symbol("EOF"),ye=Symbol("maybeEmitEnd"),Pe=Symbol("emittedEnd"),fs=Symbol("emittingEnd"),Br=Symbol("emittedError"),ds=Symbol("closed"),Ku=Symbol("read"),ms=Symbol("flush"),Hu=Symbol("flushChunk"),Ht=Symbol("encoding"),ar=Symbol("decoder"),gt=Symbol("flowing"),Mr=Symbol("paused"),lr=Symbol("resume"),yt=Symbol("buffer"),Ft=Symbol("pipes"),Dt=Symbol("bufferLength"),io=Symbol("bufferPush"),gs=Symbol("bufferShift"),Ct=Symbol("objectMode"),rt=Symbol("destroyed"),so=Symbol("error"),no=Symbol("emitData"),Yu=Symbol("emitEnd"),oo=Symbol("emitEnd2"),ne=Symbol("async"),ao=Symbol("abort"),ys=Symbol("aborted"),Nr=Symbol("signal"),Ve=Symbol("dataListeners"),It=Symbol("discarded"),Wr=t=>Promise.resolve().then(t),Dg=t=>t(),wg=t=>t==="end"||t==="finish"||t==="prefinish",bg=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,vg=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),xc=class{src;dest;opts;ondrain;constructor(t,e,r){this.src=t,this.dest=e,this.opts=r,this.ondrain=()=>t[lr](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Cg=class extends xc{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,r){super(t,e,r),this.proxyErrors=i=>this.dest.emit("error",i),t.on("error",this.proxyErrors)}},Eg=t=>!!t.objectMode,Sg=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Ss=class extends $s.EventEmitter{[gt]=!1;[Mr]=!1;[Ft]=[];[yt]=[];[Ct];[Ht];[ne];[ar];[ge]=!1;[Pe]=!1;[fs]=!1;[ds]=!1;[Br]=null;[Dt]=0;[rt]=!1;[Nr];[ys]=!1;[Ve]=0;[It]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Eg(e)?(this[Ct]=!0,this[Ht]=null):Sg(e)?(this[Ht]=e.encoding,this[Ct]=!1):(this[Ct]=!1,this[Ht]=null),this[ne]=!!e.async,this[ar]=this[Ht]?new Sc.StringDecoder(this[Ht]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[yt]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Ft]});let{signal:r}=e;r&&(this[Nr]=r,r.aborted?this[ao]():r.addEventListener("abort",()=>this[ao]()))}get bufferLength(){return this[Dt]}get encoding(){return this[Ht]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[Ct]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ne]}set async(t){this[ne]=this[ne]||!!t}[ao](){this[ys]=!0,this.emit("abort",this[Nr]?.reason),this.destroy(this[Nr]?.reason)}get aborted(){return this[ys]}set aborted(t){}write(t,e,r){if(this[ys])return!1;if(this[ge])throw new Error("write after end");if(this[rt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(r=e,e="utf8"),e||(e="utf8");let i=this[ne]?Wr:Dg;if(!this[Ct]&&!Buffer.isBuffer(t)){if(vg(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(bg(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[Ct]?(this[gt]&&this[Dt]!==0&&this[ms](!0),this[gt]?this.emit("data",t):this[io](t),this[Dt]!==0&&this.emit("readable"),r&&i(r),this[gt]):t.length?(typeof t=="string"&&!(e===this[Ht]&&!this[ar]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[Ht]&&(t=this[ar].write(t)),this[gt]&&this[Dt]!==0&&this[ms](!0),this[gt]?this.emit("data",t):this[io](t),this[Dt]!==0&&this.emit("readable"),r&&i(r),this[gt]):(this[Dt]!==0&&this.emit("readable"),r&&i(r),this[gt])}read(t){if(this[rt])return null;if(this[It]=!1,this[Dt]===0||t===0||t&&t>this[Dt])return this[ye](),null;this[Ct]&&(t=null),this[yt].length>1&&!this[Ct]&&(this[yt]=[this[Ht]?this[yt].join(""):Buffer.concat(this[yt],this[Dt])]);let e=this[Ku](t||null,this[yt][0]);return this[ye](),e}[Ku](t,e){if(this[Ct])this[gs]();else{let r=e;t===r.length||t===null?this[gs]():typeof r=="string"?(this[yt][0]=r.slice(t),e=r.slice(0,t),this[Dt]-=t):(this[yt][0]=r.subarray(t),e=r.subarray(0,t),this[Dt]-=t)}return this.emit("data",e),!this[yt].length&&!this[ge]&&this.emit("drain"),e}end(t,e,r){return typeof t=="function"&&(r=t,t=void 0),typeof e=="function"&&(r=e,e="utf8"),t!==void 0&&this.write(t,e),r&&this.once("end",r),this[ge]=!0,this.writable=!1,(this[gt]||!this[Mr])&&this[ye](),this}[lr](){this[rt]||(!this[Ve]&&!this[Ft].length&&(this[It]=!0),this[Mr]=!1,this[gt]=!0,this.emit("resume"),this[yt].length?this[ms]():this[ge]?this[ye]():this.emit("drain"))}resume(){return this[lr]()}pause(){this[gt]=!1,this[Mr]=!0,this[It]=!1}get destroyed(){return this[rt]}get flowing(){return this[gt]}get paused(){return this[Mr]}[io](t){this[Ct]?this[Dt]+=1:this[Dt]+=t.length,this[yt].push(t)}[gs](){return this[Ct]?this[Dt]-=1:this[Dt]-=this[yt][0].length,this[yt].shift()}[ms](t=!1){do;while(this[Hu](this[gs]())&&this[yt].length);!t&&!this[yt].length&&!this[ge]&&this.emit("drain")}[Hu](t){return this.emit("data",t),this[gt]}pipe(t,e){if(this[rt])return t;this[It]=!1;let r=this[Pe];return e=e||{},t===Gu.stdout||t===Gu.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,r?e.end&&t.end():(this[Ft].push(e.proxyErrors?new Cg(this,t,e):new xc(this,t,e)),this[ne]?Wr(()=>this[lr]()):this[lr]()),t}unpipe(t){let e=this[Ft].find(r=>r.dest===t);e&&(this[Ft].length===1?(this[gt]&&this[Ve]===0&&(this[gt]=!1),this[Ft]=[]):this[Ft].splice(this[Ft].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let r=super.on(t,e);if(t==="data")this[It]=!1,this[Ve]++,!this[Ft].length&&!this[gt]&&this[lr]();else if(t==="readable"&&this[Dt]!==0)super.emit("readable");else if(wg(t)&&this[Pe])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Br]){let i=e;this[ne]?Wr(()=>i.call(this,this[Br])):i.call(this,this[Br])}return r}removeListener(t,e){return this.off(t,e)}off(t,e){let r=super.off(t,e);return t==="data"&&(this[Ve]=this.listeners("data").length,this[Ve]===0&&!this[It]&&!this[Ft].length&&(this[gt]=!1)),r}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[Ve]=0,!this[It]&&!this[Ft].length&&(this[gt]=!1)),e}get emittedEnd(){return this[Pe]}[ye](){!this[fs]&&!this[Pe]&&!this[rt]&&this[yt].length===0&&this[ge]&&(this[fs]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ds]&&this.emit("close"),this[fs]=!1)}emit(t,...e){let r=e[0];if(t!=="error"&&t!=="close"&&t!==rt&&this[rt])return!1;if(t==="data")return!this[Ct]&&!r?!1:this[ne]?(Wr(()=>this[no](r)),!0):this[no](r);if(t==="end")return this[Yu]();if(t==="close"){if(this[ds]=!0,!this[Pe]&&!this[rt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(t==="error"){this[Br]=r,super.emit(so,r);let s=!this[Nr]||this.listeners("error").length?super.emit("error",r):!1;return this[ye](),s}else if(t==="resume"){let s=super.emit("resume");return this[ye](),s}else if(t==="finish"||t==="prefinish"){let s=super.emit(t);return this.removeAllListeners(t),s}let i=super.emit(t,...e);return this[ye](),i}[no](t){for(let r of this[Ft])r.dest.write(t)===!1&&this.pause();let e=this[It]?!1:super.emit("data",t);return this[ye](),e}[Yu](){return this[Pe]?!1:(this[Pe]=!0,this.readable=!1,this[ne]?(Wr(()=>this[oo]()),!0):this[oo]())}[oo](){if(this[ar]){let e=this[ar].end();if(e){for(let r of this[Ft])r.dest.write(e);this[It]||super.emit("data",e)}}for(let e of this[Ft])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[Ct]||(t.dataLength=0);let e=this.promise();return this.on("data",r=>{t.push(r),this[Ct]||(t.dataLength+=r.length)}),await e,t}async concat(){if(this[Ct])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[Ht]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(rt,()=>e(new Error("stream destroyed"))),this.on("error",r=>e(r)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[It]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[ge])return e();let i,s,n=u=>{this.off("data",o),this.off("end",a),this.off(rt,l),e(),s(u)},o=u=>{this.off("error",n),this.off("end",a),this.off(rt,l),this.pause(),i({value:u,done:!!this[ge]})},a=()=>{this.off("error",n),this.off("data",o),this.off(rt,l),e(),i({done:!0,value:void 0})},l=()=>n(new Error("stream destroyed"));return new Promise((u,c)=>{s=c,i=u,this.once(rt,l),this.once("error",n),this.once("end",a),this.once("data",o)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[It]=!1;let t=!1,e=()=>(this.pause(),this.off(so,e),this.off(rt,e),this.off("end",e),t=!0,{done:!0,value:void 0}),r=()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}};return this.once("end",e),this.once(so,e),this.once(rt,e),{next:r,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[rt])return t?this.emit("error",t):this.emit(rt),this;this[rt]=!0,this[It]=!0,this[yt].length=0,this[Dt]=0;let e=this;return typeof e.close=="function"&&!this[ds]&&e.close(),t?this.emit("error",t):this.emit(rt),this}static get isStream(){return mg}},xg=ae.realpathSync.native,qr={lstatSync:ae.lstatSync,readdir:ae.readdir,readdirSync:ae.readdirSync,readlinkSync:ae.readlinkSync,realpathSync:xg,promises:{lstat:Re.lstat,readdir:Re.readdir,readlink:Re.readlink,realpath:Re.realpath}},Fc=t=>!t||t===qr||t===dg?qr:{...qr,...t,promises:{...qr.promises,...t.promises||{}}},$c=/^\\\\\?\\([a-z]:)\\?$/i,Fg=t=>t.replace(/\//g,"\\").replace($c,"$1\\"),$g=/[\\\/]/,Ut=0,Pc=1,Ac=2,oe=4,Tc=6,Rc=8,qe=10,kc=12,zt=15,zr=~zt,lo=16,Ju=32,Gr=64,Yt=128,Ds=256,vs=512,Qu=Gr|Yt|vs,Pg=1023,uo=t=>t.isFile()?Rc:t.isDirectory()?oe:t.isSymbolicLink()?qe:t.isCharacterDevice()?Ac:t.isBlockDevice()?Tc:t.isSocket()?kc:t.isFIFO()?Pc:Ut,Zu=new Fs({max:2**12}),Kr=t=>{let e=Zu.get(t);if(e)return e;let r=t.normalize("NFKD");return Zu.set(t,r),r},Xu=new Fs({max:2**12}),ws=t=>{let e=Xu.get(t);if(e)return e;let r=Kr(t.toLowerCase());return Xu.set(t,r),r},tc=class extends Fs{constructor(){super({max:256})}},Ag=class extends Fs{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},_c=Symbol("PathScurry setAsCwd"),Rt=class{name;root;roots;parent;nocase;isCWD=!1;#t;#e;get dev(){return this.#e}#n;get mode(){return this.#n}#i;get nlink(){return this.#i}#o;get uid(){return this.#o}#y;get gid(){return this.#y}#D;get rdev(){return this.#D}#c;get blksize(){return this.#c}#a;get ino(){return this.#a}#p;get size(){return this.#p}#h;get blocks(){return this.#h}#l;get atimeMs(){return this.#l}#s;get mtimeMs(){return this.#s}#f;get ctimeMs(){return this.#f}#v;get birthtimeMs(){return this.#v}#b;get atime(){return this.#b}#d;get mtime(){return this.#d}#P;get ctime(){return this.#P}#m;get birthtime(){return this.#m}#S;#x;#g;#w;#C;#F;#r;#O;#k;#$;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=Ut,r,i,s,n,o){this.name=t,this.#S=s?ws(t):Kr(t),this.#r=e&Pg,this.nocase=s,this.roots=i,this.root=r||this,this.#O=n,this.#g=o.fullpath,this.#C=o.relative,this.#F=o.relativePosix,this.parent=o.parent,this.parent?this.#t=this.parent.#t:this.#t=Fc(o.fs)}depth(){return this.#x!==void 0?this.#x:this.parent?this.#x=this.parent.depth()+1:this.#x=0}childrenCache(){return this.#O}resolve(t){if(!t)return this;let e=this.getRootString(t),r=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#_(r):this.#_(r)}#_(t){let e=this;for(let r of t)e=e.child(r);return e}children(){let t=this.#O.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#O.set(this,e),this.#r&=~lo,e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let r=this.children(),i=this.nocase?ws(t):Kr(t);for(let a of r)if(a.#S===i)return a;let s=this.parent?this.sep:"",n=this.#g?this.#g+s+t:void 0,o=this.newChild(t,Ut,{...e,parent:this,fullpath:n});return this.canReaddir()||(o.#r|=Yt),r.push(o),o}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let t=this.name,e=this.parent;if(!e)return this.#C=this.name;let r=e.relative();return r+(!r||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#F!==void 0)return this.#F;let t=this.name,e=this.parent;if(!e)return this.#F=this.fullpathPosix();let r=e.relativePosix();return r+(!r||!e.parent?"":"/")+t}fullpath(){if(this.#g!==void 0)return this.#g;let t=this.name,e=this.parent;if(!e)return this.#g=this.name;let r=e.fullpath()+(e.parent?this.sep:"")+t;return this.#g=r}fullpathPosix(){if(this.#w!==void 0)return this.#w;if(this.sep==="/")return this.#w=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#w=`//?/${i}`:this.#w=i}let t=this.parent,e=t.fullpathPosix(),r=e+(!e||!t.parent?"":"/")+this.name;return this.#w=r}isUnknown(){return(this.#r&zt)===Ut}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#r&zt)===Rc}isDirectory(){return(this.#r&zt)===oe}isCharacterDevice(){return(this.#r&zt)===Ac}isBlockDevice(){return(this.#r&zt)===Tc}isFIFO(){return(this.#r&zt)===Pc}isSocket(){return(this.#r&zt)===kc}isSymbolicLink(){return(this.#r&qe)===qe}lstatCached(){return this.#r&Ju?this:void 0}readlinkCached(){return this.#k}realpathCached(){return this.#$}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#k)return!0;if(!this.parent)return!1;let t=this.#r&zt;return!(t!==Ut&&t!==qe||this.#r&Ds||this.#r&Yt)}calledReaddir(){return!!(this.#r&lo)}isENOENT(){return!!(this.#r&Yt)}isNamed(t){return this.nocase?this.#S===ws(t):this.#S===Kr(t)}async readlink(){let t=this.#k;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=await this.#t.promises.readlink(this.fullpath()),r=(await this.parent.realpath())?.resolve(e);if(r)return this.#k=r}catch(e){this.#R(e.code);return}}readlinkSync(){let t=this.#k;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=this.#t.readlinkSync(this.fullpath()),r=this.parent.realpathSync()?.resolve(e);if(r)return this.#k=r}catch(e){this.#R(e.code);return}}#B(t){this.#r|=lo;for(let e=t.provisional;e<t.length;e++){let r=t[e];r&&r.#E()}}#E(){this.#r&Yt||(this.#r=(this.#r|Yt)&zr,this.#V())}#V(){let t=this.children();t.provisional=0;for(let e of t)e.#E()}#L(){this.#r|=vs,this.#j()}#j(){if(this.#r&Gr)return;let t=this.#r;(t&zt)===oe&&(t&=zr),this.#r=t|Gr,this.#V()}#M(t=""){t==="ENOTDIR"||t==="EPERM"?this.#j():t==="ENOENT"?this.#E():this.children().provisional=0}#T(t=""){t==="ENOTDIR"?this.parent.#j():t==="ENOENT"&&this.#E()}#R(t=""){let e=this.#r;e|=Ds,t==="ENOENT"&&(e|=Yt),(t==="EINVAL"||t==="UNKNOWN")&&(e&=zr),this.#r=e,t==="ENOTDIR"&&this.parent&&this.parent.#j()}#N(t,e){return this.#z(t,e)||this.#W(t,e)}#W(t,e){let r=uo(t),i=this.newChild(t.name,r,{parent:this}),s=i.#r&zt;return s!==oe&&s!==qe&&s!==Ut&&(i.#r|=Gr),e.unshift(i),e.provisional++,i}#z(t,e){for(let r=e.provisional;r<e.length;r++){let i=e[r];if((this.nocase?ws(t.name):Kr(t.name))===i.#S)return this.#u(t,i,r,e)}}#u(t,e,r,i){let s=e.name;return e.#r=e.#r&zr|uo(t),s!==t.name&&(e.name=t.name),r!==i.provisional&&(r===i.length-1?i.pop():i.splice(r,1),i.unshift(e)),i.provisional++,e}async lstat(){if((this.#r&Yt)===0)try{return this.#U(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#T(t.code)}}lstatSync(){if((this.#r&Yt)===0)try{return this.#U(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#T(t.code)}}#U(t){let{atime:e,atimeMs:r,birthtime:i,birthtimeMs:s,blksize:n,blocks:o,ctime:a,ctimeMs:l,dev:u,gid:c,ino:p,mode:m,mtime:f,mtimeMs:h,nlink:d,rdev:y,size:g,uid:D}=t;this.#b=e,this.#l=r,this.#m=i,this.#v=s,this.#c=n,this.#h=o,this.#P=a,this.#f=l,this.#e=u,this.#y=c,this.#a=p,this.#n=m,this.#d=f,this.#s=h,this.#i=d,this.#D=y,this.#p=g,this.#o=D;let v=uo(t);this.#r=this.#r&zr|v|Ju,v!==Ut&&v!==oe&&v!==qe&&(this.#r|=Gr)}#I=[];#A=!1;#q(t){this.#A=!1;let e=this.#I.slice();this.#I.length=0,e.forEach(r=>r(null,t))}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let r=this.children();if(this.calledReaddir()){let s=r.slice(0,r.provisional);e?t(null,s):queueMicrotask(()=>t(null,s));return}if(this.#I.push(t),this.#A)return;this.#A=!0;let i=this.fullpath();this.#t.readdir(i,{withFileTypes:!0},(s,n)=>{if(s)this.#M(s.code),r.provisional=0;else{for(let o of n)this.#N(o,r);this.#B(r)}this.#q(r.slice(0,r.provisional))})}#G;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(this.#G)await this.#G;else{let r=()=>{};this.#G=new Promise(i=>r=i);try{for(let i of await this.#t.promises.readdir(e,{withFileTypes:!0}))this.#N(i,t);this.#B(t)}catch(i){this.#M(i.code),t.provisional=0}this.#G=void 0,r()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let r of this.#t.readdirSync(e,{withFileTypes:!0}))this.#N(r,t);this.#B(t)}catch(r){this.#M(r.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#r&Qu)return!1;let t=zt&this.#r;return t===Ut||t===oe||t===qe}shouldWalk(t,e){return(this.#r&oe)===oe&&!(this.#r&Qu)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#$)return this.#$;if(!((vs|Ds|Yt)&this.#r))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#$=this.resolve(t)}catch{this.#L()}}realpathSync(){if(this.#$)return this.#$;if(!((vs|Ds|Yt)&this.#r))try{let t=this.#t.realpathSync(this.fullpath());return this.#$=this.resolve(t)}catch{this.#L()}}[_c](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),r=[],i=this;for(;i&&i.parent;)e.add(i),i.#C=r.join(this.sep),i.#F=r.join("/"),i=i.parent,r.push("..");for(i=t;i&&i.parent&&!e.has(i);)i.#C=void 0,i.#F=void 0,i=i.parent}},Oc=class jc extends Rt{sep="\\";splitSep=$g;constructor(e,r=Ut,i,s,n,o,a){super(e,r,i,s,n,o,a)}newChild(e,r=Ut,i={}){return new jc(e,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return cr.win32.parse(e).root}getRoot(e){if(e=Fg(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,i]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=i;return this.roots[e]=new mo(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace($c,"$1\\"),e===r}},Ic=class Lc extends Rt{splitSep="/";sep="/";constructor(e,r=Ut,i,s,n,o,a){super(e,r,i,s,n,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=Ut,i={}){return new Lc(e,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}},Bc=class{root;rootPath;roots;cwd;#t;#e;#n;nocase;#i;constructor(t=process.cwd(),e,r,{nocase:i,childrenCacheSize:s=16*1024,fs:n=qr}={}){this.#i=Fc(n),(t instanceof URL||t.startsWith("file://"))&&(t=(0,Ec.fileURLToPath)(t));let o=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#t=new tc,this.#e=new tc,this.#n=new Ag(s);let a=o.substring(this.rootPath.length).split(r);if(a.length===1&&!a[0]&&a.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#i),this.roots[this.rootPath]=this.root;let l=this.root,u=a.length-1,c=e.sep,p=this.rootPath,m=!1;for(let f of a){let h=u--;l=l.child(f,{relative:new Array(h).fill("..").join(c),relativePosix:new Array(h).fill("..").join("/"),fullpath:p+=(m?"":c)+f}),m=!0}this.cwd=l}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let e="";for(let s=t.length-1;s>=0;s--){let n=t[s];if(!(!n||n===".")&&(e=e?`${n}/${e}`:n,this.isAbsolute(n)))break}let r=this.#t.get(e);if(r!==void 0)return r;let i=this.cwd.resolve(e).fullpath();return this.#t.set(e,i),i}resolvePosix(...t){let e="";for(let s=t.length-1;s>=0;s--){let n=t[s];if(!(!n||n===".")&&(e=e?`${n}/${e}`:n,this.isAbsolute(n)))break}let r=this.#e.get(e);if(r!==void 0)return r;let i=this.cwd.resolve(e).fullpathPosix();return this.#e.set(e,i),i}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t,t=this.cwd);let{withFileTypes:r}=e;if(t.canReaddir()){let i=await t.readdir();return r?i:i.map(s=>s.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t,t=this.cwd);let{withFileTypes:r=!0}=e;return t.canReaddir()?r?t.readdirSync():t.readdirSync().map(i=>i.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t.withFileTypes,t=this.cwd);let r=await t.readlink();return e?r:r?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t.withFileTypes,t=this.cwd);let r=t.readlinkSync();return e?r:r?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t.withFileTypes,t=this.cwd);let r=await t.realpath();return e?r:r?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t.withFileTypes,t=this.cwd);let r=t.realpathSync();return e?r:r?.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t,t=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:n}=e,o=[];(!s||s(t))&&o.push(r?t:t.fullpath());let a=new Set,l=(c,p)=>{a.add(c),c.readdirCB((m,f)=>{if(m)return p(m);let h=f.length;if(!h)return p();let d=()=>{--h===0&&p()};for(let y of f)(!s||s(y))&&o.push(r?y:y.fullpath()),i&&y.isSymbolicLink()?y.realpath().then(g=>g?.isUnknown()?g.lstat():g).then(g=>g?.shouldWalk(a,n)?l(g,d):d()):y.shouldWalk(a,n)?l(y,d):d()},!0)},u=t;return new Promise((c,p)=>{l(u,m=>{if(m)return p(m);c(o)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t,t=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:n}=e,o=[];(!s||s(t))&&o.push(r?t:t.fullpath());let a=new Set([t]);for(let l of a){let u=l.readdirSync();for(let c of u){(!s||s(c))&&o.push(r?c:c.fullpath());let p=c;if(c.isSymbolicLink()){if(!(i&&(p=c.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(a,n)&&a.add(p)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t,t=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:n}=e;(!s||s(t))&&(yield r?t:t.fullpath());let o=new Set([t]);for(let a of o){let l=a.readdirSync();for(let u of l){(!s||s(u))&&(yield r?u:u.fullpath());let c=u;if(u.isSymbolicLink()){if(!(i&&(c=u.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(o,n)&&o.add(c)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t,t=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:n}=e,o=new Ss({objectMode:!0});(!s||s(t))&&o.write(r?t:t.fullpath());let a=new Set,l=[t],u=0,c=()=>{let p=!1;for(;!p;){let m=l.shift();if(!m){u===0&&o.end();return}u++,a.add(m);let f=(d,y,g=!1)=>{if(d)return o.emit("error",d);if(i&&!g){let D=[];for(let v of y)v.isSymbolicLink()&&D.push(v.realpath().then(b=>b?.isUnknown()?b.lstat():b));if(D.length){Promise.all(D).then(()=>f(null,y,!0));return}}for(let D of y)D&&(!s||s(D))&&(o.write(r?D:D.fullpath())||(p=!0));u--;for(let D of y){let v=D.realpathCached()||D;v.shouldWalk(a,n)&&l.push(v)}p&&!o.flowing?o.once("drain",c):h||c()},h=!0;m.readdirCB(f,!0),h=!1}};return c(),o}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof Rt||(e=t,t=this.cwd);let{withFileTypes:r=!0,follow:i=!1,filter:s,walkFilter:n}=e,o=new Ss({objectMode:!0}),a=new Set;(!s||s(t))&&o.write(r?t:t.fullpath());let l=[t],u=0,c=()=>{let p=!1;for(;!p;){let m=l.shift();if(!m){u===0&&o.end();return}u++,a.add(m);let f=m.readdirSync();for(let h of f)(!s||s(h))&&(o.write(r?h:h.fullpath())||(p=!0));u--;for(let h of f){let d=h;if(h.isSymbolicLink()){if(!(i&&(d=h.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(a,n)&&l.push(d)}}p&&!o.flowing&&o.once("drain",c)};return c(),o}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[_c](e)}},mo=class extends Bc{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:r=!0}=e;super(t,cr.win32,"\\",{...e,nocase:r}),this.nocase=r;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(t){return cr.win32.parse(t).root.toUpperCase()}newRoot(t){return new Oc(this.rootPath,oe,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},go=class extends Bc{sep="/";constructor(t=process.cwd(),e={}){let{nocase:r=!1}=e;super(t,cr.posix,"/",{...e,nocase:r}),this.nocase=r}parseRootPath(t){return"/"}newRoot(t){return new Ic(this.rootPath,oe,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},Mc=class extends go{constructor(t=process.cwd(),e={}){let{nocase:r=!0}=e;super(t,{...e,nocase:r})}},i1=process.platform==="win32"?Oc:Ic,Tg=process.platform==="win32"?mo:process.platform==="darwin"?Mc:go,Rg=t=>t.length>=1,kg=t=>t.length>=1,_g=Symbol.for("nodejs.util.inspect.custom"),Nc=class Wc{#t;#e;#n;length;#i;#o;#y;#D;#c;#a;#p=!0;constructor(e,r,i,s){if(!Rg(e))throw new TypeError("empty pattern list");if(!kg(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#t=e,this.#e=r,this.#n=i,this.#i=s,this.#n===0){if(this.isUNC()){let[n,o,a,l,...u]=this.#t,[c,p,m,f,...h]=this.#e;u[0]===""&&(u.shift(),h.shift());let d=[n,o,a,l,""].join("/"),y=[c,p,m,f,""].join("/");this.#t=[d,...u],this.#e=[y,...h],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...o]=this.#t,[a,...l]=this.#e;o[0]===""&&(o.shift(),l.shift());let u=n+"/",c=a+"/";this.#t=[u,...o],this.#e=[c,...l],this.length=this.#t.length}}}[_g](){return"Pattern <"+this.#e.slice(this.#n).join("/")+">"}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===$t}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#y=this.#y||(this.#n===0?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new Wc(this.#t,this.#e,this.#n+1,this.#i),this.#o.#a=this.#a,this.#o.#c=this.#c,this.#o.#D=this.#D,this.#o):this.#o=null}isUNC(){let e=this.#t;return this.#c!==void 0?this.#c:this.#c=this.#i==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#t;return this.#D!==void 0?this.#D:this.#D=this.#i==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#t;return this.#a!==void 0?this.#a:this.#a=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#t[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#p)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#p?!1:(this.#p=!1,!0)}},Og=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ec=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:r,noext:i,noglobstar:s,platform:n=Og}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=n,this.mmopts={dot:!0,nobrace:e,nocase:r,noext:i,noglobstar:s,optimizationLevel:2,platform:n,nocomment:!0,nonegate:!0};for(let o of t)this.add(o)}add(t){let e=new Te(t,this.mmopts);for(let r=0;r<e.set.length;r++){let i=e.set[r],s=e.globParts[r];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let n=new Nc(i,s,0,this.platform),o=new Te(n.globString(),this.mmopts),a=s[s.length-1]==="**",l=n.isAbsolute();l?this.absolute.push(o):this.relative.push(o),a&&(l?this.absoluteChildren.push(o):this.relativeChildren.push(o))}}ignored(t){let e=t.fullpath(),r=`${e}/`,i=t.relative()||".",s=`${i}/`;for(let n of this.relative)if(n.match(i)||n.match(s))return!0;for(let n of this.absolute)if(n.match(e)||n.match(r))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",r=(t.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(r))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}},jg=class zc{store;constructor(e=new Map){this.store=e}copy(){return new zc(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let i=e.fullpath(),s=this.store.get(i);s?s.add(r.globString()):this.store.set(i,new Set([r.globString()]))}},Ig=class{store=new Map;add(t,e,r){let i=(e?2:0)|(r?1:0),s=this.store.get(t);this.store.set(t,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},Lg=class{store=new Map;add(t,e){if(!t.canReaddir())return;let r=this.store.get(t);r?r.find(i=>i.globString()===e.globString())||r.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},rc=class Uc{hasWalkedCache;matches=new Ig;subwalks=new Lg;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new jg}processPatterns(e,r){this.patterns=r;let i=r.map(s=>[e,s]);for(let[s,n]of i){this.hasWalkedCache.storeWalked(s,n);let o=n.root(),a=n.isAbsolute()&&this.opts.absolute!==!1;if(o){s=s.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let p=n.rest();if(p)n=p;else{this.matches.add(s,!0,!1);continue}}if(s.isENOENT())continue;let l,u,c=!1;for(;typeof(l=n.pattern())=="string"&&(u=n.rest());)s=s.resolve(l),n=u,c=!0;if(l=n.pattern(),u=n.rest(),c){if(this.hasWalkedCache.hasWalked(s,n))continue;this.hasWalkedCache.storeWalked(s,n)}if(typeof l=="string"){let p=l===".."||l===""||l===".";this.matches.add(s.resolve(l),a,p);continue}else if(l===$t){(!s.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(s,n);let p=u?.pattern(),m=u?.rest();if(!u||(p===""||p===".")&&!m)this.matches.add(s,a,p===""||p===".");else if(p===".."){let f=s.parent||s;m?this.hasWalkedCache.hasWalked(f,m)||this.subwalks.add(f,m):this.matches.add(f,a,!0)}}else l instanceof RegExp&&this.subwalks.add(s,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Uc(this.opts,this.hasWalkedCache)}filterEntries(e,r){let i=this.subwalks.get(e),s=this.child();for(let n of r)for(let o of i){let a=o.isAbsolute(),l=o.pattern(),u=o.rest();l===$t?s.testGlobstar(n,o,u,a):l instanceof RegExp?s.testRegExp(n,l,u,a):s.testString(n,l,u,a)}return s}testGlobstar(e,r,i,s){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,s,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(i&&r.checkFollowGlobstar()?this.subwalks.add(e,i):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),i){let n=i.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(e,n,i.rest(),s);else if(n===".."){let o=e.parent||e;this.subwalks.add(o,i)}else n instanceof RegExp&&this.testRegExp(e,n,i.rest(),s)}}testRegExp(e,r,i,s){r.test(e.name)&&(i?this.subwalks.add(e,i):this.matches.add(e,s,!1))}testString(e,r,i,s){e.isNamed(r)&&(i?this.subwalks.add(e,i):this.matches.add(e,s,!1))}},Bg=(t,e)=>typeof t=="string"?new ec([t],e):Array.isArray(t)?new ec(t,e):t,Vc=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#e;#n;signal;maxDepth;includeChildMatches;constructor(t,e,r){if(this.patterns=t,this.path=e,this.opts=r,this.#n=!r.posix&&r.platform==="win32"?"\\":"/",this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#e=Bg(r.ignore??[],r),!this.includeChildMatches&&typeof this.#e.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#i(t){return this.seen.has(t)||!!this.#e?.ignored?.(t)}#o(t){return!!this.#e?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=t.realpathCached()||await t.realpath(),!r)return;t=r}let i=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){let s=await i.realpath();s&&(s.isUnknown()||this.opts.stat)&&await s.lstat()}return this.matchCheckTest(i,e)}matchCheckTest(t,e){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#i(t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=t.realpathCached()||t.realpathSync(),!r)return;t=r}let i=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){let s=i.realpathSync();s&&(s?.isUnknown()||this.opts.stat)&&s.lstatSync()}return this.matchCheckTest(i,e)}matchFinish(t,e){if(this.#i(t))return;if(!this.includeChildMatches&&this.#e?.add){let s=`${t.relativePosix()}/**`;this.#e.add(s)}let r=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let i=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(r){let s=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?t.relativePosix():t.relative(),n=this.opts.dotRelative&&!s.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(s?n+s+i:"."+i)}}async match(t,e,r){let i=await this.matchCheck(t,r);i&&this.matchFinish(i,e)}matchSync(t,e,r){let i=this.matchCheckSync(t,r);i&&this.matchFinish(i,e)}walkCB(t,e,r){this.signal?.aborted&&r(),this.walkCB2(t,e,new rc(this.opts),r)}walkCB2(t,e,r,i){if(this.#o(t))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(t,e,r,i));return}r.processPatterns(t,e);let s=1,n=()=>{--s===0&&i()};for(let[o,a,l]of r.matches.entries())this.#i(o)||(s++,this.match(o,a,l).then(()=>n()));for(let o of r.subwalkTargets()){if(this.maxDepth!==1/0&&o.depth()>=this.maxDepth)continue;s++;let a=o.readdirCached();o.calledReaddir()?this.walkCB3(o,a,r,n):o.readdirCB((l,u)=>this.walkCB3(o,u,r,n),!0)}n()}walkCB3(t,e,r,i){r=r.filterEntries(t,e);let s=1,n=()=>{--s===0&&i()};for(let[o,a,l]of r.matches.entries())this.#i(o)||(s++,this.match(o,a,l).then(()=>n()));for(let[o,a]of r.subwalks.entries())s++,this.walkCB2(o,a,r.child(),n);n()}walkCBSync(t,e,r){this.signal?.aborted&&r(),this.walkCB2Sync(t,e,new rc(this.opts),r)}walkCB2Sync(t,e,r,i){if(this.#o(t))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,r,i));return}r.processPatterns(t,e);let s=1,n=()=>{--s===0&&i()};for(let[o,a,l]of r.matches.entries())this.#i(o)||this.matchSync(o,a,l);for(let o of r.subwalkTargets()){if(this.maxDepth!==1/0&&o.depth()>=this.maxDepth)continue;s++;let a=o.readdirSync();this.walkCB3Sync(o,a,r,n)}n()}walkCB3Sync(t,e,r,i){r=r.filterEntries(t,e);let s=1,n=()=>{--s===0&&i()};for(let[o,a,l]of r.matches.entries())this.#i(o)||this.matchSync(o,a,l);for(let[o,a]of r.subwalks.entries())s++,this.walkCB2Sync(o,a,r.child(),n);n()}},ic=class extends Vc{matches=new Set;constructor(t,e,r){super(t,e,r)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},sc=class extends Vc{results;constructor(t,e,r){super(t,e,r),this.results=new Ss({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},Mg=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ge=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,Dc.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(a=>a.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(a=>a.includes("/")?a:`./**/${a}`)}if(this.pattern=t,this.platform=e.platform||Mg,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let a=e.platform==="win32"?mo:e.platform==="darwin"?Mc:e.platform?go:Tg;this.scurry=new a(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let r=this.platform==="darwin"||this.platform==="win32",i={braceExpandMax:1e4,...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:r,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(a=>new Te(a,i)),[n,o]=s.reduce((a,l)=>(a[0].push(...l.set),a[1].push(...l.globParts),a),[[],[]]);this.patterns=n.map((a,l)=>{let u=o[l];if(!u)throw new Error("invalid pattern object");return new Nc(a,u,0,this.platform)})}async walk(){return[...await new ic(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new ic(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new sc(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new sc(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}},Ng=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new Te(r,e).hasMagic())return!0;return!1};Wg=Ps,zg=Object.assign(qc,{sync:Ps}),Ug=As,Vg=Object.assign(Kc,{sync:As}),qg=Object.assign(Gc,{stream:Ps,iterate:As}),xs=Object.assign(nc,{glob:nc,globSync:Gc,sync:qg,globStream:qc,stream:zg,globStreamSync:Ps,streamSync:Wg,globIterate:Kc,iterate:Vg,globIterateSync:As,iterateSync:Ug,Glob:Ge,hasMagic:Ng,escape:fc,unescape:ur});xs.glob=xs});function Hg(t){let e=(0,Yr.basename)(t);return Kg.some(r=>r.test(e))}async function hr(t){let e=(0,Yr.resolve)(t),r=`${e}/.gitignore`,s=((0,Hr.existsSync)(r)?(0,Hr.readFileSync)(r,"utf-8"):"").split(`
97
+ `).map(l=>l.trim()).filter(l=>l&&!l.startsWith("#")),n=Array.from(new Set([...Gg,...s])),o=await xs(Yg,{ignore:n,cwd:e,nodir:!0}),a=[];for(let l of o)if(!Hg(l))try{a.push({filePath:l,content:(0,Hr.readFileSync)((0,Yr.resolve)(e,l),"utf-8")})}catch{}return a}var Hr,Yr,Gg,Kg,Yg,Ts=x(()=>{"use strict";Hr=require("fs"),Yr=require("path");Hc();Gg=["node_modules/**","out/**","dist/**","coverage/**","logs/**",".env",".cache/**",".idea/**",".DS_Store",".git/**"],Kg=[/^\.env(\..+)?$/i,/serviceaccount.*\.json$/i,/credentials?\.json$/i,/.*-credentials?\.json$/i,/firebase-adminsdk.*\.json$/i,/\.(pem|key|p12|pfx)$/i];Yg="**/*.{json,yml,yaml,po}"});function Yc(t){queueMicrotask(()=>{process.exit(t==="SIGINT"?130:143)})}function Vt(){let t=new AbortController;function e(){t.abort(),Yc("SIGINT")}function r(){t.abort(),Yc("SIGTERM")}return process.on("SIGINT",e),process.on("SIGTERM",r),{signal:t.signal,cleanup:()=>{process.off("SIGINT",e),process.off("SIGTERM",r)}}}var pr=x(()=>{"use strict"});function Xc(t,{default:e,alias:r,...i}={}){let s={...e,_:[]};if(t.length===0)return s;for(let n=0;n<t.length;n++){let o=t[n],a=t[n+1],l,u="",c;if(o.length>1&&o[0]==="-"){if(o[1]!=="-"&&o.length>2&&!o.includes("="))if(o.includes("."))u=o.slice(1,2),c=o.slice(2);else{let p=o.slice(1,-1);for(let m of p)r&&r[m]!==void 0&&(m=r[m]),Rs(s,m,Qc(l),l);u=o.slice(-1),a&&a[0]!=="-"&&(c=a,n++)}else if(!o.includes("=")&&a&&a[0]!=="-")u=o.replace(/^-{1,2}/,""),l=Jc(u,i),l==="boolean"?c="true":(c=a,n++);else{let p=o.indexOf("=");p===-1?u=o.replace(/^-{1,2}/,""):(u=o.slice(0,p).replace(/^-{1,2}/,""),c=o.slice(p+1)),l=Jc(u,i)}(!l||l==="boolean")&&u.length>3&&u.startsWith("no-")?Rs(s,u.slice(3),!1):(r&&r[u]!==void 0&&(u=r[u]),Rs(s,u,Zc(c,l)??Qc(l),l))}else if(o){s._.push(Zc(o));continue}}return s}var Jg,Qg,Rs,Jc,Qc,Zc,th=x(()=>{"use strict";Jg=/^(true|false)$/,Qg=/^('|").*\1$/,Rs=(t,e,r,i)=>{if(e.includes(".")){let s=e.split(".");for(let n=0;n<s.length-1;n++){let o=s[n],a={};Rs(t,o,a),t=a}e=s[s.length-1]}i==="array"&&t[e]!==void 0?Array.isArray(t[e])?t[e].push(r):t[e]=[t[e],r]:t[e]=i==="array"?[r]:r},Jc=(t,e)=>{if(e.array&&e.array.length>0&&e.array.includes(t))return"array";if(e.string&&e.string.length>0&&e.string.includes(t))return"string";if(e.boolean&&e.boolean.length>0&&e.boolean.includes(t))return"boolean"},Qc=t=>t==="string"?"":t==="array"?[]:!0,Zc=(t,e)=>e==="string"?t:e==="boolean"?t===void 0?!0:t==="true":t&&(t.length>3&&Jg.test(t)?t==="true":t.length>2&&Qg.test(t)?t.slice(1,-1):t[0]==="."&&/\d/.test(t[1])||/\d/.test(t[0])?Number(t):t)});function Zg(){return process.env.CI==="true"||process.env.CI==="1"||!process.stdout?.isTTY}function at(t,e){let r=["help","yes","json","dry-run",...e.extraBoolean??[]],i=["env",...e.extraString??[]],s={e:"env",h:"help",y:"yes",n:"dry-run",...e.extraAlias??{}},n=Xc(t,{boolean:r,string:i,alias:s});if(Zg()&&!n.yes&&(n.yes=!0),n.help){let o=[...e.options??[],"--dry-run, -n Preview changes without applying them","--yes, -y Skip confirmation prompts (auto-enabled in CI)","--json Output as JSON (for CI/scripts)","--env, -e Environment (production, staging, development)","--help, -h Show this help message"];return console.log(`
98
+ Usage: localesy ${e.name} [options]
99
+
100
+ ${e.description}
101
+
102
+ Options:
103
+ ${o.map(a=>` ${a}`).join(`
104
+ `)}
105
+ `),{args:n,shouldExit:!0}}if(n.env&&(n.env==="staging"||n.env==="production"||n.env==="development")&&xi(n.env),!e.skipIntro&&!n.json){let o=typeof e.label=="function"?e.label(n):e.label,a=o?`${yo.default.magenta("Localesy CLI")} - ${o}`:yo.default.magenta("Localesy CLI");Si(a)}return{args:n,shouldExit:!1}}var yo,le=x(()=>{"use strict";th();ct();yo=G(ot());_t()});async function Do(t){let{poll:e,isComplete:r,onProgress:i,intervalMs:s=2e3}=t,n;do await new Promise(o=>setTimeout(o,s)),n=await e(),i?.(n);while(!r(n));return n}async function ks(t){let{client:e,runId:r,signal:i,spinner:s}=t,n,o=await Do({poll:()=>e.projects.getCreationTaskStatus.query({runId:r},{signal:i}),isComplete:a=>a.isComplete,onProgress:a=>{a.progress?.message&&s.message(`${a.progress.message} (${a.progress.current}%)`),a.projectId&&(n=a.projectId)}});if(!o.success)throw new $(`Project creation failed with status: ${o.status}`);return{projectId:n}}var _s=x(()=>{"use strict";At()});var ih={};Mt(ih,{run:()=>Xg});async function Xg(t){let{args:e,shouldExit:r}=at(t,{name:"init",description:"Initialize Localesy configuration by scanning for translation files",options:["--path, -p Path to the root of your project"],extraString:["path"],extraAlias:{p:"path"}});if(r)return;let i=e.path;O("Welcome to Localesy! Let's get you started...");let s=i?.trim()||(await Nt({message:"Please provide path to the root of your project",initialValue:process.cwd()}))?.trim()||"";if(_(s))throw new Y;let n=(0,Jr.resolve)(process.cwd(),s);O(`Scanning: ${et.default.cyan(n)}`);let o=await hr(n);if(o.length===0)return Xt("No candidate files found, aborting...");let a=await M();a.start(`Analyzing ${o.length} candidate files...`);let l=Pu(),{signal:u,cleanup:c}=Vt(),p;try{p=await l.projects.analyzeLocalFiles.mutate({files:o},{signal:u})}catch(T){throw a.stop("Analysis failed!"),new $(`Failed to analyze files: ${T}`)}finally{c()}if(a.stop(`Analysis complete! Found ${p.roots.length} translation root(s) with ${p.files.length} file(s).`),p.roots.length===0)return Xt("No translation roots detected, aborting...");let m;if(p.roots.length===1)m=p.roots,R.info(`Using ${et.default.cyan(p.roots[0]?.path)} (${p.roots[0]?.fileCount} files)`);else{let T=await Ce({message:"Select translation roots to import:",options:p.roots.map(J=>({value:J.path,label:`${et.default.cyan(J.path)} (${J.fileCount} ${J.fileCount===1?"file":"files"})`}))});if(!Array.isArray(T))return Xt("No selection made, aborting...");m=p.roots.filter(J=>T.includes(J.path))}if(m.length===0)return Xt("No roots selected, aborting...");let f=new Set(m.flatMap(T=>T.filePaths)),h=p.files.filter(T=>f.has(T.filePath));console.clear();for(let T of m){let J=h.filter(ht=>f.has(ht.filePath)&&T.filePaths.includes(ht.filePath)).sort((ht,He)=>ht.displayName.localeCompare(He.displayName)),q=(process.stdout.columns||120)-13,Bt=[Math.floor(q*.3),Math.floor(q*.25),Math.floor(q*.15),Math.floor(q*.15),Math.floor(q*.15)],we=new rh.default({head:[et.default.bold("File"),et.default.bold("Language"),et.default.bold("Locale"),et.default.bold("Keys"),et.default.bold("Size")],colWidths:Bt,style:{head:["cyan"],border:["gray"]}});for(let ht of J)we.push([et.default.cyan(ht.filePath),et.default.gray(ht.displayName),et.default.blue(ht.localeCode),et.default.yellow(ht.keyCount.toString()),et.default.gray(`${ht.sizeKB} KB`)]);O(we.toString(),`${et.default.cyan(T.path)} (${T.fileCount} ${T.fileCount===1?"file":"files"})`)}let d=new Set(h.map(T=>T.localeCode)),y=p.locales.filter(T=>d.has(T.code));if(y.length===0)return Xt("Selected roots contain no recognizable locales, aborting...");let g=await Et({message:"Select source language for your translations",options:y.map(T=>({value:T.code,label:`${T.displayName} (${T.totalKeys} keys)`}))});if(_(g))throw new Y;let D=y.find(T=>T.code===g);O(`Selected source language: ${et.default.green(D?.displayName??g)}`);let v=(0,Jr.basename)(n);try{let T=(0,Jr.resolve)(n,"package.json"),J=(0,eh.readFileSync)(T,"utf8"),st=JSON.parse(J);st.name&&(v=st.name)}catch{}let b=await Nt({message:"What is the name of your project?",initialValue:v});if(_(b))throw new Y;O(`Project name: ${et.default.green(b)}`);let C=`
106
+ Project: ${et.default.bold(b)}
107
+ Path: ${et.default.cyan(n)}
108
+ Source Language: ${et.default.green(D?.displayName??g)}
109
+ Roots: ${m.length}
110
+ Total Files: ${h.length}
111
+ `.trim(),F=await pt({message:"Ready to create your Localesy project?",initialValue:!0});if(!F||_(F)){L(`No worries! Your project analysis is complete. When you're ready to save your project, run the command again.
112
+
113
+ ${C}`);return}O(C,"Project Summary");let{client:E}=await mt(),S=Tt(),{organizationId:k}=await Pr(E,{cachedOrgId:S?.organizationId,message:"Select an organization for this project:"}),z=await pt({message:"Ready to create your project?",initialValue:!0});if(!z||_(z))throw new Y("Project creation cancelled");let N=await Iu()??"main",Z=await M();Z.start("Creating project...");let{signal:W,cleanup:it}=Vt();try{let T=m.map(q=>q.path),J=o.filter(q=>f.has(q.filePath));console.log(`Uploading project: ${T.length} root(s) / ${J.length} files...`);let st=await E.projects.createProjectFromLocalFiles.mutate({projectName:b,organizationId:k,sourceLocaleCode:g,translationsBranch:N,selectedDirectories:T,files:J},{signal:W});if(!st?.runId)throw Z.stop("Failed!"),new $("Failed to start project creation task");Z.message("Project creation started, waiting for completion...");let{projectId:A}=await ks({client:E,runId:st.runId,signal:W,spinner:Z});Z.stop("Done!"),A&&(hl({organizationId:k,projectId:A,rootPath:n},n),R.info(`Created ${et.default.cyan(".localesy.json")} in your project root`)),L(`Your project has been created! Visit: ${et.default.cyan(`${tt()}/projects/${A??"unknown"}`)}`)}catch(T){throw Z.stop("Failed!"),T instanceof $?T:new $(`Project creation failed: ${T}`)}finally{it()}}var eh,Jr,rh,et,sh=x(()=>{"use strict";eh=require("fs"),Jr=require("path");ct();rh=G(Ti()),et=G(ot());_t();Ze();Ne();cs();me();Lu();Ts();pr();At();le();_s()});async function Os(t){try{let{stdout:e}=await t0("git",["hash-object",t]),r=e.trim();if(r.length===40)return r;throw new Error("Invalid SHA length")}catch{let e=await(0,ah.readFile)(t,"utf8"),r=Buffer.from(e,"utf8"),i=`blob ${r.length}\0`,s=Buffer.concat([Buffer.from(i,"utf8"),r]);return(0,oh.createHash)("sha1").update(new Uint8Array(s)).digest("hex")}}var nh,oh,ah,lh,t0,wo=x(()=>{"use strict";nh=require("child_process"),oh=require("crypto"),ah=require("fs/promises"),lh=require("util"),t0=(0,lh.promisify)(nh.execFile)});function uh(t,e){let r=[];for(let i of t){let s=e.get(i.filePath);s!==void 0&&r.push({filePath:i.filePath,content:s,fileSetId:i.fileSetId})}return r}var ch=x(()=>{"use strict"});async function ke(t){let{client:e,projectId:r,absolutePath:i,signal:s}=t,n=await hr(i),o=new Map(n.map(u=>[u.filePath,u.content])),{matched:a,missingFiles:l}=await e.projects.matchProjectFiles.query({projectId:r,filePaths:n.map(u=>u.filePath)},{signal:s});return{files:uh(a,o),missingFiles:l}}var Qr=x(()=>{"use strict";ch();Ts()});async function bo(t){let{client:e,projectId:r,absolutePath:i,lastSyncedShas:s,lastSyncedAt:n,signal:o}=t,{files:a}=await ke({client:e,projectId:r,absolutePath:i,signal:o}),l=[];for(let c of a)try{let p=await Os((0,hh.join)(i,c.filePath));l.push({filePath:c.filePath,sha:p})}catch{}let u=await e.projects.compareLocalFiles.mutate({projectId:r,localFiles:l,lastSyncedShas:s,lastSyncedAt:n},{signal:o});return{status:u.status,files:u.files.map(c=>({filePath:c.filePath,localeCode:c.localeCode,changeType:c.changeType,backendUpdatedAt:c.backendUpdatedAt})),summary:u.summary,localOnlyFiles:u.localOnlyFiles,newLocaleFiles:u.newLocaleFiles,renames:u.renames}}var hh,ph=x(()=>{"use strict";hh=require("path");wo();Qr()});function Xr(t,e){let r=(0,Zr.resolve)(t),i=(0,Zr.resolve)(r,e);if(i!==r&&!i.startsWith(r+Zr.sep))throw new $(`Refusing to write outside the project directory: ${e}`);return i}var Zr,vo=x(()=>{"use strict";Zr=require("path");At()});async function ti(t){let{client:e,projectId:r,absolutePath:i,signal:s,dryRun:n}=t,o=await M();o.start(n?"Fetching translation file list...":"Pulling translations...");let{files:a}=await e.projects.getFormattedTranslationFiles.query({projectId:r},{signal:s}),l=[];if(n){for(let c of a)l.push(Xr(i,c.filePath));o.stop(`Found ${l.length} translation files`);let u=l.map(c=>` ${c}`).join(`
114
+ `);return R.info(`Would write ${l.length} files:
115
+
116
+ ${u}`),{writtenFiles:l}}for(let u of a){let c=Xr(i,u.filePath),p=(0,fh.dirname)(c);(0,js.mkdirSync)(p,{recursive:!0}),(0,js.writeFileSync)(c,u.content,"utf-8"),l.push(c)}return o.stop(`Pulled ${l.length} translation files`),{writtenFiles:l}}var js,fh,dh=x(()=>{"use strict";js=require("fs"),fh=require("path");ct();vo()});function Co(t,e){return e?`${e} ${fr.default.cyan(t)}`:fr.default.cyan(t)}function Jt(t,e="(deleted)"){return t===null?fr.default.dim(e):t===""?fr.default.dim("(empty)"):fr.default.yellow(`"${t}"`)}var fr,ei=x(()=>{"use strict";fr=G(ot())});function Ke(t){return`${t.filePath}::${t.localeCode}::${t.key}`}function mh(t,e){switch(e.type){case"local":return t.branchValue;case"remote":return t.canonicalValue;case"edit":return e.value;case"skip":return}}function e0(t){return` base: ${Jt(t.baseValue)}
117
+ local: ${Jt(t.branchValue)}
118
+ remote: ${Jt(t.canonicalValue)}`}async function gh(t){let e=new Map;if(t.length===0)return{choices:e,aborted:!1};let r=[{value:"one-by-one",label:"Resolve one by one",hint:`${t.length} conflict${t.length===1?"":"s"}`},{value:"all-local",label:"Take local for all",hint:"overwrites remote with your values"},{value:"all-remote",label:"Take remote for all",hint:"discards your local changes for these keys"},{value:"abort",label:"Abort push"}],i=await Et({message:`${t.length} conflict${t.length===1?"":"s"} to resolve. How would you like to proceed?`,options:r,initialValue:"one-by-one"});if(_(i)||i==="abort")return{choices:e,aborted:!0};if(i==="all-local"){for(let n of t)e.set(Ke(n),{type:"local"});return{choices:e,aborted:!1}}if(i==="all-remote"){for(let n of t)e.set(Ke(n),{type:"remote"});return{choices:e,aborted:!1}}let s=0;for(;s<t.length;){let n=t[s],o=Is.default.cyan(`[${s+1}/${t.length}] `)+Is.default.bold(n.key)+Is.default.dim(` - ${n.filePath} (${n.localeCode})`);O(`${o}
119
+ ${e0(n)}`,"Conflict");let a=e.get(Ke(n)),l=a?.type==="edit"?"edit":a?.type==="local"?"local":a?.type==="remote"?"remote":a?.type==="skip"?"skip":"local",u=[{value:"local",label:"Take local",hint:"push your value"},{value:"remote",label:"Take remote",hint:"keep what is on Localesy"},{value:"edit",label:"Edit",hint:"enter a custom value"},{value:"skip",label:"Skip",hint:"leave this key for next time"},...s>0?[{value:"back",label:"\u2190 Go back",hint:"revisit the previous conflict"}]:[],{value:"abort",label:"Abort push"}],c=await Et({message:"Which value wins?",options:u,initialValue:l});if(_(c)||c==="abort")return{choices:e,aborted:!0};if(c==="back"){s--;continue}if(c==="edit"){let m=(a?.type==="edit"?a.value:null)??n.branchValue??n.canonicalValue??"",f=await Nt({message:"New value:",initialValue:m,placeholder:m});if(_(f))return{choices:e,aborted:!0};let h=f===""&&(n.branchValue===null||n.canonicalValue===null)?null:f;e.set(Ke(n),{type:"edit",value:h})}else e.set(Ke(n),{type:c});s++}return{choices:e,aborted:!1}}var Is,yh=x(()=>{"use strict";ct();Is=G(ot());ei()});function r0(t){return` current value at ${dr.default.cyan(`"${t.oldKey}"`)}: ${Jt(t.oldKeyValue,"(missing)")}
120
+ existing value at ${dr.default.cyan(`"${t.newKey}"`)}: ${Jt(t.targetExistingValue,"(missing)")}`}async function Dh(t){if(t.length===0)return{resolutions:[],aborted:!1};let e=await Et({message:`${t.length} rename collision${t.length===1?"":"s"} detected. How would you like to proceed?`,options:[{value:"one-by-one",label:"Resolve one by one",hint:`${t.length} collision${t.length===1?"":"s"}`},{value:"skip-all",label:"Skip all renames",hint:"leave existing target keys untouched in colliding files"},{value:"overwrite-all",label:"Overwrite all targets",hint:"replace existing target values with the renamed value"},{value:"abort",label:"Abort push"}],initialValue:"one-by-one"});if(_(e)||e==="abort")return{resolutions:[],aborted:!0};if(e==="skip-all")return{resolutions:t.map(s=>({...Eo(s),action:"skip"})),aborted:!1};if(e==="overwrite-all")return{resolutions:t.map(s=>({...Eo(s),action:"overwrite"})),aborted:!1};let r=new Array(t.length),i=0;for(;i<t.length;){let s=t[i],n=dr.default.cyan(`[${i+1}/${t.length}] `)+dr.default.bold(`${s.oldKey} \u2192 ${s.newKey}`)+dr.default.dim(` - ${s.filePath} (${s.localeCode})`);O(`${n}
121
+ ${r0(s)}`,"Rename Collision");let o=r[i],a=o?.action==="overwrite"?"overwrite":o&&typeof o.action=="object"&&o.action.kind==="custom"?"edit":"skip",l=[{value:"skip",label:"Keep existing target value",hint:`leave "${s.newKey}" as-is, drop "${s.oldKey}"`},{value:"overwrite",label:"Use renamed value",hint:`overwrite "${s.newKey}" with "${s.oldKey}"'s value`},{value:"edit",label:"Edit",hint:"enter a custom value for the target"},...i>0?[{value:"back",label:"\u2190 Go back",hint:"revisit the previous collision"}]:[],{value:"abort",label:"Abort push"}],u=await Et({message:`What should "${s.newKey}" be in ${s.filePath}?`,options:l,initialValue:a});if(_(u)||u==="abort")return{resolutions:[],aborted:!0};if(u==="back"){i--;continue}let c=await(async()=>{if(u==="skip")return"skip";if(u==="overwrite")return"overwrite";let m=(o&&typeof o.action=="object"&&o.action.kind==="custom"?o.action.value:null)??s.oldKeyValue??s.targetExistingValue??"",f=await Nt({message:`New value for "${s.newKey}":`,initialValue:m,placeholder:m});return _(f)?null:{kind:"custom",value:f}})();if(c===null)return{resolutions:[],aborted:!0};r[i]={...Eo(s),action:c},i++}return{resolutions:r.filter(Boolean),aborted:!1}}function Eo(t){return{filePath:t.filePath,localeCode:t.localeCode,oldKey:t.oldKey,newKey:t.newKey}}var dr,wh=x(()=>{"use strict";ct();dr=G(ot());ei()});function bh(t,e,r){return[...t].sort((i,s)=>{let n=e(i),o=e(s);if(r){if(n===r)return-1;if(o===r)return 1}return n.localeCompare(o)})}async function vh(t){let{client:e,project:r,projectId:i,absolutePath:s,signal:n,changedFilePaths:o,yes:a,dryRun:l}=t,u=new Set,c=new Set;for(let P of r.translationFileSets??[])for(let U of P.translationFiles??[])U?.filePath&&u.add(U.filePath),U?.localeCode&&c.add(U.localeCode);if(u.size===0&&(r.translationFileSets?.length??0)===0)return R.warning("No translation file sets found in this project. Run `localesy init` first."),null;let p=await M();p.start("Scanning local files...");let{files:m,missingFiles:f}=await ke({client:e,projectId:i,absolutePath:s,signal:n}),h=o?new Set(o):null,d=m.filter(P=>{let U=u.has(P.filePath);return!h||!U?!0:h.has(P.filePath)});if(d.length===0)if(p.stop("No files to push"),o!==void 0&&o.length===0){if(R.info(lt.default.green("All files are in sync with Localesy. Nothing to push.")),l)return null;let U=a||await pt({message:"Push all files anyway?",initialValue:!1});if(!U||_(U))return null}else return p.stop("No files match registered patterns"),await a0({client:e,projectId:i,absolutePath:s,signal:n,yes:a,dryRun:l}),null;let y;try{y=await e.projects.analyzeLocalFiles.mutate({files:d.map(P=>({filePath:P.filePath,content:P.content}))},{signal:n})}catch(P){throw p.stop("Analysis failed!"),P}p.stop(`Found ${y.files.length} files locally`),f.length>0&&O(`Missing files (registered in project but not on disk):
122
+
123
+ ${f.map(P=>` ${lt.default.yellow("\u2022")} ${P}`).join(`
124
+ `)}`,"Warning");let g=y.files.filter(P=>P.isRecognized&&!c.has(P.localeCode)),D=new Set;if(g.length>0&&l)for(let P of g)D.add(P.filePath);if(g.length>0&&!l){let P=new Map;for(let nt of g){let si=P.get(nt.localeCode)??[];si.push(nt),P.set(nt.localeCode,si)}let U=Array.from(P.entries()).map(([nt,si])=>{let tp=y.locales.find(Vs=>Vs.code===nt)?.displayName??nt,ep=si.map(Vs=>Vs.filePath).join(", ");return{value:nt,label:`${lt.default.cyan("NEW")} ${tp}`,hint:ep}});O(`These locale files exist on disk but aren't in the project yet:
125
+
126
+ ${g.map(nt=>` ${lt.default.cyan("+")} ${nt.filePath} (${nt.localeCode})`).join(`
127
+ `)}`,"New Locales Detected");let X=a?U.map(nt=>nt.value):await Ce({message:"Which new locales should we add to the project?",options:U,initialValues:U.map(nt=>nt.value),required:!1});if(_(X))return null;let Oe=new Set(X);for(let nt of g)Oe.has(nt.localeCode)&&D.add(nt.filePath)}let v=o!==void 0&&o.length>0,b=y.files.filter(P=>P.isRecognized?c.has(P.localeCode)?!0:D.has(P.filePath):!1);if(b.length===0)return R.warning("Nothing to push."),null;let C=r.sourceTranslationLocaleCode??null,F=bh(b,P=>P.localeCode,C),E=bh(y.locales.filter(P=>b.some(U=>U.localeCode===P.code)),P=>P.code,C);if(l){let P=F.reduce((X,Oe)=>X+Oe.keyCount,0),U=F.map(X=>` ${!c.has(X.localeCode)?`${lt.default.cyan("[NEW] ")}`:""}${lt.default.cyan(X.filePath)} (${X.localeCode}, ${X.keyCount} keys)`).join(`
128
+ `);return R.info(`Would push ${F.length} files (${P} keys) to Localesy:
129
+
130
+ ${U}`),null}let S=v&&b.length<=10,k;if(S){let P=a?F.map(U=>U.filePath):await Ce({message:"Select files to push:",options:F.map(U=>{let Oe=!c.has(U.localeCode)?`${lt.default.cyan("[NEW] ")}`:"";return{value:U.filePath,label:`${Oe}${U.filePath} (${U.localeCode}, ${U.keyCount} keys)`}}),initialValues:F.map(U=>U.filePath)});if(_(P))return null;k=new Set(P)}else{let P=a?E.map(X=>X.code):await Ce({message:"Select languages to push:",options:E.map(X=>{let nt=!c.has(X.code)?`${lt.default.cyan("[NEW] ")}`:"";return{value:X.code,label:`${nt}${X.displayName} (${X.totalKeys} keys)`}}),initialValues:E.map(X=>X.code)});if(_(P))return null;let U=new Set(P);k=new Set(F.filter(X=>U.has(X.localeCode)).map(X=>X.filePath))}if(k.size===0)return R.warning("No files selected to push."),null;let z=d.filter(P=>k.has(P.filePath)),N=z.map(P=>` ${lt.default.cyan(P.filePath)}`).join(`
131
+ `),Z=a||await pt({message:`Push ${z.length} translation file(s) to Localesy?
132
+
133
+ ${N}
134
+ `,initialValue:!0});if(!Z||_(Z))return null;let W=await M();W.start("Computing diff against Localesy...");let T=(await e.translations.listSnapshots.query({projectId:String(i),limit:1},{signal:n})).snapshots[0]?.id??null,J=await e.translations.computePushDiff.mutate({projectId:String(i),baseSnapshotId:T,localFiles:z.map(P=>({filePath:P.filePath,content:P.content,fileSetId:P.fileSetId}))},{signal:n}),{cleanHunks:st,conflicts:A,newFileChanges:q}=J,Bt=J.renameCollisions??[];W.stop("Diff computed");let we=await i0(Bt,a),ht=await s0(A,a),He=ht.filter(P=>P.finalValue!==void 0).length;if(st.length+He+q.length===0)return W.stop("Already up to date"),R.info(lt.default.green("No changes to push.")),{updatedCount:0,skippedCount:0,results:z.map(P=>({filePath:P.filePath,status:"in_sync"}))};W=await M(),W.start("Applying changes...");let zs=[...q,...st];await e.translations.updateManyWithDiff.mutate({projectId:String(i),changes:zs,expectedBaseSnapshotId:T,...we.length>0?{renameResolutions:we}:{},...ht.length>0?{conflictResolutions:ht}:{}},{signal:n});let Qt=new Set;for(let P of st)Qt.add(P.filePath);for(let P of ht)P.finalValue!==void 0&&Qt.add(P.filePath);for(let P of q)(P.type==="FILE_ADDED"||P.type==="KEY_ADDED")&&P.filePath&&Qt.add(P.filePath);let ii=o0(st),Qh=ii.total+He,Us=q.filter(P=>P.type==="FILE_ADDED").length,Zh=Us>0?` (${Us} new file${Us===1?"":"s"})`:"",Xh=ii.renamed>0?` (${ii.renamed} rename${ii.renamed===1?"":"s"})`:"";return W.stop(`Pushed ${Qh} change(s) across ${Qt.size} file(s)${Zh}${Xh}`),{updatedCount:Qt.size,skippedCount:0,results:Array.from(Qt).map(P=>({filePath:P,status:"updated"}))}}async function i0(t,e){if(t.length===0)return[];if(!(!e&&process.stdout?.isTTY===!0)){let u=t.map(c=>` ${lt.default.yellow("\u2022")} ${c.oldKey} \u2192 ${c.newKey} in ${c.filePath} (${c.localeCode})`).join(`
135
+ `);throw new Error(`Push aborted: ${t.length} rename collision(s) found:
136
+
137
+ ${u}
138
+
139
+ Re-run interactively (without --yes / outside CI) to resolve them, or fix the colliding keys locally.`)}let i=await Dh(t);if(i.aborted)throw new Error(`Push aborted: ${t.length} rename collision(s) left unresolved.`);let s=i.resolutions,n=s.filter(u=>u.action==="skip").length,o=s.filter(u=>u.action==="overwrite").length,a=s.filter(u=>typeof u.action=="object"&&u.action.kind==="custom").length,l=[];return n>0&&l.push(`${n} skipped`),o>0&&l.push(`${o} overwritten`),a>0&&l.push(`${a} custom`),R.info(lt.default.green(`Resolved ${s.length} of ${t.length} rename collision(s)`+(l.length>0?` (${l.join(", ")})`:""))),s}async function s0(t,e){if(t.length===0)return[];if(n0(t),!(!e&&process.stdout?.isTTY===!0))throw new Error(`Push aborted: ${t.length} conflict(s) found. Run \`localesy pull\` to get the latest changes, resolve locally, and push again. Re-run interactively (without --yes / outside CI) to resolve conflicts in place.`);let i=await gh(t);if(i.aborted)throw new Error(`Push aborted: ${t.length} conflict(s) left unresolved. Re-run \`localesy push\` to try again, or \`localesy pull\` to take remote.`);let s=t.map(l=>{let u=i.choices.get(Ke(l)),c=u?mh(l,u):void 0;return{filePath:l.filePath,localeCode:l.localeCode,key:l.key,...c!==void 0?{finalValue:c}:{}}}),n=s.filter(l=>l.finalValue!==void 0).length,o=s.length-n,a=o>0?` (${o} left unchanged on remote)`:"";return R.info(lt.default.green(`Resolved ${n} of ${t.length} conflict(s)${a}`)),s}function n0(t){let e=new Map;for(let i of t){let s=`${i.filePath} (${i.localeCode})`,n=e.get(s)??[];n.push(i),e.set(s,n)}let r=[];for(let[i,s]of e){let n=s.map(o=>` ${lt.default.yellow("\u2717")} ${lt.default.bold(o.key)}
140
+ base: ${Jt(o.baseValue)}
141
+ local: ${Jt(o.branchValue)}
142
+ remote: ${Jt(o.canonicalValue)}`);r.push(`${lt.default.cyan(i)}
143
+ ${n.join(`
144
+
145
+ `)}`)}O(r.join(`
146
+
147
+ `),"Conflicts")}function o0(t){let e={added:0,updated:0,deleted:0,renamed:0};for(let r of t)r.type==="KEY_ADDED"?e.added++:r.type==="KEY_UPDATED"?e.updated++:r.type==="KEY_DELETED"?e.deleted++:r.type==="KEY_RENAMED"&&e.renamed++;return{...e,total:e.added+e.updated+e.deleted+e.renamed}}async function a0(t){let{client:e,projectId:r,absolutePath:i,signal:s,yes:n,dryRun:o}=t,a=await M();a.start("Checking for layout changes...");let l=await hr(i);if(l.length===0){a.stop("No translation files found on disk"),R.warning("No translation files found locally.");return}let u=await e.projects.detectProjectLayoutDrift.query({projectId:String(r),files:l},{signal:s});if(!u.hasDrift){a.stop("No layout changes detected"),R.warning("No translation files found locally that match the project layout.");return}a.stop("Layout change detected");let c=u.registeredPatterns.map(h=>` ${lt.default.dim("\u2022")} ${h}`).join(`
148
+ `),p=u.detectedPatterns.map(h=>` ${lt.default.cyan("\u2022")} ${h}`).join(`
149
+ `);if(O(`Registered patterns:
150
+ ${c}
151
+
152
+ Detected on disk:
153
+ ${p}
154
+
155
+ ${lt.default.yellow(`${u.candidateFileCount} candidate file(s) on disk, ${u.matchesRegistered} match the registered patterns.`)}`,"Layout change"),o){R.info("Dry run - skipping layout replace prompt.");return}let m=n||await pt({message:"Reset the project to match the detected layout? (destructive - replaces registered file sets)",initialValue:!1});if(!m||_(m)){R.info("Layout left as-is. Re-run `localesy push` once your files match the registered patterns.");return}let f=await M();f.start("Replacing project layout...");try{let h=await e.projects.replaceProjectLayout.mutate({projectId:String(r),files:l},{signal:s});f.stop(`Layout replaced (${h.createdFileSetsCount} file set(s), ${h.createdFilesCount} file(s)).`)}catch(h){throw f.stop("Replace failed!"),h}R.success("Re-run `localesy push` to push translations against the new layout.")}var lt,Ch=x(()=>{"use strict";ct();lt=G(ot());ei();Qr();Ts();yh();wh()});var xh={};Mt(xh,{run:()=>ri});async function ri(t){let{args:e,shouldExit:r}=at(t,{name:"sync",description:"Sync translations between local files and Localesy (push then pull by default)",label:d=>d["push-only"]?"Push Translations":d["pull-only"]?"Pull Translations":"Sync Translations",options:["--push-only Only push local translations to Localesy","--pull-only Only pull translations from Localesy to local files","--force, -f Skip sync status check and force the operation"],extraBoolean:["push-only","pull-only","force"],extraAlias:{f:"force"}});if(r)return;let i=e["push-only"]===!0,s=e["pull-only"]===!0,n=e.force===!0,o=e["dry-run"]===!0;if(i&&s)throw new $("Cannot use --push-only and --pull-only together");let{client:a}=await mt(),{projectId:l,rootPath:u}=await ee(a,{withRootPath:!0}),c=(0,Sh.resolve)(process.cwd(),u),m=(Tt()??{}).lastSyncedShas??{},{signal:f,cleanup:h}=Vt();try{if(s){await l0({client:a,projectId:l,absolutePath:c,signal:f,dryRun:o});return}let d=await M();d.start("Fetching project details...");let y;try{y=(await a.projects.getWithTranslations.query({projectId:l,includeTranslationValue:!1,includeTranslationStats:!1},{signal:f})).project,d.stop("Project details loaded!")}catch(C){throw d.stop("Failed to fetch project details"),C}let g=await u0({client:a,project:y,projectId:l,absolutePath:c,lastSyncedShas:m,signal:f,force:n,pushOnly:i,dryRun:o,yes:e.yes});if(!g.proceed)return;let{changedFilePaths:D,pendingRenames:v}=g;v.length>0&&!o&&await c0({client:a,projectId:l,renames:v,yes:e.yes===!0,signal:f});let b=await vh({client:a,project:y,projectId:l,absolutePath:c,signal:f,changedFilePaths:D,yes:e.yes,dryRun:o});if(i){if(!o&&b){let C=b.results.filter(F=>F.status==="success"||F.status==="updated").map(F=>F.filePath);await Ls(c,C)}o?L("Dry run complete. No changes were made."):b?L(`Translations pushed successfully!
156
+
157
+ View your project: ${ut.default.cyan(`${tt()}/projects/${l}`)}`):L("Push cancelled.");return}if(o){await ti({client:a,projectId:l,absolutePath:c,signal:f,dryRun:o}),L("Dry run complete. No changes were made.");return}if(b){let C=await ti({client:a,projectId:l,absolutePath:c,signal:f}),F=b.results.filter(k=>k.status==="success"||k.status==="updated").map(k=>k.filePath),E=[...new Set([...F,...C.writtenFiles])];await Ls(c,E);let S=C.writtenFiles.map(k=>` ${ut.default.cyan(k)}`).join(`
158
+ `);L(`Sync complete!
159
+
160
+ Pushed ${b.updatedCount} files, pulled ${C.writtenFiles.length} files:
161
+
162
+ ${S}
163
+
164
+ Run ${ut.default.cyan("git diff")} to see the changes.`)}else L("Push was skipped. No pull performed.")}catch(d){throw d instanceof $?d:new $(`Sync failed: ${d}`)}finally{h()}}async function l0(t){let{client:e,projectId:r,absolutePath:i,signal:s,dryRun:n}=t,o=await ti({client:e,projectId:r,absolutePath:i,signal:s,dryRun:n});if(n){L("Dry run complete. No changes were made.");return}await Ls(i,o.writtenFiles);let a=o.writtenFiles.map(l=>` ${ut.default.cyan(l)}`).join(`
165
+ `);L(`Translations saved:
166
+
167
+ ${a}
168
+
169
+ Run ${ut.default.cyan("git diff")} to see the changes.`)}async function u0(t){let{client:e,project:r,projectId:i,absolutePath:s,lastSyncedShas:n,signal:o,force:a,pushOnly:l,dryRun:u,yes:c}=t,p=(r.translationFileSets?.length??0)>0;if(a||l||!p)return{proceed:!0,changedFilePaths:void 0,pendingRenames:[]};let m=await M();m.start("Checking sync status...");let f=await bo({client:e,projectId:i,absolutePath:s,lastSyncedShas:n,signal:o});m.stop("Sync status checked!");let h=f.renames,d=Eh(f);if(f.status==="remote_ahead"){let y=f.summary.remoteChanged+f.summary.remoteOnly;O(`${ut.default.cyan("Localesy has newer changes!")}
170
+
171
+ ${ut.default.gray("\u2022")} ${y} file(s) have changes on Localesy that are not in your local files.
172
+
173
+ You can:
174
+ ${ut.default.cyan("1.")} Pull first to get the latest changes
175
+ ${ut.default.cyan("2.")} Push anyway (will overwrite remote changes)
176
+ ${ut.default.cyan("3.")} Cancel and review the changes`,"Sync Status");let g=c||u?"pull-first":await Et({message:"What would you like to do?",options:[{value:"pull-first",label:"Pull from Localesy first",hint:"recommended"},{value:"push-anyway",label:"Push anyway",hint:"will overwrite remote changes"},{value:"cancel",label:"Cancel"}]});if(_(g)||g==="cancel")return L("Sync cancelled."),{proceed:!1};if(g==="pull-first"){let D=await ti({client:e,projectId:i,absolutePath:s,signal:o,dryRun:u});u||await Ls(s,D.writtenFiles);let v=D.writtenFiles.map(b=>` ${ut.default.cyan(b)}`).join(`
177
+ `);if(R.info(`${u?"Would pull":"Pulled"} ${D.writtenFiles.length} files:
178
+
179
+ ${v}`),!u){let b=await bo({client:e,projectId:i,absolutePath:s,lastSyncedShas:Tt()?.lastSyncedShas??{},signal:o});if(h=b.renames,b.status==="in_sync")return L(`Sync complete! Pulled ${D.writtenFiles.length} files.
180
+
181
+ Run ${ut.default.cyan("git diff")} to see the changes.`),{proceed:!1};if(d=Eh(b),d.length>0)R.info(`Found ${d.length} local changes to push...
182
+ `);else if(h.length===0)return L(`Sync complete! Pulled ${D.writtenFiles.length} files.
183
+
184
+ Run ${ut.default.cyan("git diff")} to see the changes.`),{proceed:!1}}}}else if(f.status==="diverged"){let y=f.summary.localChanged+f.summary.bothChanged,g=f.summary.remoteChanged+f.summary.bothChanged;if(O(`${ut.default.yellow("Both local and remote have changes!")}
185
+
186
+ ${ut.default.yellow("\u2022")} ${y} file(s) changed locally
187
+ ${ut.default.cyan("\u2022")} ${g} file(s) changed on Localesy
188
+
189
+ Pushing will overwrite remote changes. Consider pulling first to review.`,"Sync Status"),!u){let D=c||await pt({message:"Continue with push?",initialValue:!1});if(!D||_(D))return L("Sync cancelled. Run `localesy sync --pull-only` to pull remote changes first."),{proceed:!1}}}else if(f.status==="in_sync")return L(ut.default.green("Local files are already in sync with Localesy")),{proceed:!1};return{proceed:!0,changedFilePaths:d,pendingRenames:h}}function Eh(t){let e=t.files.filter(i=>i.changeType==="local_changed"||i.changeType==="both_changed").map(i=>i.filePath),r=t.newLocaleFiles.map(i=>i.filePath);return[...new Set([...e,...t.localOnlyFiles,...r])]}async function c0(t){let{client:e,projectId:r,renames:i,yes:s,signal:n}=t,o=i.map(c=>` ${ut.default.red(c.oldPath)} \u2192 ${ut.default.green(c.newPath)}`).join(`
190
+ `);O(o,"Detected file path renames:");let a=s?!0:await pt({message:`Update ${i.length} file path(s) in Localesy?`,initialValue:!0});if(!a||_(a)){R.info("Skipped renames, continuing...");return}let l=await M();l.start("Syncing file paths...");let u=await e.projects.syncFilePaths.mutate({projectId:r,fileMappings:i.map(c=>({localeCode:c.localeCode,translationFileSetId:c.fileSetId,newFilePath:c.newPath}))},{signal:n});l.stop(`Updated ${u.updatedCount} file path(s)`),u.errors.length>0&&O(u.errors.join(`
191
+ `),"Warnings")}async function Ls(t,e){let r=Tt()??{},i=r.lastSyncedShas??{};for(let s of e){let n=s.startsWith(t)?s.slice(t.length+1):s;try{let o=s.startsWith(t)?s:`${t}/${n}`,a=await Os(o);i[n]=a}catch{}}pe({...r,lastSyncedShas:i})}var Sh,ut,Bs=x(()=>{"use strict";Sh=require("path");ct();ut=G(ot());_t();Ze();Ne();me();ph();dh();Ch();pr();At();wo();le()});var Fh={};Mt(Fh,{run:()=>h0});async function h0(t){await ri(["--push-only",...t])}var $h=x(()=>{"use strict";Bs()});var Ph={};Mt(Ph,{run:()=>p0});async function p0(t){await ri(["--pull-only",...t])}var Ah=x(()=>{"use strict";Bs()});var Th={};Mt(Th,{run:()=>f0});async function f0(t){let{shouldExit:e}=at(t,{name:"translate",description:"Translate missing keys in your local translation files",label:"Translate"});if(e)return;let{client:r}=await mt(),{projectId:i,rootPath:s}=await ee(r,{withRootPath:!0}),n=(0,Ns.resolve)(process.cwd(),s),{signal:o,cleanup:a}=Vt();try{let l=await M();l.start("Loading project details...");let u;try{u=(await r.projects.getWithTranslations.query({projectId:i,includeTranslationValue:!1,includeTranslationStats:!1},{signal:o})).project,l.stop("Project loaded!")}catch(A){throw l.stop("Failed!"),new $(`Failed to load project: ${A}`)}let c=u.sourceTranslationLocaleCode??"en_US",p=await M();p.start("Scanning local translation files...");let{files:m,missingFiles:f}=await ke({client:r,projectId:i,absolutePath:n,signal:o});if(p.stop(`Found ${m.length} local files`),f.length>0&&R.warning(`${f.length} files missing locally: ${f.slice(0,3).join(", ")}${f.length>3?"...":""}`),m.length===0)throw new $("No translation files found locally");let h=await M();h.start("Analyzing files against Localesy...");let d;try{d=await r.translations.analyzeFullBranchFiles.mutate({projectId:i,files:m},{signal:o}),h.stop("Analysis complete!")}catch(A){throw h.stop("Failed!"),new $(`Failed to analyze files: ${A}`)}let{source:y,targets:g}=d;(y.newKeys>0||y.updatedKeys>0)&&O(`${_e.default.green(`+${y.newKeys} new`)} ${_e.default.yellow(`~${y.updatedKeys} updated`)} ${_e.default.red(`-${y.deletedKeys} deleted`)}`,`Source Changes (${c})`);let D=g.filter(A=>A.missingKeys>0);if(D.length===0){L(_e.default.green("All translations are up to date!"));return}let v=D.reduce((A,q)=>A+q.missingKeys,0);O(D.map(A=>`${A.label}: ${_e.default.red(`${A.missingKeys} missing`)}`).join(`
192
+ `),`Missing Translations (${v} total keys)`);let b=await Ce({message:"Select languages to translate:",options:D.map(A=>({value:A.localeCode,label:A.label,hint:`${A.missingKeys} missing keys`})),initialValues:D.map(A=>A.localeCode)});if(_(b))throw new Y;if(b.length===0)throw new Y("No languages selected");let C=b,E=D.filter(A=>C.includes(A.localeCode)).reduce((A,q)=>A+q.missingKeys,0),S=await pt({message:`Translate ${E} keys across ${b.length} language(s)?`,initialValue:!0});if(!S||_(S))throw new Y;let k=await M();k.start("Starting AI translation...");let z;try{z=(await r.translations.translateFullFiles.mutate({projectId:i,sourceLocaleCode:c,targetLocaleCodes:C,files:m},{signal:o})).runId}catch(A){throw k.stop("Failed!"),new $(`Failed to start translation: ${A}`)}let N;try{N=await Do({poll:()=>r.translations.getTranslateBranchTaskStatus.query({runId:z},{signal:o}),isComplete:A=>A.isComplete,onProgress:A=>{if(!A.progress?.message)return;let{current:q=0,total:Bt=0,skipped:we=0,totalKeys:ht=0,message:He,stage:Ws}=A.progress,zs=Bt>0?Math.round(q/Bt*100):0,Qt=[He];Ws==="translating"&&ht>0&&Qt.push(`${ht} keys so far`),Ws==="translating"&&we>0&&Qt.push(`${we} skipped`),k.message(`${Qt.join(" \xB7 ")} (${zs}%)`)}})}catch(A){throw k.stop("Failed!"),A instanceof $?A:new $(`Failed to poll translation status: ${A}`)}if(!N.success)throw k.stop("Failed!"),new $(`Translation failed with status: ${N.status}`);k.stop("Translation complete!");let Z=N.files??[];for(let A of Z){let q=Xr(n,A.filePath),Bt=(0,Ns.dirname)(q);(0,Ms.mkdirSync)(Bt,{recursive:!0}),(0,Ms.writeFileSync)(q,A.content,"utf-8")}let W=Z.filter(A=>A.localeCode===c),it=Z.filter(A=>A.localeCode!==c),T=it.map(A=>{let q=g.find(Bt=>Bt.localeCode===A.localeCode);return` ${Co(A.filePath,q?.emoji)}`}).join(`
193
+ `),J=W.map(A=>{let q=g.find(Bt=>Bt.localeCode===c);return` ${Co(A.filePath,q?.emoji)} ${_e.default.gray("(formatted)")}`}).join(`
194
+ `),st=[`Wrote ${it.length} translation files:
195
+
196
+ ${T}`];W.length>0&&st.push(`Applied formatting to source:
197
+
198
+ ${J}`),st.push(`Run ${_e.default.cyan("git diff")} to review your changes.`),L(st.join(`
199
+
200
+ `))}finally{a()}}var Ms,Ns,_e,Rh=x(()=>{"use strict";Ms=require("fs"),Ns=require("path");ct();_e=G(ot());Ne();me();Qr();pr();At();ei();vo();le();_s()});var kh={};Mt(kh,{run:()=>d0});async function d0(t){let{shouldExit:e}=at(t,{name:"new",description:"Create a new language, project, or organization",label:"Create New"});if(e)return;let r=await Et({message:"What would you like to create?",options:[{value:"language",label:"New language"},{value:"project",label:"New project"},{value:"organization",label:"New organization"}]});if(_(r))throw new Y;let{client:i}=await mt();if(r==="organization"){await m0(i);return}if(r==="project"){await g0(i);return}await y0(i)}async function m0(t){let e=await Nt({message:"What is the name of your organization?"});if(_(e))throw new Y;let r=await M();r.start("Creating organization...");try{let i=await t.organizations.createOrUpdate.mutate({name:e});r.stop("Done!"),i?.id&&pe({...Tt(),organizationId:i.id}),L(`Organization ${ue.default.green(e)} has been created!
201
+
202
+ Run ${ue.default.cyan("localesy init")} to create a project in this organization.`)}catch(i){r.stop("Failed!");let s=i instanceof Error?i.message:String(i);throw new $(`Organization could not be created: ${s}`)}}async function g0(t){let e=Tt(),{organizationId:r}=await Pr(t,{cachedOrgId:e?.organizationId}),i=await Nt({message:"What is the name of your project?"});if(_(i))throw new Y;let s=await t.locales.getAll.query(),n=await pn({message:"Select the source language:",maxItems:8,options:s.map(u=>({value:u.value,label:u.label,hint:u.value}))});if(_(n))throw new Y;let o=await M();o.start("Creating project...");let{signal:a,cleanup:l}=Vt();try{let u=await t.projects.createWithTranslations.mutate({project:{name:i,organizationId:r,sourceTranslationLocaleCode:n},extra:{type:"new"}},{signal:a});if(!u?.runId)throw o.stop("Failed!"),new $("Failed to start project creation task");o.message("Project creation started, waiting for completion...");let{projectId:c}=await ks({client:t,runId:u.runId,signal:a,spinner:o});o.stop("Done!"),c&&pe({organizationId:r,projectId:c}),L(`Project ${ue.default.green(i)} has been created!
203
+
204
+ Run ${ue.default.cyan("localesy sync --push-only")} to upload translation files.
205
+
206
+ View your project: ${ue.default.cyan(`${tt()}/projects/${c??"unknown"}`)}`)}catch(u){if(o.stop("Failed!"),u instanceof $)throw u;let c=u instanceof Error?u.message:String(u);throw new $(`Project could not be created: ${c}`)}finally{l()}}async function y0(t){let{projectId:e}=await ee(t),r=await M();r.start("Fetching project details...");let{signal:i,cleanup:s}=Vt(),n;try{n=(await t.projects.getWithTranslations.query({projectId:e,includeTranslationValue:!1,includeTranslationStats:!1},{signal:i})).project,r.stop("Project details loaded!")}catch(g){throw r.stop("Failed to fetch project details"),new $(`Failed to fetch project details: ${g}`)}finally{s()}let o=n.sourceTranslationLocaleCode??"en_US",a=new Set(n.translationFileSets?.flatMap(g=>g.translationFiles?.map(D=>D.localeCode)??[])??[]),l=await M();l.start("Fetching available languages...");let u;try{u=await t.locales.getAll.query(),l.stop("Languages loaded!")}catch(g){throw l.stop("Failed to fetch languages"),new $(`Failed to fetch languages: ${g}`)}let c=u.filter(g=>!a.has(g.value));if(c.length===0)throw new Y("All languages are already added to this project.");O(`Your project has ${a.size} language(s).
207
+ Source language: ${ue.default.cyan(o)}`,"Add New Language");let p=await pn({message:"Search and select a language:",maxItems:8,options:c.map(g=>({value:g.value,label:g.label,hint:g.value}))});if(_(p))throw new Y;let m=c.find(g=>g.value===p);if(!m)throw new $("Language could not be created. Invalid locale selected.");let h=u.find(g=>g.value===o)?.label??o,d=await pt({message:`Generate translations with AI based on ${ue.default.cyan(h)}?`,initialValue:!0});if(_(d))throw new Y;let y=await M();y.start(d?`Generating ${m.label} translations...`:`Creating ${m.label} language files...`);try{let g=await t.translations.generateNewLanguage.mutate({projectId:e,targetLocaleCode:m.value,generateWithAI:d});y.stop("Done!"),L(`${m.label} has been added!
208
+
209
+ Created ${g.totalFilesCreated} translation file(s).
210
+
211
+ Run ${ue.default.cyan("localesy sync --pull-only")} to download the new translations.
212
+
213
+ View your project: ${ue.default.cyan(`${tt()}/projects/${e}`)}`)}catch(g){y.stop("Failed!");let D=g instanceof Error?g.message:String(g);throw new $(`Language could not be created: ${D}`)}}var ue,_h=x(()=>{"use strict";ct();ue=G(ot());_t();Ze();Ne();me();pr();At();le();_s()});var Ih={};Mt(Ih,{run:()=>w0});function D0(t,e){let r=Math.round(t/100*e),i=e-r;return V.default.green("\u2588".repeat(r))+V.default.gray("\u2591".repeat(i))}async function w0(t){let{args:e,shouldExit:r}=at(t,{name:"status",description:"Analyze local translation files and compare against Localesy",label:"Translation Status"});if(r)return;let i={start:()=>{},stop:()=>{},message:()=>{}},{client:s}=await mt(),{projectId:n,rootPath:o}=await ee(s,{withRootPath:!0}),a=(0,Oh.resolve)(process.cwd(),o),{signal:l,cleanup:u}=Vt();try{let c=e.json?i:await M();c.start("Loading project details..."),await s.projects.getWithTranslations.query({projectId:n,includeTranslationValue:!1,includeTranslationStats:!1},{signal:l}),c.stop("Project loaded!");let p=e.json?i:await M();p.start("Scanning local translation files...");let{files:m,missingFiles:f}=await ke({client:s,projectId:n,absolutePath:a,signal:l});if(p.stop(`Found ${m.length} local files`),!e.json&&f.length>0&&R.warning(`${f.length} files missing locally: ${f.slice(0,3).join(", ")}${f.length>3?"...":""}`),m.length===0)throw new $("No translation files found locally");let h=e.json?i:await M();h.start("Analyzing files against Localesy...");let d=await s.translations.analyzeFullBranchFiles.mutate({projectId:n,files:m},{signal:l});if(h.stop("Analysis complete!"),e.json){console.log(JSON.stringify(d));return}let{source:y,targets:g,sourceLocaleCode:D}=d,v=(()=>{let F=[];return y.newKeys>0&&F.push(`${V.default.green(`+${y.newKeys}`)} new keys`),y.updatedKeys>0&&F.push(`${V.default.yellow(`~${y.updatedKeys}`)} updated keys`),y.deletedKeys>0&&F.push(`${V.default.red(`-${y.deletedKeys}`)} deleted keys`),F.length===0&&F.push(V.default.gray("No changes from Localesy")),F.join(" ")})();if(O(`${V.default.cyan("Source:")} ${D} (${y.totalLocalKeys} keys)
214
+ ${v}`,"Source Language Changes"),g.length===0)R.info("No target languages found in project");else{let S=(process.stdout.columns||120)-13,k=[Math.floor(S*.35),Math.floor(S*.15),Math.floor(S*.15),Math.floor(S*.2),Math.floor(S*.15)],z=new jh.default({head:[V.default.bold("Language"),V.default.bold("Filled"),V.default.bold("Missing"),V.default.bold("Progress"),V.default.bold("Files")],colWidths:k,style:{head:["cyan"],border:["gray"]}});for(let N of g){let Z=N.totalSourceKeys>0?Math.floor(N.filledKeys/N.totalSourceKeys*100):0,W=D0(Z,10),it=Z===100?V.default.green:Z>=80?V.default.yellow:V.default.red,T=N.isNew?`${V.default.cyan("NEW")} ${V.default.white(N.label)}`:V.default.white(N.label);z.push([T,V.default.green(N.filledKeys.toString()),N.missingKeys>0?V.default.red(N.missingKeys.toString()):V.default.gray("0"),`${W} ${it(`${Z}%`)}`,V.default.gray(N.filePaths.length.toString())])}O(z.toString(),`${V.default.bold(d.projectName)} - Target Languages`)}let b=g.reduce((F,E)=>F+E.missingKeys,0),C=g.filter(F=>F.isNew);if(C.length>0&&R.info(`Detected ${C.length} new ${C.length===1?"locale":"locales"} on disk: ${C.map(F=>V.default.cyan(F.localeCode)).join(", ")}. Run ${V.default.cyan("localesy sync")} to add ${C.length===1?"it":"them"} to the project.`),b>0||y.newKeys>0||y.updatedKeys>0){let F=b>0?`Run ${V.default.cyan("localesy translate")} to translate ${b} missing keys`:`Run ${V.default.cyan("localesy sync")} to push your changes`;R.info(F)}else C.length===0&&R.info(V.default.green("All languages are up to date!"));L(`View full details: ${V.default.cyan(`${tt()}/projects/${n}`)}`)}catch(c){throw c instanceof $?c:new $(`Failed to analyze: ${c}`)}finally{u()}}var Oh,jh,V,Lh=x(()=>{"use strict";Oh=require("path");ct();jh=G(Ti()),V=G(ot());_t();Ne();me();Qr();pr();At();le()});var Nh={};Mt(Nh,{run:()=>v0});async function v0(t){let e=t[0],r=t.slice(1);await(0,Mh.match)(e).with("set",()=>C0(r)).with("path",()=>E0(r)).with(void 0,()=>So(t)).with("show",()=>So(t)).otherwise(i=>{if(i?.startsWith("-"))return So(t);throw R.error(`Unknown config subcommand: ${i}`),new $(`Unknown config subcommand: ${i}`)})}async function So(t){let{shouldExit:e}=at(t,{name:"config",description:"View local project configuration",label:"Configuration",options:["Subcommands:"," set <k> <v> Set a configuration value (organizationId, projectId, rootPath)"," path Show the config file path",""]});if(e)return;await mt();let r=Tt(),i=Fn();if(!r)throw new $(`No configuration found.
215
+
216
+ Run ${wt.default.cyan("localesy init")} to set up your project.
217
+
218
+ Config path: ${wt.default.gray(i)}`);let s=new Bh.default({style:{head:["cyan"],border:["gray"]}});s.push({[wt.default.cyan("Organization ID")]:r.organizationId??wt.default.gray("not set")},{[wt.default.cyan("Project ID")]:r.projectId??wt.default.gray("not set")},{[wt.default.cyan("Root Path")]:r.rootPath??wt.default.gray("not set")},{[wt.default.cyan("Config File")]:wt.default.gray(i)}),console.log(s.toString()),r.projectId&&L(`View project: ${wt.default.cyan(`${tt()}/projects/${r.projectId}`)}`)}async function C0(t){let{args:e,shouldExit:r}=at(t,{name:"config set <key> <value>",description:"Set a configuration value",label:"Set Config",options:["Keys:"," organizationId Organization ID (uuid)"," projectId Project ID (uuid)"," rootPath Root path for translation files",""]});if(r)return;let i=e._[0],s=i!==void 0?t[t.indexOf(i)+1]:void 0;if(!i||s===void 0)throw new $("Usage: localesy config set <key> <value>");await mt();let n=["organizationId","projectId","rootPath"];if(!n.includes(i))throw new $(`Invalid key: ${wt.default.red(i)}
219
+
220
+ Valid keys: ${n.map(u=>wt.default.cyan(u)).join(", ")}`);let o=Tt()??{},a=i;if((a==="organizationId"||a==="projectId")&&!b0.test(s))throw new $(`${wt.default.cyan(i)} must be a valid uuid`);let l={...o,[a]:s};pe(l),L(`Set ${wt.default.cyan(i)} = ${wt.default.green(s)}`)}async function E0(t){let{shouldExit:e}=at(t,{name:"config path",description:"Show the config file path",skipIntro:!0});e||(await mt(),console.log(Fn()))}var Bh,wt,Mh,b0,Wh=x(()=>{"use strict";ct();Bh=G(Ti()),wt=G(ot()),Mh=require("ts-pattern");_t();Ze();me();At();le();b0=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i});var zh={};Mt(zh,{run:()=>S0});async function S0(t){let{shouldExit:e}=at(t,{name:"login",description:"Authenticate with Localesy",label:"Login"});if(e)return;let r=$e();if(r){let s=Ir(r.access_token);try{let n=await s.users.getCurrent.query(),o=n?.email??n?.nickname??"Unknown user";O(`Logged in as ${xo.default.green(o)}`,"Current Session");let a=await pt({message:"Do you want to authenticate as another user?",initialValue:!1});if(_(a)||!a){L("Keeping current session.");return}de()}catch{O("Your session has expired.","Session Expired"),de()}}let{authToken:i}=await mt();i&&L(`Logged in successfully!
221
+
222
+ Credentials saved to:
223
+ ${xo.default.gray(ls())}`)}var xo,Uh=x(()=>{"use strict";ct();xo=G(ot());cs();me();jr();le()});var qh={};Mt(qh,{run:()=>x0});async function x0(t){let{shouldExit:e}=at(t,{name:"logout",description:"Clear stored authentication credentials",label:"Logout"});if(e)return;let r=ls();de(),L(`Logged out successfully.
224
+
225
+ Removed credentials from:
226
+ ${Vh.default.gray(r)}`)}var Vh,Gh=x(()=>{"use strict";ct();Vh=G(ot());jr();le()});var Hh={};Mt(Hh,{run:()=>F0});async function F0(t){let{shouldExit:e}=at(t,{name:"open",description:"Open project in Localesy web app",label:"Open Project"});if(e)return;let{client:r}=await mt(),{projectId:i}=await ee(r),s=`${tt()}/projects/${i}`;hs(s),L(`Opened ${Kh.default.cyan(s)}`)}var Kh,Yh=x(()=>{"use strict";ct();Kh=G(ot());_t();Ne();me();eo();le()});ct();var Jh=require("ts-pattern");_t();function sa(){let t=process.argv.slice(2),e,r=[];for(let i of t)if(i.startsWith("--env=")){let s=i.split("=")[1];xi(s)}else e?r.push(i):e=i;return{command:e,commandArgs:r}}At();var{command:De,commandArgs:$0}=sa();async function P0(){if(!De||De==="help"||De==="--help"||De==="-h"){await Promise.resolve().then(()=>(oa(),na)).then(r=>r.run());return}if(De==="--version"||De==="-v"){console.log("0.0.1-rc.1");return}let t=(0,Jh.match)(De).with("init",()=>Promise.resolve().then(()=>(sh(),ih))).with("sync",()=>Promise.resolve().then(()=>(Bs(),xh))).with("push",()=>Promise.resolve().then(()=>($h(),Fh))).with("pull",()=>Promise.resolve().then(()=>(Ah(),Ph))).with("translate",()=>Promise.resolve().then(()=>(Rh(),Th))).with("new",()=>Promise.resolve().then(()=>(_h(),kh))).with("status",()=>Promise.resolve().then(()=>(Lh(),Ih))).with("config",()=>Promise.resolve().then(()=>(Wh(),Nh))).with("login","auth",()=>Promise.resolve().then(()=>(Uh(),zh))).with("logout",()=>Promise.resolve().then(()=>(Gh(),qh))).with("open",()=>Promise.resolve().then(()=>(Yh(),Hh))).otherwise(()=>null);if(!t)throw R.error(`Unknown command: ${De}`),R.info('Run "localesy help" for available commands'),new $(`Unknown command: ${De}`);await(await t).run($0)}P0().catch(t=>{t instanceof Y&&(Xt(t.message),process.exit(0)),t instanceof $&&(Xt(t.message),process.exit(t.exitCode)),Xt(`An unexpected error occurred: ${t instanceof Error?t.message:String(t)}`),process.exit(1)});
227
+ /*! Bundled license information:
228
+
229
+ @trpc/client/dist/httpLink-DCFpUmZF.mjs:
230
+ (* istanbul ignore if -- @preserve *)
231
+ */
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "localesy",
3
+ "version": "0.0.1-rc.1",
4
+ "type": "commonjs",
5
+ "description": "CLI for Localesy translation management",
6
+ "license": "MIT",
7
+ "author": "Localesy",
8
+ "homepage": "https://localesy.com",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/localesy/localesy.git",
12
+ "directory": "apps/cli"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/localesy/localesy/issues"
16
+ },
17
+ "keywords": [
18
+ "cli",
19
+ "i18n",
20
+ "translation",
21
+ "localization",
22
+ "l10n",
23
+ "localesy"
24
+ ],
25
+ "main": "./dist/index.js",
26
+ "bin": {
27
+ "localesy": "dist/index.js"
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "scripts": {
36
+ "build": "tsup",
37
+ "dev": "bun run src/index.ts",
38
+ "gen:api": "bun run scripts/gen-api-types.ts",
39
+ "typecheck": "tsc --noEmit",
40
+ "test": "bun test src/__tests__/unit && bun test src/__tests__/integration",
41
+ "test:unit": "bun test src/__tests__/unit",
42
+ "test:integration": "bun test src/__tests__/integration",
43
+ "prepublishOnly": "bun run build",
44
+ "release": "npm publish",
45
+ "analyse": "bun run scripts/analyse.ts",
46
+ "deadcode": "knip",
47
+ "graph": "depcruise src --include-only ^src --config .dependency-cruiser.cjs --output-type dot | tred | dot -Tsvg -o cli-depgraph.svg",
48
+ "arch": "depcruise src --config .dependency-cruiser.cjs"
49
+ },
50
+ "devDependencies": {
51
+ "@bomb.sh/args": "0.3.1",
52
+ "@clack/prompts": "1.0.0-alpha.6",
53
+ "@trpc/client": "11.8.1",
54
+ "@trpc/server": "11.8.1",
55
+ "@types/bun": "^1.3.0",
56
+ "@types/node": "^22",
57
+ "cli-table3": "0.6.5",
58
+ "dependency-cruiser": "^17.4.3",
59
+ "glob": "13.0.6",
60
+ "knip": "^6.16.1",
61
+ "picocolors": "1.1.1",
62
+ "superjson": "2.2.5",
63
+ "tsup": "^8.5.1",
64
+ "typescript": "^5.5.0"
65
+ },
66
+ "dependencies": {
67
+ "ts-pattern": "5.9.0"
68
+ }
69
+ }