@fugood/bricks-cli 2.24.11 → 2.24.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/611.js +1 -1
- package/lib/627.js +1 -1
- package/lib/703.js +1 -1
- package/lib/737.js +2 -2
- package/lib/890.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";const t=e(import.meta.url);import*as o from"ink";import*as n from"ink-picture";import*as r from"react";import*as i from"react/jsx-runtime";import{default as s}from"conf";var a,l,u,c,d,p,f,g,h,m={444:(e,t,o)=>{o.a(e,async(e,n)=>{try{o.d(t,{A:()=>S,e:()=>w});var r=o(99436),i=o(35679),s=o(88568),a=o(74752),l=o(74445),u=o(73087),c=o(81637),d=o(69504),p=o(64447),f=o(34528),g=o(96739),h=o(93759),m=o(7089),D=o(25811),y=o(59726),v=o(14778),F=o(61685),b=o(99456),_=o(63465),C=o(96684),$=e([v]),E=$.then?(await $)():$;v=E[0];var w=(k=r(function*(){var e,t=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);-1!==t&&process.argv[t+1]&&((0,a.setProfileOverride)(process.argv[t+1]),process.argv.splice(t,2)),i.DM.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.24.11","-v, --version","output the version number").enablePositionalOptions(),i.DM.addCommand(u.s),i.DM.addCommand(c._),i.DM.addCommand(d.B),i.DM.addCommand(p.A),i.DM.addCommand(f.p),i.DM.addCommand(g.u),i.DM.addCommand(h.E),i.DM.addCommand(m.oT),i.DM.addCommand(D.K),i.DM.addCommand(y.gf),i.DM.addCommand(v.D),i.DM.addCommand(F.v),i.DM.addCommand(b.l),i.DM.addCommand(_.D),i.DM.addCommand(C.Q),i.DM.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(r(function*(){try{var e=(yield Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(632),o.e(700),o.e(779)]).then(o.bind(o,18779))).runInteractiveMode;yield e()}catch(e){console.error(s.default.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),i.DM.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action((e=r(function*(e){var t=yield Promise.resolve().then(o.bind(o,74752)),n=t.getToken,r=t.getBaseUrl,i=t.getCurrentProfile,a=(yield Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(700)]).then(o.bind(o,50700))).createClient,l=(yield Promise.resolve().then(o.bind(o,29790))).default,u=n(i());u||(console.error(s.default.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var c=l("Fetching workspace info...").start();try{var d=a(r(),u),p=yield d.workspace();if(c.stop(),e.json)return void console.log(JSON.stringify(p,null,2));console.log(s.default.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${s.default.green(p.name)}`),console.log(`ID: ${s.default.gray(p._id)}`),console.log(`Description: ${p.description||s.default.gray("N/A")}`),console.log(`\n${s.default.bold("Data")}`),console.log(`Remote Update: ${p.bank?.enable_remote_update?s.default.green("Enabled"):s.default.gray("Disabled")}`),console.log(`Spacename: ${p.bank?.spacename||s.default.gray("N/A")}`),console.log("─".repeat(60))}catch(e){c.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}}),function(t){return e.apply(this,arguments)})),i.DM.on("--help",()=>{console.log(""),console.log(s.default.bold("Examples:")),console.log(""),console.log(s.default.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(s.default.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(s.default.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(s.default.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(s.default.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(s.default.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(s.default.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(s.default.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(s.default.gray("Get workspace token from BRICKS Controller:")),console.log(s.default.cyan(" https://control.bricks.tools")),console.log(s.default.gray(" Go to Workspace Settings > API Token"))});var n=process.argv.slice(2);if(0===n.length){if((0,l.shouldStartInteractiveMode)(n))try{var $=(yield Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(632),o.e(700),o.e(779)]).then(o.bind(o,18779))).runInteractiveMode;return void(yield $())}catch(e){console.error(s.default.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}return console.error(s.default.gray("No command provided. Interactive mode requires a TTY, so showing help instead.\n")),void i.DM.outputHelp()}yield i.DM.parseAsync(process.argv)}),function(){return k.apply(this,arguments)});const S=w;n()}catch(e){n(e)}var k})},1001:(e,t,o)=>{o.d(t,{p:()=>i});var n=/^(\d+)(s|m|h|d|w)$/,r={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function i(e){var t=e.match(n);if(t){var o=parseInt(t[1],10),i=r[t[2]];return new Date(Date.now()-o*i).toISOString()}var s=new Date(e);if(isNaN(s.getTime()))throw new Error(`Invalid time format: "${e}". Use ISO 8601 or relative (e.g. 1h, 30m, 2d)`);return s.toISOString()}},1708:e=>{e.exports=t("node:process")},2203:e=>{e.exports=t("stream")},3634:e=>{e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},3900:e=>{e.exports=JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},"dots2":{"interval":80,"frames":["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},"dots3":{"interval":80,"frames":["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},"dots4":{"interval":80,"frames":["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},"dots5":{"interval":80,"frames":["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},"dots6":{"interval":80,"frames":["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},"dots7":{"interval":80,"frames":["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},"dots8":{"interval":80,"frames":["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},"dots9":{"interval":80,"frames":["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},"dots10":{"interval":80,"frames":["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},"dots11":{"interval":100,"frames":["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},"dots12":{"interval":80,"frames":["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},"dots13":{"interval":80,"frames":["⣼","⣹","⢻","⠿","⡟","⣏","⣧","⣶"]},"dots8Bit":{"interval":80,"frames":["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},"sand":{"interval":80,"frames":["⠁","⠂","⠄","⡀","⡈","⡐","⡠","⣀","⣁","⣂","⣄","⣌","⣔","⣤","⣥","⣦","⣮","⣶","⣷","⣿","⡿","⠿","⢟","⠟","⡛","⠛","⠫","⢋","⠋","⠍","⡉","⠉","⠑","⠡","⢁"]},"line":{"interval":130,"frames":["-","\\\\","|","/"]},"line2":{"interval":100,"frames":["⠂","-","–","—","–","-"]},"pipe":{"interval":100,"frames":["┤","┘","┴","└","├","┌","┬","┐"]},"simpleDots":{"interval":400,"frames":[". ",".. ","..."," "]},"simpleDotsScrolling":{"interval":200,"frames":[". ",".. ","..."," .."," ."," "]},"star":{"interval":70,"frames":["✶","✸","✹","✺","✹","✷"]},"star2":{"interval":80,"frames":["+","x","*"]},"flip":{"interval":70,"frames":["_","_","_","-","`","`","\'","´","-","_","_","_"]},"hamburger":{"interval":100,"frames":["☱","☲","☴"]},"growVertical":{"interval":120,"frames":["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},"growHorizontal":{"interval":120,"frames":["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},"balloon":{"interval":140,"frames":[" ",".","o","O","@","*"," "]},"balloon2":{"interval":120,"frames":[".","o","O","°","O","o","."]},"noise":{"interval":100,"frames":["▓","▒","░"]},"bounce":{"interval":120,"frames":["⠁","⠂","⠄","⠂"]},"boxBounce":{"interval":120,"frames":["▖","▘","▝","▗"]},"boxBounce2":{"interval":100,"frames":["▌","▀","▐","▄"]},"triangle":{"interval":50,"frames":["◢","◣","◤","◥"]},"binary":{"interval":80,"frames":["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},"arc":{"interval":100,"frames":["◜","◠","◝","◞","◡","◟"]},"circle":{"interval":120,"frames":["◡","⊙","◠"]},"squareCorners":{"interval":180,"frames":["◰","◳","◲","◱"]},"circleQuarters":{"interval":120,"frames":["◴","◷","◶","◵"]},"circleHalves":{"interval":50,"frames":["◐","◓","◑","◒"]},"squish":{"interval":100,"frames":["╫","╪"]},"toggle":{"interval":250,"frames":["⊶","⊷"]},"toggle2":{"interval":80,"frames":["▫","▪"]},"toggle3":{"interval":120,"frames":["□","■"]},"toggle4":{"interval":100,"frames":["■","□","▪","▫"]},"toggle5":{"interval":100,"frames":["▮","▯"]},"toggle6":{"interval":300,"frames":["ဝ","၀"]},"toggle7":{"interval":80,"frames":["⦾","⦿"]},"toggle8":{"interval":100,"frames":["◍","◌"]},"toggle9":{"interval":100,"frames":["◉","◎"]},"toggle10":{"interval":100,"frames":["㊂","㊀","㊁"]},"toggle11":{"interval":50,"frames":["⧇","⧆"]},"toggle12":{"interval":120,"frames":["☗","☖"]},"toggle13":{"interval":80,"frames":["=","*","-"]},"arrow":{"interval":100,"frames":["←","↖","↑","↗","→","↘","↓","↙"]},"arrow2":{"interval":80,"frames":["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},"arrow3":{"interval":120,"frames":["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},"bouncingBar":{"interval":80,"frames":["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},"bouncingBall":{"interval":80,"frames":["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},"smiley":{"interval":200,"frames":["😄 ","😝 "]},"monkey":{"interval":300,"frames":["🙈 ","🙈 ","🙉 ","🙊 "]},"hearts":{"interval":100,"frames":["💛 ","💙 ","💜 ","💚 ","❤️ "]},"clock":{"interval":100,"frames":["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},"earth":{"interval":180,"frames":["🌍 ","🌎 ","🌏 "]},"material":{"interval":17,"frames":["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███████▁▁▁▁▁▁▁▁▁▁▁▁▁","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","██████████▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","█████████████▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁██████████████▁▁▁▁","▁▁▁██████████████▁▁▁","▁▁▁▁█████████████▁▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁▁▁████████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","██████▁▁▁▁▁▁▁▁▁▁▁▁▁█","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁▁█████████████▁▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁▁███████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁▁█████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"]},"moon":{"interval":80,"frames":["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},"runner":{"interval":140,"frames":["🚶 ","🏃 "]},"pong":{"interval":80,"frames":["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},"shark":{"interval":120,"frames":["▐|\\\\____________▌","▐_|\\\\___________▌","▐__|\\\\__________▌","▐___|\\\\_________▌","▐____|\\\\________▌","▐_____|\\\\_______▌","▐______|\\\\______▌","▐_______|\\\\_____▌","▐________|\\\\____▌","▐_________|\\\\___▌","▐__________|\\\\__▌","▐___________|\\\\_▌","▐____________|\\\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},"dqpb":{"interval":100,"frames":["d","q","p","b"]},"weather":{"interval":100,"frames":["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},"christmas":{"interval":400,"frames":["🌲","🎄"]},"grenade":{"interval":80,"frames":["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},"point":{"interval":125,"frames":["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},"layer":{"interval":150,"frames":["-","=","≡"]},"betaWave":{"interval":80,"frames":["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]},"fingerDance":{"interval":160,"frames":["🤘 ","🤟 ","🖖 ","✋ ","🤚 ","👆 "]},"fistBump":{"interval":80,"frames":["🤜 🤛 ","🤜 🤛 ","🤜 🤛 "," 🤜 🤛 "," 🤜🤛 "," 🤜✨🤛 ","🤜 ✨ 🤛 "]},"soccerHeader":{"interval":80,"frames":[" 🧑⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 "]},"mindblown":{"interval":160,"frames":["😐 ","😐 ","😮 ","😮 ","😦 ","😦 ","😧 ","😧 ","🤯 ","💥 ","✨ "," "," "," "]},"speaker":{"interval":160,"frames":["🔈 ","🔉 ","🔊 ","🔉 "]},"orangePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 "]},"bluePulse":{"interval":100,"frames":["🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"orangeBluePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 ","🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"timeTravel":{"interval":100,"frames":["🕛 ","🕚 ","🕙 ","🕘 ","🕗 ","🕖 ","🕕 ","🕔 ","🕓 ","🕒 ","🕑 ","🕐 "]},"aesthetic":{"interval":80,"frames":["▰▱▱▱▱▱▱","▰▰▱▱▱▱▱","▰▰▰▱▱▱▱","▰▰▰▰▱▱▱","▰▰▰▰▰▱▱","▰▰▰▰▰▰▱","▰▰▰▰▰▰▰","▰▱▱▱▱▱▱"]},"dwarfFortress":{"interval":80,"frames":[" ██████£££ ","☺██████£££ ","☺██████£££ ","☺▓█████£££ ","☺▓█████£££ ","☺▒█████£££ ","☺▒█████£££ ","☺░█████£££ ","☺░█████£££ ","☺ █████£££ "," ☺█████£££ "," ☺█████£££ "," ☺▓████£££ "," ☺▓████£££ "," ☺▒████£££ "," ☺▒████£££ "," ☺░████£££ "," ☺░████£££ "," ☺ ████£££ "," ☺████£££ "," ☺████£££ "," ☺▓███£££ "," ☺▓███£££ "," ☺▒███£££ "," ☺▒███£££ "," ☺░███£££ "," ☺░███£££ "," ☺ ███£££ "," ☺███£££ "," ☺███£££ "," ☺▓██£££ "," ☺▓██£££ "," ☺▒██£££ "," ☺▒██£££ "," ☺░██£££ "," ☺░██£££ "," ☺ ██£££ "," ☺██£££ "," ☺██£££ "," ☺▓█£££ "," ☺▓█£££ "," ☺▒█£££ "," ☺▒█£££ "," ☺░█£££ "," ☺░█£££ "," ☺ █£££ "," ☺█£££ "," ☺█£££ "," ☺▓£££ "," ☺▓£££ "," ☺▒£££ "," ☺▒£££ "," ☺░£££ "," ☺░£££ "," ☺ £££ "," ☺£££ "," ☺£££ "," ☺▓££ "," ☺▓££ "," ☺▒££ "," ☺▒££ "," ☺░££ "," ☺░££ "," ☺ ££ "," ☺££ "," ☺££ "," ☺▓£ "," ☺▓£ "," ☺▒£ "," ☺▒£ "," ☺░£ "," ☺░£ "," ☺ £ "," ☺£ "," ☺£ "," ☺▓ "," ☺▓ "," ☺▒ "," ☺▒ "," ☺░ "," ☺░ "," ☺ "," ☺ &"," ☺ ☼&"," ☺ ☼ &"," ☺☼ &"," ☺☼ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & ","‼ & "," & "," & "," & ░ "," & ▒ "," & ▓ "," & £ "," & ░£ "," & ▒£ "," & ▓£ "," & ££ "," & ░££ "," & ▒££ ","& ▓££ ","& £££ "," ░£££ "," ▒£££ "," ▓£££ "," █£££ "," ░█£££ "," ▒█£££ "," ▓█£££ "," ██£££ "," ░██£££ "," ▒██£££ "," ▓██£££ "," ███£££ "," ░███£££ "," ▒███£££ "," ▓███£££ "," ████£££ "," ░████£££ "," ▒████£££ "," ▓████£££ "," █████£££ "," ░█████£££ "," ▒█████£££ "," ▓█████£££ "," ██████£££ "," ██████£££ "]}}')},5523:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},6939:(e,t,o)=>{o.d(t,{H_:()=>a,Iy:()=>s,S5:()=>c,jB:()=>l,yd:()=>d});var n=o(88568),r=o(79896),i=o(34992),s=(e,t,o)=>({label:e,ok:t,detail:o}),a=(e,t,{id:o,name:n,...r}={})=>({id:e?._id||t,name:n||e?.name||"Unnamed",...r}),l=(e,t)=>{var o={id:e};return t.name&&(o.name=t.name),t.description&&(o.description=t.description),t.config?o.config=t.config:t.file&&(o.config=r.readFileSync(t.file,"utf-8")),void 0!==o.config&&(o.validateConfig=!1!==t.validate),t.lastCommitId&&(o.lastCommitId=t.lastCommitId),o},u=e=>null==e?n.default.gray("N/A"):"object"==typeof e?n.default.gray(JSON.stringify(e,null,2)):String(e),c=({action:e,target:t,request:o,checks:r=[],json:s=!1})=>{var a={ok:!0,dryRun:!0,action:e,target:t||null,request:o||null,checks:r};s?(0,i.GF)(a):(console.log(n.default.bold(`\nDry Run: ${e}`)),console.log("─".repeat(60)),t&&(console.log(n.default.bold("Target")),Object.entries(t).forEach(([e,t])=>{console.log(`${e}: ${u(t)}`)})),o&&(console.log(`\n${n.default.bold("Request")}`),Object.entries(o).forEach(([e,t])=>{console.log(`${e}: ${u(t)}`)})),r.length>0&&(console.log(`\n${n.default.bold("Checks")}`),r.forEach(e=>{var t=e.ok?n.default.green("OK"):n.default.red("FAIL"),o=e.detail?` ${e.detail}`:"";console.log(`${t} ${e.label}${o}`)})),console.log("─".repeat(60)))},d=({action:e,target:t,result:o=null,json:n=!1,message:r})=>{n?(0,i.GF)({ok:!0,dryRun:!1,action:e,target:t||null,result:o}):r&&console.log(r)}},7066:e=>{e.exports=t("node:tty")},7089:(e,t,o)=>{o.d(t,{oT:()=>c});var n=o(35679),r=o(88568),i=o(74752),s={prod:"https://display.bricks.tools",beta:"https://display-beta.bricks.tools",dev:"http://localhost:3001"},a=e=>{var t=Object.entries(s).find(([,t])=>e===t);return t?t[0]:null},l={prod:"https://activity-log.bricks.tools",beta:"https://activity-log-beta.bricks.tools",dev:"http://localhost:8088"},u=e=>{var t=Object.entries(l).find(([,t])=>e===t);return t?t[0]:null},c=new n.uB("config").description("CLI configuration management");c.command("endpoint").argument("[environment]","Environment to use (prod, beta, dev)").description("Show or set endpoint environment").option("-p, --profile","Set for current profile instead of global").action((e,t)=>{if(!e){var o=(0,i.getBaseUrl)(),n=a(o),c=(0,i.getActivityLogBaseUrl)(),d=u(c);return console.log(r.default.bold("\nEndpoint Configuration")),console.log("─".repeat(50)),console.log(r.default.bold("BRICKS")),console.log(` URL: ${r.default.cyan(o)}`),console.log(` Environment: ${n?r.default.green(n):r.default.yellow("custom")}`),console.log(r.default.bold("Activity Log")),console.log(` URL: ${r.default.cyan(c)}`),console.log(` Environment: ${d?r.default.green(d):r.default.yellow("custom")}`),console.log("─".repeat(50)),void console.log(r.default.gray("\nUsage: bricks config endpoint <prod|beta|dev>"))}var p=Object.keys(s);p.includes(e)||(console.error(r.default.red(`Invalid environment: ${e}`)),console.log(r.default.gray(`Valid options: ${p.join(", ")}`)),process.exit(1));var f=s[e],g=l[e],h=t.profile?(0,i.getCurrentProfile)():null;(0,i.setBaseUrl)(f,h),(0,i.setActivityLogBaseUrl)(g,h);var m=t.profile?` (profile: ${(0,i.getCurrentProfile)()})`:"";console.log(r.default.green(`✓ Endpoint changed to ${e}${m}`)),console.log(r.default.gray(` BRICKS: ${f}`)),console.log(r.default.gray(` Activity Log: ${g}`)),console.log(r.default.yellow("\nNote: You may need to re-authenticate if your token is for a different environment.")),console.log(r.default.gray("Use `bricks auth status` to check your connection."))}),c.command("show").description("Show current configuration").option("-j, --json","Output as JSON").action(e=>{var t=(0,i.getBaseUrl)(),o=a(t);if(e.json)console.log(JSON.stringify({endpoint:t,environment:o||"custom"},null,2));else{console.log(r.default.bold("\nBRICKS CLI Configuration")),console.log("─".repeat(50)),console.log(`BRICKS: ${r.default.cyan(t)}`),o?console.log(`Environment: ${r.default.green(o)}`):console.log(`Environment: ${r.default.yellow("custom")}`);var n=(0,i.getActivityLogBaseUrl)(),s=u(n);console.log(`Activity Log: ${r.default.cyan(n)} ${s?r.default.green(`(${s})`):r.default.yellow("(custom)")}`),console.log("─".repeat(50))}})},8498:(e,t,n)=>{e.exports=(e=>{var t={};return n.d(t,e),t})({Box:()=>o.Box,Text:()=>o.Text,render:()=>o.render,useApp:()=>o.useApp,useInput:()=>o.useInput})},12044:(e,t,o)=>{o.r(t),o.d(t,{discoverDevToolsServers:()=>c,httpProbeSubnet:()=>d,verifyDevToolsServer:()=>p});var n,r,i=o(99436),s=o(41314),a=o(48161),l="bricks-devtools",u=()=>{var e=[],t=a.networkInterfaces();for(var o of Object.values(t)){var n=function(){if("IPv4"!==r.family||r.internal)return 1;var t=r.address.split(".").map(Number),o=r.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~o[t]).toString()).join(".");e.push({address:r.address,broadcast:n})};for(var r of o)n()}return e},c=({timeout:e=3e3,idleTimeout:t=0}={})=>new Promise((o,n)=>{var r=new Map,i=s.createSocket("udp4"),a=null,c=null,d=!1,p=()=>{if(!d){d=!0,clearTimeout(a),clearTimeout(c);try{i.close()}catch{}o([...r.values()])}};i.on("error",e=>{if(!d){d=!0,clearTimeout(a),clearTimeout(c);try{i.close()}catch{}n(e)}}),i.on("message",(e,o)=>{try{var n=JSON.parse(e.toString());if(n.s!==l)return;if("ANNOUNCE"!==n.t&&"RESPONSE"!==n.t)return;var i=n.d?.info;if(!i)return;var s=o.address,a=`${s}:${i.port}`;r.has(a)||(r.set(a,{...i,address:s}),t&&!d&&(clearTimeout(c),c=setTimeout(p,t)))}catch{}}),i.bind(()=>{i.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:l,d:{id:`cli-${Math.random().toString(36).substring(2,9)}`}})),o=new Set(["255.255.255.255","127.0.0.1"]);for(var n of u())o.add(n.broadcast);for(var r of o)i.send(t,0,t.length,19900,r);a=setTimeout(p,e)})}),d=(n=i(function*({port:e=19851,connectTimeout:t=500,concurrency:o=50,timeout:n=0}={}){var r=u();if(0===r.length)return[];var s=[],a=n>0?Date.now()+n:0,l=[],c=new Set;for(var d of r){var f=d.address.split(".").slice(0,3).join(".");if(!c.has(f)){c.add(f);for(var g=1;g<255;g++)l.push(`${f}.${g}`)}}for(var h=0;h<l.length&&!(a&&Date.now()>=a);h+=o){var m=l.slice(h,h+o);yield Promise.allSettled(m.map(function(){var o=i(function*(o){var n=yield p(o,e,t);n&&s.push({...n,address:o,port:e})});return function(e){return o.apply(this,arguments)}}()))}return s}),function(){return n.apply(this,arguments)}),p=(r=i(function*(e,t,o=3e3){try{var n=new AbortController,r=setTimeout(()=>n.abort(),o),i=yield fetch(`http://${e}:${t}/devtools/info`,{signal:n.signal});return clearTimeout(r),i.ok?yield i.json():null}catch{return null}}),function(e,t){return r.apply(this,arguments)})},13193:e=>{e.exports=t("string_decoder")},13675:(e,t,o)=>{o.d(t,{Ku:()=>a,w9:()=>s});var n=o(79896),r=o(16928),i=new Set(["CTOR","CTOR Desktop"]),s=e=>{var t=`Release by ${(()=>{var e=process.env.BRICKS_RELEASE_SIGN;return e&&i.has(e)?e:"BRICKS CLI"})()}`;return e?`${e}\n\n${t}`:t},a=e=>{if(e.endsWith(".json")||e.includes("/")){if(!n.existsSync(e))throw new Error(`Config file not found: ${e}`);var t=n.readFileSync(e,"utf-8");return{config:t,source:{type:"file",path:r.resolve(e)},sizeBytes:Buffer.byteLength(t)}}return{config:e,source:{type:"inline"},sizeBytes:Buffer.byteLength(e)}}},14778:(e,t,o)=>{o.a(e,async(e,n)=>{try{o.d(t,{D:()=>h});var r=o(35679),i=o(69278),s=o(16928),a=o(70857),l=o(84361),u=e([l]),c=u.then?(await u)():u;l=c[0];var d=process.env.BRICKS_PROJECT_DESKTOP_DATA_DIR||s.join(a.homedir(),".bricks-project-desktop"),p=s.join(d,"acp.sock"),f=`[acp] Cannot connect to CTOR.\n Make sure the desktop app is running and ACP is enabled in Settings.\n Socket: ${p}\n`,g=e=>{var t=new i.Socket,o="",n=!1,r=[];t.on("error",t=>{var o="ENOENT"===t.code||"ECONNREFUSED"===t.code?"CTOR not reachable (is the desktop app running with ACP enabled?)":`socket error: ${t.message}`;process.stderr.write(`[acp] ${o}\n`);try{e.close(1011,o)}catch{}}),t.on("connect",()=>{n=!0,(()=>{for(;r.length>0;)t.write(r.shift())})()}),t.on("data",t=>{var n;for(o+=t.toString("utf8");-1!==(n=o.indexOf("\n"));){var r=o.slice(0,n);o=o.slice(n+1),r.length>0&&e.readyState===e.OPEN&&e.send(r)}}),t.on("close",()=>{o.length>0&&e.readyState===e.OPEN&&(e.send(o),o="");try{e.close()}catch{}}),e.on("message",(e,o)=>{var i=o?Buffer.from(e).toString("utf8"):e.toString(),s=i.endsWith("\n")?i:i+"\n";n?t.write(s):r.push(s)}),e.on("close",()=>t.destroy()),e.on("error",()=>t.destroy()),t.connect(p)},h=new r.uB("desktop-acp-bridge").description("ACP bridge — connects acpx to the running CTOR desktop app").option("--ws","Start a WebSocket server that bridges the Unix socket instead of using stdio").option("--host <host>","WebSocket server bind host (default: 0.0.0.0)","0.0.0.0").option("--port <port>","WebSocket server port (default: 8765)","8765").option("--auth-token <token>","Require this Bearer token in the WebSocket Authorization header").action(e=>{if(!e.ws)return(t=i.connect(p)).on("connect",()=>{process.stdin.pipe(t),t.pipe(process.stdout)}),t.on("error",e=>{"ENOENT"===e.code||"ECONNREFUSED"===e.code?process.stderr.write(f):process.stderr.write(`[acp] Connection error: ${e.message}\n`),process.exit(1)}),void t.on("close",()=>{process.exit(0)});var t,o=Number.parseInt(e.port,10);(!Number.isInteger(o)||o<0||o>65535)&&(process.stderr.write(`[acp] Invalid --port value: ${e.port}\n`),process.exit(1));var n=e.authToken||process.env.BRICKS_DESKTOP_ACP_BRIDGE_TOKEN||void 0;(({host:e,port:t,authToken:o})=>{var n=new l.WebSocketServer({host:e,port:t,verifyClient:({req:e},t)=>{if(o){for(var n=e.headers.authorization||"",r=`Bearer ${o}`,i=Buffer.from(n),s=Buffer.from(r),a=i.length===s.length,l=Math.max(i.length,s.length),u=0;u<l;u++)(i[u]||0)!==(s[u]||0)&&(a=!1);a?t(!0):t(!1,401,"Unauthorized")}else t(!0)}});n.on("listening",()=>{var e=n.address(),t="string"==typeof e?e:`ws://${e.address}:${e.port}`;process.stderr.write(`[acp] WebSocket bridge listening on ${t}\n`),o||process.stderr.write("[acp] WARNING: no --auth-token set; the bridge is exposed on this host without authentication.\n")}),n.on("error",e=>{process.stderr.write(`[acp] WebSocket server error: ${e.message}\n`),process.exit(1)}),n.on("connection",g);var r=()=>{n.close(()=>process.exit(0))};process.on("SIGINT",r),process.on("SIGTERM",r)})({host:e.host,port:o,authToken:n})});n()}catch(e){n(e)}})},16698:e=>{e.exports=t("node:async_hooks")},16928:e=>{e.exports=t("path")},18572:(e,t,o)=>{const n=o(78474).EventEmitter,r=o(31421),i=o(76760),s=o(73024),a=o(1708),{Argument:l,humanReadableArgName:u}=o(41762),{CommanderError:c}=o(43823),{Help:d}=o(99690),{Option:p,DualOptions:f}=o(92088),{suggestSimilar:g}=o(86054);class h extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,outputError:(e,t)=>t(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,o){let n=t,r=o;"object"==typeof n&&null!==n&&(r=n,n=null),r=r||{};const[,i,s]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(i);return n&&(a.description(n),a._executableHandler=!0),r.isDefault&&(this._defaultCommandName=a._name),a._hidden=!(!r.noHelp&&!r.hidden),a._executableFile=r.executableFile||null,s&&a.arguments(s),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(e){return new h(e)}createHelp(){return Object.assign(new d,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new l(e,t)}argument(e,t,o,n){const r=this.createArgument(e,t);return"function"==typeof o?r.default(n).argParser(o):r.default(o),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if("boolean"==typeof e)return this._addImplicitHelpCommand=e,this;e=e??"help [command]";const[,o,n]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",i=this.createCommand(o);return i.helpOption(!1),n&&i.arguments(n),r&&i.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=i,this}addHelpCommand(e,t){return"object"!=typeof e?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){const o=["preSubcommand","preAction","postAction"];if(!o.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if("commander.executeSubCommandAsync"!==e.code)throw e}),this}_exit(e,t,o){this._exitCallback&&this._exitCallback(new c(e,t,o)),a.exit(e)}action(e){return this._actionHandler=t=>{const o=this.registeredArguments.length,n=t.slice(0,o);return this._storeOptionsAsProperties?n[o]=this:n[o]=this.opts(),n.push(this),e.apply(this,n)},this}createOption(e,t){return new p(e,t)}_callParseArg(e,t,o,n){try{return e.parseArg(t,o)}catch(e){if("commander.invalidArgument"===e.code){const t=`${n} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const o=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${o}'\n- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){const t=e=>[e.name()].concat(e.aliases()),o=t(e).find(e=>this._findCommand(e));if(o){const n=t(this._findCommand(o)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);const t=e.name(),o=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(o,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(o,e.defaultValue,"default");const n=(t,n,r)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const i=this.getOptionValue(o);null!==t&&e.parseArg?t=this._callParseArg(e,t,i,n):null!==t&&e.variadic&&(t=e._concatValue(t,i)),null==t&&(t=!e.negate&&(!(!e.isBoolean()&&!e.optional)||"")),this.setOptionValueWithSource(o,t,r)};return this.on("option:"+t,t=>{const o=`error: option '${e.flags}' argument '${t}' is invalid.`;n(t,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{const o=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;n(t,o,"env")}),this}_optionEx(e,t,o,n,r){if("object"==typeof t&&t instanceof p)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const i=this.createOption(t,o);if(i.makeOptionMandatory(!!e.mandatory),"function"==typeof n)i.default(r).argParser(n);else if(n instanceof RegExp){const e=n;n=(t,o)=>{const n=e.exec(t);return n?n[0]:o},i.default(r).argParser(n)}else i.default(n);return this.addOption(i)}option(e,t,o,n){return this._optionEx({},e,t,o,n)}requiredOption(e,t,o,n){return this._optionEx({mandatory:!0},e,t,o,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,o){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=o,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(o=>{void 0!==o.getOptionValueSource(e)&&(t=o.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},void 0===e&&void 0===t.from){a.versions?.electron&&(t.from="electron");const e=a.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}let o;switch(void 0===e&&(e=a.argv),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],o=e.slice(2);break;case"electron":a.defaultApp?(this._scriptPath=e[1],o=e.slice(2)):o=e.slice(1);break;case"user":o=e.slice(0);break;case"eval":o=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",o}parse(e,t){const o=this._prepareUserArgs(e,t);return this._parseCommand([],o),this}async parseAsync(e,t){const o=this._prepareUserArgs(e,t);return await this._parseCommand([],o),this}_executeSubCommand(e,t){t=t.slice();let o=!1;const n=[".js",".ts",".tsx",".mjs",".cjs"];function l(e,t){const o=i.resolve(e,t);if(s.existsSync(o))return o;if(n.includes(i.extname(t)))return;const r=n.find(e=>s.existsSync(`${o}${e}`));return r?`${o}${r}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u,d=e._executableFile||`${this._name}-${e._name}`,p=this._executableDir||"";if(this._scriptPath){let e;try{e=s.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}p=i.resolve(i.dirname(e),p)}if(p){let t=l(p,d);if(!t&&!e._executableFile&&this._scriptPath){const o=i.basename(this._scriptPath,i.extname(this._scriptPath));o!==this._name&&(t=l(p,`${o}-${e._name}`))}d=t||d}if(o=n.includes(i.extname(d)),"win32"!==a.platform?o?(t.unshift(d),t=m(a.execArgv).concat(t),u=r.spawn(a.argv[0],t,{stdio:"inherit"})):u=r.spawn(d,t,{stdio:"inherit"}):(t.unshift(d),t=m(a.execArgv).concat(t),u=r.spawn(a.execPath,t,{stdio:"inherit"})),!u.killed){["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{a.on(e,()=>{!1===u.killed&&null===u.exitCode&&u.kill(e)})})}const f=this._exitCallback;u.on("close",e=>{e=e??1,f?f(new c(e,"commander.executeSubCommandAsync","(close)")):a.exit(e)}),u.on("error",t=>{if("ENOENT"===t.code){const t=p?`searched for local subcommand relative to directory '${p}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${d}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(o)}if("EACCES"===t.code)throw new Error(`'${d}' not executable`);if(f){const e=new c(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,f(e)}else a.exit(1)}),this.runningCommand=u}_dispatchSubcommand(e,t,o){const n=this._findCommand(e);let r;return n||this.help({error:!0}),r=this._chainOrCallSubCommandHook(r,n,"preSubcommand"),r=this._chainOrCall(r,()=>{if(!n._executableHandler)return n._parseCommand(t,o);this._executeSubCommand(n,t.concat(o))}),r}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const e=(e,t,o)=>{let n=t;if(null!==t&&e.parseArg){const r=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;n=this._callParseArg(e,t,o,r)}return n};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach((o,n)=>{let r=o.defaultValue;o.variadic?n<this.args.length?(r=this.args.slice(n),o.parseArg&&(r=r.reduce((t,n)=>e(o,n,t),o.defaultValue))):void 0===r&&(r=[]):n<this.args.length&&(r=this.args[n],o.parseArg&&(r=e(o,r,o.defaultValue))),t[n]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let o=e;const n=[];return this._getCommandAndAncestors().reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{n.push({hookedCommand:e,callback:t})})}),"postAction"===t&&n.reverse(),n.forEach(e=>{o=this._chainOrCall(o,()=>e.callback(e.hookedCommand,this))}),o}_chainOrCallSubCommandHook(e,t,o){let n=e;return void 0!==this._lifeCycleHooks[o]&&this._lifeCycleHooks[o].forEach(e=>{n=this._chainOrCall(n,()=>e(this,t))}),n}_parseCommand(e,t){const o=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(o.operands),t=o.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(o.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const n=()=>{o.unknown.length>0&&this.unknownOption(o.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){let o;return n(),this._processArguments(),o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))n(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){const e=this.options.filter(e=>{const t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{const o=e.find(e=>t.conflictsWith.includes(e.attributeName()));o&&this._conflictingOption(t,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){const t=[],o=[];let n=t;const r=e.slice();function i(e){return e.length>1&&"-"===e[0]}let s=null;for(;r.length;){const e=r.shift();if("--"===e){n===o&&n.push(e),n.push(...r);break}if(!s||i(e)){if(s=null,i(e)){const t=this._findOption(e);if(t){if(t.required){const e=r.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;r.length>0&&!i(r[0])&&(e=r.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);s=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){const t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),r.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("="),o=this._findOption(e.slice(0,t));if(o&&(o.required||o.optional)){this.emit(`option:${o.name()}`,e.slice(t+1));continue}}if(i(e)&&(n=o),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===o.length){if(this._findCommand(e)){t.push(e),r.length>0&&o.push(...r);break}if(this._getHelpCommand()&&e===this._getHelpCommand().name()){t.push(e),r.length>0&&t.push(...r);break}if(this._defaultCommandName){o.push(e),r.length>0&&o.push(...r);break}}if(this._passThroughOptions){n.push(e),r.length>0&&n.push(...r);break}n.push(e)}else this.emit(`option:${s.name()}`,e)}return{operands:t,unknown:o}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let o=0;o<t;o++){const t=this.options[o].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const o=t||{},n=o.exitCode||1,r=o.code||"commander.error";this._exit(n,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){const t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){const e=new f(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(o=>void 0!==o.implied&&t(o.attributeName())&&e.valueFromOption(this.getOptionValue(o.attributeName()),o)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")})})}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const o=e=>{const t=e.attributeName(),o=this.getOptionValue(t),n=this.options.find(e=>e.negate&&t===e.attributeName()),r=this.options.find(e=>!e.negate&&t===e.attributeName());return n&&(void 0===n.presetArg&&!1===o||void 0!==n.presetArg&&o===n.presetArg)?n:r||e},n=e=>{const t=o(e),n=t.attributeName();return"env"===this.getOptionValueSource(n)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},r=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],n=this;do{const e=n.createHelp().visibleOptions(n).filter(e=>e.long).map(e=>e.long);o=o.concat(e),n=n.parent}while(n&&!n._enablePositionalOptions);t=g(e,o)}const o=`error: unknown option '${e}'${t}`;this.error(o,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.length,o=1===t?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${o} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const o=[];this.createHelp().visibleCommands(this).forEach(e=>{o.push(e.name()),e.alias()&&o.push(e.alias())}),t=g(e,o)}const o=`error: unknown command '${e}'${t}`;this.error(o,{code:"commander.unknownCommand"})}version(e,t,o){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",o=o||"output the version number";const n=this.createOption(t,o);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");const o=this.parent?._findCommand(e);if(o){const t=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;const e=this.registeredArguments.map(e=>u(e));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){const t={error:!!(e=e||{}).error};let o;return o=t.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),t.write=e.write||o,t.command=this,t}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const o=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(e=>e.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let n=this.helpInformation(o);if(t&&(n=t(n),"string"!=typeof n&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");o.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(e=>e.emit("afterAllHelp",o))}helpOption(e,t){return"boolean"==typeof e?(this._helpOption=e?this._helpOption??void 0:null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=a.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const o=["beforeAll","before","after","afterAll"];if(!o.includes(e))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${o.join("', '")}'`);const n=`${e}Help`;return this.on(n,e=>{let o;o="function"==typeof t?t({error:e.error,command:e.command}):t,o&&e.write(`${o}\n`)}),this}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function m(e){return e.map(e=>{if(!e.startsWith("--inspect"))return e;let t,o,n="127.0.0.1",r="9229";return null!==(o=e.match(/^(--inspect(-brk)?)$/))?t=o[1]:null!==(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=o[1],/^\d+$/.test(o[3])?r=o[3]:n=o[3]):null!==(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=o[1],n=o[3],r=o[4]),t&&"0"!==r?`${t}=${n}:${parseInt(r)+1}`:e})}t.Command=h},20181:e=>{e.exports=t("buffer")},24434:e=>{e.exports=t("events")},24876:e=>{e.exports=t("punycode")},25811:(e,t,o)=>{o.d(t,{K:()=>l});var n,r=o(99436),i=o(35679),s=o(88568),a=o(74752),l=new i.uB("mcp").description("MCP server management");l.command("start").description("Start the BRICKS MCP server in STDIO mode").option("-t, --token <token>","API token (overrides saved token)").action((n=r(function*(e){var t=(0,a.getCurrentProfile)(),n=e.token||(0,a.getToken)(t);n||(console.error(s.default.red("Error: No API token found.")),console.error(s.default.gray("Please login first with: bricks auth login <passcode>")),console.error(s.default.gray("Or provide a token with: bricks mcp start --token <token>")),process.exit(1));try{var r=(yield Promise.all([o.e(657),o.e(480),o.e(428),o.e(886),o.e(703),o.e(737)]).then(o.bind(o,18737))).startStdioServer;yield r({token:n})}catch(e){console.error(s.default.red(`Failed to start MCP server: ${e.message}`)),process.exit(1)}}),function(e){return n.apply(this,arguments)}))},27549:function(e,t,o){e.exports=(o(35317),o(76982),function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){e.exports=o(34)},function(e,t,o){var n=o(29)("wks"),r=o(33),i=o(2).Symbol,s="function"==typeof i;(e.exports=function(e){return n[e]||(n[e]=s&&i[e]||(s?i:r)("Symbol."+e))}).store=n},function(e,t){var o=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=o)},function(e,t,o){var n=o(9);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,o){e.exports=!o(24)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,o){var n=o(12),r=o(17);e.exports=o(4)?function(e,t,o){return n.f(e,t,r(1,o))}:function(e,t,o){return e[t]=o,e}},function(e,t){var o=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=o)},function(e,t,o){var n=o(14);e.exports=function(e,t,o){if(n(e),void 0===t)return e;switch(o){case 1:return function(o){return e.call(t,o)};case 2:return function(o,n){return e.call(t,o,n)};case 3:return function(o,n,r){return e.call(t,o,n,r)}}return function(){return e.apply(t,arguments)}}},function(e,t){var o={}.hasOwnProperty;e.exports=function(e,t){return o.call(e,t)}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports={}},function(e,t){var o={}.toString;e.exports=function(e){return o.call(e).slice(8,-1)}},function(e,t,o){var n=o(3),r=o(26),i=o(32),s=Object.defineProperty;t.f=o(4)?Object.defineProperty:function(e,t,o){if(n(e),t=i(t,!0),n(o),r)try{return s(e,t,o)}catch(e){}if("get"in o||"set"in o)throw TypeError("Accessors not supported!");return"value"in o&&(e[t]=o.value),e}},function(e,t,o){var n=o(42),r=o(15);e.exports=function(e){return n(r(e))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,o){var n=o(9),r=o(2).document,i=n(r)&&n(r.createElement);e.exports=function(e){return i?r.createElement(e):{}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,o){var n=o(12).f,r=o(8),i=o(1)("toStringTag");e.exports=function(e,t,o){e&&!r(e=o?e:e.prototype,i)&&n(e,i,{configurable:!0,value:t})}},function(e,t,o){var n=o(29)("keys"),r=o(33);e.exports=function(e){return n[e]||(n[e]=r(e))}},function(e,t){var o=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:o)(e)}},function(e,t,o){var n=o(11),r=o(1)("toStringTag"),i="Arguments"==n(function(){return arguments}()),s=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,o,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(o=s(t=Object(e),r))?o:i?n(t):"Object"==(a=n(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,o){var n=o(2),r=o(6),i=o(7),s=o(5),a="prototype",l=function(e,t,o){var u,c,d,p=e&l.F,f=e&l.G,g=e&l.S,h=e&l.P,m=e&l.B,D=e&l.W,y=f?r:r[t]||(r[t]={}),v=y[a],F=f?n:g?n[t]:(n[t]||{})[a];for(u in f&&(o=t),o)(c=!p&&F&&void 0!==F[u])&&u in y||(d=c?F[u]:o[u],y[u]=f&&"function"!=typeof F[u]?o[u]:m&&c?i(d,n):D&&F[u]==d?function(e){var t=function(t,o,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,o)}return new e(t,o,n)}return e.apply(this,arguments)};return t[a]=e[a],t}(d):h&&"function"==typeof d?i(Function.call,d):d,h&&((y.virtual||(y.virtual={}))[u]=d,e&l.R&&v&&!v[u]&&s(v,u,d)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,o){e.exports=o(2).document&&document.documentElement},function(e,t,o){e.exports=!o(4)&&!o(24)(function(){return 7!=Object.defineProperty(o(16)("div"),"a",{get:function(){return 7}}).a})},function(e,t,o){var n=o(28),r=o(23),i=o(57),s=o(5),a=o(8),l=o(10),u=o(45),c=o(18),d=o(52),p=o(1)("iterator"),f=!([].keys&&"next"in[].keys()),g="@@iterator",h="keys",m="values",D=function(){return this};e.exports=function(e,t,o,y,v,F,b){u(o,t,y);var _,C,$,E=function(e){if(!f&&e in x)return x[e];switch(e){case h:case m:return function(){return new o(this,e)}}return function(){return new o(this,e)}},w=t+" Iterator",k=v==m,S=!1,x=e.prototype,O=x[p]||x[g]||v&&x[v],A=O||E(v),I=v?k?E("entries"):A:void 0,j="Array"==t&&x.entries||O;if(j&&($=d(j.call(new e)))!==Object.prototype&&(c($,w,!0),n||a($,p)||s($,p,D)),k&&O&&O.name!==m&&(S=!0,A=function(){return O.call(this)}),n&&!b||!f&&!S&&x[p]||s(x,p,A),l[t]=A,l[w]=D,v)if(_={values:k?A:E(m),keys:F?A:E(h),entries:I},b)for(C in _)C in x||i(x,C,_[C]);else r(r.P+r.F*(f||S),t,_);return _}},function(e,t){e.exports=!0},function(e,t,o){var n=o(2),r="__core-js_shared__",i=n[r]||(n[r]={});e.exports=function(e){return i[e]||(i[e]={})}},function(e,t,o){var n,r,i,s=o(7),a=o(41),l=o(25),u=o(16),c=o(2),d=c.process,p=c.setImmediate,f=c.clearImmediate,g=c.MessageChannel,h=0,m={},D="onreadystatechange",y=function(){var e=+this;if(m.hasOwnProperty(e)){var t=m[e];delete m[e],t()}},v=function(e){y.call(e.data)};p&&f||(p=function(e){for(var t=[],o=1;arguments.length>o;)t.push(arguments[o++]);return m[++h]=function(){a("function"==typeof e?e:Function(e),t)},n(h),h},f=function(e){delete m[e]},"process"==o(11)(d)?n=function(e){d.nextTick(s(y,e,1))}:g?(i=(r=new g).port2,r.port1.onmessage=v,n=s(i.postMessage,i,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(n=function(e){c.postMessage(e+"","*")},c.addEventListener("message",v,!1)):n=D in u("script")?function(e){l.appendChild(u("script"))[D]=function(){l.removeChild(this),y.call(e)}}:function(e){setTimeout(s(y,e,1),0)}),e.exports={set:p,clear:f}},function(e,t,o){var n=o(20),r=Math.min;e.exports=function(e){return e>0?r(n(e),9007199254740991):0}},function(e,t,o){var n=o(9);e.exports=function(e,t){if(!n(e))return e;var o,r;if(t&&"function"==typeof(o=e.toString)&&!n(r=o.call(e)))return r;if("function"==typeof(o=e.valueOf)&&!n(r=o.call(e)))return r;if(!t&&"function"==typeof(o=e.toString)&&!n(r=o.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){var o=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++o+n).toString(36))}},function(e,t,o){function n(e){return e&&e.__esModule?e:{default:e}}function r(){return"win32"!==process.platform?"":"ia32"===process.arch&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function i(e){return(0,d.createHash)("sha256").update(e).digest("hex")}function s(e){switch(p){case"darwin":return e.split("IOPlatformUUID")[1].split("\n")[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return e.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":case"freebsd":return e.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function a(e){var t=s((0,c.execSync)(f[p]).toString());return e?t:i(t)}function l(e){return new u.default(function(t,o){return(0,c.exec)(f[p],{},function(n,r,a){if(n)return o(new Error("Error while obtaining machine id: "+n.stack));var l=s(r.toString());return t(e?l:i(l))})})}Object.defineProperty(t,"__esModule",{value:!0});var u=n(o(35));t.machineIdSync=a,t.machineId=l;var c=o(70),d=o(71),p=process.platform,f={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:{native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"}[r()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(e,t,o){e.exports={default:o(36),__esModule:!0}},function(e,t,o){o(66),o(68),o(69),o(67),e.exports=o(6).Promise},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t,o,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(o+": incorrect invocation!");return e}},function(e,t,o){var n=o(13),r=o(31),i=o(62);e.exports=function(e){return function(t,o,s){var a,l=n(t),u=r(l.length),c=i(s,u);if(e&&o!=o){for(;u>c;)if((a=l[c++])!=a)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===o)return e||c||0;return!e&&-1}}},function(e,t,o){var n=o(7),r=o(44),i=o(43),s=o(3),a=o(31),l=o(64),u={},c={};t=e.exports=function(e,t,o,d,p){var f,g,h,m,D=p?function(){return e}:l(e),y=n(o,d,t?2:1),v=0;if("function"!=typeof D)throw TypeError(e+" is not iterable!");if(i(D)){for(f=a(e.length);f>v;v++)if((m=t?y(s(g=e[v])[0],g[1]):y(e[v]))===u||m===c)return m}else for(h=D.call(e);!(g=h.next()).done;)if((m=r(h,y,g.value,t))===u||m===c)return m},t.BREAK=u,t.RETURN=c},function(e,t){e.exports=function(e,t,o){var n=void 0===o;switch(t.length){case 0:return n?e():e.call(o);case 1:return n?e(t[0]):e.call(o,t[0]);case 2:return n?e(t[0],t[1]):e.call(o,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(o,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(o,t[0],t[1],t[2],t[3])}return e.apply(o,t)}},function(e,t,o){var n=o(11);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},function(e,t,o){var n=o(10),r=o(1)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||i[r]===e)}},function(e,t,o){var n=o(3);e.exports=function(e,t,o,r){try{return r?t(n(o)[0],o[1]):t(o)}catch(t){var i=e.return;throw void 0!==i&&n(i.call(e)),t}}},function(e,t,o){var n=o(49),r=o(17),i=o(18),s={};o(5)(s,o(1)("iterator"),function(){return this}),e.exports=function(e,t,o){e.prototype=n(s,{next:r(1,o)}),i(e,t+" Iterator")}},function(e,t,o){var n=o(1)("iterator"),r=!1;try{var i=[7][n]();i.return=function(){r=!0},Array.from(i,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!r)return!1;var o=!1;try{var i=[7],s=i[n]();s.next=function(){return{done:o=!0}},i[n]=function(){return s},e(i)}catch(e){}return o}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,o){var n=o(2),r=o(30).set,i=n.MutationObserver||n.WebKitMutationObserver,s=n.process,a=n.Promise,l="process"==o(11)(s);e.exports=function(){var e,t,o,u=function(){var n,r;for(l&&(n=s.domain)&&n.exit();e;){r=e.fn,e=e.next;try{r()}catch(n){throw e?o():t=void 0,n}}t=void 0,n&&n.enter()};if(l)o=function(){s.nextTick(u)};else if(i){var c=!0,d=document.createTextNode("");new i(u).observe(d,{characterData:!0}),o=function(){d.data=c=!c}}else if(a&&a.resolve){var p=a.resolve();o=function(){p.then(u)}}else o=function(){r.call(n,u)};return function(n){var r={fn:n,next:void 0};t&&(t.next=r),e||(e=r,o()),t=r}}},function(e,t,o){var n=o(3),r=o(50),i=o(22),s=o(19)("IE_PROTO"),a=function(){},l="prototype",u=function(){var e,t=o(16)("iframe"),n=i.length,r=">";for(t.style.display="none",o(25).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object</script"+r),e.close(),u=e.F;n--;)delete u[l][i[n]];return u()};e.exports=Object.create||function(e,t){var o;return null!==e?(a[l]=n(e),o=new a,a[l]=null,o[s]=e):o=u(),void 0===t?o:r(o,t)}},function(e,t,o){var n=o(12),r=o(3),i=o(54);e.exports=o(4)?Object.defineProperties:function(e,t){r(e);for(var o,s=i(t),a=s.length,l=0;a>l;)n.f(e,o=s[l++],t[o]);return e}},function(e,t,o){var n=o(55),r=o(17),i=o(13),s=o(32),a=o(8),l=o(26),u=Object.getOwnPropertyDescriptor;t.f=o(4)?u:function(e,t){if(e=i(e),t=s(t,!0),l)try{return u(e,t)}catch(e){}if(a(e,t))return r(!n.f.call(e,t),e[t])}},function(e,t,o){var n=o(8),r=o(63),i=o(19)("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=r(e),n(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},function(e,t,o){var n=o(8),r=o(13),i=o(39)(!1),s=o(19)("IE_PROTO");e.exports=function(e,t){var o,a=r(e),l=0,u=[];for(o in a)o!=s&&n(a,o)&&u.push(o);for(;t.length>l;)n(a,o=t[l++])&&(~i(u,o)||u.push(o));return u}},function(e,t,o){var n=o(53),r=o(22);e.exports=Object.keys||function(e){return n(e,r)}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,o){var n=o(5);e.exports=function(e,t,o){for(var r in t)o&&e[r]?e[r]=t[r]:n(e,r,t[r]);return e}},function(e,t,o){e.exports=o(5)},function(e,t,o){var n=o(9),r=o(3),i=function(e,t){if(r(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{(n=o(7)(Function.call,o(51).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,o){return i(e,o),t?e.__proto__=o:n(e,o),e}}({},!1):void 0),check:i}},function(e,t,o){var n=o(2),r=o(6),i=o(12),s=o(4),a=o(1)("species");e.exports=function(e){var t="function"==typeof r[e]?r[e]:n[e];s&&t&&!t[a]&&i.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,o){var n=o(3),r=o(14),i=o(1)("species");e.exports=function(e,t){var o,s=n(e).constructor;return void 0===s||null==(o=n(s)[i])?t:r(o)}},function(e,t,o){var n=o(20),r=o(15);e.exports=function(e){return function(t,o){var i,s,a=String(r(t)),l=n(o),u=a.length;return l<0||l>=u?e?"":void 0:(i=a.charCodeAt(l))<55296||i>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?e?a.charAt(l):i:e?a.slice(l,l+2):s-56320+(i-55296<<10)+65536}}},function(e,t,o){var n=o(20),r=Math.max,i=Math.min;e.exports=function(e,t){return(e=n(e))<0?r(e+t,0):i(e,t)}},function(e,t,o){var n=o(15);e.exports=function(e){return Object(n(e))}},function(e,t,o){var n=o(21),r=o(1)("iterator"),i=o(10);e.exports=o(6).getIteratorMethod=function(e){if(null!=e)return e[r]||e["@@iterator"]||i[n(e)]}},function(e,t,o){var n=o(37),r=o(47),i=o(10),s=o(13);e.exports=o(27)(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,o=this._i++;return!e||o>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?o:"values"==t?e[o]:[o,e[o]])},"values"),i.Arguments=i.Array,n("keys"),n("values"),n("entries")},function(e,t){},function(e,t,o){var n,r,i,s=o(28),a=o(2),l=o(7),u=o(21),c=o(23),d=o(9),p=(o(3),o(14)),f=o(38),g=o(40),h=(o(58).set,o(60)),m=o(30).set,D=o(48)(),y="Promise",v=a.TypeError,F=a.process,b=a[y],_="process"==u(F=a.process),C=function(){},$=!!function(){try{var e=b.resolve(1),t=(e.constructor={})[o(1)("species")]=function(e){e(C,C)};return(_||"function"==typeof PromiseRejectionEvent)&&e.then(C)instanceof t}catch(e){}}(),E=function(e,t){return e===t||e===b&&t===i},w=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},k=function(e){return E(b,e)?new S(e):new r(e)},S=r=function(e){var t,o;this.promise=new e(function(e,n){if(void 0!==t||void 0!==o)throw v("Bad Promise constructor");t=e,o=n}),this.resolve=p(t),this.reject=p(o)},x=function(e){try{e()}catch(e){return{error:e}}},O=function(e,t){if(!e._n){e._n=!0;var o=e._c;D(function(){for(var n=e._v,r=1==e._s,i=0,s=function(t){var o,i,s=r?t.ok:t.fail,a=t.resolve,l=t.reject,u=t.domain;try{s?(r||(2==e._h&&j(e),e._h=1),!0===s?o=n:(u&&u.enter(),o=s(n),u&&u.exit()),o===t.promise?l(v("Promise-chain cycle")):(i=w(o))?i.call(o,a,l):a(o)):l(n)}catch(e){l(e)}};o.length>i;)s(o[i++]);e._c=[],e._n=!1,t&&!e._h&&A(e)})}},A=function(e){m.call(a,function(){var t,o,n,r=e._v;if(I(e)&&(t=x(function(){_?F.emit("unhandledRejection",r,e):(o=a.onunhandledrejection)?o({promise:e,reason:r}):(n=a.console)&&n.error&&n.error("Unhandled promise rejection",r)}),e._h=_||I(e)?2:1),e._a=void 0,t)throw t.error})},I=function(e){if(1==e._h)return!1;for(var t,o=e._a||e._c,n=0;o.length>n;)if((t=o[n++]).fail||!I(t.promise))return!1;return!0},j=function(e){m.call(a,function(){var t;_?F.emit("rejectionHandled",e):(t=a.onrejectionhandled)&&t({promise:e,reason:e._v})})},B=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),O(t,!0))},N=function(e){var t,o=this;if(!o._d){o._d=!0,o=o._w||o;try{if(o===e)throw v("Promise can't be resolved itself");(t=w(e))?D(function(){var n={_w:o,_d:!1};try{t.call(e,l(N,n,1),l(B,n,1))}catch(e){B.call(n,e)}}):(o._v=e,o._s=1,O(o,!1))}catch(e){B.call({_w:o,_d:!1},e)}}};$||(b=function(e){f(this,b,y,"_h"),p(e),n.call(this);try{e(l(N,this,1),l(B,this,1))}catch(e){B.call(this,e)}},(n=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=o(56)(b.prototype,{then:function(e,t){var o=k(h(this,b));return o.ok="function"!=typeof e||e,o.fail="function"==typeof t&&t,o.domain=_?F.domain:void 0,this._c.push(o),this._a&&this._a.push(o),this._s&&O(this,!1),o.promise},catch:function(e){return this.then(void 0,e)}}),S=function(){var e=new n;this.promise=e,this.resolve=l(N,e,1),this.reject=l(B,e,1)}),c(c.G+c.W+c.F*!$,{Promise:b}),o(18)(b,y),o(59)(y),i=o(6)[y],c(c.S+c.F*!$,y,{reject:function(e){var t=k(this);return(0,t.reject)(e),t.promise}}),c(c.S+c.F*(s||!$),y,{resolve:function(e){if(e instanceof b&&E(e.constructor,this))return e;var t=k(this);return(0,t.resolve)(e),t.promise}}),c(c.S+c.F*!($&&o(46)(function(e){b.all(e).catch(C)})),y,{all:function(e){var t=this,o=k(t),n=o.resolve,r=o.reject,i=x(function(){var o=[],i=0,s=1;g(e,!1,function(e){var a=i++,l=!1;o.push(void 0),s++,t.resolve(e).then(function(e){l||(l=!0,o[a]=e,--s||n(o))},r)}),--s||n(o)});return i&&r(i.error),o.promise},race:function(e){var t=this,o=k(t),n=o.reject,r=x(function(){g(e,!1,function(e){t.resolve(e).then(o.resolve,n)})});return r&&n(r.error),o.promise}})},function(e,t,o){var n=o(61)(!0);o(27)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,o=this._i;return o>=t.length?{value:void 0,done:!0}:(e=n(t,o),this._i+=e.length,{value:e,done:!1})})},function(e,t,o){o(65);for(var n=o(2),r=o(5),i=o(10),s=o(1)("toStringTag"),a=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],l=0;l<5;l++){var u=a[l],c=n[u],d=c&&c.prototype;d&&!d[s]&&r(d,s,u),i[u]=i.Array}},function(e,t){e.exports=o(35317)},function(e,t){e.exports=o(76982)}]))},29122:(e,t,o)=>{o.d(t,{A:()=>r});var n=o(1708);function r(){const{env:e}=n,{TERM:t,TERM_PROGRAM:o}=e;return"win32"!==n.platform?"linux"!==t:Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||"{cmd::Cmder}"===e.ConEmuTask||"Terminus-Sublime"===o||"vscode"===o||"xterm-256color"===t||"alacritty"===t||"rxvt-unicode"===t||"rxvt-unicode-256color"===t||"JetBrains-JediTerm"===e.TERMINAL_EMULATOR}},29557:e=>{e.exports=n},29790:(e,t,o)=>{o.d(t,{default:()=>Y,oraPromise:()=>z,spinners:()=>A}),o.r(t);var n=o(1708),r=o(88568);const i=(e,t,o,n)=>{if("length"===o||"prototype"===o)return;if("arguments"===o||"caller"===o)return;const r=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);!s(r,i)&&n||Object.defineProperty(e,o,i)},s=function(e,t){return void 0===e||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},a=(e,t)=>`/* Wrapped ${e}*/\n${t}`,l=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),u=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");function c(e,t,{ignoreNonConfigurable:o=!1}={}){const{name:n}=e;for(const n of Reflect.ownKeys(t))i(e,t,n,o);return((e,t)=>{const o=Object.getPrototypeOf(t);o!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,o)})(e,t),((e,t,o)=>{const n=""===o?"":`with ${o.trim()}() `,r=a.bind(null,n,t.toString());Object.defineProperty(r,"name",u);const{writable:i,enumerable:s,configurable:c}=l;Object.defineProperty(e,"toString",{value:r,writable:i,enumerable:s,configurable:c})})(e,t,n),e}const d=new WeakMap,p=(e,t={})=>{if("function"!=typeof e)throw new TypeError("Expected a function");let o,n=0;const r=e.displayName||e.name||"<anonymous>",i=function(...s){if(d.set(i,++n),1===n)o=e.apply(this,s),e=void 0;else if(!0===t.throw)throw new Error(`Function \`${r}\` can only be called once`);return o};return c(i,e),d.set(i,n),i};p.callCount=e=>{if(!d.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return d.get(e)};const f=p,g=[];g.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&g.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&g.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const h=e=>!!e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on,m=Symbol.for("signal-exit emitter"),D=globalThis,y=Object.defineProperty.bind(Object);class v{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(D[m])return D[m];y(D,m,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){const o=this.listeners[e],n=o.indexOf(t);-1!==n&&(0===n&&1===o.length?o.length=0:o.splice(n,1))}emit(e,t,o){if(this.emitted[e])return!1;this.emitted[e]=!0;let n=!1;for(const r of this.listeners[e])n=!0===r(t,o)||n;return"exit"===e&&(n=this.emit("afterExit",t,o)||n),n}}class F{}const b=globalThis.process,{onExit:_,load:C,unload:$}=(E=h(b)?new class extends F{#e="win32"===b.platform?"SIGINT":"SIGHUP";#t=new v;#o;#n;#r;#i={};#s=!1;constructor(e){super(),this.#o=e,this.#i={};for(const t of g)this.#i[t]=()=>{const o=this.#o.listeners(t);let{count:n}=this.#t;const r=e;if("object"==typeof r.__signal_exit_emitter__&&"number"==typeof r.__signal_exit_emitter__.count&&(n+=r.__signal_exit_emitter__.count),o.length===n){this.unload();const o=this.#t.emit("exit",null,t),n="SIGHUP"===t?this.#e:t;o||e.kill(e.pid,n)}};this.#r=e.reallyExit,this.#n=e.emit}onExit(e,t){if(!h(this.#o))return()=>{};!1===this.#s&&this.load();const o=t?.alwaysLast?"afterExit":"exit";return this.#t.on(o,e),()=>{this.#t.removeListener(o,e),0===this.#t.listeners.exit.length&&0===this.#t.listeners.afterExit.length&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#t.count+=1;for(const e of g)try{const t=this.#i[e];t&&this.#o.on(e,t)}catch(e){}this.#o.emit=(e,...t)=>this.#a(e,...t),this.#o.reallyExit=e=>this.#l(e)}}unload(){this.#s&&(this.#s=!1,g.forEach(e=>{const t=this.#i[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#o.removeListener(e,t)}catch(e){}}),this.#o.emit=this.#n,this.#o.reallyExit=this.#r,this.#t.count-=1)}#l(e){return h(this.#o)?(this.#o.exitCode=e||0,this.#t.emit("exit",this.#o.exitCode,null),this.#r.call(this.#o,this.#o.exitCode)):0}#a(e,...t){const o=this.#n;if("exit"===e&&h(this.#o)){"number"==typeof t[0]&&(this.#o.exitCode=t[0]);const n=o.call(this.#o,e,...t);return this.#t.emit("exit",this.#o.exitCode,null),n}return o.call(this.#o,e,...t)}}(b):new class extends F{onExit(){return()=>{}}load(){}unload(){}},{onExit:(e,t)=>E.onExit(e,t),load:()=>E.load(),unload:()=>E.unload()});var E;const w=n.stderr.isTTY?n.stderr:n.stdout.isTTY?n.stdout:void 0,k=w?f(()=>{_(()=>{w.write("[?25h")},{alwaysLast:!0})}):()=>{};let S=!1;const x={show:(e=n.stderr)=>{e.isTTY&&(S=!1,e.write("[?25h"))},hide:(e=n.stderr)=>{e.isTTY&&(k(),S=!0,e.write("[?25l"))},toggle:(e,t)=>{void 0!==e&&(S=e),S?x.show(t):x.hide(t)}},O=x;var A=o(47661);const I={info:r.default.blue("ℹ"),success:r.default.green("✔"),warning:r.default.yellow("⚠"),error:r.default.red("✖")},j={info:r.default.blue("i"),success:r.default.green("√"),warning:r.default.yellow("‼"),error:r.default.red("×")},B=("win32"!==n.platform?"linux"!==n.env.TERM:Boolean(n.env.CI)||Boolean(n.env.WT_SESSION)||Boolean(n.env.TERMINUS_SUBLIME)||"{cmd::Cmder}"===n.env.ConEmuTask||"Terminus-Sublime"===n.env.TERM_PROGRAM||"vscode"===n.env.TERM_PROGRAM||"xterm-256color"===n.env.TERM||"alacritty"===n.env.TERM||"JetBrains-JediTerm"===n.env.TERMINAL_EMULATOR)?I:j;const N=function({onlyFirst:e=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")}();function T(e){if("string"!=typeof e)throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(N,"")}function P(e){return 161===e||164===e||167===e||168===e||170===e||173===e||174===e||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||198===e||208===e||215===e||216===e||e>=222&&e<=225||230===e||e>=232&&e<=234||236===e||237===e||240===e||242===e||243===e||e>=247&&e<=250||252===e||254===e||257===e||273===e||275===e||283===e||294===e||295===e||299===e||e>=305&&e<=307||312===e||e>=319&&e<=322||324===e||e>=328&&e<=331||333===e||338===e||339===e||358===e||359===e||363===e||462===e||464===e||466===e||468===e||470===e||472===e||474===e||476===e||593===e||609===e||708===e||711===e||e>=713&&e<=715||717===e||720===e||e>=728&&e<=731||733===e||735===e||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||1025===e||e>=1040&&e<=1103||1105===e||8208===e||e>=8211&&e<=8214||8216===e||8217===e||8220===e||8221===e||e>=8224&&e<=8226||e>=8228&&e<=8231||8240===e||8242===e||8243===e||8245===e||8251===e||8254===e||8308===e||8319===e||e>=8321&&e<=8324||8364===e||8451===e||8453===e||8457===e||8467===e||8470===e||8481===e||8482===e||8486===e||8491===e||8531===e||8532===e||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||8585===e||e>=8592&&e<=8601||8632===e||8633===e||8658===e||8660===e||8679===e||8704===e||8706===e||8707===e||8711===e||8712===e||8715===e||8719===e||8721===e||8725===e||8730===e||e>=8733&&e<=8736||8739===e||8741===e||e>=8743&&e<=8748||8750===e||e>=8756&&e<=8759||8764===e||8765===e||8776===e||8780===e||8786===e||8800===e||8801===e||e>=8804&&e<=8807||8810===e||8811===e||8814===e||8815===e||8834===e||8835===e||8838===e||8839===e||8853===e||8857===e||8869===e||8895===e||8978===e||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||9632===e||9633===e||e>=9635&&e<=9641||9650===e||9651===e||9654===e||9655===e||9660===e||9661===e||9664===e||9665===e||e>=9670&&e<=9672||9675===e||e>=9678&&e<=9681||e>=9698&&e<=9701||9711===e||9733===e||9734===e||9737===e||9742===e||9743===e||9756===e||9758===e||9792===e||9794===e||9824===e||9825===e||e>=9827&&e<=9829||e>=9831&&e<=9834||9836===e||9837===e||9839===e||9886===e||9887===e||9919===e||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||9955===e||9960===e||9961===e||e>=9963&&e<=9969||9972===e||e>=9974&&e<=9977||9979===e||9980===e||9982===e||9983===e||10045===e||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||65533===e||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||127375===e||127376===e||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function M(e){return 12288===e||e>=65281&&e<=65376||e>=65504&&e<=65510}function R(e){return e>=4352&&e<=4447||8986===e||8987===e||9001===e||9002===e||e>=9193&&e<=9196||9200===e||9203===e||9725===e||9726===e||9748===e||9749===e||e>=9776&&e<=9783||e>=9800&&e<=9811||9855===e||e>=9866&&e<=9871||9875===e||9889===e||9898===e||9899===e||9917===e||9918===e||9924===e||9925===e||9934===e||9940===e||9962===e||9970===e||9971===e||9973===e||9978===e||9981===e||9989===e||9994===e||9995===e||10024===e||10060===e||10062===e||e>=10067&&e<=10069||10071===e||e>=10133&&e<=10135||10160===e||10175===e||11035===e||11036===e||11088===e||11093===e||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||110589===e||110590===e||e>=110592&&e<=110882||110898===e||e>=110928&&e<=110930||110933===e||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||126980===e||127183===e||127374===e||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||127568===e||127569===e||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||127988===e||e>=127992&&e<=128062||128064===e||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||128378===e||128405===e||128406===e||128420===e||e>=128507&&e<=128591||e>=128640&&e<=128709||128716===e||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||128747===e||128748===e||e>=128756&&e<=128764||e>=128992&&e<=129003||129008===e||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||129736===e||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function U(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function L(e,{ambiguousAsWide:t=!1}={}){return U(e),M(e)||R(e)||t&&P(e)?2:1}const J=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,q=new Intl.Segmenter,V=/^\p{Default_Ignorable_Code_Point}$/u;function G(e,t={}){if("string"!=typeof e||0===e.length)return 0;const{ambiguousIsNarrow:o=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=T(e)),0===e.length)return 0;let r=0;const i={ambiguousAsWide:!o};for(const{segment:t}of q.segment(e)){const e=t.codePointAt(0);e<=31||e>=127&&e<=159||(e>=8203&&e<=8207||65279===e||e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=55296&&e<=57343||e>=65024&&e<=65039||V.test(t)||(J().test(t)?r+=2:r+=L(e,i)))}return r}var W=o(29122);const H=new class{#u=0;start(){this.#u++,1===this.#u&&this.#c()}stop(){if(this.#u<=0)throw new Error("`stop` called more times than `start`");this.#u--,0===this.#u&&this.#d()}#c(){"win32"!==n.platform&&n.stdin.isTTY&&(n.stdin.setRawMode(!0),n.stdin.on("data",this.#p),n.stdin.resume())}#d(){n.stdin.isTTY&&(n.stdin.off("data",this.#p),n.stdin.pause(),n.stdin.setRawMode(!1))}#p(e){3===e[0]&&n.emit("SIGINT")}};class K{#f=0;#g=!1;#h=0;#m=-1;#D=0;#y;#v;#F;#b;#_;#C;#$;#E;#w;#k;#S;color;constructor(e){"string"==typeof e&&(e={text:e}),this.#y={color:"cyan",stream:n.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#y.color,this.spinner=this.#y.spinner,this.#_=this.#y.interval,this.#F=this.#y.stream,this.#C="boolean"==typeof this.#y.isEnabled?this.#y.isEnabled:function({stream:e=process.stdout}={}){return Boolean(e&&e.isTTY&&"dumb"!==process.env.TERM&&!("CI"in process.env))}({stream:this.#F}),this.#$="boolean"==typeof this.#y.isSilent&&this.#y.isSilent,this.text=this.#y.text,this.prefixText=this.#y.prefixText,this.suffixText=this.#y.suffixText,this.indent=this.#y.indent}get indent(){return this.#E}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#E=e,this.#x()}get interval(){return this.#_??this.#v.interval??100}get spinner(){return this.#v}set spinner(e){if(this.#m=-1,this.#_=void 0,"object"==typeof e){if(void 0===e.frames)throw new Error("The given spinner must have a `frames` property");this.#v=e}else if((0,W.A)())if(void 0===e)this.#v=A.dots;else{if("default"===e||!A[e])throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);this.#v=A[e]}else this.#v=A.line}get text(){return this.#w}set text(e=""){this.#w=e,this.#x()}get prefixText(){return this.#k}set prefixText(e=""){this.#k=e,this.#x()}get suffixText(){return this.#S}set suffixText(e=""){this.#S=e,this.#x()}get isSpinning(){return void 0!==this.#b}#O(e=this.#k,t=" "){return"string"==typeof e&&""!==e?e+t:"function"==typeof e?e()+t:""}#A(e=this.#S,t=" "){return"string"==typeof e&&""!==e?t+e:"function"==typeof e?t+e():""}#x(){const e=this.#F.columns??80,t=this.#O(this.#k,"-"),o=this.#A(this.#S,"-"),n=" ".repeat(this.#E)+t+"--"+this.#w+"--"+o;this.#h=0;for(const t of T(n).split("\n"))this.#h+=Math.max(1,Math.ceil(G(t,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#C&&!this.#$}set isEnabled(e){if("boolean"!=typeof e)throw new TypeError("The `isEnabled` option must be a boolean");this.#C=e}get isSilent(){return this.#$}set isSilent(e){if("boolean"!=typeof e)throw new TypeError("The `isSilent` option must be a boolean");this.#$=e}frame(){const e=Date.now();(-1===this.#m||e-this.#D>=this.interval)&&(this.#m=++this.#m%this.#v.frames.length,this.#D=e);const{frames:t}=this.#v;let o=t[this.#m];this.color&&(o=r.default[this.color](o));return("string"==typeof this.#k&&""!==this.#k?this.#k+" ":"")+o+("string"==typeof this.text?" "+this.text:"")+("string"==typeof this.#S&&""!==this.#S?" "+this.#S:"")}clear(){if(!this.#C||!this.#F.isTTY)return this;this.#F.cursorTo(0);for(let e=0;e<this.#f;e++)e>0&&this.#F.moveCursor(0,-1),this.#F.clearLine(1);return(this.#E||this.lastIndent!==this.#E)&&this.#F.cursorTo(this.#E),this.lastIndent=this.#E,this.#f=0,this}render(){return this.#$||(this.clear(),this.#F.write(this.frame()),this.#f=this.#h),this}start(e){return e&&(this.text=e),this.#$?this:this.#C?(this.isSpinning||(this.#y.hideCursor&&O.hide(this.#F),this.#y.discardStdin&&n.stdin.isTTY&&(this.#g=!0,H.start()),this.render(),this.#b=setInterval(this.render.bind(this),this.interval)),this):(this.text&&this.#F.write(`- ${this.text}\n`),this)}stop(){return this.#C?(clearInterval(this.#b),this.#b=void 0,this.#m=0,this.clear(),this.#y.hideCursor&&O.show(this.#F),this.#y.discardStdin&&n.stdin.isTTY&&this.#g&&(H.stop(),this.#g=!1),this):this}succeed(e){return this.stopAndPersist({symbol:B.success,text:e})}fail(e){return this.stopAndPersist({symbol:B.error,text:e})}warn(e){return this.stopAndPersist({symbol:B.warning,text:e})}info(e){return this.stopAndPersist({symbol:B.info,text:e})}stopAndPersist(e={}){if(this.#$)return this;const t=e.prefixText??this.#k,o=this.#O(t," "),n=e.symbol??" ",r=e.text??this.text,i="string"==typeof r?(n?" ":"")+r:"",s=e.suffixText??this.#S,a=o+n+i+this.#A(s," ")+"\n";return this.stop(),this.#F.write(a),this}}function Y(e){return new K(e)}async function z(e,t){const o="function"==typeof e,n="function"==typeof e.then;if(!o&&!n)throw new TypeError("Parameter `action` must be a Function or a Promise");const{successText:r,failText:i}="object"==typeof t?t:{successText:void 0,failText:void 0},s=Y(t).start();try{const t=o?e(s):e,n=await t;return s.succeed(void 0===r?void 0:"string"==typeof r?r:r(n)),n}catch(e){throw s.fail(void 0===i?void 0:"string"==typeof i?i:i(e)),e}}},31421:e=>{e.exports=t("node:child_process")},34528:(e,t,o)=>{o.d(t,{p:()=>C});var n,r,i,s,a,l,u,c=o(68832),d=o(99436),p=o(35679),f=o(88568),g=o(29790),h=o(34992),m=o(88055),D=o(75706),y=o(6939),v=3e5,F=e=>{if(!e)return f.default.gray("○");var t=Date.now()-new Date(e).getTime();return t<=v?f.default.green("●"):Math.floor(t/6e4)<60?f.default.yellow("○"):f.default.red("○")},b=(e,t)=>(0,y.H_)(e,t,{deviceCount:e?.devices?.length||0}),_=["refresh","clear-cache","system-menu-open","system-menu-close","system-info-open","system-info-close","local-sync-panel-open","local-sync-panel-close","debug-panel-open","debug-panel-close","logging-on","logging-off","test-panel-open","test-panel-close"],C=new p.uB("group").description("Device Group management");C.command("list").description("List all device groups").option("-j, --json","Output as JSON").action((n=d(function*(e){var t=(0,m.requireAuth)(),o=(0,g.default)("Fetching device groups...").start();try{var n=yield t.deviceGroups({});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(f.default.yellow("No device groups found"));console.log(f.default.bold("\nDevice Groups")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.devices?.length||0;console.log(`● ${f.default.cyan(e.name)} ${f.default.gray(`(${t} devices)`)}`),console.log(` ID: ${f.default.gray(e._id)}`),e.description&&console.log(` ${f.default.gray(e.description)}`),console.log()})}catch(e){o.fail(`Failed to list groups: ${e.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),C.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action((r=d(function*(e,t){var o=(0,m.requireAuth)(),n=(0,g.default)("Fetching device group...").start();try{var r=yield o.deviceGroup({id:e});if(n.stop(),r||(console.log(f.default.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));console.log(f.default.bold(`\nDevice Group: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${f.default.gray(r._id)}`),console.log(`Description: ${r.description||f.default.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||f.default.gray("None")}`),console.log(`Created: ${f.default.gray(r.create_datetime)}`),console.log(`Modified: ${f.default.gray(r.last_modify_datetime)}`),r.devices?.length>0&&(console.log(`\n${f.default.bold("Devices")} (${r.devices.length})`),r.devices.forEach(e=>{var t=e.device_target_name||e.device_id;console.log(` - ${t} ${f.default.gray(`(${e.device_id})`)}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get group: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),C.command("resolve <query>").description("Resolve a device group name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((i=d(function*(e,t){var o=(0,m.requireAuth)(),n=t.json?null:(0,g.default)("Resolving device group...").start();try{var r=yield(0,D.Y)(()=>o.deviceGroup({id:e})),i=r?[r]:yield o.deviceGroups({paginate:{limit:t.limit}}),s=r?i:(i||[]).filter(t=>t.name?.toLowerCase().includes(e.trim().toLowerCase())),a=(0,D.K)({resource:"group",query:e,items:s||[],fields:["_id","name"],selectedBy:r?"id":null});if(n&&n.stop(),t.json)return void(0,h.GF)(a);if(a.resolved){var l=a.resolved;return console.log(f.default.bold("\nResolved Device Group")),console.log("─".repeat(60)),console.log(`Name: ${f.default.cyan(l.name||"Unnamed")}`),console.log(`ID: ${f.default.gray(l._id)}`),console.log(`Selected By: ${a.selectedBy}`),void console.log("─".repeat(60))}if(0===a.matches.length)return void console.log(f.default.yellow(`No device groups matched "${e}"`));console.log(f.default.bold(`\nMatching Device Groups (${a.matches.length})`)),console.log("─".repeat(80)),a.matches.forEach(e=>{console.log(`${f.default.cyan(e.name||"Unnamed")} ${f.default.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){n?n.fail(`Failed to resolve device group: ${t.message}`):(0,h.OW)(t.message,{resource:"group",query:e}),process.exit(1)}}),function(e,t){return i.apply(this,arguments)})),C.command("devices <id>").description("List devices in a group with status").option("-j, --json","Output as JSON").action((s=d(function*(e,t){var o=(0,m.requireAuth)(),n=(0,g.default)("Fetching devices...").start();try{var r=yield o.devicesByGroup({id:e});if(n.stop(),t.json)return void console.log(JSON.stringify(r,null,2));if(!r||0===r.length)return void console.log(f.default.yellow("No devices in this group"));console.log(f.default.bold("\nDevices in Group")),console.log("─".repeat(80)),r.forEach(e=>{var t=e.device||{},o=t.entry_detail?.watch_dog_timer?.last_alive_time,n=F(o),r=t.name||t.device_name||e.target_name||t._id||"Unknown",i=t.entry_detail?.application?.name||f.default.gray("No app");console.log(`${n} ${f.default.cyan(r.padEnd(30))} ${i}`)}),console.log("─".repeat(80))}catch(e){n.fail(`Failed to get devices: ${e.message}`),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),C.command("dispatch <id> <action>").description("Dispatch action to all devices in group").option("--dry-run","Validate inputs and show the dispatch plan without sending it").option("-j, --json","Output as JSON").action((a=d(function*(e,t,o){var n=(0,m.requireAuth)(),r=o.json?null:(0,g.default)(`Dispatching ${t}...`).start();_.includes(t)||(o.json?(0,h.OW)(`Invalid action. Valid actions: ${_.join(", ")}`,{action:"group.dispatch",target:{id:e}}):r.fail(`Invalid action. Valid actions: ${_.join(", ")}`),process.exit(1));try{var i=yield n.deviceGroup({id:e});if(!i)throw new Error("Device group not found");if(o.dryRun)return r&&r.stop(),void(0,y.S5)({action:"group.dispatch",target:b(i,e),request:{action:t},checks:[(0,y.Iy)("group exists",!0,`${i.name} (${i._id})`),(0,y.Iy)("action is valid",!0)],json:o.json});var s=yield n.dispatchDeviceGroupAction({id:e,action:t});o.json?(0,y.yd)({action:"group.dispatch",target:b(i,e),result:{action:t,dispatched:s?.dispatched||0,devices:s?.devices||0},json:!0}):(r.succeed(`Action dispatched: ${f.default.green(t)}`),s&&(console.log(`Dispatched: ${f.default.green(s.dispatched||0)}`),console.log(`Devices: ${f.default.gray(s.devices||0)}`)))}catch(t){o.json?(0,h.OW)(t.message,{action:"group.dispatch",target:{id:e}}):r.fail(`Failed to dispatch action: ${t.message}`),process.exit(1)}}),function(e,t,o){return a.apply(this,arguments)})),C.command("refresh <id>").description("Refresh all devices in group").option("--dry-run","Validate inputs and show the refresh plan without sending it").option("-j, --json","Output as JSON").action((l=d(function*(e,t){var o=(0,m.requireAuth)(),n=t.json?null:(0,g.default)("Refreshing devices...").start();try{var r=yield o.deviceGroup({id:e});if(!r)throw new Error("Device group not found");if(t.dryRun)return n&&n.stop(),void(0,y.S5)({action:"group.refresh",target:b(r,e),request:{action:"refresh"},checks:[(0,y.Iy)("group exists",!0,`${r.name} (${r._id})`)],json:t.json});var i=yield o.dispatchDeviceGroupAction({id:e,action:"refresh"});t.json?(0,y.yd)({action:"group.refresh",target:b(r,e),result:{dispatched:i?.dispatched||0,devices:i?.devices||0},json:!0}):(n.succeed("Devices refreshed"),i&&(console.log(`Dispatched: ${f.default.green(i.dispatched||0)}`),console.log(`Devices: ${f.default.gray(i.devices||0)}`)))}catch(o){t.json?(0,h.OW)(o.message,{action:"group.refresh",target:{id:e}}):n.fail(`Failed to refresh: ${o.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),C.command("monitor <id>").description("Monitor devices in group (polls every 60s)").option("-i, --interval <seconds>","Polling interval in seconds","60").action((u=d(function*(e,t){var o=(0,m.requireAuth)(),n=1e3*parseInt(t.interval,10);console.log(f.default.bold("\nDevice Group Monitor")),console.log(f.default.gray(`Polling every ${t.interval}s. Press Ctrl+C to stop.\n`));var r,i=(r=d(function*(){try{var t=yield Promise.all([o.deviceGroup({id:e}),o.devicesByGroup({id:e})]),n=c(t,2),r=n[0],i=n[1];if(process.stdout.write("[2J[0f"),console.log(f.default.bold(`Device Group: ${r.name}`)+f.default.gray(` - ${(new Date).toLocaleTimeString()}`)),console.log("─".repeat(80)),!i||0===i.length)return void console.log(f.default.yellow("No devices in this group"));var s=0,a=0;i.forEach(e=>{var t=e.device||{},o=t.entry_detail?.watch_dog_timer?.last_alive_time,n=F(o),r=t.name||t.device_name||e.target_name||t._id||"Unknown",i=t.entry_detail?.application?.name||f.default.gray("No app");o&&Date.now()-new Date(o).getTime()<=v?s++:a++,console.log(`${n} ${f.default.cyan(r.padEnd(30))} ${i}`)}),console.log("─".repeat(80)),console.log(`Online: ${f.default.green(s)} Offline: ${f.default.red(a)}`),console.log(`\n${f.default.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(f.default.red(`Error: ${e.message}`))}}),function(){return r.apply(this,arguments)});yield i(),setInterval(i,n)}),function(e,t){return u.apply(this,arguments)}))},34992:(e,t,o)=>{o.d(t,{$l:()=>i,GF:()=>n,OW:()=>r});var n=e=>{console.log(JSON.stringify(e,null,2))},r=(e,t={})=>{console.error(JSON.stringify({ok:!1,error:{message:e,...t}},null,2))},i=(e,t=4)=>e?e.length<=2*t?"*".repeat(e.length):`${e.slice(0,t)}…${e.slice(-t)}`:null},35317:e=>{e.exports=t("child_process")},35679:(e,t,o)=>{o.d(t,{DM:()=>r,uB:()=>d});var n=o(65181);const{DM:r,gu:i,er:s,Ww:a,b7:l,Di:u,a2:c,uB:d,ef:p,c$:f,_V:g}=n},35704:(e,t,o)=>{o.d(t,{V:()=>i});var n={S:"Subspace",B:"Brick",C:"Canvas",A:"Animation",G:"Generator",D:"Data",F:"Data Calc",N:"Calc Node",T:"Test",TC:"Test Case",AT:"Automation Map"},r=e=>e?.split("_")?.[0]||"",i=(e,{keyword:t,types:o}={})=>{var i=t?.trim().toLowerCase()||"",s=o?.length>0?new Set(o.flatMap(e=>{var t=String(e).trim().toUpperCase();return t?[t]:[]})):null,a=Object.entries(e||{}).filter(([,e])=>e&&!e.hide).filter(([e,t])=>{var o=r(e);if(s&&!s.has(o))return!1;if(!i)return!0;var n=t?.title?String(t.title).toLowerCase():"";return e.toLowerCase().includes(i)||n.includes(i)}).reduce((e,[t,o])=>{var n=r(t);return e[n]||(e[n]=[]),e[n].push({shortId:t,ref:o}),e},{});return Object.entries(a).map(([e,t])=>({prefix:e,label:n[e]||e,refs:t.sort((e,t)=>{var o=e.ref?.title||e.shortId,n=t.ref?.title||t.shortId;return String(o).localeCompare(String(n))})})).sort((e,t)=>e.label.localeCompare(t.label))}},37067:e=>{e.exports=t("node:http")},39023:e=>{e.exports=t("util")},40610:e=>{e.exports=t("node:dns")},41314:e=>{e.exports=t("node:dgram")},41762:(e,t,o)=>{const{InvalidArgumentError:n}=o(43823);t.Argument=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},t.humanReadableArgName=function(e){const t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"}},42613:e=>{e.exports=t("assert")},43106:e=>{e.exports=t("zlib")},43823:(e,t)=>{class o extends Error{constructor(e,t,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}t.CommanderError=o,t.InvalidArgumentError=class extends o{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}},44708:e=>{e.exports=t("node:https")},47661:(e,t,o)=>{const n=Object.assign({},o(3900)),r=Object.keys(n);Object.defineProperty(n,"random",{get(){const e=Math.floor(Math.random()*r.length),t=r[e];return n[t]}}),e.exports=n},48161:e=>{e.exports=t("node:os")},51455:e=>{e.exports=t("node:fs/promises")},51649:(e,t,o)=>{e.exports=(e=>{var t={};return o.d(t,e),t})({createElement:()=>r.createElement,default:()=>r.default,useCallback:()=>r.useCallback,useEffect:()=>r.useEffect,useRef:()=>r.useRef,useState:()=>r.useState})},52018:e=>{e.exports=t("tty")},57975:e=>{e.exports=t("node:util")},58611:e=>{e.exports=t("http")},59138:(e,t,o)=>{o.d(t,{i:()=>n});var n=()=>"undefined"!=typeof module&&"function"==typeof module.require?module.require("../gql/client.js"):Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(700)]).then(o.bind(o,50700))},59726:(e,t,o)=>{o.d(t,{gf:()=>w});var n,r,i,s,a,l,u,c=o(68832),d=o(99436),p=o(35679),f=o(88568),g=o(51455),h=o(76760),m=o(12044),D=(n=d(function*(e,t,o=3e3){var n;try{var r=new AbortController;n=setTimeout(()=>r.abort(),o);var i=yield fetch(`http://${e}:${t}/json/list`,{signal:r.signal});return i.ok?yield i.json():null}catch{return null}finally{void 0!==n&&clearTimeout(n)}}),function(e,t){return n.apply(this,arguments)}),y=e=>{if(!e)return null;var t=e.match(/\/ws\/(.+)$/);return t?decodeURIComponent(t[1]):null},v=(r=d(function*(e,t=1e3){for(var o=[],n=e,r=0;r<10;r++){var i=h.join(n,".bricks","devtools.json");try{var s=yield g.readFile(i,"utf8"),a=JSON.parse(s),l=yield(0,m.verifyDevToolsServer)(a.address||"localhost",a.port,t);l&&o.push({name:a.name||"BRICKS Preview (CTOR Preview)",address:a.address||"localhost",port:a.port,protocols:["cdp"],hasPasscode:!1,source:"project",projectPath:n,...l})}catch{}var u=h.dirname(n);if(u===n)break;n=u}return o}),function(e){return r.apply(this,arguments)}),F=(i=d(function*({timeout:e=3e3,verify:t=!1,udpOnly:o=!1,project:n=!0,port:r=19851,cwd:i=process.cwd(),onStatus:s}={}){var a,l,u=(0,m.discoverDevToolsServers)({timeout:e,idleTimeout:800}),p=o?Promise.resolve([]):(s?.("Scanning via UDP + HTTP probe..."),(0,m.httpProbeSubnet)({port:r,timeout:e})),f=n?v(i,1e3):Promise.resolve([]),g=yield Promise.all([u,p,f]),h=c(g,3),F=(e=>{var t=new Map;for(var o of e){var n=o.deviceId||`${o.address}:${o.port}`,r=t.get(n);if(r){for(var i of(r.addresses.includes(o.address)||r.addresses.push(o.address),"127.0.0.1"===r.address&&"127.0.0.1"!==o.address&&(r.address=o.address),o.protocols||[]))r.protocols.includes(i)||r.protocols.push(i);for(var s of Object.entries(o)){var a=c(s,2),l=a[0],u=a[1];null!=u&&"address"!==l&&"addresses"!==l&&"protocols"!==l&&(void 0!==r[l]&&null!==r[l]||(r[l]=u))}}else t.set(n,{...o,addresses:[o.address],protocols:[...o.protocols||[]]})}return[...t.values()]})([...h[0],...h[1],...h[2]]);if(0===F.length)return[];if(t){s?.(`Verifying ${F.length} server(s)...`);var b=yield Promise.all(F.map((a=d(function*(e){var t=yield(0,m.verifyDevToolsServer)(e.address,e.port);return{...e,verified:!!t,version:t?.version||e.version}}),function(e){return a.apply(this,arguments)})));F.splice(0,F.length,...b)}return s?.("Checking chrome://inspect support..."),yield Promise.all(F.map((l=d(function*(e){var t=yield D(e.address,e.port);if(t){e.chromeInspect=!0;var o=y(t[0]?.webSocketDebuggerUrl);o&&(e.passcode=o)}}),function(e){return l.apply(this,arguments)}))),F}),function(){return i.apply(this,arguments)}),b="2.24",_="19851",C="127.0.0.1",$=e=>{if(!e)return{host:void 0,port:void 0};var t=e.match(/^\[([^\]]+)\](?::(\d+))?$/);if(t)return{host:t[1],port:t[2]};var o=e.lastIndexOf(":");if(o>0&&e.indexOf(":")===o){var n=e.slice(o+1);if(/^\d+$/.test(n))return{host:e.slice(0,o),port:n}}return{host:e,port:void 0}},E=e=>{if(!e)return!1;for(var t=e.replace(/^v/,"").split(".").map(Number),o=b.split(".").map(Number),n=0;n<o.length;n++){if((t[n]||0)>o[n])return!0;if((t[n]||0)<o[n])return!1}return!0},w=new p.uB("devtools").description("DevTools server discovery, inspection, and CDP commands").option("-a, --address <address>",`DevTools server address, host or host:port (default: ${C})`).option("-p, --port <port>",`Server port for CDP commands (default: ${_})`).option("--passcode <passcode>","Device passcode for CDP commands"),k=e=>e.option("-a, --address <address>","DevTools server address, host or host:port").option("-p, --port <port>",`Server port (default: ${_})`).option("--passcode <passcode>","Device passcode").option("-j, --json","Output as JSON"),S=function(){var e=d(function*(e,t){var n,r=(yield Promise.resolve().then(o.bind(o,29790))).default,i=(yield Promise.resolve().then(o.bind(o,12044))).verifyDevToolsServer,s=(yield o.e(999).then(o.bind(o,12999))).createCdpClient,a=(e=>{var t=w.opts(),o=e.address??t.address,n=$(o);return{...e,address:n.host??C,port:e.port??t.port??n.port??_,passcode:e.passcode??t.passcode}})(e),l=parseInt(a.port,10),u=r("Connecting to DevTools...").start();try{var c=yield i(a.address,l);c||(u.fail(`Cannot reach DevTools server at ${a.address}:${l}`),process.exit(1)),c.version&&!E(c.version)&&(u.fail(`CDP requires app version >= ${b} (device: ${c.version})`),process.exit(1)),n=s(a.address,l,a.passcode),yield n.connect(),u.stop(),yield t(n)}catch(e){u.isSpinning&&u.stop(),console.error(f.default.red(e.message)),process.exit(1)}finally{n?.close()}});return function(t,o){return e.apply(this,arguments)}}(),x=({subspaceId:e,handler:t,action:o,parameters:n,property:r,waitAsync:i,sync:s})=>{var a={handler:t,action:o};return void 0!==n&&(a.parameters=n),void 0!==r&&(a.property=r),void 0!==i&&(a.waitAsync=i),void 0!==s&&(a.sync=s),`(() => {\n const systemRef = globalThis.system\n if (!systemRef?.executeAction) throw new Error('BRICKS DevTools system actions are unavailable')\n const subspaceId = ${e?JSON.stringify(e):"(Object.keys(globalThis.system?.subspaces?.() || {})[0] || '')"}\n if (!subspaceId) throw new Error('No BRICKS subspace is available')\n return systemRef.executeAction(subspaceId, ${JSON.stringify(a)})\n})()`},O=/^\d+$/,A=e=>"string"==typeof e&&O.test(e),I=function(){var e=d(function*(e,t){yield e.send("DOM.enable");var o=yield e.send("DOM.resolveNode",{nodeId:Number(t)}),n=o?.object;if(!n)throw new Error(`Node ${t} not found`);if("value"in n)return n.value;if(!n.objectId)throw new Error(`Node ${t} did not resolve to metadata`);var r=yield e.send("Runtime.getProperties",{objectId:n.objectId,ownProperties:!0}),i=r.result,s=void 0===i?[]:i,a=r.exceptionDetails;if(a)throw new Error(a.text||`Cannot read node ${t}`);return s.reduce((e,t)=>(e[t.name]=(e=>{if(e)return"value"in e?e.value:e.unserializableValue||e.description})(t.value),e),{})});return function(t,o){return e.apply(this,arguments)}}(),j=(s=d(function*(e,{subspaceId:t,brickId:o}){var n=t,r=o,i={};if(A(t)){var s=yield I(e,t);if(n=s.subspaceId||(String(s.shortId||"").startsWith("S_")?s.shortId:null),i.subspaceNodeId=Number(t),!n)throw new Error(`Node ${t} is not inside a BRICKS subspace`)}if(A(o)){var a=yield I(e,o);if(r=a.brickId||(String(a.shortId||"").startsWith("B_")?a.shortId:null),!A(t)&&a.subspaceId&&(n=a.subspaceId),i.brickNodeId=Number(o),!r)throw new Error(`Node ${o} is not a BRICKS brick`)}return{subspaceId:n,brickId:r,...i}}),function(e,t){return s.apply(this,arguments)}),B=(a=d(function*(e,t,{json:o,successMessage:n,jsonResult:r}){yield e.send("Runtime.enable"),(e=>{if(e.exceptionDetails){var t=e.exceptionDetails,o=t.exception?.description||t.exception?.value||t.text;throw new Error(o||"Runtime evaluation failed")}})(yield e.send("Runtime.evaluate",{expression:t,objectGroup:"console",returnByValue:!0,awaitPromise:!0})),o?console.log(JSON.stringify({success:!0,...r},null,2)):console.log(f.default.green(n))}),function(e,t,o){return a.apply(this,arguments)}),N=e=>{if(!e)return{};for(var t={},o=0;o<e.length;o+=2)t[e[o]]=e[o+1];return t},T=e=>{if(!e)return null;var t=e.nodeName||e.localName||"unknown",o=e.id||e.shortId;o&&(t+=`#${o}`),e.title&&(t+=` "${e.title}"`);var n=[];return e.nodeId&&n.push(`node ${e.nodeId}`),e.shortId&&e.shortId!==o&&n.push(e.shortId),e.brickId&&e.brickId!==e.shortId&&n.push(e.brickId),e.templateKey&&n.push(e.templateKey),n.length>0?`${t} (${n.join(", ")})`:t},P=(e,t="",o=!0,n=!0)=>{var r=[],i=n?"":o?"└─ ":"├─ ",s=n?"":o?" ":"│ ",a=e.nodeName||"#unknown";if(9===e.nodeType)a="#document";else if(3===e.nodeType){var l=e.nodeValue||"";a=f.default.gray(`"${l}"`)}else if(1===e.nodeType){var u=N(e.attributes),c=u.id||u["short-id"];c&&(a+=f.default.gray(`#${c}`)),u.title&&(a+=` ${f.default.green(`"${u.title}"`)}`),void 0!==u.w&&void 0!==u.h&&(a+=f.default.blue(` ${u.w}×${u.h}`),void 0!==u.x&&void 0!==u.y&&(a+=f.default.blue(` @${u.x},${u.y}`)));var d=[];void 0!==u.hide&&d.push(f.default.red("hidden")),void 0!==u.pressable&&d.push(f.default.yellow("pressable")),void 0!==u.editable&&d.push(f.default.yellow("editable")),d.length>0&&(a+=` [${d.join(", ")}]`)}r.push(`${t}${i}${a}`);var p=e.children||[];return p.forEach((e,o)=>{r.push(...P(e,t+s,o===p.length-1,!1))}),r};w.command("scan").description("Scan LAN for DevTools servers via UDP + HTTP").option("-t, --timeout <ms>","Scan timeout in milliseconds","3000").option("-j, --json","Output as JSON").option("--verify","Verify each discovered server via HTTP").option("--udp-only","Skip HTTP subnet probe (UDP only)").option("--no-project","Exclude local BRICKS project preview servers").option("-p, --port <port>","Port for HTTP probe","19851").action(function(){var e=d(function*(e){var t=(yield Promise.resolve().then(o.bind(o,29790))).default,n=yield Promise.resolve().then(o.bind(o,74752)),r=n.getCurrentProfile,i=n.getTokenInfo,s=parseInt(e.timeout,10),a=t(`Scanning for DevTools servers (${s}ms)...`).start();try{var l=yield F({timeout:s,verify:!!e.verify,udpOnly:!!e.udpOnly,project:!!e.project,port:parseInt(e.port,10),onStatus:e=>{a.text=e}});if(0===l.length)return e.json?(a.stop(),console.log(JSON.stringify([],null,2))):a.info("No DevTools servers found on the network."),void process.exit(0);a.stop(),e.json&&(console.log(JSON.stringify(l,null,2)),process.exit(0));var u=i(r()),c=u?.workspaceId||null;console.log(f.default.bold(`\nFound ${l.length} DevTools server(s)`)),console.log("─".repeat(80));var d=function*(e){var t=!1===e.verified?f.default.red("unverified"):f.default.green("online"),o=e.hasPasscode?f.default.yellow("passcode"):f.default.gray("open"),n=(e.protocols||[]).map(e=>f.default.cyan(e)).join(", "),r=e.workspaceId&&c&&e.workspaceId===c,i=e.addresses||[e.address],s=i.filter(t=>t!==e.address),a=s.length>0?`${e.address}:${e.port} +${s.length} more`:`${e.address}:${e.port}`;if(console.log(` ${f.default.bold(e.name||"Unknown")} ${f.default.gray(`(${a})`)} [${t}]`),s.length>0&&console.log(` Addresses: ${i.map(e=>f.default.gray(e)).join(", ")}`),e.version&&console.log(` Version: ${f.default.green(e.version)}`),e.chromeInspect){var l=e.passcode?f.default.cyan(e.passcode):f.default.gray("no passcode");console.log(` Chrome Inspect: ${f.default.green("supported")} (passcode: ${l})`)}var u=` Protocols: ${n||f.default.gray("none")} Auth: ${o}`;if(e.deviceId&&(u+=` Device: ${f.default.gray(e.deviceId)}`),console.log(u),e.workspaceId){var d=r?f.default.green(`${e.workspaceId} (current profile)`):f.default.gray(e.workspaceId);console.log(` Workspace: ${d}`)}};for(var p of l)yield*d(p);console.log("─".repeat(80));var g=l[0],h=`${g.address}:${g.port||19851}`,m=g.passcode?`/ws/${encodeURIComponent(g.passcode)}`:"/ws/<passcode>";console.log(f.default.gray(`\nConnect via: http://${h}/devtools-frontend/inspector.html?ws=${h}${m}`)),console.log(f.default.gray(`Legacy: devtools://devtools/bundled/inspector.html?ws=${h}${m}`)),process.exit(0)}catch(e){a.fail(`Scan failed: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),w.command("open <address>").description("Show DevTools server information").option("-p, --port <port>",`Server port (default: ${_})`).option("--info","Show connection URLs").action((l=d(function*(e,t){var n=(yield Promise.resolve().then(o.bind(o,29790))).default,r=(yield Promise.resolve().then(o.bind(o,12044))).verifyDevToolsServer,i=$(e),s=i.host??C,a=parseInt(t.port??i.port??_,10),l=`${s}:${a}`,u=n(`Fetching server info from ${l}...`).start(),c=yield r(s,a);c||(u.fail(`Could not reach DevTools server at ${l}`),process.exit(1)),u.stop();var d=yield D(s,a),p=d?y(d?.[0]?.webSocketDebuggerUrl):null,g=p?`/ws/${encodeURIComponent(p)}`:"/ws/<passcode>";if(t.info)return console.log(f.default.bold("Connection URLs")),console.log("─".repeat(60)),console.log(` Web UI: ${f.default.cyan(`http://${l}`)}`),console.log(` CDP: ${f.default.cyan(`http://${l}/devtools-frontend/inspector.html?ws=${l}${g}`)}`),console.log(` CDP legacy: ${f.default.cyan(`devtools://devtools/bundled/inspector.html?ws=${l}${g}`)}`),console.log(` MCP: ${f.default.cyan(`http://${l}/mcp`)}`),console.log(` MCP SSE: ${f.default.cyan(`http://${l}/sse`)}`),console.log(` Info: ${f.default.cyan(`http://${l}/devtools/info`)}`),console.log("─".repeat(60)),console.log(),console.log(f.default.bold("Authorization")),p&&console.log(` Passcode: ${f.default.cyan(p)}`),console.log(" MCP and MCP SSE require a Bearer token header with the device passcode:"),void console.log(` ${f.default.gray(`Authorization: Bearer ${p||"<passcode>"}`)}`);if(console.log(f.default.bold("DevTools Server")),console.log("─".repeat(60)),console.log(` Name: ${f.default.cyan(c.name||"Unknown")}`),console.log(` Version: ${c.version?f.default.green(c.version):f.default.gray("N/A")}`),console.log(` Device ID: ${f.default.gray(c.deviceId||"N/A")}`),console.log(` Workspace: ${f.default.gray(c.workspaceId||"N/A")}`),console.log(` Protocols: ${(c.protocols||[]).map(e=>f.default.cyan(e)).join(", ")||f.default.gray("none")}`),console.log(` Auth: ${c.hasPasscode?f.default.yellow("passcode required"):f.default.gray("open")}`),console.log(` Port: ${c.port}`),d){var h=p?f.default.cyan(p):f.default.gray("no passcode");console.log(` Inspect: ${f.default.green("chrome://inspect supported")} (passcode: ${h})`)}else console.log(` Inspect: ${f.default.gray("chrome://inspect not available")}`);console.log("─".repeat(60)),c.version&&!E(c.version)&&console.log(f.default.yellow(`\n CDP commands require version >= ${b}`)),console.log(f.default.gray("\n Use --info to see connection URLs"))}),function(e,t){return l.apply(this,arguments)})),k(w.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((u=d(function*(e){var t;yield S(e,(t=d(function*(t){var n=yield t.send("Page.captureScreenshot",{format:"png"});n.data||(console.error(f.default.red("No screenshot data received")),process.exit(1));var r=yield Promise.resolve().then(o.t.bind(o,73024,19)),i=yield Promise.resolve().then(o.t.bind(o,76760,19)),s=e.output||`screenshot-${Date.now()}.png`,a=i.resolve(s);r.writeFileSync(a,Buffer.from(n.data,"base64")),console.log(f.default.green(`Screenshot saved to ${a}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return u.apply(this,arguments)}));var M,R,U,L,J,q,V,G,W=w.command("brick").description("Brick component inspection");k(W.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((M=d(function*(e){var t;yield S(e,(t=d(function*(t){yield t.send("DOM.enable");var o=parseInt(e.depth,10),n=(yield t.send("DOM.getDocument",{depth:o})).root;e.json?console.log(JSON.stringify(n,null,2)):console.log(P(n).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return M.apply(this,arguments)})),k(W.command("query <selector>").description("Find brick by CSS selector")).action((R=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=(yield o.send("DOM.getDocument",{depth:0})).root,r=(yield o.send("DOM.querySelector",{nodeId:n.nodeId,selector:e})).nodeId;if(0!==r){var i=yield o.send("DOM.describeNode",{nodeId:r}),s=(yield o.send("DOM.getAttributes",{nodeId:r})).attributes,a=N(s);if(t.json)console.log(JSON.stringify({nodeId:r,...i.node,attributes:a},null,2));else if(console.log(f.default.bold(`Node ${r}: ${i.node?.nodeName||"unknown"}`)),Object.keys(a).length>0)for(var l of(console.log(f.default.bold("Attributes:")),Object.entries(a))){var u=c(l,2),d=u[0],p=u[1];console.log(` ${f.default.cyan(d)}: ${p}`)}}else console.log(f.default.yellow("No element found"))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return R.apply(this,arguments)})),k(W.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((U=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=(yield o.send("DOM.getDocument",{depth:0})).root,r=(yield o.send("DOM.querySelectorAll",{nodeId:n.nodeId,selector:e})).nodeIds;if(t.json)console.log(JSON.stringify({nodeIds:r,count:r.length},null,2));else for(var i of(console.log(f.default.bold(`Found ${r.length} element(s)`)),r)){var s=yield o.send("DOM.describeNode",{nodeId:i}),a=(yield o.send("DOM.getAttributes",{nodeId:i})).attributes,l=N(a),u=l.id||l["short-id"]||"";console.log(` ${i}: ${s.node?.nodeName}${u?f.default.gray(`#${u}`):""}`)}}),function(e){return o.apply(this,arguments)}))}),function(e,t){return U.apply(this,arguments)})),k(W.command("attributes <nodeId>").description("Get brick attributes")).action((L=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=parseInt(e,10),r=(yield o.send("DOM.getAttributes",{nodeId:n})).attributes,i=N(r);if(t.json)console.log(JSON.stringify(i,null,2));else if(0!==Object.keys(i).length)for(var s of Object.entries(i)){var a=c(s,2),l=a[0],u=a[1];console.log(` ${f.default.cyan(l)}: ${u}`)}else console.log(f.default.gray("No attributes"))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return L.apply(this,arguments)})),k(W.command("box-model <nodeId>").description("Get brick dimensions and position")).action((J=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=parseInt(e,10),r=(yield o.send("DOM.getBoxModel",{nodeId:n})).model;t.json?console.log(JSON.stringify(r,null,2)):(console.log(f.default.bold(`Box Model for node ${n}`)),console.log(` Width: ${r.width}`),console.log(` Height: ${r.height}`),r.content&&console.log(` Content: [${r.content.join(", ")}]`),r.padding&&console.log(` Padding: [${r.padding.join(", ")}]`),r.border&&console.log(` Border: [${r.border.join(", ")}]`),r.margin&&console.log(` Margin: [${r.margin.join(", ")}]`))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return J.apply(this,arguments)})),k(W.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((q=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=parseInt(e,10),r=(yield o.send("DOM.resolveNode",{nodeId:n})).object;if(t.json)console.log(JSON.stringify(r,null,2));else if(console.log(f.default.bold(`Resolved node ${n}`)),console.log(` Type: ${r.type}`),r.className&&console.log(` Class: ${r.className}`),r.description&&console.log(` Description: ${r.description}`),r.objectId&&console.log(` Object ID: ${f.default.gray(r.objectId)}`),r.preview?.properties)for(var i of(console.log(f.default.bold(" Properties:")),r.preview.properties))console.log(` ${f.default.cyan(i.name)}: ${i.value}`)}),function(e){return o.apply(this,arguments)}))}),function(e,t){return q.apply(this,arguments)})),k(W.command("focus <nodeId>").description("Focus a brick element")).action((V=d(function*(e,t){var o;yield S(t,(o=d(function*(t){yield t.send("DOM.enable");var o=parseInt(e,10);yield t.send("DOM.focus",{nodeId:o}),console.log(f.default.green(`Focused node ${o}`))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return V.apply(this,arguments)})),k(W.command("input <subspaceId> <brickId> <text...>").description("Set text on a BRICK_TEXT_INPUT by subspace/brick id or node id")).action((G=d(function*(e,t,o,n){var r,i=Array.isArray(o)?o.join(" "):o;yield S(n,(r=d(function*(o){var r=yield j(o,{subspaceId:e,brickId:t});yield B(o,(({subspaceId:e,brickId:t,text:o})=>x({subspaceId:e,handler:t,action:"BRICK_TEXT_INPUT_SET_TEXT",parameters:{BRICK_TEXT_INPUT_TEXT:o}}))({...r,text:i}),{json:n.json,successMessage:`Set text on ${r.brickId}`,jsonResult:{...r,action:"BRICK_TEXT_INPUT_SET_TEXT",text:i}})}),function(e){return r.apply(this,arguments)}))}),function(e,t,o,n){return G.apply(this,arguments)}));var H,K,Y,z=w.command("input").description("Input emulation");k(z.command("tap <x> <y>").description("Tap/click at coordinates")).action((H=d(function*(e,t,o){var n;yield S(o,(n=d(function*(n){var r=parseFloat(e),i=parseFloat(t),s=yield n.send("Input.dispatchMouseEvent",{type:"mousePressed",x:r,y:i,button:"left",clickCount:1});yield n.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:r,y:i,button:"left",clickCount:1}),(({x:e,y:t,tapResult:o,json:n})=>{if(n)console.log(JSON.stringify({x:e,y:t,...o||{}},null,2));else{console.log(f.default.green(`Tapped at (${e}, ${t})`));var r=T(o?.element||o?.tappedElement||o?.hitElement);if(r){console.log(` Element: ${r}`);var i=o?.hitElement,s=o?.tappedElement;if(i&&s&&i.nodeId!==s.nodeId){var a=T(i);a&&console.log(` Hit: ${a}`)}o&&!1===o.dispatched&&console.log(f.default.yellow(" Action: no pressable handler"))}else console.log(f.default.yellow(" Element: none"))}})({x:r,y:i,tapResult:s,json:o.json})}),function(e){return n.apply(this,arguments)}))}),function(e,t,o){return H.apply(this,arguments)})),k(z.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((K=d(function*(e,t){var o;yield S(t,(o=d(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(f.default.green(`Key: ${e}`))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return K.apply(this,arguments)})),k(w.command("popup").description("System popup and alert control").command("close [popupId]").description("Close the current system alert/popup, or a popup by id/type").option("--type <type>","Popup clear type for SYSTEM POPUP_RESET").option("--subspace <subspaceId>","Subspace id to execute from (defaults to first subspace)")).action((Y=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield B(o,(({subspaceId:e,popupId:t,clearType:o})=>{var n={};return t&&(n.POPUP_ID=t),o&&(n.POPUP_CLEAR_TYPE=o),x({subspaceId:e,handler:"SYSTEM",action:"POPUP_RESET",parameters:n})})({subspaceId:t.subspace,popupId:e,clearType:t.type}),{json:t.json,successMessage:e?`Closed popup ${e}`:"Closed current popup",jsonResult:{subspaceId:t.subspace||null,popupId:e||null,clearType:t.type||null,action:"POPUP_RESET"}})}),function(e){return o.apply(this,arguments)}))}),function(e,t){return Y.apply(this,arguments)}));var Q,X,Z=w.command("network").description("Network inspection");k(Z.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((Q=d(function*(e){var t;yield S(e,(t=d(function*(t){var o=new Map,n=parseInt(e.duration,10);t.on("Network.requestWillBeSent",e=>{o.set(e.requestId,{method:e.request.method,url:e.request.url,requestId:e.requestId,timestamp:e.timestamp})}),t.on("Network.responseReceived",e=>{var t=o.get(e.requestId);t&&(t.status=e.response.status,t.mimeType=e.response.mimeType)}),t.on("Network.loadingFailed",e=>{var t=o.get(e.requestId);t&&(t.error=e.errorText)}),yield t.send("Network.enable"),yield new Promise(e=>setTimeout(e,n)),yield t.send("Network.disable");var r=[...o.values()];if(e.json)console.log(JSON.stringify(r,null,2));else if(console.log(f.default.bold(`Network Activity (captured ${(n/1e3).toFixed(1)}s, ${r.length} requests)`)),0!==r.length)for(var i of r){var s=i.error?f.default.red("ERR"):i.status?i.status<300?f.default.green(i.status):i.status<400?f.default.yellow(i.status):f.default.red(i.status):f.default.gray("..."),a=i.url.length>60?i.url.substring(0,57)+"...":i.url;console.log(` ${s} ${f.default.bold(i.method.padEnd(6))} ${a} ${f.default.gray(`(${i.requestId})`)}`)}else console.log(f.default.gray(" No network activity captured"))}),function(e){return t.apply(this,arguments)}))}),function(e){return Q.apply(this,arguments)})),k(Z.command("get <requestId>").description("Get response body for a network request")).action((X=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("Network.enable");var n=yield o.send("Network.getResponseBody",{requestId:e}),r=n.body,i=n.base64Encoded;t.json?console.log(JSON.stringify({body:r,base64Encoded:i},null,2)):i?console.log(f.default.gray(`[base64 encoded, ${r.length} chars]`)):console.log(r)}),function(e){return o.apply(this,arguments)}))}),function(e,t){return X.apply(this,arguments)}));var ee,te,oe,ne="bricks://app",re="DATA-",ie="properties",se="entries",ae=e=>{if(null==e||"object"!=typeof e)return{value:e};if("value"in e)return{value:e.value};if("unserializableValue"in e)return{value:e.unserializableValue};if(e.objectId){var t=e.preview?.properties;return Array.isArray(t)&&t.length>0?{value:t.reduce((e,t)=>(e[t.name]=t.value,e),{}),byRef:!0}:{value:e.description||`[${e.type}]`,byRef:!0}}return{value:"undefined"===e.type?void 0:e.description}},le=e=>{var t=e.startsWith(re)?e.slice(5):e,o=t.indexOf(":");return o<0?{shortId:t,title:null}:{shortId:t.slice(0,o),title:t.slice(o+1)}},ue=e=>{if(e.startsWith("global:"))return{scope:"global",name:e.slice(7)};if(e.startsWith("subspace:")){var t=e.slice(9),o=t.indexOf(":");return o>0?{scope:"subspace",subspaceUuid:t.slice(0,o),name:t.slice(o+1)}:{scope:"subspace",subspaceUuid:t,name:""}}return{scope:null,name:e}},ce=(e=[])=>{var t=new Map,o=new Map,n=new Set;for(var r of e||[])if(r&&"object"==typeof r){var i=r.shortId,s=r.uuid;i&&n.add(i),s&&(n.add(s),t.set(s,r),o.set(s,s),i&&o.set(i,s))}return{byUuid:t,uuidByScope:o,knownScopes:n}},de=(e=[])=>e?.byUuid&&e?.uuidByScope&&e?.knownScopes?e:ce(e),pe=(ee=d(function*(e){try{var t=yield e.send("Runtime.evaluate",{expression:"JSON.stringify(Object.values(system.subspaces()).map((s) => ({ shortId: s.shortId, uuid: s.uuid, title: s.title })))",objectGroup:"console",returnByValue:!0}),o=t.result;return t.exceptionDetails||"string"!=typeof o?.value?[]:JSON.parse(o.value)}catch{return[]}}),function(e){return ee.apply(this,arguments)}),fe=(e,{full:t=!1,width:o=100}={})=>{var n="string"==typeof e?e:JSON.stringify(e);return void 0===n?f.default.gray("undefined"):t||n.length<=o?n:`${n.substring(0,o)}…`},ge=(e,t)=>{var o=de(t),n=e.subspaceUuid?o.byUuid.get(e.subspaceUuid):null;return{key:e.rawKey,scope:e.scope,...e.subspaceUuid?{subspaceUuid:e.subspaceUuid}:{},...n?.shortId?{subspaceShortId:n.shortId}:{},name:e.name,value:e.value}},he=(te=d(function*(e,{databaseName:t,objectStoreName:o,options:n}){var r=parseInt(n.skip??"0",10)||0,i=parseInt(n.limit??"25",10)||25,s=null;try{s=(yield e.send("IndexedDB.getMetadata",{securityOrigin:ne,databaseName:t,objectStoreName:o})).entriesCount}catch{}var a=yield e.send("IndexedDB.requestData",{securityOrigin:ne,databaseName:t,objectStoreName:o,indexName:"",skipCount:r,pageSize:i,returnByValue:!0}),l=a.objectStoreDataEntries,u=a.hasMore,c=!1,d=l.map(e=>{var t=ae(e.key).value,o=ae(e.value),n=o.value;return o.byRef&&(c=!0),{key:t,value:n}});if(n.json)console.log(JSON.stringify({database:t,objectStore:o,skip:r,limit:i,total:s,hasMore:!!u,entries:d},null,2));else{var p=null==s?"":` of ${s}`,g=r>0?`, skipped ${r}`:"";for(var h of(console.log(f.default.bold(`${t} / ${o} (${d.length}${p} entries${g})`)),console.log("─".repeat(60)),0===d.length&&console.log(f.default.gray(" No entries")),d)){var m=h.key,D=h.value,y="string"==typeof m?m:JSON.stringify(m);console.log(` ${f.default.cyan(y)}: ${fe(D,{full:!!n.full})}`)}u&&console.log(f.default.gray(" …more entries available — use -l/--limit and -s/--skip")),c&&console.log(f.default.yellow("\n Some values came back as object handles (device app without by-value reads).\n Update the device app to see full values."))}}),function(e,t){return te.apply(this,arguments)}),me=e=>e.option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0").option("--full","Do not truncate values"),De=w.command("storage").description("Storage inspection (read-only — CDP cannot mutate device storage)");k(De.command("list").description("Overview of all storage stores with entry counts")).action((oe=d(function*(e){var t;yield S(e,(t=d(function*(t){yield t.send("DOMStorage.enable"),yield t.send("IndexedDB.enable");var o,n=(o=d(function*(e){return(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ne,isLocalStorage:e}})).entries.length}),function(e){return o.apply(this,arguments)}),r=yield n(!0),i=yield n(!1),s=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ne})).databaseNames,a=[];for(var l of s){var u=l.startsWith(re)?ie:se,c=null;try{c=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ne,databaseName:l,objectStoreName:u})).entriesCount}catch{}a.push({name:l,objectStoreName:u,entriesCount:c})}var p=a.filter(e=>e.name.startsWith(re)).map(e=>({...e,...le(e.name)})),g=a.filter(e=>!e.name.startsWith(re));if(e.json)console.log(JSON.stringify({system:{persist:r,memory:i},dataBanks:p,caches:g},null,2));else{var h=e=>null==e?f.default.gray("? entries"):`${e} entries`;for(var m of(console.log(f.default.bold("Storage Overview")+f.default.gray(" (read-only)")),console.log("─".repeat(60)),console.log(` ${f.default.bold("System storage")}${f.default.gray(" → storage system persist|memory")}`),console.log(` persist ${h(r)}`),console.log(` memory ${h(i)}`),console.log(` ${f.default.bold("Data banks")}${f.default.gray(" → storage data-bank get <S_xxxx|title>")}`),0===p.length&&console.log(f.default.gray(" none")),p)){var D=m.title?` "${m.title}"`:"";console.log(` ${f.default.cyan(m.shortId)}${D} ${h(m.entriesCount)}`)}for(var y of(console.log(` ${f.default.bold("Caches")}${f.default.gray(" → storage cache generator|generative-media")}`),0===g.length&&console.log(f.default.gray(" none")),g))console.log(` ${f.default.cyan(y.name)} ${h(y.entriesCount)}`);console.log("─".repeat(60))}}),function(e){return t.apply(this,arguments)}))}),function(e){return oe.apply(this,arguments)}));var ye,ve=De.command("system").description("System key-value storage"),Fe=e=>e.option("--scope <scope>","Filter by scope: global or a subspace S_xxxx/UUID").option("--prefix <prefix>","Filter by key-name prefix (within the scope)").option("--full","Do not truncate values"),be=(e,t)=>{return o=d(function*(o){var n;yield S(o,(n=d(function*(n){yield n.send("DOMStorage.enable");var r=(yield n.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ne,isLocalStorage:e}})).entries,i=yield pe(n),s=ce(i),a=((e,{scope:t,prefix:o,subspaceIndex:n=[]}={})=>{var r=de(n),i=t&&"global"!==t?r.uuidByScope.get(t)||t:null;return e.map(([e,t])=>({rawKey:e,value:t,...ue(e)})).filter(e=>!("global"===t&&"global"!==e.scope||i&&("subspace"!==e.scope||e.subspaceUuid!==i)||o&&!e.name.startsWith(o)))})(r,{scope:o.scope,prefix:o.prefix,subspaceIndex:s});if(o.json)console.log(JSON.stringify(a.map(e=>ge(e,s)),null,2));else if(((e,{label:t,subspaceIndex:o,full:n})=>{var r=de(o);if(console.log(f.default.bold(`${t} (${e.length} items)`)),console.log("─".repeat(60)),0!==e.length){var i=null;for(var s of e){var a="subspace"===s.scope?`subspace:${s.subspaceUuid}`:s.scope;if(a!==i)if(i=a,"subspace"===s.scope){var l=r.byUuid.get(s.subspaceUuid),u=l?`${l.shortId}${l.title?` "${l.title}"`:""} `:"";console.log(` ${f.default.bold(`subspace ${u}`)}${f.default.gray(`(${s.subspaceUuid})`)}`)}else console.log(` ${f.default.bold(s.scope||"other")}`);var c=s.name||s.rawKey;console.log(` ${f.default.cyan(c)}: ${fe(s.value,{full:n,width:80})}`)}}else console.log(f.default.gray(" No entries"))})(a,{label:t,subspaceIndex:s,full:!!o.full}),0===a.length&&o.scope&&"global"!==o.scope&&!s.knownScopes.has(o.scope)){var l=i.map(e=>e.shortId).join(", ");console.log(f.default.yellow(` Scope "${o.scope}" did not match a known subspace${l?` (known: ${l})`:""}`))}}),function(e){return n.apply(this,arguments)}))}),function(e){return o.apply(this,arguments)};var o};Fe(k(ve.command("persist").description("Show persistent system storage entries"))).action(be(!0,"Persistent Storage")),Fe(k(ve.command("memory").description("Show in-memory system storage entries"))).action(be(!1,"Memory Storage")),k(ve.command("get <key>").description("Show a single system storage value (full, untruncated)").option("--scope <scope>","Key scope: global (default) or a subspace S_xxxx/UUID","global").option("--memory","Read from in-memory storage instead of persistent")).action((ye=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOMStorage.enable");var n=(yield o.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ne,isLocalStorage:!t.memory}})).entries,r=yield pe(o),i=ce(r),s=[e];if("global"===t.scope)s.push(`global:${e}`);else{var a=i.uuidByScope.get(t.scope)||t.scope;s.push(`subspace:${a}:${e}`)}var l=n.map(([e,t])=>({rawKey:e,value:t,...ue(e)})).find(e=>s.includes(e.rawKey));if(!l){var u=n.map(([e])=>e).filter(t=>t.toLowerCase().includes(e.toLowerCase())).slice(0,5);if(u.length>0)for(var c of(console.error(f.default.yellow("Similar keys:")),u))console.error(` ${c}`);throw new Error(`Key not found: ${s[s.length-1]}`)}if(t.json)console.log(JSON.stringify(ge(l,i),null,2));else{if("string"==typeof l.value)try{return void console.log(JSON.stringify(JSON.parse(l.value),null,2))}catch{}console.log("string"==typeof l.value?l.value:JSON.stringify(l.value,null,2))}}),function(e){return o.apply(this,arguments)}))}),function(e,t){return ye.apply(this,arguments)}));var _e,Ce,$e=De.command("data-bank").description("Data bank (Property Bank) stores");k($e.command("list").description("List data banks")).action((_e=d(function*(e){var t;yield S(e,(t=d(function*(t){yield t.send("IndexedDB.enable");var o=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ne})).databaseNames,n=[];for(var r of o.filter(e=>e.startsWith(re))){var i=null;try{i=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ne,databaseName:r,objectStoreName:ie})).entriesCount}catch{}n.push({name:r,...le(r),entriesCount:i})}if(e.json)console.log(JSON.stringify(n,null,2));else{for(var s of(console.log(f.default.bold(`Data Banks (${n.length})`)),console.log("─".repeat(60)),0===n.length&&console.log(f.default.gray(" No data banks")),n)){var a=s.title?` ${f.default.green(`"${s.title}"`)}`:"",l=null===s.entriesCount||void 0===s.entriesCount?"":f.default.gray(` ${s.entriesCount} entries`);console.log(` ${f.default.cyan(s.shortId)}${a}${l}`)}console.log(f.default.gray("\nInspect: bricks devtools storage data-bank get <S_xxxx|title>"))}}),function(e){return t.apply(this,arguments)}))}),function(e){return _e.apply(this,arguments)})),me(k($e.command("get <bank> [store]").description(`Show data bank entries — <bank> accepts a subspace S_xxxx, a title keyword, or the full DATA-* database name; [store] defaults to "${ie}"`))).action((Ce=d(function*(e,t,o){var n;yield S(o,(n=d(function*(n){yield n.send("IndexedDB.enable");var r=(yield n.send("IndexedDB.requestDatabaseNames",{securityOrigin:ne})).databaseNames,i=((e,t)=>{var o=e.filter(e=>e.startsWith(re)),n=o.find(e=>e===t||e===`${re}${t}`);if(n)return{match:n};if(t.startsWith("S_")){var r=o.filter(e=>le(e).shortId===t);if(1===r.length)return{match:r[0]};if(r.length>1)return{candidates:r}}var i=t.toLowerCase(),s=o.filter(e=>e.slice(5).toLowerCase().includes(i));return 1===s.length?{match:s[0]}:{candidates:s}})(r,e);if(!i.match){var s=r.filter(e=>e.startsWith(re)),a=(i.candidates?.length||0)>1,l=a?i.candidates:s;for(var u of(console.error(f.default.yellow(a?`Data bank "${e}" is ambiguous. Candidates:`:`Data bank "${e}" not found. Available:`)),l)){var c=le(u),d=c.shortId,p=c.title;console.error(` ${d}${p?` "${p}"`:""}`)}process.exit(1)}yield he(n,{databaseName:i.match,objectStoreName:t||ie,options:o})}),function(e){return n.apply(this,arguments)}))}),function(e,t,o){return Ce.apply(this,arguments)}));var Ee=De.command("cache").description("Cache stores (generator, generative-media)"),we=e=>{return t=d(function*(t){var o;yield S(t,(o=d(function*(o){yield o.send("IndexedDB.enable"),yield he(o,{databaseName:e,objectStoreName:se,options:t})}),function(e){return o.apply(this,arguments)}))}),function(e){return t.apply(this,arguments)};var t};me(k(Ee.command("generator").description("Show generator cache entries"))).action(we("GENERATOR_CACHE")),me(k(Ee.command("generative-media").description("Show generative media cache entries"))).action(we("GENERATIVE_MEDIA_CACHE")),me(k(De.command("generator-cache",{hidden:!0}).description("Alias of `storage cache generator`"))).action(we("GENERATOR_CACHE"));var ke,Se,xe=w.command("runtime").description("Runtime and evaluation");k(xe.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((ke=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("Runtime.enable");var n=yield o.send("Runtime.evaluate",{expression:e,objectGroup:"console",returnByValue:!0,awaitPromise:!!t.await,generatePreview:!0});if(t.json)console.log(JSON.stringify(n,null,2));else{n.exceptionDetails&&(console.error(f.default.red(`Error: ${n.exceptionDetails.text}`)),n.exceptionDetails.exception?.description&&console.error(f.default.red(n.exceptionDetails.exception.description)),process.exit(1));var r=n.result;if("undefined"===r.type)console.log(f.default.gray("undefined"));else if(void 0!==r.value){var i="object"==typeof r.value?JSON.stringify(r.value,null,2):String(r.value);console.log(i)}else r.description?console.log(r.description):console.log(f.default.gray(`[${r.type}${r.subtype?`:${r.subtype}`:""}]`))}}),function(e){return o.apply(this,arguments)}))}),function(e,t){return ke.apply(this,arguments)})),k(xe.command("properties <objectId>").description("Get properties of a remote object")).action((Se=d(function*(e,t){var o;yield S(t,(o=d(function*(o){var n=(yield o.send("Runtime.getProperties",{objectId:e,ownProperties:!0})).result;if(t.json)console.log(JSON.stringify(n,null,2));else for(var r of(console.log(f.default.bold(`Properties of ${e}`)),n))if(r.enumerable){var i=r.value,s=i?.description||i?.value?.toString()||f.default.gray(`[${i?.type}]`);console.log(` ${f.default.cyan(r.name)}: ${s}`)}}),function(e){return o.apply(this,arguments)}))}),function(e,t){return Se.apply(this,arguments)}))},61685:(e,t,o)=>{o.d(t,{v:()=>E});var n=o(99436),r=o(35679),i=o(88568),s=o(74752),a=o(1001),l=o(16928),u=o(79896);function c(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return c=function(e){this.s=e,this.n=e.next},c.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var o=this.s.return;return void 0===o?Promise.resolve({value:e,done:!0}):t(o.apply(this.s,arguments))},throw:function(e){var o=this.s.return;return void 0===o?Promise.reject(e):t(o.apply(this.s,arguments))}},new c(e)}var d,p,f,g,h,m,D,y=(d=n(function*(){return(yield Promise.resolve().then(o.bind(o,29790))).default}),function(){return d.apply(this,arguments)}),v=(p=n(function*(){return Promise.all([o.e(657),o.e(7),o.e(146)]).then(o.bind(o,77146))}),function(){return p.apply(this,arguments)}),F=(f=n(function*(e){return(yield y())(e).start()}),function(e){return f.apply(this,arguments)}),b=(g=n(function*(){var e=(0,s.getCurrentProfile)(),t=(0,s.getToken)(e);return t||(console.error(i.default.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,(yield v()).createActivityLogClient)((0,s.getActivityLogBaseUrl)(),t)}),function(){return g.apply(this,arguments)}),_=2592e6,C=e=>new Date(e).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z"),$=(e,t)=>{if(!e)return"";var o="string"==typeof e?e:JSON.stringify(e);return o.length>t?o.slice(0,t-1)+"…":o},E=new r.uB("activity-log").alias("al").description("Activity log queries (read-only)");E.command("events").description("Query activity log events (all types)").requiredOption("--start-time <datetime>","Start time (ISO 8601 or relative: 1h, 30m, 2d)").option("--end-time <datetime>","End time (default: now)").option("--device <id>","Filter by device ID").option("--type <type>","Filter by event type: general, data, local_sync").option("--event-name <name>","Filter by event name").option("--subspace <id>","Filter by subspace ID").option("--sender <id>","Filter by sender").option("--limit <n>","Max events to display",parseInt).option("-j, --json","Output as JSON array").option("--jsonl","Output as JSONL (one JSON per line)").action((h=n(function*(e){var t=yield b(),o=(e=>{var t=(0,a.p)(e.startTime),o=e.endTime?(0,a.p)(e.endTime):(new Date).toISOString();new Date(o)-new Date(t)>_&&(console.error(i.default.red("Time range must be 30 days or less")),process.exit(1));var n={start_time:t,end_time:o};return e.device&&(n.device_id=e.device),e.type&&(n.event_type=e.type),e.eventName&&(n.event_name=e.eventName),e.subspace&&(n.subspace_id=e.subspace),e.sender&&(n.sender=e.sender),n})(e);if(e.jsonl){var n=0;try{var r,s=!1,l=!1;try{for(var u,d=function(e){var t,o,n,r=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,n=Symbol.iterator);r--;){if(o&&null!=(t=e[o]))return t.call(e);if(n&&null!=(t=e[n]))return new c(t.call(e));o="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}(t.events(o));s=!(u=yield d.next()).done;s=!1){var p=u.value;if(console.log(JSON.stringify(p)),n++,e.limit&&n>=e.limit)break}}catch(e){l=!0,r=e}finally{try{s&&null!=d.return&&(yield d.return())}finally{if(l)throw r}}}catch(e){console.error(i.default.red(`Failed to query events: ${e.message}`)),process.exit(1)}}else{var f=yield F("Querying events...");try{var g=yield t.collectEvents(o,{limit:e.limit});if(f.stop(),e.json)return void console.log(JSON.stringify(g,null,2));if(0===g.length)return void console.log(i.default.yellow("No events found"));for(var h of(console.log(i.default.bold(`\nActivity Log Events (${g.length})`)),console.log("─".repeat(100)),console.log(i.default.gray(`${"Timestamp".padEnd(24)} ${"Type".padEnd(12)} ${"Device".padEnd(14)} ${"Event Name".padEnd(28)} ${"Sender".padEnd(16)} Payload`)),console.log("─".repeat(100)),g)){var m=C(h.timestamp),D=(h.event_type||"").padEnd(12),y=$(h.device_id,14).padEnd(14),v=$(h.event_name,28).padEnd(28),E=$(h.sender,16).padEnd(16),w=$(h.payload,40);console.log(`${m} ${D} ${y} ${v} ${E} ${i.default.gray(w)}`)}console.log("─".repeat(100))}catch(e){f.fail(`Failed to query events: ${e.message}`),process.exit(1)}}}),function(e){return h.apply(this,arguments)})),E.command("screenshots").description("List screenshot timestamps for a device").requiredOption("--device <id>","Device ID (required)").requiredOption("--start-time <datetime>","Start time (ISO 8601 or relative: 1h, 30m, 2d)").option("--end-time <datetime>","End time (default: now)").option("-j, --json","Output as JSON").action((m=n(function*(e){var t=yield b(),o=(0,a.p)(e.startTime),n=e.endTime?(0,a.p)(e.endTime):(new Date).toISOString();new Date(n)-new Date(o)>_&&(console.error(i.default.red("Time range must be 30 days or less")),process.exit(1));var r={device_id:e.device,start_time:o,end_time:n},s=yield F("Querying screenshots...");try{var l=yield t.collectScreenshots(r);if(s.stop(),e.json)return void console.log(JSON.stringify(l,null,2));if(0===l.length)return void console.log(i.default.yellow("No screenshots found"));console.log(i.default.bold(`\nScreenshots (${l.length})`)),console.log("─".repeat(56)),console.log(i.default.gray(`${"#".padStart(4)} ${"Timestamp".padEnd(24)} --ts value`)),console.log("─".repeat(56)),l.forEach((e,t)=>{var o=new Date(e.timestamp).getTime();console.log(`${String(t+1).padStart(4)} ${C(e.timestamp).padEnd(24)} ${o}`)}),console.log("─".repeat(56))}catch(e){s.fail(`Failed to query screenshots: ${e.message}`),process.exit(1)}}),function(e){return m.apply(this,arguments)})),E.command("screenshot").description("Download a screenshot image").requiredOption("--device <id>","Device ID").requiredOption("--ts <timestamp>","Screenshot timestamp (ISO 8601 or epoch ms)").option("--space <id>","Workspace/space ID (auto-detected from profile)").option("-o, --output <path>","Output file path").option("--open","Open with OS default viewer after download").action((D=n(function*(e){var t,n,r=yield b(),a=e.space||(t=(0,s.getCurrentProfile)(),n=(0,s.getTokenInfo)(t),n?.workspaceId);a||(console.error(i.default.red("Could not determine workspace ID. Use --space <id> or log in first.")),process.exit(1));var c=/^\d+$/.test(e.ts)?e.ts:new Date(e.ts).getTime(),d=yield F("Downloading screenshot...");try{var p=yield r.downloadScreenshot(a,e.device,c);d.stop();var f=e.output||`screenshot-${e.device}-${c}.jpg`,g=l.resolve(f);u.writeFileSync(g,p);var h=(p.length/1024).toFixed(1);console.log(i.default.green(`✓ Screenshot saved: ${g} (${h} KB)`)),e.open&&(0,(yield Promise.resolve().then(o.t.bind(o,35317,19))).exec)(`${"darwin"===process.platform?"open":"win32"===process.platform?"start":"xdg-open"} "${g}"`)}catch(e){d.fail(`Failed to download screenshot: ${e.message}`),process.exit(1)}}),function(e){return D.apply(this,arguments)}))},63402:(e,t,o)=>{o.d(t,{GE:()=>r,YC:()=>n,jR:()=>i});var n=["InSubspace","Global"],r="Data Bank is not enabled for this workspace.",i=e=>{if(e&&!n.includes(e))throw new Error(`Invalid meta "${e}" (expected ${n.join(" | ")})`)}},63465:(e,t,o)=>{o.d(t,{D:()=>d});var n,r,i,s=o(99436),a=o(35679),l=o(88568),u=(n=s(function*(){var e=(yield Promise.resolve().then(o.bind(o,29790))).default,t=yield o.e(611).then(o.bind(o,20611)),n=t.detectChannel,r=t.detectInstallMethod,i=yield o.e(718).then(o.bind(o,61718));return{ora:e,detectChannel:n,detectInstallMethod:r,fetchLatestVersionInfo:i.fetchLatestVersionInfo,runUpdateForMethod:i.runUpdateForMethod}}),function(){return n.apply(this,arguments)}),c=(r=s(function*({message:e,defaultValue:t,autoYes:n}){if(n)return!0;(0,(yield Promise.resolve().then(o.bind(o,74445))).isInteractiveTerminal)()||(console.error(l.default.red("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.")),process.exit(1));try{var r=(yield o.e(637).then(o.bind(o,60637))).confirm;return yield r({message:e,default:t})}catch{return!1}}),function(e){return r.apply(this,arguments)}),d=new a.uB("update-cli").description("Update the BRICKS CLI to the latest version").option("-y, --yes","Skip confirmation prompts").option("--channel <channel>","Override channel (release|beta)").option("--check-update","Only check whether a newer version is available and exit").action((i=s(function*(e){var t=yield u(),o=t.ora,n=t.detectChannel,r=t.detectInstallMethod,i=t.fetchLatestVersionInfo,a=t.runUpdateForMethod,d="2.24.11",p=r(),f=e.channel||n({version:d,execPath:p.execPath});console.log(l.default.bold(e.checkUpdate?"BRICKS CLI Update Check":"BRICKS CLI Update")),console.log("─".repeat(60)),console.log(`Current version : ${l.default.cyan(d)}`),console.log(`Channel : ${l.default.cyan(f)}`),console.log(`Detected method : ${l.default.cyan(p.method)}`),p.execPath&&"binary"===p.method&&console.log(`Binary path : ${l.default.gray(p.execPath)}`),p.installRoot&&console.log(`Install root : ${l.default.gray(p.installRoot)}`);var g="npm"===p.method||"bun"===p.method?"npm":"cdn",h=o(`Fetching latest version info (${g})...`).start(),m=null,D=null;try{m=(yield i(f,p.method)).version,h.succeed(`Latest ${f} (${g}): ${l.default.green(m)}`)}catch(e){D=e,h.warn(`Could not fetch version info: ${e.message}`)}var y=m&&m===d;if(e.checkUpdate){if(D&&process.exit(2),y)return void console.log(l.default.green("\nUp to date."));m&&(console.log(l.default.yellow(`\nUpdate available: ${d} → ${m}. Run 'bricks update-cli' to install.`)),process.exit(1)),console.log(l.default.yellow("\nCould not determine current version.")),process.exit(2)}if(!y||(console.log(l.default.green("\nAlready running the latest version.")),yield c({message:"Reinstall anyway?",defaultValue:!1,autoYes:e.yes}))){var v=["npm","bun","binary"].includes(p.method);v||console.log(l.default.yellow(`Cannot auto-detect installer (method: ${p.method}); falling back to binary install.`));var F=v?p.method:"binary";if(yield c({message:`Update CLI using "${F}" method?`,defaultValue:!0,autoYes:e.yes})){var b,_=(b=s(function*(e){console.log(l.default.cyan(`\n→ Running ${e} update...`));try{return yield a(e,f,p),!0}catch(t){return console.error(l.default.yellow(`\n${e} update failed: ${t.message}`)),!1}}),function(e){return b.apply(this,arguments)}),C=yield _(F);C||"binary"===F||(console.log(l.default.cyan("\nFalling back to binary install (same method used by the desktop app).")),(yield c({message:"Try the binary installer as a fallback?",defaultValue:!0,autoYes:e.yes}))&&(C=yield _("binary"))),C||(console.error(l.default.red("\nUpdate failed. See messages above.")),process.exit(1)),console.log(l.default.green("\nUpdate complete."))}else console.log(l.default.yellow("Cancelled."))}else console.log(l.default.gray("Skipped."))}),function(e){return i.apply(this,arguments)}))},64447:(e,t,o)=>{o.d(t,{A:()=>S});var n,r,i,s,a,l,u,c,d,p,f,g,h=o(99436),m=o(35679),D=o(88568),y=o(29790),v=o(74752),F=o(59138),b=o(35704),_=o(34992),C=o(88055),$=o(75706),E=o(13675),w=o(6939),k=(e,t)=>(0,w.H_)(e,t,{currentVersion:e?.current_version||null,public:Boolean(e?.is_public)}),S=new m.uB("module").description("Module management");S.command("new").description("Create a new module").requiredOption("-n, --name <name>","Module name").option("-d, --description <description>","Module description").option("--layout-width <width>","Layout width",parseInt).option("--layout-height <height>","Layout height",parseInt).option("--public","Make module available to all users").option("--allow-modify","Allow users to modify imported module config").option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((n=h(function*(e){var t=(0,C.requireAuth)(),n=e.json?null:(0,y.default)("Creating module...").start();try{var r={name:e.name};e.description&&(r.description=e.description),e.layoutWidth&&(r.layoutWidth=e.layoutWidth),e.layoutHeight&&(r.layoutHeight=e.layoutHeight),e.public&&(r.isPublic=!0),e.allowModify&&(r.isAllowModify=!0);var i=yield t.createModule(r);if(e.json&&!e.init?console.log(JSON.stringify(i,null,2)):e.json||(n.succeed(`Module created: ${D.default.green(i.name)}`),console.log(` ID: ${D.default.gray(i._id)}`),i.description&&console.log(` ${D.default.gray(i.description)}`),console.log(` Public: ${i.is_public?D.default.green("Yes"):D.default.gray("No")}`),console.log(` Allow Modify: ${i.is_allow_modify?D.default.green("Yes"):D.default.gray("No")}`)),e.init){n&&n.stop();var s=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield s("module",i._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):n.fail(`Failed to create module: ${t.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),S.command("list").description("List all modules").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action((r=h(function*(e){var t=(0,C.requireAuth)(),o=(0,y.default)("Fetching modules...").start();try{var n=yield t.modules({keyword:e.keyword});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(D.default.yellow("No modules found"));console.log(D.default.bold("\nModules")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.current_version?`v${e.current_version}`:D.default.gray("no version");console.log(`● ${D.default.cyan(e.name)} ${D.default.gray(t)}`),console.log(` ID: ${D.default.gray(e._id)}`),e.description&&console.log(` ${D.default.gray(e.description)}`),console.log()})}catch(e){o.fail(`Failed to list modules: ${e.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)})),S.command("list-public").description("Search public modules").requiredOption("-k, --keyword <keyword>","Search keyword (min 2 characters)").option("-j, --json","Output as JSON").action((i=h(function*(e){var t=(0,(yield(0,F.i)()).createClient)((0,v.getBaseUrl)()),o=(0,y.default)("Searching public modules...").start();try{var n=yield t.publicModules({keyword:e.keyword});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(D.default.yellow("No public modules found"));console.log(D.default.bold("\nPublic Modules")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.current_version?`v${e.current_version}`:D.default.gray("no version");console.log(`● ${D.default.cyan(e.name)} ${D.default.gray(t)}`),console.log(` ID: ${D.default.gray(e._id)}`),e.description&&console.log(` ${D.default.gray(e.description)}`),console.log()})}catch(e){o.fail(`Failed to search public modules: ${e.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),S.command("get <id>").description("Get module details").option("-j, --json","Output as JSON").action((s=h(function*(e,t){var o=(0,C.requireAuth)(),n=(0,y.default)("Fetching module...").start();try{var r=yield o.module({id:e});if(n.stop(),r||(console.log(D.default.red("Module not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));if(console.log(D.default.bold(`\nModule: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${D.default.gray(r._id)}`),console.log(`Description: ${r.description||D.default.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||D.default.gray("None")}`),console.log(`Created: ${D.default.gray(r.create_datetime)}`),console.log(`Modified: ${D.default.gray(r.last_modify_datetime)}`),console.log(`\n${D.default.bold("Version")}`),console.log(`Current: ${r.current_version?`v${r.current_version}`:D.default.gray("No version")}`),console.log(`Unreleased: ${r.has_unreleased_changes?D.default.yellow("Yes"):D.default.green("No")}`),console.log(`\n${D.default.bold("Settings")}`),console.log(`Public: ${r.is_public?D.default.green("Yes"):D.default.gray("No")}`),console.log(`Allow Modify: ${r.is_allow_modify?D.default.green("Yes"):D.default.gray("No")}`),console.log(`Short Edit: ${r.short_edit?.enabled?D.default.green("Enabled"):D.default.gray("Disabled")}`),r.short_edit?.enabled&&r.short_edit.ref_map){var i=Object.keys(r.short_edit.ref_map).length;console.log(` References: ${i} editable properties`)}null!=r.use_count?.total_count&&(console.log(`\n${D.default.bold("Usage")}`),console.log(`Used In: ${r.use_count.total_count} application(s)`)),r.expose_properties?.length>0&&(console.log(`\n${D.default.bold("Exposed Properties")} (${r.expose_properties.length})`),r.expose_properties.forEach(e=>{console.log(` - ${D.default.cyan(e)}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get module: ${e.message}`),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),S.command("resolve <query>").description("Resolve a module name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((a=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Resolving module...").start();try{var r=yield(0,$.Y)(()=>o.module({id:e})),i=r?[r]:yield o.modules({keyword:e,paginate:{limit:t.limit}}),s=(0,$.K)({resource:"module",query:e,items:i||[],fields:["_id","name"],selectedBy:r?"id":null});if(n&&n.stop(),t.json)return void(0,_.GF)(s);if(s.resolved){var a=s.resolved;return console.log(D.default.bold("\nResolved Module")),console.log("─".repeat(60)),console.log(`Name: ${D.default.cyan(a.name||"Unnamed")}`),console.log(`ID: ${D.default.gray(a._id)}`),console.log(`Selected By: ${s.selectedBy}`),void console.log("─".repeat(60))}if(0===s.matches.length)return void console.log(D.default.yellow(`No modules matched "${e}"`));console.log(D.default.bold(`\nMatching Modules (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${D.default.cyan(e.name||"Unnamed")} ${D.default.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){n?n.fail(`Failed to resolve module: ${t.message}`):(0,_.OW)(t.message,{resource:"module",query:e}),process.exit(1)}}),function(e,t){return a.apply(this,arguments)})),S.command("update <id>").description("Update module name, description, and/or configuration").option("-n, --name <name>","Module name").option("-d, --description <description>","Module description").option("-c, --config <json>","Module config as JSON string").option("-f, --file <path>","Module config from file").option("--validate","Validate configuration (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((l=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Updating module...").start();try{var r=yield o.updateModule((0,w.jB)(e,t));t.json?(0,w.yd)({action:"module.update",target:k(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(n.succeed(`Module updated: ${D.default.green(r.name)}`),r.has_unreleased_changes&&console.log(D.default.yellow("Note: Module has unreleased changes")))}catch(o){t.json?(0,_.OW)(o.message,{action:"module.update",target:{id:e}}):n.fail(`Failed to update module: ${o.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),S.command("short-edit <id>").description("Short edit module properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((u=h(function*(e,t){var o=(0,C.requireAuth)(),n=(0,y.default)("Applying short edit...").start();try{var r=JSON.parse(t.list);Array.isArray(r)||(n.fail("List must be a JSON array"),process.exit(1));var i=yield o.shortEditModule({id:e,list:r});n.succeed(`Short edit applied to: ${D.default.green(i.name)}`)}catch(e){n.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),S.command("short-refs <id>").description("List short edit references for a module").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action((c=h(function*(e,t){var o=(0,C.requireAuth)(),n=(0,y.default)("Fetching short edit references...").start();try{var r=yield o.module({id:e});if(n.stop(),!r?.short_edit?.enabled)return void console.log(D.default.yellow("Short Edit is not enabled for this module"));var i=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],s=(0,b.V)(r.short_edit.ref_map,{keyword:t.keyword,types:i});if(t.json)return void console.log(JSON.stringify(s,null,2));if(0===s.length)return void console.log(D.default.yellow("No short edit references found"));console.log(D.default.bold(`\nShort Edit References: ${r.name}`)),s.forEach(e=>{console.log(D.default.cyan(`\n${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var o=t?.title?D.default.gray(`- ${t.title}`):"";console.log(` ${D.default.green(e)} ${o}`)})}),console.log()}catch(e){n.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),S.command("remove <id>").description("Remove a module").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((d=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Removing module...").start();try{var r=yield o.module({id:e});if(!r)throw new Error("Module not found");var i=k(r,e);if(t.dryRun)return n&&n.stop(),void(0,w.S5)({action:"module.remove",target:i,request:{id:e},checks:[(0,w.Iy)("module exists",!0,`${i.name} (${i.id})`)],json:t.json});var s=yield o.removeModule({id:e});t.json?(0,w.yd)({action:"module.remove",target:i,result:{removed:Boolean(s)},json:!0}):n.succeed(`Module removed: ${D.default.green(i.name)}`)}catch(o){t.json?(0,_.OW)(o.message,{action:"module.remove",target:{id:e}}):n.fail(`Failed to remove module: ${o.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),S.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("-n, --name <name>","Update module name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((p=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Releasing module...").start();try{var r=(0,E.Ku)(t.config),i=r.config,s=r.source,a=r.sizeBytes,l=yield o.module({id:e});if(!l)throw new Error("Module not found");if(l.is_public)throw new Error("Public module deployment is temporarily not recommended");var u=t.version||t.name||l.name||"Untitled",c=(0,E.w9)(t.changelogs);if(t.dryRun)return n&&n.stop(),void(0,w.S5)({action:"module.release",target:k(l,e),request:{name:t.name||null,version:u,changelogs:t.changelogs||null,configSource:s,configSizeBytes:a},checks:[(0,w.Iy)("module exists",!0,`${l.name} (${l._id})`),(0,w.Iy)("module is private",!l.is_public),(0,w.Iy)("release config loaded",!0,`${a} bytes`)],json:t.json});var d=yield o.releaseModule({id:e,config:i,...t.name?{name:t.name}:{},releaseCurrentVersion:u,releaseCurrentVersionNote:c});t.json?(0,w.yd)({action:"module.release",target:k(d||l,e),result:{name:t.name||null,version:u,configSource:s,configSizeBytes:a},json:!0}):n.succeed(`Module released: ${D.default.green(d?.name||l.name)}`)}catch(o){t.json?(0,_.OW)(o.message,{action:"module.release",target:{id:e}}):n.fail(`Failed to release module: ${o.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),S.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((f=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Pulling module project...").start();try{var r=yield o.moduleProject({id:e,buildApplicationOnly:!0});r||(n?n.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(r)):(n.succeed(`Module project fetched: ${D.default.green(r.files?.length||0)} files`),console.log(JSON.stringify(r,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),S.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from a module").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((g=h(function*(e,t){var n=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield n("module",e,t)}),function(e,t){return g.apply(this,arguments)}))},64756:e=>{e.exports=t("tls")},65181:(e,t,o)=>{const{Argument:n}=o(41762),{Command:r}=o(18572),{CommanderError:i,InvalidArgumentError:s}=o(43823),{Help:a}=o(99690),{Option:l}=o(92088);t.DM=new r,t.gu=e=>new r(e),t.Ww=(e,t)=>new l(e,t),t.er=(e,t)=>new n(e,t),t.uB=r,t.c$=l,t.ef=n,t._V=a,t.b7=i,t.Di=s,t.a2=s},65692:e=>{e.exports=t("https")},66442:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n},e.exports.__esModule=!0,e.exports.default=e.exports},68832:(e,t,o)=>{var n=o(3634),r=o(96525),i=o(78243),s=o(5523);e.exports=function(e,t){return n(e)||r(e,t)||i(e,t)||s()},e.exports.__esModule=!0,e.exports.default=e.exports},69278:e=>{e.exports=t("net")},69504:(e,t,o)=>{o.d(t,{B:()=>A});var n,r,i,s,a,l,u,c,d,p,f,g,h,m,D,y,v=o(99436),F=o(35679),b=o(88568),_=o(29790),C=o(79896),$=o(35704),E=o(34992),w=o(88055),k=o(75706),S=o(13675),x=o(6939),O=(e,t)=>(0,x.H_)(e,t,{currentVersion:e?.current_version||null,unreleasedChanges:Boolean(e?.has_unreleased_changes)}),A=new F.uB("app").description("Application management");A.command("new").description("Create a new application").requiredOption("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("--layout-width <width>","Layout width",parseInt).option("--layout-height <height>","Layout height",parseInt).option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((n=v(function*(e){var t=(0,w.requireAuth)(),n=e.json?null:(0,_.default)("Creating application...").start();try{var r={name:e.name};e.description&&(r.description=e.description),e.layoutWidth&&(r.layoutWidth=e.layoutWidth),e.layoutHeight&&(r.layoutHeight=e.layoutHeight);var i=yield t.createApplication(r);if(e.json&&!e.init?console.log(JSON.stringify(i,null,2)):e.json||(n.succeed(`Application created: ${b.default.green(i.name)}`),console.log(` ID: ${b.default.gray(i._id)}`),i.description&&console.log(` ${b.default.gray(i.description)}`)),e.init){n&&n.stop();var s=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield s("application",i._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):n.fail(`Failed to create application: ${t.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),A.command("share-info <applicationId>").description("Show public share info (releases available for share-new) for an application").option("-j, --json","Output as JSON").action((r=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Fetching share info...").start();try{var r=yield o.publicApplicationShareInfo({id:e});if(n&&n.stop(),!r)return void(t.json?console.log(JSON.stringify(null)):console.log(b.default.yellow("No share info found for this application")));if(t.json)return void console.log(JSON.stringify(r,null,2));var i=[...r.share?.selected_releases||[]].sort((e,t)=>new Date(t.date||0)-new Date(e.date||0));console.log(b.default.bold(`\nShare Info: ${r.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`App ID: ${b.default.gray(r._id)}`),r.description&&console.log(`Description: ${r.description}`),r.owner?.id_from_user&&console.log(`Owner: ${b.default.gray(r.owner.id_from_user)}`),r.share?.tags?.length&&console.log(`Tags: ${r.share.tags.join(", ")}`),r.share?.type&&console.log(`Type: ${r.share.type}`),console.log(`\n${b.default.bold("Selected Releases")} (${i.length})`),0===i.length?console.log(b.default.gray(" None")):i.forEach(e=>{console.log(`\n ${b.default.cyan(e.name||"(unnamed)")} ${b.default.gray(e.date||"")}`),console.log(` Version ID: ${b.default.green(e.version)}`),console.log(` Release ID: ${b.default.gray(e._id)}`),e.note&&console.log(` Note: ${b.default.gray(e.note)}`)}),console.log("\n"+"─".repeat(60)),console.log(b.default.gray("Use:"),`bricks app share-new --app-id ${r._id} --version <name>`),console.log(b.default.gray("Or: "),"bricks app share-new --version-id <Version ID>")}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to fetch share info: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),A.command("share-new").description("Create a new application from a shared release version").option("--app-id <id>","Source shared application ID (requires --version)").option("--version <name>","Release name to use from the source app (requires --app-id)").option("--version-id <id>","Share version ID (from `app share-info`); skips lookup").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("--skip-if-exists","Return existing application if one already exists with this share version").option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((i=v(function*(e){var t=(0,w.requireAuth)(),n=e.json?null:(0,_.default)("Creating application from shared version...").start();try{if(!(e.versionId||e.appId&&e.version))throw new Error("Provide --version-id, or both --app-id and --version. Run `bricks app share-info <appId>` to discover values.");var r=e.versionId;if(!r){n&&(n.text="Resolving share version...");var i=yield t.publicApplicationShareInfo({id:e.appId}),s=i?.share?.selected_releases||[],a=s.find(t=>t.name===e.version);if(!a){var l=s.map(e=>e.name).filter(Boolean).join(", ")||"none";throw new Error(`Release "${e.version}" not found on app ${e.appId}. Available: ${l}`)}r=a.version,n&&(n.text="Creating application from shared version...")}var u={shareVersionId:r};e.name&&(u.name=e.name),e.description&&(u.description=e.description),e.skipIfExists&&(u.skipIfExists=!0);var c=yield t.createApplicationWithShareVersion(u);if(e.json&&!e.init?console.log(JSON.stringify(c,null,2)):e.json||(n.succeed(`Application created: ${b.default.green(c.name)}`),console.log(` ID: ${b.default.gray(c._id)}`),c.description&&console.log(` ${b.default.gray(c.description)}`)),e.init){n&&n.stop();var d=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield d("application",c._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):n.fail(`Failed to create application from shared version: ${t.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),A.command("list").description("List all applications").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action((s=v(function*(e){var t=(0,w.requireAuth)(),o=(0,_.default)("Fetching applications...").start();try{var n=yield t.applications({keyword:e.keyword});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(b.default.yellow("No applications found"));console.log(b.default.bold("\nApplications")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.has_unreleased_changes?b.default.yellow("●"):b.default.green("●"),o=e.current_version?`v${e.current_version}`:b.default.gray("no version");console.log(`${t} ${b.default.cyan(e.name)} ${b.default.gray(o)}`),console.log(` ID: ${b.default.gray(e._id)}`),e.description&&console.log(` ${b.default.gray(e.description)}`),console.log()})}catch(e){o.fail(`Failed to list applications: ${e.message}`),process.exit(1)}}),function(e){return s.apply(this,arguments)})),A.command("get <id>").description("Get application details").option("-c, --composed","Get composed configuration").option("-j, --json","Output as JSON").action((a=v(function*(e,t){var o=(0,w.requireAuth)(),n=(0,_.default)("Fetching application...").start();try{var r=yield o.application({id:e,composed:t.composed});if(n.stop(),r||(console.log(b.default.red("Application not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));if(console.log(b.default.bold(`\nApplication: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${b.default.gray(r._id)}`),console.log(`Description: ${r.description||b.default.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||b.default.gray("None")}`),console.log(`Created: ${b.default.gray(r.create_datetime)}`),console.log(`Modified: ${b.default.gray(r.last_modify_datetime)}`),console.log(`\n${b.default.bold("Version")}`),r.current_version){if(console.log(`Current: v${r.current_version}`),r.current_version_details){var i=r.current_version_details;i.name&&console.log(`Release Name: ${i.name}`),i.note&&console.log(`Release Note: ${b.default.gray(i.note)}`),i.create_datetime&&console.log(`Released At: ${b.default.gray(i.create_datetime)}`)}}else console.log(`Current: ${b.default.gray("No version")}`);if(console.log(`Unreleased: ${r.has_unreleased_changes?b.default.yellow("Yes"):b.default.green("No")}`),console.log(`\n${b.default.bold("Features")}`),console.log(`Short Edit: ${r.short_edit?.enabled?b.default.green("Enabled"):b.default.gray("Disabled")}`),r.short_edit?.enabled&&r.short_edit.ref_map){var s=Object.keys(r.short_edit.ref_map).length;console.log(` References: ${s} editable properties`)}console.log(`Automation: ${r.canvas_control?.enable_schedule?b.default.green("Scheduled"):b.default.gray("No schedule")}`),r.lock?.enabled&&console.log(`Locked: ${b.default.yellow("Yes")}`),r.sync_key&&console.log(`Sync Key: ${b.default.gray(r.sync_key)}`),r.devices?.length>0?(console.log(`\n${b.default.bold("Bound Devices")} (${r.devices.length})`),r.devices.forEach(e=>{var t="active"===e.status?b.default.green("●"):b.default.gray("○"),o=e.frame?b.default.gray(` [${e.frame.x||0},${e.frame.y||0} ${e.frame.width}x${e.frame.height}]`):"";console.log(` ${t} ${e.device_id}${o}`)})):console.log(`\n${b.default.bold("Bound Devices")}: ${b.default.gray("None")}`),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get application: ${e.message}`),process.exit(1)}}),function(e,t){return a.apply(this,arguments)})),A.command("resolve <query>").description("Resolve an application name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((l=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Resolving application...").start();try{var r=yield(0,k.Y)(()=>o.application({id:e})),i=r?[r]:yield o.applications({keyword:e,paginate:{limit:t.limit}}),s=(0,k.K)({resource:"application",query:e,items:i||[],fields:["_id","name"],selectedBy:r?"id":null});if(n&&n.stop(),t.json)return void(0,E.GF)(s);if(s.resolved){var a=s.resolved;return console.log(b.default.bold("\nResolved Application")),console.log("─".repeat(60)),console.log(`Name: ${b.default.cyan(a.name||"Unnamed")}`),console.log(`ID: ${b.default.gray(a._id)}`),console.log(`Selected By: ${s.selectedBy}`),void console.log("─".repeat(60))}if(0===s.matches.length)return void console.log(b.default.yellow(`No applications matched "${e}"`));console.log(b.default.bold(`\nMatching Applications (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${b.default.cyan(e.name||"Unnamed")} ${b.default.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){n?n.fail(`Failed to resolve application: ${t.message}`):(0,E.OW)(t.message,{resource:"application",query:e}),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),A.command("update <id>").description("Update application name, description, and/or configuration").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("-c, --config <json>","Application config as JSON string").option("-f, --file <path>","Application config from file").option("--validate","Validate configuration (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((u=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Updating application...").start();try{var r=yield o.updateApplication((0,x.jB)(e,t));t.json?(0,x.yd)({action:"application.update",target:O(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(n.succeed(`Application updated: ${b.default.green(r.name)}`),r.has_unreleased_changes&&console.log(b.default.yellow("Note: Application has unreleased changes")))}catch(o){t.json?(0,E.OW)(o.message,{action:"application.update",target:{id:e}}):n.fail(`Failed to update application: ${o.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),A.command("short-edit <id>").description("Short edit application properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((c=v(function*(e,t){var o=(0,w.requireAuth)(),n=(0,_.default)("Applying short edit...").start();try{var r=JSON.parse(t.list);Array.isArray(r)||(n.fail("List must be a JSON array"),process.exit(1));var i=yield o.shortEditApplication({id:e,list:r});n.succeed(`Short edit applied to: ${b.default.green(i.name)}`)}catch(e){n.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),A.command("short-refs <id>").description("List short edit references for an application").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action((d=v(function*(e,t){var o=(0,w.requireAuth)(),n=(0,_.default)("Fetching short edit references...").start();try{var r=yield o.application({id:e});if(n.stop(),!r?.short_edit?.enabled)return void console.log(b.default.yellow("Short Edit is not enabled for this application"));var i=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],s=(0,$.V)(r.short_edit.ref_map,{keyword:t.keyword,types:i});if(t.json)return void console.log(JSON.stringify(s,null,2));if(0===s.length)return void console.log(b.default.yellow("No short edit references found"));console.log(b.default.bold(`\nShort Edit References: ${r.name}`)),s.forEach(e=>{console.log(b.default.cyan(`\n${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var o=t?.title?b.default.gray(`- ${t.title}`):"";console.log(` ${b.default.green(e)} ${o}`)})}),console.log()}catch(e){n.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),A.command("bind <id>").description("Bind devices to application").option("-b, --bind <devices>","Device IDs to bind (comma-separated)").option("-u, --unbind <devices>","Device IDs to unbind (comma-separated)").option("--dry-run","Validate inputs and show the binding plan without applying it").option("-j, --json","Output as JSON").action((p=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Updating device bindings...").start();try{var r=yield o.application({id:e});if(!r)throw new Error("Application not found");var i=t.bind?t.bind.split(",").map(e=>e.trim()):[],s=t.unbind?t.unbind.split(",").map(e=>e.trim()):[],a={id:e};if(i.length>0&&(a.bindDevices=i),s.length>0&&(a.unbindDevices=s),t.dryRun)return n&&n.stop(),void(0,x.S5)({action:"application.bind",target:O(r,e),request:{bindDevices:i,unbindDevices:s},checks:[(0,x.Iy)("application exists",!0,`${r.name} (${r._id})`),(0,x.Iy)("device changes provided",i.length+s.length>0,`bind=${i.length}, unbind=${s.length}`)],json:t.json});yield o.bindApplication(a),t.json?(0,x.yd)({action:"application.bind",target:O(r,e),result:{bindDevices:i,unbindDevices:s},json:!0}):n.succeed("Device bindings updated")}catch(o){t.json?(0,E.OW)(o.message,{action:"application.bind",target:{id:e}}):n.fail(`Failed to update bindings: ${o.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),A.command("remove <id>").description("Remove an application").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((f=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Removing application...").start();try{var r=yield o.application({id:e});if(!r)throw new Error("Application not found");var i=O(r,e);if(t.dryRun)return n&&n.stop(),void(0,x.S5)({action:"application.remove",target:i,request:{id:e},checks:[(0,x.Iy)("application exists",!0,`${i.name} (${i.id})`)],json:t.json});var s=yield o.removeApplication({id:e});t.json?(0,x.yd)({action:"application.remove",target:i,result:{removed:Boolean(s)},json:!0}):n.succeed(`Application removed: ${b.default.green(i.name)}`)}catch(o){t.json?(0,E.OW)(o.message,{action:"application.remove",target:{id:e}}):n.fail(`Failed to remove application: ${o.message}`),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),A.command("trigger <id> <testId>").description("Trigger automation test on application").option("--play","Play the test",!0).option("--stop","Stop the test").option("--setup-at-launch","Setup to run at app launch").option("-g, --match-group <group>","Match group").action((g=v(function*(e,t,o){var n=(0,w.requireAuth)(),r=(0,_.default)("Triggering automation...").start();try{yield n.triggerApplicationCanvasControl({id:e,testId:t,play:!o.stop&&o.play,setupAtLaunch:o.setupAtLaunch,matchGroup:o.matchGroup}),r.succeed(`Automation triggered: ${b.default.green(t)}`)}catch(e){r.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}}),function(e,t,o){return g.apply(this,arguments)})),A.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("-n, --name <name>","Update application name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((h=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Releasing application...").start();try{var r=(0,S.Ku)(t.config),i=r.config,s=r.source,a=r.sizeBytes,l=yield o.application({id:e});if(!l)throw new Error("Application not found");if(l.lock?.enabled)throw new Error("Application is locked");var u=t.version||t.name||l.name||"Untitled",c=(0,S.w9)(t.changelogs);if(t.dryRun)return n&&n.stop(),void(0,x.S5)({action:"application.release",target:O(l,e),request:{name:t.name||null,version:u,changelogs:t.changelogs||null,configSource:s,configSizeBytes:a},checks:[(0,x.Iy)("application exists",!0,`${l.name} (${l._id})`),(0,x.Iy)("application is unlocked",!l.lock?.enabled),(0,x.Iy)("release config loaded",!0,`${a} bytes`)],json:t.json});var d=yield o.releaseApplication({id:e,config:i,...t.name?{name:t.name}:{},releaseCurrentVersion:u,releaseCurrentVersionNote:c});t.json?(0,x.yd)({action:"application.release",target:O(d||l,e),result:{name:t.name||null,version:u,configSource:s,configSizeBytes:a},json:!0}):n.succeed(`Application released: ${b.default.green(d?.name||l.name)}`)}catch(o){t.json?(0,E.OW)(o.message,{action:"application.release",target:{id:e}}):n.fail(`Failed to release application: ${o.message}`),process.exit(1)}}),function(e,t){return h.apply(this,arguments)})),A.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((m=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Pulling application project...").start();try{var r=yield o.applicationProject({id:e,buildApplicationOnly:!0});r||(n?n.fail("Application project not found"):console.error(JSON.stringify({error:"Application project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(r)):(n.succeed(`Application project fetched: ${b.default.green(r.files?.length||0)} files`),console.log(JSON.stringify(r,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to pull application project: ${e.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),A.command("check-config <path>").description("Validate application config against BRICKS schema").option("-j, --json","Output as JSON").option("--validate-automation","Also validate automation_map and test_map references (skips commented/unfinished steps)").option("--no-validate-expressions","Skip validating PROPERTY_BANK_EXPRESSION strings against the runtime expression rules").action((D=v(function*(e,t){C.existsSync(e)||(console.error(b.default.red(`Config file not found: ${e}`)),process.exit(1));var n=(0,_.default)("Validating config...").start();try{var r=C.readFileSync(e,"utf-8"),i=JSON.parse(r),s=yield Promise.all([o.e(428),o.e(236),o.e(703),o.e(890)]).then(o.t.bind(o,38890,19)),a=s.checkConfig,l=s.checkConfigDeprecatedFeatures,u=a(i,{checkAutomation:!!t.validateAutomation,checkCalc:!0,checkExpressions:!1!==t.validateExpressions}),c=l(i);if(n.stop(),t.json)return console.log(JSON.stringify({...u,deprecations:c},null,2)),void(u.valid||process.exit(1));if(u.valid&&0===c.length)return void console.log(b.default.green("✓ Config is valid"));console.log(b.default.bold("\nConfig Validation Report")),console.log("─".repeat(60)),u.schema.length>0&&(console.log(b.default.red(`\n Schema Errors (${u.schema.length})\n`)),u.schema.forEach((e,t)=>{var o=e.instancePath||e.dataPath||"/";console.log(` ${b.default.red(`${t+1}.`)} ${b.default.bold(o)}`),console.log(` ${e.message}`),e.params?.pattern&&console.log(` ${b.default.gray(`pattern: ${e.params.pattern}`)}`)})),u.ref.length>0&&(console.log(b.default.red(`\n Reference Errors (${u.ref.length})\n`)),u.ref.forEach((e,t)=>{console.log(` ${b.default.red(`${t+1}.`)} ${b.default.bold(e.field)}`),console.log(` ${e.message}`)})),u.calc.length>0&&(console.log(b.default.red(`\n Data Calculation Errors (${u.calc.length})\n`)),u.calc.forEach((e,t)=>{console.log(` ${b.default.red(`${t+1}.`)} ${b.default.bold(e.field)}`),console.log(` ${e.message}`)})),u.expression?.length>0&&(console.log(b.default.red(`\n Expression Errors (${u.expression.length})\n`)),u.expression.forEach((e,t)=>{console.log(` ${b.default.red(`${t+1}.`)} ${b.default.bold(e.field)}`),console.log(` ${e.message}`)})),c.length>0&&(console.log(b.default.yellow(`\n Deprecation Warnings (${c.length})\n`)),c.forEach((e,t)=>{console.log(` ${b.default.yellow(`${t+1}.`)} ${b.default.bold(e.id)}`),console.log(` ${e.data}`)})),console.log("\n"+"─".repeat(60));var d=u.schema.length+u.ref.length+u.calc.length+(u.expression?.length||0);u.valid?console.log(b.default.yellow(`⚠ ${c.length} warning(s)`)):console.log(b.default.red(`✗ ${d} error(s)`)+(c.length>0?b.default.yellow(`, ${c.length} warning(s)`):"")),u.valid||process.exit(1)}catch(e){n.fail(`Failed to validate config: ${e.message}`),process.exit(1)}}),function(e,t){return D.apply(this,arguments)})),A.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from an application").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((y=v(function*(e,t){var n=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield n("application",e,t)}),function(e,t){return y.apply(this,arguments)}))},70857:e=>{e.exports=t("os")},71178:(e,t,o)=>{e.exports=(e=>{var t={};return o.d(t,e),t})({Fragment:()=>i.Fragment,jsx:()=>i.jsx,jsxs:()=>i.jsxs})},73024:e=>{e.exports=t("node:fs")},73087:(e,o,n)=>{n.d(o,{s:()=>F});var r=n(99436),i=n(35679),s=n(88568),a=n(29790);const l=t("readline");var u,c,d,p,f,g=n(74752),h=n(34992),m=n(59138),D=e=>!!e&&"object"==typeof e&&!Array.isArray(e),y=(e={})=>{var t=D(e)?e:{},o=t.plan,n=D(o)?o:{},r=D(t.lock)?t.lock:{},i="string"==typeof o?o:n.type;return{...t,plan:{...n,type:i||"free"},lock:{...r,features:!!r.features}}},v=(u=r(function*(){var e=(0,g.getCurrentProfile)(),t=(0,g.getCurrentProfileSource)(),o=(0,g.getTokenInfo)(e),n=(0,g.getBaseUrl)();if(!o?.token)return{ok:!1,profile:e,profileSource:t,baseUrl:n,auth:{available:!1,source:"missing",workspaceId:null,workspaceName:null,createdAt:null,tokenPreview:null},workspace:null,error:null};try{var r=(0,(yield(0,m.i)()).createClient)(n,o.token),i=yield r.workspace();return{ok:!0,profile:e,profileSource:t,baseUrl:n,auth:{available:!0,source:"config",workspaceId:i?._id||o.workspaceId||null,workspaceName:i?.name||o.workspaceName||null,createdAt:o.createdAt||null,tokenPreview:(0,h.$l)(o.token)},workspace:i?{_id:i._id,name:i.name,description:i.description||null}:null,error:null}}catch(r){return{ok:!1,profile:e,profileSource:t,baseUrl:n,auth:{available:!0,source:"config",workspaceId:o.workspaceId||null,workspaceName:o.workspaceName||null,createdAt:o.createdAt||null,tokenPreview:(0,h.$l)(o.token)},workspace:null,error:{message:r.message}}}}),function(){return u.apply(this,arguments)}),F=new i.uB("auth").description("Authentication and token management");F.command("login").description("Login with a one-time passcode from BRICKS Controller (recommended)").argument("[passcode]","One-time passcode from BRICKS Controller").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((c=r(function*(e,t){var o,n,r=t.profile||(0,g.getCurrentProfile)(),i=t.name,u=e;u||(console.log(s.default.cyan("Generate a one-time passcode from BRICKS Controller:")),console.log(s.default.gray(" 1. Open the link below (or select your workspace first)")),console.log(` ${s.default.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(s.default.gray(' 2. Click "Generate OTP" to create a one-time passcode\n')),(u=yield(o="Enter passcode: ",n=l.createInterface({input:process.stdin,output:process.stdout}),new Promise(e=>{n.question(o,t=>{n.close(),e(t.trim())})})))||(console.log(s.default.red("Passcode is required")),process.exit(1)));var c=(0,a.default)("Validating passcode...").start();try{var d=yield(0,m.i)(),p=d.createClient,f=(0,d.createPublicClient)((0,g.getBaseUrl)()),h=yield f.checkWorkspaceOTP(u);h.valid||(c.fail(`Invalid passcode: ${h.error||"Unknown error"}`),process.exit(1)),c.text=`Exchanging passcode for token (workspace: ${h.workspaceName})...`;var D=yield f.exchangeWorkspaceOTP(u);D.token||(c.fail("Failed to obtain token"),process.exit(1));var v=p((0,g.getBaseUrl)(),D.token),F=yield v.workspace();F||(c.fail("Token validation failed"),process.exit(1)),(0,g.setToken)(r,{token:D.token,name:i||F.name,workspaceId:F._id,workspaceName:F.name,workspaceBilling:y(F.billing)}),(0,g.setCurrentProfile)(r),c.succeed(`Logged in to workspace: ${s.default.green(F.name)} (profile: ${s.default.cyan(r)})`)}catch(e){c.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),F.command("login-token").description("Login with a workspace token directly").option("-t, --token <token>","Workspace token").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((d=r(function*(e){var t=e.profile||(0,g.getCurrentProfile)(),o=e.token,n=e.name;o||(console.error(s.default.red("Error: Token is required. Use -t or --token to provide it.")),console.log(s.default.gray("\nYou can get a workspace token from BRICKS Controller:")+s.default.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")),console.log(` ${s.default.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(s.default.gray("Select your workspace and create a new token.\n")),console.log(s.default.yellow("Tip: Use `bricks auth login` for a simpler OTP-based login.")),process.exit(1));var r=(0,a.default)("Validating token...").start();try{var i=(0,(yield(0,m.i)()).createClient)((0,g.getBaseUrl)(),o),l=yield i.workspace();l||(r.fail("Invalid token or unable to access workspace"),process.exit(1)),(0,g.setToken)(t,{token:o,name:n||l.name,workspaceId:l._id,workspaceName:l.name,workspaceBilling:y(l.billing)}),(0,g.setCurrentProfile)(t),r.succeed(`Logged in to workspace: ${s.default.green(l.name)} (profile: ${s.default.cyan(t)})`)}catch(e){r.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e){return d.apply(this,arguments)})),F.command("logout").description("Remove saved token").option("-p, --profile <profile>","Profile to remove").option("-a, --all","Remove all profiles").action((p=r(function*(e){var t=e.profile;if(e.all)return(0,g.listProfiles)().forEach(e=>(0,g.removeToken)(e.name)),void console.log(s.default.green("All profiles removed"));var o=t||(0,g.getCurrentProfile)();(0,g.getTokenInfo)(o)?((0,g.removeToken)(o),console.log(s.default.green(`Logged out from profile: ${o}`))):console.log(s.default.yellow(`No token found for profile: ${o}`))}),function(e){return p.apply(this,arguments)})),F.command("status").description("Show current authentication status").option("-j, --json","Output as JSON").action((f=r(function*(e){var t=(0,g.getCurrentProfile)(),o=(0,g.getTokenInfo)(t);if(!o)return e.json?void(0,h.GF)(yield v()):(console.log(s.default.yellow("Not logged in")),void console.log(s.default.gray("Use `bricks auth login` to login")));if(e.json)(0,h.GF)(yield v());else{var n=(0,a.default)("Checking connection...").start();try{var r=(0,(yield(0,m.i)()).createClient)((0,g.getBaseUrl)(),o.token),i=yield r.workspace();n.stop(),console.log(s.default.bold("\nAuthentication Status")),console.log("─".repeat(40)),console.log(`Profile: ${s.default.cyan(t)}`),console.log(`Workspace: ${s.default.green(i.name)}`),console.log(`Workspace ID: ${s.default.gray(i._id)}`);var l=(0,g.getBaseUrl)(),u=o.baseUrl;console.log(`Base URL: ${s.default.gray(l)}${u?"":s.default.gray(" (global)")}`),console.log(`Logged in: ${s.default.gray(o.createdAt)}`),console.log("─".repeat(40))}catch(e){n.fail(`Connection failed: ${e.message}`)}}}),function(e){return f.apply(this,arguments)})),F.command("list").description("List all saved profiles").action(()=>{var e=(0,g.listProfiles)();if(0===e.length)return console.log(s.default.yellow("No saved profiles")),void console.log(s.default.gray("Use `bricks auth login` to login"));console.log(s.default.bold("\nSaved Profiles")),console.log("─".repeat(60)),e.forEach(e=>{var t=e.current?s.default.green("● "):" ",o=e.current?s.default.green(e.name):e.name,n=e.baseUrl?s.default.gray(` [${e.baseUrl}]`):"";console.log(`${t}${o.padEnd(15)} ${s.default.gray(e.workspaceName||"Unknown")}${n}`)}),console.log("─".repeat(60))}),F.command("use <profile>").description("Switch to a different profile").action(e=>{var t=(0,g.getTokenInfo)(e);if(!t)return console.log(s.default.red(`Profile not found: ${e}`)),void console.log(s.default.gray("Use `bricks auth list` to see available profiles"));(0,g.setCurrentProfile)(e),console.log(s.default.green(`Switched to profile: ${e}`)),t.workspaceName&&console.log(s.default.gray(`Workspace: ${t.workspaceName}`))}),F.command("set-url <url>").description("Set the base URL for the current profile").option("-g, --global","Set the global base URL instead of per-profile").action((e,t)=>{if(t.global)(0,g.setBaseUrl)(e),console.log(s.default.green(`Global base URL set to: ${e}`));else{var o=(0,g.getCurrentProfile)();(0,g.setBaseUrl)(e,o),console.log(s.default.green(`Base URL for profile ${s.default.cyan(o)} set to: ${e}`))}})},74445:(e,t,o)=>{o.r(t),o.d(t,{isInteractiveTerminal:()=>n,shouldStartInteractiveMode:()=>r});var n=()=>Boolean(process.stdin.isTTY&&process.stdout.isTTY&&"function"==typeof process.stdin.setRawMode),r=(e=[])=>0===e.length&&n()},74752:(e,t,o)=>{o.d(t,{CONFIG_DIR:()=>i,CONFIG_PATH:()=>a,clearBankCredentials:()=>$,clearConfig:()=>k,default:()=>S,getActivityLogBaseUrl:()=>E,getBankCredentials:()=>_,getBaseUrl:()=>u,getCurrentProfile:()=>y,getCurrentProfileSource:()=>v,getToken:()=>p,getTokenInfo:()=>f,getTokens:()=>d,listProfiles:()=>b,removeToken:()=>h,setActivityLogBaseUrl:()=>w,setBankCredentials:()=>C,setBaseUrl:()=>c,setCurrentProfile:()=>F,setProfileOverride:()=>D,setToken:()=>g}),o.r(t);var n=o(16928),r=o(70857),i=n.join(r.homedir(),".bricks-cli"),a=n.join(i,"config.json"),l=new s({projectName:"bricks-cli",cwd:i,schema:{tokens:{type:"object",default:{},additionalProperties:{type:"object",properties:{token:{type:"string"},name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:"string"},workspaceBilling:{type:"object"},createdAt:{type:"string"},baseUrl:{type:"string"},bank:{type:"object"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"},activityLogBaseUrl:{type:"string",default:"https://activity-log.bricks.tools"}}}),u=()=>{var e=y(),t=l.get("tokens");return t[e]?.baseUrl||l.get("baseUrl")},c=(e,t)=>{if(t){var o=l.get("tokens");o[t]||(o[t]={}),o[t].baseUrl=e,l.set("tokens",o)}else l.set("baseUrl",e)},d=()=>l.get("tokens"),p=(e="default")=>{var t=l.get("tokens");return t[e]?.token},f=(e="default")=>l.get("tokens")[e],g=(e,t)=>{var o=l.get("tokens"),n=o[e];o[e]={...n?.baseUrl?{baseUrl:n.baseUrl}:{},...n?.activityLogBaseUrl?{activityLogBaseUrl:n.activityLogBaseUrl}:{},...t,createdAt:(new Date).toISOString()},l.set("tokens",o)},h=e=>{var t=l.get("tokens");delete t[e],l.set("tokens",t)},m=null,D=e=>{m=e},y=()=>m||process.env.BRICKS_PROFILE||l.get("currentProfile"),v=()=>m?"override":process.env.BRICKS_PROFILE?"env":"config",F=e=>l.set("currentProfile",e),b=()=>{var e=l.get("tokens"),t=l.get("currentProfile");return Object.keys(e).map(o=>({...e[o],name:o,current:o===t}))},_=(e="default")=>{var t=l.get("tokens");return t[e]?.bank||null},C=(e,t)=>{var o=l.get("tokens");o[e]||(o[e]={}),o[e].bank=t,l.set("tokens",o)},$=e=>{var t=l.get("tokens");return!!t[e]?.bank&&(delete t[e].bank,l.set("tokens",t),!0)},E=()=>{var e=y(),t=l.get("tokens");return t[e]?.activityLogBaseUrl||l.get("activityLogBaseUrl")},w=(e,t)=>{if(t){var o=l.get("tokens");o[t]||(o[t]={}),o[t].activityLogBaseUrl=e,l.set("tokens",o)}else l.set("activityLogBaseUrl",e)},k=()=>{l.clear()};const S=l},75706:(e,t,o)=>{o.d(t,{K:()=>s,Y:()=>a});var n,r=o(99436),i=e=>String(e||"").trim().toLowerCase(),s=({resource:e,query:t,items:o,fields:n,selectedBy:r=null})=>{var s=i(t),a=o.filter(e=>n.some(t=>i(((e,t)=>t.split(".").reduce((e,t)=>e?.[t],e)??null)(e,t))===s)),l=null,u=r;return"id"===r?l=o[0]||null:1===a.length?(l=a[0],u="exact"):1===o.length&&(l=o[0],u="single"),{resource:e,query:t,exactMatchCount:a.length,matchCount:o.length,selectedBy:u,ambiguous:o.length>1&&!l,resolved:l,matches:o}},a=(n=r(function*(e){try{return yield e()}catch(e){if(/not found/i.test(e.message))return null;throw e}}),function(e){return n.apply(this,arguments)})},76760:e=>{e.exports=t("node:path")},76982:e=>{e.exports=t("crypto")},77030:e=>{e.exports=t("node:net")},77598:e=>{e.exports=t("node:crypto")},78243:(e,t,o)=>{var n=o(66442);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},78474:e=>{e.exports=t("node:events")},79491:e=>{e.exports=import("oxfmt")},79896:e=>{e.exports=t("fs")},80481:e=>{e.exports=t("node:readline")},81637:(e,t,o)=>{o.d(t,{_:()=>I});var n,r,i,s,a,l,u,c,d,p,f,g,h,m,D=o(68832),y=o(99436),v=o(35679),F=o(88568),b=o(29790),_=o(34992),C=o(88055),$=o(75706),E=o(6939),w=o(1001),k=e=>{if(!e)return F.default.gray("○ Unknown");var t=Date.now()-new Date(e).getTime();if(t<=3e5)return F.default.green("● Online");var o=Math.floor(t/6e4);if(o<60)return F.default.yellow(`○ Offline (${o}m ago)`);var n=Math.floor(o/60);if(n<24)return F.default.red(`○ Offline (${n}h ago)`);var r=Math.floor(n/24);return F.default.red(`○ Offline (${r}d ago)`)},S=e=>e.name||e.device_name||"Unnamed",x=(e,t)=>(0,E.H_)(e,t,{name:S(e),deviceName:e?.device_name||null}),O=(r=y(function*(e,t){var o=yield e.device({id:t});if(!o)throw new Error("Device not found");return o}),function(e,t){return r.apply(this,arguments)}),A=(i=y(function*({id:e,type:t,eventPayload:o,options:n,progressMessage:r,successMessage:i,failureMessage:s="Failed to control device"}){var a=(0,C.requireAuth)(),l=n.json?null:(0,b.default)(r).start();try{var u=yield O(a,e),c=x(u,e);if(n.dryRun)return l&&l.stop(),void(0,E.S5)({action:"device.control",target:c,request:{type:t,eventPayload:o||null},checks:[(0,E.Iy)("device exists",!0,`${c.name} (${c.id})`)],json:n.json});yield a.controlDevice({id:e,type:t,eventPayload:o}),l?l.succeed(i):(0,E.yd)({action:"device.control",target:c,result:{type:t,eventPayload:o||null},json:!0})}catch(o){n.json?(0,_.OW)(o.message,{action:"device.control",target:{id:e},type:t}):l.fail(`${s}: ${o.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)}),I=new v.uB("device").description("Device management");I.command("list").description("List all devices").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action((s=y(function*(e){var t=(0,C.requireAuth)(),o=(0,b.default)("Fetching devices...").start();try{var n=yield t.devices({keyword:e.keyword});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(F.default.yellow("No devices found"));console.log(F.default.bold("\nDevices")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,o=k(t),n=e.entry_detail?.application?.name||F.default.gray("No app bound");console.log(`${o} ${F.default.cyan(e.name||e.device_name)}`),console.log(` ID: ${F.default.gray(e._id)}`),console.log(` App: ${n}`),console.log()})}catch(e){o.fail(`Failed to list devices: ${e.message}`),process.exit(1)}}),function(e){return s.apply(this,arguments)})),I.command("get <id>").description("Get device details").option("-j, --json","Output as JSON").action((a=y(function*(e,t){var o=(0,C.requireAuth)(),n=(0,b.default)("Fetching device...").start();try{var r=yield o.device({id:e});if(n.stop(),r||(console.log(F.default.red("Device not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));var i=r.entry_detail?.watch_dog_timer?.last_alive_time,s=k(i);if(console.log(F.default.bold(`\nDevice: ${r.name||r.device_name}`)),console.log("─".repeat(60)),console.log(`Status: ${s}`),console.log(`ID: ${F.default.gray(r._id)}`),console.log(`Device Name: ${r.device_name||F.default.gray("N/A")}`),console.log(`Description: ${r.description||F.default.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||F.default.gray("None")}`),console.log(`Created: ${F.default.gray(r.create_datetime||"N/A")}`),console.log(`Modified: ${F.default.gray(r.last_modify_datetime||"N/A")}`),r.entry_detail){var a=r.entry_detail;if(console.log(`\n${F.default.bold("Entry Details")}`),console.log(`Type: ${a.type||F.default.gray("N/A")}`),console.log(`Unique ID: ${F.default.gray(a.unique_id||"N/A")}`),console.log(`Version: ${a.operation_version||F.default.gray("N/A")}`),console.log(`Mode: ${a.operation_mode||F.default.gray("N/A")}`),Array.isArray(a.screen)&&a.screen.length>0)console.log(`\n${F.default.bold("Screens")} (${a.screen.length})`),a.screen.forEach((e,t)=>{var o=e.resolution,n=o?`${o.width}x${o.height} @${o.scale}x`:"N/A",r=e.master?F.default.green(" (master)"):"",i=e.orientation?` [${e.orientation}]`:"",s=e.touch?.available?F.default.cyan(` touch:${e.touch.touch_point}pt`):"";console.log(` ${t+1}. ${e.title||"Screen"}${r}${i} - ${n}${s}`)});else if(a.screen?.resolution){var l=a.screen.resolution;console.log(`Resolution: ${l.width}x${l.height} @${l.scale}x`)}var u=null!=a.memory_usage,c=null!=a.disk_usage;if(u||c){if(console.log(`\n${F.default.bold("System Resources")}`),u){var d=Array.isArray(a.memory_usage)?a.memory_usage[0]:a.memory_usage;if(Number.isFinite(d)){var p=Math.round(100*d),f=F.default.green;p>80?f=F.default.red:p>60&&(f=F.default.yellow),console.log(`Memory: ${f(`${p}%`)}`)}else console.log(`Memory: ${F.default.gray("N/A")}`)}if(c){var g=Array.isArray(a.disk_usage)?a.disk_usage[0]:a.disk_usage;if(Number.isFinite(g)){var h=Math.round(100*g),m=F.default.green;h>90?m=F.default.red:h>75&&(m=F.default.yellow),console.log(`Disk: ${m(`${h}%`)}`)}else console.log(`Disk: ${F.default.gray("N/A")}`)}}var D=[];if(a.sound?.available&&D.push("Sound"),a.camera?.available&&D.push("Camera"),a.audio_in?.available&&D.push("Audio Input"),D.length>0&&(console.log(`\n${F.default.bold("Capabilities")}`),console.log(`Available: ${D.join(", ")}`),a.camera?.channel?.length>0&&a.camera.channel.forEach(e=>{var t=e.resolution?`${e.resolution.width}x${e.resolution.height}`:"";console.log(` Camera: ${e.title||"Camera"} ${t} [${e.orientation||"N/A"}]`)})),a.local_sync){var y=a.local_sync;console.log(`\n${F.default.bold("Local Sync")}`),console.log(`Role: ${y.is_main?F.default.cyan("Main"):"Secondary"}`),null!=y.peer_count&&console.log(`Peers: ${y.peer_count}`),null!=y.mean_latency&&console.log(`Latency: ${y.mean_latency.toFixed(2)}ms`)}if(a.update){var v=a.update;console.log(`\n${F.default.bold("Update Status")}`),console.log(`Needs Update: ${v.need_update?F.default.yellow("Yes"):F.default.green("No")}`),v.current_version&&console.log(`App Version: ${v.current_version}`),v.running_mode&&console.log(`Running Mode: ${v.running_mode}`),v.last_update_at&&console.log(`Last Update: ${F.default.gray(v.last_update_at)}`)}if(a.watch_dog_timer){var _=a.watch_dog_timer;console.log(`\n${F.default.bold("Watchdog")}`),console.log(`Alive: ${_.alive?F.default.green("Yes"):F.default.red("No")}`),_.last_launch_time&&console.log(`Last Launch: ${F.default.gray(_.last_launch_time)}`),_.last_alive_time&&console.log(`Last Alive: ${F.default.gray(_.last_alive_time)}`)}}r.bound_application&&(console.log(`\n${F.default.bold("Bound Application")}`),console.log(`Name: ${r.bound_application.name}`),console.log(`ID: ${F.default.gray(r.bound_application._id)}`)),r.env?.variables&&Object.keys(r.env.variables).length>0&&(console.log(`\n${F.default.bold("Environment Variables")}`),Object.entries(r.env.variables).forEach(([e,t])=>{console.log(` ${F.default.cyan(e)}: ${t}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get device: ${e.message}`),process.exit(1)}}),function(e,t){return a.apply(this,arguments)})),I.command("resolve <query>").description("Resolve a device name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((l=y(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,b.default)("Resolving device...").start();try{var r=yield(0,$.Y)(()=>o.device({id:e})),i=r||!e?r?[r]:[]:yield o.devices({keyword:e,paginate:{limit:t.limit}}),s=(0,$.K)({resource:"device",query:e,items:r?[r]:i||[],fields:["_id","name","device_name"],selectedBy:r?"id":null});if(n&&n.stop(),t.json)return void(0,_.GF)(s);if(s.resolved){var a=s.resolved;return console.log(F.default.bold("\nResolved Device")),console.log("─".repeat(60)),console.log(`Name: ${F.default.cyan(a.name||a.device_name||"Unnamed")}`),console.log(`ID: ${F.default.gray(a._id)}`),console.log(`Selected By: ${s.selectedBy}`),void console.log("─".repeat(60))}if(0===s.matches.length)return void console.log(F.default.yellow(`No devices matched "${e}"`));console.log(F.default.bold(`\nMatching Devices (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${F.default.cyan(e.name||e.device_name||"Unnamed")} ${F.default.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){n?n.fail(`Failed to resolve device: ${t.message}`):(0,_.OW)(t.message,{resource:"device",query:e}),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),I.command("bind <passcode>").description("Bind a new device using passcode").option("-n, --name <name>","Device name").option("--dry-run","Validate inputs and show the device binding plan without creating a device").option("-j, --json","Output as JSON").action((u=y(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,b.default)("Checking passcode...").start();try{var r=yield o.checkBindDevicePasscode({passcode:e});r||(t.json?(0,_.OW)("Invalid passcode or expired",{action:"device.bind"}):n.fail("Invalid passcode or expired"),process.exit(1));var i={name:t.name||r.payload?.deviceName||"CLI Device",deviceName:r.payload?.deviceName||null};if(t.dryRun)return n&&n.stop(),void(0,E.S5)({action:"device.bind",target:i,request:{passcodePreview:(0,_.$l)(e),requestedName:t.name||null,inferredName:r.payload?.deviceName||null},checks:[(0,E.Iy)("passcode is valid",!0),(0,E.Iy)("device name resolved",!0,i.name)],json:t.json});n&&(n.text="Binding device...");var s=yield o.createDevice({bindPasscode:e,name:i.name,deviceName:r.payload?.deviceName});t.json?(0,E.yd)({action:"device.bind",target:x(s,s._id),result:{inferredName:r.payload?.deviceName||null},json:!0}):(n.succeed(`Device bound successfully: ${F.default.green(s.name)}`),console.log(F.default.gray(`Device ID: ${s._id}`)))}catch(e){t.json?(0,_.OW)(e.message,{action:"device.bind"}):n.fail(`Failed to bind device: ${e.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),I.command("remove <id>").description("Remove a device").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((c=y(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,b.default)("Removing device...").start();try{var r=yield O(o,e),i=x(r,e);if(t.dryRun)return n&&n.stop(),void(0,E.S5)({action:"device.remove",target:i,request:{id:e},checks:[(0,E.Iy)("device exists",!0,`${i.name} (${i.id})`)],json:t.json});var s=yield o.removeDevice({id:e});t.json?(0,E.yd)({action:"device.remove",target:i,result:{removed:Boolean(s)},json:!0}):n.succeed(`Device removed: ${F.default.green(i.name)}`)}catch(o){t.json?(0,_.OW)(o.message,{action:"device.remove",target:{id:e}}):n.fail(`Failed to remove device: ${o.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),I.command("control <id> <type>").description("Control a device").option("-p, --payload <json>","Event payload as JSON").option("--dry-run","Validate inputs and show the control request without sending it").option("-j, --json","Output as JSON").action((d=y(function*(e,t,o){try{var n;o.payload&&(n=JSON.parse(o.payload)),yield A({id:e,type:t,eventPayload:n,options:o,progressMessage:`Sending ${t} to device...`,successMessage:`Control event sent: ${F.default.green(t)}`,failureMessage:"Failed to control device"})}catch(n){o.json?(0,_.OW)(n.message,{action:"device.control",target:{id:e},type:t}):console.error(F.default.red(`Failed to control device: ${n.message}`)),process.exit(1)}}),function(e,t,o){return d.apply(this,arguments)})),I.command("refresh <id>").description("Refresh device application").option("--dry-run","Validate inputs and show the refresh request without sending it").option("-j, --json","Output as JSON").action((p=y(function*(e,t){yield A({id:e,type:"refresh",options:t,progressMessage:"Refreshing device...",successMessage:"Device refreshed",failureMessage:"Failed to refresh device"})}),function(e,t){return p.apply(this,arguments)})),I.command("clear-cache <id>").description("Clear device cache").option("--dry-run","Validate inputs and show the cache-clear request without sending it").option("-j, --json","Output as JSON").action((f=y(function*(e,t){yield A({id:e,type:"clear-cache",options:t,progressMessage:"Clearing cache...",successMessage:"Cache cleared",failureMessage:"Failed to clear cache"})}),function(e,t){return f.apply(this,arguments)})),I.command("screenshot <id>").description("Take device screenshot and save to file").option("-o, --output <path>","Output file path").option("--no-take","Only fetch existing screenshot without taking a new one").action((g=y(function*(e,t){var r=(0,C.requireAuth)(),i=(0,b.default)("Fetching workspace info...").start();try{var s=yield r.workspace();s?.media_resource?.enable_media_workspace||(i.fail("Media workspace is not enabled for this workspace"),process.exit(1)),s.media_resource.system_media_box_id||(i.fail("No media box configured for this workspace"),process.exit(1)),!1!==t.take&&(i.text="Sending screenshot request to device...",yield r.controlDevice({id:e,type:"take-screenshot"}),i.text="Waiting for device to capture screenshot...",yield new Promise(e=>setTimeout(e,3e3))),i.text="Fetching screenshot...";var a=(yield(n||=Promise.all([o.e(657),o.e(336)]).then(o.bind(o,47336)),n)).fetchAndSaveScreenshot,l=yield a(r,s,e,t.output);if(l.error&&(i.fail(l.error),process.exit(1)),i.succeed("Screenshot saved"),console.log(),console.log(F.default.bold("Screenshot saved to:")),console.log(F.default.cyan(l.path)),console.log(),l.file?.meta){var u=l.file.meta,c=u.originalWidth,d=u.originalHeight,p=u.originalFileSize;if(c&&d&&console.log(`${F.default.gray("Size:")} ${c}x${d}`),p){var f=(p/1024).toFixed(1);console.log(`${F.default.gray("File:")} ${f} KB`)}}l.file?.updatedAt&&console.log(`${F.default.gray("Updated:")} ${new Date(l.file.updatedAt).toLocaleString()}`)}catch(e){i.fail(`Failed to get screenshot: ${e.message}`),process.exit(1)}}),function(e,t){return g.apply(this,arguments)})),I.command("metrics <id>").description("Show device metrics (uptime, memory, disk)").option("--start-date <date>","Start date/time (ISO 8601 or relative e.g. 1h, 2d, default: today)").option("--end-date <date>","End date/time (ISO 8601 or relative e.g. 1h, 2d, default: now)").option("-j, --json","Output as JSON").action((h=y(function*(e,t){var o=(0,C.requireAuth)(),n=(0,b.default)("Fetching device metrics...").start();try{var r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).toISOString(),s=t.startDate?(0,w.p)(t.startDate):i,a=t.endDate?(0,w.p)(t.endDate):r.toISOString(),l=yield o.deviceUsage({deviceId:e,startDate:s,endDate:a});if(n.stop(),!l||0===l.length)return void console.log(F.default.yellow("No metrics data found for this device"));if(t.json)return void console.log(JSON.stringify(l,null,2));for(var u of(console.log(F.default.bold(`\nDevice Metrics: ${e}`)),console.log("─".repeat(60)),console.log(F.default.gray(`${"Date".padEnd(12)} ${"Uptime Events".padEnd(15)} ${"Avg Memory".padEnd(12)} ${"Avg Disk".padEnd(10)}`)),console.log("─".repeat(60)),l)){var c=(u.date||"").padEnd(12),d=String(u.uptime?.length||0).padEnd(15),p="N/A";if(u.memory_usage?.length){var f=0,g=0;for(var h of u.memory_usage){var m=h.values||[],y=D(m,2),v=y[0],_=y[1];null!=v&&null!=_&&_>0&&(f+=v,g+=_)}g>0&&(p=`${(f/g*100).toFixed(1)}%`)}var $="N/A";if(u.disk_usage?.length){var E=0,k=0;for(var S of u.disk_usage){var x=S.values||[],O=D(x,2),A=O[0],I=O[1];null!=A&&null!=I&&I>0&&(E+=A,k+=I)}k>0&&($=`${(E/k*100).toFixed(1)}%`)}console.log(`${c} ${d} ${p.padEnd(12)} ${$.padEnd(10)}`)}console.log("─".repeat(60))}catch(e){n.fail(`Failed to get device metrics: ${e.message}`),process.exit(1)}}),function(e,t){return h.apply(this,arguments)})),I.command("monitor").description("Monitor device status (polls every 60s)").option("-g, --group <id>","Monitor devices in a group").option("-i, --interval <seconds>","Polling interval in seconds","60").action((m=y(function*(e){var t=(0,C.requireAuth)(),o=1e3*parseInt(e.interval,10);console.log(F.default.bold("\nDevice Monitor")),console.log(F.default.gray(`Polling every ${e.interval}s. Press Ctrl+C to stop.\n`));var n,r=(n=y(function*(){try{var o;if(o=e.group?yield t.devicesByGroup({id:e.group}):yield t.devices({}),process.stdout.write("[2J[0f"),console.log(F.default.bold("Device Monitor")+F.default.gray(` - ${(new Date).toLocaleTimeString()}`)),console.log("─".repeat(80)),!o||0===o.length)return void console.log(F.default.yellow("No devices found"));o.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,o=k(t),n=e.name||e.device_name||e.device_target_name||"Unnamed",r=e.entry_detail?.application?.name||F.default.gray("No app");console.log(`${o} ${F.default.cyan(n.padEnd(25))} ${r}`)}),console.log(`\n${F.default.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(F.default.red(`Error: ${e.message}`))}}),function(){return n.apply(this,arguments)});yield r(),setInterval(r,o)}),function(e){return m.apply(this,arguments)}))},84361:e=>{e.exports=import("ws")},86054:(e,t)=>{t.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));const o=e.startsWith("--");o&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let n=[],r=3;return t.forEach(t=>{if(t.length<=1)return;const o=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);const o=[];for(let t=0;t<=e.length;t++)o[t]=[t];for(let e=0;e<=t.length;e++)o[0][e]=e;for(let n=1;n<=t.length;n++)for(let r=1;r<=e.length;r++){let i=1;i=e[r-1]===t[n-1]?0:1,o[r][n]=Math.min(o[r-1][n]+1,o[r][n-1]+1,o[r-1][n-1]+i),r>1&&n>1&&e[r-1]===t[n-2]&&e[r-2]===t[n-1]&&(o[r][n]=Math.min(o[r][n],o[r-2][n-2]+1))}return o[e.length][t.length]}(e,t),i=Math.max(e.length,t.length);(i-o)/i>.4&&(o<r?(r=o,n=[t]):o===r&&n.push(t))}),n.sort((e,t)=>e.localeCompare(t)),o&&(n=n.map(e=>`--${e}`)),n.length>1?`\n(Did you mean one of ${n.join(", ")}?)`:1===n.length?`\n(Did you mean ${n[0]}?)`:""}},87016:e=>{e.exports=t("url")},88055:(e,t,o)=>{o.r(t),o.d(t,{requireAuth:()=>u});var n=o(99436),r=o(88568),i=o(74752),s=o(59138),a=new Set(["$$typeof","asymmetricMatch","catch","constructor","finally","hasOwnProperty","inspect","nodeType","toJSON","toString","valueOf"]),l=(e,t)=>{var o,r=null,i=(o=n(function*(){return r||=Promise.resolve((0,s.i)()).then(({createClient:o})=>o(e,t)),r}),function(){return o.apply(this,arguments)});return new Proxy({},{get:(e,t)=>t===Symbol.toStringTag?"BricksLazyClient":"string"!=typeof t||"then"===t||a.has(t)?void 0:n(function*(...e){var o=yield i(),n=o[t];return"function"==typeof n?n.apply(o,e):n})})},u=()=>{var e=(0,i.getCurrentProfile)(),t=(0,i.getToken)(e);return t||(console.error(r.default.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),l((0,i.getBaseUrl)(),t)}},88568:(e,t,o)=>{o.d(t,{Chalk:()=>x,backgroundColorNames:()=>u,backgroundColors:()=>u,chalkStderr:()=>R,colorNames:()=>c,colors:()=>c,default:()=>U,foregroundColorNames:()=>l,foregroundColors:()=>l,modifierNames:()=>a,modifiers:()=>a,supportsColor:()=>_,supportsColorStderr:()=>C}),o.r(t);const n=(e=0)=>t=>`[${t+e}m`,r=(e=0)=>t=>`[${38+e};5;${t}m`,i=(e=0)=>(t,o,n)=>`[${38+e};2;${t};${o};${n}m`,s={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},a=Object.keys(s.modifier),l=Object.keys(s.color),u=Object.keys(s.bgColor),c=[...l,...u];const d=function(){const e=new Map;for(const[t,o]of Object.entries(s)){for(const[t,n]of Object.entries(o))s[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},o[t]=s[t],e.set(n[0],n[1]);Object.defineProperty(s,t,{value:o,enumerable:!1})}return Object.defineProperty(s,"codes",{value:e,enumerable:!1}),s.color.close="[39m",s.bgColor.close="[49m",s.color.ansi=n(),s.color.ansi256=r(),s.color.ansi16m=i(),s.bgColor.ansi=n(10),s.bgColor.ansi256=r(10),s.bgColor.ansi16m=i(10),Object.defineProperties(s,{rgbToAnsi256:{value:(e,t,o)=>e===t&&t===o?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[o]=t;3===o.length&&(o=[...o].map(e=>e+e).join(""));const n=Number.parseInt(o,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>s.rgbToAnsi256(...s.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,o,n;if(e>=232)t=(10*(e-232)+8)/255,o=t,n=t;else{const r=(e-=16)%36;t=Math.floor(e/36)/5,o=Math.floor(r/6)/5,n=r%6/5}const r=2*Math.max(t,o,n);if(0===r)return 30;let i=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(t));return 2===r&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,o)=>s.ansi256ToAnsi(s.rgbToAnsi256(e,t,o)),enumerable:!1},hexToAnsi:{value:e=>s.ansi256ToAnsi(s.hexToAnsi256(e)),enumerable:!1}}),s}();var p=o(1708),f=o(48161),g=o(7066);function h(e,t=(globalThis.Deno?globalThis.Deno.args:p.argv)){const o=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(o+e),r=t.indexOf("--");return-1!==n&&(-1===r||n<r)}const{env:m}=p;let D;function y(e,{streamIsTTY:t,sniffFlags:o=!0}={}){const n=function(){if("FORCE_COLOR"in m)return"true"===m.FORCE_COLOR?1:"false"===m.FORCE_COLOR?0:0===m.FORCE_COLOR.length?1:Math.min(Number.parseInt(m.FORCE_COLOR,10),3)}();void 0!==n&&(D=n);const r=o?D:n;if(0===r)return 0;if(o){if(h("color=16m")||h("color=full")||h("color=truecolor"))return 3;if(h("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(e&&!t&&void 0===r)return 0;const i=r||0;if("dumb"===m.TERM)return i;if("win32"===p.platform){const e=f.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in m)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(e=>e in m)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(e=>e in m)||"codeship"===m.CI_NAME?1:i;if("TEAMCITY_VERSION"in m)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(m.TEAMCITY_VERSION)?1:0;if("truecolor"===m.COLORTERM)return 3;if("xterm-kitty"===m.TERM)return 3;if("xterm-ghostty"===m.TERM)return 3;if("wezterm"===m.TERM)return 3;if("TERM_PROGRAM"in m){const e=Number.parseInt((m.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(m.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(m.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(m.TERM)||"COLORTERM"in m?1:i}function v(e,t={}){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(y(e,{streamIsTTY:e&&e.isTTY,...t}))}h("no-color")||h("no-colors")||h("color=false")||h("color=never")?D=0:(h("color")||h("colors")||h("color=true")||h("color=always"))&&(D=1);const F={stdout:v({isTTY:g.isatty(1)}),stderr:v({isTTY:g.isatty(2)})};function b(e,t,o){let n=e.indexOf(t);if(-1===n)return e;const r=t.length;let i=0,s="";do{s+=e.slice(i,n)+t+o,i=n+r,n=e.indexOf(t,i)}while(-1!==n);return s+=e.slice(i),s}const{stdout:_,stderr:C}=F,$=Symbol("GENERATOR"),E=Symbol("STYLER"),w=Symbol("IS_EMPTY"),k=["ansi","ansi","ansi256","ansi16m"],S=Object.create(null);class x{constructor(e){return O(e)}}const O=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const o=_?_.level:0;e.level=void 0===t.level?o:t.level})(t,e),Object.setPrototypeOf(t,A.prototype),t};function A(e){return O(e)}Object.setPrototypeOf(A.prototype,Function.prototype);for(const[e,t]of Object.entries(d))S[e]={get(){const o=T(this,N(t.open,t.close,this[E]),this[w]);return Object.defineProperty(this,e,{value:o}),o}};S.visible={get(){const e=T(this,this[E],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const I=(e,t,o,...n)=>"rgb"===e?"ansi16m"===t?d[o].ansi16m(...n):"ansi256"===t?d[o].ansi256(d.rgbToAnsi256(...n)):d[o].ansi(d.rgbToAnsi(...n)):"hex"===e?I("rgb",t,o,...d.hexToRgb(...n)):d[o][e](...n),j=["rgb","hex","ansi256"];for(const e of j){S[e]={get(){const{level:t}=this;return function(...o){const n=N(I(e,k[t],"color",...o),d.color.close,this[E]);return T(this,n,this[w])}}};S["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...o){const n=N(I(e,k[t],"bgColor",...o),d.bgColor.close,this[E]);return T(this,n,this[w])}}}}const B=Object.defineProperties(()=>{},{...S,level:{enumerable:!0,get(){return this[$].level},set(e){this[$].level=e}}}),N=(e,t,o)=>{let n,r;return void 0===o?(n=e,r=t):(n=o.openAll+e,r=t+o.closeAll),{open:e,close:t,openAll:n,closeAll:r,parent:o}},T=(e,t,o)=>{const n=(...e)=>P(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,B),n[$]=e,n[E]=t,n[w]=o,n},P=(e,t)=>{if(e.level<=0||!t)return e[w]?"":t;let o=e[E];if(void 0===o)return t;const{openAll:n,closeAll:r}=o;if(t.includes(""))for(;void 0!==o;)t=b(t,o.close,o.open),o=o.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,o,n){let r=0,i="";do{const s="\r"===e[n-1];i+=e.slice(r,s?n-1:n)+t+(s?"\r\n":"\n")+o,r=n+1,n=e.indexOf("\n",r)}while(-1!==n);return i+=e.slice(r),i}(t,r,n,i)),n+t+r};Object.defineProperties(A.prototype,S);const M=A(),R=A({level:C?C.level:0}),U=M},92088:(e,t,o)=>{const{InvalidArgumentError:n}=o(43823);t.Option=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;const o=function(e){let t,o;const n=e.split(/[ |,]+/);n.length>1&&!/^[[<]/.test(n[1])&&(t=n.shift());o=n.shift(),!t&&/^-[^-]$/.test(o)&&(t=o,o=void 0);return{shortFlag:t,longFlag:o}}(e);this.short=o.shortFlag,this.long=o.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return"string"==typeof e&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},t.DualOptions=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){const o=t.attributeName();if(!this.dualOptions.has(o))return!0;const n=this.negativeOptions.get(o).presetArg,r=void 0!==n&&n;return t.negate===(r===e)}}},93759:(e,t,o)=>{o.d(t,{E:()=>T});var n,r,i,s,a,l,u,c,d,p=o(68832),f=o(99436),g=o(79896),h=o(35679),m=o(88568),D=o(34992),y=o(88055),v=o(74445),F=o(74752),b=o(63402),_=o(6939),C=(n=f(function*(){return(yield Promise.resolve().then(o.bind(o,29790))).default}),function(){return n.apply(this,arguments)}),$=(r=f(function*(e,t){return e.json?null:(yield C())(t).start()}),function(e,t){return r.apply(this,arguments)}),E=(i=f(function*(){return o.e(637).then(o.bind(o,60637))}),function(){return i.apply(this,arguments)}),w=(s=f(function*(){return o.e(169).then(o.bind(o,98169))}),function(){return s.apply(this,arguments)}),k=(a=f(function*(){return Promise.all([o.e(657),o.e(7),o.e(996)]).then(o.bind(o,7996))}),function(){return a.apply(this,arguments)}),S=(l=f(function*({message:e,autoYes:t,json:o}){if(t)return!0;if(o)throw new Error("Confirmation required: pass -y/--yes together with --json");if(!(0,v.isInteractiveTerminal)())throw new Error("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.");try{var n=(yield E()).confirm;return yield n({message:e,default:!1})}catch{return!1}}),function(e){return l.apply(this,arguments)}),x=({spinner:e,error:t,options:o,action:n,target:r})=>{var i=t.message;i?.includes(b.GE)?i=`${b.GE} Run \`bricks data enable\` first.`:t.isBankAuthError&&(i=`${i}\nThe Data Bank key may be invalid or revoked — run \`bricks data login\` to reissue.`),o.json?(0,D.OW)(i,{action:n,...r&&{target:r}}):e?e.fail(i):console.error(m.default.red(i)),process.exit(1)},O=e=>{try{return JSON.parse(e)}catch{return e}},A=(e,t)=>{try{return JSON.parse(e)}catch{throw new Error(`Invalid JSON for ${t}`)}},I=e=>e.split(",").map(e=>e.trim()).filter(Boolean),j=e=>({name:e.name,meta:e.meta,value:(0,D.$l)(e.value),enableExpired:!!e.enableExpired,expiredAt:e.expiredAt||null,createAt:e.createAt||null,hasReadLimit:!!e.limitedReadProperties?.length,hasWriteLimit:!!e.limitedWriteProperties?.length}),B=(u=f(function*(e){var t=yield e.workspace();return t?.bank||{}}),function(e){return u.apply(this,arguments)}),N=(c=f(function*(e){var t=(yield w()).resolveBankCredentials,o=yield k(),n=o.createBankClient,r=o.resolveBankEndpoint,i=yield t(e);return n({endpoint:r((0,F.getBaseUrl)()),spacename:i.spacename,spacekey:i.spacekey})}),function(e){return c.apply(this,arguments)}),T=new h.uB("data").description("Data Bank (remote properties) management");T.command("status").description("Show Data Bank status for this workspace").option("-j, --json","Output as JSON").action((d=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Fetching Data Bank status...");try{var n=yield B(t),r=(0,F.getBankCredentials)((0,F.getCurrentProfile)()),i={enabled:!!n.enable_remote_update,spacename:n.spacename||null,keys:(n.keys||[]).map(j),cliKey:r?{keyName:r.keyName||null,spacekey:(0,D.$l)(r.spacekey),issuedAt:r.issuedAt||null}:null};if(o&&o.stop(),e.json)return void(0,D.GF)(i);console.log(m.default.bold("\nData Bank")),console.log("─".repeat(60)),console.log(`Enabled: ${i.enabled?m.default.green("Yes"):m.default.red("No")}`),console.log(`Spacename: ${i.spacename||m.default.gray("N/A")}`),console.log(`Keys: ${i.keys.length}`),console.log(`CLI Key: ${i.cliKey?`${i.cliKey.keyName||"Unnamed"} ${m.default.gray(`(${i.cliKey.spacekey})`)}`:m.default.gray("none (issued automatically on first use)")}`),console.log("─".repeat(60)),i.enabled||console.log(m.default.yellow("Run `bricks data enable` to enable Data Bank."))}catch(t){x({spinner:o,error:t,options:e,action:"data.status"})}}),function(e){return d.apply(this,arguments)}));var P,M,R,U=(P=f(function*(e,t){var o=(0,y.requireAuth)(),n=e?"data.enable":"data.disable",r=yield $(t,(e?"Enabling":"Disabling")+" Data Bank...");try{var i=yield o.updateWorkspace({enableBankRemoteUpdate:e}),s=i?.bank||{};r&&r.stop(),(0,_.yd)({action:n,target:{spacename:s.spacename||null},result:{enabled:!!s.enable_remote_update},json:t.json,message:e?`${m.default.green("Data Bank enabled.")} Spacename: ${m.default.cyan(s.spacename)}`:m.default.green("Data Bank disabled.")})}catch(e){x({spinner:r,error:e,options:t,action:n})}}),function(e,t){return P.apply(this,arguments)});T.command("enable").description("Enable Data Bank on this workspace").option("-j, --json","Output as JSON").action(e=>U(!0,e)),T.command("disable").description("Disable Data Bank on this workspace").option("-j, --json","Output as JSON").action(e=>U(!1,e)),T.command("login").description("Issue a Data Bank space key and save it to the active profile").option("--name <keyName>","Space key name","bricks-cli").option("-j, --json","Output as JSON").action((M=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Issuing Data Bank key...");try{var n=(yield w()).issueBankCredentials,r=yield n(t,{keyName:e.name});o&&o.stop(),(0,_.yd)({action:"data.login",target:{spacename:r.spacename},result:{keyName:r.keyName,spacekey:(0,D.$l)(r.spacekey),issuedAt:r.issuedAt},json:e.json,message:`${m.default.green("Data Bank key issued and saved.")} ${m.default.gray(`(${r.keyName}, stored in ${F.CONFIG_PATH})`)}`})}catch(t){x({spinner:o,error:t,options:e,action:"data.login"})}}),function(e){return M.apply(this,arguments)})),T.command("logout").description("Remove the stored Data Bank key from the active profile").option("--revoke","Also revoke the key on the workspace").option("-j, --json","Output as JSON").action((R=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Clearing Data Bank key...");try{var n=(yield w()).clearStoredBankCredentials,r=yield n(t,{revoke:e.revoke}),i=r.cleared,s=r.revoked;o&&o.stop(),(0,_.yd)({action:"data.logout",target:{profile:(0,F.getCurrentProfile)()},result:{cleared:i,revoked:s},json:e.json,message:i?m.default.green(`Data Bank key removed${s?" and revoked":""}.`):m.default.yellow("No Data Bank key stored for this profile.")})}catch(t){x({spinner:o,error:t,options:e,action:"data.logout"})}}),function(e){return R.apply(this,arguments)}));var L,J,q,V,G,W,H,K=new h.uB("keys").description("Data Bank space key management");T.addCommand(K),K.command("list").description("List Data Bank space keys (values are masked; use --json for full values)").option("-j, --json","Output as JSON (includes full key values)").action((L=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Fetching space keys...");try{var n=(yield B(t)).keys||[];if(o&&o.stop(),e.json)return void(0,D.GF)(n);if(0===n.length)return void console.log(m.default.yellow("No space keys found"));console.log(m.default.bold("\nData Bank Space Keys")),console.log("─".repeat(60)),(e=>{e.forEach(e=>{var t=e.enableExpired?`expires ${e.expiredAt}`:"no expiry",o=[e.hasReadLimit&&"read-limited",e.hasWriteLimit&&"write-limited"].filter(Boolean).join(", ");console.log(`● ${m.default.cyan(e.name||"Unnamed")} ${m.default.gray(`(${e.meta})`)}`),console.log(` Value: ${m.default.gray(e.value)}`),console.log(` Expiry: ${m.default.gray(t)}${o?m.default.gray(`, ${o}`):""}`),console.log()})})(n.map(j)),console.log("─".repeat(60))}catch(t){x({spinner:o,error:t,options:e,action:"data.keys.list"})}}),function(e){return L.apply(this,arguments)})),K.command("new <name>").description("Create a new Data Bank space key").option("--expire-at <date>","Expiry time (ISO date, between 1 hour and 90 days from now)").option("--read <propertyIds>","Limit readable properties (comma separated)").option("--write <propertyIds>","Limit writable properties (comma separated)").option("-j, --json","Output as JSON").action((J=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Creating space key...");try{if(t.expireAt&&Number.isNaN(Date.parse(t.expireAt)))throw new Error(`Invalid --expire-at date: ${t.expireAt}`);var r=yield B(o),i=new Set((r.keys||[]).map(e=>e.value)),s=yield o.updateWorkspace({newBankKey:{name:e,enableExpired:!!t.expireAt,expiredAt:t.expireAt,limitedReadProps:t.read?I(t.read):void 0,limitedWriteProps:t.write?I(t.write):void 0}}),a=s?.bank?.keys||[],l=a.find(e=>!i.has(e.value))||a.filter(t=>t.name===e).at(-1);if(!l)throw new Error("Space key was not created");n&&n.stop(),(0,_.yd)({action:"data.keys.new",target:{name:e},result:l,json:t.json,message:m.default.green(`Space key "${e}" created.`)}),t.json||(console.log(m.default.yellow("\n⚠ Copy this key now — it will not be shown again in full:")),console.log(l.value))}catch(o){x({spinner:n,error:o,options:t,action:"data.keys.new",target:{name:e}})}}),function(e,t){return J.apply(this,arguments)})),K.command("revoke <keyOrName>").description("Revoke a Data Bank space key by value or name").option("-y, --yes","Skip confirmation prompt").option("-j, --json","Output as JSON").action((q=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Resolving space key...");try{var r=(yield B(o)).keys||[],i=r.filter(t=>t.value===e);if(0===i.length&&(i=r.filter(t=>t.name===e)),0===i.length)throw new Error(`No space key matched "${e}"`);if(i.length>1)throw new Error(`Multiple space keys named "${e}"; pass the exact key value instead`);var s=p(i,1)[0];if(n&&n.stop(),!(yield S({message:`Revoke space key "${s.name}" (${(0,D.$l)(s.value)})?`,autoYes:t.yes,json:t.json})))return void console.log(m.default.yellow("Cancelled"));yield o.updateWorkspace({revokeBankKey:s.value}),(0,_.yd)({action:"data.keys.revoke",target:{name:s.name,meta:s.meta},result:{revoked:!0},json:t.json,message:m.default.green(`Space key "${s.name}" revoked.`)})}catch(e){x({spinner:n,error:e,options:t,action:"data.keys.revoke"})}}),function(e,t){return q.apply(this,arguments)})),T.command("list").description("List Data Bank properties").option("-k, --keyword <keyword>","Filter by definition title / description or tags").option("-m, --meta <meta>",`Filter by meta (${b.YC.join(" | ")})`).option("-j, --json","Output as JSON").action((V=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Fetching properties...");try{(0,b.jR)(e.meta);var n=yield N(t),r=yield n.listProperties({keyword:e.keyword,meta:e.meta});if(o&&o.stop(),e.json)return void(0,D.GF)(r||[]);if(!r||0===r.length)return void console.log(m.default.yellow("No Data Bank properties found"));console.log(m.default.bold(`\nData Bank Properties (${r.length})`)),console.log("─".repeat(80)),r.forEach(e=>{var t=e.definition?.title;console.log(`● ${m.default.cyan(e.propertyId)} ${m.default.gray(`(${e.meta})`)}${t?` ${t}`:""}`),e.tags?.length&&console.log(` Tags: ${e.tags.join(", ")}`),console.log(` Value: ${(e=>{if(null==e)return m.default.gray("null");var t=JSON.stringify(e);return t.length>60?`${t.slice(0,60)}…`:t})(e.value)}`),console.log(` Updated: ${m.default.gray(e.updateAt)}`),console.log()}),console.log("─".repeat(80))}catch(t){x({spinner:o,error:t,options:e,action:"data.list"})}}),function(e){return V.apply(this,arguments)})),T.command("get <propertyId>").description("Get a Data Bank property").option("-j, --json","Output as JSON").action((G=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Fetching property...");try{var r=yield N(o),i=yield r.getProperty(e);if(!i)throw new Error(`Property not found: ${e}`);if(n&&n.stop(),t.json)return void(0,D.GF)(i);console.log(m.default.bold(`\nData Bank Property: ${i.propertyId}`)),console.log("─".repeat(60)),console.log(`Meta: ${i.meta}`),console.log(`Title: ${i.definition?.title||m.default.gray("N/A")}`),console.log(`Tags: ${i.tags?.join(", ")||m.default.gray("None")}`),console.log(`Last Note: ${i.lastUpdateNote||m.default.gray("N/A")}`),console.log(`Updated: ${m.default.gray(i.updateAt)}`),console.log(`Created: ${m.default.gray(i.createAt)}`),console.log(`\n${m.default.bold("Value")}`),console.log(JSON.stringify(i.value,null,2)),console.log(`\n${m.default.bold("Definition")}`),console.log(JSON.stringify(i.definition,null,2)),console.log("─".repeat(60))}catch(o){x({spinner:n,error:o,options:t,action:"data.get",target:{propertyId:e}})}}),function(e,t){return G.apply(this,arguments)})),T.command("set <propertyId>").description("Create or update a Data Bank property (upsert by default)").option("-v, --value <value>","New value (JSON; falls back to plain string)").option("--value-file <path>","Read the new value from a file (JSON; falls back to raw text)").option("-d, --definition <json>","Replace the property definition (JSON)").option("--definition-file <path>","Read the definition from a JSON file").option("-m, --meta <meta>",`Property meta (${b.YC.join(" | ")}), default InSubspace`).option("-t, --tags <tags>","Replace tags (comma separated)").option("-n, --note <note>","Update note","Updated via bricks-cli").option("--no-upsert","Fail when the property does not exist").option("--no-notify","Do not notify subscribed devices").option("--dry-run","Validate inputs and show the payload without sending it").option("-j, --json","Output as JSON").action((W=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Preparing property update...");try{if(void 0!==t.value&&t.valueFile)throw new Error("Use either --value or --value-file, not both");if(t.definition&&t.definitionFile)throw new Error("Use either --definition or --definition-file, not both");var r;(0,b.jR)(t.meta);var i,s=!0;void 0!==t.value?r=O(t.value):t.valueFile?r=O(g.readFileSync(t.valueFile,"utf8")):s=!1,t.definition?i=A(t.definition,"--definition"):t.definitionFile&&(i=A(g.readFileSync(t.definitionFile,"utf8"),"--definition-file"));var a=yield N(o),l=yield a.getProperty(e);if(!l&&!t.upsert)throw new Error(`Property not found: ${e} (--no-upsert)`);!s&&l&&(r=l.value);var u={propertyId:e,meta:t.meta,definition:i,value:r,updateNote:t.note,upsert:t.upsert,tags:t.tags?I(t.tags):void 0},c=!1===t.notify||void 0,d={propertyId:e,exists:!!l};if(t.dryRun)return n&&n.stop(),void(0,_.S5)({action:"data.set",target:d,request:{...u,dontNotify:c},checks:[(0,_.Iy)("property exists",!!l,l?void 0:"will be created"),(0,_.Iy)("value provided",s,s?void 0:"current value kept")],json:t.json});var f=(yield a.updateProperties([u],c))||[],h=p(f,1)[0];if(!h)throw new Error("Property was not updated");n&&n.stop(),(0,_.yd)({action:"data.set",target:d,result:h,json:t.json,message:`${m.default.green(l?"Property updated:":"Property created:")} ${h.propertyId}`})}catch(o){x({spinner:n,error:o,options:t,action:"data.set",target:{propertyId:e}})}}),function(e,t){return W.apply(this,arguments)})),T.command("remove <propertyId>").description("Remove a Data Bank property").option("-y, --yes","Skip confirmation prompt").option("--dry-run","Validate inputs and show the removal plan without sending it").option("-j, --json","Output as JSON").action((H=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Fetching property...");try{var r=yield N(o),i=yield r.getProperty(e);if(!i)throw new Error(`Property not found: ${e}`);n&&n.stop();var s={propertyId:e,title:i.definition?.title};if(t.dryRun)return void(0,_.S5)({action:"data.remove",target:s,request:{propertyId:e},checks:[(0,_.Iy)("property exists",!0)],json:t.json});if(!(yield S({message:`Remove Data Bank property "${e}"? This cannot be undone.`,autoYes:t.yes,json:t.json})))return void console.log(m.default.yellow("Cancelled"));if(!(yield r.removeProperty(e)))throw new Error("Property was not removed");(0,_.yd)({action:"data.remove",target:s,result:{removed:!0},json:t.json,message:m.default.green(`Property removed: ${e}`)})}catch(o){x({spinner:n,error:o,options:t,action:"data.remove",target:{propertyId:e}})}}),function(e,t){return H.apply(this,arguments)}))},96525:e=>{e.exports=function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,r,i,s,a=[],l=!0,u=!1;try{if(i=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;l=!1}else for(;!(l=(n=i.call(o)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{if(!l&&null!=o.return&&(s=o.return(),Object(s)!==s))return}finally{if(u)throw r}}return a}},e.exports.__esModule=!0,e.exports.default=e.exports},96684:(e,t,o)=>{o.d(t,{Q:()=>O});var n,r,i,s,a,l,u=o(99436),c=o(35679),d=o(88568),p=o(77598),f=o(48161),g=o(76760),h=o(51455),m=o(27549),D=o(41314),y=8089,v=({timeout:e=3e3,idleTimeout:t=0,port:o=8089}={})=>new Promise((n,r)=>{var i=new Map,s=D.createSocket("udp4"),a=null,l=null,u=!1,c=()=>{if(!u){u=!0,clearTimeout(a),clearTimeout(l);try{s.close()}catch{}n([...i.values()])}};s.on("error",e=>{if(!u){u=!0,clearTimeout(a),clearTimeout(l);try{s.close()}catch{}r(e)}}),s.on("message",(e,o)=>{try{var n=JSON.parse(e.toString());if("2.0"!==n.v)return;if("ANNOUNCE"!==n.t&&"RESPONSE"!==n.t)return;var r=n.d?.info;if(!r)return;var s={...r,address:o.address},a=s.id||`${o.address}:${s.port}`;i.has(a)||(i.set(a,s),t&&!u&&(clearTimeout(l),l=setTimeout(c,t)))}catch{}}),s.bind(()=>{s.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"2.0",d:{id:`cli-${Math.random().toString(36).slice(2,9)}`}}));for(var n of(()=>{var e=new Set(["255.255.255.255","127.0.0.1"]),t=f.networkInterfaces();for(var o of Object.values(t)){var n=function(){if("IPv4"!==r.family||r.internal)return 1;var t=r.address.split(".").map(Number),o=r.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~o[t]).toString()).join(".");e.add(n)};for(var r of o)n()}return[...e]})())s.send(t,0,t.length,o,n);a=setTimeout(c,e)})}),F=(n=u(function*(e,t,o=3e3){var n;try{var r=new AbortController;n=setTimeout(()=>r.abort(),o);var i=yield fetch(`http://${e}:${t}/buttress/info`,{signal:r.signal});return i.ok?yield i.json():null}catch{return null}finally{void 0!==n&&clearTimeout(n)}}),function(e,t){return n.apply(this,arguments)}),b=g.join(f.homedir(),".bricks-cli","buttress"),_=e=>e||b,C=e=>g.join(_(e),"state.json"),$=()=>{try{return`buttress-${m.machineIdSync()}`}catch{return null}},E=function(){var e=u(function*(e){var t=C(e);try{var o=yield h.readFile(t,"utf8");return JSON.parse(o)}catch(e){if("ENOENT"===e.code)return null;throw e}});return function(t){return e.apply(this,arguments)}}(),w=(r=u(function*(e,t){var o=_(t),n=C(t);yield h.mkdir(o,{recursive:!0});var r=`${n}.tmp-${process.pid}`;return yield h.writeFile(r,JSON.stringify(e,null,2),"utf8"),yield h.rename(r,n),n}),function(e,t){return r.apply(this,arguments)}),k=(i=u(function*(e){var t=C(e);try{return yield h.unlink(t),!0}catch(e){if("ENOENT"===e.code)return!1;throw e}}),function(e){return i.apply(this,arguments)}),S=(s=u(function*({timeout:e=3e3,verify:t=!0,port:o=8089,onStatus:n}={}){n?.(`Scanning UDP ${o} for ${e}ms...`);var r=yield v({timeout:e,port:o});if(0===r.length)return[];if(!t)return r;n?.(`Verifying ${r.length} server(s)...`);var i,s=yield Promise.all(r.map((i=u(function*(e){var t=yield F(e.address,e.port,2e3);return t?{...e,...t,address:e.address,verified:!0}:{...e,verified:!1}}),function(e){return i.apply(this,arguments)})));return s}),function(){return s.apply(this,arguments)}),x=function(){var e=u(function*(){var e=yield Promise.resolve().then(o.bind(o,74752)),t=e.getToken,n=e.getBaseUrl,r=e.getCurrentProfile,i=(yield Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(700)]).then(o.bind(o,50700))).createClient,s=t(r());return s||(console.error(d.default.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),i(n(),s)});return function(){return e.apply(this,arguments)}}(),O=new c.uB("buttress").description("Pair and inspect buttress-server bindings for the current workspace").alias("butr");O.command("bind").description("Pair a local buttress-server with the current workspace").option("-s, --server-id <id>","Buttress server id (auto-detected from machine id by default)").option("-n, --name <name>","Friendly name for this buttress server").option("--state-dir <dir>","Override the buttress state directory (defaults to ~/.bricks-cli/buttress)").option("--print","Print state.json to stdout instead of writing to disk (useful for remote setups)").action(function(){var e=u(function*(e){var t=(yield Promise.resolve().then(o.bind(o,29790))).default,n=e.serverId||$();n||(console.error(d.default.red("Could not detect a local server id. Pass --server-id <id> explicitly.")),process.exit(1));var r,i,s,a,l,u,c=(r=p.generateKeyPairSync("ed25519"),i=r.publicKey,s=r.privateKey,a=i.export({type:"spki",format:"der"}),l=s.export({type:"pkcs8",format:"der"}),u=p.createHash("sha256").update(a).digest("hex").slice(0,16),{publicKeySpki:a.toString("base64"),privateKeyPkcs8:l.toString("base64"),kid:u}),f=yield x(),g=t(`Binding buttress server ${d.default.cyan(n)}...`).start();try{var h=yield f.bindButtressServer({serverId:n,name:e.name,serverPublicKey:{spkiBase64:c.publicKeySpki,kid:c.kid}});g.stop();var m={workspace:{id:h.workspaceId,name:h.workspaceName,serverId:h.serverId,issuerPublicKey:h.issuerPublicKey.pem,kid:h.issuerPublicKey.kid,boundAt:(new Date).toISOString()},serverKeyPair:c};if(e.print)return console.warn(d.default.yellow("⚠ Output contains the server announce private key. Treat as a secret.")),void process.stdout.write(`${JSON.stringify(m,null,2)}\n`);var D=yield w(m,e.stateDir);console.log(d.default.green("✓"),"Buttress server bound to workspace."),console.log(` Workspace: ${d.default.bold(h.workspaceName)} (${h.workspaceId})`),console.log(` Server id: ${d.default.cyan(h.serverId)}`),console.log(` Issuer kid: ${d.default.gray(h.issuerPublicKey.kid)}`),console.log(` Announce kid: ${d.default.gray(c.kid)}`),console.log(` State file: ${d.default.gray(D)}`),console.log(),console.log(d.default.yellow("Restart buttress-server for the binding to take effect."))}catch(e){g.fail(`Bind failed: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),O.command("unbind").description("Unbind a buttress server from this workspace").option("-s, --server-id <id>","Buttress server id (auto-detected by default)").option("--state-dir <dir>","Override the buttress state directory").option("--keep-local","Do not remove the local state.json file").action(function(){var e=u(function*(e){var t=e.serverId||$();t||(console.error(d.default.red("Could not detect a local server id. Pass --server-id explicitly.")),process.exit(1));var o=yield x();try{if((yield o.unbindButtressServer({serverId:t}))?console.log(d.default.green("✓"),`Unbound ${d.default.cyan(t)} from workspace.`):console.log(d.default.yellow("!"),`${d.default.cyan(t)} was not bound to this workspace.`),!e.keepLocal){var n=C(e.stateDir),r=yield E(e.stateDir);r?.workspace?.serverId===t&&(yield k(e.stateDir),console.log(d.default.gray(`Removed local state file: ${n}`)))}}catch(e){console.error(d.default.red(`Unbind failed: ${e.message}`)),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),O.command("status").description("Show local buttress binding state and the workspace-side bound list").option("--state-dir <dir>","Override the buttress state directory").option("-j, --json","Output as JSON").action(function(){var e=u(function*(e){var t=yield E(e.stateDir),o=null;try{var n=yield x();o=yield n.buttressServers()}catch(e){o={error:e.message}}e.json?console.log(JSON.stringify({local:t,remote:o},null,2)):(console.log(d.default.bold("\nLocal buttress state")),console.log("─".repeat(60)),t?.workspace?(console.log(` Workspace: ${d.default.bold(t.workspace.name)} (${t.workspace.id})`),console.log(` Server id: ${d.default.cyan(t.workspace.serverId)}`),console.log(` Issuer kid: ${d.default.gray(t.workspace.kid)}`),console.log(` Bound at: ${d.default.gray(t.workspace.boundAt)}`),console.log(` File: ${d.default.gray(C(e.stateDir))}`)):console.log(d.default.gray(" not bound (no state.json found)")),console.log(d.default.bold("\nWorkspace-side bound servers")),console.log("─".repeat(60)),Array.isArray(o)?0===o.length?console.log(d.default.gray(" none")):o.forEach(e=>{console.log(` ${d.default.cyan(e.serverId)} ${d.default.gray(e.name||"")} ${d.default.gray(e.boundAt||"")}`)}):o?.error&&console.log(d.default.red(` failed to fetch: ${o.error}`)))});return function(t){return e.apply(this,arguments)}}()),O.command("issue-token").description("Issue a long-lived workspace-scoped buttress access token (CLI/CTOR usage)").option("--ttl <seconds>","Time-to-live in seconds (default 30 days)",e=>parseInt(e,10)).option("-j, --json","Output as JSON").action((a=u(function*(e){var t=yield x();try{var o=yield t.issueButtressAccessToken({ttlSeconds:e.ttl});if(e.json)return void console.log(JSON.stringify(o,null,2));console.log(d.default.green("✓"),"Buttress access token issued."),console.log(` Workspace: ${o.workspaceId}`),console.log(` Expires: ${o.expiresAt}`),console.log(` jti: ${d.default.gray(o.jti)}`),console.log(),console.log(d.default.cyan(o.token))}catch(e){console.error(d.default.red(`Issue token failed: ${e.message}`)),process.exit(1)}}),function(e){return a.apply(this,arguments)})),O.command("scan").description("Scan LAN for buttress-servers via UDP and verify each via /buttress/info").option("-t, --timeout <ms>","Scan timeout in milliseconds","3000").option("-p, --port <port>","UDP discovery port",String(y)).option("--udp-only","Skip HTTP /buttress/info verification").option("-j, --json","Output as JSON").action((l=u(function*(e){var t=(yield Promise.resolve().then(o.bind(o,29790))).default,n=yield Promise.resolve().then(o.bind(o,74752)),r=n.getCurrentProfile,i=n.getTokenInfo,s=parseInt(e.timeout,10),a=parseInt(e.port,10),l=[],u=t(`Scanning for buttress-servers (${s}ms)...`).start();try{l=yield S({timeout:s,port:a,verify:!e.udpOnly,onStatus:e=>{u.text=e}}),u.stop()}catch(e){u.fail(`Scan failed: ${e.message}`),process.exit(1)}var c=r(),p=i(c)?.workspaceId||null;if(e.json)console.log(JSON.stringify({servers:l,workspaceId:p},null,2));else if(0!==l.length){for(var f of(console.log(d.default.bold(`\nFound ${l.length} buttress-server(s)`)),console.log("─".repeat(70)),l)){var g=!1===f.verified?d.default.red("unverified"):d.default.green("online"),h=f.workspace?.id,m=h&&p&&h===p,D=f.authentication?.bound?d.default.yellow("JWT required"):d.default.gray("open");console.log(` ${d.default.bold(f.name||"Unknown")} ${d.default.gray(`(${f.address}:${f.port})`)} [${g}]`),f.id&&console.log(` Server id: ${d.default.cyan(f.id)}`),f.version&&console.log(` Version: ${d.default.green(f.version)}`);var y=f.authentication?.kid?d.default.gray(` (kid: ${f.authentication.kid})`):"";if(console.log(` Auth: ${D}${y}`),h){var v=m?d.default.green(`${h} ${d.default.bold("(current profile)")}`):d.default.gray(h);console.log(` Workspace: ${v}`)}if(Array.isArray(f.generators)&&f.generators.length>0)for(var F of(console.log(" Generators:"),f.generators)){var b=[];"number"==typeof F.score&&b.push(`score ${F.score.toFixed(1)}`),!0===F.hasGpu?b.push("GPU ✓"):!1===F.hasGpu&&b.push("GPU ✗"),"number"==typeof F.usableBytes&&b.push(`${(F.usableBytes/1024**3).toFixed(1)} GB usable`);var _=b.length>0?` ${d.default.gray(b.join(" "))}`:"";console.log(` - ${d.default.cyan(F.type)}${_}`)}}console.log("─".repeat(70)),l.some(e=>e.authentication?.bound)&&(console.log(),console.log(d.default.gray("To connect to a bound server, run `bricks buttress issue-token` for a workspace access token.")))}else console.log(d.default.yellow("No buttress-servers found on the LAN."))}),function(e){return l.apply(this,arguments)}))},96739:(e,t,o)=>{o.d(t,{u:()=>D});var n,r,i,s,a,l,u,c=o(68832),d=o(99436),p=o(35679),f=()=>(n||(n=Promise.all([Promise.resolve().then(o.bind(o,88568)),Promise.resolve().then(o.bind(o,29790)),Promise.resolve().then(o.bind(o,88055)),Promise.all([o.e(657),o.e(336)]).then(o.bind(o,47336))]).then(([e,t,o,n])=>({chalk:e.default,ora:t.default,requireAuth:o.requireAuth,isMediaEnabled:n.isMediaEnabled,buildScreenshotUrl:n.buildScreenshotUrl}))),n),g=(i=d(function*(e,t){var o=yield e.workspace();if(!t.isMediaEnabled(o))throw new Error("Media workspace not enabled for this workspace")}),function(e,t){return i.apply(this,arguments)}),h=e=>{var t=e.meta||{};if(!t.originalFileUploaded)return{ready:!1,label:"Uploading"};if("Video"===e.fileType){if(!t.videoThumbOriginalFileKey)return{ready:!1,label:"Processing"};if(!t.convertedFileUploaded)return{ready:!1,label:"Transcoding"}}return{ready:!0,label:"Ready"}},m=(e,t)=>e.ready?t.green(e.label):t.yellow(e.label),D=new p.uB("media").description("Media Flow support");D.command("boxes").description("List Media Flow boxes").option("-j, --json","Output as JSON").action((s=d(function*(e){var t=yield f(),o=t.chalk,n=t.requireAuth(),r=t.ora("Fetching media boxes...").start();try{yield g(n,t);var i=yield n.mediaBoxes();if(r.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(o.yellow("No media boxes found"));console.log(o.bold("\nMedia Boxes")),console.log("─".repeat(80)),i.forEach(e=>{console.log(`${o.cyan(e.name||"Unnamed")} ${o.gray(e.id)}`),e.description&&console.log(` ${e.description}`),e.tags?.length&&console.log(` Tags: ${e.tags.join(", ")}`),null!=e.size&&console.log(` Size: ${e.size}`),console.log()})}catch(e){r.fail(`Failed to list media boxes: ${e.message}`),process.exit(1)}}),function(e){return s.apply(this,arguments)})),D.command("box <id>").description("Get Media Flow box details").option("-j, --json","Output as JSON").action((a=d(function*(e,t){var o=yield f(),n=o.chalk,r=o.requireAuth(),i=o.ora("Fetching media box...").start();try{yield g(r,o);var s=yield r.mediaBox({id:e});if(i.stop(),s||(console.log(n.red("Media box not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(s,null,2));console.log(n.bold(`\nMedia Box: ${s.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`ID: ${n.gray(s.id)}`),console.log(`Description: ${s.description||n.gray("N/A")}`),console.log(`Tags: ${s.tags?.join(", ")||n.gray("None")}`),null!=s.size&&console.log(`Size: ${s.size}`),s.passcodes?.length&&(console.log(`\n${n.bold("Passcodes")}`),s.passcodes.forEach(e=>{console.log(`- ${e.name||"Passcode"}: ${e.code}`)})),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get media box: ${e.message}`),process.exit(1)}}),function(e,t){return a.apply(this,arguments)})),D.command("files <boxId>").description("List Media Flow files in a box").option("-t, --types <types>","Comma-separated file types to include").option("-u, --user-tag <tag>","Filter by user tag (repeatable)",(e,t)=>[...t,e],[]).option("-l, --limit <limit>","Limit results",e=>Number.parseInt(e,10)).option("-o, --offset <offset>","Offset results",e=>Number.parseInt(e,10)).option("-j, --json","Output as JSON").action((l=d(function*(e,t){var o=yield f(),n=o.chalk,r=o.requireAuth(),i=o.ora("Fetching media files...").start();try{yield g(r,o);var s=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):void 0,a=t.userTag?.length?t.userTag:void 0,l=yield r.mediaFiles({boxId:e,includeTypes:s,userTags:a,limit:t.limit,offset:t.offset});if(i.stop(),t.json)return void console.log(JSON.stringify(l,null,2));if(!l||0===l.length)return void console.log(n.yellow("No media files found"));console.log(n.bold(`\nMedia Files (${l.length})`)),console.log("─".repeat(100)),l.forEach(e=>{var t=h(e);console.log(`${n.cyan(e.name||"Unnamed")} ${n.gray(e.id)}`),console.log(` Type: ${e.fileType} Status: ${m(t,n)}`),e.userTags?.length&&console.log(` Tags: ${e.userTags.join(", ")}`),e.updatedAt&&console.log(` Updated: ${new Date(e.updatedAt).toLocaleString()}`),console.log()})}catch(e){i.fail(`Failed to list media files: ${e.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),D.command("file <id>").description("Get Media Flow file details").option("-j, --json","Output as JSON").action((u=d(function*(e,t){var o=yield f(),n=o.chalk,r=o.requireAuth(),i=o.ora("Fetching media file...").start();try{yield g(r,o);var s=yield r.mediaFile({id:e});if(i.stop(),s||(console.log(n.red("Media file not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(s,null,2));var a=h(s);console.log(n.bold(`\nMedia File: ${s.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`ID: ${n.gray(s.id)}`),console.log(`Box ID: ${n.gray(s.boxId)}`),console.log(`Type: ${s.fileType}`),console.log(`Status: ${m(a,n)}`),console.log(`Description: ${s.description||n.gray("N/A")}`),console.log(`Tags: ${s.userTags?.join(", ")||n.gray("None")}`),console.log(`Created: ${n.gray(s.createdAt||"N/A")}`),console.log(`Updated: ${n.gray(s.updatedAt||"N/A")}`);var l=o.buildScreenshotUrl(s),u=o.buildScreenshotUrl(s,{preferThumbnail:!0});s.meta?.originalFileKey&&console.log(`Original Key: ${n.gray(s.meta.originalFileKey)}`),l&&console.log(`Original URL: ${n.gray(l)}`),u&&u!==l&&console.log(`Thumbnail URL: ${n.gray(u)}`),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get media file: ${e.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)}));var y,v,F=e=>{var t=e.match(/^(\d+)x(\d+)(?::(\w+))?$/);if(!t)throw new Error(`Invalid image version spec: "${e}". Expected format: WxH or WxH:STRATEGY`);return{width:parseInt(t[1],10),height:parseInt(t[2],10),strategy:(t[3]||"FILL").toUpperCase(),copypreview:!1}},b=(y=d(function*(e,t,o,n,r){var i=new FormData;for(var s of Object.entries(t)){var a=c(s,2),l=a[0],u=a[1];i.append(l,u)}i.append("file",new Blob([o],{type:r}),n);var d=yield fetch(e,{method:"POST",body:i});if(!d.ok&&204!==d.status){var p=yield d.text().catch(()=>"");throw new Error(`S3 upload failed (${d.status}): ${p}`)}}),function(e,t,o,n,r){return y.apply(this,arguments)});D.command("upload <boxId> <files...>").description("Upload file(s) to a Media Flow box").option("-d, --description <text>","File description","").option("-t, --user-tag <tag>","User tag (repeatable, max 15)",(e,t)=>[...t,e],[]).option("--image-version <spec>","Image resize spec as WxH or WxH:STRATEGY (repeatable)",(e,t)=>[...t,e],[]).option("--image-version-type <type>","Image output format: jpg or png").option("--enable-ai-analysis","Enable AI analysis on uploaded files").option("--ai-instruction <text>","Custom AI analysis instruction").option("--concurrency <n>","Max concurrent uploads",e=>parseInt(e,10),3).option("-j, --json","Output as JSON").action((v=d(function*(e,t,n){var i,s,a=yield f(),l=yield(r||(r=Promise.all([Promise.resolve().then(o.t.bind(o,51455,19)),Promise.resolve().then(o.t.bind(o,76760,19)),o.e(90).then(o.t.bind(o,86090,19)),o.e(209).then(o.bind(o,56209))]).then(([e,t,o,n])=>({readFile:e.readFile,stat:e.stat,basename:t.basename,resolve:t.resolve,lookup:o.lookup,runWithConcurrency:n.runWithConcurrency}))),r),u=a.chalk,c=a.requireAuth(),p=a.ora("Preparing upload...").start();try{if(yield g(c,a),n.userTag.length>15)throw new Error("Maximum 15 user tags allowed");var h=n.imageVersion.map(F),m=n.enableAiAnalysis||!!n.aiInstruction,D=yield Promise.all(t.map((s=d(function*(e){var t=l.resolve(e),o=yield l.stat(t).catch(()=>null);if(!o||!o.isFile())throw new Error(`Not a file: ${e}`);var n=l.basename(t);return{filePath:t,fileName:n,contentType:l.lookup(n)||"application/octet-stream",size:o.size}}),function(e){return s.apply(this,arguments)})));p.stop();var y=D.length;console.log(u.bold(`\nUploading ${y} file${y>1?"s":""} to box ${u.gray(e)}...\n`));var v=[];yield l.runWithConcurrency(D,n.concurrency,(i=d(function*(t,o){var r,i,s=`[${o+1}/${y}] ${t.fileName}`,d=a.ora(`${s} — requesting upload...`).start();try{var p=(i=t.contentType)?"image/svg+xml"===i?"FILE":i.startsWith("image/")?"IMAGE":i.startsWith("video/")?"VIDEO":i.startsWith("audio/")?"AUDIO":"FILE":"FILE",f={imageVersions:"IMAGE"===p?h:[],imageVersionType:"IMAGE"===p?n.imageVersionType:void 0,enableAiAnalysis:m,aiCustomInstruction:n.aiInstruction||void 0},g=yield c.createMediaFileUploadRequest({name:t.fileName,description:n.description,boxId:e,fileType:p,contentType:t.contentType,userTags:n.userTag.length?n.userTag:[],meta:f});d.text=`${s} — uploading to storage...`;var D=JSON.parse(g.meta.uploadInfo),F=yield l.readFile(t.filePath);yield b(D.url,{AWSAccessKeyId:D.AWSAccessKeyId,"Content-Type":D["Content-Type"],key:D.key,Signature:D.Signature,Policy:D.Policy,acl:D.acl},F,t.fileName,t.contentType),d.succeed(`${s} ${u.green("✓")} ${u.gray(`(${p}, ${r=t.size,r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:r<1073741824?`${(r/1048576).toFixed(1)} MB`:`${(r/1073741824).toFixed(1)} GB`})`)}`),v.push({file:t.fileName,id:g.id,status:"success",fileType:p,size:t.size})}catch(e){d.fail(`${s} — ${e.message}`),v.push({file:t.fileName,id:null,status:"failed",error:e.message})}}),function(e,t){return i.apply(this,arguments)}));var _=v.filter(e=>"success"===e.status).length,C=v.filter(e=>"failed"===e.status).length;n.json?console.log(JSON.stringify({boxId:e,results:v,summary:{total:y,success:_,failed:C}},null,2)):(console.log(),0===C?console.log(u.green(`Uploaded ${_}/${y} files`)):console.log(u.yellow(`Uploaded ${_}/${y} files (${C} failed)`))),C>0&&process.exit(1)}catch(e){p.fail(`Upload failed: ${e.message}`),process.exit(1)}}),function(e,t,o){return v.apply(this,arguments)}))},99436:e=>{function t(e,t,o,n,r,i,s){try{var a=e[i](s),l=a.value}catch(e){return void o(e)}a.done?t(l):Promise.resolve(l).then(n,r)}e.exports=function(e){return function(){var o=this,n=arguments;return new Promise(function(r,i){var s=e.apply(o,n);function a(e){t(s,r,i,a,l,"next",e)}function l(e){t(s,r,i,a,l,"throw",e)}a(void 0)})}},e.exports.__esModule=!0,e.exports.default=e.exports},99456:(e,t,o)=>{o.d(t,{l:()=>a});var n=o(99436),r=o(35679),i=o(34992),s=()=>Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(700),o.e(627)]).then(o.bind(o,33627)),a=(({loadDoctorModule:e=s}={})=>{return new r.uB("doctor").description("Check CLI configuration, auth state, and workspace reachability").option("-j, --json","Output as JSON").action((t=n(function*(t){try{var o=yield e(),n=o.buildDoctorReport,r=o.renderDoctorReport,s=yield n();if(t.json)return void(0,i.GF)(s);console.log(r(s))}catch(e){t.json?(0,i.OW)(e.message):console.error(`Doctor failed: ${e.message}`),process.exit(1)}}),function(e){return t.apply(this,arguments)}));var t})()},99690:(e,t,o)=>{const{humanReadableArgName:n}=o(41762);t.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){const t=e.commands.filter(e=>!e._hidden),o=e._getHelpCommand();return o&&!o._hidden&&t.push(o),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){const o=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return o(e).localeCompare(o(t))}visibleOptions(e){const t=e.options.filter(e=>!e.hidden),o=e._getHelpOption();if(o&&!o.hidden){const n=o.short&&e._findOption(o.short),r=o.long&&e._findOption(o.long);n||r?o.long&&!r?t.push(e.createOption(o.long,o.description)):o.short&&!n&&t.push(e.createOption(o.short,o.description)):t.push(o)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let o=e.parent;o;o=o.parent){const e=o.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){const t=e.registeredArguments.map(e=>n(e)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,o)=>Math.max(e,t.subcommandTerm(o).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,o)=>Math.max(e,t.optionTerm(o).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,o)=>Math.max(e,t.optionTerm(o).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,o)=>Math.max(e,t.argumentTerm(o).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let o="";for(let t=e.parent;t;t=t.parent)o=t.name()+" "+o;return o+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue){(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}return void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){const o=`(${t.join(", ")})`;return e.description?`${e.description} ${o}`:o}return e.description}formatHelp(e,t){const o=t.padWidth(e,t),n=t.helpWidth||80;function r(e,r){if(r){const i=`${e.padEnd(o+2)}${r}`;return t.wrap(i,n-2,o+2)}return e}function i(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let s=[`Usage: ${t.commandUsage(e)}`,""];const a=t.commandDescription(e);a.length>0&&(s=s.concat([t.wrap(a,n,0),""]));const l=t.visibleArguments(e).map(e=>r(t.argumentTerm(e),t.argumentDescription(e)));l.length>0&&(s=s.concat(["Arguments:",i(l),""]));const u=t.visibleOptions(e).map(e=>r(t.optionTerm(e),t.optionDescription(e)));if(u.length>0&&(s=s.concat(["Options:",i(u),""])),this.showGlobalOptions){const o=t.visibleGlobalOptions(e).map(e=>r(t.optionTerm(e),t.optionDescription(e)));o.length>0&&(s=s.concat(["Global Options:",i(o),""]))}const c=t.visibleCommands(e).map(e=>r(t.subcommandTerm(e),t.subcommandDescription(e)));return c.length>0&&(s=s.concat(["Commands:",i(c),""])),s.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,o,n=40){const r=new RegExp("[\\n][ \\f\\t\\v - \ufeff]+");if(e.match(r))return e;const i=t-o;if(i<n)return e;const s=e.slice(0,o),a=e.slice(o).replace("\r\n","\n"),l=" ".repeat(o),u="\\s",c=new RegExp(`\n|.{1,${i-1}}([${u}]|$)|[^${u}]+?([${u}]|$)`,"g");return s+(a.match(c)||[]).map((e,t)=>"\n"===e?"":(t>0?l:"")+e.trimEnd()).join("\n")}}}},D={};function y(e){var t=D[e];if(void 0!==t)return t.exports;var o=D[e]={id:e,loaded:!1,exports:{}};return m[e].call(o.exports,o,o.exports,y),o.loaded=!0,o.exports}y.m=m,a="function"==typeof Symbol,l=a?Symbol("webpack queues"):"__webpack_queues__",u=a?Symbol("webpack exports"):"__webpack_exports__",c=a?Symbol("webpack error"):"__webpack_error__",d=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},y.a=(e,t,o)=>{var n;o&&((n=[]).d=-1);var r,i,s,a=new Set,p=e.exports,f=new Promise((e,t)=>{s=t,i=e});f[u]=p,f[l]=e=>(n&&e(n),a.forEach(e),f.catch(e=>{})),e.exports=f,t(e=>{var t;r=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[l])return e;if(e.then){var t=[];t.d=0,e.then(e=>{o[u]=e,d(t)},e=>{o[c]=e,d(t)});var o={};return o[l]=e=>e(t),o}}var n={};return n[l]=e=>{},n[u]=e,n}))(e);var o=()=>r.map(e=>{if(e[c])throw e[c];return e[u]}),i=new Promise(e=>{(t=()=>e(o)).r=0;var i=e=>e!==n&&!a.has(e)&&(a.add(e),e&&!e.d&&(t.r++,e.push(t)));r.map(e=>e[l](i))});return t.r?i:o()},e=>(e?s(f[c]=e):i(p),d(n))),n&&n.d<0&&(n.d=0)},y.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return y.d(t,{a:t}),t},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,y.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var o=Object.create(null);y.r(o);var n={};p=p||[null,f({}),f([]),f(f)];for(var r=2&t&&e;("object"==typeof r||"function"==typeof r)&&!~p.indexOf(r);r=f(r))Object.getOwnPropertyNames(r).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,y.d(o,n),o},y.d=(e,t)=>{for(var o in t)y.o(t,o)&&!y.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},y.f={},y.e=e=>Promise.all(Object.keys(y.f).reduce((t,o)=>(y.f[o](e,t),t),[])),y.u=e=>e+".js",y.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),y.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),g={57:0},h=e=>{var t,o,{__webpack_esm_ids__:n,__webpack_esm_modules__:r,__webpack_esm_runtime__:i}=e,s=0;for(t in r)y.o(r,t)&&(y.m[t]=r[t]);for(i&&i(y);s<n.length;s++)o=n[s],y.o(g,o)&&g[o]&&g[o][0](),g[n[s]]=0},y.f.j=(e,t)=>{var o=y.o(g,e)?g[e]:void 0;if(0!==o)if(o)t.push(o[1]);else{var n=import("./"+y.u(e)).then(h,t=>{throw 0!==g[e]&&(g[e]=void 0),t});n=Promise.race([n,new Promise(t=>o=g[e]=[t])]),t.push(o[1]=n)}};var v=y(444);const F=(v=await v).A,b=v.e;export{F as default,b as run};
|
|
1
|
+
import{createRequire as e}from"node:module";const t=e(import.meta.url);import*as o from"ink";import*as n from"ink-picture";import*as r from"react";import*as i from"react/jsx-runtime";import{default as s}from"conf";var a,l,u,c,d,p,f,g,h,m={444:(e,t,o)=>{o.a(e,async(e,n)=>{try{o.d(t,{A:()=>S,e:()=>w});var r=o(99436),i=o(35679),s=o(88568),a=o(74752),l=o(74445),u=o(73087),c=o(81637),d=o(69504),p=o(64447),f=o(34528),g=o(96739),h=o(93759),m=o(7089),D=o(25811),y=o(59726),v=o(14778),F=o(61685),b=o(99456),_=o(63465),C=o(96684),$=e([v]),E=$.then?(await $)():$;v=E[0];var w=(k=r(function*(){var e,t=process.argv.findIndex(e=>"--auth-profile"===e||"-ap"===e);-1!==t&&process.argv[t+1]&&((0,a.setProfileOverride)(process.argv[t+1]),process.argv.splice(t,2)),i.DM.name("bricks").description("BRICKS CLI - Command-line interface for BRICKS Workspace API").version("2.24.13","-v, --version","output the version number").enablePositionalOptions(),i.DM.addCommand(u.s),i.DM.addCommand(c._),i.DM.addCommand(d.B),i.DM.addCommand(p.A),i.DM.addCommand(f.p),i.DM.addCommand(g.u),i.DM.addCommand(h.E),i.DM.addCommand(m.oT),i.DM.addCommand(D.K),i.DM.addCommand(y.gf),i.DM.addCommand(v.D),i.DM.addCommand(F.v),i.DM.addCommand(b.l),i.DM.addCommand(_.D),i.DM.addCommand(C.Q),i.DM.command("interactive").alias("i").description("Start interactive mode with Ink UI").action(r(function*(){try{var e=(yield Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(632),o.e(700),o.e(779)]).then(o.bind(o,18779))).runInteractiveMode;yield e()}catch(e){console.error(s.default.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}})),i.DM.command("workspace").alias("ws").description("Show current workspace information").option("-j, --json","Output as JSON").action((e=r(function*(e){var t=yield Promise.resolve().then(o.bind(o,74752)),n=t.getToken,r=t.getBaseUrl,i=t.getCurrentProfile,a=(yield Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(700)]).then(o.bind(o,50700))).createClient,l=(yield Promise.resolve().then(o.bind(o,29790))).default,u=n(i());u||(console.error(s.default.red("Not logged in. Use `bricks auth login` first.")),process.exit(1));var c=l("Fetching workspace info...").start();try{var d=a(r(),u),p=yield d.workspace();if(c.stop(),e.json)return void console.log(JSON.stringify(p,null,2));console.log(s.default.bold("\nWorkspace Information")),console.log("─".repeat(60)),console.log(`Name: ${s.default.green(p.name)}`),console.log(`ID: ${s.default.gray(p._id)}`),console.log(`Description: ${p.description||s.default.gray("N/A")}`),console.log(`\n${s.default.bold("Data")}`),console.log(`Remote Update: ${p.bank?.enable_remote_update?s.default.green("Enabled"):s.default.gray("Disabled")}`),console.log(`Spacename: ${p.bank?.spacename||s.default.gray("N/A")}`),console.log("─".repeat(60))}catch(e){c.fail(`Failed to get workspace: ${e.message}`),process.exit(1)}}),function(t){return e.apply(this,arguments)})),i.DM.on("--help",()=>{console.log(""),console.log(s.default.bold("Examples:")),console.log(""),console.log(s.default.gray(" # Login with a one-time passcode (recommended)")),console.log(" $ bricks auth login <passcode>"),console.log(""),console.log(s.default.gray(" # List all devices")),console.log(" $ bricks device list"),console.log(""),console.log(s.default.gray(" # Monitor devices in real-time")),console.log(" $ bricks device monitor"),console.log(""),console.log(s.default.gray(" # Control a device")),console.log(" $ bricks device refresh <device-id>"),console.log(" $ bricks device control <device-id> clear-cache"),console.log(""),console.log(s.default.gray(" # Bind a new device")),console.log(' $ bricks device bind <passcode> -n "My Device"'),console.log(""),console.log(s.default.gray(" # List applications")),console.log(" $ bricks app list"),console.log(""),console.log(s.default.gray(" # Start interactive mode")),console.log(" $ bricks interactive"),console.log(""),console.log(s.default.gray(" # Change API endpoint")),console.log(" $ bricks config endpoint beta"),console.log(""),console.log(s.default.gray("Get workspace token from BRICKS Controller:")),console.log(s.default.cyan(" https://control.bricks.tools")),console.log(s.default.gray(" Go to Workspace Settings > API Token"))});var n=process.argv.slice(2);if(0===n.length){if((0,l.shouldStartInteractiveMode)(n))try{var $=(yield Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(632),o.e(700),o.e(779)]).then(o.bind(o,18779))).runInteractiveMode;return void(yield $())}catch(e){console.error(s.default.red(`Failed to start interactive mode: ${e.message}`)),process.exit(1)}return console.error(s.default.gray("No command provided. Interactive mode requires a TTY, so showing help instead.\n")),void i.DM.outputHelp()}yield i.DM.parseAsync(process.argv)}),function(){return k.apply(this,arguments)});const S=w;n()}catch(e){n(e)}var k})},1001:(e,t,o)=>{o.d(t,{p:()=>i});var n=/^(\d+)(s|m|h|d|w)$/,r={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function i(e){var t=e.match(n);if(t){var o=parseInt(t[1],10),i=r[t[2]];return new Date(Date.now()-o*i).toISOString()}var s=new Date(e);if(isNaN(s.getTime()))throw new Error(`Invalid time format: "${e}". Use ISO 8601 or relative (e.g. 1h, 30m, 2d)`);return s.toISOString()}},1708:e=>{e.exports=t("node:process")},2203:e=>{e.exports=t("stream")},3634:e=>{e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},3900:e=>{e.exports=JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},"dots2":{"interval":80,"frames":["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},"dots3":{"interval":80,"frames":["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},"dots4":{"interval":80,"frames":["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},"dots5":{"interval":80,"frames":["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},"dots6":{"interval":80,"frames":["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},"dots7":{"interval":80,"frames":["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},"dots8":{"interval":80,"frames":["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},"dots9":{"interval":80,"frames":["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},"dots10":{"interval":80,"frames":["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},"dots11":{"interval":100,"frames":["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},"dots12":{"interval":80,"frames":["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},"dots13":{"interval":80,"frames":["⣼","⣹","⢻","⠿","⡟","⣏","⣧","⣶"]},"dots8Bit":{"interval":80,"frames":["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},"sand":{"interval":80,"frames":["⠁","⠂","⠄","⡀","⡈","⡐","⡠","⣀","⣁","⣂","⣄","⣌","⣔","⣤","⣥","⣦","⣮","⣶","⣷","⣿","⡿","⠿","⢟","⠟","⡛","⠛","⠫","⢋","⠋","⠍","⡉","⠉","⠑","⠡","⢁"]},"line":{"interval":130,"frames":["-","\\\\","|","/"]},"line2":{"interval":100,"frames":["⠂","-","–","—","–","-"]},"pipe":{"interval":100,"frames":["┤","┘","┴","└","├","┌","┬","┐"]},"simpleDots":{"interval":400,"frames":[". ",".. ","..."," "]},"simpleDotsScrolling":{"interval":200,"frames":[". ",".. ","..."," .."," ."," "]},"star":{"interval":70,"frames":["✶","✸","✹","✺","✹","✷"]},"star2":{"interval":80,"frames":["+","x","*"]},"flip":{"interval":70,"frames":["_","_","_","-","`","`","\'","´","-","_","_","_"]},"hamburger":{"interval":100,"frames":["☱","☲","☴"]},"growVertical":{"interval":120,"frames":["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},"growHorizontal":{"interval":120,"frames":["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},"balloon":{"interval":140,"frames":[" ",".","o","O","@","*"," "]},"balloon2":{"interval":120,"frames":[".","o","O","°","O","o","."]},"noise":{"interval":100,"frames":["▓","▒","░"]},"bounce":{"interval":120,"frames":["⠁","⠂","⠄","⠂"]},"boxBounce":{"interval":120,"frames":["▖","▘","▝","▗"]},"boxBounce2":{"interval":100,"frames":["▌","▀","▐","▄"]},"triangle":{"interval":50,"frames":["◢","◣","◤","◥"]},"binary":{"interval":80,"frames":["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},"arc":{"interval":100,"frames":["◜","◠","◝","◞","◡","◟"]},"circle":{"interval":120,"frames":["◡","⊙","◠"]},"squareCorners":{"interval":180,"frames":["◰","◳","◲","◱"]},"circleQuarters":{"interval":120,"frames":["◴","◷","◶","◵"]},"circleHalves":{"interval":50,"frames":["◐","◓","◑","◒"]},"squish":{"interval":100,"frames":["╫","╪"]},"toggle":{"interval":250,"frames":["⊶","⊷"]},"toggle2":{"interval":80,"frames":["▫","▪"]},"toggle3":{"interval":120,"frames":["□","■"]},"toggle4":{"interval":100,"frames":["■","□","▪","▫"]},"toggle5":{"interval":100,"frames":["▮","▯"]},"toggle6":{"interval":300,"frames":["ဝ","၀"]},"toggle7":{"interval":80,"frames":["⦾","⦿"]},"toggle8":{"interval":100,"frames":["◍","◌"]},"toggle9":{"interval":100,"frames":["◉","◎"]},"toggle10":{"interval":100,"frames":["㊂","㊀","㊁"]},"toggle11":{"interval":50,"frames":["⧇","⧆"]},"toggle12":{"interval":120,"frames":["☗","☖"]},"toggle13":{"interval":80,"frames":["=","*","-"]},"arrow":{"interval":100,"frames":["←","↖","↑","↗","→","↘","↓","↙"]},"arrow2":{"interval":80,"frames":["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},"arrow3":{"interval":120,"frames":["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},"bouncingBar":{"interval":80,"frames":["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},"bouncingBall":{"interval":80,"frames":["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},"smiley":{"interval":200,"frames":["😄 ","😝 "]},"monkey":{"interval":300,"frames":["🙈 ","🙈 ","🙉 ","🙊 "]},"hearts":{"interval":100,"frames":["💛 ","💙 ","💜 ","💚 ","❤️ "]},"clock":{"interval":100,"frames":["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},"earth":{"interval":180,"frames":["🌍 ","🌎 ","🌏 "]},"material":{"interval":17,"frames":["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███████▁▁▁▁▁▁▁▁▁▁▁▁▁","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","██████████▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","█████████████▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁██████████████▁▁▁▁","▁▁▁██████████████▁▁▁","▁▁▁▁█████████████▁▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁▁▁████████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","██████▁▁▁▁▁▁▁▁▁▁▁▁▁█","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁▁█████████████▁▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁▁███████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁▁█████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"]},"moon":{"interval":80,"frames":["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},"runner":{"interval":140,"frames":["🚶 ","🏃 "]},"pong":{"interval":80,"frames":["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},"shark":{"interval":120,"frames":["▐|\\\\____________▌","▐_|\\\\___________▌","▐__|\\\\__________▌","▐___|\\\\_________▌","▐____|\\\\________▌","▐_____|\\\\_______▌","▐______|\\\\______▌","▐_______|\\\\_____▌","▐________|\\\\____▌","▐_________|\\\\___▌","▐__________|\\\\__▌","▐___________|\\\\_▌","▐____________|\\\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},"dqpb":{"interval":100,"frames":["d","q","p","b"]},"weather":{"interval":100,"frames":["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},"christmas":{"interval":400,"frames":["🌲","🎄"]},"grenade":{"interval":80,"frames":["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},"point":{"interval":125,"frames":["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},"layer":{"interval":150,"frames":["-","=","≡"]},"betaWave":{"interval":80,"frames":["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]},"fingerDance":{"interval":160,"frames":["🤘 ","🤟 ","🖖 ","✋ ","🤚 ","👆 "]},"fistBump":{"interval":80,"frames":["🤜 🤛 ","🤜 🤛 ","🤜 🤛 "," 🤜 🤛 "," 🤜🤛 "," 🤜✨🤛 ","🤜 ✨ 🤛 "]},"soccerHeader":{"interval":80,"frames":[" 🧑⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 "]},"mindblown":{"interval":160,"frames":["😐 ","😐 ","😮 ","😮 ","😦 ","😦 ","😧 ","😧 ","🤯 ","💥 ","✨ "," "," "," "]},"speaker":{"interval":160,"frames":["🔈 ","🔉 ","🔊 ","🔉 "]},"orangePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 "]},"bluePulse":{"interval":100,"frames":["🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"orangeBluePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 ","🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"timeTravel":{"interval":100,"frames":["🕛 ","🕚 ","🕙 ","🕘 ","🕗 ","🕖 ","🕕 ","🕔 ","🕓 ","🕒 ","🕑 ","🕐 "]},"aesthetic":{"interval":80,"frames":["▰▱▱▱▱▱▱","▰▰▱▱▱▱▱","▰▰▰▱▱▱▱","▰▰▰▰▱▱▱","▰▰▰▰▰▱▱","▰▰▰▰▰▰▱","▰▰▰▰▰▰▰","▰▱▱▱▱▱▱"]},"dwarfFortress":{"interval":80,"frames":[" ██████£££ ","☺██████£££ ","☺██████£££ ","☺▓█████£££ ","☺▓█████£££ ","☺▒█████£££ ","☺▒█████£££ ","☺░█████£££ ","☺░█████£££ ","☺ █████£££ "," ☺█████£££ "," ☺█████£££ "," ☺▓████£££ "," ☺▓████£££ "," ☺▒████£££ "," ☺▒████£££ "," ☺░████£££ "," ☺░████£££ "," ☺ ████£££ "," ☺████£££ "," ☺████£££ "," ☺▓███£££ "," ☺▓███£££ "," ☺▒███£££ "," ☺▒███£££ "," ☺░███£££ "," ☺░███£££ "," ☺ ███£££ "," ☺███£££ "," ☺███£££ "," ☺▓██£££ "," ☺▓██£££ "," ☺▒██£££ "," ☺▒██£££ "," ☺░██£££ "," ☺░██£££ "," ☺ ██£££ "," ☺██£££ "," ☺██£££ "," ☺▓█£££ "," ☺▓█£££ "," ☺▒█£££ "," ☺▒█£££ "," ☺░█£££ "," ☺░█£££ "," ☺ █£££ "," ☺█£££ "," ☺█£££ "," ☺▓£££ "," ☺▓£££ "," ☺▒£££ "," ☺▒£££ "," ☺░£££ "," ☺░£££ "," ☺ £££ "," ☺£££ "," ☺£££ "," ☺▓££ "," ☺▓££ "," ☺▒££ "," ☺▒££ "," ☺░££ "," ☺░££ "," ☺ ££ "," ☺££ "," ☺££ "," ☺▓£ "," ☺▓£ "," ☺▒£ "," ☺▒£ "," ☺░£ "," ☺░£ "," ☺ £ "," ☺£ "," ☺£ "," ☺▓ "," ☺▓ "," ☺▒ "," ☺▒ "," ☺░ "," ☺░ "," ☺ "," ☺ &"," ☺ ☼&"," ☺ ☼ &"," ☺☼ &"," ☺☼ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & ","‼ & "," & "," & "," & ░ "," & ▒ "," & ▓ "," & £ "," & ░£ "," & ▒£ "," & ▓£ "," & ££ "," & ░££ "," & ▒££ ","& ▓££ ","& £££ "," ░£££ "," ▒£££ "," ▓£££ "," █£££ "," ░█£££ "," ▒█£££ "," ▓█£££ "," ██£££ "," ░██£££ "," ▒██£££ "," ▓██£££ "," ███£££ "," ░███£££ "," ▒███£££ "," ▓███£££ "," ████£££ "," ░████£££ "," ▒████£££ "," ▓████£££ "," █████£££ "," ░█████£££ "," ▒█████£££ "," ▓█████£££ "," ██████£££ "," ██████£££ "]}}')},5523:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},6939:(e,t,o)=>{o.d(t,{H_:()=>a,Iy:()=>s,S5:()=>c,jB:()=>l,yd:()=>d});var n=o(88568),r=o(79896),i=o(34992),s=(e,t,o)=>({label:e,ok:t,detail:o}),a=(e,t,{id:o,name:n,...r}={})=>({id:e?._id||t,name:n||e?.name||"Unnamed",...r}),l=(e,t)=>{var o={id:e};return t.name&&(o.name=t.name),t.description&&(o.description=t.description),t.config?o.config=t.config:t.file&&(o.config=r.readFileSync(t.file,"utf-8")),void 0!==o.config&&(o.validateConfig=!1!==t.validate),t.lastCommitId&&(o.lastCommitId=t.lastCommitId),o},u=e=>null==e?n.default.gray("N/A"):"object"==typeof e?n.default.gray(JSON.stringify(e,null,2)):String(e),c=({action:e,target:t,request:o,checks:r=[],json:s=!1})=>{var a={ok:!0,dryRun:!0,action:e,target:t||null,request:o||null,checks:r};s?(0,i.GF)(a):(console.log(n.default.bold(`\nDry Run: ${e}`)),console.log("─".repeat(60)),t&&(console.log(n.default.bold("Target")),Object.entries(t).forEach(([e,t])=>{console.log(`${e}: ${u(t)}`)})),o&&(console.log(`\n${n.default.bold("Request")}`),Object.entries(o).forEach(([e,t])=>{console.log(`${e}: ${u(t)}`)})),r.length>0&&(console.log(`\n${n.default.bold("Checks")}`),r.forEach(e=>{var t=e.ok?n.default.green("OK"):n.default.red("FAIL"),o=e.detail?` ${e.detail}`:"";console.log(`${t} ${e.label}${o}`)})),console.log("─".repeat(60)))},d=({action:e,target:t,result:o=null,json:n=!1,message:r})=>{n?(0,i.GF)({ok:!0,dryRun:!1,action:e,target:t||null,result:o}):r&&console.log(r)}},7066:e=>{e.exports=t("node:tty")},7089:(e,t,o)=>{o.d(t,{oT:()=>c});var n=o(35679),r=o(88568),i=o(74752),s={prod:"https://display.bricks.tools",beta:"https://display-beta.bricks.tools",dev:"http://localhost:3001"},a=e=>{var t=Object.entries(s).find(([,t])=>e===t);return t?t[0]:null},l={prod:"https://activity-log.bricks.tools",beta:"https://activity-log-beta.bricks.tools",dev:"http://localhost:8088"},u=e=>{var t=Object.entries(l).find(([,t])=>e===t);return t?t[0]:null},c=new n.uB("config").description("CLI configuration management");c.command("endpoint").argument("[environment]","Environment to use (prod, beta, dev)").description("Show or set endpoint environment").option("-p, --profile","Set for current profile instead of global").action((e,t)=>{if(!e){var o=(0,i.getBaseUrl)(),n=a(o),c=(0,i.getActivityLogBaseUrl)(),d=u(c);return console.log(r.default.bold("\nEndpoint Configuration")),console.log("─".repeat(50)),console.log(r.default.bold("BRICKS")),console.log(` URL: ${r.default.cyan(o)}`),console.log(` Environment: ${n?r.default.green(n):r.default.yellow("custom")}`),console.log(r.default.bold("Activity Log")),console.log(` URL: ${r.default.cyan(c)}`),console.log(` Environment: ${d?r.default.green(d):r.default.yellow("custom")}`),console.log("─".repeat(50)),void console.log(r.default.gray("\nUsage: bricks config endpoint <prod|beta|dev>"))}var p=Object.keys(s);p.includes(e)||(console.error(r.default.red(`Invalid environment: ${e}`)),console.log(r.default.gray(`Valid options: ${p.join(", ")}`)),process.exit(1));var f=s[e],g=l[e],h=t.profile?(0,i.getCurrentProfile)():null;(0,i.setBaseUrl)(f,h),(0,i.setActivityLogBaseUrl)(g,h);var m=t.profile?` (profile: ${(0,i.getCurrentProfile)()})`:"";console.log(r.default.green(`✓ Endpoint changed to ${e}${m}`)),console.log(r.default.gray(` BRICKS: ${f}`)),console.log(r.default.gray(` Activity Log: ${g}`)),console.log(r.default.yellow("\nNote: You may need to re-authenticate if your token is for a different environment.")),console.log(r.default.gray("Use `bricks auth status` to check your connection."))}),c.command("show").description("Show current configuration").option("-j, --json","Output as JSON").action(e=>{var t=(0,i.getBaseUrl)(),o=a(t);if(e.json)console.log(JSON.stringify({endpoint:t,environment:o||"custom"},null,2));else{console.log(r.default.bold("\nBRICKS CLI Configuration")),console.log("─".repeat(50)),console.log(`BRICKS: ${r.default.cyan(t)}`),o?console.log(`Environment: ${r.default.green(o)}`):console.log(`Environment: ${r.default.yellow("custom")}`);var n=(0,i.getActivityLogBaseUrl)(),s=u(n);console.log(`Activity Log: ${r.default.cyan(n)} ${s?r.default.green(`(${s})`):r.default.yellow("(custom)")}`),console.log("─".repeat(50))}})},8498:(e,t,n)=>{e.exports=(e=>{var t={};return n.d(t,e),t})({Box:()=>o.Box,Text:()=>o.Text,render:()=>o.render,useApp:()=>o.useApp,useInput:()=>o.useInput})},12044:(e,t,o)=>{o.r(t),o.d(t,{discoverDevToolsServers:()=>c,httpProbeSubnet:()=>d,verifyDevToolsServer:()=>p});var n,r,i=o(99436),s=o(41314),a=o(48161),l="bricks-devtools",u=()=>{var e=[],t=a.networkInterfaces();for(var o of Object.values(t)){var n=function(){if("IPv4"!==r.family||r.internal)return 1;var t=r.address.split(".").map(Number),o=r.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~o[t]).toString()).join(".");e.push({address:r.address,broadcast:n})};for(var r of o)n()}return e},c=({timeout:e=3e3,idleTimeout:t=0}={})=>new Promise((o,n)=>{var r=new Map,i=s.createSocket("udp4"),a=null,c=null,d=!1,p=()=>{if(!d){d=!0,clearTimeout(a),clearTimeout(c);try{i.close()}catch{}o([...r.values()])}};i.on("error",e=>{if(!d){d=!0,clearTimeout(a),clearTimeout(c);try{i.close()}catch{}n(e)}}),i.on("message",(e,o)=>{try{var n=JSON.parse(e.toString());if(n.s!==l)return;if("ANNOUNCE"!==n.t&&"RESPONSE"!==n.t)return;var i=n.d?.info;if(!i)return;var s=o.address,a=`${s}:${i.port}`;r.has(a)||(r.set(a,{...i,address:s}),t&&!d&&(clearTimeout(c),c=setTimeout(p,t)))}catch{}}),i.bind(()=>{i.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"1.0",s:l,d:{id:`cli-${Math.random().toString(36).substring(2,9)}`}})),o=new Set(["255.255.255.255","127.0.0.1"]);for(var n of u())o.add(n.broadcast);for(var r of o)i.send(t,0,t.length,19900,r);a=setTimeout(p,e)})}),d=(n=i(function*({port:e=19851,connectTimeout:t=500,concurrency:o=50,timeout:n=0}={}){var r=u();if(0===r.length)return[];var s=[],a=n>0?Date.now()+n:0,l=[],c=new Set;for(var d of r){var f=d.address.split(".").slice(0,3).join(".");if(!c.has(f)){c.add(f);for(var g=1;g<255;g++)l.push(`${f}.${g}`)}}for(var h=0;h<l.length&&!(a&&Date.now()>=a);h+=o){var m=l.slice(h,h+o);yield Promise.allSettled(m.map(function(){var o=i(function*(o){var n=yield p(o,e,t);n&&s.push({...n,address:o,port:e})});return function(e){return o.apply(this,arguments)}}()))}return s}),function(){return n.apply(this,arguments)}),p=(r=i(function*(e,t,o=3e3){try{var n=new AbortController,r=setTimeout(()=>n.abort(),o),i=yield fetch(`http://${e}:${t}/devtools/info`,{signal:n.signal});return clearTimeout(r),i.ok?yield i.json():null}catch{return null}}),function(e,t){return r.apply(this,arguments)})},13193:e=>{e.exports=t("string_decoder")},13675:(e,t,o)=>{o.d(t,{Ku:()=>a,w9:()=>s});var n=o(79896),r=o(16928),i=new Set(["CTOR","CTOR Desktop"]),s=e=>{var t=`Release by ${(()=>{var e=process.env.BRICKS_RELEASE_SIGN;return e&&i.has(e)?e:"BRICKS CLI"})()}`;return e?`${e}\n\n${t}`:t},a=e=>{if(e.endsWith(".json")||e.includes("/")){if(!n.existsSync(e))throw new Error(`Config file not found: ${e}`);var t=n.readFileSync(e,"utf-8");return{config:t,source:{type:"file",path:r.resolve(e)},sizeBytes:Buffer.byteLength(t)}}return{config:e,source:{type:"inline"},sizeBytes:Buffer.byteLength(e)}}},14778:(e,t,o)=>{o.a(e,async(e,n)=>{try{o.d(t,{D:()=>h});var r=o(35679),i=o(69278),s=o(16928),a=o(70857),l=o(84361),u=e([l]),c=u.then?(await u)():u;l=c[0];var d=process.env.BRICKS_PROJECT_DESKTOP_DATA_DIR||s.join(a.homedir(),".bricks-project-desktop"),p=s.join(d,"acp.sock"),f=`[acp] Cannot connect to CTOR.\n Make sure the desktop app is running and ACP is enabled in Settings.\n Socket: ${p}\n`,g=e=>{var t=new i.Socket,o="",n=!1,r=[];t.on("error",t=>{var o="ENOENT"===t.code||"ECONNREFUSED"===t.code?"CTOR not reachable (is the desktop app running with ACP enabled?)":`socket error: ${t.message}`;process.stderr.write(`[acp] ${o}\n`);try{e.close(1011,o)}catch{}}),t.on("connect",()=>{n=!0,(()=>{for(;r.length>0;)t.write(r.shift())})()}),t.on("data",t=>{var n;for(o+=t.toString("utf8");-1!==(n=o.indexOf("\n"));){var r=o.slice(0,n);o=o.slice(n+1),r.length>0&&e.readyState===e.OPEN&&e.send(r)}}),t.on("close",()=>{o.length>0&&e.readyState===e.OPEN&&(e.send(o),o="");try{e.close()}catch{}}),e.on("message",(e,o)=>{var i=o?Buffer.from(e).toString("utf8"):e.toString(),s=i.endsWith("\n")?i:i+"\n";n?t.write(s):r.push(s)}),e.on("close",()=>t.destroy()),e.on("error",()=>t.destroy()),t.connect(p)},h=new r.uB("desktop-acp-bridge").description("ACP bridge — connects acpx to the running CTOR desktop app").option("--ws","Start a WebSocket server that bridges the Unix socket instead of using stdio").option("--host <host>","WebSocket server bind host (default: 0.0.0.0)","0.0.0.0").option("--port <port>","WebSocket server port (default: 8765)","8765").option("--auth-token <token>","Require this Bearer token in the WebSocket Authorization header").action(e=>{if(!e.ws)return(t=i.connect(p)).on("connect",()=>{process.stdin.pipe(t),t.pipe(process.stdout)}),t.on("error",e=>{"ENOENT"===e.code||"ECONNREFUSED"===e.code?process.stderr.write(f):process.stderr.write(`[acp] Connection error: ${e.message}\n`),process.exit(1)}),void t.on("close",()=>{process.exit(0)});var t,o=Number.parseInt(e.port,10);(!Number.isInteger(o)||o<0||o>65535)&&(process.stderr.write(`[acp] Invalid --port value: ${e.port}\n`),process.exit(1));var n=e.authToken||process.env.BRICKS_DESKTOP_ACP_BRIDGE_TOKEN||void 0;(({host:e,port:t,authToken:o})=>{var n=new l.WebSocketServer({host:e,port:t,verifyClient:({req:e},t)=>{if(o){for(var n=e.headers.authorization||"",r=`Bearer ${o}`,i=Buffer.from(n),s=Buffer.from(r),a=i.length===s.length,l=Math.max(i.length,s.length),u=0;u<l;u++)(i[u]||0)!==(s[u]||0)&&(a=!1);a?t(!0):t(!1,401,"Unauthorized")}else t(!0)}});n.on("listening",()=>{var e=n.address(),t="string"==typeof e?e:`ws://${e.address}:${e.port}`;process.stderr.write(`[acp] WebSocket bridge listening on ${t}\n`),o||process.stderr.write("[acp] WARNING: no --auth-token set; the bridge is exposed on this host without authentication.\n")}),n.on("error",e=>{process.stderr.write(`[acp] WebSocket server error: ${e.message}\n`),process.exit(1)}),n.on("connection",g);var r=()=>{n.close(()=>process.exit(0))};process.on("SIGINT",r),process.on("SIGTERM",r)})({host:e.host,port:o,authToken:n})});n()}catch(e){n(e)}})},16698:e=>{e.exports=t("node:async_hooks")},16928:e=>{e.exports=t("path")},18572:(e,t,o)=>{const n=o(78474).EventEmitter,r=o(31421),i=o(76760),s=o(73024),a=o(1708),{Argument:l,humanReadableArgName:u}=o(41762),{CommanderError:c}=o(43823),{Help:d}=o(99690),{Option:p,DualOptions:f}=o(92088),{suggestSimilar:g}=o(86054);class h extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,outputError:(e,t)=>t(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,o){let n=t,r=o;"object"==typeof n&&null!==n&&(r=n,n=null),r=r||{};const[,i,s]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(i);return n&&(a.description(n),a._executableHandler=!0),r.isDefault&&(this._defaultCommandName=a._name),a._hidden=!(!r.noHelp&&!r.hidden),a._executableFile=r.executableFile||null,s&&a.arguments(s),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(e){return new h(e)}createHelp(){return Object.assign(new d,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new l(e,t)}argument(e,t,o,n){const r=this.createArgument(e,t);return"function"==typeof o?r.default(n).argParser(o):r.default(o),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if("boolean"==typeof e)return this._addImplicitHelpCommand=e,this;e=e??"help [command]";const[,o,n]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",i=this.createCommand(o);return i.helpOption(!1),n&&i.arguments(n),r&&i.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=i,this}addHelpCommand(e,t){return"object"!=typeof e?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){const o=["preSubcommand","preAction","postAction"];if(!o.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if("commander.executeSubCommandAsync"!==e.code)throw e}),this}_exit(e,t,o){this._exitCallback&&this._exitCallback(new c(e,t,o)),a.exit(e)}action(e){return this._actionHandler=t=>{const o=this.registeredArguments.length,n=t.slice(0,o);return this._storeOptionsAsProperties?n[o]=this:n[o]=this.opts(),n.push(this),e.apply(this,n)},this}createOption(e,t){return new p(e,t)}_callParseArg(e,t,o,n){try{return e.parseArg(t,o)}catch(e){if("commander.invalidArgument"===e.code){const t=`${n} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const o=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${o}'\n- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){const t=e=>[e.name()].concat(e.aliases()),o=t(e).find(e=>this._findCommand(e));if(o){const n=t(this._findCommand(o)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);const t=e.name(),o=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(o,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(o,e.defaultValue,"default");const n=(t,n,r)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const i=this.getOptionValue(o);null!==t&&e.parseArg?t=this._callParseArg(e,t,i,n):null!==t&&e.variadic&&(t=e._concatValue(t,i)),null==t&&(t=!e.negate&&(!(!e.isBoolean()&&!e.optional)||"")),this.setOptionValueWithSource(o,t,r)};return this.on("option:"+t,t=>{const o=`error: option '${e.flags}' argument '${t}' is invalid.`;n(t,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{const o=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;n(t,o,"env")}),this}_optionEx(e,t,o,n,r){if("object"==typeof t&&t instanceof p)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const i=this.createOption(t,o);if(i.makeOptionMandatory(!!e.mandatory),"function"==typeof n)i.default(r).argParser(n);else if(n instanceof RegExp){const e=n;n=(t,o)=>{const n=e.exec(t);return n?n[0]:o},i.default(r).argParser(n)}else i.default(n);return this.addOption(i)}option(e,t,o,n){return this._optionEx({},e,t,o,n)}requiredOption(e,t,o,n){return this._optionEx({mandatory:!0},e,t,o,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,o){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=o,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(o=>{void 0!==o.getOptionValueSource(e)&&(t=o.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},void 0===e&&void 0===t.from){a.versions?.electron&&(t.from="electron");const e=a.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}let o;switch(void 0===e&&(e=a.argv),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],o=e.slice(2);break;case"electron":a.defaultApp?(this._scriptPath=e[1],o=e.slice(2)):o=e.slice(1);break;case"user":o=e.slice(0);break;case"eval":o=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",o}parse(e,t){const o=this._prepareUserArgs(e,t);return this._parseCommand([],o),this}async parseAsync(e,t){const o=this._prepareUserArgs(e,t);return await this._parseCommand([],o),this}_executeSubCommand(e,t){t=t.slice();let o=!1;const n=[".js",".ts",".tsx",".mjs",".cjs"];function l(e,t){const o=i.resolve(e,t);if(s.existsSync(o))return o;if(n.includes(i.extname(t)))return;const r=n.find(e=>s.existsSync(`${o}${e}`));return r?`${o}${r}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u,d=e._executableFile||`${this._name}-${e._name}`,p=this._executableDir||"";if(this._scriptPath){let e;try{e=s.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}p=i.resolve(i.dirname(e),p)}if(p){let t=l(p,d);if(!t&&!e._executableFile&&this._scriptPath){const o=i.basename(this._scriptPath,i.extname(this._scriptPath));o!==this._name&&(t=l(p,`${o}-${e._name}`))}d=t||d}if(o=n.includes(i.extname(d)),"win32"!==a.platform?o?(t.unshift(d),t=m(a.execArgv).concat(t),u=r.spawn(a.argv[0],t,{stdio:"inherit"})):u=r.spawn(d,t,{stdio:"inherit"}):(t.unshift(d),t=m(a.execArgv).concat(t),u=r.spawn(a.execPath,t,{stdio:"inherit"})),!u.killed){["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{a.on(e,()=>{!1===u.killed&&null===u.exitCode&&u.kill(e)})})}const f=this._exitCallback;u.on("close",e=>{e=e??1,f?f(new c(e,"commander.executeSubCommandAsync","(close)")):a.exit(e)}),u.on("error",t=>{if("ENOENT"===t.code){const t=p?`searched for local subcommand relative to directory '${p}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${d}' does not exist\n - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t}`;throw new Error(o)}if("EACCES"===t.code)throw new Error(`'${d}' not executable`);if(f){const e=new c(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,f(e)}else a.exit(1)}),this.runningCommand=u}_dispatchSubcommand(e,t,o){const n=this._findCommand(e);let r;return n||this.help({error:!0}),r=this._chainOrCallSubCommandHook(r,n,"preSubcommand"),r=this._chainOrCall(r,()=>{if(!n._executableHandler)return n._parseCommand(t,o);this._executeSubCommand(n,t.concat(o))}),r}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const e=(e,t,o)=>{let n=t;if(null!==t&&e.parseArg){const r=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;n=this._callParseArg(e,t,o,r)}return n};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach((o,n)=>{let r=o.defaultValue;o.variadic?n<this.args.length?(r=this.args.slice(n),o.parseArg&&(r=r.reduce((t,n)=>e(o,n,t),o.defaultValue))):void 0===r&&(r=[]):n<this.args.length&&(r=this.args[n],o.parseArg&&(r=e(o,r,o.defaultValue))),t[n]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let o=e;const n=[];return this._getCommandAndAncestors().reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{n.push({hookedCommand:e,callback:t})})}),"postAction"===t&&n.reverse(),n.forEach(e=>{o=this._chainOrCall(o,()=>e.callback(e.hookedCommand,this))}),o}_chainOrCallSubCommandHook(e,t,o){let n=e;return void 0!==this._lifeCycleHooks[o]&&this._lifeCycleHooks[o].forEach(e=>{n=this._chainOrCall(n,()=>e(this,t))}),n}_parseCommand(e,t){const o=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(o.operands),t=o.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(o.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const n=()=>{o.unknown.length>0&&this.unknownOption(o.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){let o;return n(),this._processArguments(),o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(r))n(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){const e=this.options.filter(e=>{const t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{const o=e.find(e=>t.conflictsWith.includes(e.attributeName()));o&&this._conflictingOption(t,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){const t=[],o=[];let n=t;const r=e.slice();function i(e){return e.length>1&&"-"===e[0]}let s=null;for(;r.length;){const e=r.shift();if("--"===e){n===o&&n.push(e),n.push(...r);break}if(!s||i(e)){if(s=null,i(e)){const t=this._findOption(e);if(t){if(t.required){const e=r.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;r.length>0&&!i(r[0])&&(e=r.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);s=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){const t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),r.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("="),o=this._findOption(e.slice(0,t));if(o&&(o.required||o.optional)){this.emit(`option:${o.name()}`,e.slice(t+1));continue}}if(i(e)&&(n=o),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===o.length){if(this._findCommand(e)){t.push(e),r.length>0&&o.push(...r);break}if(this._getHelpCommand()&&e===this._getHelpCommand().name()){t.push(e),r.length>0&&t.push(...r);break}if(this._defaultCommandName){o.push(e),r.length>0&&o.push(...r);break}}if(this._passThroughOptions){n.push(e),r.length>0&&n.push(...r);break}n.push(e)}else this.emit(`option:${s.name()}`,e)}return{operands:t,unknown:o}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let o=0;o<t;o++){const t=this.options[o].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const o=t||{},n=o.exitCode||1,r=o.code||"commander.error";this._exit(n,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){const t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){const e=new f(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(o=>void 0!==o.implied&&t(o.attributeName())&&e.valueFromOption(this.getOptionValue(o.attributeName()),o)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")})})}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const o=e=>{const t=e.attributeName(),o=this.getOptionValue(t),n=this.options.find(e=>e.negate&&t===e.attributeName()),r=this.options.find(e=>!e.negate&&t===e.attributeName());return n&&(void 0===n.presetArg&&!1===o||void 0!==n.presetArg&&o===n.presetArg)?n:r||e},n=e=>{const t=o(e),n=t.attributeName();return"env"===this.getOptionValueSource(n)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},r=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],n=this;do{const e=n.createHelp().visibleOptions(n).filter(e=>e.long).map(e=>e.long);o=o.concat(e),n=n.parent}while(n&&!n._enablePositionalOptions);t=g(e,o)}const o=`error: unknown option '${e}'${t}`;this.error(o,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.length,o=1===t?"":"s",n=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${o} but got ${e.length}.`;this.error(n,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const o=[];this.createHelp().visibleCommands(this).forEach(e=>{o.push(e.name()),e.alias()&&o.push(e.alias())}),t=g(e,o)}const o=`error: unknown command '${e}'${t}`;this.error(o,{code:"commander.unknownCommand"})}version(e,t,o){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",o=o||"output the version number";const n=this.createOption(t,o);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");const o=this.parent?._findCommand(e);if(o){const t=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;const e=this.registeredArguments.map(e=>u(e));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){const t={error:!!(e=e||{}).error};let o;return o=t.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),t.write=e.write||o,t.command=this,t}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const o=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(e=>e.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let n=this.helpInformation(o);if(t&&(n=t(n),"string"!=typeof n&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");o.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(e=>e.emit("afterAllHelp",o))}helpOption(e,t){return"boolean"==typeof e?(this._helpOption=e?this._helpOption??void 0:null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=a.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const o=["beforeAll","before","after","afterAll"];if(!o.includes(e))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${o.join("', '")}'`);const n=`${e}Help`;return this.on(n,e=>{let o;o="function"==typeof t?t({error:e.error,command:e.command}):t,o&&e.write(`${o}\n`)}),this}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function m(e){return e.map(e=>{if(!e.startsWith("--inspect"))return e;let t,o,n="127.0.0.1",r="9229";return null!==(o=e.match(/^(--inspect(-brk)?)$/))?t=o[1]:null!==(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=o[1],/^\d+$/.test(o[3])?r=o[3]:n=o[3]):null!==(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=o[1],n=o[3],r=o[4]),t&&"0"!==r?`${t}=${n}:${parseInt(r)+1}`:e})}t.Command=h},20181:e=>{e.exports=t("buffer")},24434:e=>{e.exports=t("events")},24876:e=>{e.exports=t("punycode")},25811:(e,t,o)=>{o.d(t,{K:()=>l});var n,r=o(99436),i=o(35679),s=o(88568),a=o(74752),l=new i.uB("mcp").description("MCP server management");l.command("start").description("Start the BRICKS MCP server in STDIO mode").option("-t, --token <token>","API token (overrides saved token)").action((n=r(function*(e){var t=(0,a.getCurrentProfile)(),n=e.token||(0,a.getToken)(t);n||(console.error(s.default.red("Error: No API token found.")),console.error(s.default.gray("Please login first with: bricks auth login <passcode>")),console.error(s.default.gray("Or provide a token with: bricks mcp start --token <token>")),process.exit(1));try{var r=(yield Promise.all([o.e(657),o.e(480),o.e(428),o.e(886),o.e(703),o.e(737)]).then(o.bind(o,18737))).startStdioServer;yield r({token:n})}catch(e){console.error(s.default.red(`Failed to start MCP server: ${e.message}`)),process.exit(1)}}),function(e){return n.apply(this,arguments)}))},27549:function(e,t,o){e.exports=(o(35317),o(76982),function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){e.exports=o(34)},function(e,t,o){var n=o(29)("wks"),r=o(33),i=o(2).Symbol,s="function"==typeof i;(e.exports=function(e){return n[e]||(n[e]=s&&i[e]||(s?i:r)("Symbol."+e))}).store=n},function(e,t){var o=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=o)},function(e,t,o){var n=o(9);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,o){e.exports=!o(24)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,o){var n=o(12),r=o(17);e.exports=o(4)?function(e,t,o){return n.f(e,t,r(1,o))}:function(e,t,o){return e[t]=o,e}},function(e,t){var o=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=o)},function(e,t,o){var n=o(14);e.exports=function(e,t,o){if(n(e),void 0===t)return e;switch(o){case 1:return function(o){return e.call(t,o)};case 2:return function(o,n){return e.call(t,o,n)};case 3:return function(o,n,r){return e.call(t,o,n,r)}}return function(){return e.apply(t,arguments)}}},function(e,t){var o={}.hasOwnProperty;e.exports=function(e,t){return o.call(e,t)}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports={}},function(e,t){var o={}.toString;e.exports=function(e){return o.call(e).slice(8,-1)}},function(e,t,o){var n=o(3),r=o(26),i=o(32),s=Object.defineProperty;t.f=o(4)?Object.defineProperty:function(e,t,o){if(n(e),t=i(t,!0),n(o),r)try{return s(e,t,o)}catch(e){}if("get"in o||"set"in o)throw TypeError("Accessors not supported!");return"value"in o&&(e[t]=o.value),e}},function(e,t,o){var n=o(42),r=o(15);e.exports=function(e){return n(r(e))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,o){var n=o(9),r=o(2).document,i=n(r)&&n(r.createElement);e.exports=function(e){return i?r.createElement(e):{}}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,o){var n=o(12).f,r=o(8),i=o(1)("toStringTag");e.exports=function(e,t,o){e&&!r(e=o?e:e.prototype,i)&&n(e,i,{configurable:!0,value:t})}},function(e,t,o){var n=o(29)("keys"),r=o(33);e.exports=function(e){return n[e]||(n[e]=r(e))}},function(e,t){var o=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:o)(e)}},function(e,t,o){var n=o(11),r=o(1)("toStringTag"),i="Arguments"==n(function(){return arguments}()),s=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,o,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(o=s(t=Object(e),r))?o:i?n(t):"Object"==(a=n(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,o){var n=o(2),r=o(6),i=o(7),s=o(5),a="prototype",l=function(e,t,o){var u,c,d,p=e&l.F,f=e&l.G,g=e&l.S,h=e&l.P,m=e&l.B,D=e&l.W,y=f?r:r[t]||(r[t]={}),v=y[a],F=f?n:g?n[t]:(n[t]||{})[a];for(u in f&&(o=t),o)(c=!p&&F&&void 0!==F[u])&&u in y||(d=c?F[u]:o[u],y[u]=f&&"function"!=typeof F[u]?o[u]:m&&c?i(d,n):D&&F[u]==d?function(e){var t=function(t,o,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,o)}return new e(t,o,n)}return e.apply(this,arguments)};return t[a]=e[a],t}(d):h&&"function"==typeof d?i(Function.call,d):d,h&&((y.virtual||(y.virtual={}))[u]=d,e&l.R&&v&&!v[u]&&s(v,u,d)))};l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,o){e.exports=o(2).document&&document.documentElement},function(e,t,o){e.exports=!o(4)&&!o(24)(function(){return 7!=Object.defineProperty(o(16)("div"),"a",{get:function(){return 7}}).a})},function(e,t,o){var n=o(28),r=o(23),i=o(57),s=o(5),a=o(8),l=o(10),u=o(45),c=o(18),d=o(52),p=o(1)("iterator"),f=!([].keys&&"next"in[].keys()),g="@@iterator",h="keys",m="values",D=function(){return this};e.exports=function(e,t,o,y,v,F,b){u(o,t,y);var _,C,$,E=function(e){if(!f&&e in x)return x[e];switch(e){case h:case m:return function(){return new o(this,e)}}return function(){return new o(this,e)}},w=t+" Iterator",k=v==m,S=!1,x=e.prototype,O=x[p]||x[g]||v&&x[v],A=O||E(v),I=v?k?E("entries"):A:void 0,j="Array"==t&&x.entries||O;if(j&&($=d(j.call(new e)))!==Object.prototype&&(c($,w,!0),n||a($,p)||s($,p,D)),k&&O&&O.name!==m&&(S=!0,A=function(){return O.call(this)}),n&&!b||!f&&!S&&x[p]||s(x,p,A),l[t]=A,l[w]=D,v)if(_={values:k?A:E(m),keys:F?A:E(h),entries:I},b)for(C in _)C in x||i(x,C,_[C]);else r(r.P+r.F*(f||S),t,_);return _}},function(e,t){e.exports=!0},function(e,t,o){var n=o(2),r="__core-js_shared__",i=n[r]||(n[r]={});e.exports=function(e){return i[e]||(i[e]={})}},function(e,t,o){var n,r,i,s=o(7),a=o(41),l=o(25),u=o(16),c=o(2),d=c.process,p=c.setImmediate,f=c.clearImmediate,g=c.MessageChannel,h=0,m={},D="onreadystatechange",y=function(){var e=+this;if(m.hasOwnProperty(e)){var t=m[e];delete m[e],t()}},v=function(e){y.call(e.data)};p&&f||(p=function(e){for(var t=[],o=1;arguments.length>o;)t.push(arguments[o++]);return m[++h]=function(){a("function"==typeof e?e:Function(e),t)},n(h),h},f=function(e){delete m[e]},"process"==o(11)(d)?n=function(e){d.nextTick(s(y,e,1))}:g?(i=(r=new g).port2,r.port1.onmessage=v,n=s(i.postMessage,i,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(n=function(e){c.postMessage(e+"","*")},c.addEventListener("message",v,!1)):n=D in u("script")?function(e){l.appendChild(u("script"))[D]=function(){l.removeChild(this),y.call(e)}}:function(e){setTimeout(s(y,e,1),0)}),e.exports={set:p,clear:f}},function(e,t,o){var n=o(20),r=Math.min;e.exports=function(e){return e>0?r(n(e),9007199254740991):0}},function(e,t,o){var n=o(9);e.exports=function(e,t){if(!n(e))return e;var o,r;if(t&&"function"==typeof(o=e.toString)&&!n(r=o.call(e)))return r;if("function"==typeof(o=e.valueOf)&&!n(r=o.call(e)))return r;if(!t&&"function"==typeof(o=e.toString)&&!n(r=o.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){var o=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++o+n).toString(36))}},function(e,t,o){function n(e){return e&&e.__esModule?e:{default:e}}function r(){return"win32"!==process.platform?"":"ia32"===process.arch&&process.env.hasOwnProperty("PROCESSOR_ARCHITEW6432")?"mixed":"native"}function i(e){return(0,d.createHash)("sha256").update(e).digest("hex")}function s(e){switch(p){case"darwin":return e.split("IOPlatformUUID")[1].split("\n")[0].replace(/\=|\s+|\"/gi,"").toLowerCase();case"win32":return e.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi,"").toLowerCase();case"linux":case"freebsd":return e.toString().replace(/\r+|\n+|\s+/gi,"").toLowerCase();default:throw new Error("Unsupported platform: "+process.platform)}}function a(e){var t=s((0,c.execSync)(f[p]).toString());return e?t:i(t)}function l(e){return new u.default(function(t,o){return(0,c.exec)(f[p],{},function(n,r,a){if(n)return o(new Error("Error while obtaining machine id: "+n.stack));var l=s(r.toString());return t(e?l:i(l))})})}Object.defineProperty(t,"__esModule",{value:!0});var u=n(o(35));t.machineIdSync=a,t.machineId=l;var c=o(70),d=o(71),p=process.platform,f={darwin:"ioreg -rd1 -c IOPlatformExpertDevice",win32:{native:"%windir%\\System32",mixed:"%windir%\\sysnative\\cmd.exe /c %windir%\\System32"}[r()]+"\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",linux:"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :",freebsd:"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid"}},function(e,t,o){e.exports={default:o(36),__esModule:!0}},function(e,t,o){o(66),o(68),o(69),o(67),e.exports=o(6).Promise},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t,o,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(o+": incorrect invocation!");return e}},function(e,t,o){var n=o(13),r=o(31),i=o(62);e.exports=function(e){return function(t,o,s){var a,l=n(t),u=r(l.length),c=i(s,u);if(e&&o!=o){for(;u>c;)if((a=l[c++])!=a)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===o)return e||c||0;return!e&&-1}}},function(e,t,o){var n=o(7),r=o(44),i=o(43),s=o(3),a=o(31),l=o(64),u={},c={};t=e.exports=function(e,t,o,d,p){var f,g,h,m,D=p?function(){return e}:l(e),y=n(o,d,t?2:1),v=0;if("function"!=typeof D)throw TypeError(e+" is not iterable!");if(i(D)){for(f=a(e.length);f>v;v++)if((m=t?y(s(g=e[v])[0],g[1]):y(e[v]))===u||m===c)return m}else for(h=D.call(e);!(g=h.next()).done;)if((m=r(h,y,g.value,t))===u||m===c)return m},t.BREAK=u,t.RETURN=c},function(e,t){e.exports=function(e,t,o){var n=void 0===o;switch(t.length){case 0:return n?e():e.call(o);case 1:return n?e(t[0]):e.call(o,t[0]);case 2:return n?e(t[0],t[1]):e.call(o,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(o,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(o,t[0],t[1],t[2],t[3])}return e.apply(o,t)}},function(e,t,o){var n=o(11);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},function(e,t,o){var n=o(10),r=o(1)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||i[r]===e)}},function(e,t,o){var n=o(3);e.exports=function(e,t,o,r){try{return r?t(n(o)[0],o[1]):t(o)}catch(t){var i=e.return;throw void 0!==i&&n(i.call(e)),t}}},function(e,t,o){var n=o(49),r=o(17),i=o(18),s={};o(5)(s,o(1)("iterator"),function(){return this}),e.exports=function(e,t,o){e.prototype=n(s,{next:r(1,o)}),i(e,t+" Iterator")}},function(e,t,o){var n=o(1)("iterator"),r=!1;try{var i=[7][n]();i.return=function(){r=!0},Array.from(i,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!r)return!1;var o=!1;try{var i=[7],s=i[n]();s.next=function(){return{done:o=!0}},i[n]=function(){return s},e(i)}catch(e){}return o}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,o){var n=o(2),r=o(30).set,i=n.MutationObserver||n.WebKitMutationObserver,s=n.process,a=n.Promise,l="process"==o(11)(s);e.exports=function(){var e,t,o,u=function(){var n,r;for(l&&(n=s.domain)&&n.exit();e;){r=e.fn,e=e.next;try{r()}catch(n){throw e?o():t=void 0,n}}t=void 0,n&&n.enter()};if(l)o=function(){s.nextTick(u)};else if(i){var c=!0,d=document.createTextNode("");new i(u).observe(d,{characterData:!0}),o=function(){d.data=c=!c}}else if(a&&a.resolve){var p=a.resolve();o=function(){p.then(u)}}else o=function(){r.call(n,u)};return function(n){var r={fn:n,next:void 0};t&&(t.next=r),e||(e=r,o()),t=r}}},function(e,t,o){var n=o(3),r=o(50),i=o(22),s=o(19)("IE_PROTO"),a=function(){},l="prototype",u=function(){var e,t=o(16)("iframe"),n=i.length,r=">";for(t.style.display="none",o(25).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object</script"+r),e.close(),u=e.F;n--;)delete u[l][i[n]];return u()};e.exports=Object.create||function(e,t){var o;return null!==e?(a[l]=n(e),o=new a,a[l]=null,o[s]=e):o=u(),void 0===t?o:r(o,t)}},function(e,t,o){var n=o(12),r=o(3),i=o(54);e.exports=o(4)?Object.defineProperties:function(e,t){r(e);for(var o,s=i(t),a=s.length,l=0;a>l;)n.f(e,o=s[l++],t[o]);return e}},function(e,t,o){var n=o(55),r=o(17),i=o(13),s=o(32),a=o(8),l=o(26),u=Object.getOwnPropertyDescriptor;t.f=o(4)?u:function(e,t){if(e=i(e),t=s(t,!0),l)try{return u(e,t)}catch(e){}if(a(e,t))return r(!n.f.call(e,t),e[t])}},function(e,t,o){var n=o(8),r=o(63),i=o(19)("IE_PROTO"),s=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=r(e),n(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?s:null}},function(e,t,o){var n=o(8),r=o(13),i=o(39)(!1),s=o(19)("IE_PROTO");e.exports=function(e,t){var o,a=r(e),l=0,u=[];for(o in a)o!=s&&n(a,o)&&u.push(o);for(;t.length>l;)n(a,o=t[l++])&&(~i(u,o)||u.push(o));return u}},function(e,t,o){var n=o(53),r=o(22);e.exports=Object.keys||function(e){return n(e,r)}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,o){var n=o(5);e.exports=function(e,t,o){for(var r in t)o&&e[r]?e[r]=t[r]:n(e,r,t[r]);return e}},function(e,t,o){e.exports=o(5)},function(e,t,o){var n=o(9),r=o(3),i=function(e,t){if(r(e),!n(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,n){try{(n=o(7)(Function.call,o(51).f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,o){return i(e,o),t?e.__proto__=o:n(e,o),e}}({},!1):void 0),check:i}},function(e,t,o){var n=o(2),r=o(6),i=o(12),s=o(4),a=o(1)("species");e.exports=function(e){var t="function"==typeof r[e]?r[e]:n[e];s&&t&&!t[a]&&i.f(t,a,{configurable:!0,get:function(){return this}})}},function(e,t,o){var n=o(3),r=o(14),i=o(1)("species");e.exports=function(e,t){var o,s=n(e).constructor;return void 0===s||null==(o=n(s)[i])?t:r(o)}},function(e,t,o){var n=o(20),r=o(15);e.exports=function(e){return function(t,o){var i,s,a=String(r(t)),l=n(o),u=a.length;return l<0||l>=u?e?"":void 0:(i=a.charCodeAt(l))<55296||i>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?e?a.charAt(l):i:e?a.slice(l,l+2):s-56320+(i-55296<<10)+65536}}},function(e,t,o){var n=o(20),r=Math.max,i=Math.min;e.exports=function(e,t){return(e=n(e))<0?r(e+t,0):i(e,t)}},function(e,t,o){var n=o(15);e.exports=function(e){return Object(n(e))}},function(e,t,o){var n=o(21),r=o(1)("iterator"),i=o(10);e.exports=o(6).getIteratorMethod=function(e){if(null!=e)return e[r]||e["@@iterator"]||i[n(e)]}},function(e,t,o){var n=o(37),r=o(47),i=o(10),s=o(13);e.exports=o(27)(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,o=this._i++;return!e||o>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?o:"values"==t?e[o]:[o,e[o]])},"values"),i.Arguments=i.Array,n("keys"),n("values"),n("entries")},function(e,t){},function(e,t,o){var n,r,i,s=o(28),a=o(2),l=o(7),u=o(21),c=o(23),d=o(9),p=(o(3),o(14)),f=o(38),g=o(40),h=(o(58).set,o(60)),m=o(30).set,D=o(48)(),y="Promise",v=a.TypeError,F=a.process,b=a[y],_="process"==u(F=a.process),C=function(){},$=!!function(){try{var e=b.resolve(1),t=(e.constructor={})[o(1)("species")]=function(e){e(C,C)};return(_||"function"==typeof PromiseRejectionEvent)&&e.then(C)instanceof t}catch(e){}}(),E=function(e,t){return e===t||e===b&&t===i},w=function(e){var t;return!(!d(e)||"function"!=typeof(t=e.then))&&t},k=function(e){return E(b,e)?new S(e):new r(e)},S=r=function(e){var t,o;this.promise=new e(function(e,n){if(void 0!==t||void 0!==o)throw v("Bad Promise constructor");t=e,o=n}),this.resolve=p(t),this.reject=p(o)},x=function(e){try{e()}catch(e){return{error:e}}},O=function(e,t){if(!e._n){e._n=!0;var o=e._c;D(function(){for(var n=e._v,r=1==e._s,i=0,s=function(t){var o,i,s=r?t.ok:t.fail,a=t.resolve,l=t.reject,u=t.domain;try{s?(r||(2==e._h&&j(e),e._h=1),!0===s?o=n:(u&&u.enter(),o=s(n),u&&u.exit()),o===t.promise?l(v("Promise-chain cycle")):(i=w(o))?i.call(o,a,l):a(o)):l(n)}catch(e){l(e)}};o.length>i;)s(o[i++]);e._c=[],e._n=!1,t&&!e._h&&A(e)})}},A=function(e){m.call(a,function(){var t,o,n,r=e._v;if(I(e)&&(t=x(function(){_?F.emit("unhandledRejection",r,e):(o=a.onunhandledrejection)?o({promise:e,reason:r}):(n=a.console)&&n.error&&n.error("Unhandled promise rejection",r)}),e._h=_||I(e)?2:1),e._a=void 0,t)throw t.error})},I=function(e){if(1==e._h)return!1;for(var t,o=e._a||e._c,n=0;o.length>n;)if((t=o[n++]).fail||!I(t.promise))return!1;return!0},j=function(e){m.call(a,function(){var t;_?F.emit("rejectionHandled",e):(t=a.onrejectionhandled)&&t({promise:e,reason:e._v})})},B=function(e){var t=this;t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),O(t,!0))},N=function(e){var t,o=this;if(!o._d){o._d=!0,o=o._w||o;try{if(o===e)throw v("Promise can't be resolved itself");(t=w(e))?D(function(){var n={_w:o,_d:!1};try{t.call(e,l(N,n,1),l(B,n,1))}catch(e){B.call(n,e)}}):(o._v=e,o._s=1,O(o,!1))}catch(e){B.call({_w:o,_d:!1},e)}}};$||(b=function(e){f(this,b,y,"_h"),p(e),n.call(this);try{e(l(N,this,1),l(B,this,1))}catch(e){B.call(this,e)}},(n=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=o(56)(b.prototype,{then:function(e,t){var o=k(h(this,b));return o.ok="function"!=typeof e||e,o.fail="function"==typeof t&&t,o.domain=_?F.domain:void 0,this._c.push(o),this._a&&this._a.push(o),this._s&&O(this,!1),o.promise},catch:function(e){return this.then(void 0,e)}}),S=function(){var e=new n;this.promise=e,this.resolve=l(N,e,1),this.reject=l(B,e,1)}),c(c.G+c.W+c.F*!$,{Promise:b}),o(18)(b,y),o(59)(y),i=o(6)[y],c(c.S+c.F*!$,y,{reject:function(e){var t=k(this);return(0,t.reject)(e),t.promise}}),c(c.S+c.F*(s||!$),y,{resolve:function(e){if(e instanceof b&&E(e.constructor,this))return e;var t=k(this);return(0,t.resolve)(e),t.promise}}),c(c.S+c.F*!($&&o(46)(function(e){b.all(e).catch(C)})),y,{all:function(e){var t=this,o=k(t),n=o.resolve,r=o.reject,i=x(function(){var o=[],i=0,s=1;g(e,!1,function(e){var a=i++,l=!1;o.push(void 0),s++,t.resolve(e).then(function(e){l||(l=!0,o[a]=e,--s||n(o))},r)}),--s||n(o)});return i&&r(i.error),o.promise},race:function(e){var t=this,o=k(t),n=o.reject,r=x(function(){g(e,!1,function(e){t.resolve(e).then(o.resolve,n)})});return r&&n(r.error),o.promise}})},function(e,t,o){var n=o(61)(!0);o(27)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,o=this._i;return o>=t.length?{value:void 0,done:!0}:(e=n(t,o),this._i+=e.length,{value:e,done:!1})})},function(e,t,o){o(65);for(var n=o(2),r=o(5),i=o(10),s=o(1)("toStringTag"),a=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],l=0;l<5;l++){var u=a[l],c=n[u],d=c&&c.prototype;d&&!d[s]&&r(d,s,u),i[u]=i.Array}},function(e,t){e.exports=o(35317)},function(e,t){e.exports=o(76982)}]))},29122:(e,t,o)=>{o.d(t,{A:()=>r});var n=o(1708);function r(){const{env:e}=n,{TERM:t,TERM_PROGRAM:o}=e;return"win32"!==n.platform?"linux"!==t:Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||"{cmd::Cmder}"===e.ConEmuTask||"Terminus-Sublime"===o||"vscode"===o||"xterm-256color"===t||"alacritty"===t||"rxvt-unicode"===t||"rxvt-unicode-256color"===t||"JetBrains-JediTerm"===e.TERMINAL_EMULATOR}},29557:e=>{e.exports=n},29790:(e,t,o)=>{o.d(t,{default:()=>Y,oraPromise:()=>z,spinners:()=>A}),o.r(t);var n=o(1708),r=o(88568);const i=(e,t,o,n)=>{if("length"===o||"prototype"===o)return;if("arguments"===o||"caller"===o)return;const r=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);!s(r,i)&&n||Object.defineProperty(e,o,i)},s=function(e,t){return void 0===e||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},a=(e,t)=>`/* Wrapped ${e}*/\n${t}`,l=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),u=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");function c(e,t,{ignoreNonConfigurable:o=!1}={}){const{name:n}=e;for(const n of Reflect.ownKeys(t))i(e,t,n,o);return((e,t)=>{const o=Object.getPrototypeOf(t);o!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,o)})(e,t),((e,t,o)=>{const n=""===o?"":`with ${o.trim()}() `,r=a.bind(null,n,t.toString());Object.defineProperty(r,"name",u);const{writable:i,enumerable:s,configurable:c}=l;Object.defineProperty(e,"toString",{value:r,writable:i,enumerable:s,configurable:c})})(e,t,n),e}const d=new WeakMap,p=(e,t={})=>{if("function"!=typeof e)throw new TypeError("Expected a function");let o,n=0;const r=e.displayName||e.name||"<anonymous>",i=function(...s){if(d.set(i,++n),1===n)o=e.apply(this,s),e=void 0;else if(!0===t.throw)throw new Error(`Function \`${r}\` can only be called once`);return o};return c(i,e),d.set(i,n),i};p.callCount=e=>{if(!d.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return d.get(e)};const f=p,g=[];g.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&g.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),"linux"===process.platform&&g.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const h=e=>!!e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on,m=Symbol.for("signal-exit emitter"),D=globalThis,y=Object.defineProperty.bind(Object);class v{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(D[m])return D[m];y(D,m,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){const o=this.listeners[e],n=o.indexOf(t);-1!==n&&(0===n&&1===o.length?o.length=0:o.splice(n,1))}emit(e,t,o){if(this.emitted[e])return!1;this.emitted[e]=!0;let n=!1;for(const r of this.listeners[e])n=!0===r(t,o)||n;return"exit"===e&&(n=this.emit("afterExit",t,o)||n),n}}class F{}const b=globalThis.process,{onExit:_,load:C,unload:$}=(E=h(b)?new class extends F{#e="win32"===b.platform?"SIGINT":"SIGHUP";#t=new v;#o;#n;#r;#i={};#s=!1;constructor(e){super(),this.#o=e,this.#i={};for(const t of g)this.#i[t]=()=>{const o=this.#o.listeners(t);let{count:n}=this.#t;const r=e;if("object"==typeof r.__signal_exit_emitter__&&"number"==typeof r.__signal_exit_emitter__.count&&(n+=r.__signal_exit_emitter__.count),o.length===n){this.unload();const o=this.#t.emit("exit",null,t),n="SIGHUP"===t?this.#e:t;o||e.kill(e.pid,n)}};this.#r=e.reallyExit,this.#n=e.emit}onExit(e,t){if(!h(this.#o))return()=>{};!1===this.#s&&this.load();const o=t?.alwaysLast?"afterExit":"exit";return this.#t.on(o,e),()=>{this.#t.removeListener(o,e),0===this.#t.listeners.exit.length&&0===this.#t.listeners.afterExit.length&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#t.count+=1;for(const e of g)try{const t=this.#i[e];t&&this.#o.on(e,t)}catch(e){}this.#o.emit=(e,...t)=>this.#a(e,...t),this.#o.reallyExit=e=>this.#l(e)}}unload(){this.#s&&(this.#s=!1,g.forEach(e=>{const t=this.#i[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#o.removeListener(e,t)}catch(e){}}),this.#o.emit=this.#n,this.#o.reallyExit=this.#r,this.#t.count-=1)}#l(e){return h(this.#o)?(this.#o.exitCode=e||0,this.#t.emit("exit",this.#o.exitCode,null),this.#r.call(this.#o,this.#o.exitCode)):0}#a(e,...t){const o=this.#n;if("exit"===e&&h(this.#o)){"number"==typeof t[0]&&(this.#o.exitCode=t[0]);const n=o.call(this.#o,e,...t);return this.#t.emit("exit",this.#o.exitCode,null),n}return o.call(this.#o,e,...t)}}(b):new class extends F{onExit(){return()=>{}}load(){}unload(){}},{onExit:(e,t)=>E.onExit(e,t),load:()=>E.load(),unload:()=>E.unload()});var E;const w=n.stderr.isTTY?n.stderr:n.stdout.isTTY?n.stdout:void 0,k=w?f(()=>{_(()=>{w.write("[?25h")},{alwaysLast:!0})}):()=>{};let S=!1;const x={show:(e=n.stderr)=>{e.isTTY&&(S=!1,e.write("[?25h"))},hide:(e=n.stderr)=>{e.isTTY&&(k(),S=!0,e.write("[?25l"))},toggle:(e,t)=>{void 0!==e&&(S=e),S?x.show(t):x.hide(t)}},O=x;var A=o(47661);const I={info:r.default.blue("ℹ"),success:r.default.green("✔"),warning:r.default.yellow("⚠"),error:r.default.red("✖")},j={info:r.default.blue("i"),success:r.default.green("√"),warning:r.default.yellow("‼"),error:r.default.red("×")},B=("win32"!==n.platform?"linux"!==n.env.TERM:Boolean(n.env.CI)||Boolean(n.env.WT_SESSION)||Boolean(n.env.TERMINUS_SUBLIME)||"{cmd::Cmder}"===n.env.ConEmuTask||"Terminus-Sublime"===n.env.TERM_PROGRAM||"vscode"===n.env.TERM_PROGRAM||"xterm-256color"===n.env.TERM||"alacritty"===n.env.TERM||"JetBrains-JediTerm"===n.env.TERMINAL_EMULATOR)?I:j;const N=function({onlyFirst:e=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")}();function T(e){if("string"!=typeof e)throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(N,"")}function P(e){return 161===e||164===e||167===e||168===e||170===e||173===e||174===e||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||198===e||208===e||215===e||216===e||e>=222&&e<=225||230===e||e>=232&&e<=234||236===e||237===e||240===e||242===e||243===e||e>=247&&e<=250||252===e||254===e||257===e||273===e||275===e||283===e||294===e||295===e||299===e||e>=305&&e<=307||312===e||e>=319&&e<=322||324===e||e>=328&&e<=331||333===e||338===e||339===e||358===e||359===e||363===e||462===e||464===e||466===e||468===e||470===e||472===e||474===e||476===e||593===e||609===e||708===e||711===e||e>=713&&e<=715||717===e||720===e||e>=728&&e<=731||733===e||735===e||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||1025===e||e>=1040&&e<=1103||1105===e||8208===e||e>=8211&&e<=8214||8216===e||8217===e||8220===e||8221===e||e>=8224&&e<=8226||e>=8228&&e<=8231||8240===e||8242===e||8243===e||8245===e||8251===e||8254===e||8308===e||8319===e||e>=8321&&e<=8324||8364===e||8451===e||8453===e||8457===e||8467===e||8470===e||8481===e||8482===e||8486===e||8491===e||8531===e||8532===e||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||8585===e||e>=8592&&e<=8601||8632===e||8633===e||8658===e||8660===e||8679===e||8704===e||8706===e||8707===e||8711===e||8712===e||8715===e||8719===e||8721===e||8725===e||8730===e||e>=8733&&e<=8736||8739===e||8741===e||e>=8743&&e<=8748||8750===e||e>=8756&&e<=8759||8764===e||8765===e||8776===e||8780===e||8786===e||8800===e||8801===e||e>=8804&&e<=8807||8810===e||8811===e||8814===e||8815===e||8834===e||8835===e||8838===e||8839===e||8853===e||8857===e||8869===e||8895===e||8978===e||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||9632===e||9633===e||e>=9635&&e<=9641||9650===e||9651===e||9654===e||9655===e||9660===e||9661===e||9664===e||9665===e||e>=9670&&e<=9672||9675===e||e>=9678&&e<=9681||e>=9698&&e<=9701||9711===e||9733===e||9734===e||9737===e||9742===e||9743===e||9756===e||9758===e||9792===e||9794===e||9824===e||9825===e||e>=9827&&e<=9829||e>=9831&&e<=9834||9836===e||9837===e||9839===e||9886===e||9887===e||9919===e||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||9955===e||9960===e||9961===e||e>=9963&&e<=9969||9972===e||e>=9974&&e<=9977||9979===e||9980===e||9982===e||9983===e||10045===e||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||65533===e||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||127375===e||127376===e||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function M(e){return 12288===e||e>=65281&&e<=65376||e>=65504&&e<=65510}function R(e){return e>=4352&&e<=4447||8986===e||8987===e||9001===e||9002===e||e>=9193&&e<=9196||9200===e||9203===e||9725===e||9726===e||9748===e||9749===e||e>=9776&&e<=9783||e>=9800&&e<=9811||9855===e||e>=9866&&e<=9871||9875===e||9889===e||9898===e||9899===e||9917===e||9918===e||9924===e||9925===e||9934===e||9940===e||9962===e||9970===e||9971===e||9973===e||9978===e||9981===e||9989===e||9994===e||9995===e||10024===e||10060===e||10062===e||e>=10067&&e<=10069||10071===e||e>=10133&&e<=10135||10160===e||10175===e||11035===e||11036===e||11088===e||11093===e||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||110589===e||110590===e||e>=110592&&e<=110882||110898===e||e>=110928&&e<=110930||110933===e||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||126980===e||127183===e||127374===e||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||127568===e||127569===e||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||127988===e||e>=127992&&e<=128062||128064===e||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||128378===e||128405===e||128406===e||128420===e||e>=128507&&e<=128591||e>=128640&&e<=128709||128716===e||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||128747===e||128748===e||e>=128756&&e<=128764||e>=128992&&e<=129003||129008===e||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||129736===e||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function U(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function L(e,{ambiguousAsWide:t=!1}={}){return U(e),M(e)||R(e)||t&&P(e)?2:1}const J=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g,q=new Intl.Segmenter,V=/^\p{Default_Ignorable_Code_Point}$/u;function G(e,t={}){if("string"!=typeof e||0===e.length)return 0;const{ambiguousIsNarrow:o=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=T(e)),0===e.length)return 0;let r=0;const i={ambiguousAsWide:!o};for(const{segment:t}of q.segment(e)){const e=t.codePointAt(0);e<=31||e>=127&&e<=159||(e>=8203&&e<=8207||65279===e||e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=55296&&e<=57343||e>=65024&&e<=65039||V.test(t)||(J().test(t)?r+=2:r+=L(e,i)))}return r}var W=o(29122);const H=new class{#u=0;start(){this.#u++,1===this.#u&&this.#c()}stop(){if(this.#u<=0)throw new Error("`stop` called more times than `start`");this.#u--,0===this.#u&&this.#d()}#c(){"win32"!==n.platform&&n.stdin.isTTY&&(n.stdin.setRawMode(!0),n.stdin.on("data",this.#p),n.stdin.resume())}#d(){n.stdin.isTTY&&(n.stdin.off("data",this.#p),n.stdin.pause(),n.stdin.setRawMode(!1))}#p(e){3===e[0]&&n.emit("SIGINT")}};class K{#f=0;#g=!1;#h=0;#m=-1;#D=0;#y;#v;#F;#b;#_;#C;#$;#E;#w;#k;#S;color;constructor(e){"string"==typeof e&&(e={text:e}),this.#y={color:"cyan",stream:n.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#y.color,this.spinner=this.#y.spinner,this.#_=this.#y.interval,this.#F=this.#y.stream,this.#C="boolean"==typeof this.#y.isEnabled?this.#y.isEnabled:function({stream:e=process.stdout}={}){return Boolean(e&&e.isTTY&&"dumb"!==process.env.TERM&&!("CI"in process.env))}({stream:this.#F}),this.#$="boolean"==typeof this.#y.isSilent&&this.#y.isSilent,this.text=this.#y.text,this.prefixText=this.#y.prefixText,this.suffixText=this.#y.suffixText,this.indent=this.#y.indent}get indent(){return this.#E}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#E=e,this.#x()}get interval(){return this.#_??this.#v.interval??100}get spinner(){return this.#v}set spinner(e){if(this.#m=-1,this.#_=void 0,"object"==typeof e){if(void 0===e.frames)throw new Error("The given spinner must have a `frames` property");this.#v=e}else if((0,W.A)())if(void 0===e)this.#v=A.dots;else{if("default"===e||!A[e])throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);this.#v=A[e]}else this.#v=A.line}get text(){return this.#w}set text(e=""){this.#w=e,this.#x()}get prefixText(){return this.#k}set prefixText(e=""){this.#k=e,this.#x()}get suffixText(){return this.#S}set suffixText(e=""){this.#S=e,this.#x()}get isSpinning(){return void 0!==this.#b}#O(e=this.#k,t=" "){return"string"==typeof e&&""!==e?e+t:"function"==typeof e?e()+t:""}#A(e=this.#S,t=" "){return"string"==typeof e&&""!==e?t+e:"function"==typeof e?t+e():""}#x(){const e=this.#F.columns??80,t=this.#O(this.#k,"-"),o=this.#A(this.#S,"-"),n=" ".repeat(this.#E)+t+"--"+this.#w+"--"+o;this.#h=0;for(const t of T(n).split("\n"))this.#h+=Math.max(1,Math.ceil(G(t,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#C&&!this.#$}set isEnabled(e){if("boolean"!=typeof e)throw new TypeError("The `isEnabled` option must be a boolean");this.#C=e}get isSilent(){return this.#$}set isSilent(e){if("boolean"!=typeof e)throw new TypeError("The `isSilent` option must be a boolean");this.#$=e}frame(){const e=Date.now();(-1===this.#m||e-this.#D>=this.interval)&&(this.#m=++this.#m%this.#v.frames.length,this.#D=e);const{frames:t}=this.#v;let o=t[this.#m];this.color&&(o=r.default[this.color](o));return("string"==typeof this.#k&&""!==this.#k?this.#k+" ":"")+o+("string"==typeof this.text?" "+this.text:"")+("string"==typeof this.#S&&""!==this.#S?" "+this.#S:"")}clear(){if(!this.#C||!this.#F.isTTY)return this;this.#F.cursorTo(0);for(let e=0;e<this.#f;e++)e>0&&this.#F.moveCursor(0,-1),this.#F.clearLine(1);return(this.#E||this.lastIndent!==this.#E)&&this.#F.cursorTo(this.#E),this.lastIndent=this.#E,this.#f=0,this}render(){return this.#$||(this.clear(),this.#F.write(this.frame()),this.#f=this.#h),this}start(e){return e&&(this.text=e),this.#$?this:this.#C?(this.isSpinning||(this.#y.hideCursor&&O.hide(this.#F),this.#y.discardStdin&&n.stdin.isTTY&&(this.#g=!0,H.start()),this.render(),this.#b=setInterval(this.render.bind(this),this.interval)),this):(this.text&&this.#F.write(`- ${this.text}\n`),this)}stop(){return this.#C?(clearInterval(this.#b),this.#b=void 0,this.#m=0,this.clear(),this.#y.hideCursor&&O.show(this.#F),this.#y.discardStdin&&n.stdin.isTTY&&this.#g&&(H.stop(),this.#g=!1),this):this}succeed(e){return this.stopAndPersist({symbol:B.success,text:e})}fail(e){return this.stopAndPersist({symbol:B.error,text:e})}warn(e){return this.stopAndPersist({symbol:B.warning,text:e})}info(e){return this.stopAndPersist({symbol:B.info,text:e})}stopAndPersist(e={}){if(this.#$)return this;const t=e.prefixText??this.#k,o=this.#O(t," "),n=e.symbol??" ",r=e.text??this.text,i="string"==typeof r?(n?" ":"")+r:"",s=e.suffixText??this.#S,a=o+n+i+this.#A(s," ")+"\n";return this.stop(),this.#F.write(a),this}}function Y(e){return new K(e)}async function z(e,t){const o="function"==typeof e,n="function"==typeof e.then;if(!o&&!n)throw new TypeError("Parameter `action` must be a Function or a Promise");const{successText:r,failText:i}="object"==typeof t?t:{successText:void 0,failText:void 0},s=Y(t).start();try{const t=o?e(s):e,n=await t;return s.succeed(void 0===r?void 0:"string"==typeof r?r:r(n)),n}catch(e){throw s.fail(void 0===i?void 0:"string"==typeof i?i:i(e)),e}}},31421:e=>{e.exports=t("node:child_process")},34528:(e,t,o)=>{o.d(t,{p:()=>C});var n,r,i,s,a,l,u,c=o(68832),d=o(99436),p=o(35679),f=o(88568),g=o(29790),h=o(34992),m=o(88055),D=o(75706),y=o(6939),v=3e5,F=e=>{if(!e)return f.default.gray("○");var t=Date.now()-new Date(e).getTime();return t<=v?f.default.green("●"):Math.floor(t/6e4)<60?f.default.yellow("○"):f.default.red("○")},b=(e,t)=>(0,y.H_)(e,t,{deviceCount:e?.devices?.length||0}),_=["refresh","clear-cache","system-menu-open","system-menu-close","system-info-open","system-info-close","local-sync-panel-open","local-sync-panel-close","debug-panel-open","debug-panel-close","logging-on","logging-off","test-panel-open","test-panel-close"],C=new p.uB("group").description("Device Group management");C.command("list").description("List all device groups").option("-j, --json","Output as JSON").action((n=d(function*(e){var t=(0,m.requireAuth)(),o=(0,g.default)("Fetching device groups...").start();try{var n=yield t.deviceGroups({});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(f.default.yellow("No device groups found"));console.log(f.default.bold("\nDevice Groups")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.devices?.length||0;console.log(`● ${f.default.cyan(e.name)} ${f.default.gray(`(${t} devices)`)}`),console.log(` ID: ${f.default.gray(e._id)}`),e.description&&console.log(` ${f.default.gray(e.description)}`),console.log()})}catch(e){o.fail(`Failed to list groups: ${e.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),C.command("get <id>").description("Get device group details").option("-j, --json","Output as JSON").action((r=d(function*(e,t){var o=(0,m.requireAuth)(),n=(0,g.default)("Fetching device group...").start();try{var r=yield o.deviceGroup({id:e});if(n.stop(),r||(console.log(f.default.red("Device group not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));console.log(f.default.bold(`\nDevice Group: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${f.default.gray(r._id)}`),console.log(`Description: ${r.description||f.default.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||f.default.gray("None")}`),console.log(`Created: ${f.default.gray(r.create_datetime)}`),console.log(`Modified: ${f.default.gray(r.last_modify_datetime)}`),r.devices?.length>0&&(console.log(`\n${f.default.bold("Devices")} (${r.devices.length})`),r.devices.forEach(e=>{var t=e.device_target_name||e.device_id;console.log(` - ${t} ${f.default.gray(`(${e.device_id})`)}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get group: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),C.command("resolve <query>").description("Resolve a device group name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((i=d(function*(e,t){var o=(0,m.requireAuth)(),n=t.json?null:(0,g.default)("Resolving device group...").start();try{var r=yield(0,D.Y)(()=>o.deviceGroup({id:e})),i=r?[r]:yield o.deviceGroups({paginate:{limit:t.limit}}),s=r?i:(i||[]).filter(t=>t.name?.toLowerCase().includes(e.trim().toLowerCase())),a=(0,D.K)({resource:"group",query:e,items:s||[],fields:["_id","name"],selectedBy:r?"id":null});if(n&&n.stop(),t.json)return void(0,h.GF)(a);if(a.resolved){var l=a.resolved;return console.log(f.default.bold("\nResolved Device Group")),console.log("─".repeat(60)),console.log(`Name: ${f.default.cyan(l.name||"Unnamed")}`),console.log(`ID: ${f.default.gray(l._id)}`),console.log(`Selected By: ${a.selectedBy}`),void console.log("─".repeat(60))}if(0===a.matches.length)return void console.log(f.default.yellow(`No device groups matched "${e}"`));console.log(f.default.bold(`\nMatching Device Groups (${a.matches.length})`)),console.log("─".repeat(80)),a.matches.forEach(e=>{console.log(`${f.default.cyan(e.name||"Unnamed")} ${f.default.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){n?n.fail(`Failed to resolve device group: ${t.message}`):(0,h.OW)(t.message,{resource:"group",query:e}),process.exit(1)}}),function(e,t){return i.apply(this,arguments)})),C.command("devices <id>").description("List devices in a group with status").option("-j, --json","Output as JSON").action((s=d(function*(e,t){var o=(0,m.requireAuth)(),n=(0,g.default)("Fetching devices...").start();try{var r=yield o.devicesByGroup({id:e});if(n.stop(),t.json)return void console.log(JSON.stringify(r,null,2));if(!r||0===r.length)return void console.log(f.default.yellow("No devices in this group"));console.log(f.default.bold("\nDevices in Group")),console.log("─".repeat(80)),r.forEach(e=>{var t=e.device||{},o=t.entry_detail?.watch_dog_timer?.last_alive_time,n=F(o),r=t.name||t.device_name||e.target_name||t._id||"Unknown",i=t.entry_detail?.application?.name||f.default.gray("No app");console.log(`${n} ${f.default.cyan(r.padEnd(30))} ${i}`)}),console.log("─".repeat(80))}catch(e){n.fail(`Failed to get devices: ${e.message}`),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),C.command("dispatch <id> <action>").description("Dispatch action to all devices in group").option("--dry-run","Validate inputs and show the dispatch plan without sending it").option("-j, --json","Output as JSON").action((a=d(function*(e,t,o){var n=(0,m.requireAuth)(),r=o.json?null:(0,g.default)(`Dispatching ${t}...`).start();_.includes(t)||(o.json?(0,h.OW)(`Invalid action. Valid actions: ${_.join(", ")}`,{action:"group.dispatch",target:{id:e}}):r.fail(`Invalid action. Valid actions: ${_.join(", ")}`),process.exit(1));try{var i=yield n.deviceGroup({id:e});if(!i)throw new Error("Device group not found");if(o.dryRun)return r&&r.stop(),void(0,y.S5)({action:"group.dispatch",target:b(i,e),request:{action:t},checks:[(0,y.Iy)("group exists",!0,`${i.name} (${i._id})`),(0,y.Iy)("action is valid",!0)],json:o.json});var s=yield n.dispatchDeviceGroupAction({id:e,action:t});o.json?(0,y.yd)({action:"group.dispatch",target:b(i,e),result:{action:t,dispatched:s?.dispatched||0,devices:s?.devices||0},json:!0}):(r.succeed(`Action dispatched: ${f.default.green(t)}`),s&&(console.log(`Dispatched: ${f.default.green(s.dispatched||0)}`),console.log(`Devices: ${f.default.gray(s.devices||0)}`)))}catch(t){o.json?(0,h.OW)(t.message,{action:"group.dispatch",target:{id:e}}):r.fail(`Failed to dispatch action: ${t.message}`),process.exit(1)}}),function(e,t,o){return a.apply(this,arguments)})),C.command("refresh <id>").description("Refresh all devices in group").option("--dry-run","Validate inputs and show the refresh plan without sending it").option("-j, --json","Output as JSON").action((l=d(function*(e,t){var o=(0,m.requireAuth)(),n=t.json?null:(0,g.default)("Refreshing devices...").start();try{var r=yield o.deviceGroup({id:e});if(!r)throw new Error("Device group not found");if(t.dryRun)return n&&n.stop(),void(0,y.S5)({action:"group.refresh",target:b(r,e),request:{action:"refresh"},checks:[(0,y.Iy)("group exists",!0,`${r.name} (${r._id})`)],json:t.json});var i=yield o.dispatchDeviceGroupAction({id:e,action:"refresh"});t.json?(0,y.yd)({action:"group.refresh",target:b(r,e),result:{dispatched:i?.dispatched||0,devices:i?.devices||0},json:!0}):(n.succeed("Devices refreshed"),i&&(console.log(`Dispatched: ${f.default.green(i.dispatched||0)}`),console.log(`Devices: ${f.default.gray(i.devices||0)}`)))}catch(o){t.json?(0,h.OW)(o.message,{action:"group.refresh",target:{id:e}}):n.fail(`Failed to refresh: ${o.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),C.command("monitor <id>").description("Monitor devices in group (polls every 60s)").option("-i, --interval <seconds>","Polling interval in seconds","60").action((u=d(function*(e,t){var o=(0,m.requireAuth)(),n=1e3*parseInt(t.interval,10);console.log(f.default.bold("\nDevice Group Monitor")),console.log(f.default.gray(`Polling every ${t.interval}s. Press Ctrl+C to stop.\n`));var r,i=(r=d(function*(){try{var t=yield Promise.all([o.deviceGroup({id:e}),o.devicesByGroup({id:e})]),n=c(t,2),r=n[0],i=n[1];if(process.stdout.write("[2J[0f"),console.log(f.default.bold(`Device Group: ${r.name}`)+f.default.gray(` - ${(new Date).toLocaleTimeString()}`)),console.log("─".repeat(80)),!i||0===i.length)return void console.log(f.default.yellow("No devices in this group"));var s=0,a=0;i.forEach(e=>{var t=e.device||{},o=t.entry_detail?.watch_dog_timer?.last_alive_time,n=F(o),r=t.name||t.device_name||e.target_name||t._id||"Unknown",i=t.entry_detail?.application?.name||f.default.gray("No app");o&&Date.now()-new Date(o).getTime()<=v?s++:a++,console.log(`${n} ${f.default.cyan(r.padEnd(30))} ${i}`)}),console.log("─".repeat(80)),console.log(`Online: ${f.default.green(s)} Offline: ${f.default.red(a)}`),console.log(`\n${f.default.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(f.default.red(`Error: ${e.message}`))}}),function(){return r.apply(this,arguments)});yield i(),setInterval(i,n)}),function(e,t){return u.apply(this,arguments)}))},34992:(e,t,o)=>{o.d(t,{$l:()=>i,GF:()=>n,OW:()=>r});var n=e=>{console.log(JSON.stringify(e,null,2))},r=(e,t={})=>{console.error(JSON.stringify({ok:!1,error:{message:e,...t}},null,2))},i=(e,t=4)=>e?e.length<=2*t?"*".repeat(e.length):`${e.slice(0,t)}…${e.slice(-t)}`:null},35317:e=>{e.exports=t("child_process")},35679:(e,t,o)=>{o.d(t,{DM:()=>r,uB:()=>d});var n=o(65181);const{DM:r,gu:i,er:s,Ww:a,b7:l,Di:u,a2:c,uB:d,ef:p,c$:f,_V:g}=n},35704:(e,t,o)=>{o.d(t,{V:()=>i});var n={S:"Subspace",B:"Brick",C:"Canvas",A:"Animation",G:"Generator",D:"Data",F:"Data Calc",N:"Calc Node",T:"Test",TC:"Test Case",AT:"Automation Map"},r=e=>e?.split("_")?.[0]||"",i=(e,{keyword:t,types:o}={})=>{var i=t?.trim().toLowerCase()||"",s=o?.length>0?new Set(o.flatMap(e=>{var t=String(e).trim().toUpperCase();return t?[t]:[]})):null,a=Object.entries(e||{}).filter(([,e])=>e&&!e.hide).filter(([e,t])=>{var o=r(e);if(s&&!s.has(o))return!1;if(!i)return!0;var n=t?.title?String(t.title).toLowerCase():"";return e.toLowerCase().includes(i)||n.includes(i)}).reduce((e,[t,o])=>{var n=r(t);return e[n]||(e[n]=[]),e[n].push({shortId:t,ref:o}),e},{});return Object.entries(a).map(([e,t])=>({prefix:e,label:n[e]||e,refs:t.sort((e,t)=>{var o=e.ref?.title||e.shortId,n=t.ref?.title||t.shortId;return String(o).localeCompare(String(n))})})).sort((e,t)=>e.label.localeCompare(t.label))}},37067:e=>{e.exports=t("node:http")},39023:e=>{e.exports=t("util")},40610:e=>{e.exports=t("node:dns")},41314:e=>{e.exports=t("node:dgram")},41762:(e,t,o)=>{const{InvalidArgumentError:n}=o(43823);t.Argument=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},t.humanReadableArgName=function(e){const t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"}},42613:e=>{e.exports=t("assert")},43106:e=>{e.exports=t("zlib")},43823:(e,t)=>{class o extends Error{constructor(e,t,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}t.CommanderError=o,t.InvalidArgumentError=class extends o{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}},44708:e=>{e.exports=t("node:https")},47661:(e,t,o)=>{const n=Object.assign({},o(3900)),r=Object.keys(n);Object.defineProperty(n,"random",{get(){const e=Math.floor(Math.random()*r.length),t=r[e];return n[t]}}),e.exports=n},48161:e=>{e.exports=t("node:os")},51455:e=>{e.exports=t("node:fs/promises")},51649:(e,t,o)=>{e.exports=(e=>{var t={};return o.d(t,e),t})({createElement:()=>r.createElement,default:()=>r.default,useCallback:()=>r.useCallback,useEffect:()=>r.useEffect,useRef:()=>r.useRef,useState:()=>r.useState})},52018:e=>{e.exports=t("tty")},57975:e=>{e.exports=t("node:util")},58611:e=>{e.exports=t("http")},59138:(e,t,o)=>{o.d(t,{i:()=>n});var n=()=>"undefined"!=typeof module&&"function"==typeof module.require?module.require("../gql/client.js"):Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(700)]).then(o.bind(o,50700))},59726:(e,t,o)=>{o.d(t,{gf:()=>w});var n,r,i,s,a,l,u,c=o(68832),d=o(99436),p=o(35679),f=o(88568),g=o(51455),h=o(76760),m=o(12044),D=(n=d(function*(e,t,o=3e3){var n;try{var r=new AbortController;n=setTimeout(()=>r.abort(),o);var i=yield fetch(`http://${e}:${t}/json/list`,{signal:r.signal});return i.ok?yield i.json():null}catch{return null}finally{void 0!==n&&clearTimeout(n)}}),function(e,t){return n.apply(this,arguments)}),y=e=>{if(!e)return null;var t=e.match(/\/ws\/(.+)$/);return t?decodeURIComponent(t[1]):null},v=(r=d(function*(e,t=1e3){for(var o=[],n=e,r=0;r<10;r++){var i=h.join(n,".bricks","devtools.json");try{var s=yield g.readFile(i,"utf8"),a=JSON.parse(s),l=yield(0,m.verifyDevToolsServer)(a.address||"localhost",a.port,t);l&&o.push({name:a.name||"BRICKS Preview (CTOR Preview)",address:a.address||"localhost",port:a.port,protocols:["cdp"],hasPasscode:!1,source:"project",projectPath:n,...l})}catch{}var u=h.dirname(n);if(u===n)break;n=u}return o}),function(e){return r.apply(this,arguments)}),F=(i=d(function*({timeout:e=3e3,verify:t=!1,udpOnly:o=!1,project:n=!0,port:r=19851,cwd:i=process.cwd(),onStatus:s}={}){var a,l,u=(0,m.discoverDevToolsServers)({timeout:e,idleTimeout:800}),p=o?Promise.resolve([]):(s?.("Scanning via UDP + HTTP probe..."),(0,m.httpProbeSubnet)({port:r,timeout:e})),f=n?v(i,1e3):Promise.resolve([]),g=yield Promise.all([u,p,f]),h=c(g,3),F=(e=>{var t=new Map;for(var o of e){var n=o.deviceId||`${o.address}:${o.port}`,r=t.get(n);if(r){for(var i of(r.addresses.includes(o.address)||r.addresses.push(o.address),"127.0.0.1"===r.address&&"127.0.0.1"!==o.address&&(r.address=o.address),o.protocols||[]))r.protocols.includes(i)||r.protocols.push(i);for(var s of Object.entries(o)){var a=c(s,2),l=a[0],u=a[1];null!=u&&"address"!==l&&"addresses"!==l&&"protocols"!==l&&(void 0!==r[l]&&null!==r[l]||(r[l]=u))}}else t.set(n,{...o,addresses:[o.address],protocols:[...o.protocols||[]]})}return[...t.values()]})([...h[0],...h[1],...h[2]]);if(0===F.length)return[];if(t){s?.(`Verifying ${F.length} server(s)...`);var b=yield Promise.all(F.map((a=d(function*(e){var t=yield(0,m.verifyDevToolsServer)(e.address,e.port);return{...e,verified:!!t,version:t?.version||e.version}}),function(e){return a.apply(this,arguments)})));F.splice(0,F.length,...b)}return s?.("Checking chrome://inspect support..."),yield Promise.all(F.map((l=d(function*(e){var t=yield D(e.address,e.port);if(t){e.chromeInspect=!0;var o=y(t[0]?.webSocketDebuggerUrl);o&&(e.passcode=o)}}),function(e){return l.apply(this,arguments)}))),F}),function(){return i.apply(this,arguments)}),b="2.24",_="19851",C="127.0.0.1",$=e=>{if(!e)return{host:void 0,port:void 0};var t=e.match(/^\[([^\]]+)\](?::(\d+))?$/);if(t)return{host:t[1],port:t[2]};var o=e.lastIndexOf(":");if(o>0&&e.indexOf(":")===o){var n=e.slice(o+1);if(/^\d+$/.test(n))return{host:e.slice(0,o),port:n}}return{host:e,port:void 0}},E=e=>{if(!e)return!1;for(var t=e.replace(/^v/,"").split(".").map(Number),o=b.split(".").map(Number),n=0;n<o.length;n++){if((t[n]||0)>o[n])return!0;if((t[n]||0)<o[n])return!1}return!0},w=new p.uB("devtools").description("DevTools server discovery, inspection, and CDP commands").option("-a, --address <address>",`DevTools server address, host or host:port (default: ${C})`).option("-p, --port <port>",`Server port for CDP commands (default: ${_})`).option("--passcode <passcode>","Device passcode for CDP commands"),k=e=>e.option("-a, --address <address>","DevTools server address, host or host:port").option("-p, --port <port>",`Server port (default: ${_})`).option("--passcode <passcode>","Device passcode").option("-j, --json","Output as JSON"),S=function(){var e=d(function*(e,t){var n,r=(yield Promise.resolve().then(o.bind(o,29790))).default,i=(yield Promise.resolve().then(o.bind(o,12044))).verifyDevToolsServer,s=(yield o.e(999).then(o.bind(o,12999))).createCdpClient,a=(e=>{var t=w.opts(),o=e.address??t.address,n=$(o);return{...e,address:n.host??C,port:e.port??t.port??n.port??_,passcode:e.passcode??t.passcode}})(e),l=parseInt(a.port,10),u=r("Connecting to DevTools...").start();try{var c=yield i(a.address,l);c||(u.fail(`Cannot reach DevTools server at ${a.address}:${l}`),process.exit(1)),c.version&&!E(c.version)&&(u.fail(`CDP requires app version >= ${b} (device: ${c.version})`),process.exit(1)),n=s(a.address,l,a.passcode),yield n.connect(),u.stop(),yield t(n)}catch(e){u.isSpinning&&u.stop(),console.error(f.default.red(e.message)),process.exit(1)}finally{n?.close()}});return function(t,o){return e.apply(this,arguments)}}(),x=({subspaceId:e,handler:t,action:o,parameters:n,property:r,waitAsync:i,sync:s})=>{var a={handler:t,action:o};return void 0!==n&&(a.parameters=n),void 0!==r&&(a.property=r),void 0!==i&&(a.waitAsync=i),void 0!==s&&(a.sync=s),`(() => {\n const systemRef = globalThis.system\n if (!systemRef?.executeAction) throw new Error('BRICKS DevTools system actions are unavailable')\n const subspaceId = ${e?JSON.stringify(e):"(Object.keys(globalThis.system?.subspaces?.() || {})[0] || '')"}\n if (!subspaceId) throw new Error('No BRICKS subspace is available')\n return systemRef.executeAction(subspaceId, ${JSON.stringify(a)})\n})()`},O=/^\d+$/,A=e=>"string"==typeof e&&O.test(e),I=function(){var e=d(function*(e,t){yield e.send("DOM.enable");var o=yield e.send("DOM.resolveNode",{nodeId:Number(t)}),n=o?.object;if(!n)throw new Error(`Node ${t} not found`);if("value"in n)return n.value;if(!n.objectId)throw new Error(`Node ${t} did not resolve to metadata`);var r=yield e.send("Runtime.getProperties",{objectId:n.objectId,ownProperties:!0}),i=r.result,s=void 0===i?[]:i,a=r.exceptionDetails;if(a)throw new Error(a.text||`Cannot read node ${t}`);return s.reduce((e,t)=>(e[t.name]=(e=>{if(e)return"value"in e?e.value:e.unserializableValue||e.description})(t.value),e),{})});return function(t,o){return e.apply(this,arguments)}}(),j=(s=d(function*(e,{subspaceId:t,brickId:o}){var n=t,r=o,i={};if(A(t)){var s=yield I(e,t);if(n=s.subspaceId||(String(s.shortId||"").startsWith("S_")?s.shortId:null),i.subspaceNodeId=Number(t),!n)throw new Error(`Node ${t} is not inside a BRICKS subspace`)}if(A(o)){var a=yield I(e,o);if(r=a.brickId||(String(a.shortId||"").startsWith("B_")?a.shortId:null),!A(t)&&a.subspaceId&&(n=a.subspaceId),i.brickNodeId=Number(o),!r)throw new Error(`Node ${o} is not a BRICKS brick`)}return{subspaceId:n,brickId:r,...i}}),function(e,t){return s.apply(this,arguments)}),B=(a=d(function*(e,t,{json:o,successMessage:n,jsonResult:r}){yield e.send("Runtime.enable"),(e=>{if(e.exceptionDetails){var t=e.exceptionDetails,o=t.exception?.description||t.exception?.value||t.text;throw new Error(o||"Runtime evaluation failed")}})(yield e.send("Runtime.evaluate",{expression:t,objectGroup:"console",returnByValue:!0,awaitPromise:!0})),o?console.log(JSON.stringify({success:!0,...r},null,2)):console.log(f.default.green(n))}),function(e,t,o){return a.apply(this,arguments)}),N=e=>{if(!e)return{};for(var t={},o=0;o<e.length;o+=2)t[e[o]]=e[o+1];return t},T=e=>{if(!e)return null;var t=e.nodeName||e.localName||"unknown",o=e.id||e.shortId;o&&(t+=`#${o}`),e.title&&(t+=` "${e.title}"`);var n=[];return e.nodeId&&n.push(`node ${e.nodeId}`),e.shortId&&e.shortId!==o&&n.push(e.shortId),e.brickId&&e.brickId!==e.shortId&&n.push(e.brickId),e.templateKey&&n.push(e.templateKey),n.length>0?`${t} (${n.join(", ")})`:t},P=(e,t="",o=!0,n=!0)=>{var r=[],i=n?"":o?"└─ ":"├─ ",s=n?"":o?" ":"│ ",a=e.nodeName||"#unknown";if(9===e.nodeType)a="#document";else if(3===e.nodeType){var l=e.nodeValue||"";a=f.default.gray(`"${l}"`)}else if(1===e.nodeType){var u=N(e.attributes),c=u.id||u["short-id"];c&&(a+=f.default.gray(`#${c}`)),u.title&&(a+=` ${f.default.green(`"${u.title}"`)}`),void 0!==u.w&&void 0!==u.h&&(a+=f.default.blue(` ${u.w}×${u.h}`),void 0!==u.x&&void 0!==u.y&&(a+=f.default.blue(` @${u.x},${u.y}`)));var d=[];void 0!==u.hide&&d.push(f.default.red("hidden")),void 0!==u.pressable&&d.push(f.default.yellow("pressable")),void 0!==u.editable&&d.push(f.default.yellow("editable")),d.length>0&&(a+=` [${d.join(", ")}]`)}r.push(`${t}${i}${a}`);var p=e.children||[];return p.forEach((e,o)=>{r.push(...P(e,t+s,o===p.length-1,!1))}),r};w.command("scan").description("Scan LAN for DevTools servers via UDP + HTTP").option("-t, --timeout <ms>","Scan timeout in milliseconds","3000").option("-j, --json","Output as JSON").option("--verify","Verify each discovered server via HTTP").option("--udp-only","Skip HTTP subnet probe (UDP only)").option("--no-project","Exclude local BRICKS project preview servers").option("-p, --port <port>","Port for HTTP probe","19851").action(function(){var e=d(function*(e){var t=(yield Promise.resolve().then(o.bind(o,29790))).default,n=yield Promise.resolve().then(o.bind(o,74752)),r=n.getCurrentProfile,i=n.getTokenInfo,s=parseInt(e.timeout,10),a=t(`Scanning for DevTools servers (${s}ms)...`).start();try{var l=yield F({timeout:s,verify:!!e.verify,udpOnly:!!e.udpOnly,project:!!e.project,port:parseInt(e.port,10),onStatus:e=>{a.text=e}});if(0===l.length)return e.json?(a.stop(),console.log(JSON.stringify([],null,2))):a.info("No DevTools servers found on the network."),void process.exit(0);a.stop(),e.json&&(console.log(JSON.stringify(l,null,2)),process.exit(0));var u=i(r()),c=u?.workspaceId||null;console.log(f.default.bold(`\nFound ${l.length} DevTools server(s)`)),console.log("─".repeat(80));var d=function*(e){var t=!1===e.verified?f.default.red("unverified"):f.default.green("online"),o=e.hasPasscode?f.default.yellow("passcode"):f.default.gray("open"),n=(e.protocols||[]).map(e=>f.default.cyan(e)).join(", "),r=e.workspaceId&&c&&e.workspaceId===c,i=e.addresses||[e.address],s=i.filter(t=>t!==e.address),a=s.length>0?`${e.address}:${e.port} +${s.length} more`:`${e.address}:${e.port}`;if(console.log(` ${f.default.bold(e.name||"Unknown")} ${f.default.gray(`(${a})`)} [${t}]`),s.length>0&&console.log(` Addresses: ${i.map(e=>f.default.gray(e)).join(", ")}`),e.version&&console.log(` Version: ${f.default.green(e.version)}`),e.chromeInspect){var l=e.passcode?f.default.cyan(e.passcode):f.default.gray("no passcode");console.log(` Chrome Inspect: ${f.default.green("supported")} (passcode: ${l})`)}var u=` Protocols: ${n||f.default.gray("none")} Auth: ${o}`;if(e.deviceId&&(u+=` Device: ${f.default.gray(e.deviceId)}`),console.log(u),e.workspaceId){var d=r?f.default.green(`${e.workspaceId} (current profile)`):f.default.gray(e.workspaceId);console.log(` Workspace: ${d}`)}};for(var p of l)yield*d(p);console.log("─".repeat(80));var g=l[0],h=`${g.address}:${g.port||19851}`,m=g.passcode?`/ws/${encodeURIComponent(g.passcode)}`:"/ws/<passcode>";console.log(f.default.gray(`\nConnect via: http://${h}/devtools-frontend/inspector.html?ws=${h}${m}`)),console.log(f.default.gray(`Legacy: devtools://devtools/bundled/inspector.html?ws=${h}${m}`)),process.exit(0)}catch(e){a.fail(`Scan failed: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),w.command("open <address>").description("Show DevTools server information").option("-p, --port <port>",`Server port (default: ${_})`).option("--info","Show connection URLs").action((l=d(function*(e,t){var n=(yield Promise.resolve().then(o.bind(o,29790))).default,r=(yield Promise.resolve().then(o.bind(o,12044))).verifyDevToolsServer,i=$(e),s=i.host??C,a=parseInt(t.port??i.port??_,10),l=`${s}:${a}`,u=n(`Fetching server info from ${l}...`).start(),c=yield r(s,a);c||(u.fail(`Could not reach DevTools server at ${l}`),process.exit(1)),u.stop();var d=yield D(s,a),p=d?y(d?.[0]?.webSocketDebuggerUrl):null,g=p?`/ws/${encodeURIComponent(p)}`:"/ws/<passcode>";if(t.info)return console.log(f.default.bold("Connection URLs")),console.log("─".repeat(60)),console.log(` Web UI: ${f.default.cyan(`http://${l}`)}`),console.log(` CDP: ${f.default.cyan(`http://${l}/devtools-frontend/inspector.html?ws=${l}${g}`)}`),console.log(` CDP legacy: ${f.default.cyan(`devtools://devtools/bundled/inspector.html?ws=${l}${g}`)}`),console.log(` MCP: ${f.default.cyan(`http://${l}/mcp`)}`),console.log(` MCP SSE: ${f.default.cyan(`http://${l}/sse`)}`),console.log(` Info: ${f.default.cyan(`http://${l}/devtools/info`)}`),console.log("─".repeat(60)),console.log(),console.log(f.default.bold("Authorization")),p&&console.log(` Passcode: ${f.default.cyan(p)}`),console.log(" MCP and MCP SSE require a Bearer token header with the device passcode:"),void console.log(` ${f.default.gray(`Authorization: Bearer ${p||"<passcode>"}`)}`);if(console.log(f.default.bold("DevTools Server")),console.log("─".repeat(60)),console.log(` Name: ${f.default.cyan(c.name||"Unknown")}`),console.log(` Version: ${c.version?f.default.green(c.version):f.default.gray("N/A")}`),console.log(` Device ID: ${f.default.gray(c.deviceId||"N/A")}`),console.log(` Workspace: ${f.default.gray(c.workspaceId||"N/A")}`),console.log(` Protocols: ${(c.protocols||[]).map(e=>f.default.cyan(e)).join(", ")||f.default.gray("none")}`),console.log(` Auth: ${c.hasPasscode?f.default.yellow("passcode required"):f.default.gray("open")}`),console.log(` Port: ${c.port}`),d){var h=p?f.default.cyan(p):f.default.gray("no passcode");console.log(` Inspect: ${f.default.green("chrome://inspect supported")} (passcode: ${h})`)}else console.log(` Inspect: ${f.default.gray("chrome://inspect not available")}`);console.log("─".repeat(60)),c.version&&!E(c.version)&&console.log(f.default.yellow(`\n CDP commands require version >= ${b}`)),console.log(f.default.gray("\n Use --info to see connection URLs"))}),function(e,t){return l.apply(this,arguments)})),k(w.command("screenshot").description("Capture device screenshot").option("-o, --output <path>","Output file path")).action((u=d(function*(e){var t;yield S(e,(t=d(function*(t){var n=yield t.send("Page.captureScreenshot",{format:"png"});n.data||(console.error(f.default.red("No screenshot data received")),process.exit(1));var r=yield Promise.resolve().then(o.t.bind(o,73024,19)),i=yield Promise.resolve().then(o.t.bind(o,76760,19)),s=e.output||`screenshot-${Date.now()}.png`,a=i.resolve(s);r.writeFileSync(a,Buffer.from(n.data,"base64")),console.log(f.default.green(`Screenshot saved to ${a}`))}),function(e){return t.apply(this,arguments)}))}),function(e){return u.apply(this,arguments)}));var M,R,U,L,J,q,V,G,W=w.command("brick").description("Brick component inspection");k(W.command("tree").description("Print brick component tree").option("-d, --depth <depth>","Max depth (-1 for full)","3")).action((M=d(function*(e){var t;yield S(e,(t=d(function*(t){yield t.send("DOM.enable");var o=parseInt(e.depth,10),n=(yield t.send("DOM.getDocument",{depth:o})).root;e.json?console.log(JSON.stringify(n,null,2)):console.log(P(n).join("\n"))}),function(e){return t.apply(this,arguments)}))}),function(e){return M.apply(this,arguments)})),k(W.command("query <selector>").description("Find brick by CSS selector")).action((R=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=(yield o.send("DOM.getDocument",{depth:0})).root,r=(yield o.send("DOM.querySelector",{nodeId:n.nodeId,selector:e})).nodeId;if(0!==r){var i=yield o.send("DOM.describeNode",{nodeId:r}),s=(yield o.send("DOM.getAttributes",{nodeId:r})).attributes,a=N(s);if(t.json)console.log(JSON.stringify({nodeId:r,...i.node,attributes:a},null,2));else if(console.log(f.default.bold(`Node ${r}: ${i.node?.nodeName||"unknown"}`)),Object.keys(a).length>0)for(var l of(console.log(f.default.bold("Attributes:")),Object.entries(a))){var u=c(l,2),d=u[0],p=u[1];console.log(` ${f.default.cyan(d)}: ${p}`)}}else console.log(f.default.yellow("No element found"))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return R.apply(this,arguments)})),k(W.command("query-all <selector>").description("Find all bricks matching CSS selector")).action((U=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=(yield o.send("DOM.getDocument",{depth:0})).root,r=(yield o.send("DOM.querySelectorAll",{nodeId:n.nodeId,selector:e})).nodeIds;if(t.json)console.log(JSON.stringify({nodeIds:r,count:r.length},null,2));else for(var i of(console.log(f.default.bold(`Found ${r.length} element(s)`)),r)){var s=yield o.send("DOM.describeNode",{nodeId:i}),a=(yield o.send("DOM.getAttributes",{nodeId:i})).attributes,l=N(a),u=l.id||l["short-id"]||"";console.log(` ${i}: ${s.node?.nodeName}${u?f.default.gray(`#${u}`):""}`)}}),function(e){return o.apply(this,arguments)}))}),function(e,t){return U.apply(this,arguments)})),k(W.command("attributes <nodeId>").description("Get brick attributes")).action((L=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=parseInt(e,10),r=(yield o.send("DOM.getAttributes",{nodeId:n})).attributes,i=N(r);if(t.json)console.log(JSON.stringify(i,null,2));else if(0!==Object.keys(i).length)for(var s of Object.entries(i)){var a=c(s,2),l=a[0],u=a[1];console.log(` ${f.default.cyan(l)}: ${u}`)}else console.log(f.default.gray("No attributes"))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return L.apply(this,arguments)})),k(W.command("box-model <nodeId>").description("Get brick dimensions and position")).action((J=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=parseInt(e,10),r=(yield o.send("DOM.getBoxModel",{nodeId:n})).model;t.json?console.log(JSON.stringify(r,null,2)):(console.log(f.default.bold(`Box Model for node ${n}`)),console.log(` Width: ${r.width}`),console.log(` Height: ${r.height}`),r.content&&console.log(` Content: [${r.content.join(", ")}]`),r.padding&&console.log(` Padding: [${r.padding.join(", ")}]`),r.border&&console.log(` Border: [${r.border.join(", ")}]`),r.margin&&console.log(` Margin: [${r.margin.join(", ")}]`))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return J.apply(this,arguments)})),k(W.command("resolve <nodeId>").description("Resolve brick to JavaScript object with properties")).action((q=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOM.enable");var n=parseInt(e,10),r=(yield o.send("DOM.resolveNode",{nodeId:n})).object;if(t.json)console.log(JSON.stringify(r,null,2));else if(console.log(f.default.bold(`Resolved node ${n}`)),console.log(` Type: ${r.type}`),r.className&&console.log(` Class: ${r.className}`),r.description&&console.log(` Description: ${r.description}`),r.objectId&&console.log(` Object ID: ${f.default.gray(r.objectId)}`),r.preview?.properties)for(var i of(console.log(f.default.bold(" Properties:")),r.preview.properties))console.log(` ${f.default.cyan(i.name)}: ${i.value}`)}),function(e){return o.apply(this,arguments)}))}),function(e,t){return q.apply(this,arguments)})),k(W.command("focus <nodeId>").description("Focus a brick element")).action((V=d(function*(e,t){var o;yield S(t,(o=d(function*(t){yield t.send("DOM.enable");var o=parseInt(e,10);yield t.send("DOM.focus",{nodeId:o}),console.log(f.default.green(`Focused node ${o}`))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return V.apply(this,arguments)})),k(W.command("input <subspaceId> <brickId> <text...>").description("Set text on a BRICK_TEXT_INPUT by subspace/brick id or node id")).action((G=d(function*(e,t,o,n){var r,i=Array.isArray(o)?o.join(" "):o;yield S(n,(r=d(function*(o){var r=yield j(o,{subspaceId:e,brickId:t});yield B(o,(({subspaceId:e,brickId:t,text:o})=>x({subspaceId:e,handler:t,action:"BRICK_TEXT_INPUT_SET_TEXT",parameters:{BRICK_TEXT_INPUT_TEXT:o}}))({...r,text:i}),{json:n.json,successMessage:`Set text on ${r.brickId}`,jsonResult:{...r,action:"BRICK_TEXT_INPUT_SET_TEXT",text:i}})}),function(e){return r.apply(this,arguments)}))}),function(e,t,o,n){return G.apply(this,arguments)}));var H,K,Y,z=w.command("input").description("Input emulation");k(z.command("tap <x> <y>").description("Tap/click at coordinates")).action((H=d(function*(e,t,o){var n;yield S(o,(n=d(function*(n){var r=parseFloat(e),i=parseFloat(t),s=yield n.send("Input.dispatchMouseEvent",{type:"mousePressed",x:r,y:i,button:"left",clickCount:1});yield n.send("Input.dispatchMouseEvent",{type:"mouseReleased",x:r,y:i,button:"left",clickCount:1}),(({x:e,y:t,tapResult:o,json:n})=>{if(n)console.log(JSON.stringify({x:e,y:t,...o||{}},null,2));else{console.log(f.default.green(`Tapped at (${e}, ${t})`));var r=T(o?.element||o?.tappedElement||o?.hitElement);if(r){console.log(` Element: ${r}`);var i=o?.hitElement,s=o?.tappedElement;if(i&&s&&i.nodeId!==s.nodeId){var a=T(i);a&&console.log(` Hit: ${a}`)}o&&!1===o.dispatched&&console.log(f.default.yellow(" Action: no pressable handler"))}else console.log(f.default.yellow(" Element: none"))}})({x:r,y:i,tapResult:s,json:o.json})}),function(e){return n.apply(this,arguments)}))}),function(e,t,o){return H.apply(this,arguments)})),k(z.command("key <key>").description("Dispatch key event (e.g., Enter, Escape, Tab)")).action((K=d(function*(e,t){var o;yield S(t,(o=d(function*(t){yield t.send("Input.dispatchKeyEvent",{type:"keyDown",key:e}),yield t.send("Input.dispatchKeyEvent",{type:"keyUp",key:e}),console.log(f.default.green(`Key: ${e}`))}),function(e){return o.apply(this,arguments)}))}),function(e,t){return K.apply(this,arguments)})),k(w.command("popup").description("System popup and alert control").command("close [popupId]").description("Close the current system alert/popup, or a popup by id/type").option("--type <type>","Popup clear type for SYSTEM POPUP_RESET").option("--subspace <subspaceId>","Subspace id to execute from (defaults to first subspace)")).action((Y=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield B(o,(({subspaceId:e,popupId:t,clearType:o})=>{var n={};return t&&(n.POPUP_ID=t),o&&(n.POPUP_CLEAR_TYPE=o),x({subspaceId:e,handler:"SYSTEM",action:"POPUP_RESET",parameters:n})})({subspaceId:t.subspace,popupId:e,clearType:t.type}),{json:t.json,successMessage:e?`Closed popup ${e}`:"Closed current popup",jsonResult:{subspaceId:t.subspace||null,popupId:e||null,clearType:t.type||null,action:"POPUP_RESET"}})}),function(e){return o.apply(this,arguments)}))}),function(e,t){return Y.apply(this,arguments)}));var Q,X,Z=w.command("network").description("Network inspection");k(Z.command("list").description("Capture snapshot of network activity").option("--duration <ms>","Capture duration in milliseconds","2000")).action((Q=d(function*(e){var t;yield S(e,(t=d(function*(t){var o=new Map,n=parseInt(e.duration,10);t.on("Network.requestWillBeSent",e=>{o.set(e.requestId,{method:e.request.method,url:e.request.url,requestId:e.requestId,timestamp:e.timestamp})}),t.on("Network.responseReceived",e=>{var t=o.get(e.requestId);t&&(t.status=e.response.status,t.mimeType=e.response.mimeType)}),t.on("Network.loadingFailed",e=>{var t=o.get(e.requestId);t&&(t.error=e.errorText)}),yield t.send("Network.enable"),yield new Promise(e=>setTimeout(e,n)),yield t.send("Network.disable");var r=[...o.values()];if(e.json)console.log(JSON.stringify(r,null,2));else if(console.log(f.default.bold(`Network Activity (captured ${(n/1e3).toFixed(1)}s, ${r.length} requests)`)),0!==r.length)for(var i of r){var s=i.error?f.default.red("ERR"):i.status?i.status<300?f.default.green(i.status):i.status<400?f.default.yellow(i.status):f.default.red(i.status):f.default.gray("..."),a=i.url.length>60?i.url.substring(0,57)+"...":i.url;console.log(` ${s} ${f.default.bold(i.method.padEnd(6))} ${a} ${f.default.gray(`(${i.requestId})`)}`)}else console.log(f.default.gray(" No network activity captured"))}),function(e){return t.apply(this,arguments)}))}),function(e){return Q.apply(this,arguments)})),k(Z.command("get <requestId>").description("Get response body for a network request")).action((X=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("Network.enable");var n=yield o.send("Network.getResponseBody",{requestId:e}),r=n.body,i=n.base64Encoded;t.json?console.log(JSON.stringify({body:r,base64Encoded:i},null,2)):i?console.log(f.default.gray(`[base64 encoded, ${r.length} chars]`)):console.log(r)}),function(e){return o.apply(this,arguments)}))}),function(e,t){return X.apply(this,arguments)}));var ee,te,oe,ne="bricks://app",re="DATA-",ie="properties",se="entries",ae=e=>{if(null==e||"object"!=typeof e)return{value:e};if("value"in e)return{value:e.value};if("unserializableValue"in e)return{value:e.unserializableValue};if(e.objectId){var t=e.preview?.properties;return Array.isArray(t)&&t.length>0?{value:t.reduce((e,t)=>(e[t.name]=t.value,e),{}),byRef:!0}:{value:e.description||`[${e.type}]`,byRef:!0}}return{value:"undefined"===e.type?void 0:e.description}},le=e=>{var t=e.startsWith(re)?e.slice(5):e,o=t.indexOf(":");return o<0?{shortId:t,title:null}:{shortId:t.slice(0,o),title:t.slice(o+1)}},ue=e=>{if(e.startsWith("global:"))return{scope:"global",name:e.slice(7)};if(e.startsWith("subspace:")){var t=e.slice(9),o=t.indexOf(":");return o>0?{scope:"subspace",subspaceUuid:t.slice(0,o),name:t.slice(o+1)}:{scope:"subspace",subspaceUuid:t,name:""}}return{scope:null,name:e}},ce=(e=[])=>{var t=new Map,o=new Map,n=new Set;for(var r of e||[])if(r&&"object"==typeof r){var i=r.shortId,s=r.uuid;i&&n.add(i),s&&(n.add(s),t.set(s,r),o.set(s,s),i&&o.set(i,s))}return{byUuid:t,uuidByScope:o,knownScopes:n}},de=(e=[])=>e?.byUuid&&e?.uuidByScope&&e?.knownScopes?e:ce(e),pe=(ee=d(function*(e){try{var t=yield e.send("Runtime.evaluate",{expression:"JSON.stringify(Object.values(system.subspaces()).map((s) => ({ shortId: s.shortId, uuid: s.uuid, title: s.title })))",objectGroup:"console",returnByValue:!0}),o=t.result;return t.exceptionDetails||"string"!=typeof o?.value?[]:JSON.parse(o.value)}catch{return[]}}),function(e){return ee.apply(this,arguments)}),fe=(e,{full:t=!1,width:o=100}={})=>{var n="string"==typeof e?e:JSON.stringify(e);return void 0===n?f.default.gray("undefined"):t||n.length<=o?n:`${n.substring(0,o)}…`},ge=(e,t)=>{var o=de(t),n=e.subspaceUuid?o.byUuid.get(e.subspaceUuid):null;return{key:e.rawKey,scope:e.scope,...e.subspaceUuid?{subspaceUuid:e.subspaceUuid}:{},...n?.shortId?{subspaceShortId:n.shortId}:{},name:e.name,value:e.value}},he=(te=d(function*(e,{databaseName:t,objectStoreName:o,options:n}){var r=parseInt(n.skip??"0",10)||0,i=parseInt(n.limit??"25",10)||25,s=null;try{s=(yield e.send("IndexedDB.getMetadata",{securityOrigin:ne,databaseName:t,objectStoreName:o})).entriesCount}catch{}var a=yield e.send("IndexedDB.requestData",{securityOrigin:ne,databaseName:t,objectStoreName:o,indexName:"",skipCount:r,pageSize:i,returnByValue:!0}),l=a.objectStoreDataEntries,u=a.hasMore,c=!1,d=l.map(e=>{var t=ae(e.key).value,o=ae(e.value),n=o.value;return o.byRef&&(c=!0),{key:t,value:n}});if(n.json)console.log(JSON.stringify({database:t,objectStore:o,skip:r,limit:i,total:s,hasMore:!!u,entries:d},null,2));else{var p=null==s?"":` of ${s}`,g=r>0?`, skipped ${r}`:"";for(var h of(console.log(f.default.bold(`${t} / ${o} (${d.length}${p} entries${g})`)),console.log("─".repeat(60)),0===d.length&&console.log(f.default.gray(" No entries")),d)){var m=h.key,D=h.value,y="string"==typeof m?m:JSON.stringify(m);console.log(` ${f.default.cyan(y)}: ${fe(D,{full:!!n.full})}`)}u&&console.log(f.default.gray(" …more entries available — use -l/--limit and -s/--skip")),c&&console.log(f.default.yellow("\n Some values came back as object handles (device app without by-value reads).\n Update the device app to see full values."))}}),function(e,t){return te.apply(this,arguments)}),me=e=>e.option("-l, --limit <count>","Max items to fetch","25").option("-s, --skip <count>","Items to skip","0").option("--full","Do not truncate values"),De=w.command("storage").description("Storage inspection (read-only — CDP cannot mutate device storage)");k(De.command("list").description("Overview of all storage stores with entry counts")).action((oe=d(function*(e){var t;yield S(e,(t=d(function*(t){yield t.send("DOMStorage.enable"),yield t.send("IndexedDB.enable");var o,n=(o=d(function*(e){return(yield t.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ne,isLocalStorage:e}})).entries.length}),function(e){return o.apply(this,arguments)}),r=yield n(!0),i=yield n(!1),s=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ne})).databaseNames,a=[];for(var l of s){var u=l.startsWith(re)?ie:se,c=null;try{c=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ne,databaseName:l,objectStoreName:u})).entriesCount}catch{}a.push({name:l,objectStoreName:u,entriesCount:c})}var p=a.filter(e=>e.name.startsWith(re)).map(e=>({...e,...le(e.name)})),g=a.filter(e=>!e.name.startsWith(re));if(e.json)console.log(JSON.stringify({system:{persist:r,memory:i},dataBanks:p,caches:g},null,2));else{var h=e=>null==e?f.default.gray("? entries"):`${e} entries`;for(var m of(console.log(f.default.bold("Storage Overview")+f.default.gray(" (read-only)")),console.log("─".repeat(60)),console.log(` ${f.default.bold("System storage")}${f.default.gray(" → storage system persist|memory")}`),console.log(` persist ${h(r)}`),console.log(` memory ${h(i)}`),console.log(` ${f.default.bold("Data banks")}${f.default.gray(" → storage data-bank get <S_xxxx|title>")}`),0===p.length&&console.log(f.default.gray(" none")),p)){var D=m.title?` "${m.title}"`:"";console.log(` ${f.default.cyan(m.shortId)}${D} ${h(m.entriesCount)}`)}for(var y of(console.log(` ${f.default.bold("Caches")}${f.default.gray(" → storage cache generator|generative-media")}`),0===g.length&&console.log(f.default.gray(" none")),g))console.log(` ${f.default.cyan(y.name)} ${h(y.entriesCount)}`);console.log("─".repeat(60))}}),function(e){return t.apply(this,arguments)}))}),function(e){return oe.apply(this,arguments)}));var ye,ve=De.command("system").description("System key-value storage"),Fe=e=>e.option("--scope <scope>","Filter by scope: global or a subspace S_xxxx/UUID").option("--prefix <prefix>","Filter by key-name prefix (within the scope)").option("--full","Do not truncate values"),be=(e,t)=>{return o=d(function*(o){var n;yield S(o,(n=d(function*(n){yield n.send("DOMStorage.enable");var r=(yield n.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ne,isLocalStorage:e}})).entries,i=yield pe(n),s=ce(i),a=((e,{scope:t,prefix:o,subspaceIndex:n=[]}={})=>{var r=de(n),i=t&&"global"!==t?r.uuidByScope.get(t)||t:null;return e.map(([e,t])=>({rawKey:e,value:t,...ue(e)})).filter(e=>!("global"===t&&"global"!==e.scope||i&&("subspace"!==e.scope||e.subspaceUuid!==i)||o&&!e.name.startsWith(o)))})(r,{scope:o.scope,prefix:o.prefix,subspaceIndex:s});if(o.json)console.log(JSON.stringify(a.map(e=>ge(e,s)),null,2));else if(((e,{label:t,subspaceIndex:o,full:n})=>{var r=de(o);if(console.log(f.default.bold(`${t} (${e.length} items)`)),console.log("─".repeat(60)),0!==e.length){var i=null;for(var s of e){var a="subspace"===s.scope?`subspace:${s.subspaceUuid}`:s.scope;if(a!==i)if(i=a,"subspace"===s.scope){var l=r.byUuid.get(s.subspaceUuid),u=l?`${l.shortId}${l.title?` "${l.title}"`:""} `:"";console.log(` ${f.default.bold(`subspace ${u}`)}${f.default.gray(`(${s.subspaceUuid})`)}`)}else console.log(` ${f.default.bold(s.scope||"other")}`);var c=s.name||s.rawKey;console.log(` ${f.default.cyan(c)}: ${fe(s.value,{full:n,width:80})}`)}}else console.log(f.default.gray(" No entries"))})(a,{label:t,subspaceIndex:s,full:!!o.full}),0===a.length&&o.scope&&"global"!==o.scope&&!s.knownScopes.has(o.scope)){var l=i.map(e=>e.shortId).join(", ");console.log(f.default.yellow(` Scope "${o.scope}" did not match a known subspace${l?` (known: ${l})`:""}`))}}),function(e){return n.apply(this,arguments)}))}),function(e){return o.apply(this,arguments)};var o};Fe(k(ve.command("persist").description("Show persistent system storage entries"))).action(be(!0,"Persistent Storage")),Fe(k(ve.command("memory").description("Show in-memory system storage entries"))).action(be(!1,"Memory Storage")),k(ve.command("get <key>").description("Show a single system storage value (full, untruncated)").option("--scope <scope>","Key scope: global (default) or a subspace S_xxxx/UUID","global").option("--memory","Read from in-memory storage instead of persistent")).action((ye=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("DOMStorage.enable");var n=(yield o.send("DOMStorage.getDOMStorageItems",{storageId:{securityOrigin:ne,isLocalStorage:!t.memory}})).entries,r=yield pe(o),i=ce(r),s=[e];if("global"===t.scope)s.push(`global:${e}`);else{var a=i.uuidByScope.get(t.scope)||t.scope;s.push(`subspace:${a}:${e}`)}var l=n.map(([e,t])=>({rawKey:e,value:t,...ue(e)})).find(e=>s.includes(e.rawKey));if(!l){var u=n.map(([e])=>e).filter(t=>t.toLowerCase().includes(e.toLowerCase())).slice(0,5);if(u.length>0)for(var c of(console.error(f.default.yellow("Similar keys:")),u))console.error(` ${c}`);throw new Error(`Key not found: ${s[s.length-1]}`)}if(t.json)console.log(JSON.stringify(ge(l,i),null,2));else{if("string"==typeof l.value)try{return void console.log(JSON.stringify(JSON.parse(l.value),null,2))}catch{}console.log("string"==typeof l.value?l.value:JSON.stringify(l.value,null,2))}}),function(e){return o.apply(this,arguments)}))}),function(e,t){return ye.apply(this,arguments)}));var _e,Ce,$e=De.command("data-bank").description("Data bank (Property Bank) stores");k($e.command("list").description("List data banks")).action((_e=d(function*(e){var t;yield S(e,(t=d(function*(t){yield t.send("IndexedDB.enable");var o=(yield t.send("IndexedDB.requestDatabaseNames",{securityOrigin:ne})).databaseNames,n=[];for(var r of o.filter(e=>e.startsWith(re))){var i=null;try{i=(yield t.send("IndexedDB.getMetadata",{securityOrigin:ne,databaseName:r,objectStoreName:ie})).entriesCount}catch{}n.push({name:r,...le(r),entriesCount:i})}if(e.json)console.log(JSON.stringify(n,null,2));else{for(var s of(console.log(f.default.bold(`Data Banks (${n.length})`)),console.log("─".repeat(60)),0===n.length&&console.log(f.default.gray(" No data banks")),n)){var a=s.title?` ${f.default.green(`"${s.title}"`)}`:"",l=null===s.entriesCount||void 0===s.entriesCount?"":f.default.gray(` ${s.entriesCount} entries`);console.log(` ${f.default.cyan(s.shortId)}${a}${l}`)}console.log(f.default.gray("\nInspect: bricks devtools storage data-bank get <S_xxxx|title>"))}}),function(e){return t.apply(this,arguments)}))}),function(e){return _e.apply(this,arguments)})),me(k($e.command("get <bank> [store]").description(`Show data bank entries — <bank> accepts a subspace S_xxxx, a title keyword, or the full DATA-* database name; [store] defaults to "${ie}"`))).action((Ce=d(function*(e,t,o){var n;yield S(o,(n=d(function*(n){yield n.send("IndexedDB.enable");var r=(yield n.send("IndexedDB.requestDatabaseNames",{securityOrigin:ne})).databaseNames,i=((e,t)=>{var o=e.filter(e=>e.startsWith(re)),n=o.find(e=>e===t||e===`${re}${t}`);if(n)return{match:n};if(t.startsWith("S_")){var r=o.filter(e=>le(e).shortId===t);if(1===r.length)return{match:r[0]};if(r.length>1)return{candidates:r}}var i=t.toLowerCase(),s=o.filter(e=>e.slice(5).toLowerCase().includes(i));return 1===s.length?{match:s[0]}:{candidates:s}})(r,e);if(!i.match){var s=r.filter(e=>e.startsWith(re)),a=(i.candidates?.length||0)>1,l=a?i.candidates:s;for(var u of(console.error(f.default.yellow(a?`Data bank "${e}" is ambiguous. Candidates:`:`Data bank "${e}" not found. Available:`)),l)){var c=le(u),d=c.shortId,p=c.title;console.error(` ${d}${p?` "${p}"`:""}`)}process.exit(1)}yield he(n,{databaseName:i.match,objectStoreName:t||ie,options:o})}),function(e){return n.apply(this,arguments)}))}),function(e,t,o){return Ce.apply(this,arguments)}));var Ee=De.command("cache").description("Cache stores (generator, generative-media)"),we=e=>{return t=d(function*(t){var o;yield S(t,(o=d(function*(o){yield o.send("IndexedDB.enable"),yield he(o,{databaseName:e,objectStoreName:se,options:t})}),function(e){return o.apply(this,arguments)}))}),function(e){return t.apply(this,arguments)};var t};me(k(Ee.command("generator").description("Show generator cache entries"))).action(we("GENERATOR_CACHE")),me(k(Ee.command("generative-media").description("Show generative media cache entries"))).action(we("GENERATIVE_MEDIA_CACHE")),me(k(De.command("generator-cache",{hidden:!0}).description("Alias of `storage cache generator`"))).action(we("GENERATOR_CACHE"));var ke,Se,xe=w.command("runtime").description("Runtime and evaluation");k(xe.command("eval <expression>").description("Evaluate JavaScript expression").option("--await","Await promise result")).action((ke=d(function*(e,t){var o;yield S(t,(o=d(function*(o){yield o.send("Runtime.enable");var n=yield o.send("Runtime.evaluate",{expression:e,objectGroup:"console",returnByValue:!0,awaitPromise:!!t.await,generatePreview:!0});if(t.json)console.log(JSON.stringify(n,null,2));else{n.exceptionDetails&&(console.error(f.default.red(`Error: ${n.exceptionDetails.text}`)),n.exceptionDetails.exception?.description&&console.error(f.default.red(n.exceptionDetails.exception.description)),process.exit(1));var r=n.result;if("undefined"===r.type)console.log(f.default.gray("undefined"));else if(void 0!==r.value){var i="object"==typeof r.value?JSON.stringify(r.value,null,2):String(r.value);console.log(i)}else r.description?console.log(r.description):console.log(f.default.gray(`[${r.type}${r.subtype?`:${r.subtype}`:""}]`))}}),function(e){return o.apply(this,arguments)}))}),function(e,t){return ke.apply(this,arguments)})),k(xe.command("properties <objectId>").description("Get properties of a remote object")).action((Se=d(function*(e,t){var o;yield S(t,(o=d(function*(o){var n=(yield o.send("Runtime.getProperties",{objectId:e,ownProperties:!0})).result;if(t.json)console.log(JSON.stringify(n,null,2));else for(var r of(console.log(f.default.bold(`Properties of ${e}`)),n))if(r.enumerable){var i=r.value,s=i?.description||i?.value?.toString()||f.default.gray(`[${i?.type}]`);console.log(` ${f.default.cyan(r.name)}: ${s}`)}}),function(e){return o.apply(this,arguments)}))}),function(e,t){return Se.apply(this,arguments)}))},61685:(e,t,o)=>{o.d(t,{v:()=>E});var n=o(99436),r=o(35679),i=o(88568),s=o(74752),a=o(1001),l=o(16928),u=o(79896);function c(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return c=function(e){this.s=e,this.n=e.next},c.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var o=this.s.return;return void 0===o?Promise.resolve({value:e,done:!0}):t(o.apply(this.s,arguments))},throw:function(e){var o=this.s.return;return void 0===o?Promise.reject(e):t(o.apply(this.s,arguments))}},new c(e)}var d,p,f,g,h,m,D,y=(d=n(function*(){return(yield Promise.resolve().then(o.bind(o,29790))).default}),function(){return d.apply(this,arguments)}),v=(p=n(function*(){return Promise.all([o.e(657),o.e(7),o.e(146)]).then(o.bind(o,77146))}),function(){return p.apply(this,arguments)}),F=(f=n(function*(e){return(yield y())(e).start()}),function(e){return f.apply(this,arguments)}),b=(g=n(function*(){var e=(0,s.getCurrentProfile)(),t=(0,s.getToken)(e);return t||(console.error(i.default.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),(0,(yield v()).createActivityLogClient)((0,s.getActivityLogBaseUrl)(),t)}),function(){return g.apply(this,arguments)}),_=2592e6,C=e=>new Date(e).toISOString().replace("T"," ").replace(/\.\d+Z$/,"Z"),$=(e,t)=>{if(!e)return"";var o="string"==typeof e?e:JSON.stringify(e);return o.length>t?o.slice(0,t-1)+"…":o},E=new r.uB("activity-log").alias("al").description("Activity log queries (read-only)");E.command("events").description("Query activity log events (all types)").requiredOption("--start-time <datetime>","Start time (ISO 8601 or relative: 1h, 30m, 2d)").option("--end-time <datetime>","End time (default: now)").option("--device <id>","Filter by device ID").option("--type <type>","Filter by event type: general, data, local_sync").option("--event-name <name>","Filter by event name").option("--subspace <id>","Filter by subspace ID").option("--sender <id>","Filter by sender").option("--limit <n>","Max events to display",parseInt).option("-j, --json","Output as JSON array").option("--jsonl","Output as JSONL (one JSON per line)").action((h=n(function*(e){var t=yield b(),o=(e=>{var t=(0,a.p)(e.startTime),o=e.endTime?(0,a.p)(e.endTime):(new Date).toISOString();new Date(o)-new Date(t)>_&&(console.error(i.default.red("Time range must be 30 days or less")),process.exit(1));var n={start_time:t,end_time:o};return e.device&&(n.device_id=e.device),e.type&&(n.event_type=e.type),e.eventName&&(n.event_name=e.eventName),e.subspace&&(n.subspace_id=e.subspace),e.sender&&(n.sender=e.sender),n})(e);if(e.jsonl){var n=0;try{var r,s=!1,l=!1;try{for(var u,d=function(e){var t,o,n,r=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,n=Symbol.iterator);r--;){if(o&&null!=(t=e[o]))return t.call(e);if(n&&null!=(t=e[n]))return new c(t.call(e));o="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}(t.events(o));s=!(u=yield d.next()).done;s=!1){var p=u.value;if(console.log(JSON.stringify(p)),n++,e.limit&&n>=e.limit)break}}catch(e){l=!0,r=e}finally{try{s&&null!=d.return&&(yield d.return())}finally{if(l)throw r}}}catch(e){console.error(i.default.red(`Failed to query events: ${e.message}`)),process.exit(1)}}else{var f=yield F("Querying events...");try{var g=yield t.collectEvents(o,{limit:e.limit});if(f.stop(),e.json)return void console.log(JSON.stringify(g,null,2));if(0===g.length)return void console.log(i.default.yellow("No events found"));for(var h of(console.log(i.default.bold(`\nActivity Log Events (${g.length})`)),console.log("─".repeat(100)),console.log(i.default.gray(`${"Timestamp".padEnd(24)} ${"Type".padEnd(12)} ${"Device".padEnd(14)} ${"Event Name".padEnd(28)} ${"Sender".padEnd(16)} Payload`)),console.log("─".repeat(100)),g)){var m=C(h.timestamp),D=(h.event_type||"").padEnd(12),y=$(h.device_id,14).padEnd(14),v=$(h.event_name,28).padEnd(28),E=$(h.sender,16).padEnd(16),w=$(h.payload,40);console.log(`${m} ${D} ${y} ${v} ${E} ${i.default.gray(w)}`)}console.log("─".repeat(100))}catch(e){f.fail(`Failed to query events: ${e.message}`),process.exit(1)}}}),function(e){return h.apply(this,arguments)})),E.command("screenshots").description("List screenshot timestamps for a device").requiredOption("--device <id>","Device ID (required)").requiredOption("--start-time <datetime>","Start time (ISO 8601 or relative: 1h, 30m, 2d)").option("--end-time <datetime>","End time (default: now)").option("-j, --json","Output as JSON").action((m=n(function*(e){var t=yield b(),o=(0,a.p)(e.startTime),n=e.endTime?(0,a.p)(e.endTime):(new Date).toISOString();new Date(n)-new Date(o)>_&&(console.error(i.default.red("Time range must be 30 days or less")),process.exit(1));var r={device_id:e.device,start_time:o,end_time:n},s=yield F("Querying screenshots...");try{var l=yield t.collectScreenshots(r);if(s.stop(),e.json)return void console.log(JSON.stringify(l,null,2));if(0===l.length)return void console.log(i.default.yellow("No screenshots found"));console.log(i.default.bold(`\nScreenshots (${l.length})`)),console.log("─".repeat(56)),console.log(i.default.gray(`${"#".padStart(4)} ${"Timestamp".padEnd(24)} --ts value`)),console.log("─".repeat(56)),l.forEach((e,t)=>{var o=new Date(e.timestamp).getTime();console.log(`${String(t+1).padStart(4)} ${C(e.timestamp).padEnd(24)} ${o}`)}),console.log("─".repeat(56))}catch(e){s.fail(`Failed to query screenshots: ${e.message}`),process.exit(1)}}),function(e){return m.apply(this,arguments)})),E.command("screenshot").description("Download a screenshot image").requiredOption("--device <id>","Device ID").requiredOption("--ts <timestamp>","Screenshot timestamp (ISO 8601 or epoch ms)").option("--space <id>","Workspace/space ID (auto-detected from profile)").option("-o, --output <path>","Output file path").option("--open","Open with OS default viewer after download").action((D=n(function*(e){var t,n,r=yield b(),a=e.space||(t=(0,s.getCurrentProfile)(),n=(0,s.getTokenInfo)(t),n?.workspaceId);a||(console.error(i.default.red("Could not determine workspace ID. Use --space <id> or log in first.")),process.exit(1));var c=/^\d+$/.test(e.ts)?e.ts:new Date(e.ts).getTime(),d=yield F("Downloading screenshot...");try{var p=yield r.downloadScreenshot(a,e.device,c);d.stop();var f=e.output||`screenshot-${e.device}-${c}.jpg`,g=l.resolve(f);u.writeFileSync(g,p);var h=(p.length/1024).toFixed(1);console.log(i.default.green(`✓ Screenshot saved: ${g} (${h} KB)`)),e.open&&(0,(yield Promise.resolve().then(o.t.bind(o,35317,19))).exec)(`${"darwin"===process.platform?"open":"win32"===process.platform?"start":"xdg-open"} "${g}"`)}catch(e){d.fail(`Failed to download screenshot: ${e.message}`),process.exit(1)}}),function(e){return D.apply(this,arguments)}))},63402:(e,t,o)=>{o.d(t,{GE:()=>r,YC:()=>n,jR:()=>i});var n=["InSubspace","Global"],r="Data Bank is not enabled for this workspace.",i=e=>{if(e&&!n.includes(e))throw new Error(`Invalid meta "${e}" (expected ${n.join(" | ")})`)}},63465:(e,t,o)=>{o.d(t,{D:()=>d});var n,r,i,s=o(99436),a=o(35679),l=o(88568),u=(n=s(function*(){var e=(yield Promise.resolve().then(o.bind(o,29790))).default,t=yield o.e(611).then(o.bind(o,20611)),n=t.detectChannel,r=t.detectInstallMethod,i=yield o.e(718).then(o.bind(o,61718));return{ora:e,detectChannel:n,detectInstallMethod:r,fetchLatestVersionInfo:i.fetchLatestVersionInfo,runUpdateForMethod:i.runUpdateForMethod}}),function(){return n.apply(this,arguments)}),c=(r=s(function*({message:e,defaultValue:t,autoYes:n}){if(n)return!0;(0,(yield Promise.resolve().then(o.bind(o,74445))).isInteractiveTerminal)()||(console.error(l.default.red("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.")),process.exit(1));try{var r=(yield o.e(637).then(o.bind(o,60637))).confirm;return yield r({message:e,default:t})}catch{return!1}}),function(e){return r.apply(this,arguments)}),d=new a.uB("update-cli").description("Update the BRICKS CLI to the latest version").option("-y, --yes","Skip confirmation prompts").option("--channel <channel>","Override channel (release|beta)").option("--check-update","Only check whether a newer version is available and exit").action((i=s(function*(e){var t=yield u(),o=t.ora,n=t.detectChannel,r=t.detectInstallMethod,i=t.fetchLatestVersionInfo,a=t.runUpdateForMethod,d="2.24.13",p=r(),f=e.channel||n({version:d,execPath:p.execPath});console.log(l.default.bold(e.checkUpdate?"BRICKS CLI Update Check":"BRICKS CLI Update")),console.log("─".repeat(60)),console.log(`Current version : ${l.default.cyan(d)}`),console.log(`Channel : ${l.default.cyan(f)}`),console.log(`Detected method : ${l.default.cyan(p.method)}`),p.execPath&&"binary"===p.method&&console.log(`Binary path : ${l.default.gray(p.execPath)}`),p.installRoot&&console.log(`Install root : ${l.default.gray(p.installRoot)}`);var g="npm"===p.method||"bun"===p.method?"npm":"cdn",h=o(`Fetching latest version info (${g})...`).start(),m=null,D=null;try{m=(yield i(f,p.method)).version,h.succeed(`Latest ${f} (${g}): ${l.default.green(m)}`)}catch(e){D=e,h.warn(`Could not fetch version info: ${e.message}`)}var y=m&&m===d;if(e.checkUpdate){if(D&&process.exit(2),y)return void console.log(l.default.green("\nUp to date."));m&&(console.log(l.default.yellow(`\nUpdate available: ${d} → ${m}. Run 'bricks update-cli' to install.`)),process.exit(1)),console.log(l.default.yellow("\nCould not determine current version.")),process.exit(2)}if(!y||(console.log(l.default.green("\nAlready running the latest version.")),yield c({message:"Reinstall anyway?",defaultValue:!1,autoYes:e.yes}))){var v=["npm","bun","binary"].includes(p.method);v||console.log(l.default.yellow(`Cannot auto-detect installer (method: ${p.method}); falling back to binary install.`));var F=v?p.method:"binary";if(yield c({message:`Update CLI using "${F}" method?`,defaultValue:!0,autoYes:e.yes})){var b,_=(b=s(function*(e){console.log(l.default.cyan(`\n→ Running ${e} update...`));try{return yield a(e,f,p),!0}catch(t){return console.error(l.default.yellow(`\n${e} update failed: ${t.message}`)),!1}}),function(e){return b.apply(this,arguments)}),C=yield _(F);C||"binary"===F||(console.log(l.default.cyan("\nFalling back to binary install (same method used by the desktop app).")),(yield c({message:"Try the binary installer as a fallback?",defaultValue:!0,autoYes:e.yes}))&&(C=yield _("binary"))),C||(console.error(l.default.red("\nUpdate failed. See messages above.")),process.exit(1)),console.log(l.default.green("\nUpdate complete."))}else console.log(l.default.yellow("Cancelled."))}else console.log(l.default.gray("Skipped."))}),function(e){return i.apply(this,arguments)}))},64447:(e,t,o)=>{o.d(t,{A:()=>S});var n,r,i,s,a,l,u,c,d,p,f,g,h=o(99436),m=o(35679),D=o(88568),y=o(29790),v=o(74752),F=o(59138),b=o(35704),_=o(34992),C=o(88055),$=o(75706),E=o(13675),w=o(6939),k=(e,t)=>(0,w.H_)(e,t,{currentVersion:e?.current_version||null,public:Boolean(e?.is_public)}),S=new m.uB("module").description("Module management");S.command("new").description("Create a new module").requiredOption("-n, --name <name>","Module name").option("-d, --description <description>","Module description").option("--layout-width <width>","Layout width",parseInt).option("--layout-height <height>","Layout height",parseInt).option("--public","Make module available to all users").option("--allow-modify","Allow users to modify imported module config").option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((n=h(function*(e){var t=(0,C.requireAuth)(),n=e.json?null:(0,y.default)("Creating module...").start();try{var r={name:e.name};e.description&&(r.description=e.description),e.layoutWidth&&(r.layoutWidth=e.layoutWidth),e.layoutHeight&&(r.layoutHeight=e.layoutHeight),e.public&&(r.isPublic=!0),e.allowModify&&(r.isAllowModify=!0);var i=yield t.createModule(r);if(e.json&&!e.init?console.log(JSON.stringify(i,null,2)):e.json||(n.succeed(`Module created: ${D.default.green(i.name)}`),console.log(` ID: ${D.default.gray(i._id)}`),i.description&&console.log(` ${D.default.gray(i.description)}`),console.log(` Public: ${i.is_public?D.default.green("Yes"):D.default.gray("No")}`),console.log(` Allow Modify: ${i.is_allow_modify?D.default.green("Yes"):D.default.gray("No")}`)),e.init){n&&n.stop();var s=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield s("module",i._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):n.fail(`Failed to create module: ${t.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),S.command("list").description("List all modules").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action((r=h(function*(e){var t=(0,C.requireAuth)(),o=(0,y.default)("Fetching modules...").start();try{var n=yield t.modules({keyword:e.keyword});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(D.default.yellow("No modules found"));console.log(D.default.bold("\nModules")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.current_version?`v${e.current_version}`:D.default.gray("no version");console.log(`● ${D.default.cyan(e.name)} ${D.default.gray(t)}`),console.log(` ID: ${D.default.gray(e._id)}`),e.description&&console.log(` ${D.default.gray(e.description)}`),console.log()})}catch(e){o.fail(`Failed to list modules: ${e.message}`),process.exit(1)}}),function(e){return r.apply(this,arguments)})),S.command("list-public").description("Search public modules").requiredOption("-k, --keyword <keyword>","Search keyword (min 2 characters)").option("-j, --json","Output as JSON").action((i=h(function*(e){var t=(0,(yield(0,F.i)()).createClient)((0,v.getBaseUrl)()),o=(0,y.default)("Searching public modules...").start();try{var n=yield t.publicModules({keyword:e.keyword});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(D.default.yellow("No public modules found"));console.log(D.default.bold("\nPublic Modules")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.current_version?`v${e.current_version}`:D.default.gray("no version");console.log(`● ${D.default.cyan(e.name)} ${D.default.gray(t)}`),console.log(` ID: ${D.default.gray(e._id)}`),e.description&&console.log(` ${D.default.gray(e.description)}`),console.log()})}catch(e){o.fail(`Failed to search public modules: ${e.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),S.command("get <id>").description("Get module details").option("-j, --json","Output as JSON").action((s=h(function*(e,t){var o=(0,C.requireAuth)(),n=(0,y.default)("Fetching module...").start();try{var r=yield o.module({id:e});if(n.stop(),r||(console.log(D.default.red("Module not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));if(console.log(D.default.bold(`\nModule: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${D.default.gray(r._id)}`),console.log(`Description: ${r.description||D.default.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||D.default.gray("None")}`),console.log(`Created: ${D.default.gray(r.create_datetime)}`),console.log(`Modified: ${D.default.gray(r.last_modify_datetime)}`),console.log(`\n${D.default.bold("Version")}`),console.log(`Current: ${r.current_version?`v${r.current_version}`:D.default.gray("No version")}`),console.log(`Unreleased: ${r.has_unreleased_changes?D.default.yellow("Yes"):D.default.green("No")}`),console.log(`\n${D.default.bold("Settings")}`),console.log(`Public: ${r.is_public?D.default.green("Yes"):D.default.gray("No")}`),console.log(`Allow Modify: ${r.is_allow_modify?D.default.green("Yes"):D.default.gray("No")}`),console.log(`Short Edit: ${r.short_edit?.enabled?D.default.green("Enabled"):D.default.gray("Disabled")}`),r.short_edit?.enabled&&r.short_edit.ref_map){var i=Object.keys(r.short_edit.ref_map).length;console.log(` References: ${i} editable properties`)}null!=r.use_count?.total_count&&(console.log(`\n${D.default.bold("Usage")}`),console.log(`Used In: ${r.use_count.total_count} application(s)`)),r.expose_properties?.length>0&&(console.log(`\n${D.default.bold("Exposed Properties")} (${r.expose_properties.length})`),r.expose_properties.forEach(e=>{console.log(` - ${D.default.cyan(e)}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get module: ${e.message}`),process.exit(1)}}),function(e,t){return s.apply(this,arguments)})),S.command("resolve <query>").description("Resolve a module name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((a=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Resolving module...").start();try{var r=yield(0,$.Y)(()=>o.module({id:e})),i=r?[r]:yield o.modules({keyword:e,paginate:{limit:t.limit}}),s=(0,$.K)({resource:"module",query:e,items:i||[],fields:["_id","name"],selectedBy:r?"id":null});if(n&&n.stop(),t.json)return void(0,_.GF)(s);if(s.resolved){var a=s.resolved;return console.log(D.default.bold("\nResolved Module")),console.log("─".repeat(60)),console.log(`Name: ${D.default.cyan(a.name||"Unnamed")}`),console.log(`ID: ${D.default.gray(a._id)}`),console.log(`Selected By: ${s.selectedBy}`),void console.log("─".repeat(60))}if(0===s.matches.length)return void console.log(D.default.yellow(`No modules matched "${e}"`));console.log(D.default.bold(`\nMatching Modules (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${D.default.cyan(e.name||"Unnamed")} ${D.default.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){n?n.fail(`Failed to resolve module: ${t.message}`):(0,_.OW)(t.message,{resource:"module",query:e}),process.exit(1)}}),function(e,t){return a.apply(this,arguments)})),S.command("update <id>").description("Update module name, description, and/or configuration").option("-n, --name <name>","Module name").option("-d, --description <description>","Module description").option("-c, --config <json>","Module config as JSON string").option("-f, --file <path>","Module config from file").option("--validate","Validate configuration (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((l=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Updating module...").start();try{var r=yield o.updateModule((0,w.jB)(e,t));t.json?(0,w.yd)({action:"module.update",target:k(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(n.succeed(`Module updated: ${D.default.green(r.name)}`),r.has_unreleased_changes&&console.log(D.default.yellow("Note: Module has unreleased changes")))}catch(o){t.json?(0,_.OW)(o.message,{action:"module.update",target:{id:e}}):n.fail(`Failed to update module: ${o.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),S.command("short-edit <id>").description("Short edit module properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((u=h(function*(e,t){var o=(0,C.requireAuth)(),n=(0,y.default)("Applying short edit...").start();try{var r=JSON.parse(t.list);Array.isArray(r)||(n.fail("List must be a JSON array"),process.exit(1));var i=yield o.shortEditModule({id:e,list:r});n.succeed(`Short edit applied to: ${D.default.green(i.name)}`)}catch(e){n.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),S.command("short-refs <id>").description("List short edit references for a module").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action((c=h(function*(e,t){var o=(0,C.requireAuth)(),n=(0,y.default)("Fetching short edit references...").start();try{var r=yield o.module({id:e});if(n.stop(),!r?.short_edit?.enabled)return void console.log(D.default.yellow("Short Edit is not enabled for this module"));var i=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],s=(0,b.V)(r.short_edit.ref_map,{keyword:t.keyword,types:i});if(t.json)return void console.log(JSON.stringify(s,null,2));if(0===s.length)return void console.log(D.default.yellow("No short edit references found"));console.log(D.default.bold(`\nShort Edit References: ${r.name}`)),s.forEach(e=>{console.log(D.default.cyan(`\n${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var o=t?.title?D.default.gray(`- ${t.title}`):"";console.log(` ${D.default.green(e)} ${o}`)})}),console.log()}catch(e){n.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),S.command("remove <id>").description("Remove a module").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((d=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Removing module...").start();try{var r=yield o.module({id:e});if(!r)throw new Error("Module not found");var i=k(r,e);if(t.dryRun)return n&&n.stop(),void(0,w.S5)({action:"module.remove",target:i,request:{id:e},checks:[(0,w.Iy)("module exists",!0,`${i.name} (${i.id})`)],json:t.json});var s=yield o.removeModule({id:e});t.json?(0,w.yd)({action:"module.remove",target:i,result:{removed:Boolean(s)},json:!0}):n.succeed(`Module removed: ${D.default.green(i.name)}`)}catch(o){t.json?(0,_.OW)(o.message,{action:"module.remove",target:{id:e}}):n.fail(`Failed to remove module: ${o.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),S.command("release <id>").description("Release module to BRICKS platform").requiredOption("-c, --config <path|json>","Module config file path or JSON string").option("-n, --name <name>","Update module name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((p=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Releasing module...").start();try{var r=(0,E.Ku)(t.config),i=r.config,s=r.source,a=r.sizeBytes,l=yield o.module({id:e});if(!l)throw new Error("Module not found");if(l.is_public)throw new Error("Public module deployment is temporarily not recommended");var u=t.version||t.name||l.name||"Untitled",c=(0,E.w9)(t.changelogs);if(t.dryRun)return n&&n.stop(),void(0,w.S5)({action:"module.release",target:k(l,e),request:{name:t.name||null,version:u,changelogs:t.changelogs||null,configSource:s,configSizeBytes:a},checks:[(0,w.Iy)("module exists",!0,`${l.name} (${l._id})`),(0,w.Iy)("module is private",!l.is_public),(0,w.Iy)("release config loaded",!0,`${a} bytes`)],json:t.json});var d=yield o.releaseModule({id:e,config:i,...t.name?{name:t.name}:{},releaseCurrentVersion:u,releaseCurrentVersionNote:c});t.json?(0,w.yd)({action:"module.release",target:k(d||l,e),result:{name:t.name||null,version:u,configSource:s,configSizeBytes:a},json:!0}):n.succeed(`Module released: ${D.default.green(d?.name||l.name)}`)}catch(o){t.json?(0,_.OW)(o.message,{action:"module.release",target:{id:e}}):n.fail(`Failed to release module: ${o.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),S.command("project-pull <id>").description("Pull module source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((f=h(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,y.default)("Pulling module project...").start();try{var r=yield o.moduleProject({id:e,buildApplicationOnly:!0});r||(n?n.fail("Module project not found"):console.error(JSON.stringify({error:"Module project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(r)):(n.succeed(`Module project fetched: ${D.default.green(r.files?.length||0)} files`),console.log(JSON.stringify(r,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to pull module project: ${e.message}`),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),S.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from a module").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((g=h(function*(e,t){var n=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield n("module",e,t)}),function(e,t){return g.apply(this,arguments)}))},64756:e=>{e.exports=t("tls")},65181:(e,t,o)=>{const{Argument:n}=o(41762),{Command:r}=o(18572),{CommanderError:i,InvalidArgumentError:s}=o(43823),{Help:a}=o(99690),{Option:l}=o(92088);t.DM=new r,t.gu=e=>new r(e),t.Ww=(e,t)=>new l(e,t),t.er=(e,t)=>new n(e,t),t.uB=r,t.c$=l,t.ef=n,t._V=a,t.b7=i,t.Di=s,t.a2=s},65692:e=>{e.exports=t("https")},66442:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n},e.exports.__esModule=!0,e.exports.default=e.exports},68832:(e,t,o)=>{var n=o(3634),r=o(96525),i=o(78243),s=o(5523);e.exports=function(e,t){return n(e)||r(e,t)||i(e,t)||s()},e.exports.__esModule=!0,e.exports.default=e.exports},69278:e=>{e.exports=t("net")},69504:(e,t,o)=>{o.d(t,{B:()=>A});var n,r,i,s,a,l,u,c,d,p,f,g,h,m,D,y,v=o(99436),F=o(35679),b=o(88568),_=o(29790),C=o(79896),$=o(35704),E=o(34992),w=o(88055),k=o(75706),S=o(13675),x=o(6939),O=(e,t)=>(0,x.H_)(e,t,{currentVersion:e?.current_version||null,unreleasedChanges:Boolean(e?.has_unreleased_changes)}),A=new F.uB("app").description("Application management");A.command("new").description("Create a new application").requiredOption("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("--layout-width <width>","Layout width",parseInt).option("--layout-height <height>","Layout height",parseInt).option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((n=v(function*(e){var t=(0,w.requireAuth)(),n=e.json?null:(0,_.default)("Creating application...").start();try{var r={name:e.name};e.description&&(r.description=e.description),e.layoutWidth&&(r.layoutWidth=e.layoutWidth),e.layoutHeight&&(r.layoutHeight=e.layoutHeight);var i=yield t.createApplication(r);if(e.json&&!e.init?console.log(JSON.stringify(i,null,2)):e.json||(n.succeed(`Application created: ${b.default.green(i.name)}`),console.log(` ID: ${b.default.gray(i._id)}`),i.description&&console.log(` ${b.default.gray(i.description)}`)),e.init){n&&n.stop();var s=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield s("application",i._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):n.fail(`Failed to create application: ${t.message}`),process.exit(1)}}),function(e){return n.apply(this,arguments)})),A.command("share-info <applicationId>").description("Show public share info (releases available for share-new) for an application").option("-j, --json","Output as JSON").action((r=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Fetching share info...").start();try{var r=yield o.publicApplicationShareInfo({id:e});if(n&&n.stop(),!r)return void(t.json?console.log(JSON.stringify(null)):console.log(b.default.yellow("No share info found for this application")));if(t.json)return void console.log(JSON.stringify(r,null,2));var i=[...r.share?.selected_releases||[]].sort((e,t)=>new Date(t.date||0)-new Date(e.date||0));console.log(b.default.bold(`\nShare Info: ${r.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`App ID: ${b.default.gray(r._id)}`),r.description&&console.log(`Description: ${r.description}`),r.owner?.id_from_user&&console.log(`Owner: ${b.default.gray(r.owner.id_from_user)}`),r.share?.tags?.length&&console.log(`Tags: ${r.share.tags.join(", ")}`),r.share?.type&&console.log(`Type: ${r.share.type}`),console.log(`\n${b.default.bold("Selected Releases")} (${i.length})`),0===i.length?console.log(b.default.gray(" None")):i.forEach(e=>{console.log(`\n ${b.default.cyan(e.name||"(unnamed)")} ${b.default.gray(e.date||"")}`),console.log(` Version ID: ${b.default.green(e.version)}`),console.log(` Release ID: ${b.default.gray(e._id)}`),e.note&&console.log(` Note: ${b.default.gray(e.note)}`)}),console.log("\n"+"─".repeat(60)),console.log(b.default.gray("Use:"),`bricks app share-new --app-id ${r._id} --version <name>`),console.log(b.default.gray("Or: "),"bricks app share-new --version-id <Version ID>")}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to fetch share info: ${e.message}`),process.exit(1)}}),function(e,t){return r.apply(this,arguments)})),A.command("share-new").description("Create a new application from a shared release version").option("--app-id <id>","Source shared application ID (requires --version)").option("--version <name>","Release name to use from the source app (requires --app-id)").option("--version-id <id>","Share version ID (from `app share-info`); skips lookup").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("--skip-if-exists","Return existing application if one already exists with this share version").option("--init","Initialize a BRICKS Project after creation").option("-o, --output <dir>","Output directory for --init (default: current directory)").option("-y, --yes","Skip prompts for --init").option("-j, --json","Output as JSON").action((i=v(function*(e){var t=(0,w.requireAuth)(),n=e.json?null:(0,_.default)("Creating application from shared version...").start();try{if(!(e.versionId||e.appId&&e.version))throw new Error("Provide --version-id, or both --app-id and --version. Run `bricks app share-info <appId>` to discover values.");var r=e.versionId;if(!r){n&&(n.text="Resolving share version...");var i=yield t.publicApplicationShareInfo({id:e.appId}),s=i?.share?.selected_releases||[],a=s.find(t=>t.name===e.version);if(!a){var l=s.map(e=>e.name).filter(Boolean).join(", ")||"none";throw new Error(`Release "${e.version}" not found on app ${e.appId}. Available: ${l}`)}r=a.version,n&&(n.text="Creating application from shared version...")}var u={shareVersionId:r};e.name&&(u.name=e.name),e.description&&(u.description=e.description),e.skipIfExists&&(u.skipIfExists=!0);var c=yield t.createApplicationWithShareVersion(u);if(e.json&&!e.init?console.log(JSON.stringify(c,null,2)):e.json||(n.succeed(`Application created: ${b.default.green(c.name)}`),console.log(` ID: ${b.default.gray(c._id)}`),c.description&&console.log(` ${b.default.gray(c.description)}`)),e.init){n&&n.stop();var d=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield d("application",c._id,{output:e.output,yes:e.yes,json:e.json})}}catch(t){e.json?console.error(JSON.stringify({error:t.message})):n.fail(`Failed to create application from shared version: ${t.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)})),A.command("list").description("List all applications").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action((s=v(function*(e){var t=(0,w.requireAuth)(),o=(0,_.default)("Fetching applications...").start();try{var n=yield t.applications({keyword:e.keyword});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(b.default.yellow("No applications found"));console.log(b.default.bold("\nApplications")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.has_unreleased_changes?b.default.yellow("●"):b.default.green("●"),o=e.current_version?`v${e.current_version}`:b.default.gray("no version");console.log(`${t} ${b.default.cyan(e.name)} ${b.default.gray(o)}`),console.log(` ID: ${b.default.gray(e._id)}`),e.description&&console.log(` ${b.default.gray(e.description)}`),console.log()})}catch(e){o.fail(`Failed to list applications: ${e.message}`),process.exit(1)}}),function(e){return s.apply(this,arguments)})),A.command("get <id>").description("Get application details").option("-c, --composed","Get composed configuration").option("-j, --json","Output as JSON").action((a=v(function*(e,t){var o=(0,w.requireAuth)(),n=(0,_.default)("Fetching application...").start();try{var r=yield o.application({id:e,composed:t.composed});if(n.stop(),r||(console.log(b.default.red("Application not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));if(console.log(b.default.bold(`\nApplication: ${r.name}`)),console.log("─".repeat(60)),console.log(`ID: ${b.default.gray(r._id)}`),console.log(`Description: ${r.description||b.default.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||b.default.gray("None")}`),console.log(`Created: ${b.default.gray(r.create_datetime)}`),console.log(`Modified: ${b.default.gray(r.last_modify_datetime)}`),console.log(`\n${b.default.bold("Version")}`),r.current_version){if(console.log(`Current: v${r.current_version}`),r.current_version_details){var i=r.current_version_details;i.name&&console.log(`Release Name: ${i.name}`),i.note&&console.log(`Release Note: ${b.default.gray(i.note)}`),i.create_datetime&&console.log(`Released At: ${b.default.gray(i.create_datetime)}`)}}else console.log(`Current: ${b.default.gray("No version")}`);if(console.log(`Unreleased: ${r.has_unreleased_changes?b.default.yellow("Yes"):b.default.green("No")}`),console.log(`\n${b.default.bold("Features")}`),console.log(`Short Edit: ${r.short_edit?.enabled?b.default.green("Enabled"):b.default.gray("Disabled")}`),r.short_edit?.enabled&&r.short_edit.ref_map){var s=Object.keys(r.short_edit.ref_map).length;console.log(` References: ${s} editable properties`)}console.log(`Automation: ${r.canvas_control?.enable_schedule?b.default.green("Scheduled"):b.default.gray("No schedule")}`),r.lock?.enabled&&console.log(`Locked: ${b.default.yellow("Yes")}`),r.sync_key&&console.log(`Sync Key: ${b.default.gray(r.sync_key)}`),r.devices?.length>0?(console.log(`\n${b.default.bold("Bound Devices")} (${r.devices.length})`),r.devices.forEach(e=>{var t="active"===e.status?b.default.green("●"):b.default.gray("○"),o=e.frame?b.default.gray(` [${e.frame.x||0},${e.frame.y||0} ${e.frame.width}x${e.frame.height}]`):"";console.log(` ${t} ${e.device_id}${o}`)})):console.log(`\n${b.default.bold("Bound Devices")}: ${b.default.gray("None")}`),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get application: ${e.message}`),process.exit(1)}}),function(e,t){return a.apply(this,arguments)})),A.command("resolve <query>").description("Resolve an application name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((l=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Resolving application...").start();try{var r=yield(0,k.Y)(()=>o.application({id:e})),i=r?[r]:yield o.applications({keyword:e,paginate:{limit:t.limit}}),s=(0,k.K)({resource:"application",query:e,items:i||[],fields:["_id","name"],selectedBy:r?"id":null});if(n&&n.stop(),t.json)return void(0,E.GF)(s);if(s.resolved){var a=s.resolved;return console.log(b.default.bold("\nResolved Application")),console.log("─".repeat(60)),console.log(`Name: ${b.default.cyan(a.name||"Unnamed")}`),console.log(`ID: ${b.default.gray(a._id)}`),console.log(`Selected By: ${s.selectedBy}`),void console.log("─".repeat(60))}if(0===s.matches.length)return void console.log(b.default.yellow(`No applications matched "${e}"`));console.log(b.default.bold(`\nMatching Applications (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${b.default.cyan(e.name||"Unnamed")} ${b.default.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){n?n.fail(`Failed to resolve application: ${t.message}`):(0,E.OW)(t.message,{resource:"application",query:e}),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),A.command("update <id>").description("Update application name, description, and/or configuration").option("-n, --name <name>","Application name").option("-d, --description <description>","Application description").option("-c, --config <json>","Application config as JSON string").option("-f, --file <path>","Application config from file").option("--validate","Validate configuration (default: true when config is set)",!0).option("--no-validate","Skip server-side config validation").option("--last-commit-id <id>","Reject if server config.bricks_project_last_commit_id does not match this value").option("-j, --json","Output as JSON").action((u=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Updating application...").start();try{var r=yield o.updateApplication((0,x.jB)(e,t));t.json?(0,x.yd)({action:"application.update",target:O(r,e),result:{lastCommitId:t.lastCommitId||null},json:!0}):(n.succeed(`Application updated: ${b.default.green(r.name)}`),r.has_unreleased_changes&&console.log(b.default.yellow("Note: Application has unreleased changes")))}catch(o){t.json?(0,E.OW)(o.message,{action:"application.update",target:{id:e}}):n.fail(`Failed to update application: ${o.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),A.command("short-edit <id>").description("Short edit application properties").requiredOption("-l, --list <json>","Short edit list as JSON array").action((c=v(function*(e,t){var o=(0,w.requireAuth)(),n=(0,_.default)("Applying short edit...").start();try{var r=JSON.parse(t.list);Array.isArray(r)||(n.fail("List must be a JSON array"),process.exit(1));var i=yield o.shortEditApplication({id:e,list:r});n.succeed(`Short edit applied to: ${b.default.green(i.name)}`)}catch(e){n.fail(`Failed to apply short edit: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),A.command("short-refs <id>").description("List short edit references for an application").option("-k, --keyword <keyword>","Filter by shortId or title").option("-t, --types <types>","Comma-separated shortId prefixes to include (e.g. B,C,S)").option("-j, --json","Output as JSON").action((d=v(function*(e,t){var o=(0,w.requireAuth)(),n=(0,_.default)("Fetching short edit references...").start();try{var r=yield o.application({id:e});if(n.stop(),!r?.short_edit?.enabled)return void console.log(b.default.yellow("Short Edit is not enabled for this application"));var i=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):[],s=(0,$.V)(r.short_edit.ref_map,{keyword:t.keyword,types:i});if(t.json)return void console.log(JSON.stringify(s,null,2));if(0===s.length)return void console.log(b.default.yellow("No short edit references found"));console.log(b.default.bold(`\nShort Edit References: ${r.name}`)),s.forEach(e=>{console.log(b.default.cyan(`\n${e.label} (${e.prefix}_)`)),e.refs.forEach(({shortId:e,ref:t})=>{var o=t?.title?b.default.gray(`- ${t.title}`):"";console.log(` ${b.default.green(e)} ${o}`)})}),console.log()}catch(e){n.fail(`Failed to fetch short edit references: ${e.message}`),process.exit(1)}}),function(e,t){return d.apply(this,arguments)})),A.command("bind <id>").description("Bind devices to application").option("-b, --bind <devices>","Device IDs to bind (comma-separated)").option("-u, --unbind <devices>","Device IDs to unbind (comma-separated)").option("--dry-run","Validate inputs and show the binding plan without applying it").option("-j, --json","Output as JSON").action((p=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Updating device bindings...").start();try{var r=yield o.application({id:e});if(!r)throw new Error("Application not found");var i=t.bind?t.bind.split(",").map(e=>e.trim()):[],s=t.unbind?t.unbind.split(",").map(e=>e.trim()):[],a={id:e};if(i.length>0&&(a.bindDevices=i),s.length>0&&(a.unbindDevices=s),t.dryRun)return n&&n.stop(),void(0,x.S5)({action:"application.bind",target:O(r,e),request:{bindDevices:i,unbindDevices:s},checks:[(0,x.Iy)("application exists",!0,`${r.name} (${r._id})`),(0,x.Iy)("device changes provided",i.length+s.length>0,`bind=${i.length}, unbind=${s.length}`)],json:t.json});yield o.bindApplication(a),t.json?(0,x.yd)({action:"application.bind",target:O(r,e),result:{bindDevices:i,unbindDevices:s},json:!0}):n.succeed("Device bindings updated")}catch(o){t.json?(0,E.OW)(o.message,{action:"application.bind",target:{id:e}}):n.fail(`Failed to update bindings: ${o.message}`),process.exit(1)}}),function(e,t){return p.apply(this,arguments)})),A.command("remove <id>").description("Remove an application").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((f=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Removing application...").start();try{var r=yield o.application({id:e});if(!r)throw new Error("Application not found");var i=O(r,e);if(t.dryRun)return n&&n.stop(),void(0,x.S5)({action:"application.remove",target:i,request:{id:e},checks:[(0,x.Iy)("application exists",!0,`${i.name} (${i.id})`)],json:t.json});var s=yield o.removeApplication({id:e});t.json?(0,x.yd)({action:"application.remove",target:i,result:{removed:Boolean(s)},json:!0}):n.succeed(`Application removed: ${b.default.green(i.name)}`)}catch(o){t.json?(0,E.OW)(o.message,{action:"application.remove",target:{id:e}}):n.fail(`Failed to remove application: ${o.message}`),process.exit(1)}}),function(e,t){return f.apply(this,arguments)})),A.command("trigger <id> <testId>").description("Trigger automation test on application").option("--play","Play the test",!0).option("--stop","Stop the test").option("--setup-at-launch","Setup to run at app launch").option("-g, --match-group <group>","Match group").action((g=v(function*(e,t,o){var n=(0,w.requireAuth)(),r=(0,_.default)("Triggering automation...").start();try{yield n.triggerApplicationCanvasControl({id:e,testId:t,play:!o.stop&&o.play,setupAtLaunch:o.setupAtLaunch,matchGroup:o.matchGroup}),r.succeed(`Automation triggered: ${b.default.green(t)}`)}catch(e){r.fail(`Failed to trigger automation: ${e.message}`),process.exit(1)}}),function(e,t,o){return g.apply(this,arguments)})),A.command("release <id>").description("Release application to BRICKS platform").requiredOption("-c, --config <path|json>","Application config file path or JSON string").option("-n, --name <name>","Update application name as part of the release").option("--version <version>","Version name").option("--changelogs <text>","Release changelogs").option("--dry-run","Validate inputs and show the release plan without publishing").option("-j, --json","Output as JSON").action((h=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Releasing application...").start();try{var r=(0,S.Ku)(t.config),i=r.config,s=r.source,a=r.sizeBytes,l=yield o.application({id:e});if(!l)throw new Error("Application not found");if(l.lock?.enabled)throw new Error("Application is locked");var u=t.version||t.name||l.name||"Untitled",c=(0,S.w9)(t.changelogs);if(t.dryRun)return n&&n.stop(),void(0,x.S5)({action:"application.release",target:O(l,e),request:{name:t.name||null,version:u,changelogs:t.changelogs||null,configSource:s,configSizeBytes:a},checks:[(0,x.Iy)("application exists",!0,`${l.name} (${l._id})`),(0,x.Iy)("application is unlocked",!l.lock?.enabled),(0,x.Iy)("release config loaded",!0,`${a} bytes`)],json:t.json});var d=yield o.releaseApplication({id:e,config:i,...t.name?{name:t.name}:{},releaseCurrentVersion:u,releaseCurrentVersionNote:c});t.json?(0,x.yd)({action:"application.release",target:O(d||l,e),result:{name:t.name||null,version:u,configSource:s,configSizeBytes:a},json:!0}):n.succeed(`Application released: ${b.default.green(d?.name||l.name)}`)}catch(o){t.json?(0,E.OW)(o.message,{action:"application.release",target:{id:e}}):n.fail(`Failed to release application: ${o.message}`),process.exit(1)}}),function(e,t){return h.apply(this,arguments)})),A.command("project-pull <id>").description("Pull application source files from BRICKS platform").option("-j, --json","Output as JSON (for programmatic use)").action((m=v(function*(e,t){var o=(0,w.requireAuth)(),n=t.json?null:(0,_.default)("Pulling application project...").start();try{var r=yield o.applicationProject({id:e,buildApplicationOnly:!0});r||(n?n.fail("Application project not found"):console.error(JSON.stringify({error:"Application project not found"})),process.exit(1)),t.json?console.log(JSON.stringify(r)):(n.succeed(`Application project fetched: ${b.default.green(r.files?.length||0)} files`),console.log(JSON.stringify(r,null,2)))}catch(e){t.json?console.error(JSON.stringify({error:e.message})):n.fail(`Failed to pull application project: ${e.message}`),process.exit(1)}}),function(e,t){return m.apply(this,arguments)})),A.command("check-config <path>").description("Validate application config against BRICKS schema").option("-j, --json","Output as JSON").option("--validate-automation","Also validate automation_map and test_map references (skips commented/unfinished steps)").option("--no-validate-expressions","Skip validating PROPERTY_BANK_EXPRESSION strings against the runtime expression rules").action((D=v(function*(e,t){C.existsSync(e)||(console.error(b.default.red(`Config file not found: ${e}`)),process.exit(1));var n=(0,_.default)("Validating config...").start();try{var r=C.readFileSync(e,"utf-8"),i=JSON.parse(r),s=yield Promise.all([o.e(428),o.e(236),o.e(703),o.e(890)]).then(o.t.bind(o,38890,19)),a=s.checkConfig,l=s.checkConfigDeprecatedFeatures,u=a(i,{checkAutomation:!!t.validateAutomation,checkCalc:!0,checkExpressions:!1!==t.validateExpressions}),c=l(i);if(n.stop(),t.json)return console.log(JSON.stringify({...u,deprecations:c},null,2)),void(u.valid||process.exit(1));if(u.valid&&0===c.length)return void console.log(b.default.green("✓ Config is valid"));console.log(b.default.bold("\nConfig Validation Report")),console.log("─".repeat(60)),u.schema.length>0&&(console.log(b.default.red(`\n Schema Errors (${u.schema.length})\n`)),u.schema.forEach((e,t)=>{var o=e.instancePath||e.dataPath||"/";console.log(` ${b.default.red(`${t+1}.`)} ${b.default.bold(o)}`),console.log(` ${e.message}`),e.params?.pattern&&console.log(` ${b.default.gray(`pattern: ${e.params.pattern}`)}`)})),u.ref.length>0&&(console.log(b.default.red(`\n Reference Errors (${u.ref.length})\n`)),u.ref.forEach((e,t)=>{console.log(` ${b.default.red(`${t+1}.`)} ${b.default.bold(e.field)}`),console.log(` ${e.message}`)})),u.calc.length>0&&(console.log(b.default.red(`\n Data Calculation Errors (${u.calc.length})\n`)),u.calc.forEach((e,t)=>{console.log(` ${b.default.red(`${t+1}.`)} ${b.default.bold(e.field)}`),console.log(` ${e.message}`)})),u.expression?.length>0&&(console.log(b.default.red(`\n Expression Errors (${u.expression.length})\n`)),u.expression.forEach((e,t)=>{console.log(` ${b.default.red(`${t+1}.`)} ${b.default.bold(e.field)}`),console.log(` ${e.message}`)})),c.length>0&&(console.log(b.default.yellow(`\n Deprecation Warnings (${c.length})\n`)),c.forEach((e,t)=>{console.log(` ${b.default.yellow(`${t+1}.`)} ${b.default.bold(e.id)}`),console.log(` ${e.data}`)})),console.log("\n"+"─".repeat(60));var d=u.schema.length+u.ref.length+u.calc.length+(u.expression?.length||0);u.valid?console.log(b.default.yellow(`⚠ ${c.length} warning(s)`)):console.log(b.default.red(`✗ ${d} error(s)`)+(c.length>0?b.default.yellow(`, ${c.length} warning(s)`):"")),u.valid||process.exit(1)}catch(e){n.fail(`Failed to validate config: ${e.message}`),process.exit(1)}}),function(e,t){return D.apply(this,arguments)})),A.command("ctor-init <id>").alias("project-init").description("Initialize a BRICKS Project from an application").option("-o, --output <dir>","Output directory (default: current directory)").option("--github-actions","Include GitHub Actions workflow (default: true)").option("--no-github-actions","Skip GitHub Actions workflow setup").option("--agents","Include AGENTS.md (default: true)").option("--no-agents","Skip AGENTS.md setup").option("--claude","Include CLAUDE.md (default: true)").option("--no-claude","Skip CLAUDE.md setup").option("--gemini","Include GEMINI.md (default: false)").option("--no-gemini","Skip GEMINI.md setup").option("--install","Run bun install after generation (default: true)").option("--no-install","Skip bun install after generation").option("--git","Initialize git repository (default: true)").option("--no-git","Skip git initialization").option("-y, --yes","Skip prompts and use defaults/flags").option("-j, --json","Output as JSON (for programmatic use)").action((y=v(function*(e,t){var n=(yield Promise.all([o.e(637),o.e(153)]).then(o.bind(o,47153))).initProject;yield n("application",e,t)}),function(e,t){return y.apply(this,arguments)}))},70857:e=>{e.exports=t("os")},71178:(e,t,o)=>{e.exports=(e=>{var t={};return o.d(t,e),t})({Fragment:()=>i.Fragment,jsx:()=>i.jsx,jsxs:()=>i.jsxs})},73024:e=>{e.exports=t("node:fs")},73087:(e,o,n)=>{n.d(o,{s:()=>F});var r=n(99436),i=n(35679),s=n(88568),a=n(29790);const l=t("readline");var u,c,d,p,f,g=n(74752),h=n(34992),m=n(59138),D=e=>!!e&&"object"==typeof e&&!Array.isArray(e),y=(e={})=>{var t=D(e)?e:{},o=t.plan,n=D(o)?o:{},r=D(t.lock)?t.lock:{},i="string"==typeof o?o:n.type;return{...t,plan:{...n,type:i||"free"},lock:{...r,features:!!r.features}}},v=(u=r(function*(){var e=(0,g.getCurrentProfile)(),t=(0,g.getCurrentProfileSource)(),o=(0,g.getTokenInfo)(e),n=(0,g.getBaseUrl)();if(!o?.token)return{ok:!1,profile:e,profileSource:t,baseUrl:n,auth:{available:!1,source:"missing",workspaceId:null,workspaceName:null,createdAt:null,tokenPreview:null},workspace:null,error:null};try{var r=(0,(yield(0,m.i)()).createClient)(n,o.token),i=yield r.workspace();return{ok:!0,profile:e,profileSource:t,baseUrl:n,auth:{available:!0,source:"config",workspaceId:i?._id||o.workspaceId||null,workspaceName:i?.name||o.workspaceName||null,createdAt:o.createdAt||null,tokenPreview:(0,h.$l)(o.token)},workspace:i?{_id:i._id,name:i.name,description:i.description||null}:null,error:null}}catch(r){return{ok:!1,profile:e,profileSource:t,baseUrl:n,auth:{available:!0,source:"config",workspaceId:o.workspaceId||null,workspaceName:o.workspaceName||null,createdAt:o.createdAt||null,tokenPreview:(0,h.$l)(o.token)},workspace:null,error:{message:r.message}}}}),function(){return u.apply(this,arguments)}),F=new i.uB("auth").description("Authentication and token management");F.command("login").description("Login with a one-time passcode from BRICKS Controller (recommended)").argument("[passcode]","One-time passcode from BRICKS Controller").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((c=r(function*(e,t){var o,n,r=t.profile||(0,g.getCurrentProfile)(),i=t.name,u=e;u||(console.log(s.default.cyan("Generate a one-time passcode from BRICKS Controller:")),console.log(s.default.gray(" 1. Open the link below (or select your workspace first)")),console.log(` ${s.default.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(s.default.gray(' 2. Click "Generate OTP" to create a one-time passcode\n')),(u=yield(o="Enter passcode: ",n=l.createInterface({input:process.stdin,output:process.stdout}),new Promise(e=>{n.question(o,t=>{n.close(),e(t.trim())})})))||(console.log(s.default.red("Passcode is required")),process.exit(1)));var c=(0,a.default)("Validating passcode...").start();try{var d=yield(0,m.i)(),p=d.createClient,f=(0,d.createPublicClient)((0,g.getBaseUrl)()),h=yield f.checkWorkspaceOTP(u);h.valid||(c.fail(`Invalid passcode: ${h.error||"Unknown error"}`),process.exit(1)),c.text=`Exchanging passcode for token (workspace: ${h.workspaceName})...`;var D=yield f.exchangeWorkspaceOTP(u);D.token||(c.fail("Failed to obtain token"),process.exit(1));var v=p((0,g.getBaseUrl)(),D.token),F=yield v.workspace();F||(c.fail("Token validation failed"),process.exit(1)),(0,g.setToken)(r,{token:D.token,name:i||F.name,workspaceId:F._id,workspaceName:F.name,workspaceBilling:y(F.billing)}),(0,g.setCurrentProfile)(r),c.succeed(`Logged in to workspace: ${s.default.green(F.name)} (profile: ${s.default.cyan(r)})`)}catch(e){c.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),F.command("login-token").description("Login with a workspace token directly").option("-t, --token <token>","Workspace token").option("-p, --profile <profile>","Profile name to save the token").option("-n, --name <name>","Profile display name").action((d=r(function*(e){var t=e.profile||(0,g.getCurrentProfile)(),o=e.token,n=e.name;o||(console.error(s.default.red("Error: Token is required. Use -t or --token to provide it.")),console.log(s.default.gray("\nYou can get a workspace token from BRICKS Controller:")+s.default.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")),console.log(` ${s.default.underline.blue("https://control.bricks.tools/#/?action=manage-tokens")}`),console.log(s.default.gray("Select your workspace and create a new token.\n")),console.log(s.default.yellow("Tip: Use `bricks auth login` for a simpler OTP-based login.")),process.exit(1));var r=(0,a.default)("Validating token...").start();try{var i=(0,(yield(0,m.i)()).createClient)((0,g.getBaseUrl)(),o),l=yield i.workspace();l||(r.fail("Invalid token or unable to access workspace"),process.exit(1)),(0,g.setToken)(t,{token:o,name:n||l.name,workspaceId:l._id,workspaceName:l.name,workspaceBilling:y(l.billing)}),(0,g.setCurrentProfile)(t),r.succeed(`Logged in to workspace: ${s.default.green(l.name)} (profile: ${s.default.cyan(t)})`)}catch(e){r.fail(`Login failed: ${e.message}`),process.exit(1)}}),function(e){return d.apply(this,arguments)})),F.command("logout").description("Remove saved token").option("-p, --profile <profile>","Profile to remove").option("-a, --all","Remove all profiles").action((p=r(function*(e){var t=e.profile;if(e.all)return(0,g.listProfiles)().forEach(e=>(0,g.removeToken)(e.name)),void console.log(s.default.green("All profiles removed"));var o=t||(0,g.getCurrentProfile)();(0,g.getTokenInfo)(o)?((0,g.removeToken)(o),console.log(s.default.green(`Logged out from profile: ${o}`))):console.log(s.default.yellow(`No token found for profile: ${o}`))}),function(e){return p.apply(this,arguments)})),F.command("status").description("Show current authentication status").option("-j, --json","Output as JSON").action((f=r(function*(e){var t=(0,g.getCurrentProfile)(),o=(0,g.getTokenInfo)(t);if(!o)return e.json?void(0,h.GF)(yield v()):(console.log(s.default.yellow("Not logged in")),void console.log(s.default.gray("Use `bricks auth login` to login")));if(e.json)(0,h.GF)(yield v());else{var n=(0,a.default)("Checking connection...").start();try{var r=(0,(yield(0,m.i)()).createClient)((0,g.getBaseUrl)(),o.token),i=yield r.workspace();n.stop(),console.log(s.default.bold("\nAuthentication Status")),console.log("─".repeat(40)),console.log(`Profile: ${s.default.cyan(t)}`),console.log(`Workspace: ${s.default.green(i.name)}`),console.log(`Workspace ID: ${s.default.gray(i._id)}`);var l=(0,g.getBaseUrl)(),u=o.baseUrl;console.log(`Base URL: ${s.default.gray(l)}${u?"":s.default.gray(" (global)")}`),console.log(`Logged in: ${s.default.gray(o.createdAt)}`),console.log("─".repeat(40))}catch(e){n.fail(`Connection failed: ${e.message}`)}}}),function(e){return f.apply(this,arguments)})),F.command("list").description("List all saved profiles").action(()=>{var e=(0,g.listProfiles)();if(0===e.length)return console.log(s.default.yellow("No saved profiles")),void console.log(s.default.gray("Use `bricks auth login` to login"));console.log(s.default.bold("\nSaved Profiles")),console.log("─".repeat(60)),e.forEach(e=>{var t=e.current?s.default.green("● "):" ",o=e.current?s.default.green(e.name):e.name,n=e.baseUrl?s.default.gray(` [${e.baseUrl}]`):"";console.log(`${t}${o.padEnd(15)} ${s.default.gray(e.workspaceName||"Unknown")}${n}`)}),console.log("─".repeat(60))}),F.command("use <profile>").description("Switch to a different profile").action(e=>{var t=(0,g.getTokenInfo)(e);if(!t)return console.log(s.default.red(`Profile not found: ${e}`)),void console.log(s.default.gray("Use `bricks auth list` to see available profiles"));(0,g.setCurrentProfile)(e),console.log(s.default.green(`Switched to profile: ${e}`)),t.workspaceName&&console.log(s.default.gray(`Workspace: ${t.workspaceName}`))}),F.command("set-url <url>").description("Set the base URL for the current profile").option("-g, --global","Set the global base URL instead of per-profile").action((e,t)=>{if(t.global)(0,g.setBaseUrl)(e),console.log(s.default.green(`Global base URL set to: ${e}`));else{var o=(0,g.getCurrentProfile)();(0,g.setBaseUrl)(e,o),console.log(s.default.green(`Base URL for profile ${s.default.cyan(o)} set to: ${e}`))}})},74445:(e,t,o)=>{o.r(t),o.d(t,{isInteractiveTerminal:()=>n,shouldStartInteractiveMode:()=>r});var n=()=>Boolean(process.stdin.isTTY&&process.stdout.isTTY&&"function"==typeof process.stdin.setRawMode),r=(e=[])=>0===e.length&&n()},74752:(e,t,o)=>{o.d(t,{CONFIG_DIR:()=>i,CONFIG_PATH:()=>a,clearBankCredentials:()=>$,clearConfig:()=>k,default:()=>S,getActivityLogBaseUrl:()=>E,getBankCredentials:()=>_,getBaseUrl:()=>u,getCurrentProfile:()=>y,getCurrentProfileSource:()=>v,getToken:()=>p,getTokenInfo:()=>f,getTokens:()=>d,listProfiles:()=>b,removeToken:()=>h,setActivityLogBaseUrl:()=>w,setBankCredentials:()=>C,setBaseUrl:()=>c,setCurrentProfile:()=>F,setProfileOverride:()=>D,setToken:()=>g}),o.r(t);var n=o(16928),r=o(70857),i=n.join(r.homedir(),".bricks-cli"),a=n.join(i,"config.json"),l=new s({projectName:"bricks-cli",cwd:i,schema:{tokens:{type:"object",default:{},additionalProperties:{type:"object",properties:{token:{type:"string"},name:{type:"string"},workspaceId:{type:"string"},workspaceName:{type:"string"},workspaceBilling:{type:"object"},createdAt:{type:"string"},baseUrl:{type:"string"},bank:{type:"object"}}}},currentProfile:{type:"string",default:"default"},baseUrl:{type:"string",default:"https://display.bricks.tools"},activityLogBaseUrl:{type:"string",default:"https://activity-log.bricks.tools"}}}),u=()=>{var e=y(),t=l.get("tokens");return t[e]?.baseUrl||l.get("baseUrl")},c=(e,t)=>{if(t){var o=l.get("tokens");o[t]||(o[t]={}),o[t].baseUrl=e,l.set("tokens",o)}else l.set("baseUrl",e)},d=()=>l.get("tokens"),p=(e="default")=>{var t=l.get("tokens");return t[e]?.token},f=(e="default")=>l.get("tokens")[e],g=(e,t)=>{var o=l.get("tokens"),n=o[e];o[e]={...n?.baseUrl?{baseUrl:n.baseUrl}:{},...n?.activityLogBaseUrl?{activityLogBaseUrl:n.activityLogBaseUrl}:{},...t,createdAt:(new Date).toISOString()},l.set("tokens",o)},h=e=>{var t=l.get("tokens");delete t[e],l.set("tokens",t)},m=null,D=e=>{m=e},y=()=>m||process.env.BRICKS_PROFILE||l.get("currentProfile"),v=()=>m?"override":process.env.BRICKS_PROFILE?"env":"config",F=e=>l.set("currentProfile",e),b=()=>{var e=l.get("tokens"),t=l.get("currentProfile");return Object.keys(e).map(o=>({...e[o],name:o,current:o===t}))},_=(e="default")=>{var t=l.get("tokens");return t[e]?.bank||null},C=(e,t)=>{var o=l.get("tokens");o[e]||(o[e]={}),o[e].bank=t,l.set("tokens",o)},$=e=>{var t=l.get("tokens");return!!t[e]?.bank&&(delete t[e].bank,l.set("tokens",t),!0)},E=()=>{var e=y(),t=l.get("tokens");return t[e]?.activityLogBaseUrl||l.get("activityLogBaseUrl")},w=(e,t)=>{if(t){var o=l.get("tokens");o[t]||(o[t]={}),o[t].activityLogBaseUrl=e,l.set("tokens",o)}else l.set("activityLogBaseUrl",e)},k=()=>{l.clear()};const S=l},75706:(e,t,o)=>{o.d(t,{K:()=>s,Y:()=>a});var n,r=o(99436),i=e=>String(e||"").trim().toLowerCase(),s=({resource:e,query:t,items:o,fields:n,selectedBy:r=null})=>{var s=i(t),a=o.filter(e=>n.some(t=>i(((e,t)=>t.split(".").reduce((e,t)=>e?.[t],e)??null)(e,t))===s)),l=null,u=r;return"id"===r?l=o[0]||null:1===a.length?(l=a[0],u="exact"):1===o.length&&(l=o[0],u="single"),{resource:e,query:t,exactMatchCount:a.length,matchCount:o.length,selectedBy:u,ambiguous:o.length>1&&!l,resolved:l,matches:o}},a=(n=r(function*(e){try{return yield e()}catch(e){if(/not found/i.test(e.message))return null;throw e}}),function(e){return n.apply(this,arguments)})},76760:e=>{e.exports=t("node:path")},76982:e=>{e.exports=t("crypto")},77030:e=>{e.exports=t("node:net")},77598:e=>{e.exports=t("node:crypto")},78243:(e,t,o)=>{var n=o(66442);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},78474:e=>{e.exports=t("node:events")},79491:e=>{e.exports=import("oxfmt")},79896:e=>{e.exports=t("fs")},80481:e=>{e.exports=t("node:readline")},81637:(e,t,o)=>{o.d(t,{_:()=>I});var n,r,i,s,a,l,u,c,d,p,f,g,h,m,D=o(68832),y=o(99436),v=o(35679),F=o(88568),b=o(29790),_=o(34992),C=o(88055),$=o(75706),E=o(6939),w=o(1001),k=e=>{if(!e)return F.default.gray("○ Unknown");var t=Date.now()-new Date(e).getTime();if(t<=3e5)return F.default.green("● Online");var o=Math.floor(t/6e4);if(o<60)return F.default.yellow(`○ Offline (${o}m ago)`);var n=Math.floor(o/60);if(n<24)return F.default.red(`○ Offline (${n}h ago)`);var r=Math.floor(n/24);return F.default.red(`○ Offline (${r}d ago)`)},S=e=>e.name||e.device_name||"Unnamed",x=(e,t)=>(0,E.H_)(e,t,{name:S(e),deviceName:e?.device_name||null}),O=(r=y(function*(e,t){var o=yield e.device({id:t});if(!o)throw new Error("Device not found");return o}),function(e,t){return r.apply(this,arguments)}),A=(i=y(function*({id:e,type:t,eventPayload:o,options:n,progressMessage:r,successMessage:i,failureMessage:s="Failed to control device"}){var a=(0,C.requireAuth)(),l=n.json?null:(0,b.default)(r).start();try{var u=yield O(a,e),c=x(u,e);if(n.dryRun)return l&&l.stop(),void(0,E.S5)({action:"device.control",target:c,request:{type:t,eventPayload:o||null},checks:[(0,E.Iy)("device exists",!0,`${c.name} (${c.id})`)],json:n.json});yield a.controlDevice({id:e,type:t,eventPayload:o}),l?l.succeed(i):(0,E.yd)({action:"device.control",target:c,result:{type:t,eventPayload:o||null},json:!0})}catch(o){n.json?(0,_.OW)(o.message,{action:"device.control",target:{id:e},type:t}):l.fail(`${s}: ${o.message}`),process.exit(1)}}),function(e){return i.apply(this,arguments)}),I=new v.uB("device").description("Device management");I.command("list").description("List all devices").option("-k, --keyword <keyword>","Filter by keyword").option("-j, --json","Output as JSON").action((s=y(function*(e){var t=(0,C.requireAuth)(),o=(0,b.default)("Fetching devices...").start();try{var n=yield t.devices({keyword:e.keyword});if(o.stop(),e.json)return void console.log(JSON.stringify(n,null,2));if(!n||0===n.length)return void console.log(F.default.yellow("No devices found"));console.log(F.default.bold("\nDevices")),console.log("─".repeat(80)),n.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,o=k(t),n=e.entry_detail?.application?.name||F.default.gray("No app bound");console.log(`${o} ${F.default.cyan(e.name||e.device_name)}`),console.log(` ID: ${F.default.gray(e._id)}`),console.log(` App: ${n}`),console.log()})}catch(e){o.fail(`Failed to list devices: ${e.message}`),process.exit(1)}}),function(e){return s.apply(this,arguments)})),I.command("get <id>").description("Get device details").option("-j, --json","Output as JSON").action((a=y(function*(e,t){var o=(0,C.requireAuth)(),n=(0,b.default)("Fetching device...").start();try{var r=yield o.device({id:e});if(n.stop(),r||(console.log(F.default.red("Device not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(r,null,2));var i=r.entry_detail?.watch_dog_timer?.last_alive_time,s=k(i);if(console.log(F.default.bold(`\nDevice: ${r.name||r.device_name}`)),console.log("─".repeat(60)),console.log(`Status: ${s}`),console.log(`ID: ${F.default.gray(r._id)}`),console.log(`Device Name: ${r.device_name||F.default.gray("N/A")}`),console.log(`Description: ${r.description||F.default.gray("N/A")}`),console.log(`Tags: ${r.tags?.join(", ")||F.default.gray("None")}`),console.log(`Created: ${F.default.gray(r.create_datetime||"N/A")}`),console.log(`Modified: ${F.default.gray(r.last_modify_datetime||"N/A")}`),r.entry_detail){var a=r.entry_detail;if(console.log(`\n${F.default.bold("Entry Details")}`),console.log(`Type: ${a.type||F.default.gray("N/A")}`),console.log(`Unique ID: ${F.default.gray(a.unique_id||"N/A")}`),console.log(`Version: ${a.operation_version||F.default.gray("N/A")}`),console.log(`Mode: ${a.operation_mode||F.default.gray("N/A")}`),Array.isArray(a.screen)&&a.screen.length>0)console.log(`\n${F.default.bold("Screens")} (${a.screen.length})`),a.screen.forEach((e,t)=>{var o=e.resolution,n=o?`${o.width}x${o.height} @${o.scale}x`:"N/A",r=e.master?F.default.green(" (master)"):"",i=e.orientation?` [${e.orientation}]`:"",s=e.touch?.available?F.default.cyan(` touch:${e.touch.touch_point}pt`):"";console.log(` ${t+1}. ${e.title||"Screen"}${r}${i} - ${n}${s}`)});else if(a.screen?.resolution){var l=a.screen.resolution;console.log(`Resolution: ${l.width}x${l.height} @${l.scale}x`)}var u=null!=a.memory_usage,c=null!=a.disk_usage;if(u||c){if(console.log(`\n${F.default.bold("System Resources")}`),u){var d=Array.isArray(a.memory_usage)?a.memory_usage[0]:a.memory_usage;if(Number.isFinite(d)){var p=Math.round(100*d),f=F.default.green;p>80?f=F.default.red:p>60&&(f=F.default.yellow),console.log(`Memory: ${f(`${p}%`)}`)}else console.log(`Memory: ${F.default.gray("N/A")}`)}if(c){var g=Array.isArray(a.disk_usage)?a.disk_usage[0]:a.disk_usage;if(Number.isFinite(g)){var h=Math.round(100*g),m=F.default.green;h>90?m=F.default.red:h>75&&(m=F.default.yellow),console.log(`Disk: ${m(`${h}%`)}`)}else console.log(`Disk: ${F.default.gray("N/A")}`)}}var D=[];if(a.sound?.available&&D.push("Sound"),a.camera?.available&&D.push("Camera"),a.audio_in?.available&&D.push("Audio Input"),D.length>0&&(console.log(`\n${F.default.bold("Capabilities")}`),console.log(`Available: ${D.join(", ")}`),a.camera?.channel?.length>0&&a.camera.channel.forEach(e=>{var t=e.resolution?`${e.resolution.width}x${e.resolution.height}`:"";console.log(` Camera: ${e.title||"Camera"} ${t} [${e.orientation||"N/A"}]`)})),a.local_sync){var y=a.local_sync;console.log(`\n${F.default.bold("Local Sync")}`),console.log(`Role: ${y.is_main?F.default.cyan("Main"):"Secondary"}`),null!=y.peer_count&&console.log(`Peers: ${y.peer_count}`),null!=y.mean_latency&&console.log(`Latency: ${y.mean_latency.toFixed(2)}ms`)}if(a.update){var v=a.update;console.log(`\n${F.default.bold("Update Status")}`),console.log(`Needs Update: ${v.need_update?F.default.yellow("Yes"):F.default.green("No")}`),v.current_version&&console.log(`App Version: ${v.current_version}`),v.running_mode&&console.log(`Running Mode: ${v.running_mode}`),v.last_update_at&&console.log(`Last Update: ${F.default.gray(v.last_update_at)}`)}if(a.watch_dog_timer){var _=a.watch_dog_timer;console.log(`\n${F.default.bold("Watchdog")}`),console.log(`Alive: ${_.alive?F.default.green("Yes"):F.default.red("No")}`),_.last_launch_time&&console.log(`Last Launch: ${F.default.gray(_.last_launch_time)}`),_.last_alive_time&&console.log(`Last Alive: ${F.default.gray(_.last_alive_time)}`)}}r.bound_application&&(console.log(`\n${F.default.bold("Bound Application")}`),console.log(`Name: ${r.bound_application.name}`),console.log(`ID: ${F.default.gray(r.bound_application._id)}`)),r.env?.variables&&Object.keys(r.env.variables).length>0&&(console.log(`\n${F.default.bold("Environment Variables")}`),Object.entries(r.env.variables).forEach(([e,t])=>{console.log(` ${F.default.cyan(e)}: ${t}`)})),console.log("─".repeat(60))}catch(e){n.fail(`Failed to get device: ${e.message}`),process.exit(1)}}),function(e,t){return a.apply(this,arguments)})),I.command("resolve <query>").description("Resolve a device name or ID to stable IDs").option("-l, --limit <limit>","Limit search results",e=>Number.parseInt(e,10),10).option("-j, --json","Output as JSON").action((l=y(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,b.default)("Resolving device...").start();try{var r=yield(0,$.Y)(()=>o.device({id:e})),i=r||!e?r?[r]:[]:yield o.devices({keyword:e,paginate:{limit:t.limit}}),s=(0,$.K)({resource:"device",query:e,items:r?[r]:i||[],fields:["_id","name","device_name"],selectedBy:r?"id":null});if(n&&n.stop(),t.json)return void(0,_.GF)(s);if(s.resolved){var a=s.resolved;return console.log(F.default.bold("\nResolved Device")),console.log("─".repeat(60)),console.log(`Name: ${F.default.cyan(a.name||a.device_name||"Unnamed")}`),console.log(`ID: ${F.default.gray(a._id)}`),console.log(`Selected By: ${s.selectedBy}`),void console.log("─".repeat(60))}if(0===s.matches.length)return void console.log(F.default.yellow(`No devices matched "${e}"`));console.log(F.default.bold(`\nMatching Devices (${s.matches.length})`)),console.log("─".repeat(80)),s.matches.forEach(e=>{console.log(`${F.default.cyan(e.name||e.device_name||"Unnamed")} ${F.default.gray(e._id)}`)}),console.log("─".repeat(80))}catch(t){n?n.fail(`Failed to resolve device: ${t.message}`):(0,_.OW)(t.message,{resource:"device",query:e}),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),I.command("bind <passcode>").description("Bind a new device using passcode").option("-n, --name <name>","Device name").option("--dry-run","Validate inputs and show the device binding plan without creating a device").option("-j, --json","Output as JSON").action((u=y(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,b.default)("Checking passcode...").start();try{var r=yield o.checkBindDevicePasscode({passcode:e});r||(t.json?(0,_.OW)("Invalid passcode or expired",{action:"device.bind"}):n.fail("Invalid passcode or expired"),process.exit(1));var i={name:t.name||r.payload?.deviceName||"CLI Device",deviceName:r.payload?.deviceName||null};if(t.dryRun)return n&&n.stop(),void(0,E.S5)({action:"device.bind",target:i,request:{passcodePreview:(0,_.$l)(e),requestedName:t.name||null,inferredName:r.payload?.deviceName||null},checks:[(0,E.Iy)("passcode is valid",!0),(0,E.Iy)("device name resolved",!0,i.name)],json:t.json});n&&(n.text="Binding device...");var s=yield o.createDevice({bindPasscode:e,name:i.name,deviceName:r.payload?.deviceName});t.json?(0,E.yd)({action:"device.bind",target:x(s,s._id),result:{inferredName:r.payload?.deviceName||null},json:!0}):(n.succeed(`Device bound successfully: ${F.default.green(s.name)}`),console.log(F.default.gray(`Device ID: ${s._id}`)))}catch(e){t.json?(0,_.OW)(e.message,{action:"device.bind"}):n.fail(`Failed to bind device: ${e.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)})),I.command("remove <id>").description("Remove a device").option("--dry-run","Validate the target and show the removal plan without deleting it").option("-j, --json","Output as JSON").action((c=y(function*(e,t){var o=(0,C.requireAuth)(),n=t.json?null:(0,b.default)("Removing device...").start();try{var r=yield O(o,e),i=x(r,e);if(t.dryRun)return n&&n.stop(),void(0,E.S5)({action:"device.remove",target:i,request:{id:e},checks:[(0,E.Iy)("device exists",!0,`${i.name} (${i.id})`)],json:t.json});var s=yield o.removeDevice({id:e});t.json?(0,E.yd)({action:"device.remove",target:i,result:{removed:Boolean(s)},json:!0}):n.succeed(`Device removed: ${F.default.green(i.name)}`)}catch(o){t.json?(0,_.OW)(o.message,{action:"device.remove",target:{id:e}}):n.fail(`Failed to remove device: ${o.message}`),process.exit(1)}}),function(e,t){return c.apply(this,arguments)})),I.command("control <id> <type>").description("Control a device").option("-p, --payload <json>","Event payload as JSON").option("--dry-run","Validate inputs and show the control request without sending it").option("-j, --json","Output as JSON").action((d=y(function*(e,t,o){try{var n;o.payload&&(n=JSON.parse(o.payload)),yield A({id:e,type:t,eventPayload:n,options:o,progressMessage:`Sending ${t} to device...`,successMessage:`Control event sent: ${F.default.green(t)}`,failureMessage:"Failed to control device"})}catch(n){o.json?(0,_.OW)(n.message,{action:"device.control",target:{id:e},type:t}):console.error(F.default.red(`Failed to control device: ${n.message}`)),process.exit(1)}}),function(e,t,o){return d.apply(this,arguments)})),I.command("refresh <id>").description("Refresh device application").option("--dry-run","Validate inputs and show the refresh request without sending it").option("-j, --json","Output as JSON").action((p=y(function*(e,t){yield A({id:e,type:"refresh",options:t,progressMessage:"Refreshing device...",successMessage:"Device refreshed",failureMessage:"Failed to refresh device"})}),function(e,t){return p.apply(this,arguments)})),I.command("clear-cache <id>").description("Clear device cache").option("--dry-run","Validate inputs and show the cache-clear request without sending it").option("-j, --json","Output as JSON").action((f=y(function*(e,t){yield A({id:e,type:"clear-cache",options:t,progressMessage:"Clearing cache...",successMessage:"Cache cleared",failureMessage:"Failed to clear cache"})}),function(e,t){return f.apply(this,arguments)})),I.command("screenshot <id>").description("Take device screenshot and save to file").option("-o, --output <path>","Output file path").option("--no-take","Only fetch existing screenshot without taking a new one").action((g=y(function*(e,t){var r=(0,C.requireAuth)(),i=(0,b.default)("Fetching workspace info...").start();try{var s=yield r.workspace();s?.media_resource?.enable_media_workspace||(i.fail("Media workspace is not enabled for this workspace"),process.exit(1)),s.media_resource.system_media_box_id||(i.fail("No media box configured for this workspace"),process.exit(1)),!1!==t.take&&(i.text="Sending screenshot request to device...",yield r.controlDevice({id:e,type:"take-screenshot"}),i.text="Waiting for device to capture screenshot...",yield new Promise(e=>setTimeout(e,3e3))),i.text="Fetching screenshot...";var a=(yield(n||=Promise.all([o.e(657),o.e(336)]).then(o.bind(o,47336)),n)).fetchAndSaveScreenshot,l=yield a(r,s,e,t.output);if(l.error&&(i.fail(l.error),process.exit(1)),i.succeed("Screenshot saved"),console.log(),console.log(F.default.bold("Screenshot saved to:")),console.log(F.default.cyan(l.path)),console.log(),l.file?.meta){var u=l.file.meta,c=u.originalWidth,d=u.originalHeight,p=u.originalFileSize;if(c&&d&&console.log(`${F.default.gray("Size:")} ${c}x${d}`),p){var f=(p/1024).toFixed(1);console.log(`${F.default.gray("File:")} ${f} KB`)}}l.file?.updatedAt&&console.log(`${F.default.gray("Updated:")} ${new Date(l.file.updatedAt).toLocaleString()}`)}catch(e){i.fail(`Failed to get screenshot: ${e.message}`),process.exit(1)}}),function(e,t){return g.apply(this,arguments)})),I.command("metrics <id>").description("Show device metrics (uptime, memory, disk)").option("--start-date <date>","Start date/time (ISO 8601 or relative e.g. 1h, 2d, default: today)").option("--end-date <date>","End date/time (ISO 8601 or relative e.g. 1h, 2d, default: now)").option("-j, --json","Output as JSON").action((h=y(function*(e,t){var o=(0,C.requireAuth)(),n=(0,b.default)("Fetching device metrics...").start();try{var r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).toISOString(),s=t.startDate?(0,w.p)(t.startDate):i,a=t.endDate?(0,w.p)(t.endDate):r.toISOString(),l=yield o.deviceUsage({deviceId:e,startDate:s,endDate:a});if(n.stop(),!l||0===l.length)return void console.log(F.default.yellow("No metrics data found for this device"));if(t.json)return void console.log(JSON.stringify(l,null,2));for(var u of(console.log(F.default.bold(`\nDevice Metrics: ${e}`)),console.log("─".repeat(60)),console.log(F.default.gray(`${"Date".padEnd(12)} ${"Uptime Events".padEnd(15)} ${"Avg Memory".padEnd(12)} ${"Avg Disk".padEnd(10)}`)),console.log("─".repeat(60)),l)){var c=(u.date||"").padEnd(12),d=String(u.uptime?.length||0).padEnd(15),p="N/A";if(u.memory_usage?.length){var f=0,g=0;for(var h of u.memory_usage){var m=h.values||[],y=D(m,2),v=y[0],_=y[1];null!=v&&null!=_&&_>0&&(f+=v,g+=_)}g>0&&(p=`${(f/g*100).toFixed(1)}%`)}var $="N/A";if(u.disk_usage?.length){var E=0,k=0;for(var S of u.disk_usage){var x=S.values||[],O=D(x,2),A=O[0],I=O[1];null!=A&&null!=I&&I>0&&(E+=A,k+=I)}k>0&&($=`${(E/k*100).toFixed(1)}%`)}console.log(`${c} ${d} ${p.padEnd(12)} ${$.padEnd(10)}`)}console.log("─".repeat(60))}catch(e){n.fail(`Failed to get device metrics: ${e.message}`),process.exit(1)}}),function(e,t){return h.apply(this,arguments)})),I.command("monitor").description("Monitor device status (polls every 60s)").option("-g, --group <id>","Monitor devices in a group").option("-i, --interval <seconds>","Polling interval in seconds","60").action((m=y(function*(e){var t=(0,C.requireAuth)(),o=1e3*parseInt(e.interval,10);console.log(F.default.bold("\nDevice Monitor")),console.log(F.default.gray(`Polling every ${e.interval}s. Press Ctrl+C to stop.\n`));var n,r=(n=y(function*(){try{var o;if(o=e.group?yield t.devicesByGroup({id:e.group}):yield t.devices({}),process.stdout.write("[2J[0f"),console.log(F.default.bold("Device Monitor")+F.default.gray(` - ${(new Date).toLocaleTimeString()}`)),console.log("─".repeat(80)),!o||0===o.length)return void console.log(F.default.yellow("No devices found"));o.forEach(e=>{var t=e.entry_detail?.watch_dog_timer?.last_alive_time,o=k(t),n=e.name||e.device_name||e.device_target_name||"Unnamed",r=e.entry_detail?.application?.name||F.default.gray("No app");console.log(`${o} ${F.default.cyan(n.padEnd(25))} ${r}`)}),console.log(`\n${F.default.gray("Press Ctrl+C to stop")}`)}catch(e){console.error(F.default.red(`Error: ${e.message}`))}}),function(){return n.apply(this,arguments)});yield r(),setInterval(r,o)}),function(e){return m.apply(this,arguments)}))},84361:e=>{e.exports=import("ws")},86054:(e,t)=>{t.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));const o=e.startsWith("--");o&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let n=[],r=3;return t.forEach(t=>{if(t.length<=1)return;const o=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);const o=[];for(let t=0;t<=e.length;t++)o[t]=[t];for(let e=0;e<=t.length;e++)o[0][e]=e;for(let n=1;n<=t.length;n++)for(let r=1;r<=e.length;r++){let i=1;i=e[r-1]===t[n-1]?0:1,o[r][n]=Math.min(o[r-1][n]+1,o[r][n-1]+1,o[r-1][n-1]+i),r>1&&n>1&&e[r-1]===t[n-2]&&e[r-2]===t[n-1]&&(o[r][n]=Math.min(o[r][n],o[r-2][n-2]+1))}return o[e.length][t.length]}(e,t),i=Math.max(e.length,t.length);(i-o)/i>.4&&(o<r?(r=o,n=[t]):o===r&&n.push(t))}),n.sort((e,t)=>e.localeCompare(t)),o&&(n=n.map(e=>`--${e}`)),n.length>1?`\n(Did you mean one of ${n.join(", ")}?)`:1===n.length?`\n(Did you mean ${n[0]}?)`:""}},87016:e=>{e.exports=t("url")},88055:(e,t,o)=>{o.r(t),o.d(t,{requireAuth:()=>u});var n=o(99436),r=o(88568),i=o(74752),s=o(59138),a=new Set(["$$typeof","asymmetricMatch","catch","constructor","finally","hasOwnProperty","inspect","nodeType","toJSON","toString","valueOf"]),l=(e,t)=>{var o,r=null,i=(o=n(function*(){return r||=Promise.resolve((0,s.i)()).then(({createClient:o})=>o(e,t)),r}),function(){return o.apply(this,arguments)});return new Proxy({},{get:(e,t)=>t===Symbol.toStringTag?"BricksLazyClient":"string"!=typeof t||"then"===t||a.has(t)?void 0:n(function*(...e){var o=yield i(),n=o[t];return"function"==typeof n?n.apply(o,e):n})})},u=()=>{var e=(0,i.getCurrentProfile)(),t=(0,i.getToken)(e);return t||(console.error(r.default.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),l((0,i.getBaseUrl)(),t)}},88568:(e,t,o)=>{o.d(t,{Chalk:()=>x,backgroundColorNames:()=>u,backgroundColors:()=>u,chalkStderr:()=>R,colorNames:()=>c,colors:()=>c,default:()=>U,foregroundColorNames:()=>l,foregroundColors:()=>l,modifierNames:()=>a,modifiers:()=>a,supportsColor:()=>_,supportsColorStderr:()=>C}),o.r(t);const n=(e=0)=>t=>`[${t+e}m`,r=(e=0)=>t=>`[${38+e};5;${t}m`,i=(e=0)=>(t,o,n)=>`[${38+e};2;${t};${o};${n}m`,s={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},a=Object.keys(s.modifier),l=Object.keys(s.color),u=Object.keys(s.bgColor),c=[...l,...u];const d=function(){const e=new Map;for(const[t,o]of Object.entries(s)){for(const[t,n]of Object.entries(o))s[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},o[t]=s[t],e.set(n[0],n[1]);Object.defineProperty(s,t,{value:o,enumerable:!1})}return Object.defineProperty(s,"codes",{value:e,enumerable:!1}),s.color.close="[39m",s.bgColor.close="[49m",s.color.ansi=n(),s.color.ansi256=r(),s.color.ansi16m=i(),s.bgColor.ansi=n(10),s.bgColor.ansi256=r(10),s.bgColor.ansi16m=i(10),Object.defineProperties(s,{rgbToAnsi256:{value:(e,t,o)=>e===t&&t===o?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(o/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[o]=t;3===o.length&&(o=[...o].map(e=>e+e).join(""));const n=Number.parseInt(o,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>s.rgbToAnsi256(...s.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,o,n;if(e>=232)t=(10*(e-232)+8)/255,o=t,n=t;else{const r=(e-=16)%36;t=Math.floor(e/36)/5,o=Math.floor(r/6)/5,n=r%6/5}const r=2*Math.max(t,o,n);if(0===r)return 30;let i=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(t));return 2===r&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,o)=>s.ansi256ToAnsi(s.rgbToAnsi256(e,t,o)),enumerable:!1},hexToAnsi:{value:e=>s.ansi256ToAnsi(s.hexToAnsi256(e)),enumerable:!1}}),s}();var p=o(1708),f=o(48161),g=o(7066);function h(e,t=(globalThis.Deno?globalThis.Deno.args:p.argv)){const o=e.startsWith("-")?"":1===e.length?"-":"--",n=t.indexOf(o+e),r=t.indexOf("--");return-1!==n&&(-1===r||n<r)}const{env:m}=p;let D;function y(e,{streamIsTTY:t,sniffFlags:o=!0}={}){const n=function(){if("FORCE_COLOR"in m)return"true"===m.FORCE_COLOR?1:"false"===m.FORCE_COLOR?0:0===m.FORCE_COLOR.length?1:Math.min(Number.parseInt(m.FORCE_COLOR,10),3)}();void 0!==n&&(D=n);const r=o?D:n;if(0===r)return 0;if(o){if(h("color=16m")||h("color=full")||h("color=truecolor"))return 3;if(h("color=256"))return 2}if("TF_BUILD"in m&&"AGENT_NAME"in m)return 1;if(e&&!t&&void 0===r)return 0;const i=r||0;if("dumb"===m.TERM)return i;if("win32"===p.platform){const e=f.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in m)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(e=>e in m)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(e=>e in m)||"codeship"===m.CI_NAME?1:i;if("TEAMCITY_VERSION"in m)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(m.TEAMCITY_VERSION)?1:0;if("truecolor"===m.COLORTERM)return 3;if("xterm-kitty"===m.TERM)return 3;if("xterm-ghostty"===m.TERM)return 3;if("wezterm"===m.TERM)return 3;if("TERM_PROGRAM"in m){const e=Number.parseInt((m.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(m.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(m.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(m.TERM)||"COLORTERM"in m?1:i}function v(e,t={}){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(y(e,{streamIsTTY:e&&e.isTTY,...t}))}h("no-color")||h("no-colors")||h("color=false")||h("color=never")?D=0:(h("color")||h("colors")||h("color=true")||h("color=always"))&&(D=1);const F={stdout:v({isTTY:g.isatty(1)}),stderr:v({isTTY:g.isatty(2)})};function b(e,t,o){let n=e.indexOf(t);if(-1===n)return e;const r=t.length;let i=0,s="";do{s+=e.slice(i,n)+t+o,i=n+r,n=e.indexOf(t,i)}while(-1!==n);return s+=e.slice(i),s}const{stdout:_,stderr:C}=F,$=Symbol("GENERATOR"),E=Symbol("STYLER"),w=Symbol("IS_EMPTY"),k=["ansi","ansi","ansi256","ansi16m"],S=Object.create(null);class x{constructor(e){return O(e)}}const O=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const o=_?_.level:0;e.level=void 0===t.level?o:t.level})(t,e),Object.setPrototypeOf(t,A.prototype),t};function A(e){return O(e)}Object.setPrototypeOf(A.prototype,Function.prototype);for(const[e,t]of Object.entries(d))S[e]={get(){const o=T(this,N(t.open,t.close,this[E]),this[w]);return Object.defineProperty(this,e,{value:o}),o}};S.visible={get(){const e=T(this,this[E],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const I=(e,t,o,...n)=>"rgb"===e?"ansi16m"===t?d[o].ansi16m(...n):"ansi256"===t?d[o].ansi256(d.rgbToAnsi256(...n)):d[o].ansi(d.rgbToAnsi(...n)):"hex"===e?I("rgb",t,o,...d.hexToRgb(...n)):d[o][e](...n),j=["rgb","hex","ansi256"];for(const e of j){S[e]={get(){const{level:t}=this;return function(...o){const n=N(I(e,k[t],"color",...o),d.color.close,this[E]);return T(this,n,this[w])}}};S["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...o){const n=N(I(e,k[t],"bgColor",...o),d.bgColor.close,this[E]);return T(this,n,this[w])}}}}const B=Object.defineProperties(()=>{},{...S,level:{enumerable:!0,get(){return this[$].level},set(e){this[$].level=e}}}),N=(e,t,o)=>{let n,r;return void 0===o?(n=e,r=t):(n=o.openAll+e,r=t+o.closeAll),{open:e,close:t,openAll:n,closeAll:r,parent:o}},T=(e,t,o)=>{const n=(...e)=>P(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,B),n[$]=e,n[E]=t,n[w]=o,n},P=(e,t)=>{if(e.level<=0||!t)return e[w]?"":t;let o=e[E];if(void 0===o)return t;const{openAll:n,closeAll:r}=o;if(t.includes(""))for(;void 0!==o;)t=b(t,o.close,o.open),o=o.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,o,n){let r=0,i="";do{const s="\r"===e[n-1];i+=e.slice(r,s?n-1:n)+t+(s?"\r\n":"\n")+o,r=n+1,n=e.indexOf("\n",r)}while(-1!==n);return i+=e.slice(r),i}(t,r,n,i)),n+t+r};Object.defineProperties(A.prototype,S);const M=A(),R=A({level:C?C.level:0}),U=M},92088:(e,t,o)=>{const{InvalidArgumentError:n}=o(43823);t.Option=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;const o=function(e){let t,o;const n=e.split(/[ |,]+/);n.length>1&&!/^[[<]/.test(n[1])&&(t=n.shift());o=n.shift(),!t&&/^-[^-]$/.test(o)&&(t=o,o=void 0);return{shortFlag:t,longFlag:o}}(e);this.short=o.shortFlag,this.long=o.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return"string"==typeof e&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new n(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},t.DualOptions=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){const o=t.attributeName();if(!this.dualOptions.has(o))return!0;const n=this.negativeOptions.get(o).presetArg,r=void 0!==n&&n;return t.negate===(r===e)}}},93759:(e,t,o)=>{o.d(t,{E:()=>T});var n,r,i,s,a,l,u,c,d,p=o(68832),f=o(99436),g=o(79896),h=o(35679),m=o(88568),D=o(34992),y=o(88055),v=o(74445),F=o(74752),b=o(63402),_=o(6939),C=(n=f(function*(){return(yield Promise.resolve().then(o.bind(o,29790))).default}),function(){return n.apply(this,arguments)}),$=(r=f(function*(e,t){return e.json?null:(yield C())(t).start()}),function(e,t){return r.apply(this,arguments)}),E=(i=f(function*(){return o.e(637).then(o.bind(o,60637))}),function(){return i.apply(this,arguments)}),w=(s=f(function*(){return o.e(169).then(o.bind(o,98169))}),function(){return s.apply(this,arguments)}),k=(a=f(function*(){return Promise.all([o.e(657),o.e(7),o.e(996)]).then(o.bind(o,7996))}),function(){return a.apply(this,arguments)}),S=(l=f(function*({message:e,autoYes:t,json:o}){if(t)return!0;if(o)throw new Error("Confirmation required: pass -y/--yes together with --json");if(!(0,v.isInteractiveTerminal)())throw new Error("Refusing to prompt in a non-interactive shell. Pass -y/--yes to confirm.");try{var n=(yield E()).confirm;return yield n({message:e,default:!1})}catch{return!1}}),function(e){return l.apply(this,arguments)}),x=({spinner:e,error:t,options:o,action:n,target:r})=>{var i=t.message;i?.includes(b.GE)?i=`${b.GE} Run \`bricks data enable\` first.`:t.isBankAuthError&&(i=`${i}\nThe Data Bank key may be invalid or revoked — run \`bricks data login\` to reissue.`),o.json?(0,D.OW)(i,{action:n,...r&&{target:r}}):e?e.fail(i):console.error(m.default.red(i)),process.exit(1)},O=e=>{try{return JSON.parse(e)}catch{return e}},A=(e,t)=>{try{return JSON.parse(e)}catch{throw new Error(`Invalid JSON for ${t}`)}},I=e=>e.split(",").map(e=>e.trim()).filter(Boolean),j=e=>({name:e.name,meta:e.meta,value:(0,D.$l)(e.value),enableExpired:!!e.enableExpired,expiredAt:e.expiredAt||null,createAt:e.createAt||null,hasReadLimit:!!e.limitedReadProperties?.length,hasWriteLimit:!!e.limitedWriteProperties?.length}),B=(u=f(function*(e){var t=yield e.workspace();return t?.bank||{}}),function(e){return u.apply(this,arguments)}),N=(c=f(function*(e){var t=(yield w()).resolveBankCredentials,o=yield k(),n=o.createBankClient,r=o.resolveBankEndpoint,i=yield t(e);return n({endpoint:r((0,F.getBaseUrl)()),spacename:i.spacename,spacekey:i.spacekey})}),function(e){return c.apply(this,arguments)}),T=new h.uB("data").description("Data Bank (remote properties) management");T.command("status").description("Show Data Bank status for this workspace").option("-j, --json","Output as JSON").action((d=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Fetching Data Bank status...");try{var n=yield B(t),r=(0,F.getBankCredentials)((0,F.getCurrentProfile)()),i={enabled:!!n.enable_remote_update,spacename:n.spacename||null,keys:(n.keys||[]).map(j),cliKey:r?{keyName:r.keyName||null,spacekey:(0,D.$l)(r.spacekey),issuedAt:r.issuedAt||null}:null};if(o&&o.stop(),e.json)return void(0,D.GF)(i);console.log(m.default.bold("\nData Bank")),console.log("─".repeat(60)),console.log(`Enabled: ${i.enabled?m.default.green("Yes"):m.default.red("No")}`),console.log(`Spacename: ${i.spacename||m.default.gray("N/A")}`),console.log(`Keys: ${i.keys.length}`),console.log(`CLI Key: ${i.cliKey?`${i.cliKey.keyName||"Unnamed"} ${m.default.gray(`(${i.cliKey.spacekey})`)}`:m.default.gray("none (issued automatically on first use)")}`),console.log("─".repeat(60)),i.enabled||console.log(m.default.yellow("Run `bricks data enable` to enable Data Bank."))}catch(t){x({spinner:o,error:t,options:e,action:"data.status"})}}),function(e){return d.apply(this,arguments)}));var P,M,R,U=(P=f(function*(e,t){var o=(0,y.requireAuth)(),n=e?"data.enable":"data.disable",r=yield $(t,(e?"Enabling":"Disabling")+" Data Bank...");try{var i=yield o.updateWorkspace({enableBankRemoteUpdate:e}),s=i?.bank||{};r&&r.stop(),(0,_.yd)({action:n,target:{spacename:s.spacename||null},result:{enabled:!!s.enable_remote_update},json:t.json,message:e?`${m.default.green("Data Bank enabled.")} Spacename: ${m.default.cyan(s.spacename)}`:m.default.green("Data Bank disabled.")})}catch(e){x({spinner:r,error:e,options:t,action:n})}}),function(e,t){return P.apply(this,arguments)});T.command("enable").description("Enable Data Bank on this workspace").option("-j, --json","Output as JSON").action(e=>U(!0,e)),T.command("disable").description("Disable Data Bank on this workspace").option("-j, --json","Output as JSON").action(e=>U(!1,e)),T.command("login").description("Issue a Data Bank space key and save it to the active profile").option("--name <keyName>","Space key name","bricks-cli").option("-j, --json","Output as JSON").action((M=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Issuing Data Bank key...");try{var n=(yield w()).issueBankCredentials,r=yield n(t,{keyName:e.name});o&&o.stop(),(0,_.yd)({action:"data.login",target:{spacename:r.spacename},result:{keyName:r.keyName,spacekey:(0,D.$l)(r.spacekey),issuedAt:r.issuedAt},json:e.json,message:`${m.default.green("Data Bank key issued and saved.")} ${m.default.gray(`(${r.keyName}, stored in ${F.CONFIG_PATH})`)}`})}catch(t){x({spinner:o,error:t,options:e,action:"data.login"})}}),function(e){return M.apply(this,arguments)})),T.command("logout").description("Remove the stored Data Bank key from the active profile").option("--revoke","Also revoke the key on the workspace").option("-j, --json","Output as JSON").action((R=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Clearing Data Bank key...");try{var n=(yield w()).clearStoredBankCredentials,r=yield n(t,{revoke:e.revoke}),i=r.cleared,s=r.revoked;o&&o.stop(),(0,_.yd)({action:"data.logout",target:{profile:(0,F.getCurrentProfile)()},result:{cleared:i,revoked:s},json:e.json,message:i?m.default.green(`Data Bank key removed${s?" and revoked":""}.`):m.default.yellow("No Data Bank key stored for this profile.")})}catch(t){x({spinner:o,error:t,options:e,action:"data.logout"})}}),function(e){return R.apply(this,arguments)}));var L,J,q,V,G,W,H,K=new h.uB("keys").description("Data Bank space key management");T.addCommand(K),K.command("list").description("List Data Bank space keys (values are masked; use --json for full values)").option("-j, --json","Output as JSON (includes full key values)").action((L=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Fetching space keys...");try{var n=(yield B(t)).keys||[];if(o&&o.stop(),e.json)return void(0,D.GF)(n);if(0===n.length)return void console.log(m.default.yellow("No space keys found"));console.log(m.default.bold("\nData Bank Space Keys")),console.log("─".repeat(60)),(e=>{e.forEach(e=>{var t=e.enableExpired?`expires ${e.expiredAt}`:"no expiry",o=[e.hasReadLimit&&"read-limited",e.hasWriteLimit&&"write-limited"].filter(Boolean).join(", ");console.log(`● ${m.default.cyan(e.name||"Unnamed")} ${m.default.gray(`(${e.meta})`)}`),console.log(` Value: ${m.default.gray(e.value)}`),console.log(` Expiry: ${m.default.gray(t)}${o?m.default.gray(`, ${o}`):""}`),console.log()})})(n.map(j)),console.log("─".repeat(60))}catch(t){x({spinner:o,error:t,options:e,action:"data.keys.list"})}}),function(e){return L.apply(this,arguments)})),K.command("new <name>").description("Create a new Data Bank space key").option("--expire-at <date>","Expiry time (ISO date, between 1 hour and 90 days from now)").option("--read <propertyIds>","Limit readable properties (comma separated)").option("--write <propertyIds>","Limit writable properties (comma separated)").option("-j, --json","Output as JSON").action((J=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Creating space key...");try{if(t.expireAt&&Number.isNaN(Date.parse(t.expireAt)))throw new Error(`Invalid --expire-at date: ${t.expireAt}`);var r=yield B(o),i=new Set((r.keys||[]).map(e=>e.value)),s=yield o.updateWorkspace({newBankKey:{name:e,enableExpired:!!t.expireAt,expiredAt:t.expireAt,limitedReadProps:t.read?I(t.read):void 0,limitedWriteProps:t.write?I(t.write):void 0}}),a=s?.bank?.keys||[],l=a.find(e=>!i.has(e.value))||a.filter(t=>t.name===e).at(-1);if(!l)throw new Error("Space key was not created");n&&n.stop(),(0,_.yd)({action:"data.keys.new",target:{name:e},result:l,json:t.json,message:m.default.green(`Space key "${e}" created.`)}),t.json||(console.log(m.default.yellow("\n⚠ Copy this key now — it will not be shown again in full:")),console.log(l.value))}catch(o){x({spinner:n,error:o,options:t,action:"data.keys.new",target:{name:e}})}}),function(e,t){return J.apply(this,arguments)})),K.command("revoke <keyOrName>").description("Revoke a Data Bank space key by value or name").option("-y, --yes","Skip confirmation prompt").option("-j, --json","Output as JSON").action((q=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Resolving space key...");try{var r=(yield B(o)).keys||[],i=r.filter(t=>t.value===e);if(0===i.length&&(i=r.filter(t=>t.name===e)),0===i.length)throw new Error(`No space key matched "${e}"`);if(i.length>1)throw new Error(`Multiple space keys named "${e}"; pass the exact key value instead`);var s=p(i,1)[0];if(n&&n.stop(),!(yield S({message:`Revoke space key "${s.name}" (${(0,D.$l)(s.value)})?`,autoYes:t.yes,json:t.json})))return void console.log(m.default.yellow("Cancelled"));yield o.updateWorkspace({revokeBankKey:s.value}),(0,_.yd)({action:"data.keys.revoke",target:{name:s.name,meta:s.meta},result:{revoked:!0},json:t.json,message:m.default.green(`Space key "${s.name}" revoked.`)})}catch(e){x({spinner:n,error:e,options:t,action:"data.keys.revoke"})}}),function(e,t){return q.apply(this,arguments)})),T.command("list").description("List Data Bank properties").option("-k, --keyword <keyword>","Filter by definition title / description or tags").option("-m, --meta <meta>",`Filter by meta (${b.YC.join(" | ")})`).option("-j, --json","Output as JSON").action((V=f(function*(e){var t=(0,y.requireAuth)(),o=yield $(e,"Fetching properties...");try{(0,b.jR)(e.meta);var n=yield N(t),r=yield n.listProperties({keyword:e.keyword,meta:e.meta});if(o&&o.stop(),e.json)return void(0,D.GF)(r||[]);if(!r||0===r.length)return void console.log(m.default.yellow("No Data Bank properties found"));console.log(m.default.bold(`\nData Bank Properties (${r.length})`)),console.log("─".repeat(80)),r.forEach(e=>{var t=e.definition?.title;console.log(`● ${m.default.cyan(e.propertyId)} ${m.default.gray(`(${e.meta})`)}${t?` ${t}`:""}`),e.tags?.length&&console.log(` Tags: ${e.tags.join(", ")}`),console.log(` Value: ${(e=>{if(null==e)return m.default.gray("null");var t=JSON.stringify(e);return t.length>60?`${t.slice(0,60)}…`:t})(e.value)}`),console.log(` Updated: ${m.default.gray(e.updateAt)}`),console.log()}),console.log("─".repeat(80))}catch(t){x({spinner:o,error:t,options:e,action:"data.list"})}}),function(e){return V.apply(this,arguments)})),T.command("get <propertyId>").description("Get a Data Bank property").option("-j, --json","Output as JSON").action((G=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Fetching property...");try{var r=yield N(o),i=yield r.getProperty(e);if(!i)throw new Error(`Property not found: ${e}`);if(n&&n.stop(),t.json)return void(0,D.GF)(i);console.log(m.default.bold(`\nData Bank Property: ${i.propertyId}`)),console.log("─".repeat(60)),console.log(`Meta: ${i.meta}`),console.log(`Title: ${i.definition?.title||m.default.gray("N/A")}`),console.log(`Tags: ${i.tags?.join(", ")||m.default.gray("None")}`),console.log(`Last Note: ${i.lastUpdateNote||m.default.gray("N/A")}`),console.log(`Updated: ${m.default.gray(i.updateAt)}`),console.log(`Created: ${m.default.gray(i.createAt)}`),console.log(`\n${m.default.bold("Value")}`),console.log(JSON.stringify(i.value,null,2)),console.log(`\n${m.default.bold("Definition")}`),console.log(JSON.stringify(i.definition,null,2)),console.log("─".repeat(60))}catch(o){x({spinner:n,error:o,options:t,action:"data.get",target:{propertyId:e}})}}),function(e,t){return G.apply(this,arguments)})),T.command("set <propertyId>").description("Create or update a Data Bank property (upsert by default)").option("-v, --value <value>","New value (JSON; falls back to plain string)").option("--value-file <path>","Read the new value from a file (JSON; falls back to raw text)").option("-d, --definition <json>","Replace the property definition (JSON)").option("--definition-file <path>","Read the definition from a JSON file").option("-m, --meta <meta>",`Property meta (${b.YC.join(" | ")}), default InSubspace`).option("-t, --tags <tags>","Replace tags (comma separated)").option("-n, --note <note>","Update note","Updated via bricks-cli").option("--no-upsert","Fail when the property does not exist").option("--no-notify","Do not notify subscribed devices").option("--dry-run","Validate inputs and show the payload without sending it").option("-j, --json","Output as JSON").action((W=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Preparing property update...");try{if(void 0!==t.value&&t.valueFile)throw new Error("Use either --value or --value-file, not both");if(t.definition&&t.definitionFile)throw new Error("Use either --definition or --definition-file, not both");var r;(0,b.jR)(t.meta);var i,s=!0;void 0!==t.value?r=O(t.value):t.valueFile?r=O(g.readFileSync(t.valueFile,"utf8")):s=!1,t.definition?i=A(t.definition,"--definition"):t.definitionFile&&(i=A(g.readFileSync(t.definitionFile,"utf8"),"--definition-file"));var a=yield N(o),l=yield a.getProperty(e);if(!l&&!t.upsert)throw new Error(`Property not found: ${e} (--no-upsert)`);!s&&l&&(r=l.value);var u={propertyId:e,meta:t.meta,definition:i,value:r,updateNote:t.note,upsert:t.upsert,tags:t.tags?I(t.tags):void 0},c=!1===t.notify||void 0,d={propertyId:e,exists:!!l};if(t.dryRun)return n&&n.stop(),void(0,_.S5)({action:"data.set",target:d,request:{...u,dontNotify:c},checks:[(0,_.Iy)("property exists",!!l,l?void 0:"will be created"),(0,_.Iy)("value provided",s,s?void 0:"current value kept")],json:t.json});var f=(yield a.updateProperties([u],c))||[],h=p(f,1)[0];if(!h)throw new Error("Property was not updated");n&&n.stop(),(0,_.yd)({action:"data.set",target:d,result:h,json:t.json,message:`${m.default.green(l?"Property updated:":"Property created:")} ${h.propertyId}`})}catch(o){x({spinner:n,error:o,options:t,action:"data.set",target:{propertyId:e}})}}),function(e,t){return W.apply(this,arguments)})),T.command("remove <propertyId>").description("Remove a Data Bank property").option("-y, --yes","Skip confirmation prompt").option("--dry-run","Validate inputs and show the removal plan without sending it").option("-j, --json","Output as JSON").action((H=f(function*(e,t){var o=(0,y.requireAuth)(),n=yield $(t,"Fetching property...");try{var r=yield N(o),i=yield r.getProperty(e);if(!i)throw new Error(`Property not found: ${e}`);n&&n.stop();var s={propertyId:e,title:i.definition?.title};if(t.dryRun)return void(0,_.S5)({action:"data.remove",target:s,request:{propertyId:e},checks:[(0,_.Iy)("property exists",!0)],json:t.json});if(!(yield S({message:`Remove Data Bank property "${e}"? This cannot be undone.`,autoYes:t.yes,json:t.json})))return void console.log(m.default.yellow("Cancelled"));if(!(yield r.removeProperty(e)))throw new Error("Property was not removed");(0,_.yd)({action:"data.remove",target:s,result:{removed:!0},json:t.json,message:m.default.green(`Property removed: ${e}`)})}catch(o){x({spinner:n,error:o,options:t,action:"data.remove",target:{propertyId:e}})}}),function(e,t){return H.apply(this,arguments)}))},96525:e=>{e.exports=function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,r,i,s,a=[],l=!0,u=!1;try{if(i=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;l=!1}else for(;!(l=(n=i.call(o)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{if(!l&&null!=o.return&&(s=o.return(),Object(s)!==s))return}finally{if(u)throw r}}return a}},e.exports.__esModule=!0,e.exports.default=e.exports},96684:(e,t,o)=>{o.d(t,{Q:()=>O});var n,r,i,s,a,l,u=o(99436),c=o(35679),d=o(88568),p=o(77598),f=o(48161),g=o(76760),h=o(51455),m=o(27549),D=o(41314),y=8089,v=({timeout:e=3e3,idleTimeout:t=0,port:o=8089}={})=>new Promise((n,r)=>{var i=new Map,s=D.createSocket("udp4"),a=null,l=null,u=!1,c=()=>{if(!u){u=!0,clearTimeout(a),clearTimeout(l);try{s.close()}catch{}n([...i.values()])}};s.on("error",e=>{if(!u){u=!0,clearTimeout(a),clearTimeout(l);try{s.close()}catch{}r(e)}}),s.on("message",(e,o)=>{try{var n=JSON.parse(e.toString());if("2.0"!==n.v)return;if("ANNOUNCE"!==n.t&&"RESPONSE"!==n.t)return;var r=n.d?.info;if(!r)return;var s={...r,address:o.address},a=s.id||`${o.address}:${s.port}`;i.has(a)||(i.set(a,s),t&&!u&&(clearTimeout(l),l=setTimeout(c,t)))}catch{}}),s.bind(()=>{s.setBroadcast(!0);var t=Buffer.from(JSON.stringify({t:"QUERY",v:"2.0",d:{id:`cli-${Math.random().toString(36).slice(2,9)}`}}));for(var n of(()=>{var e=new Set(["255.255.255.255","127.0.0.1"]),t=f.networkInterfaces();for(var o of Object.values(t)){var n=function(){if("IPv4"!==r.family||r.internal)return 1;var t=r.address.split(".").map(Number),o=r.netmask.split(".").map(Number),n=t.map((e,t)=>(e|255&~o[t]).toString()).join(".");e.add(n)};for(var r of o)n()}return[...e]})())s.send(t,0,t.length,o,n);a=setTimeout(c,e)})}),F=(n=u(function*(e,t,o=3e3){var n;try{var r=new AbortController;n=setTimeout(()=>r.abort(),o);var i=yield fetch(`http://${e}:${t}/buttress/info`,{signal:r.signal});return i.ok?yield i.json():null}catch{return null}finally{void 0!==n&&clearTimeout(n)}}),function(e,t){return n.apply(this,arguments)}),b=g.join(f.homedir(),".bricks-cli","buttress"),_=e=>e||b,C=e=>g.join(_(e),"state.json"),$=()=>{try{return`buttress-${m.machineIdSync()}`}catch{return null}},E=function(){var e=u(function*(e){var t=C(e);try{var o=yield h.readFile(t,"utf8");return JSON.parse(o)}catch(e){if("ENOENT"===e.code)return null;throw e}});return function(t){return e.apply(this,arguments)}}(),w=(r=u(function*(e,t){var o=_(t),n=C(t);yield h.mkdir(o,{recursive:!0});var r=`${n}.tmp-${process.pid}`;return yield h.writeFile(r,JSON.stringify(e,null,2),"utf8"),yield h.rename(r,n),n}),function(e,t){return r.apply(this,arguments)}),k=(i=u(function*(e){var t=C(e);try{return yield h.unlink(t),!0}catch(e){if("ENOENT"===e.code)return!1;throw e}}),function(e){return i.apply(this,arguments)}),S=(s=u(function*({timeout:e=3e3,verify:t=!0,port:o=8089,onStatus:n}={}){n?.(`Scanning UDP ${o} for ${e}ms...`);var r=yield v({timeout:e,port:o});if(0===r.length)return[];if(!t)return r;n?.(`Verifying ${r.length} server(s)...`);var i,s=yield Promise.all(r.map((i=u(function*(e){var t=yield F(e.address,e.port,2e3);return t?{...e,...t,address:e.address,verified:!0}:{...e,verified:!1}}),function(e){return i.apply(this,arguments)})));return s}),function(){return s.apply(this,arguments)}),x=function(){var e=u(function*(){var e=yield Promise.resolve().then(o.bind(o,74752)),t=e.getToken,n=e.getBaseUrl,r=e.getCurrentProfile,i=(yield Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(700)]).then(o.bind(o,50700))).createClient,s=t(r());return s||(console.error(d.default.red("Not logged in. Use `bricks auth login` first.")),process.exit(1)),i(n(),s)});return function(){return e.apply(this,arguments)}}(),O=new c.uB("buttress").description("Pair and inspect buttress-server bindings for the current workspace").alias("butr");O.command("bind").description("Pair a local buttress-server with the current workspace").option("-s, --server-id <id>","Buttress server id (auto-detected from machine id by default)").option("-n, --name <name>","Friendly name for this buttress server").option("--state-dir <dir>","Override the buttress state directory (defaults to ~/.bricks-cli/buttress)").option("--print","Print state.json to stdout instead of writing to disk (useful for remote setups)").action(function(){var e=u(function*(e){var t=(yield Promise.resolve().then(o.bind(o,29790))).default,n=e.serverId||$();n||(console.error(d.default.red("Could not detect a local server id. Pass --server-id <id> explicitly.")),process.exit(1));var r,i,s,a,l,u,c=(r=p.generateKeyPairSync("ed25519"),i=r.publicKey,s=r.privateKey,a=i.export({type:"spki",format:"der"}),l=s.export({type:"pkcs8",format:"der"}),u=p.createHash("sha256").update(a).digest("hex").slice(0,16),{publicKeySpki:a.toString("base64"),privateKeyPkcs8:l.toString("base64"),kid:u}),f=yield x(),g=t(`Binding buttress server ${d.default.cyan(n)}...`).start();try{var h=yield f.bindButtressServer({serverId:n,name:e.name,serverPublicKey:{spkiBase64:c.publicKeySpki,kid:c.kid}});g.stop();var m={workspace:{id:h.workspaceId,name:h.workspaceName,serverId:h.serverId,issuerPublicKey:h.issuerPublicKey.pem,kid:h.issuerPublicKey.kid,boundAt:(new Date).toISOString()},serverKeyPair:c};if(e.print)return console.warn(d.default.yellow("⚠ Output contains the server announce private key. Treat as a secret.")),void process.stdout.write(`${JSON.stringify(m,null,2)}\n`);var D=yield w(m,e.stateDir);console.log(d.default.green("✓"),"Buttress server bound to workspace."),console.log(` Workspace: ${d.default.bold(h.workspaceName)} (${h.workspaceId})`),console.log(` Server id: ${d.default.cyan(h.serverId)}`),console.log(` Issuer kid: ${d.default.gray(h.issuerPublicKey.kid)}`),console.log(` Announce kid: ${d.default.gray(c.kid)}`),console.log(` State file: ${d.default.gray(D)}`),console.log(),console.log(d.default.yellow("Restart buttress-server for the binding to take effect."))}catch(e){g.fail(`Bind failed: ${e.message}`),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),O.command("unbind").description("Unbind a buttress server from this workspace").option("-s, --server-id <id>","Buttress server id (auto-detected by default)").option("--state-dir <dir>","Override the buttress state directory").option("--keep-local","Do not remove the local state.json file").action(function(){var e=u(function*(e){var t=e.serverId||$();t||(console.error(d.default.red("Could not detect a local server id. Pass --server-id explicitly.")),process.exit(1));var o=yield x();try{if((yield o.unbindButtressServer({serverId:t}))?console.log(d.default.green("✓"),`Unbound ${d.default.cyan(t)} from workspace.`):console.log(d.default.yellow("!"),`${d.default.cyan(t)} was not bound to this workspace.`),!e.keepLocal){var n=C(e.stateDir),r=yield E(e.stateDir);r?.workspace?.serverId===t&&(yield k(e.stateDir),console.log(d.default.gray(`Removed local state file: ${n}`)))}}catch(e){console.error(d.default.red(`Unbind failed: ${e.message}`)),process.exit(1)}});return function(t){return e.apply(this,arguments)}}()),O.command("status").description("Show local buttress binding state and the workspace-side bound list").option("--state-dir <dir>","Override the buttress state directory").option("-j, --json","Output as JSON").action(function(){var e=u(function*(e){var t=yield E(e.stateDir),o=null;try{var n=yield x();o=yield n.buttressServers()}catch(e){o={error:e.message}}e.json?console.log(JSON.stringify({local:t,remote:o},null,2)):(console.log(d.default.bold("\nLocal buttress state")),console.log("─".repeat(60)),t?.workspace?(console.log(` Workspace: ${d.default.bold(t.workspace.name)} (${t.workspace.id})`),console.log(` Server id: ${d.default.cyan(t.workspace.serverId)}`),console.log(` Issuer kid: ${d.default.gray(t.workspace.kid)}`),console.log(` Bound at: ${d.default.gray(t.workspace.boundAt)}`),console.log(` File: ${d.default.gray(C(e.stateDir))}`)):console.log(d.default.gray(" not bound (no state.json found)")),console.log(d.default.bold("\nWorkspace-side bound servers")),console.log("─".repeat(60)),Array.isArray(o)?0===o.length?console.log(d.default.gray(" none")):o.forEach(e=>{console.log(` ${d.default.cyan(e.serverId)} ${d.default.gray(e.name||"")} ${d.default.gray(e.boundAt||"")}`)}):o?.error&&console.log(d.default.red(` failed to fetch: ${o.error}`)))});return function(t){return e.apply(this,arguments)}}()),O.command("issue-token").description("Issue a long-lived workspace-scoped buttress access token (CLI/CTOR usage)").option("--ttl <seconds>","Time-to-live in seconds (default 30 days)",e=>parseInt(e,10)).option("-j, --json","Output as JSON").action((a=u(function*(e){var t=yield x();try{var o=yield t.issueButtressAccessToken({ttlSeconds:e.ttl});if(e.json)return void console.log(JSON.stringify(o,null,2));console.log(d.default.green("✓"),"Buttress access token issued."),console.log(` Workspace: ${o.workspaceId}`),console.log(` Expires: ${o.expiresAt}`),console.log(` jti: ${d.default.gray(o.jti)}`),console.log(),console.log(d.default.cyan(o.token))}catch(e){console.error(d.default.red(`Issue token failed: ${e.message}`)),process.exit(1)}}),function(e){return a.apply(this,arguments)})),O.command("scan").description("Scan LAN for buttress-servers via UDP and verify each via /buttress/info").option("-t, --timeout <ms>","Scan timeout in milliseconds","3000").option("-p, --port <port>","UDP discovery port",String(y)).option("--udp-only","Skip HTTP /buttress/info verification").option("-j, --json","Output as JSON").action((l=u(function*(e){var t=(yield Promise.resolve().then(o.bind(o,29790))).default,n=yield Promise.resolve().then(o.bind(o,74752)),r=n.getCurrentProfile,i=n.getTokenInfo,s=parseInt(e.timeout,10),a=parseInt(e.port,10),l=[],u=t(`Scanning for buttress-servers (${s}ms)...`).start();try{l=yield S({timeout:s,port:a,verify:!e.udpOnly,onStatus:e=>{u.text=e}}),u.stop()}catch(e){u.fail(`Scan failed: ${e.message}`),process.exit(1)}var c=r(),p=i(c)?.workspaceId||null;if(e.json)console.log(JSON.stringify({servers:l,workspaceId:p},null,2));else if(0!==l.length){for(var f of(console.log(d.default.bold(`\nFound ${l.length} buttress-server(s)`)),console.log("─".repeat(70)),l)){var g=!1===f.verified?d.default.red("unverified"):d.default.green("online"),h=f.workspace?.id,m=h&&p&&h===p,D=f.authentication?.bound?d.default.yellow("JWT required"):d.default.gray("open");console.log(` ${d.default.bold(f.name||"Unknown")} ${d.default.gray(`(${f.address}:${f.port})`)} [${g}]`),f.id&&console.log(` Server id: ${d.default.cyan(f.id)}`),f.version&&console.log(` Version: ${d.default.green(f.version)}`);var y=f.authentication?.kid?d.default.gray(` (kid: ${f.authentication.kid})`):"";if(console.log(` Auth: ${D}${y}`),h){var v=m?d.default.green(`${h} ${d.default.bold("(current profile)")}`):d.default.gray(h);console.log(` Workspace: ${v}`)}if(Array.isArray(f.generators)&&f.generators.length>0)for(var F of(console.log(" Generators:"),f.generators)){var b=[];"number"==typeof F.score&&b.push(`score ${F.score.toFixed(1)}`),!0===F.hasGpu?b.push("GPU ✓"):!1===F.hasGpu&&b.push("GPU ✗"),"number"==typeof F.usableBytes&&b.push(`${(F.usableBytes/1024**3).toFixed(1)} GB usable`);var _=b.length>0?` ${d.default.gray(b.join(" "))}`:"";console.log(` - ${d.default.cyan(F.type)}${_}`)}}console.log("─".repeat(70)),l.some(e=>e.authentication?.bound)&&(console.log(),console.log(d.default.gray("To connect to a bound server, run `bricks buttress issue-token` for a workspace access token.")))}else console.log(d.default.yellow("No buttress-servers found on the LAN."))}),function(e){return l.apply(this,arguments)}))},96739:(e,t,o)=>{o.d(t,{u:()=>D});var n,r,i,s,a,l,u,c=o(68832),d=o(99436),p=o(35679),f=()=>(n||(n=Promise.all([Promise.resolve().then(o.bind(o,88568)),Promise.resolve().then(o.bind(o,29790)),Promise.resolve().then(o.bind(o,88055)),Promise.all([o.e(657),o.e(336)]).then(o.bind(o,47336))]).then(([e,t,o,n])=>({chalk:e.default,ora:t.default,requireAuth:o.requireAuth,isMediaEnabled:n.isMediaEnabled,buildScreenshotUrl:n.buildScreenshotUrl}))),n),g=(i=d(function*(e,t){var o=yield e.workspace();if(!t.isMediaEnabled(o))throw new Error("Media workspace not enabled for this workspace")}),function(e,t){return i.apply(this,arguments)}),h=e=>{var t=e.meta||{};if(!t.originalFileUploaded)return{ready:!1,label:"Uploading"};if("Video"===e.fileType){if(!t.videoThumbOriginalFileKey)return{ready:!1,label:"Processing"};if(!t.convertedFileUploaded)return{ready:!1,label:"Transcoding"}}return{ready:!0,label:"Ready"}},m=(e,t)=>e.ready?t.green(e.label):t.yellow(e.label),D=new p.uB("media").description("Media Flow support");D.command("boxes").description("List Media Flow boxes").option("-j, --json","Output as JSON").action((s=d(function*(e){var t=yield f(),o=t.chalk,n=t.requireAuth(),r=t.ora("Fetching media boxes...").start();try{yield g(n,t);var i=yield n.mediaBoxes();if(r.stop(),e.json)return void console.log(JSON.stringify(i,null,2));if(!i||0===i.length)return void console.log(o.yellow("No media boxes found"));console.log(o.bold("\nMedia Boxes")),console.log("─".repeat(80)),i.forEach(e=>{console.log(`${o.cyan(e.name||"Unnamed")} ${o.gray(e.id)}`),e.description&&console.log(` ${e.description}`),e.tags?.length&&console.log(` Tags: ${e.tags.join(", ")}`),null!=e.size&&console.log(` Size: ${e.size}`),console.log()})}catch(e){r.fail(`Failed to list media boxes: ${e.message}`),process.exit(1)}}),function(e){return s.apply(this,arguments)})),D.command("box <id>").description("Get Media Flow box details").option("-j, --json","Output as JSON").action((a=d(function*(e,t){var o=yield f(),n=o.chalk,r=o.requireAuth(),i=o.ora("Fetching media box...").start();try{yield g(r,o);var s=yield r.mediaBox({id:e});if(i.stop(),s||(console.log(n.red("Media box not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(s,null,2));console.log(n.bold(`\nMedia Box: ${s.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`ID: ${n.gray(s.id)}`),console.log(`Description: ${s.description||n.gray("N/A")}`),console.log(`Tags: ${s.tags?.join(", ")||n.gray("None")}`),null!=s.size&&console.log(`Size: ${s.size}`),s.passcodes?.length&&(console.log(`\n${n.bold("Passcodes")}`),s.passcodes.forEach(e=>{console.log(`- ${e.name||"Passcode"}: ${e.code}`)})),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get media box: ${e.message}`),process.exit(1)}}),function(e,t){return a.apply(this,arguments)})),D.command("files <boxId>").description("List Media Flow files in a box").option("-t, --types <types>","Comma-separated file types to include").option("-u, --user-tag <tag>","Filter by user tag (repeatable)",(e,t)=>[...t,e],[]).option("-l, --limit <limit>","Limit results",e=>Number.parseInt(e,10)).option("-o, --offset <offset>","Offset results",e=>Number.parseInt(e,10)).option("-j, --json","Output as JSON").action((l=d(function*(e,t){var o=yield f(),n=o.chalk,r=o.requireAuth(),i=o.ora("Fetching media files...").start();try{yield g(r,o);var s=t.types?t.types.split(",").map(e=>e.trim()).filter(Boolean):void 0,a=t.userTag?.length?t.userTag:void 0,l=yield r.mediaFiles({boxId:e,includeTypes:s,userTags:a,limit:t.limit,offset:t.offset});if(i.stop(),t.json)return void console.log(JSON.stringify(l,null,2));if(!l||0===l.length)return void console.log(n.yellow("No media files found"));console.log(n.bold(`\nMedia Files (${l.length})`)),console.log("─".repeat(100)),l.forEach(e=>{var t=h(e);console.log(`${n.cyan(e.name||"Unnamed")} ${n.gray(e.id)}`),console.log(` Type: ${e.fileType} Status: ${m(t,n)}`),e.userTags?.length&&console.log(` Tags: ${e.userTags.join(", ")}`),e.updatedAt&&console.log(` Updated: ${new Date(e.updatedAt).toLocaleString()}`),console.log()})}catch(e){i.fail(`Failed to list media files: ${e.message}`),process.exit(1)}}),function(e,t){return l.apply(this,arguments)})),D.command("file <id>").description("Get Media Flow file details").option("-j, --json","Output as JSON").action((u=d(function*(e,t){var o=yield f(),n=o.chalk,r=o.requireAuth(),i=o.ora("Fetching media file...").start();try{yield g(r,o);var s=yield r.mediaFile({id:e});if(i.stop(),s||(console.log(n.red("Media file not found")),process.exit(1)),t.json)return void console.log(JSON.stringify(s,null,2));var a=h(s);console.log(n.bold(`\nMedia File: ${s.name||"Unnamed"}`)),console.log("─".repeat(60)),console.log(`ID: ${n.gray(s.id)}`),console.log(`Box ID: ${n.gray(s.boxId)}`),console.log(`Type: ${s.fileType}`),console.log(`Status: ${m(a,n)}`),console.log(`Description: ${s.description||n.gray("N/A")}`),console.log(`Tags: ${s.userTags?.join(", ")||n.gray("None")}`),console.log(`Created: ${n.gray(s.createdAt||"N/A")}`),console.log(`Updated: ${n.gray(s.updatedAt||"N/A")}`);var l=o.buildScreenshotUrl(s),u=o.buildScreenshotUrl(s,{preferThumbnail:!0});s.meta?.originalFileKey&&console.log(`Original Key: ${n.gray(s.meta.originalFileKey)}`),l&&console.log(`Original URL: ${n.gray(l)}`),u&&u!==l&&console.log(`Thumbnail URL: ${n.gray(u)}`),console.log("─".repeat(60))}catch(e){i.fail(`Failed to get media file: ${e.message}`),process.exit(1)}}),function(e,t){return u.apply(this,arguments)}));var y,v,F=e=>{var t=e.match(/^(\d+)x(\d+)(?::(\w+))?$/);if(!t)throw new Error(`Invalid image version spec: "${e}". Expected format: WxH or WxH:STRATEGY`);return{width:parseInt(t[1],10),height:parseInt(t[2],10),strategy:(t[3]||"FILL").toUpperCase(),copypreview:!1}},b=(y=d(function*(e,t,o,n,r){var i=new FormData;for(var s of Object.entries(t)){var a=c(s,2),l=a[0],u=a[1];i.append(l,u)}i.append("file",new Blob([o],{type:r}),n);var d=yield fetch(e,{method:"POST",body:i});if(!d.ok&&204!==d.status){var p=yield d.text().catch(()=>"");throw new Error(`S3 upload failed (${d.status}): ${p}`)}}),function(e,t,o,n,r){return y.apply(this,arguments)});D.command("upload <boxId> <files...>").description("Upload file(s) to a Media Flow box").option("-d, --description <text>","File description","").option("-t, --user-tag <tag>","User tag (repeatable, max 15)",(e,t)=>[...t,e],[]).option("--image-version <spec>","Image resize spec as WxH or WxH:STRATEGY (repeatable)",(e,t)=>[...t,e],[]).option("--image-version-type <type>","Image output format: jpg or png").option("--enable-ai-analysis","Enable AI analysis on uploaded files").option("--ai-instruction <text>","Custom AI analysis instruction").option("--concurrency <n>","Max concurrent uploads",e=>parseInt(e,10),3).option("-j, --json","Output as JSON").action((v=d(function*(e,t,n){var i,s,a=yield f(),l=yield(r||(r=Promise.all([Promise.resolve().then(o.t.bind(o,51455,19)),Promise.resolve().then(o.t.bind(o,76760,19)),o.e(90).then(o.t.bind(o,86090,19)),o.e(209).then(o.bind(o,56209))]).then(([e,t,o,n])=>({readFile:e.readFile,stat:e.stat,basename:t.basename,resolve:t.resolve,lookup:o.lookup,runWithConcurrency:n.runWithConcurrency}))),r),u=a.chalk,c=a.requireAuth(),p=a.ora("Preparing upload...").start();try{if(yield g(c,a),n.userTag.length>15)throw new Error("Maximum 15 user tags allowed");var h=n.imageVersion.map(F),m=n.enableAiAnalysis||!!n.aiInstruction,D=yield Promise.all(t.map((s=d(function*(e){var t=l.resolve(e),o=yield l.stat(t).catch(()=>null);if(!o||!o.isFile())throw new Error(`Not a file: ${e}`);var n=l.basename(t);return{filePath:t,fileName:n,contentType:l.lookup(n)||"application/octet-stream",size:o.size}}),function(e){return s.apply(this,arguments)})));p.stop();var y=D.length;console.log(u.bold(`\nUploading ${y} file${y>1?"s":""} to box ${u.gray(e)}...\n`));var v=[];yield l.runWithConcurrency(D,n.concurrency,(i=d(function*(t,o){var r,i,s=`[${o+1}/${y}] ${t.fileName}`,d=a.ora(`${s} — requesting upload...`).start();try{var p=(i=t.contentType)?"image/svg+xml"===i?"FILE":i.startsWith("image/")?"IMAGE":i.startsWith("video/")?"VIDEO":i.startsWith("audio/")?"AUDIO":"FILE":"FILE",f={imageVersions:"IMAGE"===p?h:[],imageVersionType:"IMAGE"===p?n.imageVersionType:void 0,enableAiAnalysis:m,aiCustomInstruction:n.aiInstruction||void 0},g=yield c.createMediaFileUploadRequest({name:t.fileName,description:n.description,boxId:e,fileType:p,contentType:t.contentType,userTags:n.userTag.length?n.userTag:[],meta:f});d.text=`${s} — uploading to storage...`;var D=JSON.parse(g.meta.uploadInfo),F=yield l.readFile(t.filePath);yield b(D.url,{AWSAccessKeyId:D.AWSAccessKeyId,"Content-Type":D["Content-Type"],key:D.key,Signature:D.Signature,Policy:D.Policy,acl:D.acl},F,t.fileName,t.contentType),d.succeed(`${s} ${u.green("✓")} ${u.gray(`(${p}, ${r=t.size,r<1024?`${r} B`:r<1048576?`${(r/1024).toFixed(1)} KB`:r<1073741824?`${(r/1048576).toFixed(1)} MB`:`${(r/1073741824).toFixed(1)} GB`})`)}`),v.push({file:t.fileName,id:g.id,status:"success",fileType:p,size:t.size})}catch(e){d.fail(`${s} — ${e.message}`),v.push({file:t.fileName,id:null,status:"failed",error:e.message})}}),function(e,t){return i.apply(this,arguments)}));var _=v.filter(e=>"success"===e.status).length,C=v.filter(e=>"failed"===e.status).length;n.json?console.log(JSON.stringify({boxId:e,results:v,summary:{total:y,success:_,failed:C}},null,2)):(console.log(),0===C?console.log(u.green(`Uploaded ${_}/${y} files`)):console.log(u.yellow(`Uploaded ${_}/${y} files (${C} failed)`))),C>0&&process.exit(1)}catch(e){p.fail(`Upload failed: ${e.message}`),process.exit(1)}}),function(e,t,o){return v.apply(this,arguments)}))},99436:e=>{function t(e,t,o,n,r,i,s){try{var a=e[i](s),l=a.value}catch(e){return void o(e)}a.done?t(l):Promise.resolve(l).then(n,r)}e.exports=function(e){return function(){var o=this,n=arguments;return new Promise(function(r,i){var s=e.apply(o,n);function a(e){t(s,r,i,a,l,"next",e)}function l(e){t(s,r,i,a,l,"throw",e)}a(void 0)})}},e.exports.__esModule=!0,e.exports.default=e.exports},99456:(e,t,o)=>{o.d(t,{l:()=>a});var n=o(99436),r=o(35679),i=o(34992),s=()=>Promise.all([o.e(657),o.e(7),o.e(480),o.e(378),o.e(700),o.e(627)]).then(o.bind(o,33627)),a=(({loadDoctorModule:e=s}={})=>{return new r.uB("doctor").description("Check CLI configuration, auth state, and workspace reachability").option("-j, --json","Output as JSON").action((t=n(function*(t){try{var o=yield e(),n=o.buildDoctorReport,r=o.renderDoctorReport,s=yield n();if(t.json)return void(0,i.GF)(s);console.log(r(s))}catch(e){t.json?(0,i.OW)(e.message):console.error(`Doctor failed: ${e.message}`),process.exit(1)}}),function(e){return t.apply(this,arguments)}));var t})()},99690:(e,t,o)=>{const{humanReadableArgName:n}=o(41762);t.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){const t=e.commands.filter(e=>!e._hidden),o=e._getHelpCommand();return o&&!o._hidden&&t.push(o),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){const o=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return o(e).localeCompare(o(t))}visibleOptions(e){const t=e.options.filter(e=>!e.hidden),o=e._getHelpOption();if(o&&!o.hidden){const n=o.short&&e._findOption(o.short),r=o.long&&e._findOption(o.long);n||r?o.long&&!r?t.push(e.createOption(o.long,o.description)):o.short&&!n&&t.push(e.createOption(o.short,o.description)):t.push(o)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let o=e.parent;o;o=o.parent){const e=o.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){const t=e.registeredArguments.map(e=>n(e)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,o)=>Math.max(e,t.subcommandTerm(o).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,o)=>Math.max(e,t.optionTerm(o).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,o)=>Math.max(e,t.optionTerm(o).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,o)=>Math.max(e,t.argumentTerm(o).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let o="";for(let t=e.parent;t;t=t.parent)o=t.name()+" "+o;return o+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue){(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}return void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){const o=`(${t.join(", ")})`;return e.description?`${e.description} ${o}`:o}return e.description}formatHelp(e,t){const o=t.padWidth(e,t),n=t.helpWidth||80;function r(e,r){if(r){const i=`${e.padEnd(o+2)}${r}`;return t.wrap(i,n-2,o+2)}return e}function i(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let s=[`Usage: ${t.commandUsage(e)}`,""];const a=t.commandDescription(e);a.length>0&&(s=s.concat([t.wrap(a,n,0),""]));const l=t.visibleArguments(e).map(e=>r(t.argumentTerm(e),t.argumentDescription(e)));l.length>0&&(s=s.concat(["Arguments:",i(l),""]));const u=t.visibleOptions(e).map(e=>r(t.optionTerm(e),t.optionDescription(e)));if(u.length>0&&(s=s.concat(["Options:",i(u),""])),this.showGlobalOptions){const o=t.visibleGlobalOptions(e).map(e=>r(t.optionTerm(e),t.optionDescription(e)));o.length>0&&(s=s.concat(["Global Options:",i(o),""]))}const c=t.visibleCommands(e).map(e=>r(t.subcommandTerm(e),t.subcommandDescription(e)));return c.length>0&&(s=s.concat(["Commands:",i(c),""])),s.join("\n")}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,o,n=40){const r=new RegExp("[\\n][ \\f\\t\\v - \ufeff]+");if(e.match(r))return e;const i=t-o;if(i<n)return e;const s=e.slice(0,o),a=e.slice(o).replace("\r\n","\n"),l=" ".repeat(o),u="\\s",c=new RegExp(`\n|.{1,${i-1}}([${u}]|$)|[^${u}]+?([${u}]|$)`,"g");return s+(a.match(c)||[]).map((e,t)=>"\n"===e?"":(t>0?l:"")+e.trimEnd()).join("\n")}}}},D={};function y(e){var t=D[e];if(void 0!==t)return t.exports;var o=D[e]={id:e,loaded:!1,exports:{}};return m[e].call(o.exports,o,o.exports,y),o.loaded=!0,o.exports}y.m=m,a="function"==typeof Symbol,l=a?Symbol("webpack queues"):"__webpack_queues__",u=a?Symbol("webpack exports"):"__webpack_exports__",c=a?Symbol("webpack error"):"__webpack_error__",d=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},y.a=(e,t,o)=>{var n;o&&((n=[]).d=-1);var r,i,s,a=new Set,p=e.exports,f=new Promise((e,t)=>{s=t,i=e});f[u]=p,f[l]=e=>(n&&e(n),a.forEach(e),f.catch(e=>{})),e.exports=f,t(e=>{var t;r=(e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[l])return e;if(e.then){var t=[];t.d=0,e.then(e=>{o[u]=e,d(t)},e=>{o[c]=e,d(t)});var o={};return o[l]=e=>e(t),o}}var n={};return n[l]=e=>{},n[u]=e,n}))(e);var o=()=>r.map(e=>{if(e[c])throw e[c];return e[u]}),i=new Promise(e=>{(t=()=>e(o)).r=0;var i=e=>e!==n&&!a.has(e)&&(a.add(e),e&&!e.d&&(t.r++,e.push(t)));r.map(e=>e[l](i))});return t.r?i:o()},e=>(e?s(f[c]=e):i(p),d(n))),n&&n.d<0&&(n.d=0)},y.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return y.d(t,{a:t}),t},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,y.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var o=Object.create(null);y.r(o);var n={};p=p||[null,f({}),f([]),f(f)];for(var r=2&t&&e;("object"==typeof r||"function"==typeof r)&&!~p.indexOf(r);r=f(r))Object.getOwnPropertyNames(r).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,y.d(o,n),o},y.d=(e,t)=>{for(var o in t)y.o(t,o)&&!y.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},y.f={},y.e=e=>Promise.all(Object.keys(y.f).reduce((t,o)=>(y.f[o](e,t),t),[])),y.u=e=>e+".js",y.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),y.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),g={57:0},h=e=>{var t,o,{__webpack_esm_ids__:n,__webpack_esm_modules__:r,__webpack_esm_runtime__:i}=e,s=0;for(t in r)y.o(r,t)&&(y.m[t]=r[t]);for(i&&i(y);s<n.length;s++)o=n[s],y.o(g,o)&&g[o]&&g[o][0](),g[n[s]]=0},y.f.j=(e,t)=>{var o=y.o(g,e)?g[e]:void 0;if(0!==o)if(o)t.push(o[1]);else{var n=import("./"+y.u(e)).then(h,t=>{throw 0!==g[e]&&(g[e]=void 0),t});n=Promise.race([n,new Promise(t=>o=g[e]=[t])]),t.push(o[1]=n)}};var v=y(444);const F=(v=await v).A,b=v.e;export{F as default,b as run};
|